Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Return the last stage/task as the active one if all tasks have finished.
天舟94119f4a7f11
diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vueindex 9cd38270b2..6b326f4497 100644--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue@@ -133,6 +133,7 @@ import { Store, useStore } from "vuex";import StatusTransitionForm from "../components/StatusTransitionForm.vue";import {activeTask,+ allTaskList,applicableTaskTransition,TaskStatusTransition,} from "../utils";@@ -302,14 +303,22 @@ export default {return list.filter((item) => {- const currentTask = activeTask((props.issue as Issue).pipeline);+ 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") {return false;}- // Don't display the Resolve action if there is outstanding task.- if (item == "RESOLVE" && currentTask.id != EMPTY_ID) {+ const taskList = allTaskList(pipeline);+ // Don't display the Resolve action if the last task is NOT in end status.+ if (+ item == "RESOLVE" &&+ taskList.length > 0 &&+ (currentTask.id != taskList[taskList.length - 1].id ||+ (currentTask.status != "DONE" &&+ currentTask.status != "SKIPPED"))+ ) {return false;}diff --git a/frontend/src/miragejs/seeds/index.ts b/frontend/src/miragejs/seeds/index.tsindex b7b7f48af4..7b4f0c3934 100644--- a/frontend/src/miragejs/seeds/index.ts+++ b/frontend/src/miragejs/seeds/index.ts@@ -903,7 +903,7 @@ const createUpdateSchemaStage = (server.create("task", {creatorId: creatorId,updaterId: creatorId,- name: `Update ${databaseList[i].name} schema`,+ name: `Update '${databaseList[i].name}' schema`,type: "bb.task.schema.udpate",status: taskStatusList[i],when: i < 3 ? "ON_SUCCESS" : "MANUAL",diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.tsindex 8347cc9583..867433810a 100644--- a/frontend/src/utils/pipeline.ts+++ b/frontend/src/utils/pipeline.ts@@ -44,6 +44,18 @@ export function allTaskList(pipeline: Pipeline): Task[] {return list;}+export function lastTask(pipeline: Pipeline): Task {+ if (+ pipeline.stageList.length > 0 &&+ pipeline.stageList[pipeline.stageList.length - 1].taskList.length > 0+ ) {+ const lastStage = pipeline.stageList[pipeline.stageList.length - 1];+ return lastStage.taskList[lastStage.taskList.length - 1];+ }++ return empty("TASK") as Task;+}+export function findTaskById(pipeline: Pipeline, taskId: TaskId): Task {for (const stage of pipeline.stageList) {for (const task of stage.taskList) {@@ -55,6 +67,27 @@ export function findTaskById(pipeline: Pipeline, taskId: TaskId): Task {return unknown("TASK") as Task;}+export function activeStage(pipeline: Pipeline): Stage {+ for (const stage of pipeline.stageList) {+ for (const task of stage.taskList) {+ if (+ task.status == "PENDING" ||+ task.status == "RUNNING" ||+ // "FAILED" is also a transient task status, which requires user+ // to take further action (e.g. Skip, Retry)+ task.status == "FAILED"+ ) {+ return stage;+ }+ }+ }++ if (pipeline.stageList.length > 0) {+ return pipeline.stageList[pipeline.stageList.length - 1];+ }+ return empty("STAGE") as Stage;+}+export function activeTask(pipeline: Pipeline): Task {for (const stage of pipeline.stageList) {for (const task of stage.taskList) {@@ -69,6 +102,12 @@ export function activeTask(pipeline: Pipeline): Task {}}}++ const theLastTask = lastTask(pipeline);+ if (theLastTask.id != EMPTY_ID) {+ return theLastTask;+ }+return empty("TASK") as Task;}@@ -169,20 +208,3 @@ export function applicableTaskTransition(return TASK_STATUS_TRANSITION_LIST.get(type)!;});}--function activeStage(pipeline: Pipeline): Stage {- for (const stage of pipeline.stageList) {- for (const task of stage.taskList) {- if (- task.status == "PENDING" ||- task.status == "RUNNING" ||- // "FAILED" is also a transient task status, which requires user- // to take further action (e.g. Skip, Retry)- task.status == "FAILED"- ) {- return stage;- }- }- }- return empty("STAGE") as Stage;-}