mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-18 22:04:05 +00:00
Truncate collections
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<script>
|
||||
import { busy, connections } from '../../stores';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase } from '../../../wailsjs/go/app/App';
|
||||
import { DropCollection, DropDatabase, OpenCollection, OpenConnection, OpenDatabase, TruncateCollection } from '../../../wailsjs/go/app/App';
|
||||
import Grid from '../../components/grid.svelte';
|
||||
import { WindowSetTitle } from '../../../wailsjs/runtime/runtime';
|
||||
|
||||
@ -69,6 +69,13 @@
|
||||
busy.end();
|
||||
}
|
||||
|
||||
async function truncateCollection(dbKey, collKey) {
|
||||
busy.start();
|
||||
await TruncateCollection(activeHostKey, dbKey, collKey);
|
||||
await reload();
|
||||
busy.end();
|
||||
}
|
||||
|
||||
async function dropCollection(dbKey, collKey) {
|
||||
busy.start();
|
||||
await DropCollection(activeHostKey, dbKey, collKey);
|
||||
@ -94,21 +101,22 @@
|
||||
name: collKey,
|
||||
icon: 'list',
|
||||
menu: [
|
||||
{ label: `Rename ${collKey} collection…`, fn: () => dispatch('renameCollection', collKey) },
|
||||
{ label: `Drop ${collKey}…`, fn: () => dropCollection(dbKey, collKey) },
|
||||
{ label: 'Rename collection…', fn: () => dispatch('renameCollection', collKey) },
|
||||
{ label: 'Truncate collection…', fn: () => truncateCollection(dbKey, collKey) },
|
||||
{ label: 'Drop collection…', fn: () => dropCollection(dbKey, collKey) },
|
||||
{ separator: true },
|
||||
{ label: 'New collection…', fn: () => dispatch('newCollection') },
|
||||
],
|
||||
})) || [],
|
||||
menu: [
|
||||
{ label: `Drop database ${dbKey}…`, fn: () => dropDatabase(dbKey) },
|
||||
{ label: 'Drop database…', fn: () => dropDatabase(dbKey) },
|
||||
{ separator: true },
|
||||
{ label: 'New database…', fn: () => dispatch('newDatabase') },
|
||||
],
|
||||
})),
|
||||
menu: [
|
||||
{ label: 'New database…', fn: () => dispatch('newDatabase') },
|
||||
{ separator: true },
|
||||
{ separator: true },
|
||||
{ label: `Edit host ${hosts[hostKey].name}…`, fn: () => dispatch('editHost', hostKey) },
|
||||
],
|
||||
}))}
|
||||
|
2
frontend/wailsjs/go/app/App.d.ts
vendored
2
frontend/wailsjs/go/app/App.d.ts
vendored
@ -41,6 +41,8 @@ export function RenameCollection(arg1:string,arg2:string,arg3:string,arg4:string
|
||||
|
||||
export function Settings():Promise<app.Settings>;
|
||||
|
||||
export function TruncateCollection(arg1:string,arg2:string,arg3:string):Promise<boolean>;
|
||||
|
||||
export function UpdateHost(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function UpdateItems(arg1:string,arg2:string,arg3:string,arg4:string):Promise<number>;
|
||||
|
@ -74,6 +74,10 @@ export function Settings() {
|
||||
return window['go']['app']['App']['Settings']();
|
||||
}
|
||||
|
||||
export function TruncateCollection(arg1, arg2, arg3) {
|
||||
return window['go']['app']['App']['TruncateCollection'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function UpdateHost(arg1, arg2) {
|
||||
return window['go']['app']['App']['UpdateHost'](arg1, arg2);
|
||||
}
|
||||
|
Reference in New Issue
Block a user