table editor - mark tab unsaved

This commit is contained in:
SPRINX0\prochazka
2024-12-04 10:00:03 +01:00
parent a63d70ca7e
commit 20de78f88a

View File

@@ -55,7 +55,7 @@
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte'; import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
import ToolStripButton from '../buttons/ToolStripButton.svelte'; import ToolStripButton from '../buttons/ToolStripButton.svelte';
import hasPermission from '../utility/hasPermission'; import hasPermission from '../utility/hasPermission';
import { changeTab } from '../utility/common'; import { changeTab, markTabSaved, markTabUnsaved } from '../utility/common';
export let tabid; export let tabid;
export let conid; export let conid;
@@ -115,6 +115,7 @@
if (errorMessage) { if (errorMessage) {
showModal(ErrorMessageModal, { title: 'Error when saving', message: errorMessage }); showModal(ErrorMessageModal, { title: 'Error when saving', message: errorMessage });
} else { } else {
markTabSaved(tabid);
await apiCall('database-connections/sync-model', { conid, database }); await apiCall('database-connections/sync-model', { conid, database });
showSnackbarSuccess('Saved to database'); showSnackbarSuccess('Saved to database');
const isCreateTable = $editorValue?.base == null; const isCreateTable = $editorValue?.base == null;
@@ -152,7 +153,7 @@
{resetCounter} {resetCounter}
isCreateTable={objectTypeField == 'tables' && $editorValue && !$editorValue?.base} isCreateTable={objectTypeField == 'tables' && $editorValue && !$editorValue?.base}
setTableInfo={objectTypeField == 'tables' && !$connection?.isReadOnly && hasPermission(`dbops/model/edit`) setTableInfo={objectTypeField == 'tables' && !$connection?.isReadOnly && hasPermission(`dbops/model/edit`)
? tableInfoUpdater => ? tableInfoUpdater => {
setEditorData(tbl => setEditorData(tbl =>
tbl tbl
? { ? {
@@ -163,7 +164,9 @@
base: tableInfoWithPairingId, base: tableInfoWithPairingId,
current: tableInfoUpdater(tableInfoWithPairingId), current: tableInfoUpdater(tableInfoWithPairingId),
} }
) );
markTabUnsaved(tabid);
}
: null} : null}
/> />
<svelte:fragment slot="toolstrip"> <svelte:fragment slot="toolstrip">