@microsoft/windows-admin-center-sdk 2.538.0 → 2.541.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular/assets/strings/de-DE/strings.json +1 -1
- package/angular/assets/strings/es-ES/strings.json +1 -1
- package/angular/assets/strings/it-IT/strings.json +1 -1
- package/angular/assets/strings/ko-KR/strings.json +1 -1
- package/angular/assets/strings/nl-NL/strings.json +1 -1
- package/angular/assets/strings/pt-PT/strings.json +1 -1
- package/angular/assets/strings/tr-TR/strings.json +1 -1
- package/angular/assets/strings/zh-CN/strings.json +1 -1
- package/angular/assets/strings/zh-TW/strings.json +1 -1
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js +172 -112
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.js.map +1 -1
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js +1 -1
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js.map +1 -1
- package/angular/esm2015/src/controls/header/header.component.js +3 -1
- package/angular/esm2015/src/controls/header/index.js +2 -2
- package/angular/esm2015/src/controls/page-alert-bar/models/page-alert.js +2 -1
- package/angular/esm2015/src/controls/page-alert-bar/page-alert-bar.component.js +11 -3
- package/angular/esm2015/src/controls/property-grid/property-grid.component.js +2 -2
- package/angular/esm2015/src/controls/wizard/wizard-builder.js +13 -1
- package/angular/esm2015/src/controls/wizard/wizard.component.js +126 -109
- package/angular/esm2015/src/controls/wizard/wizard.module.js +12 -7
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js +156 -113
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js.map +1 -1
- package/angular/src/controls/header/header.component.d.ts +7 -0
- package/angular/src/controls/header/index.d.ts +1 -1
- package/angular/src/controls/page-alert-bar/models/page-alert.d.ts +2 -1
- package/angular/src/controls/page-alert-bar/page-alert-bar.component.d.ts +1 -0
- package/angular/src/controls/wizard/wizard-builder.d.ts +13 -0
- package/angular/src/controls/wizard/wizard.component.d.ts +5 -0
- package/angular/src/controls/wizard/wizard.module.d.ts +10 -9
- package/core/data/active-directory/active-directory.js +2 -2
- package/core/data/active-directory/active-directory.js.map +1 -1
- package/core/data/powershell.d.ts +2 -2
- package/core/data/powershell.js +2 -2
- package/core/data/powershell.js.map +1 -1
- package/core/notification/notification-manager.d.ts +0 -18
- package/core/notification/notification-manager.js +10 -55
- package/core/notification/notification-manager.js.map +1 -1
- package/core/notification/notification.d.ts +1 -10
- package/core/notification/notification.js +33 -30
- package/core/notification/notification.js.map +1 -1
- package/core/notification/powershell-notification.d.ts +15 -15
- package/core/notification/powershell-notification.js +8 -19
- package/core/notification/powershell-notification.js.map +1 -1
- package/core/notification/socket-signalr.d.ts +14 -8
- package/core/notification/socket-signalr.js +19 -18
- package/core/notification/socket-signalr.js.map +1 -1
- package/core/notification/work-item-manager.d.ts +0 -4
- package/core/notification/work-item-manager.js +20 -76
- package/core/notification/work-item-manager.js.map +1 -1
- package/package.json +5 -2
- package/styles/css/main-v2.css +1 -1
- package/tools/wac-cli/src/create/main.js +0 -1
- package/tools/wac-cli/src/create/main.js.map +1 -1
- package/tools/wac-cli/templates/internal/package.json +4 -0
- package/tools/wac-cli/templates/library/angular.json +3 -0
- package/tools/wac-cli/templates/wac-template/angular.json +3 -0
- package/tools/wac-cli/templates/wac-template/package.json +4 -0
- package/tools/wac-cli/templates/wac-template/src/app/default/default.component.spec.ts +2 -3
- package/core/notification/notification-message.d.ts +0 -41
- package/core/notification/notification-message.js +0 -3
- package/core/notification/notification-message.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/notification/notification-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAc,aAAa,EAAgB,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,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AU;YACnC,QAAQ,EAAE,YAAY,CAAC,QAAQ;SAClC,CAAC;QACF,OAAO,kBAAkB,CAAC;IAC9B,CAAC;IAED;;;;;OAKG;IACK,QAAQ,CAAC,WAAoC,EAAE,YAA2B;QAC9E,iGAAiG;QACjG,MAAM,gBAAgB,GAAG,EAAE,CAAC;QAC5B,IAAI,YAAY,EAAE;YACd,OAAO,CAAC,qBAAqB,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;SACjE;QAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/G,mBAAmB;QACnB,OAAO,CAAC,UAAU,CACd,cAAc,EACd,YAAY,CAAC,CAAC;YACV,kCAAkC,CAAC,MAAM,CACrC,uBAAuB,CAAC,WAAW,CAAC,EACpC,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,EACrC,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,OAAO,EACpB,YAAY,CAAC,IAAI,CAAC;YACtB,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;CACJ","file":"notification-manager.js","sourcesContent":["import { EMPTY, Observable, ReplaySubject, Subscription } from 'rxjs';\r\nimport { Globalization } from '../data/globalization';\r\nimport { Net } from '../data/net';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { Strings } from '../generated/strings';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { RpcNotificationSubjectServer } from '../rpc/notification/rpc-notification-subject-server';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { RpcWorkItemFind, RpcWorkItemFindResult } from '../rpc/work-item-find/rpc-work-item-find-model';\r\nimport { RpcWorkItemFindSubjectServer } from '../rpc/work-item-find/rpc-work-item-find-subject-server';\r\nimport { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';\r\nimport { Notification, NotificationChangeEvent, NotificationEvent } from './notification';\r\nimport { NotificationMessage } from './notification-message';\r\nimport { NotificationState } from './notification-state';\r\nimport { PowerShellWorkItemMessage } from './powershell-notification';\r\nimport { SocketMessage } from './socket-signalr';\r\nimport { RecoveredWorkItem, WorkItemResult } from './work-item-request';\r\n\r\n/**\r\n * Mock the IFrameService class in app folder\r\n */\r\nexport class IFrameService {\r\n public getActiveToolIFrameData: () => {\r\n entryPoint: {\r\n name: string;\r\n parentModule: {\r\n name: string;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Notification manager class.\r\n */\r\nexport class NotificationManager {\r\n private collection: { [id: string]: Notification };\r\n private psSessionIdToNotificationIdMap = new Map<string, string>();\r\n private notificationIdToPsSessionIdMap = new Map<string, string>();\r\n private rpcNotifySubscription: Subscription;\r\n private rpcQuerySubscription: Subscription;\r\n private changedEventSubject: ReplaySubject<NotificationEvent>;\r\n private rpcWorkItemFindSubjectServer: RpcWorkItemFindSubjectServer;\r\n private rpcNotificationSubjectServer: RpcNotificationSubjectServer;\r\n private iFrameService: IFrameService;\r\n\r\n /**\r\n * Initializes a new instance of the NotificationManager class.\r\n *\r\n * @param rpc the RPC object.\r\n */\r\n constructor(private rpc: Rpc) {\r\n this.changedEventSubject = new ReplaySubject<NotificationEvent>(1);\r\n this.initialize();\r\n }\r\n\r\n /**\r\n * register iframe service from shell\r\n * @param iFrameService the iframe service from shell\r\n */\r\n public registerIFrameService(iFrameService: any) {\r\n this.iFrameService = iFrameService;\r\n }\r\n\r\n /**\r\n * Gets the items from current notification collection including dismissed.\r\n */\r\n public get items(): Notification[] {\r\n const items: Notification[] = [];\r\n for (const item in this.collection) {\r\n if (this.collection.hasOwnProperty(item)) {\r\n items.push(this.collection[item]);\r\n }\r\n }\r\n\r\n return items;\r\n }\r\n\r\n /**\r\n * Gets the subject of notification changed event.\r\n */\r\n public get changed(): ReplaySubject<NotificationEvent> {\r\n return this.changedEventSubject;\r\n }\r\n\r\n /**\r\n * Initializes the rpc notification call.\r\n */\r\n public initialize(): void {\r\n this.collection = {};\r\n\r\n // notification request from rpc...\r\n this.rpcNotificationSubjectServer = new RpcNotificationSubjectServer(this.rpc);\r\n this.rpcNotifySubscription = this.rpcNotificationSubjectServer.subject\r\n .subscribe(\r\n item => {\r\n this.notify(item.data).toPromise().then(item.deferred.resolve, item.deferred.reject);\r\n },\r\n error => {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationRpcInitialization.message;\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n });\r\n this.rpcWorkItemFindSubjectServer = new RpcWorkItemFindSubjectServer(this.rpc);\r\n this.rpcQuerySubscription = this.rpcWorkItemFindSubjectServer.subject\r\n .subscribe(\r\n item => {\r\n item.deferred.resolve(this.workItemFind(item.data));\r\n },\r\n error => {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationRpcInitialization.message;\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n });\r\n this.addEvent(NotificationChangeEvent.Initialized);\r\n }\r\n\r\n /**\r\n * Stop the notification manager.\r\n */\r\n public uninitialize(): void {\r\n if (this.rpcNotifySubscription) {\r\n this.rpcNotifySubscription.unsubscribe();\r\n this.rpcNotifySubscription = null;\r\n }\r\n\r\n if (this.rpcQuerySubscription) {\r\n this.rpcQuerySubscription.unsubscribe();\r\n this.rpcQuerySubscription = null;\r\n }\r\n }\r\n\r\n /**\r\n * Find a notification.\r\n *\r\n * @param id the notification id.\r\n */\r\n public find(id: string): Notification {\r\n const notificationId = this.psSessionIdToNotificationIdMap[id] || id;\r\n return this.collection[notificationId];\r\n }\r\n\r\n /**\r\n * Remove a notification.\r\n * There is no dismiss API on the gateway, this just remove from the list.\r\n * Don't remove active notification. Use dismiss api instead, so it doesn't displays to .items property.\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if removed.\r\n */\r\n public remove(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n const psSessionId = this.notificationIdToPsSessionIdMap[id];\r\n delete this.psSessionIdToNotificationIdMap[psSessionId];\r\n delete this.notificationIdToPsSessionIdMap[id];\r\n delete this.collection[id];\r\n this.addEvent(NotificationChangeEvent.Remove, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Dismiss a notification to mark dismiss property.\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if dismissed.\r\n */\r\n public dismiss(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n notification.dismissed = true;\r\n this.addEvent(NotificationChangeEvent.Remove, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Set dismissed to false for notification updated that was previously dismissed\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if undismissed.\r\n */\r\n public undismiss(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n notification.dismissed = false;\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add notification from WorkItem.\r\n *\r\n * @param psSessionId the psSession ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public addFromWorkItem(notificationId: string, workItem: RpcWorkItem, state: NotificationState): void {\r\n const notification = Notification.createFromWorkItem(notificationId, workItem, state, this.iFrameService);\r\n const existingNotification = this.find(notificationId);\r\n this.collection[notificationId] = notification;\r\n\r\n if (!notification.isDisabled) {\r\n if (existingNotification) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n } else {\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update an existing work item with psSession Id information.\r\n *\r\n * @param notificationId the id of the notification.\r\n * @param psSessionId the psSession ID.\r\n * @param workItem the work item.\r\n * @param state the state of the work item.\r\n * @param object the object from query result.\r\n */\r\n public updateWorkItemWithPsSession(\r\n notificationId: string,\r\n psSessionId: string,\r\n workItem: RpcWorkItem,\r\n state: NotificationState,\r\n object: any): boolean {\r\n\r\n const notification = this.find(notificationId);\r\n this.psSessionIdToNotificationIdMap[psSessionId] = notificationId;\r\n this.notificationIdToPsSessionIdMap[notificationId] = psSessionId;\r\n\r\n if (notification) {\r\n if (notification.updateFromWorkItem(notificationId, workItem, state, object)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add notification from Recover.\r\n *\r\n * @param id the notification ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public addFromRecover(recover: RecoveredWorkItem): void {\r\n const notification = Notification.createFromRecover(recover, this.iFrameService);\r\n this.collection[recover.id] = notification;\r\n this.psSessionIdToNotificationIdMap[recover.id] = recover.id;\r\n this.notificationIdToPsSessionIdMap[recover.id] = recover.id;\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n }\r\n\r\n /**\r\n * Add initial notification for Message Notification.\r\n *\r\n * @param id the notification ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public addForNotificationMessage(state: NotificationState, message: NotificationMessage): boolean {\r\n if (this.collection[message.id]) {\r\n return false;\r\n }\r\n\r\n const notification = new Notification(message.id);\r\n const now = new Date();\r\n notification.isFromRecover = true;\r\n notification.state = state;\r\n notification.object = {};\r\n notification.nodeName = message.sourceName;\r\n notification.moduleDisplayName = message.sourceName;\r\n notification.startTimestamp = Globalization.timeOnly(now);\r\n notification.changedTimestamp = Globalization.timeOnly(now);\r\n notification.changedTimestampValue = now.getTime();\r\n notification.description = null;\r\n notification.typeId = null;\r\n notification.title = message.title;\r\n notification.message = message.message;\r\n this.collection[message.id] = notification;\r\n this.psSessionIdToNotificationIdMap[message.id] = message.id;\r\n this.notificationIdToPsSessionIdMap[message.id] = message.id;\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n return true;\r\n }\r\n\r\n /**\r\n * Update notification from socket message.\r\n *\r\n * @param psSessionId the psSession ID.\r\n * @param message the socket message.\r\n */\r\n public updateFromMessage(psSessionId: string, message: SocketMessage<PowerShellWorkItemMessage>): boolean {\r\n const notificationId = this.psSessionIdToNotificationIdMap[psSessionId];\r\n const notification = this.find(notificationId);\r\n if (notification) {\r\n if (notification.updateFromMessage(message)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Update notification from socket message.\r\n *\r\n * @param psSessionId the psSession ID.\r\n * @param message the socket message.\r\n */\r\n public updateFromNotificationMessage(state: NotificationState, item: NotificationMessage): boolean {\r\n const notification = this.find(item.id);\r\n if (notification) {\r\n notification.updateFromNotificationMessage(state, item);\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add or update client notification.\r\n *\r\n * @param clientNotification the client notification object.\r\n * @param Observable the observable of void.\r\n */\r\n public notify(clientNotification: RpcNotification): Observable<any> {\r\n // convert alert into notification\r\n if (MsftSme.isNullOrWhiteSpace(clientNotification.title)) {\r\n clientNotification.title = clientNotification.message;\r\n clientNotification.message = null;\r\n }\r\n\r\n SmeWebTelemetry.traceClientNotification(clientNotification);\r\n\r\n let notification = this.find(clientNotification.id);\r\n if (notification) {\r\n if (notification.updateFromClient(clientNotification)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n\r\n return EMPTY;\r\n }\r\n\r\n notification = Notification.createFromClient(clientNotification, this.iFrameService);\r\n this.collection[clientNotification.id] = notification;\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n return EMPTY;\r\n }\r\n\r\n /**\r\n * Find current work item by the typeId/sourceName/nodeName.\r\n *\r\n * @param workItemFind the query notification object.\r\n * @param RpcWorkItemFindResult the result of query.\r\n */\r\n public workItemFind(workItemFind: RpcWorkItemFind): RpcWorkItemFindResult {\r\n const keys = Object.keys(this.collection);\r\n const results: WorkItemResult[] = keys\r\n .map(key => <any>{ key: key, notification: this.collection[key] })\r\n .filter(data => data.notification.moduleName === workItemFind.moduleName\r\n && data.notification.nodeName === workItemFind.nodeName\r\n && data.notification.typeId === workItemFind.typeId)\r\n .map(data => <WorkItemResult>{\r\n id: data.key,\r\n state: data.notification.state,\r\n percent: data.notification.percent,\r\n error: data.notification.error,\r\n object: data.notification.object\r\n });\r\n\r\n const notificationResult: RpcWorkItemFindResult = {\r\n results: results,\r\n typeId: workItemFind.typeId,\r\n moduleName: workItemFind.moduleName,\r\n nodeName: workItemFind.nodeName\r\n };\r\n return notificationResult;\r\n }\r\n\r\n /**\r\n * Add an event to report the change of notification data or collection.\r\n *\r\n * @param changeEvent the changed event.\r\n * @param notification the notification object. (optional)\r\n */\r\n private addEvent(changeEvent: NotificationChangeEvent, notification?: Notification): void {\r\n // need to copy otherwise every change to original notification will be shown on UI without event\r\n const notificationCopy = {};\r\n if (notification) {\r\n MsftSme.shallowCopyFromObject(notificationCopy, notification);\r\n }\r\n\r\n this.changedEventSubject.next(<NotificationEvent>{ notification: notificationCopy, changeEvent: changeEvent });\r\n // no localization.\r\n Logging.logVerbose(\r\n 'Notification',\r\n notification ?\r\n 'addEvent: {0}/{1}\\n{2}\\n{3}\\n{4}'.format(\r\n NotificationChangeEvent[changeEvent],\r\n NotificationState[notification.state],\r\n notification.title,\r\n notification.message,\r\n notification.link)\r\n : 'addEvent: {0}'.format(NotificationChangeEvent[changeEvent]));\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/notification/notification-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B,EAAE,YAAY,CAAC,CAAC;SACjE;QAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;QAC/G,mBAAmB;QACnB,OAAO,CAAC,GAAG,CAAC;YACR,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,QAAQ,CAAC,OAAO;YACvB,OAAO,EAAE,YAAY,CAAC,CAAC;gBACnB,kCAAkC,CAAC,MAAM,CACrC,uBAAuB,CAAC,WAAW,CAAC,EACpC,iBAAiB,CAAC,YAAY,CAAC,KAAK,CAAC,EACrC,YAAY,CAAC,KAAK,EAClB,YAAY,CAAC,OAAO,EACpB,YAAY,CAAC,IAAI,CAAC;gBACtB,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;SACrE,CAAC,CAAC;IACP,CAAC;CACJ","file":"notification-manager.js","sourcesContent":["import { empty, Observable, ReplaySubject, Subscription } from 'rxjs';\r\nimport { Net } from '../data/net';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { SmeWebTelemetry } from '../diagnostics/sme-web-telemetry';\r\nimport { Strings } from '../generated/strings';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { RpcNotificationSubjectServer } from '../rpc/notification/rpc-notification-subject-server';\r\nimport { Rpc } from '../rpc/rpc';\r\nimport { RpcWorkItemFind, RpcWorkItemFindResult } from '../rpc/work-item-find/rpc-work-item-find-model';\r\nimport { RpcWorkItemFindSubjectServer } from '../rpc/work-item-find/rpc-work-item-find-subject-server';\r\nimport { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';\r\nimport { Notification, NotificationChangeEvent, NotificationEvent } from './notification';\r\nimport { NotificationState } from './notification-state';\r\nimport { PowerShellWorkItemMessage } from './powershell-notification';\r\nimport { SocketMessage } from './socket-signalr';\r\nimport { RecoveredWorkItem, WorkItemResult } from './work-item-request';\r\n\r\n/**\r\n * Mock the IFrameService class in app folder\r\n */\r\nexport class IFrameService {\r\n public getActiveToolIFrameData: () => {\r\n entryPoint: {\r\n name: string;\r\n parentModule: {\r\n name: string;\r\n }\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Notification manager class.\r\n */\r\nexport class NotificationManager {\r\n private collection: { [id: string]: Notification };\r\n private psSessionIdToNotificationIdMap = new Map<string, string>();\r\n private notificationIdToPsSessionIdMap = new Map<string, string>();\r\n private rpcNotifySubscription: Subscription;\r\n private rpcQuerySubscription: Subscription;\r\n private changedEventSubject: ReplaySubject<NotificationEvent>;\r\n private rpcWorkItemFindSubjectServer: RpcWorkItemFindSubjectServer;\r\n private rpcNotificationSubjectServer: RpcNotificationSubjectServer;\r\n private iFrameService: IFrameService;\r\n\r\n /**\r\n * Initializes a new instance of the NotificationManager class.\r\n *\r\n * @param rpc the RPC object.\r\n */\r\n constructor(private rpc: Rpc) {\r\n this.changedEventSubject = new ReplaySubject<NotificationEvent>(1);\r\n this.initialize();\r\n }\r\n\r\n /**\r\n * register iframe service from shell\r\n * @param iFrameService the iframe service from shell\r\n */\r\n public registerIFrameService(iFrameService: any) {\r\n this.iFrameService = iFrameService;\r\n }\r\n\r\n /**\r\n * Gets the items from current notification collection including dismissed.\r\n */\r\n public get items(): Notification[] {\r\n const items: Notification[] = [];\r\n for (const item in this.collection) {\r\n if (this.collection.hasOwnProperty(item)) {\r\n items.push(this.collection[item]);\r\n }\r\n }\r\n\r\n return items;\r\n }\r\n\r\n /**\r\n * Gets the subject of notification changed event.\r\n */\r\n public get changed(): ReplaySubject<NotificationEvent> {\r\n return this.changedEventSubject;\r\n }\r\n\r\n /**\r\n * Initializes the rpc notification call.\r\n */\r\n public initialize(): void {\r\n this.collection = {};\r\n\r\n // notification request from rpc...\r\n this.rpcNotificationSubjectServer = new RpcNotificationSubjectServer(this.rpc);\r\n this.rpcNotifySubscription = this.rpcNotificationSubjectServer.subject\r\n .subscribe(\r\n item => {\r\n this.notify(item.data).toPromise().then(item.deferred.resolve, item.deferred.reject);\r\n },\r\n error => {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationRpcInitialization.message;\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n });\r\n this.rpcWorkItemFindSubjectServer = new RpcWorkItemFindSubjectServer(this.rpc);\r\n this.rpcQuerySubscription = this.rpcWorkItemFindSubjectServer.subject\r\n .subscribe(\r\n item => {\r\n item.deferred.resolve(this.workItemFind(item.data));\r\n },\r\n error => {\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationRpcInitialization.message;\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Error,\r\n message: message.format(Net.getErrorMessage(error))\r\n });\r\n });\r\n this.addEvent(NotificationChangeEvent.Initialized);\r\n }\r\n\r\n /**\r\n * Stop the notification manager.\r\n */\r\n public uninitialize(): void {\r\n if (this.rpcNotifySubscription) {\r\n this.rpcNotifySubscription.unsubscribe();\r\n this.rpcNotifySubscription = null;\r\n }\r\n\r\n if (this.rpcQuerySubscription) {\r\n this.rpcQuerySubscription.unsubscribe();\r\n this.rpcQuerySubscription = null;\r\n }\r\n }\r\n\r\n /**\r\n * Find a notification.\r\n *\r\n * @param id the notification id.\r\n */\r\n public find(id: string): Notification {\r\n const notificationId = this.psSessionIdToNotificationIdMap[id] || id;\r\n return this.collection[notificationId];\r\n }\r\n\r\n /**\r\n * Remove a notification.\r\n * There is no dismiss API on the gateway, this just remove from the list.\r\n * Don't remove active notification. Use dismiss api instead, so it doesn't displays to .items property.\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if removed.\r\n */\r\n public remove(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n const psSessionId = this.notificationIdToPsSessionIdMap[id];\r\n delete this.psSessionIdToNotificationIdMap[psSessionId];\r\n delete this.notificationIdToPsSessionIdMap[id];\r\n delete this.collection[id];\r\n this.addEvent(NotificationChangeEvent.Remove, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Dismiss a notification to mark dismiss property.\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if dismissed.\r\n */\r\n public dismiss(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n notification.dismissed = true;\r\n this.addEvent(NotificationChangeEvent.Remove, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Set dismissed to false for notification updated that was previously dismissed\r\n *\r\n * @param id the session id (notification id).\r\n * @return boolean true if undismissed.\r\n */\r\n public undismiss(id: string): boolean {\r\n const notification: Notification = this.find(id);\r\n if (notification) {\r\n notification.dismissed = false;\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add notification from WorkItem.\r\n *\r\n * @param psSessionId the psSession ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public addFromWorkItem(notificationId: string, workItem: RpcWorkItem, state: NotificationState): void {\r\n const notification = Notification.createFromWorkItem(notificationId, workItem, state, this.iFrameService);\r\n const existingNotification = this.find(notificationId);\r\n this.collection[notificationId] = notification;\r\n\r\n if (!notification.isDisabled) {\r\n if (existingNotification) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n } else {\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Update an existing work item with psSession Id information.\r\n *\r\n * @param notificationId the id of the notification.\r\n * @param psSessionId the psSession ID.\r\n * @param workItem the work item.\r\n * @param state the state of the work item.\r\n * @param object the object from query result.\r\n */\r\n public updateWorkItemWithPsSession(\r\n notificationId: string,\r\n psSessionId: string,\r\n workItem: RpcWorkItem,\r\n state: NotificationState,\r\n object: any): boolean {\r\n\r\n const notification = this.find(notificationId);\r\n this.psSessionIdToNotificationIdMap[psSessionId] = notificationId;\r\n this.notificationIdToPsSessionIdMap[notificationId] = psSessionId;\r\n\r\n if (notification) {\r\n if (notification.updateFromWorkItem(notificationId, workItem, state, object)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add notification from Recover.\r\n *\r\n * @param id the notification ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public addFromRecover(recover: RecoveredWorkItem): void {\r\n const notification = Notification.createFromRecover(recover, this.iFrameService);\r\n this.collection[recover.id] = notification;\r\n this.psSessionIdToNotificationIdMap[recover.id] = recover.id;\r\n this.notificationIdToPsSessionIdMap[recover.id] = recover.id;\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n }\r\n\r\n /**\r\n * Update notification from socket message.\r\n *\r\n * @param psSessionId the psSession ID.\r\n * @param message the socket message.\r\n */\r\n public updateFromMessage(psSessionId: string, message: SocketMessage<PowerShellWorkItemMessage>): boolean {\r\n const notificationId = this.psSessionIdToNotificationIdMap[psSessionId];\r\n const notification = this.find(notificationId);\r\n if (notification) {\r\n if (notification.updateFromMessage(message)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Add or update client notification.\r\n *\r\n * @param clientNotification the client notification object.\r\n * @param Observable the observable of void.\r\n */\r\n public notify(clientNotification: RpcNotification): Observable<any> {\r\n // convert alert into notification\r\n if (MsftSme.isNullOrWhiteSpace(clientNotification.title)) {\r\n clientNotification.title = clientNotification.message;\r\n clientNotification.message = null;\r\n }\r\n\r\n SmeWebTelemetry.traceClientNotification(clientNotification);\r\n\r\n let notification = this.find(clientNotification.id);\r\n if (notification) {\r\n if (notification.updateFromClient(clientNotification)) {\r\n this.addEvent(NotificationChangeEvent.Change, notification);\r\n }\r\n\r\n return empty();\r\n }\r\n\r\n notification = Notification.createFromClient(clientNotification, this.iFrameService);\r\n this.collection[clientNotification.id] = notification;\r\n this.addEvent(NotificationChangeEvent.Add, notification);\r\n return empty();\r\n }\r\n\r\n /**\r\n * Find current work item by the typeId/sourceName/nodeName.\r\n *\r\n * @param workItemFind the query notification object.\r\n * @param RpcWorkItemFindResult the result of query.\r\n */\r\n public workItemFind(workItemFind: RpcWorkItemFind): RpcWorkItemFindResult {\r\n const keys = Object.keys(this.collection);\r\n const results: WorkItemResult[] = keys\r\n .map(key => <any>{ key: key, notification: this.collection[key] })\r\n .filter(data => data.notification.moduleName === workItemFind.moduleName\r\n && data.notification.nodeName === workItemFind.nodeName\r\n && data.notification.typeId === workItemFind.typeId)\r\n .map(data => <WorkItemResult>{\r\n id: data.key,\r\n state: data.notification.state,\r\n percent: data.notification.percent,\r\n error: data.notification.error,\r\n object: data.notification.object\r\n });\r\n\r\n const notificationResult: RpcWorkItemFindResult = {\r\n results: results,\r\n typeId: workItemFind.typeId,\r\n moduleName: workItemFind.moduleName,\r\n nodeName: workItemFind.nodeName\r\n };\r\n return notificationResult;\r\n }\r\n\r\n /**\r\n * Add an event to report the change of notification data or collection.\r\n *\r\n * @param changeEvent the changed event.\r\n * @param notification the notification object. (optional)\r\n */\r\n private addEvent(changeEvent: NotificationChangeEvent, notification?: Notification): void {\r\n // need to copy otherwise every change to original notification will be shown on UI without event\r\n const notificationCopy = {};\r\n if (notification) {\r\n MsftSme.shallowCopyFromObject(notificationCopy, notification);\r\n }\r\n\r\n this.changedEventSubject.next(<NotificationEvent>{ notification: notificationCopy, changeEvent: changeEvent });\r\n // no localization.\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Verbose,\r\n message: notification ?\r\n 'addEvent: {0}/{1}\\n{2}\\n{3}\\n{4}'.format(\r\n NotificationChangeEvent[changeEvent],\r\n NotificationState[notification.state],\r\n notification.title,\r\n notification.message,\r\n notification.link)\r\n : 'addEvent: {0}'.format(NotificationChangeEvent[changeEvent])\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -2,7 +2,6 @@ import { RpcNotification } from '../rpc/notification/rpc-notification-model';
|
|
|
2
2
|
import { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';
|
|
3
3
|
import { NotificationLinkType } from './notification-link-type';
|
|
4
4
|
import { IFrameService } from './notification-manager';
|
|
5
|
-
import { NotificationMessage } from './notification-message';
|
|
6
5
|
import { NotificationState } from './notification-state';
|
|
7
6
|
import { PowerShellWorkItemMessage } from './powershell-notification';
|
|
8
7
|
import { SocketMessage } from './socket-signalr';
|
|
@@ -158,7 +157,7 @@ export declare class Notification {
|
|
|
158
157
|
/**
|
|
159
158
|
* Create notification from instant request.
|
|
160
159
|
*
|
|
161
|
-
* @param client the RPC
|
|
160
|
+
* @param client the RPC notication request.
|
|
162
161
|
* @return notification the notification object.
|
|
163
162
|
*/
|
|
164
163
|
static createFromClient(client: RpcNotification, iFrameService: IFrameService): Notification;
|
|
@@ -183,14 +182,6 @@ export declare class Notification {
|
|
|
183
182
|
* @return boolean the changed status.
|
|
184
183
|
*/
|
|
185
184
|
updateFromMessage(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
186
|
-
/**
|
|
187
|
-
* Update the notification by socket message from the gateway.
|
|
188
|
-
*
|
|
189
|
-
* @param state the state of notification.
|
|
190
|
-
* @param item the socket message.
|
|
191
|
-
* @return boolean the changed status.
|
|
192
|
-
*/
|
|
193
|
-
updateFromNotificationMessage(state: NotificationState, item: NotificationMessage): boolean;
|
|
194
185
|
/**
|
|
195
186
|
* Update the notification by instant notification message from the client.
|
|
196
187
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Globalization } from '../data/globalization';
|
|
2
|
+
import { LogLevel } from '../diagnostics/log-level';
|
|
2
3
|
import { Logging } from '../diagnostics/logging';
|
|
3
4
|
import { NotificationLinkType } from './notification-link-type';
|
|
4
5
|
import { NotificationState } from './notification-state';
|
|
@@ -79,7 +80,10 @@ export class Notification {
|
|
|
79
80
|
notification.isFromRecover = true;
|
|
80
81
|
if (recoveredWorkItem.failed) {
|
|
81
82
|
notification.state = NotificationState.Error;
|
|
82
|
-
notification.object = {
|
|
83
|
+
notification.object = {
|
|
84
|
+
errorType: 'WorkItemRecover',
|
|
85
|
+
message: recoveredWorkItem.errorMessage
|
|
86
|
+
};
|
|
83
87
|
}
|
|
84
88
|
else {
|
|
85
89
|
notification.state = NotificationState.InProgress;
|
|
@@ -91,7 +95,7 @@ export class Notification {
|
|
|
91
95
|
/**
|
|
92
96
|
* Create notification from instant request.
|
|
93
97
|
*
|
|
94
|
-
* @param client the RPC
|
|
98
|
+
* @param client the RPC notication request.
|
|
95
99
|
* @return notification the notification object.
|
|
96
100
|
*/
|
|
97
101
|
static createFromClient(client, iFrameService) {
|
|
@@ -133,7 +137,11 @@ export class Notification {
|
|
|
133
137
|
let changed = false;
|
|
134
138
|
const now = Date.now();
|
|
135
139
|
if (PowerShellNotification.hasError(item)) {
|
|
136
|
-
Logging.
|
|
140
|
+
Logging.log({
|
|
141
|
+
source: 'Notification',
|
|
142
|
+
level: LogLevel.Debug,
|
|
143
|
+
message: '{0}/Error/{1}'.format(this.id, JSON.stringify(item.message.errors))
|
|
144
|
+
});
|
|
137
145
|
if (this.updateState(NotificationState.Error)) {
|
|
138
146
|
this.changedTimestampValue = now;
|
|
139
147
|
this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);
|
|
@@ -144,7 +152,11 @@ export class Notification {
|
|
|
144
152
|
return !this.isDisabled;
|
|
145
153
|
}
|
|
146
154
|
if (PowerShellNotification.hasException(item)) {
|
|
147
|
-
Logging.
|
|
155
|
+
Logging.log({
|
|
156
|
+
source: 'Notification',
|
|
157
|
+
level: LogLevel.Debug,
|
|
158
|
+
message: '{0}/Exception/{1}'.format(this.id, item.message.exception)
|
|
159
|
+
});
|
|
148
160
|
if (this.updateState(NotificationState.Error)) {
|
|
149
161
|
this.changedTimestampValue = now;
|
|
150
162
|
this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);
|
|
@@ -155,14 +167,18 @@ export class Notification {
|
|
|
155
167
|
return !this.isDisabled;
|
|
156
168
|
}
|
|
157
169
|
if (PowerShellNotification.hasProgress(item)) {
|
|
158
|
-
Logging.
|
|
170
|
+
Logging.log({
|
|
171
|
+
source: 'Notification',
|
|
172
|
+
level: LogLevel.Debug,
|
|
173
|
+
message: '{0}/Progress/{1}'.format(this.id, JSON.stringify(item.message.progress))
|
|
174
|
+
});
|
|
159
175
|
if (this.updateState(NotificationState.InProgress)) {
|
|
160
176
|
this.changedTimestampValue = now;
|
|
161
177
|
this.changedTimestamp = this.getGlobalizedTimestamp(now);
|
|
162
178
|
}
|
|
163
179
|
this.object = item.message.progress && MsftSme.last(item.message.progress);
|
|
164
|
-
if (this.object && this.object.hasOwnProperty('
|
|
165
|
-
this.progressPercent = this.object && this.object.
|
|
180
|
+
if (this.object && this.object.hasOwnProperty('percent')) {
|
|
181
|
+
this.progressPercent = this.object && this.object.percent;
|
|
166
182
|
}
|
|
167
183
|
if ((this.progressPercent == null || this.progressPercent < 0)
|
|
168
184
|
&& this.workItem.progressMessage && this.workItem.progressMessage.indexOf('{{percent}}') >= 0) {
|
|
@@ -171,12 +187,20 @@ export class Notification {
|
|
|
171
187
|
changed = true;
|
|
172
188
|
}
|
|
173
189
|
if (PowerShellNotification.hasData(item)) {
|
|
174
|
-
Logging.
|
|
190
|
+
Logging.log({
|
|
191
|
+
source: 'Notification',
|
|
192
|
+
level: LogLevel.Debug,
|
|
193
|
+
message: '{0}/Data/{1}'.format(this.id, JSON.stringify(item.message.results))
|
|
194
|
+
});
|
|
175
195
|
this.object = item.message.results && MsftSme.last(item.message.results);
|
|
176
196
|
changed = true;
|
|
177
197
|
}
|
|
178
198
|
if (PowerShellNotification.hasCompleted(item)) {
|
|
179
|
-
Logging.
|
|
199
|
+
Logging.log({
|
|
200
|
+
source: 'Notification',
|
|
201
|
+
level: LogLevel.Debug,
|
|
202
|
+
message: '{0}/Completed'.format(this.id)
|
|
203
|
+
});
|
|
180
204
|
if (this.updateState(NotificationState.Success)) {
|
|
181
205
|
this.changedTimestampValue = now;
|
|
182
206
|
this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);
|
|
@@ -186,27 +210,6 @@ export class Notification {
|
|
|
186
210
|
this.updateMessageAndLinkAndTitle(this.workItem);
|
|
187
211
|
return !this.isDisabled && changed;
|
|
188
212
|
}
|
|
189
|
-
/**
|
|
190
|
-
* Update the notification by socket message from the gateway.
|
|
191
|
-
*
|
|
192
|
-
* @param state the state of notification.
|
|
193
|
-
* @param item the socket message.
|
|
194
|
-
* @return boolean the changed status.
|
|
195
|
-
*/
|
|
196
|
-
updateFromNotificationMessage(state, item) {
|
|
197
|
-
const now = Date.now();
|
|
198
|
-
this.title = item.title;
|
|
199
|
-
this.message = item.message;
|
|
200
|
-
this.state = state;
|
|
201
|
-
this.changedTimestampValue = now;
|
|
202
|
-
if (state === NotificationState.InProgress) {
|
|
203
|
-
this.changedTimestamp = this.getGlobalizedTimestamp(now);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);
|
|
207
|
-
}
|
|
208
|
-
return true;
|
|
209
|
-
}
|
|
210
213
|
/**
|
|
211
214
|
* Update the notification by instant notification message from the client.
|
|
212
215
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAKjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAA6B,MAAM,2B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,IAAI,CAAC,MAAM,EAAE;oBACb,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAClC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;oBACzB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;wBACxB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;4BACb,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;yBACxB;6BAAM;4BACH,MAAM,GAAG,IAAI,CAAC;4BACd,MAAM;yBACT;qBACJ;oBAED,IAAI,MAAM,EAAE;wBACR,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;qBAClE;iBACJ;aACJ;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","file":"notification.js","sourcesContent":["import { Globalization } from '../data/globalization';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';\r\nimport { NotificationLinkType } from './notification-link-type';\r\nimport { IFrameService } from './notification-manager';\r\nimport { NotificationMessage } from './notification-message';\r\nimport { NotificationState } from './notification-state';\r\nimport { PowerShellNotification, PowerShellWorkItemMessage } from './powershell-notification';\r\nimport { SocketMessage } from './socket-signalr';\r\nimport { RecoveredWorkItem } from './work-item-request';\r\n\r\n/**\r\n * Notification changed event type.\r\n */\r\nexport enum NotificationChangeEvent {\r\n Initialized,\r\n InitializationFailed,\r\n Add,\r\n Remove,\r\n Change\r\n}\r\n\r\n/**\r\n * Notification changed event packet.\r\n */\r\nexport interface NotificationEvent {\r\n changeEvent: NotificationChangeEvent;\r\n notification?: Notification;\r\n}\r\n\r\n/**\r\n * Internal notification object converted from ClientNotification object.\r\n * Contains data to track notifications.\r\n */\r\nexport class Notification {\r\n private strings: Strings = MsftSme.getStrings<Strings>();\r\n\r\n /**\r\n * Work item passed from RPC or client on shell.\r\n */\r\n private workItem: RpcWorkItem;\r\n\r\n /**\r\n * The type ID of work item.\r\n */\r\n public typeId: string;\r\n\r\n /**\r\n * The node name.\r\n */\r\n public nodeName: string;\r\n\r\n /**\r\n * The module name.\r\n */\r\n public moduleName: string;\r\n\r\n /**\r\n * The entry point name within the module\r\n */\r\n public entryPointName: string;\r\n\r\n /**\r\n * The module display name.\r\n */\r\n public moduleDisplayName: string;\r\n\r\n /**\r\n * Object included last response.\r\n */\r\n public object: any;\r\n\r\n /**\r\n * The state of notification.\r\n */\r\n public state: NotificationState;\r\n\r\n /**\r\n * The title of work item to display user. (localized)\r\n */\r\n public title: string;\r\n\r\n /**\r\n * The description of work item to display user. (localized)\r\n */\r\n public description: string;\r\n\r\n /**\r\n * The message. (localized)\r\n */\r\n public message: string;\r\n\r\n /**\r\n * Possible solution message to address error. (localized)\r\n */\r\n public solutionMessage: string;\r\n\r\n /**\r\n * True if the notification was created from recover, updates from messages should be taken\r\n */\r\n public isFromRecover = false;\r\n\r\n /**\r\n * True if the notification is disabled and should not be shown to the user\r\n */\r\n public isDisabled = false;\r\n\r\n /**\r\n * The start timestamp as a formatted globalized string\r\n */\r\n public startTimestamp: string;\r\n\r\n /**\r\n * The last changed timestamp as a formatted globalized string\r\n */\r\n public changedTimestamp: string;\r\n\r\n /**\r\n * The last changed timestamp as a number\r\n */\r\n public changedTimestampValue: number;\r\n\r\n /**\r\n * The end timestamp as a formatted globalized string\r\n */\r\n public endTimestamp: string;\r\n\r\n /**\r\n * The progress percent.\r\n */\r\n public progressPercent: number;\r\n\r\n /**\r\n * The success link to navigate to the object view. (optional)\r\n * At default, it brings to the home page of the module.\r\n */\r\n public link: string;\r\n\r\n /**\r\n * the notification link type of the link\r\n */\r\n public linkType: NotificationLinkType;\r\n\r\n /**\r\n * True if we should show the link in the notification's alert\r\n * We will show the link if there is a custom link or it is a long running request\r\n */\r\n public showLinkInAlert = false;\r\n\r\n /**\r\n * Marked it's no longer display to include list of notifications.\r\n */\r\n public dismissed = false;\r\n\r\n /**\r\n * The parent URI window.location.pathname.\r\n */\r\n public locationPathname: string;\r\n\r\n /**\r\n * The parent URI window.location.search\r\n */\r\n public locationSearch: string;\r\n\r\n /**\r\n *\r\n * Tracks if the notification has been read.\r\n */\r\n public isUnread = true;\r\n\r\n /**\r\n * Create notification from WorkItem.\r\n *\r\n * @param id the notification ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public static createFromWorkItem(\r\n id: string, workItem: RpcWorkItem, state: NotificationState, iFrameService: IFrameService, object?: any): Notification {\r\n const notification = new Notification(id);\r\n notification.workItem = workItem;\r\n\r\n notification.state = state;\r\n notification.object = object;\r\n notification.initializeFromWorkItem(workItem, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Create notification from recovered work item.\r\n *\r\n * @param recoveredWorkItem the recovered work item.\r\n * @return notification the notification object.\r\n */\r\n public static createFromRecover(recoveredWorkItem: RecoveredWorkItem, iFrameService: IFrameService): Notification {\r\n const notification = new Notification(recoveredWorkItem.id);\r\n notification.workItem = recoveredWorkItem.metadata;\r\n notification.isFromRecover = true;\r\n\r\n if (recoveredWorkItem.failed) {\r\n notification.state = NotificationState.Error;\r\n notification.object = { errorType: 'WorkItemRecover', message: recoveredWorkItem.errorMessage };\r\n } else {\r\n notification.state = NotificationState.InProgress;\r\n notification.object = {};\r\n }\r\n\r\n notification.initializeFromWorkItem(recoveredWorkItem.metadata, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Create notification from instant request.\r\n *\r\n * @param client the RPC notification request.\r\n * @return notification the notification object.\r\n */\r\n public static createFromClient(client: RpcNotification, iFrameService: IFrameService): Notification {\r\n const notification = new Notification(client.id);\r\n notification.locationPathname = window.location.pathname;\r\n notification.locationSearch = window.location.search;\r\n notification.initializeFromInstant(client, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Initializes a new instance of the Notification class.\r\n *\r\n * @param id the notification ID.\r\n */\r\n constructor(public id: string) { }\r\n\r\n /**\r\n * Update a notification by work item from RPC.\r\n * @param id the notification id.\r\n * @param workItem the work item.\r\n * @param state the state of the notification.\r\n * @param object the object from query result.\r\n */\r\n public updateFromWorkItem(id: string, workItem: RpcWorkItem, state: NotificationState, object?: any) {\r\n let changed = false;\r\n\r\n if (this.updateState(state)) {\r\n changed = true;\r\n const now = Date.now();\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n if (this.object !== object) {\r\n changed = true;\r\n this.object = object;\r\n }\r\n\r\n this.updateMessageAndLinkAndTitle(workItem);\r\n return !this.isDisabled && changed;\r\n }\r\n\r\n /**\r\n * Update the notification by socket message from the gateway.\r\n *\r\n * @param item the socket message.\r\n * @return boolean the changed status.\r\n */\r\n public updateFromMessage(item: SocketMessage<PowerShellWorkItemMessage>): boolean {\r\n let changed = false;\r\n const now = Date.now();\r\n if (PowerShellNotification.hasError(item)) {\r\n Logging.logDebug('Notification', '{0}/Error/{1}'.format(this.id, JSON.stringify(item.message.errors)));\r\n if (this.updateState(NotificationState.Error)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = item.message.errors && MsftSme.first(item.message.errors);\r\n changed = true;\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled;\r\n }\r\n\r\n if (PowerShellNotification.hasException(item)) {\r\n Logging.logDebug('Notification', '{0}/Exception/{1}'.format(this.id, item.message.exception));\r\n if (this.updateState(NotificationState.Error)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = { message: item.message.exception };\r\n changed = true;\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled;\r\n }\r\n\r\n if (PowerShellNotification.hasProgress(item)) {\r\n Logging.logDebug('Notification', '{0}/Progress/{1}'.format(this.id, JSON.stringify(item.message.progress)));\r\n if (this.updateState(NotificationState.InProgress)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = item.message.progress && MsftSme.last(item.message.progress);\r\n if (this.object && this.object.hasOwnProperty('percentComplete')) {\r\n this.progressPercent = this.object && this.object.percentComplete;\r\n }\r\n\r\n if ((this.progressPercent == null || this.progressPercent < 0)\r\n && this.workItem.progressMessage && this.workItem.progressMessage.indexOf('{{percent}}') >= 0) {\r\n return false;\r\n }\r\n\r\n changed = true;\r\n }\r\n\r\n if (PowerShellNotification.hasData(item)) {\r\n Logging.logDebug('Notification', '{0}/Data/{1}'.format(this.id, JSON.stringify(item.message.results)));\r\n this.object = item.message.results && MsftSme.last(item.message.results);\r\n changed = true;\r\n }\r\n\r\n if (PowerShellNotification.hasCompleted(item)) {\r\n Logging.logDebug('Notification', '{0}/Completed'.format(this.id));\r\n if (this.updateState(NotificationState.Success)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n changed = true;\r\n }\r\n\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled && changed;\r\n }\r\n\r\n /**\r\n * Update the notification by socket message from the gateway.\r\n *\r\n * @param state the state of notification.\r\n * @param item the socket message.\r\n * @return boolean the changed status.\r\n */\r\n public updateFromNotificationMessage(state: NotificationState, item: NotificationMessage): boolean {\r\n const now = Date.now();\r\n this.title = item.title;\r\n this.message = item.message;\r\n this.state = state;\r\n this.changedTimestampValue = now;\r\n if (state === NotificationState.InProgress) {\r\n this.changedTimestamp = this.getGlobalizedTimestamp(now);\r\n } else {\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Update the notification by instant notification message from the client.\r\n *\r\n * @param client the instant notification object.\r\n * @param boolean the changed status.\r\n */\r\n public updateFromClient(client: RpcNotification): boolean {\r\n let changed = false;\r\n const title = client.title;\r\n if (this.title !== title) {\r\n changed = true;\r\n this.title = title;\r\n }\r\n\r\n if (this.description !== client.description) {\r\n changed = true;\r\n this.description = client.description;\r\n }\r\n\r\n if (this.updateState(client.state)) {\r\n const now = Date.now();\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.getGlobalizedTimestamp(now);\r\n changed = true;\r\n if (this.state !== NotificationState.InProgress) {\r\n this.endTimestamp = this.changedTimestamp;\r\n }\r\n }\r\n\r\n const link = this.formatLink(client.link, client.linkType);\r\n if (this.link !== link) {\r\n changed = true;\r\n this.link = link;\r\n this.linkType = client.linkType;\r\n }\r\n\r\n if (this.message !== client.message) {\r\n changed = true;\r\n this.message = client.message;\r\n }\r\n\r\n if (this.solutionMessage !== client.solutionMessage) {\r\n changed = true;\r\n this.solutionMessage = client.solutionMessage;\r\n }\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Gets the module display name.\r\n */\r\n private getModuleDisplayName(iFrameService: IFrameService, sourceName: string, sourceSubName: string): string {\r\n const activeIFrame = iFrameService ? iFrameService.getActiveToolIFrameData() : null;\r\n if (activeIFrame && activeIFrame.entryPoint) {\r\n const entryPoint = activeIFrame.entryPoint;\r\n this.entryPointName = entryPoint.name;\r\n\r\n if (entryPoint.parentModule) {\r\n this.moduleName = entryPoint.parentModule.name;\r\n }\r\n } else {\r\n // fallback see if we can get any info from RPC\r\n this.moduleName = sourceName;\r\n if (sourceSubName) {\r\n this.entryPointName = MsftSme.first(sourceSubName.split('#'));\r\n }\r\n }\r\n\r\n const environment = MsftSme.self().Environment;\r\n\r\n // if moduleName === environment.name then the source is Shell. Return null to use generic module name\r\n if (this.moduleName && this.moduleName !== environment.name) {\r\n const module: EnvironmentModule = MsftSme.find(\r\n <EnvironmentModule[]>environment.modules,\r\n value => value.name === this.moduleName);\r\n if (module) {\r\n if (this.entryPointName) {\r\n const entryPoint = MsftSme.find(module.entryPoints, ep => ep.name === this.entryPointName);\r\n if (entryPoint) {\r\n return entryPoint.displayName;\r\n }\r\n }\r\n\r\n return module.displayName;\r\n }\r\n\r\n return this.moduleName;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Update the state.\r\n *\r\n * @param state the new state.\r\n * @return boolean the changed state.\r\n */\r\n private updateState(state: NotificationState): boolean {\r\n if (this.state !== state) {\r\n this.state = state;\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private initializeFromWorkItem(item: RpcWorkItem, iFrameService: IFrameService): void {\r\n this.nodeName = item.nodeName;\r\n this.moduleDisplayName = this.getModuleDisplayName(iFrameService, item.sourceName, item.sourceSubName);\r\n this.startTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n this.changedTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n this.changedTimestampValue = item.timestamp;\r\n this.description = item.description;\r\n this.typeId = item.typeId;\r\n this.updateMessageAndLinkAndTitle(item);\r\n }\r\n\r\n private updateMessageAndLinkAndTitle(item: RpcWorkItem): void {\r\n let template: string;\r\n this.isDisabled = !this.isFromRecover && item.disableAllNotifications;\r\n switch (this.state) {\r\n case NotificationState.Submitted:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.submittedMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Started:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.startedMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Error:\r\n this.title = item.errorTitle || item.title;\r\n this.isDisabled = !this.isFromRecover && item.disableErrorNotification;\r\n this.endTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n template = item.errorMessage;\r\n this.link = this.formatLink(item.errorLink, item.errorLinkType);\r\n this.linkType = item.errorLinkType;\r\n this.showLinkInAlert = true;\r\n this.moduleDisplayName = item.errorLinkText || this.moduleDisplayName;\r\n break;\r\n case NotificationState.InProgress:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.progressMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Success:\r\n this.title = item.successTitle || item.title;\r\n this.endTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n template = item.successMessage;\r\n this.link = this.formatLink(item.successLink, item.successLinkType);\r\n this.linkType = item.successLinkType;\r\n this.moduleDisplayName = item.successLinkText || this.moduleDisplayName;\r\n this.showLinkInAlert = true;\r\n break;\r\n default:\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationUnsupportedState.message;\r\n throw new Error(message);\r\n }\r\n\r\n this.message = this.formatMessage(template);\r\n }\r\n\r\n private initializeFromInstant(client: RpcNotification, iFrameService: IFrameService): void {\r\n this.nodeName = client.nodeName;\r\n this.moduleDisplayName = client.linkText ?\r\n client.linkText\r\n : this.getModuleDisplayName(iFrameService, client.sourceName, client.sourceSubName);\r\n this.startTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n this.changedTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n this.changedTimestampValue = client.timestamp;\r\n this.title = client.title;\r\n this.description = client.description;\r\n this.state = client.state;\r\n this.link = this.formatLink(client.link, client.linkType);\r\n this.linkType = client.linkType;\r\n this.message = client.message;\r\n this.solutionMessage = client.solutionMessage;\r\n if (this.state !== NotificationState.Started && this.state !== NotificationState.InProgress) {\r\n this.endTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n }\r\n }\r\n\r\n private getGlobalizedTimestamp(timestamp: number): string {\r\n return Globalization.timeOnly(new Date(timestamp));\r\n }\r\n\r\n private formatLink(link: string, linkType?: NotificationLinkType): string {\r\n // tslint:disable-next-line:max-line-length\r\n // href example:\r\n // tslint:disable-next-line:max-line-length\r\n // \"http://localhost:4400/apps/msft.sme.server-manager!servers/tools/msft.sme.module-seed!main?connection=sme-full1.redmond.corp.microsoft.com\"\r\n\r\n if (linkType === NotificationLinkType.Absolute) {\r\n return link;\r\n }\r\n\r\n // null linkType behaves like NotificationLinkType.RelativeToTool\r\n const pathname = linkType === NotificationLinkType.RelativeToRoot ?\r\n '/'\r\n : this.locationPathname || this.workItem && this.workItem.locationPathname;\r\n\r\n if (link && pathname) {\r\n this.showLinkInAlert = true;\r\n return MsftSme.trimEnd(pathname, '/') + '/' + MsftSme.trimStart(link, '/');\r\n }\r\n\r\n this.showLinkInAlert = false;\r\n return pathname;\r\n }\r\n\r\n private formatMessage(template: string): string {\r\n const parameters = this.findParameters(template);\r\n const message = this.replaceParameters(template, parameters);\r\n return message;\r\n }\r\n\r\n private findParameters(template: string): string[] {\r\n const results: string[] = [];\r\n if (!template) {\r\n return results;\r\n }\r\n\r\n const segments = template.split('{{');\r\n for (const seg of segments) {\r\n const index = seg.indexOf('}}');\r\n if (index > 0) {\r\n results.push(seg.substr(0, index));\r\n }\r\n }\r\n\r\n return results;\r\n }\r\n\r\n private replaceParameters(message: string, parameters: string[]): string {\r\n for (const param of parameters) {\r\n if (param === 'percent') {\r\n if (typeof this.progressPercent === 'number') {\r\n message = message.replaceAll('{{percent}}', '' + this.progressPercent);\r\n }\r\n } else if (param === 'objectName') {\r\n if (this.workItem && this.workItem.objectName) {\r\n message = message.replaceAll('{{objectName}}', this.workItem.objectName);\r\n }\r\n } else {\r\n if (this.object) {\r\n const segments = param.split('.');\r\n let target = this.object;\r\n for (const seg of segments) {\r\n if (target[seg]) {\r\n target = target[seg];\r\n } else {\r\n target = null;\r\n break;\r\n }\r\n }\r\n\r\n if (target) {\r\n message = message.replaceAll('{{' + param + '}}', '' + target);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return message;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/notification/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MA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AAI,CAAC,MAAM,EAAE;oBACb,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;oBAClC,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;oBACzB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;wBACxB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;4BACb,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;yBACxB;6BAAM;4BACH,MAAM,GAAG,IAAI,CAAC;4BACd,MAAM;yBACT;qBACJ;oBAED,IAAI,MAAM,EAAE;wBACR,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,KAAK,GAAG,IAAI,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;qBAClE;iBACJ;aACJ;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","file":"notification.js","sourcesContent":["import { Globalization } from '../data/globalization';\r\nimport { LogLevel } from '../diagnostics/log-level';\r\nimport { Logging } from '../diagnostics/logging';\r\nimport { Strings } from '../generated/strings';\r\nimport { EnvironmentModule } from '../manifest/environment-modules';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { RpcWorkItem } from '../rpc/work-item/rpc-work-item-model';\r\nimport { NotificationLinkType } from './notification-link-type';\r\nimport { IFrameService } from './notification-manager';\r\nimport { NotificationState } from './notification-state';\r\nimport { PowerShellNotification, PowerShellWorkItemMessage } from './powershell-notification';\r\nimport { SocketMessage } from './socket-signalr';\r\nimport { RecoveredWorkItem } from './work-item-request';\r\n\r\n/**\r\n * Notification changed event type.\r\n */\r\nexport enum NotificationChangeEvent {\r\n Initialized,\r\n InitializationFailed,\r\n Add,\r\n Remove,\r\n Change\r\n}\r\n\r\n/**\r\n * Notification changed event packet.\r\n */\r\nexport interface NotificationEvent {\r\n changeEvent: NotificationChangeEvent;\r\n notification?: Notification;\r\n}\r\n\r\n/**\r\n * Internal notification object converted from ClientNotification object.\r\n * Contains data to track notifications.\r\n */\r\nexport class Notification {\r\n private strings: Strings = MsftSme.getStrings<Strings>();\r\n\r\n /**\r\n * Work item passed from RPC or client on shell.\r\n */\r\n private workItem: RpcWorkItem;\r\n\r\n /**\r\n * The type ID of work item.\r\n */\r\n public typeId: string;\r\n\r\n /**\r\n * The node name.\r\n */\r\n public nodeName: string;\r\n\r\n /**\r\n * The module name.\r\n */\r\n public moduleName: string;\r\n\r\n /**\r\n * The entry point name within the module\r\n */\r\n public entryPointName: string;\r\n\r\n /**\r\n * The module display name.\r\n */\r\n public moduleDisplayName: string;\r\n\r\n /**\r\n * Object included last response.\r\n */\r\n public object: any;\r\n\r\n /**\r\n * The state of notification.\r\n */\r\n public state: NotificationState;\r\n\r\n /**\r\n * The title of work item to display user. (localized)\r\n */\r\n public title: string;\r\n\r\n /**\r\n * The description of work item to display user. (localized)\r\n */\r\n public description: string;\r\n\r\n /**\r\n * The message. (localized)\r\n */\r\n public message: string;\r\n\r\n /**\r\n * Possible solution message to address error. (localized)\r\n */\r\n public solutionMessage: string;\r\n\r\n /**\r\n * True if the notification was created from recover, updates from messages should be taken\r\n */\r\n public isFromRecover = false;\r\n\r\n /**\r\n * True if the notification is disabled and should not be shown to the user\r\n */\r\n public isDisabled = false;\r\n\r\n /**\r\n * The start timestamp as a formatted globalized string\r\n */\r\n public startTimestamp: string;\r\n\r\n /**\r\n * The last changed timestamp as a formatted globalized string\r\n */\r\n public changedTimestamp: string;\r\n\r\n /**\r\n * The last changed timestamp as a number\r\n */\r\n public changedTimestampValue: number;\r\n\r\n /**\r\n * The end timestamp as a formatted globalized string\r\n */\r\n public endTimestamp: string;\r\n\r\n /**\r\n * The progress percent.\r\n */\r\n public progressPercent: number;\r\n\r\n /**\r\n * The success link to navigate to the object view. (optional)\r\n * At default, it brings to the home page of the module.\r\n */\r\n public link: string;\r\n\r\n /**\r\n * the notification link type of the link\r\n */\r\n public linkType: NotificationLinkType;\r\n\r\n /**\r\n * True if we should show the link in the notification's alert\r\n * We will show the link if there is a custom link or it is a long running request\r\n */\r\n public showLinkInAlert = false;\r\n\r\n /**\r\n * Marked it's no longer display to include list of notifications.\r\n */\r\n public dismissed = false;\r\n\r\n /**\r\n * The parent URI window.location.pathname.\r\n */\r\n public locationPathname: string;\r\n\r\n /**\r\n * The parent URI window.location.search\r\n */\r\n public locationSearch: string;\r\n\r\n /**\r\n *\r\n * Tracks if the notification has been read.\r\n */\r\n public isUnread = true;\r\n\r\n /**\r\n * Create notification from WorkItem.\r\n *\r\n * @param id the notification ID.\r\n * @param workItem the RPC work item.\r\n * @param state the initial state.\r\n * @param object the object from query result.\r\n * @return notification the notification object.\r\n */\r\n public static createFromWorkItem(\r\n id: string, workItem: RpcWorkItem, state: NotificationState, iFrameService: IFrameService, object?: any): Notification {\r\n const notification = new Notification(id);\r\n notification.workItem = workItem;\r\n\r\n notification.state = state;\r\n notification.object = object;\r\n notification.initializeFromWorkItem(workItem, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Create notification from recovered work item.\r\n *\r\n * @param recoveredWorkItem the recovered work item.\r\n * @return notification the notification object.\r\n */\r\n public static createFromRecover(recoveredWorkItem: RecoveredWorkItem, iFrameService: IFrameService): Notification {\r\n const notification = new Notification(recoveredWorkItem.id);\r\n notification.workItem = recoveredWorkItem.metadata;\r\n notification.isFromRecover = true;\r\n\r\n if (recoveredWorkItem.failed) {\r\n notification.state = NotificationState.Error;\r\n notification.object = {\r\n errorType: 'WorkItemRecover',\r\n message: recoveredWorkItem.errorMessage\r\n };\r\n } else {\r\n notification.state = NotificationState.InProgress;\r\n notification.object = {};\r\n }\r\n\r\n notification.initializeFromWorkItem(recoveredWorkItem.metadata, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Create notification from instant request.\r\n *\r\n * @param client the RPC notication request.\r\n * @return notification the notification object.\r\n */\r\n public static createFromClient(client: RpcNotification, iFrameService: IFrameService): Notification {\r\n const notification = new Notification(client.id);\r\n notification.locationPathname = window.location.pathname;\r\n notification.locationSearch = window.location.search;\r\n notification.initializeFromInstant(client, iFrameService);\r\n return notification;\r\n }\r\n\r\n /**\r\n * Initializes a new instance of the Notification class.\r\n *\r\n * @param id the notification ID.\r\n */\r\n constructor(public id: string) { }\r\n\r\n /**\r\n * Update a notification by work item from RPC.\r\n * @param id the notification id.\r\n * @param workItem the work item.\r\n * @param state the state of the notification.\r\n * @param object the object from query result.\r\n */\r\n public updateFromWorkItem(id: string, workItem: RpcWorkItem, state: NotificationState, object?: any) {\r\n let changed = false;\r\n\r\n if (this.updateState(state)) {\r\n changed = true;\r\n const now = Date.now();\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n if (this.object !== object) {\r\n changed = true;\r\n this.object = object;\r\n }\r\n\r\n this.updateMessageAndLinkAndTitle(workItem);\r\n return !this.isDisabled && changed;\r\n }\r\n\r\n /**\r\n * Update the notification by socket message from the gateway.\r\n *\r\n * @param item the socket message.\r\n * @return boolean the changed status.\r\n */\r\n public updateFromMessage(item: SocketMessage<PowerShellWorkItemMessage>): boolean {\r\n let changed = false;\r\n const now = Date.now();\r\n if (PowerShellNotification.hasError(item)) {\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Debug,\r\n message: '{0}/Error/{1}'.format(this.id, JSON.stringify(item.message.errors))\r\n });\r\n if (this.updateState(NotificationState.Error)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = item.message.errors && MsftSme.first(item.message.errors);\r\n changed = true;\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled;\r\n }\r\n\r\n if (PowerShellNotification.hasException(item)) {\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Debug,\r\n message: '{0}/Exception/{1}'.format(this.id, item.message.exception)\r\n });\r\n if (this.updateState(NotificationState.Error)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = { message: item.message.exception };\r\n changed = true;\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled;\r\n }\r\n\r\n if (PowerShellNotification.hasProgress(item)) {\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Debug,\r\n message: '{0}/Progress/{1}'.format(this.id, JSON.stringify(item.message.progress))\r\n });\r\n if (this.updateState(NotificationState.InProgress)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n this.object = item.message.progress && MsftSme.last(item.message.progress);\r\n if (this.object && this.object.hasOwnProperty('percent')) {\r\n this.progressPercent = this.object && this.object.percent;\r\n }\r\n\r\n if ((this.progressPercent == null || this.progressPercent < 0)\r\n && this.workItem.progressMessage && this.workItem.progressMessage.indexOf('{{percent}}') >= 0) {\r\n return false;\r\n }\r\n\r\n changed = true;\r\n }\r\n\r\n if (PowerShellNotification.hasData(item)) {\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Debug,\r\n message: '{0}/Data/{1}'.format(this.id, JSON.stringify(item.message.results))\r\n });\r\n this.object = item.message.results && MsftSme.last(item.message.results);\r\n changed = true;\r\n }\r\n\r\n if (PowerShellNotification.hasCompleted(item)) {\r\n Logging.log({\r\n source: 'Notification',\r\n level: LogLevel.Debug,\r\n message: '{0}/Completed'.format(this.id)\r\n });\r\n if (this.updateState(NotificationState.Success)) {\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.endTimestamp = this.getGlobalizedTimestamp(now);\r\n }\r\n\r\n changed = true;\r\n }\r\n\r\n this.updateMessageAndLinkAndTitle(this.workItem);\r\n return !this.isDisabled && changed;\r\n }\r\n\r\n /**\r\n * Update the notification by instant notification message from the client.\r\n *\r\n * @param client the instant notification object.\r\n * @param boolean the changed status.\r\n */\r\n public updateFromClient(client: RpcNotification): boolean {\r\n let changed = false;\r\n const title = client.title;\r\n if (this.title !== title) {\r\n changed = true;\r\n this.title = title;\r\n }\r\n\r\n if (this.description !== client.description) {\r\n changed = true;\r\n this.description = client.description;\r\n }\r\n\r\n if (this.updateState(client.state)) {\r\n const now = Date.now();\r\n this.changedTimestampValue = now;\r\n this.changedTimestamp = this.getGlobalizedTimestamp(now);\r\n changed = true;\r\n if (this.state !== NotificationState.InProgress) {\r\n this.endTimestamp = this.changedTimestamp;\r\n }\r\n }\r\n\r\n const link = this.formatLink(client.link, client.linkType);\r\n if (this.link !== link) {\r\n changed = true;\r\n this.link = link;\r\n this.linkType = client.linkType;\r\n }\r\n\r\n if (this.message !== client.message) {\r\n changed = true;\r\n this.message = client.message;\r\n }\r\n\r\n if (this.solutionMessage !== client.solutionMessage) {\r\n changed = true;\r\n this.solutionMessage = client.solutionMessage;\r\n }\r\n\r\n return changed;\r\n }\r\n\r\n /**\r\n * Gets the module display name.\r\n */\r\n private getModuleDisplayName(iFrameService: IFrameService, sourceName: string, sourceSubName: string): string {\r\n const activeIFrame = iFrameService ? iFrameService.getActiveToolIFrameData() : null;\r\n if (activeIFrame && activeIFrame.entryPoint) {\r\n const entryPoint = activeIFrame.entryPoint;\r\n this.entryPointName = entryPoint.name;\r\n\r\n if (entryPoint.parentModule) {\r\n this.moduleName = entryPoint.parentModule.name;\r\n }\r\n } else {\r\n // fallback see if we can get any info from RPC\r\n this.moduleName = sourceName;\r\n if (sourceSubName) {\r\n this.entryPointName = MsftSme.first(sourceSubName.split('#'));\r\n }\r\n }\r\n\r\n const environment = MsftSme.self().Environment;\r\n\r\n // if moduleName === environment.name then the source is Shell. Return null to use generic module name\r\n if (this.moduleName && this.moduleName !== environment.name) {\r\n const module: EnvironmentModule = MsftSme.find(\r\n <EnvironmentModule[]>environment.modules,\r\n value => value.name === this.moduleName);\r\n if (module) {\r\n if (this.entryPointName) {\r\n const entryPoint = MsftSme.find(module.entryPoints, ep => ep.name === this.entryPointName);\r\n if (entryPoint) {\r\n return entryPoint.displayName;\r\n }\r\n }\r\n\r\n return module.displayName;\r\n }\r\n\r\n return this.moduleName;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Update the state.\r\n *\r\n * @param state the new state.\r\n * @return boolean the changed state.\r\n */\r\n private updateState(state: NotificationState): boolean {\r\n if (this.state !== state) {\r\n this.state = state;\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n private initializeFromWorkItem(item: RpcWorkItem, iFrameService: IFrameService): void {\r\n this.nodeName = item.nodeName;\r\n this.moduleDisplayName = this.getModuleDisplayName(iFrameService, item.sourceName, item.sourceSubName);\r\n this.startTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n this.changedTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n this.changedTimestampValue = item.timestamp;\r\n this.description = item.description;\r\n this.typeId = item.typeId;\r\n this.updateMessageAndLinkAndTitle(item);\r\n }\r\n\r\n private updateMessageAndLinkAndTitle(item: RpcWorkItem): void {\r\n let template: string;\r\n this.isDisabled = !this.isFromRecover && item.disableAllNotifications;\r\n switch (this.state) {\r\n case NotificationState.Submitted:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.submittedMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Started:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.startedMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Error:\r\n this.title = item.errorTitle || item.title;\r\n this.isDisabled = !this.isFromRecover && item.disableErrorNotification;\r\n this.endTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n template = item.errorMessage;\r\n this.link = this.formatLink(item.errorLink, item.errorLinkType);\r\n this.linkType = item.errorLinkType;\r\n this.showLinkInAlert = true;\r\n this.moduleDisplayName = item.errorLinkText || this.moduleDisplayName;\r\n break;\r\n case NotificationState.InProgress:\r\n this.title = item.inProgressTitle || item.title;\r\n template = item.progressMessage;\r\n this.link = this.formatLink(null);\r\n break;\r\n case NotificationState.Success:\r\n this.title = item.successTitle || item.title;\r\n this.endTimestamp = this.getGlobalizedTimestamp(item.timestamp);\r\n template = item.successMessage;\r\n this.link = this.formatLink(item.successLink, item.successLinkType);\r\n this.linkType = item.successLinkType;\r\n this.moduleDisplayName = item.successLinkText || this.moduleDisplayName;\r\n this.showLinkInAlert = true;\r\n break;\r\n default:\r\n const message = MsftSme.getStrings<Strings>().MsftSmeShell.Core.Error.NotificationUnsupportedState.message;\r\n throw new Error(message);\r\n }\r\n\r\n this.message = this.formatMessage(template);\r\n }\r\n\r\n private initializeFromInstant(client: RpcNotification, iFrameService: IFrameService): void {\r\n this.nodeName = client.nodeName;\r\n this.moduleDisplayName = client.linkText ?\r\n client.linkText\r\n : this.getModuleDisplayName(iFrameService, client.sourceName, client.sourceSubName);\r\n this.startTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n this.changedTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n this.changedTimestampValue = client.timestamp;\r\n this.title = client.title;\r\n this.description = client.description;\r\n this.state = client.state;\r\n this.link = this.formatLink(client.link, client.linkType);\r\n this.linkType = client.linkType;\r\n this.message = client.message;\r\n this.solutionMessage = client.solutionMessage;\r\n if (this.state !== NotificationState.Started && this.state !== NotificationState.InProgress) {\r\n this.endTimestamp = this.getGlobalizedTimestamp(client.timestamp);\r\n }\r\n }\r\n\r\n private getGlobalizedTimestamp(timestamp: number): string {\r\n return Globalization.timeOnly(new Date(timestamp));\r\n }\r\n\r\n private formatLink(link: string, linkType?: NotificationLinkType): string {\r\n // tslint:disable-next-line:max-line-length\r\n // href example:\r\n // tslint:disable-next-line:max-line-length\r\n // \"http://localhost:4400/apps/msft.sme.server-manager!servers/tools/msft.sme.module-seed!main?connection=sme-full1.redmond.corp.microsoft.com\"\r\n\r\n if (linkType === NotificationLinkType.Absolute) {\r\n return link;\r\n }\r\n\r\n // null linkType behaves like NotificationLinkType.RelativeToTool\r\n const pathname = linkType === NotificationLinkType.RelativeToRoot ?\r\n '/'\r\n : this.locationPathname || this.workItem && this.workItem.locationPathname;\r\n\r\n if (link && pathname) {\r\n this.showLinkInAlert = true;\r\n return MsftSme.trimEnd(pathname, '/') + '/' + MsftSme.trimStart(link, '/');\r\n }\r\n\r\n this.showLinkInAlert = false;\r\n return pathname;\r\n }\r\n\r\n private formatMessage(template: string): string {\r\n const parameters = this.findParameters(template);\r\n const message = this.replaceParameters(template, parameters);\r\n return message;\r\n }\r\n\r\n private findParameters(template: string): string[] {\r\n const results: string[] = [];\r\n if (!template) {\r\n return results;\r\n }\r\n\r\n const segments = template.split('{{');\r\n for (const seg of segments) {\r\n const index = seg.indexOf('}}');\r\n if (index > 0) {\r\n results.push(seg.substr(0, index));\r\n }\r\n }\r\n\r\n return results;\r\n }\r\n\r\n private replaceParameters(message: string, parameters: string[]): string {\r\n for (const param of parameters) {\r\n if (param === 'percent') {\r\n if (typeof this.progressPercent === 'number') {\r\n message = message.replaceAll('{{percent}}', '' + this.progressPercent);\r\n }\r\n } else if (param === 'objectName') {\r\n if (this.workItem && this.workItem.objectName) {\r\n message = message.replaceAll('{{objectName}}', this.workItem.objectName);\r\n }\r\n } else {\r\n if (this.object) {\r\n const segments = param.split('.');\r\n let target = this.object;\r\n for (const seg of segments) {\r\n if (target[seg]) {\r\n target = target[seg];\r\n } else {\r\n target = null;\r\n break;\r\n }\r\n }\r\n\r\n if (target) {\r\n message = message.replaceAll('{{' + param + '}}', '' + target);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return message;\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="jquery" />
|
|
2
|
+
import { Observable, Subject } from 'rxjs';
|
|
2
3
|
import { NodeConnection, NodeRequestOptions } from '../data/node-connection';
|
|
3
4
|
import { PowerShellCommand } from '../data/powershell';
|
|
4
|
-
import { NotificationMessage } from './notification-message';
|
|
5
5
|
import { NotificationState } from './notification-state';
|
|
6
6
|
import { SocketMessage, SocketSignalR } from './socket-signalr';
|
|
7
7
|
import { WorkItemResult } from './work-item-request';
|
|
@@ -28,17 +28,18 @@ export interface PowerShellWorkItemMessage {
|
|
|
28
28
|
/**
|
|
29
29
|
* The PowerShell script based notification class.
|
|
30
30
|
*/
|
|
31
|
-
export declare class PowerShellNotification extends SocketSignalR<PowerShellWorkItemMessage
|
|
31
|
+
export declare class PowerShellNotification extends SocketSignalR<PowerShellWorkItemMessage> {
|
|
32
32
|
private static connectionUrl;
|
|
33
|
+
private static proxyName;
|
|
33
34
|
private static notify;
|
|
34
35
|
private static subscribe;
|
|
35
36
|
private subjectInternal;
|
|
36
|
-
static hasConnectionError(item: SocketMessage<PowerShellWorkItemMessage
|
|
37
|
-
static hasError(item: SocketMessage<PowerShellWorkItemMessage
|
|
38
|
-
static hasException(item: SocketMessage<PowerShellWorkItemMessage
|
|
39
|
-
static hasCompleted(item: SocketMessage<PowerShellWorkItemMessage
|
|
40
|
-
static hasData(item: SocketMessage<PowerShellWorkItemMessage
|
|
41
|
-
static hasProgress(item: SocketMessage<PowerShellWorkItemMessage
|
|
37
|
+
static hasConnectionError(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
38
|
+
static hasError(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
39
|
+
static hasException(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
40
|
+
static hasCompleted(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
41
|
+
static hasData(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
42
|
+
static hasProgress(item: SocketMessage<PowerShellWorkItemMessage>): boolean;
|
|
42
43
|
/**
|
|
43
44
|
* Initializes a new instance of the GatewaySocket class.
|
|
44
45
|
*/
|
|
@@ -46,7 +47,7 @@ export declare class PowerShellNotification extends SocketSignalR<PowerShellWork
|
|
|
46
47
|
/**
|
|
47
48
|
* Gets the subject observable to get notifications.
|
|
48
49
|
*/
|
|
49
|
-
get subject():
|
|
50
|
+
get subject(): Subject<SocketMessage<PowerShellWorkItemMessage>>;
|
|
50
51
|
/**
|
|
51
52
|
* Submit PowerShell command as a work item.
|
|
52
53
|
*
|
|
@@ -61,7 +62,7 @@ export declare class PowerShellNotification extends SocketSignalR<PowerShellWork
|
|
|
61
62
|
/**
|
|
62
63
|
* Initialize to subscribe the web socket connection.
|
|
63
64
|
*/
|
|
64
|
-
initialize():
|
|
65
|
+
initialize(): JQueryPromise<any>;
|
|
65
66
|
/**
|
|
66
67
|
* Uninitialize to subscribe the web socket connection.
|
|
67
68
|
*/
|
|
@@ -72,19 +73,18 @@ export declare class PowerShellNotification extends SocketSignalR<PowerShellWork
|
|
|
72
73
|
* @param id the session ID of work item.
|
|
73
74
|
* @return Promise the promise object.
|
|
74
75
|
*/
|
|
75
|
-
subscribeSession(id: string):
|
|
76
|
+
subscribeSession(id: string): JQueryPromise<any>;
|
|
76
77
|
/**
|
|
77
78
|
* The client handler to process message.
|
|
78
79
|
*
|
|
79
80
|
* @param notification the message notification.
|
|
80
81
|
*/
|
|
81
|
-
protected clientHandler(notification: SocketMessage<PowerShellWorkItemMessage
|
|
82
|
+
protected clientHandler(notification: SocketMessage<PowerShellWorkItemMessage>): void;
|
|
82
83
|
/**
|
|
83
84
|
* Process the message.
|
|
84
85
|
*
|
|
85
86
|
* @param messages the messages.
|
|
86
87
|
*/
|
|
87
88
|
protected processMessage(message: string): void;
|
|
88
|
-
private
|
|
89
|
-
private processMessageData;
|
|
89
|
+
private processData;
|
|
90
90
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types='jquery' />
|
|
1
2
|
import { of, Subject } from 'rxjs';
|
|
2
3
|
import { catchError, map } from 'rxjs/operators';
|
|
3
4
|
import { Net } from '../data/net';
|
|
@@ -16,7 +17,7 @@ export class PowerShellNotification extends SocketSignalR {
|
|
|
16
17
|
* Initializes a new instance of the GatewaySocket class.
|
|
17
18
|
*/
|
|
18
19
|
constructor(gatewayUrl) {
|
|
19
|
-
super(gatewayUrl, PowerShellNotification.connectionUrl);
|
|
20
|
+
super(gatewayUrl, PowerShellNotification.connectionUrl, PowerShellNotification.proxyName);
|
|
20
21
|
}
|
|
21
22
|
/* tslint:disable:no-bitwise */
|
|
22
23
|
static hasConnectionError(item) {
|
|
@@ -41,7 +42,7 @@ export class PowerShellNotification extends SocketSignalR {
|
|
|
41
42
|
* Gets the subject observable to get notifications.
|
|
42
43
|
*/
|
|
43
44
|
get subject() {
|
|
44
|
-
return this.subjectInternal
|
|
45
|
+
return this.subjectInternal;
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
48
|
* Submit PowerShell command as a work item.
|
|
@@ -116,7 +117,7 @@ export class PowerShellNotification extends SocketSignalR {
|
|
|
116
117
|
const powershellCommandId = response.id ? response.id : response.sessionId;
|
|
117
118
|
SmeWebTelemetry.addPowershellId(powershellCommandId, command);
|
|
118
119
|
}
|
|
119
|
-
this.
|
|
120
|
+
this.processData(response);
|
|
120
121
|
// sending back the client.
|
|
121
122
|
const workItemResult = { id: result.id, state: result.state, error: error };
|
|
122
123
|
// passing in the results as object of the workItemResult
|
|
@@ -177,18 +178,9 @@ export class PowerShellNotification extends SocketSignalR {
|
|
|
177
178
|
return;
|
|
178
179
|
}
|
|
179
180
|
const data = JSON.parse(message);
|
|
180
|
-
|
|
181
|
-
// PowerShell work item.
|
|
182
|
-
this.processPowerShellData(data);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (data.id) {
|
|
186
|
-
// Notification message.
|
|
187
|
-
this.processMessageData(data);
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
181
|
+
this.processData(data);
|
|
190
182
|
}
|
|
191
|
-
|
|
183
|
+
processData(data) {
|
|
192
184
|
/* tslint:disable:no-bitwise */
|
|
193
185
|
let type = SocketMessageFlags.None;
|
|
194
186
|
if (data.results && data.results.length > 0) {
|
|
@@ -209,13 +201,10 @@ export class PowerShellNotification extends SocketSignalR {
|
|
|
209
201
|
/* tslint:enable:no-bitwise */
|
|
210
202
|
this.clientHandler({ type: type, message: data });
|
|
211
203
|
}
|
|
212
|
-
processMessageData(message) {
|
|
213
|
-
const type = SocketMessageFlags.Data;
|
|
214
|
-
this.clientHandler({ type, message });
|
|
215
|
-
}
|
|
216
204
|
}
|
|
217
205
|
PowerShellNotification.connectionUrl = '/api/notifications';
|
|
218
|
-
PowerShellNotification.
|
|
206
|
+
PowerShellNotification.proxyName = 'notificationHub';
|
|
207
|
+
PowerShellNotification.notify = 'notify';
|
|
219
208
|
PowerShellNotification.subscribe = 'Subscribe';
|
|
220
209
|
|
|
221
210
|
//# sourceMappingURL=powershell-notification.js.map
|