mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-02 05:33:59 +00:00
nosql add new column GUI improved
This commit is contained in:
@@ -182,6 +182,13 @@
|
|||||||
header: 'Add new column',
|
header: 'Add new column',
|
||||||
onConfirm: name => {
|
onConfirm: name => {
|
||||||
display.addDynamicColumn(name);
|
display.addDynamicColumn(name);
|
||||||
|
tick().then(() => {
|
||||||
|
selectedColumns = [name];
|
||||||
|
currentColumnUniqueName = name;
|
||||||
|
if (!isJsonView) {
|
||||||
|
display.focusColumns(selectedColumns);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}>Add</InlineButton
|
}}>Add</InlineButton
|
||||||
|
|||||||
@@ -66,6 +66,16 @@
|
|||||||
onClick: () => getCurrentDataGrid().insertNewRow(),
|
onClick: () => getCurrentDataGrid().insertNewRow(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerCommand({
|
||||||
|
id: 'dataGrid.addNewColumn',
|
||||||
|
category: 'Data grid',
|
||||||
|
name: 'Add new column',
|
||||||
|
toolbarName: 'New column',
|
||||||
|
icon: 'icon add-column',
|
||||||
|
testEnabled: () => getCurrentDataGrid()?.addNewColumnEnabled(),
|
||||||
|
onClick: () => getCurrentDataGrid().addNewColumn(),
|
||||||
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
id: 'dataGrid.cloneRows',
|
id: 'dataGrid.cloneRows',
|
||||||
category: 'Data grid',
|
category: 'Data grid',
|
||||||
@@ -419,6 +429,7 @@
|
|||||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||||
import { openJsonLinesData } from '../utility/openJsonLinesData';
|
import { openJsonLinesData } from '../utility/openJsonLinesData';
|
||||||
import contextMenuActivator from '../utility/contextMenuActivator';
|
import contextMenuActivator from '../utility/contextMenuActivator';
|
||||||
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
|
|
||||||
export let onLoadNextData = undefined;
|
export let onLoadNextData = undefined;
|
||||||
export let grider = undefined;
|
export let grider = undefined;
|
||||||
@@ -554,6 +565,24 @@
|
|||||||
grider.endUpdate();
|
grider.endUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addNewColumnEnabled() {
|
||||||
|
return getGrider()?.editable && isDynamicStructure;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addNewColumn() {
|
||||||
|
showModal(InputTextModal, {
|
||||||
|
value: '',
|
||||||
|
label: 'Column name',
|
||||||
|
header: 'Add new column',
|
||||||
|
onConfirm: name => {
|
||||||
|
display.addDynamicColumn(name);
|
||||||
|
tick().then(() => {
|
||||||
|
display.focusColumns([name]);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export async function insertNewRow() {
|
export async function insertNewRow() {
|
||||||
if (!grider.canInsert) return;
|
if (!grider.canInsert) return;
|
||||||
const rowIndex = grider.insertRow();
|
const rowIndex = grider.insertRow();
|
||||||
@@ -1728,6 +1757,7 @@
|
|||||||
{ command: 'dataGrid.hideColumn' },
|
{ command: 'dataGrid.hideColumn' },
|
||||||
{ command: 'dataGrid.filterSelected' },
|
{ command: 'dataGrid.filterSelected' },
|
||||||
{ command: 'dataGrid.clearFilter' },
|
{ command: 'dataGrid.clearFilter' },
|
||||||
|
{ command: 'dataGrid.addNewColumn', hideDisabled: true },
|
||||||
{ command: 'dataGrid.undo', hideDisabled: true },
|
{ command: 'dataGrid.undo', hideDisabled: true },
|
||||||
{ command: 'dataGrid.redo', hideDisabled: true },
|
{ command: 'dataGrid.redo', hideDisabled: true },
|
||||||
{ divider: true },
|
{ divider: true },
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
'icon app': 'mdi mdi-layers-triple',
|
'icon app': 'mdi mdi-layers-triple',
|
||||||
'icon open-in-new': 'mdi mdi-open-in-new',
|
'icon open-in-new': 'mdi mdi-open-in-new',
|
||||||
'icon add-folder': 'mdi mdi-folder-plus-outline',
|
'icon add-folder': 'mdi mdi-folder-plus-outline',
|
||||||
|
'icon add-column': 'mdi mdi-table-column-plus-after',
|
||||||
|
|
||||||
'icon window-restore': 'mdi mdi-window-restore',
|
'icon window-restore': 'mdi mdi-window-restore',
|
||||||
'icon window-maximize': 'mdi mdi-window-maximize',
|
'icon window-maximize': 'mdi mdi-window-maximize',
|
||||||
|
|||||||
@@ -179,6 +179,10 @@
|
|||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton command="dataGrid.refresh" />
|
<ToolStripCommandButton command="dataGrid.refresh" />
|
||||||
<ToolStripExportButton command="jslTableGrid.export" {quickExportHandlerRef} />
|
<ToolStripExportButton command="jslTableGrid.export" {quickExportHandlerRef} />
|
||||||
|
<ToolStripCommandButton command="dataGrid.revertAllChanges" hideDisabled />
|
||||||
|
<ToolStripCommandButton command="dataGrid.insertNewRow" hideDisabled />
|
||||||
|
<ToolStripCommandButton command="dataGrid.deleteSelectedRows" hideDisabled />
|
||||||
|
<ToolStripCommandButton command="dataGrid.addNewColumn" hideDisabled />
|
||||||
<ToolStripCommandButton command="archiveFile.save" />
|
<ToolStripCommandButton command="archiveFile.save" />
|
||||||
<ToolStripCommandButton command="archiveFile.saveAs" />
|
<ToolStripCommandButton command="archiveFile.saveAs" />
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|||||||
@@ -212,6 +212,7 @@
|
|||||||
<ToolStripCommandButton command="dataGrid.revertAllChanges" hideDisabled />
|
<ToolStripCommandButton command="dataGrid.revertAllChanges" hideDisabled />
|
||||||
<ToolStripCommandButton command="dataGrid.insertNewRow" hideDisabled />
|
<ToolStripCommandButton command="dataGrid.insertNewRow" hideDisabled />
|
||||||
<ToolStripCommandButton command="dataGrid.deleteSelectedRows" hideDisabled />
|
<ToolStripCommandButton command="dataGrid.deleteSelectedRows" hideDisabled />
|
||||||
|
<ToolStripCommandButton command="dataGrid.addNewColumn" hideDisabled />
|
||||||
<ToolStripCommandButton command="dataGrid.switchToJson" hideDisabled />
|
<ToolStripCommandButton command="dataGrid.switchToJson" hideDisabled />
|
||||||
<ToolStripCommandButton command="dataGrid.switchToTable" hideDisabled />
|
<ToolStripCommandButton command="dataGrid.switchToTable" hideDisabled />
|
||||||
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
||||||
|
|||||||
Reference in New Issue
Block a user