mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
support remove fields for mongo
This commit is contained in:
@@ -81,10 +81,21 @@
|
||||
category: 'Data grid',
|
||||
name: 'Set NULL',
|
||||
keyText: 'CtrlOrCommand+0',
|
||||
testEnabled: () => getCurrentDataGrid()?.getGrider()?.editable,
|
||||
testEnabled: () =>
|
||||
getCurrentDataGrid()?.getGrider()?.editable && !getCurrentDataGrid()?.getEditorTypes()?.supportFieldRemoval,
|
||||
onClick: () => getCurrentDataGrid().setFixedValue(null),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataGrid.removeField',
|
||||
category: 'Data grid',
|
||||
name: 'Remove field',
|
||||
keyText: 'CtrlOrCommand+0',
|
||||
testEnabled: () =>
|
||||
getCurrentDataGrid()?.getGrider()?.editable && getCurrentDataGrid()?.getEditorTypes()?.supportFieldRemoval,
|
||||
onClick: () => getCurrentDataGrid().setFixedValue(undefined),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataGrid.undo',
|
||||
category: 'Data grid',
|
||||
@@ -823,6 +834,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
export function getEditorTypes() {
|
||||
return display?.driver?.dataEditorTypesBehaviour;
|
||||
}
|
||||
|
||||
export function addJsonDocumentEnabled() {
|
||||
return grider.editable;
|
||||
}
|
||||
@@ -1703,7 +1718,8 @@
|
||||
{ command: 'dataGrid.deleteSelectedRows' },
|
||||
{ command: 'dataGrid.insertNewRow' },
|
||||
{ command: 'dataGrid.cloneRows' },
|
||||
{ command: 'dataGrid.setNull' },
|
||||
{ command: 'dataGrid.setNull', hideDisabled: true },
|
||||
{ command: 'dataGrid.removeField', hideDisabled: true },
|
||||
{ placeTag: 'edit' },
|
||||
{ divider: true },
|
||||
{ command: 'dataGrid.findColumn' },
|
||||
|
||||
@@ -48,10 +48,19 @@
|
||||
category: 'Data form',
|
||||
name: 'Set NULL',
|
||||
keyText: 'CtrlOrCommand+0',
|
||||
testEnabled: () => getCurrentDataForm() != null,
|
||||
testEnabled: () => getCurrentDataForm() != null && !getCurrentDataForm()?.getEditorTypes()?.supportFieldRemoval,
|
||||
onClick: () => getCurrentDataForm().setFixedValue(null),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataForm.removeField',
|
||||
category: 'Data form',
|
||||
name: 'Remove field',
|
||||
keyText: 'CtrlOrCommand+0',
|
||||
testEnabled: () => getCurrentDataForm() != null && getCurrentDataForm()?.getEditorTypes()?.supportFieldRemoval,
|
||||
onClick: () => getCurrentDataForm().setFixedValue(undefined),
|
||||
});
|
||||
|
||||
registerCommand({
|
||||
id: 'dataForm.undo',
|
||||
category: 'Data form',
|
||||
@@ -321,6 +330,10 @@
|
||||
|
||||
export const activator = createActivator('FormView', false);
|
||||
|
||||
export function getEditorTypes() {
|
||||
return display?.driver?.dataEditorTypesBehaviour;
|
||||
}
|
||||
|
||||
const handleTableMouseDown = event => {
|
||||
if (event.target.closest('.buttonLike')) return;
|
||||
if (event.target.closest('.resizeHandleControl')) return;
|
||||
@@ -411,10 +424,11 @@
|
||||
{ divider: true },
|
||||
{ placeTag: 'save' },
|
||||
{ command: 'dataForm.revertRowChanges' },
|
||||
{ command: 'dataForm.setNull' },
|
||||
{ command: 'dataForm.setNull', hideDisabled: true },
|
||||
{ command: 'dataForm.removeField', hideDisabled: true },
|
||||
{ divider: true },
|
||||
{ command: 'dataForm.undo' },
|
||||
{ command: 'dataForm.redo' },
|
||||
{ command: 'dataForm.undo', hideDisabled: true },
|
||||
{ command: 'dataForm.redo', hideDisabled: true },
|
||||
{ divider: true },
|
||||
{ command: 'dataForm.goToFirst' },
|
||||
{ command: 'dataForm.goToPrevious' },
|
||||
|
||||
@@ -121,7 +121,13 @@
|
||||
const resp = await apiCall('database-connections/update-collection', {
|
||||
conid,
|
||||
database,
|
||||
changeSet,
|
||||
changeSet: {
|
||||
...changeSet,
|
||||
updates: changeSet.updates.map(update => ({
|
||||
...update,
|
||||
fields: _.mapValues(update.fields, (v, k) => (v === undefined ? { $undefined: true } : v)),
|
||||
})),
|
||||
},
|
||||
});
|
||||
const { errorMessage } = resp || {};
|
||||
if (errorMessage) {
|
||||
|
||||
Reference in New Issue
Block a user