define virtual reference from diagram

This commit is contained in:
Jan Prochazka 2022-01-29 15:43:42 +01:00
parent de3faf618f
commit 157325f605
3 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@
import InputTextModal from '../modals/InputTextModal.svelte';
import { showModal } from '../modals/modalTools';
import { currentThemeDefinition } from '../stores';
import VirtualForeignKeyEditorModal from '../tableeditor/VirtualForeignKeyEditorModal.svelte';
import contextMenu from '../utility/contextMenu';
import moveDrag from '../utility/moveDrag';
import ColumnLine from './ColumnLine.svelte';
@ -166,6 +167,15 @@
});
};
const handleDefineVirtualForeignKey = table => {
showModal(VirtualForeignKeyEditorModal, {
schemaName: table.schemaName,
pureName: table.pureName,
conid,
database,
});
};
function createMenu() {
return [
{ text: 'Remove', onClick: () => onRemoveTable({ designerId }) },
@ -185,6 +195,11 @@
settings?.allowAddAllReferences &&
!isMultipleTableSelection && { text: 'Add references', onClick: () => onAddAllReferences(table) },
settings?.allowChangeColor && { text: 'Change color', onClick: () => onChangeTableColor(table) },
settings?.allowDefineVirtualReferences &&
!isMultipleTableSelection && {
text: 'Define virtual foreign key',
onClick: () => handleDefineVirtualForeignKey(table),
},
settings?.appendTableSystemMenu &&
!isMultipleTableSelection && [{ divider: true }, createDatabaseObjectMenu({ ...table, conid, database })],
];

View File

@ -21,6 +21,7 @@
allowChangeColor: true,
appendTableSystemMenu: true,
customizeStyle: true,
allowDefineVirtualReferences: true,
}}
referenceComponent={DiagramDesignerReference}
/>

View File

@ -21,6 +21,7 @@
allowChangeColor: false,
appendTableSystemMenu: false,
customizeStyle: false,
allowDefineVirtualReferences: false,
}}
referenceComponent={QueryDesignerReference}
/>