From 0b2e38229d8e0fb11ca2a30a831019c38941f646 Mon Sep 17 00:00:00 2001 From: Andrew Duncan Date: Mon, 18 Jun 2018 11:02:47 -0400 Subject: [PATCH] ability to cancel label changes (#308) --- src/app/container/container.component.html | 3 +++ src/app/container/container.component.ts | 5 +++++ src/app/shared/entry.ts | 5 +++++ src/app/workflow/workflow.component.html | 7 +++++-- src/app/workflow/workflow.component.ts | 6 ++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/app/container/container.component.html b/src/app/container/container.component.html index 13569af423..49950b3198 100644 --- a/src/app/container/container.component.html +++ b/src/app/container/container.component.html @@ -121,6 +121,9 @@

(matChipInputTokenEnd)="addToLabels($event)"/> + diff --git a/src/app/container/container.component.ts b/src/app/container/container.component.ts index 1cd55d4d6b..d66b9cd9e9 100644 --- a/src/app/container/container.component.ts +++ b/src/app/container/container.component.ts @@ -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); } diff --git a/src/app/shared/entry.ts b/src/app/shared/entry.ts index 9d386789be..6734f06a9c 100644 --- a/src/app/shared/entry.ts +++ b/src/app/shared/entry.ts @@ -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; } diff --git a/src/app/workflow/workflow.component.html b/src/app/workflow/workflow.component.html index f0cb0b2aa0..3717aa08c1 100644 --- a/src/app/workflow/workflow.component.html +++ b/src/app/workflow/workflow.component.html @@ -90,7 +90,7 @@

- {{label}} + {{label}} @@ -112,8 +112,11 @@

(matChipInputTokenEnd)="addToLabels($event)"/> +

diff --git a/src/app/workflow/workflow.component.ts b/src/app/workflow/workflow.component.ts index 5eec4e4169..e1013d420e 100644 --- a/src/app/workflow/workflow.component.ts +++ b/src/app/workflow/workflow.component.ts @@ -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 => {