Skip to content

Commit

Permalink
Zowe Suite v1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Feb 19, 2020
2 parents 2917116 + f7d7dd0 commit 9d9600e
Show file tree
Hide file tree
Showing 11 changed files with 1,206 additions and 991 deletions.
436 changes: 241 additions & 195 deletions bootstrap/package-lock.json

Large diffs are not rendered by default.

614 changes: 329 additions & 285 deletions system-apps/app-prop-viewer/webClient/package-lock.json

Large diffs are not rendered by default.

626 changes: 335 additions & 291 deletions system-apps/system-settings-preferences/webClient/package-lock.json

Large diffs are not rendered by default.

430 changes: 249 additions & 181 deletions virtual-desktop/package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,7 @@ export class ApplicationManager implements MVDHosting.ApplicationManagerInterfac
return this.spawnApplication(plugin as DesktopPluginDefinitionImpl, metadata);
});
});
window.addEventListener('message',(message:any)=> {
if (message.data === 'iframeload') {
this.applicationInstances.forEach((appInstance)=> {
let instance = appInstance.instanceId;
const iframe:HTMLElement|null = document.getElementById(`${IFRAME_NAME_PREFIX}${instance}`);
console.log(`iframe=`,iframe);
if (iframe) {
if ((iframe as any).contentWindow == message.source
|| (iframe as any).contentWindow == message.source.parent
|| ((iframe as any).src.indexOf(message.origin) == 0)) {
//it's this one
const appInstance = this.applicationInstances.get(instance);
if (appInstance) {
const pluginId = appInstance.plugin.getIdentifier();
this.logger.info(`Iframe loaded: ${pluginId}, instance=${instance}`);
return ZoweZLUX.dispatcher.iframeLoaded(instance, pluginId);
}
}
}
});
this.logger.warn(`No iframe identified as source of message`);
}
});

(window as any).ZoweZLUX.dispatcher.setPostMessageHandler( (instanceId:MVDHosting.InstanceId, message:any ) => {
let applicationInstance:ApplicationInstance|undefined = this.applicationInstances.get(instanceId);
if (applicationInstance){
Expand All @@ -102,6 +80,30 @@ export class ApplicationManager implements MVDHosting.ApplicationManagerInterfac
}
}
});
window.addEventListener('message',(message:any)=> {
if (message.data === 'iframeload') {
this.applicationInstances.forEach((appInstance)=> {
let instance = appInstance.instanceId;
const iframe:HTMLElement|null = document.getElementById(`${IFRAME_NAME_PREFIX}${instance}`);
if (iframe) {
// this always resolved as true oddly enough
if ((iframe as any).contentWindow === message.source
|| (iframe as any).contentWindow === message.source.parent
|| ((iframe as any).src.indexOf(message.origin) == 0)) {
// if ((iframe as any).contentWindow.frameElement.id === message.source.frameElement.id) {
//it's this one
const appInstance = this.applicationInstances.get(instance);
if (appInstance) {
const pluginId = appInstance.plugin.getIdentifier();
this.logger.info(`Iframe loaded: ${pluginId}, instance=${instance}`);
return ZoweZLUX.dispatcher.iframeLoaded(instance, pluginId);
}
}
}
});
this.logger.warn(`No iframe identified as source of message`);
}
});
}

private generateInstanceId(): MVDHosting.InstanceId {
Expand Down Expand Up @@ -172,26 +174,24 @@ export class ApplicationManager implements MVDHosting.ApplicationManagerInterfac
// so we return as to not repeat the process and create two Viewports for one instance
return applicationInstance.instanceId;
}
let injector;
if (messages) {
injector = this.injectionManager.generateModuleInjector(plugin, launchMetadata, messages);
} else {
injector = this.injectionManager.generateModuleInjector(plugin, launchMetadata);
}
const injector = this.injectionManager.generateModuleInjector(plugin, launchMetadata, applicationInstance.instanceId, messages);

this.instantiateApplicationInstance(applicationInstance, compiled.moduleFactory, injector);
this.logger.debug(`appMgr spawning plugin ID=${plugin.getIdentifier()}, `
+`compiled.initialComponent=`,compiled.initialComponent);
applicationInstance.setMainComponent(compiled.initialComponent);
this.generateMainComponentRefFor(applicationInstance, viewportId); // new component is added to DOM here
if (applicationInstance.isIFrame) {
// applicationInstance.ifrramwWindow =
}

//Beneath all the abstraction is the instance of the App object, framework-independent
let notATurtle = this.getJavascriptObjectForApplication(applicationInstance, viewportId);
// JOE HAX - register to dispatcher
ZoweZLUX.dispatcher.registerPluginInstance(plugin.getBasePlugin(), // this is Plugin class instance
applicationInstance.instanceId,
applicationInstance.isIFrame ); // instanceId is proxy handle to isntance
applicationInstance.isIFrame ); // instanceId is proxy handle to isntance
if (applicationInstance.isIFrame) {
// TODO does this work with iframe-adapter.js
//ZoweZLUX.dispatcher.addPendingIframe(plugin.getBasePlugin(), null)
}
if (notATurtle && (typeof notATurtle.provideZLUXDispatcherCallbacks == 'function')) {
ZoweZLUX.dispatcher.registerApplicationCallbacks(plugin.getBasePlugin(), applicationInstance.instanceId, notATurtle.provideZLUXDispatcherCallbacks());
} else if (!applicationInstance.isIFrame) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export class InjectionManager {
// injector above in constructor is injector of the AppManager module
// generateModuleInjector make root injector augmented with addition providers

generateModuleInjector(pluginDefinition: MVDHosting.DesktopPluginDefinition, launchMetadata: any, messages?: any): Injector {
generateModuleInjector(pluginDefinition: MVDHosting.DesktopPluginDefinition, launchMetadata: any,
instanceId: MVDHosting.InstanceId, messages?: any): Injector {
let identifier = pluginDefinition.getIdentifier();

const l10nPluginConfig: Angular2L10nConfig = {
Expand Down Expand Up @@ -65,6 +66,10 @@ export class InjectionManager {
{
provide: Angular2InjectionTokens.L10N_CONFIG,
useValue: l10nPluginConfig
},
{
provide: Angular2InjectionTokens.INSTANCE_ID,
useValue: instanceId
}
], this.injector.get(NgModuleRef).injector); // gets root injector of virtualDesktop tree
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export class ReactPluginComponent implements AfterViewInit, OnDestroy {
@Inject(Angular2InjectionTokens.VIEWPORT_EVENTS) viewportEvents: Angular2PluginViewportEvents,
@Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) pluginDefinition: MVDHosting.DesktopPluginDefinition,
@Inject(Angular2InjectionTokens.LOGGER) logger: ZLUX.ComponentLogger,
@Inject(Angular2InjectionTokens.LAUNCH_METADATA) launchMetadata: any
@Inject(Angular2InjectionTokens.LAUNCH_METADATA) launchMetadata: any,
@Inject(Angular2InjectionTokens.INSTANCE_ID) instanceId: MVDHosting.InstanceId
) {
this.resources = {
mainWindowId: mainWindowId,
Expand All @@ -44,7 +45,8 @@ export class ReactPluginComponent implements AfterViewInit, OnDestroy {
viewportEvents: viewportEvents,
logger: logger,
pluginDefinition: pluginDefinition,
launchMetadata: launchMetadata
launchMetadata: launchMetadata,
instanceId: instanceId
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export class DesktopPluginDefinitionImpl implements MVDHosting.DesktopPluginDefi
this.key = basePlugin.getKey();
}

get standaloneUseFramework(): boolean {
return !!this.basePlugin.getWebContent().standaloneUseFramework;
}

get hasWebContent(): boolean {
return this.basePlugin.getWebContent() != null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ function openWindow(item: LaunchbarItem, applicationManager: MVDHosting.Applicat
}

function openStandalone(item: LaunchbarItem): void {
const plginType:string = item.plugin.getFramework();
const pluginType:string = item.plugin.getFramework();
//future TODO: initialize cross-window app2app communication??
if (plginType === 'iframe') {
if (pluginType === 'iframe' && !(item.plugin.standaloneUseFramework)) {
// Still allows IFrames to comprehend URL parameters if address is copy/pasted later. Should not break any app2app possibilities
window.open(`${location.origin}${(window as any).ZoweZLUX.uriBroker.pluginResourceUri(item.plugin, item.plugin.getBasePlugin().getWebContent().startingPage)}`);
} else {
Expand Down Expand Up @@ -112,4 +112,4 @@ export function generateInstanceActions(item: LaunchbarItem,
]
}
return menuItems;
}
}
1 change: 1 addition & 0 deletions virtual-desktop/src/pluginlib/inject-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const Angular2InjectionTokens = {
PLUGIN_DEFINITION: 'virtualdesktop-ng2.0-0-0.plugin-definition',
LAUNCH_METADATA: 'virtualdesktop-ng2.0-0-0.launch-metadata',
L10N_CONFIG: 'virtualdesktop-ng2.0-0-0.l10n-config',
INSTANCE_ID: 'virtualdesktop-ng2.0-0-0.instance-id',

/* Component Level Resources */
PLUGIN_EMBED_ACTIONS: 'virtualdesktop-ng2.0-0-0.plugin-embed-actions',
Expand Down
1 change: 1 addition & 0 deletions virtual-desktop/src/pluginlib/react-inject-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface ReactMVDResources {
readonly logger: ZLUX.ComponentLogger;
readonly pluginDefinition: MVDHosting.DesktopPluginDefinition;
readonly launchMetadata: any;
readonly instanceId: MVDHosting.InstanceId;
};

/* TODO
Expand Down

0 comments on commit 9d9600e

Please sign in to comment.