@microsoft/windows-admin-center-sdk 2.295.0 → 2.298.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/cs-CZ/strings.json +1 -1
- package/angular/assets/strings/de-DE/strings.json +1 -1
- package/angular/assets/strings/es-ES/strings.json +1 -1
- package/angular/assets/strings/fr-FR/strings.json +1 -1
- package/angular/assets/strings/hu-HU/strings.json +1 -1
- package/angular/assets/strings/it-IT/strings.json +1 -1
- package/angular/assets/strings/ja-JP/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/pl-PL/strings.json +1 -1
- package/angular/assets/strings/pt-BR/strings.json +1 -1
- package/angular/assets/strings/pt-PT/strings.json +1 -1
- package/angular/assets/strings/ru-RU/strings.json +1 -1
- package/angular/assets/strings/strings.json +1 -1
- package/angular/assets/strings/sv-SE/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 +558 -240
- 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 +2 -2
- package/angular/bundles/microsoft-windows-admin-center-sdk-angular.umd.min.js.map +1 -1
- package/angular/esm2015/src/controls/actions/containers/action-bar/action-bar.component.js +7 -2
- package/angular/esm2015/src/controls/alert-bar/alert-bar.component.js +5 -5
- package/angular/esm2015/src/controls/common/base.component.js +8 -1
- package/angular/esm2015/src/controls/data-table/data-table.component.js +39 -9
- package/angular/esm2015/src/controls/form/form-field/checklist/checklist-form-field.component.js +11 -8
- package/angular/esm2015/src/controls/form/form-field/combobox/combobox-form-field.component.js +8 -9
- package/angular/esm2015/src/controls/form/form-field/file/file-form-field.component.js +14 -2
- package/angular/esm2015/src/controls/form/form-field/form-field.component.js +9 -2
- package/angular/esm2015/src/controls/layout/layout-definition.component.js +9 -2
- package/angular/esm2015/src/controls/layout/layout.component.js +11 -2
- package/angular/esm2015/src/controls/master-view/master-view.component.js +32 -5
- package/angular/esm2015/src/controls/page-alert-bar/models/index.js +1 -1
- package/angular/esm2015/src/controls/pivot/pivot.component.js +11 -5
- package/angular/esm2015/src/controls/property-grid/property-grid-item.component.js +50 -2
- package/angular/esm2015/src/controls/property-grid/property-grid.component.js +73 -60
- package/angular/esm2015/src/controls/property-grid/property-grid.module.js +5 -1
- package/angular/esm2015/src/controls/settings/common-settings/common-settings.component.js +151 -70
- package/angular/esm2015/src/controls/settings/settings.component.js +48 -8
- package/angular/esm2015/src/controls/settings/settings.module.js +21 -9
- package/angular/esm2015/src/controls/wizard/wizard.component.js +55 -65
- package/angular/esm2015/src/generated/strings.js +1 -1
- package/angular/esm2015/src/service/app-context.service.js +3 -1
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js +535 -240
- package/angular/fesm2015/microsoft-windows-admin-center-sdk-angular.js.map +1 -1
- package/angular/package.json +2 -0
- package/angular/src/controls/common/base.component.d.ts +5 -0
- package/angular/src/controls/data-table/data-table.component.d.ts +15 -0
- package/angular/src/controls/form/form-field/checklist/checklist-form-field.component.d.ts +1 -0
- package/angular/src/controls/form/form-field/file/file-form-field.component.d.ts +4 -0
- package/angular/src/controls/layout/layout-definition.component.d.ts +6 -1
- package/angular/src/controls/master-view/master-view.component.d.ts +118 -2
- package/angular/src/controls/page-alert-bar/models/index.d.ts +1 -1
- package/angular/src/controls/pivot/pivot.component.d.ts +4 -1
- package/angular/src/controls/property-grid/property-grid-item.component.d.ts +53 -3
- package/angular/src/controls/property-grid/property-grid.component.d.ts +1 -2
- package/angular/src/controls/property-grid/property-grid.module.d.ts +4 -3
- package/angular/src/controls/settings/common-settings/common-settings.component.d.ts +32 -1
- package/angular/src/controls/settings/settings.component.d.ts +18 -1
- package/angular/src/controls/settings/settings.module.d.ts +3 -1
- package/angular/src/generated/strings.d.ts +3 -0
- package/core/base/environment.d.ts +10 -0
- package/core/base/environment.js.map +1 -1
- package/core/data/gateway-connection.d.ts +34 -0
- package/core/data/gateway-connection.js +59 -2
- package/core/data/gateway-connection.js.map +1 -1
- package/core/data/gateway-status.d.ts +24 -0
- package/core/data/gateway-status.js +3 -0
- package/core/data/gateway-status.js.map +1 -0
- package/core/data/node-connection.d.ts +4 -0
- package/core/data/node-connection.js.map +1 -1
- package/core/data/powershell.d.ts +4 -0
- package/core/data/powershell.js +1 -0
- package/core/data/powershell.js.map +1 -1
- package/core/data/wdac-operations.d.ts +123 -0
- package/core/data/wdac-operations.js +144 -0
- package/core/data/wdac-operations.js.map +1 -0
- package/core/diagnostics/sme-web-telemetry-models.d.ts +20 -3
- package/core/diagnostics/sme-web-telemetry-models.js +6 -2
- package/core/diagnostics/sme-web-telemetry-models.js.map +1 -1
- package/core/diagnostics/sme-web-telemetry.d.ts +13 -1
- package/core/diagnostics/sme-web-telemetry.js +51 -11
- package/core/diagnostics/sme-web-telemetry.js.map +1 -1
- package/core/generated/powershell-scripts.d.ts +8 -4
- package/core/generated/powershell-scripts.js +8 -4
- package/core/generated/powershell-scripts.js.map +1 -1
- package/core/index.d.ts +2 -0
- package/core/index.js +1 -0
- package/core/index.js.map +1 -1
- package/core/manifest/environment-modules.js +10 -0
- package/core/manifest/environment-modules.js.map +1 -1
- package/core/notification/powershell-notification.js +1 -1
- package/core/notification/powershell-notification.js.map +1 -1
- package/core/performance/performance-tracker.d.ts +67 -0
- package/core/performance/performance-tracker.js +211 -4
- package/core/performance/performance-tracker.js.map +1 -1
- package/core/rpc/credssp/rpc-credssp-model.d.ts +27 -2
- package/core/rpc/credssp/rpc-credssp-model.js +10 -0
- package/core/rpc/credssp/rpc-credssp-model.js.map +1 -1
- package/core/security/credssp-manager.d.ts +15 -1
- package/core/security/credssp-manager.js +28 -0
- package/core/security/credssp-manager.js.map +1 -1
- package/core/shared/gateway-inventory/gateway-inventory.d.ts +10 -0
- package/core/shared/gateway-inventory/gateway-inventory.js +11 -0
- package/core/shared/gateway-inventory/gateway-inventory.js.map +1 -1
- package/e2e/assets/strings/cs-CZ/strings.json +1 -1
- package/e2e/assets/strings/de-DE/strings.json +1 -1
- package/e2e/assets/strings/es-ES/strings.json +1 -1
- package/e2e/assets/strings/fr-FR/strings.json +1 -1
- package/e2e/assets/strings/hu-HU/strings.json +1 -1
- package/e2e/assets/strings/it-IT/strings.json +1 -1
- package/e2e/assets/strings/ja-JP/strings.json +1 -1
- package/e2e/assets/strings/ko-KR/strings.json +1 -1
- package/e2e/assets/strings/nl-NL/strings.json +1 -1
- package/e2e/assets/strings/pl-PL/strings.json +1 -1
- package/e2e/assets/strings/pt-BR/strings.json +1 -1
- package/e2e/assets/strings/pt-PT/strings.json +1 -1
- package/e2e/assets/strings/ru-RU/strings.json +1 -1
- package/e2e/assets/strings/strings.json +1 -1
- package/e2e/assets/strings/sv-SE/strings.json +1 -1
- package/e2e/assets/strings/tr-TR/strings.json +1 -1
- package/e2e/assets/strings/zh-CN/strings.json +1 -1
- package/e2e/assets/strings/zh-TW/strings.json +1 -1
- package/package.json +5 -3
- package/styles/css/main.css +1 -1
- package/tools/module-template/gulpfile.ts/index.ts +1 -1
- package/tools/package-lock.json +18081 -4110
- package/tools/wac-cli/src/create/main.d.ts +6 -3
- package/tools/wac-cli/src/create/main.js +87 -35
- package/tools/wac-cli/src/create/main.js.map +1 -1
- package/tools/wac-cli/src/index.js +2 -2
- package/tools/wac-cli/src/index.js.map +1 -1
- package/tools/wac-cli/templates/internal/npmrc.txt +6 -0
- package/tools/wac-cli/templates/internal/package.json +101 -0
- package/tools/wac-cli/templates/{manifest/solution-manifest.json → solution/manifest.json} +19 -0
- package/tools/wac-cli/templates/solution/strings.resjson +16 -0
- package/tools/wac-cli/templates/wac-template/angular.json +2 -2
- package/tools/wac-cli/templates/wac-template/gulpfile.ts/config-data.ts +1 -1
- package/tools/wac-cli/templates/wac-template/package.json +0 -8
- package/tools/wac-cli/templates/wac-template/src/app/app-routing.module.ts +1 -1
- package/tools/wac-cli/templates/wac-template/src/main.ts +2 -0
- package/tools/wac-cli/templates/{manifest/tool-manifest.json → wac-template/src/manifest.json} +0 -0
- package/tools/wac-cli/templates/wac-template/src/polyfills.ts +1 -1
- package/tools/wac-cli/templates/wac-template/src/test.ts +2 -2
- package/tools/wac-cli/templates/wac-template/src/version.ts +3 -0
- package/tools/wac-cli/templates/wac-template/version.json +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry-models.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry-models.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;AAqEpF;;GAEG;AACH,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,yDAAM,CAAA;IACN,6DAAQ,CAAA;IACR,uEAAa,CAAA;IACb,mEAAW,CAAA;IACX,iEAAU,CAAA;IACV,uFAAqB,CAAA;IACrB,qEAAY,CAAA;AAChB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,oBAGZ;AAHA,WAAY,oBAAoB;IAC7B,uCAAe,CAAA;IACf,oCAAY,CAAA;AAChB,CAAC,EAHY,oBAAoB,KAApB,oBAAoB,QAGhC;AAED;;GAEG;AACF,MAAM,CAAN,IAAY,mBAOZ;AAPA,WAAY,mBAAmB;IAC5B,6CAAsB,CAAA;IACtB,sCAAe,CAAA;IACf,kDAA2B,CAAA;IAC3B,gDAAyB,CAAA;IACzB,oDAA6B,CAAA;IAC7B,gDAAyB,CAAA;AAC7B,CAAC,EAPY,mBAAmB,KAAnB,mBAAmB,QAO/B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,2DAA0C,CAAA;IAC1C,6CAA4B,CAAA;IAC5B,2DAA0C,CAAA;IAC1C,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,iDAAgC,CAAA;IAChC,wEAAuD,CAAA;AAC3D,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC5B,2CAAmB,CAAA;IACnB,+CAAuB,CAAA;IACvB,uCAAe,CAAA;IACf,yCAAiB,CAAA;AACrB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B","file":"sme-web-telemetry-models.js","sourcesContent":["// 1DS documentation found at\r\n// https://1dsdocs.azurewebsites.net/getting-started/javascript-getting_started.html\r\n\r\n/**\r\n * This file contains override value interfaces from 1DS - we redefine these locally because we cannot take the npm package due to\r\n * it being from a private feed. Instead, we load the CDN and use our redefined interfaces to help everything mesh together.\r\n * Disable tslint interface prefix rule b/c these are 1DS libraries, avoid renaming to keep consistent.\r\n */\r\n\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\n\r\n// tslint:disable:interface-name\r\n/************************************\r\n * WAC models\r\n ************************************/\r\n\r\n/**\r\n * Exposed class to hold sme performance data.\r\n */\r\nexport interface SmePerformanceData {\r\n label?: string;\r\n sme?: any;\r\n resources?: any;\r\n navigation?: any;\r\n totalLoadTime: number;\r\n}\r\n\r\n/**\r\n * Holds lighthouse metrics to send via telemetry. See more details at https://web.dev/vitals/\r\n */\r\n export interface LighthousePerformanceMetrics {\r\n CumulativeLayoutShift?: number;\r\n LargestContentfulPaint?: number;\r\n FirstContentfulPaint?: number;\r\n FirstInputDelay?: number;\r\n TimeToFirstByte?: number;\r\n TotalBlockingTime?: number;\r\n TimeToInteractive?: number;\r\n}\r\n\r\n/**\r\n * Class w/ all SME performance data to be sent via telemetry. Internal to SmeWebTelemetry.\r\n * Numbers are converted to strings because we use toFixed to truncate numbers to avoid triggering MSCOM scrubbed\r\n * stream personal data removal (eg with phone numbers)\r\n */\r\nexport interface CompleteSmePerformanceData {\r\n extension: string;\r\n entryPointName: string;\r\n url: string;\r\n moduleOpened: boolean;\r\n label?: string;\r\n sme?: any;\r\n resources?: any;\r\n navigation?: any;\r\n totalLoadTime: string;\r\n}\r\n\r\n/**\r\n * Class to hold any kind of telemetry event parameters needed to fire an event.\r\n */\r\nexport interface TelemetryEventBody {\r\n overrideValues?: IOverrideValues;\r\n element?: Element;\r\n performance?: SmePerformanceData;\r\n lighthouse?: LighthousePerformanceMetrics;\r\n notification?: RpcNotification;\r\n custom?: any;\r\n customProperties?: { [name: string]: any };\r\n}\r\n\r\n/**\r\n * Telemetry events supported.\r\n */\r\nexport enum TelemetryEvents {\r\n Action,\r\n PageView,\r\n ContentUpdate,\r\n Performance,\r\n Lighthouse,\r\n ModuleOpenPerformance,\r\n Notification\r\n}\r\n\r\n/**\r\n * Telemetry action types supported - corresponds to awa jsll action type dictionary.\r\n */\r\n export enum TelemetryActionTypes {\r\n Automatic = 'A',\r\n Click = 'CL'\r\n}\r\n\r\n/**\r\n * Telemetry event types supported - labels type field in data dictionary within events.\r\n */\r\n export enum TelemetryEventTypes {\r\n Informational = 'info',\r\n Error = 'error',\r\n Performance = 'performance',\r\n Lighthouse = 'lighthouse',\r\n Notification = 'notification',\r\n Powershell = 'powershell'\r\n}\r\n\r\n/**\r\n * Labels for WAC metadata tags\r\n */\r\nexport enum SmeMetaLabels {\r\n Language = 'wac-lang',\r\n IsProduction = 'wac-prod',\r\n ExtensionVersion = 'wac-extension-version',\r\n SessionId = 'wac-session-id',\r\n InstallationType = 'wac-installation-type',\r\n Build = 'wac-build',\r\n Market = 'market',\r\n Environment = 'env',\r\n GatewayMode = 'wac-gateway-mode',\r\n GatewayOperationalMode = 'wac-gateway-operational-mode'\r\n}\r\n\r\n/**\r\n * Standard telemetry tracking event states\r\n */\r\nexport enum TelemetryEventStates {\r\n Started = 'started',\r\n Completed = 'completed',\r\n Error = 'error',\r\n Exited = 'exited'\r\n}\r\n\r\n/**\r\n * Include powershell details that may be helpful in telemetry, including response and psSessionId.\r\n * Data is kept as an optional any-helpful field kind of thing.\r\n */\r\nexport interface PowershellDetails {\r\n /**\r\n * Response object - this should be the response within the error if result is an AjaxError\r\n */\r\n response?: any;\r\n\r\n /**\r\n * Powershell session ID - used to map to PS command in telemetry\r\n */\r\n id?: string;\r\n\r\n /**\r\n * Any other miscellaneous data that would like to be sent.\r\n */\r\n otherData?: any;\r\n}\r\n\r\n/************************************\r\n * Override values interfaces\r\n ************************************/\r\n export interface IOverrideValues {\r\n /**\r\n * One of the awa.behavior values.\r\n */\r\n behavior?: number;\r\n /**\r\n * Page name\r\n */\r\n pageName?: string;\r\n /**\r\n * Page type\r\n */\r\n pageType?: string;\r\n /**\r\n * KVP to be added to the page tags collected\r\n */\r\n pageTags?: any;\r\n /**\r\n * Indicates if the event was fired automatically\r\n */\r\n isAuto?: boolean;\r\n}\r\n\r\n/**\r\n * Overrides for Page View event\r\n */\r\n export interface IPageViewOverrideValues extends IOverrideValues {\r\n /**\r\n * Uri of the referrer page\r\n */\r\n referrerUri?: string;\r\n}\r\n\r\n/**\r\n * Overrides for Page Action event\r\n */\r\nexport interface IPageActionOverrideValues extends IOverrideValues {\r\n /**\r\n * Uri of the referrer page\r\n */\r\n refUri?: string;\r\n /**\r\n * One of the awa.actionType values\r\n */\r\n actionType?: string;\r\n /**\r\n * Target uri for PageAction events\r\n */\r\n targetUri?: string;\r\n /**\r\n * Click coordinates relative to the top left of the fully rendered content area in the browser\r\n */\r\n clickCoordinateX?: number;\r\n /**\r\n * Click coordinates relative to the top left of the fully rendered content area in the browser\r\n */\r\n clickCoordinateY?: number;\r\n /**\r\n * KVP of the content\r\n */\r\n content?: any;\r\n /**\r\n * KVPs to be added to the content tags collected on a Page Action event; extends the items in the Content blob in Page Action events\r\n */\r\n contentTags?: any;\r\n}\r\n\r\n/**\r\n * Overrides for Content Update event\r\n */\r\nexport interface IContentUpdateOverrideValues extends IOverrideValues {\r\n /**\r\n * KVP of the content\r\n */\r\n content?: any;\r\n /**\r\n * Indicates if the Contentupdate event is the first ContentUpdate event\r\n */\r\n isDomComplete?: boolean;\r\n /**\r\n * One of the awa.actionType values\r\n */\r\n actionType?: string;\r\n}\r\n\r\n/**\r\n * Overrides for Page Unload event\r\n */\r\nexport interface IPageUnloadOverrideValues extends IOverrideValues {\r\n /**\r\n * Scroll depth override\r\n */\r\n scrollDepth?: string;\r\n /**\r\n * Vertical scroll position/offset when event was fired in pixels.\r\n */\r\n vScrollOffset?: number;\r\n}\r\n\r\n/**\r\n * Overrides for Page View Performance event\r\n */\r\nexport interface IPageViewPerformanceOverrideValues extends IOverrideValues {\r\n /**\r\n * Viewport height\r\n */\r\n vpHeight?: number;\r\n /**\r\n * Viewport width\r\n */\r\n vpWidth?: number;\r\n /**\r\n * Represents UX Framework name and version used.\r\n */\r\n framework?: string;\r\n /**\r\n * These are timings pulled from the browser/container.\r\n * They are standards which are captured by the browser, like the navigationStart/End, LoadEventStart/End\r\n */\r\n systemTiming?: string;\r\n /**\r\n * These are user set timings\r\n */\r\n customTiming?: string;\r\n}\r\n"]}
|
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { AppContext } from '../data/app-context';
|
|
3
3
|
import { PowerShellCommand } from '../data/powershell';
|
|
4
4
|
import { RpcNotification } from '../rpc/notification/rpc-notification-model';
|
|
5
|
-
import { IContentUpdateOverrideValues, IPageActionOverrideValues, IPageViewOverrideValues, PowershellDetails, SmePerformanceData, TelemetryEventStates } from './sme-web-telemetry-models';
|
|
5
|
+
import { IContentUpdateOverrideValues, IPageActionOverrideValues, IPageViewOverrideValues, LighthousePerformanceMetrics, PowershellDetails, SmePerformanceData, TelemetryEventStates } from './sme-web-telemetry-models';
|
|
6
6
|
export declare class SmeWebTelemetry {
|
|
7
7
|
/**
|
|
8
8
|
* The source name to use when logging about this service.
|
|
@@ -20,6 +20,8 @@ export declare class SmeWebTelemetry {
|
|
|
20
20
|
private static rpcInitAlready;
|
|
21
21
|
private static metaTags;
|
|
22
22
|
private static powershellIdMap;
|
|
23
|
+
private static isProd;
|
|
24
|
+
static get isProduction(): boolean;
|
|
23
25
|
private static windowsAdminCenterTenantToken;
|
|
24
26
|
/**
|
|
25
27
|
* Map of module versions used in this instance of web telemetry - memoize values here.
|
|
@@ -118,6 +120,16 @@ export declare class SmeWebTelemetry {
|
|
|
118
120
|
* @param contentOverrides any content overriding behavior wanted in the performance event
|
|
119
121
|
*/
|
|
120
122
|
static tracePerformanceData(dataPayload: SmePerformanceData, contentOverrides?: any): void;
|
|
123
|
+
/**
|
|
124
|
+
* Send a content update event - this event will contain timings for lighthouse calculation in the backend
|
|
125
|
+
* This can potentially be sent a couple times with overlapping data for one page load event, depending
|
|
126
|
+
* on when the TTI is calculated. In this scenario, it will be handled on the backend.
|
|
127
|
+
* @param dataPayload Lighthouse data
|
|
128
|
+
* @param contentOverrides any content overriding behavior wanted in the performance event
|
|
129
|
+
*/
|
|
130
|
+
static traceLighthouseData(dataPayload: LighthousePerformanceMetrics, contentOverrides?: any, properties?: {
|
|
131
|
+
[name: string]: any;
|
|
132
|
+
}): void;
|
|
121
133
|
/**
|
|
122
134
|
* See tracePerformanceData comments, only difference is moduleOpened is true and the contentOverrides
|
|
123
135
|
* @param dataPayload performance data to be sent through telemetry.
|
|
@@ -4,7 +4,7 @@ import { Meta } from '@angular/platform-browser';
|
|
|
4
4
|
import { EMPTY, Observable } from 'rxjs';
|
|
5
5
|
import { delay, retryWhen, shareReplay, take, tap } from 'rxjs/operators';
|
|
6
6
|
import { NotificationState } from '../notification/notification-state';
|
|
7
|
-
import {
|
|
7
|
+
import { GatewayInstallationType, GatewayMode, GatewayOperationalMode } from '../shared/gateway-inventory/gateway-inventory';
|
|
8
8
|
import { Logging } from './logging';
|
|
9
9
|
import { SmeMetaLabels, TelemetryActionTypes, TelemetryEvents, TelemetryEventStates, TelemetryEventTypes } from './sme-web-telemetry-models';
|
|
10
10
|
export class SmeWebTelemetry {
|
|
@@ -23,6 +23,9 @@ export class SmeWebTelemetry {
|
|
|
23
23
|
static get backlogHasSpace() {
|
|
24
24
|
return this.eventBacklog.length < 50;
|
|
25
25
|
}
|
|
26
|
+
static get isProduction() {
|
|
27
|
+
return this.isProd;
|
|
28
|
+
}
|
|
26
29
|
/**
|
|
27
30
|
* Get the list of module versions for use in telemetry where the event is sent via RPC to shell
|
|
28
31
|
* from the actual module the event is called in.
|
|
@@ -51,6 +54,10 @@ export class SmeWebTelemetry {
|
|
|
51
54
|
this.tracePerformanceData(body.performance, overrideVals ? overrideVals.content : null);
|
|
52
55
|
break;
|
|
53
56
|
}
|
|
57
|
+
case TelemetryEvents.Lighthouse: {
|
|
58
|
+
this.traceLighthouseData(body.lighthouse, body.overrideValues);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
54
61
|
case TelemetryEvents.ModuleOpenPerformance:
|
|
55
62
|
this.traceModuleOpenPerformance(body.performance);
|
|
56
63
|
break;
|
|
@@ -130,8 +137,10 @@ export class SmeWebTelemetry {
|
|
|
130
137
|
// Instantiate these initially so they aren't empty values
|
|
131
138
|
this.metaTags[SmeMetaLabels.InstallationType] = 'N/A';
|
|
132
139
|
this.metaTags[SmeMetaLabels.Build] = 'N/A';
|
|
133
|
-
|
|
134
|
-
|
|
140
|
+
this.metaTags[SmeMetaLabels.GatewayMode] = GatewayMode[MsftSme.self().Init.mode];
|
|
141
|
+
this.metaTags[SmeMetaLabels.GatewayOperationalMode] = 'N/A';
|
|
142
|
+
this.isProd = MsftSme.self().Init.isProduction;
|
|
143
|
+
return appContext.gateway.getStatus()
|
|
135
144
|
.pipe(retryWhen(errors => {
|
|
136
145
|
let gatewayRetries = 2;
|
|
137
146
|
return errors.pipe(delay(1000), tap((error) => {
|
|
@@ -141,10 +150,15 @@ export class SmeWebTelemetry {
|
|
|
141
150
|
Logging.logDebug(this.logSourceName, 'Attempting to query gateway again...');
|
|
142
151
|
gatewayRetries--;
|
|
143
152
|
}));
|
|
144
|
-
}), take(1), tap((
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.metaTags[SmeMetaLabels.
|
|
153
|
+
}), take(1), tap((status) => {
|
|
154
|
+
this.isProd = this.isProd
|
|
155
|
+
&& GatewayOperationalMode[status.gatewayOperationalMode] !== GatewayOperationalMode.Development;
|
|
156
|
+
this.metaTags[SmeMetaLabels.InstallationType] = status.installationType || GatewayInstallationType.Standard;
|
|
157
|
+
this.metaTags[SmeMetaLabels.Build] = status.gatewayVersion;
|
|
158
|
+
this.metaTags[SmeMetaLabels.GatewayMode] = GatewayMode[status.gatewayMode];
|
|
159
|
+
this.metaTags[SmeMetaLabels.GatewayOperationalMode] = GatewayOperationalMode[status.gatewayOperationalMode];
|
|
160
|
+
this.metaTags[SmeMetaLabels.IsProduction] = this.isProd.toString();
|
|
161
|
+
this.metaTags[SmeMetaLabels.Environment] = this.isProd.toString();
|
|
148
162
|
// If not shell, handle in RPC handler, because some fields will init after 1DS inits
|
|
149
163
|
// If rpc handler has happened already, go ahead with this
|
|
150
164
|
if (MsftSme.isShell() || this.rpcInitAlready) {
|
|
@@ -186,7 +200,7 @@ export class SmeWebTelemetry {
|
|
|
186
200
|
onLoad: false,
|
|
187
201
|
onUnload: true,
|
|
188
202
|
click: true,
|
|
189
|
-
resize:
|
|
203
|
+
resize: true,
|
|
190
204
|
jsError: true,
|
|
191
205
|
lineage: true
|
|
192
206
|
},
|
|
@@ -211,6 +225,9 @@ export class SmeWebTelemetry {
|
|
|
211
225
|
event.baseData.properties.pageTags.metaTags[SmeMetaLabels.ExtensionVersion] =
|
|
212
226
|
this.getModuleVersion(event.baseData.name);
|
|
213
227
|
}
|
|
228
|
+
event.baseData.properties.pageTags.screenResolution = { availableHeight: window.screen.availHeight,
|
|
229
|
+
availableWidth: window.screen.availWidth };
|
|
230
|
+
event.baseData.properties.pageTags.frameDetails = { height: window.innerHeight, width: window.innerWidth };
|
|
214
231
|
});
|
|
215
232
|
observer.next();
|
|
216
233
|
observer.complete();
|
|
@@ -345,11 +362,32 @@ export class SmeWebTelemetry {
|
|
|
345
362
|
// A for automatic, performance tracking is done automatically.
|
|
346
363
|
const overrideValues = {
|
|
347
364
|
actionType: TelemetryActionTypes.Automatic,
|
|
348
|
-
content: contentOverrides ||
|
|
365
|
+
content: contentOverrides || dataPayload
|
|
349
366
|
};
|
|
350
367
|
const customProps = { timings: data, type: TelemetryEventTypes.Performance };
|
|
351
368
|
this.telemetryHandler.captureContentUpdate(overrideValues, customProps);
|
|
352
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Send a content update event - this event will contain timings for lighthouse calculation in the backend
|
|
372
|
+
* This can potentially be sent a couple times with overlapping data for one page load event, depending
|
|
373
|
+
* on when the TTI is calculated. In this scenario, it will be handled on the backend.
|
|
374
|
+
* @param dataPayload Lighthouse data
|
|
375
|
+
* @param contentOverrides any content overriding behavior wanted in the performance event
|
|
376
|
+
*/
|
|
377
|
+
static traceLighthouseData(dataPayload, contentOverrides, properties) {
|
|
378
|
+
if (!this.telemetryHandler && this.backlogHasSpace) {
|
|
379
|
+
this.eventBacklog.push([TelemetryEvents.Lighthouse, { lighthouse: dataPayload, overrideValues: { content: contentOverrides }
|
|
380
|
+
}]);
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const overrideValues = {
|
|
384
|
+
actionType: TelemetryActionTypes.Automatic,
|
|
385
|
+
content: contentOverrides || dataPayload
|
|
386
|
+
};
|
|
387
|
+
const customProps = { timings: dataPayload, type: TelemetryEventTypes.Lighthouse };
|
|
388
|
+
MsftSme.deepAssign(customProps, properties);
|
|
389
|
+
this.telemetryHandler.captureContentUpdate(overrideValues, customProps);
|
|
390
|
+
}
|
|
353
391
|
/**
|
|
354
392
|
* See tracePerformanceData comments, only difference is moduleOpened is true and the contentOverrides
|
|
355
393
|
* @param dataPayload performance data to be sent through telemetry.
|
|
@@ -424,8 +462,9 @@ export class SmeWebTelemetry {
|
|
|
424
462
|
if (state !== TelemetryEventStates.Started && id) {
|
|
425
463
|
this.removePowershellId(id);
|
|
426
464
|
}
|
|
427
|
-
const psContent = { psCommand: psCommand.command, state: state,
|
|
428
|
-
|
|
465
|
+
const psContent = { psCommand: psCommand.command, state: state, psModule: psCommand.module,
|
|
466
|
+
otherData: details && details.otherData ? details.otherData : {} };
|
|
467
|
+
const sourceName = this.nameOfModule;
|
|
429
468
|
if (response && response.error) {
|
|
430
469
|
psContent['errorCodes'] = [response.error.code];
|
|
431
470
|
}
|
|
@@ -477,6 +516,7 @@ SmeWebTelemetry.testMode = 'test';
|
|
|
477
516
|
SmeWebTelemetry.rpcInitAlready = false;
|
|
478
517
|
SmeWebTelemetry.metaTags = {};
|
|
479
518
|
SmeWebTelemetry.powershellIdMap = {};
|
|
519
|
+
SmeWebTelemetry.isProd = true;
|
|
480
520
|
// AppId/Tenant Token provided by MarTech support
|
|
481
521
|
// AppId is not used, but it will be mapped to later in the pipeline
|
|
482
522
|
// Full keys are JS:WindowsAdminCenter and o:f78e2b7c9ae4461399c360160d82dcfc for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAOH,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IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE;YACpC,SAAS,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAClE,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SACzG;QACD,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC,EAClD,EAAC,IAAI,EAAE,mBAAmB,CAAC,UAAU,EAAC,CAAC,CAAC;IAChD,CAAC;;AAlgBc,4BAAY,GAA4C,EAAE,CAAC;AAC3D,gCAAgB,GAAG,IAAI,CAAC;AAExB,wBAAQ,GAAG,MAAM,CAAC;AAElB,8BAAc,GAAG,KAAK,CAAC;AACvB,wBAAQ,GAA4B,EAAE,CAAC;AACvC,+BAAe,GAAsC,EAAE,CAAC;AAGvE,iDAAiD;AACjD,oEAAoE;AACpE,iFAAiF;AACjF,oGAAoG;AACpG,iEAAiE;AAClD,6CAA6B,GAAG,4EAA4E,CAAC;AAE5H;;GAEG;AACY,8BAAc,GAAG,EAAE,CAAC","file":"sme-web-telemetry.js","sourcesContent":["// 1DS documentation found at\r\n// https://1dsdocs.azurewebsites.net/getting-started/javascript-getting_started.html\r\n\r\nimport { Meta } from '@angular/platform-browser';\r\nimport { EMPTY, Observable } from 'rxjs';\r\nimport { delay, retryWhen, shareReplay, take, tap } from 'rxjs/operators';\r\nimport { AppContext } from '../data/app-context';\r\nimport { PowerShellCommand } from '../data/powershell';\r\nimport { NotificationState } from '../notification/notification-state';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { GatewayInventory} from '../shared/gateway-inventory/gateway-inventory';\r\nimport { GatewayInventoryCache } from '../shared/gateway-inventory/gateway-inventory-cache';\r\nimport { Logging } from './logging';\r\nimport {\r\n CompleteSmePerformanceData,\r\n IContentUpdateOverrideValues,\r\n IPageActionOverrideValues,\r\n IPageViewOverrideValues,\r\n IPageViewPerformanceOverrideValues,\r\n PowershellDetails,\r\n SmeMetaLabels,\r\n SmePerformanceData,\r\n TelemetryActionTypes,\r\n TelemetryEventBody,\r\n TelemetryEvents,\r\n TelemetryEventStates,\r\n TelemetryEventTypes\r\n} from './sme-web-telemetry-models';\r\n\r\n// placeholder for the oneDS type, introduced when we load script.\r\ndeclare var oneDS: any;\r\n\r\nexport class SmeWebTelemetry {\r\n\r\n /**\r\n * The source name to use when logging about this service.\r\n */\r\n private static get logSourceName() {\r\n return 'WebTelemetry';\r\n }\r\n /**\r\n * Gets the name of current shell or module.\r\n */\r\n private static get nameOfModule(): string {\r\n return MsftSme.self().Init.moduleName ? MsftSme.self().Init.moduleName : SmeWebTelemetry.testMode;\r\n }\r\n\r\n private static get backlogHasSpace(): boolean {\r\n return this.eventBacklog.length < 50;\r\n }\r\n\r\n private static eventBacklog: [TelemetryEvents, TelemetryEventBody][] = [];\r\n private static telemetryHandler = null;\r\n\r\n private static testMode = 'test';\r\n private static metaService: Meta;\r\n private static rpcInitAlready = false;\r\n private static metaTags: {[tag: string]: string} = {};\r\n private static powershellIdMap: {[id: string]: PowerShellCommand} = {};\r\n\r\n\r\n // AppId/Tenant Token provided by MarTech support\r\n // AppId is not used, but it will be mapped to later in the pipeline\r\n // Full keys are JS:WindowsAdminCenter and o:f78e2b7c9ae4461399c360160d82dcfc for\r\n // AppId/Tenant token respectively. In Cosmos, only the initial portion of the tenant token is used.\r\n // private static windowsAdminCenterAppId = 'WindowsAdminCenter';\r\n private static windowsAdminCenterTenantToken = 'f78e2b7c9ae4461399c360160d82dcfc-9371288c-a1b9-4fdc-a196-0340fc5f9880-7071';\r\n\r\n /**\r\n * Map of module versions used in this instance of web telemetry - memoize values here.\r\n */\r\n private static moduleVersions = {};\r\n\r\n /**\r\n * Get the list of module versions for use in telemetry where the event is sent via RPC to shell\r\n * from the actual module the event is called in.\r\n * @returns list of module mappings to versions\r\n */\r\n private static getModuleVersion(moduleName: string): string {\r\n if (this.moduleVersions[moduleName]) {\r\n return this.moduleVersions[moduleName];\r\n }\r\n const environment = MsftSme.self().Environment;\r\n const moduleObject = environment.modules.find((module) => {\r\n return module.name === moduleName;\r\n });\r\n const version = moduleObject ? moduleObject.version : 'N/A';\r\n this.moduleVersions[moduleName] = version;\r\n return version;\r\n }\r\n\r\n /**\r\n * Send any manual events that were triggered prior to telemetry initializing.\r\n */\r\n private static sendBacklogEvents(): void {\r\n this.eventBacklog.forEach(([type, body]: [TelemetryEvents, TelemetryEventBody]) => {\r\n switch (type) {\r\n case TelemetryEvents.Performance: {\r\n const overrideVals = body.overrideValues as IContentUpdateOverrideValues;\r\n this.tracePerformanceData(body.performance, overrideVals ? overrideVals.content : null);\r\n break;\r\n }\r\n case TelemetryEvents.ModuleOpenPerformance: this.traceModuleOpenPerformance(body.performance); break;\r\n case TelemetryEvents.Action: {\r\n const overrideVals = body.overrideValues as IPageActionOverrideValues;\r\n this.traceAction(body.element, overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.ContentUpdate: {\r\n const overrideVals = body.overrideValues as IContentUpdateOverrideValues;\r\n this.traceContentUpdate(overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.PageView: {\r\n const overrideVals = body.overrideValues as IPageViewOverrideValues;\r\n this.tracePageView(overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.Notification: this.traceClientNotification(body.notification); break;\r\n default: return;\r\n }\r\n });\r\n this.eventBacklog = [];\r\n }\r\n\r\n /**\r\n * Helper to combine setting metaTags, initialize handler, and\r\n * send any telemetry events that occurred prior to initialization\r\n */\r\n private static configureAndInitTelemetry(): void {\r\n this.setMetaInDom();\r\n this.initTelemetryHandler().subscribe(\r\n () => { this.sendBacklogEvents(); },\r\n (error: Error) => {\r\n Logging.logError(this.logSourceName, '{0}: {1}'.format(error.name, error.message));\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Helper function to set metaTags in DOM\r\n */\r\n private static setMetaInDom(): void {\r\n for (const [key, value] of Object.entries(this.metaTags)) {\r\n this.metaService.updateTag({name: `awa-${key}`, content: value});\r\n }\r\n }\r\n\r\n /**\r\n * Update Metatags and/or initialize telemetry, depending on whether rpc message came before or after app-context init.\r\n * @param newMetaTags Primarily contains WAC-Session-Id & extension-version, received from RPC message\r\n */\r\n public static updateFromRpcInit(newMetaTags: {[tag: string]: string}): void {\r\n // All the fields will be updated at the same time here, checking one (wac-session-id is the main one) is enough for the check\r\n const shouldInitHere = SmeMetaLabels.SessionId in this.metaTags\r\n && this.metaTags[SmeMetaLabels.SessionId] === 'N/A';\r\n this.rpcInitAlready = true;\r\n MsftSme.deepAssign(this.metaTags, newMetaTags);\r\n\r\n // If metaTags contains session ID but it's N/A (ie initial init was called already), call the init. If not,\r\n // just wait for normal init to be called in app-context. Depending on timing RPC update can happen before or after.\r\n if (shouldInitHere) {\r\n this.configureAndInitTelemetry();\r\n }\r\n }\r\n\r\n /**\r\n * Load 1DS if does not already exist\r\n * @param appContext App context currently being used\r\n */\r\n public static init(appContext: AppContext): Observable<boolean> {\r\n if (this.telemetryHandler) {\r\n return EMPTY;\r\n }\r\n\r\n this.metaService = new Meta(document);\r\n // Set fields we don't need gateway for, if connection to gateway fails, initialize telemetry with limited fields\r\n this.metaTags[SmeMetaLabels.Language] = MsftSme.self().Resources.localeId;\r\n this.metaTags[SmeMetaLabels.Market] = MsftSme.self().Resources.localeId;\r\n this.metaTags[SmeMetaLabels.IsProduction] = MsftSme.self().Init.isProduction.toString();\r\n this.metaTags[SmeMetaLabels.Environment] = MsftSme.self().Init.isProduction.toString();\r\n this.metaTags[SmeMetaLabels.ExtensionVersion] = MsftSme.self().Environment.version;\r\n this.metaTags[SmeMetaLabels.SessionId] = MsftSme.sessionId();\r\n // Instantiate these initially so they aren't empty values\r\n this.metaTags[SmeMetaLabels.InstallationType] = 'N/A';\r\n this.metaTags[SmeMetaLabels.Build] = 'N/A';\r\n const gatewayInventoryCache = new GatewayInventoryCache(appContext);\r\n return gatewayInventoryCache.query({})\r\n .pipe(\r\n retryWhen(errors => {\r\n let gatewayRetries = 2;\r\n return errors.pipe(\r\n delay(1000),\r\n tap((error) => {\r\n if (gatewayRetries === 0) {\r\n throw error;\r\n }\r\n Logging.logDebug(this.logSourceName, 'Attempting to query gateway again...');\r\n gatewayRetries--;\r\n })\r\n );\r\n }),\r\n take(1),\r\n tap((inventory: any) => {\r\n const gatewayInventory: GatewayInventory = inventory.instance;\r\n\r\n this.metaTags[SmeMetaLabels.InstallationType] = gatewayInventory.installationType;\r\n this.metaTags[SmeMetaLabels.Build] = gatewayInventory.gatewayVersion;\r\n\r\n // If not shell, handle in RPC handler, because some fields will init after 1DS inits\r\n // If rpc handler has happened already, go ahead with this\r\n if (MsftSme.isShell() || this.rpcInitAlready) {\r\n this.configureAndInitTelemetry();\r\n }\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Set config and initialize telemetry library handler\r\n */\r\n private static initTelemetryHandler(): Observable<void> {\r\n const observable = Observable.create(observer => {\r\n const script: HTMLScriptElement = document.createElement('script');\r\n script.type = 'text/javascript';\r\n script.src = MsftSme.self().Environment.configuration.telemetry.sourceLibraryCdnLink;\r\n script.integrity = MsftSme.self().Environment.configuration.telemetry.sourceLibraryCdnIntegrityHash;\r\n script.crossOrigin = 'anonymous';\r\n script.async = true;\r\n\r\n script.onload = () => {\r\n this.telemetryHandler = new oneDS.ApplicationInsights();\r\n const entryType: string = MsftSme.self().Init.entryPointType;\r\n const entryName: string = MsftSme.self().Init.entryPointName;\r\n\r\n const config = {\r\n instrumentationKey: this.windowsAdminCenterTenantToken,\r\n // post channel configuration\r\n channelConfiguration: {\r\n eventsLimitInMem: 50\r\n },\r\n // Properties Plugin configuration\r\n propertyConfiguration: {\r\n userAgent: 'Windows Admin Center',\r\n sessionAsGuid: true\r\n },\r\n // Web Analytics Plugin configuration\r\n webAnalyticsConfiguration: {\r\n autoCapture: {\r\n scroll: false,\r\n pageView: true,\r\n onLoad: false,\r\n onUnload: true,\r\n click: true,\r\n resize: false,\r\n jsError: true,\r\n lineage: true\r\n },\r\n coreData: {\r\n pageName: this.nameOfModule,\r\n // to prevent personal data from being sent in URI\r\n referrerUri: 'windows.admin.center',\r\n requestUri: 'windows.admin.center',\r\n pageTags: {\r\n entryPointName: entryName || '',\r\n entryPointType: entryType || ''\r\n }\r\n },\r\n useShortNameForContentBlob: false\r\n }\r\n };\r\n this.telemetryHandler.initialize(config, []);\r\n this.telemetryHandler.addTelemetryInitializer((event: any) => {\r\n // If we send an event that originates from a different module (eg notifications in shell)\r\n // change the extension version to match module\r\n if (event.baseData.name !== this.nameOfModule) {\r\n event.baseData.properties.pageTags.metaTags[SmeMetaLabels.ExtensionVersion] =\r\n this.getModuleVersion(event.baseData.name);\r\n }\r\n });\r\n observer.next();\r\n observer.complete();\r\n };\r\n script.onerror = () => {\r\n script.remove();\r\n observer.error(new Error('1DS Script could not be loaded'));\r\n };\r\n document.body.appendChild(script);\r\n }).pipe(shareReplay(1));\r\n return observable;\r\n }\r\n\r\n /**\r\n * Send a Page-Action event through Web Telemetry.\r\n * @param element Element action is being executed on\r\n * @param overrideValues Various values to override within default Web Telemetry page action fields, see Web Telemetry documentation.\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static traceAction(element: Element, overrideValues?: IPageActionOverrideValues, properties?: {[name: string]: any}): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Action, { element: element, overrideValues: overrideValues,\r\n customProperties: properties }]);\r\n return;\r\n }\r\n if (!overrideValues.actionType) {\r\n overrideValues.actionType = TelemetryActionTypes.Automatic;\r\n }\r\n this.telemetryHandler.capturePageAction(element, overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Send a Page-View event through Web Telemetry.\r\n * @param overrideValues Various values to override within default Web Telemetry page view fields, see Web Telemetry documentation.\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static tracePageView(overrideValues: IPageViewOverrideValues, properties?: { [name: string]: any }): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.PageView, { overrideValues: overrideValues }]);\r\n return;\r\n }\r\n this.telemetryHandler.capturePageView(overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Send a Content-Update event through Web Telemetry.\r\n * @param overrideValues Various values to override within default Web Telemetry content update fields, see Web Telemetry documentation\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static traceContentUpdate(overrideValues: IContentUpdateOverrideValues, properties?: { [name: string]: any }): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.ContentUpdate, { overrideValues: overrideValues, customProperties: properties }]);\r\n return;\r\n }\r\n if (!overrideValues.actionType) {\r\n overrideValues.actionType = TelemetryActionTypes.Automatic;\r\n }\r\n this.telemetryHandler.captureContentUpdate(overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Add standard fields onto performance data\r\n * @param data SmePerformanceData to be sent\r\n */\r\n private static fillStandardPerformanceData(data: SmePerformanceData): CompleteSmePerformanceData {\r\n const fullDataPayload: CompleteSmePerformanceData = {\r\n extension: MsftSme.self().Environment.name,\r\n entryPointName: MsftSme.self().Init.entryPointName || '',\r\n url: window.location.pathname,\r\n moduleOpened: false,\r\n totalLoadTime: '',\r\n label: data.label,\r\n sme: {},\r\n resources: {},\r\n navigation: {}\r\n };\r\n // Truncate all decimals to 5 places to avoid cosmos stream from redacting any\r\n // Convert PerformanceNavigationTiming to JSON so we can manipulate it via Object.() methods.\r\n fullDataPayload.totalLoadTime = data.totalLoadTime.toFixed(5);\r\n const timingData = {\r\n 'sme': data.sme || {},\r\n 'resources': data.resources || {},\r\n 'navigation': data.navigation ? data.navigation.toJSON() : {}\r\n };\r\n\r\n for (const [sourceKey, sourceVal] of Object.entries(timingData)) {\r\n for (const [resourceKey, resourceVal] of Object.entries(sourceVal)) {\r\n // navigation has some string-string maps, ignore the string values.\r\n // Convert all numbers back into numbers to preserve types in cosmos stream\r\n if (!MsftSme.isEmpty(sourceVal) && typeof resourceVal === 'number') {\r\n fullDataPayload[sourceKey][resourceKey] = parseFloat(resourceVal.toFixed(7));\r\n }\r\n }\r\n }\r\n\r\n // Set this here if need - often the appLoad times happen before Init is populated,\r\n // so check again to make sure if its actually empty.\r\n if (fullDataPayload.navigation) {\r\n fullDataPayload.entryPointName = MsftSme.self().Init.entryPointName || '';\r\n }\r\n return fullDataPayload;\r\n }\r\n\r\n /**\r\n * Send a content update event. This content update contains an updated sme-specific timings structure with relevant\r\n * performance data under the data field. The original timings data is also contained under the navigation field.\r\n * The structure of the event is such:\r\n * data : { ...,\r\n * \"timings\": {\r\n * \"extension\": [extension-name],\r\n * \"entryPointName\": [entryPointName],\r\n * \"url\": [url-endpoint],\r\n * \"moduleOpened\" : [isModuleOpened],\r\n * \"sme\": {\r\n * [sme-mark] : [mark-timestamps],\r\n * ...\r\n * },\r\n * \"resources\": {\r\n * [resource-endpoint] : [resource-load-complete-timestamps],\r\n * ...\r\n * },\r\n * \"navigation\": {\r\n * [performance-navigation-event]: [navigation-event-timestamps]\r\n * }\r\n * }, ...\r\n * }\r\n * Certain fields are set within this class instead of outside modules since they will always be the same.\r\n * @param dataPayload performance data to be sent through telemetry.\r\n * @param contentOverrides any content overriding behavior wanted in the performance event\r\n */\r\n public static tracePerformanceData(dataPayload: SmePerformanceData, contentOverrides?: any): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Performance,\r\n { performance: dataPayload,\r\n overrideValues: { content: contentOverrides } as IContentUpdateOverrideValues\r\n }\r\n ]);\r\n return;\r\n }\r\n const data = SmeWebTelemetry.fillStandardPerformanceData(dataPayload);\r\n\r\n // A for automatic, performance tracking is done automatically.\r\n const overrideValues: IContentUpdateOverrideValues = {\r\n actionType: TelemetryActionTypes.Automatic,\r\n content: contentOverrides || {}\r\n };\r\n\r\n const customProps = { timings: data, type: TelemetryEventTypes.Performance };\r\n this.telemetryHandler.captureContentUpdate(overrideValues, customProps);\r\n }\r\n\r\n /**\r\n * See tracePerformanceData comments, only difference is moduleOpened is true and the contentOverrides\r\n * @param dataPayload performance data to be sent through telemetry.\r\n */\r\n public static traceModuleOpenPerformance(dataPayload: SmePerformanceData): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.ModuleOpenPerformance, { performance: dataPayload }]);\r\n return;\r\n }\r\n const data = SmeWebTelemetry.fillStandardPerformanceData(dataPayload);\r\n data.moduleOpened = true;\r\n\r\n const overrideValues: IPageViewPerformanceOverrideValues = {\r\n customTiming: JSON.stringify(data)\r\n };\r\n const customProps = { timings: data, type: TelemetryEventTypes.Performance };\r\n\r\n this.telemetryHandler.capturePageViewPerformance(overrideValues, customProps);\r\n }\r\n\r\n /**\r\n * Helper to create event boilerplate for notification\r\n * @param clientNotification Client notification to send event for\r\n */\r\n public static traceClientNotification(clientNotification: RpcNotification): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Notification, { notification: clientNotification }]);\r\n return;\r\n }\r\n const overrideValues: IContentUpdateOverrideValues = {\r\n content: {\r\n message: clientNotification.message,\r\n title: clientNotification.title,\r\n state: NotificationState[clientNotification.state],\r\n contentType: TelemetryEventTypes.Notification\r\n },\r\n // If source is not shell, replace pagename with proper source.\r\n pageName: clientNotification.sourceName ? clientNotification.sourceName : this.nameOfModule\r\n };\r\n this.traceContentUpdate(overrideValues, { type: TelemetryEventTypes.Notification });\r\n }\r\n\r\n /**\r\n * Helper function to assign a command to an id in a multi-step workitem process\r\n * @param id The ID of the powershell session to assign\r\n * @param command The command to assign to the session ID\r\n */\r\n public static addPowershellId(id: string, command: PowerShellCommand) {\r\n this.powershellIdMap[id] = command;\r\n }\r\n\r\n /**\r\n * Helper function to assign a command to an id in a multi-step workitem process\r\n * @param id The ID of the powershell session to assign\r\n * @param command The command to assign to the session ID\r\n */\r\n public static removePowershellId(id: string) {\r\n delete this.powershellIdMap[id];\r\n }\r\n\r\n\r\n /**\r\n * Helper to create event boilerplate for powershell event. In the case where command is not available,\r\n * use an ID (usually ps session ID, which may correlate with work item id)\r\n * This is only used to track ERROR messages.\r\n * @param command Powershell Command\r\n * @param state State of powershell event (start/end/etc)\r\n * @param details Optional details object - see interface for more detail.\r\n */\r\n public static tracePowershellEvent(command: PowerShellCommand, state: TelemetryEventStates, details?: PowershellDetails ): void {\r\n const id = details ? details.id : null;\r\n const response = details ? details.response : null;\r\n const psCommand = command ? command : this.powershellIdMap[id];\r\n\r\n // Ignore any events that are either null or un-named PS commands.\r\n if ((psCommand && !psCommand.command) || !psCommand) {\r\n return;\r\n }\r\n\r\n // If state is not started and id is provided, remove the ID from the map to save space.\r\n if (state !== TelemetryEventStates.Started && id) {\r\n this.removePowershellId(id);\r\n }\r\n\r\n const psContent = {psCommand: psCommand.command, state: state, otherData: details && details.otherData ? details.otherData : {}};\r\n const sourceName = psCommand.module ? psCommand.module.toLowerCase() : this.nameOfModule;\r\n if (response && response.error) {\r\n psContent['errorCodes'] = [response.error.code];\r\n } else if (response && response.errors) {\r\n psContent['errorCodes'] = response.errors.map((e) => e.errorType);\r\n psContent.otherData['hResult'] = response.errors.map((e) => e.detailRecord && e.detailRecord.hResult);\r\n }\r\n SmeWebTelemetry.traceAction(null, {content: psContent, pageName: sourceName},\r\n {type: TelemetryEventTypes.Powershell});\r\n }\r\n\r\n /**\r\n * Helper to create event boilerplate for powershell batch event. Batch doesn't deal with work items, so\r\n * we can ignore the ID and sourceName handling that the above function handles.\r\n * @param commands Powershell Commands List in properties stringified form. PS Batch events places PS command into a\r\n * '{properties: PSCommand }' string structure.\r\n * @param state State of powershell event (start/end/etc)\r\n * @param details Optional details object contains various optional fields in powershell event.\r\n * @returns\r\n */\r\n public static tracePowershellBatchEvent(commands: string[], state: TelemetryEventStates, details?: PowershellDetails ) {\r\n // check that at least one command is valid\r\n if (!commands || commands.length === 0) {\r\n return;\r\n }\r\n\r\n let parsedCommands: string[] = [];\r\n parsedCommands = commands.reduce((commandList, currentCommand) => {\r\n if (currentCommand) {\r\n const parsedCommand = JSON.parse(currentCommand).properties.command;\r\n if (parsedCommand) {\r\n commandList.push(parsedCommand);\r\n }\r\n return commandList;\r\n }\r\n }, parsedCommands);\r\n\r\n\r\n const response = details ? details.response : null;\r\n\r\n const psContent = {psCommands: parsedCommands, state: state, otherData: details && details.otherData ? details.otherData : {}};\r\n\r\n if (response && response.error) {\r\n psContent['errorCodes'] = [response.error.code];\r\n } else if (response && response.errors) {\r\n psContent['errorCodes'] = response.errors.map((e) => e.errorType);\r\n psContent.otherData['hResult'] = response.errors.map((e) => e.detailRecord && e.detailRecord.hResult);\r\n }\r\n SmeWebTelemetry.traceAction(null, {content: psContent},\r\n {type: TelemetryEventTypes.Powershell});\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../packages/core/diagnostics/sme-web-telemetry.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,oFAAoF;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAC7H,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAQH,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AC,CAAC;IAChD,CAAC;;AA/iBc,4BAAY,GAA4C,EAAE,CAAC;AAC3D,gCAAgB,GAAG,IAAI,CAAC;AAExB,wBAAQ,GAAG,MAAM,CAAC;AAElB,8BAAc,GAAG,KAAK,CAAC;AACvB,wBAAQ,GAA4B,EAAE,CAAC;AACvC,+BAAe,GAAsC,EAAE,CAAC;AACxD,sBAAM,GAAG,IAAI,CAAC;AAM7B,iDAAiD;AACjD,oEAAoE;AACpE,iFAAiF;AACjF,oGAAoG;AACpG,iEAAiE;AAClD,6CAA6B,GAAG,4EAA4E,CAAC;AAE5H;;GAEG;AACY,8BAAc,GAAG,EAAE,CAAC","file":"sme-web-telemetry.js","sourcesContent":["// 1DS documentation found at\r\n// https://1dsdocs.azurewebsites.net/getting-started/javascript-getting_started.html\r\n\r\nimport { Meta } from '@angular/platform-browser';\r\nimport { EMPTY, Observable } from 'rxjs';\r\nimport { delay, retryWhen, shareReplay, take, tap } from 'rxjs/operators';\r\nimport { AppContext } from '../data/app-context';\r\nimport { PowerShellCommand } from '../data/powershell';\r\nimport { NotificationState } from '../notification/notification-state';\r\nimport { RpcNotification } from '../rpc/notification/rpc-notification-model';\r\nimport { GatewayInstallationType, GatewayMode, GatewayOperationalMode } from '../shared/gateway-inventory/gateway-inventory';\r\nimport { Logging } from './logging';\r\nimport {\r\n CompleteSmePerformanceData,\r\n IContentUpdateOverrideValues,\r\n IPageActionOverrideValues,\r\n IPageViewOverrideValues,\r\n IPageViewPerformanceOverrideValues,\r\n LighthousePerformanceMetrics,\r\n PowershellDetails,\r\n SmeMetaLabels,\r\n SmePerformanceData,\r\n TelemetryActionTypes,\r\n TelemetryEventBody,\r\n TelemetryEvents,\r\n TelemetryEventStates,\r\n TelemetryEventTypes\r\n} from './sme-web-telemetry-models';\r\n\r\n// placeholder for the oneDS type, introduced when we load script.\r\ndeclare var oneDS: any;\r\n\r\nexport class SmeWebTelemetry {\r\n\r\n /**\r\n * The source name to use when logging about this service.\r\n */\r\n private static get logSourceName() {\r\n return 'WebTelemetry';\r\n }\r\n /**\r\n * Gets the name of current shell or module.\r\n */\r\n private static get nameOfModule(): string {\r\n return MsftSme.self().Init.moduleName ? MsftSme.self().Init.moduleName : SmeWebTelemetry.testMode;\r\n }\r\n\r\n private static get backlogHasSpace(): boolean {\r\n return this.eventBacklog.length < 50;\r\n }\r\n\r\n private static eventBacklog: [TelemetryEvents, TelemetryEventBody][] = [];\r\n private static telemetryHandler = null;\r\n\r\n private static testMode = 'test';\r\n private static metaService: Meta;\r\n private static rpcInitAlready = false;\r\n private static metaTags: {[tag: string]: string} = {};\r\n private static powershellIdMap: {[id: string]: PowerShellCommand} = {};\r\n private static isProd = true;\r\n\r\n public static get isProduction() {\r\n return this.isProd;\r\n }\r\n\r\n // AppId/Tenant Token provided by MarTech support\r\n // AppId is not used, but it will be mapped to later in the pipeline\r\n // Full keys are JS:WindowsAdminCenter and o:f78e2b7c9ae4461399c360160d82dcfc for\r\n // AppId/Tenant token respectively. In Cosmos, only the initial portion of the tenant token is used.\r\n // private static windowsAdminCenterAppId = 'WindowsAdminCenter';\r\n private static windowsAdminCenterTenantToken = 'f78e2b7c9ae4461399c360160d82dcfc-9371288c-a1b9-4fdc-a196-0340fc5f9880-7071';\r\n\r\n /**\r\n * Map of module versions used in this instance of web telemetry - memoize values here.\r\n */\r\n private static moduleVersions = {};\r\n\r\n /**\r\n * Get the list of module versions for use in telemetry where the event is sent via RPC to shell\r\n * from the actual module the event is called in.\r\n * @returns list of module mappings to versions\r\n */\r\n private static getModuleVersion(moduleName: string): string {\r\n if (this.moduleVersions[moduleName]) {\r\n return this.moduleVersions[moduleName];\r\n }\r\n const environment = MsftSme.self().Environment;\r\n const moduleObject = environment.modules.find((module) => {\r\n return module.name === moduleName;\r\n });\r\n const version = moduleObject ? moduleObject.version : 'N/A';\r\n this.moduleVersions[moduleName] = version;\r\n return version;\r\n }\r\n\r\n /**\r\n * Send any manual events that were triggered prior to telemetry initializing.\r\n */\r\n private static sendBacklogEvents(): void {\r\n this.eventBacklog.forEach(([type, body]: [TelemetryEvents, TelemetryEventBody]) => {\r\n switch (type) {\r\n case TelemetryEvents.Performance: {\r\n const overrideVals = body.overrideValues as IContentUpdateOverrideValues;\r\n this.tracePerformanceData(body.performance, overrideVals ? overrideVals.content : null);\r\n break;\r\n }\r\n case TelemetryEvents.Lighthouse: {\r\n this.traceLighthouseData(body.lighthouse, body.overrideValues as IContentUpdateOverrideValues);\r\n break;\r\n }\r\n case TelemetryEvents.ModuleOpenPerformance: this.traceModuleOpenPerformance(body.performance); break;\r\n case TelemetryEvents.Action: {\r\n const overrideVals = body.overrideValues as IPageActionOverrideValues;\r\n this.traceAction(body.element, overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.ContentUpdate: {\r\n const overrideVals = body.overrideValues as IContentUpdateOverrideValues;\r\n this.traceContentUpdate(overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.PageView: {\r\n const overrideVals = body.overrideValues as IPageViewOverrideValues;\r\n this.tracePageView(overrideVals, body.customProperties);\r\n break;\r\n }\r\n case TelemetryEvents.Notification: this.traceClientNotification(body.notification); break;\r\n default: return;\r\n }\r\n });\r\n this.eventBacklog = [];\r\n }\r\n\r\n /**\r\n * Helper to combine setting metaTags, initialize handler, and\r\n * send any telemetry events that occurred prior to initialization\r\n */\r\n private static configureAndInitTelemetry(): void {\r\n this.setMetaInDom();\r\n this.initTelemetryHandler().subscribe(\r\n () => { this.sendBacklogEvents(); },\r\n (error: Error) => {\r\n Logging.logError(this.logSourceName, '{0}: {1}'.format(error.name, error.message));\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Helper function to set metaTags in DOM\r\n */\r\n private static setMetaInDom(): void {\r\n for (const [key, value] of Object.entries(this.metaTags)) {\r\n this.metaService.updateTag({name: `awa-${key}`, content: value});\r\n }\r\n }\r\n\r\n /**\r\n * Update Metatags and/or initialize telemetry, depending on whether rpc message came before or after app-context init.\r\n * @param newMetaTags Primarily contains WAC-Session-Id & extension-version, received from RPC message\r\n */\r\n public static updateFromRpcInit(newMetaTags: {[tag: string]: string}): void {\r\n // All the fields will be updated at the same time here, checking one (wac-session-id is the main one) is enough for the check\r\n const shouldInitHere = SmeMetaLabels.SessionId in this.metaTags\r\n && this.metaTags[SmeMetaLabels.SessionId] === 'N/A';\r\n this.rpcInitAlready = true;\r\n MsftSme.deepAssign(this.metaTags, newMetaTags);\r\n\r\n // If metaTags contains session ID but it's N/A (ie initial init was called already), call the init. If not,\r\n // just wait for normal init to be called in app-context. Depending on timing RPC update can happen before or after.\r\n if (shouldInitHere) {\r\n this.configureAndInitTelemetry();\r\n }\r\n }\r\n\r\n /**\r\n * Load 1DS if does not already exist\r\n * @param appContext App context currently being used\r\n */\r\n public static init(appContext: AppContext): Observable<boolean> {\r\n if (this.telemetryHandler) {\r\n return EMPTY;\r\n }\r\n\r\n this.metaService = new Meta(document);\r\n // Set fields we don't need gateway for, if connection to gateway fails, initialize telemetry with limited fields\r\n this.metaTags[SmeMetaLabels.Language] = MsftSme.self().Resources.localeId;\r\n this.metaTags[SmeMetaLabels.Market] = MsftSme.self().Resources.localeId;\r\n this.metaTags[SmeMetaLabels.IsProduction] = MsftSme.self().Init.isProduction.toString();\r\n this.metaTags[SmeMetaLabels.Environment] = MsftSme.self().Init.isProduction.toString();\r\n this.metaTags[SmeMetaLabels.ExtensionVersion] = MsftSme.self().Environment.version;\r\n this.metaTags[SmeMetaLabels.SessionId] = MsftSme.sessionId();\r\n // Instantiate these initially so they aren't empty values\r\n this.metaTags[SmeMetaLabels.InstallationType] = 'N/A';\r\n this.metaTags[SmeMetaLabels.Build] = 'N/A';\r\n this.metaTags[SmeMetaLabels.GatewayMode] = GatewayMode[MsftSme.self().Init.mode];\r\n this.metaTags[SmeMetaLabels.GatewayOperationalMode] = 'N/A';\r\n this.isProd = MsftSme.self().Init.isProduction;\r\n return appContext.gateway.getStatus()\r\n .pipe(\r\n retryWhen(errors => {\r\n let gatewayRetries = 2;\r\n return errors.pipe(\r\n delay(1000),\r\n tap((error) => {\r\n if (gatewayRetries === 0) {\r\n throw error;\r\n }\r\n Logging.logDebug(this.logSourceName, 'Attempting to query gateway again...');\r\n gatewayRetries--;\r\n })\r\n );\r\n }),\r\n take(1),\r\n tap((status: any) => {\r\n this.isProd = this.isProd\r\n && GatewayOperationalMode[<string>status.gatewayOperationalMode] !== GatewayOperationalMode.Development;\r\n\r\n this.metaTags[SmeMetaLabels.InstallationType] = status.installationType || GatewayInstallationType.Standard;\r\n this.metaTags[SmeMetaLabels.Build] = status.gatewayVersion;\r\n this.metaTags[SmeMetaLabels.GatewayMode] = GatewayMode[status.gatewayMode];\r\n this.metaTags[SmeMetaLabels.GatewayOperationalMode] = GatewayOperationalMode[status.gatewayOperationalMode];\r\n this.metaTags[SmeMetaLabels.IsProduction] = this.isProd.toString();\r\n this.metaTags[SmeMetaLabels.Environment] = this.isProd.toString();\r\n // If not shell, handle in RPC handler, because some fields will init after 1DS inits\r\n // If rpc handler has happened already, go ahead with this\r\n if (MsftSme.isShell() || this.rpcInitAlready) {\r\n this.configureAndInitTelemetry();\r\n }\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Set config and initialize telemetry library handler\r\n */\r\n private static initTelemetryHandler(): Observable<void> {\r\n const observable = Observable.create(observer => {\r\n const script: HTMLScriptElement = document.createElement('script');\r\n script.type = 'text/javascript';\r\n script.src = MsftSme.self().Environment.configuration.telemetry.sourceLibraryCdnLink;\r\n script.integrity = MsftSme.self().Environment.configuration.telemetry.sourceLibraryCdnIntegrityHash;\r\n script.crossOrigin = 'anonymous';\r\n script.async = true;\r\n\r\n script.onload = () => {\r\n this.telemetryHandler = new oneDS.ApplicationInsights();\r\n const entryType: string = MsftSme.self().Init.entryPointType;\r\n const entryName: string = MsftSme.self().Init.entryPointName;\r\n\r\n const config = {\r\n instrumentationKey: this.windowsAdminCenterTenantToken,\r\n // post channel configuration\r\n channelConfiguration: {\r\n eventsLimitInMem: 50\r\n },\r\n // Properties Plugin configuration\r\n propertyConfiguration: {\r\n userAgent: 'Windows Admin Center',\r\n sessionAsGuid: true\r\n },\r\n // Web Analytics Plugin configuration\r\n webAnalyticsConfiguration: {\r\n autoCapture: {\r\n scroll: false,\r\n pageView: true,\r\n onLoad: false,\r\n onUnload: true,\r\n click: true,\r\n resize: true,\r\n jsError: true,\r\n lineage: true\r\n },\r\n coreData: {\r\n pageName: this.nameOfModule,\r\n // to prevent personal data from being sent in URI\r\n referrerUri: 'windows.admin.center',\r\n requestUri: 'windows.admin.center',\r\n pageTags: {\r\n entryPointName: entryName || '',\r\n entryPointType: entryType || ''\r\n }\r\n },\r\n useShortNameForContentBlob: false\r\n }\r\n };\r\n this.telemetryHandler.initialize(config, []);\r\n this.telemetryHandler.addTelemetryInitializer((event: any) => {\r\n // If we send an event that originates from a different module (eg notifications in shell)\r\n // change the extension version to match module\r\n if (event.baseData.name !== this.nameOfModule) {\r\n event.baseData.properties.pageTags.metaTags[SmeMetaLabels.ExtensionVersion] =\r\n this.getModuleVersion(event.baseData.name);\r\n }\r\n event.baseData.properties.pageTags.screenResolution = {availableHeight: window.screen.availHeight,\r\n availableWidth: window.screen.availWidth};\r\n event.baseData.properties.pageTags.frameDetails = {height: window.innerHeight, width: window.innerWidth};\r\n\r\n });\r\n observer.next();\r\n observer.complete();\r\n };\r\n script.onerror = () => {\r\n script.remove();\r\n observer.error(new Error('1DS Script could not be loaded'));\r\n };\r\n document.body.appendChild(script);\r\n }).pipe(shareReplay(1));\r\n return observable;\r\n }\r\n\r\n /**\r\n * Send a Page-Action event through Web Telemetry.\r\n * @param element Element action is being executed on\r\n * @param overrideValues Various values to override within default Web Telemetry page action fields, see Web Telemetry documentation.\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static traceAction(element: Element, overrideValues?: IPageActionOverrideValues, properties?: {[name: string]: any}): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Action, { element: element, overrideValues: overrideValues,\r\n customProperties: properties }]);\r\n return;\r\n }\r\n if (!overrideValues.actionType) {\r\n overrideValues.actionType = TelemetryActionTypes.Automatic;\r\n }\r\n this.telemetryHandler.capturePageAction(element, overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Send a Page-View event through Web Telemetry.\r\n * @param overrideValues Various values to override within default Web Telemetry page view fields, see Web Telemetry documentation.\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static tracePageView(overrideValues: IPageViewOverrideValues, properties?: { [name: string]: any }): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.PageView, { overrideValues: overrideValues }]);\r\n return;\r\n }\r\n this.telemetryHandler.capturePageView(overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Send a Content-Update event through Web Telemetry.\r\n * @param overrideValues Various values to override within default Web Telemetry content update fields, see Web Telemetry documentation\r\n * @param properties Extra properties in an index signature. These are placed under the data field in partC data.\r\n */\r\n public static traceContentUpdate(overrideValues: IContentUpdateOverrideValues, properties?: { [name: string]: any }): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.ContentUpdate, { overrideValues: overrideValues, customProperties: properties }]);\r\n return;\r\n }\r\n if (!overrideValues.actionType) {\r\n overrideValues.actionType = TelemetryActionTypes.Automatic;\r\n }\r\n this.telemetryHandler.captureContentUpdate(overrideValues, properties);\r\n }\r\n\r\n /**\r\n * Add standard fields onto performance data\r\n * @param data SmePerformanceData to be sent\r\n */\r\n private static fillStandardPerformanceData(data: SmePerformanceData): CompleteSmePerformanceData {\r\n const fullDataPayload: CompleteSmePerformanceData = {\r\n extension: MsftSme.self().Environment.name,\r\n entryPointName: MsftSme.self().Init.entryPointName || '',\r\n url: window.location.pathname,\r\n moduleOpened: false,\r\n totalLoadTime: '',\r\n label: data.label,\r\n sme: {},\r\n resources: {},\r\n navigation: {}\r\n };\r\n // Truncate all decimals to 5 places to avoid cosmos stream from redacting any\r\n // Convert PerformanceNavigationTiming to JSON so we can manipulate it via Object.() methods.\r\n fullDataPayload.totalLoadTime = data.totalLoadTime.toFixed(5);\r\n const timingData = {\r\n 'sme': data.sme || {},\r\n 'resources': data.resources || {},\r\n 'navigation': data.navigation ? data.navigation.toJSON() : {}\r\n };\r\n\r\n for (const [sourceKey, sourceVal] of Object.entries(timingData)) {\r\n for (const [resourceKey, resourceVal] of Object.entries(sourceVal)) {\r\n // navigation has some string-string maps, ignore the string values.\r\n // Convert all numbers back into numbers to preserve types in cosmos stream\r\n if (!MsftSme.isEmpty(sourceVal) && typeof resourceVal === 'number') {\r\n fullDataPayload[sourceKey][resourceKey] = parseFloat(resourceVal.toFixed(7));\r\n }\r\n }\r\n }\r\n\r\n // Set this here if need - often the appLoad times happen before Init is populated,\r\n // so check again to make sure if its actually empty.\r\n if (fullDataPayload.navigation) {\r\n fullDataPayload.entryPointName = MsftSme.self().Init.entryPointName || '';\r\n }\r\n return fullDataPayload;\r\n }\r\n\r\n /**\r\n * Send a content update event. This content update contains an updated sme-specific timings structure with relevant\r\n * performance data under the data field. The original timings data is also contained under the navigation field.\r\n * The structure of the event is such:\r\n * data : { ...,\r\n * \"timings\": {\r\n * \"extension\": [extension-name],\r\n * \"entryPointName\": [entryPointName],\r\n * \"url\": [url-endpoint],\r\n * \"moduleOpened\" : [isModuleOpened],\r\n * \"sme\": {\r\n * [sme-mark] : [mark-timestamps],\r\n * ...\r\n * },\r\n * \"resources\": {\r\n * [resource-endpoint] : [resource-load-complete-timestamps],\r\n * ...\r\n * },\r\n * \"navigation\": {\r\n * [performance-navigation-event]: [navigation-event-timestamps]\r\n * }\r\n * }, ...\r\n * }\r\n * Certain fields are set within this class instead of outside modules since they will always be the same.\r\n * @param dataPayload performance data to be sent through telemetry.\r\n * @param contentOverrides any content overriding behavior wanted in the performance event\r\n */\r\n public static tracePerformanceData(dataPayload: SmePerformanceData, contentOverrides?: any): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Performance,\r\n { performance: dataPayload,\r\n overrideValues: { content: contentOverrides } as IContentUpdateOverrideValues\r\n }\r\n ]);\r\n return;\r\n }\r\n const data = SmeWebTelemetry.fillStandardPerformanceData(dataPayload);\r\n\r\n // A for automatic, performance tracking is done automatically.\r\n const overrideValues: IContentUpdateOverrideValues = {\r\n actionType: TelemetryActionTypes.Automatic,\r\n content: contentOverrides || dataPayload\r\n };\r\n\r\n const customProps = { timings: data, type: TelemetryEventTypes.Performance };\r\n this.telemetryHandler.captureContentUpdate(overrideValues, customProps);\r\n }\r\n\r\n /**\r\n * Send a content update event - this event will contain timings for lighthouse calculation in the backend\r\n * This can potentially be sent a couple times with overlapping data for one page load event, depending\r\n * on when the TTI is calculated. In this scenario, it will be handled on the backend.\r\n * @param dataPayload Lighthouse data\r\n * @param contentOverrides any content overriding behavior wanted in the performance event\r\n */\r\n public static traceLighthouseData(dataPayload: LighthousePerformanceMetrics, contentOverrides?: any,\r\n properties?: { [name: string]: any }): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Lighthouse,\r\n { lighthouse: dataPayload,\r\n overrideValues: { content: contentOverrides } as IContentUpdateOverrideValues\r\n }]);\r\n return;\r\n }\r\n\r\n const overrideValues: IContentUpdateOverrideValues = {\r\n actionType: TelemetryActionTypes.Automatic,\r\n content: contentOverrides || dataPayload\r\n };\r\n\r\n const customProps = { timings: dataPayload, type: TelemetryEventTypes.Lighthouse };\r\n MsftSme.deepAssign(customProps, properties);\r\n this.telemetryHandler.captureContentUpdate(overrideValues, customProps);\r\n }\r\n\r\n /**\r\n * See tracePerformanceData comments, only difference is moduleOpened is true and the contentOverrides\r\n * @param dataPayload performance data to be sent through telemetry.\r\n */\r\n public static traceModuleOpenPerformance(dataPayload: SmePerformanceData): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.ModuleOpenPerformance, { performance: dataPayload }]);\r\n return;\r\n }\r\n const data = SmeWebTelemetry.fillStandardPerformanceData(dataPayload);\r\n data.moduleOpened = true;\r\n\r\n const overrideValues: IPageViewPerformanceOverrideValues = {\r\n customTiming: JSON.stringify(data)\r\n };\r\n const customProps = { timings: data, type: TelemetryEventTypes.Performance };\r\n\r\n this.telemetryHandler.capturePageViewPerformance(overrideValues, customProps);\r\n }\r\n\r\n /**\r\n * Helper to create event boilerplate for notification\r\n * @param clientNotification Client notification to send event for\r\n */\r\n public static traceClientNotification(clientNotification: RpcNotification): void {\r\n if (!this.telemetryHandler && this.backlogHasSpace) {\r\n this.eventBacklog.push([TelemetryEvents.Notification, { notification: clientNotification }]);\r\n return;\r\n }\r\n const overrideValues: IContentUpdateOverrideValues = {\r\n content: {\r\n message: clientNotification.message,\r\n title: clientNotification.title,\r\n state: NotificationState[clientNotification.state],\r\n contentType: TelemetryEventTypes.Notification\r\n },\r\n // If source is not shell, replace pagename with proper source.\r\n pageName: clientNotification.sourceName ? clientNotification.sourceName : this.nameOfModule\r\n };\r\n this.traceContentUpdate(overrideValues, { type: TelemetryEventTypes.Notification });\r\n }\r\n\r\n /**\r\n * Helper function to assign a command to an id in a multi-step workitem process\r\n * @param id The ID of the powershell session to assign\r\n * @param command The command to assign to the session ID\r\n */\r\n public static addPowershellId(id: string, command: PowerShellCommand) {\r\n this.powershellIdMap[id] = command;\r\n }\r\n\r\n /**\r\n * Helper function to assign a command to an id in a multi-step workitem process\r\n * @param id The ID of the powershell session to assign\r\n * @param command The command to assign to the session ID\r\n */\r\n public static removePowershellId(id: string) {\r\n delete this.powershellIdMap[id];\r\n }\r\n\r\n /**\r\n * Helper to create event boilerplate for powershell event. In the case where command is not available,\r\n * use an ID (usually ps session ID, which may correlate with work item id)\r\n * This is only used to track ERROR messages.\r\n * @param command Powershell Command\r\n * @param state State of powershell event (start/end/etc)\r\n * @param details Optional details object - see interface for more detail.\r\n */\r\n public static tracePowershellEvent(command: PowerShellCommand, state: TelemetryEventStates, details?: PowershellDetails ): void {\r\n const id = details ? details.id : null;\r\n const response = details ? details.response : null;\r\n const psCommand = command ? command : this.powershellIdMap[id];\r\n\r\n // Ignore any events that are either null or un-named PS commands.\r\n if ((psCommand && !psCommand.command) || !psCommand) {\r\n return;\r\n }\r\n\r\n // If state is not started and id is provided, remove the ID from the map to save space.\r\n if (state !== TelemetryEventStates.Started && id) {\r\n this.removePowershellId(id);\r\n }\r\n\r\n const psContent = {psCommand: psCommand.command, state: state, psModule: psCommand.module,\r\n otherData: details && details.otherData ? details.otherData : {}};\r\n const sourceName = this.nameOfModule;\r\n if (response && response.error) {\r\n psContent['errorCodes'] = [response.error.code];\r\n } else if (response && response.errors) {\r\n psContent['errorCodes'] = response.errors.map((e) => e.errorType);\r\n psContent.otherData['hResult'] = response.errors.map((e) => e.detailRecord && e.detailRecord.hResult);\r\n }\r\n SmeWebTelemetry.traceAction(null, {content: psContent, pageName: sourceName},\r\n {type: TelemetryEventTypes.Powershell});\r\n }\r\n\r\n /**\r\n * Helper to create event boilerplate for powershell batch event. Batch doesn't deal with work items, so\r\n * we can ignore the ID and sourceName handling that the above function handles.\r\n * @param commands Powershell Commands List in properties stringified form. PS Batch events places PS command into a\r\n * '{properties: PSCommand }' string structure.\r\n * @param state State of powershell event (start/end/etc)\r\n * @param details Optional details object contains various optional fields in powershell event.\r\n * @returns\r\n */\r\n public static tracePowershellBatchEvent(commands: string[], state: TelemetryEventStates, details?: PowershellDetails ) {\r\n // check that at least one command is valid\r\n if (!commands || commands.length === 0) {\r\n return;\r\n }\r\n\r\n let parsedCommands: string[] = [];\r\n parsedCommands = commands.reduce((commandList, currentCommand) => {\r\n if (currentCommand) {\r\n const parsedCommand = JSON.parse(currentCommand).properties.command;\r\n if (parsedCommand) {\r\n commandList.push(parsedCommand);\r\n }\r\n return commandList;\r\n }\r\n }, parsedCommands);\r\n\r\n\r\n const response = details ? details.response : null;\r\n\r\n const psContent = {psCommands: parsedCommands, state: state, otherData: details && details.otherData ? details.otherData : {}};\r\n\r\n if (response && response.error) {\r\n psContent['errorCodes'] = [response.error.code];\r\n } else if (response && response.errors) {\r\n psContent['errorCodes'] = response.errors.map((e) => e.errorType);\r\n psContent.otherData['hResult'] = response.errors.map((e) => e.detailRecord && e.detailRecord.hResult);\r\n }\r\n SmeWebTelemetry.traceAction(null, {content: psContent},\r\n {type: TelemetryEventTypes.Powershell});\r\n }\r\n}\r\n"]}
|
|
@@ -6,6 +6,10 @@ export declare module PowerShellScripts {
|
|
|
6
6
|
const module = "Microsoft.SME.Shell";
|
|
7
7
|
const resourceName = "MsftSmeShell";
|
|
8
8
|
const powerShellPrefix = "WACSH";
|
|
9
|
+
const Get_LanguageMode: {
|
|
10
|
+
command: string;
|
|
11
|
+
script: string;
|
|
12
|
+
};
|
|
9
13
|
const Start_ScheduledReboot: {
|
|
10
14
|
command: string;
|
|
11
15
|
script: string;
|
|
@@ -14,6 +18,10 @@ export declare module PowerShellScripts {
|
|
|
14
18
|
command: string;
|
|
15
19
|
script: string;
|
|
16
20
|
};
|
|
21
|
+
const Install_MMAgent: {
|
|
22
|
+
command: string;
|
|
23
|
+
script: string;
|
|
24
|
+
};
|
|
17
25
|
const Get_CimWin32LogicalDisk: {
|
|
18
26
|
command: string;
|
|
19
27
|
script: string;
|
|
@@ -42,8 +50,4 @@ export declare module PowerShellScripts {
|
|
|
42
50
|
command: string;
|
|
43
51
|
script: string;
|
|
44
52
|
};
|
|
45
|
-
const Install_MMAgent: {
|
|
46
|
-
command: string;
|
|
47
|
-
script: string;
|
|
48
|
-
};
|
|
49
53
|
}
|
|
@@ -9,6 +9,10 @@ export var PowerShellScripts;
|
|
|
9
9
|
PowerShellScripts.module = 'Microsoft.SME.Shell';
|
|
10
10
|
PowerShellScripts.resourceName = 'MsftSmeShell';
|
|
11
11
|
PowerShellScripts.powerShellPrefix = 'WACSH';
|
|
12
|
+
PowerShellScripts.Get_LanguageMode = {
|
|
13
|
+
command: 'Get-LanguageMode',
|
|
14
|
+
script: "##Get-LanguageMode##:Get-LanguageMode.ps1\nenum PSLanguageMode {\nFullLanguage = 0\nRestrictedLanguage = 1\nNoLanguage = 2\nConstrainedLanguage = 3\n}\ntry {\n$result = $ExecutionContext.SessionState.LanguageMode\nreturn [PSLanguageMode]::$result\n}\ncatch {\nif (($_.FullyQualifiedErrorId -eq \"PropertyReferenceNotSupportedInDataSection\") -or ($_.FullyQualifiedErrorId -eq \"VariableReferenceNotSupportedInDataSection\")) {\nreturn [PSLanguageMode]::RestrictedLanguage\n}\nelseif ($_.FullyQualifiedErrorId -eq \"ScriptsNotAllowed\") {\nreturn [PSLanguageMode]::NoLanguage\n}\nelse {\nreturn [PSLanguageMode]::RestrictedLanguage\n}\n}\n"
|
|
15
|
+
};
|
|
12
16
|
PowerShellScripts.Start_ScheduledReboot = {
|
|
13
17
|
command: 'Start-ScheduledReboot',
|
|
14
18
|
script: "##Start-ScheduledReboot##:Start-ScheduledReboot.ps1\nparam (\n[Parameter(Mandatory = $true)]\n[bool]$restartlater,\n[Parameter(Mandatory = $false)]\n[String]$restartTime,\n[Parameter(Mandatory = $false)]\n[String]$restartReason,\n[Parameter(Mandatory = $false)]\n[System.Int16]$reasonNumberMajor,\n[Parameter(Mandatory = $false)]\n[System.Int16]$reasonNumberMinor\n)\n$waitTime = 5\nif ($restartlater -and -not($restartTime)) {\n$waitTime = 30\n} elseif ($restartTime) {\n$waitTime = [decimal]::round(((Get-Date $restartTime) - (Get-Date)).TotalSeconds);\nif ($waitTime -gt (315360000 - 30)) {\nTHROW \"Invalid restart time $restartTime. The valid range is 0-315360000s (10 years), with a default of 30\"\n}\n}\nif ($waitTime -lt 5 ) {\n$waitTime = 5\n}\n$command = \"Shutdown /r /t $waitTime\"\nif ($restartReason -and ($reasonNumberMajor -ne $null) -and ($reasonNumberMinor -ne $null)) {\n$command += \" /d ${restartReason}:${reasonNumberMajor}:${reasonNumberMinor}\"\n}\nInvoke-Expression -Command $command\n"
|
|
@@ -17,6 +21,10 @@ export var PowerShellScripts;
|
|
|
17
21
|
command: 'Stop-Reboot',
|
|
18
22
|
script: "##Stop-Reboot##:Stop-Reboot.ps1\n$command = \"Shutdown /a\"\nInvoke-Expression -Command $command\n"
|
|
19
23
|
};
|
|
24
|
+
PowerShellScripts.Install_MMAgent = {
|
|
25
|
+
command: 'Install-MMAgent',
|
|
26
|
+
script: "##Install-MMAgent##:Install-MMAgent.ps1\nparam(\n[Parameter(Mandatory = $true)]\n[String]\n$workspaceId,\n[Parameter(Mandatory = $true)]\n[String]\n$workspacePrimaryKey,\n[Parameter(Mandatory = $true)]\n[String]\n$taskName\n)\n$Script = @\u0027\n$mmaExe = Join-Path -Path $env:temp -ChildPath \u0027MMASetup-AMD64.exe\u0027\nif (Test-Path $mmaExe) {\nRemove-Item $mmaExe\n}\nInvoke-WebRequest -Uri https://go.microsoft.com/fwlink/?LinkId=828603 -OutFile $mmaExe\n$extractFolder = Join-Path -Path $env:temp -ChildPath \u0027SmeMMAInstaller\u0027\nif (Test-Path $extractFolder) {\nRemove-Item $extractFolder -Force -Recurse\n}\n\u0026$mmaExe /c /t:$extractFolder\n$setupExe = Join-Path -Path $extractFolder -ChildPath \u0027setup.exe\u0027\nfor ($i=1; $i -le 10; $i++) {\nif(-Not(Test-Path $setupExe)) {\nsleep -s 6\n}\n}\n\u0026$setupExe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_AZURE_CLOUD_TYPE=0 OPINSIGHTS_WORKSPACE_ID=$workspaceId OPINSIGHTS_WORKSPACE_KEY=$workspacePrimaryKey AcceptEndUserLicenseAgreement=1\n\u0027@\n$Script = \u0027$workspaceId = \u0027 + \"\u0027$workspaceId\u0027;\" + $Script\n$Script = \u0027$workspacePrimaryKey =\u0027 + \"\u0027$workspacePrimaryKey\u0027;\" + $Script\n$ScriptFile = Join-Path -Path $env:LocalAppData -ChildPath \"$taskName.ps1\"\n$ResultFile = Join-Path -Path $env:temp -ChildPath \"$taskName.log\"\nif (Test-Path $ResultFile) {\nRemove-Item $ResultFile\n}\n$Script | Out-File $ScriptFile\nif (-Not(Test-Path $ScriptFile)) {\n$message = \"Failed to create file:\" + $ScriptFile\nWrite-Error $message\nreturn #If failed to create script file, no need continue just return here\n}\n$User = [Security.Principal.WindowsIdentity]::GetCurrent()\n$Role = (New-Object Security.Principal.WindowsPrincipal $User).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)\n$arg = \"-NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -c $ScriptFile \u003e\u003e $ResultFile 2\u003e\u00261\"\nif(!$Role)\n{\nWrite-Warning \"To perform some operations you must run an elevated Windows PowerShell console.\"\n}\n$Scheduler = New-Object -ComObject Schedule.Service\nfor ($i=1; $i -le 3; $i++)\n{\nTry\n{\n$Scheduler.Connect()\nBreak\n}\nCatch\n{\nif($i -ge 3)\n{\nWrite-EventLog -LogName Application -Source \"SME Register $taskName\" -EntryType Error -EventID 1 -Message \"Can\u0027t connect to Schedule service\"\nWrite-Error \"Can\u0027t connect to Schedule service\" -ErrorAction Stop\n}\nelse\n{\nStart-Sleep -s 1\n}\n}\n}\n$RootFolder = $Scheduler.GetFolder(\"\\\")\nif($RootFolder.GetTasks(0) | Where-Object {$_.Name -eq $TaskName})\n{\nWrite-Debug(\"Deleting existing task\" + $TaskName)\n$RootFolder.DeleteTask($TaskName,0)\n}\n$Task = $Scheduler.NewTask(0)\n$RegistrationInfo = $Task.RegistrationInfo\n$RegistrationInfo.Description = $TaskName\n$RegistrationInfo.Author = $User.Name\n$Triggers = $Task.Triggers\n$Trigger = $Triggers.Create(7) #TASK_TRIGGER_REGISTRATION: Starts the task when the task is registered.\n$Trigger.Enabled = $true\n$Settings = $Task.Settings\n$Settings.Enabled = $True\n$Settings.StartWhenAvailable = $True\n$Settings.Hidden = $False\n$Settings.ExecutionTimeLimit = \"PT20M\" # 20 minutes\n$Action = $Task.Actions.Create(0)\n$Action.Path = \"powershell\"\n$Action.Arguments = $arg\n$Task.Principal.RunLevel = 1\n$RootFolder.RegisterTaskDefinition($TaskName, $Task, 6, \"SYSTEM\", $Null, 1) | Out-Null\n$RootFolder.GetTask($TaskName).Run(0) | Out-Null\nwhile($Scheduler.GetRunningTasks(0) | Where-Object {$_.Name -eq $TaskName})\n{\nStart-Sleep -s 1\n}\n$RootFolder.DeleteTask($TaskName,0)\nRemove-Item $ScriptFile\nif (Test-Path $ResultFile)\n{\nGet-Content -Path $ResultFile | Out-String -Stream\nRemove-Item $ResultFile\n}\n"
|
|
27
|
+
};
|
|
20
28
|
PowerShellScripts.Get_CimWin32LogicalDisk = {
|
|
21
29
|
command: 'Get-CimWin32LogicalDisk',
|
|
22
30
|
script: "##Get-CimWin32LogicalDisk##:Get-CimWin32LogicalDisk.ps1\nimport-module CimCmdlets\nGet-CimInstance -Namespace root/cimv2 -ClassName Win32_LogicalDisk\n"
|
|
@@ -45,10 +53,6 @@ export var PowerShellScripts;
|
|
|
45
53
|
command: 'Get-ServerInventory',
|
|
46
54
|
script: "##Get-ServerInventory##:Get-ServerInventory.ps1\nSet-StrictMode -Version 5.0\nImport-Module CimCmdlets\nImport-Module Storage -ErrorAction SilentlyContinue\nfunction convertOsVersion([string]$osVersion) {\n[Ref]$parsedVersion = $null\nif (![Version]::TryParse($osVersion, $parsedVersion)) {\nreturn $null\n}\n$version = [Version]$parsedVersion.Value\nreturn New-Object Version -ArgumentList $version.Major, $version.Minor\n}\nfunction isCredSSPEnabled() {\nSet-Variable credSSPServicePath -Option Constant -Value \"WSMan:\\localhost\\Service\\Auth\\CredSSP\"\nSet-Variable credSSPClientPath -Option Constant -Value \"WSMan:\\localhost\\Client\\Auth\\CredSSP\"\n$credSSPServerEnabled = $false;\n$credSSPClientEnabled = $false;\n$credSSPServerService = Get-Item $credSSPServicePath -ErrorAction SilentlyContinue\nif ($credSSPServerService) {\n$credSSPServerEnabled = [System.Convert]::ToBoolean($credSSPServerService.Value)\n}\n$credSSPClientService = Get-Item $credSSPClientPath -ErrorAction SilentlyContinue\nif ($credSSPClientService) {\n$credSSPClientEnabled = [System.Convert]::ToBoolean($credSSPClientService.Value)\n}\nreturn ($credSSPServerEnabled -or $credSSPClientEnabled)\n}\nfunction isHyperVRoleInstalled() {\n$vmmsService = Get-Service -Name \"VMMS\" -ErrorAction SilentlyContinue\nreturn $vmmsService -and $vmmsService.Name -eq \"VMMS\"\n}\nfunction isHyperVPowerShellSupportInstalled() {\nreturn !!(Get-Module -ListAvailable Hyper-V -ErrorAction SilentlyContinue)\n}\nfunction isWMF5Installed([string] $operatingSystemVersion) {\nSet-Variable Server2016 -Option Constant -Value (New-Object Version \u002710.0\u0027) # And Windows 10 client SKUs\nSet-Variable Server2012 -Option Constant -Value (New-Object Version \u00276.2\u0027)\n$version = convertOsVersion $operatingSystemVersion\nif (-not $version) {\nreturn $false\n}\nif ($version -ge $Server2016) {\nreturn $true\n}\nelse {\nif ($version -ge $Server2012) {\n$registryKey = \u0027HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine\u0027\n$registryKeyValue = Get-ItemProperty -Path $registryKey -Name PowerShellVersion -ErrorAction SilentlyContinue\nif ($registryKeyValue -and ($registryKeyValue.PowerShellVersion.Length -ne 0)) {\n$installedWmfVersion = [Version]$registryKeyValue.PowerShellVersion\nif ($installedWmfVersion -ge [Version]\u00275.0\u0027) {\nreturn $true\n}\n}\n}\n}\nreturn $false\n}\nfunction isUserAnAdministrator() {\nreturn ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] \"Administrator\")\n}\nfunction getClusterInformation() {\n$returnValues = @{ }\n$returnValues.IsS2dEnabled = $false\n$returnValues.IsCluster = $false\n$returnValues.ClusterFqdn = $null\n$returnValues.IsBritannicaEnabled = $false\n$namespace = Get-CimInstance -Namespace root/MSCluster -ClassName __NAMESPACE -ErrorAction SilentlyContinue\nif ($namespace) {\n$cluster = Get-CimInstance -Namespace root/MSCluster -ClassName MSCluster_Cluster -ErrorAction SilentlyContinue\nif ($cluster) {\n$returnValues.IsCluster = $true\n$returnValues.ClusterFqdn = $cluster.Fqdn\n$returnValues.IsS2dEnabled = !!(Get-Member -InputObject $cluster -Name \"S2DEnabled\") -and ($cluster.S2DEnabled -gt 0)\n$returnValues.IsBritannicaEnabled = $null -ne (Get-CimInstance -Namespace root/sddc/management -ClassName SDDC_Cluster -ErrorAction SilentlyContinue)\n}\n}\nreturn $returnValues\n}\nfunction getComputerFqdnAndAddress($computerName) {\n$hostEntry = [System.Net.Dns]::GetHostEntry($computerName)\n$addressList = @()\nforeach ($item in $hostEntry.AddressList) {\n$address = New-Object PSObject\n$address | Add-Member -MemberType NoteProperty -Name \u0027IpAddress\u0027 -Value $item.ToString()\n$address | Add-Member -MemberType NoteProperty -Name \u0027AddressFamily\u0027 -Value $item.AddressFamily.ToString()\n$addressList += $address\n}\n$result = New-Object PSObject\n$result | Add-Member -MemberType NoteProperty -Name \u0027Fqdn\u0027 -Value $hostEntry.HostName\n$result | Add-Member -MemberType NoteProperty -Name \u0027AddressList\u0027 -Value $addressList\nreturn $result\n}\nfunction getHostFqdnAndAddress($computerSystem) {\n$computerName = $computerSystem.DNSHostName\nif (!$computerName) {\n$computerName = $computerSystem.Name\n}\nreturn getComputerFqdnAndAddress $computerName\n}\nfunction getManagementToolsSupportInformation() {\n$returnValues = @{ }\n$returnValues.ManagementToolsAvailable = $false\n$returnValues.ServerManagerAvailable = $false\n$namespaces = Get-CimInstance -Namespace root/microsoft/windows -ClassName __NAMESPACE -ErrorAction SilentlyContinue\nif ($namespaces) {\n$returnValues.ManagementToolsAvailable = !!($namespaces | Where-Object { $_.Name -ieq \"ManagementTools\" })\n$returnValues.ServerManagerAvailable = !!($namespaces | Where-Object { $_.Name -ieq \"ServerManager\" })\n}\nreturn $returnValues\n}\nfunction isRemoteAppEnabled() {\nSet-Variable key -Option Constant -Value \"HKLM:\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\\\\Terminal Server\\\\TSAppAllowList\"\n$registryKeyValue = Get-ItemProperty -Path $key -Name fDisabledAllowList -ErrorAction SilentlyContinue\nif (-not $registryKeyValue) {\nreturn $false\n}\nreturn $registryKeyValue.fDisabledAllowList -eq 1\n}\nfunction getOperatingSystemInfo() {\nreturn Get-CimInstance Win32_OperatingSystem | Microsoft.PowerShell.Utility\\Select-Object csName, Caption, OperatingSystemSKU, Version, ProductType, OSType, LastBootUpTime\n}\nfunction getComputerSystemInfo() {\nreturn Get-CimInstance Win32_ComputerSystem -ErrorAction SilentlyContinue | `\nMicrosoft.PowerShell.Utility\\Select-Object TotalPhysicalMemory, DomainRole, Manufacturer, Model, NumberOfLogicalProcessors, Domain, Workgroup, DNSHostName, Name, PartOfDomain, SystemFamily, SystemSKUNumber\n}\nfunction getSmbiosData($computerSystem) {\n$ChassisTypes =\n@{\n1 = \u0027Other\u0027\n2 = \u0027Unknown\u0027\n3 = \u0027Desktop\u0027\n4 = \u0027Low Profile Desktop\u0027\n5 = \u0027Pizza Box\u0027\n6 = \u0027Mini Tower\u0027\n7 = \u0027Tower\u0027\n8 = \u0027Portable\u0027\n9 = \u0027Laptop\u0027\n10 = \u0027Notebook\u0027\n11 = \u0027Hand Held\u0027\n12 = \u0027Docking Station\u0027\n13 = \u0027All in One\u0027\n14 = \u0027Sub Notebook\u0027\n15 = \u0027Space-Saving\u0027\n16 = \u0027Lunch Box\u0027\n17 = \u0027Main System Chassis\u0027\n18 = \u0027Expansion Chassis\u0027\n19 = \u0027SubChassis\u0027\n20 = \u0027Bus Expansion Chassis\u0027\n21 = \u0027Peripheral Chassis\u0027\n22 = \u0027Storage Chassis\u0027\n23 = \u0027Rack Mount Chassis\u0027\n24 = \u0027Sealed-Case PC\u0027\n25 = \u0027Multi-system chassis\u0027\n26 = \u0027Compact PCI\u0027\n27 = \u0027Advanced TCA\u0027\n28 = \u0027Blade\u0027\n29 = \u0027Blade Enclosure\u0027\n30 = \u0027Tablet\u0027\n31 = \u0027Convertible\u0027\n32 = \u0027Detachable\u0027\n33 = \u0027IoT Gateway\u0027\n34 = \u0027Embedded PC\u0027\n35 = \u0027Mini PC\u0027\n36 = \u0027Stick PC\u0027\n}\n$list = New-Object System.Collections.ArrayList\n$win32_Bios = Get-CimInstance -class Win32_Bios\n$obj = New-Object -Type PSObject | Microsoft.PowerShell.Utility\\Select-Object SerialNumber, Manufacturer, UUID, BaseBoardProduct, ChassisTypes, Chassis, SystemFamily, SystemSKUNumber, SMBIOSAssetTag\n$obj.SerialNumber = $win32_Bios.SerialNumber\n$obj.Manufacturer = $win32_Bios.Manufacturer\n$computerSystemProduct = Get-CimInstance Win32_ComputerSystemProduct\nif ($null -ne $computerSystemProduct) {\n$obj.UUID = $computerSystemProduct.UUID\n}\n$baseboard = Get-CimInstance Win32_BaseBoard\nif ($null -ne $baseboard) {\n$obj.BaseBoardProduct = $baseboard.Product\n}\n$systemEnclosure = Get-CimInstance Win32_SystemEnclosure\nif ($null -ne $systemEnclosure) {\n$obj.SMBIOSAssetTag = $systemEnclosure.SMBIOSAssetTag\n}\n$obj.ChassisTypes = Get-CimInstance Win32_SystemEnclosure | Microsoft.PowerShell.Utility\\Select-Object -ExpandProperty ChassisTypes\n$obj.Chassis = New-Object -TypeName \u0027System.Collections.ArrayList\u0027\n$obj.ChassisTypes | ForEach-Object -Process {\n$obj.Chassis.Add($ChassisTypes[[int]$_])\n}\n$obj.SystemFamily = $computerSystem.SystemFamily\n$obj.SystemSKUNumber = $computerSystem.SystemSKUNumber\n$list.Add($obj) | Out-Null\nreturn $list\n}\n$operatingSystem = getOperatingSystemInfo\n$computerSystem = getComputerSystemInfo\n$isAdministrator = isUserAnAdministrator\n$fqdnAndAddress = getHostFqdnAndAddress $computerSystem\n$hostname = [Environment]::MachineName\n$netbios = $env:ComputerName\n$managementToolsInformation = getManagementToolsSupportInformation\n$isWmfInstalled = isWMF5Installed $operatingSystem.Version\n$clusterInformation = getClusterInformation -ErrorAction SilentlyContinue\n$isHyperVPowershellInstalled = isHyperVPowerShellSupportInstalled\n$isHyperVRoleInstalled = isHyperVRoleInstalled\n$isCredSSPEnabled = isCredSSPEnabled\n$isRemoteAppEnabled = isRemoteAppEnabled\n$smbiosData = getSmbiosData $computerSystem\n$result = New-Object PSObject\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsAdministrator\u0027 -Value $isAdministrator\n$result | Add-Member -MemberType NoteProperty -Name \u0027OperatingSystem\u0027 -Value $operatingSystem\n$result | Add-Member -MemberType NoteProperty -Name \u0027ComputerSystem\u0027 -Value $computerSystem\n$result | Add-Member -MemberType NoteProperty -Name \u0027Fqdn\u0027 -Value $fqdnAndAddress.Fqdn\n$result | Add-Member -MemberType NoteProperty -Name \u0027AddressList\u0027 -Value $fqdnAndAddress.AddressList\n$result | Add-Member -MemberType NoteProperty -Name \u0027Hostname\u0027 -Value $hostname\n$result | Add-Member -MemberType NoteProperty -Name \u0027NetBios\u0027 -Value $netbios\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsManagementToolsAvailable\u0027 -Value $managementToolsInformation.ManagementToolsAvailable\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsServerManagerAvailable\u0027 -Value $managementToolsInformation.ServerManagerAvailable\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsWmfInstalled\u0027 -Value $isWmfInstalled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsCluster\u0027 -Value $clusterInformation.IsCluster\n$result | Add-Member -MemberType NoteProperty -Name \u0027ClusterFqdn\u0027 -Value $clusterInformation.ClusterFqdn\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsS2dEnabled\u0027 -Value $clusterInformation.IsS2dEnabled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsBritannicaEnabled\u0027 -Value $clusterInformation.IsBritannicaEnabled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsHyperVRoleInstalled\u0027 -Value $isHyperVRoleInstalled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsHyperVPowershellInstalled\u0027 -Value $isHyperVPowershellInstalled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsCredSSPEnabled\u0027 -Value $isCredSSPEnabled\n$result | Add-Member -MemberType NoteProperty -Name \u0027IsRemoteAppEnabled\u0027 -Value $isRemoteAppEnabled\n$result | Add-Member -MemberType NoteProperty -Name \u0027SmbiosData\u0027 -Value $smbiosData\n$result\n"
|
|
47
55
|
};
|
|
48
|
-
PowerShellScripts.Install_MMAgent = {
|
|
49
|
-
command: 'Install-MMAgent',
|
|
50
|
-
script: "##Install-MMAgent##:Install-MMAgent.ps1\nparam(\n[Parameter(Mandatory = $true)]\n[String]\n$workspaceId,\n[Parameter(Mandatory = $true)]\n[String]\n$workspacePrimaryKey,\n[Parameter(Mandatory = $true)]\n[String]\n$taskName\n)\n$Script = @\u0027\n$mmaExe = Join-Path -Path $env:temp -ChildPath \u0027MMASetup-AMD64.exe\u0027\nif (Test-Path $mmaExe) {\nRemove-Item $mmaExe\n}\nInvoke-WebRequest -Uri https://go.microsoft.com/fwlink/?LinkId=828603 -OutFile $mmaExe\n$extractFolder = Join-Path -Path $env:temp -ChildPath \u0027SmeMMAInstaller\u0027\nif (Test-Path $extractFolder) {\nRemove-Item $extractFolder -Force -Recurse\n}\n\u0026$mmaExe /c /t:$extractFolder\n$setupExe = Join-Path -Path $extractFolder -ChildPath \u0027setup.exe\u0027\nfor ($i=1; $i -le 10; $i++) {\nif(-Not(Test-Path $setupExe)) {\nsleep -s 6\n}\n}\n\u0026$setupExe /qn NOAPM=1 ADD_OPINSIGHTS_WORKSPACE=1 OPINSIGHTS_WORKSPACE_AZURE_CLOUD_TYPE=0 OPINSIGHTS_WORKSPACE_ID=$workspaceId OPINSIGHTS_WORKSPACE_KEY=$workspacePrimaryKey AcceptEndUserLicenseAgreement=1\n\u0027@\n$Script = \u0027$workspaceId = \u0027 + \"\u0027$workspaceId\u0027;\" + $Script\n$Script = \u0027$workspacePrimaryKey =\u0027 + \"\u0027$workspacePrimaryKey\u0027;\" + $Script\n$ScriptFile = Join-Path -Path $env:LocalAppData -ChildPath \"$taskName.ps1\"\n$ResultFile = Join-Path -Path $env:temp -ChildPath \"$taskName.log\"\nif (Test-Path $ResultFile) {\nRemove-Item $ResultFile\n}\n$Script | Out-File $ScriptFile\nif (-Not(Test-Path $ScriptFile)) {\n$message = \"Failed to create file:\" + $ScriptFile\nWrite-Error $message\nreturn #If failed to create script file, no need continue just return here\n}\n$User = [Security.Principal.WindowsIdentity]::GetCurrent()\n$Role = (New-Object Security.Principal.WindowsPrincipal $User).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)\n$arg = \"-NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -c $ScriptFile \u003e\u003e $ResultFile 2\u003e\u00261\"\nif(!$Role)\n{\nWrite-Warning \"To perform some operations you must run an elevated Windows PowerShell console.\"\n}\n$Scheduler = New-Object -ComObject Schedule.Service\nfor ($i=1; $i -le 3; $i++)\n{\nTry\n{\n$Scheduler.Connect()\nBreak\n}\nCatch\n{\nif($i -ge 3)\n{\nWrite-EventLog -LogName Application -Source \"SME Register $taskName\" -EntryType Error -EventID 1 -Message \"Can\u0027t connect to Schedule service\"\nWrite-Error \"Can\u0027t connect to Schedule service\" -ErrorAction Stop\n}\nelse\n{\nStart-Sleep -s 1\n}\n}\n}\n$RootFolder = $Scheduler.GetFolder(\"\\\")\nif($RootFolder.GetTasks(0) | Where-Object {$_.Name -eq $TaskName})\n{\nWrite-Debug(\"Deleting existing task\" + $TaskName)\n$RootFolder.DeleteTask($TaskName,0)\n}\n$Task = $Scheduler.NewTask(0)\n$RegistrationInfo = $Task.RegistrationInfo\n$RegistrationInfo.Description = $TaskName\n$RegistrationInfo.Author = $User.Name\n$Triggers = $Task.Triggers\n$Trigger = $Triggers.Create(7) #TASK_TRIGGER_REGISTRATION: Starts the task when the task is registered.\n$Trigger.Enabled = $true\n$Settings = $Task.Settings\n$Settings.Enabled = $True\n$Settings.StartWhenAvailable = $True\n$Settings.Hidden = $False\n$Settings.ExecutionTimeLimit = \"PT20M\" # 20 minutes\n$Action = $Task.Actions.Create(0)\n$Action.Path = \"powershell\"\n$Action.Arguments = $arg\n$Task.Principal.RunLevel = 1\n$RootFolder.RegisterTaskDefinition($TaskName, $Task, 6, \"SYSTEM\", $Null, 1) | Out-Null\n$RootFolder.GetTask($TaskName).Run(0) | Out-Null\nwhile($Scheduler.GetRunningTasks(0) | Where-Object {$_.Name -eq $TaskName})\n{\nStart-Sleep -s 1\n}\n$RootFolder.DeleteTask($TaskName,0)\nRemove-Item $ScriptFile\nif (Test-Path $ResultFile)\n{\nGet-Content -Path $ResultFile | Out-String -Stream\nRemove-Item $ResultFile\n}\n"
|
|
51
|
-
};
|
|
52
56
|
})(PowerShellScripts || (PowerShellScripts = {}));
|
|
53
57
|
|
|
54
58
|
//# sourceMappingURL=powershell-scripts.js.map
|