From c2c74678e43d2658820f818a8011d7004689ec8c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 13 May 2021 12:39:35 +0100 Subject: [PATCH] lock concept in UI, make dev links go to builder and prod links go to real apps --- .../src/components/start/AppCard.svelte | 13 +++- .../src/components/start/AppRow.svelte | 19 +++-- packages/builder/src/constants/index.js | 4 + .../pages/builder/portal/apps/index.svelte | 73 ++++++++++--------- 4 files changed, 62 insertions(+), 47 deletions(-) diff --git a/packages/builder/src/components/start/AppCard.svelte b/packages/builder/src/components/start/AppCard.svelte index fdbfe2a822..12220863cf 100644 --- a/packages/builder/src/components/start/AppCard.svelte +++ b/packages/builder/src/components/start/AppCard.svelte @@ -9,20 +9,26 @@ Link, } from "@budibase/bbui" import { gradient } from "actions" + import { AppStatus } from "constants" import { url } from "@roxi/routify" export let app export let exportApp export let deleteApp + export let appStatus + + let href = + appStatus === AppStatus.DEV ? $url(`../../app/${app._id}`) : `/${app._id}` + let target = appStatus === AppStatus.DEV ? "_self" : "_target"
- + - {app._id} {app.name} + {app.name} @@ -33,13 +39,14 @@ deleteApp(app)} icon="Delete"> Delete + deleteApp(app)} icon="Code">Develop
Edited {Math.floor(1 + Math.random() * 10)} months ago - {#if Math.random() > 0.5} + {#if appStatus === AppStatus.DEV && app.lockedBy} {/if}
diff --git a/packages/builder/src/components/start/AppRow.svelte b/packages/builder/src/components/start/AppRow.svelte index ce534336ca..113edae7ac 100644 --- a/packages/builder/src/components/start/AppRow.svelte +++ b/packages/builder/src/components/start/AppRow.svelte @@ -8,6 +8,7 @@ MenuItem, Link, } from "@budibase/bbui" + import { AppStatus } from "constants" import { url } from "@roxi/routify" export let app @@ -15,11 +16,16 @@ export let exportApp export let deleteApp export let last + export let appStatus + + let href = + appStatus === AppStatus.DEV ? $url(`../../app/${app._id}`) : `/${app._id}` + let target = appStatus === AppStatus.DEV ? "_self" : "_target"
- + {app.name} @@ -29,15 +35,12 @@ Edited {Math.round(Math.random() * 10 + 1)} months ago
- {#if Math.random() < 0.33} + {#if app.lockedBy} +
+ Locked by {app.lockedBy.email} + {:else}
Open - {:else if Math.random() < 0.33} -
- Locked by Will Wheaton - {:else} -
- Locked by you {/if}
diff --git a/packages/builder/src/constants/index.js b/packages/builder/src/constants/index.js index a858df674b..6128b78109 100644 --- a/packages/builder/src/constants/index.js +++ b/packages/builder/src/constants/index.js @@ -9,6 +9,10 @@ export const FrontendTypes = { NONE: "none", } +export const AppStatus = { + DEV: "dev", +} + // fields on the user table that cannot be edited export const UNEDITABLE_USER_FIELDS = ["email", "password", "roleId", "status"] diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 9760f49674..c6ca167d09 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -93,46 +93,46 @@ onMount(async () => { checkKeys() - await apps.load() + await apps.load(appStatus) loaded = true }) - {#if $apps.length} - -
- Apps - - - - -
-
-
-
+ + (layout = "grid")} + selected={layout === "grid"} + quiet + icon="ClassicGridView" + /> + (layout = "table")} + selected={layout === "table"} + quiet + icon="ViewRow" + /> + +
+ {#if $apps.length}
{/each}
-
- {/if} + {/if} + {#if !$apps.length && !creatingApp && loaded}