mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-28 18:46:02 +00:00
new collection refactor + mongo drop collection fixed
This commit is contained in:
4
packages/types/engines.d.ts
vendored
4
packages/types/engines.d.ts
vendored
@@ -115,8 +115,12 @@ export interface EngineDriver extends FilterBehaviourProvider {
|
||||
profilerChartAggregateFunction?: string;
|
||||
profilerChartMeasures?: { label: string; field: string }[];
|
||||
isElectronOnly?: boolean;
|
||||
|
||||
collectionSingularLabel?: string;
|
||||
collectionPluralLabel?: string;
|
||||
collectionNameLabel?: string;
|
||||
newCollectionFormParams?: any[];
|
||||
|
||||
supportedCreateDatabase?: boolean;
|
||||
showConnectionField?: (
|
||||
field: string,
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
</script>
|
||||
|
||||
{#if arg.type == 'text'}
|
||||
<FormTextField label={arg.label} {name} defaultValue={arg.default} />
|
||||
<FormTextField label={arg.label} {name} defaultValue={arg.default} focused={arg.focused} />
|
||||
{:else if arg.type == 'number'}
|
||||
<FormTextField label={arg.label} type="number" {name} defaultValue={arg.default} />
|
||||
<FormTextField label={arg.label} type="number" {name} defaultValue={arg.default} focused={arg.focused} />
|
||||
{:else if arg.type == 'checkbox'}
|
||||
<FormCheckboxField label={arg.label} {name} defaultValue={arg.default} />
|
||||
{:else if arg.type == 'select'}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import FormArgument from './FormArgument.svelte';
|
||||
|
||||
export let namePrefix;
|
||||
export let namePrefix = '';
|
||||
export let args: any[];
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import FormStyledButton from '../buttons/FormStyledButton.svelte';
|
||||
import FormArgumentList from '../forms/FormArgumentList.svelte';
|
||||
|
||||
import FormProvider from '../forms/FormProvider.svelte';
|
||||
import FormSubmit from '../forms/FormSubmit.svelte';
|
||||
@@ -22,7 +23,7 @@
|
||||
Create {driver?.collectionSingularLabel ?? 'collection/container'}
|
||||
</svelte:fragment>
|
||||
|
||||
<FormTextField label={`New ${driver?.collectionSingularLabel ?? 'collection/container'} name`} name="name" focused />
|
||||
<FormArgumentList args={driver?.newCollectionFormParams} />
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<FormSubmit value="OK" on:click={e => handleSubmit(e.detail)} />
|
||||
|
||||
@@ -110,8 +110,10 @@ const driver = {
|
||||
switch (type) {
|
||||
case 'createCollection':
|
||||
await this.script(pool, `db.createCollection('${operation.collection.name}')`);
|
||||
case 'dropOperation':
|
||||
break;
|
||||
case 'dropCollection':
|
||||
await this.script(pool, `db.dropCollection('${operation.collection}')`);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Operation type ${type} not supported`);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,15 @@ const driver = {
|
||||
},
|
||||
],
|
||||
|
||||
newCollectionFormParams: [
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Collection name',
|
||||
name: 'name',
|
||||
focused: true,
|
||||
},
|
||||
],
|
||||
|
||||
getCollectionUpdateScript(changeSet, collectionInfo) {
|
||||
let res = '';
|
||||
for (const insert of changeSet.inserts) {
|
||||
|
||||
Reference in New Issue
Block a user