diff --git a/ui/.env b/ui/.env index c983d07f..bcd72804 100644 --- a/ui/.env +++ b/ui/.env @@ -1,5 +1,7 @@ # all environments should start with 'PB_' prefix -PB_BACKEND_URL = ../ -PB_PROFILE_COLLECTION = profiles -PB_RULES_SYNTAX_DOCS = https://pocketbase.io/docs/manage-collections#rules-filters-syntax -PB_INSTALLER_PARAM = installer +PB_BACKEND_URL = "../" +PB_PROFILE_COLLECTION = "profiles" +PB_RULES_SYNTAX_DOCS = "https://pocketbase.io/docs/manage-collections#rules-filters-syntax" +PB_INSTALLER_PARAM = "installer" +PB_RELEASES = "https://github.com/pocketbase/pocketbase/releases" +PB_VERSION = "v0.4.0" diff --git a/ui/.env.development b/ui/.env.development index b4615bf4..d00088b5 100644 --- a/ui/.env.development +++ b/ui/.env.development @@ -1 +1 @@ -PB_BACKEND_URL = http://127.0.0.1:8090 +PB_BACKEND_URL = "http://127.0.0.1:8090" diff --git a/ui/index.html b/ui/index.html index 4330e9b4..e3c250ed 100644 --- a/ui/index.html +++ b/ui/index.html @@ -20,7 +20,7 @@ - + -
-
- -
+ +
{#if !nobranding}
- -
-
+ diff --git a/ui/src/components/base/PageWrapper.svelte b/ui/src/components/base/PageWrapper.svelte new file mode 100644 index 00000000..e1cb01ba --- /dev/null +++ b/ui/src/components/base/PageWrapper.svelte @@ -0,0 +1,24 @@ + + + diff --git a/ui/src/components/logs/PageLogs.svelte b/ui/src/components/logs/PageLogs.svelte index dc363e58..b6ee6b59 100644 --- a/ui/src/components/logs/PageLogs.svelte +++ b/ui/src/components/logs/PageLogs.svelte @@ -1,6 +1,7 @@ -
+
+ diff --git a/ui/src/components/records/PageRecords.svelte b/ui/src/components/records/PageRecords.svelte index 9a2772a3..afda82dc 100644 --- a/ui/src/components/records/PageRecords.svelte +++ b/ui/src/components/records/PageRecords.svelte @@ -8,6 +8,7 @@ } from "@/stores/collections"; import tooltip from "@/actions/tooltip"; import { pageTitle } from "@/stores/app"; + import PageWrapper from "@/components/base/PageWrapper.svelte"; import Searchbar from "@/components/base/Searchbar.svelte"; import RefreshButton from "@/components/base/RefreshButton.svelte"; import CollectionsSidebar from "@/components/collections/CollectionsSidebar.svelte"; @@ -55,29 +56,33 @@ {#if $isCollectionsLoading} -
- -

Loading collections...

-
-{:else if !viewableCollections.length} -
-
- + +
+ +

Loading collections...

-

Create your first collection to add records!

- -
+ +{:else if !viewableCollections.length} + +
+
+ +
+

Create your first collection to add records!

+ +
+
{:else} -
+
+ {/if} diff --git a/ui/src/components/settings/ImportPopup.svelte b/ui/src/components/settings/ImportPopup.svelte index a8e51961..74fff8e4 100644 --- a/ui/src/components/settings/ImportPopup.svelte +++ b/ui/src/components/settings/ImportPopup.svelte @@ -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()} > Confirm and import diff --git a/ui/src/components/settings/PageApplication.svelte b/ui/src/components/settings/PageApplication.svelte index a3af0cf4..74d9bd0c 100644 --- a/ui/src/components/settings/PageApplication.svelte +++ b/ui/src/components/settings/PageApplication.svelte @@ -3,6 +3,7 @@ import CommonHelper from "@/utils/CommonHelper"; import { pageTitle, appName } from "@/stores/app"; import { addSuccessToast } from "@/stores/toasts"; + import PageWrapper from "@/components/base/PageWrapper.svelte"; import Field from "@/components/base/Field.svelte"; import SettingsSidebar from "@/components/settings/SettingsSidebar.svelte"; @@ -62,7 +63,7 @@ -
+
- + diff --git a/ui/src/components/settings/PageAuthProviders.svelte b/ui/src/components/settings/PageAuthProviders.svelte index a9d08f8f..503769ff 100644 --- a/ui/src/components/settings/PageAuthProviders.svelte +++ b/ui/src/components/settings/PageAuthProviders.svelte @@ -4,6 +4,7 @@ import { pageTitle } from "@/stores/app"; import { setErrors } from "@/stores/errors"; import { addSuccessToast } from "@/stores/toasts"; + import PageWrapper from "@/components/base/PageWrapper.svelte"; import SettingsSidebar from "@/components/settings/SettingsSidebar.svelte"; import EmailAuthAccordion from "@/components/settings/EmailAuthAccordion.svelte"; import AuthProviderAccordion from "@/components/settings/AuthProviderAccordion.svelte"; @@ -73,7 +74,7 @@ -
+
- +
diff --git a/ui/src/components/settings/PageExportCollections.svelte b/ui/src/components/settings/PageExportCollections.svelte index 7898bfe7..9accfcca 100644 --- a/ui/src/components/settings/PageExportCollections.svelte +++ b/ui/src/components/settings/PageExportCollections.svelte @@ -3,6 +3,7 @@ import CommonHelper from "@/utils/CommonHelper"; import { pageTitle } from "@/stores/app"; import { addInfoToast } from "@/stores/toasts"; + import PageWrapper from "@/components/base/PageWrapper.svelte"; import CodeBlock from "@/components/base/CodeBlock.svelte"; import SettingsSidebar from "@/components/settings/SettingsSidebar.svelte"; @@ -43,13 +44,13 @@ function copy() { CommonHelper.copyToClipboard(schema); - addInfoToast("The collections list was copied to your clipboard!", 3000); + addInfoToast("The configuration was copied to your clipboard!", 3000); } -
+
- +