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