Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Add runnable field to stage. Run button is displayed if the stage has the runnable field. Also add the stage run/retry/skip type
Tianzhou Chene28dda1942cb
diff --git a/frontend/src/miragejs/seeds/index.js b/frontend/src/miragejs/seeds/index.jsindex d667dbec2a..4f611e72cd 100644--- a/frontend/src/miragejs/seeds/index.js+++ b/frontend/src/miragejs/seeds/index.js@@ -277,6 +277,10 @@ const fillStage = (environmentList) => {name: environmentList[0].name,type: "ENVIRONMENT",environmentId: environmentList[0].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "PENDING",},{@@ -284,6 +288,10 @@ const fillStage = (environmentList) => {name: environmentList[1].name,type: "ENVIRONMENT",environmentId: environmentList[1].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "PENDING",},],@@ -297,6 +305,10 @@ const fillStage = (environmentList) => {name: environmentList[0].name,type: "ENVIRONMENT",environmentId: environmentList[0].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -304,6 +316,10 @@ const fillStage = (environmentList) => {name: environmentList[1].name,type: "ENVIRONMENT",environmentId: environmentList[1].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -311,6 +327,10 @@ const fillStage = (environmentList) => {name: environmentList[2].name,type: "ENVIRONMENT",environmentId: environmentList[2].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "RUNNING",},{@@ -318,6 +338,10 @@ const fillStage = (environmentList) => {name: environmentList[3].name,type: "ENVIRONMENT",environmentId: environmentList[3].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "PENDING",},],@@ -331,6 +355,10 @@ const fillStage = (environmentList) => {name: environmentList[0].name,type: "ENVIRONMENT",environmentId: environmentList[0].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -338,6 +366,10 @@ const fillStage = (environmentList) => {name: environmentList[1].name,type: "ENVIRONMENT",environmentId: environmentList[1].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "SKIPPED",},{@@ -345,6 +377,10 @@ const fillStage = (environmentList) => {name: environmentList[2].name,type: "ENVIRONMENT",environmentId: environmentList[2].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -352,6 +388,10 @@ const fillStage = (environmentList) => {name: environmentList[3].name,type: "ENVIRONMENT",environmentId: environmentList[3].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},],@@ -365,6 +405,10 @@ const fillStage = (environmentList) => {name: environmentList[0].name,type: "ENVIRONMENT",environmentId: environmentList[0].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -372,6 +416,10 @@ const fillStage = (environmentList) => {name: environmentList[1].name,type: "ENVIRONMENT",environmentId: environmentList[1].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "FAILED",},{@@ -379,6 +427,10 @@ const fillStage = (environmentList) => {name: environmentList[2].name,type: "ENVIRONMENT",environmentId: environmentList[2].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "PENDING",},{@@ -386,6 +438,10 @@ const fillStage = (environmentList) => {name: environmentList[3].name,type: "ENVIRONMENT",environmentId: environmentList[3].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "PENDING",},],@@ -399,6 +455,10 @@ const fillStage = (environmentList) => {name: environmentList[0].name,type: "ENVIRONMENT",environmentId: environmentList[0].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -406,6 +466,10 @@ const fillStage = (environmentList) => {name: environmentList[1].name,type: "ENVIRONMENT",environmentId: environmentList[1].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "SKIPPED",},{@@ -413,6 +477,10 @@ const fillStage = (environmentList) => {name: environmentList[2].name,type: "ENVIRONMENT",environmentId: environmentList[2].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "DONE",},{@@ -420,6 +488,10 @@ const fillStage = (environmentList) => {name: environmentList[3].name,type: "ENVIRONMENT",environmentId: environmentList[3].id,+ runnable: {+ auto: true,+ run: () => {},+ },status: "CANCELED",},],diff --git a/frontend/src/plugins/task/template.ts b/frontend/src/plugins/task/template.tsindex 492c4d699f..c4a4ddba4f 100644--- a/frontend/src/plugins/task/template.ts+++ b/frontend/src/plugins/task/template.ts@@ -93,6 +93,12 @@ export const taskTemplateList: TaskTemplate[] = [name: env.attributes.name,type: "ENVIRONMENT",status: "PENDING",+ runnable: {+ auto: true,+ run: () => {+ console.log("Start", env.attributes.name);+ },+ },};}),creator: {diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex 779318499b..bf9b88a653 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -50,11 +50,17 @@ export type StageStatus =| "CANCELED"| "SKIPPED";+export type StageRunnable = {+ auto: boolean;+ run: () => void;+};+export type Stage = {id: StageId;name: string;type: StageType;environmentId?: EnvironmentId;+ runnable?: StageRunnable;};export type StageProgress = Stage & {diff --git a/frontend/src/views/TaskDetail.vue b/frontend/src/views/TaskDetail.vueindex b0dce19a96..73889fe197 100644--- a/frontend/src/views/TaskDetail.vue+++ b/frontend/src/views/TaskDetail.vue@@ -118,8 +118,8 @@ type TaskTransitionType =| "bytebase.task.reopen";type StageTransitionType =+ | "bytebase.stage.run"| "bytebase.stage.retry"- | "bytebase.stage.cancel"| "bytebase.stage.skip";type TransitionType = TaskTransitionType | StageTransitionType;@@ -147,6 +147,7 @@ interface Transition {type: TransitionType;actionName: string;actionType: ActionType;+ requiredRunnable: boolean;from: SourceWorkflowStatus;to: (status: WorkflowStatus) => WorkflowStatus;allowedRoleList: RoleType[];@@ -162,6 +163,7 @@ const TRANSITION_LIST: Transition[] = [type: "bytebase.task.resolve",actionName: "Resolve",actionType: ActionType.SUCCESS,+ requiredRunnable: false,from: {taskStatus: ["OPEN"],stageStatus: ["PENDING", "DONE", "SKIPPED"],@@ -192,6 +194,7 @@ const TRANSITION_LIST: Transition[] = [type: "bytebase.task.abort",actionName: "Abort",actionType: ActionType.NORMAL,+ requiredRunnable: false,from: {taskStatus: ["OPEN"],stageStatus: ["PENDING", "FAILED"],@@ -199,18 +202,19 @@ const TRANSITION_LIST: Transition[] = [to: (from: WorkflowStatus) => {return {taskStatus: "CANCELED",- stageStatus: "SKIPPED",+ stageStatus: "CANCELED",};},- allowedRoleList: ["CREATOR"],+ allowedRoleList: ["ASSIGNEE", "CREATOR"],},{type: "bytebase.task.reopen",actionName: "Reopen",actionType: ActionType.NORMAL,+ requiredRunnable: false,from: {taskStatus: ["DONE", "CANCELED"],- stageStatus: ["PENDING", "DONE", "FAILED", "CANCELED"],+ stageStatus: ["PENDING", "DONE", "FAILED", "CANCELED", "SKIPPED"],},to: (from: WorkflowStatus) => {return {@@ -220,6 +224,57 @@ const TRANSITION_LIST: Transition[] = [},allowedRoleList: ["ASSIGNEE", "CREATOR"],},+ {+ type: "bytebase.stage.run",+ actionName: "Run",+ actionType: ActionType.PRIMARY,+ requiredRunnable: true,+ from: {+ taskStatus: ["OPEN"],+ stageStatus: ["PENDING"],+ },+ to: (from: WorkflowStatus) => {+ return {+ taskStatus: "OPEN",+ stageStatus: "RUNNING",+ };+ },+ allowedRoleList: ["ASSIGNEE"],+ },+ {+ type: "bytebase.stage.retry",+ actionName: "Rerun",+ actionType: ActionType.PRIMARY,+ requiredRunnable: true,+ from: {+ taskStatus: ["OPEN"],+ stageStatus: ["FAILED"],+ },+ to: (from: WorkflowStatus) => {+ return {+ taskStatus: "OPEN",+ stageStatus: "RUNNING",+ };+ },+ allowedRoleList: ["ASSIGNEE"],+ },+ {+ type: "bytebase.stage.skip",+ actionName: "Skip",+ actionType: ActionType.NORMAL,+ requiredRunnable: false,+ from: {+ taskStatus: ["OPEN"],+ stageStatus: ["PENDING", "FAILED"],+ },+ to: (from: WorkflowStatus) => {+ return {+ taskStatus: "OPEN",+ stageStatus: "SKIPPED",+ };+ },+ allowedRoleList: ["ASSIGNEE"],+ },];interface LocalState {@@ -400,14 +455,14 @@ export default {: currentUser!.id === state.task.attributes.assignee?.id? "ASSIGNEE": "GUEST";+ const stage = activeStage(state.task as Task);return (transition.from.taskStatus.includes((state.task as Task).attributes.status) &&- transition.from.stageStatus.includes(- activeStage(state.task as Task).status- ) &&- transition.allowedRoleList.includes(role)+ transition.from.stageStatus.includes(stage.status) &&+ transition.allowedRoleList.includes(role) &&+ (!transition.requiredRunnable || stage.runnable));}).sort((a, b) => b.actionType - a.actionType);};