UBERF-9165: Fix archived workspace select (#7712)

Fix workspace loading issue when click on archived

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2025-01-20 12:11:03 +07:00 committed by GitHub
parent 67ca63dace
commit 46084e0c82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 52 additions and 22 deletions

View File

@ -57,6 +57,7 @@
"Next": "Další", "Next": "Další",
"Skip": "Přeskočit", "Skip": "Přeskočit",
"SignUpCompleted": "Registrace dokončena", "SignUpCompleted": "Registrace dokončena",
"StartUsingHuly": "Začněte používat Huly" "StartUsingHuly": "Začněte používat Huly",
"WorkspaceIsArchived": "Pracovní prostor je archivován kvůli nečinnosti. Kontaktujte nás prosím pro obnovení..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Weiter", "Next": "Weiter",
"Skip": "Überspringen", "Skip": "Überspringen",
"SignUpCompleted": "Registrierung abgeschlossen", "SignUpCompleted": "Registrierung abgeschlossen",
"StartUsingHuly": "Starten Sie mit Huly" "StartUsingHuly": "Starten Sie mit Huly",
"WorkspaceArchivedDesc": "Workspace wurde wegen Inaktivität archiviert. Bitte kontaktieren Sie uns zur Wiederherstellung..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Next", "Next": "Next",
"Skip": "Skip", "Skip": "Skip",
"SignUpCompleted": "Sign up completed", "SignUpCompleted": "Sign up completed",
"StartUsingHuly": "Start using Huly" "StartUsingHuly": "Start using Huly",
"WorkspaceArchivedDesc": "Workspace is archived because of being unused, Please contact us to restore..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Siguiente", "Next": "Siguiente",
"Skip": "Saltar", "Skip": "Saltar",
"SignUpCompleted": "Registro completado", "SignUpCompleted": "Registro completado",
"StartUsingHuly": "Comienza a usar Huly" "StartUsingHuly": "Comienza a usar Huly",
"WorkspaceArchivedDesc": "El espacio de trabajo está archivado por no estar en uso, por favor contáctenos para restaurarlo..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Suivant", "Next": "Suivant",
"Skip": "Passer", "Skip": "Passer",
"SignUpCompleted": "Inscription terminée", "SignUpCompleted": "Inscription terminée",
"StartUsingHuly": "Commencez à utiliser Huly" "StartUsingHuly": "Commencez à utiliser Huly",
"WorkspaceArchivedDesc": "L'espace de travail est archivé en raison de son inactivité, veuillez nous contacter pour le restaurer..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Avanti", "Next": "Avanti",
"Skip": "Salta", "Skip": "Salta",
"SignUpCompleted": "Registrazione completata", "SignUpCompleted": "Registrazione completata",
"StartUsingHuly": "Inizia a usare Huly" "StartUsingHuly": "Inizia a usare Huly",
"WorkspaceArchivedDesc": "Il workspace è stato archiviato perché inutilizzato. Si prega di contattarci per ripristinarlo..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Seguinte", "Next": "Seguinte",
"Skip": "Saltar", "Skip": "Saltar",
"SignUpCompleted": "Registo concluído", "SignUpCompleted": "Registo concluído",
"StartUsingHuly": "Começar a usar Huly" "StartUsingHuly": "Começar a usar Huly",
"WorkspaceArchivedDesc": "O espaço de trabalho está arquivado por estar inativo, por favor, entre em contato conosco para restaurá-lo..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "Дальше", "Next": "Дальше",
"Skip": "Пропустить", "Skip": "Пропустить",
"SignUpCompleted": "Регистрация завершена", "SignUpCompleted": "Регистрация завершена",
"StartUsingHuly": "Начать использовать Huly" "StartUsingHuly": "Начать использовать Huly",
"WorkspaceArchivedDesc": "Рабочее пространство архивировано из-за неиспользования, пожалуйста, свяжитесь с нами для восстановления..."
} }
} }

View File

@ -57,6 +57,7 @@
"Next": "下一个", "Next": "下一个",
"Skip": "跳过", "Skip": "跳过",
"SignUpCompleted": "注册完成", "SignUpCompleted": "注册完成",
"StartUsingHuly": "开始使用 Huly" "StartUsingHuly": "开始使用 Huly",
"WorkspaceArchivedDesc": "工作区因未使用而归档,请与我们联系以恢复..."
} }
} }

View File

@ -60,7 +60,8 @@
(it) => (it) =>
(it.workspaceName?.includes(search) ?? false) || (it.workspaceName?.includes(search) ?? false) ||
(it.workspaceUrl?.includes(search) ?? false) || (it.workspaceUrl?.includes(search) ?? false) ||
it.workspace?.includes(search) it.workspace?.includes(search) ||
it.createdBy?.includes(search)
), ),
(it) => { (it) => {
const lastUsageDays = Math.round((now - it.lastVisit) / (1000 * 3600 * 24)) const lastUsageDays = Math.round((now - it.lastVisit) / (1000 * 3600 * 24))
@ -169,6 +170,9 @@
/> />
</div> </div>
</span> </span>
<div class="ml-1" style:width={'12rem'}>
{workspace.createdBy}
</div>
<span class="label overflow-label" style:width={'8rem'}> <span class="label overflow-label" style:width={'8rem'}>
{workspace.region ?? ''} {workspace.region ?? ''}
</span> </span>

View File

@ -14,24 +14,26 @@
// limitations under the License. // limitations under the License.
--> -->
<script lang="ts"> <script lang="ts">
import { isArchivingMode } from '@hcengineering/core'
import { LoginInfo, Workspace } from '@hcengineering/login' import { LoginInfo, Workspace } from '@hcengineering/login'
import { OK, Severity, Status } from '@hcengineering/platform' import { OK, Severity, Status } from '@hcengineering/platform'
import presentation, { NavLink, isAdminUser, reduceCalls } from '@hcengineering/presentation' import presentation, { NavLink, isAdminUser, reduceCalls } from '@hcengineering/presentation'
import MessageBox from '@hcengineering/presentation/src/components/MessageBox.svelte'
import { import {
Button, Button,
Label, Label,
Spinner,
Scroller, Scroller,
SearchEdit, SearchEdit,
Spinner,
deviceOptionsStore as deviceInfo, deviceOptionsStore as deviceInfo,
setMetadataLocalStorage, setMetadataLocalStorage,
showPopup,
ticker ticker
} from '@hcengineering/ui' } from '@hcengineering/ui'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import login from '../plugin' import login from '../plugin'
import { getAccount, getHref, getWorkspaces, goTo, navigateToWorkspace, selectWorkspace } from '../utils' import { getAccount, getHref, getWorkspaces, goTo, navigateToWorkspace, selectWorkspace } from '../utils'
import StatusControl from './StatusControl.svelte' import StatusControl from './StatusControl.svelte'
import { isArchivingMode } from '@hcengineering/core'
export let navigateUrl: string | undefined = undefined export let navigateUrl: string | undefined = undefined
let workspaces: Workspace[] = [] let workspaces: Workspace[] = []
@ -67,6 +69,17 @@
status = new Status(Severity.INFO, login.status.ConnectingToServer, {}) status = new Status(Severity.INFO, login.status.ConnectingToServer, {})
const [loginStatus, result] = await selectWorkspace(workspace) const [loginStatus, result] = await selectWorkspace(workspace)
if (isArchivingMode(result?.mode)) {
showPopup(MessageBox, {
label: login.string.SelectWorkspace,
message: login.string.WorkspaceArchivedDesc,
canSubmit: false,
params: {},
action: async () => {}
})
status = loginStatus
return
}
status = loginStatus status = loginStatus
navigateToWorkspace(workspace, result, navigateUrl) navigateToWorkspace(workspace, result, navigateUrl)
@ -139,17 +152,19 @@
{#if isArchivingMode(workspace.mode)} {#if isArchivingMode(workspace.mode)}
- <Label label={presentation.string.Archived} /> - <Label label={presentation.string.Archived} />
{/if} {/if}
{#if workspace.mode !== 'active'} {#if workspace.mode !== 'active' && workspace.mode !== 'archived'}
({workspace.progress}%) ({workspace.progress}%)
{/if} {/if}
</span> </span>
{#if isAdmin} <span class="text-xs flex-row-center flex-center">
<span class="text-xs flex-row-center flex-center"> {#if isAdmin}
{workspace.workspace} {workspace.workspace}
{#if workspace.region !== undefined} {#if workspace.region !== undefined}
at ({workspace.region}) at ({workspace.region})
{/if} {/if}
<div class="text-sm"> {/if}
<div class="text-sm">
{#if isAdmin}
{#if workspace.backupInfo != null} {#if workspace.backupInfo != null}
{@const sz = workspace.backupInfo.dataSize + workspace.backupInfo.blobsSize} {@const sz = workspace.backupInfo.dataSize + workspace.backupInfo.blobsSize}
{@const szGb = Math.round((sz * 100) / 1024) / 100} {@const szGb = Math.round((sz * 100) / 1024) / 100}
@ -159,10 +174,10 @@
- {Math.round(sz)}Mb - - {Math.round(sz)}Mb -
{/if} {/if}
{/if} {/if}
({lastUsageDays} days) {/if}
</div> ({lastUsageDays} days)
</span> </div>
{/if} </span>
</div> </div>
</div> </div>
{/each} {/each}

View File

@ -85,7 +85,9 @@ export default plugin(loginId, {
LinkValidHours: '' as IntlString, LinkValidHours: '' as IntlString,
EmailMask: '' as IntlString, EmailMask: '' as IntlString,
NoLimit: '' as IntlString, NoLimit: '' as IntlString,
InviteLimit: '' as IntlString InviteLimit: '' as IntlString,
WorkspaceArchived: '' as IntlString,
WorkspaceArchivedDesc: '' as IntlString
}, },
function: { function: {
SendInvite: '' as Resource<(email: string, personId?: Ref<Doc>, role?: AccountRole) => Promise<void>>, SendInvite: '' as Resource<(email: string, personId?: Ref<Doc>, role?: AccountRole) => Promise<void>>,

View File

@ -504,7 +504,7 @@ export async function selectWorkspace (
const result: WorkspaceLoginInfo = { const result: WorkspaceLoginInfo = {
endpoint: '', endpoint: '',
email, email,
token: '', token: generateToken(email, getWorkspaceId(workspaceInfo.workspace), getExtra(accountInfo)),
workspace: workspaceUrl, workspace: workspaceUrl,
workspaceId: workspaceInfo.workspace, workspaceId: workspaceInfo.workspace,
mode: workspaceInfo.mode, mode: workspaceInfo.mode,