From 4b87887a4fa885f4f848807cc082191f718a978d Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Sat, 31 Jul 2021 17:07:44 +0530 Subject: [PATCH] Show completion view on sso segment Signed-off-by: RMidhunSuresh --- src/domain/RootViewModel.js | 11 ++++++++++- src/platform/web/ui/RootView.js | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/domain/RootViewModel.js b/src/domain/RootViewModel.js index fca8d779..15b9d19e 100644 --- a/src/domain/RootViewModel.js +++ b/src/domain/RootViewModel.js @@ -35,12 +35,16 @@ export class RootViewModel extends ViewModel { async load() { this.track(this.navigation.observe("login").subscribe(() => this._applyNavigation())); this.track(this.navigation.observe("session").subscribe(() => this._applyNavigation())); + this.track(this.navigation.observe("sso").subscribe(() => { + this._applyNavigation(); + })); this._applyNavigation(true); } async _applyNavigation(shouldRestoreLastUrl) { const isLogin = this.navigation.observe("login").get(); const sessionId = this.navigation.observe("session").get(); + const SSOSegment = this.navigation.path.get("sso"); if (isLogin) { if (this.activeSection !== "login") { this._showLogin(); @@ -65,7 +69,10 @@ export class RootViewModel extends ViewModel { this._showSessionLoader(sessionId); } } - } else { + } else if (SSOSegment) { + this._setSection(() => this.showCompletionView = true); + } + else { try { if (!(shouldRestoreLastUrl && this.urlCreator.tryRestoreLastUrl())) { const sessionInfos = await this.platform.sessionInfoStorage.getAll(); @@ -147,6 +154,8 @@ export class RootViewModel extends ViewModel { return "picker"; } else if (this._sessionLoadViewModel) { return "loading"; + } else if (this.showCompletionView) { + return "sso"; } else { return "redirecting"; } diff --git a/src/platform/web/ui/RootView.js b/src/platform/web/ui/RootView.js index f60bb984..55cdac14 100644 --- a/src/platform/web/ui/RootView.js +++ b/src/platform/web/ui/RootView.js @@ -20,6 +20,7 @@ import {SessionLoadView} from "./login/SessionLoadView.js"; import {SessionPickerView} from "./login/SessionPickerView.js"; import {TemplateView} from "./general/TemplateView.js"; import {StaticView} from "./general/StaticView.js"; +import {CompleteSSOView} from "../../../domain/CompleteSSOView.js"; export class RootView extends TemplateView { render(t, vm) { @@ -42,6 +43,8 @@ export class RootView extends TemplateView { return new StaticView(t => t.p("Redirecting...")); case "loading": return new SessionLoadView(vm.sessionLoadViewModel); + case "sso": + return new CompleteSSOView(); default: throw new Error(`Unknown section: ${vm.activeSection}`); }