From 11293997a941f5ff4d5f554bad68702b252e80c2 Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 18 May 2022 17:22:58 +0100 Subject: [PATCH] Code review updates --- packages/bbui/src/Layout/Layout.svelte | 8 + packages/bbui/src/Layout/Page.svelte | 8 +- .../src/components/common/AppLockModal.svelte | 6 +- .../src/components/common/DashCard.svelte | 12 +- .../src/pages/builder/portal/_layout.svelte | 2 +- .../pages/builder/portal/apps/index.svelte | 23 +- .../builder/portal/apps/templates.svelte | 9 +- .../overview/[application]/index.svelte | 308 +++++++++++++----- .../overview/_components/OverviewTab.svelte | 256 ++++++++------- .../overview/_components/SettingsTab.svelte | 28 +- 10 files changed, 426 insertions(+), 234 deletions(-) diff --git a/packages/bbui/src/Layout/Layout.svelte b/packages/bbui/src/Layout/Layout.svelte index c66a409242..ce37850811 100644 --- a/packages/bbui/src/Layout/Layout.svelte +++ b/packages/bbui/src/Layout/Layout.svelte @@ -40,6 +40,10 @@ padding-left: var(--spacing-xl); padding-right: var(--spacing-xl); } + .paddingX-XXL { + padding-left: calc(var(--spacing-xl) * 2); + padding-right: calc(var(--spacing-xl) * 2); + } .paddingY-S { padding-top: var(--spacing-s); padding-bottom: var(--spacing-s); @@ -56,6 +60,10 @@ padding-top: var(--spacing-xl); padding-bottom: var(--spacing-xl); } + .paddingY-XXL { + padding-top: calc(var(--spacing-xl) * 2); + padding-bottom: calc(var(--spacing-xl) * 2); + } .gap-XXS { grid-gap: var(--spacing-xs); } diff --git a/packages/bbui/src/Layout/Page.svelte b/packages/bbui/src/Layout/Page.svelte index c12d54787b..2996bcc613 100644 --- a/packages/bbui/src/Layout/Page.svelte +++ b/packages/bbui/src/Layout/Page.svelte @@ -1,9 +1,10 @@ -
+
@@ -23,4 +24,9 @@ max-width: none; margin: 0; } + + .noPadding { + padding: 0px; + margin: 0px; + } diff --git a/packages/builder/src/components/common/AppLockModal.svelte b/packages/builder/src/components/common/AppLockModal.svelte index 77c26a59d2..75e2b15925 100644 --- a/packages/builder/src/components/common/AppLockModal.svelte +++ b/packages/builder/src/components/common/AppLockModal.svelte @@ -28,8 +28,6 @@ $: lockedByHeading = lockedBy && lockedByYou ? "Locked by you" : `Locked by ${lockIdentifer}` - $: lockExpiry = getExpiryDuration(app) - const getExpiryDuration = app => { if (!app?.lockedBy?.lockedAt) { return -1 @@ -86,12 +84,12 @@ between your team.

- {#if lockedByYou && lockExpiry > 0} + {#if lockedByYou && getExpiryDuration(app) > 0} {processStringSync( "This lock will expire in {{ duration time 'millisecond' }} from now", { - time: lockExpiry, + time: getExpiryDuration(app), } )} diff --git a/packages/builder/src/components/common/DashCard.svelte b/packages/builder/src/components/common/DashCard.svelte index 1d7ea9120a..b3a2ac7d69 100644 --- a/packages/builder/src/components/common/DashCard.svelte +++ b/packages/builder/src/components/common/DashCard.svelte @@ -10,20 +10,13 @@
-
{ - if (actionDefined) { - action() - } - }} - > +
{title} {#if actionDefined} - + {/if}
@@ -36,7 +29,6 @@ .dash-card { background: var(--spectrum-alias-background-color-primary); border-radius: var(--border-radius-s); - border: 1px solid var(--spectrum-global-color-gray-300); overflow: hidden; min-height: 150px; } diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index f54b4ad834..1b4ccf7dbf 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -321,7 +321,7 @@ .mobile-toggle, .user-dropdown { - flex: 1 1 0; + flex: 0 1 0; } /* Reduce BBUI page padding */ diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 2869db42ff..2685881973 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -10,7 +10,6 @@ notifications, Body, Search, - Divider, Helpers, } from "@budibase/bbui" import TemplateDisplay from "components/common/TemplateDisplay.svelte" @@ -66,6 +65,9 @@ app?.name?.toLowerCase().includes(searchTerm.toLowerCase()) ) + $: lockedApps = filteredApps.filter(app => app?.lockedYou || app?.lockedOther) + $: unlocked = lockedApps?.length == 0 + const enrichApps = (apps, user, sortBy) => { const enrichedApps = apps.map(app => ({ ...app, @@ -178,10 +180,6 @@ } } - const previewApp = app => { - window.open(`/${app.devId}`) - } - const appOverview = app => { $goto(`../overview/${app.devId}`) } @@ -348,7 +346,7 @@ {/if} {#if enrichedApps.length} - +
- -
+ +
{#each filteredApps as app (app.appId)} {/each} @@ -490,6 +487,9 @@ diff --git a/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte b/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte index 37bf3f81b9..7100b4d725 100644 --- a/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte +++ b/packages/builder/src/pages/builder/portal/overview/_components/OverviewTab.svelte @@ -1,7 +1,14 @@
-
- -
-
- {#if isPublished} - - Published - {:else} - - Unpublished - {/if} -
- -

- {#if deployments?.length} - {processStringSync( - "Last published {{ duration time 'millisecond' }} ago", - { - time: - new Date().getTime() - - new Date(deployments[0].updatedAt).getTime(), - } - )} - {/if} - {#if !deployments?.length} - - - {/if} -

-
-
- -
- {#await userPromise} - - {:then _} -
- {#if appEditor} - -
- {appEditor._id === $auth.user._id ? "You" : appEditorText} -
+ +
+ +
+
+ {#if isPublished} + + Published + {:else} + + Unpublished {/if}
- {:catch error} -

Could not fetch user: {error.message}

- {/await} -

- {#if app} - {processStringSync( - "Last edited {{ duration time 'millisecond' }} ago", - { - time: new Date().getTime() - new Date(app?.updatedAt).getTime(), - } - )} - {/if} -

-
-
- { - navigateTab("Settings") - }} - dataCy={"app-version"} - > -
- {$store.version} - {#if updateAvailable} -

- New version {clientPackage.version} is available - - { - if (typeof navigateTab === "function") { - navigateTab("Settings") + +

+ {#if deployments?.length} + {processStringSync( + "Last published {{ duration time 'millisecond' }} ago", + { + time: + new Date().getTime() - + new Date(deployments[0].updatedAt).getTime(), } - }} - > - Update - + )} + {/if} + {#if !deployments?.length} + - + {/if}

- {:else} -

You're running the latest!

- {/if} -
-
-
- {#if false} -
- { - navigateTab("Automation History") - }} - dataCy={"automation-history"} - > -
-
-
- 0 -
- - Success -
+
+ + +
+ {#await userPromise} + + {:then _} +
+ {#if appEditor} + +
+ {appEditor._id === $auth.user._id ? "You" : appEditorText} +
+ {/if}
-
- 0 -
- - Error -
-
-
+ {:catch error} +

Could not fetch user: {error.message}

+ {/await} +

+ {#if app} + {processStringSync( + "Last edited {{ duration time 'millisecond' }} ago", + { + time: + new Date().getTime() - new Date(app?.updatedAt).getTime(), + } + )} + {/if} +

{ - navigateTab("Backups") + navigateTab("Settings") }} - dataCy={"backups"} + dataCy={"app-version"} > -
test
+
+ {$store.version} + {#if updateAvailable} +

+ New version {clientPackage.version} is available + - + { + if (typeof navigateTab === "function") { + navigateTab("Settings") + } + }} + > + Update + +

+ {:else} +

You're running the latest!

+ {/if} +
- {/if} + {#if false} +
+ { + navigateTab("Automation History") + }} + dataCy={"automation-history"} + > +
+
+
+ 0 +
+ + Success +
+
+
+ 0 +
+ + Error +
+
+
+
+
+ { + navigateTab("Backups") + }} + dataCy={"backups"} + > +
test
+
+
+ {/if} +