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