Skip to content

Commit 682952f

Browse files
committed
fix: key-bindings fail after compile
1 parent 0cbf2dd commit 682952f

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

console/atest-ui/src/views/DataManager.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ const executeQueryWithoutShowingNativeSQL = () => {
336336
executeWithQuery(sqlQuery.value)
337337
}
338338
339-
Magic.LoadMagicKeys(import.meta.url, new Map([
339+
Magic.LoadMagicKeys('DataManager', new Map([
340340
["executeQuery", executeQuery],
341341
["executeWithSelectedQuery", executeWithSelectedQuery],
342342
["executeQueryWithoutShowingNativeSQL", executeQueryWithoutShowingNativeSQL],

console/atest-ui/src/views/StoreManager.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ function addStore() {
108108
createAction.value = true
109109
}
110110
111-
Magic.LoadMagicKeys(import.meta.url, {
112-
"addStore": addStore,
113-
"loadStores": loadStores,
114-
})
111+
Magic.LoadMagicKeys('StoreManager', new Map([
112+
["addStore", addStore],
113+
["loadStores", loadStores],
114+
]))
115115
116116
const rules = reactive<FormRules<Store>>({
117117
name: [{ required: true, message: 'Name is required', trigger: 'blur' }],

console/atest-ui/src/views/TestCase.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,14 +935,14 @@ const openQueryTab = () => {
935935
testResultActiveTab.value = 'query'
936936
}
937937
938-
Magic.LoadMagicKeys(import.meta.url), {
939-
"sendRequest": sendRequest,
940-
"openDuplicateTestCaseDialog": openDuplicateTestCaseDialog,
941-
"openOutputTab": openOutputTab,
942-
"openBodyTab": openBodyTab,
943-
"openHeaderTab": openHeaderTab,
944-
"openQueryTab": openQueryTab
945-
}
938+
Magic.LoadMagicKeys('TestCase', new Map([
939+
["sendRequest", sendRequest],
940+
["openDuplicateTestCaseDialog", openDuplicateTestCaseDialog],
941+
["openOutputTab", openOutputTab],
942+
["openBodyTab", openBodyTab],
943+
["openHeaderTab", openHeaderTab],
944+
["openQueryTab", openQueryTab]
945+
]))
946946
</script>
947947

948948
<template>

console/atest-ui/src/views/TestSuite.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ function openNewTestCaseDialog() {
153153
querySuggestedAPIs = NewSuggestedAPIsQuery(Cache.GetCurrentStore().name!, props.name!)
154154
}
155155
156-
Magic.LoadMagicKeys(import.meta.url, {
157-
"openNewTestCaseDialog": openNewTestCaseDialog,
158-
"saveTestSuite": saveTestSuite,
159-
})
156+
Magic.LoadMagicKeys('TestSuite', new Map([
157+
["openNewTestCaseDialog", openNewTestCaseDialog],
158+
["saveTestSuite", saveTestSuite],
159+
]))
160160
161161
const submitTestCaseForm = async (formEl: FormInstance | undefined) => {
162162
if (!formEl) return

console/atest-ui/src/views/magicKeys.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ interface KeyBinding {
7171
action: string
7272
}
7373

74-
const LoadMagicKeys = (url: String, mapping: Map<String, Function>) => {
75-
const fileName = url.substring(url.lastIndexOf('/') + 1);
76-
const pageName = fileName.split(".vue")[0];
74+
const LoadMagicKeys = (pageName: String, mapping: Map<String, Function>) => {
75+
console.log(`Loading magic keys for page: ${pageName}`);
7776
API.GetBinding("default", (data) => {
7877
const bindings = JSON.parse(data.message) as KeyBindings;
7978
bindings.pages.forEach((page: Page) => {

0 commit comments

Comments
 (0)