azure-devops-extension-api 4.229.0 → 4.231.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/Alert/Alert.d.ts +32 -2
- package/Alert/Alert.js +14 -0
- package/Alert/Alert.min.js +1 -1
- package/Alert/AlertClient.d.ts +4 -2
- package/Alert/AlertClient.js +8 -4
- package/Alert/AlertClient.min.js +1 -1
- package/Build/Build.d.ts +1 -1
- package/Dashboard/WidgetConfigHelpers.d.ts +34 -0
- package/Dashboard/WidgetConfigHelpers.js +45 -0
- package/Dashboard/WidgetConfigHelpers.min.js +1 -0
- package/Dashboard/WidgetContracts.d.ts +213 -0
- package/Dashboard/WidgetContracts.js +25 -0
- package/Dashboard/WidgetContracts.min.js +1 -0
- package/Dashboard/WidgetHelpers.d.ts +89 -0
- package/Dashboard/WidgetHelpers.js +146 -0
- package/Dashboard/WidgetHelpers.min.js +1 -0
- package/Dashboard/index.d.ts +3 -0
- package/Dashboard/index.js +4 -1
- package/Dashboard/index.min.js +1 -1
- package/Gallery/Gallery.d.ts +14 -1
- package/Gallery/Gallery.js +13 -0
- package/Gallery/Gallery.min.js +1 -1
- package/Git/Git.d.ts +5 -1
- package/Git/Git.js +4 -0
- package/Git/Git.min.js +1 -1
- package/Git/GitClient.js +37 -37
- package/Git/GitClient.min.js +1 -1
- package/Management/Management.d.ts +61 -0
- package/Management/ManagementClient.d.ts +6 -0
- package/Management/ManagementClient.js +23 -0
- package/Management/ManagementClient.min.js +1 -1
- package/Release/Release.d.ts +4 -4
- package/Test/Test.d.ts +199 -0
- package/Test/Test.js +83 -0
- package/Test/Test.min.js +1 -1
- package/TestResults/TestResultsClient.d.ts +21 -0
- package/TestResults/TestResultsClient.js +69 -0
- package/TestResults/TestResultsClient.min.js +1 -1
- package/WebApi/WebApi.d.ts +9 -0
- package/WebApi/WebApi.js +10 -0
- package/WebApi/WebApi.min.js +1 -1
- package/package.json +1 -1
package/Alert/Alert.d.ts
CHANGED
|
@@ -60,6 +60,14 @@ export interface Alert {
|
|
|
60
60
|
* Tools that have detected this issue.
|
|
61
61
|
*/
|
|
62
62
|
tools: Tool[];
|
|
63
|
+
/**
|
|
64
|
+
* A truncated/obfuscated version of the secret pertaining to the alert (if applicable).
|
|
65
|
+
*/
|
|
66
|
+
truncatedSecret: string;
|
|
67
|
+
/**
|
|
68
|
+
* ValidationFingerprints for the secret liveness check. Only return on demanded
|
|
69
|
+
*/
|
|
70
|
+
validationFingerprints: ValidationFingerprint[];
|
|
63
71
|
}
|
|
64
72
|
/**
|
|
65
73
|
* Summary of the state of the alert for a given analysis configuration.
|
|
@@ -371,6 +379,16 @@ export declare enum DismissalType {
|
|
|
371
379
|
*/
|
|
372
380
|
FalsePositive = 3
|
|
373
381
|
}
|
|
382
|
+
export declare enum ExpandOption {
|
|
383
|
+
/**
|
|
384
|
+
* No Expands.
|
|
385
|
+
*/
|
|
386
|
+
None = 0,
|
|
387
|
+
/**
|
|
388
|
+
* Return validationFingerprints in Alert.
|
|
389
|
+
*/
|
|
390
|
+
ValidationFingerprint = 1
|
|
391
|
+
}
|
|
374
392
|
export interface LogicalLocation {
|
|
375
393
|
fullyQualifiedName: string;
|
|
376
394
|
/**
|
|
@@ -495,7 +513,7 @@ export declare enum ResultType {
|
|
|
495
513
|
*/
|
|
496
514
|
export interface Rule {
|
|
497
515
|
/**
|
|
498
|
-
* Additional properties of this rule
|
|
516
|
+
* Additional properties of this rule dependent on the rule type. For example, dependency rules may include the CVE ID if it is available.
|
|
499
517
|
*/
|
|
500
518
|
additionalProperties: {
|
|
501
519
|
[key: string]: any;
|
|
@@ -582,12 +600,19 @@ export interface SearchCriteria {
|
|
|
582
600
|
* If provided, only return alerts last seen before this date. \<br /\>Otherwise return all alerts.
|
|
583
601
|
*/
|
|
584
602
|
toDate: Date;
|
|
603
|
+
/**
|
|
604
|
+
* If provided with toolName, only return alerts detected by this tool. \<br /\>Otherwise, return alerts detected by all tools.
|
|
605
|
+
*/
|
|
606
|
+
toolName: string;
|
|
585
607
|
}
|
|
586
608
|
export declare enum Severity {
|
|
587
609
|
Low = 0,
|
|
588
610
|
Medium = 1,
|
|
589
611
|
High = 2,
|
|
590
|
-
Critical = 3
|
|
612
|
+
Critical = 3,
|
|
613
|
+
Note = 4,
|
|
614
|
+
Warning = 5,
|
|
615
|
+
Error = 6
|
|
591
616
|
}
|
|
592
617
|
export declare enum State {
|
|
593
618
|
/**
|
|
@@ -645,6 +670,11 @@ export interface UxFilters {
|
|
|
645
670
|
* Alert states to show. If empty show all alert states
|
|
646
671
|
*/
|
|
647
672
|
states: State[];
|
|
673
|
+
tools: Tool[];
|
|
674
|
+
}
|
|
675
|
+
export interface ValidationFingerprint {
|
|
676
|
+
validationFingerprintHash: string;
|
|
677
|
+
validationFingerprintJson: string;
|
|
648
678
|
}
|
|
649
679
|
/**
|
|
650
680
|
* Information for locating files in a source control system
|
package/Alert/Alert.js
CHANGED
|
@@ -120,6 +120,17 @@ define(["require", "exports"], function (require, exports) {
|
|
|
120
120
|
*/
|
|
121
121
|
DismissalType[DismissalType["FalsePositive"] = 3] = "FalsePositive";
|
|
122
122
|
})(DismissalType = exports.DismissalType || (exports.DismissalType = {}));
|
|
123
|
+
var ExpandOption;
|
|
124
|
+
(function (ExpandOption) {
|
|
125
|
+
/**
|
|
126
|
+
* No Expands.
|
|
127
|
+
*/
|
|
128
|
+
ExpandOption[ExpandOption["None"] = 0] = "None";
|
|
129
|
+
/**
|
|
130
|
+
* Return validationFingerprints in Alert.
|
|
131
|
+
*/
|
|
132
|
+
ExpandOption[ExpandOption["ValidationFingerprint"] = 1] = "ValidationFingerprint";
|
|
133
|
+
})(ExpandOption = exports.ExpandOption || (exports.ExpandOption = {}));
|
|
123
134
|
/**
|
|
124
135
|
* This enum defines the different result types.
|
|
125
136
|
*/
|
|
@@ -144,6 +155,9 @@ define(["require", "exports"], function (require, exports) {
|
|
|
144
155
|
Severity[Severity["Medium"] = 1] = "Medium";
|
|
145
156
|
Severity[Severity["High"] = 2] = "High";
|
|
146
157
|
Severity[Severity["Critical"] = 3] = "Critical";
|
|
158
|
+
Severity[Severity["Note"] = 4] = "Note";
|
|
159
|
+
Severity[Severity["Warning"] = 5] = "Warning";
|
|
160
|
+
Severity[Severity["Error"] = 6] = "Error";
|
|
147
161
|
})(Severity = exports.Severity || (exports.Severity = {}));
|
|
148
162
|
var State;
|
|
149
163
|
(function (State) {
|
package/Alert/Alert.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
define(["require","exports"],function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.Secret=2]="Secret",e[e.Code=3]="Code"}(n.AlertType||(n.AlertType={}));!function(e){e[e.Default=0]="Default",e[e.AdoPipeline=1]="AdoPipeline"}(n.AnalysisConfigurationType||(n.AnalysisConfigurationType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.NuGet=1]="NuGet",e[e.Npm=2]="Npm",e[e.Maven=3]="Maven",e[e.Git=4]="Git",e[e.Other=5]="Other",e[e.RubyGems=6]="RubyGems",e[e.Cargo=7]="Cargo",e[e.Pip=8]="Pip",e[e.File=9]="File",e[e.Go=10]="Go",e[e.DockerImage=11]="DockerImage",e[e.Pod=12]="Pod",e[e.Linux=13]="Linux",e[e.Conda=14]="Conda",e[e.DockerReference=15]="DockerReference",e[e.Vcpkg=16]="Vcpkg"}(n.ComponentType||(n.ComponentType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Fixed=1]="Fixed",e[e.AcceptedRisk=2]="AcceptedRisk",e[e.FalsePositive=3]="FalsePositive"}(n.DismissalType||(n.DismissalType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.VersionControl=2]="VersionControl"}(n.ResultType||(n.ResultType={}));!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High",e[e.Critical=3]="Critical"}(n.Severity||(n.Severity={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Active=1]="Active",e[e.Dismissed=2]="Dismissed",e[e.Fixed=4]="Fixed",e[e.AutoDismissed=8]="AutoDismissed"}(n.State||(n.State={}))});
|
|
1
|
+
define(["require","exports"],function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.Secret=2]="Secret",e[e.Code=3]="Code"}(n.AlertType||(n.AlertType={}));!function(e){e[e.Default=0]="Default",e[e.AdoPipeline=1]="AdoPipeline"}(n.AnalysisConfigurationType||(n.AnalysisConfigurationType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.NuGet=1]="NuGet",e[e.Npm=2]="Npm",e[e.Maven=3]="Maven",e[e.Git=4]="Git",e[e.Other=5]="Other",e[e.RubyGems=6]="RubyGems",e[e.Cargo=7]="Cargo",e[e.Pip=8]="Pip",e[e.File=9]="File",e[e.Go=10]="Go",e[e.DockerImage=11]="DockerImage",e[e.Pod=12]="Pod",e[e.Linux=13]="Linux",e[e.Conda=14]="Conda",e[e.DockerReference=15]="DockerReference",e[e.Vcpkg=16]="Vcpkg"}(n.ComponentType||(n.ComponentType={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Fixed=1]="Fixed",e[e.AcceptedRisk=2]="AcceptedRisk",e[e.FalsePositive=3]="FalsePositive"}(n.DismissalType||(n.DismissalType={}));!function(e){e[e.None=0]="None",e[e.ValidationFingerprint=1]="ValidationFingerprint"}(n.ExpandOption||(n.ExpandOption={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Dependency=1]="Dependency",e[e.VersionControl=2]="VersionControl"}(n.ResultType||(n.ResultType={}));!function(e){e[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High",e[e.Critical=3]="Critical",e[e.Note=4]="Note",e[e.Warning=5]="Warning",e[e.Error=6]="Error"}(n.Severity||(n.Severity={}));!function(e){e[e.Unknown=0]="Unknown",e[e.Active=1]="Active",e[e.Dismissed=2]="Dismissed",e[e.Fixed=4]="Fixed",e[e.AutoDismissed=8]="AutoDismissed"}(n.State||(n.State={}))});
|
package/Alert/AlertClient.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export declare class AlertRestClient extends RestClientBase {
|
|
|
11
11
|
* @param alertId - ID of alert to retrieve
|
|
12
12
|
* @param repository - Name or id of a repository that alert is part of
|
|
13
13
|
* @param ref -
|
|
14
|
+
* @param expand - Expand alert attributes. Possible options are \{ValidationFingerprint, None\}
|
|
14
15
|
*/
|
|
15
|
-
getAlert(project: string, alertId: number, repository: string, ref?: string): Promise<Alert.Alert>;
|
|
16
|
+
getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: Alert.ExpandOption): Promise<Alert.Alert>;
|
|
16
17
|
/**
|
|
17
18
|
* Get alerts for a repository
|
|
18
19
|
*
|
|
@@ -31,8 +32,9 @@ export declare class AlertRestClient extends RestClientBase {
|
|
|
31
32
|
* @param alertId - ID of alert to retrieve
|
|
32
33
|
* @param repository - Name or id of a repository that alert is part of
|
|
33
34
|
* @param ref -
|
|
35
|
+
* @param expand - Expand alert attributes. Possible options are \{ValidationFingerprint, None\}
|
|
34
36
|
*/
|
|
35
|
-
getAlertSarif(project: string, alertId: number, repository: string, ref?: string): Promise<string>;
|
|
37
|
+
getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: Alert.ExpandOption): Promise<string>;
|
|
36
38
|
/**
|
|
37
39
|
* Update the status of an alert
|
|
38
40
|
*
|
package/Alert/AlertClient.js
CHANGED
|
@@ -63,13 +63,15 @@ define(["require", "exports", "../Common/RestClientBase", "../Common/Util/Serial
|
|
|
63
63
|
* @param alertId - ID of alert to retrieve
|
|
64
64
|
* @param repository - Name or id of a repository that alert is part of
|
|
65
65
|
* @param ref -
|
|
66
|
+
* @param expand - Expand alert attributes. Possible options are \{ValidationFingerprint, None\}
|
|
66
67
|
*/
|
|
67
|
-
AlertRestClient.prototype.getAlert = function (project, alertId, repository, ref) {
|
|
68
|
+
AlertRestClient.prototype.getAlert = function (project, alertId, repository, ref, expand) {
|
|
68
69
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
70
|
var queryValues;
|
|
70
71
|
return __generator(this, function (_a) {
|
|
71
72
|
queryValues = {
|
|
72
|
-
ref: ref
|
|
73
|
+
ref: ref,
|
|
74
|
+
expand: expand
|
|
73
75
|
};
|
|
74
76
|
return [2 /*return*/, this.beginRequest({
|
|
75
77
|
apiVersion: "7.2-preview.1",
|
|
@@ -136,13 +138,15 @@ define(["require", "exports", "../Common/RestClientBase", "../Common/Util/Serial
|
|
|
136
138
|
* @param alertId - ID of alert to retrieve
|
|
137
139
|
* @param repository - Name or id of a repository that alert is part of
|
|
138
140
|
* @param ref -
|
|
141
|
+
* @param expand - Expand alert attributes. Possible options are \{ValidationFingerprint, None\}
|
|
139
142
|
*/
|
|
140
|
-
AlertRestClient.prototype.getAlertSarif = function (project, alertId, repository, ref) {
|
|
143
|
+
AlertRestClient.prototype.getAlertSarif = function (project, alertId, repository, ref, expand) {
|
|
141
144
|
return __awaiter(this, void 0, void 0, function () {
|
|
142
145
|
var queryValues;
|
|
143
146
|
return __generator(this, function (_a) {
|
|
144
147
|
queryValues = {
|
|
145
|
-
ref: ref
|
|
148
|
+
ref: ref,
|
|
149
|
+
expand: expand
|
|
146
150
|
};
|
|
147
151
|
return [2 /*return*/, this.beginRequest({
|
|
148
152
|
apiVersion: "7.2-preview.1",
|
package/Alert/AlertClient.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))(function(i
|
|
1
|
+
var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))(function(n,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){e.done?n(e.value):new r(function(t){t(e.value)}).then(a,s)}u((o=o.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function r(r){return function(a){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,n&&(i=2&r[0]?n.return:r[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;switch(n=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,n=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!(i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(6===r[0]&&s.label<i[1]){s.label=i[1],i=r;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(r);break}i[2]&&s.ops.pop(),s.trys.pop();continue}r=t.call(e,s)}catch(e){r=[6,e],n=0}finally{o=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}var o,n,i,a,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","../Common/RestClientBase","../Common/Util/Serialization"],function(e,t,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.getAlert=function(e,t,r,o,n){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(a){return i={ref:o,expand:n},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,alertId:t,repository:r},queryParams:i})]})})},t.prototype.getAlerts=function(e,t,r,n,i,a){return __awaiter(this,void 0,void 0,function(){var s,u=this;return __generator(this,function(p){return s={top:r,orderBy:n,criteria:i,continuationToken:a},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,repository:t},queryParams:s,returnRawResponse:!0}).then(function(e){return __awaiter(u,void 0,void 0,function(){var t;return __generator(this,function(r){switch(r.label){case 0:return[4,e.text().then(o.deserializeVssJsonObject)];case 1:return t=r.sent(),t.continuationToken=e.headers.get("x-ms-continuationtoken"),[2,t]}})})})]})})},t.prototype.getAlertSarif=function(e,t,r,o,n){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(a){return i={ref:o,expand:n},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,alertId:t,repository:r},queryParams:i})]})})},t.prototype.updateAlert=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(n){return[2,this.beginRequest({apiVersion:"7.2-preview.1",method:"PATCH",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:t,alertId:r,repository:o},body:e})]})})},t.prototype.getAlertInstances=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(i){return n={ref:o},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/alerts/{alertId}/Instances",routeValues:{project:e,alertId:t,repository:r},queryParams:n})]})})},t.prototype.uploadSarif=function(e,t,r){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(o){return[2,this.beginRequest({apiVersion:"7.2-preview.1",method:"POST",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/sarifs",routeValues:{project:t,repository:r},customHeaders:{"Content-Type":"application/octet-stream"},body:e})]})})},t.prototype.getUxFilters=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var o;return __generator(this,function(n){return o={alertType:r},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/filters",routeValues:{project:e,repository:t},queryParams:o})]})})},t.prototype.getSarif=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"_apis/Alert/Sarifs/{sarifId}",routeValues:{sarifId:e}})]})})},t}(r.RestClientBase);t.AlertRestClient=n});
|
package/Build/Build.d.ts
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetConfigHelpers.ts
|
|
3
|
+
*/
|
|
4
|
+
import { EventArgs } from "./WidgetContracts";
|
|
5
|
+
export declare class ConfigurationEvent {
|
|
6
|
+
/**
|
|
7
|
+
* Configuration has changed. When this event is notified, the preview is updated and Save button is enabled.
|
|
8
|
+
*
|
|
9
|
+
* The payload expected when notifying this event: { data: customSettings }
|
|
10
|
+
*
|
|
11
|
+
* {customSettings} is the serialized custom config settings pertaining to the widget.
|
|
12
|
+
*/
|
|
13
|
+
static ConfigurationChange: string;
|
|
14
|
+
/**
|
|
15
|
+
* Configuration tries to execute API calls and fails. When this event is notified, the config does not render a view and we pass an error message to the configuration host.
|
|
16
|
+
*
|
|
17
|
+
* The payload expected when notifying this event: { data: string }
|
|
18
|
+
*
|
|
19
|
+
* {string} is the error message that is displayed at the top of the configuration.
|
|
20
|
+
*/
|
|
21
|
+
static ConfigurationError: string;
|
|
22
|
+
/**
|
|
23
|
+
* Widget configuration general settings changed. When this event is notified, the widget name or widget size is updated.
|
|
24
|
+
*
|
|
25
|
+
* The payload expected when notifying this event: { data: { IGeneralSettings } }
|
|
26
|
+
*
|
|
27
|
+
* {generalSettings} is the serialized object containing WidgetName and WidgetSize
|
|
28
|
+
*/
|
|
29
|
+
static GeneralSettingsChanged: string;
|
|
30
|
+
/**
|
|
31
|
+
* @param payload the event arguments we pass when we want to notify the configuration.
|
|
32
|
+
*/
|
|
33
|
+
static Args<T>(payload: T): EventArgs<T>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetConfigHelpers.ts
|
|
3
|
+
*/
|
|
4
|
+
define(["require", "exports"], function (require, exports) {
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
var ConfigurationEvent = /** @class */ (function () {
|
|
8
|
+
function ConfigurationEvent() {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @param payload the event arguments we pass when we want to notify the configuration.
|
|
12
|
+
*/
|
|
13
|
+
ConfigurationEvent.Args = function (payload) {
|
|
14
|
+
return {
|
|
15
|
+
data: payload
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Configuration has changed. When this event is notified, the preview is updated and Save button is enabled.
|
|
20
|
+
*
|
|
21
|
+
* The payload expected when notifying this event: { data: customSettings }
|
|
22
|
+
*
|
|
23
|
+
* {customSettings} is the serialized custom config settings pertaining to the widget.
|
|
24
|
+
*/
|
|
25
|
+
ConfigurationEvent.ConfigurationChange = "ms.vss-dashboards-web.configurationChange";
|
|
26
|
+
/**
|
|
27
|
+
* Configuration tries to execute API calls and fails. When this event is notified, the config does not render a view and we pass an error message to the configuration host.
|
|
28
|
+
*
|
|
29
|
+
* The payload expected when notifying this event: { data: string }
|
|
30
|
+
*
|
|
31
|
+
* {string} is the error message that is displayed at the top of the configuration.
|
|
32
|
+
*/
|
|
33
|
+
ConfigurationEvent.ConfigurationError = "ms.vss-dashboards-web.configurationError";
|
|
34
|
+
/**
|
|
35
|
+
* Widget configuration general settings changed. When this event is notified, the widget name or widget size is updated.
|
|
36
|
+
*
|
|
37
|
+
* The payload expected when notifying this event: { data: { IGeneralSettings } }
|
|
38
|
+
*
|
|
39
|
+
* {generalSettings} is the serialized object containing WidgetName and WidgetSize
|
|
40
|
+
*/
|
|
41
|
+
ConfigurationEvent.GeneralSettingsChanged = "ms.vss-dashboards-web.generalSettingsChanged";
|
|
42
|
+
return ConfigurationEvent;
|
|
43
|
+
}());
|
|
44
|
+
exports.ConfigurationEvent = ConfigurationEvent;
|
|
45
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
define(["require","exports"],function(n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function n(){}return n.Args=function(n){return{data:n}},n.ConfigurationChange="ms.vss-dashboards-web.configurationChange",n.ConfigurationError="ms.vss-dashboards-web.configurationError",n.GeneralSettingsChanged="ms.vss-dashboards-web.generalSettingsChanged",n}();e.ConfigurationEvent=r});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetContracts.ts
|
|
3
|
+
*/
|
|
4
|
+
import { LightboxOptions, SemanticVersion, WidgetSize } from "./Dashboard";
|
|
5
|
+
/**
|
|
6
|
+
* settings of the widget that encapsulate their serialized data and version support.
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomSettings {
|
|
9
|
+
/**
|
|
10
|
+
* the settings data serialized as a string.
|
|
11
|
+
*/
|
|
12
|
+
data: string;
|
|
13
|
+
/**
|
|
14
|
+
* (Optional) version for the settings represented as a semantic version object.
|
|
15
|
+
* If none is available, the version defaults to {major:1, minor:0, patch:0} or "1.0.0"
|
|
16
|
+
*/
|
|
17
|
+
version?: SemanticVersion;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A description of widget state, satisfying requirements for rendering a widget (Does not contain grid centric information, or contribution metadata).
|
|
21
|
+
*/
|
|
22
|
+
export interface WidgetSettings {
|
|
23
|
+
/**
|
|
24
|
+
* size of the widget (in case of configuration, this maps to the size sub section in the general section of the configuration panel)
|
|
25
|
+
*/
|
|
26
|
+
size: WidgetSize;
|
|
27
|
+
/**
|
|
28
|
+
* name of the widget (in case of configuration, this maps to the name sub section in the general section of the configuration panel)
|
|
29
|
+
*/
|
|
30
|
+
name: string;
|
|
31
|
+
/**
|
|
32
|
+
* settings of the widget
|
|
33
|
+
*/
|
|
34
|
+
customSettings: CustomSettings;
|
|
35
|
+
/**
|
|
36
|
+
* Lightbox options
|
|
37
|
+
*/
|
|
38
|
+
lightboxOptions?: LightboxOptions;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Used to differentiate between widget status helpers
|
|
42
|
+
*/
|
|
43
|
+
export declare enum WidgetStatusType {
|
|
44
|
+
/**
|
|
45
|
+
* The widget loaded successfully
|
|
46
|
+
*/
|
|
47
|
+
Success = 0,
|
|
48
|
+
/**
|
|
49
|
+
* The widget failed to load
|
|
50
|
+
*/
|
|
51
|
+
Failure = 1,
|
|
52
|
+
/**
|
|
53
|
+
* The widget needs to be configured
|
|
54
|
+
*/
|
|
55
|
+
Unconfigured = 2
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The object encapsulating the result for an IWidget/IConfigurableWidget method call. This object is created using the WidgetStatusHelper library.
|
|
59
|
+
*/
|
|
60
|
+
export interface WidgetStatus {
|
|
61
|
+
/**
|
|
62
|
+
* the rendered state of the widget serialized to a string.
|
|
63
|
+
*/
|
|
64
|
+
state?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Used to determine which widget status helper was called
|
|
67
|
+
*/
|
|
68
|
+
statusType?: WidgetStatusType;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* All widgets implement this interface
|
|
72
|
+
*/
|
|
73
|
+
export interface IWidget {
|
|
74
|
+
/** widgets use the settings provided along with the any cached data they may have to paint an interactive state. No network calls should be made by the widget.
|
|
75
|
+
* @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
|
|
76
|
+
* @returns object wrapped in a promise that encapsulates the success of this operation.
|
|
77
|
+
* when this calls are completed and the experience is done loading.
|
|
78
|
+
*/
|
|
79
|
+
preload: (widgetSettings: WidgetSettings) => Promise<WidgetStatus>;
|
|
80
|
+
/**
|
|
81
|
+
* Widgets use the settings provided as well as server side calls to complete their rendering experience.
|
|
82
|
+
* In the future, widgets are expected to provide a loading experience while the calls are being waited to be completed.
|
|
83
|
+
* Until then, the widget host will provide the loading experience
|
|
84
|
+
* @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
|
|
85
|
+
* @returns object wrapped in a promise that encapsulates the success of this operation.
|
|
86
|
+
* when this calls are completed and the experience is done loading.
|
|
87
|
+
*/
|
|
88
|
+
load: (widgetSettings: WidgetSettings) => Promise<WidgetStatus>;
|
|
89
|
+
/**
|
|
90
|
+
* Widgets manage any operations that are not necessary for initial load but are required for the full widget experience.
|
|
91
|
+
*/
|
|
92
|
+
onDashboardLoaded?: () => void;
|
|
93
|
+
/**
|
|
94
|
+
* The framework calls this method to determine if the widget should be disabled for users with stakeholder license
|
|
95
|
+
* @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
|
|
96
|
+
* @returns A boolean wrapped in a promise that determines if the widget should be disabled for users with stakeholder license
|
|
97
|
+
*/
|
|
98
|
+
disableWidgetForStakeholders?: (widgetSettings: WidgetSettings) => Promise<boolean>;
|
|
99
|
+
/**
|
|
100
|
+
* Run widget in lightboxed mode
|
|
101
|
+
* @param {WidgetSettings} settings of the widget as available when the widget render is called by the host.
|
|
102
|
+
* @param {LightboxSize} size of the lightbox
|
|
103
|
+
* @returns object wrapped in a promise that encapsulates the success of this operation.
|
|
104
|
+
* when this calls are completed and the experience is done loading.
|
|
105
|
+
*/
|
|
106
|
+
lightbox?: (widgetSettings: WidgetSettings, lightboxSize: Size) => Promise<WidgetStatus>;
|
|
107
|
+
/**
|
|
108
|
+
* Listen to message from host
|
|
109
|
+
* @param {string} type of event
|
|
110
|
+
* @param {eventArgs} arguments associated with the event.
|
|
111
|
+
*/
|
|
112
|
+
listen?: <T>(event: string, eventArgs: EventArgs<T>) => void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Configurable widgets implement this interface
|
|
116
|
+
*/
|
|
117
|
+
export interface IConfigurableWidget extends IWidget {
|
|
118
|
+
/**
|
|
119
|
+
* When the configuration view is changed, the widget is expected to update its view.
|
|
120
|
+
* @param {WidgetSettings} the latest widget settings as available from the configuration view for the widget.
|
|
121
|
+
* @returns object wrapped in a promise that encapsulates the success of this operation.
|
|
122
|
+
*/
|
|
123
|
+
reload: (newWidgetSettings: WidgetSettings) => Promise<WidgetStatus>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Widget authors implement this interface for their configuration.
|
|
127
|
+
*/
|
|
128
|
+
export interface IWidgetConfiguration {
|
|
129
|
+
/**
|
|
130
|
+
* Called by the host to setup the widget configuration, which uses the settings shared with the widget to complete its rendering experience.
|
|
131
|
+
* @param {WidgetSettings} settings of the widget as shared with the configuration.
|
|
132
|
+
* @param {IWidgetConfigurationContext} widgetConfigurationContext provided by the host of the widget configuration to allow for communication.
|
|
133
|
+
* @returns object wrapped in a promise that encapsulates the success of this operation.
|
|
134
|
+
* If load fails, returns error message via WidgetStatusHelper.Failure(errorMessage).
|
|
135
|
+
*/
|
|
136
|
+
load: (widgetSettings: WidgetSettings, widgetConfigurationContext: IWidgetConfigurationContext) => Promise<WidgetStatus>;
|
|
137
|
+
/**
|
|
138
|
+
* Called by the host when the user clicks on the Save button.
|
|
139
|
+
* Widget author is expected to run validations if needed.
|
|
140
|
+
* If ready to save, then use WidgetHelpers.WidgetConfigurationSave.Valid() to return the serialized custom settings of the widget from the configuraton.
|
|
141
|
+
* If custom settings are not valid and so not ready to save, then use WidgetHelpers.WidgetConfigurationSave.Invalid() to notify the host to stop save.
|
|
142
|
+
* @returns object of type SaveStatus wrapped in a promise.
|
|
143
|
+
*/
|
|
144
|
+
onSave: () => Promise<SaveStatus>;
|
|
145
|
+
/**
|
|
146
|
+
* (Optional) Called by the host when the configuration is ready to be saved (when the user clicks the save button on the configuration panel)
|
|
147
|
+
*/
|
|
148
|
+
onSaveComplete?: () => void;
|
|
149
|
+
/**
|
|
150
|
+
* Listen to message from host
|
|
151
|
+
* @param {string} type of event
|
|
152
|
+
* @param {eventArgs} arguments associated with the event.
|
|
153
|
+
*/
|
|
154
|
+
listen?: <T>(event: string, eventArgs: EventArgs<T>) => void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The result of a notification being made by a widget configuration.
|
|
158
|
+
*/
|
|
159
|
+
export interface NotifyResult {
|
|
160
|
+
/**
|
|
161
|
+
* Gets a response from the subscriber of the notification, if they provide one as part of the schema for the event.
|
|
162
|
+
* @returns A promise with the data representing the return payload serialized as a string.
|
|
163
|
+
*/
|
|
164
|
+
getResponse(): Promise<string>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Arguments associated with an event being passed by a widget or configurations.
|
|
168
|
+
*/
|
|
169
|
+
export interface EventArgs<T> {
|
|
170
|
+
/**
|
|
171
|
+
* Data relevant to the event.
|
|
172
|
+
*/
|
|
173
|
+
data: T;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Interface for the object passed to the widget configuration to communicate with its host.
|
|
177
|
+
*/
|
|
178
|
+
export interface IWidgetConfigurationContext {
|
|
179
|
+
/**
|
|
180
|
+
* The widget configuration calls this method when it wants to notify any of the WidgetEvents to the host
|
|
181
|
+
* @param {string} type of event
|
|
182
|
+
* @param {eventArgs} arguments associated with the event which comes from the widget configuration.
|
|
183
|
+
* @returns a promise with the result of the notification. If arguments are malformed, the promise will be rejected. If multiple notifications are made for the same event
|
|
184
|
+
* only the promise for the latest notification is resolved and the rest are treated as stale. The subscriber of the notification can send back information in a serialized form.
|
|
185
|
+
*/
|
|
186
|
+
notify: <T>(event: string, eventArgs: EventArgs<T>) => Promise<NotifyResult>;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Interface for the object passed to the host when user clicks on the Save button in the configuration pane
|
|
190
|
+
*/
|
|
191
|
+
export interface SaveStatus {
|
|
192
|
+
/**
|
|
193
|
+
* The custom settings to save
|
|
194
|
+
*/
|
|
195
|
+
customSettings?: CustomSettings;
|
|
196
|
+
/**
|
|
197
|
+
* Indicates validity of the customSettings. If false, then user will be shown a generic error message and settings will not be saved.
|
|
198
|
+
*/
|
|
199
|
+
isValid: boolean;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Size of lightbox to draw widget in
|
|
203
|
+
*/
|
|
204
|
+
export interface Size {
|
|
205
|
+
/**
|
|
206
|
+
* width in pixels
|
|
207
|
+
*/
|
|
208
|
+
width: number;
|
|
209
|
+
/**
|
|
210
|
+
* height in pixels
|
|
211
|
+
*/
|
|
212
|
+
height: number;
|
|
213
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetContracts.ts
|
|
3
|
+
*/
|
|
4
|
+
define(["require", "exports"], function (require, exports) {
|
|
5
|
+
"use strict";
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
/**
|
|
8
|
+
* Used to differentiate between widget status helpers
|
|
9
|
+
*/
|
|
10
|
+
var WidgetStatusType;
|
|
11
|
+
(function (WidgetStatusType) {
|
|
12
|
+
/**
|
|
13
|
+
* The widget loaded successfully
|
|
14
|
+
*/
|
|
15
|
+
WidgetStatusType[WidgetStatusType["Success"] = 0] = "Success";
|
|
16
|
+
/**
|
|
17
|
+
* The widget failed to load
|
|
18
|
+
*/
|
|
19
|
+
WidgetStatusType[WidgetStatusType["Failure"] = 1] = "Failure";
|
|
20
|
+
/**
|
|
21
|
+
* The widget needs to be configured
|
|
22
|
+
*/
|
|
23
|
+
WidgetStatusType[WidgetStatusType["Unconfigured"] = 2] = "Unconfigured";
|
|
24
|
+
})(WidgetStatusType = exports.WidgetStatusType || (exports.WidgetStatusType = {}));
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
define(["require","exports"],function(e,u){"use strict";Object.defineProperty(u,"__esModule",{value:!0});!function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure",e[e.Unconfigured=2]="Unconfigured"}(u.WidgetStatusType||(u.WidgetStatusType={}))});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* From /Tfs/WebPlatform/Client/TFS/Dashboards/WidgetHelpers.ts
|
|
3
|
+
*/
|
|
4
|
+
import { CustomSettings, SaveStatus, WidgetStatus } from "./WidgetContracts";
|
|
5
|
+
export declare class WidgetStatusHelper {
|
|
6
|
+
/**
|
|
7
|
+
* method to encapsulate a successful result for a widget loading operation (load, reload, openLightbox etc)
|
|
8
|
+
* @param state any state information to be passed to the initiator of the loading call.
|
|
9
|
+
* @param title title for the lightbox of a widget when available.
|
|
10
|
+
* @returns promise encapsulating the status of the widget loading operations.
|
|
11
|
+
*/
|
|
12
|
+
static Success(state?: string): Promise<WidgetStatus>;
|
|
13
|
+
/**
|
|
14
|
+
* method to encapsulate a failed result for a widget loading operation (load, reload, openLightbox etc)
|
|
15
|
+
* @param message message to display as part within the widget error experience.
|
|
16
|
+
* @param isUserVisible indicates whether the message should be displayed to the user or a generic error message displayed. Defaults to true.
|
|
17
|
+
* @param isRichText indicates whether the message is an html that can be rendered as a rich experience. Defaults to false. Only trusted extensions are
|
|
18
|
+
* allowed to set this to true. For any 3rd party widgets passing this value as true, it will be ignored.
|
|
19
|
+
* @returns promise encapsulating the status of the widget loading operations.
|
|
20
|
+
*/
|
|
21
|
+
static Failure(message: string, isUserVisible?: boolean, isRichText?: boolean): Promise<WidgetStatus>;
|
|
22
|
+
/**
|
|
23
|
+
* method to encapsulate a result for a widget loading operation that results in the widget being in an unconfigured state.
|
|
24
|
+
* @returns promise encapsulating the status of the widget loading operations.
|
|
25
|
+
*/
|
|
26
|
+
static Unconfigured(): Promise<WidgetStatus>;
|
|
27
|
+
}
|
|
28
|
+
export declare class WidgetConfigurationSave {
|
|
29
|
+
/**
|
|
30
|
+
* method to encapsulate a valid state that is returned by the widget configuration
|
|
31
|
+
* @param customSettings settings from the widget configuration to be returned as part of this state.
|
|
32
|
+
* @returns promise encapsulating the state being returned.
|
|
33
|
+
*/
|
|
34
|
+
static Valid(customSettings: CustomSettings): Promise<SaveStatus>;
|
|
35
|
+
/**
|
|
36
|
+
* method to encapsulate an invalid state that is returned by the widget configuration
|
|
37
|
+
* @returns promise encapsulating the state being returned.
|
|
38
|
+
*/
|
|
39
|
+
static Invalid(): Promise<SaveStatus>;
|
|
40
|
+
}
|
|
41
|
+
export declare class WidgetSizeConverter {
|
|
42
|
+
/**
|
|
43
|
+
* Cell width of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
|
|
44
|
+
*/
|
|
45
|
+
private static CellWidth;
|
|
46
|
+
/**
|
|
47
|
+
* Cell height of the grid that is used to draw the widgets, this includes the border around the widget (i.e. this is the size of the div, border included)
|
|
48
|
+
*/
|
|
49
|
+
private static CellHeight;
|
|
50
|
+
/**
|
|
51
|
+
* Cell gutter width between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
|
|
52
|
+
*/
|
|
53
|
+
private static CellMarginWidth;
|
|
54
|
+
/**
|
|
55
|
+
* Cell gutter height between the cells that is used to draw the widget, this excludes the border around the widget (i.e. this is distance between widgets)
|
|
56
|
+
*/
|
|
57
|
+
private static CellMarginHeight;
|
|
58
|
+
/**
|
|
59
|
+
* Calculates a dimension in pixels, given widget cell size and grid dimensions
|
|
60
|
+
* @returns size in pixels
|
|
61
|
+
*/
|
|
62
|
+
private static CalculatePixelSize;
|
|
63
|
+
/**
|
|
64
|
+
* @returns width in pixels for 1x1 widget
|
|
65
|
+
*/
|
|
66
|
+
static GetWidgetWidth(): number;
|
|
67
|
+
/**
|
|
68
|
+
* @returns height in pixels for 1x1 widget
|
|
69
|
+
*/
|
|
70
|
+
static GetWidgetHeight(): number;
|
|
71
|
+
/**
|
|
72
|
+
* @returns width in pixels for widget gutter
|
|
73
|
+
*/
|
|
74
|
+
static GetWidgetMarginWidth(): number;
|
|
75
|
+
/**
|
|
76
|
+
* @returns height in pixels for widget gutter
|
|
77
|
+
*/
|
|
78
|
+
static GetWidgetMarginHeight(): number;
|
|
79
|
+
/**
|
|
80
|
+
* Converts widget column span into pixels
|
|
81
|
+
* @returns width in pixels
|
|
82
|
+
*/
|
|
83
|
+
static ColumnsToPixelWidth(columnSpan: number): number;
|
|
84
|
+
/**
|
|
85
|
+
* Converts widget row span into pixels
|
|
86
|
+
* @returns height in pixels
|
|
87
|
+
*/
|
|
88
|
+
static RowsToPixelHeight(rowSpan: number): number;
|
|
89
|
+
}
|