diff --git a/CHANGELOG.md b/CHANGELOG.md index 93bb7ba21..5c165de4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Zlux App Manager will be documented in this file. +## `2.8.0` +- Bugfix: Fixed the iframe-adapter not properly recognizing standalone mode +- Bugfix: Fixed Iframes from unintentionally loading their sources multiple times during refocus & multi-app situations +- Enhancement: Added new isSingleAppModeSimple() to iframe-adapter to differentiate between standalone mode and simple standalone mode +- Enhancement: Replace existing snapshot preview with lighter UI to magnitudes increase multi-app Desktop performance + ## `2.0.0` - Enhancement: New desktop library versions: Angular 6->12, Corejs 2->3, Typescript 2->4 etc. For more information, visit https://www.zowe.org/vnext diff --git a/bootstrap/src/main.ts b/bootstrap/src/main.ts index df5f0652f..917afc829 100644 --- a/bootstrap/src/main.ts +++ b/bootstrap/src/main.ts @@ -36,7 +36,6 @@ function processApp2AppArgs(url?: string): void { switch (key) { case "pluginId": window['GIZA_PLUGIN_TO_BE_LOADED'] = value; - window['GIZA_SIMPLE_CONTAINER_REQUESTED'] = true; window['GIZA_ENVIRONMENT'] = 'MVD'; pluginId = value; break; @@ -49,16 +48,17 @@ function processApp2AppArgs(url?: string): void { break; case "windowManager": windowManager = value; + if (!windowManager || windowManager.toUpperCase() !== 'MVD') { + window['GIZA_SIMPLE_CONTAINER_REQUESTED'] = true; + } break; } }); if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { - if (windowManager && windowManager.toUpperCase() === 'MVD') { - console.log(`ZWED5043I - MVD standalone container requested with pluginId ${pluginId}`); - } else { - console.log(`ZWED5003I - Simple container requested with pluginId ${pluginId}`); - } + console.log(`ZWED5003I - Simple container requested with pluginId ${pluginId}`); + } else { + console.log(`ZWED5043I - MVD standalone container requested with pluginId ${pluginId}`); } } diff --git a/bootstrap/web/iframe-adapter.js b/bootstrap/web/iframe-adapter.js index 0f6cfa2c3..fbc791c05 100644 --- a/bootstrap/web/iframe-adapter.js +++ b/bootstrap/web/iframe-adapter.js @@ -72,7 +72,8 @@ let messageHandler = function(message) { window.dispatchEvent(restored) return; case 'windowEvents.resized': - //console.log('resized') + let resized = new CustomEvent('ZoweZLUX.windowEvents', {detail: {event:'resized'}}); + window.dispatchEvent(resized); return; case 'windowEvents.titleChanged': let titleChanged = new CustomEvent('ZoweZLUX.windowEvents', {detail: {event:'titleChange'}}); @@ -183,27 +184,24 @@ var ZoweZLUX = { pluginDef: undefined, launchMetadata: undefined, - //True - Standalone, False - We are in regular desktop mode + //True - Single app mode, False - We are in regular desktop mode isSingleAppMode() { return new Promise(function(resolve, reject) { - if (window.GIZA_SIMPLE_CONTAINER_REQUESTED) { //Ancient edgecase + if (window.top.GIZA_PLUGIN_TO_BE_LOADED) { //Ancient edgecase resolve(true); //Standalone mode - } else { - let intervalId = setInterval(checkForStandaloneMode, 100); - function checkForStandaloneMode() { - if (ZoweZLUX.iframe.pluginDef) { //If we have the plugin definition - clearInterval(intervalId); - resolve(false); - } + } else { + resolve(false); } - setTimeout(() => { - clearInterval(intervalId); - if (ZoweZLUX.iframe.pluginDef === undefined || null) { - resolve(true); - } else { - resolve(false); - } - }, 1000); + }); + }, + + //True - Standalone + using simple window manager, False - We are in regular desktop or using the MVD window manager for single app mode + isSingleAppModeSimple() { + return new Promise(function(resolve, reject) { + if (window.top.GIZA_SIMPLE_CONTAINER_REQUESTED) { //Ancient edgecase + resolve(true); //Standalone mode + } else { + resolve(false); } }); } diff --git a/virtual-desktop/src/app/authentication-manager/login/login.component.ts b/virtual-desktop/src/app/authentication-manager/login/login.component.ts index fd14699ac..03466977e 100644 --- a/virtual-desktop/src/app/authentication-manager/login/login.component.ts +++ b/virtual-desktop/src/app/authentication-manager/login/login.component.ts @@ -194,7 +194,7 @@ export class LoginComponent implements OnInit { } } this.isLoading = false; - if (!this.showLogin && window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (!this.showLogin && window['GIZA_PLUGIN_TO_BE_LOADED']) { this.authenticationService.spawnApplicationsWithNoUsername(); this.enableExpirationPrompt = false; this.needLogin = false; diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.css b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.css index 1698242a0..9c52fb47d 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.css +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.css @@ -12,9 +12,8 @@ .instance-item { width: 200px; - height: 120px; - margin-left: 3px; - margin-right: 3px; + height: 140px; + margin: 3px; } .instance-viewer { @@ -51,6 +50,11 @@ margin-top: -10px; } +.instance-preview-caption { + font-size: large; + padding-top: 1rem; +} + .instance-snapshot:hover .instance-preview { opacity: 0.5; } diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.html b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.html index 4d692e658..bb0329fcf 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.html +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.html @@ -11,12 +11,15 @@ [style.background]="color.launchbarMenuColor" [style.color]="color.launchbarMenuText">
-
-
-

{{getTitleForWindow(windowId)}}

+
+
+

{{i}} {{getTitleForWindow(windowId)}}

+
+
+

{{i}} {{getTitleForWindow(windowId)}}

- {{i}} {{getTitleForWindow(windowId)}} +
diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.ts index 6cf2ea7fd..12ae2ab65 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-instance-view/launchbar-instance-view.component.ts @@ -67,6 +67,10 @@ export class LaunchbarInstanceViewComponent { return title; } + isWindowFocused(windowId: MVDWindowManagement.WindowId): boolean { + return this.windowManager.windowHasFocus(windowId); + } + clicked(windowId: MVDWindowManagement.WindowId, item: LaunchbarItem): void { this.windowManager.requestWindowFocus(windowId); } diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-menu/launchbar-menu.component.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-menu/launchbar-menu.component.ts index 67fae421e..6de01ac06 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-menu/launchbar-menu.component.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar-menu/launchbar-menu.component.ts @@ -146,7 +146,7 @@ export class LaunchbarMenuComponent implements MVDHosting.LoginActionInterface{ this.appKeyboard.keyUpEvent .subscribe((event:KeyboardEvent) => { // TODO: Disable bottom app bar once mvd-window-manager single app mode is functional. Variable subject to change. - if (event.which === KeyCode.KEY_M && !window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (event.which === KeyCode.KEY_M && !window['GIZA_PLUGIN_TO_BE_LOADED']) { this.activeToggle(); } }); diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar/launchbar.component.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar/launchbar.component.ts index 158c70dd6..784b981a8 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar/launchbar.component.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/launchbar/launchbar.component.ts @@ -77,7 +77,7 @@ export class LaunchbarComponent implements MVDHosting.LogoutActionInterface { } // TODO: Disable bottom app bar once mvd-window-manager single app mode is functional. Variable subject to change. - if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (window['GIZA_PLUGIN_TO_BE_LOADED']) { this.displayAppBar = "none"; } else { this.displayAppBar = "inherit"; diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/shared/launchbar-items/plugin-launchbar-item.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/shared/launchbar-items/plugin-launchbar-item.ts index 7bba5ca97..398f7d9a3 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/shared/launchbar-items/plugin-launchbar-item.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/launchbar/shared/launchbar-items/plugin-launchbar-item.ts @@ -38,7 +38,8 @@ export class PluginLaunchbarItem extends LaunchbarItem{// implements ZLUX.Plugin } let index = this.instanceIds.indexOf(window.windowId); if (index != -1) { - this.generateSnapshot(index); + // TODO: Generate snapshot code needs optimization due to incredible desktop performance slowdown + // this.generateSnapshot(index); } }); } @@ -92,18 +93,20 @@ export class PluginLaunchbarItem extends LaunchbarItem{// implements ZLUX.Plugin } instanceAdded(instanceId: MVDHosting.InstanceId, isEmbedded: boolean|undefined) { - var self = this; + //var self = this; if (!isEmbedded) { this.instanceIds.push(instanceId); - let index = this.instanceIds.length-1; + //let index = this.instanceIds.length-1; if (this.instanceIds.length != 1) { //skip first for performance setTimeout(function() { - self.generateSnapshot(index); + // TODO: Generate snapshot code needs optimization due to incredible desktop performance slowdown + //self.generateSnapshot(index); }, 3000); } if (this.instanceIds.length == 2) { //go back and init first. slightly worse for performance - self.generateSnapshot(0); + // TODO: Generate snapshot code needs optimization due to incredible desktop performance slowdown + //self.generateSnapshot(0); } } } diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/shared/window-manager.service.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/shared/window-manager.service.ts index c34f0b9f5..62c4f9e15 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/shared/window-manager.service.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/shared/window-manager.service.ts @@ -56,8 +56,8 @@ export class WindowManagerService implements MVDWindowManagement.WindowManagerSe private focusedWindow: DesktopWindow | null; private topZIndex: number; - private _lastScreenshotPluginId: string = ''; - private _lastScreenshotWindowId: number = -1; + //private _lastScreenshotPluginId: string = ''; + //private _lastScreenshotWindowId: number = -1; public showPersonalizationPanel: boolean = false; private autoSaveInterval : number = 300000; public autoSaveFiles : {[key:string]:number} = {}; @@ -144,7 +144,7 @@ export class WindowManagerService implements MVDWindowManagement.WindowManagerSe .subscribe((event:KeyboardEvent) => { if (event.which === KeyCode.DOWN_ARROW) { // TODO: Disable minimize hotkey once mvd-window-manager single app mode is functional. Variable subject to change. - if(this.focusedWindow && !window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if(this.focusedWindow && !window['GIZA_PLUGIN_TO_BE_LOADED']) { this.minimizeToggle(this.focusedWindow.windowId); } } @@ -273,7 +273,7 @@ export class WindowManagerService implements MVDWindowManagement.WindowManagerSe private refreshMaximizedWindowSize(desktopWindow: DesktopWindow): void { //This is the window viewport size, so you must subtract the header and launchbar from the height, if not in standalone mode. let height; - if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (window['GIZA_PLUGIN_TO_BE_LOADED']) { height = window.innerHeight; } else { height = window.innerHeight - WindowManagerService.MAXIMIZE_WINDOW_HEIGHT_OFFSET; @@ -757,10 +757,10 @@ export class WindowManagerService implements MVDWindowManagement.WindowManagerSe this.logger.warn("ZWED5187W", destination); //this.logger.warn('Attempted to request focus for null window, ID=${destination}'); return false; } - let requestScreenshot = false; - if (!this.windowHasFocus(destination) && this._lastScreenshotWindowId != destination){ - requestScreenshot = true; - } + //let requestScreenshot = false; + //if (!this.windowHasFocus(destination) && this._lastScreenshotWindowId != destination){ + //requestScreenshot = true; + //} //can't focus an unseen window! if (desktopWindow.windowState.stateType === DesktopWindowStateType.Minimized) { @@ -769,13 +769,14 @@ export class WindowManagerService implements MVDWindowManagement.WindowManagerSe this.focusedWindow = desktopWindow; desktopWindow.windowState.zIndex = this.topZIndex ++; - if (requestScreenshot){ - setTimeout(()=> { - this.screenshotRequestEmitter.next({pluginId: this._lastScreenshotPluginId, windowId: this._lastScreenshotWindowId}); - this._lastScreenshotWindowId = destination; - this._lastScreenshotPluginId = desktopWindow.plugin.getIdentifier(); - },500); //delay a bit for performance perception - } + // TODO: Generate snapshot code needs optimization due to incredible desktop performance slowdown + // if (requestScreenshot){ + // setTimeout(()=> { + // this.screenshotRequestEmitter.next({pluginId: this._lastScreenshotPluginId, windowId: this._lastScreenshotWindowId}); + // this._lastScreenshotWindowId = destination; + // this._lastScreenshotPluginId = desktopWindow.plugin.getIdentifier(); + // },500); //delay a bit for performance perception + // } this.setDesktopTitle(desktopWindow.windowTitle); return true; } diff --git a/virtual-desktop/src/app/window-manager/mvd-window-manager/window/window.component.ts b/virtual-desktop/src/app/window-manager/mvd-window-manager/window/window.component.ts index f4d232bbd..967342804 100644 --- a/virtual-desktop/src/app/window-manager/mvd-window-manager/window/window.component.ts +++ b/virtual-desktop/src/app/window-manager/mvd-window-manager/window/window.component.ts @@ -69,7 +69,7 @@ export class WindowComponent { this.displayMinimize = true; // TODO: Disable minimize button once mvd-window-manager single app mode is functional. Variable subject to change. - if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (window['GIZA_PLUGIN_TO_BE_LOADED']) { this.displayMinimize = false; this.maximizeLeft = this.minimizeLeft; } @@ -86,7 +86,7 @@ export class WindowComponent { this.displayMinimize = true; // TODO: Disable minimize button once mvd-window-manager single app mode is functional. Variable subject to change. - if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (window['GIZA_PLUGIN_TO_BE_LOADED']) { this.displayMinimize = false; this.maximizeLeft = this.minimizeLeft; } @@ -103,7 +103,7 @@ export class WindowComponent { this.displayMinimize = true; // TODO: Disable minimize button once mvd-window-manager single app mode is functional. Variable subject to change. - if (window['GIZA_SIMPLE_CONTAINER_REQUESTED']) { + if (window['GIZA_PLUGIN_TO_BE_LOADED']) { this.displayMinimize = false; this.maximizeLeft = this.minimizeLeft; } @@ -161,7 +161,7 @@ export class WindowComponent { this.maxWidth = '100%'; this.zIndex = this.desktopWindow.windowState.zIndex; // In standalone app mode, our launchbar doesn't exist - this.launchbarHeight = (window.GIZA_SIMPLE_CONTAINER_REQUESTED ? 0 : WindowManagerService.LAUNCHBAR_HEIGHT); + this.launchbarHeight = (window.GIZA_PLUGIN_TO_BE_LOADED ? 0 : WindowManagerService.LAUNCHBAR_HEIGHT); /* These 4 conditionals check if a window is out of bounds by checking if a window has been dragged too far out of view, in either of the 4 directions, and locks it from going further. */