From fa1930c130b1c420527b654659c21ee7ad0b9a91 Mon Sep 17 00:00:00 2001 From: Suneeth Keerthy Date: Fri, 6 Sep 2019 13:26:56 -0400 Subject: [PATCH 1/5] Added sample notification button to show apps being able to send notifications to the notification manager Signed-off-by: Suneeth Keerthy --- webClient/package-lock.json | 78 +++++++++++++++++++++------- webClient/src/app/app.component.html | 2 + webClient/src/app/app.component.ts | 27 +++++++++- 3 files changed, 87 insertions(+), 20 deletions(-) diff --git a/webClient/package-lock.json b/webClient/package-lock.json index 53e3314..6bff70b 100644 --- a/webClient/package-lock.json +++ b/webClient/package-lock.json @@ -987,6 +987,7 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, + "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -2054,7 +2055,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "constants-browserify": { "version": "1.0.0", @@ -2508,7 +2510,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true + "dev": true, + "optional": true }, "depd": { "version": "1.1.2", @@ -3469,7 +3472,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -3490,12 +3494,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3510,17 +3516,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -3637,7 +3646,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3649,6 +3659,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3663,6 +3674,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3670,12 +3682,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3694,6 +3708,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3774,7 +3789,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3786,6 +3802,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3871,7 +3888,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3907,6 +3925,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3926,6 +3945,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3969,12 +3989,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -3983,6 +4005,7 @@ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", @@ -4001,6 +4024,7 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, + "optional": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -4032,7 +4056,8 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true + "dev": true, + "optional": true }, "get-stream": { "version": "4.1.0", @@ -4296,7 +4321,8 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true + "dev": true, + "optional": true }, "has-value": { "version": "1.0.0", @@ -5127,7 +5153,8 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true + "dev": true, + "optional": true }, "is-windows": { "version": "1.0.2", @@ -5470,6 +5497,7 @@ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", @@ -5482,7 +5510,8 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "dev": true, + "optional": true } } }, @@ -5607,7 +5636,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true + "dev": true, + "optional": true }, "map-visit": { "version": "1.0.0", @@ -6219,6 +6249,7 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, + "optional": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -6608,6 +6639,7 @@ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, + "optional": true, "requires": { "error-ex": "^1.2.0" } @@ -7116,6 +7148,7 @@ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, + "optional": true, "requires": { "load-json-file": "^1.0.0", "normalize-package-data": "^2.3.2", @@ -7127,6 +7160,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "pify": "^2.0.0", @@ -7137,7 +7171,8 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "dev": true, + "optional": true } } }, @@ -7146,6 +7181,7 @@ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, + "optional": true, "requires": { "find-up": "^1.0.0", "read-pkg": "^1.0.0" @@ -7156,6 +7192,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, + "optional": true, "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" @@ -7166,6 +7203,7 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, + "optional": true, "requires": { "pinkie-promise": "^2.0.0" } @@ -8319,6 +8357,7 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, + "optional": true, "requires": { "is-utf8": "^0.2.0" } @@ -9735,6 +9774,7 @@ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, + "optional": true, "requires": { "string-width": "^1.0.2 || 2" } diff --git a/webClient/src/app/app.component.html b/webClient/src/app/app.component.html index 819d99c..7ba0841 100644 --- a/webClient/src/app/app.component.html +++ b/webClient/src/app/app.component.html @@ -81,6 +81,8 @@ +
+ diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index e5e5129..b67ddf7 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -20,13 +20,18 @@ import { SettingsService } from './services/settings.service'; import { LocaleService, TranslationService, Language } from 'angular-l10n'; +import {Http} from '@angular/http'; +import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' + + +const EVERYONE = "Everyone" + @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], providers: [HelloService, ZluxPopupManagerService, SettingsService] }) - export class AppComponent { @Language() lang: string; @@ -52,8 +57,10 @@ export class AppComponent { items = ['a', 'b', 'c', 'd'] helloText = ''; serverResponseMessage: string; + response: string; constructor( + private http: Http, public locale: LocaleService, public translation: TranslationService, @Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) private pluginDefinition: ZLUX.ContainerPluginDefinition, @@ -69,6 +76,7 @@ export class AppComponent { if (this.launchMetadata != null && this.launchMetadata.data != null && this.launchMetadata.data.type != null) { this.handleLaunchOrMessageObject(this.launchMetadata.data); } + this.response = ""; } handleLaunchOrMessageObject(data: any) { @@ -241,6 +249,23 @@ export class AppComponent { this.callStatus = message; } } + + sendNotification(): void { + let pluginId = this.pluginDefinition.getBasePlugin().getIdentifier() + let notification = new ZoweNotification("Test", "This notifications should produce a different icon", 1, pluginId) + + ZoweZLUX.pluginManager.loadPlugins('bootstrap').then((res: any) => { + let url = ZoweZLUX.uriBroker.pluginRESTUri(res[0], 'adminnotificationdata', '') + 'write' + this.http.post(url, {"notification": notification, "recipient": EVERYONE}) + .subscribe( + res => { + this.response = JSON.parse((res as any)['_body']).Response + }, + error => { + this.response = JSON.parse((error as any)['_body']).Response + }) + }) + } } From d872561010d1e4dd7ab24307980db44304c223d2 Mon Sep 17 00:00:00 2001 From: Suneeth Keerthy Date: Fri, 6 Sep 2019 13:56:20 -0400 Subject: [PATCH 2/5] Added response message Signed-off-by: Suneeth Keerthy --- webClient/src/app/app.component.html | 3 +++ webClient/src/app/app.component.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/webClient/src/app/app.component.html b/webClient/src/app/app.component.html index 7ba0841..44764ee 100644 --- a/webClient/src/app/app.component.html +++ b/webClient/src/app/app.component.html @@ -83,6 +83,9 @@
+
+ {{response}} +
diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index b67ddf7..d6a4520 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -23,7 +23,6 @@ import { LocaleService, TranslationService, Language } from 'angular-l10n'; import {Http} from '@angular/http'; import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' - const EVERYONE = "Everyone" @Component({ @@ -32,6 +31,7 @@ const EVERYONE = "Everyone" styleUrls: ['./app.component.css'], providers: [HelloService, ZluxPopupManagerService, SettingsService] }) + export class AppComponent { @Language() lang: string; From 1082d4203b1dbbd3cce548943ad2126a599d233f Mon Sep 17 00:00:00 2001 From: Suneeth Keerthy Date: Thu, 12 Sep 2019 17:14:34 -0400 Subject: [PATCH 3/5] Restructure the way it calls the notification manager Signed-off-by: Suneeth Keerthy --- webClient/src/app/app.component.html | 5 +++-- webClient/src/app/app.component.ts | 33 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/webClient/src/app/app.component.html b/webClient/src/app/app.component.html index 44764ee..b0c19d1 100644 --- a/webClient/src/app/app.component.html +++ b/webClient/src/app/app.component.html @@ -83,9 +83,10 @@
+
- {{response}} -
+ {{response}} + diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index d6a4520..490735f 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -20,8 +20,7 @@ import { SettingsService } from './services/settings.service'; import { LocaleService, TranslationService, Language } from 'angular-l10n'; -import {Http} from '@angular/http'; -import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' +// import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' const EVERYONE = "Everyone" @@ -60,7 +59,6 @@ export class AppComponent { response: string; constructor( - private http: Http, public locale: LocaleService, public translation: TranslationService, @Inject(Angular2InjectionTokens.PLUGIN_DEFINITION) private pluginDefinition: ZLUX.ContainerPluginDefinition, @@ -250,21 +248,24 @@ export class AppComponent { } } - sendNotification(): void { + sendNotification(): number { let pluginId = this.pluginDefinition.getBasePlugin().getIdentifier() - let notification = new ZoweNotification("Test", "This notifications should produce a different icon", 1, pluginId) + let notification = ZoweZLUX.notificationManager.createNotification("Test", "This notification is NOT being sent through the server", 1, pluginId) + return ZoweZLUX.notificationManager.notify(notification) + } + + sendRestNotification(): void { + let pluginId = this.pluginDefinition.getBasePlugin().getIdentifier() + let notification = ZoweZLUX.notificationManager.createNotification("Test", "This notification is being sent through the server", 1, pluginId) - ZoweZLUX.pluginManager.loadPlugins('bootstrap').then((res: any) => { - let url = ZoweZLUX.uriBroker.pluginRESTUri(res[0], 'adminnotificationdata', '') + 'write' - this.http.post(url, {"notification": notification, "recipient": EVERYONE}) - .subscribe( - res => { - this.response = JSON.parse((res as any)['_body']).Response - }, - error => { - this.response = JSON.parse((error as any)['_body']).Response - }) - }) + ZoweZLUX.notificationManager.serverNotify({"notification": notification, "recipient": EVERYONE}) + .then( + (res: any) => { + res.json().then((json: any) => this.response = "Server Response: " + json.Response) + }, + (error: any) => { + error.json().then((json: any) => this.response = "Server Response: " + json.Response) + }) } } From 0d12c62a35be553e42fa0ec16b43f78dd6065e35 Mon Sep 17 00:00:00 2001 From: Suneeth Keerthy Date: Thu, 12 Sep 2019 17:21:41 -0400 Subject: [PATCH 4/5] Removed unneeded things Signed-off-by: Suneeth Keerthy --- webClient/src/app/app.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index 490735f..a5e5754 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -20,8 +20,6 @@ import { SettingsService } from './services/settings.service'; import { LocaleService, TranslationService, Language } from 'angular-l10n'; -// import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' - const EVERYONE = "Everyone" @Component({ From 5a903b672e46c2370be2f4d58aa9eca6815a4e32 Mon Sep 17 00:00:00 2001 From: Suneeth Keerthy Date: Fri, 13 Sep 2019 16:26:33 -0400 Subject: [PATCH 5/5] Fix somethings Signed-off-by: Suneeth Keerthy --- webClient/src/app/app.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webClient/src/app/app.component.ts b/webClient/src/app/app.component.ts index a5e5754..46b0c38 100644 --- a/webClient/src/app/app.component.ts +++ b/webClient/src/app/app.component.ts @@ -19,7 +19,7 @@ import { HelloService } from './services/hello.service'; import { SettingsService } from './services/settings.service'; import { LocaleService, TranslationService, Language } from 'angular-l10n'; - +import { ZoweNotification } from '../../../../zlux-platform/base/src/notification-manager/notification' const EVERYONE = "Everyone" @Component({ @@ -248,13 +248,13 @@ export class AppComponent { sendNotification(): number { let pluginId = this.pluginDefinition.getBasePlugin().getIdentifier() - let notification = ZoweZLUX.notificationManager.createNotification("Test", "This notification is NOT being sent through the server", 1, pluginId) + let notification = new ZoweNotification("Test", "This notification is NOT being sent through the server", 1, pluginId) return ZoweZLUX.notificationManager.notify(notification) } sendRestNotification(): void { let pluginId = this.pluginDefinition.getBasePlugin().getIdentifier() - let notification = ZoweZLUX.notificationManager.createNotification("Test", "This notification is being sent through the server", 1, pluginId) + let notification = new ZoweNotification("Test", "This notification is being sent through the server", 1, pluginId) ZoweZLUX.notificationManager.serverNotify({"notification": notification, "recipient": EVERYONE}) .then(