Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update task execution list #1997

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ui/src/app/shared/api/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export class TaskService {
params = params.append('sort', `${sort},${order}`);
}
return this.httpClient
.get<any>(UrlUtilities.calculateBaseApiUrl() + 'tasks/definitions', {headers, params})
.get<any>(UrlUtilities.calculateBaseApiUrl() + 'tasks/executions', {headers, params})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these changes? I was only expecting tasks/executions in getExecutions to become tasks/thinexecutions

.pipe(map(TaskPage.parse), catchError(ErrorUtils.catchError));
}

getTask(name: string, manifest = false): Observable<Task | unknown> {
const headers = HttpUtils.getDefaultHttpHeaders();
return this.httpClient
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/definitions/${name}?manifest=${manifest}`, {headers})
.get<any>(UrlUtilities.calculateBaseApiUrl() + `tasks/executions/${name}?manifest=${manifest}`, {headers})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these represent an old error that didn't surface?

.pipe(map(Task.parse), catchError(ErrorUtils.catchError));
}

Expand All @@ -62,14 +62,14 @@ export class TaskService {
.append('description', description);
const headers = HttpUtils.getDefaultHttpHeaders();
return this.httpClient
.post(UrlUtilities.calculateBaseApiUrl() + 'tasks/definitions', {}, {headers, params})
.post(UrlUtilities.calculateBaseApiUrl() + 'tasks/executions', {}, {headers, params})
.pipe(catchError(ErrorUtils.catchError));
}

destroyTask(task: Task): Observable<any> {
const headers = HttpUtils.getDefaultHttpHeaders();
return this.httpClient
.delete(UrlUtilities.calculateBaseApiUrl() + 'tasks/definitions/' + task.name, {headers, observe: 'response'})
.delete(UrlUtilities.calculateBaseApiUrl() + 'tasks/executions/' + task.name, {headers, observe: 'response'})
.pipe(catchError(ErrorUtils.catchError));
}

Expand Down Expand Up @@ -216,7 +216,7 @@ export class TaskService {
params = params.append('sort', `${sort},${order}`);
}
return this.httpClient
.get<any>(UrlUtilities.calculateBaseApiUrl() + 'tasks/executions', {headers, params})
.get<any>(UrlUtilities.calculateBaseApiUrl() + 'tasks/definitions', {headers, params})
.pipe(map(TaskExecutionPage.parse), catchError(ErrorUtils.catchError));
}

Expand Down
47 changes: 45 additions & 2 deletions ui/src/app/shared/model/task-execution.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface hrefObj {

interface TaskExecutionLinks {
'tasks/logs': hrefObj;
'tasks/definitions': hrefObj;
}

export class LaunchResponse {
Expand Down Expand Up @@ -106,11 +107,53 @@ export class TaskExecution {
}
}

export class TaskExecutionThin {
executionId: number;
parentExecutionId: number;
exitCode: number;
taskName: string;
startTime: DateTime;
endTime: DateTime;
exitMessage: string;
externalExecutionId: number;
errorMessage: string;
schemaTarget: string;
platformName: string;
_links: TaskExecutionLinks;

static parse(input: any): TaskExecution {
const execution = new TaskExecution();
execution.executionId = input?.executionId;
execution.exitCode = input?.exitCode;
execution.taskName = input?.taskName;
execution.startTime = input?.startTime ? DateTime.fromISO(input.startTime) : null;
execution.endTime = input?.endTime ? DateTime.fromISO(input.endTime) : null;
execution.exitMessage = input?.exitMessage;
execution.schemaTarget = input?.schemaTarget || 'boot2';
execution.errorMessage = input?.errorMessage;
execution.externalExecutionId = input?.externalExecutionId;
execution.parentExecutionId = input?.parentExecutionId;
execution._links = input?._links;
execution.schemaTarget = input?.schemaTarget;
return execution;
}
}

export class TaskExecutionPage extends Page<TaskExecution> {
static parse(input: any): Page<TaskExecution> {
const page = Page.fromJSON<TaskExecution>(input);
if (input && input._embedded && input._embedded.taskExecutionResourceList) {
page.items = input._embedded.taskExecutionResourceList.map(TaskExecution.parse);
if (input && input._embedded && input._embedded.taskExecutionThinResourceList) {
page.items = input._embedded.taskExecutionThinResourceList.map(TaskExecution.parse);
}
return page;
}
}

export class TaskExecutionThinPage extends Page<TaskExecution> {
static parse(input: any): Page<TaskExecutionThin> {
const page = Page.fromJSON<TaskExecutionThin>(input);
if (input && input._embedded && input._embedded.taskExecutionThinResourceList) {
page.items = input._embedded.taskExecutionThinResourceList.map(TaskExecutionThin.parse);
}
return page;
}
Expand Down
Loading