mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 05:03:57 +00:00
mongo update script preview
This commit is contained in:
2
packages/types/engines.d.ts
vendored
2
packages/types/engines.d.ts
vendored
@@ -32,6 +32,7 @@ export interface ReadCollectionOptions {
|
|||||||
skip?: number;
|
skip?: number;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EngineDriver {
|
export interface EngineDriver {
|
||||||
engine: string;
|
engine: string;
|
||||||
title: string;
|
title: string;
|
||||||
@@ -62,6 +63,7 @@ export interface EngineDriver {
|
|||||||
getAuthTypes(): EngineAuthType[];
|
getAuthTypes(): EngineAuthType[];
|
||||||
readCollection(pool: any, options: ReadCollectionOptions): Promise<any>;
|
readCollection(pool: any, options: ReadCollectionOptions): Promise<any>;
|
||||||
updateCollection(pool: any, changeSet: any): Promise<any>;
|
updateCollection(pool: any, changeSet: any): Promise<any>;
|
||||||
|
getCollectionUpdateScript(changeSet: any): string;
|
||||||
|
|
||||||
analyserClass?: any;
|
analyserClass?: any;
|
||||||
dumperClass?: any;
|
dumperClass?: any;
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
import FormProvider from '../forms/FormProvider.svelte';
|
import FormProvider from '../forms/FormProvider.svelte';
|
||||||
import FormSubmit from '../forms/FormSubmit.svelte';
|
import FormSubmit from '../forms/FormSubmit.svelte';
|
||||||
import JSONTree from '../jsontree/JSONTree.svelte';
|
import JSONTree from '../jsontree/JSONTree.svelte';
|
||||||
|
import AceEditor from '../query/AceEditor.svelte';
|
||||||
|
|
||||||
import ModalBase from './ModalBase.svelte';
|
import ModalBase from './ModalBase.svelte';
|
||||||
import { closeCurrentModal } from './modalTools';
|
import { closeCurrentModal } from './modalTools';
|
||||||
|
|
||||||
export let json;
|
export let script;
|
||||||
export let onConfirm;
|
export let onConfirm;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
<div slot="header">Save changes</div>
|
<div slot="header">Save changes</div>
|
||||||
|
|
||||||
<div class="editor">
|
<div class="editor">
|
||||||
<JSONTree value={json} />
|
<AceEditor mode="javascript" readOnly value={script} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
@@ -37,6 +38,5 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 30vh;
|
height: 30vh;
|
||||||
width: 40vw;
|
width: 40vw;
|
||||||
overflow: scroll;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -118,11 +118,17 @@
|
|||||||
|
|
||||||
export function save() {
|
export function save() {
|
||||||
const json = $changeSetStore?.value;
|
const json = $changeSetStore?.value;
|
||||||
|
const driver = findEngineDriver($connection, $extensions);
|
||||||
|
const script = driver.getCollectionUpdateScript ? driver.getCollectionUpdateScript(json) : null;
|
||||||
|
if (script) {
|
||||||
showModal(ConfirmNoSqlModal, {
|
showModal(ConfirmNoSqlModal, {
|
||||||
json,
|
script,
|
||||||
onConfirm: () => handleConfirmChange(json),
|
onConfirm: () => handleConfirmChange(json),
|
||||||
engine: display.engine,
|
engine: display.engine,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
handleConfirmChange(json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addJsonDocument() {
|
export function addJsonDocument() {
|
||||||
|
|||||||
Reference in New Issue
Block a user