diff --git a/.vscode/launch.json b/.vscode/launch.json index 963beefeee..1473cfbfe4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Launch", "type": "node", "request": "launch", - "protocol": "inspector", + "protocol": "legacy", "program": "${workspaceRoot}/src/client/main.ts", "stopOnEntry": false, "args": [], diff --git a/app/components/task/action/add/task-create-basic-dialog.component.ts b/app/components/task/action/add/task-create-basic-dialog.component.ts index e9c6c4c982..57f8e8c2a0 100644 --- a/app/components/task/action/add/task-create-basic-dialog.component.ts +++ b/app/components/task/action/add/task-create-basic-dialog.component.ts @@ -51,7 +51,7 @@ export class TaskCreateBasicDialogComponent extends DynamicForm -
- - - - Id is a required field - Id has a maximum length of 64 characters - Id can contain any combination of alphanumeric characters including hyphens and underscores -
+
+
+ + + + Id is a required field + Id has a maximum length of 64 characters + Id can contain any combination of alphanumeric characters including hyphens and underscores +
-
- - - - Display name has a maximum length of 1024 characters +
+ + + + Display name has a maximum length of 1024 characters +
@@ -32,6 +34,10 @@ Retry count values can range from -1 to 100
+
+ + +
diff --git a/app/components/task/details/task-configuration.html b/app/components/task/details/task-configuration.html index 7f5f8fc9f7..1d093770b3 100644 --- a/app/components/task/details/task-configuration.html +++ b/app/components/task/details/task-configuration.html @@ -7,7 +7,7 @@ - + diff --git a/app/models/decorators/task-decorator.ts b/app/models/decorators/task-decorator.ts index 4d27176bf2..329770e343 100644 --- a/app/models/decorators/task-decorator.ts +++ b/app/models/decorators/task-decorator.ts @@ -1,4 +1,4 @@ -import { Task, TaskState } from "app/models"; +import { AutoUserScope, Task, TaskState, UserAccountElevationLevel } from "app/models"; import { DecoratorBase } from "app/utils/decorators"; import { ComputeNodeInfoDecorator } from "./compute-node-info-decorator"; import { TaskConstraintsDecorator } from "./task-constraints-decorator"; @@ -16,7 +16,6 @@ export class TaskDecorator extends DecoratorBase { public previousState: string; public previousStateTransitionTime: string; public commandLine: string; - public runElevated: boolean; public successExitCodes: string; public exitConditions: {}; @@ -30,6 +29,7 @@ export class TaskDecorator extends DecoratorBase { public stats: {}; public dependsOn: {}; public applicationPackageReferences: any[]; + public userIdentitySummary: string; constructor(task: Task) { super(task); @@ -45,7 +45,6 @@ export class TaskDecorator extends DecoratorBase { this.previousState = this.stateField(task.previousState); this.previousStateTransitionTime = this.dateField(task.previousStateTransitionTime); this.commandLine = this.stringField(task.commandLine); - this.runElevated = task.runElevated; this.exitConditions = task.exitConditions || {}; this.resourceFiles = task.resourceFiles || {}; @@ -58,6 +57,8 @@ export class TaskDecorator extends DecoratorBase { this.stats = task.stats || {}; this.dependsOn = task.dependsOn || {}; this.applicationPackageReferences = task.applicationPackageReferences || []; + + this._initUserIdentity(); } private _getStateIcon(state: TaskState): string { @@ -73,4 +74,25 @@ export class TaskDecorator extends DecoratorBase { return "fa-question-circle-o"; } } + + private _initUserIdentity() { + const userIdentity = this.original.userIdentity; + let value; + if (!userIdentity || (!userIdentity.userName && !userIdentity.autoUser)) { + value = "Task user"; + } else if (userIdentity.autoUser) { + const isAdmin = userIdentity.autoUser.elevationLevel === UserAccountElevationLevel.admin; + const isPoolScope = userIdentity.autoUser.scope === AutoUserScope.pool; + const scope = isPoolScope ? "Pool default user" : "Task default user"; + if (isAdmin) { + value = `${scope} (Admin)`; + } else { + value = scope; + } + } else { + value = userIdentity.userName; + } + + this.userIdentitySummary = value; + } } diff --git a/app/models/dtos/task-create.dto.ts b/app/models/dtos/task-create.dto.ts index 396895f475..8e7ee9bcd9 100644 --- a/app/models/dtos/task-create.dto.ts +++ b/app/models/dtos/task-create.dto.ts @@ -30,7 +30,7 @@ export class TaskCreateDto extends Dto { public constraints?: ConstraintDto; @DtoAttr() - public runElevated?: boolean; + public userIdentity?: any; @DtoAttr() public multiInstanceSettings?: any; diff --git a/app/models/forms/create-task-model.ts b/app/models/forms/create-task-model.ts index 1505f343f6..305e62bceb 100644 --- a/app/models/forms/create-task-model.ts +++ b/app/models/forms/create-task-model.ts @@ -15,7 +15,7 @@ export interface CreateTaskModel { environmentSettings: any[]; affinityInfo: any; constraints: TaskConstraintsModel; - runElevated: boolean; + userIdentity: any; multiInstanceSettings: any; applicationPackageReferences: any[]; } @@ -36,7 +36,7 @@ export function createTaskFormToJsonData(formData: CreateTaskModel): any { maxTaskRetryCount: formData.constraints.maxTaskRetryCount, retentionTime: retentionTime, }, - runElevated: formData.runElevated, + userIdentity: formData.userIdentity, multiInstanceSettings: null, applicationPackageReferences: null, }; @@ -53,8 +53,7 @@ export function taskToFormModel(task: TaskCreateDto): CreateTaskModel { resourceFiles: task.resourceFiles, environmentSettings: task.environmentSettings, affinityInfo: task.affinityInfo, - - runElevated: task.runElevated, + userIdentity: task.userIdentity, multiInstanceSettings: task.multiInstanceSettings, applicationPackageReferences: task.applicationPackageReferences, }; diff --git a/app/models/task.ts b/app/models/task.ts index c423a430d1..b8cc675ee8 100644 --- a/app/models/task.ts +++ b/app/models/task.ts @@ -13,6 +13,7 @@ import { TaskDependencies } from "./task-dependencies"; import { TaskExecutionInformation } from "./task-execution-information"; import { TaskExitConditions } from "./task-exit-conditions"; import { TaskOutputFile } from "./task-output-file"; +import { UserIdentity } from "./user-identity"; export interface TaskAttributes { id: string; @@ -55,7 +56,7 @@ export class Task extends Record { @Prop() public previousState: TaskState; @Prop() public previousStateTransitionTime: Date; @Prop() public commandLine: string; - @Prop() public runElevated: boolean; + @Prop() public userIdentity: UserIdentity; @Prop() public exitConditions: TaskExitConditions = new TaskExitConditions(); @ListProp(ResourceFile) public resourceFiles: List = List([]); @ListProp(TaskOutputFile) public outputFiles: List = List([]);