import UX

This commit is contained in:
Jan Prochazka 2021-12-09 08:20:29 +01:00
parent bcf95d3872
commit a96851b38f
3 changed files with 48 additions and 2 deletions

View File

@ -304,6 +304,8 @@ registerCommand({
'installedPluginsWidget',
'allPluginsWidget',
'currentArchive',
];
for (const key of keys) removeLocalStorage(key);
showSnackbarSuccess('Restart DbGate (or reload on web) for applying changes');

View File

@ -1,6 +1,8 @@
<script lang="ts">
import _ from 'lodash';
import FormStyledButton from '../elements/FormStyledButton.svelte';
import FormArchiveFilesSelect from '../forms/FormArchiveFilesSelect.svelte';
import moment from 'moment';
import FormArchiveFolderSelect from '../forms/FormArchiveFolderSelect.svelte';
import FormArgumentList from '../forms/FormArgumentList.svelte';
@ -11,7 +13,7 @@
import FontIcon from '../icons/FontIcon.svelte';
import { findFileFormat, getFileFormatDirections } from '../plugins/fileformats';
import SqlEditor from '../query/SqlEditor.svelte';
import { extensions } from '../stores';
import { currentArchive, currentDatabase, extensions } from '../stores';
import { useArchiveFiles, useDatabaseInfo } from '../utility/metadataLoaders';
import FilesInput from './FilesInput.svelte';
import FormConnectionSelect from './FormConnectionSelect.svelte';
@ -64,6 +66,44 @@
</div>
{/if}
{#if direction == 'target'}
<div class="buttons">
{#if $currentDatabase}
<FormStyledButton
value="Current DB"
on:click={() => {
values.update(x => ({
...x,
[storageTypeField]: 'database',
[connectionIdField]: $currentDatabase?.connection?._id,
[databaseNameField]: $currentDatabase?.name,
}));
}}
/>
{/if}
<FormStyledButton
value="Current archive"
on:click={() => {
values.update(x => ({
...x,
[storageTypeField]: 'archive',
[archiveFolderField]: $currentArchive,
}));
}}
/>
<FormStyledButton
value="New archive"
on:click={() => {
values.update(x => ({
...x,
[storageTypeField]: 'archive',
[archiveFolderField]: `import-${moment().format('YYYY-MM-DD-hh-mm-ss')}`,
}));
}}
/>
</div>
{/if}
<FormSelectField
options={types.filter(x => x.directions.includes(direction))}
name={storageTypeField}
@ -153,4 +193,8 @@
margin-bottom: 3px;
color: var(--theme-font-3);
}
.buttons {
margin-left: var(--dim-large-form-margin);
}
</style>

View File

@ -61,7 +61,7 @@ export const currentDropDownMenu = writable(null);
export const openedModals = writable([]);
export const openedSnackbars = writable([]);
export const nullStore = readable(null, () => {});
export const currentArchive = writable('default');
export const currentArchive = writableWithStorage('default', 'currentArchive');
export const isFileDragActive = writable(false);
export const selectedCellsCallback = writable(null);
export const loadingPluginStore = writable({