Hotkeys Assignment¶
To make working with the Unidata system in several browser tabs more easy, the use of hotkeys is available. The UEGlobalHotkey is used to assign keyboard shortcuts.
UEGlobalHotkey type
import {UeModuleBase} from '../../userexit/type/UeModuleBase';
import {ComponentType} from 'react';
export type UEGlobalHotkey = UeModuleBase & {
default: {
component: ComponentType<{}>;
meta: {};
};
}
Implementation example:
import {IdSearch} from './hotkey/IdSearch';
import {SystemTools} from './hotkey/SystemTools';
import {UEList} from '@unidata/types';
export enum UrlRoutes {
MainPage = '/main', // Main page with widgets
SearchPage = '/search', // Main route of the search page
SearchTable = '/search/:namespace?/:entityName?', // A table with the results
DataView = '/dataviewlight/:namespace/:entityName/:etalonId', // Page for viewing data card
Compare = '/data/compare/:entityName', // Page for viewing compare table
History = '/data/history/:namespace/:entityName/:etalonId' // Page for viewing record history
}
const hotkeyDefaults = {
type: UEList.GlobalHotkey,
active: true,
system: false,
resolver: () => true,
meta: {}
};
export const hotkeys = [
{
'default': {
moduleId: 'idSearch',
component: IdSearch,
...hotkeyDefaults
}
},
{
'default': {
moduleId: 'systemTools',
component: SystemTools,
...hotkeyDefaults
}
}
];