basic progress toasts

ref #62
This commit is contained in:
2021-02-20 17:19:17 +01:00
parent dbc0ab76af
commit a7642c2da4
7 changed files with 70 additions and 1 deletions

View File

@@ -49,6 +49,11 @@
on:click={async () => {
const locale = getLocaleFromNavigator();
const orgs = current_organizations.filter((r) => r.is_selected === true);
const toast = Toastify({
text: $_('generating-pdfs'),
duration: -1,
}).showToast();
let count = 0;
for await (const o of orgs) {
const runners = await RunnerOrganizationService.runnerOrganizationControllerGetRunners(o.id);
fetch(
@@ -63,6 +68,7 @@
)
.then((response) => response.blob())
.then((blob) => {
count++;
const url = window.URL.createObjectURL(blob);
let a = document.createElement('a');
a.href = url;
@@ -70,6 +76,15 @@
document.body.appendChild(a);
a.click();
a.remove();
if (count === orgs.length) {
toast.hideToast();
Toastify({
text: $_('pdfs-successfully-generated'),
duration: 3500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}
})
.catch((err) => {});
}