Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Term change. Task -> Stage, Step -> Task
天舟5eb44f759776
diff --git a/frontend/src/components/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm.vueindex 9ae7f3acb2..2689b07152 100644--- a/frontend/src/components/AlterSchemaPrepForm.vue+++ b/frontend/src/components/AlterSchemaPrepForm.vue@@ -10,10 +10,10 @@class="mt-1 w-full"id="environment"name="environment"- :selectedId="state.singleTaskConfig.environmentId"+ :selectedId="state.singleStageConfig.environmentId"@select-environment-id="(environmentId) => {- state.singleTaskConfig.environmentId = environmentId;+ state.singleStageConfig.environmentId = environmentId;}"/>@@ -50,8 +50,8 @@class="mt-1 w-full"id="database"name="database"- :selectedId="state.singleTaskConfig.databaseId"- :environmentId="state.singleTaskConfig.environmentId"+ :selectedId="state.singleStageConfig.databaseId"+ :environmentId="state.singleStageConfig.environmentId":projectId="state.project.id":mode="'USER'"@select-database-id="@@ -117,7 +117,7 @@ import {UNKNOWN_ID,} from "../types";-type TaskConfig = {+type StageConfig = {environmentId: EnvironmentId;databaseId: DatabaseId;};@@ -125,8 +125,8 @@ type TaskConfig = {interface LocalState {project: Project;singleEnvironment: boolean;- singleTaskConfig: TaskConfig;- taskConfigList: TaskConfig[];+ singleStageConfig: StageConfig;+ stageConfigList: StageConfig[];}export default {@@ -160,19 +160,19 @@ export default {const state = reactive<LocalState>({project: store.getters["project/projectById"](props.projectId),singleEnvironment: true,- singleTaskConfig: {+ singleStageConfig: {environmentId: UNKNOWN_ID,databaseId: UNKNOWN_ID,},- taskConfigList: [],+ stageConfigList: [],});const allowNext = computed(() => {if (state.singleEnvironment) {return (state.project.id != UNKNOWN_ID &&- state.singleTaskConfig.environmentId != UNKNOWN_ID &&- state.singleTaskConfig.databaseId != UNKNOWN_ID+ state.singleStageConfig.environmentId != UNKNOWN_ID &&+ state.singleStageConfig.databaseId != UNKNOWN_ID);}return true;@@ -182,16 +182,16 @@ export default {state.project = store.getters["project/projectById"](projectId);if (state.singleEnvironment) {} else {- state.taskConfigList = [];+ state.stageConfigList = [];}};const changeDatabaseId = (databaseId: DatabaseId) => {- state.singleTaskConfig.databaseId = databaseId;+ state.singleStageConfig.databaseId = databaseId;if (databaseId != UNKNOWN_ID) {const database: Database = store.getters["database/databaseById"](- state.singleTaskConfig.databaseId+ state.singleStageConfig.databaseId);state.project = database.project;}@@ -206,7 +206,7 @@ export default {if (state.singleEnvironment) {const database = store.getters["database/databaseById"](- state.singleTaskConfig.databaseId+ state.singleStageConfig.databaseId);router.push({diff --git a/frontend/src/components/IssueStatusIcon.vue b/frontend/src/components/IssueStatusIcon.vueindex b63af5f0fa..8ecbb35d33 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="stepStatus === 'RUNNING'"+ v-if="taskStatus === '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="stepStatus === 'FAILED'"+ v-else-if="taskStatus === 'FAILED'"class="h-2 w-2 rounded-full text-center pb-6 font-normal text-base"aria-hidden="true">!</span@@ -58,7 +58,7 @@<script lang="ts">import { PropType } from "vue";-import { StepStatus, IssueStatus } from "../types";+import { TaskStatus, IssueStatus } from "../types";type SizeType = "small" | "normal";@@ -69,9 +69,9 @@ export default {required: true,type: String as PropType<IssueStatus>,},- // Specify stepStatus if we want to show the step specific status when issueStatus is OPEN.- stepStatus: {- type: String as PropType<StepStatus>,+ // Specify taskStatus if we want to show the task specific status when issueStatus is OPEN.+ taskStatus: {+ type: String as PropType<TaskStatus>,},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.stepStatus && props.stepStatus === "FAILED") {+ if (props.taskStatus && props.taskStatus === "FAILED") {return (iconClass +" bg-error text-white hover:text-white hover:bg-error-hover"diff --git a/frontend/src/components/IssueTable.vue b/frontend/src/components/IssueTable.vueindex ccd14445d1..65b3c3c920 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"- :stepStatus="activeStep(issue.pipeline).status"+ :taskStatus="activeTask(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="stepList(issue)" />+ <BBStepBar :stepList="taskList(issue)" /></BBTableCell><BBTableCell class="hidden md:table-cell">{{ humanizeTs(issue.updatedTs) }}@@ -116,17 +116,16 @@ import {BBTableColumn,BBTableSectionDataSource,BBStep,- BBStepStatus,} from "../bbkit/types";import IssueStatusIcon from "../components/IssueStatusIcon.vue";import {issueSlug,activeEnvironment,activeDatabase,- activeStep,- allStepList,+ activeTask,+ allTaskList,} from "../utils";-import { Issue, EMPTY_ID, Step } from "../types";+import { Issue, EMPTY_ID, Task } from "../types";type Mode = "ALL" | "PROJECT";@@ -238,12 +237,12 @@ export default {const router = useRouter();- const stepList = function (issue: Issue): BBStep[] {- const list: Step[] = allStepList(issue.pipeline);- return list.map((step) => {+ const taskList = function (issue: Issue): BBStep[] {+ const list: Task[] = allTaskList(issue.pipeline);+ return list.map((task) => {return {- title: step.name,- status: step.status,+ title: task.name,+ status: task.status,link: (): string => {return `/issue/${issue.id}`;},@@ -261,8 +260,8 @@ export default {columnList: columnListMap.get(props.mode),activeEnvironmentName,activeDatabaseName,- stepList,- activeStep,+ taskList,+ activeTask,clickIssue,};},diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vueindex 646770c0a4..595312f15c 100644--- a/frontend/src/components/QuickActionPanel.vue+++ b/frontend/src/components/QuickActionPanel.vue@@ -418,7 +418,7 @@ export default {const alterSchema = () => {state.modalTitle = "Alter schema";- state.modalSubtitle = "Step 1 - choose database";+ state.modalSubtitle = "Task 1 - choose database";state.quickActionType = "quickaction.bytebase.database.schema.update";state.showModal = true;};diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vueindex 945be044da..b01bb91216 100644--- a/frontend/src/components/Quickstart.vue+++ b/frontend/src/components/Quickstart.vue@@ -20,7 +20,7 @@<nav class="flex justify-center" aria-label="Progress"><ol class="space-y-4"><li v-for="(intro, index) in effectiveList" :key="index">- <!-- Complete Step -->+ <!-- Complete Task --><router-link :to="intro.link" class="group"><span class="flex items-start"><span@@ -42,7 +42,7 @@/></svg></template>- <template v-else-if="isStepActive(index)">+ <template v-else-if="isTaskActive(index)"><spanclass="absolute h-4 w-4 rounded-full bg-blue-200"></span>@@ -152,7 +152,7 @@ export default {return isDeveloper(currentUser.value.role) ? devIntroList : introList;});- const isStepActive = (index: number): boolean => {+ const isTaskActive = (index: number): boolean => {for (let i = index - 1; i >= 0; i--) {if (!introList[i].done) {return false;@@ -184,7 +184,7 @@ export default {return {effectiveList,- isStepActive,+ isTaskActive,hideQuickstart,};},diff --git a/frontend/src/components/StepStatusTransitionForm.vue b/frontend/src/components/TaskStatusTransitionForm.vuesimilarity index 94%rename from frontend/src/components/StepStatusTransitionForm.vuerename to frontend/src/components/TaskStatusTransitionForm.vueindex 725a2c2e44..f8dd6eea19 100644--- a/frontend/src/components/StepStatusTransitionForm.vue+++ b/frontend/src/components/TaskStatusTransitionForm.vue@@ -49,14 +49,14 @@<script lang="ts">import { computed, reactive, ref, PropType } from "vue";import { Issue } from "../types";-import { StepStatusTransition } from "../utils";+import { TaskStatusTransition } from "../utils";interface LocalState {comment: string;}export default {- name: "StepStatusTransitionForm",+ name: "TaskStatusTransitionForm",emits: ["submit", "cancel"],props: {okText: {@@ -69,7 +69,7 @@ export default {},transition: {required: true,- type: Object as PropType<StepStatusTransition>,+ type: Object as PropType<TaskStatusTransition>,},},setup(props, ctx) {diff --git a/frontend/src/miragejs/factories/index.js b/frontend/src/miragejs/factories/index.jsindex 5de28e31c3..4c9e19561e 100644--- a/frontend/src/miragejs/factories/index.js+++ b/frontend/src/miragejs/factories/index.js@@ -8,8 +8,8 @@ import dataSourceMember from "./dataSourceMember";import database from "./database";import issue from "./issue";import pipeline from "./pipeline";+import stage from "./stage";import task from "./task";-import step from "./step";import activity from "./activity";import message from "./message";import workspace from "./workspace";@@ -37,8 +37,8 @@ export default {...message,...issue,...pipeline,+ ...stage,...task,- ...step,...activity,...workspace,diff --git a/frontend/src/miragejs/factories/step.js b/frontend/src/miragejs/factories/stage.jssimilarity index 76%rename from frontend/src/miragejs/factories/step.jsrename to frontend/src/miragejs/factories/stage.jsindex 4aca13e348..75d3773049 100644--- a/frontend/src/miragejs/factories/step.js+++ b/frontend/src/miragejs/factories/stage.js@@ -3,7 +3,7 @@ import faker from "faker";import { UNKNOWN_ID } from "../../types";export default {- step: Factory.extend({+ stage: Factory.extend({creatorId() {return UNKNOWN_ID;},@@ -20,13 +20,10 @@ export default {return faker.fake("{{lorem.sentence}}");},type() {- return "bytebase.step.final";+ return "bytebase.stage.unknown";},- status() {- return "PENDING";- },- payload() {- return undefined;+ databaseId() {+ return UNKNOWN_ID;},}),};diff --git a/frontend/src/miragejs/factories/task.js b/frontend/src/miragejs/factories/task.jsindex 48b4146f76..546eefd11f 100644--- a/frontend/src/miragejs/factories/task.js+++ b/frontend/src/miragejs/factories/task.js@@ -20,10 +20,13 @@ export default {return faker.fake("{{lorem.sentence}}");},type() {- return "bytebase.task.unknown";+ return "bytebase.task.final";},- databaseId() {- return UNKNOWN_ID;+ status() {+ return "PENDING";+ },+ payload() {+ return undefined;},}),};diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.jsindex ae0156c808..7c2be148e2 100644--- a/frontend/src/miragejs/models/index.js+++ b/frontend/src/miragejs/models/index.js@@ -27,8 +27,8 @@ export default {projectMember: hasMany(),issue: hasMany(),pipeline: hasMany(),+ stage: hasMany(),task: hasMany(),- step: hasMany(),environment: hasMany(),instance: hasMany(),database: hasMany(),@@ -92,30 +92,30 @@ export default {// Pipelinepipeline: Model.extend({workspace: belongsTo(),+ stage: hasMany(),task: hasMany(),- step: hasMany(),}),pipelinePatch: Model,pipelineStatusPatch: Model,- // Task- task: Model.extend({+ // Stage+ stage: Model.extend({workspace: belongsTo(),pipeline: belongsTo(),environment: belongsTo(),database: belongsTo(),}),- taskPatch: Model,- taskStatusPatch: Model,+ stagePatch: Model,+ stageStatusPatch: Model,- // Step- step: Model.extend({+ // Task+ task: Model.extend({workspace: belongsTo(),pipeline: belongsTo(),- task: belongsTo(),+ stage: belongsTo(),}),- stepPatch: Model,- stepStatusPatch: Model,+ taskPatch: Model,+ taskStatusPatch: Model,// Environmentenvironment: Model.extend({@@ -141,7 +141,7 @@ export default {instance: belongsTo(),project: belongsTo(),dataSource: hasMany(),- task: hasMany(),+ stage: hasMany(),}),databaseNew: Model,databasePatch: Model,diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.jsindex 1b1826d0ef..b97992c837 100644--- a/frontend/src/miragejs/routes/index.js+++ b/frontend/src/miragejs/routes/index.js@@ -8,7 +8,7 @@ import configureActivity from "./activity";import configureMessage from "./message";import configureBookmark from "./bookmark";import configureIssue from "./issue";-import configureStep from "./step";+import configureTask from "./task";import configureProject from "./project";import configureProjectMember from "./projectMember";import configureEnvironment from "./environment";@@ -55,8 +55,8 @@ export default function routes() {// IssueconfigureIssue(this);- // Step- configureStep(this);+ // Task+ configureTask(this);// EnvironmentconfigureEnvironment(this);diff --git a/frontend/src/miragejs/routes/issue.js b/frontend/src/miragejs/routes/issue.jsindex c0a17d9e64..5b45fd0131 100644--- a/frontend/src/miragejs/routes/issue.js+++ b/frontend/src/miragejs/routes/issue.js@@ -56,11 +56,11 @@ export default function configureIssue(route) {createdPipeline = schema.pipelines.create(newPipeline);- for (const task of pipeline.taskList) {- const { stepList, databaseId, environmentId, ...taskAttrs } = task;+ for (const stage of pipeline.stageList) {+ const { taskList, databaseId, environmentId, ...stageAttrs } = stage;- const createdTask = schema.tasks.create({- ...taskAttrs,+ const createdStage = schema.stages.create({+ ...stageAttrs,createdTs: ts,updaterId: attrs.creatorId,updatedTs: ts,@@ -71,15 +71,15 @@ export default function configureIssue(route) {workspaceId: WORKSPACE_ID,});- for (const step of stepList) {- schema.steps.create({- ...step,+ for (const task of taskList) {+ schema.tasks.create({+ ...task,createdTs: ts,updaterId: attrs.creatorId,updatedTs: ts,status: "PENDING",pipeline: createdPipeline,- task: createdTask,+ stage: createdStage,workspaceId: WORKSPACE_ID,});}@@ -190,16 +190,16 @@ export default function configureIssue(route) {}}- if (attrs.task !== undefined) {- const task = issue.taskList.find((item) => item.id == attrs.task.id);- if (task) {+ if (attrs.stage !== undefined) {+ const stage = issue.stageList.find((item) => item.id == attrs.stage.id);+ if (stage) {changeList.push({- fieldId: [IssueBuiltinFieldId.TASK, task.id].join("."),- oldValue: task.status,- newValue: attrs.task.status,+ fieldId: [IssueBuiltinFieldId.STAGE, stage.id].join("."),+ oldValue: stage.status,+ newValue: attrs.stage.status,});- task.status = attrs.task.status;- attrs.taskList = issue.taskList;+ stage.status = attrs.stage.status;+ attrs.stageList = issue.stageList;}}@@ -300,26 +300,26 @@ export default function configureIssue(route) {status: attrs.status,});- const taskList = schema.tasks.where({ pipelineId: pipeline.id }).models;+ const stageList = schema.stages.where({ pipelineId: pipeline.id }).models;if (attrs.status == "DONE") {- // Returns error if any of the steps is not in the end status.- for (let i = 0; i < taskList.length; i++) {- const stepList = schema.steps.where({+ // Returns error if any of the tasks is not in the end status.+ for (let i = 0; i < stageList.length; i++) {+ const taskList = schema.tasks.where({issueId: issue.id,- taskId: taskList[i].id,+ stageId: stageList[i].id,}).models;- for (let j = 0; j < stepList.length; j++) {+ for (let j = 0; j < taskList.length; j++) {if (- stepList[j].status != "DONE" &&- stepList[j].status != "CANCELED" &&- stepList[j].status != "SKIPPED"+ taskList[j].status != "DONE" &&+ taskList[j].status != "CANCELED" &&+ taskList[j].status != "SKIPPED") {return new Response(404,{},{- errors: `Can't resolve issue ${issue.name}. Step ${stepList[j].name} in task ${taskList[i].name} is in ${stepList[j].status} status`,+ errors: `Can't resolve issue ${issue.name}. Task ${taskList[j].name} in stage ${stageList[i].name} is in ${taskList[j].status} status`,});}@@ -329,26 +329,26 @@ export default function configureIssue(route) {pipeline.update({ status: "DONE" });}- // If issue is canceled, we find the current running tasks and steps, mark each of them CANCELED.- // We keep PENDING tasks and steps as is since the issue maybe reopened later, and it's better to+ // If issue is canceled, we find the current running stages and tasks, mark each of them CANCELED.+ // We keep PENDING stages and tasks as is since the issue maybe reopened later, and it's better to// keep them in the state before it was canceled.if (attrs.status == "CANCELED") {pipeline.update({ status: "CAMCELED" });- for (let i = 0; i < taskList.length; i++) {- if (taskList[i].status == "RUNNING") {- schema.tasks.find(taskList[i].id).update({+ for (let i = 0; i < stageList.length; i++) {+ if (stageList[i].status == "RUNNING") {+ schema.stages.find(stageList[i].id).update({status: "CANCELED",});- const stepList = schema.steps.where({+ const taskList = schema.tasks.where({issueId: issue.id,- taskId: taskList[i].id,+ stageId: stageList[i].id,}).models;- for (let j = 0; j < stepList.length; j++) {- if (stepList[j].status == "RUNNING") {- schema.steps.find(stepList[j].id).update({+ for (let j = 0; j < taskList.length; j++) {+ if (taskList[j].status == "RUNNING") {+ schema.tasks.find(taskList[j].id).update({status: "CANCELED",});}@@ -358,7 +358,7 @@ export default function configureIssue(route) {}// If issue is opened, we just move the pipeline to the PENDING status.- // We keep tasks and steps status as is since even those status are canceled,+ // We keep stages and tasks status as is since even those status are canceled,// we don't known whether it's canceled because of the issue is previously// canceled, or it's canceled for a different reason. And it's always safer// for user to explicitly resume the execution.diff --git a/frontend/src/miragejs/routes/step.js b/frontend/src/miragejs/routes/task.jssimilarity index 60%rename from frontend/src/miragejs/routes/step.jsrename to frontend/src/miragejs/routes/task.jsindex c7ccc01062..bb6b48312f 100644--- a/frontend/src/miragejs/routes/step.js+++ b/frontend/src/miragejs/routes/task.js@@ -2,11 +2,11 @@ import { Response } from "miragejs";import { WORKSPACE_ID } from "./index";import { IssueBuiltinFieldId } from "../../plugins";-export default function configureStep(route) {+export default function configureTask(route) {route.patch(- "/pipeline/:pipelineId/step/:stepId/status",+ "/pipeline/:pipelineId/task/:taskId/status",function (schema, request) {- const attrs = this.normalizedRequestAttrs("step-status-patch");+ const attrs = this.normalizedRequestAttrs("task-status-patch");const pipeline = schema.pipelines.find(request.params.pipelineId);if (!pipeline) {@@ -17,12 +17,12 @@ export default function configureStep(route) {);}- const step = schema.steps.find(request.params.stepId);- if (!step) {+ const task = schema.tasks.find(request.params.taskId);+ if (!task) {return new Response(404,{},- { errors: "Step " + request.params.stepId + " not found" }+ { errors: "Task " + request.params.taskId + " not found" });}@@ -30,14 +30,14 @@ export default function configureStep(route) {const changeList = [];- if (attrs.status && step.status != attrs.status) {+ if (attrs.status && task.status != attrs.status) {changeList.push({- fieldId: IssueBuiltinFieldId.STEP_STATUS,- oldValue: step.status,+ fieldId: IssueBuiltinFieldId.TASK_STATUS,+ oldValue: task.status,newValue: attrs.status,});- const updatedStep = step.update({ ...attrs, updatedTs: ts });+ const updatedTask = task.update({ ...attrs, updatedTs: ts });const payload = {changeList,@@ -48,17 +48,17 @@ export default function configureStep(route) {createdTs: ts,updaterId: attrs.updaterId,updatedTs: ts,- actionType: "bytebase.issue.task.step.status.update",- containerId: updatedStep.id,+ actionType: "bytebase.issue.stage.task.status.update",+ containerId: updatedTask.id,comment: attrs.comment,payload,workspaceId: WORKSPACE_ID,});- return updatedStep;+ return updatedTask;}- return step;+ return task;});}diff --git a/frontend/src/miragejs/seeds/index.ts b/frontend/src/miragejs/seeds/index.tsindex b6e2e3633f..d88dffe91b 100644--- a/frontend/src/miragejs/seeds/index.ts+++ b/frontend/src/miragejs/seeds/index.ts@@ -5,19 +5,19 @@ import {Environment,Instance,Principal,- TaskType,+ StageType,Issue,DEFAULT_PROJECT_ID,ALL_DATABASE_NAME,IssueNew,IssueStatus,- TaskNew,- TaskId,+ StageNew,+ StageId,DatabaseId,ProjectId,PrincipalId,IssueId,- StepStatus,+ TaskStatus,PipelineId,} from "../../types";import { databaseSlug, issueSlug } from "../../utils";@@ -373,11 +373,11 @@ const workspacesSeeder = (server: any) => {workspace: workspace1,});- // const task = server.create("task", {+ // const stage = server.create("stage", {// creatorId: ws1Dev1.id,// updaterId: ws1Dev1.id,// name: "Create database",- // type: "bytebase.task.database.create",+ // type: "bytebase.stage.database.create",// status: "PENDING",// environmentId: environmentList1[1].id,// databaseId: databaseList1[1].id,@@ -385,14 +385,14 @@ const workspacesSeeder = (server: any) => {// workspace: workspace1,// });- // server.create("step", {+ // server.create("task", {// creatorId: ws1Dev1.id,// updaterId: ws1Dev1.id,// name: "Waiting approval",- // type: "bytebase.step.approve",+ // type: "bytebase.task.approve",// status: "PENDING",// pipeline,- // task,+ // stage,// workspace: workspace1,// });@@ -463,27 +463,27 @@ const workspacesSeeder = (server: any) => {const statusSetList: {issueStatus: IssueStatus;- stepStatusList: StepStatus[];+ taskStatusList: TaskStatus[];}[] = [{issueStatus: "OPEN",- stepStatusList: ["PENDING"],+ taskStatusList: ["PENDING"],},{issueStatus: "OPEN",- stepStatusList: ["DONE", "DONE", "RUNNING", "PENDING"],+ taskStatusList: ["DONE", "DONE", "RUNNING", "PENDING"],},{issueStatus: "DONE",- stepStatusList: ["DONE", "SKIPPED", "DONE", "DONE"],+ taskStatusList: ["DONE", "SKIPPED", "DONE", "DONE"],},{issueStatus: "OPEN",- stepStatusList: ["DONE", "FAILED", "PENDING", "PENDING"],+ taskStatusList: ["DONE", "FAILED", "PENDING", "PENDING"],},{issueStatus: "CANCELED",- stepStatusList: ["DONE", "SKIPPED", "DONE", "PENDING"],+ taskStatusList: ["DONE", "SKIPPED", "DONE", "PENDING"],},];@@ -514,14 +514,14 @@ const workspacesSeeder = (server: any) => {workspace: workspace1,});- createUpdateSchemaTask(+ createUpdateSchemaStage(server,workspace1.id,pipeline.id,ws1Dev1.id,environmentList1,databaseList1,- statusSet.stepStatusList+ statusSet.taskStatusList);server.create("activity", {@@ -572,14 +572,14 @@ const workspacesSeeder = (server: any) => {workspace: workspace1,});- createUpdateSchemaTask(+ createUpdateSchemaStage(server,workspace1.id,pipeline.id,ws1Owner.id,environmentList1,databaseList1,- statusSet.stepStatusList+ statusSet.taskStatusList);server.create("activity", {@@ -630,14 +630,14 @@ const workspacesSeeder = (server: any) => {workspace: workspace1,});- createUpdateSchemaTask(+ createUpdateSchemaStage(server,workspace1.id,pipeline.id,ws1Dev2.id,environmentList1,databaseList1,- statusSet.stepStatusList+ statusSet.taskStatusList);server.create("activity", {@@ -686,7 +686,7 @@ const workspacesSeeder = (server: any) => {workspace: workspace2,});- createUpdateSchemaTask(+ createUpdateSchemaStage(server,workspace2.id,pipeline.id,@@ -805,46 +805,46 @@ const createInstanceList = (return instanceList;};-const createUpdateSchemaTask = (+const createUpdateSchemaStage = (server: any,workspaceId: string,pipelineId: PipelineId,creatorId: PrincipalId,environmentList: Environment[],databaseList: Database[],- stepStatusList: StepStatus[]+ taskStatusList: TaskStatus[]) => {- for (let i = 0; i < stepStatusList.length; i++) {- const task = server.create("task", {+ for (let i = 0; i < taskStatusList.length; i++) {+ const stage = server.create("stage", {creatorId: creatorId,updaterId: creatorId,name: `${environmentList[i].name}`,- type: "bytebase.task.schema.update",+ type: "bytebase.stage.schema.update",environmentId: environmentList[i].id,databaseId: databaseList[i].id,pipelineId,workspaceId,});- // server.create("step", {+ // server.create("task", {// creatorId: creatorId,// updaterId: creatorId,// name: "Waiting approval",- // type: "bytebase.step.approve",- // status: stepStatusList[i],+ // type: "bytebase.task.approve",+ // status: taskStatusList[i],// pipelineId,- // task,+ // stage,// workspaceId,// });- server.create("step", {+ server.create("task", {creatorId: creatorId,updaterId: creatorId,name: `Update ${databaseList[i].name} schema`,- type: "bytebase.step.schema.udpate",- status: stepStatusList[i],+ type: "bytebase.task.schema.udpate",+ status: taskStatusList[i],pipelineId,- task,+ stage,workspaceId,});}diff --git a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts b/frontend/src/plugins/issue/DatabaseCreateTemplate.tsindex 6f14ac31af..188a09062e 100644--- a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts@@ -25,16 +25,16 @@ const template: IssueTemplate = {type: "bytebase.database.create",description: "",pipeline: {- taskList: [+ stageList: [{name: "Create database",environmentId: ctx.environmentList[0].id,databaseId: EMPTY_ID,- type: "bytebase.task.database.create",- stepList: [+ type: "bytebase.stage.database.create",+ taskList: [{name: "Waiting for approval",- type: "bytebase.step.approve",+ type: "bytebase.task.approve",},],},diff --git a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts b/frontend/src/plugins/issue/DatabaseGrantTemplate.tsindex d34fc176d8..be85f2730e 100644--- a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts@@ -25,16 +25,16 @@ const template: IssueTemplate = {type: "bytebase.database.grant",description: "",pipeline: {- taskList: [+ stageList: [{name: "Request database access",- type: "bytebase.task.database.grant",+ type: "bytebase.stage.database.grant",environmentId: ctx.environmentList[0].id,databaseId: ctx.databaseList[0].id,- stepList: [+ taskList: [{name: "Waiting for approval",- type: "bytebase.step.approve",+ type: "bytebase.task.approve",},],},diff --git a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.tsindex d0f66dc18a..822a3e15d0 100644--- a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts@@ -7,7 +7,7 @@ import {IssueContext,} from "../types";-import { Database, Task, TaskNew, IssueNew, UNKNOWN_ID } from "../../types";+import { Database, Stage, StageNew, IssueNew, UNKNOWN_ID } from "../../types";const template: IssueTemplate = {type: "bytebase.database.schema.update",@@ -15,21 +15,21 @@ const template: IssueTemplate = {ctx: TemplateContext): Omit<IssueNew, "projectId" | "creatorId"> => {const payload: any = {};- const taskList: TaskNew[] = [];+ const stageList: StageNew[] = [];for (let i = 0; i < ctx.databaseList.length; i++) {- taskList.push({+ stageList.push({name: `[${ctx.databaseList[i].instance.environment.name}] ${ctx.databaseList[i].name}`,- type: "bytebase.task.schema.update",+ type: "bytebase.stage.schema.update",environmentId: ctx.environmentList[i].id,databaseId: ctx.databaseList[i].id,- stepList: [+ taskList: [{name: "Waiting for approval",- type: "bytebase.step.approve",+ type: "bytebase.task.approve",},{name: `Update ${ctx.databaseList[i].name} schema`,- type: "bytebase.step.database.schema.update",+ type: "bytebase.task.database.schema.update",},],});@@ -39,7 +39,7 @@ const template: IssueTemplate = {type: "bytebase.database.schema.update",description: "",pipeline: {- taskList,+ stageList,creatorId: ctx.currentUser.id,name: "Update database schema pipeline",},diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.tsindex dcedda4a44..604c54b522 100644--- a/frontend/src/plugins/types.ts+++ b/frontend/src/plugins/types.ts@@ -10,7 +10,7 @@ import {} from "../types";// Issue-// It has to be string type because the id for task field contain multiple parts.+// It has to be string type because the id for stage field contain multiple parts.export type FieldId = string;export enum IssueBuiltinFieldId {@@ -23,12 +23,12 @@ export enum IssueBuiltinFieldId {INSTANCE = "7",DATABASE = "8",DATA_SOURCE = "9",- TASK = "10", // The full id is concatenated with the actual task id e.g. "8".<<task id>>+ STAGE = "10", // The full id is concatenated with the actual stage id e.g. "8".<<stage id>>SQL = "11",ROLLBACK_SQL = "12",SUBSCRIBER_LIST = "13",- TASK_STATUS = "14",- STEP_STATUS = "15",+ STAGE_STATUS = "14",+ TASK_STATUS = "15",}export const INPUT_CUSTOM_FIELD_ID_BEGIN = "100";diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.tsindex 0c2f6d0d6e..8ff80387cd 100644--- a/frontend/src/store/index.ts+++ b/frontend/src/store/index.ts@@ -15,8 +15,8 @@ import plan from "./modules/plan";import auth from "./modules/auth";import issue from "./modules/issue";import pipeline from "./modules/pipeline";+import stage from "./modules/stage";import task from "./modules/task";-import step from "./modules/step";// Following states are persisted in local storageimport uistate from "./modules/uistate";@@ -44,8 +44,8 @@ export const store: Store<any> = createStore({auth,issue,pipeline,+ stage,task,- step,uistate,router,command,diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.tsindex 348c5512ed..79440939cb 100644--- a/frontend/src/store/modules/auth.ts+++ b/frontend/src/store/modules/auth.ts@@ -63,7 +63,7 @@ const actions = {// Refresh the corresponding principalawait dispatch("principal/fetchPrincipalById", newUser.id, { root: true });- // The conversion relies on the above step.+ // The conversion relies on the above task.const convertedUser = convert(newUser, rootGetters);localStorage.setItem("bb.auth.user", JSON.stringify(convertedUser));@@ -85,7 +85,7 @@ const actions = {// Refresh the corresponding principaldispatch("principal/fetchPrincipalById", activatedUser.id, { root: true });- // The conversion relies on the above step to get the lastest data+ // The conversion relies on the above task to get the lastest dataconst convertedUser = convert(activatedUser, rootGetters);localStorage.setItem("bb.auth.user", JSON.stringify(convertedUser));diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.tsindex 9407181681..9411111f37 100644--- a/frontend/src/store/modules/issue.ts+++ b/frontend/src/store/modules/issue.ts@@ -113,7 +113,7 @@ const actions = {async fetchIssueListForUser({ commit, rootGetters }: any, userId: UserId) {const data = (await axios.get(- `/api/issue?user=${userId}&include=project,pipeline,pipeline.task,pipeline.step`+ `/api/issue?user=${userId}&include=project,pipeline,pipeline.stage,pipeline.task`)).data;const issueList = data.data.map((issue: ResourceObject) => {@@ -128,7 +128,7 @@ const actions = {async fetchIssueListForProject({ rootGetters }: any, projectId: ProjectId) {const data = (await axios.get(- `/api/issue?project=${projectId}&include=project,pipeline,pipeline.task,pipeline.step`+ `/api/issue?project=${projectId}&include=project,pipeline,pipeline.stage,pipeline.task`)).data;const issueList = data.data.map((issue: ResourceObject) => {@@ -142,7 +142,7 @@ const actions = {async fetchIssueById({ commit, rootGetters }: any, issueId: IssueId) {const data = (await axios.get(- `/api/issue/${issueId}?include=project,pipeline,pipeline.task,pipeline.step`+ `/api/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`)).data;const issue = convert(data.data, data.included, rootGetters);@@ -156,7 +156,7 @@ const actions = {async createIssue({ commit, rootGetters }: any, newIssue: IssueNew) {const data = (await axios.post(- `/api/issue?include=project,pipeline,pipeline.task,pipeline.step`,+ `/api/issue?include=project,pipeline,pipeline.stage,pipeline.task`,{data: {type: "issuenew",@@ -187,7 +187,7 @@ const actions = {) {const data = (await axios.patch(- `/api/issue/${issueId}?include=project,pipeline,pipeline.task,pipeline.step`,+ `/api/issue/${issueId}?include=project,pipeline,pipeline.stage,pipeline.task`,{data: {type: "issuepatch",@@ -220,7 +220,7 @@ const actions = {) {const data = (await axios.patch(- `/api/issue/${issueId}/status?include=project,pipeline,pipeline.task,pipeline.step`,+ `/api/issue/${issueId}/status?include=project,pipeline,pipeline.stage,pipeline.task`,{data: {type: "issuestatuspatch",diff --git a/frontend/src/store/modules/pipeline.ts b/frontend/src/store/modules/pipeline.tsindex 5889156350..d6c9c3e2e0 100644--- a/frontend/src/store/modules/pipeline.ts+++ b/frontend/src/store/modules/pipeline.ts@@ -6,11 +6,11 @@ import {PipelineId,PipelineState,PipelineStatusPatch,- Step,+ Task,Issue,IssueId,unknown,- Task,+ Stage,} from "../../types";const state: () => PipelineState = () => ({});@@ -27,35 +27,38 @@ function convert(pipeline.attributes.updaterId);- const taskList: Task[] = [];+ const stageList: Stage[] = [];for (const item of includedList || []) {if (- item.type == "task" &&+ item.type == "stage" &&(item.relationships!.pipeline.data as ResourceIdentifier).id ==pipeline.id) {- const task: Task = rootGetters["task/convertPartial"](item, includedList);- taskList.push(task);+ const stage: Stage = rootGetters["stage/convertPartial"](+ item,+ includedList+ );+ stageList.push(stage);}}const result: Pipeline = {...(pipeline.attributes as Omit<Pipeline,- "id" | "creator" | "updater" | "taskList"+ "id" | "creator" | "updater" | "stageList">),id: pipeline.id,creator,updater,- taskList,+ stageList,};- // Now we have a complate issue, we assign it back to task and step- for (const task of result.taskList) {- task.pipeline = result;- for (const step of task.stepList) {- step.pipeline = result;- step.task = task;+ // Now we have a complate issue, we assign it back to stage and task+ for (const stage of result.stageList) {+ stage.pipeline = result;+ for (const task of stage.taskList) {+ task.pipeline = result;+ task.stage = stage;}}diff --git a/frontend/src/store/modules/stage.ts b/frontend/src/store/modules/stage.tsnew file mode 100644index 0000000000..2ca5ee7368--- /dev/null+++ b/frontend/src/store/modules/stage.ts@@ -0,0 +1,109 @@+import axios from "axios";+import {+ ResourceIdentifier,+ ResourceObject,+ Stage,+ StageId,+ StageState,+ Task,+ Issue,+ IssueId,+ unknown,+ PipelineId,+ Pipeline,+ Database,+ empty,+ Environment,+} from "../../types";++const state: () => StageState = () => ({});++function convertPartial(+ stage: ResourceObject,+ includedList: ResourceObject[],+ rootGetters: any+): Omit<Stage, "pipeline"> {+ const creator = rootGetters["principal/principalById"](+ stage.attributes.creatorId+ );+ const updater = rootGetters["principal/principalById"](+ stage.attributes.updaterId+ );++ // We should always have a valid environment+ const environment: Environment = rootGetters["environment/environmentById"](+ (stage.relationships!.environment.data as ResourceIdentifier).id+ );++ let database: Database = empty("DATABASE") as Database;+ // For create database stage, there is no database id.+ if (stage.relationships!.database.data) {+ database = rootGetters["database/databaseById"](+ (stage.relationships!.database.data as ResourceIdentifier).id+ );+ }++ const taskList: Task[] = [];+ for (const item of includedList || []) {+ if (+ item.type == "task" &&+ (item.relationships!.stage.data as ResourceIdentifier).id == stage.id+ ) {+ const task = rootGetters["task/convertPartial"](item);+ taskList.push(task);+ }+ }++ const result: Omit<Stage, "pipeline"> = {+ ...(stage.attributes as Omit<+ Stage,+ "id" | "creator" | "updater" | "database" | "taskList"+ >),+ id: stage.id,+ creator,+ updater,+ environment,+ database,+ taskList,+ };++ return result;+}++const getters = {+ convertPartial: (+ state: StageState,+ getters: any,+ rootState: any,+ rootGetters: any+ ) => (stage: ResourceObject, includedList: ResourceObject[]): Stage => {+ // It's only called when pipeline tries to convert itself, so we don't have a issue yet.+ const pipelineId = stage.attributes.pipelineId as PipelineId;+ let pipeline: Pipeline = unknown("PIPELINE") as Pipeline;+ pipeline.id = pipelineId;++ const result: Stage = {+ ...convertPartial(stage, includedList, rootGetters),+ pipeline,+ };++ for (const task of result.taskList) {+ task.stage = result;+ task.pipeline = pipeline;+ }++ return result;+ },+};++const actions = {};++const mutations = {};++export default {+ namespaced: true,+ state,+ getters,+ actions,+ mutations,+};diff --git a/frontend/src/store/modules/step.ts b/frontend/src/store/modules/step.tsdeleted file mode 100644index 78da64c52e..0000000000--- a/frontend/src/store/modules/step.ts+++ /dev/null@@ -1,101 +0,0 @@-import axios from "axios";-import {- ResourceObject,- StepState,- Step,- Task,- unknown,- IssueId,- TaskId,- PipelineId,- Pipeline,- StepStatusPatch,- StepId,-} from "../../types";--const state: () => StepState = () => ({});--function convertPartial(- step: ResourceObject,- rootGetters: any-): Omit<Step, "pipeline" | "task"> {- const creator = rootGetters["principal/principalById"](- step.attributes.creatorId- );- const updater = rootGetters["principal/principalById"](- step.attributes.updaterId- );-- return {- ...(step.attributes as Omit<- Step,- "id" | "creator" | "updater" | "pipeline" | "task"- >),- id: step.id,- creator,- updater,- };-}--const getters = {- convertPartial: (- state: StepState,- getters: any,- rootState: any,- rootGetters: any- ) => (step: ResourceObject): Step => {- // It's only called when pipeline/task tries to convert itself, so we don't have a issue yet.- const pipelineId = step.attributes.pipelineId as PipelineId;- let pipeline: Pipeline = unknown("PIPELINE") as Pipeline;- pipeline.id = pipelineId;-- const taskId = step.attributes.taskId as TaskId;- let task: Task = unknown("TASK") as Task;- task.id = taskId;-- return {- ...convertPartial(step, rootGetters),- pipeline,- task,- };- },-};--const actions = {- async updateStatus(- { dispatch }: any,- {- issueId,- pipelineId,- stepId,- stepStatusPatch,- }: {- issueId: IssueId;- pipelineId: PipelineId;- stepId: StepId;- stepStatusPatch: StepStatusPatch;- }- ) {- // TODO: Returns the updated pipeline and update the issue.- const data = (- await axios.patch(`/api/pipeline/${pipelineId}/step/${stepId}/status`, {- data: {- type: "stepstatuspatch",- attributes: stepStatusPatch,- },- })- ).data;-- dispatch("issue/fetchIssueById", issueId, { root: true });- },-};--const mutations = {};--export default {- namespaced: true,- state,- getters,- actions,- mutations,-};diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.tsindex d3fd8d820f..7d4c43b3ce 100644--- a/frontend/src/store/modules/task.ts+++ b/frontend/src/store/modules/task.ts@@ -1,28 +1,24 @@import axios from "axios";import {- ResourceIdentifier,ResourceObject,- Task,- TaskId,TaskState,- Step,- Issue,- IssueId,+ Task,+ Stage,unknown,+ IssueId,+ StageId,PipelineId,Pipeline,- Database,- empty,- Environment,+ TaskStatusPatch,+ TaskId,} from "../../types";const state: () => TaskState = () => ({});function convertPartial(task: ResourceObject,- includedList: ResourceObject[],rootGetters: any-): Omit<Task, "pipeline"> {+): Omit<Task, "pipeline" | "stage"> {const creator = rootGetters["principal/principalById"](task.attributes.creatorId);@@ -30,44 +26,15 @@ function convertPartial(task.attributes.updaterId);- // We should always have a valid environment- const environment: Environment = rootGetters["environment/environmentById"](- (task.relationships!.environment.data as ResourceIdentifier).id- );-- let database: Database = empty("DATABASE") as Database;- // For create database task, there is no database id.- if (task.relationships!.database.data) {- database = rootGetters["database/databaseById"](- (task.relationships!.database.data as ResourceIdentifier).id- );- }-- const stepList: Step[] = [];- for (const item of includedList || []) {- if (- item.type == "step" &&- (item.relationships!.task.data as ResourceIdentifier).id == task.id- ) {- const step = rootGetters["step/convertPartial"](item);- stepList.push(step);- }- }-- const result: Omit<Task, "pipeline"> = {+ return {...(task.attributes as Omit<Task,- "id" | "creator" | "updater" | "database" | "stepList"+ "id" | "creator" | "updater" | "pipeline" | "stage">),id: task.id,creator,updater,- environment,- database,- stepList,};-- return result;}const getters = {@@ -76,28 +43,53 @@ const getters = {getters: any,rootState: any,rootGetters: any- ) => (task: ResourceObject, includedList: ResourceObject[]): Task => {- // It's only called when pipeline tries to convert itself, so we don't have a issue yet.+ ) => (task: ResourceObject): Task => {+ // It's only called when pipeline/stage tries to convert itself, so we don't have a issue yet.const pipelineId = task.attributes.pipelineId as PipelineId;let pipeline: Pipeline = unknown("PIPELINE") as Pipeline;pipeline.id = pipelineId;- const result: Task = {- ...convertPartial(task, includedList, rootGetters),+ const stageId = task.attributes.stageId as StageId;+ let stage: Stage = unknown("STAGE") as Stage;+ stage.id = stageId;++ return {+ ...convertPartial(task, rootGetters),pipeline,+ stage,};+ },+};- for (const step of result.stepList) {- step.task = result;- step.pipeline = pipeline;+const actions = {+ async updateStatus(+ { dispatch }: any,+ {+ issueId,+ pipelineId,+ taskId,+ taskStatusPatch,+ }: {+ issueId: IssueId;+ pipelineId: PipelineId;+ taskId: TaskId;+ taskStatusPatch: TaskStatusPatch;}+ ) {+ // TODO: Returns the updated pipeline and update the issue.+ const data = (+ await axios.patch(`/api/pipeline/${pipelineId}/task/${taskId}/status`, {+ data: {+ type: "taskstatuspatch",+ attributes: taskStatusPatch,+ },+ })+ ).data;- return result;+ dispatch("issue/fetchIssueById", issueId, { root: true });},};-const actions = {};-const mutations = {};export default {diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex 1d0998f1d4..21ef807424 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -27,8 +27,8 @@ export type ResourceType =| "DATA_SOURCE"| "ISSUE"| "PIPELINE"+ | "STAGE"| "TASK"- | "STEP"| "ACTIVITY"| "MESSAGE"| "BOOKMARK";@@ -50,8 +50,8 @@ export const unknown = (| DataSource| Issue| Pipeline+ | Stage| Task- | Step| Activity| Message| Bookmark => {@@ -172,7 +172,7 @@ export const unknown = (updatedTs: 0,name: "<<Unknown pipeline>>",status: "DONE",- taskList: [],+ stageList: [],};const UNKNOWN_ISSUE: Issue = {@@ -191,30 +191,30 @@ export const unknown = (payload: {},};- const UNKNOWN_TASK: Task = {+ const UNKNOWN_STAGE: Stage = {id: UNKNOWN_ID,pipeline: UNKNOWN_PIPELINE,creator: UNKNOWN_PRINCIPAL,createdTs: 0,updater: UNKNOWN_PRINCIPAL,updatedTs: 0,- name: "<<Unknown task>>",- type: "bytebase.task.unknown",+ name: "<<Unknown stage>>",+ type: "bytebase.stage.unknown",environment: UNKNOWN_ENVIRONMENT,database: UNKNOWN_DATABASE,- stepList: [],+ taskList: [],};- const UNKNOWN_STEP: Step = {+ const UNKNOWN_TASK: Task = {id: UNKNOWN_ID,pipeline: UNKNOWN_PIPELINE,- task: UNKNOWN_TASK,+ stage: UNKNOWN_STAGE,creator: UNKNOWN_PRINCIPAL,createdTs: 0,updater: UNKNOWN_PRINCIPAL,updatedTs: 0,- name: "<<Unknown step>>",- type: "bytebase.step.unknown",+ name: "<<Unknown task>>",+ type: "bytebase.task.unknown",status: "DONE",};@@ -277,10 +277,10 @@ export const unknown = (return UNKNOWN_ISSUE;case "PIPELINE":return UNKNOWN_PIPELINE;+ case "STAGE":+ return UNKNOWN_STAGE;case "TASK":return UNKNOWN_TASK;- case "STEP":- return UNKNOWN_STEP;case "ACTIVITY":return UNKNOWN_ACTIVITY;case "MESSAGE":@@ -306,8 +306,8 @@ export const empty = (| DataSource| Issue| Pipeline+ | Stage| Task- | Step| Activity| Message| Bookmark => {@@ -428,7 +428,7 @@ export const empty = (updatedTs: 0,name: "",status: "DONE",- taskList: [],+ stageList: [],};const EMPTY_ISSUE: Issue = {@@ -447,7 +447,7 @@ export const empty = (payload: {},};- const EMPTY_TASK: Task = {+ const EMPTY_STAGE: Stage = {id: EMPTY_ID,pipeline: EMPTY_PIPELINE,creator: EMPTY_PRINCIPAL,@@ -455,22 +455,22 @@ export const empty = (updater: EMPTY_PRINCIPAL,updatedTs: 0,name: "",- type: "bytebase.task.unknown",+ type: "bytebase.stage.unknown",environment: EMPTY_ENVIRONMENT,database: EMPTY_DATABASE,- stepList: [],+ taskList: [],};- const EMPTY_STEP: Step = {+ const EMPTY_TASK: Task = {id: EMPTY_ID,pipeline: EMPTY_PIPELINE,- task: EMPTY_TASK,+ stage: EMPTY_STAGE,creator: EMPTY_PRINCIPAL,createdTs: 0,updater: EMPTY_PRINCIPAL,updatedTs: 0,name: "",- type: "bytebase.step.unknown",+ type: "bytebase.task.unknown",status: "DONE",};@@ -533,10 +533,10 @@ export const empty = (return EMPTY_ISSUE;case "PIPELINE":return EMPTY_PIPELINE;+ case "STAGE":+ return EMPTY_STAGE;case "TASK":return EMPTY_TASK;- case "STEP":- return EMPTY_STEP;case "ACTIVITY":return EMPTY_ACTIVITY;case "MESSAGE":@@ -566,9 +566,9 @@ export type IssueId = string;export type PipelineId = string;-export type TaskId = string;+export type StageId = string;-export type StepId = string;+export type TaskId = string;export type ActivityId = string;@@ -957,45 +957,45 @@ export const ASSIGNEE_APPLICABLE_ACTION_LIST: Map<["CANCELED", ["REOPEN"]],]);-// Pipeline, Task, Step are the backbones of execution.+// Pipeline, Stage, Task are the backbones of execution.//-// A PIPELINE consists of multiple TASKS. A TASK consists of multiple STEPS.+// A PIPELINE consists of multiple STAGES. A STAGE consists of multiple TASKS.//// Comparison with Tekton// PIPELINE = Tekton Pipeline+// STAGE = Tekton Stage// TASK = Tekton Task-// STEP = Tekton Step//// Comparison with GitLab:// PIPELINE = GitLab Pipeline-// TASK = GitLab Stage-// STEP = GitLab Job+// STAGE = GitLab Stage+// TASK = GitLab Job//// Comparison with Octopus:// PIPELINE = Octopus Lifecycle-// TASK = Octopus Phase-// STEP = Octopus Step+// STAGE = Octopus Phase+// TASK = Octopus Task-// We require a task to associate with a database. Since database belongs to an instance, which-// in turns belongs to an environment, thus the task is also associated with an instance and environment.+// We require a stage to associate with a database. Since database belongs to an instance, which+// in turns belongs to an environment, thus the stage is also associated with an instance and environment.// The environment has tiers which defines rules like whether requires manual approval./*An exampleAn alter schema PIPELINE- Dev TASK (db_dev, env_dev)+ Dev STAGE (db_dev, env_dev)Change dev database schema- Testing TASK (db_test, env_test)+ Testing STAGE (db_test, env_test)Change testing database schemaVerify integration test pass- Staging TASK (db_staging, env_staging)+ Staging STAGE (db_staging, env_staging)Approve changeChange staging database schema- Prod TASK (db_prod, env_prod)+ Prod STAGE (db_prod, env_prod)Approve changeChange prod database schema*/@@ -1006,7 +1006,7 @@ export type Pipeline = {id: PipelineId;// Related fields- taskList: Task[];+ stageList: Stage[];// Standard fieldscreator: Principal;@@ -1021,7 +1021,7 @@ export type Pipeline = {export type PipelineNew = {// Related fields- taskList: TaskNew[];+ stageList: StageNew[];// Standard fieldscreatorId: PrincipalId;@@ -1039,30 +1039,30 @@ export type PipelineStatusPatch = {comment?: string;};-// Task-export type TaskType =- | "bytebase.task.unknown"- | "bytebase.task.final"- | "bytebase.task.transition"- | "bytebase.task.database.create"- | "bytebase.task.database.grant"- | "bytebase.task.schema.update";+// Stage+export type StageType =+ | "bytebase.stage.unknown"+ | "bytebase.stage.final"+ | "bytebase.stage.transition"+ | "bytebase.stage.database.create"+ | "bytebase.stage.database.grant"+ | "bytebase.stage.schema.update";-export type TaskRunnable = {+export type StageRunnable = {auto: boolean;run: () => void;};// The database belongs to an instance which in turns belongs to an environment.-// THus task can access both instance and environment info.-export type Task = {- id: TaskId;+// THus stage can access both instance and environment info.+export type Stage = {+ id: StageId;// Related fields- stepList: Step[];+ taskList: Task[];pipeline: Pipeline;environment: Environment;- // We may get an empty database for tasks like creating database.+ // We may get an empty database for stages like creating database.database: Database;// Standard fields@@ -1073,44 +1073,44 @@ export type Task = {// Domain specific fieldsname: string;- type: TaskType;- runnable?: TaskRunnable;+ type: StageType;+ runnable?: StageRunnable;};-export type TaskNew = {+export type StageNew = {// Related fields- stepList: StepNew[];+ taskList: TaskNew[];environmentId: EnvironmentId;databaseId: DatabaseId;// Domain specific fieldsname: string;- type: TaskType;+ type: StageType;};-// Step-export type StepType =- | "bytebase.step.unknown"- | "bytebase.step.final"- | "bytebase.step.resolve"- | "bytebase.step.approve"- | "bytebase.step.database.schema.update";+// Task+export type TaskType =+ | "bytebase.task.unknown"+ | "bytebase.task.final"+ | "bytebase.task.resolve"+ | "bytebase.task.approve"+ | "bytebase.task.database.schema.update";-export type StepStatus = "PENDING" | "RUNNING" | "DONE" | "FAILED" | "SKIPPED";+export type TaskStatus = "PENDING" | "RUNNING" | "DONE" | "FAILED" | "SKIPPED";-export type DatabaseSchemaUpdateStepPayload = {+export type DatabaseSchemaUpdateTaskPayload = {sql: string;rollbackSql: string;};-export type StepPayload = DatabaseSchemaUpdateStepPayload;+export type TaskPayload = DatabaseSchemaUpdateTaskPayload;-export type Step = {- id: StepId;+export type Task = {+ id: TaskId;// Related fieldspipeline: Pipeline;- task: Task;+ stage: Stage;// Standard fieldscreator: Principal;@@ -1120,28 +1120,28 @@ export type Step = {// Domain specific fieldsname: string;- type: StepType;- status: StepStatus;- payload?: StepPayload;+ type: TaskType;+ status: TaskStatus;+ payload?: TaskPayload;};-export type StepNew = {+export type TaskNew = {// Domain specific fieldsname: string;- type: StepType;+ type: TaskType;};-export type StepPatch = {+export type TaskPatch = {// Standard fieldsupdaterId: PrincipalId;// Domain specific fields- status: StepStatus;+ status: TaskStatus;};-export type StepStatusPatch = {+export type TaskStatusPatch = {updaterId: PrincipalId;- status: StepStatus;+ status: TaskStatus;comment?: string;};@@ -1151,8 +1151,8 @@ export type IssueActionType =| "bytebase.issue.comment.create"| "bytebase.issue.field.update"| "bytebase.issue.status.update"- | "bytebase.issue.task.status.update"- | "bytebase.issue.task.step.status.update";+ | "bytebase.issue.stage.status.update"+ | "bytebase.issue.stage.task.status.update";export type ActionType = IssueActionType;@@ -1238,7 +1238,7 @@ export type InstanceMessageType =export type IssueMessageType =| "bb.msg.issue.assign"| "bb.msg.issue.status.update"- | "bb.msg.issue.task.status.update"+ | "bb.msg.issue.stage.status.update"| "bb.msg.issue.comment";export type MessageType =@@ -1697,9 +1697,9 @@ export interface IssueState {export interface PipelineState {}-export interface TaskState {}+export interface StageState {}-export interface StepState {}+export interface TaskState {}export interface ProjectState {projectById: Map<ProjectId, Project>;diff --git a/frontend/src/utils/issue.ts b/frontend/src/utils/issue.tsindex a0c07c21f0..4ef6982541 100644--- a/frontend/src/utils/issue.ts+++ b/frontend/src/utils/issue.ts@@ -1,10 +1,10 @@-import { Issue, TaskId } from "../types";+import { Issue, StageId } from "../types";-export function taskName(issue: Issue, taskId: TaskId): string {- for (const task of issue.pipeline.taskList) {- if (task.id == taskId) {- return task.name;+export function stageName(issue: Issue, stageId: StageId): string {+ for (const stage of issue.pipeline.stageList) {+ if (stage.id == stageId) {+ return stage.name;}}- return "<<Unknown task>>";+ return "<<Unknown stage>>";}diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.tsindex 11493f25c4..3b2d33ae60 100644--- a/frontend/src/utils/pipeline.ts+++ b/frontend/src/utils/pipeline.ts@@ -4,89 +4,89 @@ import {EMPTY_ID,Environment,Pipeline,- Step,- StepStatus,Task,+ TaskStatus,+ Stage,UNKNOWN_ID,} from "../types";export type PipelineType =| "NO_PIPELINE"- | "SINGLE_TASK"- | "MULTI_SINGLE_STEP_TASK"- | "MULTI_TASK";+ | "SINGLE_STAGE"+ | "MULTI_SINGLE_TASK_STAGE"+ | "MULTI_STAGE";export function pipelineType(pipeline: Pipeline): PipelineType {- if (pipeline.taskList.length == 0) {+ if (pipeline.stageList.length == 0) {return "NO_PIPELINE";- } else if (pipeline.taskList.length == 1) {- return "SINGLE_TASK";+ } else if (pipeline.stageList.length == 1) {+ return "SINGLE_STAGE";} else {- for (const task of pipeline.taskList) {- if (task.stepList.length > 1) {- return "MULTI_TASK";+ for (const stage of pipeline.stageList) {+ if (stage.taskList.length > 1) {+ return "MULTI_STAGE";}}- return "MULTI_SINGLE_STEP_TASK";+ return "MULTI_SINGLE_TASK_STAGE";}}-// 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);+// Returns all tasks from all stages.+export function allTaskList(pipeline: Pipeline): Task[] {+ const list: Task[] = [];+ pipeline.stageList.forEach((stage) => {+ stage.taskList.forEach((task) => {+ list.push(task);});});return list;}-export function activeStep(pipeline: Pipeline): Step {- for (const task of pipeline.taskList) {- for (const step of task.stepList) {+export function activeTask(pipeline: Pipeline): Task {+ for (const stage of pipeline.stageList) {+ for (const task of stage.taskList) {if (- step.status == "PENDING" ||- step.status == "RUNNING" ||- // "FAILED" is also a transient step status, which requires user+ task.status == "PENDING" ||+ task.status == "RUNNING" ||+ // "FAILED" is also a transient task status, which requires user// to take further action (e.g. Skip, Retry)- step.status == "FAILED"+ task.status == "FAILED") {- return step;+ return task;}}}- return empty("STEP") as Step;+ return empty("TASK") as Task;}export function activeEnvironment(pipeline: Pipeline): Environment {- const task: Task = activeTask(pipeline);- if (task.id == EMPTY_ID) {+ const stage: Stage = activeStage(pipeline);+ if (stage.id == EMPTY_ID) {return empty("ENVIRONMENT") as Environment;}- return task.environment;+ return stage.environment;}export function activeDatabase(pipeline: Pipeline): Database {- const task = activeTask(pipeline);- if (task.id == EMPTY_ID) {+ const stage = activeStage(pipeline);+ if (stage.id == EMPTY_ID) {return empty("DATABASE") as Database;}- return task.database;+ return stage.database;}-export type StepStatusTransitionType = "RUN" | "RETRY" | "CANCEL" | "SKIP";+export type TaskStatusTransitionType = "RUN" | "RETRY" | "CANCEL" | "SKIP";-export interface StepStatusTransition {- type: StepStatusTransitionType;- to: StepStatus;+export interface TaskStatusTransition {+ type: TaskStatusTransitionType;+ to: TaskStatus;buttonName: string;buttonClass: string;}-const STEP_STATUS_TRANSITION_LIST: Map<- StepStatusTransitionType,- StepStatusTransition+const TASK_STATUS_TRANSITION_LIST: Map<+ TaskStatusTransitionType,+ TaskStatusTransition> = new Map([["RUN",@@ -128,9 +128,9 @@ const STEP_STATUS_TRANSITION_LIST: Map<]);// The transition button is ordered from right to left on the UI-const APPLICABLE_STEP_TRANSITION_LIST: Map<- StepStatus,- StepStatusTransitionType[]+const APPLICABLE_TASK_TRANSITION_LIST: Map<+ TaskStatus,+ TaskStatusTransitionType[]> = new Map([["PENDING", ["RUN", "SKIP"]],["RUNNING", ["CANCEL"]],@@ -139,37 +139,37 @@ const APPLICABLE_STEP_TRANSITION_LIST: Map<["SKIPPED", []],]);-export function applicableStepTransition(+export function applicableTaskTransition(pipeline: Pipeline-): StepStatusTransition[] {- const step = activeStep(pipeline);+): TaskStatusTransition[] {+ const task = activeTask(pipeline);- if (step.id == EMPTY_ID || step.id == UNKNOWN_ID) {+ if (task.id == EMPTY_ID || task.id == UNKNOWN_ID) {return [];}- const list: StepStatusTransitionType[] = APPLICABLE_STEP_TRANSITION_LIST.get(- step.status+ const list: TaskStatusTransitionType[] = APPLICABLE_TASK_TRANSITION_LIST.get(+ task.status)!;- return list.map((type: StepStatusTransitionType) => {- return STEP_STATUS_TRANSITION_LIST.get(type)!;+ return list.map((type: TaskStatusTransitionType) => {+ return TASK_STATUS_TRANSITION_LIST.get(type)!;});}-function activeTask(pipeline: Pipeline): Task {- for (const task of pipeline.taskList) {- for (const step of task.stepList) {+function activeStage(pipeline: Pipeline): Stage {+ for (const stage of pipeline.stageList) {+ for (const task of stage.taskList) {if (- step.status == "PENDING" ||- step.status == "RUNNING" ||- // "FAILED" is also a transient step status, which requires user+ task.status == "PENDING" ||+ task.status == "RUNNING" ||+ // "FAILED" is also a transient task status, which requires user// to take further action (e.g. Skip, Retry)- step.status == "FAILED"+ task.status == "FAILED") {- return task;+ return stage;}}}- return empty("TASK") as Task;+ return empty("STAGE") as Stage;}diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vueindex 8684c13db8..beeee8b553 100644--- a/frontend/src/views/Home.vue+++ b/frontend/src/views/Home.vue@@ -46,8 +46,8 @@ import { useStore } from "vuex";import { useRouter } from "vue-router";import EnvironmentTabFilter from "../components/EnvironmentTabFilter.vue";import IssueTable from "../components/IssueTable.vue";-import { activeEnvironment, activeStep } from "../utils";-import { Environment, Issue, StepStatus } from "../types";+import { activeEnvironment, activeTask } from "../utils";+import { Environment, Issue, TaskStatus } from "../types";interface LocalState {createdList: Issue[];@@ -165,7 +165,7 @@ export default {};const openIssueSorter = (a: Issue, b: Issue) => {- const statusOrder = (status: StepStatus) => {+ const statusOrder = (status: TaskStatus) => {switch (status) {case "FAILED":return 0;@@ -179,8 +179,8 @@ export default {return 4;}};- const aStatusOrder = statusOrder(activeStep(a.pipeline).status);- const bStatusOrder = statusOrder(activeStep(b.pipeline).status);+ const aStatusOrder = statusOrder(activeTask(a.pipeline).status);+ const bStatusOrder = statusOrder(activeTask(b.pipeline).status);if (aStatusOrder == bStatusOrder) {return b.updatedTs - a.updatedTs;}diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vueindex f375fa7650..b55260cccc 100644--- a/frontend/src/views/Inbox.vue+++ b/frontend/src/views/Inbox.vue@@ -343,10 +343,10 @@ export default {payload.newStatus);}- case "bb.msg.issue.task.status.update": {+ case "bb.msg.issue.stage.status.update": {const payload = message.payload as IssueUpdateStatusMessagePayload;return (- "changed issue task status from " ++ "changed issue stage status from " +payload.oldStatus +" to " +payload.newStatusdiff --git a/frontend/src/views/IssueActivityPanel.vue b/frontend/src/views/IssueActivityPanel.vueindex 5825106b38..f1515e1eb4 100644--- a/frontend/src/views/IssueActivityPanel.vue+++ b/frontend/src/views/IssueActivityPanel.vue@@ -303,7 +303,7 @@ import {Environment,Principal,} from "../types";-import { sizeToFit, taskName } from "../utils";+import { sizeToFit, stageName } from "../utils";import { fieldFromId, IssueTemplate, IssueBuiltinFieldId } from "../plugins";interface LocalState {@@ -490,8 +490,8 @@ export default {return "commented";case "bytebase.issue.field.update":case "bytebase.issue.status.update":- case "bytebase.issue.task.status.update":- case "bytebase.issue.task.step.status.update": {+ case "bytebase.issue.stage.status.update":+ case "bytebase.issue.stage.task.status.update": {const updateInfoList: string[] = [];for (const update of (activity.payload as ActionIssueFieldUpdatePayload)?.changeList || []) {@@ -506,12 +506,12 @@ export default {name = "status";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == IssueBuiltinFieldId.TASK_STATUS) {- name = "task status";+ } else if (update.fieldId == IssueBuiltinFieldId.STAGE_STATUS) {+ name = "stage status";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == IssueBuiltinFieldId.STEP_STATUS) {- name = "step status";+ } else if (update.fieldId == IssueBuiltinFieldId.TASK_STATUS) {+ name = "task status";oldValue = update.oldValue;newValue = update.newValue;} else if (update.fieldId == IssueBuiltinFieldId.ASSIGNEE) {@@ -529,10 +529,10 @@ export default {} else if (update.fieldId == IssueBuiltinFieldId.DESCRIPTION) {name = "description";} else if (- update.fieldId.split(".")[0] == IssueBuiltinFieldId.TASK+ update.fieldId.split(".")[0] == IssueBuiltinFieldId.STAGE) {- const taskId = update.fieldId.split(".")[1];- name = taskName(props.issue, taskId);+ const stageId = update.fieldId.split(".")[1];+ name = stageName(props.issue, stageId);oldValue = update.oldValue;newValue = update.newValue;} else if (update.fieldId == IssueBuiltinFieldId.SQL) {diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vueindex 4f3e9e5a24..a44919afbc 100644--- a/frontend/src/views/IssueDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -36,19 +36,19 @@</template><!-- Action Button List --><div- v-if="applicableStepStatusTransitionList.length > 0"+ v-if="applicableTaskStatusTransitionList.length > 0"class="flex space-x-2"><templatev-for="(transition, index- ) in applicableStepStatusTransitionList.reverse()"+ ) in applicableTaskStatusTransitionList.reverse()":key="index"><buttontype="button":class="transition.buttonClass"- @click.prevent="tryStartStepStatusTransition(transition)"+ @click.prevent="tryStartTaskStatusTransition(transition)">{{ transition.buttonName }}</button>@@ -123,9 +123,9 @@</IssueHighlightPanel></div>- <!-- Task Flow Bar -->+ <!-- Stage Flow Bar --><template v-if="showPipelineFlowBar">- <template v-if="currentPipelineType == 'MULTI_SINGLE_STEP_TASK'">+ <template v-if="currentPipelineType == 'MULTI_SINGLE_TASK_STAGE'"><PipelineSimpleFlow :pipeline="state.issue.pipeline" /></template></template>@@ -248,9 +248,9 @@ import {idFromSlug,issueSlug,isDemo,- StepStatusTransition,- applicableStepTransition,- activeStep,+ TaskStatusTransition,+ applicableTaskTransition,+ activeTask,pipelineType,PipelineType,} from "../utils";@@ -278,8 +278,8 @@ import {UNKNOWN_ID,ProjectId,Environment,- StepStatusPatch,- StepId,+ TaskStatusPatch,+ TaskId,EMPTY_ID,} from "../types";import {@@ -585,27 +585,27 @@ export default {return true;};- const tryStartStepStatusTransition = (transition: StepStatusTransition) => {- const step = activeStep((state.issue as Issue).pipeline);- doStepStatusTransition(transition, step.id);+ const tryStartTaskStatusTransition = (transition: TaskStatusTransition) => {+ const task = activeTask((state.issue as Issue).pipeline);+ doTaskStatusTransition(transition, task.id);};- const doStepStatusTransition = (- transition: StepStatusTransition,- stepId: StepId,+ const doTaskStatusTransition = (+ transition: TaskStatusTransition,+ taskId: TaskId,comment?: string) => {- const stepStatusPatch: StepStatusPatch = {+ const taskStatusPatch: TaskStatusPatch = {updaterId: currentUser.value.id,status: transition.to,comment: comment ? comment.trim() : undefined,};- store.dispatch("step/updateStatus", {+ store.dispatch("task/updateStatus", {issueId: (state.issue as Issue).id,pipelineId: (state.issue as Issue).pipeline.id,- stepId,- stepStatusPatch,+ taskId,+ taskStatusPatch,});};@@ -821,17 +821,17 @@ export default {return state.issue.type == "bytebase.database.schema.update";});- const applicableStepStatusTransitionList = computed(- (): StepStatusTransition[] => {+ const applicableTaskStatusTransitionList = computed(+ (): TaskStatusTransition[] => {switch ((state.issue as Issue).status) {case "DONE":case "CANCELED":return [];case "OPEN": {- let list: StepStatusTransition[] = [];+ let list: TaskStatusTransition[] = [];if (currentUser.value.id === (state.issue as Issue).assignee?.id) {- list = applicableStepTransition((state.issue as Issue).pipeline);+ list = applicableTaskTransition((state.issue as Issue).pipeline);}return list;@@ -862,19 +862,19 @@ export default {return list.filter((item) => {- const currentStep = activeStep((state.issue as Issue).pipeline);- // Disallow any issue status transition if the active step is in RUNNING state.- if (currentStep.status == "RUNNING") {+ const currentTask = activeTask((state.issue as Issue).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 step.- if (item == "RESOLVE" && currentStep.id != EMPTY_ID) {+ // Don't display the Resolve action if there is outstanding task.+ if (item == "RESOLVE" && currentTask.id != EMPTY_ID) {return false;}- // Don't display the Abort action if there is NO outstanding step.- if (item == "ABORT" && currentStep.id == EMPTY_ID) {+ // Don't display the Abort action if there is NO outstanding task.+ if (item == "ABORT" && currentTask.id == EMPTY_ID) {return false;}return true;@@ -894,8 +894,8 @@ export default {updateSql,updateRollbackSql,allowTransition,- tryStartStepStatusTransition,- doStepStatusTransition,+ tryStartTaskStatusTransition,+ doTaskStatusTransition,tryStartIssueStatusTransition,doIssueStatusTransition,updateAssigneeId,@@ -918,7 +918,7 @@ export default {showIssueOutputPanel,showIssueSqlPanel,showIssueRollbackSqlPanel,- applicableStepStatusTransitionList,+ applicableTaskStatusTransitionList,applicableIssueStatusTransitionList,};},diff --git a/frontend/src/views/IssueHighlightPanel.vue b/frontend/src/views/IssueHighlightPanel.vueindex 4b58e7de90..22abb350b2 100644--- a/frontend/src/views/IssueHighlightPanel.vue+++ b/frontend/src/views/IssueHighlightPanel.vue@@ -7,7 +7,7 @@<IssueStatusIconv-if="!$props.new":issueStatus="issue.status"- :stepStatus="activeStep(issue.pipeline).status"+ :taskStatus="activeTask(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 { activeStep } from "../utils";+import { activeTask } from "../utils";import { Issue } from "../types";interface LocalState {@@ -83,7 +83,7 @@ export default {(curIssue, _) => {state.name = curIssue.name;- console.log("Current step", activeStep(props.issue.pipeline));+ console.log("Current task", activeTask(props.issue.pipeline));});@@ -94,7 +94,7 @@ export default {}};- return { state, activeStep, trySaveName };+ return { state, activeTask, trySaveName };},};</script>diff --git a/frontend/src/views/IssueSidebar.vue b/frontend/src/views/IssueSidebar.vueindex a85c7523f6..f14eee41ce 100644--- a/frontend/src/views/IssueSidebar.vue+++ b/frontend/src/views/IssueSidebar.vue@@ -301,7 +301,7 @@ export default {const database = computed((): Database => {if (props.new) {- const databaseId = (props.issue as IssueNew).pipeline?.taskList[0]+ const databaseId = (props.issue as IssueNew).pipeline?.stageList[0].databaseId;return store.getters["database/databaseById"](databaseId);}@@ -323,7 +323,7 @@ export default {const environment = computed((): Environment => {if (props.new) {- const environmentId = (props.issue as IssueNew).pipeline?.taskList[0]+ const environmentId = (props.issue as IssueNew).pipeline?.stageList[0].environmentId;return store.getters["environment/environmentById"](environmentId);}diff --git a/frontend/src/views/PipelineSimpleFlow.vue b/frontend/src/views/PipelineSimpleFlow.vueindex 6f3c80a29a..fc61708cfa 100644--- a/frontend/src/views/PipelineSimpleFlow.vue+++ b/frontend/src/views/PipelineSimpleFlow.vue@@ -16,9 +16,9 @@class="relative w-6 h-6 flex flex-shrink-0 items-center justify-center rounded-full select-none":class="flowItemIconClass(item)">- <template v-if="item.stepStatus === 'PENDING'">+ <template v-if="item.taskStatus === 'PENDING'"><span- v-if="activeStep(pipeline).id === item.stepId"+ v-if="activeTask(pipeline).id === item.taskId"class="h-1.5 w-1.5 bg-blue-600 rounded-full"aria-hidden="true"></span>@@ -28,7 +28,7 @@aria-hidden="true"></span></template>- <template v-else-if="item.stepStatus == 'RUNNING'">+ <template v-else-if="item.taskStatus == 'RUNNING'"><spanclass="h-2.5 w-2.5 bg-blue-600 rounded-full"style="@@ -37,7 +37,7 @@aria-hidden="true"></span></template>- <template v-else-if="item.stepStatus == 'DONE'">+ <template v-else-if="item.taskStatus == 'DONE'"><svgclass="w-5 h-5"xmlns="http://www.w3.org/2000/svg"@@ -52,14 +52,14 @@/></svg></template>- <template v-else-if="item.stepStatus == 'FAILED'">+ <template v-else-if="item.taskStatus == 'FAILED'"><spanclass="h-2.5 w-2.5 rounded-full text-center pb-6 font-medium text-base"aria-hidden="true">!</span></template>- <template v-else-if="item.stepStatus == 'SKIPPED'">+ <template v-else-if="item.taskStatus == 'SKIPPED'"><svgclass="w-5 h-5"fill="currentColor"@@ -80,17 +80,17 @@class="hidden lg:ml-4 lg:flex lg:flex-col":class="flowItemTextClass(item)">- <span class="text-xs">{{ item.taskName }}</span>- <span class="text-sm">{{ item.stepName }}</span>+ <span class="text-xs">{{ item.stageName }}</span>+ <span class="text-sm">{{ item.taskName }}</span></div><divclass="ml-4 grid grid-cols-2 lg:hidden":class="flowItemTextClass(item)"><span class="col-span-1 flex items-center text-sm w-32">{{- item.taskName+ item.stageName}}</span>- <span class="col-span-1 text-sm">{{ item.stepName }}</span>+ <span class="col-span-1 text-sm">{{ item.taskName }}</span></div></span></div>@@ -122,14 +122,14 @@<script lang="ts">import { computed, PropType } from "vue";-import { Pipeline, StepStatus, StepId } from "../types";-import { activeStep } from "../utils";+import { Pipeline, TaskStatus, TaskId } from "../types";+import { activeTask } from "../utils";interface FlowItem {+ stageName: string;+ taskId: TaskId;taskName: string;- stepId: StepId;- stepName: string;- stepStatus: StepStatus;+ taskStatus: TaskStatus;}export default {@@ -144,21 +144,21 @@ export default {components: {},setup(props, {}) {const itemList = computed<FlowItem[]>(() => {- return props.pipeline.taskList.map((task) => {- const step = task.stepList[0];+ return props.pipeline.stageList.map((stage) => {+ const task = stage.taskList[0];return {+ stageName: stage.name,+ taskId: task.id,taskName: task.name,- stepId: step.id,- stepName: step.name,- stepStatus: step.status,+ taskStatus: task.status,};});});const flowItemIconClass = (item: FlowItem) => {- switch (item.stepStatus) {+ switch (item.taskStatus) {case "PENDING":- if (activeStep(props.pipeline).id === item.stepId) {+ if (activeTask(props.pipeline).id === item.taskId) {return "bg-white border-2 border-blue-600 text-blue-600 ";}return "bg-white border-2 border-gray-300";@@ -175,16 +175,16 @@ export default {const flowItemTextClass = (item: FlowItem) => {let textClass =- activeStep(props.pipeline).id === item.stepId+ activeTask(props.pipeline).id === item.taskId? "font-semibold ": "font-normal ";- switch (item.stepStatus) {+ switch (item.taskStatus) {case "SKIPPED":return textClass + "text-gray-500";case "DONE":return textClass + "text-control";case "PENDING":- if (activeStep(props.pipeline).id === item.stepId) {+ if (activeTask(props.pipeline).id === item.taskId) {return textClass + "text-blue-600";}return textClass + "text-control";@@ -197,7 +197,7 @@ export default {return {itemList,- activeStep,+ activeTask,flowItemIconClass,flowItemTextClass,};