Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Introduce more structured stagetype using reverved domain style
天舟c2e142ede65f
diff --git a/frontend/src/miragejs/seeds/index.ts b/frontend/src/miragejs/seeds/index.tsindex 6c5c9585e5..a38a7e523a 100644--- a/frontend/src/miragejs/seeds/index.ts+++ b/frontend/src/miragejs/seeds/index.ts@@ -1,5 +1,5 @@import faker from "faker";-import { Environment, Stage, Task } from "../../types";+import { Environment, Stage, StageType, Task } from "../../types";import { instanceSlug, databaseSlug, taskSlug } from "../../utils";/*@@ -76,7 +76,7 @@ const workspacesSeeder = (server: any) => {{id: "1",name: "Request",- type: "SIMPLE",+ type: "bytebase.stage.general",status: "PENDING",},],@@ -109,15 +109,15 @@ const workspacesSeeder = (server: any) => {task = server.create("task", {type: "bytebase.database.request",- name: "Request data source for environment - " + environmentList1[1].name,+ name: "Request database for environment - " + environmentList1[1].name,creatorId: ws1Dev1.id,assigneeId: ws1Owner.id,subscriberIdList: [ws1DBA.id, ws1Dev2.id],stageList: [{id: "1",- name: "Request data source",- type: "SIMPLE",+ name: "Create database",+ type: "bytebase.stage.database.create",status: "PENDING",},],@@ -334,6 +334,7 @@ const workspacesSeeder = (server: any) => {const fillTaskAndStageStatus = (environmentList: Environment[]): Pick<Task, "status" | "stageList"> => {+ const type: StageType = "bytebase.stage.schema.update";const i = Math.floor(Math.random() * 5);if (i % 5 == 0) {return {@@ -342,7 +343,7 @@ const fillTaskAndStageStatus = ({id: "1",name: environmentList[0].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[0].id,runnable: {auto: true,@@ -353,7 +354,7 @@ const fillTaskAndStageStatus = ({id: "2",name: environmentList[1].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[1].id,runnable: {auto: true,@@ -370,7 +371,7 @@ const fillTaskAndStageStatus = ({id: "1",name: environmentList[0].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[0].id,runnable: {auto: true,@@ -381,7 +382,7 @@ const fillTaskAndStageStatus = ({id: "2",name: environmentList[1].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[1].id,runnable: {auto: true,@@ -392,7 +393,7 @@ const fillTaskAndStageStatus = ({id: "3",name: environmentList[2].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[2].id,runnable: {auto: true,@@ -403,7 +404,7 @@ const fillTaskAndStageStatus = ({id: "4",name: environmentList[3].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[3].id,runnable: {auto: true,@@ -420,7 +421,7 @@ const fillTaskAndStageStatus = ({id: "1",name: environmentList[0].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[0].id,runnable: {auto: true,@@ -431,7 +432,7 @@ const fillTaskAndStageStatus = ({id: "2",name: environmentList[1].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[1].id,runnable: {auto: true,@@ -442,7 +443,7 @@ const fillTaskAndStageStatus = ({id: "3",name: environmentList[2].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[2].id,runnable: {auto: true,@@ -453,7 +454,7 @@ const fillTaskAndStageStatus = ({id: "4",name: environmentList[3].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[3].id,runnable: {auto: true,@@ -470,7 +471,7 @@ const fillTaskAndStageStatus = ({id: "1",name: environmentList[0].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[0].id,runnable: {auto: true,@@ -481,7 +482,7 @@ const fillTaskAndStageStatus = ({id: "2",name: environmentList[1].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[1].id,runnable: {auto: true,@@ -492,7 +493,7 @@ const fillTaskAndStageStatus = ({id: "3",name: environmentList[2].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[2].id,runnable: {auto: true,@@ -503,7 +504,7 @@ const fillTaskAndStageStatus = ({id: "4",name: environmentList[3].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[3].id,runnable: {auto: true,@@ -520,7 +521,7 @@ const fillTaskAndStageStatus = ({id: "1",name: environmentList[0].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[0].id,runnable: {auto: true,@@ -531,7 +532,7 @@ const fillTaskAndStageStatus = ({id: "2",name: environmentList[1].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[1].id,runnable: {auto: true,@@ -542,7 +543,7 @@ const fillTaskAndStageStatus = ({id: "3",name: environmentList[2].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[2].id,runnable: {auto: true,@@ -553,7 +554,7 @@ const fillTaskAndStageStatus = ({id: "4",name: environmentList[3].name,- type: "ENVIRONMENT",+ type,environmentId: environmentList[3].id,runnable: {auto: true,diff --git a/frontend/src/plugins/task/DatabaseRequestTemplate.ts b/frontend/src/plugins/task/DatabaseRequestTemplate.tsindex ed62910751..07d98964cb 100644--- a/frontend/src/plugins/task/DatabaseRequestTemplate.ts+++ b/frontend/src/plugins/task/DatabaseRequestTemplate.ts@@ -34,8 +34,8 @@ const template: TaskTemplate = {stageList: [{id: "1",- name: "Request database",- type: "SIMPLE",+ name: "Create database",+ type: "bytebase.stage.database.create",status: "PENDING",},],diff --git a/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.tsindex 4c0a06607e..25f1cd3bb1 100644--- a/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.ts+++ b/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.ts@@ -22,7 +22,7 @@ const template: TaskTemplate = {return {id: env.id,name: env.name,- type: "ENVIRONMENT",+ type: "bytebase.stage.schema.update",status: "PENDING",runnable: {auto: true,diff --git a/frontend/src/plugins/task/template.ts b/frontend/src/plugins/task/template.tsindex e8401436f8..fde385ad7e 100644--- a/frontend/src/plugins/task/template.ts+++ b/frontend/src/plugins/task/template.ts@@ -22,7 +22,7 @@ const DEFAULT_TEMPLATE = {{id: "1",name: "Request",- type: "SIMPLE",+ type: "bytebase.stage.general",status: "PENDING",},],diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex 0adce9ac00..0d9dd4c591 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -252,7 +252,12 @@ export type Bookmark = {export type BookmarkNew = Omit<Bookmark, "id">;// Stage-export type StageType = "SIMPLE" | "ENVIRONMENT";+export type StageType =+ | "bytebase.stage.general"+ | "bytebase.stage.transition"+ | "bytebase.stage.database.create"+ | "bytebase.stage.database.grant"+ | "bytebase.stage.schema.update";export type StageStatus = "PENDING" | "RUNNING" | "DONE" | "FAILED" | "SKIPPED";diff --git a/frontend/src/utils/task.ts b/frontend/src/utils/task.tsindex c61c56ea46..06184359a2 100644--- a/frontend/src/utils/task.ts+++ b/frontend/src/utils/task.ts@@ -40,7 +40,7 @@ export function activeStageIsRunning(task: Task): boolean {export function activeEnvironmentId(task: Task): EnvironmentId | null {const stage = activeStage(task);- if (stage.type === "ENVIRONMENT") {+ if (stage.environmentId) {return stage.environmentId!;}const taskTemplate = templateForType(task.type);diff --git a/frontend/src/views/TaskStageFlow.vue b/frontend/src/views/TaskStageFlow.vueindex 45baa0875d..5ae20684a4 100644--- a/frontend/src/views/TaskStageFlow.vue+++ b/frontend/src/views/TaskStageFlow.vue@@ -376,9 +376,6 @@ export default {const applicableStageTransitionList = computed(() => {const stage = activeStage(props.task as Task);- if (stage.type != "ENVIRONMENT") {- return false;- }const list: StageStatusTransitionType[] = [];if (currentUser.value.id === (props.task as Task).assignee?.id) {list.push(...ASSIGNEE_APPLICABLE_STAGE_ACTION_LIST.get(stage.status)!);