From d8b4b84c9c96b09aa2971f733b0dc617cc99eb83 Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Sat, 29 Jun 2024 17:22:19 +0400 Subject: [PATCH] uberf-7434: show dowload progress (#5944) --- packages/presentation/src/utils.ts | 10 +++++ .../src/components/GuestApp.svelte | 6 +++ plugins/workbench-assets/lang/en.json | 3 +- plugins/workbench-assets/lang/es.json | 3 +- plugins/workbench-assets/lang/fr.json | 3 +- plugins/workbench-assets/lang/pt.json | 3 +- plugins/workbench-assets/lang/ru.json | 3 +- plugins/workbench-assets/lang/zh.json | 3 +- .../src/components/WorkbenchApp.svelte | 42 ++++++++++++------- plugins/workbench/src/index.ts | 3 +- 10 files changed, 58 insertions(+), 21 deletions(-) diff --git a/packages/presentation/src/utils.ts b/packages/presentation/src/utils.ts index 28001a69a0..1679dfe2cc 100644 --- a/packages/presentation/src/utils.ts +++ b/packages/presentation/src/utils.ts @@ -704,3 +704,13 @@ export function setPresentationCookie (token: string, workspaceId: string): void } setToken('/files/' + workspaceId) } + +export const upgradeDownloadProgress = writable(0) + +export function setDownloadProgress (percent: number): void { + if (Number.isNaN(percent)) { + return + } + + upgradeDownloadProgress.set(Math.round(percent)) +} diff --git a/plugins/guest-resources/src/components/GuestApp.svelte b/plugins/guest-resources/src/components/GuestApp.svelte index cd9893882d..46b9a6542f 100644 --- a/plugins/guest-resources/src/components/GuestApp.svelte +++ b/plugins/guest-resources/src/components/GuestApp.svelte @@ -15,6 +15,7 @@ -{#if $location.path[0] === workbenchId || $location.path[0] === workbench.component.WorkbenchApp} +{#if $location.path[0] === workbenchId || $location.path[0] === workbenchRes.component.WorkbenchApp} {#if $deviceOptionsStore.isMobile && mobileAllowed !== true}
-

-
{:else} {#key $location.path[1]} - {#await connect(getMetadata(workbench.metadata.PlatformTitle) ?? 'Platform')} + {#await connect(getMetadata(workbenchRes.metadata.PlatformTitle) ?? 'Platform')} {#if ($workspaceCreating ?? -1) > 0}
-
{/if} {#if $versionError} -
+
{$versionError}
{/if} + {#if $upgradeDownloadProgress > 0} +
+
+ {/if} {:then client} {#if $versionError}
{#if isNeedUpgrade} -

- +

+ {:else} -

+

{/if} {$versionError} + {#if $upgradeDownloadProgress > 0} +
+
+ {/if}
{:else if client} - + {/if} {:catch error} diff --git a/plugins/workbench/src/index.ts b/plugins/workbench/src/index.ts index 144665da16..59a74a0e29 100644 --- a/plugins/workbench/src/index.ts +++ b/plugins/workbench/src/index.ts @@ -154,7 +154,8 @@ export default plugin(workbenchId, { string: { Archive: '' as IntlString, View: '' as IntlString, - ServerUnderMaintenance: '' as IntlString + ServerUnderMaintenance: '' as IntlString, + UpgradeDownloadProgress: '' as IntlString }, icon: { Search: '' as Asset