mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
new perspective command
This commit is contained in:
parent
a910e91a91
commit
eab5f4fe5e
@ -8,6 +8,7 @@ module.exports = ({ editMenu }) => [
|
||||
{ command: 'new.query', hideDisabled: true },
|
||||
{ command: 'new.queryDesign', hideDisabled: true },
|
||||
{ command: 'new.diagram', hideDisabled: true },
|
||||
{ command: 'new.perspective', hideDisabled: true },
|
||||
{ command: 'new.freetable', hideDisabled: true },
|
||||
{ command: 'new.shell', hideDisabled: true },
|
||||
{ command: 'new.jsonl', hideDisabled: true },
|
||||
|
@ -116,7 +116,16 @@ export function createPerspectiveNodeConfig(name: { schemaName?: string; pureNam
|
||||
return node;
|
||||
}
|
||||
|
||||
export function createPerspectiveConfig(rootObject: { schemaName?: string; pureName: string }): PerspectiveConfig {
|
||||
export function createPerspectiveConfig(rootObject?: { schemaName?: string; pureName: string }): PerspectiveConfig {
|
||||
if (!rootObject) {
|
||||
return {
|
||||
nodes: [],
|
||||
references: [],
|
||||
isArranged: true,
|
||||
rootDesignerId: null,
|
||||
};
|
||||
}
|
||||
|
||||
const rootNode = createPerspectiveNodeConfig(rootObject);
|
||||
return {
|
||||
nodes: [rootNode],
|
||||
|
@ -6,7 +6,7 @@ import SettingsModal from '../settings/SettingsModal.svelte';
|
||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import newQuery, { newDiagram, newQueryDesign } from '../query/newQuery';
|
||||
import newQuery, { newDiagram, newPerspective, newQueryDesign } from '../query/newQuery';
|
||||
import saveTabFile from '../utility/saveTabFile';
|
||||
import openNewTab from '../utility/openNewTab';
|
||||
import getElectron from '../utility/getElectron';
|
||||
@ -129,6 +129,15 @@ registerCommand({
|
||||
onClick: () => newQueryDesign(),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'new.perspective',
|
||||
category: 'New',
|
||||
icon: 'img perspective',
|
||||
name: 'Perspective',
|
||||
menuName: 'New perspective',
|
||||
onClick: () => newPerspective(),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'new.diagram',
|
||||
category: 'New',
|
||||
|
@ -40,3 +40,7 @@ export function newQueryDesign() {
|
||||
export function newDiagram() {
|
||||
return newQuery({ tabComponent: 'DiagramTab', icon: 'img diagram', title: 'Diagram #' });
|
||||
}
|
||||
|
||||
export function newPerspective() {
|
||||
return newQuery({ tabComponent: 'PerspectiveTab', icon: 'img perspective', title: 'Perspective #' });
|
||||
}
|
||||
|
@ -101,10 +101,14 @@
|
||||
});
|
||||
|
||||
const [modelState, dispatchModel] = createUndoReducer(
|
||||
createPerspectiveConfig({
|
||||
createPerspectiveConfig(
|
||||
pureName
|
||||
? {
|
||||
schemaName,
|
||||
pureName,
|
||||
})
|
||||
}
|
||||
: null
|
||||
)
|
||||
);
|
||||
|
||||
const cache = new PerspectiveCache();
|
||||
|
Loading…
Reference in New Issue
Block a user