Skip to content

Commit 93a5612

Browse files
Andrei SalanovichAndrei Salanovich
authored andcommitted
#352: add PSVersion to the component in order it to save its value for scripts during update
1 parent 80de8ed commit 93a5612

File tree

5 files changed

+259
-5
lines changed

5 files changed

+259
-5
lines changed

src/Dorc.ApiModel/ComponentAPIModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ public class ComponentApiModel
1414
public bool StopOnFailure { get; set; }
1515
public int ParentId { get; set; }
1616
public bool? IsEnabled { set; get; }
17+
public string PSVersion { set; get; }
1718
}
1819
}

src/Dorc.PersistentData/Sources/ManageProjectsPersistentSource.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public void CreateComponent(ComponentApiModel apiComponent, int projectId, int?
312312
Path = apiComponent.ScriptPath,
313313
NonProdOnly = apiComponent.NonProdOnly,
314314
IsPathJSON = IsScriptPathJson(apiComponent.ScriptPath),
315-
PowerShellVersionNumber = PowerShellVersion.V7.ToVersionString()
315+
PowerShellVersionNumber = string.IsNullOrEmpty(apiComponent.PSVersion) ? PowerShellVersion.V7.ToVersionString() : apiComponent.PSVersion
316316
};
317317

318318
component.Script = script;
@@ -359,6 +359,7 @@ public void UpdateComponent(ComponentApiModel apiComponent, int projectId, int?
359359
script.Path = apiComponent.ScriptPath;
360360
script.NonProdOnly = apiComponent.NonProdOnly;
361361
script.IsPathJSON = IsScriptPathJson(apiComponent.ScriptPath);
362+
script.PowerShellVersionNumber = string.IsNullOrEmpty(apiComponent.PSVersion) ? PowerShellVersion.V7.ToVersionString() : apiComponent.PSVersion;
362363
}
363364
else if (apiComponent.ScriptPath == null)
364365
{
@@ -372,7 +373,7 @@ public void UpdateComponent(ComponentApiModel apiComponent, int projectId, int?
372373
Path = apiComponent.ScriptPath,
373374
NonProdOnly = apiComponent.NonProdOnly,
374375
IsPathJSON = IsScriptPathJson(apiComponent.ScriptPath),
375-
PowerShellVersionNumber = PowerShellVersion.V7.ToVersionString()
376+
PowerShellVersionNumber = string.IsNullOrEmpty(apiComponent.PSVersion) ? PowerShellVersion.V7.ToVersionString() : apiComponent.PSVersion
376377
};
377378
component.Script = script;
378379
}
@@ -502,7 +503,8 @@ private static ComponentApiModel MapToComponentApiModel(Component comp)
502503
NonProdOnly = script.NonProdOnly,
503504
StopOnFailure = comp.StopOnFailure,
504505
IsEnabled = comp.IsEnabled,
505-
ParentId = comp.Parent != null ? comp.Parent.Id : 0
506+
ParentId = comp.Parent != null ? comp.Parent.Id : 0,
507+
PSVersion = script.PowerShellVersionNumber
506508
};
507509

508510
return new ComponentApiModel

src/dorc-web/src/apis/dorc-api/models/ComponentApiModel.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ export interface ComponentApiModel {
5151
* @memberof ComponentApiModel
5252
*/
5353
IsEnabled?: boolean | null;
54+
/**
55+
* @type {string}
56+
* @memberof ComponentApiModel
57+
*/
58+
PSVersion?: string | null;
5459
}

src/dorc-web/src/apis/dorc-api/models/ConfigValueApiModel.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export interface ConfigValueApiModel {
3737
*/
3838
Secure?: boolean;
3939
/**
40-
* @type {boolean | undefined}
40+
* @type {boolean}
4141
* @memberof ConfigValueApiModel
4242
*/
43-
IsForProd?: boolean;
43+
IsForProd?: boolean | null;
4444
}

src/dorc-web/src/apis/dorc-api/swagger.json

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,150 @@
220220
}
221221
}
222222
},
223+
"/Analytics/EnvironmentUsage": {
224+
"get": {
225+
"tags": [
226+
"Analytics"
227+
],
228+
"responses": {
229+
"200": {
230+
"description": "OK",
231+
"content": {
232+
"application/json": {
233+
"schema": {
234+
"type": "array",
235+
"items": {
236+
"$ref": "#/components/schemas/AnalyticsEnvironmentUsageApiModel"
237+
}
238+
}
239+
},
240+
"text/json": {
241+
"schema": {
242+
"type": "array",
243+
"items": {
244+
"$ref": "#/components/schemas/AnalyticsEnvironmentUsageApiModel"
245+
}
246+
}
247+
}
248+
}
249+
}
250+
}
251+
}
252+
},
253+
"/Analytics/UserActivity": {
254+
"get": {
255+
"tags": [
256+
"Analytics"
257+
],
258+
"responses": {
259+
"200": {
260+
"description": "OK",
261+
"content": {
262+
"application/json": {
263+
"schema": {
264+
"type": "array",
265+
"items": {
266+
"$ref": "#/components/schemas/AnalyticsUserActivityApiModel"
267+
}
268+
}
269+
},
270+
"text/json": {
271+
"schema": {
272+
"type": "array",
273+
"items": {
274+
"$ref": "#/components/schemas/AnalyticsUserActivityApiModel"
275+
}
276+
}
277+
}
278+
}
279+
}
280+
}
281+
}
282+
},
283+
"/Analytics/TimePattern": {
284+
"get": {
285+
"tags": [
286+
"Analytics"
287+
],
288+
"responses": {
289+
"200": {
290+
"description": "OK",
291+
"content": {
292+
"application/json": {
293+
"schema": {
294+
"type": "array",
295+
"items": {
296+
"$ref": "#/components/schemas/AnalyticsTimePatternApiModel"
297+
}
298+
}
299+
},
300+
"text/json": {
301+
"schema": {
302+
"type": "array",
303+
"items": {
304+
"$ref": "#/components/schemas/AnalyticsTimePatternApiModel"
305+
}
306+
}
307+
}
308+
}
309+
}
310+
}
311+
}
312+
},
313+
"/Analytics/ComponentUsage": {
314+
"get": {
315+
"tags": [
316+
"Analytics"
317+
],
318+
"responses": {
319+
"200": {
320+
"description": "OK",
321+
"content": {
322+
"application/json": {
323+
"schema": {
324+
"type": "array",
325+
"items": {
326+
"$ref": "#/components/schemas/AnalyticsComponentUsageApiModel"
327+
}
328+
}
329+
},
330+
"text/json": {
331+
"schema": {
332+
"type": "array",
333+
"items": {
334+
"$ref": "#/components/schemas/AnalyticsComponentUsageApiModel"
335+
}
336+
}
337+
}
338+
}
339+
}
340+
}
341+
}
342+
},
343+
"/Analytics/Duration": {
344+
"get": {
345+
"tags": [
346+
"Analytics"
347+
],
348+
"responses": {
349+
"200": {
350+
"description": "OK",
351+
"content": {
352+
"application/json": {
353+
"schema": {
354+
"$ref": "#/components/schemas/AnalyticsDurationApiModel"
355+
}
356+
},
357+
"text/json": {
358+
"schema": {
359+
"$ref": "#/components/schemas/AnalyticsDurationApiModel"
360+
}
361+
}
362+
}
363+
}
364+
}
365+
}
366+
},
223367
"/AnalyticsDeploymentsDate": {
224368
"get": {
225369
"tags": [
@@ -6498,6 +6642,20 @@
64986642
"type": "integer",
64996643
"format": "int32"
65006644
},
6645+
"AnalyticsComponentUsageApiModel": {
6646+
"type": "object",
6647+
"properties": {
6648+
"ComponentName": {
6649+
"type": "string",
6650+
"nullable": true
6651+
},
6652+
"CountOfDeployments": {
6653+
"type": "integer",
6654+
"format": "int32"
6655+
}
6656+
},
6657+
"additionalProperties": false
6658+
},
65016659
"AnalyticsDeploymentsPerProjectApiModel": {
65026660
"type": "object",
65036661
"properties": {
@@ -6528,6 +6686,86 @@
65286686
},
65296687
"additionalProperties": false
65306688
},
6689+
"AnalyticsDurationApiModel": {
6690+
"type": "object",
6691+
"properties": {
6692+
"AverageDurationMinutes": {
6693+
"type": "number",
6694+
"format": "double"
6695+
},
6696+
"MaxDurationMinutes": {
6697+
"type": "number",
6698+
"format": "double"
6699+
},
6700+
"MinDurationMinutes": {
6701+
"type": "number",
6702+
"format": "double"
6703+
},
6704+
"TotalDeployments": {
6705+
"type": "integer",
6706+
"format": "int32"
6707+
}
6708+
},
6709+
"additionalProperties": false
6710+
},
6711+
"AnalyticsEnvironmentUsageApiModel": {
6712+
"type": "object",
6713+
"properties": {
6714+
"EnvironmentName": {
6715+
"type": "string",
6716+
"nullable": true
6717+
},
6718+
"CountOfDeployments": {
6719+
"type": "integer",
6720+
"format": "int32"
6721+
},
6722+
"Failed": {
6723+
"type": "integer",
6724+
"format": "int32"
6725+
}
6726+
},
6727+
"additionalProperties": false
6728+
},
6729+
"AnalyticsTimePatternApiModel": {
6730+
"type": "object",
6731+
"properties": {
6732+
"HourOfDay": {
6733+
"type": "integer",
6734+
"format": "int32"
6735+
},
6736+
"DayOfWeek": {
6737+
"type": "integer",
6738+
"format": "int32"
6739+
},
6740+
"DayOfWeekName": {
6741+
"type": "string",
6742+
"nullable": true
6743+
},
6744+
"CountOfDeployments": {
6745+
"type": "integer",
6746+
"format": "int32"
6747+
}
6748+
},
6749+
"additionalProperties": false
6750+
},
6751+
"AnalyticsUserActivityApiModel": {
6752+
"type": "object",
6753+
"properties": {
6754+
"UserName": {
6755+
"type": "string",
6756+
"nullable": true
6757+
},
6758+
"CountOfDeployments": {
6759+
"type": "integer",
6760+
"format": "int32"
6761+
},
6762+
"Failed": {
6763+
"type": "integer",
6764+
"format": "int32"
6765+
}
6766+
},
6767+
"additionalProperties": false
6768+
},
65316769
"ApiBoolResult": {
65326770
"type": "object",
65336771
"properties": {
@@ -6660,6 +6898,10 @@
66606898
"IsEnabled": {
66616899
"type": "boolean",
66626900
"nullable": true
6901+
},
6902+
"PSVersion": {
6903+
"type": "string",
6904+
"nullable": true
66636905
}
66646906
},
66656907
"additionalProperties": false
@@ -6697,6 +6939,10 @@
66976939
},
66986940
"Secure": {
66996941
"type": "boolean"
6942+
},
6943+
"IsForProd": {
6944+
"type": "boolean",
6945+
"nullable": true
67006946
}
67016947
},
67026948
"additionalProperties": false

0 commit comments

Comments
 (0)