Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/app.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 => {
Expand Down
3 changes: 3 additions & 0 deletions app/services/adal/adal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export class AdalService {
}

public login(): Observable<any> {
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<any>> = [];
for (let tenantId of ids) {
Expand Down
2 changes: 1 addition & 1 deletion app/services/adal/user-authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
}
Expand Down
1 change: 1 addition & 0 deletions client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
25 changes: 23 additions & 2 deletions client/splash-screen/splash-screen.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,21 @@
margin: auto;
}

.message {
.title {
color: #d5d5d5;
margin: auto;
width: 100px;
font-size: 20px;
text-align: center;
}

#message {
color: #d5d5d5;
font-size: 12px;
position: absolute;
bottom: 5px;
}

.bubble {
width: 20px;
height: 20px;
Expand Down Expand Up @@ -98,6 +105,17 @@
</style>
<html>

<script>
document.addEventListener("DOMContentLoaded", () => {
const message = document.getElementById("message");
const {ipcRenderer} = require("electron");
ipcRenderer.on("update-message", (event, arg) => {
message.innerHTML = arg;
})
})

</script>

<body>
<div class="bubbles">
<div class="bubble x1"></div>
Expand All @@ -111,9 +129,12 @@
<img src="./flask.svg"></img>
</div>

<div class="message">
<div class="title">
Batch labs
</div>

<div id="message">
</div>
</body>

</html>
22 changes: 21 additions & 1 deletion client/splash-screen/splash-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -18,6 +19,9 @@ export class SplashScreen {
frame: false,
});
this._window.loadURL(url);
this._window.webContents.once("dom-ready", () => {
this._sendMessageToWindow();
});
}

public show() {
Expand All @@ -37,8 +41,24 @@ export class SplashScreen {

public destroy() {
if (this._window) {
this._window.close();
this._window.destroy();
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);
}
}
}