From 1602e97047cf0e76d09d8b6588526c9ac1a52adb Mon Sep 17 00:00:00 2001 From: Dean Date: Tue, 14 May 2024 10:48:20 +0100 Subject: [PATCH] Added updated UX for updating app metadata. --- .../bbui/src/Actions/position_dropdown.js | 2 + .../src/components/common/EditableIcon.svelte | 15 +- .../components/common/UpdateAppForm.svelte | 217 ++++++++++++++++++ .../components/common/UpdateAppTopNav.svelte | 77 +++++++ .../src/components/deploy/AppActions.svelte | 26 --- .../components/start/UpdateAppModal.svelte | 151 ------------ .../settings/name-and-url.svelte | 86 +------ 7 files changed, 309 insertions(+), 265 deletions(-) create mode 100644 packages/builder/src/components/common/UpdateAppForm.svelte create mode 100644 packages/builder/src/components/common/UpdateAppTopNav.svelte delete mode 100644 packages/builder/src/components/start/UpdateAppModal.svelte diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 6c4fcab757..21635592d2 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -155,6 +155,8 @@ export default function positionDropdown(element, opts) { applyXStrategy(Strategies.StartToEnd) } else if (align === "left-outside") { applyXStrategy(Strategies.EndToStart) + } else if (align === "center") { + applyXStrategy(Strategies.MidPoint) } else { applyXStrategy(Strategies.StartToStart) } diff --git a/packages/builder/src/components/common/EditableIcon.svelte b/packages/builder/src/components/common/EditableIcon.svelte index 776fab5307..6c0986e601 100644 --- a/packages/builder/src/components/common/EditableIcon.svelte +++ b/packages/builder/src/components/common/EditableIcon.svelte @@ -7,6 +7,7 @@ export let app export let color export let autoSave = false + export let disabled = false let modal @@ -14,12 +15,16 @@
-
- -
-
+ {#if !disabled} +
+ +
+
+ +
+ {:else} -
+ {/if}
diff --git a/packages/builder/src/components/common/UpdateAppForm.svelte b/packages/builder/src/components/common/UpdateAppForm.svelte new file mode 100644 index 0000000000..6fc897dffa --- /dev/null +++ b/packages/builder/src/components/common/UpdateAppForm.svelte @@ -0,0 +1,217 @@ + + +
+
+
+ + ($validation.touched.name = true)} + on:change={nameToUrl($values.name)} + disabled={appDeployed} + /> +
+
+ + ($validation.touched.url = true)} + on:change={tidyUrl($values.url)} + placeholder={$values.url + ? $values.url + : `/${resolveAppUrl(null, $values.name)}`} + disabled={appDeployed} + /> +
+
+ + +
+
+ {#if !appDeployed} + + {:else} +
+ Unpublish your app to edit name and URL +
+ {/if} +
+
+
+ + diff --git a/packages/builder/src/components/common/UpdateAppTopNav.svelte b/packages/builder/src/components/common/UpdateAppTopNav.svelte new file mode 100644 index 0000000000..539cc78582 --- /dev/null +++ b/packages/builder/src/components/common/UpdateAppTopNav.svelte @@ -0,0 +1,77 @@ + + +
+ + +
{ + formPopover.show() + }} + > + + + + +
+
+ + { + formPopoverOpen = false + }} + on:open={() => { + formPopoverOpen = true + }} +> + +
+ +
+
+
+ + diff --git a/packages/builder/src/components/deploy/AppActions.svelte b/packages/builder/src/components/deploy/AppActions.svelte index 105d1ed958..94153252a6 100644 --- a/packages/builder/src/components/deploy/AppActions.svelte +++ b/packages/builder/src/components/deploy/AppActions.svelte @@ -8,13 +8,11 @@ ActionButton, Icon, Link, - Modal, StatusLight, AbsTooltip, } from "@budibase/bbui" import RevertModal from "components/deploy/RevertModal.svelte" import VersionModal from "components/deploy/VersionModal.svelte" - import UpdateAppModal from "components/start/UpdateAppModal.svelte" import { processStringSync } from "@budibase/string-templates" import ConfirmDialog from "components/common/ConfirmDialog.svelte" import analytics, { Events, EventSource } from "analytics" @@ -37,7 +35,6 @@ export let loaded let unpublishModal - let updateAppModal let revertModal let versionModal let appActionPopover @@ -61,11 +58,6 @@ $: canPublish = !publishing && loaded && $sortedScreens.length > 0 $: lastDeployed = getLastDeployedString($deploymentStore, lastOpened) - const initialiseApp = async () => { - const applicationPkg = await API.fetchAppPackage($appStore.devId) - await initialise(applicationPkg) - } - const getLastDeployedString = deployments => { return deployments?.length ? processStringSync("Published {{ duration time 'millisecond' }} ago", { @@ -247,16 +239,12 @@ appActionPopover.hide() if (isPublished) { viewApp() - } else { - updateAppModal.show() } }} > {$appStore.url} {#if isPublished} - {:else} - {/if} @@ -330,20 +318,6 @@ Are you sure you want to unpublish the app {selectedApp?.name}? - - { - await initialiseApp() - }} - /> - - diff --git a/packages/builder/src/components/start/UpdateAppModal.svelte b/packages/builder/src/components/start/UpdateAppModal.svelte deleted file mode 100644 index 94f6b20694..0000000000 --- a/packages/builder/src/components/start/UpdateAppModal.svelte +++ /dev/null @@ -1,151 +0,0 @@ - - - - ($validation.touched.name = true)} - on:change={nameToUrl($values.name)} - label="Name" - /> - - - - - ($validation.touched.url = true)} - on:change={tidyUrl($values.url)} - label="URL" - placeholder={$values.url - ? $values.url - : `/${resolveAppUrl(null, $values.name)}`} - /> - diff --git a/packages/builder/src/pages/builder/app/[application]/settings/name-and-url.svelte b/packages/builder/src/pages/builder/app/[application]/settings/name-and-url.svelte index be580552c7..e91b8ac3a8 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/name-and-url.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/name-and-url.svelte @@ -1,30 +1,6 @@ @@ -33,61 +9,5 @@ Edit your app's name and URL - - - - {$appStore?.name} - - - - -
- -
-
- - - - {$appStore.url} - - -
- -
+ - - - { - await initialiseApp() - }} - /> - - -