[MOV] web,base_automation: hotkeys from webclient/ to core/

The hotkeys feature is a core feature, not only useful for the webclient.

closes odoo-dev/odoo#942

Related: odoo-dev/enterprise#172
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Bruno Boi
2021-06-18 21:31:32 +02:00
committed by Aaron Bohy
parent fc7c431840
commit aab6f88439
17 changed files with 21 additions and 24 deletions
@@ -6,7 +6,7 @@ import { errorService } from "@web/core/errors/error_service";
import { dialogService } from "@web/core/dialog/dialog_service";
import { notificationService } from "@web/core/notifications/notification_service";
import { uiService } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { registerCleanup } from "@web/../tests/helpers/cleanup";
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
import { makeFakeRPCService, makeFakeLocalizationService } from "@web/../tests/helpers/mock_services";
@@ -1,8 +1,8 @@
/** @odoo-module **/
import { isMacOS } from "../../core/browser/feature_detection";
import { registry } from "../../core/registry";
import { browser } from "../../core/browser/browser";
import { isMacOS } from "../browser/feature_detection";
import { registry } from "../registry";
import { browser } from "../browser/browser";
export function getHotkeyToPress(hotkey, altIsOptional = false) {
let result = hotkey.split("+");
@@ -1,7 +1,7 @@
/** @odoo-module **/
import { registry } from "../../core/registry";
import { getHotkeyToPress } from "../hotkeys/hotkey_service";
import { getHotkeyToPress } from "../../core/hotkeys/hotkey_service";
import { CommandPaletteDialog } from "./command_palette_dialog";
/**
@@ -8,7 +8,7 @@ import { debugService } from "@web/core/debug/debug_service";
import { ormService } from "@web/core/orm_service";
import { uiService } from "@web/core/ui_service";
import { ActionDialog } from "@web/webclient/actions/action_dialog";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { registerCleanup } from "../../helpers/cleanup";
import { makeTestEnv, prepareRegistriesWithCleanup } from "../../helpers/mock_env";
import { makeFakeDialogService, makeFakeLocalizationService } from "../../helpers/mock_services";
@@ -7,7 +7,7 @@ import { errorService } from "@web/core/errors/error_service";
import { registry } from "@web/core/registry";
import { notificationService } from "@web/core/notifications/notification_service";
import { uiService } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { registerCleanup } from "../helpers/cleanup";
import { clearRegistryWithCleanup, makeTestEnv } from "../helpers/mock_env";
import { makeFakeLocalizationService, makeFakeRPCService } from "../helpers/mock_services";
+1 -1
View File
@@ -3,7 +3,7 @@
import { registry } from "@web/core/registry";
import { useService } from "@web/core/service_hook";
import { uiService } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { Dialog } from "@web/core/dialog/dialog";
import { makeTestEnv } from "../helpers/mock_env";
import { click, getFixture, nextTick } from "../helpers/utils";
@@ -2,7 +2,7 @@
import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { makeTestEnv } from "../helpers/mock_env";
import { click, getFixture, makeDeferred, nextTick, triggerHotkey } from "../helpers/utils";
@@ -11,7 +11,7 @@ import {
} from "@web/core/errors/error_dialogs";
import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { makeTestEnv } from "../../helpers/mock_env";
import { makeFakeDialogService, makeFakeLocalizationService } from "../../helpers/mock_services";
import { click, getFixture, nextTick, patchWithCleanup } from "../../helpers/utils";
@@ -4,7 +4,7 @@ import { browser } from "@web/core/browser/browser";
import { useHotkey } from "@web/core/hotkey_hook";
import { registry } from "@web/core/registry";
import { uiService, useActiveElement } from "@web/core/ui_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { makeTestEnv } from "../../helpers/mock_env";
import { getFixture, nextTick, patchWithCleanup, triggerHotkey } from "../../helpers/utils";
@@ -4,7 +4,7 @@ import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { patch, unpatch } from "@web/core/utils/patch";
import { makeLegacyDialogMappingService } from "@web/legacy/utils";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import core from "web.core";
import makeTestEnvironment from "web.test_env";
import { registerCleanup } from "./cleanup";
@@ -5,7 +5,7 @@ import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { useCommand } from "@web/webclient/commands/command_hook";
import { commandService } from "@web/webclient/commands/command_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { makeTestEnv } from "../../helpers/mock_env";
import { click, getFixture, nextTick, triggerHotkey } from "../../helpers/utils";
@@ -90,12 +90,9 @@ QUnit.test("useCommand hook", async (assert) => {
class MyComponent extends TestComponent {
setup() {
super.setup();
useCommand(
"Take the throne",
() => {
assert.step("Hodor");
},
);
useCommand("Take the throne", () => {
assert.step("Hodor");
});
}
}
testComponent = await mount(MyComponent, { env, target });
+1 -1
View File
@@ -15,7 +15,7 @@ import {
import { viewService } from "@web/views/view_service";
import { actionService } from "@web/webclient/actions/action_service";
import { effectService } from "@web/webclient/effects/effect_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { menuService } from "@web/webclient/menu_service";
import { WebClient } from "@web/webclient/webclient";
// This import is needed because of it's sideeffects, for exemple :
@@ -6,7 +6,7 @@ import { menuService } from "@web/webclient/menu_service";
import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { actionService } from "@web/webclient/actions/action_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { NavBar } from "@web/webclient/navbar/navbar";
import { clearRegistryWithCleanup, makeTestEnv } from "../helpers/mock_env";
import { click, getFixture, nextTick, patchWithCleanup } from "../helpers/utils";
@@ -2,7 +2,7 @@
import { browser } from "@web/core/browser/browser";
import { registry } from "@web/core/registry";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { SwitchCompanyMenu } from "@web/webclient/switch_company_menu/switch_company_menu";
import { registerCleanup } from "../helpers/cleanup";
import { makeTestEnv } from "../helpers/mock_env";
@@ -5,7 +5,7 @@ import { ormService } from "@web/core/orm_service";
import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { patch, unpatch } from "@web/core/utils/patch";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { UserMenu } from "@web/webclient/user_menu/user_menu";
import { preferencesItem } from "@web/webclient/user_menu/user_menu_items";
import { userService } from "@web/core/user_service";
@@ -7,7 +7,7 @@ import { registry } from "@web/core/registry";
import { uiService } from "@web/core/ui_service";
import { legacyServiceProvider } from "@web/legacy/legacy_service_provider";
import { actionService } from "@web/webclient/actions/action_service";
import { hotkeyService } from "@web/webclient/hotkeys/hotkey_service";
import { hotkeyService } from "@web/core/hotkeys/hotkey_service";
import { menuService } from "@web/webclient/menu_service";
import { WebClient } from "@web/webclient/webclient";
import { clearRegistryWithCleanup, makeTestEnv } from "../helpers/mock_env";