Skip to content

Commit

Permalink
gh-1217 Delete Task Executions
Browse files Browse the repository at this point in the history
- Task Executions list: add bulk delete action and delete action
- Task Execution: add delete action
- Task Definition - Executions list: add bulk delete action and delete action
- Add Task Executions Destroy modal
- Update model TaskExecution: add parentTaskExecutionId
- Update checkbox master: null as an no item
- Task execution with parentTaskExecutionId can not be destroyed

Resolves #1217
  • Loading branch information
oodamien authored and ghillert committed Jul 16, 2019
1 parent 71f5856 commit 6d0f9bd
Show file tree
Hide file tree
Showing 33 changed files with 786 additions and 62 deletions.
2 changes: 1 addition & 1 deletion ui/src/app/apps/app-details/app-details.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class AppDetailsComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class AppsBulkImportPropertiesComponent implements OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AppsRegisterComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class AppsBulkImportUriComponent implements OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class AuditRecordDetailsComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/auth/logout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class LogoutComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/jobs/jobs/jobs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class JobsComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/layout/navigation/navigation.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NavigationComponent implements DoCheck, OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
10 changes: 6 additions & 4 deletions ui/src/app/shared/components/master-checkbox.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,22 @@ export class MasterCheckboxComponent implements DoCheck, AfterViewInit {
if (!this.items) {
return;
}
const count = this.items.reduce((a, b) => b ? a + 1 : a, 0);
const indeterminate = (count > 0 && count < this.items.length);
const filtered = this.items.filter(i => i !== null);
const count = filtered.reduce((a, b) => b ? a + 1 : a, 0);
const indeterminate = (count > 0 && count < filtered.length);
if ((count > 0) === this.input && this.checkbox.nativeElement.indeterminate === indeterminate) {
return;
}

this.input = (count > 0);
this.checkbox.nativeElement.indeterminate = indeterminate;
this.change.emit({value: (count > 0), indeterminate: indeterminate});
}

click() {
for (let i = 0; i < this.items.length; i++) {
this.items[i] = this.input;
if (this.items[i] !== null) {
this.items[i] = this.input;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class StreamCreateDialogComponent extends Modal implements OnInit, OnDest
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class StreamCreateComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/streams/stream/graph/stream-graph.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class StreamGraphComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class StreamsDeployComponent extends Modal implements OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class DeploymentPropertiesComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
8 changes: 6 additions & 2 deletions ui/src/app/tasks/model/task-execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class TaskExecution {
public errorMessage: string;
public externalExecutionId: string;
public taskExecutionStatus: string;
public parentExecutionId: number;

constructor(executionId: number,
exitCode: number,
Expand All @@ -25,7 +26,8 @@ export class TaskExecution {
jobExecutionIds: number[],
errorMessage: string,
externalExecutionId: string,
taskExecutionStatus: string) {
taskExecutionStatus: string,
parentExecutionId: number) {
this.executionId = executionId;
this.exitCode = exitCode;
this.taskName = taskName;
Expand All @@ -37,6 +39,7 @@ export class TaskExecution {
this.errorMessage = errorMessage;
this.taskExecutionStatus = taskExecutionStatus;
this.externalExecutionId = externalExecutionId;
this.parentExecutionId = parentExecutionId;
}

static fromJSON(jsonItem): TaskExecution {
Expand All @@ -51,7 +54,8 @@ export class TaskExecution {
jsonItem.jobExecutionIds,
jsonItem.errorMessage,
jsonItem.externalExecutionId,
jsonItem.taskExecutionStatus);
jsonItem.taskExecutionStatus,
jsonItem.parentExecutionId);
}

static pageFromJSON(input): Page<TaskExecution> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class TaskDefinitionCreateDialogComponent implements OnInit, OnDestroy {
}

/**
* Will cleanup any {@link Subscription}s to prevent
* Will clean up any {@link Subscription}s to prevent
* memory leaks.
*/
ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<div *ngIf="executions$ | async as executions; else loading" id="executions-list" dataflowLayoutType type="full">

<div class="list-bar" *ngIf="!(executions.page.totalPages < 2 && executions.page.items.length === 0)">
<button class="btn btn-default btn-fa" (click)="refresh(executions.params)" title="Refresh" type="button">
<span class="fa fa-refresh"></span>
Refresh
</button>
</div>
<app-list-bar [params]="executions.params" [page]="executions.page" [countSelected]="countSelected()" #listBar
(refresh)="refresh(executions.params)" [hideSearch]="true" [actions]="executionsActions()"
(action)="applyAction($event.action, null, executions.params, executions.page)">
</app-list-bar>

<table *ngIf="executions.page?.items && executions.page.items.length > 0"
class="table table-hover table-actions" id="taskExecutionsTable">
<thead>
<tr>
<th style="width: 30px" [dataflowAppRoles]="['ROLE_DESTROY']">
<app-master-checkbox (change)="changeCheckboxes(executions.page)" *ngIf="form?.checkboxes"
[dataflowAppRoles]="['ROLE_CREATE']" [items]="form.checkboxes"></app-master-checkbox>
</th>
<th style="width: 140px">
<app-sort id="sort-id" (change)="applySort(executions.params, $event)" [value]="'TASK_EXECUTION_ID'"
[sort]="executions.params">
Expand Down Expand Up @@ -42,6 +44,10 @@
<ng-container
*ngFor="let item of executions.page.items | paginate: executions.page.getPaginationInstance(); index as i">
<tr>
<td class="cell-checkbox" [dataflowAppRoles]="['ROLE_DESTROY']">
<input [dataflowAppRoles]="['ROLE_CREATE']" type="checkbox" (change)="changeCheckboxes(executions.page)"
[(ngModel)]="form.checkboxes[i]" *ngIf="!item.parentExecutionId"/>
</td>
<td>
<a (click)="details(item)" style="cursor: pointer">
#{{ item.executionId }}
Expand All @@ -56,13 +62,11 @@
<td>
{{ item.exitCode }}
</td>

<td class="table-actions" width="10px" nowrap="">
<div class="actions-btn" role="group">
<button type="button" name="task-details{{ i }}" (click)="details(item)" class="btn btn-default"
title="Details">
<span class="fa fa-info-circle"></span>
</button>
</div>
<app-list-row-actions [item]="item"
(action)="applyAction($event.action, $event.args, executions.params, executions.page)"
[actions]="executionActions(item, i)"></app-list-row-actions>
</td>
</tr>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { DATAFLOW_LIST } from '../../../shared/components/list/list.component';
import { DATAFLOW_PAGE } from 'src/app/shared/components/page/page.component';
import { MasterCheckboxComponent } from '../../../shared/components/master-checkbox.component';

/**
* Test {@link TaskDefinitionExecutionsComponent}.
Expand All @@ -57,6 +58,7 @@ describe('TaskDefinitionExecutionsComponent', () => {
declarations: [
RolesDirective,
TaskDefinitionExecutionsComponent,
MasterCheckboxComponent,
DataflowDateTimePipe,
AppTypeComponent,
TaskStatusComponent,
Expand Down Expand Up @@ -105,8 +107,8 @@ describe('TaskDefinitionExecutionsComponent', () => {
it('should populate task executions', () => {
fixture.detectChanges();
const des: DebugElement[] = fixture.debugElement.queryAll(By.css('table[id=taskExecutionsTable] tr:first-child td'));
expect(des.length).toBe(5);
expect(des[0].nativeElement.textContent).toContain('#2');
expect(des.length).toBe(6);
expect(des[1].nativeElement.textContent).toContain('#2');
});

describe('no execution', () => {
Expand Down Expand Up @@ -276,7 +278,7 @@ describe('TaskDefinitionExecutionsComponent', () => {
it('should navigate to the detail page', () => {
const line: DebugElement = fixture.debugElement.queryAll(By.css('#taskExecutionsTable tbody tr'))[0];
const navigate = spyOn((<any>component).router, 'navigate');
line.query(By.css('.actions-btn button[name="task-details0"]')).nativeElement.click();
line.query(By.css('.actions button[name="details-execution0"]')).nativeElement.click();
expect(navigate).toHaveBeenCalledWith(['tasks/executions/2']);
});

Expand Down
Loading

0 comments on commit 6d0f9bd

Please sign in to comment.