Skip to content

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

Refine the IssueStatusIcon to show stepStatus instead of taskStatus

天舟b869125f275c
diff --git a/frontend/src/components/IssueStatusIcon.vue b/frontend/src/components/IssueStatusIcon.vue
index e9a5179fa5..b63af5f0fa 100644
--- a/frontend/src/components/IssueStatusIcon.vue
+++ b/frontend/src/components/IssueStatusIcon.vue
@@ -5,13 +5,13 @@
>
<template v-if="issueStatus === `OPEN`">
<span
- v-if="taskStatus === 'RUNNING'"
+ v-if="stepStatus === 'RUNNING'"
class="h-2 w-2 bg-blue-600 hover:bg-blue-700 rounded-full"
style="animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"
aria-hidden="true"
></span>
<span
- v-else-if="taskStatus === 'FAILED'"
+ v-else-if="stepStatus === 'FAILED'"
class="h-2 w-2 rounded-full text-center pb-6 font-normal text-base"
aria-hidden="true"
>!</span
@@ -58,8 +58,7 @@
<script lang="ts">
import { PropType } from "vue";
-import { activeTask } from "../utils";
-import { TaskStatus, IssueStatus } from "../types";
+import { StepStatus, IssueStatus } from "../types";
type SizeType = "small" | "normal";
@@ -70,8 +69,9 @@ export default {
required: true,
type: String as PropType<IssueStatus>,
},
- taskStatus: {
- type: String as PropType<TaskStatus>,
+ // Specify stepStatus if we want to show the step specific status when issueStatus is OPEN.
+ stepStatus: {
+ type: String as PropType<StepStatus>,
},
size: {
type: String as PropType<SizeType>,
@@ -84,7 +84,7 @@ export default {
let iconClass = props.size === "normal" ? "w-5 h-5" : "w-4 h-4";
switch (props.issueStatus) {
case "OPEN":
- if (props.taskStatus && props.taskStatus === "FAILED") {
+ if (props.stepStatus && props.stepStatus === "FAILED") {
return (
iconClass +
" bg-error text-white hover:text-white hover:bg-error-hover"
@@ -106,7 +106,6 @@ export default {
return {
issueIconClass,
- activeTask,
};
},
};
diff --git a/frontend/src/components/IssueTable.vue b/frontend/src/components/IssueTable.vue
index 0980bad4c0..ccd14445d1 100644
--- a/frontend/src/components/IssueTable.vue
+++ b/frontend/src/components/IssueTable.vue
@@ -72,7 +72,7 @@
<BBTableCell :leftPadding="4" class="table-cell">
<IssueStatusIcon
:issueStatus="issue.status"
- :taskStatus="activeTask(issue.pipeline).status"
+ :stepStatus="activeStep(issue.pipeline).status"
/>
</BBTableCell>
<BBTableCell v-if="mode == 'ALL'" class="table-cell text-gray-500">
@@ -88,7 +88,7 @@
{{ activeDatabaseName(issue) }}
</BBTableCell>
<BBTableCell class="hidden sm:table-cell">
- <BBStepBar :stepList="taskList(issue)" />
+ <BBStepBar :stepList="stepList(issue)" />
</BBTableCell>
<BBTableCell class="hidden md:table-cell">
{{ humanizeTs(issue.updatedTs) }}
@@ -123,9 +123,10 @@ import {
issueSlug,
activeEnvironment,
activeDatabase,
- activeTask,
+ activeStep,
+ allStepList,
} from "../utils";
-import { Issue, EMPTY_ID } from "../types";
+import { Issue, EMPTY_ID, Step } from "../types";
type Mode = "ALL" | "PROJECT";
@@ -237,33 +238,12 @@ export default {
const router = useRouter();
- const taskList = function (issue: Issue): BBStep[] {
- return issue.pipeline.taskList.map((task) => {
- let stepStatus: BBStepStatus = "PENDING";
- switch (task.status) {
- case "PENDING":
- if (activeTask(issue.pipeline).id === task.id) {
- stepStatus = "PENDING_ACTIVE";
- } else {
- stepStatus = "PENDING";
- }
- break;
- case "RUNNING":
- stepStatus = "RUNNING";
- break;
- case "DONE":
- stepStatus = "DONE";
- break;
- case "FAILED":
- stepStatus = "FAILED";
- break;
- case "SKIPPED":
- stepStatus = "SKIPPED";
- break;
- }
+ const stepList = function (issue: Issue): BBStep[] {
+ const list: Step[] = allStepList(issue.pipeline);
+ return list.map((step) => {
return {
- title: task.name,
- status: stepStatus,
+ title: step.name,
+ status: step.status,
link: (): string => {
return `/issue/${issue.id}`;
},
@@ -281,8 +261,8 @@ export default {
columnList: columnListMap.get(props.mode),
activeEnvironmentName,
activeDatabaseName,
- taskList,
- activeTask,
+ stepList,
+ activeStep,
clickIssue,
};
},
diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.ts
index 43b18c039e..2669e42750 100644
--- a/frontend/src/utils/pipeline.ts
+++ b/frontend/src/utils/pipeline.ts
@@ -10,6 +10,38 @@ import {
UNKNOWN_ID,
} from "../types";
+export type PipelineType =
+ | "NO_PIPELINE"
+ | "SINGLE_TASK"
+ | "MULTI_SINGLE_STEP_TASK"
+ | "MULTI_TASK";
+
+export function pipelineType(pipeline: Pipeline): PipelineType {
+ if (pipeline.taskList.length == 0) {
+ return "NO_PIPELINE";
+ } else if (pipeline.taskList.length == 1) {
+ return "SINGLE_TASK";
+ } else {
+ for (const task of pipeline.taskList) {
+ if (task.stepList.length > 1) {
+ return "MULTI_TASK";
+ }
+ }
+ return "MULTI_SINGLE_STEP_TASK";
+ }
+}
+
+// Returns all steps from all tasks.
+export function allStepList(pipeline: Pipeline): Step[] {
+ const list: Step[] = [];
+ pipeline.taskList.forEach((task) => {
+ task.stepList.forEach((step) => {
+ list.push(step);
+ });
+ });
+ return list;
+}
+
export function activeTask(pipeline: Pipeline): Task {
for (const task of pipeline.taskList) {
if (
diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vue
index c8c7528471..0311ab617b 100644
--- a/frontend/src/views/IssueDetail.vue
+++ b/frontend/src/views/IssueDetail.vue
@@ -47,7 +47,7 @@
<!-- Task Flow Bar -->
<template v-if="showPipelineFlowBar">
- <template v-if="pipelineType == 'MULTI_SINGLE_STEP_TASK'">
+ <template v-if="currentPipelineType == 'MULTI_SINGLE_STEP_TASK'">
<PipelineSimpleFlow :pipeline="state.issue.pipeline" />
</template>
</template>
@@ -174,6 +174,8 @@ import {
StepStatusTransition,
applicableStepTransition,
activeStep,
+ pipelineType,
+ PipelineType,
} from "../utils";
import IssueHighlightPanel from "../views/IssueHighlightPanel.vue";
import IssueTaskFlow from "./IssueTaskFlow.vue";
@@ -216,12 +218,6 @@ import {
IssueContext,
} from "../plugins";
-type PipelineType =
- | "NO_PIPELINE"
- | "SINGLE_TASK"
- | "MULTI_SINGLE_STEP_TASK"
- | "MULTI_TASK";
-
type UpdateStatusModalStatePayload = {
transition: IssueStatusTransition;
didTransit: () => {};
@@ -702,25 +698,13 @@ export default {
});
};
- const pipelineType = computed(
+ const currentPipelineType = computed(
(): PipelineType => {
- const pipeline: Pipeline = (state.issue as Issue).pipeline;
- if (pipeline.taskList.length == 0) {
- return "NO_PIPELINE";
- } else if (pipeline.taskList.length == 1) {
- return "SINGLE_TASK";
- } else {
- for (const task of (state.issue as Issue).pipeline.taskList) {
- if (task.stepList.length > 1) {
- return "MULTI_TASK";
- }
- }
- return "MULTI_SINGLE_STEP_TASK";
- }
+ return pipelineType((state.issue as Issue).pipeline);
}
);
- console.log(pipelineType.value);
+ console.log(currentPipelineType.value);
const allowCreate = computed(() => {
const newIssue = state.issue as IssueNew;
@@ -784,7 +768,7 @@ export default {
});
const showPipelineFlowBar = computed(() => {
- return !state.new && pipelineType.value != "NO_PIPELINE";
+ return !state.new && currentPipelineType.value != "NO_PIPELINE";
});
const showIssueOutputPanel = computed(() => {
@@ -872,7 +856,7 @@ export default {
updateSubscriberIdList,
updateCustomField,
doCreate,
- pipelineType,
+ currentPipelineType,
allowCreate,
currentUser,
issueTemplate,
diff --git a/frontend/src/views/IssueHighlightPanel.vue b/frontend/src/views/IssueHighlightPanel.vue
index 08e4e9186d..716cdeee95 100644
--- a/frontend/src/views/IssueHighlightPanel.vue
+++ b/frontend/src/views/IssueHighlightPanel.vue
@@ -7,7 +7,7 @@
<IssueStatusIcon
v-if="!$props.new"
:issueStatus="issue.status"
- :taskStatus="activeTask(issue.pipeline).status"
+ :stepStatus="activeStep(issue.pipeline).status"
/>
</div>
<BBTextField
@@ -46,7 +46,7 @@
<script lang="ts">
import { reactive, watch, PropType } from "vue";
import IssueStatusIcon from "../components/IssueStatusIcon.vue";
-import { activeTask } from "../utils";
+import { activeStep } from "../utils";
import { Issue } from "../types";
interface LocalState {
@@ -92,7 +92,7 @@ export default {
}
};
- return { state, activeTask, trySaveName };
+ return { state, activeStep, trySaveName };
},
};
</script>
diff --git a/frontend/src/views/PipelineSimpleFlow.vue b/frontend/src/views/PipelineSimpleFlow.vue
index 41eedfbc29..c6003f1ebd 100644
--- a/frontend/src/views/PipelineSimpleFlow.vue
+++ b/frontend/src/views/PipelineSimpleFlow.vue
@@ -159,6 +159,8 @@ export default {
});
});
+ console.log(itemList.value);
+
const flowItemIconClass = (item: FlowItem) => {
switch (item.stepStatus) {
case "PENDING":