Merge pull request #17149 from assuntad23/bug/16922/wf-report-disable-button

[23.2] Disable Workflow Report and Generate PDF buttons unless workflow is successful
This commit is contained in:
Marius van den Beek
2023-12-15 12:56:07 +01:00
committed by GitHub
@@ -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"
@@ -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: {
@@ -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;
},