Skip to content

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

Make issue reference Pipeline

天舟c5fab81dcb76
diff --git a/frontend/src/components/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm.vue
index 2cfcbd2e50..9ae7f3acb2 100644
--- a/frontend/src/components/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm.vue
@@ -114,7 +114,6 @@ import {
EnvironmentId,
Project,
ProjectId,
- unknown,
UNKNOWN_ID,
} from "../types";
@@ -218,6 +217,7 @@ export default {
query: {
template: "bytebase.database.schema.update",
name: `[${database.name}] Alter schema`,
+ project: state.project.id,
databaseList: database.id,
},
});
diff --git a/frontend/src/components/IssueTable.vue b/frontend/src/components/IssueTable.vue
index 8ae764d997..a842e09ca9 100644
--- a/frontend/src/components/IssueTable.vue
+++ b/frontend/src/components/IssueTable.vue
@@ -72,7 +72,7 @@
<BBTableCell :leftPadding="4" class="table-cell">
<IssueStatusIcon
:issueStatus="issue.status"
- :taskStatus="activeTask(issue).status"
+ :taskStatus="activeTask(issue.pipeline).status"
/>
</BBTableCell>
<BBTableCell v-if="mode == 'ALL'" class="table-cell text-gray-500">
@@ -228,7 +228,7 @@ export default {
});
const activeEnvironmentName = function (issue: Issue) {
- const id = activeEnvironmentId(issue);
+ const id = activeEnvironmentId(issue.pipeline);
if (id == EMPTY_ID) {
return "";
}
@@ -236,7 +236,7 @@ export default {
};
const activeDatabaseName = function (issue: Issue) {
- const id = activeDatabaseId(issue);
+ const id = activeDatabaseId(issue.pipeline);
if (id == EMPTY_ID) {
return "";
}
@@ -246,11 +246,11 @@ export default {
const router = useRouter();
const taskList = function (issue: Issue): BBStep[] {
- return issue.taskList.map((task) => {
+ return issue.pipeline.taskList.map((task) => {
let stepStatus: BBStepStatus = "PENDING";
switch (task.status) {
case "PENDING":
- if (activeTask(issue).id === task.id) {
+ if (activeTask(issue.pipeline).id === task.id) {
stepStatus = "PENDING_ACTIVE";
} else {
stepStatus = "PENDING";
diff --git a/frontend/src/components/RequestDatabasePrepForm.vue b/frontend/src/components/RequestDatabasePrepForm.vue
index 22aef8a074..c60cd5d468 100644
--- a/frontend/src/components/RequestDatabasePrepForm.vue
+++ b/frontend/src/components/RequestDatabasePrepForm.vue
@@ -132,12 +132,12 @@ import isEmpty from "lodash-es/isEmpty";
import ProjectSelect from "../components/ProjectSelect.vue";
import DatabaseSelect from "../components/DatabaseSelect.vue";
import EnvironmentSelect from "../components/EnvironmentSelect.vue";
-import { EnvironmentId, ProjectId } from "../types";
+import { EnvironmentId, ProjectId, UNKNOWN_ID } from "../types";
import { allowDatabaseAccess } from "../utils";
interface LocalState {
- environmentId?: EnvironmentId;
- projectId?: ProjectId;
+ environmentId: EnvironmentId;
+ projectId: ProjectId;
// Radio button only accept string value
create: "ON" | "OFF";
databaseName?: string;
@@ -171,6 +171,8 @@ export default {
});
const state = reactive<LocalState>({
+ environmentId: UNKNOWN_ID,
+ projectId: UNKNOWN_ID,
create: "ON",
readOnly: true,
});
@@ -193,8 +195,8 @@ export default {
const allowRequest = computed(() => {
return (
- state.environmentId &&
- state.projectId &&
+ state.environmentId != UNKNOWN_ID &&
+ state.projectId != UNKNOWN_ID &&
((state.create == "ON" && !isEmpty(state.databaseName)) ||
(state.create == "OFF" && state.databaseId)) &&
!alreadyGranted.value
@@ -221,6 +223,7 @@ export default {
template: "bytebase.database.create",
name: `[${environment.name}] Request new database '${state.databaseName}'`,
environment: state.environmentId,
+ project: state.projectId,
database: state.databaseName,
},
});
diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.js
index 3b426314e3..2611618810 100644
--- a/frontend/src/miragejs/models/index.js
+++ b/frontend/src/miragejs/models/index.js
@@ -83,8 +83,7 @@ export default {
issue: Model.extend({
workspace: belongsTo(),
project: belongsTo(),
- task: hasMany(),
- step: hasMany(),
+ pipeline: belongsTo(),
}),
issueNew: Model,
issuePatch: Model,
@@ -96,13 +95,13 @@ export default {
task: hasMany(),
step: hasMany(),
}),
- taskPatch: Model,
- taskStatusPatch: Model,
+ pipelinePatch: Model,
+ pipelineStatusPatch: Model,
// Task
task: Model.extend({
workspace: belongsTo(),
- issue: belongsTo(),
+ pipeline: belongsTo(),
database: belongsTo(),
}),
taskPatch: Model,
@@ -111,7 +110,7 @@ export default {
// Step
step: Model.extend({
workspace: belongsTo(),
- issue: belongsTo(),
+ pipeline: belongsTo(),
task: belongsTo(),
}),
stepPatch: Model,
diff --git a/frontend/src/miragejs/routes/issue.js b/frontend/src/miragejs/routes/issue.js
index 4fcb94793d..2aa16dd359 100644
--- a/frontend/src/miragejs/routes/issue.js
+++ b/frontend/src/miragejs/routes/issue.js
@@ -40,46 +40,63 @@ export default function configureIssue(route) {
route.post("/issue", function (schema, request) {
const ts = Date.now();
- const { taskList, ...attrs } = this.normalizedRequestAttrs("issue-new");
- const database = schema.databases.find(taskList[0].databaseId);
+ const { pipeline, ...attrs } = this.normalizedRequestAttrs("issue-new");
+ const database = schema.databases.find(pipeline.taskList[0].databaseId);
- const newIssue = {
- ...attrs,
- createdTs: ts,
- updaterId: attrs.creatorId,
- updatedTs: ts,
- status: "OPEN",
- projectId: database.projectId,
- workspaceId: WORKSPACE_ID,
- };
- const createdIssue = schema.issues.create(newIssue);
+ let createdPipeline;
- for (const task of taskList) {
- const { stepList, ...taskAttrs } = task;
- const createdTask = schema.tasks.create({
- ...taskAttrs,
+ // Create pipeline if exists
+ if (pipeline) {
+ const newPipeline = {
createdTs: ts,
updaterId: attrs.creatorId,
updatedTs: ts,
- status: "PENDING",
- issue: createdIssue,
+ name: pipeline.name,
+ status: "OPEN",
workspaceId: WORKSPACE_ID,
- });
+ };
+
+ createdPipeline = schema.pipelines.create(newPipeline);
- for (const step of stepList) {
- schema.steps.create({
- ...step,
+ for (const task of pipeline.taskList) {
+ const { stepList, ...taskAttrs } = task;
+ const createdTask = schema.tasks.create({
+ ...taskAttrs,
createdTs: ts,
updaterId: attrs.creatorId,
updatedTs: ts,
status: "PENDING",
- issue: createdIssue,
- task: createdTask,
+ pipeline: createdPipeline,
workspaceId: WORKSPACE_ID,
});
+
+ for (const step of stepList) {
+ schema.steps.create({
+ ...step,
+ createdTs: ts,
+ updaterId: attrs.creatorId,
+ updatedTs: ts,
+ status: "PENDING",
+ pipeline: createdPipeline,
+ task: createdTask,
+ workspaceId: WORKSPACE_ID,
+ });
+ }
}
}
+ const newIssue = {
+ ...attrs,
+ createdTs: ts,
+ updaterId: attrs.creatorId,
+ updatedTs: ts,
+ status: "OPEN",
+ subscriberIdList: [],
+ pipeline: createdPipeline,
+ workspaceId: WORKSPACE_ID,
+ };
+ const createdIssue = schema.issues.create(newIssue);
+
schema.activities.create({
creatorId: attrs.creatorId,
createdTs: ts,
diff --git a/frontend/src/miragejs/seeds/index.ts b/frontend/src/miragejs/seeds/index.ts
index 3160bd0035..9dc2b7723f 100644
--- a/frontend/src/miragejs/seeds/index.ts
+++ b/frontend/src/miragejs/seeds/index.ts
@@ -19,6 +19,7 @@ import {
PrincipalId,
IssueId,
StepStatus,
+ PipelineId,
} from "../../types";
import { databaseSlug, issueSlug } from "../../utils";
@@ -346,9 +347,19 @@ const workspacesSeeder = (server: any) => {
"history",
];
+ const title = `Create database '${databaseList1[1].name}' for environment - ${environmentList1[1].name}`;
+
+ let pipeline = server.create("pipeline", {
+ name: `Pipeline ${title}`,
+ creatorId: ws1Dev1.id,
+ updaterId: ws1Dev1.id,
+ status: "PENDING",
+ workspace: workspace1,
+ });
+
issue = server.create("issue", {
type: "bytebase.database.create",
- name: `Create database '${databaseList1[1].name}' for environment - ${environmentList1[1].name}`,
+ name: title,
creatorId: ws1Dev1.id,
updaterId: ws1Dev1.id,
assigneeId: ws1Owner.id,
@@ -359,6 +370,7 @@ const workspacesSeeder = (server: any) => {
8: databaseList1[1].name,
},
project: projectList1[1],
+ pipeline,
workspace: workspace1,
});
@@ -369,7 +381,7 @@ const workspacesSeeder = (server: any) => {
type: "bytebase.task.database.create",
status: "PENDING",
databaseId: databaseList1[1].id,
- issue,
+ pipeline,
workspace: workspace1,
});
@@ -379,7 +391,7 @@ const workspacesSeeder = (server: any) => {
name: "Waiting approval",
type: "bytebase.step.approve",
status: "PENDING",
- issue,
+ pipeline,
task,
workspace: workspace1,
});
@@ -485,6 +497,15 @@ const workspacesSeeder = (server: any) => {
const data = randomUpdateSchemaIssueName();
const statusSet =
statusSetList[Math.floor(Math.random() * statusSetList.length)];
+
+ pipeline = server.create("pipeline", {
+ name: `Pipeline ${data.title}`,
+ creatorId: ws1Dev1.id,
+ updaterId: ws1Dev1.id,
+ status: "PENDING",
+ workspace: workspace1,
+ });
+
issue = server.create("issue", {
name: data.title,
type: "bytebase.database.schema.update",
@@ -495,13 +516,14 @@ const workspacesSeeder = (server: any) => {
subscriberIdList: [ws1DBA.id, ws1Dev2.id],
status: statusSet.issueStatus,
project: projectList1[i],
+ pipeline,
workspace: workspace1,
});
createUpdateSchemaTask(
server,
workspace1.id,
- issue.id,
+ pipeline.id,
ws1Dev1.id,
environmentList1,
databaseList1,
@@ -534,6 +556,15 @@ const workspacesSeeder = (server: any) => {
const data = randomUpdateSchemaIssueName();
const statusSet =
statusSetList[Math.floor(Math.random() * statusSetList.length)];
+
+ pipeline = server.create("pipeline", {
+ name: `Pipeline ${data.title}`,
+ creatorId: ws1Owner.id,
+ updaterId: ws1Owner.id,
+ status: "PENDING",
+ workspace: workspace1,
+ });
+
issue = server.create("issue", {
name: data.title,
type: "bytebase.database.schema.update",
@@ -544,13 +575,14 @@ const workspacesSeeder = (server: any) => {
subscriberIdList: [ws1Dev2.id],
status: statusSet.issueStatus,
project: projectList1[i],
+ pipeline,
workspace: workspace1,
});
createUpdateSchemaTask(
server,
workspace1.id,
- issue.id,
+ pipeline.id,
ws1Owner.id,
environmentList1,
databaseList1,
@@ -583,6 +615,15 @@ const workspacesSeeder = (server: any) => {
const data = randomUpdateSchemaIssueName();
const statusSet =
statusSetList[Math.floor(Math.random() * statusSetList.length)];
+
+ pipeline = server.create("pipeline", {
+ name: `Pipeline ${data.title}`,
+ creatorId: ws1Dev2.id,
+ updaterId: ws1Dev2.id,
+ status: "PENDING",
+ workspace: workspace1,
+ });
+
issue = server.create("issue", {
name: data.title,
type: "bytebase.database.schema.update",
@@ -593,13 +634,14 @@ const workspacesSeeder = (server: any) => {
subscriberIdList: [ws1Owner.id, ws1Dev1.id],
status: statusSet.issueStatus,
project: projectList1[i],
+ pipeline,
workspace: workspace1,
});
createUpdateSchemaTask(
server,
workspace1.id,
- issue.id,
+ pipeline.id,
ws1Dev2.id,
environmentList1,
databaseList1,
@@ -631,6 +673,15 @@ const workspacesSeeder = (server: any) => {
const data = randomUpdateSchemaIssueName();
const statusSet =
statusSetList[Math.floor(Math.random() * statusSetList.length)];
+
+ pipeline = server.create("pipeline", {
+ name: `Pipeline ${data.title}`,
+ creatorId: ws2Dev.id,
+ updaterId: ws2Dev.id,
+ status: "PENDING",
+ workspace: workspace2,
+ });
+
issue = server.create("issue", {
name: data.title,
type: "bytebase.database.schema.update",
@@ -640,13 +691,14 @@ const workspacesSeeder = (server: any) => {
sql: data.sql,
status: statusSet.issueStatus,
project: projectList2[0],
+ pipeline,
workspace: workspace2,
});
createUpdateSchemaTask(
server,
workspace2.id,
- issue.id,
+ pipeline.id,
ws2Dev.id,
environmentList2,
databaseList2,
@@ -766,7 +818,7 @@ const createInstanceList = (
const createUpdateSchemaTask = (
server: any,
workspaceId: string,
- issueId: IssueId,
+ pipelineId: PipelineId,
creatorId: PrincipalId,
environmentList: Environment[],
databaseList: Database[],
@@ -781,7 +833,7 @@ const createUpdateSchemaTask = (
type: "bytebase.task.schema.update",
status: taskStatusList[i],
databaseId: databaseList[i].id,
- issueId,
+ pipelineId,
workspaceId,
});
@@ -791,7 +843,7 @@ const createUpdateSchemaTask = (
name: "Waiting approval",
type: "bytebase.step.approve",
status: stepStatusList[i],
- issueId,
+ pipelineId,
task,
workspaceId,
});
@@ -802,7 +854,7 @@ const createUpdateSchemaTask = (
name: `Update ${databaseList[i].name} schema`,
type: "bytebase.step.schema.udpate",
status: stepStatusList[i],
- issueId,
+ pipelineId,
task,
workspaceId,
});
diff --git a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
index 6ce68bd895..47a5a3c068 100644
--- a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
@@ -12,7 +12,9 @@ const OUTPUT_DATABASE_FIELD_ID = OUTPUT_CUSTOM_FIELD_ID_BEGIN;
const template: IssueTemplate = {
type: "bytebase.database.create",
- buildIssue: (ctx: TemplateContext): IssueNew => {
+ buildIssue: (
+ ctx: TemplateContext
+ ): Omit<IssueNew, "projectId" | "creatorId"> => {
const payload: any = {};
payload[IssueBuiltinFieldId.DATABASE] = "";
@@ -20,22 +22,23 @@ const template: IssueTemplate = {
name: "Request new db",
type: "bytebase.database.create",
description: "",
- taskList: [
- {
- name: "Create database",
- type: "bytebase.task.database.create",
- databaseId:
- ctx.databaseList.length > 0 ? ctx.databaseList[0].id : UNKNOWN_ID,
- stepList: [
- {
- name: "Waiting for approval",
- type: "bytebase.step.approve",
- },
- ],
- },
- ],
- creatorId: ctx.currentUser.id,
- subscriberIdList: [],
+ pipeline: {
+ taskList: [
+ {
+ name: "Create database",
+ type: "bytebase.task.database.create",
+ databaseId: UNKNOWN_ID,
+ stepList: [
+ {
+ name: "Waiting for approval",
+ type: "bytebase.step.approve",
+ },
+ ],
+ },
+ ],
+ creatorId: ctx.currentUser.id,
+ name: "Create database pipeline",
+ },
payload,
};
},
diff --git a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
index 7339ca788f..424064bc42 100644
--- a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
@@ -13,29 +13,33 @@ const INPUT_READ_ONLY_FIELD_ID = INPUT_CUSTOM_FIELD_ID_BEGIN;
const template: IssueTemplate = {
type: "bytebase.database.grant",
- buildIssue: (ctx: TemplateContext): IssueNew => {
+ buildIssue: (
+ ctx: TemplateContext
+ ): Omit<IssueNew, "projectId" | "creatorId"> => {
const payload: any = {};
return {
name: "Request database access",
type: "bytebase.database.grant",
description: "",
- taskList: [
- {
- name: "Request database access",
- type: "bytebase.task.database.grant",
- databaseId:
- ctx.databaseList.length > 0 ? ctx.databaseList[0].id : UNKNOWN_ID,
- stepList: [
- {
- name: "Waiting for approval",
- type: "bytebase.step.approve",
- },
- ],
- },
- ],
- creatorId: ctx.currentUser.id,
- subscriberIdList: [],
+ pipeline: {
+ taskList: [
+ {
+ name: "Request database access",
+ type: "bytebase.task.database.grant",
+ databaseId:
+ ctx.databaseList.length > 0 ? ctx.databaseList[0].id : UNKNOWN_ID,
+ stepList: [
+ {
+ name: "Waiting for approval",
+ type: "bytebase.step.approve",
+ },
+ ],
+ },
+ ],
+ creatorId: ctx.currentUser.id,
+ name: "Request database access",
+ },
payload,
};
},
diff --git a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
index 2c7d6b3009..6f739641d0 100644
--- a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
@@ -11,33 +11,37 @@ import { Database, Task, TaskNew, IssueNew, UNKNOWN_ID } from "../../types";
const template: IssueTemplate = {
type: "bytebase.database.schema.update",
- buildIssue: (ctx: TemplateContext): IssueNew => {
+ buildIssue: (
+ ctx: TemplateContext
+ ): Omit<IssueNew, "projectId" | "creatorId"> => {
const payload: any = {};
return {
- name: "Change db",
+ name: "Update database schema",
type: "bytebase.database.schema.update",
description: "",
- taskList: ctx.databaseList.map(
- (database: Database): TaskNew => {
- return {
- name: `[${database.instance.environment.name}] ${database.name}`,
- type: "bytebase.task.schema.update",
- databaseId: database.id,
- stepList: [
- {
- name: "Waiting for approval",
- type: "bytebase.step.approve",
- },
- {
- name: `Update ${database.name} schema`,
- type: "bytebase.step.database.schema.update",
- },
- ],
- };
- }
- ),
- creatorId: ctx.currentUser.id,
- subscriberIdList: [],
+ pipeline: {
+ taskList: ctx.databaseList.map(
+ (database: Database): TaskNew => {
+ return {
+ name: `[${database.instance.environment.name}] ${database.name}`,
+ type: "bytebase.task.schema.update",
+ databaseId: database.id,
+ stepList: [
+ {
+ name: "Waiting for approval",
+ type: "bytebase.step.approve",
+ },
+ {
+ name: `Update ${database.name} schema`,
+ type: "bytebase.step.database.schema.update",
+ },
+ ],
+ };
+ }
+ ),
+ creatorId: ctx.currentUser.id,
+ name: "Update database schema pipeline",
+ },
payload,
};
},
diff --git a/frontend/src/plugins/issue/DefaultTemplate.ts b/frontend/src/plugins/issue/DefaultTemplate.ts
index 8473ed261c..c8d5e26353 100644
--- a/frontend/src/plugins/issue/DefaultTemplate.ts
+++ b/frontend/src/plugins/issue/DefaultTemplate.ts
@@ -3,14 +3,13 @@ import { IssueTemplate, TemplateContext } from "../types";
const template: IssueTemplate = {
type: "bytebase.general",
- buildIssue: (ctx: TemplateContext): IssueNew => {
+ buildIssue: (
+ ctx: TemplateContext
+ ): Omit<IssueNew, "projectId" | "creatorId"> => {
return {
name: "",
type: "bytebase.general",
description: "",
- taskList: [],
- creatorId: ctx.currentUser.id,
- subscriberIdList: [],
payload: {},
};
},
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index 50b868f2c0..cfd56ab3b7 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -113,6 +113,8 @@ export type TemplateContext = {
export type IssueTemplate = {
type: string;
- buildIssue: (ctx: TemplateContext) => IssueNew;
+ buildIssue: (
+ ctx: TemplateContext
+ ) => Omit<IssueNew, "projectId" | "creatorId">;
fieldList: IssueField[];
};
diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts
index 80d2be9535..0c2f6d0d6e 100644
--- a/frontend/src/store/index.ts
+++ b/frontend/src/store/index.ts
@@ -14,6 +14,7 @@ import principal from "./modules/principal";
import plan from "./modules/plan";
import auth from "./modules/auth";
import issue from "./modules/issue";
+import pipeline from "./modules/pipeline";
import task from "./modules/task";
import step from "./modules/step";
@@ -42,6 +43,7 @@ export const store: Store<any> = createStore({
plan,
auth,
issue,
+ pipeline,
task,
step,
uistate,
diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.ts
index f1968b89d8..45d97af56a 100644
--- a/frontend/src/store/modules/issue.ts
+++ b/frontend/src/store/modules/issue.ts
@@ -12,8 +12,9 @@ import {
Project,
ResourceIdentifier,
ProjectId,
- Task,
IssueStatusPatch,
+ Pipeline,
+ empty,
} from "../../types";
function convert(
@@ -46,36 +47,37 @@ function convert(
let project: Project = unknown("PROJECT") as Project;
project.id = projectId;
- const taskList: Task[] = [];
+ let pipeline: Pipeline;
+ if (issue.relationships!.pipeline.data) {
+ const pipelineId = (issue.relationships!.pipeline
+ .data as ResourceIdentifier).id;
+ pipeline = unknown("PIPELINE") as Pipeline;
+ pipeline.id = pipelineId;
+ } else {
+ pipeline = empty("PIPELINE") as Pipeline;
+ }
+
for (const item of includedList || []) {
if (
- item.type == "task" &&
- (item.relationships!.issue.data as ResourceIdentifier).id == issue.id
+ item.type == "project" &&
+ (issue.relationships!.project.data as ResourceIdentifier).id == item.id
) {
- const task: Task = rootGetters["task/convertPartial"](item, includedList);
- taskList.push(task);
+ project = rootGetters["project/convert"](item);
}
if (
- item.type == "project" &&
- (item.relationships!.issue.data as ResourceIdentifier[]).find(
- (item) => item.id == issue.id
- )
+ item.type == "pipeline" &&
+ issue.relationships!.pipeline.data &&
+ (issue.relationships!.pipeline.data as ResourceIdentifier).id == item.id
) {
- project = rootGetters["project/convert"](item);
+ pipeline = rootGetters["pipeline/convert"](item, includedList);
}
}
- const result: Issue = {
+ return {
...(issue.attributes as Omit<
Issue,
- | "id"
- | "project"
- | "creator"
- | "updater"
- | "assignee"
- | "subscriberList"
- | "taskList"
+ "id" | "project" | "creator" | "updater" | "assignee" | "subscriberList"
>),
id: issue.id,
project,
@@ -83,19 +85,8 @@ function convert(
updater,
assignee,
subscriberList,
- taskList,
+ pipeline,
};
-
- // Now we have a complate issue, we assign it back to task and step
- for (const task of result.taskList) {
- task.issue = result;
- for (const step of task.stepList) {
- step.issue = result;
- step.task = task;
- }
- }
-
- return result;
}
const state: () => IssueState = () => ({
@@ -116,7 +107,9 @@ const getters = {
const actions = {
async fetchIssueListForUser({ commit, rootGetters }: any, userId: UserId) {
const data = (
- await axios.get(`/api/issue?user=${userId}&include=project,task,step`)
+ await axios.get(
+ `/api/issue?user=${userId}&include=project,pipeline,pipeline.task,pipeline.step`
+ )
).data;
const issueList = data.data.map((issue: ResourceObject) => {
return convert(issue, data.included, rootGetters);
@@ -130,7 +123,7 @@ const actions = {
async fetchIssueListForProject({ rootGetters }: any, projectId: ProjectId) {
const data = (
await axios.get(
- `/api/issue?project=${projectId}&include=project,task,step`
+ `/api/issue?project=${projectId}&include=project,pipeline,pipeline.task,pipeline.step`
)
).data;
const issueList = data.data.map((issue: ResourceObject) => {
@@ -143,7 +136,9 @@ const actions = {
async fetchIssueById({ commit, rootGetters }: any, issueId: IssueId) {
const data = (
- await axios.get(`/api/issue/${issueId}?include=project,task,step`)
+ await axios.get(
+ `/api/issue/${issueId}?include=project,pipeline,pipeline.task,pipeline.step`
+ )
).data;
const issue = convert(data.data, data.included, rootGetters);
commit("setIssueById", {
@@ -155,12 +150,15 @@ const actions = {
async createIssue({ commit, rootGetters }: any, newIssue: IssueNew) {
const data = (
- await axios.post(`/api/issue?include=project,task,step`, {
- data: {
- type: "issuenew",
- attributes: newIssue,
- },
- })
+ await axios.post(
+ `/api/issue?include=project,pipeline,pipeline.task,pipeline.step`,
+ {
+ data: {
+ type: "issuenew",
+ attributes: newIssue,
+ },
+ }
+ )
).data;
const createdIssue = convert(data.data, data.included, rootGetters);
@@ -183,12 +181,15 @@ const actions = {
}
) {
const data = (
- await axios.patch(`/api/issue/${issueId}?include=project,task,step`, {
- data: {
- type: "issuepatch",
- attributes: issuePatch,
- },
- })
+ await axios.patch(
+ `/api/issue/${issueId}?include=project,pipeline,pipeline.task,pipeline.step`,
+ {
+ data: {
+ type: "issuepatch",
+ attributes: issuePatch,
+ },
+ }
+ )
).data;
const updatedIssue = convert(data.data, data.included, rootGetters);
@@ -214,7 +215,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/issue/${issueId}/status?include=project,task,step`,
+ `/api/issue/${issueId}/status?include=project,pipeline,pipeline.task,pipeline.step`,
{
data: {
type: "issuestatuspatch",
diff --git a/frontend/src/store/modules/pipeline.ts b/frontend/src/store/modules/pipeline.ts
new file mode 100644
index 0000000000..5889156350
--- /dev/null
+++ b/frontend/src/store/modules/pipeline.ts
@@ -0,0 +1,106 @@
+import axios from "axios";
+import {
+ ResourceIdentifier,
+ ResourceObject,
+ Pipeline,
+ PipelineId,
+ PipelineState,
+ PipelineStatusPatch,
+ Step,
+ Issue,
+ IssueId,
+ unknown,
+ Task,
+} from "../../types";
+
+const state: () => PipelineState = () => ({});
+
+function convert(
+ pipeline: ResourceObject,
+ includedList: ResourceObject[],
+ rootGetters: any
+): Pipeline {
+ const creator = rootGetters["principal/principalById"](
+ pipeline.attributes.creatorId
+ );
+ const updater = rootGetters["principal/principalById"](
+ pipeline.attributes.updaterId
+ );
+
+ const taskList: Task[] = [];
+ for (const item of includedList || []) {
+ if (
+ item.type == "task" &&
+ (item.relationships!.pipeline.data as ResourceIdentifier).id ==
+ pipeline.id
+ ) {
+ const task: Task = rootGetters["task/convertPartial"](item, includedList);
+ taskList.push(task);
+ }
+ }
+
+ const result: Pipeline = {
+ ...(pipeline.attributes as Omit<
+ Pipeline,
+ "id" | "creator" | "updater" | "taskList"
+ >),
+ id: pipeline.id,
+ creator,
+ updater,
+ taskList,
+ };
+
+ // 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;
+ }
+ }
+
+ return result;
+}
+
+const getters = {
+ convert: (
+ state: PipelineState,
+ getters: any,
+ rootState: any,
+ rootGetters: any
+ ) => (pipeline: ResourceObject, includedList: ResourceObject[]): Pipeline => {
+ return convert(pipeline, includedList, rootGetters);
+ },
+
+ async updatePipelineStatus(
+ { dispatch }: any,
+ {
+ pipelineId,
+ pipelineStatusPatch,
+ }: {
+ pipelineId: PipelineId;
+ pipelineStatusPatch: PipelineStatusPatch;
+ }
+ ) {
+ const data = (
+ await axios.patch(`/api/pipeline/${pipelineId}/status`, {
+ data: {
+ type: "pipelinestatuspatch",
+ attributes: pipelineStatusPatch,
+ },
+ })
+ ).data;
+ },
+};
+
+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.ts
index 118be872a6..fd81be8090 100644
--- a/frontend/src/store/modules/step.ts
+++ b/frontend/src/store/modules/step.ts
@@ -8,6 +8,8 @@ import {
unknown,
IssueId,
TaskId,
+ PipelineId,
+ Pipeline,
} from "../../types";
const state: () => StepState = () => ({});
@@ -15,7 +17,7 @@ const state: () => StepState = () => ({});
function convertPartial(
step: ResourceObject,
rootGetters: any
-): Omit<Step, "issue" | "task"> {
+): Omit<Step, "pipeline" | "task"> {
const creator = rootGetters["principal/principalById"](
step.attributes.creatorId
);
@@ -26,7 +28,7 @@ function convertPartial(
return {
...(step.attributes as Omit<
Step,
- "id" | "creator" | "updater" | "issue" | "task"
+ "id" | "creator" | "updater" | "pipeline" | "task"
>),
id: step.id,
creator,
@@ -34,16 +36,6 @@ function convertPartial(
};
}
-function convert(step: ResourceObject, rootGetters: any): Step {
- const issue: Issue = rootGetters["issue/issueById"](step.attributes.issueId);
- const task: Task = rootGetters["task/taskById"](step.attributes.taskId);
- return {
- ...convertPartial(step, rootGetters),
- issue,
- task,
- };
-}
-
const getters = {
convertPartial: (
state: StepState,
@@ -51,10 +43,10 @@ const getters = {
rootState: any,
rootGetters: any
) => (step: ResourceObject): Step => {
- // It's only called when issue/task tries to convert themselves, so we don't have a issue/task yet.
- const issueId = step.attributes.issueId as IssueId;
- let issue: Issue = unknown("ISSUE") as Issue;
- issue.id = issueId;
+ // 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;
@@ -62,7 +54,7 @@ const getters = {
return {
...convertPartial(step, rootGetters),
- issue,
+ pipeline,
task,
};
},
diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.ts
index ff23c9332b..a63e34ba09 100644
--- a/frontend/src/store/modules/task.ts
+++ b/frontend/src/store/modules/task.ts
@@ -1,5 +1,4 @@
import axios from "axios";
-import { root } from "postcss";
import {
ResourceIdentifier,
ResourceObject,
@@ -11,6 +10,8 @@ import {
Issue,
IssueId,
unknown,
+ PipelineId,
+ Pipeline,
} from "../../types";
const state: () => TaskState = () => ({});
@@ -19,7 +20,7 @@ function convertPartial(
task: ResourceObject,
includedList: ResourceObject[],
rootGetters: any
-): Omit<Task, "issue"> {
+): Omit<Task, "pipeline"> {
const creator = rootGetters["principal/principalById"](
task.attributes.creatorId
);
@@ -42,10 +43,10 @@ function convertPartial(
}
}
- const result: Omit<Task, "issue"> = {
+ const result: Omit<Task, "pipeline"> = {
...(task.attributes as Omit<
Task,
- "id" | "creator" | "updater" | "issue" | "database" | "stepList"
+ "id" | "creator" | "updater" | "database" | "stepList"
>),
id: task.id,
creator,
@@ -64,19 +65,19 @@ const getters = {
rootState: any,
rootGetters: any
) => (task: ResourceObject, includedList: ResourceObject[]): Task => {
- // It's only called when issue tries to convert itself, so we don't have a issue yet.
- const issueId = task.attributes.issueId as IssueId;
- let issue: Issue = unknown("ISSUE") as Issue;
- issue.id = issueId;
+ // It's only called when pipeline 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),
- issue,
+ pipeline,
};
for (const step of result.stepList) {
step.task = result;
- step.issue = issue;
+ step.pipeline = pipeline;
}
return result;
diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.ts
index 2be34642e0..943b54a7bd 100644
--- a/frontend/src/types/bytebase.ts
+++ b/frontend/src/types/bytebase.ts
@@ -164,35 +164,36 @@ export const unknown = (
type: "RO",
};
- const UNKNOWN_ISSUE: Issue = {
+ const UNKNOWN_PIPELINE: Pipeline = {
id: UNKNOWN_ID,
creator: UNKNOWN_PRINCIPAL,
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
updatedTs: 0,
- project: UNKNOWN_PROJECT,
- name: "<<Unknown issue>>",
- status: "OPEN",
- type: "bytebase.general",
- description: "",
+ name: "<<Unknown pipeline>>",
+ status: "PENDING",
taskList: [],
- subscriberList: [],
- payload: {},
};
- const UNKNOWN_PIPELINE: Pipeline = {
+ const UNKNOWN_ISSUE: Issue = {
id: UNKNOWN_ID,
+ project: UNKNOWN_PROJECT,
+ pipeline: UNKNOWN_PIPELINE,
creator: UNKNOWN_PRINCIPAL,
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
updatedTs: 0,
- name: "<<Unknown pipeline>>",
- status: "PENDING",
- taskList: [],
+ name: "<<Unknown issue>>",
+ status: "OPEN",
+ type: "bytebase.general",
+ description: "",
+ subscriberList: [],
+ payload: {},
};
const UNKNOWN_TASK: Task = {
id: UNKNOWN_ID,
+ pipeline: UNKNOWN_PIPELINE,
creator: UNKNOWN_PRINCIPAL,
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
@@ -200,14 +201,13 @@ export const unknown = (
name: "<<Unknown task>>",
type: "bytebase.task.unknown",
status: "PENDING",
- issue: UNKNOWN_ISSUE,
database: UNKNOWN_DATABASE,
stepList: [],
};
const UNKNOWN_STEP: Step = {
id: UNKNOWN_ID,
- issue: UNKNOWN_ISSUE,
+ pipeline: UNKNOWN_PIPELINE,
task: UNKNOWN_TASK,
creator: UNKNOWN_PRINCIPAL,
createdTs: 0,
@@ -420,35 +420,36 @@ export const empty = (
type: "RO",
};
- const EMPTY_ISSUE: Issue = {
+ const EMPTY_PIPELINE: Pipeline = {
id: EMPTY_ID,
creator: EMPTY_PRINCIPAL,
createdTs: 0,
updater: EMPTY_PRINCIPAL,
updatedTs: 0,
- project: EMPTY_PROJECT,
- name: "<<Empty issue>>",
- status: "OPEN",
- type: "bytebase.general",
- description: "",
+ name: "<<Empty pipeline>>",
+ status: "PENDING",
taskList: [],
- subscriberList: [],
- payload: {},
};
- const EMPTY_PIPELINE: Pipeline = {
+ const EMPTY_ISSUE: Issue = {
id: EMPTY_ID,
+ pipeline: EMPTY_PIPELINE,
+ project: EMPTY_PROJECT,
creator: EMPTY_PRINCIPAL,
createdTs: 0,
updater: EMPTY_PRINCIPAL,
updatedTs: 0,
- name: "<<Empty pipeline>>",
- status: "PENDING",
- taskList: [],
+ name: "<<Empty issue>>",
+ status: "OPEN",
+ type: "bytebase.general",
+ description: "",
+ subscriberList: [],
+ payload: {},
};
const EMPTY_TASK: Task = {
id: EMPTY_ID,
+ pipeline: EMPTY_PIPELINE,
creator: EMPTY_PRINCIPAL,
createdTs: 0,
updater: EMPTY_PRINCIPAL,
@@ -456,14 +457,13 @@ export const empty = (
name: "<<Empty task>>",
type: "bytebase.task.unknown",
status: "PENDING",
- issue: EMPTY_ISSUE,
database: EMPTY_DATABASE,
stepList: [],
};
const EMPTY_STEP: Step = {
id: EMPTY_ID,
- issue: EMPTY_ISSUE,
+ pipeline: EMPTY_PIPELINE,
task: EMPTY_TASK,
creator: EMPTY_PRINCIPAL,
createdTs: 0,
@@ -548,6 +548,9 @@ export const empty = (
export const FINAL_TASK: Task = {
id: EMPTY_ID,
+ pipeline: empty("PIPELINE") as Pipeline,
+ database: empty("DATABASE") as Database,
+ stepList: [],
creator: empty("PRINCIPAL") as Principal,
createdTs: 0,
updater: empty("PRINCIPAL") as Principal,
@@ -555,14 +558,11 @@ export const FINAL_TASK: Task = {
name: "Final task",
type: "bytebase.task.final",
status: "PENDING",
- issue: empty("ISSUE") as Issue,
- database: empty("DATABASE") as Database,
- stepList: [],
};
export const FINAL_STEP: Step = {
id: EMPTY_ID,
- issue: empty("ISSUE") as Issue,
+ pipeline: empty("PIPELINE") as Pipeline,
task: FINAL_TASK,
creator: empty("PRINCIPAL") as Principal,
createdTs: 0,
@@ -858,7 +858,7 @@ export type Issue = {
// Related fields
project: Project;
- taskList: Task[];
+ pipeline: Pipeline;
// Standard fields
creator: Principal;
@@ -880,7 +880,8 @@ export type Issue = {
export type IssueNew = {
// Related fields
- taskList: TaskNew[];
+ projectId: ProjectId;
+ pipeline?: PipelineNew;
// Standard fields
creatorId: PrincipalId;
@@ -890,7 +891,6 @@ export type IssueNew = {
type: IssueType;
description: string;
assigneeId?: PrincipalId;
- subscriberIdList: PrincipalId[];
sql?: string;
rollbackSql?: string;
payload: IssuePayload;
@@ -1098,7 +1098,7 @@ export type Task = {
// Related fields
stepList: Step[];
- issue: Issue;
+ pipeline: Pipeline;
database: Database;
// Standard fields
@@ -1202,7 +1202,7 @@ export type Step = {
id: StepId;
// Related fields
- issue: Issue;
+ pipeline: Pipeline;
task: Task;
// Standard fields
@@ -1781,6 +1781,8 @@ export interface IssueState {
issueById: Map<IssueId, Issue>;
}
+export interface PipelineState {}
+
export interface TaskState {}
export interface StepState {}
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index af80190ca7..672c337119 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -6,4 +6,5 @@ export * from "./link";
export * from "./role";
export * from "./slug";
export * from "./issue";
+export * from "./pipeline";
export * from "./util";
diff --git a/frontend/src/utils/issue.ts b/frontend/src/utils/issue.ts
index af3f5abe4f..174262d2ed 100644
--- a/frontend/src/utils/issue.ts
+++ b/frontend/src/utils/issue.ts
@@ -1,16 +1,8 @@
-import {
- Issue,
- TaskId,
- Task,
- EnvironmentId,
- DatabaseId,
- Step,
- FINAL_TASK,
- EMPTY_ID,
-} from "../types";
+import { Issue, TaskId } from "../types";
+import { activeTask } from "./pipeline";
export function taskName(issue: Issue, taskId: TaskId): string {
- for (const task of issue.taskList) {
+ for (const task of issue.pipeline.taskList) {
if (task.id == taskId) {
return task.name;
}
@@ -20,40 +12,5 @@ export function taskName(issue: Issue, taskId: TaskId): string {
// Returns true if the active step is the last step in the entire issue
export function pendingResolve(issue: Issue): boolean {
- return activeTask(issue).type == "bytebase.task.final";
-}
-
-export function activeTask(issue: Issue): Task {
- for (const task of issue.taskList) {
- if (
- task.status === "PENDING" ||
- task.status === "RUNNING" ||
- // "FAILED" is also a transient task status, which requires user
- // to take further action (e.g. Cancel, Skip, Retry)
- task.status === "FAILED"
- ) {
- return task;
- }
- }
- return FINAL_TASK;
-}
-
-export function activeTaskIsRunning(issue: Issue): boolean {
- return activeTask(issue).status === "RUNNING";
-}
-
-export function activeEnvironmentId(issue: Issue): EnvironmentId {
- const task: Task = activeTask(issue);
- if (task.id == EMPTY_ID) {
- return EMPTY_ID;
- }
- return task.database.instance.environment.id;
-}
-
-export function activeDatabaseId(issue: Issue): DatabaseId {
- const task = activeTask(issue);
- if (task.id == EMPTY_ID) {
- return EMPTY_ID;
- }
- return task.database.id;
+ return activeTask(issue.pipeline).type == "bytebase.task.final";
}
diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.ts
new file mode 100644
index 0000000000..7db127acee
--- /dev/null
+++ b/frontend/src/utils/pipeline.ts
@@ -0,0 +1,43 @@
+import {
+ DatabaseId,
+ EMPTY_ID,
+ EnvironmentId,
+ FINAL_TASK,
+ Pipeline,
+ Task,
+} from "../types";
+
+export function activeTask(pipeline: Pipeline): Task {
+ for (const task of pipeline.taskList) {
+ if (
+ task.status === "PENDING" ||
+ task.status === "RUNNING" ||
+ // "FAILED" is also a transient task status, which requires user
+ // to take further action (e.g. Cancel, Skip, Retry)
+ task.status === "FAILED"
+ ) {
+ return task;
+ }
+ }
+ return FINAL_TASK;
+}
+
+export function activeTaskIsRunning(pipeline: Pipeline): boolean {
+ return activeTask(pipeline).status === "RUNNING";
+}
+
+export function activeEnvironmentId(pipeline: Pipeline): EnvironmentId {
+ const task: Task = activeTask(pipeline);
+ if (task.id == EMPTY_ID) {
+ return EMPTY_ID;
+ }
+ return task.database.instance.environment.id;
+}
+
+export function activeDatabaseId(pipeline: Pipeline): DatabaseId {
+ const task = activeTask(pipeline);
+ if (task.id == EMPTY_ID) {
+ return EMPTY_ID;
+ }
+ return task.database.id;
+}
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index 5606f6bbd6..a195b8708a 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -156,7 +156,8 @@ export default {
return list.filter((issue) => {
return (
(!state.selectedEnvironment ||
- activeEnvironmentId(issue) === state.selectedEnvironment.id) &&
+ activeEnvironmentId(issue.pipeline) ===
+ state.selectedEnvironment.id) &&
(!state.searchText ||
issue.name.toLowerCase().includes(state.searchText.toLowerCase()))
);
@@ -178,8 +179,8 @@ export default {
return 4;
}
};
- const aStatusOrder = statusOrder(activeTask(a).status);
- const bStatusOrder = statusOrder(activeTask(b).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/IssueDetail.vue b/frontend/src/views/IssueDetail.vue
index 0813228da7..02611ad1c2 100644
--- a/frontend/src/views/IssueDetail.vue
+++ b/frontend/src/views/IssueDetail.vue
@@ -208,6 +208,8 @@ import {
IssueStatusPatch,
TaskStatus,
TaskId,
+ UNKNOWN_ID,
+ ProjectId,
} from "../types";
import {
defaulTemplate,
@@ -339,18 +341,22 @@ export default {
databaseList.push(store.getters["database/databaseById"](databaseId));
}
- const newIssue: IssueNew = newIssueTemplate.value.buildIssue({
- databaseList,
- currentUser: currentUser.value,
- });
+ const newIssue: IssueNew = {
+ ...newIssueTemplate.value.buildIssue({
+ databaseList,
+ currentUser: currentUser.value,
+ }),
+ projectId: router.currentRoute.value.query.project
+ ? (router.currentRoute.value.query.project as ProjectId)
+ : UNKNOWN_ID,
+ creatorId: currentUser.value.id,
+ };
// For demo mode, we assign the issue to the current user, so it can also experience the assignee user flow.
if (isDemo()) {
newIssue.assigneeId = currentUser.value.id;
}
- newIssue.creatorId = currentUser.value.id;
-
if (router.currentRoute.value.query.name) {
newIssue.name = router.currentRoute.value.query.name as string;
}
@@ -641,12 +647,12 @@ export default {
const workflowType = computed(
(): WorkflowType => {
- if (state.issue.taskList.length > 1) {
+ if ((state.issue as Issue).pipeline.taskList.length > 1) {
return "MULTI_TASK";
}
if (
- state.issue.taskList.length == 1 &&
- state.issue.taskList[0].stepList.length > 1
+ (state.issue as Issue).pipeline.taskList.length == 1 &&
+ (state.issue as Issue).pipeline.taskList[0].stepList.length > 1
) {
return "SINGLE_TASK";
}
diff --git a/frontend/src/views/IssueHighlightPanel.vue b/frontend/src/views/IssueHighlightPanel.vue
index 88945f1b39..08e4e9186d 100644
--- a/frontend/src/views/IssueHighlightPanel.vue
+++ b/frontend/src/views/IssueHighlightPanel.vue
@@ -7,7 +7,7 @@
<IssueStatusIcon
v-if="!$props.new"
:issueStatus="issue.status"
- :taskStatus="activeTask(issue).status"
+ :taskStatus="activeTask(issue.pipeline).status"
/>
</div>
<BBTextField
diff --git a/frontend/src/views/IssueSidebar.vue b/frontend/src/views/IssueSidebar.vue
index ecd0d4b8fc..408fe071b2 100644
--- a/frontend/src/views/IssueSidebar.vue
+++ b/frontend/src/views/IssueSidebar.vue
@@ -301,8 +301,8 @@ export default {
const database = computed(
(): Database => {
const databaseId = props.new
- ? (props.issue as IssueNew).taskList[0].databaseId
- : activeDatabaseId(props.issue as Issue);
+ ? (props.issue as IssueNew).pipeline?.taskList[0].databaseId
+ : activeDatabaseId((props.issue as Issue).pipeline);
return store.getters["database/databaseById"](databaseId);
}
);
diff --git a/frontend/src/views/IssueTaskFlow.vue b/frontend/src/views/IssueTaskFlow.vue
index 28fb282159..e7dd102d79 100644
--- a/frontend/src/views/IssueTaskFlow.vue
+++ b/frontend/src/views/IssueTaskFlow.vue
@@ -18,7 +18,7 @@
>
<template v-if="task.status === 'PENDING'">
<span
- v-if="activeTask(issue).id === task.id"
+ v-if="activeTask(issue.pipeline).id === task.id"
class="h-1.5 w-1.5 bg-blue-600 rounded-full"
aria-hidden="true"
></span>
@@ -82,7 +82,7 @@
</span>
<div
v-if="
- activeTask(issue).id === task.id &&
+ activeTask(issue.pipeline).id === task.id &&
applicableTaskTransitionList.length > 0
"
class="flex flex-row space-x-1 mr-4"
@@ -325,7 +325,7 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
const taskList = computed<FlowItem[]>(() => {
- return props.issue.taskList.map((task) => {
+ return props.issue.pipeline.taskList.map((task) => {
return {
id: task.id,
title: task.name,
@@ -340,7 +340,7 @@ export default {
const taskIconClass = (task: FlowItem) => {
switch (task.status) {
case "PENDING":
- if (activeTask(props.issue).id === task.id) {
+ if (activeTask(props.issue.pipeline).id === task.id) {
return "bg-white border-2 border-blue-600 text-blue-600 ";
}
return "bg-white border-2 border-gray-300";
@@ -357,7 +357,7 @@ export default {
const taskTextClass = (task: FlowItem) => {
let textClass =
- activeTask(props.issue).id === task.id
+ activeTask(props.issue.pipeline).id === task.id
? "font-medium "
: "font-normal ";
switch (task.status) {
@@ -366,7 +366,7 @@ export default {
case "DONE":
return textClass + "text-control";
case "PENDING":
- if (activeTask(props.issue).id === task.id) {
+ if (activeTask(props.issue.pipeline).id === task.id) {
return textClass + "text-blue-600";
}
return textClass + "text-control";
@@ -378,7 +378,7 @@ export default {
};
const applicableTaskTransitionList = computed(() => {
- const task = activeTask(props.issue as Issue);
+ const task = activeTask((props.issue as Issue).pipeline);
const list: TaskStatusTransitionType[] = [];
if (currentUser.value.id === (props.issue as Issue).assignee?.id) {
list.push(...ASSIGNEE_APPLICABLE_TASK_ACTION_LIST.get(task.status)!);
@@ -409,7 +409,7 @@ export default {
modalState.title =
transition.actionName +
' "' +
- activeTask(props.issue as Issue).name +
+ activeTask((props.issue as Issue).pipeline).name +
'" ?';
modalState.transition = transition;
modalState.show = true;