diff --git a/dev/prod/src/platform.ts b/dev/prod/src/platform.ts index 7c7cc507d9..fc41bfacfe 100644 --- a/dev/prod/src/platform.ts +++ b/dev/prod/src/platform.ts @@ -72,14 +72,13 @@ import { textEditorId } from '@anticrm/text-editor' import { setMetadata } from '@anticrm/platform' - -export async function configurePlatform() { +export async function configurePlatform() { const config = await (await fetch('/config.json')).json() console.log('loading configuration', config) setMetadata(login.metadata.AccountsUrl, config.ACCOUNTS_URL) - setMetadata(login.metadata.UploadUrl, config.UPLOAD_URL) - - if( config.MODEL_VERSION != null) { + setMetadata(login.metadata.UploadUrl, config.UPLOAD_URL) + + if (config.MODEL_VERSION != null) { console.log('Minimal Model version requirement', config.MODEL_VERSION) setMetadata(presentation.metadata.RequiredVersion, config.MODEL_VERSION) } @@ -87,10 +86,18 @@ export async function configurePlatform() { setMetadata(login.metadata.GmailUrl, process.env.GMAIL_URL ?? 'http://localhost:8087') setMetadata(login.metadata.OverrideEndpoint, process.env.LOGIN_ENDPOINT) setMetadata(login.metadata.FrontUrl, process.env.FRONT_URL) - + setMetadata(rekoni.metadata.RekoniUrl, process.env.REKONI_URL) - setMetadata(uiPlugin.metadata.DefaultApplication, workbench.component.WorkbenchApp ) + setMetadata(uiPlugin.metadata.DefaultApplication, workbench.component.WorkbenchApp) + + setMetadata( + uiPlugin.metadata.Routes, + new Map([ + [workbenchId, workbench.component.WorkbenchApp], + [loginId, login.component.LoginApp] + ]) + ) addLocation(coreId, async () => ({ default: async () => ({}) })) addLocation(presentationId, async () => ({ default: async () => ({}) })) diff --git a/packages/ui/src/components/internal/Root.svelte b/packages/ui/src/components/internal/Root.svelte index 23df7fd73d..eba12694d2 100644 --- a/packages/ui/src/components/internal/Root.svelte +++ b/packages/ui/src/components/internal/Root.svelte @@ -22,8 +22,13 @@ onDestroy( location.subscribe((loc) => { - if (loc.path[0]) { - application = loc.path[0] as AnyComponent + const routes = getMetadata(uiPlugin.metadata.Routes) ?? new Map() + const component = loc.path[0] + + application = routes.get(component) + if (application === undefined && Array.from(routes.values()).includes(component as AnyComponent)) { + // if component id is used + application = component as AnyComponent } if (application === undefined) { diff --git a/packages/ui/src/plugin.ts b/packages/ui/src/plugin.ts index 42fdda11ee..ad63adfef8 100644 --- a/packages/ui/src/plugin.ts +++ b/packages/ui/src/plugin.ts @@ -67,7 +67,8 @@ export const uis = plugin(uiId, { Back: '' as IntlString }, metadata: { - DefaultApplication: '' as Metadata + DefaultApplication: '' as Metadata, + Routes: '' as Metadata> } }) diff --git a/plugins/login-resources/src/components/CreateWorkspaceForm.svelte b/plugins/login-resources/src/components/CreateWorkspaceForm.svelte index 3a16a1dac8..51a32e4764 100644 --- a/plugins/login-resources/src/components/CreateWorkspaceForm.svelte +++ b/plugins/login-resources/src/components/CreateWorkspaceForm.svelte @@ -20,7 +20,7 @@ import { createWorkspace } from '../utils' import { getCurrentLocation, navigate, setMetadataLocalStorage, showPopup } from '@anticrm/ui' import login from '../plugin' - import workbench from '@anticrm/workbench' + import { workbenchId } from '@anticrm/workbench' import InviteLink from './InviteLink.svelte' const fields = [{ name: 'workspace', i18n: login.string.Workspace, rule: /^[0-9a-z#%&^\-@!)(]{3,63}$/ }] @@ -45,7 +45,7 @@ setMetadataLocalStorage(login.metadata.LoginEmail, result.email) setMetadataLocalStorage(login.metadata.CurrentWorkspace, object.workspace) showPopup(InviteLink, {}, undefined, () => { - navigate({ path: [workbench.component.WorkbenchApp] }) + navigate({ path: [workbenchId] }) }) } } diff --git a/plugins/login-resources/src/components/Join.svelte b/plugins/login-resources/src/components/Join.svelte index f0c177bd79..d91b586022 100644 --- a/plugins/login-resources/src/components/Join.svelte +++ b/plugins/login-resources/src/components/Join.svelte @@ -20,7 +20,7 @@ import { join, signUpJoin } from '../utils' import login from '../plugin' - import workbench from '@anticrm/workbench' + import { workbenchId } from '@anticrm/workbench' const location = getCurrentLocation() let page = 'login' @@ -76,7 +76,7 @@ setMetadataLocalStorage(login.metadata.LoginEndpoint, result.endpoint) setMetadataLocalStorage(login.metadata.LoginEmail, result.email) setMetadataLocalStorage(login.metadata.CurrentWorkspace, result.workspace) - navigate({ path: [workbench.component.WorkbenchApp] }) + navigate({ path: [workbenchId] }) } } } diff --git a/plugins/login-resources/src/components/SelectWorkspace.svelte b/plugins/login-resources/src/components/SelectWorkspace.svelte index 2a8078bb6a..f23d18f767 100644 --- a/plugins/login-resources/src/components/SelectWorkspace.svelte +++ b/plugins/login-resources/src/components/SelectWorkspace.svelte @@ -16,7 +16,7 @@