From d150dcf46cdbe27f0893c71e212abbb1efc7d5a0 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 27 Mar 2017 11:31:04 -0700 Subject: [PATCH 1/4] Splash screen show status message --- app/app.ts | 2 ++ app/services/adal/adal.service.ts | 3 +++ client/main.ts | 1 + client/splash-screen/splash-screen.html | 26 +++++++++++++++++++++++-- client/splash-screen/splash-screen.ts | 20 +++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/app/app.ts b/app/app.ts index 0d6348ac91..0968b2ac87 100644 --- a/app/app.ts +++ b/app/app.ts @@ -1,4 +1,5 @@ import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import { remote } from "electron"; import { log } from "app/utils"; import { AppModule } from "./app.module"; @@ -14,6 +15,7 @@ import "roboto-fontface/css/roboto/roboto-fontface.css"; import "./assets/styles/main.scss"; import "./environment"; +(remote.getCurrentWindow() as any).splashScreen.updateMessage("Initializing app"); const platform = platformBrowserDynamic(); platform.bootstrapModule(AppModule).catch(error => { diff --git a/app/services/adal/adal.service.ts b/app/services/adal/adal.service.ts index 7d583eaa5f..2332765357 100644 --- a/app/services/adal/adal.service.ts +++ b/app/services/adal/adal.service.ts @@ -68,7 +68,10 @@ export class AdalService { } public login(): Observable { + this.remote.getSplashScreen().updateMessage("Login to azure active directory"); const obs = this._loadTenantIds().flatMap((ids) => { + this.remote.getSplashScreen().updateMessage("Retrieving access tokens"); + this._tenantsIds.next(ids); const queries: Array<() => Observable> = []; for (let tenantId of ids) { diff --git a/client/main.ts b/client/main.ts index e3bec58222..d1ada8d0ea 100644 --- a/client/main.ts +++ b/client/main.ts @@ -24,6 +24,7 @@ const splashScreen = new SplashScreen(); // Create the browser window. function createWindow() { splashScreen.create(); + splashScreen.updateMessage("Loading app"); protocol.registerStringProtocol("urn", (request, callback) => { // Close all auth windows that need to be closed while (authWindowsToClose.length) { diff --git a/client/splash-screen/splash-screen.html b/client/splash-screen/splash-screen.html index 81d8316d61..59e3f37221 100644 --- a/client/splash-screen/splash-screen.html +++ b/client/splash-screen/splash-screen.html @@ -25,7 +25,7 @@ margin: auto; } - .message { + .title { color: #d5d5d5; margin: auto; width: 100px; @@ -33,6 +33,13 @@ text-align: center; } + #message { + color: #d5d5d5; + font-size: 12px; + position: absolute; + bottom: 5px; + } + .bubble { width: 20px; height: 20px; @@ -98,6 +105,18 @@ + +
@@ -111,9 +130,12 @@
-
+
Batch labs
+ +
+
diff --git a/client/splash-screen/splash-screen.ts b/client/splash-screen/splash-screen.ts index fd2c209671..b73b235eae 100644 --- a/client/splash-screen/splash-screen.ts +++ b/client/splash-screen/splash-screen.ts @@ -6,6 +6,7 @@ const url = process.env.HOT ? urls.dev : urls.prod; export class SplashScreen { private _window: Electron.BrowserWindow; + private _currentMessage = ""; public create() { this.destroy(); @@ -18,6 +19,9 @@ export class SplashScreen { frame: false, }); this._window.loadURL(url); + this._window.webContents.once("dom-ready", () => { + this._sendMessageToWindow(); + }); } public show() { @@ -40,5 +44,21 @@ export class SplashScreen { this._window.close(); this._window = null; } + this.clearMessage(); + } + + public updateMessage(message: string) { + this._currentMessage = message; + this._sendMessageToWindow(); + } + + public clearMessage() { + this.updateMessage(""); + } + + private _sendMessageToWindow() { + if (this._window) { + this._window.webContents.send("update-message", this._currentMessage); + } } } From a956456f59d0c460bd79af11bcd09f411ece9e85 Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 27 Mar 2017 11:37:37 -0700 Subject: [PATCH 2/4] Fixes close after splash screen --- app/services/adal/user-authorization.ts | 2 +- client/main.ts | 2 +- client/splash-screen/splash-screen.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/adal/user-authorization.ts b/app/services/adal/user-authorization.ts index 59f29dc9fb..435dc10288 100644 --- a/app/services/adal/user-authorization.ts +++ b/app/services/adal/user-authorization.ts @@ -136,8 +136,8 @@ export class UserAuthorization { this._authWindow = null; // If the user closed manualy then we need to also close the main window if (this._waitingForAuth) { - this.remoteService.getCurrentWindow().destroy(); this.remoteService.getSplashScreen().destroy(); + this.remoteService.getCurrentWindow().destroy(); } }); } diff --git a/client/main.ts b/client/main.ts index d1ada8d0ea..c65d72f1bd 100644 --- a/client/main.ts +++ b/client/main.ts @@ -44,7 +44,7 @@ function createWindow() { height: 1000, icon: Constants.urls.icon, width: 1600, - show: false, // Don't show the window until the user authenticated, comment to debug auth problems, + show: true, // Don't show the window until the user authenticated, comment to debug auth problems, webPreferences: { webSecurity: false, }, diff --git a/client/splash-screen/splash-screen.ts b/client/splash-screen/splash-screen.ts index b73b235eae..a203202406 100644 --- a/client/splash-screen/splash-screen.ts +++ b/client/splash-screen/splash-screen.ts @@ -41,7 +41,7 @@ export class SplashScreen { public destroy() { if (this._window) { - this._window.close(); + this._window.destroy(); this._window = null; } this.clearMessage(); From b4489e0cf9008a55391ebde2a2df60eef8bbbc3f Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 27 Mar 2017 11:38:09 -0700 Subject: [PATCH 3/4] Main show false --- client/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.ts b/client/main.ts index c65d72f1bd..d1ada8d0ea 100644 --- a/client/main.ts +++ b/client/main.ts @@ -44,7 +44,7 @@ function createWindow() { height: 1000, icon: Constants.urls.icon, width: 1600, - show: true, // Don't show the window until the user authenticated, comment to debug auth problems, + show: false, // Don't show the window until the user authenticated, comment to debug auth problems, webPreferences: { webSecurity: false, }, From 108f24b1a46d44dcdc79b151c1f64e4a62a5543b Mon Sep 17 00:00:00 2001 From: Timothee Guerin Date: Mon, 27 Mar 2017 11:46:28 -0700 Subject: [PATCH 4/4] Remove console.log --- client/splash-screen/splash-screen.html | 1 - 1 file changed, 1 deletion(-) diff --git a/client/splash-screen/splash-screen.html b/client/splash-screen/splash-screen.html index 59e3f37221..87ead26d07 100644 --- a/client/splash-screen/splash-screen.html +++ b/client/splash-screen/splash-screen.html @@ -110,7 +110,6 @@ const message = document.getElementById("message"); const {ipcRenderer} = require("electron"); ipcRenderer.on("update-message", (event, arg) => { - console.log(arg) // prints "pong" message.innerHTML = arg; }) })