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
|
||||
.filter((route) => route.meta.keyBinding)
|
||||
.reduce((map, route) => {
|
||||
map[route.meta.keyBinding.toLowerCase()] = route.path;
|
||||
map['Key' + route.meta.keyBinding.toUpperCase()] = route.path;
|
||||
return map;
|
||||
}, {});
|
||||
|
||||
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();
|
||||
router.push(keyBindingMap[key]);
|
||||
router.push(keyBindingMap[code]);
|
||||
isNotified = true;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -33,7 +33,12 @@ const itemComputed = computed(() => {
|
|||
<QItemSection avatar v-if="!itemComputed.icon">
|
||||
<QIcon name="disabled_by_default" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
|
||||
<QItemSection>
|
||||
{{ t(itemComputed.title) }}
|
||||
<QTooltip>
|
||||
{{ 'Ctrl + Alt + ' + item.keyBinding.toUpperCase() }}
|
||||
</QTooltip>
|
||||
</QItemSection>
|
||||
<QItemSection side>
|
||||
<slot name="side" :item="itemComputed" />
|
||||
</QItemSection>
|
||||
|
|
|
@ -56,19 +56,11 @@ const pinnedModules = computed(() => navigation.getPinnedModules());
|
|||
<div class="text-center text-primary button-text">
|
||||
{{ t(item.title) }}
|
||||
<div v-if="item.keyBinding">
|
||||
{{
|
||||
'(' +
|
||||
(item.keyBinding == '€'
|
||||
? 'E'
|
||||
: item.keyBinding) +
|
||||
')'
|
||||
}}
|
||||
{{ '(' + item.keyBinding + ')' }}
|
||||
<QTooltip>
|
||||
{{
|
||||
'Ctrl + Alt + ' +
|
||||
(item.keyBinding == '€'
|
||||
? 'E'
|
||||
: item.keyBinding.toUpperCase())
|
||||
item.keyBinding.toUpperCase()
|
||||
}}
|
||||
</QTooltip>
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@ export default {
|
|||
title: 'entries',
|
||||
icon: 'vn:entry',
|
||||
moduleName: 'Entry',
|
||||
keyBinding: '€',
|
||||
keyBinding: 'e',
|
||||
},
|
||||
component: RouterView,
|
||||
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