mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-09-13 08:24:17 +00:00
Drop active item in find.svelte
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { FindItems } from '../../../../wailsjs/go/app/App';
|
||||
import { FindItems, RemoveItemById } from '../../../../wailsjs/go/app/App';
|
||||
import CodeExample from '../../../components/code-example.svelte';
|
||||
import { input } from '../../../actions';
|
||||
import ObjectGrid from '../../../components/objectgrid.svelte';
|
||||
@ -20,7 +20,7 @@
|
||||
let result = {};
|
||||
let submittedForm = {};
|
||||
let queryField;
|
||||
let activePath = '';
|
||||
let activePath = [];
|
||||
let objectViewerData;
|
||||
$: code = `db.${collection.key}.find(${form.query || '{}'}${form.fields && form.fields !== '{}' ? `, ${form.fields}` : ''}).sort(${form.sort})${form.skip ? `.skip(${form.skip})` : ''}${form.limit ? `.limit(${form.limit})` : ''};`;
|
||||
|
||||
@ -46,8 +46,14 @@
|
||||
submitQuery();
|
||||
}
|
||||
|
||||
function remove() {
|
||||
// todo
|
||||
async function removeActive() {
|
||||
if (!activePath[0]) {
|
||||
return;
|
||||
}
|
||||
const ok = await RemoveItemById(collection.hostKey, collection.dbKey, collection.key, activePath[0]);
|
||||
if (ok) {
|
||||
await submitQuery();
|
||||
}
|
||||
}
|
||||
|
||||
function resetFocus() {
|
||||
@ -116,7 +122,7 @@
|
||||
{/key}
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn danger" on:click={remove} disabled={!activePath?.length}>
|
||||
<button class="btn danger" on:click={removeActive} disabled={!activePath?.length}>
|
||||
<Icon name="-" />
|
||||
</button>
|
||||
<button class="btn" on:click={prev} disabled={!submittedForm.limit || (submittedForm.skip <= 0) || !result?.results?.length}>
|
||||
|
2
frontend/wailsjs/go/app/App.d.ts
vendored
2
frontend/wailsjs/go/app/App.d.ts
vendored
@ -28,6 +28,8 @@ export function OpenDatabase(arg1:string,arg2:string):Promise<Array<string>>;
|
||||
|
||||
export function RemoveHost(arg1:string):Promise<void>;
|
||||
|
||||
export function RemoveItemById(arg1:string,arg2:string,arg3:string,arg4:string):Promise<boolean>;
|
||||
|
||||
export function RemoveItems(arg1:string,arg2:string,arg3:string,arg4:string,arg5:boolean):Promise<number>;
|
||||
|
||||
export function UpdateItems(arg1:string,arg2:string,arg3:string,arg4:string):Promise<number>;
|
||||
|
@ -50,6 +50,10 @@ export function RemoveHost(arg1) {
|
||||
return window['go']['app']['App']['RemoveHost'](arg1);
|
||||
}
|
||||
|
||||
export function RemoveItemById(arg1, arg2, arg3, arg4) {
|
||||
return window['go']['app']['App']['RemoveItemById'](arg1, arg2, arg3, arg4);
|
||||
}
|
||||
|
||||
export function RemoveItems(arg1, arg2, arg3, arg4, arg5) {
|
||||
return window['go']['app']['App']['RemoveItems'](arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
|
Reference in New Issue
Block a user