Skip to content

Commit

Permalink
ability to cancel label changes (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
agduncan94 authored Jun 18, 2018
1 parent c0e8edd commit 0b2e382
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/container/container.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ <h3>
(matChipInputTokenEnd)="addToLabels($event)"/>
</mat-chip-list>
</mat-form-field>
<button type="button"(click)="cancelLabelChanges()" class="btn btn-link" *ngIf="labelsEditMode && !isToolPublic">
<span class="glyphicon glyphicon-remove"></span> Cancel
</button>
<button type="button"(click)="submitContainerEdits()" class="btn btn-link" *ngIf="labelsEditMode && !isToolPublic">
<span class="glyphicon glyphicon-floppy-save"></span>Save
</button>
Expand Down
5 changes: 5 additions & 0 deletions src/app/container/container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ export class ContainerComponent extends Entry {
});
}

cancelLabelChanges(): void {
this.containerEditData.labels = this.dockstoreService.getLabelStrings(this.tool.labels);
this.labelsEditMode = false;
}

public toolCopyBtnClick(copyBtn): void {
this.containerService.setCopyBtn(copyBtn);
}
Expand Down
5 changes: 5 additions & 0 deletions src/app/shared/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,9 @@ export abstract class Entry implements OnInit, OnDestroy, AfterViewInit {
* @param label label to remove
*/
abstract removeLabel(label: any): void;

/**
* Cancels any unsaved label changes
*/
abstract cancelLabelChanges(): void;
}
7 changes: 5 additions & 2 deletions src/app/workflow/workflow.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h3>
<div *ngIf="workflow" class="col-sm-12" style="margin-bottom: 5px;">
<span *ngIf="!labelsEditMode">
<mat-chip-list>
<mat-chip color="primary" *ngFor="let label of workflowEditData.labels" (click)="goToSearch(label)">{{label}}</mat-chip>
<mat-chip color="primary" *ngFor="let label of workflowEditData" (click)="goToSearch(label)">{{label}}</mat-chip>
<button type="button" *ngIf="!labelsEditMode && !isWorkflowPublic" class="btn btn-link" (click)="toggleLabelsEditMode()">
Manage labels
</button>
Expand All @@ -112,8 +112,11 @@ <h3>
(matChipInputTokenEnd)="addToLabels($event)"/>
</mat-chip-list>
</mat-form-field>
<button type="button"(click)="cancelLabelChanges()" class="btn btn-link" *ngIf="labelsEditMode && !isWorkflowPublic">
<span class="glyphicon glyphicon-remove"></span> Cancel
</button>
<button type="button"(click)="submitWorkflowEdits()" class="btn btn-link" *ngIf="labelsEditMode && !isWorkflowPublic">
<span class="glyphicon glyphicon-floppy-save"></span>Save
<span class="glyphicon glyphicon-floppy-save"></span> Save
</button>
</span>
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/workflow/workflow.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ export class WorkflowComponent extends Entry {
this.setWorkflowLabels();
}
}

cancelLabelChanges(): void {
this.workflowEditData.labels = this.dockstoreService.getLabelStrings(this.workflow.labels);
this.labelsEditMode = false;
}

setWorkflowLabels(): any {
return this.workflowsService.updateLabels(this.workflow.id, this.workflowEditData.labels.join(', '))
.subscribe(workflow => {
Expand Down

0 comments on commit 0b2e382

Please sign in to comment.