Skip to content

Commit

Permalink
Merge pull request galaxyproject#17149 from assuntad23/bug/16922/wf-r…
Browse files Browse the repository at this point in the history
…eport-disable-button

[23.2] Disable Workflow Report and Generate PDF buttons unless workflow is successful
  • Loading branch information
mvdbeek authored Dec 15, 2023
2 parents c4c8d7b + fd36ded commit ad7fccb
Showing 1 changed file with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@
<div class="mb-3 workflow-invocation-state-component">
<div v-if="invocationAndJobTerminal">
<span>
<b-button v-b-tooltip.hover size="sm" class="invocation-report-link" :href="invocationLink">
<b-button
v-b-tooltip.hover
:title="invocationStateSuccess ? reportTooltip : disabledReportTooltip"
:disabled="!invocationStateSuccess"
size="sm"
class="invocation-report-link"
:href="invocationLink">
View Report
</b-button>
<b-button
v-b-tooltip.hover
:title="invocationStateSuccess ? generatePdfTooltip : disabledReportTooltip"
:disabled="!invocationStateSuccess"
size="sm"
class="invocation-pdf-link"
:href="invocationPdfLink"
Expand Down Expand Up @@ -109,6 +117,8 @@ export default {
return {
stepStatesInterval: null,
jobStatesInterval: null,
reportTooltip: "View report for this workflow invocation",
generatePdfTooltip: "Generate PDF report for this workflow invocation",
};
},
computed: {
Expand All @@ -126,6 +136,28 @@ export default {
invocationState: function () {
return this.invocation?.state || "new";
},
invocationStateSuccess: function () {
return this.invocationState == "scheduled" && this.runningCount === 0 && this.invocationAndJobTerminal;
},
disabledReportTooltip: function () {
const state = this.invocationState;
const runCount = this.runningCount;
if (this.invocationState != "scheduled") {
return (
"This workflow is not currently scheduled. The current state is ",
state,
". Once the workflow is fully scheduled and jobs have complete this option will become available."
);
} else if (runCount != 0) {
return (
"The workflow invocation still contains ",
runCount,
" running job(s). Once these jobs have completed this option will become available. "
);
} else {
return "Steps for this workflow are still running. A report will be available once complete.";
}
},
stepCount: function () {
return this.invocation?.steps.length;
},
Expand Down

0 comments on commit ad7fccb

Please sign in to comment.