forked from verdnatura/salix-front
refactor: refs #7889 modified shortcut and dashboard, and added tootlip in LeftMenu
This commit is contained in:
parent
5d78f564dd
commit
ef98f60486
|
@ -9,16 +9,16 @@ export default {
|
||||||
const keyBindingMap = routes
|
const keyBindingMap = routes
|
||||||
.filter((route) => route.meta.keyBinding)
|
.filter((route) => route.meta.keyBinding)
|
||||||
.reduce((map, route) => {
|
.reduce((map, route) => {
|
||||||
map[route.meta.keyBinding.toLowerCase()] = route.path;
|
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||||
return map;
|
return map;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = (event) => {
|
||||||
const { ctrlKey, altKey, key } = event;
|
const { ctrlKey, altKey, code } = event;
|
||||||
|
|
||||||
if (ctrlKey && altKey && keyBindingMap[key] && !isNotified) {
|
if (ctrlKey && altKey && keyBindingMap[code] && !isNotified) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
router.push(keyBindingMap[key]);
|
router.push(keyBindingMap[code]);
|
||||||
isNotified = true;
|
isNotified = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,12 @@ const itemComputed = computed(() => {
|
||||||
<QItemSection avatar v-if="!itemComputed.icon">
|
<QItemSection avatar v-if="!itemComputed.icon">
|
||||||
<QIcon name="disabled_by_default" />
|
<QIcon name="disabled_by_default" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
|
<QItemSection>
|
||||||
|
{{ t(itemComputed.title) }}
|
||||||
|
<QTooltip>
|
||||||
|
{{ 'Ctrl + Alt + ' + item.keyBinding.toUpperCase() }}
|
||||||
|
</QTooltip>
|
||||||
|
</QItemSection>
|
||||||
<QItemSection side>
|
<QItemSection side>
|
||||||
<slot name="side" :item="itemComputed" />
|
<slot name="side" :item="itemComputed" />
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
|
|
|
@ -56,19 +56,11 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
|
||||||
<div class="text-center text-primary button-text">
|
<div class="text-center text-primary button-text">
|
||||||
{{ t(item.title) }}
|
{{ t(item.title) }}
|
||||||
<div v-if="item.keyBinding">
|
<div v-if="item.keyBinding">
|
||||||
{{
|
{{ '(' + item.keyBinding + ')' }}
|
||||||
'(' +
|
|
||||||
(item.keyBinding == '€'
|
|
||||||
? 'E'
|
|
||||||
: item.keyBinding) +
|
|
||||||
')'
|
|
||||||
}}
|
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{
|
{{
|
||||||
'Ctrl + Alt + ' +
|
'Ctrl + Alt + ' +
|
||||||
(item.keyBinding == '€'
|
item.keyBinding.toUpperCase()
|
||||||
? 'E'
|
|
||||||
: item.keyBinding.toUpperCase())
|
|
||||||
}}
|
}}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default {
|
||||||
title: 'entries',
|
title: 'entries',
|
||||||
icon: 'vn:entry',
|
icon: 'vn:entry',
|
||||||
moduleName: 'Entry',
|
moduleName: 'Entry',
|
||||||
keyBinding: '€',
|
keyBinding: 'e',
|
||||||
},
|
},
|
||||||
component: RouterView,
|
component: RouterView,
|
||||||
redirect: { name: 'EntryMain' },
|
redirect: { name: 'EntryMain' },
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
describe('VnShortcuts', () => {
|
||||||
|
const modules = {
|
||||||
|
item: 'a',
|
||||||
|
customer: 'c',
|
||||||
|
ticket: 't',
|
||||||
|
claim: 'r',
|
||||||
|
worker: 'w',
|
||||||
|
monitor: 'm',
|
||||||
|
order: 'p',
|
||||||
|
supplier: 'p',
|
||||||
|
entry: '€',
|
||||||
|
zone: 'z',
|
||||||
|
account: 'u',
|
||||||
|
};
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.login('developer');
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should visit each module', () => {
|
||||||
|
Object.keys(modules).forEach((module) => {
|
||||||
|
const shortcut = modules[module];
|
||||||
|
|
||||||
|
cy.get('body').type(`{ctrl}{alt}${shortcut}`);
|
||||||
|
|
||||||
|
cy.url().should('include', module);
|
||||||
|
cy.get('body').should('be.visible');
|
||||||
|
|
||||||
|
cy.visit('/');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue