From 5f81584a14390938b8a67d2449454a562fe70fc4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 12 May 2023 14:16:10 +0100 Subject: [PATCH] Update top bar when not the primary builder and prevent flashing during loading states --- .../src/builderStore/store/frontend.js | 6 +- .../src/components/deploy/AppActions.svelte | 190 +++++++++--------- .../builder/app/[application]/_layout.svelte | 141 +++++++------ 3 files changed, 182 insertions(+), 155 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index e264dc099b..33c82778e3 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -39,6 +39,7 @@ import { makePropSafe as safe } from "@budibase/string-templates" import { getComponentFieldOptions } from "helpers/formFields" const INITIAL_FRONTEND_STATE = { + initialised: false, apps: [], name: "", url: "", @@ -70,6 +71,7 @@ const INITIAL_FRONTEND_STATE = { previewDevice: "desktop", highlightedSettingKey: null, builderSidePanel: false, + hasLock: true, // URL params selectedScreenId: null, @@ -112,7 +114,7 @@ export const getFrontendStore = () => { store.set({ ...INITIAL_FRONTEND_STATE }) }, initialise: async pkg => { - const { layouts, screens, application, clientLibPath } = pkg + const { layouts, screens, application, clientLibPath, hasLock } = pkg await store.actions.components.refreshDefinitions(application.appId) @@ -137,6 +139,8 @@ export const getFrontendStore = () => { upgradableVersion: application.upgradableVersion, navigation: application.navigation || {}, usedPlugins: application.usedPlugins || [], + hasLock, + initialised: true, })) screenHistoryStore.reset() automationHistoryStore.reset() diff --git a/packages/builder/src/components/deploy/AppActions.svelte b/packages/builder/src/components/deploy/AppActions.svelte index daed564204..9813237317 100644 --- a/packages/builder/src/components/deploy/AppActions.svelte +++ b/packages/builder/src/components/deploy/AppActions.svelte @@ -113,109 +113,113 @@ }) -
-
-
- -
- - - {#if isPublished} -
-
- -
- -
- - Your published app - - - {processStringSync( - "Last published {{ duration time 'millisecond' }} ago", - { - time: - new Date().getTime() - - new Date(latestDeployments[0].updatedAt).getTime(), - } - )} - - -
- - -
-
-
-
+{#if $store.hasLock} +
+
+
+
- {/if} + - {#if !isPublished} - - {/if} + {#if isPublished} +
+
+ +
+ +
+ + Your published app + + + {processStringSync( + "Last published {{ duration time 'millisecond' }} ago", + { + time: + new Date().getTime() - + new Date(latestDeployments[0].updatedAt).getTime(), + } + )} + + +
+ + +
+
+
+
+
+ {/if} - - + {#if !isPublished} { - store.update(state => { - state.builderSidePanel = true - return state - }) - }} - > - Users - - - -
-
+ tooltip="Your app has not been published yet" + disabled + /> + {/if} - - Are you sure you want to unpublish the app {selectedApp?.name}? - + + + { + store.update(state => { + state.builderSidePanel = true + return state + }) + }} + > + Users + + + +
+
+ + + Are you sure you want to unpublish the app {selectedApp?.name}? + +{/if}
- + {#if $store.hasLock} + + {/if}