mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 20:46:01 +00:00
custom error shortcuts
This commit is contained in:
49
packages/web/src/modals/CommandModal.svelte
Normal file
49
packages/web/src/modals/CommandModal.svelte
Normal file
@@ -0,0 +1,49 @@
|
||||
<script lang="ts">
|
||||
import _ from 'lodash';
|
||||
|
||||
import FormStyledButton from '../elements/FormStyledButton.svelte';
|
||||
|
||||
import FormProvider from '../forms/FormProvider.svelte';
|
||||
import FormSubmit from '../forms/FormSubmit.svelte';
|
||||
import FormTextField from '../forms/FormTextField.svelte';
|
||||
import { customKeyboardShortcuts } from '../stores';
|
||||
import ModalBase from './ModalBase.svelte';
|
||||
import { closeCurrentModal } from './modalTools';
|
||||
|
||||
export let command;
|
||||
</script>
|
||||
|
||||
<FormProvider initialValues={command}>
|
||||
<ModalBase {...$$restProps}>
|
||||
<svelte:fragment slot="header">Configure commmand</svelte:fragment>
|
||||
|
||||
<FormTextField label="Category" name="category" disabled />
|
||||
<FormTextField label="Name" name="name" disabled />
|
||||
<FormTextField label="Keyboard shortcut" name="keyText" />
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<FormSubmit
|
||||
value="OK"
|
||||
on:click={e => {
|
||||
closeCurrentModal();
|
||||
customKeyboardShortcuts.update(list => ({
|
||||
...list,
|
||||
[command.id]: {
|
||||
keyText: e.detail.keyText,
|
||||
customKeyboardShortcut: true,
|
||||
},
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<FormStyledButton
|
||||
type="button"
|
||||
value="Reset"
|
||||
on:click={() => {
|
||||
closeCurrentModal();
|
||||
customKeyboardShortcuts.update(list => _.omit(list, [command.id]));
|
||||
}}
|
||||
/>
|
||||
<FormStyledButton type="button" value="Close" on:click={closeCurrentModal} />
|
||||
</svelte:fragment>
|
||||
</ModalBase>
|
||||
</FormProvider>
|
||||
Reference in New Issue
Block a user