Skip to content

Commit

Permalink
give better success message for saving hosted workflow versions (#853)
Browse files Browse the repository at this point in the history
* #2905 give better message on success for saving hosted workflow versions
  • Loading branch information
NatalieEO authored and Ldcabansay committed Dec 20, 2019
1 parent 7dfc899 commit 11cb47d
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ export class WorkflowFileEditorComponent extends FileEditing {
if (!this.versions || this.versions.length === 0) {
return true;
}
const mostRecentId = this.versions.reduce((max, n) => Math.max(max, n.id), this.versions[0].id);
const mostRecentId = this.getIdOfNewestVersion(this.versions);
return this._selectedVersion.id === mostRecentId;
}

getIdOfNewestVersion(versions: Array<WorkflowVersion>): number {
return versions.reduce((max, n) => Math.max(max, n.id), this.versions[0].id);
}

/**
* Splits up the sourcefiles for the version into descriptor files and test parameter files
*/
Expand Down Expand Up @@ -107,7 +111,11 @@ export class WorkflowFileEditorComponent extends FileEditing {
this.workflowsService.getWorkflow(editedWorkflow.id).subscribe(
(newlyGottenWorkflow: Workflow) => {
this.workflowService.setWorkflow(newlyGottenWorkflow);
this.alertService.detailedSuccess();
const mostRecentId = this.getIdOfNewestVersion(newlyGottenWorkflow.workflowVersions);
const updatedVersion = newlyGottenWorkflow.workflowVersions.find(v => v.id === mostRecentId);
this.alertService.detailedSuccess(
'Saved version ' + updatedVersion.name + ' of hosted workflow ' + newlyGottenWorkflow.repository
);
},
error => {
this.alertService.detailedError(error);
Expand Down

0 comments on commit 11cb47d

Please sign in to comment.