Update top bar when not the primary builder and prevent flashing during loading states
This commit is contained in:
parent
7f96fbf741
commit
5f81584a14
|
@ -39,6 +39,7 @@ import { makePropSafe as safe } from "@budibase/string-templates"
|
||||||
import { getComponentFieldOptions } from "helpers/formFields"
|
import { getComponentFieldOptions } from "helpers/formFields"
|
||||||
|
|
||||||
const INITIAL_FRONTEND_STATE = {
|
const INITIAL_FRONTEND_STATE = {
|
||||||
|
initialised: false,
|
||||||
apps: [],
|
apps: [],
|
||||||
name: "",
|
name: "",
|
||||||
url: "",
|
url: "",
|
||||||
|
@ -70,6 +71,7 @@ const INITIAL_FRONTEND_STATE = {
|
||||||
previewDevice: "desktop",
|
previewDevice: "desktop",
|
||||||
highlightedSettingKey: null,
|
highlightedSettingKey: null,
|
||||||
builderSidePanel: false,
|
builderSidePanel: false,
|
||||||
|
hasLock: true,
|
||||||
|
|
||||||
// URL params
|
// URL params
|
||||||
selectedScreenId: null,
|
selectedScreenId: null,
|
||||||
|
@ -112,7 +114,7 @@ export const getFrontendStore = () => {
|
||||||
store.set({ ...INITIAL_FRONTEND_STATE })
|
store.set({ ...INITIAL_FRONTEND_STATE })
|
||||||
},
|
},
|
||||||
initialise: async pkg => {
|
initialise: async pkg => {
|
||||||
const { layouts, screens, application, clientLibPath } = pkg
|
const { layouts, screens, application, clientLibPath, hasLock } = pkg
|
||||||
|
|
||||||
await store.actions.components.refreshDefinitions(application.appId)
|
await store.actions.components.refreshDefinitions(application.appId)
|
||||||
|
|
||||||
|
@ -137,6 +139,8 @@ export const getFrontendStore = () => {
|
||||||
upgradableVersion: application.upgradableVersion,
|
upgradableVersion: application.upgradableVersion,
|
||||||
navigation: application.navigation || {},
|
navigation: application.navigation || {},
|
||||||
usedPlugins: application.usedPlugins || [],
|
usedPlugins: application.usedPlugins || [],
|
||||||
|
hasLock,
|
||||||
|
initialised: true,
|
||||||
}))
|
}))
|
||||||
screenHistoryStore.reset()
|
screenHistoryStore.reset()
|
||||||
automationHistoryStore.reset()
|
automationHistoryStore.reset()
|
||||||
|
|
|
@ -113,6 +113,7 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if $store.hasLock}
|
||||||
<div class="action-top-nav">
|
<div class="action-top-nav">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<div class="version">
|
<div class="version">
|
||||||
|
@ -212,10 +213,13 @@
|
||||||
>
|
>
|
||||||
Are you sure you want to unpublish the app <b>{selectedApp?.name}</b>?
|
Are you sure you want to unpublish the app <b>{selectedApp?.name}</b>?
|
||||||
</ConfirmDialog>
|
</ConfirmDialog>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<Button on:click={previewApp} secondary>Preview</Button>
|
<Button on:click={previewApp} secondary>Preview</Button>
|
||||||
|
{#if $store.hasLock}
|
||||||
<DeployModal onOk={completePublish} />
|
<DeployModal onOk={completePublish} />
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -134,6 +134,7 @@
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
<div class="top-nav">
|
<div class="top-nav">
|
||||||
|
{#if $store.initialised}
|
||||||
<div class="topleftnav">
|
<div class="topleftnav">
|
||||||
<ActionMenu>
|
<ActionMenu>
|
||||||
<div slot="control">
|
<div slot="control">
|
||||||
|
@ -148,7 +149,8 @@
|
||||||
Overview
|
Overview
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() => $goto(`../../portal/overview/${application}/access`)}
|
on:click={() =>
|
||||||
|
$goto(`../../portal/overview/${application}/access`)}
|
||||||
>
|
>
|
||||||
Access
|
Access
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -159,7 +161,8 @@
|
||||||
Automation history
|
Automation history
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() => $goto(`../../portal/overview/${application}/backups`)}
|
on:click={() =>
|
||||||
|
$goto(`../../portal/overview/${application}/backups`)}
|
||||||
>
|
>
|
||||||
Backups
|
Backups
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -171,7 +174,8 @@
|
||||||
Name and URL
|
Name and URL
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
on:click={() => $goto(`../../portal/overview/${application}/version`)}
|
on:click={() =>
|
||||||
|
$goto(`../../portal/overview/${application}/version`)}
|
||||||
>
|
>
|
||||||
Version
|
Version
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
@ -179,6 +183,7 @@
|
||||||
<Heading size="XS">{$store.name}</Heading>
|
<Heading size="XS">{$store.name}</Heading>
|
||||||
</div>
|
</div>
|
||||||
<div class="topcenternav">
|
<div class="topcenternav">
|
||||||
|
{#if $store.hasLock}
|
||||||
<Tabs {selected} size="M">
|
<Tabs {selected} size="M">
|
||||||
{#each $layout.children as { path, title }}
|
{#each $layout.children as { path, title }}
|
||||||
<TourWrap tourStepKey={`builder-${title}-section`}>
|
<TourWrap tourStepKey={`builder-${title}-section`}>
|
||||||
|
@ -192,10 +197,17 @@
|
||||||
</TourWrap>
|
</TourWrap>
|
||||||
{/each}
|
{/each}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
{:else}
|
||||||
|
<div class="secondary-editor">
|
||||||
|
<Icon name="LockClosed" />
|
||||||
|
Another user is currently editing your screens and automations
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="toprightnav">
|
<div class="toprightnav">
|
||||||
<AppActions {application} />
|
<AppActions {application} />
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#await promise}
|
{#await promise}
|
||||||
<!-- This should probably be some kind of loading state? -->
|
<!-- This should probably be some kind of loading state? -->
|
||||||
|
@ -270,4 +282,11 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--spacing-l);
|
gap: var(--spacing-l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.secondary-editor {
|
||||||
|
align-self: center;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue