mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 01:26:01 +00:00
handle invalid perspective format
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
import { registerFileCommands } from '../commands/stdCommands';
|
import { registerFileCommands } from '../commands/stdCommands';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import ToolStripSaveButton from '../buttons/ToolStripSaveButton.svelte';
|
import ToolStripSaveButton from '../buttons/ToolStripSaveButton.svelte';
|
||||||
|
import ErrorInfo from '../elements/ErrorInfo.svelte';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
@@ -52,6 +53,8 @@
|
|||||||
export let schemaName;
|
export let schemaName;
|
||||||
export let pureName;
|
export let pureName;
|
||||||
|
|
||||||
|
let isFormatError;
|
||||||
|
|
||||||
export const activator = createActivator('PerspectiveTab', true);
|
export const activator = createActivator('PerspectiveTab', true);
|
||||||
|
|
||||||
$: connection = useConnectionInfo({ conid });
|
$: connection = useConnectionInfo({ conid });
|
||||||
@@ -88,7 +91,11 @@
|
|||||||
const { editorState, editorValue, setEditorData } = useEditorData({
|
const { editorState, editorValue, setEditorData } = useEditorData({
|
||||||
tabid,
|
tabid,
|
||||||
onInitialData: value => {
|
onInitialData: value => {
|
||||||
|
if (!value.nodes) {
|
||||||
|
isFormatError = true;
|
||||||
|
} else {
|
||||||
dispatchModel({ type: 'reset', value });
|
dispatchModel({ type: 'reset', value });
|
||||||
|
}
|
||||||
invalidateCommands();
|
invalidateCommands();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -110,6 +117,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ToolStripContainer>
|
<ToolStripContainer>
|
||||||
|
{#if isFormatError}
|
||||||
|
<ErrorInfo message="Invalid perspective format, please create new perspective" alignTop />
|
||||||
|
{:else}
|
||||||
<PerspectiveView
|
<PerspectiveView
|
||||||
{conid}
|
{conid}
|
||||||
{database}
|
{database}
|
||||||
@@ -132,6 +142,7 @@
|
|||||||
{cache}
|
{cache}
|
||||||
{loadedCounts}
|
{loadedCounts}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton
|
<ToolStripCommandButton
|
||||||
|
|||||||
Reference in New Issue
Block a user