App metadata screen fixes, copy code button casing and delete app button hidden on publish

This commit is contained in:
Dean 2023-06-29 09:53:13 +01:00
parent 59ae9f4f98
commit 854950581c
7 changed files with 37 additions and 40 deletions

View File

@ -155,6 +155,7 @@ export const getFrontendStore = () => {
...INITIAL_FRONTEND_STATE.features, ...INITIAL_FRONTEND_STATE.features,
...application.features, ...application.features,
}, },
icon: application.icon || {},
initialised: true, initialised: true,
})) }))
screenHistoryStore.reset() screenHistoryStore.reset()

View File

@ -275,7 +275,7 @@
} }
}} }}
> >
{selectedApp ? `${selectedApp?.url}` : ""} {$store.url}
{#if isPublished} {#if isPublished}
<Icon size="S" name="LinkOut" /> <Icon size="S" name="LinkOut" />
{:else} {:else}
@ -344,7 +344,12 @@
<Modal bind:this={updateAppModal} padding={false} width="600px"> <Modal bind:this={updateAppModal} padding={false} width="600px">
<UpdateAppModal <UpdateAppModal
app={selectedApp} app={{
name: $store.name,
url: $store.url,
icon: $store.icon,
devId: $store.appId,
}}
onUpdateComplete={async () => { onUpdateComplete={async () => {
await initialiseApp() await initialiseApp()
}} }}

View File

@ -47,7 +47,7 @@
async function updateApp() { async function updateApp() {
try { try {
await apps.update(app.instance._id, { await apps.update(app.devId, {
name: $values.name?.trim(), name: $values.name?.trim(),
url: $values.url?.trim(), url: $values.url?.trim(),
icon: { icon: {

View File

@ -3,8 +3,14 @@
import { Page, Layout } from "@budibase/bbui" import { Page, Layout } from "@budibase/bbui"
import { url, isActive } from "@roxi/routify" import { url, isActive } from "@roxi/routify"
import DeleteModal from "components/deploy/DeleteModal.svelte" import DeleteModal from "components/deploy/DeleteModal.svelte"
import { apps } from "stores/portal"
import { store } from "builderStore"
let deleteModal let deleteModal
$: filteredApps = $apps.filter(app => app.devId === $store.appId)
$: selectedApp = filteredApps?.length ? filteredApps[0] : null
$: isPublished = selectedApp?.status === "published"
</script> </script>
<!-- routify:options index=4 --> <!-- routify:options index=4 -->
@ -43,6 +49,7 @@
url={$url("./version")} url={$url("./version")}
active={$isActive("./version")} active={$isActive("./version")}
/> />
{#if !isPublished}
<div class="delete-action"> <div class="delete-action">
<SideNavItem <SideNavItem
text="Delete app" text="Delete app"
@ -51,6 +58,7 @@
}} }}
/> />
</div> </div>
{/if}
</SideNav> </SideNav>
<slot /> <slot />
</Content> </Content>

View File

@ -39,7 +39,7 @@
notifications.success("Copied") notifications.success("Copied")
}} }}
> >
Copy Code Copy code
</Button> </Button>
</div> </div>
{:else} {:else}

View File

@ -19,11 +19,10 @@
$: filteredApps = $apps.filter(app => app.devId == $store.appId) $: filteredApps = $apps.filter(app => app.devId == $store.appId)
$: app = filteredApps.length ? filteredApps[0] : {} $: app = filteredApps.length ? filteredApps[0] : {}
$: appUrl = `${window.origin}/app${app?.url}`
$: appDeployed = app?.status === AppStatus.DEPLOYED $: appDeployed = app?.status === AppStatus.DEPLOYED
const initialiseApp = async () => { const initialiseApp = async () => {
const applicationPkg = await API.fetchAppPackage(app.devId) const applicationPkg = await API.fetchAppPackage($store.appId)
await store.actions.initialise(applicationPkg) await store.actions.initialise(applicationPkg)
} }
</script> </script>
@ -37,7 +36,7 @@
<Layout noPadding gap="XXS"> <Layout noPadding gap="XXS">
<Label size="L">Name</Label> <Label size="L">Name</Label>
<Body>{app?.name}</Body> <Body>{$store?.name}</Body>
</Layout> </Layout>
<Layout noPadding gap="XS"> <Layout noPadding gap="XS">
@ -45,15 +44,15 @@
<div class="icon"> <div class="icon">
<Icon <Icon
size="L" size="L"
name={app?.icon?.name || "Apps"} name={$store?.icon?.name || "Apps"}
color={app?.icon?.color} color={$store?.icon?.color}
/> />
</div> </div>
</Layout> </Layout>
<Layout noPadding gap="XXS"> <Layout noPadding gap="XXS">
<Label size="L">URL</Label> <Label size="L">URL</Label>
<Body>{appUrl}</Body> <Body>{$store.url}</Body>
</Layout> </Layout>
<div> <div>
@ -75,7 +74,12 @@
<Modal bind:this={updatingModal} padding={false} width="600px"> <Modal bind:this={updatingModal} padding={false} width="600px">
<UpdateAppModal <UpdateAppModal
{app} app={{
name: $store.name,
url: $store.url,
icon: $store.icon,
devId: $store.appId,
}}
onUpdateComplete={async () => { onUpdateComplete={async () => {
await initialiseApp() await initialiseApp()
}} }}

View File

@ -1,21 +0,0 @@
import { writable, derived } from "svelte/store"
import { apps } from "./apps"
const createOverviewStore = () => {
const store = writable({
selectedAppId: null,
})
const derivedStore = derived([store, apps], ([$store, $apps]) => {
return {
...$store,
selectedApp: $apps?.find(app => app.devId === $store.selectedAppId),
}
})
return {
update: store.update,
subscribe: derivedStore.subscribe,
}
}
export const overview = createOverviewStore()