added version number in the footer

This commit is contained in:
Gani Georgiev
2022-08-09 16:16:09 +03:00
parent 8b2b26c196
commit 8288da8372
21 changed files with 379 additions and 299 deletions
+25 -3
View File
@@ -4,6 +4,7 @@
import CommonHelper from "@/utils/CommonHelper";
import OverlayPanel from "@/components/base/OverlayPanel.svelte";
import { addSuccessToast } from "@/stores/toasts";
import { confirm } from "@/stores/confirmation";
const dispatch = createEventDispatcher();
@@ -17,6 +18,10 @@
loadChanges();
}
$: deletedCollections = oldCollections.filter((old) => {
return !CommonHelper.findByKey(newCollections, "id", old.id)?.id;
});
export function show(a, b) {
oldCollections = a;
newCollections = b;
@@ -103,7 +108,24 @@
return diffsToHtml(diffs, ops);
}
async function submitImport() {
function submitWithConfirm() {
if (deletedCollections.length) {
const deletedNames = deletedCollections.map((c) => c.name);
confirm(
`Do you really want to delete the following collections and their related records data:\n- ${deletedNames.join(
"\n- "
)}?`,
() => {
submit();
}
);
} else {
submit();
}
}
async function submit() {
if (isImporting) {
return;
}
@@ -111,7 +133,7 @@
isImporting = true;
try {
await ApiClient.collections.import(newCollections);
await ApiClient.collections.import(newCollections, true);
addSuccessToast("Successfully imported the collections configuration.");
dispatch("submit");
} catch (err) {
@@ -180,7 +202,7 @@
class="btn btn-expanded"
class:btn-loading={isImporting}
disabled={isImporting}
on:click={() => submitImport()}
on:click={() => submitWithConfirm()}
>
<span class="txt">Confirm and import</span>
</button>