|
14 | 14 | // limitations under the License.
|
15 | 15 | -->
|
16 | 16 | <script lang="ts">
|
17 |
| - import { isActiveMode, isArchivingMode, isRestoringMode, isUpgradingMode } from '@hcengineering/core' |
18 |
| - import { LoginInfo, WorkspaceInfoWithStatus } from '@hcengineering/login' |
| 17 | + import { |
| 18 | + WorkspaceInfoWithStatus, |
| 19 | + isActiveMode, |
| 20 | + isArchivingMode, |
| 21 | + isRestoringMode, |
| 22 | + isUpgradingMode |
| 23 | + } from '@hcengineering/core' |
| 24 | + import { LoginInfo } from '@hcengineering/login' |
19 | 25 | import { OK, Severity, Status } from '@hcengineering/platform'
|
20 | 26 | import presentation, { MessageBox, NavLink, isAdminUser, reduceCalls } from '@hcengineering/presentation'
|
21 | 27 | import {
|
22 |
| - ticker, |
23 | 28 | Button,
|
24 | 29 | Label,
|
25 | 30 | Scroller,
|
26 | 31 | SearchEdit,
|
27 | 32 | Spinner,
|
28 | 33 | deviceOptionsStore as deviceInfo,
|
29 |
| - showPopup |
| 34 | + showPopup, |
| 35 | + ticker |
30 | 36 | } from '@hcengineering/ui'
|
31 | 37 | import { logOut } from '@hcengineering/workbench'
|
32 | 38 | import { onMount } from 'svelte'
|
33 | 39 |
|
34 | 40 | import login from '../plugin'
|
35 | 41 | import {
|
36 |
| - fetchWorkspace, |
37 | 42 | getAccount,
|
| 43 | + getAccountDisplayName, |
| 44 | + getHref, |
38 | 45 | getWorkspaces,
|
39 | 46 | goTo,
|
40 | 47 | navigateToWorkspace,
|
41 | 48 | selectWorkspace,
|
42 |
| - getAccountDisplayName |
| 49 | + unArchive |
43 | 50 | } from '../utils'
|
44 | 51 | import StatusControl from './StatusControl.svelte'
|
| 52 | +
|
| 53 | + export let navigateUrl: string | undefined = undefined |
| 54 | +
|
45 | 55 | let workspaces: WorkspaceInfoWithStatus[] = []
|
46 | 56 | let status = OK
|
47 | 57 | let accountPromise: Promise<LoginInfo | null>
|
|
75 | 85 | status = new Status(Severity.INFO, login.status.ConnectingToServer, {})
|
76 | 86 |
|
77 | 87 | const [loginStatus, result] = await selectWorkspace(workspaceUrl)
|
78 |
| - if (isArchivingMode(result?.mode) && result?.workspaceId !== undefined) { |
79 |
| - const workspaceId = result?.workspaceId |
| 88 | +
|
| 89 | + const ws = workspaces.find((it) => it.uuid === result?.workspace) |
| 90 | + if (ws != null && isArchivingMode(ws?.mode) && result?.workspace !== undefined) { |
80 | 91 | showPopup(MessageBox, {
|
81 | 92 | label: login.string.SelectWorkspace,
|
82 | 93 | message: login.string.WorkspaceArchivedDesc,
|
83 | 94 | canSubmit: true,
|
84 | 95 | params: {},
|
85 | 96 | okLabel: login.string.RestoreArchivedWorkspace,
|
86 | 97 | action: async () => {
|
87 |
| - if (await unArchive(workspaceId, result.token)) { |
| 98 | + if (await unArchive(ws.uuid, result.token)) { |
88 | 99 | workspaces = await getWorkspaces()
|
89 |
| - let info = workspaces.filter((it) => it.workspaceId === workspaceId).shift() |
| 100 | + let info = workspaces.find((it) => it.uuid === ws.uuid) |
90 | 101 | while (isRestoringMode(info?.mode) || isUpgradingMode(info?.mode)) {
|
91 | 102 | await new Promise<void>((resolve) => setTimeout(resolve, 5000))
|
92 | 103 | workspaces = await getWorkspaces()
|
93 |
| - info = workspaces.filter((it) => it.workspaceId === workspaceId).shift() |
| 104 | + info = workspaces.find((it) => it.uuid === ws.uuid) |
94 | 105 | }
|
95 | 106 | }
|
96 | 107 | }
|
|
0 commit comments