mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-19 06:14:04 +00:00
Zenity progress bar
This commit is contained in:
@ -1,13 +1,26 @@
|
||||
import { StartProgressBar, StopProgressBar } from '$wails/go/ui/UI';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
const { update, subscribe } = writable(0);
|
||||
|
||||
let timer;
|
||||
let progressBarShown = false;
|
||||
subscribe(isBusy => {
|
||||
if (isBusy) {
|
||||
document.body.classList.add('busy');
|
||||
if (!progressBarShown) {
|
||||
progressBarShown = true;
|
||||
timer = setTimeout(() => StartProgressBar(''), 100);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
timer = undefined;
|
||||
}
|
||||
progressBarShown = false;
|
||||
document.body.classList.remove('busy');
|
||||
StopProgressBar();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
import ObjectGrid from '$components/objectgrid.svelte';
|
||||
import input from '$lib/actions/input';
|
||||
import { deepClone } from '$lib/objects';
|
||||
import busy from '$lib/stores/busy';
|
||||
import queries from '$lib/stores/queries';
|
||||
import applicationSettings from '$lib/stores/settings';
|
||||
import views from '$lib/stores/views';
|
||||
@ -41,6 +42,7 @@
|
||||
$: activePage = (submittedForm.limit && submittedForm.skip && result?.results?.length) ? submittedForm.skip / submittedForm.limit : 0;
|
||||
|
||||
async function submitQuery() {
|
||||
busy.start();
|
||||
activePath = [];
|
||||
const newResult = await FindItems(collection.hostKey, collection.dbKey, collection.key, JSON.stringify(form));
|
||||
if (newResult) {
|
||||
@ -48,6 +50,7 @@
|
||||
result = newResult;
|
||||
submittedForm = deepClone(form);
|
||||
}
|
||||
busy.end();
|
||||
resetFocus();
|
||||
}
|
||||
|
||||
|
4
frontend/wailsjs/go/ui/UI.d.ts
vendored
4
frontend/wailsjs/go/ui/UI.d.ts
vendored
@ -10,4 +10,8 @@ export function OpenDirectory(arg1:string,arg2:string):Promise<string>;
|
||||
|
||||
export function Reveal(arg1:string):Promise<void>;
|
||||
|
||||
export function StartProgressBar(arg1:string):Promise<void>;
|
||||
|
||||
export function Startup(arg1:context.Context):Promise<void>;
|
||||
|
||||
export function StopProgressBar():Promise<void>;
|
||||
|
@ -18,6 +18,14 @@ export function Reveal(arg1) {
|
||||
return window['go']['ui']['UI']['Reveal'](arg1);
|
||||
}
|
||||
|
||||
export function StartProgressBar(arg1) {
|
||||
return window['go']['ui']['UI']['StartProgressBar'](arg1);
|
||||
}
|
||||
|
||||
export function Startup(arg1) {
|
||||
return window['go']['ui']['UI']['Startup'](arg1);
|
||||
}
|
||||
|
||||
export function StopProgressBar() {
|
||||
return window['go']['ui']['UI']['StopProgressBar']();
|
||||
}
|
||||
|
Reference in New Issue
Block a user