Skip to content

Commit

Permalink
Zowe Suite v1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zowe-robot authored Mar 25, 2020
2 parents f692a9e + 81f125f commit 87f7ac9
Show file tree
Hide file tree
Showing 10 changed files with 11,020 additions and 7,108 deletions.
2 changes: 1 addition & 1 deletion nodeServer/ts/helloWorld.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Router } from "express-serve-static-core";

const express = require('express');
const Promise = require('bluebird');
const obfuscator = require ('../../zlux-shared/src/obfuscator/htmlObfuscator.js');
const obfuscator = require ('zlux-shared/src/obfuscator/htmlObfuscator.js');

class HelloWorldDataservice{
private context: any;
Expand Down
17,845 changes: 10,802 additions & 7,043 deletions webClient/package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions webClient/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"@angular/compiler-cli": "~6.0.9",
"@angular/core": "~6.0.9",
"@angular/forms": "~6.0.9",
"@angular/http": "~6.0.9",
"@angular/language-service": "~6.0.9",
"@angular/platform-browser": "~6.0.9",
"@angular/platform-browser-dynamic": "~6.0.9",
Expand All @@ -26,21 +25,21 @@
"angular-l10n": "5.2.0",
"angular2-template-loader": "~0.6.2",
"codelyzer": "~4.4.2",
"copy-webpack-plugin": "~4.5.2",
"compression-webpack-plugin": "~3.1.0",
"copy-webpack-plugin": "~5.1.1",
"core-js": "~2.5.7",
"css-loader": "~1.0.0",
"exports-loader": "~0.7.0",
"file-loader": "~1.1.11",
"html-loader": "~0.5.5",
"ngx-i18nsupport": "~0.17.1",
"rxjs": "~6.2.2",
"rxjs-compat": "~6.2.2",
"source-map-loader": "~0.2.3",
"ts-loader": "~4.4.2",
"tslint": "~5.10.0",
"typescript": "~2.7.2",
"webpack": "~4.4.0",
"webpack-cli": "~3.0.0",
"webpack": "~4.42.0",
"webpack-cli": "~3.1.0",
"webpack-config": "~7.5.0",
"zone.js": "~0.8.26"
}
Expand Down
4 changes: 2 additions & 2 deletions webClient/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Copyright Contributors to the Zowe Project.
-->

<div class="app-component test-panel-container">
<div class="app-component test-panel-container" (contextmenu)="onRightClick($event)">
<div class="test-panel plugin-test-panel">
<div class="bottom-10">
<span class="bigger-bold-text"
Expand Down Expand Up @@ -50,7 +50,7 @@
<span class="bold-text hide-it" i18n="window title for target app@@target-app-window-title">
Target App Window Title (this will become the title for the target window)</span>
<div class="div-input hide-it">
<input class="iframe-input input-height input-corner input-text shadowed" type="text" name="appWindowTitle" id="appWindowTitle" placeholder="app window title" value="My New Title"/>
<input class="iframe-input input-height input-corner input-text shadowed" type="text" placeholder="app window title" value="My New Title"/>
</div>
<span class="div-input bold-text" i18n="parameters@@parameters">Parameters:</span>
<div class="div-textarea-input">
Expand Down
202 changes: 158 additions & 44 deletions webClient/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
Copyright Contributors to the Zowe Project.
*/

import { Component, Inject } from '@angular/core';
import { Angular2InjectionTokens } from 'pluginlib/inject-resources';
import { Component, Inject, Optional } from '@angular/core';
import { Angular2InjectionTokens, ContextMenuItem, Angular2PluginWindowActions } from 'pluginlib/inject-resources';

import { ZluxPopupManagerService, ZluxErrorSeverity } from '@zlux/widgets';

import { HelloService } from './services/hello.service';
import { SettingsService } from './services/settings.service';

import { LocaleService, TranslationService, Language } from 'angular-l10n';
import { catchError } from 'rxjs/operators';
import { zip, throwError } from 'rxjs';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -52,13 +54,15 @@ export class AppComponent {
items = ['a', 'b', 'c', 'd']
helloText = '';
serverResponseMessage: string;
private menuItems: ContextMenuItem[];

constructor(
public locale: LocaleService,
public translation: TranslationService,
@Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) private pluginDefinition: ZLUX.ContainerPluginDefinition,
@Inject(Angular2InjectionTokens.LOGGER) private log: ZLUX.ComponentLogger,
@Inject(Angular2InjectionTokens.LAUNCH_METADATA) private launchMetadata: any,
@Optional() @Inject(Angular2InjectionTokens.WINDOW_ACTIONS) private windowActions: Angular2PluginWindowActions,
private popupManager: ZluxPopupManagerService,
private helloService: HelloService,
private settingsService: SettingsService) {
Expand Down Expand Up @@ -123,64 +127,53 @@ export class AppComponent {

getDefaultsFromServer() {
this.settingsService.getDefaultsFromServer().subscribe(res => {
if (res.status != 200) {
this.log.warn(`Get defaults from server failed. Data missing or request invalid. Status=${res.status}`);
}
try {
let responseJson = res.json();
this.log.info(`JSON=${JSON.stringify(responseJson)}`);
if (res.status == 200) {
if (responseJson.contents.appid && responseJson.contents.parameters) {
let paramData = responseJson.contents.parameters.data;
this.parameters = paramData.parameters;
this.actionType = paramData.actionType;
this.targetMode = paramData.appTarget;
this.targetAppId = responseJson.contents.appid.data.appId;
} else {
this.log.warn(`Incomplete data. AppID or Parameters missing.`);
}
}
} catch (e) {
this.log.warn(`Response was not JSON`);
this.log.info(`JSON=${JSON.stringify(res)}`);
if (res.contents.appid && res.contents.parameters) {
let paramData = res.contents.parameters.data;
this.parameters = paramData.parameters;
this.actionType = paramData.actionType;
this.targetMode = paramData.appTarget;
this.targetAppId = res.contents.appid.data.appId;
} else {
this.log.warn(`Incomplete data. AppID or Parameters missing.`);
}
}, e => {
this.log.warn(`Error on getting defaults, e=${e}`);
this.callStatus = 'Error getting defaults';
});
}

saveToServer() {
this.settingsService.saveAppRequest(this.actionType, this.targetMode, this.parameters).subscribe(res => {
this.log.info(`Saved parameters with HTTP status=${res.status}`);
if (res.status == 200 || res.status == 201) {
this.settingsService.saveAppId(this.targetAppId).subscribe(res=> {
this.log.info(`Saved App ID with HTTP status=${res.status}`);
}, e=> {
this.log.warn(`Error on saving App ID, e=${e}`);
saveToServer(): void {
zip(
this.settingsService.saveAppRequest(this.actionType, this.targetMode, this.parameters)
.pipe(catchError(err => {
this.log.warn(`Error on saving parameters, e=${err}`);
this.callStatus = 'Error saving parameters';
return throwError(err);
})),
this.settingsService.saveAppId(this.targetAppId)
.pipe(catchError(err => {
this.log.warn(`Error on saving App ID, e=${err}`);
this.callStatus = 'Error saving App ID';
});
} else {
this.log.warn(`Error on saving parameters, response status=${res.status}`);
}
}, e => {
this.log.warn(`Error on saving parameters, e=${e}`);
this.callStatus = 'Error saving parameters';
});
return throwError(err);
})),
).subscribe(
() => this.log.info(`Saved parameters and App ID`)
)
}

sayHello() {
sayHello(): void {
this.helloService.sayHello(this.helloText)
.subscribe(res => {
const responseJson: any = res.json();
if (responseJson != null && responseJson.serverResponse != null) {
this.serverResponseMessage =
.subscribe((res:any) => {
if (res != null) {
this.serverResponseMessage =
`${this.translation.translate('server_replied_with')}
"${responseJson.serverResponse}"`;
"${res.serverResponse}"`;
} else {
this.serverResponseMessage = "<Empty Reply from Server>";
}
this.log.info(responseJson);
this.log.info(res);
});
}

Expand Down Expand Up @@ -241,6 +234,127 @@ export class AppComponent {
this.callStatus = message;
}
}

generateTestMenuItems(translator: TranslationService): void {
this.menuItems = [
{
"text": translator.translate('items'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('items'));
},
"children": [
{
"text": translator.translate('item_1.1'),
// "icon": 'icon-settings',
"action": () => {
this.log.info(translator.translate('item_1.1'));
},
"children": [
{
"text": translator.translate('item_1.1.1'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('item_1.1.1'));
}
},
{
"text": translator.translate('item_1.1.2'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('item_1.1.2'));
}
}
]
},
{
"text": translator.translate('item_1.2'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('item_1.2'));
},
"children": [
{
"text": translator.translate('item_1.2.1'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('item_1.2.1'));
}
},
{
"text": translator.translate('item_1.2.2'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('item_1.2.2'));
}
}
]
}
]
},
{
"text": translator.translate('disabled'),
"disabled": true,
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('disabled'));
},
"children": [
{
"text": translator.translate('disabled_1.1'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('disabled_1.1'));
}
},
{
"text": translator.translate('disabled_1.2'),
// "icon": 'icon-person',
"action": () => {
this.log.info(translator.translate('disabled_1.2'));
}
}
]
},
{
"text": translator.translate('persisting_item'),
// "icon": 'icon-settings',
"action": () => {
this.log.info(translator.translate('persisting_item'));
},
"preventCloseMenu": true,
"children": [
{
"text": translator.translate('shortcut_item'),
// "icon": 'icon-person',
"shortcutText": 'F5',
"action": () => {
this.log.info(translator.translate('shortcut_item'));
}
},
{
"text": translator.translate('persisting_shortcut_item'),
// "icon": 'icon-person',
"shortcutText": 'F6',
"action": () => {
this.log.info(translator.translate('persisting_shortcut_item'));
},
"preventCloseMenu": true
}
]
}
];
}

onRightClick(event: MouseEvent): boolean {
if (this.windowActions) {
if (!this.menuItems) {this.generateTestMenuItems(this.translation);}
this.windowActions.spawnContextMenu(event.clientX, event.clientY, this.menuItems, true);
}
return false;
}


}


Expand Down
18 changes: 13 additions & 5 deletions webClient/src/app/services/hello.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,34 @@
*/

import { Injectable } from '@angular/core';
import { Http} from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';

export interface HelloResponseBody {
_objectType: string,
_metaDataVersion: string,
requestBody: string,
requestURL: string,
serverResponse: string;
}

@Injectable()
export class HelloService {
private destination:string;

constructor(private http: Http){}
constructor(private http: HttpClient){}

setDestination(path: string):void {
this.destination = path;
}

sayHello(text: string): Observable<any> {
sayHello(text: string): Observable<HelloResponseBody> {
const requestBody = {
"_objectType": "org.zowe.zlux.sample.angular.request.hello",
"_metaDataVersion": "1.0.0",
"messageFromClient": text
}
return this.http.post(this.destination, requestBody);
return this.http.post<HelloResponseBody>(this.destination, requestBody);
}

}
Expand Down
6 changes: 3 additions & 3 deletions webClient/src/app/services/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
*/

import { Injectable } from '@angular/core';
import { Http} from '@angular/http';
import { HttpClient } from '@angular/common/http';

@Injectable()
export class SettingsService {
private plugin:ZLUX.Plugin;

constructor(private http: Http){}
constructor(private http: HttpClient){}

setPlugin(plugin: ZLUX.Plugin):void {
this.plugin = plugin;
}

getDefaultsFromServer() {
return this.http.get(ZoweZLUX.uriBroker.pluginConfigUri(this.plugin, 'requests/app', undefined));
return this.http.get<any>(ZoweZLUX.uriBroker.pluginConfigUri(this.plugin, 'requests/app', undefined));
}

saveAppRequest(actionType: string, targetMode: string, parameters: string) {
Expand Down
Loading

0 comments on commit 87f7ac9

Please sign in to comment.