Skip to content

Commit

Permalink
Zowe Suite v2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Apr 13, 2023
2 parents 3a33237 + 098d7a5 commit 87d9e33
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 58 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions bootstrap/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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}`);
}
}

Expand Down
34 changes: 16 additions & 18 deletions bootstrap/web/iframe-adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'}});
Expand Down Expand Up @@ -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);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@

.instance-item {
width: 200px;
height: 120px;
margin-left: 3px;
margin-right: 3px;
height: 140px;
margin: 3px;
}

.instance-viewer {
Expand Down Expand Up @@ -51,6 +50,11 @@
margin-top: -10px;
}

.instance-preview-caption {
font-size: large;
padding-top: 1rem;
}

.instance-snapshot:hover .instance-preview {
opacity: 0.5;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@
[style.background]="color.launchbarMenuColor"
[style.color]="color.launchbarMenuText">
<div class="all-instances-box">
<div class="instance-item" (mousedown)="clicked(windowId, launchbarItem)" *ngFor="let windowId of windowManager.getWindowIDs(launchbarItem.plugin); let i = index">
<div>
<p class="caption truncate">{{getTitleForWindow(windowId)}}</p>
<div class="instance-item" [style.background]="color.windowColorInactive" (mousedown)="clicked(windowId, launchbarItem)" *ngFor="let windowId of windowManager.getWindowIDs(launchbarItem.plugin); let i = index">
<div *ngIf="isWindowFocused(windowId)" [style.background]="color.launchbarColor">
<p class="caption truncate instance-preview-caption">{{i}} {{getTitleForWindow(windowId)}}</p>
</div>
<div *ngIf="!isWindowFocused(windowId)">
<p class="caption truncate instance-preview-caption">{{i}} {{getTitleForWindow(windowId)}}</p>
</div>
<div class="instance-snapshot" (click)="clicked(windowId)" [style.background-color]="black">
<img class="instance-preview" src={{getPreview(i,launchbarItem)}} alt="{{i}} {{getTitleForWindow(windowId)}}"/>
<!-- <img class="instance-preview" src={{getPreview(i,launchbarItem)}} alt="{{i}} {{getTitleForWindow(windowId)}}"/> -->
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} = {};
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 87d9e33

Please sign in to comment.