From d23b61d39197cab075f0ad2071183659f8e2fe07 Mon Sep 17 00:00:00 2001 From: Leonty Chudinov Date: Mon, 22 Jun 2020 12:12:22 +0500 Subject: [PATCH] PoC for Mobile App: Revert back app files Signed-off-by: Leonty Chudinov --- webClient/src/app/app.component.ts | 67 +++++++++++++----------------- webClient/tsconfig.json | 5 +-- 2 files changed, 29 insertions(+), 43 deletions(-) diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index 356bb34..c054acf 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -191,6 +191,7 @@ export class AppComponent { } catch (e) { //this.parameters was not JSON } + if (this.targetAppId) { let message = ''; /* With ZLUX, there's a global called ZoweZLUX which holds useful tools. So, a site @@ -201,49 +202,37 @@ export class AppComponent { */ let dispatcher = ZoweZLUX.dispatcher; let pluginManager = ZoweZLUX.pluginManager; - if (this.targetAppId) { - const plugin = pluginManager.getPlugin(this.targetAppId); - if (!plugin) { - this.popupManager.reportError( - ZluxErrorSeverity.WARNING, - this.translation.translate('invalid_plugin_identifier'), - `${this.translation.translate('no_plugin_found_for_identifier')} ${this.targetAppId}`, popupOptions); + let plugin = pluginManager.getPlugin(this.targetAppId); + if (plugin) { + let type = dispatcher.constants.ActionType[this.actionType]; + let mode = dispatcher.constants.ActionTargetMode[this.targetMode]; + + if (type != undefined && mode != undefined) { + let actionTitle = 'Launch app from sample app'; + let actionID = 'org.zowe.zlux.sample.launch'; + let argumentFormatter = {data: {op:'deref',source:'event',path:['data']}}; + /*Actions can be made ahead of time, stored and registered at startup, but for example purposes we are making one on-the-fly. + Actions are also typically associated with Recognizers, which execute an Action when a certain pattern is seen in the running App. + */ + let action = dispatcher.makeAction(actionID, actionTitle, mode,type,this.targetAppId,argumentFormatter); + let argumentData = {'data':(parameters ? parameters : this.parameters)}; + this.log.info((message = this.translation.translate('request_succeeded'))); // App request succeeded + this.callStatus = message; + /*Just because the Action is invoked does not mean the target App will accept it. We've made an Action on the fly, + So the data could be in any shape under the "data" attribute and it is up to the target App to take action or ignore this request*/ + dispatcher.invokeAction(action,argumentData); + } else { + this.log.warn((message = 'Invalid target mode or action type specified')); } - } - let type = dispatcher.constants.ActionType[this.actionType]; - let mode = dispatcher.constants.ActionTargetMode[this.targetMode]; - if (type != undefined && mode != undefined) { - let actionTitle = 'Launch app from sample app'; - let actionID = 'org.zowe.zlux.sample.launch'; - let argumentFormatter = {data: {op:'deref',source:'event',path:['data']}}; - /*Actions can be made ahead of time, stored and registered at startup, but for example purposes we are making one on-the-fly. - Actions are also typically associated with Recognizers, which execute an Action when a certain pattern is seen in the running App. - */ - let action = dispatcher.makeAction(actionID, actionTitle, mode,type,this.targetAppId,argumentFormatter); - let argumentData = this.targetAppId ? {'data':(parameters ? parameters : this.parameters)} : (parameters ? parameters : this.parameters); - this.log.info((message = this.translation.translate('request_succeeded'))); // App request succeeded - this.callStatus = message; - /*Just because the Action is invoked does not mean the target App will accept it. We've made an Action on the fly, - So the data could be in any shape under the "data" attribute and it is up to the target App to take action or ignore this request*/ - dispatcher.invokeAction(action,argumentData).catch( - e => { - let message: string; - if (typeof e === 'string') { - message = e; - } else if (e instanceof Error) { - message = e.message; - } else { - message = JSON.stringify(e); - } - this.popupManager.reportError( - ZluxErrorSeverity.WARNING, 'Unable to launch app', message, popupOptions - ); - } - ); } else { - this.log.warn((message = 'Invalid target mode or action type specified')); + this.popupManager.reportError( + ZluxErrorSeverity.WARNING, + this.translation.translate('invalid_plugin_identifier'), // + `${this.translation.translate('no_plugin_found_for_identifier')} ${this.targetAppId}`, popupOptions); } + this.callStatus = message; + } } generateTestMenuItems(translator: TranslationService): void { diff --git a/webClient/tsconfig.json b/webClient/tsconfig.json index 649b183..203f569 100644 --- a/webClient/tsconfig.json +++ b/webClient/tsconfig.json @@ -1,6 +1,3 @@ { - "extends": "../../zlux-app-manager/virtual-desktop/plugin-config/tsconfig.strict.json", - "include": [ - "./src/**/*.ts" - ] + "extends": "../../zlux-app-manager/virtual-desktop/plugin-config/tsconfig.strict.json" } \ No newline at end of file