Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] iFrame adapter: added support for plugin defintion, logger, and launch metadata #174

Merged
merged 15 commits into from Nov 1, 2019

Conversation

@timgerstel
Copy link

timgerstel commented Oct 28, 2019

This pull request adds the following features to the iFrame adapter:
-Support for the following injectable angular2plugintokens: plugin definition, launch metadata
-Support for ZoweZLUX.Logger (global logger object)

Do not merge without:
zowe/zlux-shared#23
zowe/zlux-platform#47
Signed-off-by: Timothy Gerstel tgerstel@rocketsoftware.com

Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Timothy Gerstel added 7 commits Oct 29, 2019
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
….stringify

Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
…e/injectables

Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Timothy Gerstel
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Timothy Gerstel
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Timothy Gerstel
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Timothy Gerstel
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
}catch (e){
return undefined;
}
case 'getLaunchMetadata':

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Oct 30, 2019

Member

Don't pull, since the angular & react API is a push: when the constructor of the main component executes, the injectables are present whether or not they are used. Make the iframe API the same way in that when the iframe says it is ready, the desktop can post a message that contains all info necessary to create objects that are like those injectables. So, you need the iframe adapter to have some sort of event that the iframe code listens on to await this constructor response.

iframe --- READY ---> desktop
desktop ---- pluginDef, logger ID, ways to listen on window&viewport ----> iframe adapter
iframe adapter ---- event containing pluginDef, actual component logger, viewport & window objects ---> iframe code

Timothy Gerstel added 2 commits Oct 31, 2019
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
…egistering an instance

Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
instanceId: this.instanceId
}, '*')
}catch(e){
this.frameSource.postMessage({

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Oct 31, 2019

Member

This must have a log message, so that we can spot if this happens, because it should never happen.

This comment has been minimized.

Copy link
@DivergentEuropeans

DivergentEuropeans Nov 1, 2019

@1000TurquoisePogs There's a log message a few lines down, but because this error is caught, I don't think it will get outputted to the console, so it would be good to add that 'e' in

instanceId = message.data.dispatchData.instanceId;
let data = message.data;
if(data.dispatchData){
if(instanceId === -1 && data.dispatchData.instanceId !== undefined){

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Oct 31, 2019

Member

This should have an else{} which logs a warning, because it would be very weird if the desktop tried to tell you that your instance ID was changing.

@@ -296,6 +299,10 @@ var ZoweZLUX = {
}
}

ZoweZLUX.logger = new exports.Logger();
ZoweZLUX.logger.addDestination(ZoweZLUX.logger.makeDefaultDestination(true, true, true))

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Oct 31, 2019

Member

You need some more true here. logger.addDestination(logger.makeDefaultDestination(true,true,true,true,true));

Timothy Gerstel added 2 commits Oct 31, 2019
…dd more trues to makeDefaultDestination. Prefix tempExports variable with ZoweZLUX

Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
instanceId: this.instanceId,
error: 'Unable to parse plugin definition'
}, '*');
console.warn('Unable to parse plugin defintion');

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Oct 31, 2019

Member

This needs to be a logger owned by the desktop.
Give this a try:
import { BaseLogger } from 'virtual-desktop-logger';
then just set this.logger to BaseLogger.

Timothy Gerstel
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
@@ -69,7 +76,7 @@ let messageHandler = function(message) {
console.log('restored')
return;
case 'windowEvents.moved':
console.log('moved')
//console.log('moved')

This comment has been minimized.

Copy link
@DivergentEuropeans

DivergentEuropeans Nov 1, 2019

This is bootstrap JS context, so I believe a logger is importable here right?

@@ -86,6 +93,8 @@ let messageHandler = function(message) {
}
}

window.addEventListener('message', messageHandler);

window.addEventListener("load", function () {
console.log('iFrame Adapter has loaded!');

This comment has been minimized.

Copy link
@DivergentEuropeans
instanceId: this.instanceId
}, '*')
}catch(e){
this.frameSource.postMessage({

This comment has been minimized.

Copy link
@DivergentEuropeans

DivergentEuropeans Nov 1, 2019

@1000TurquoisePogs There's a log message a few lines down, but because this error is caught, I don't think it will get outputted to the console, so it would be good to add that 'e' in

}
return copy;
}catch(e){
return undefined;

This comment has been minimized.

Copy link
@DivergentEuropeans

DivergentEuropeans Nov 1, 2019

Would it be useful to log the error here too? I'm not familiar with this code base, it's your call @timgerstel

This comment has been minimized.

Copy link
@1000TurquoisePogs

1000TurquoisePogs Nov 1, 2019

Member

Yes, let's put a log here stating what error occurred.

Timothy Gerstel added 2 commits Nov 1, 2019
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
Signed-off-by: Timothy Gerstel <tgerstel@rocketsoftware.com>
@1000TurquoisePogs 1000TurquoisePogs merged commit 96c4cc2 into zowe:staging Nov 1, 2019
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/jenkins/pr-merge This commit is being built
Details
DCO DCO
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.