Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Expose check info in the task status transition bar

天舟e1d407b71001
diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
index f56022caba..2d8c78e606 100644
--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue
+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
@@ -102,6 +102,7 @@
:mode="updateStatusModalState.mode"
:okText="updateStatusModalState.okText"
:issue="issue"
+ :task="currentTask"
:transition="updateStatusModalState.transition"
:outputFieldList="issueTemplate.outputFieldList"
@submit="
@@ -249,7 +250,7 @@ export default {
const tryStartTaskStatusTransition = (transition: TaskStatusTransition) => {
updateStatusModalState.mode = "TASK";
updateStatusModalState.okText = transition.buttonName;
- const task = activeTask((props.issue as Issue).pipeline);
+ const task = currentTask.value;
switch (transition.type) {
case "RUN":
updateStatusModalState.style = "INFO";
@@ -316,9 +317,8 @@ export default {
return list
.filter((item) => {
const pipeline = (props.issue as Issue).pipeline;
- const currentTask = activeTask(pipeline);
// Disallow any issue status transition if the active task is in RUNNING state.
- if (currentTask.status == "RUNNING") {
+ if (currentTask.value.status == "RUNNING") {
return false;
}
@@ -327,8 +327,8 @@ export default {
if (
item == "RESOLVE" &&
taskList.length > 0 &&
- (currentTask.id != taskList[taskList.length - 1].id ||
- currentTask.status != "DONE")
+ (currentTask.value.id != taskList[taskList.length - 1].id ||
+ currentTask.value.status != "DONE")
) {
return false;
}
@@ -343,6 +343,10 @@ export default {
}
);
+ const currentTask = computed(() => {
+ return activeTask((props.issue as Issue).pipeline);
+ });
+
const allowIssueStatusTransition = (
transition: IssueStatusTransition
): boolean => {
@@ -443,6 +447,7 @@ export default {
tryStartTaskStatusTransition,
doTaskStatusTransition,
applicableIssueStatusTransitionList,
+ currentTask,
allowIssueStatusTransition,
tryStartIssueStatusTransition,
doIssueStatusTransition,
diff --git a/frontend/src/components/StatusTransitionForm.vue b/frontend/src/components/StatusTransitionForm.vue
index 840e26a015..8f0b440e80 100644
--- a/frontend/src/components/StatusTransitionForm.vue
+++ b/frontend/src/components/StatusTransitionForm.vue
@@ -44,6 +44,38 @@
</template>
</template>
+ <div
+ v-if="mode == 'TASK' && task.taskCheckRunList.length > 0"
+ class="sm:col-span-4 mb-4 space-y-4"
+ >
+ <template v-if="runningCheckCount > 0">
+ <BBAttention
+ :style="'INFO'"
+ :title="`${runningCheckCount} check(s) in progress...`"
+ />
+ </template>
+ <template v-else>
+ <BBAttention
+ v-if="checkSummary.errorCount > 0"
+ :style="'CRITICAL'"
+ :title="
+ allowSubmit
+ ? `Check found ${checkSummary.errorCount} error(s) and ${checkSummary.warnCount} warning(s)`
+ : `Check found ${checkSummary.errorCount} error(s) and ${checkSummary.warnCount} warning(s), please fix before proceeding`
+ "
+ />
+ <BBAttention
+ v-else-if="checkSummary.warnCount > 0"
+ :style="'WARN'"
+ :title="`Check found ${checkSummary.warnCount} warning(s)`"
+ />
+ </template>
+ <TaskCheckBadgeBar
+ :taskCheckRunList="task.taskCheckRunList"
+ :allowSelection="false"
+ />
+ </div>
+
<div class="sm:col-span-4 w-112 min-w-full">
<label for="about" class="textlabel"> Note </label>
<div class="mt-1">
@@ -90,6 +122,7 @@
type="button"
class="ml-3 px-4 py-2"
v-bind:class="submitButtonStyle"
+ :disabled="!allowSubmit"
@click.prevent="$emit('submit', state.comment)"
>
{{ okText }}
@@ -102,10 +135,17 @@
import { computed, reactive, ref, PropType } from "vue";
import cloneDeep from "lodash-es/cloneDeep";
import DatabaseSelect from "./DatabaseSelect.vue";
-import { Issue, IssueStatusTransition } from "../types";
+import TaskCheckBadgeBar from "./TaskCheckBadgeBar.vue";
+import { Issue, IssueStatusTransition, Task, TaskCheckRun } from "../types";
import { OutputField, IssueBuiltinFieldId } from "../plugins";
import { activeEnvironment, TaskStatusTransition } from "../utils";
+type CheckSummary = {
+ successCount: number;
+ warnCount: number;
+ errorCount: number;
+};
+
interface LocalState {
comment: string;
outputValueList: string[];
@@ -127,6 +167,10 @@ export default {
required: true,
type: Object as PropType<Issue>,
},
+ // Applicable when mode = 'TASK'
+ task: {
+ type: Object as PropType<Task>,
+ },
transition: {
required: true,
type: Object as PropType<IssueStatusTransition | TaskStatusTransition>,
@@ -136,7 +180,7 @@ export default {
type: Object as PropType<OutputField[]>,
},
},
- components: { DatabaseSelect },
+ components: { DatabaseSelect, TaskCheckBadgeBar },
setup(props, { emit }) {
const commentTextArea = ref("");
@@ -180,11 +224,80 @@ export default {
}
});
+ // Disable submit if in TASK mode and there exists RUNNING check or check error and we are transitioning to RUNNING
+ const allowSubmit = computed(() => {
+ switch (props.mode) {
+ case "ISSUE": {
+ return true;
+ }
+ case "TASK": {
+ switch ((props.transition as TaskStatusTransition).to) {
+ case "RUNNING":
+ return (
+ runningCheckCount.value == 0 &&
+ checkSummary.value.errorCount == 0
+ );
+ default:
+ return true;
+ }
+ }
+ }
+ });
+
+ const runningCheckCount = computed((): number => {
+ let count = 0;
+ for (const run of props.task!.taskCheckRunList) {
+ if (run.status == "RUNNING") {
+ count++;
+ }
+ }
+ return count;
+ });
+
+ const checkSummary = computed((): CheckSummary => {
+ const summary: CheckSummary = {
+ successCount: 0,
+ warnCount: 0,
+ errorCount: 0,
+ };
+
+ // For a particular check type, only counts the most recent one
+ const list: TaskCheckRun[] = [];
+ for (const run of props.task!.taskCheckRunList) {
+ const index = list.findIndex((item) => item.type == run.type);
+ if (index >= 0 && list[index].createdTs < run.createdTs) {
+ list[index] = run;
+ } else {
+ list.push(run);
+ }
+ }
+
+ for (const check of list) {
+ if (check.status == "DONE") {
+ for (const result of check.result.resultList) {
+ if (result.status == "SUCCESS") {
+ summary.successCount++;
+ } else if (result.status == "WARN") {
+ summary.warnCount++;
+ } else if (result.status == "ERROR") {
+ summary.errorCount++;
+ }
+ }
+ } else if (check.status == "FAILED") {
+ summary.errorCount++;
+ }
+ }
+ return summary;
+ });
+
return {
state,
environmentId,
commentTextArea,
submitButtonStyle,
+ allowSubmit,
+ runningCheckCount,
+ checkSummary,
};
},
};
diff --git a/frontend/src/components/TaskCheckBadgeBar.vue b/frontend/src/components/TaskCheckBadgeBar.vue
index 45ed85cb26..02c0a5bbc7 100644
--- a/frontend/src/components/TaskCheckBadgeBar.vue
+++ b/frontend/src/components/TaskCheckBadgeBar.vue
@@ -11,15 +11,15 @@
px-3
py-0.5
rounded-full
- text-sm
- border border-control-border
- hover:bg-control-bg-hover
- text-main
+ text-sm text-main
"
:class="
- showSelection && checkRun.type == state.selectedTaskCheckRun.type
- ? 'bg-control-bg-hover'
- : ''
+ allowSelection
+ ? stickySelection &&
+ checkRun.type == state.selectedTaskCheckRun.type
+ ? 'cursor-pointer border border-control-border hover:bg-control-bg-hover bg-control-bg-hover'
+ : 'cursor-pointer border border-control-border hover:bg-control-bg-hover'
+ : 'cursor-default'
"
@click.prevent="selectTaskCheckRun(checkRun)"
>
@@ -127,7 +127,11 @@ export default {
required: true,
type: Object as PropType<TaskCheckRun[]>,
},
- showSelection: {
+ allowSelection: {
+ default: true,
+ type: Boolean,
+ },
+ stickySelection: {
default: false,
type: Boolean,
},
diff --git a/frontend/src/components/TaskCheckBar.vue b/frontend/src/components/TaskCheckBar.vue
index 2c0a5d7267..858c380f6a 100644
--- a/frontend/src/components/TaskCheckBar.vue
+++ b/frontend/src/components/TaskCheckBar.vue
@@ -25,7 +25,8 @@
<div>
<TaskCheckBadgeBar
:taskCheckRunList="task.taskCheckRunList"
- :showSelection="true"
+ :allowSelection="true"
+ :stickySelection="true"
:selectedTaskCheckRun="state.selectedTaskCheckRun"
@select-task-check-run="
(checkRun) => {