mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 06:26:00 +00:00
nosql add new column GUI improved
This commit is contained in:
@@ -182,6 +182,13 @@
|
||||
header: 'Add new column',
|
||||
onConfirm: name => {
|
||||
display.addDynamicColumn(name);
|
||||
tick().then(() => {
|
||||
selectedColumns = [name];
|
||||
currentColumnUniqueName = name;
|
||||
if (!isJsonView) {
|
||||
display.focusColumns(selectedColumns);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}}>Add</InlineButton
|
||||
|
||||
@@ -66,6 +66,16 @@
|
||||
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({
|
||||
id: 'dataGrid.cloneRows',
|
||||
category: 'Data grid',
|
||||
@@ -419,6 +429,7 @@
|
||||
import { showSnackbarSuccess } from '../utility/snackbar';
|
||||
import { openJsonLinesData } from '../utility/openJsonLinesData';
|
||||
import contextMenuActivator from '../utility/contextMenuActivator';
|
||||
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||
|
||||
export let onLoadNextData = undefined;
|
||||
export let grider = undefined;
|
||||
@@ -554,6 +565,24 @@
|
||||
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() {
|
||||
if (!grider.canInsert) return;
|
||||
const rowIndex = grider.insertRow();
|
||||
@@ -1728,6 +1757,7 @@
|
||||
{ command: 'dataGrid.hideColumn' },
|
||||
{ command: 'dataGrid.filterSelected' },
|
||||
{ command: 'dataGrid.clearFilter' },
|
||||
{ command: 'dataGrid.addNewColumn', hideDisabled: true },
|
||||
{ command: 'dataGrid.undo', hideDisabled: true },
|
||||
{ command: 'dataGrid.redo', hideDisabled: true },
|
||||
{ divider: true },
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
'icon app': 'mdi mdi-layers-triple',
|
||||
'icon open-in-new': 'mdi mdi-open-in-new',
|
||||
'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-maximize': 'mdi mdi-window-maximize',
|
||||
|
||||
@@ -179,6 +179,10 @@
|
||||
<svelte:fragment slot="toolstrip">
|
||||
<ToolStripCommandButton command="dataGrid.refresh" />
|
||||
<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.saveAs" />
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -212,6 +212,7 @@
|
||||
<ToolStripCommandButton command="dataGrid.revertAllChanges" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.insertNewRow" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.deleteSelectedRows" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.addNewColumn" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.switchToJson" hideDisabled />
|
||||
<ToolStripCommandButton command="dataGrid.switchToTable" hideDisabled />
|
||||
<ToolStripExportButton {quickExportHandlerRef} command="collectionDataGrid.export" />
|
||||
|
||||
Reference in New Issue
Block a user