Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Rename task to issue
天舟746d6d8e4fe5
diff --git a/frontend/src/components/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm.vueindex 7f1f7306a5..f6361f698f 100644--- a/frontend/src/components/AlterSchemaPrepForm.vue+++ b/frontend/src/components/AlterSchemaPrepForm.vue@@ -177,9 +177,9 @@ export default {);router.push({- name: "workspace.task.detail",+ name: "workspace.issue.detail",params: {- taskSlug: "new",+ issueSlug: "new",},query: {template: "bytebase.database.schema.update",diff --git a/frontend/src/components/DataSourceMemberForm.vue b/frontend/src/components/DataSourceMemberForm.vueindex 21702fc81d..e40eb7cc13 100644--- a/frontend/src/components/DataSourceMemberForm.vue+++ b/frontend/src/components/DataSourceMemberForm.vue@@ -116,27 +116,27 @@ input[type="number"] {</div><div class="col-span-2 col-start-2 w-64">- <label for="task" class="textlabel"> Task </label>+ <label for="issue" class="textlabel"> Issue </label><div class="mt-1 relative rounded-md shadow-sm"><divclass="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">- <span class="text-accent font-semibold sm:text-sm">task/</span>+ <span class="text-accent font-semibold sm:text-sm">issue/</span></div><div class="flex flex-row space-x-2 items-center"><inputclass="textfield w-full pl-12"- id="task"- name="task"+ id="issue"+ name="issue"type="number"- placeholder="Your task id (e.g. 1234)"- :disabled="!allowUpdateTaskId"- :value="state.taskId"- @input="updateState('taskId', $event.target.value)"+ placeholder="Your issue id (e.g. 1234)"+ :disabled="!allowUpdateIssueId"+ :value="state.issueId"+ @input="updateState('issueId', $event.target.value)"/>- <template v-if="taskLink">+ <template v-if="issueLink"><router-link- :to="taskLink"+ :to="issueLink"target="_blank"class="ml-2 normal-link text-sm">@@ -186,11 +186,11 @@ import {EnvironmentId,InstanceId,PrincipalId,- Task,- TaskId,+ Issue,+ IssueId,UNKNOWN_ID,} from "../types";-import { taskSlug } from "../utils";+import { issueSlug } from "../utils";interface LocalState {environmentId?: EnvironmentId;@@ -199,7 +199,7 @@ interface LocalState {dataSourceId?: DataSourceId;granteeId?: PrincipalId;granteeError: string;- taskId?: TaskId;+ issueId?: IssueId;}export default {@@ -212,7 +212,7 @@ export default {principalId: {type: String,},- taskId: {+ issueId: {type: String,},},@@ -235,7 +235,7 @@ export default {dataSourceId: props.dataSource ? props.dataSource.id : undefined,granteeId: props.principalId,granteeError: "",- taskId: props.taskId,+ issueId: props.issueId,});const database = computed(() => {@@ -274,19 +274,19 @@ export default {return !props.principalId && state.dataSourceId;});- const allowUpdateTaskId = computed(() => {- return !props.taskId;+ const allowUpdateIssueId = computed(() => {+ return !props.issueId;});const allowCreate = computed(() => {return state.dataSourceId && state.granteeId && !state.granteeError;});- const taskLink = computed((): string => {- if (state.taskId) {- // We intentionally not to validate whether the taskId is legit, we will do the validation+ const issueLink = computed((): string => {+ if (state.issueId) {+ // We intentionally not to validate whether the issueId is legit, we will do the validation// when actually trying to create the database.- return `/task/${state.taskId}`;+ return `/issue/${state.issueId}`;}return "";});@@ -316,8 +316,8 @@ export default {} else if (field == "granteeId") {state.granteeId = value;validateGrantee();- } else if (field == "taskId") {- state.taskId = value;+ } else if (field == "issueId") {+ state.issueId = value;}};@@ -326,20 +326,23 @@ export default {};const doGrant = async () => {- // If taskId id provided, we check its existence first.- // We only set the taskId if it's valid.- let linkedTask: Task | undefined = undefined;- if (state.taskId) {+ // If issueId id provided, we check its existence first.+ // We only set the issueId if it's valid.+ let linkedIssue: Issue | undefined = undefined;+ if (state.issueId) {try {- linkedTask = await store.dispatch("task/fetchTaskById", state.taskId);+ linkedIssue = await store.dispatch(+ "issue/fetchIssueById",+ state.issueId+ );} catch (err) {- console.warn(`Unable to fetch linked task id ${state.taskId}`, err);+ console.warn(`Unable to fetch linked issue id ${state.issueId}`, err);}}const newDataSouceMember: DataSourceMemberNew = {principalId: state.granteeId!,- taskId: linkedTask?.id,+ issueId: linkedIssue?.id,};store.dispatch("dataSource/createDataSourceMember", {@@ -361,13 +364,13 @@ export default {title: `Successfully granted '${dataSource.name}' to '${addedMember!.principal.name}'.`,- description: linkedTask- ? `We also linked the granted database to the requested task '${linkedTask.name}'.`+ description: linkedIssue+ ? `We also linked the granted database to the requested issue '${linkedIssue.name}'.`: "",- link: linkedTask- ? `/task/${taskSlug(linkedTask.name, linkedTask.id)}`+ link: linkedIssue+ ? `/issue/${issueSlug(linkedIssue.name, linkedIssue.id)}`: undefined,- manualHide: linkedTask != undefined,+ manualHide: linkedIssue != undefined,});}).catch((error) => {@@ -382,9 +385,9 @@ export default {database,allowConfigure,allowUpdateDataSourceMember,- allowUpdateTaskId,+ allowUpdateIssueId,allowCreate,- taskLink,+ issueLink,updateState,cancel,doGrant,diff --git a/frontend/src/components/DataSourceMemberTable.vue b/frontend/src/components/DataSourceMemberTable.vueindex a02c34376b..24db600963 100644--- a/frontend/src/components/DataSourceMemberTable.vue+++ b/frontend/src/components/DataSourceMemberTable.vue@@ -64,10 +64,10 @@</BBTableCell><BBTableCell><router-link- v-if="member.taskId"- :to="`/task/${member.taskId}`"+ v-if="member.issueId"+ :to="`/issue/${member.issueId}`"class="normal-link"- >task/{{ member.taskId }}+ >issue/{{ member.issueId }}</router-link></BBTableCell><BBTableCell>@@ -109,7 +109,7 @@ const columnList = [title: "User",},{- title: "Requested task",+ title: "Requested issue",},{title: "Added time",diff --git a/frontend/src/components/TaskStatusIcon.vue b/frontend/src/components/IssueStatusIcon.vuesimilarity index 86%rename from frontend/src/components/TaskStatusIcon.vuerename to frontend/src/components/IssueStatusIcon.vueindex a25aedebf0..5f53374f95 100644--- a/frontend/src/components/TaskStatusIcon.vue+++ b/frontend/src/components/IssueStatusIcon.vue@@ -1,9 +1,9 @@<template><spanclass="flex items-center justify-center rounded-full select-none"- :class="taskIconClass()"+ :class="issueIconClass()">- <template v-if="taskStatus === `OPEN`">+ <template v-if="issueStatus === `OPEN`"><spanv-if="stageStatus === 'RUNNING'"class="h-2 w-2 bg-blue-600 hover:bg-blue-700 rounded-full"@@ -22,7 +22,7 @@aria-hidden="true"></span></template>- <template v-else-if="taskStatus === `DONE`">+ <template v-else-if="issueStatus === `DONE`"><svgclass="w-4 h-4"xmlns="http://www.w3.org/2000/svg"@@ -37,7 +37,7 @@/></svg></template>- <template v-else-if="taskStatus === `CANCELED`">+ <template v-else-if="issueStatus === `CANCELED`"><svgclass="w-5 h-5"fill="currentColor"@@ -59,16 +59,16 @@<script lang="ts">import { PropType } from "vue";import { activeStage } from "../utils";-import { StageStatus, TaskStatus } from "../types";+import { StageStatus, IssueStatus } from "../types";type SizeType = "small" | "normal";export default {- name: "TaskStatusIcon",+ name: "IssueStatusIcon",props: {- taskStatus: {+ issueStatus: {required: true,- type: String as PropType<TaskStatus>,+ type: String as PropType<IssueStatus>,},stageStatus: {type: String as PropType<StageStatus>,@@ -80,9 +80,9 @@ export default {},components: {},setup(props, ctx) {- const taskIconClass = () => {+ const issueIconClass = () => {let iconClass = props.size === "normal" ? "w-5 h-5" : "w-4 h-4";- switch (props.taskStatus) {+ switch (props.issueStatus) {case "OPEN":if (props.stageStatus && props.stageStatus === "FAILED") {return (@@ -105,7 +105,7 @@ export default {};return {- taskIconClass,+ issueIconClass,activeStage,};},diff --git a/frontend/src/components/TaskStatusSelect.vue b/frontend/src/components/IssueStatusSelect.vuesimilarity index 70%rename from frontend/src/components/TaskStatusSelect.vuerename to frontend/src/components/IssueStatusSelect.vueindex 14971fc65c..d1c8694d0a 100644--- a/frontend/src/components/TaskStatusSelect.vue+++ b/frontend/src/components/IssueStatusSelect.vue@@ -8,7 +8,7 @@><template v-slot:menuItem="{ item }"><span class="flex items-center space-x-2">- <TaskStatusIcon :taskStatus="item" :size="'small'" />+ <IssueStatusIcon :issueStatus="item" :size="'small'" /><span>{{ item }}</span>@@ -19,16 +19,16 @@<script lang="ts">import { PropType } from "vue";-import TaskStatusIcon from "../components/TaskStatusIcon.vue";-import { TaskStatus, TaskStatusTransitionType } from "../types";+import IssueStatusIcon from "../components/IssueStatusIcon.vue";+import { IssueStatus, IssueStatusTransitionType } from "../types";export default {- name: "TaskStatusSelect",+ name: "IssueStatusSelect",emits: ["start-transition"],- components: { TaskStatusIcon },+ components: { IssueStatusIcon },props: {selectedStatus: {- type: String as PropType<TaskStatus>,+ type: String as PropType<IssueStatus>,},disabled: {default: false,@@ -36,8 +36,8 @@ export default {},},setup(_, { emit }) {- const changeStatus = (newStatus: TaskStatus, didChange: () => {}) => {- let transition: TaskStatusTransitionType;+ const changeStatus = (newStatus: IssueStatus, didChange: () => {}) => {+ let transition: IssueStatusTransitionType;switch (newStatus) {case "OPEN":transition = "REOPEN";diff --git a/frontend/src/components/TaskStatusTransitionForm.vue b/frontend/src/components/IssueStatusTransitionForm.vuesimilarity index 90%rename from frontend/src/components/TaskStatusTransitionForm.vuerename to frontend/src/components/IssueStatusTransitionForm.vueindex 3dc57c1667..885b30979a 100644--- a/frontend/src/components/TaskStatusTransitionForm.vue+++ b/frontend/src/components/IssueStatusTransitionForm.vue@@ -93,8 +93,8 @@import { computed, reactive, ref, PropType } from "vue";import cloneDeep from "lodash-es/cloneDeep";import DatabaseSelect from "../components/DatabaseSelect.vue";-import { Task, TaskStatusTransition } from "../types";-import { TaskField, TaskBuiltinFieldId } from "../plugins";+import { Issue, IssueStatusTransition } from "../types";+import { IssueField, IssueBuiltinFieldId } from "../plugins";interface LocalState {comment: string;@@ -102,24 +102,24 @@ interface LocalState {}export default {- name: "TaskStatusTransitionForm",+ name: "IssueStatusTransitionForm",emits: ["submit", "cancel"],props: {okText: {type: String,default: "OK",},- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},transition: {required: true,- type: Object as PropType<TaskStatusTransition>,+ type: Object as PropType<IssueStatusTransition>,},outputFieldList: {required: true,- type: Object as PropType<TaskField[]>,+ type: Object as PropType<IssueField[]>,},},components: { DatabaseSelect },@@ -129,12 +129,12 @@ export default {const state = reactive<LocalState>({comment: "",outputValueList: props.outputFieldList.map((field) =>- cloneDeep(props.task.payload[field.id])+ cloneDeep(props.issue.payload[field.id])),});const environmentId = computed(() => {- return props.task.payload[TaskBuiltinFieldId.ENVIRONMENT];+ return props.issue.payload[IssueBuiltinFieldId.ENVIRONMENT];});const submitButtonStyle = computed(() => {diff --git a/frontend/src/components/TaskTable.vue b/frontend/src/components/IssueTable.vuesimilarity index 79%rename from frontend/src/components/TaskTable.vuerename to frontend/src/components/IssueTable.vueindex 65cf8b619f..5956ad139f 100644--- a/frontend/src/components/TaskTable.vue+++ b/frontend/src/components/IssueTable.vue@@ -1,13 +1,13 @@<template><BBTable:columnList="columnList"- :sectionDataSource="taskSectionList"+ :sectionDataSource="issueSectionList":showHeader="true":leftBordered="leftBordered":rightBordered="rightBordered":topBordered="topBordered":bottomBordered="bottomBordered"- @click-row="clickTask"+ @click-row="clickIssue"><template v-slot:header><BBTableHeaderCell class="w-4 table-cell" :title="columnList[0].title" />@@ -68,39 +68,39 @@/></template></template>- <template v-slot:body="{ rowData: task }">+ <template v-slot:body="{ rowData: issue }"><BBTableCell :leftPadding="4" class="table-cell">- <TaskStatusIcon- :taskStatus="task.status"- :stageStatus="activeStage(task).status"+ <IssueStatusIcon+ :issueStatus="issue.status"+ :stageStatus="activeStage(issue).status"/></BBTableCell><BBTableCell v-if="mode == 'ALL'" class="table-cell text-gray-500">- <span class="">{{ task.project.key }}</span>+ <span class="">{{ issue.project.key }}</span></BBTableCell><BBTableCell class="truncate">- {{ task.name }}+ {{ issue.name }}</BBTableCell><BBTableCell class="table-cell">- {{ activeEnvironmentName(task) }}+ {{ activeEnvironmentName(issue) }}</BBTableCell><BBTableCell class="table-cell">- {{ activeDatabaseName(task) }}+ {{ activeDatabaseName(issue) }}</BBTableCell><BBTableCell class="hidden sm:table-cell">- <BBStepBar :stepList="stageList(task)" />+ <BBStepBar :stepList="stageList(issue)" /></BBTableCell><BBTableCell class="hidden md:table-cell">- {{ humanizeTs(task.updatedTs) }}+ {{ humanizeTs(issue.updatedTs) }}</BBTableCell><BBTableCell class="hidden sm:table-cell"><div class="flex flex-row items-center"><BBAvatar:size="'small'"- :username="task.assignee ? task.assignee.name : 'Unassigned'"+ :username="issue.assignee ? issue.assignee.name : 'Unassigned'"/><span class="ml-2">{{- task.assignee ? task.assignee.name : "Unassigned"+ issue.assignee ? issue.assignee.name : "Unassigned"}}</span></div></BBTableCell>@@ -118,14 +118,14 @@ import {BBStep,BBStepStatus,} from "../bbkit/types";-import TaskStatusIcon from "../components/TaskStatusIcon.vue";+import IssueStatusIcon from "../components/IssueStatusIcon.vue";import {- taskSlug,+ issueSlug,activeEnvironmentId,activeDatabaseId,activeStage,} from "../utils";-import { Task } from "../types";+import { Issue } from "../types";type Mode = "ALL" | "PROJECT";@@ -192,12 +192,12 @@ interface LocalState {}export default {- name: "TaskTable",- components: { TaskStatusIcon },+ name: "IssueTable",+ components: { IssueStatusIcon },props: {- taskSectionList: {+ issueSectionList: {required: true,- type: Object as PropType<BBTableSectionDataSource<Task>[]>,+ type: Object as PropType<BBTableSectionDataSource<Issue>[]>,},mode: {default: "ALL",@@ -227,27 +227,27 @@ export default {dataSource: [],});- const activeEnvironmentName = function (task: Task) {- const id = activeEnvironmentId(task);+ const activeEnvironmentName = function (issue: Issue) {+ const id = activeEnvironmentId(issue);if (id) {return store.getters["environment/environmentById"](id).name;}return "";};- const activeDatabaseName = function (task: Task) {- return store.getters["database/databaseById"](activeDatabaseId(task))+ const activeDatabaseName = function (issue: Issue) {+ return store.getters["database/databaseById"](activeDatabaseId(issue)).name;};const router = useRouter();- const stageList = function (task: Task): BBStep[] {- return task.stageList.map((stage) => {+ const stageList = function (issue: Issue): BBStep[] {+ return issue.stageList.map((stage) => {let stepStatus: BBStepStatus = "PENDING";switch (stage.status) {case "PENDING":- if (activeStage(task).id === stage.id) {+ if (activeStage(issue).id === stage.id) {stepStatus = "PENDING_ACTIVE";} else {stepStatus = "PENDING";@@ -270,15 +270,15 @@ export default {title: stage.name,status: stepStatus,link: (): string => {- return `/task/${task.id}`;+ return `/issue/${issue.id}`;},};});};- const clickTask = function (section: number, row: number) {- const task = props.taskSectionList[section].list[row];- router.push(`/task/${taskSlug(task.name, task.id)}`);+ const clickIssue = function (section: number, row: number) {+ const issue = props.issueSectionList[section].list[row];+ router.push(`/issue/${issueSlug(issue.name, issue.id)}`);};return {@@ -288,7 +288,7 @@ export default {activeDatabaseName,stageList,activeStage,- clickTask,+ clickIssue,};},};diff --git a/frontend/src/components/PricingTable.vue b/frontend/src/components/PricingTable.vueindex c655b8693f..b2aeec2475 100644--- a/frontend/src/components/PricingTable.vue+++ b/frontend/src/components/PricingTable.vue@@ -68,7 +68,7 @@/></svg><span class="text-sm text-main whitespace-nowrap"- >100 tasks (excluding archived)</span+ >100 issues (excluding archived)</span></li>@@ -241,7 +241,7 @@clip-rule="evenodd"/></svg>- <span class="text-sm text-main">Unlimited tasks</span>+ <span class="text-sm text-main">Unlimited issues</span></li><li class="flex space-x-3">@@ -419,7 +419,7 @@clip-rule="evenodd"/></svg>- <span class="text-sm text-main">Unlimited tasks </span>+ <span class="text-sm text-main">Unlimited issues </span></li><li class="flex space-x-3">diff --git a/frontend/src/components/PrincipalSelect.vue b/frontend/src/components/PrincipalSelect.vueindex 2f22750f66..a3f9844888 100644--- a/frontend/src/components/PrincipalSelect.vue+++ b/frontend/src/components/PrincipalSelect.vue@@ -14,7 +14,7 @@<template v-slot:menuItem="{ item }"><!--TODO: Have to set a fixed width, otherwise the width would change based on the selected text.Likely, there is a better solution, while the author doesn't want to fight with CSS for now.- The specific value and breakpoint is to make it align with other select in the task sidebar.+ The specific value and breakpoint is to make it align with other select in the issue sidebar.--><span class="flex lg:40 xl:w-44 items-center space-x-2"><BBAvatar :size="'small'" :username="item.name" />@@ -24,7 +24,7 @@<template v-slot:placeholder="{ placeholder }"><!--TODO: Have to set a fixed width, otherwise the width would change based on the selected text.Likely, there is a better solution, while the author doesn't want to fight with CSS for now.- The specific value and breakpoint is to make it align with other select in the task sidebar.+ The specific value and breakpoint is to make it align with other select in the issue sidebar.--><!-- Add my-0.5 padding to avoid flickering when switching to assignee --><span class="flex my-0.5 lg:40 xl:w-44">diff --git a/frontend/src/components/ProvideContext.vue b/frontend/src/components/ProvideContext.vueindex 687be1c627..b153458706 100644--- a/frontend/src/components/ProvideContext.vue+++ b/frontend/src/components/ProvideContext.vue@@ -26,10 +26,10 @@ export default {store.dispatch("instance/fetchInstanceList"),// [TODO] Fetches all databases. This may cause performance issue if the entire fleet// has a lot of databases.- // The purpose it serves is our task list in the home view displays the database name column.- // User with the Developer role may subscribe to the task, while she is not granted to that task's- // related database. In such case, user won't fetch that task by her user id, so we need to do- // a separate fetch somewhere. Another way to do it is to do on-demand fetch for each task whose+ // The purpose it serves is our issue list in the home view displays the database name column.+ // User with the Developer role may subscribe to the issue, while she is not granted to that issue's+ // related database. In such case, user won't fetch that issue by her user id, so we need to do+ // a separate fetch somewhere. Another way to do it is to do on-demand fetch for each issue whose// database hasn't been fetched yet, that solution is more complex and might not bring better// performance because it requires to do more round-trips because of the N+1 nature. Thus,// we choose to do a full fetch when initializing the context here.diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vueindex 7c9ae2c321..512cc5318d 100644--- a/frontend/src/components/QuickActionPanel.vue+++ b/frontend/src/components/QuickActionPanel.vue@@ -195,7 +195,7 @@v-if="quickAction == 'quickaction.bytebase.database.troubleshoot'"class="flex flex-col items-center w-28">- <router-link to="/task/new" class="btn-icon-primary p-3">+ <router-link to="/issue/new" class="btn-icon-primary p-3"><svgclass="w-6 h-6"fill="none"diff --git a/frontend/src/components/Quickstart.vue b/frontend/src/components/Quickstart.vueindex 3e0d9002c9..945be044da 100644--- a/frontend/src/components/Quickstart.vue+++ b/frontend/src/components/Quickstart.vue@@ -93,8 +93,8 @@ export default {const introList: IntroItem[] = reactive([{- name: "Bookmark a task",- link: "/task/hello-world-1",+ name: "Bookmark a issue",+ link: "/issue/hello-world-1",allowDeveloper: true,done: computed(() => {return store.getters["uistate/introStateByKey"]("bookmark.create");@@ -119,7 +119,7 @@ export default {{name: "Request a database",link:- "/task/new?template=bytebase.database.create&description=Estimated QPS: 10",+ "/issue/new?template=bytebase.database.create&description=Estimated QPS: 10",allowDeveloper: true,done: computed(() =>store.getters["uistate/introStateByKey"]("database.create")@@ -128,7 +128,7 @@ export default {{name: "Create a table",link:- "/task/new?template=bytebase.database.schema.update&name=Create employee table&description=Stores employee basic info&sql=CREATE TABLE employee (\n id INT NOT NULL,\n name TEXT,\n age INT,\n PRIMARY KEY (name)\n);&rollbacksql=DROP TABLE employee;",+ "/issue/new?template=bytebase.database.schema.update&name=Create employee table&description=Stores employee basic info&sql=CREATE TABLE employee (\n id INT NOT NULL,\n name TEXT,\n age INT,\n PRIMARY KEY (name)\n);&rollbacksql=DROP TABLE employee;",allowDeveloper: true,done: computed(() =>store.getters["uistate/introStateByKey"]("table.create")diff --git a/frontend/src/components/RequestDatabasePrepForm.vue b/frontend/src/components/RequestDatabasePrepForm.vueindex c14feee3af..22aef8a074 100644--- a/frontend/src/components/RequestDatabasePrepForm.vue+++ b/frontend/src/components/RequestDatabasePrepForm.vue@@ -213,9 +213,9 @@ export default {);if (state.create == "ON") {router.push({- name: "workspace.task.detail",+ name: "workspace.issue.detail",params: {- taskSlug: "new",+ issueSlug: "new",},query: {template: "bytebase.database.create",@@ -229,9 +229,9 @@ export default {state.databaseId);router.push({- name: "workspace.task.detail",+ name: "workspace.issue.detail",params: {- taskSlug: "new",+ issueSlug: "new",},query: {template: "bytebase.database.grant",diff --git a/frontend/src/components/StageStatusTransitionForm.vue b/frontend/src/components/StageStatusTransitionForm.vueindex 3ed77bc743..db7b067c01 100644--- a/frontend/src/components/StageStatusTransitionForm.vue+++ b/frontend/src/components/StageStatusTransitionForm.vue@@ -48,7 +48,7 @@<script lang="ts">import { computed, reactive, ref, PropType } from "vue";-import { Task, StageStatusTransition } from "../types";+import { Issue, StageStatusTransition } from "../types";interface LocalState {comment: string;@@ -62,9 +62,9 @@ export default {type: String,default: "OK",},- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},transition: {required: true,diff --git a/frontend/src/miragejs/factories/activity.js b/frontend/src/miragejs/factories/activity.jsindex 8e97f232d6..a2442dfb9e 100644--- a/frontend/src/miragejs/factories/activity.js+++ b/frontend/src/miragejs/factories/activity.js@@ -16,7 +16,7 @@ export default {return Date.now() - (10 - i) * 1800 * 1000;},actionType() {- return "bytebase.task.comment.create";+ return "bytebase.issue.comment.create";},containerId() {return "0";diff --git a/frontend/src/miragejs/factories/dataSourceMember.js b/frontend/src/miragejs/factories/dataSourceMember.jsindex a434193a74..1eeb5c6cda 100644--- a/frontend/src/miragejs/factories/dataSourceMember.js+++ b/frontend/src/miragejs/factories/dataSourceMember.js@@ -5,7 +5,7 @@ export default {principalId(i) {return "100";},- taskId(i) {+ issueId(i) {return (i + 1).toString();},createdTs(i) {diff --git a/frontend/src/miragejs/factories/index.js b/frontend/src/miragejs/factories/index.jsindex 4550d0b2a1..9df6d540ea 100644--- a/frontend/src/miragejs/factories/index.js+++ b/frontend/src/miragejs/factories/index.js@@ -6,7 +6,7 @@ import instance from "./instance";import dataSource from "./dataSource";import dataSourceMember from "./dataSourceMember";import database from "./database";-import task from "./task";+import issue from "./issue";import stage from "./stage";import step from "./step";import activity from "./activity";@@ -34,7 +34,7 @@ export default {...dataSourceMember,...database,...message,- ...task,+ ...issue,...stage,...step,...activity,diff --git a/frontend/src/miragejs/factories/task.js b/frontend/src/miragejs/factories/issue.jssimilarity index 97%rename from frontend/src/miragejs/factories/task.jsrename to frontend/src/miragejs/factories/issue.jsindex aeabe5d19c..b4cd766071 100644--- a/frontend/src/miragejs/factories/task.js+++ b/frontend/src/miragejs/factories/issue.js@@ -3,7 +3,7 @@ import faker from "faker";import { UNKNOWN_ID } from "../../types";export default {- task: Factory.extend({+ issue: Factory.extend({name(i) {return faker.fake("{{lorem.sentence}}");},diff --git a/frontend/src/miragejs/factories/message.js b/frontend/src/miragejs/factories/message.jsindex 01ca0e41ad..553e793018 100644--- a/frontend/src/miragejs/factories/message.js+++ b/frontend/src/miragejs/factories/message.js@@ -10,7 +10,7 @@ export default {return Date.now() - (10 - i) * 1800 * 1000;},type() {- return "bb.msg.task.assign";+ return "bb.msg.issue.assign";},status(i) {return Math.floor(Math.random() * 2) % 2 == 0 ? "DELIVERED" : "CONSUMED";@@ -31,7 +31,7 @@ export default {},payload() {return {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),};},}),diff --git a/frontend/src/miragejs/models/index.js b/frontend/src/miragejs/models/index.jsindex c66f4ba851..d950146c72 100644--- a/frontend/src/miragejs/models/index.js+++ b/frontend/src/miragejs/models/index.js@@ -25,7 +25,7 @@ export default {message: hasMany(),project: hasMany(),projectMember: hasMany(),- task: hasMany(),+ issue: hasMany(),stage: hasMany(),step: hasMany(),environment: hasMany(),@@ -65,7 +65,7 @@ export default {workspace: belongsTo(),database: hasMany(),projectMember: hasMany(),- task: hasMany(),+ issue: hasMany(),}),projectNew: Model,projectPatch: Model,@@ -78,21 +78,21 @@ export default {projectMemberNew: Model,projectMemberPatch: Model,- // Task- task: Model.extend({+ // Issue+ issue: Model.extend({workspace: belongsTo(),project: belongsTo(),stage: hasMany(),step: hasMany(),}),- taskNew: Model,- taskPatch: Model,- taskStatusPatch: Model,+ issueNew: Model,+ issuePatch: Model,+ issueStatusPatch: Model,// Stagestage: Model.extend({workspace: belongsTo(),- task: belongsTo(),+ issue: belongsTo(),database: belongsTo(),}),stagePatch: Model,@@ -101,7 +101,7 @@ export default {// Stepstep: Model.extend({workspace: belongsTo(),- task: belongsTo(),+ issue: belongsTo(),stage: belongsTo(),}),stepPatch: Model,diff --git a/frontend/src/miragejs/routes/activity.js b/frontend/src/miragejs/routes/activity.jsindex a13a672caa..ffe81de8e0 100644--- a/frontend/src/miragejs/routes/activity.js+++ b/frontend/src/miragejs/routes/activity.js@@ -31,44 +31,47 @@ export default function configureActivity(route) {createdTs: ts,updaterId: attrs.creatorId,updatedTs: ts,- actionType: "bytebase.task.comment.create",+ actionType: "bytebase.issue.comment.create",workspaceId: WORKSPACE_ID,};const createdActivity = schema.activities.create(newActivity);- const task = schema.tasks.find(attrs.containerId);+ const issue = schema.issues.find(attrs.containerId);- if (task) {+ if (issue) {const messageList = [];const messageTemplate = {containerId: attrs.containerId,createdTs: ts,updatedTs: ts,- type: "bb.msg.task.comment",+ type: "bb.msg.issue.comment",status: "DELIVERED",description: attrs.comment,creatorId: attrs.creatorId,workspaceId: WORKSPACE_ID,payload: {- taskName: task.name,+ issueName: issue.name,commentId: createdActivity.id,},};messageList.push({...messageTemplate,- receiverId: task.creatorId,+ receiverId: issue.creatorId,});- if (task.assigneeId) {+ if (issue.assigneeId) {messageList.push({...messageTemplate,- receiverId: task.assigneeId,+ receiverId: issue.assigneeId,});}- for (let subscriberId of task.subscriberIdList) {- if (subscriberId != task.creatorId && subscriberId != task.assigneeId) {+ for (let subscriberId of issue.subscriberIdList) {+ if (+ subscriberId != issue.creatorId &&+ subscriberId != issue.assigneeId+ ) {messageList.push({...messageTemplate,receiverId: subscriberId,diff --git a/frontend/src/miragejs/routes/dataSource.js b/frontend/src/miragejs/routes/dataSource.jsindex fb1e87b321..98bfe28930 100644--- a/frontend/src/miragejs/routes/dataSource.js+++ b/frontend/src/miragejs/routes/dataSource.js@@ -157,7 +157,7 @@ export default function configureDataSource(route) {if (!member) {newList.push({principalId: attrs.principalId,- taskId: attrs.taskId,+ issueId: attrs.issueId,createdTs: Date.now(),});return dataSource.update({diff --git a/frontend/src/miragejs/routes/database.js b/frontend/src/miragejs/routes/database.jsindex 074fdfd6cd..a7470958b8 100644--- a/frontend/src/miragejs/routes/database.js+++ b/frontend/src/miragejs/routes/database.js@@ -76,7 +76,7 @@ export default function configureDatabase(route) {route.post("/database", function (schema, request) {const ts = Date.now();- const { taskId, creatorId, ...attrs } = this.normalizedRequestAttrs(+ const { issueId, creatorId, ...attrs } = this.normalizedRequestAttrs("database-new");@@ -107,14 +107,14 @@ export default function configureDatabase(route) {workspaceId: WORKSPACE_ID,};- if (taskId) {+ if (issueId) {schema.activities.create({creatorId: creatorId,createdTs: ts,updaterId: creatorId,updatedTs: ts,- actionType: "bytebase.task",- containerId: taskId,+ actionType: "bytebase.issue",+ containerId: issueId,comment: `Created database ${newDatabase.name}`,workspaceId: WORKSPACE_ID,});diff --git a/frontend/src/miragejs/routes/index.js b/frontend/src/miragejs/routes/index.jsindex 483d483026..0bc1e3d5ca 100644--- a/frontend/src/miragejs/routes/index.js+++ b/frontend/src/miragejs/routes/index.js@@ -7,7 +7,7 @@ import configureMember from "./member";import configureActivity from "./activity";import configureMessage from "./message";import configureBookmark from "./bookmark";-import configureTask from "./task";+import configureIssue from "./issue";import configureProject from "./project";import configureProjectMember from "./projectMember";import configureEnvironment from "./environment";@@ -51,8 +51,8 @@ export default function routes() {// ProjectMemberconfigureProjectMember(this);- // Task- configureTask(this);+ // Issue+ configureIssue(this);// EnvironmentconfigureEnvironment(this);diff --git a/frontend/src/miragejs/routes/task.js b/frontend/src/miragejs/routes/issue.jssimilarity index 59%rename from frontend/src/miragejs/routes/task.jsrename to frontend/src/miragejs/routes/issue.jsindex 7c4d2d4b64..0376778bfb 100644--- a/frontend/src/miragejs/routes/task.js+++ b/frontend/src/miragejs/routes/issue.js@@ -1,48 +1,48 @@import { Response } from "miragejs";import isEqual from "lodash-es/isEqual";import { WORKSPACE_ID } from "./index";-import { TaskBuiltinFieldId } from "../../plugins";+import { IssueBuiltinFieldId } from "../../plugins";import { UNKNOWN_ID, DEFAULT_PROJECT_ID } from "../../types";-export default function configureTask(route) {- route.get("/task", function (schema, request) {+export default function configureIssue(route) {+ route.get("/issue", function (schema, request) {const {queryParams: { user: userId, project: projectId },} = request;if (userId || projectId) {- return schema.tasks.where((task) => {+ return schema.issues.where((issue) => {return (- task.workspaceId == WORKSPACE_ID &&+ issue.workspaceId == WORKSPACE_ID &&(!userId ||- task.creatorId == userId ||- task.assigneeId == userId ||- task.subscriberIdList.includes(userId)) &&- (!projectId || task.projectId == projectId)+ issue.creatorId == userId ||+ issue.assigneeId == userId ||+ issue.subscriberIdList.includes(userId)) &&+ (!projectId || issue.projectId == projectId));});}- return schema.tasks.all();+ return schema.issues.all();});- route.get("/task/:id", function (schema, request) {- const task = schema.tasks.find(request.params.id);- if (task) {- return task;+ route.get("/issue/:id", function (schema, request) {+ const issue = schema.issues.find(request.params.id);+ if (issue) {+ return issue;}return new Response(404,{},- { errors: "Task " + request.params.id + " not found" }+ { errors: "Issue " + request.params.id + " not found" });});- route.post("/task", function (schema, request) {+ route.post("/issue", function (schema, request) {const ts = Date.now();- const { stageList, ...attrs } = this.normalizedRequestAttrs("task-new");+ const { stageList, ...attrs } = this.normalizedRequestAttrs("issue-new");const database = schema.databases.find(stageList[0].databaseId);- const newTask = {+ const newIssue = {...attrs,createdTs: ts,updaterId: attrs.creatorId,@@ -51,7 +51,7 @@ export default function configureTask(route) {projectId: database.projectId,workspaceId: WORKSPACE_ID,};- const createdTask = schema.tasks.create(newTask);+ const createdIssue = schema.issues.create(newIssue);for (const stage of stageList) {const { stepList, ...stageAttrs } = stage;@@ -61,7 +61,7 @@ export default function configureTask(route) {updaterId: attrs.creatorId,updatedTs: ts,status: "PENDING",- task: createdTask,+ issue: createdIssue,workspaceId: WORKSPACE_ID,});@@ -72,7 +72,7 @@ export default function configureTask(route) {updaterId: attrs.creatorId,updatedTs: ts,status: "PENDING",- task: createdTask,+ issue: createdIssue,stage: createdStage,workspaceId: WORKSPACE_ID,});@@ -84,24 +84,24 @@ export default function configureTask(route) {createdTs: ts,updaterId: attrs.updaterId,updatedTs: ts,- actionType: "bytebase.task.create",- containerId: createdTask.id,+ actionType: "bytebase.issue.create",+ containerId: createdIssue.id,comment: "",workspaceId: WORKSPACE_ID,});- return createdTask;+ return createdIssue;});- route.patch("/task/:taskId", function (schema, request) {- const attrs = this.normalizedRequestAttrs("task-patch");- const task = schema.tasks.find(request.params.taskId);+ route.patch("/issue/:issueId", function (schema, request) {+ const attrs = this.normalizedRequestAttrs("issue-patch");+ const issue = schema.issues.find(request.params.issueId);- if (!task) {+ if (!issue) {return new Response(404,{},- { errors: "Task " + request.params.id + " not found" }+ { errors: "Issue " + request.params.id + " not found" });}@@ -109,7 +109,7 @@ export default function configureTask(route) {const changeList = [];const messageList = [];const messageTemplate = {- containerId: task.id,+ containerId: issue.id,creatorId: attrs.updaterId,createdTs: ts,updaterId: attrs.updaterId,@@ -119,51 +119,51 @@ export default function configureTask(route) {};if (attrs.assigneeId) {- if (task.assigneeId != attrs.assigneeId) {+ if (issue.assigneeId != attrs.assigneeId) {changeList.push({- fieldId: TaskBuiltinFieldId.ASSIGNEE,- oldValue: task.assigneeId,+ fieldId: IssueBuiltinFieldId.ASSIGNEE,+ oldValue: issue.assigneeId,newValue: attrs.assigneeId,});// Send a message to the new assigneemessageList.push({...messageTemplate,- type: "bb.msg.task.assign",+ type: "bb.msg.issue.assign",receiverId: attrs.assigneeId,payload: {- taskName: task.name,- oldAssigneeId: task.assigneeId,+ issueName: issue.name,+ oldAssigneeId: issue.assigneeId,newAssigneeId: attrs.assigneeId,},});// Send a message to the old assigneeif (- task.assigneeId != UNKNOWN_ID &&- task.creatorId != task.assigneeId+ issue.assigneeId != UNKNOWN_ID &&+ issue.creatorId != issue.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.assign",- receiverId: task.assigneeId,+ type: "bb.msg.issue.assign",+ receiverId: issue.assigneeId,payload: {- taskName: task.name,- oldAssigneeId: task.assigneeId,+ issueName: issue.name,+ oldAssigneeId: issue.assigneeId,newAssigneeId: attrs.assigneeId,},});}// Send a message to the creator- if (task.creatorId != attrs.assigneeId) {+ if (issue.creatorId != attrs.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.assign",- receiverId: task.creatorId,+ type: "bb.msg.issue.assign",+ receiverId: issue.creatorId,payload: {- taskName: task.name,- oldAssigneeId: task.assigneeId,+ issueName: issue.name,+ oldAssigneeId: issue.assigneeId,newAssigneeId: attrs.assigneeId,},});@@ -173,72 +173,72 @@ export default function configureTask(route) {// Empty string is validif (attrs.description !== undefined) {- if (task.description != attrs.description) {+ if (issue.description != attrs.description) {changeList.push({- fieldId: TaskBuiltinFieldId.DESCRIPTION,- oldValue: task.description,+ fieldId: IssueBuiltinFieldId.DESCRIPTION,+ oldValue: issue.description,newValue: attrs.description,});}}if (attrs.stage !== undefined) {- const stage = task.stageList.find((item) => item.id == attrs.stage.id);+ const stage = issue.stageList.find((item) => item.id == attrs.stage.id);if (stage) {changeList.push({- fieldId: [TaskBuiltinFieldId.STAGE, stage.id].join("."),+ fieldId: [IssueBuiltinFieldId.STAGE, stage.id].join("."),oldValue: stage.status,newValue: attrs.stage.status,});stage.status = attrs.stage.status;- attrs.stageList = task.stageList;+ attrs.stageList = issue.stageList;}}if (attrs.subscriberIdList !== undefined) {- if (task.subscriberIdList != attrs.subscriberIdList) {+ if (issue.subscriberIdList != attrs.subscriberIdList) {changeList.push({- fieldId: TaskBuiltinFieldId.SUBSCRIBER_LIST,- oldValue: task.subscriberIdList,+ fieldId: IssueBuiltinFieldId.SUBSCRIBER_LIST,+ oldValue: issue.subscriberIdList,newValue: attrs.subscriberIdList,});}}if (attrs.sql !== undefined) {- if (task.sql != attrs.sql) {+ if (issue.sql != attrs.sql) {changeList.push({- fieldId: TaskBuiltinFieldId.SQL,- oldValue: task.sql,+ fieldId: IssueBuiltinFieldId.SQL,+ oldValue: issue.sql,newValue: attrs.sql,});}}if (attrs.rollbackSql !== undefined) {- if (task.rollbackSql != attrs.rollbackSql) {+ if (issue.rollbackSql != attrs.rollbackSql) {changeList.push({- fieldId: TaskBuiltinFieldId.ROLLBACK_SQL,- oldValue: task.rollbackSql,+ fieldId: IssueBuiltinFieldId.ROLLBACK_SQL,+ oldValue: issue.rollbackSql,newValue: attrs.rollbackSql,});}}for (const fieldId in attrs.payload) {- const oldValue = task.payload[fieldId];+ const oldValue = issue.payload[fieldId];const newValue = attrs.payload[fieldId];if (!isEqual(oldValue, newValue)) {changeList.push({fieldId: fieldId,- oldValue: task.payload[fieldId],+ oldValue: issue.payload[fieldId],newValue: attrs.payload[fieldId],});}}if (changeList.length) {- const updatedTask = task.update({ ...attrs, updatedTs: ts });+ const updatedIssue = issue.update({ ...attrs, updatedTs: ts });const payload = {changeList,@@ -249,8 +249,8 @@ export default function configureTask(route) {createdTs: ts,updaterId: attrs.updaterId,updatedTs: ts,- actionType: "bytebase.task.field.update",- containerId: updatedTask.id,+ actionType: "bytebase.issue.field.update",+ containerId: updatedIssue.id,comment: attrs.comment,payload,workspaceId: WORKSPACE_ID,@@ -265,28 +265,28 @@ export default function configureTask(route) {}}- return updatedTask;+ return updatedIssue;}- return task;+ return issue;});- route.patch("/task/:taskId/status", function (schema, request) {- const attrs = this.normalizedRequestAttrs("task-status-patch");- const task = schema.tasks.find(request.params.taskId);+ route.patch("/issue/:issueId/status", function (schema, request) {+ const attrs = this.normalizedRequestAttrs("issue-status-patch");+ const issue = schema.issues.find(request.params.issueId);- if (!task) {+ if (!issue) {return new Response(404,{},- { errors: "Task " + request.params.id + " not found" }+ { errors: "Issue " + request.params.id + " not found" });}const ts = Date.now();if (attrs.status == "DONE") {- const stageList = schema.stages.where({ taskId: task.id }).models;+ const stageList = schema.stages.where({ issueId: issue.id }).models;// We check each of the stage and its steps. Returns error if any of them is not finished.for (let i = 0; i < stageList.length; i++) {@@ -295,13 +295,13 @@ export default function configureTask(route) {404,{},{- errors: `Can't resolve task ${task.name}. Stage ${stage[i].name} is in ${stage[i].status} status`,+ errors: `Can't resolve issue ${issue.name}. Stage ${stage[i].name} is in ${stage[i].status} status`,});}const stepList = schema.steps.where({- taskId: task.id,+ issueId: issue.id,stageId: stage[i].id,}).models;@@ -311,7 +311,7 @@ export default function configureTask(route) {404,{},{- errors: `Can't resolve task ${task.name}. Step ${step[j].name} in stage ${stage[i].name} is in ${step[j].status} status`,+ errors: `Can't resolve issue ${issue.name}. Step ${step[j].name} in stage ${stage[i].name} is in ${step[j].status} status`,});}@@ -322,7 +322,7 @@ export default function configureTask(route) {const changeList = [];const messageList = [];const messageTemplate = {- containerId: task.id,+ containerId: issue.id,creatorId: attrs.updaterId,createdTs: ts,updaterId: attrs.updaterId,@@ -332,43 +332,43 @@ export default function configureTask(route) {};if (attrs.status) {- if (task.status != attrs.status) {+ if (issue.status != attrs.status) {changeList.push({- fieldId: TaskBuiltinFieldId.STATUS,- oldValue: task.status,+ fieldId: IssueBuiltinFieldId.STATUS,+ oldValue: issue.status,newValue: attrs.status,});messageList.push({...messageTemplate,- type: "bb.msg.task.status.update",- receiverId: task.creatorId,+ type: "bb.msg.issue.status.update",+ receiverId: issue.creatorId,payload: {- taskName: task.name,- oldStatus: task.status,+ issueName: issue.name,+ oldStatus: issue.status,newStatus: attrs.status,},});- if (task.assigneeId) {+ if (issue.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.status.update",- receiverId: task.assigneeId,+ type: "bb.msg.issue.status.update",+ receiverId: issue.assigneeId,});}- for (let subscriberId of task.subscriberIdList) {+ for (let subscriberId of issue.subscriberIdList) {if (- subscriberId != task.creatorId &&- subscriberId != task.assigneeId+ subscriberId != issue.creatorId &&+ subscriberId != issue.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.status.update",+ type: "bb.msg.issue.status.update",receiverId: subscriberId,payload: {- taskName: task.name,+ issueName: issue.name,},});}@@ -377,7 +377,7 @@ export default function configureTask(route) {}if (changeList.length) {- const updatedTask = task.update({ ...attrs, updatedTs: ts });+ const updatedIssue = issue.update({ ...attrs, updatedTs: ts });const payload = {changeList,@@ -388,8 +388,8 @@ export default function configureTask(route) {createdTs: ts,updaterId: attrs.updaterId,updatedTs: ts,- actionType: "bytebase.task.status.update",- containerId: updatedTask.id,+ actionType: "bytebase.issue.status.update",+ containerId: updatedIssue.id,comment: attrs.comment,payload,workspaceId: WORKSPACE_ID,@@ -404,9 +404,9 @@ export default function configureTask(route) {}}- return updatedTask;+ return updatedIssue;}- return task;+ return issue;});}diff --git a/frontend/src/miragejs/routes/stage.js b/frontend/src/miragejs/routes/stage.jsindex 84b20ed9e6..b5682bf2fa 100644--- a/frontend/src/miragejs/routes/stage.js+++ b/frontend/src/miragejs/routes/stage.js@@ -1,21 +1,21 @@import { Response } from "miragejs";import isEqual from "lodash-es/isEqual";import { WORKSPACE_ID } from "./index";-import { TaskBuiltinFieldId } from "../../plugins";+import { IssueBuiltinFieldId } from "../../plugins";import { UNKNOWN_ID, DEFAULT_PROJECT_ID } from "../../types";export default function configureStage(route) {route.patch(- "/task/:taskId/stage/:stageId/status",+ "/issue/:issueId/stage/:stageId/status",function (schema, request) {const attrs = this.normalizedRequestAttrs("stage-status-patch");- const task = schema.tasks.find(request.params.taskId);+ const issue = schema.issues.find(request.params.issueId);- if (!task) {+ if (!issue) {return new Response(404,{},- { errors: "Task " + request.params.taskId + " not found" }+ { errors: "Issue " + request.params.issueId + " not found" });}@@ -33,7 +33,7 @@ export default function configureStage(route) {if (attrs.status == "DONE") {// We check each steps. Returns error if any of them is not finished.const stepList = schema.steps.where({- taskId: task.id,+ issueId: issue.id,stageId: stage.id,}).models;@@ -43,7 +43,7 @@ export default function configureStage(route) {404,{},{- errors: `Can't resolve task ${task.name}. Step ${step[j].name} in stage ${stage[i].name} is in ${step[j].status} status`,+ errors: `Can't resolve issue ${issue.name}. Step ${step[j].name} in stage ${stage[i].name} is in ${step[j].status} status`,});}@@ -53,7 +53,7 @@ export default function configureStage(route) {const changeList = [];const messageList = [];const messageTemplate = {- containerId: task.id,+ containerId: issue.id,creatorId: attrs.updaterId,createdTs: ts,updaterId: attrs.updaterId,@@ -63,43 +63,43 @@ export default function configureStage(route) {};if (attrs.status) {- if (task.status != attrs.status) {+ if (issue.status != attrs.status) {changeList.push({- fieldId: TaskBuiltinFieldId.STAGE_STATUS,- oldValue: task.status,+ fieldId: IssueBuiltinFieldId.STAGE_STATUS,+ oldValue: issue.status,newValue: attrs.status,});messageList.push({...messageTemplate,- type: "bb.msg.task.stage.status.update",- receiverId: task.creatorId,+ type: "bb.msg.issue.stage.status.update",+ receiverId: issue.creatorId,payload: {- taskName: task.name,- oldStatus: task.status,+ issueName: issue.name,+ oldStatus: issue.status,newStatus: attrs.status,},});- if (task.assigneeId) {+ if (issue.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.stage.status.update",- receiverId: task.assigneeId,+ type: "bb.msg.issue.stage.status.update",+ receiverId: issue.assigneeId,});}- for (let subscriberId of task.subscriberIdList) {+ for (let subscriberId of issue.subscriberIdList) {if (- subscriberId != task.creatorId &&- subscriberId != task.assigneeId+ subscriberId != issue.creatorId &&+ subscriberId != issue.assigneeId) {messageList.push({...messageTemplate,- type: "bb.msg.task.stage.status.update",+ type: "bb.msg.issue.stage.status.update",receiverId: subscriberId,payload: {- taskName: task.name,+ issueName: issue.name,},});}@@ -119,8 +119,8 @@ export default function configureStage(route) {createdTs: ts,updaterId: attrs.updaterId,updatedTs: ts,- actionType: "bytebase.task.stage.status.update",- containerId: updatedTask.id,+ actionType: "bytebase.issue.stage.status.update",+ containerId: updatedIssue.id,comment: attrs.comment,payload,workspaceId: WORKSPACE_ID,@@ -135,10 +135,10 @@ export default function configureStage(route) {}}- return updatedTask;+ return updatedIssue;}- return task;+ return issue;});}diff --git a/frontend/src/miragejs/seeds/index.ts b/frontend/src/miragejs/seeds/index.tsindex 5fd3ccc8f5..71d9173fb6 100644--- a/frontend/src/miragejs/seeds/index.ts+++ b/frontend/src/miragejs/seeds/index.ts@@ -6,21 +6,21 @@ import {Instance,Principal,StageType,- Task,+ Issue,DEFAULT_PROJECT_ID,ALL_DATABASE_NAME,- TaskNew,- TaskStatus,+ IssueNew,+ IssueStatus,StageNew,StageStatus,StageId,DatabaseId,ProjectId,PrincipalId,- TaskId,+ IssueId,StepStatus,} from "../../types";-import { databaseSlug, taskSlug } from "../../utils";+import { databaseSlug, issueSlug } from "../../utils";/** Mirage JS guide on Seeds: https://miragejs.com/docs/data-layer/factories#in-development@@ -178,12 +178,12 @@ const workspacesSeeder = (server: any) => {}).models[0]);- // Task- let task = server.create("task", {+ // Issue+ let issue = server.create("issue", {type: "bytebase.general",name: "Hello, World!",description:- "Welcome to Bytebase, this is the task interface where DBAs and developers collaborate on database management tasks such as: \n\n - Requesting a new database\n - Creating a table\n - Creating an index\n - Adding a column\n - Troubleshooting performance issue\n\nLet's bookmark this task by clicking the star icon on the top of this page.",+ "Welcome to Bytebase, this is the issue interface where DBAs and developers collaborate on database management issues such as: \n\n - Requesting a new database\n - Creating a table\n - Creating an index\n - Adding a column\n - Troubleshooting performance issue\n\nLet's bookmark this issue by clicking the star icon on the top of this page.",sql:"SELECT 'Welcome'\nFROM engineering\nWHERE role IN ('DBA', 'Developer') AND taste = 'Good';",creatorId: ws1Dev1.id,@@ -195,8 +195,8 @@ const workspacesSeeder = (server: any) => {});const createdActivity = server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws1Dev1.id,updaterId: ws1Dev1.id,workspace: workspace1,@@ -205,27 +205,27 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 5; i++) {if (i % 2 == 0) {server.create("message", {- type: "bb.msg.task.comment",- containerId: task.id,+ type: "bb.msg.issue.comment",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1Owner.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),commentId: createdActivity.id,},});} else {server.create("message", {- type: "bb.msg.task.status.update",- containerId: task.id,+ type: "bb.msg.issue.status.update",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1Owner.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),oldStatus: "OPEN",newStatus: "DONE",},@@ -236,27 +236,27 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 5; i++) {if (i % 2 == 0) {server.create("message", {- type: "bb.msg.task.comment",- containerId: task.id,+ type: "bb.msg.issue.comment",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1DBA.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),commentId: createdActivity.id,},});} else {server.create("message", {- type: "bb.msg.task.status.update",- containerId: task.id,+ type: "bb.msg.issue.status.update",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1DBA.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),oldStatus: "OPEN",newStatus: "CANCELED",},@@ -267,27 +267,27 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 5; i++) {if (i % 2 == 0) {server.create("message", {- type: "bb.msg.task.comment",- containerId: task.id,+ type: "bb.msg.issue.comment",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1Dev1.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),commentId: createdActivity.id,},});} else {server.create("message", {- type: "bb.msg.task.status.update",- containerId: task.id,+ type: "bb.msg.issue.status.update",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws1Dev1.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),oldStatus: "OPEN",newStatus: "DONE",},@@ -298,26 +298,26 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 5; i++) {if (i % 2 == 0) {server.create("message", {- type: "bb.msg.task.comment",- containerId: task.id,+ type: "bb.msg.issue.comment",+ containerId: issue.id,creatorId: ws2DBA.id,receiverId: ws2Dev.id,workspace: workspace2,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),commentId: createdActivity.id,},});} else {server.create("message", {- type: "bb.msg.task.status.update",- containerId: task.id,+ type: "bb.msg.issue.status.update",+ containerId: issue.id,creatorId:ws1UserList[Math.floor(Math.random() * ws1UserList.length)].id,receiverId: ws2Dev.id,workspace: workspace1,payload: {- taskName: faker.fake("{{lorem.sentence}}"),+ issueName: faker.fake("{{lorem.sentence}}"),oldStatus: "OPEN",newStatus: "DONE",},@@ -328,8 +328,8 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 3; i++) {const user = ws1UserList[Math.floor(Math.random() * ws1UserList.length)];server.create("activity", {- actionType: "bytebase.task.comment.create",- containerId: task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: issue.id,creatorId: user.id,updaterId: user.id,comment: faker.fake("{{lorem.paragraph}}"),@@ -346,7 +346,7 @@ const workspacesSeeder = (server: any) => {"history",];- task = server.create("task", {+ issue = server.create("issue", {type: "bytebase.database.create",name: `Create database '${databaseList1[1].name}' for environment - ${environmentList1[1].name}`,creatorId: ws1Dev1.id,@@ -369,7 +369,7 @@ const workspacesSeeder = (server: any) => {type: "bytebase.stage.database.create",status: "PENDING",databaseId: databaseList1[1].id,- task,+ issue,workspace: workspace1,});@@ -379,14 +379,14 @@ const workspacesSeeder = (server: any) => {name: "Waiting approval",type: "bytebase.step.approve",status: "PENDING",- task,+ issue,stage,workspace: workspace1,});server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws1Dev1.id,updaterId: ws1Dev1.id,workspace: workspace1,@@ -395,8 +395,8 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 3; i++) {const user = ws1UserList[Math.floor(Math.random() * ws1UserList.length)];server.create("activity", {- actionType: "bytebase.task.comment.create",- containerId: task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: issue.id,creatorId: user.id,updaterId: user.id,comment: faker.fake("{{lorem.paragraph}}"),@@ -408,7 +408,7 @@ const workspacesSeeder = (server: any) => {title: string;sql: string;};- const randomUpdateSchemaTaskName = (): SQLData => {+ const randomUpdateSchemaIssueName = (): SQLData => {const tableName =tableNameList[Math.floor(Math.random() * tableNameList.length)];const list: SQLData[] = [@@ -450,42 +450,42 @@ const workspacesSeeder = (server: any) => {};const statusSetList: {- taskStatus: TaskStatus;+ issueStatus: IssueStatus;stageStatusList: StageStatus[];stepStatusList: StepStatus[];}[] = [{- taskStatus: "OPEN",+ issueStatus: "OPEN",stageStatusList: ["PENDING"],stepStatusList: ["PENDING"],},{- taskStatus: "OPEN",+ issueStatus: "OPEN",stageStatusList: ["DONE", "DONE", "RUNNING", "PENDING"],stepStatusList: ["DONE", "DONE", "RUNNING", "PENDING"],},{- taskStatus: "DONE",+ issueStatus: "DONE",stageStatusList: ["DONE", "SKIPPED", "DONE", "DONE"],stepStatusList: ["DONE", "CANCELED", "DONE", "DONE"],},{- taskStatus: "OPEN",+ issueStatus: "OPEN",stageStatusList: ["DONE", "FAILED", "PENDING", "PENDING"],stepStatusList: ["DONE", "FAILED", "PENDING", "PENDING"],},{- taskStatus: "CANCELED",+ issueStatus: "CANCELED",stageStatusList: ["DONE", "SKIPPED", "DONE", "PENDING"],stepStatusList: ["DONE", "CANCELED", "DONE", "PENDING"],},];for (let i = 0; i < 3; i++) {- const data = randomUpdateSchemaTaskName();+ const data = randomUpdateSchemaIssueName();const statusSet =statusSetList[Math.floor(Math.random() * statusSetList.length)];- task = server.create("task", {+ issue = server.create("issue", {name: data.title,type: "bytebase.database.schema.update",creatorId: ws1Dev1.id,@@ -493,7 +493,7 @@ const workspacesSeeder = (server: any) => {assigneeId: ws1Owner.id,sql: data.sql,subscriberIdList: [ws1DBA.id, ws1Dev2.id],- status: statusSet.taskStatus,+ status: statusSet.issueStatus,project: projectList1[i],workspace: workspace1,});@@ -501,7 +501,7 @@ const workspacesSeeder = (server: any) => {createUpdateSchemaStage(server,workspace1.id,- task.id,+ issue.id,ws1Dev1.id,environmentList1,databaseList1,@@ -510,8 +510,8 @@ const workspacesSeeder = (server: any) => {);server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws1Dev1.id,updaterId: ws1Dev1.id,workspace: workspace1,@@ -520,8 +520,8 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 3; i++) {const user = ws1UserList[Math.floor(Math.random() * ws1UserList.length)];server.create("activity", {- actionType: "bytebase.task.comment.create",- containerId: task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: issue.id,creatorId: user.id,updaterId: user.id,comment: faker.fake("{{lorem.paragraph}}"),@@ -531,10 +531,10 @@ const workspacesSeeder = (server: any) => {}for (let i = 0; i < 3; i++) {- const data = randomUpdateSchemaTaskName();+ const data = randomUpdateSchemaIssueName();const statusSet =statusSetList[Math.floor(Math.random() * statusSetList.length)];- task = server.create("task", {+ issue = server.create("issue", {name: data.title,type: "bytebase.database.schema.update",creatorId: ws1Owner.id,@@ -542,7 +542,7 @@ const workspacesSeeder = (server: any) => {assigneeId: ws1DBA.id,sql: data.sql,subscriberIdList: [ws1Dev2.id],- status: statusSet.taskStatus,+ status: statusSet.issueStatus,project: projectList1[i],workspace: workspace1,});@@ -550,7 +550,7 @@ const workspacesSeeder = (server: any) => {createUpdateSchemaStage(server,workspace1.id,- task.id,+ issue.id,ws1Owner.id,environmentList1,databaseList1,@@ -559,8 +559,8 @@ const workspacesSeeder = (server: any) => {);server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws1Owner.id,updaterId: ws1Owner.id,workspace: workspace1,@@ -569,8 +569,8 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 3; i++) {const user = ws1UserList[Math.floor(Math.random() * ws1UserList.length)];server.create("activity", {- actionType: "bytebase.task.comment.create",- containerId: task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: issue.id,creatorId: user.id,updaterId: user.id,comment: faker.fake("{{lorem.paragraph}}"),@@ -580,10 +580,10 @@ const workspacesSeeder = (server: any) => {}for (let i = 0; i < 3; i++) {- const data = randomUpdateSchemaTaskName();+ const data = randomUpdateSchemaIssueName();const statusSet =statusSetList[Math.floor(Math.random() * statusSetList.length)];- task = server.create("task", {+ issue = server.create("issue", {name: data.title,type: "bytebase.database.schema.update",creatorId: ws1Dev2.id,@@ -591,7 +591,7 @@ const workspacesSeeder = (server: any) => {assigneeId: ws1DBA.id,sql: data.sql,subscriberIdList: [ws1Owner.id, ws1Dev1.id],- status: statusSet.taskStatus,+ status: statusSet.issueStatus,project: projectList1[i],workspace: workspace1,});@@ -599,7 +599,7 @@ const workspacesSeeder = (server: any) => {createUpdateSchemaStage(server,workspace1.id,- task.id,+ issue.id,ws1Dev2.id,environmentList1,databaseList1,@@ -608,8 +608,8 @@ const workspacesSeeder = (server: any) => {);server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws1Dev2.id,updaterId: ws1Dev2.id,workspace: workspace1,@@ -618,8 +618,8 @@ const workspacesSeeder = (server: any) => {for (let i = 0; i < 3; i++) {const user = ws1UserList[Math.floor(Math.random() * ws1UserList.length)];server.create("activity", {- actionType: "bytebase.task.comment.create",- containerId: task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: issue.id,creatorId: user.id,updaterId: user.id,comment: faker.fake("{{lorem.paragraph}}"),@@ -628,17 +628,17 @@ const workspacesSeeder = (server: any) => {}}- const data = randomUpdateSchemaTaskName();+ const data = randomUpdateSchemaIssueName();const statusSet =statusSetList[Math.floor(Math.random() * statusSetList.length)];- task = server.create("task", {+ issue = server.create("issue", {name: data.title,type: "bytebase.database.schema.update",creatorId: ws2Dev.id,updaterId: ws2Dev.id,assigneeId: ws2DBA.id,sql: data.sql,- status: statusSet.taskStatus,+ status: statusSet.issueStatus,project: projectList2[0],workspace: workspace2,});@@ -646,7 +646,7 @@ const workspacesSeeder = (server: any) => {createUpdateSchemaStage(server,workspace2.id,- task.id,+ issue.id,ws2Dev.id,environmentList2,databaseList2,@@ -655,8 +655,8 @@ const workspacesSeeder = (server: any) => {);server.create("activity", {- actionType: "bytebase.task.create",- containerId: task.id,+ actionType: "bytebase.issue.create",+ containerId: issue.id,creatorId: ws2Dev.id,updaterId: ws2Dev.id,workspace: workspace2,@@ -676,14 +676,14 @@ const workspacesSeeder = (server: any) => {{// Workspace 2- // Task- const task = server.schema.tasks.findBy({+ // Issue+ const issue = server.schema.issues.findBy({workspaceId: workspace2.id,});server.create("bookmark", {workspace: workspace2,- name: task.name,- link: `/task/${taskSlug(task.name, task.id)}`,+ name: issue.name,+ link: `/issue/${issueSlug(issue.name, issue.id)}`,creatorId: ws2DBA.id,});}@@ -766,7 +766,7 @@ const createInstanceList = (const createUpdateSchemaStage = (server: any,workspaceId: string,- taskId: TaskId,+ issueId: IssueId,creatorId: PrincipalId,environmentList: Environment[],databaseList: Database[],@@ -781,7 +781,7 @@ const createUpdateSchemaStage = (type: "bytebase.stage.schema.update",status: stageStatusList[i],databaseId: databaseList[i].id,- taskId,+ issueId,workspaceId,});@@ -791,7 +791,7 @@ const createUpdateSchemaStage = (name: "Waiting approval",type: "bytebase.step.approve",status: stepStatusList[i],- taskId,+ issueId,stage,workspaceId,});@@ -802,7 +802,7 @@ const createUpdateSchemaStage = (name: `Update ${databaseList[i].name} schema`,type: "bytebase.step.schema.udpate",status: stepStatusList[i],- taskId,+ issueId,stage,workspaceId,});diff --git a/frontend/src/plugins/index.ts b/frontend/src/plugins/index.tsindex c83069421f..c86ac25fba 100644--- a/frontend/src/plugins/index.ts+++ b/frontend/src/plugins/index.ts@@ -1,2 +1,2 @@-export * from "./task/template";+export * from "./issue/template";export * from "./types";diff --git a/frontend/src/plugins/task/DatabaseCreateTemplate.ts b/frontend/src/plugins/issue/DatabaseCreateTemplate.tssimilarity index 67%rename from frontend/src/plugins/task/DatabaseCreateTemplate.tsrename to frontend/src/plugins/issue/DatabaseCreateTemplate.tsindex 9333922278..6c7cba66d3 100644--- a/frontend/src/plugins/task/DatabaseCreateTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts@@ -1,20 +1,20 @@import isEmpty from "lodash-es/isEmpty";import {- TaskTemplate,+ IssueTemplate,TemplateContext,- TaskBuiltinFieldId,+ IssueBuiltinFieldId,OUTPUT_CUSTOM_FIELD_ID_BEGIN,- TaskContext,+ IssueContext,} from "../types";-import { TaskNew, UNKNOWN_ID } from "../../types";+import { IssueNew, UNKNOWN_ID } from "../../types";const OUTPUT_DATABASE_FIELD_ID = OUTPUT_CUSTOM_FIELD_ID_BEGIN;-const template: TaskTemplate = {+const template: IssueTemplate = {type: "bytebase.database.create",- buildTask: (ctx: TemplateContext): TaskNew => {+ buildIssue: (ctx: TemplateContext): IssueNew => {const payload: any = {};- payload[TaskBuiltinFieldId.DATABASE] = "";+ payload[IssueBuiltinFieldId.DATABASE] = "";return {name: "Request new db",@@ -42,37 +42,38 @@ const template: TaskTemplate = {fieldList: [{category: "INPUT",- id: TaskBuiltinFieldId.PROJECT,+ id: IssueBuiltinFieldId.PROJECT,slug: "project",name: "Project",type: "Project",required: true,- resolved: (ctx: TaskContext): boolean => {- const projectId = ctx.task.payload[TaskBuiltinFieldId.PROJECT];+ resolved: (ctx: IssueContext): boolean => {+ const projectId = ctx.issue.payload[IssueBuiltinFieldId.PROJECT];return !isEmpty(projectId);},},{category: "INPUT",- id: TaskBuiltinFieldId.ENVIRONMENT,+ id: IssueBuiltinFieldId.ENVIRONMENT,slug: "environment",name: "Environment",type: "Environment",required: true,- resolved: (ctx: TaskContext): boolean => {- const environmentId = ctx.task.payload[TaskBuiltinFieldId.ENVIRONMENT];+ resolved: (ctx: IssueContext): boolean => {+ const environmentId =+ ctx.issue.payload[IssueBuiltinFieldId.ENVIRONMENT];return !isEmpty(environmentId);},},{category: "INPUT",- id: TaskBuiltinFieldId.DATABASE,+ id: IssueBuiltinFieldId.DATABASE,slug: "database",name: "DB name",type: "NewDatabase",required: true,- resolved: (ctx: TaskContext): boolean => {- const databaseName = ctx.task.payload[TaskBuiltinFieldId.DATABASE];+ resolved: (ctx: IssueContext): boolean => {+ const databaseName = ctx.issue.payload[IssueBuiltinFieldId.DATABASE];return !isEmpty(databaseName);},placeholder: "New database name",@@ -85,12 +86,12 @@ const template: TaskTemplate = {type: "Database",required: true,// Returns true if it's set and matches the requested database name.- resolved: (ctx: TaskContext): boolean => {- const databaseId = ctx.task.payload[OUTPUT_DATABASE_FIELD_ID];+ resolved: (ctx: IssueContext): boolean => {+ const databaseId = ctx.issue.payload[OUTPUT_DATABASE_FIELD_ID];if (isEmpty(databaseId) || databaseId == UNKNOWN_ID) {return false;}- const requestedName = ctx.task.payload[TaskBuiltinFieldId.DATABASE];+ const requestedName = ctx.issue.payload[IssueBuiltinFieldId.DATABASE];const database = ctx.store.getters["database/databaseById"](databaseId);return database && database.name == requestedName;},diff --git a/frontend/src/plugins/task/DatabaseGrantTemplate.ts b/frontend/src/plugins/issue/DatabaseGrantTemplate.tssimilarity index 66%rename from frontend/src/plugins/task/DatabaseGrantTemplate.tsrename to frontend/src/plugins/issue/DatabaseGrantTemplate.tsindex d6aa2e01f0..8f721adba8 100644--- a/frontend/src/plugins/task/DatabaseGrantTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts@@ -1,19 +1,19 @@import isEmpty from "lodash-es/isEmpty";import {- TaskTemplate,+ IssueTemplate,TemplateContext,- TaskBuiltinFieldId,+ IssueBuiltinFieldId,INPUT_CUSTOM_FIELD_ID_BEGIN,- TaskContext,+ IssueContext,} from "../types";-import { TaskNew, EnvironmentId, UNKNOWN_ID, Task } from "../../types";+import { IssueNew, EnvironmentId, UNKNOWN_ID, Issue } from "../../types";import { allowDatabaseAccess } from "../../utils";const INPUT_READ_ONLY_FIELD_ID = INPUT_CUSTOM_FIELD_ID_BEGIN;-const template: TaskTemplate = {+const template: IssueTemplate = {type: "bytebase.database.grant",- buildTask: (ctx: TemplateContext): TaskNew => {+ buildIssue: (ctx: TemplateContext): IssueNew => {const payload: any = {};return {@@ -42,37 +42,38 @@ const template: TaskTemplate = {fieldList: [{category: "INPUT",- id: TaskBuiltinFieldId.PROJECT,+ id: IssueBuiltinFieldId.PROJECT,slug: "project",name: "Project",type: "Project",required: true,- resolved: (ctx: TaskContext): boolean => {- const projectId = ctx.task.payload[TaskBuiltinFieldId.PROJECT];+ resolved: (ctx: IssueContext): boolean => {+ const projectId = ctx.issue.payload[IssueBuiltinFieldId.PROJECT];return !isEmpty(projectId);},},{category: "INPUT",- id: TaskBuiltinFieldId.ENVIRONMENT,+ id: IssueBuiltinFieldId.ENVIRONMENT,slug: "environment",name: "Environment",type: "Environment",required: true,- resolved: (ctx: TaskContext): boolean => {- const environmentId = ctx.task.payload[TaskBuiltinFieldId.ENVIRONMENT];+ resolved: (ctx: IssueContext): boolean => {+ const environmentId =+ ctx.issue.payload[IssueBuiltinFieldId.ENVIRONMENT];return !isEmpty(environmentId);},},{category: "INPUT",- id: TaskBuiltinFieldId.DATABASE,+ id: IssueBuiltinFieldId.DATABASE,slug: "database",name: "Database",type: "Database",required: true,- resolved: (ctx: TaskContext): boolean => {- const databaseId = ctx.task.payload[TaskBuiltinFieldId.DATABASE];+ resolved: (ctx: IssueContext): boolean => {+ const databaseId = ctx.issue.payload[IssueBuiltinFieldId.DATABASE];return !isEmpty(databaseId) || databaseId == UNKNOWN_ID;},},@@ -83,7 +84,7 @@ const template: TaskTemplate = {name: "Read Only",type: "Boolean",required: true,- resolved: (ctx: TaskContext): boolean => {+ resolved: (ctx: IssueContext): boolean => {return true;},},@@ -91,16 +92,16 @@ const template: TaskTemplate = {category: "OUTPUT",// This is the same ID as the INPUT database field because the granted database should be the same// as the requested database.- id: TaskBuiltinFieldId.DATABASE,+ id: IssueBuiltinFieldId.DATABASE,slug: "database",name: "Granted database",type: "Database",required: true,- resolved: (ctx: TaskContext): boolean => {- const databaseId = ctx.task.payload[TaskBuiltinFieldId.DATABASE];+ resolved: (ctx: IssueContext): boolean => {+ const databaseId = ctx.issue.payload[IssueBuiltinFieldId.DATABASE];const database = ctx.store.getters["database/databaseById"](databaseId);- const creator = (ctx.task as Task).creator;- const type = ctx.task.payload[INPUT_READ_ONLY_FIELD_ID] ? "RO" : "RW";+ const creator = (ctx.issue as Issue).creator;+ const type = ctx.issue.payload[INPUT_READ_ONLY_FIELD_ID] ? "RO" : "RW";return allowDatabaseAccess(database, creator, type);},},diff --git a/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.tssimilarity index 82%rename from frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.tsrename to frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.tsindex f8880e9b62..9f5052fb91 100644--- a/frontend/src/plugins/task/DatabaseSchemaUpdateTemplate.ts+++ b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts@@ -1,17 +1,17 @@import isEmpty from "lodash-es/isEmpty";import {- TaskTemplate,+ IssueTemplate,TemplateContext,- TaskBuiltinFieldId,- TaskContext,+ IssueBuiltinFieldId,+ IssueContext,} from "../types";-import { Database, Stage, StageNew, TaskNew, UNKNOWN_ID } from "../../types";+import { Database, Stage, StageNew, IssueNew, UNKNOWN_ID } from "../../types";-const template: TaskTemplate = {+const template: IssueTemplate = {type: "bytebase.database.schema.update",- buildTask: (ctx: TemplateContext): TaskNew => {+ buildIssue: (ctx: TemplateContext): IssueNew => {const payload: any = {};return {name: "Change db",diff --git a/frontend/src/plugins/task/DefaultTemplate.ts b/frontend/src/plugins/issue/DefaultTemplate.tssimilarity index 58%rename from frontend/src/plugins/task/DefaultTemplate.tsrename to frontend/src/plugins/issue/DefaultTemplate.tsindex a575996fb7..b8d74c2a93 100644--- a/frontend/src/plugins/task/DefaultTemplate.ts+++ b/frontend/src/plugins/issue/DefaultTemplate.ts@@ -1,9 +1,9 @@-import { TaskNew, UNKNOWN_ID } from "../../types";-import { TaskTemplate, TemplateContext } from "../types";+import { IssueNew, UNKNOWN_ID } from "../../types";+import { IssueTemplate, TemplateContext } from "../types";-const template: TaskTemplate = {+const template: IssueTemplate = {type: "bytebase.general",- buildTask: (ctx: TemplateContext): TaskNew => {+ buildIssue: (ctx: TemplateContext): IssueNew => {return {name: "",type: "bytebase.general",diff --git a/frontend/src/plugins/task/template.ts b/frontend/src/plugins/issue/template.tssimilarity index 58%rename from frontend/src/plugins/task/template.tsrename to frontend/src/plugins/issue/template.tsindex 15660baf3a..8266462e79 100644--- a/frontend/src/plugins/task/template.ts+++ b/frontend/src/plugins/issue/template.ts@@ -1,29 +1,29 @@-import { TaskField, FieldId, TaskTemplate, UNKNOWN_FIELD } from "../types";-import { TaskType } from "../../types";+import { IssueField, FieldId, IssueTemplate, UNKNOWN_FIELD } from "../types";+import { IssueType } from "../../types";import DefaultTemplate from "./DefaultTemplate";import DatabaseCreateTemplate from "./DatabaseCreateTemplate";import DatabaseGrantTemplate from "./DatabaseGrantTemplate";import DatabaseSchemaUpdateTemplate from "./DatabaseSchemaUpdateTemplate";-const allTaskTemplateList: TaskTemplate[] = [+const allIssueTemplateList: IssueTemplate[] = [DefaultTemplate,DatabaseCreateTemplate,DatabaseGrantTemplate,DatabaseSchemaUpdateTemplate,];-export function defaulTemplate(): TaskTemplate {+export function defaulTemplate(): IssueTemplate {return DefaultTemplate;}-export function templateForType(type: TaskType): TaskTemplate | undefined {- return allTaskTemplateList.find((template) => template.type === type);+export function templateForType(type: IssueType): IssueTemplate | undefined {+ return allIssueTemplateList.find((template) => template.type === type);}export function fieldFromId(- template: TaskTemplate,+ template: IssueTemplate,fieldId: FieldId-): TaskField {+): IssueField {if (template.fieldList) {return (template.fieldList.find((field) => field.id == fieldId) || UNKNOWN_FIELDdiff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.tsindex 6fd503cf07..80bb0a791f 100644--- a/frontend/src/plugins/types.ts+++ b/frontend/src/plugins/types.ts@@ -2,18 +2,18 @@ import { Store } from "vuex";import {Environment,Principal,- TaskNew,- Task,+ IssueNew,+ Issue,DatabaseId,UNKNOWN_ID,Database,} from "../types";-// Task+// Issue// It has to be string type because the id for stage field contain multiple parts.export type FieldId = string;-export enum TaskBuiltinFieldId {+export enum IssueBuiltinFieldId {NAME = "1",STATUS = "2",ASSIGNEE = "3",@@ -33,7 +33,7 @@ export enum TaskBuiltinFieldId {export const INPUT_CUSTOM_FIELD_ID_BEGIN = "100";export const OUTPUT_CUSTOM_FIELD_ID_BEGIN = "200";-export type TaskFieldType =+export type IssueFieldType =| "Boolean"| "String"| "Environment"@@ -41,24 +41,24 @@ export type TaskFieldType =| "Database"| "NewDatabase";-export type TaskFieldReferenceProvider = {+export type IssueFieldReferenceProvider = {title: string;link: string;};-export type TaskFieldReferenceProviderContext = {- task: Task;- field: TaskField;+export type IssueFieldReferenceProviderContext = {+ issue: Issue;+ field: IssueField;};-export type TaskContext = {+export type IssueContext = {store: Store<any>;currentUser: Principal;new: boolean;- task: Task | TaskNew;+ issue: Issue | IssueNew;};-export type TaskField = {+export type IssueField = {category: "INPUT" | "OUTPUT";// Used as the key to store the data. This must NOT be changed after// in use, otherwise, it will cause data loss/corruption. Its design@@ -74,18 +74,18 @@ export type TaskField = {// The display name. OK to change.name: string;// Field type. This must NOT be changed after in use. Similar to id field.- type: TaskFieldType;+ type: IssueFieldType;// Whether the field is required.required: boolean;// Whether the field is resolved.// For INPUT, one use case is together with "required" field to validate whether it's ready to submit the data.- // For OUTPUT, one use case is to validate whether the field is filled properly according to the task.- resolved: (ctx: TaskContext) => boolean;+ // For OUTPUT, one use case is to validate whether the field is filled properly according to the issue.+ resolved: (ctx: IssueContext) => boolean;// Placeholder displayed on UI.placeholder?: string;};-export const UNKNOWN_FIELD: TaskField = {+export const UNKNOWN_FIELD: IssueField = {category: "INPUT",id: UNKNOWN_ID,slug: "",@@ -111,8 +111,8 @@ export type TemplateContext = {currentUser: Principal;};-export type TaskTemplate = {+export type IssueTemplate = {type: string;- buildTask: (ctx: TemplateContext) => TaskNew;- fieldList: TaskField[];+ buildIssue: (ctx: TemplateContext) => IssueNew;+ fieldList: IssueField[];};diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.tsindex acbbb35578..023c749dc5 100644--- a/frontend/src/router/index.ts+++ b/frontend/src/router/index.ts@@ -506,20 +506,20 @@ const routes: Array<RouteRecordRaw> = [],},{- path: "task/:taskSlug",- name: "workspace.task.detail",+ path: "issue/:issueSlug",+ name: "workspace.issue.detail",meta: {title: (route: RouteLocationNormalized) => {- const slug = route.params.taskSlug as string;+ const slug = route.params.issueSlug as string;if (slug.toLowerCase() == "new") {return "New";}- return store.getters["task/taskById"](idFromSlug(slug)).name;+ return store.getters["issue/issueById"](idFromSlug(slug)).name;},allowBookmark: true,},components: {- content: () => import("../views/TaskDetail.vue"),+ content: () => import("../views/IssueDetail.vue"),leftSidebar: DashboardSidebar,},props: { content: true },@@ -657,7 +657,7 @@ router.beforeEach((to, from, next) => {const routerSlug = store.getters["router/routeSlug"](to);const environmentSlug = routerSlug.environmentSlug;const projectSlug = routerSlug.projectSlug;- const taskSlug = routerSlug.taskSlug;+ const issueSlug = routerSlug.issueSlug;const instanceSlug = routerSlug.instanceSlug;const databaseSlug = routerSlug.databaseSlug;const dataSourceSlug = routerSlug.dataSourceSlug;@@ -693,14 +693,14 @@ router.beforeEach((to, from, next) => {return;}- if (taskSlug) {- if (taskSlug.toLowerCase() == "new") {+ if (issueSlug) {+ if (issueSlug.toLowerCase() == "new") {next();return;}store- .dispatch("task/fetchTaskById", idFromSlug(taskSlug))- .then((task) => {+ .dispatch("issue/fetchIssueById", idFromSlug(issueSlug))+ .then((issue) => {next();}).catch((error) => {diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.tsindex 72dbcfde3a..ca2198dde6 100644--- a/frontend/src/store/index.ts+++ b/frontend/src/store/index.ts@@ -13,7 +13,7 @@ import database from "./modules/database";import principal from "./modules/principal";import plan from "./modules/plan";import auth from "./modules/auth";-import task from "./modules/task";+import issue from "./modules/issue";import stage from "./modules/stage";import step from "./modules/step";@@ -41,7 +41,7 @@ export const store: Store<any> = createStore({principal,plan,auth,- task,+ issue,stage,step,uistate,diff --git a/frontend/src/store/modules/activity.ts b/frontend/src/store/modules/activity.tsindex ae1545358f..80cb0c59d7 100644--- a/frontend/src/store/modules/activity.ts+++ b/frontend/src/store/modules/activity.ts@@ -1,7 +1,7 @@import axios from "axios";import {UserId,- TaskId,+ IssueId,ActivityId,Activity,ActivityNew,@@ -28,7 +28,7 @@ function convert(activity: ResourceObject, rootGetters: any): Activity {const state: () => ActivityState = () => ({activityListByUser: new Map(),- activityListByTask: new Map(),+ activityListByIssue: new Map(),});const getters = {@@ -37,10 +37,10 @@ const getters = {): Activity[] => {return state.activityListByUser.get(userId) || [];},- activityListByTask: (state: ActivityState) => (- taskId: TaskId+ activityListByIssue: (state: ActivityState) => (+ issueId: IssueId): Activity[] => {- return state.activityListByTask.get(taskId) || [];+ return state.activityListByIssue.get(issueId) || [];},};@@ -56,14 +56,17 @@ const actions = {return activityList;},- async fetchActivityListForTask({ commit, rootGetters }: any, taskId: TaskId) {+ async fetchActivityListForIssue(+ { commit, rootGetters }: any,+ issueId: IssueId+ ) {const activityList = (- await axios.get(`/api/activity?container=${taskId}&type=bytebase.task.`)+ await axios.get(`/api/activity?container=${issueId}&type=bytebase.issue.`)).data.data.map((activity: ResourceObject) => {return convert(activity, rootGetters);});- commit("setActivityListForTask", { taskId, activityList });+ commit("setActivityListForIssue", { issueId, activityList });return activityList;},@@ -84,8 +87,8 @@ const actions = {);// There might exist other activities happened since the last fetch, so we do a full refetch.- if (newActivity.actionType.startsWith("bytebase.task.")) {- dispatch("fetchActivityListForTask", newActivity.containerId);+ if (newActivity.actionType.startsWith("bytebase.issue.")) {+ dispatch("fetchActivityListForIssue", newActivity.containerId);}return createdActivity;@@ -119,7 +122,7 @@ const actions = {rootGetters);- dispatch("fetchActivityListForTask", updatedActivity.containerId);+ dispatch("fetchActivityListForIssue", updatedActivity.containerId);return updatedActivity;},@@ -127,8 +130,8 @@ const actions = {async deleteActivity({ dispatch }: any, activity: Activity) {await axios.delete(`/api/activity/${activity.id}`);- if (activity.actionType.startsWith("bytebase.task.")) {- dispatch("fetchActivityListForTask", activity.containerId);+ if (activity.actionType.startsWith("bytebase.issue.")) {+ dispatch("fetchActivityListForIssue", activity.containerId);}},};@@ -147,17 +150,17 @@ const mutations = {state.activityListByUser.set(userId, activityList);},- setActivityListForTask(+ setActivityListForIssue(state: ActivityState,{- taskId,+ issueId,activityList,}: {- taskId: UserId;+ issueId: UserId;activityList: Activity[];}) {- state.activityListByTask.set(taskId, activityList);+ state.activityListByIssue.set(issueId, activityList);},};diff --git a/frontend/src/store/modules/dataSource.ts b/frontend/src/store/modules/dataSource.tsindex fc58f36a51..22be1dff5c 100644--- a/frontend/src/store/modules/dataSource.ts+++ b/frontend/src/store/modules/dataSource.ts@@ -35,7 +35,7 @@ function convert((item: any): DataSourceMember => {return {principal: rootGetters["principal/principalById"](item.principalId),- taskId: item.taskId,+ issueId: item.issueId,createdTs: item.createdTs,};}diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.tsindex fde1470edf..dfff831a93 100644--- a/frontend/src/store/modules/database.ts+++ b/frontend/src/store/modules/database.ts@@ -183,7 +183,7 @@ const actions = {// Unlike other list fetch, we don't fetch the data source here.// As the sole purpose for the fetch here is to prepare the database info// itself (in particular the environment name, database name and project name)- // to be displayed in the task list on the home page.+ // to be displayed in the issue list on the home page.// The data source contains sensitive connection credentials so we shouldn't// return it unconditionally.const data = (diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.tsnew file mode 100644index 0000000000..4a40c1e846--- /dev/null+++ b/frontend/src/store/modules/issue.ts@@ -0,0 +1,276 @@+import axios from "axios";+import {+ UserId,+ IssueId,+ Issue,+ IssueNew,+ IssuePatch,+ IssueState,+ ResourceObject,+ Principal,+ unknown,+ Project,+ ResourceIdentifier,+ ProjectId,+ Stage,+ IssueStatusPatch,+} from "../../types";++function convert(+ issue: ResourceObject,+ includedList: ResourceObject[],+ rootGetters: any+): Issue {+ const creator = rootGetters["principal/principalById"](+ issue.attributes.creatorId+ );+ const updater = rootGetters["principal/principalById"](+ issue.attributes.updaterId+ );++ let assignee = undefined;+ if (issue.attributes.assigneeId) {+ assignee = rootGetters["principal/principalById"](+ issue.attributes.assigneeId+ );+ }++ const subscriberList = (issue.attributes.subscriberIdList as Principal[]).map(+ (principalId) => {+ return rootGetters["principal/principalById"](principalId);+ }+ );++ const projectId = (issue.relationships!.project.data as ResourceIdentifier)+ .id;+ let project: Project = unknown("PROJECT") as Project;+ project.id = projectId;++ const stageList: Stage[] = [];+ for (const item of includedList || []) {+ if (+ item.type == "stage" &&+ (item.relationships!.issue.data as ResourceIdentifier).id == issue.id+ ) {+ const stage: Stage = rootGetters["stage/convertPartial"](+ item,+ includedList+ );+ stageList.push(stage);+ }++ if (+ item.type == "project" &&+ (item.relationships!.issue.data as ResourceIdentifier[]).find(+ (item) => item.id == issue.id+ )+ ) {+ project = rootGetters["project/convert"](item);+ }+ }++ const result: Issue = {+ ...(issue.attributes as Omit<+ Issue,+ | "id"+ | "project"+ | "creator"+ | "updater"+ | "assignee"+ | "subscriberList"+ | "stageList"+ >),+ id: issue.id,+ project,+ creator,+ updater,+ assignee,+ subscriberList,+ stageList,+ };++ // Now we have a complate issue, we assign it back to stage and step+ for (const stage of result.stageList) {+ stage.issue = result;+ for (const step of stage.stepList) {+ step.issue = result;+ step.stage = stage;+ }+ }++ return result;+}++const state: () => IssueState = () => ({+ issueListByUser: new Map(),+ issueById: new Map(),+});++const getters = {+ issueListByUser: (state: IssueState) => (userId: UserId) => {+ return state.issueListByUser.get(userId) || [];+ },++ issueById: (state: IssueState) => (issueId: IssueId): Issue => {+ return state.issueById.get(issueId) || (unknown("ISSUE") as Issue);+ },+};++const actions = {+ async fetchIssueListForUser({ commit, rootGetters }: any, userId: UserId) {+ const data = (+ await axios.get(`/api/issue?user=${userId}&include=project,stage,step`)+ ).data;+ const issueList = data.data.map((issue: ResourceObject) => {+ return convert(issue, data.included, rootGetters);+ });++ commit("setIssueListForUser", { userId, issueList });+ console.log(issueList);+ return issueList;+ },++ async fetchIssueListForProject({ rootGetters }: any, projectId: ProjectId) {+ const data = (+ await axios.get(+ `/api/issue?project=${projectId}&include=project,stage,step`+ )+ ).data;+ const issueList = data.data.map((issue: ResourceObject) => {+ return convert(issue, data.included, rootGetters);+ });++ // The caller consumes directly, so we don't store it.+ return issueList;+ },++ async fetchIssueById({ commit, rootGetters }: any, issueId: IssueId) {+ const data = (+ await axios.get(`/api/issue/${issueId}?include=project,stage,step`)+ ).data;+ const issue = convert(data.data, data.included, rootGetters);+ commit("setIssueById", {+ issueId,+ issue,+ });+ return issue;+ },++ async createIssue({ commit, rootGetters }: any, newIssue: IssueNew) {+ const data = (+ await axios.post(`/api/issue?include=project,stage,step`, {+ data: {+ type: "issuenew",+ attributes: newIssue,+ },+ })+ ).data;+ const createdIssue = convert(data.data, data.included, rootGetters);++ commit("setIssueById", {+ issueId: createdIssue.id,+ issue: createdIssue,+ });++ return createdIssue;+ },++ async patchIssue(+ { commit, dispatch, rootGetters }: any,+ {+ issueId,+ issuePatch,+ }: {+ issueId: IssueId;+ issuePatch: IssuePatch;+ }+ ) {+ const data = (+ await axios.patch(`/api/issue/${issueId}?include=project,stage,step`, {+ data: {+ type: "issuepatch",+ attributes: issuePatch,+ },+ })+ ).data;+ const updatedIssue = convert(data.data, data.included, rootGetters);++ commit("setIssueById", {+ issueId: issueId,+ issue: updatedIssue,+ });++ dispatch("activity/fetchActivityListForIssue", issueId, { root: true });++ return updatedIssue;+ },++ async updateIssueStatus(+ { commit, dispatch, rootGetters }: any,+ {+ issueId,+ issueStatusPatch,+ }: {+ issueId: IssueId;+ issueStatusPatch: IssueStatusPatch;+ }+ ) {+ const data = (+ await axios.patch(+ `/api/issue/${issueId}/status?include=project,stage,step`,+ {+ data: {+ type: "issuestatuspatch",+ attributes: issueStatusPatch,+ },+ }+ )+ ).data;+ const updatedIssue = convert(data.data, data.included, rootGetters);++ commit("setIssueById", {+ issueId: issueId,+ issue: updatedIssue,+ });++ dispatch("activity/fetchActivityListForIssue", issueId, { root: true });++ return updatedIssue;+ },+};++const mutations = {+ setIssueListForUser(+ state: IssueState,+ {+ userId,+ issueList,+ }: {+ userId: UserId;+ issueList: Issue[];+ }+ ) {+ state.issueListByUser.set(userId, issueList);+ },++ setIssueById(+ state: IssueState,+ {+ issueId,+ issue,+ }: {+ issueId: IssueId;+ issue: Issue;+ }+ ) {+ state.issueById.set(issueId, issue);+ },+};++export default {+ namespaced: true,+ state,+ getters,+ actions,+ mutations,+};diff --git a/frontend/src/store/modules/router.ts b/frontend/src/store/modules/router.tsindex 707fbb59b9..9a5d9d2c5b 100644--- a/frontend/src/store/modules/router.ts+++ b/frontend/src/store/modules/router.ts@@ -13,7 +13,7 @@ const getters = {): RouterSlug => {{// /environment/:environmentSlug- // Total 2 elements, 2nd element is the task slug+ // Total 2 elements, 2nd element is the issue slugconst environmentComponents = currentRoute.path.match("/environment/([0-9a-zA-Z_-]+)") || ["/", undefined];@@ -38,14 +38,14 @@ const getters = {}{- // /task/:taskSlug- // Total 2 elements, 2nd element is the task slug- const taskComponents = currentRoute.path.match(- "/task/([0-9a-zA-Z_-]+)"+ // /issue/:issueSlug+ // Total 2 elements, 2nd element is the issue slug+ const issueComponents = currentRoute.path.match(+ "/issue/([0-9a-zA-Z_-]+)") || ["/", undefined];- if (taskComponents[1]) {+ if (issueComponents[1]) {return {- taskSlug: taskComponents[1],+ issueSlug: issueComponents[1],};}}diff --git a/frontend/src/store/modules/stage.ts b/frontend/src/store/modules/stage.tsindex 3c775dafee..34cb35e3ea 100644--- a/frontend/src/store/modules/stage.ts+++ b/frontend/src/store/modules/stage.ts@@ -8,8 +8,8 @@ import {StageState,StageStatusPatch,Step,- Task,- TaskId,+ Issue,+ IssueId,unknown,} from "../../types";@@ -19,7 +19,7 @@ function convertPartial(stage: ResourceObject,includedList: ResourceObject[],rootGetters: any-): Omit<Stage, "task"> {+): Omit<Stage, "issue"> {const creator = rootGetters["principal/principalById"](stage.attributes.creatorId);@@ -42,10 +42,10 @@ function convertPartial(}}- const result: Omit<Stage, "task"> = {+ const result: Omit<Stage, "issue"> = {...(stage.attributes as Omit<Stage,- "id" | "creator" | "updater" | "task" | "database" | "stepList"+ "id" | "creator" | "updater" | "issue" | "database" | "stepList">),id: stage.id,creator,@@ -64,19 +64,19 @@ const getters = {rootState: any,rootGetters: any) => (stage: ResourceObject, includedList: ResourceObject[]): Stage => {- // It's only called when task tries to convert itself, so we don't have a task yet.- const taskId = stage.attributes.taskId as TaskId;- let task: Task = unknown("TASK") as Task;- task.id = taskId;+ // It's only called when issue tries to convert itself, so we don't have a issue yet.+ const issueId = stage.attributes.issueId as IssueId;+ let issue: Issue = unknown("ISSUE") as Issue;+ issue.id = issueId;const result: Stage = {...convertPartial(stage, includedList, rootGetters),- task,+ issue,};for (const step of result.stepList) {step.stage = result;- step.task = task;+ step.issue = issue;}return result;@@ -85,17 +85,17 @@ const getters = {async updateStageStatus({ dispatch }: any,{- taskId,+ issueId,stageId,stageStatusPatch,}: {- taskId: TaskId;+ issueId: IssueId;stageId: StageId;stageStatusPatch: StageStatusPatch;}) {const data = (- await axios.patch(`/api/task/${taskId}/stage/${stageId}/status`, {+ await axios.patch(`/api/issue/${issueId}/stage/${stageId}/status`, {data: {type: "stagestatuspatch",attributes: stageStatusPatch,@@ -103,7 +103,7 @@ const getters = {})).data;- dispatch("task/fetchTaskById", taskId, { root: true });+ dispatch("issue/fetchIssueById", issueId, { root: true });},};diff --git a/frontend/src/store/modules/step.ts b/frontend/src/store/modules/step.tsindex 7c09216842..84dc6405e1 100644--- a/frontend/src/store/modules/step.ts+++ b/frontend/src/store/modules/step.ts@@ -3,10 +3,10 @@ import {ResourceObject,StepState,Step,- Task,+ Issue,Stage,unknown,- TaskId,+ IssueId,StageId,} from "../../types";@@ -15,7 +15,7 @@ const state: () => StepState = () => ({});function convertPartial(step: ResourceObject,rootGetters: any-): Omit<Step, "task" | "stage"> {+): Omit<Step, "issue" | "stage"> {const creator = rootGetters["principal/principalById"](step.attributes.creatorId);@@ -26,7 +26,7 @@ function convertPartial(return {...(step.attributes as Omit<Step,- "id" | "creator" | "updater" | "task" | "stage"+ "id" | "creator" | "updater" | "issue" | "stage">),id: step.id,creator,@@ -35,11 +35,11 @@ function convertPartial(}function convert(step: ResourceObject, rootGetters: any): Step {- const task: Task = rootGetters["task/taskById"](step.attributes.taskId);+ const issue: Issue = rootGetters["issue/issueById"](step.attributes.issueId);const stage: Stage = rootGetters["stage/stageById"](step.attributes.stageId);return {...convertPartial(step, rootGetters),- task,+ issue,stage,};}@@ -51,10 +51,10 @@ const getters = {rootState: any,rootGetters: any) => (step: ResourceObject): Step => {- // It's only called when task/stage tries to convert themselves, so we don't have a task/stage yet.- const taskId = step.attributes.taskId as TaskId;- let task: Task = unknown("TASK") as Task;- task.id = taskId;+ // It's only called when issue/stage tries to convert themselves, so we don't have a issue/stage yet.+ const issueId = step.attributes.issueId as IssueId;+ let issue: Issue = unknown("ISSUE") as Issue;+ issue.id = issueId;const stageId = step.attributes.stageId as StageId;let stage: Stage = unknown("STAGE") as Stage;@@ -62,7 +62,7 @@ const getters = {return {...convertPartial(step, rootGetters),- task,+ issue,stage,};},diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.tsdeleted file mode 100644index ce61e5238d..0000000000--- a/frontend/src/store/modules/task.ts+++ /dev/null@@ -1,275 +0,0 @@-import axios from "axios";-import {- UserId,- TaskId,- Task,- TaskNew,- TaskPatch,- TaskState,- ResourceObject,- Principal,- unknown,- Project,- ResourceIdentifier,- ProjectId,- Stage,- TaskStatusPatch,-} from "../../types";--function convert(- task: ResourceObject,- includedList: ResourceObject[],- rootGetters: any-): Task {- const creator = rootGetters["principal/principalById"](- task.attributes.creatorId- );- const updater = rootGetters["principal/principalById"](- task.attributes.updaterId- );-- let assignee = undefined;- if (task.attributes.assigneeId) {- assignee = rootGetters["principal/principalById"](- task.attributes.assigneeId- );- }-- const subscriberList = (task.attributes.subscriberIdList as Principal[]).map(- (principalId) => {- return rootGetters["principal/principalById"](principalId);- }- );-- const projectId = (task.relationships!.project.data as ResourceIdentifier).id;- let project: Project = unknown("PROJECT") as Project;- project.id = projectId;-- const stageList: Stage[] = [];- for (const item of includedList || []) {- if (- item.type == "stage" &&- (item.relationships!.task.data as ResourceIdentifier).id == task.id- ) {- const stage: Stage = rootGetters["stage/convertPartial"](- item,- includedList- );- stageList.push(stage);- }-- if (- item.type == "project" &&- (item.relationships!.task.data as ResourceIdentifier[]).find(- (item) => item.id == task.id- )- ) {- project = rootGetters["project/convert"](item);- }- }-- const result: Task = {- ...(task.attributes as Omit<- Task,- | "id"- | "project"- | "creator"- | "updater"- | "assignee"- | "subscriberList"- | "stageList"- >),- id: task.id,- project,- creator,- updater,- assignee,- subscriberList,- stageList,- };-- // Now we have a complate task, we assign it back to stage and step- for (const stage of result.stageList) {- stage.task = result;- for (const step of stage.stepList) {- step.task = result;- step.stage = stage;- }- }-- return result;-}--const state: () => TaskState = () => ({- taskListByUser: new Map(),- taskById: new Map(),-});--const getters = {- taskListByUser: (state: TaskState) => (userId: UserId) => {- return state.taskListByUser.get(userId) || [];- },-- taskById: (state: TaskState) => (taskId: TaskId): Task => {- return state.taskById.get(taskId) || (unknown("TASK") as Task);- },-};--const actions = {- async fetchTaskListForUser({ commit, rootGetters }: any, userId: UserId) {- const data = (- await axios.get(`/api/task?user=${userId}&include=project,stage,step`)- ).data;- const taskList = data.data.map((task: ResourceObject) => {- return convert(task, data.included, rootGetters);- });-- commit("setTaskListForUser", { userId, taskList });- console.log(taskList);- return taskList;- },-- async fetchTaskListForProject({ rootGetters }: any, projectId: ProjectId) {- const data = (- await axios.get(- `/api/task?project=${projectId}&include=project,stage,step`- )- ).data;- const taskList = data.data.map((task: ResourceObject) => {- return convert(task, data.included, rootGetters);- });-- // The caller consumes directly, so we don't store it.- return taskList;- },-- async fetchTaskById({ commit, rootGetters }: any, taskId: TaskId) {- const data = (- await axios.get(`/api/task/${taskId}?include=project,stage,step`)- ).data;- const task = convert(data.data, data.included, rootGetters);- commit("setTaskById", {- taskId,- task,- });- return task;- },-- async createTask({ commit, rootGetters }: any, newTask: TaskNew) {- const data = (- await axios.post(`/api/task?include=project,stage,step`, {- data: {- type: "tasknew",- attributes: newTask,- },- })- ).data;- const createdTask = convert(data.data, data.included, rootGetters);-- commit("setTaskById", {- taskId: createdTask.id,- task: createdTask,- });-- return createdTask;- },-- async patchTask(- { commit, dispatch, rootGetters }: any,- {- taskId,- taskPatch,- }: {- taskId: TaskId;- taskPatch: TaskPatch;- }- ) {- const data = (- await axios.patch(`/api/task/${taskId}?include=project,stage,step`, {- data: {- type: "taskpatch",- attributes: taskPatch,- },- })- ).data;- const updatedTask = convert(data.data, data.included, rootGetters);-- commit("setTaskById", {- taskId: taskId,- task: updatedTask,- });-- dispatch("activity/fetchActivityListForTask", taskId, { root: true });-- return updatedTask;- },-- async updateTaskStatus(- { commit, dispatch, rootGetters }: any,- {- taskId,- taskStatusPatch,- }: {- taskId: TaskId;- taskStatusPatch: TaskStatusPatch;- }- ) {- const data = (- await axios.patch(- `/api/task/${taskId}/status?include=project,stage,step`,- {- data: {- type: "taskstatuspatch",- attributes: taskStatusPatch,- },- }- )- ).data;- const updatedTask = convert(data.data, data.included, rootGetters);-- commit("setTaskById", {- taskId: taskId,- task: updatedTask,- });-- dispatch("activity/fetchActivityListForTask", taskId, { root: true });-- return updatedTask;- },-};--const mutations = {- setTaskListForUser(- state: TaskState,- {- userId,- taskList,- }: {- userId: UserId;- taskList: Task[];- }- ) {- state.taskListByUser.set(userId, taskList);- },-- setTaskById(- state: TaskState,- {- taskId,- task,- }: {- taskId: TaskId;- task: Task;- }- ) {- state.taskById.set(taskId, task);- },-};--export default {- namespaced: true,- state,- getters,- actions,- mutations,-};diff --git a/frontend/src/types/bytebase.ts b/frontend/src/types/bytebase.tsindex 7dfb3f7557..7d3bfbf40d 100644--- a/frontend/src/types/bytebase.ts+++ b/frontend/src/types/bytebase.ts@@ -21,7 +21,7 @@ export type ResourceType =| "INSTANCE"| "DATABASE"| "DATA_SOURCE"- | "TASK"+ | "ISSUE"| "STAGE"| "STEP"| "ACTIVITY"@@ -42,7 +42,7 @@ export const unknown = (| Instance| Database| DataSource- | Task+ | Issue| Stage| Step| Activity@@ -157,14 +157,14 @@ export const unknown = (type: "RO",};- const UNKNOWN_TASK: Task = {+ const UNKNOWN_ISSUE: Issue = {id: UNKNOWN_ID,creator: UNKNOWN_PRINCIPAL,createdTs: 0,updater: UNKNOWN_PRINCIPAL,updatedTs: 0,project: UNKNOWN_PROJECT,- name: "<<Unknown task>>",+ name: "<<Unknown issue>>",status: "OPEN",type: "bytebase.general",description: "",@@ -182,14 +182,14 @@ export const unknown = (name: "<<Unknown stage>>",type: "bytebase.stage.unknown",status: "PENDING",- task: UNKNOWN_TASK,+ issue: UNKNOWN_ISSUE,database: UNKNOWN_DATABASE,stepList: [],};const UNKNOWN_STEP: Step = {id: UNKNOWN_ID,- task: UNKNOWN_TASK,+ issue: UNKNOWN_ISSUE,stage: UNKNOWN_STAGE,creator: UNKNOWN_PRINCIPAL,createdTs: 0,@@ -205,7 +205,7 @@ export const unknown = (containerId: UNKNOWN_ID,createdTs: 0,updatedTs: 0,- actionType: "bytebase.task.create",+ actionType: "bytebase.issue.create",creator: UNKNOWN_PRINCIPAL,updater: UNKNOWN_PRINCIPAL,comment: "<<Unknown comment>>",@@ -218,7 +218,7 @@ export const unknown = (createdTs: 0,updater: UNKNOWN_PRINCIPAL,updatedTs: 0,- type: "bb.msg.task.assign",+ type: "bb.msg.issue.assign",status: "DELIVERED",description: "",receiver: UNKNOWN_PRINCIPAL,@@ -255,8 +255,8 @@ export const unknown = (return UNKNOWN_DATABASE;case "DATA_SOURCE":return UNKNOWN_DATA_SOURCE;- case "TASK":- return UNKNOWN_TASK;+ case "ISSUE":+ return UNKNOWN_ISSUE;case "STAGE":return UNKNOWN_STAGE;case "STEP":@@ -279,14 +279,14 @@ export const FINAL_STAGE: Stage = {name: "Final stage",type: "bytebase.stage.final",status: "PENDING",- task: unknown("TASK") as Task,+ issue: unknown("ISSUE") as Issue,database: unknown("DATABASE") as Database,stepList: [],};export const FINAL_STEP: Step = {id: "0",- task: unknown("TASK") as Task,+ issue: unknown("ISSUE") as Issue,stage: FINAL_STAGE,creator: unknown("PRINCIPAL") as Principal,createdTs: 0,@@ -313,7 +313,7 @@ export type BookmarkId = string;export type ProjectId = string;-export type TaskId = string;+export type IssueId = string;export type StageId = string;@@ -335,9 +335,9 @@ export type CommandId = string;export type CommandRegisterId = string;// This references to the object id, which can be used as a container.-// Currently, only task can be used a container.+// Currently, only issue can be used a container.// The type is used by Activity and Message-export type ContainerId = TaskId;+export type ContainerId = IssueId;export type BatchUpdate = {updaterId: PrincipalId;@@ -556,17 +556,17 @@ export type ProjectPatch = {key?: string;};-// Task, Stage, Step are the backbones of execution.+// Issue, Stage, Step are the backbones of execution.//-// A TASK consists of multiple STAGES. A STAGE consists of multiple STEPS.+// A ISSUE consists of multiple STAGES. A STAGE consists of multiple STEPS.//// Comparison with GitLab:-// TASK = GitLab Pipeline+// ISSUE = GitLab Pipeline// STAGE = GitLab Stage// STEP = GitLab Job//// Comparison with Octopus:-// TASK = Octopus Lifecycle+// ISSUE = Octopus Lifecycle// STAGE = Octopus Phase// STEP = Octopus Step@@ -577,7 +577,7 @@ export type ProjectPatch = {/*An example- An alter schema TASK+ An alter schema ISSUEDev STAGE (db_dev, env_dev)Change dev database schema@@ -594,24 +594,27 @@ export type ProjectPatch = {Change prod database schema*/-// Task-type TaskTypeGeneral = "bytebase.general";+// Issue+type IssueTypeGeneral = "bytebase.general";-type TaskTypeDatabase =+type IssueTypeDatabase =| "bytebase.database.create"| "bytebase.database.grant"| "bytebase.database.schema.update";-type TaskTypeDataSource = "bytebase.data-source.request";+type IssueTypeDataSource = "bytebase.data-source.request";-export type TaskType = TaskTypeGeneral | TaskTypeDatabase | TaskTypeDataSource;+export type IssueType =+ | IssueTypeGeneral+ | IssueTypeDatabase+ | IssueTypeDataSource;-export type TaskStatus = "OPEN" | "DONE" | "CANCELED";+export type IssueStatus = "OPEN" | "DONE" | "CANCELED";-export type TaskPayload = { [key: string]: any };+export type IssuePayload = { [key: string]: any };-export type Task = {- id: TaskId;+export type Issue = {+ id: IssueId;// Related fieldsproject: Project;@@ -625,17 +628,17 @@ export type Task = {// Domain specific fieldsname: string;- status: TaskStatus;- type: TaskType;+ status: IssueStatus;+ type: IssueType;description: string;assignee?: Principal;subscriberList: Principal[];sql?: string;rollbackSql?: string;- payload: TaskPayload;+ payload: IssuePayload;};-export type TaskNew = {+export type IssueNew = {// Related fieldsstageList: StageNew[];@@ -644,16 +647,16 @@ export type TaskNew = {// Domain specific fieldsname: string;- type: TaskType;+ type: IssueType;description: string;assigneeId?: PrincipalId;subscriberIdList: PrincipalId[];sql?: string;rollbackSql?: string;- payload: TaskPayload;+ payload: IssuePayload;};-export type TaskPatch = {+export type IssuePatch = {// Related fieldsprojectId?: ProjectId;@@ -667,29 +670,29 @@ export type TaskPatch = {sql?: string;rollbackSql?: string;assigneeId?: PrincipalId;- payload?: TaskPayload;+ payload?: IssuePayload;};-export type TaskStatusPatch = {+export type IssueStatusPatch = {// Standard fieldsupdaterId: PrincipalId;// Domain specific fields- status: TaskStatus;+ status: IssueStatus;comment?: string;};-export type TaskStatusTransitionType = "NEXT" | "RESOLVE" | "ABORT" | "REOPEN";+export type IssueStatusTransitionType = "NEXT" | "RESOLVE" | "ABORT" | "REOPEN";-export interface TaskStatusTransition {- type: TaskStatusTransitionType;+export interface IssueStatusTransition {+ type: IssueStatusTransitionType;actionName: string;- to: TaskStatus;+ to: IssueStatus;}-export const TASK_STATUS_TRANSITION_LIST: Map<- TaskStatusTransitionType,- TaskStatusTransition+export const ISSUE_STATUS_TRANSITION_LIST: Map<+ IssueStatusTransitionType,+ IssueStatusTransition> = new Map([["NEXT",@@ -728,8 +731,8 @@ export const TASK_STATUS_TRANSITION_LIST: Map<// The first transition in the list is the primary action and the rests are// the normal action. For now there are at most 1 primary 1 normal action.export const CREATOR_APPLICABLE_ACTION_LIST: Map<- TaskStatus,- TaskStatusTransitionType[]+ IssueStatus,+ IssueStatusTransitionType[]> = new Map([["OPEN", ["ABORT"]],["DONE", ["REOPEN"]],@@ -737,8 +740,8 @@ export const CREATOR_APPLICABLE_ACTION_LIST: Map<]);export const ASSIGNEE_APPLICABLE_ACTION_LIST: Map<- TaskStatus,- TaskStatusTransitionType[]+ IssueStatus,+ IssueStatusTransitionType[]> = new Map([["OPEN", ["NEXT", "RESOLVE", "ABORT"]],["DONE", ["REOPEN"]],@@ -768,7 +771,7 @@ export type Stage = {// Related fieldsstepList: Step[];- task: Task;+ issue: Issue;database: Database;// Standard fields@@ -872,7 +875,7 @@ export type Step = {id: StepId;// Related fields- task: Task;+ issue: Issue;stage: Stage;// Standard fields@@ -903,16 +906,16 @@ export type StepPatch = {};// Activity-export type TaskActionType =- | "bytebase.task.create"- | "bytebase.task.comment.create"- | "bytebase.task.field.update"- | "bytebase.task.status.update"- | "bytebase.task.stage.status.update";+export type IssueActionType =+ | "bytebase.issue.create"+ | "bytebase.issue.comment.create"+ | "bytebase.issue.field.update"+ | "bytebase.issue.status.update"+ | "bytebase.issue.stage.status.update";-export type ActionType = TaskActionType;+export type ActionType = IssueActionType;-export type ActionTaskFieldUpdatePayload = {+export type ActionIssueFieldUpdatePayload = {changeList: {fieldId: FieldId;oldValue?: string;@@ -920,14 +923,14 @@ export type ActionTaskFieldUpdatePayload = {}[];};-export type ActionPayloadType = ActionTaskFieldUpdatePayload;+export type ActionPayloadType = ActionIssueFieldUpdatePayload;export type Activity = {id: ActivityId;// Related fields// The object where this activity belongs- // e.g if actionType is "bytebase.task.xxx", then this field refers to the corresponding task's id.+ // e.g if actionType is "bytebase.issue.xxx", then this field refers to the corresponding issue's id.containerId: ContainerId;// Standard fields@@ -991,17 +994,17 @@ export type InstanceMessageType =| "bb.msg.instance.archive"| "bb.msg.instance.restore";-export type TaskMessageType =- | "bb.msg.task.assign"- | "bb.msg.task.status.update"- | "bb.msg.task.stage.status.update"- | "bb.msg.task.comment";+export type IssueMessageType =+ | "bb.msg.issue.assign"+ | "bb.msg.issue.status.update"+ | "bb.msg.issue.stage.status.update"+ | "bb.msg.issue.comment";export type MessageType =| MemberMessageType| EnvironmentMessageType| InstanceMessageType- | TaskMessageType;+ | IssueMessageType;export type MemberMessagePayload = {principalId: PrincipalId;@@ -1048,20 +1051,20 @@ export type InstanceMessagePaylaod = {instanceName: string;};-export type TaskAssignMessagePayload = {- taskName: string;+export type IssueAssignMessagePayload = {+ issueName: string;oldAssigneeId: PrincipalId;newAssigneeId: PrincipalId;};-export type TaskUpdateStatusMessagePayload = {- taskName: string;- oldStatus: TaskStatus;- newStatus: TaskStatus;+export type IssueUpdateStatusMessagePayload = {+ issueName: string;+ oldStatus: IssueStatus;+ newStatus: IssueStatus;};-export type TaskCommentMessagePayload = {- taskName: string;+export type IssueCommentMessagePayload = {+ issueName: string;commentId: ActivityId;};@@ -1070,9 +1073,9 @@ export type MessagePayload =| EnvironmentMessagePayload| EnvironmentUpdateMessagePayload| InstanceMessagePaylaod- | TaskAssignMessagePayload- | TaskUpdateStatusMessagePayload- | TaskCommentMessagePayload;+ | IssueAssignMessagePayload+ | IssueUpdateStatusMessagePayload+ | IssueCommentMessagePayload;export type MessageStatus = "DELIVERED" | "CONSUMED";@@ -1235,7 +1238,7 @@ export type DatabaseNew = {// Domain specific fieldsname: string;- taskId?: TaskId;+ issueId?: IssueId;};export type DatabasePatch = {@@ -1309,13 +1312,13 @@ export type DataSourceMember = {// Domain specific fieldsprincipal: Principal;- taskId?: TaskId;+ issueId?: IssueId;};export type DataSourceMemberNew = {// Domain specific fieldsprincipalId: PrincipalId;- taskId?: TaskId;+ issueId?: IssueId;};// Auth@@ -1342,7 +1345,7 @@ export type FeatureType =// Support Owner and DBA role at the workspace level| "bytebase.admin"// Support DBA workflow, including- // 1. Developers can't create database directly, they need to do this via a request db task.+ // 1. Developers can't create database directly, they need to do this via a request db issue.// 2. Allow developers to submit troubleshooting ticket.| "bytebase.dba-workflow"// Support defining extra data source for a database and exposing the related data source UI.@@ -1358,7 +1361,7 @@ export enum PlanType {export type RouterSlug = {environmentSlug?: string;projectSlug?: string;- taskSlug?: string;+ issueSlug?: string;instanceSlug?: string;databaseSlug?: string;dataSourceSlug?: string;@@ -1436,19 +1439,19 @@ export interface BookmarkState {export interface ActivityState {activityListByUser: Map<UserId, Activity[]>;- activityListByTask: Map<TaskId, Activity[]>;+ activityListByIssue: Map<IssueId, Activity[]>;}export interface MessageState {messageListByUser: Map<UserId, Message[]>;}-export interface TaskState {- // [NOTE] This is only used by the task list view. We don't- // update the entry here if any task is changed (the updated task only gets updated in taskById).- // Instead, we always fetch the list every time we display the task list view.- taskListByUser: Map<UserId, Task[]>;- taskById: Map<TaskId, Task>;+export interface IssueState {+ // [NOTE] This is only used by the issue list view. We don't+ // update the entry here if any issue is changed (the updated issue only gets updated in issueById).+ // Instead, we always fetch the list every time we display the issue list view.+ issueListByUser: Map<UserId, Issue[]>;+ issueById: Map<IssueId, Issue>;}export interface StageState {}diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.tsindex f6bce0fb58..af80190ca7 100644--- a/frontend/src/utils/index.ts+++ b/frontend/src/utils/index.ts@@ -5,5 +5,5 @@ export * from "./database";export * from "./link";export * from "./role";export * from "./slug";-export * from "./task";+export * from "./issue";export * from "./util";diff --git a/frontend/src/utils/task.ts b/frontend/src/utils/issue.tssimilarity index 50%rename from frontend/src/utils/task.tsrename to frontend/src/utils/issue.tsindex b5e56feaea..6dfdc423f2 100644--- a/frontend/src/utils/task.ts+++ b/frontend/src/utils/issue.ts@@ -1,5 +1,5 @@import {- Task,+ Issue,StageId,Stage,EnvironmentId,@@ -8,8 +8,8 @@ import {FINAL_STAGE,} from "../types";-export function stageName(task: Task, stageId: StageId): string {- for (const stage of task.stageList) {+export function stageName(issue: Issue, stageId: StageId): string {+ for (const stage of issue.stageList) {if (stage.id == stageId) {return stage.name;}@@ -17,13 +17,13 @@ export function stageName(task: Task, stageId: StageId): string {return "<<Unknown stage>>";}-// Returns true if the active step is the last step in the entire task-export function pendingResolve(task: Task): boolean {- return activeStage(task).type == "bytebase.stage.final";+// Returns true if the active step is the last step in the entire issue+export function pendingResolve(issue: Issue): boolean {+ return activeStage(issue).type == "bytebase.stage.final";}-export function activeStage(task: Task): Stage {- for (const stage of task.stageList) {+export function activeStage(issue: Issue): Stage {+ for (const stage of issue.stageList) {if (stage.status === "PENDING" ||stage.status === "RUNNING" ||@@ -37,16 +37,16 @@ export function activeStage(task: Task): Stage {return FINAL_STAGE;}-export function activeStageIsRunning(task: Task): boolean {- return activeStage(task).status === "RUNNING";+export function activeStageIsRunning(issue: Issue): boolean {+ return activeStage(issue).status === "RUNNING";}-export function activeEnvironmentId(task: Task): EnvironmentId {- const stage: Stage = activeStage(task);+export function activeEnvironmentId(issue: Issue): EnvironmentId {+ const stage: Stage = activeStage(issue);return stage.database.instance.environment.id;}-export function activeDatabaseId(task: Task): DatabaseId {- const stage = activeStage(task);+export function activeDatabaseId(issue: Issue): DatabaseId {+ const stage = activeStage(issue);return stage.database.id;}diff --git a/frontend/src/utils/slug.ts b/frontend/src/utils/slug.tsindex d52aad9732..e86f17bc69 100644--- a/frontend/src/utils/slug.ts+++ b/frontend/src/utils/slug.ts@@ -4,7 +4,7 @@ import {Environment,Instance,Project,- TaskId,+ IssueId,} from "../types";import slug from "slug";@@ -13,8 +13,8 @@ export function idFromSlug(slug: string) {return parts[parts.length - 1];}-export function taskSlug(taskName: string, taskId: TaskId) {- return [slug(taskName), taskId].join("-");+export function issueSlug(issueName: string, issueId: IssueId) {+ return [slug(issueName), issueId].join("-");}// On the other hand, it's not possible to de-slug due to slug's one-way algorithmdiff --git a/frontend/src/views/DatabaseGrant.vue b/frontend/src/views/DatabaseGrant.vueindex 4950657f73..fc3a8abfe3 100644--- a/frontend/src/views/DatabaseGrant.vue+++ b/frontend/src/views/DatabaseGrant.vue@@ -16,7 +16,7 @@ input[type="number"] {<DataSourceMemberForm:dataSource="state.dataSource":principalId="state.granteeId"- :taskId="state.taskId"+ :issueId="state.issueId"@submit="submit"@cancel="cancel"/>@@ -27,13 +27,13 @@ import { reactive, onMounted, onUnmounted } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";import DataSourceMemberForm from "../components/DataSourceMemberForm.vue";-import { TaskId, PrincipalId, DataSource } from "../types";+import { IssueId, PrincipalId, DataSource } from "../types";import { fullDataSourcePath } from "../utils";interface LocalState {dataSource?: DataSource;granteeId?: PrincipalId;- taskId?: TaskId;+ issueId?: IssueId;}export default {@@ -70,7 +70,7 @@ export default {const state = reactive<LocalState>({dataSource,granteeId: router.currentRoute.value.query.grantee as PrincipalId,- taskId: router.currentRoute.value.query.task as TaskId,+ issueId: router.currentRoute.value.query.issue as IssueId,});const cancel = () => {diff --git a/frontend/src/views/DatabaseNew.vue b/frontend/src/views/DatabaseNew.vueindex 47949ca058..0f55816e2f 100644--- a/frontend/src/views/DatabaseNew.vue+++ b/frontend/src/views/DatabaseNew.vue@@ -93,34 +93,34 @@ input[type="number"] {</div><div class="col-span-2 col-start-2 w-64">- <label for="task" class="textlabel"> Task </label>+ <label for="issue" class="textlabel"> Issue </label><div class="mt-1 relative rounded-md shadow-sm"><router-link- v-if="$router.currentRoute.value.query.task"- :to="`/task/${$router.currentRoute.value.query.task}`"+ v-if="$router.currentRoute.value.query.issue"+ :to="`/issue/${$router.currentRoute.value.query.issue}`"class="normal-link">- {{ `task/${$router.currentRoute.value.query.task}` }}+ {{ `issue/${$router.currentRoute.value.query.issue}` }}</router-link><template v-else><divclass="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">- <span class="text-accent font-semibold sm:text-sm">task/</span>+ <span class="text-accent font-semibold sm:text-sm">issue/</span></div><div class="flex flex-row space-x-2 items-center"><inputclass="textfield w-full pl-12"- id="task"- name="task"+ id="issue"+ name="issue"type="number"- placeholder="Your task id (e.g. 1234)"- :disabled="!allowEditTask"- v-model="state.taskId"+ placeholder="Your issue id (e.g. 1234)"+ :disabled="!allowEditIssue"+ v-model="state.issueId"/>- <template v-if="taskLink">+ <template v-if="issueLink"><router-link- :to="taskLink"+ :to="issueLink"target="_blank"class="ml-2 normal-link text-sm">@@ -162,11 +162,11 @@ import InstanceSelect from "../components/InstanceSelect.vue";import EnvironmentSelect from "../components/EnvironmentSelect.vue";import ProjectSelect from "../components/ProjectSelect.vue";import PrincipalSelect from "../components/PrincipalSelect.vue";-import { instanceSlug, databaseSlug, taskSlug } from "../utils";+import { instanceSlug, databaseSlug, issueSlug } from "../utils";import {- Task,- TaskId,- TaskType,+ Issue,+ IssueId,+ IssueType,DataSourceNew,EnvironmentId,InstanceId,@@ -174,7 +174,7 @@ import {ProjectId,DatabaseNew,} from "../types";-import { TaskField, templateForType } from "../plugins";+import { IssueField, templateForType } from "../plugins";import { isEqual } from "lodash";interface LocalState {@@ -182,8 +182,8 @@ interface LocalState {environmentId?: EnvironmentId;instanceId?: InstanceId;databaseName?: string;- taskId?: TaskId;- fromTaskType?: TaskType;+ issueId?: IssueId;+ fromIssueType?: IssueType;}export default {@@ -226,8 +226,8 @@ export default {? (router.currentRoute.value.query.instance as InstanceId): undefined,databaseName: router.currentRoute.value.query.name as string,- taskId: router.currentRoute.value.query.task as TaskId,- fromTaskType: router.currentRoute.value.query.from as TaskType,+ issueId: router.currentRoute.value.query.issue as IssueId,+ fromIssueType: router.currentRoute.value.query.from as IssueType,});const allowCreate = computed(() => {@@ -239,28 +239,31 @@ export default {);});- // If it's from database request task, we disallow changing the preset field.+ // If it's from database request issue, we disallow changing the preset field.// This is to prevent accidentally changing the requested field.const allowEditProject = computed(() => {return (- state.fromTaskType != "bytebase.database.create" || !state.projectId+ state.fromIssueType != "bytebase.database.create" || !state.projectId);});const allowEditEnvironment = computed(() => {return (- state.fromTaskType != "bytebase.database.create" || !state.environmentId+ state.fromIssueType != "bytebase.database.create" ||+ !state.environmentId);});const allowEditDatabaseName = computed(() => {return (- state.fromTaskType != "bytebase.database.create" || !state.databaseName+ state.fromIssueType != "bytebase.database.create" || !state.databaseName);});- const allowEditTask = computed(() => {- return state.fromTaskType != "bytebase.database.create" || !state.taskId;+ const allowEditIssue = computed(() => {+ return (+ state.fromIssueType != "bytebase.database.create" || !state.issueId+ );});const instanceLink = computed((): string => {@@ -273,11 +276,11 @@ export default {return "";});- const taskLink = computed((): string => {- if (state.taskId) {- // We intentionally not to validate whether the taskId is legit, we will do the validation+ const issueLink = computed((): string => {+ if (state.issueId) {+ // We intentionally not to validate whether the issueId is legit, we will do the validation// when actually trying to create the database.- return `/task/${state.taskId}`;+ return `/issue/${state.issueId}`;}return "";});@@ -348,14 +351,17 @@ export default {};const create = async () => {- // If taskId id provided, we check its existence first.- // We only set the taskId if it's valid.- let linkedTask: Task | undefined = undefined;- if (state.taskId) {+ // If issueId id provided, we check its existence first.+ // We only set the issueId if it's valid.+ let linkedIssue: Issue | undefined = undefined;+ if (state.issueId) {try {- linkedTask = await store.dispatch("task/fetchTaskById", state.taskId);+ linkedIssue = await store.dispatch(+ "issue/fetchIssueById",+ state.issueId+ );} catch (err) {- console.warn(`Unable to fetch linked task id ${state.taskId}`, err);+ console.warn(`Unable to fetch linked issue id ${state.issueId}`, err);}}@@ -365,7 +371,7 @@ export default {name: state.databaseName!,instanceId: state.instanceId!,projectId: state.projectId!,- taskId: linkedTask?.id,+ issueId: linkedIssue?.id,};const createdDatabase = await store.dispatch("database/createDatabase",@@ -375,22 +381,22 @@ export default {// Redirect to the created database.router.push(`/db/${databaseSlug(createdDatabase)}`);- // If a valid task id is provided, we will set the database output field+ // If a valid issue id is provided, we will set the database output field// if it's not set before. This is based on the assumption that user creates- // the database to fullfill that particular task (e.g. completing the request db workflow)- // TODO: If there is no applicable database field, we should also link the database to the task.- if (linkedTask) {- const template = templateForType(linkedTask.type);+ // the database to fullfill that particular issue (e.g. completing the request db workflow)+ // TODO: If there is no applicable database field, we should also link the database to the issue.+ if (linkedIssue) {+ const template = templateForType(linkedIssue.type);if (template) {const databaseOutputField = template.fieldList.find(- (item: TaskField) =>+ (item: IssueField) =>item.category == "OUTPUT" && item.type == "Database");if (databaseOutputField) {- const payload = cloneDeep(linkedTask.payload);+ const payload = cloneDeep(linkedIssue.payload);// Only sets the value if it's empty to prevent accidentally overwriting- // the existing legit data (e.g. someone provides a wrong task id)+ // the existing legit data (e.g. someone provides a wrong issue id)if (databaseOutputField &&isEmpty(payload[databaseOutputField.id])@@ -398,10 +404,10 @@ export default {payload[databaseOutputField.id] = createdDatabase.id;}- if (!isEqual(payload, linkedTask.payload)) {- await store.dispatch("task/patchTask", {- taskId: linkedTask.id,- taskPatch: {+ if (!isEqual(payload, linkedIssue.payload)) {+ await store.dispatch("issue/patchIssue", {+ issueId: linkedIssue.id,+ issuePatch: {payload,updaterId: currentUser.value.id,},@@ -420,14 +426,14 @@ export default {module: "bytebase",style: "SUCCESS",title: `Succesfully created database '${createdDatabase.name}'.`,- description: linkedTask- ? `We also linked the created database to the requested task '${linkedTask.name}'.`+ description: linkedIssue+ ? `We also linked the created database to the requested issue '${linkedIssue.name}'.`: "",- link: linkedTask- ? `/task/${taskSlug(linkedTask.name, linkedTask.id)}`+ link: linkedIssue+ ? `/issue/${issueSlug(linkedIssue.name, linkedIssue.id)}`: undefined,- linkTitle: linkedTask ? "View task" : undefined,- manualHide: linkedTask != undefined,+ linkTitle: linkedIssue ? "View issue" : undefined,+ manualHide: linkedIssue != undefined,});};@@ -437,9 +443,9 @@ export default {allowEditProject,allowEditEnvironment,allowEditDatabaseName,- allowEditTask,+ allowEditIssue,instanceLink,- taskLink,+ issueLink,selectProject,selectEnvironment,selectInstance,diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vueindex 15cb05db2d..3dd632c264 100644--- a/frontend/src/views/EnvironmentDashboard.vue+++ b/frontend/src/views/EnvironmentDashboard.vue@@ -58,7 +58,7 @@:okText="'Do not show again'":cancelText="'Dismiss'":title="'How to setup \'Environment\' ?'"- :description="'Each environment in Bytebase maps to one of your testing, staging, prod environment respectively.\n\nEnvironment is a global setting, one Bytebase deployment only contains a single set of environments.\n\nDatabase instances are created under a particular environment and most tasks also require specifying an environment first.'"+ :description="'Each environment in Bytebase maps to one of your testing, staging, prod environment respectively.\n\nEnvironment is a global setting, one Bytebase deployment only contains a single set of environments.\n\nDatabase instances are created under a particular environment and most issues also require specifying an environment first.'"@ok="() => {doDismissGuide();diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vueindex 58be14bdd3..04fff0609d 100644--- a/frontend/src/views/Home.vue+++ b/frontend/src/views/Home.vue@@ -7,27 +7,27 @@/><BBTableSearchref="searchField"- :placeholder="'Search task name'"+ :placeholder="'Search issue name'"@change-text="(text) => changeSearchText(text)"/></div>- <TaskTable+ <IssueTable:leftBordered="false":rightBordered="false":topBordered="true":bottomBordered="true"- :taskSectionList="[+ :issueSectionList="[{title: 'Assigned',- list: filteredList(state.assignedList).sort(openTaskSorter),+ list: filteredList(state.assignedList).sort(openIssueSorter),},{title: 'Created',- list: filteredList(state.createdList).sort(openTaskSorter),+ list: filteredList(state.createdList).sort(openIssueSorter),},{title: 'Subscribed',- list: filteredList(state.subscribeList).sort(openTaskSorter),+ list: filteredList(state.subscribeList).sort(openIssueSorter),},{title: 'Recently Closed',@@ -45,15 +45,15 @@ import { watchEffect, computed, nextTick, onMounted, reactive, ref } from "vue";import { useStore } from "vuex";import { useRouter } from "vue-router";import EnvironmentTabFilter from "../components/EnvironmentTabFilter.vue";-import TaskTable from "../components/TaskTable.vue";+import IssueTable from "../components/IssueTable.vue";import { activeStage, activeEnvironmentId } from "../utils";-import { Environment, Task, StageStatus } from "../types";+import { Environment, Issue, StageStatus } from "../types";interface LocalState {- createdList: Task[];- assignedList: Task[];- subscribeList: Task[];- closeList: Task[];+ createdList: Issue[];+ assignedList: Issue[];+ subscribeList: Issue[];+ closeList: Issue[];searchText: string;selectedEnvironment?: Environment;}@@ -62,7 +62,7 @@ export default {name: "Home",components: {EnvironmentTabFilter,- TaskTable,+ IssueTable,},props: {},setup(props, ctx) {@@ -91,36 +91,36 @@ export default {searchField.value.$el.querySelector("#search").focus();});- const prepareTaskList = () => {+ const prepareIssueList = () => {store- .dispatch("task/fetchTaskListForUser", currentUser.value.id)- .then((taskList: Task[]) => {+ .dispatch("issue/fetchIssueListForUser", currentUser.value.id)+ .then((issueList: Issue[]) => {state.createdList = [];state.assignedList = [];state.subscribeList = [];state.closeList = [];- for (const task of taskList) {+ for (const issue of issueList) {// "OPEN"- if (task.status === "OPEN") {- if (task.creator.id === currentUser.value.id) {- state.createdList.push(task);- } else if (task.assignee?.id === currentUser.value.id) {- state.assignedList.push(task);+ if (issue.status === "OPEN") {+ if (issue.creator.id === currentUser.value.id) {+ state.createdList.push(issue);+ } else if (issue.assignee?.id === currentUser.value.id) {+ state.assignedList.push(issue);} else if (- task.subscriberList.find(+ issue.subscriberList.find((item) => item.id == currentUser.value.id)) {- state.subscribeList.push(task);+ state.subscribeList.push(issue);}}// "DONE" or "CANCELED"- else if (task.status === "DONE" || task.status === "CANCELED") {+ else if (issue.status === "DONE" || issue.status === "CANCELED") {if (- task.creator.id === currentUser.value.id ||- task.assignee?.id === currentUser.value.id+ issue.creator.id === currentUser.value.id ||+ issue.assignee?.id === currentUser.value.id) {- state.closeList.push(task);+ state.closeList.push(issue);}}}@@ -130,7 +130,7 @@ export default {});};- watchEffect(prepareTaskList);+ watchEffect(prepareIssueList);const selectEnvironment = (environment: Environment) => {state.selectedEnvironment = environment;@@ -148,22 +148,22 @@ export default {state.searchText = searchText;};- const filteredList = (list: Task[]) => {+ const filteredList = (list: Issue[]) => {if (!state.selectedEnvironment && !state.searchText) {// Select "All"return list;}- return list.filter((task) => {+ return list.filter((issue) => {return ((!state.selectedEnvironment ||- activeEnvironmentId(task) === state.selectedEnvironment.id) &&+ activeEnvironmentId(issue) === state.selectedEnvironment.id) &&(!state.searchText ||- task.name.toLowerCase().includes(state.searchText.toLowerCase()))+ issue.name.toLowerCase().includes(state.searchText.toLowerCase())));});};- const openTaskSorter = (a: Task, b: Task) => {+ const openIssueSorter = (a: Issue, b: Issue) => {const statusOrder = (status: StageStatus) => {switch (status) {case "FAILED":@@ -192,7 +192,7 @@ export default {filteredList,selectEnvironment,changeSearchText,- openTaskSorter,+ openIssueSorter,};},};diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vueindex 747e7f0466..b55260cccc 100644--- a/frontend/src/views/Inbox.vue+++ b/frontend/src/views/Inbox.vue@@ -112,30 +112,30 @@{{ message.payload.instanceName }}</span></template>- <template v-else-if="message.type == 'bb.msg.task.assign'">+ <template v-else-if="message.type == 'bb.msg.issue.assign'"><router-link- :to="`/task/${message.containerId}`"+ :to="`/issue/${message.containerId}`"class="normal-link ml-1">- {{ message.payload.taskName }}+ {{ message.payload.issueName }}</router-link></template><template- v-else-if="message.type == 'bb.msg.task.status.update'"+ v-else-if="message.type == 'bb.msg.issue.status.update'"><router-link- :to="`/task/${message.containerId}`"+ :to="`/issue/${message.containerId}`"class="normal-link ml-1">- {{ message.payload.taskName }}+ {{ message.payload.issueName }}</router-link></template>- <template v-else-if="message.type == 'bb.msg.task.comment'">+ <template v-else-if="message.type == 'bb.msg.issue.comment'"><router-link- :to="`/task/${message.containerId}#activity${message.payload.commentId}`"+ :to="`/issue/${message.containerId}#activity${message.payload.commentId}`"class="normal-link ml-1">- {{ message.payload.taskName }}+ {{ message.payload.issueName }}</router-link></template><span@@ -167,8 +167,8 @@ import {Message,Principal,PrincipalId,- TaskAssignMessagePayload,- TaskUpdateStatusMessagePayload,+ IssueAssignMessagePayload,+ IssueUpdateStatusMessagePayload,UNKNOWN_ID,} from "../types";import { isDBAOrOwner, roleName } from "../utils";@@ -301,15 +301,15 @@ export default {return "archived instance";case "bb.msg.instance.restore":return "restored instance";- case "bb.msg.task.assign": {- const payload = message.payload as TaskAssignMessagePayload;+ case "bb.msg.issue.assign": {+ const payload = message.payload as IssueAssignMessagePayload;if (payload.oldAssigneeId == UNKNOWN_ID &&payload.newAssigneeId != UNKNOWN_ID) {return "assigned " + currentUser.value.id == payload.newAssigneeId? "you"- : principalFromId(payload.newAssigneeId).name + " task";+ : principalFromId(payload.newAssigneeId).name + " issue";} else if (payload.oldAssigneeId != UNKNOWN_ID &&payload.newAssigneeId == UNKNOWN_ID@@ -317,7 +317,7 @@ export default {return "un-assigned " + currentUser.value.id ==payload.oldAssigneeId? "you"- : principalFromId(payload.oldAssigneeId).name + " task";+ : principalFromId(payload.oldAssigneeId).name + " issue";} else if (payload.oldAssigneeId != UNKNOWN_ID &&payload.newAssigneeId != UNKNOWN_ID@@ -330,30 +330,30 @@ export default {currentUser.value.id ==payload.newAssigneeId? "you"- : principalFromId(payload.newAssigneeId).name + " task";+ : principalFromId(payload.newAssigneeId).name + " issue";}- return "assigned task";+ return "assigned issue";}- case "bb.msg.task.status.update": {- const payload = message.payload as TaskUpdateStatusMessagePayload;+ case "bb.msg.issue.status.update": {+ const payload = message.payload as IssueUpdateStatusMessagePayload;return (- "changed task status from " ++ "changed issue status from " +payload.oldStatus +" to " +payload.newStatus);}- case "bb.msg.task.stage.status.update": {- const payload = message.payload as TaskUpdateStatusMessagePayload;+ case "bb.msg.issue.stage.status.update": {+ const payload = message.payload as IssueUpdateStatusMessagePayload;return (- "changed task stage status from " ++ "changed issue stage status from " +payload.oldStatus +" to " +payload.newStatus);}- case "bb.msg.task.comment":- return "commented task";+ case "bb.msg.issue.comment":+ return "commented issue";}};diff --git a/frontend/src/views/TaskActivityPanel.vue b/frontend/src/views/IssueActivityPanel.vuesimilarity index 89%rename from frontend/src/views/TaskActivityPanel.vuerename to frontend/src/views/IssueActivityPanel.vueindex 94d9847479..475c8ffeb2 100644--- a/frontend/src/views/TaskActivityPanel.vue+++ b/frontend/src/views/IssueActivityPanel.vue@@ -17,7 +17,7 @@aria-hidden="true"></span><div class="relative flex items-start">- <template v-if="activity.actionType == 'bytebase.task.create'">+ <template v-if="activity.actionType == 'bytebase.issue.create'"><div class="relative pl-0.5"><divclass="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"@@ -39,7 +39,7 @@</template><templatev-else-if="- activity.actionType == 'bytebase.task.field.update'+ activity.actionType == 'bytebase.issue.field.update'"><div class="relative pl-0.5">@@ -86,7 +86,7 @@v-if="activity.createdTs != activity.updatedTs &&activity.actionType ==- 'bytebase.task.comment.create'+ 'bytebase.issue.comment.create'">(edited@@ -126,7 +126,7 @@<buttonv-if="activity.actionType ==- 'bytebase.task.comment.create'+ 'bytebase.issue.comment.create'"class="btn-icon"@click.prevent="@@ -297,14 +297,14 @@ import {import { useStore } from "vuex";import { useRouter } from "vue-router";import {- Task,+ Issue,Activity,- ActionTaskFieldUpdatePayload,+ ActionIssueFieldUpdatePayload,Environment,Principal,} from "../types";import { sizeToFit, stageName } from "../utils";-import { fieldFromId, TaskTemplate, TaskBuiltinFieldId } from "../plugins";+import { fieldFromId, IssueTemplate, IssueBuiltinFieldId } from "../plugins";interface LocalState {showDeleteCommentModal: boolean;@@ -313,16 +313,16 @@ interface LocalState {}export default {- name: "TaskActivityPanel",+ name: "IssueActivityPanel",emits: ["update-subscriber-list"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},- taskTemplate: {+ issueTemplate: {required: true,- type: Object as PropType<TaskTemplate>,+ type: Object as PropType<IssueTemplate>,},},components: {},@@ -370,12 +370,12 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const prepareActivityList = () => {- store.dispatch("activity/fetchActivityListForTask", props.task.id);+ store.dispatch("activity/fetchActivityListForIssue", props.issue.id);};watchEffect(prepareActivityList);- // The activity list and its anchor is not immediately available when the task shows up.+ // The activity list and its anchor is not immediately available when the issue shows up.// Thus the scrollBehavior set in the vue router won't work (also tried promise to resolve async with no luck either)// So we manually use scrollIntoView after rendering the activity list.nextTick(() => {@@ -389,13 +389,15 @@ export default {// Need to use computed to make list reactive to activity list changes.const activityList = computed((): Activity[] => {- const list = store.getters["activity/activityListByTask"](props.task.id);+ const list = store.getters["activity/activityListByIssue"](+ props.issue.id+ );return list.filter((activity: Activity) => {- if (activity.actionType == "bytebase.task.field.update") {+ if (activity.actionType == "bytebase.issue.field.update") {let containUserVisibleChange = false;- for (const update of (activity.payload as ActionTaskFieldUpdatePayload)+ for (const update of (activity.payload as ActionIssueFieldUpdatePayload)?.changeList || []) {- if (update.fieldId != TaskBuiltinFieldId.SUBSCRIBER_LIST) {+ if (update.fieldId != IssueBuiltinFieldId.SUBSCRIBER_LIST) {containUserVisibleChange = true;break;}@@ -415,8 +417,8 @@ export default {const doCreateComment = () => {store.dispatch("activity/createActivity", {- actionType: "bytebase.task.comment.create",- containerId: props.task.id,+ actionType: "bytebase.issue.comment.create",+ containerId: props.issue.id,creatorId: currentUser.value.id,comment: newComment.value,})@@ -425,16 +427,16 @@ export default {nextTick(() => sizeToFit(newCommentTextArea.value));// Because the user just added a comment and we assume she is interested in this- // task, and we add her to the subscriber list if she is not there+ // issue, and we add her to the subscriber list if she is not therelet isSubscribed = false;- for (const principal of props.task.subscriberList) {+ for (const principal of props.issue.subscriberList) {if (principal.id == currentUser.value.id) {isSubscribed = true;break;}}if (!isSubscribed) {- const list = props.task.subscriberList.map((item: Principal) => {+ const list = props.issue.subscriberList.map((item: Principal) => {return item.id;});list.push(currentUser.value.id);@@ -482,32 +484,32 @@ export default {const actionSentence = (activity: Activity): string => {switch (activity.actionType) {- case "bytebase.task.create":- return "created task";- case "bytebase.task.comment.create":+ case "bytebase.issue.create":+ return "created issue";+ case "bytebase.issue.comment.create":return "commented";- case "bytebase.task.field.update":- case "bytebase.task.status.update":- case "bytebase.task.stage.status.update": {+ case "bytebase.issue.field.update":+ case "bytebase.issue.status.update":+ case "bytebase.issue.stage.status.update": {const updateInfoList: string[] = [];- for (const update of (activity.payload as ActionTaskFieldUpdatePayload)+ for (const update of (activity.payload as ActionIssueFieldUpdatePayload)?.changeList || []) {let name = "Unknown Field";let oldValue = undefined;let newValue = undefined;- if (update.fieldId == TaskBuiltinFieldId.NAME) {+ if (update.fieldId == IssueBuiltinFieldId.NAME) {name = "name";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.STATUS) {+ } else if (update.fieldId == IssueBuiltinFieldId.STATUS) {name = "status";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.STAGE_STATUS) {+ } else if (update.fieldId == IssueBuiltinFieldId.STAGE_STATUS) {name = "stage status";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.ASSIGNEE) {+ } else if (update.fieldId == IssueBuiltinFieldId.ASSIGNEE) {name = "assignee";if (update.oldValue) {oldValue = store.getters["principal/principalById"](@@ -519,27 +521,27 @@ export default {update.newValue).name;}- } else if (update.fieldId == TaskBuiltinFieldId.DESCRIPTION) {+ } else if (update.fieldId == IssueBuiltinFieldId.DESCRIPTION) {name = "description";} else if (- update.fieldId.split(".")[0] == TaskBuiltinFieldId.STAGE+ update.fieldId.split(".")[0] == IssueBuiltinFieldId.STAGE) {const stageId = update.fieldId.split(".")[1];- name = stageName(props.task, stageId);+ name = stageName(props.issue, stageId);oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.SQL) {+ } else if (update.fieldId == IssueBuiltinFieldId.SQL) {name = "SQL";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.ROLLBACK_SQL) {+ } else if (update.fieldId == IssueBuiltinFieldId.ROLLBACK_SQL) {name = "Rollback SQL";oldValue = update.oldValue;newValue = update.newValue;- } else if (update.fieldId == TaskBuiltinFieldId.SUBSCRIBER_LIST) {+ } else if (update.fieldId == IssueBuiltinFieldId.SUBSCRIBER_LIST) {continue;} else {- const field = fieldFromId(props.taskTemplate, update.fieldId);+ const field = fieldFromId(props.issueTemplate, update.fieldId);name = field.name;if (field.type === "String") {oldValue = update.oldValue;diff --git a/frontend/src/views/TaskDescriptionPanel.vue b/frontend/src/views/IssueDescriptionPanel.vuesimilarity index 84%rename from frontend/src/views/TaskDescriptionPanel.vuerename to frontend/src/views/IssueDescriptionPanel.vueindex 56e2e4cb7b..5d8175a6e6 100644--- a/frontend/src/views/TaskDescriptionPanel.vue+++ b/frontend/src/views/IssueDescriptionPanel.vue@@ -36,7 +36,7 @@v-if="state.editing"type="button"class="mt-0.5 px-3 border border-control-border rounded-sm text-control bg-control-bg hover:bg-control-bg-hover disabled:bg-control-bg disabled:opacity-50 disabled:cursor-not-allowed text-sm leading-5 font-normal focus:ring-control focus:outline-none focus-visible:ring-2 focus:ring-offset-2"- :disabled="state.editDescription == task.description"+ :disabled="state.editDescription == issue.description"@click.prevent="saveEdit">Save@@ -83,7 +83,7 @@ import {reactive,watch,} from "vue";-import { Task } from "../types";+import { Issue } from "../types";import { sizeToFit } from "../utils";interface LocalState {@@ -92,12 +92,12 @@ interface LocalState {}export default {- name: "TaskDescriptionPanel",+ name: "IssueDescriptionPanel",emits: ["update-description"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},new: {required: true,@@ -114,7 +114,7 @@ export default {const state = reactive<LocalState>({editing: false,- editDescription: props.task.description,+ editDescription: props.issue.description,});const keyboardHandler = (e: KeyboardEvent) => {@@ -125,7 +125,7 @@ export default {if (e.code == "Escape") {cancelEdit();} else if (e.code == "Enter" && e.metaKey) {- if (state.editDescription != props.task.description) {+ if (state.editDescription != props.issue.description) {saveEdit();}}@@ -147,7 +147,7 @@ export default {window.removeEventListener("resize", resizeTextAreaHandler);});- // Reset the edit state after creating the task.+ // Reset the edit state after creating the issue.watch(() => props.new,(curNew, prevNew) => {@@ -158,9 +158,9 @@ export default {);watch(- () => props.task,- (curTask, prevTask) => {- state.editDescription = curTask.description;+ () => props.issue,+ (curIssue, prevIssue) => {+ state.editDescription = curIssue.description;nextTick(() => {sizeToFit(editDescriptionTextArea.value);});@@ -168,7 +168,7 @@ export default {);const beginEdit = () => {- state.editDescription = props.task.description;+ state.editDescription = props.issue.description;state.editing = true;nextTick(() => {editDescriptionTextArea.value.focus();@@ -176,17 +176,21 @@ export default {};const saveEdit = () => {- emit("update-description", state.editDescription, (updatedTask: Task) => {- state.editDescription = updatedTask.description;- state.editing = false;- nextTick(() => {- sizeToFit(editDescriptionTextArea.value);- });- });+ emit(+ "update-description",+ state.editDescription,+ (updatedIssue: Issue) => {+ state.editDescription = updatedIssue.description;+ state.editing = false;+ nextTick(() => {+ sizeToFit(editDescriptionTextArea.value);+ });+ }+ );};const cancelEdit = () => {- state.editDescription = props.task.description;+ state.editDescription = props.issue.description;state.editing = false;nextTick(() => {sizeToFit(editDescriptionTextArea.value);diff --git a/frontend/src/views/TaskDetail.vue b/frontend/src/views/IssueDetail.vuesimilarity index 62%rename from frontend/src/views/TaskDetail.vuerename to frontend/src/views/IssueDetail.vueindex 639b08d494..570941563b 100644--- a/frontend/src/views/TaskDetail.vue+++ b/frontend/src/views/IssueDetail.vue@@ -1,13 +1,13 @@<template><div- id="task-detail-top"+ id="issue-detail-top"class="flex-1 overflow-auto focus:outline-none"tabindex="0"><!-- Highlight Panel --><div class="bg-white px-4 pb-4">- <TaskHighlightPanel- :task="state.task"+ <IssueHighlightPanel+ :issue="state.issue":new="state.new":allowEdit="allowEditNameAndDescription"@update-name="updateName"@@ -44,32 +44,32 @@":disabled="!allowTransition(transition)"@click.prevent="- tryStartTaskStatusTransition(transition.type, () => {})+ tryStartIssueStatusTransition(transition.type, () => {})">{{ transition.actionName }}</button></template></div>- </TaskHighlightPanel>+ </IssueHighlightPanel></div><!-- Stage Flow Bar -->- <TaskStageFlow- v-if="showTaskStageFlowBar"- :task="state.task"+ <IssueStageFlow+ v-if="showIssueStageFlowBar"+ :issue="state.issue"@change-stage-status="changeStageStatus"/><!-- Output Panel -->- <!-- Only render the top border if TaskStageFlow is not displayed, otherwise it would overlap with the bottom border of the TaskStageFlow -->+ <!-- Only render the top border if IssueStageFlow is not displayed, otherwise it would overlap with the bottom border of the IssueStageFlow --><div- v-if="showTaskOutputPanel"+ v-if="showIssueOutputPanel"class="px-2 py-4 md:flex md:flex-col"- :class="showTaskStageFlowBar ? '' : 'lg:border-t'"+ :class="showIssueStageFlowBar ? '' : 'lg:border-t'">- <TaskOutputPanel- :task="state.task"+ <IssueOutputPanel+ :issue="state.issue":fieldList="outputFieldList":allowEdit="allowEditOutput"@update-custom-field="updateCustomField"@@ -80,7 +80,7 @@<mainclass="flex-1 relative overflow-y-auto focus:outline-none":class="- showTaskStageFlowBar && !showTaskOutputPanel+ showIssueStageFlowBar && !showIssueOutputPanel? '': 'lg:border-t lg:border-block-border'"@@ -91,8 +91,8 @@<divclass="py-6 lg:pl-4 lg:w-96 xl:w-112 lg:border-l lg:border-block-border">- <TaskSidebar- :task="state.task"+ <IssueSidebar+ :issue="state.issue":new="state.new":fieldList="inputFieldList":allowEdit="allowEditSidebar"@@ -103,26 +103,26 @@</div><div class="lg:hidden border-t border-block-border" /><div class="w-full py-6 pr-4">- <section v-if="showTaskSqlPanel" class="border-b mb-4">- <TaskSqlPanel- :task="state.task"+ <section v-if="showIssueSqlPanel" class="border-b mb-4">+ <IssueSqlPanel+ :issue="state.issue":new="state.new":rollback="false":allowEdit="allowEditSql"@update-sql="updateSql"/></section>- <section v-if="showTaskRollbackSqlPanel" class="border-b mb-4">- <TaskSqlPanel- :task="state.task"+ <section v-if="showIssueRollbackSqlPanel" class="border-b mb-4">+ <IssueSqlPanel+ :issue="state.issue":new="state.new":rollback="true":allowEdit="allowEditSql"@update-sql="updateRollbackSql"/></section>- <TaskDescriptionPanel- :task="state.task"+ <IssueDescriptionPanel+ :issue="state.issue":new="state.new":allowEdit="allowEditNameAndDescription"@update-description="updateDescription"@@ -132,9 +132,9 @@aria-labelledby="activity-title"class="mt-4">- <TaskActivityPanel- :task="state.task"- :taskTemplate="taskTemplate"+ <IssueActivityPanel+ :issue="state.issue"+ :issueTemplate="issueTemplate"@update-subscriber-list="updateSubscriberIdList"/></section>@@ -148,15 +148,15 @@:title="updateStatusModalState.title"@close="updateStatusModalState.show = false">- <TaskStatusTransitionForm+ <IssueStatusTransitionForm:okText="updateStatusModalState.okText"- :task="state.task"+ :issue="state.issue":transition="updateStatusModalState.payload.transition":outputFieldList="outputFieldList"@submit="(comment) => {updateStatusModalState.show = false;- doTaskStatusTransition(updateStatusModalState.payload, comment);+ doIssueStatusTransition(updateStatusModalState.payload, comment);}"@cancel="@@ -183,44 +183,44 @@ import { useRouter } from "vue-router";import cloneDeep from "lodash-es/cloneDeep";import isEmpty from "lodash-es/isEmpty";import isEqual from "lodash-es/isEqual";-import { idFromSlug, taskSlug, isDemo, pendingResolve } from "../utils";-import TaskHighlightPanel from "../views/TaskHighlightPanel.vue";-import TaskStageFlow from "./TaskStageFlow.vue";-import TaskOutputPanel from "../views/TaskOutputPanel.vue";-import TaskSqlPanel from "../views/TaskSqlPanel.vue";-import TaskDescriptionPanel from "./TaskDescriptionPanel.vue";-import TaskActivityPanel from "../views/TaskActivityPanel.vue";-import TaskSidebar from "../views/TaskSidebar.vue";-import TaskStatusTransitionForm from "../components/TaskStatusTransitionForm.vue";+import { idFromSlug, issueSlug, isDemo, pendingResolve } from "../utils";+import IssueHighlightPanel from "../views/IssueHighlightPanel.vue";+import IssueStageFlow from "./IssueStageFlow.vue";+import IssueOutputPanel from "../views/IssueOutputPanel.vue";+import IssueSqlPanel from "../views/IssueSqlPanel.vue";+import IssueDescriptionPanel from "./IssueDescriptionPanel.vue";+import IssueActivityPanel from "../views/IssueActivityPanel.vue";+import IssueSidebar from "../views/IssueSidebar.vue";+import IssueStatusTransitionForm from "../components/IssueStatusTransitionForm.vue";import {- Task,- TaskNew,- TaskType,- TaskPatch,- TaskStatusTransition,- TaskStatusTransitionType,+ Issue,+ IssueNew,+ IssueType,+ IssuePatch,+ IssueStatusTransition,+ IssueStatusTransitionType,StageStatusPatch,PrincipalId,- TASK_STATUS_TRANSITION_LIST,+ ISSUE_STATUS_TRANSITION_LIST,Database,ASSIGNEE_APPLICABLE_ACTION_LIST,CREATOR_APPLICABLE_ACTION_LIST,- TaskStatusPatch,+ IssueStatusPatch,StageStatus,StageId,} from "../types";import {defaulTemplate,templateForType,- TaskField,- TaskTemplate,- TaskContext,+ IssueField,+ IssueTemplate,+ IssueContext,} from "../plugins";type WorkflowType = "SINGLE_STEP" | "SINGLE_STAGE" | "MULTI_STAGE";type UpdateStatusModalStatePayload = {- transition: TaskStatusTransition;+ transition: IssueStatusTransition;didTransit: () => {};};@@ -234,26 +234,26 @@ interface UpdateStatusModalState {interface LocalState {new: boolean;- task: ComputedRef<Task | TaskNew>;+ issue: ComputedRef<Issue | IssueNew>;}export default {- name: "TaskDetail",+ name: "IssueDetail",props: {- taskSlug: {+ issueSlug: {required: true,type: String,},},components: {- TaskHighlightPanel,- TaskStageFlow,- TaskOutputPanel,- TaskSqlPanel,- TaskDescriptionPanel,- TaskActivityPanel,- TaskSidebar,- TaskStatusTransitionForm,+ IssueHighlightPanel,+ IssueStageFlow,+ IssueOutputPanel,+ IssueSqlPanel,+ IssueDescriptionPanel,+ IssueActivityPanel,+ IssueSidebar,+ IssueStatusTransitionForm,},setup(props, ctx) {@@ -272,7 +272,7 @@ export default {// The hypothesis is that because the scroll bar is in the nested// route, thus setting the scrollBehavior in the global router// won't work.- document.getElementById("task-detail-top")!.scrollIntoView();+ document.getElementById("issue-detail-top")!.scrollIntoView();});const currentUser = computed(() => store.getters["auth/currentUser"]());@@ -282,40 +282,40 @@ export default {});const isNew = computed(() => {- return props.taskSlug.toLowerCase() == "new";+ return props.issueSlug.toLowerCase() == "new";});- const taskContext = computed(- (): TaskContext => {+ const issueContext = computed(+ (): IssueContext => {return {store,currentUser: currentUser.value,new: isNew.value,- task: state.task,+ issue: state.issue,};});- let newTaskTemplate = ref<TaskTemplate>(defaulTemplate());+ let newIssueTemplate = ref<IssueTemplate>(defaulTemplate());const refreshTemplate = () => {- const taskType = router.currentRoute.value.query.template as TaskType;- if (taskType) {- const template = templateForType(taskType);+ const issueType = router.currentRoute.value.query.template as IssueType;+ if (issueType) {+ const template = templateForType(issueType);if (template) {- newTaskTemplate.value = template;+ newIssueTemplate.value = template;} else {store.dispatch("notification/pushNotification", {module: "bytebase",style: "CRITICAL",- title: `Unknown template '${taskType}'.`,+ title: `Unknown template '${issueType}'.`,description: "Fallback to the default template",});}}- if (!newTaskTemplate.value) {- newTaskTemplate.value = defaulTemplate();+ if (!newIssueTemplate.value) {+ newIssueTemplate.value = defaulTemplate();}};@@ -339,96 +339,96 @@ export default {databaseList.push(store.getters["database/databaseById"](databaseId));}- const newTask: TaskNew = newTaskTemplate.value.buildTask({+ const newIssue: IssueNew = newIssueTemplate.value.buildIssue({databaseList,currentUser: currentUser.value,});- // For demo mode, we assign the task to the current user, so it can also experience the assignee user flow.+ // For demo mode, we assign the issue to the current user, so it can also experience the assignee user flow.if (isDemo()) {- newTask.assigneeId = currentUser.value.id;+ newIssue.assigneeId = currentUser.value.id;}- newTask.creatorId = currentUser.value.id;+ newIssue.creatorId = currentUser.value.id;if (router.currentRoute.value.query.name) {- newTask.name = router.currentRoute.value.query.name as string;+ newIssue.name = router.currentRoute.value.query.name as string;}if (router.currentRoute.value.query.description) {- newTask.description = router.currentRoute.value.query+ newIssue.description = router.currentRoute.value.query.description as string;}if (router.currentRoute.value.query.sql) {- newTask.sql = router.currentRoute.value.query.sql as string;+ newIssue.sql = router.currentRoute.value.query.sql as string;}if (router.currentRoute.value.query.rollbacksql) {- newTask.rollbackSql = router.currentRoute.value.query+ newIssue.rollbackSql = router.currentRoute.value.query.rollbacksql as string;}if (router.currentRoute.value.query.assignee) {- newTask.assigneeId = router.currentRoute.value.query+ newIssue.assigneeId = router.currentRoute.value.query.assignee as PrincipalId;}- for (const field of newTaskTemplate.value.fieldList.filter(+ for (const field of newIssueTemplate.value.fieldList.filter((item) => item.category == "INPUT")) {const value = router.currentRoute.value.query[field.slug] as string;if (value) {if (field.type == "Boolean") {- newTask.payload[field.id] =+ newIssue.payload[field.id] =value != "0" && value.toLowerCase() != "false";} else {- newTask.payload[field.id] = value;+ newIssue.payload[field.id] = value;}}}return {new: isNew.value,- task: isNew.value- ? newTask+ issue: isNew.value+ ? newIssue: cloneDeep(- store.getters["task/taskById"](idFromSlug(props.taskSlug))+ store.getters["issue/issueById"](idFromSlug(props.issueSlug))),};};const state = reactive<LocalState>(refreshState());- const refreshTask = () => {+ const refreshIssue = () => {const updatedState = refreshState();state.new = updatedState.new;- state.task = updatedState.task;+ state.issue = updatedState.issue;};- watchEffect(refreshTask);+ watchEffect(refreshIssue);- const taskTemplate = computed(- () => templateForType(state.task.type) || defaulTemplate()+ const issueTemplate = computed(+ () => templateForType(state.issue.type) || defaulTemplate());const outputFieldList = computed(() =>- taskTemplate.value.fieldList.filter(+ issueTemplate.value.fieldList.filter((item) => item.category == "OUTPUT") || []);const inputFieldList = computed(() =>- taskTemplate.value.fieldList.filter(+ issueTemplate.value.fieldList.filter((item) => item.category == "INPUT") || []);const updateName = (newName: string,- postUpdated: (updatedTask: Task) => void+ postUpdated: (updatedIssue: Issue) => void) => {if (state.new) {- (state.task as TaskNew).name = newName;+ (state.issue as IssueNew).name = newName;} else {- patchTask(+ patchIssue({name: newName,},@@ -439,12 +439,12 @@ export default {const updateSql = (newSql: string,- postUpdated: (updatedTask: Task) => void+ postUpdated: (updatedIssue: Issue) => void) => {if (state.new) {- (state.task as TaskNew).sql = newSql;+ (state.issue as IssueNew).sql = newSql;} else {- patchTask(+ patchIssue({sql: newSql,},@@ -455,12 +455,12 @@ export default {const updateRollbackSql = (newSql: string,- postUpdated: (updatedTask: Task) => void+ postUpdated: (updatedIssue: Issue) => void) => {if (state.new) {- (state.task as TaskNew).rollbackSql = newSql;+ (state.issue as IssueNew).rollbackSql = newSql;} else {- patchTask(+ patchIssue({rollbackSql: newSql,},@@ -471,12 +471,12 @@ export default {const updateDescription = (newDescription: string,- postUpdated: (updatedTask: Task) => void+ postUpdated: (updatedIssue: Issue) => void) => {if (state.new) {- (state.task as TaskNew).description = newDescription;+ (state.issue as IssueNew).description = newDescription;} else {- patchTask(+ patchIssue({description: newDescription,},@@ -485,14 +485,14 @@ export default {}};- const allowTransition = (transition: TaskStatusTransition): boolean => {- const task: Task = state.task as Task;+ const allowTransition = (transition: IssueStatusTransition): boolean => {+ const issue: Issue = state.issue as Issue;if (transition.type == "RESOLVE") {- if (pendingResolve(task)) {+ if (pendingResolve(issue)) {// Returns false if any of the required output fields is not provided.for (let i = 0; i < outputFieldList.value.length; i++) {const field = outputFieldList.value[i];- if (field.required && !field.resolved(taskContext.value)) {+ if (field.required && !field.resolved(issueContext.value)) {return false;}}@@ -502,24 +502,24 @@ export default {}return true;};- const tryStartTaskStatusTransition = (- type: TaskStatusTransitionType,+ const tryStartIssueStatusTransition = (+ type: IssueStatusTransitionType,didTransit: () => {}) => {- const transition = TASK_STATUS_TRANSITION_LIST.get(type)!;+ const transition = ISSUE_STATUS_TRANSITION_LIST.get(type)!;updateStatusModalState.okText = transition.actionName;switch (transition.to) {case "OPEN":updateStatusModalState.style = "INFO";- updateStatusModalState.title = "Reopen task?";+ updateStatusModalState.title = "Reopen issue?";break;case "DONE":updateStatusModalState.style = "SUCCESS";- updateStatusModalState.title = "Resolve task?";+ updateStatusModalState.title = "Resolve issue?";break;case "CANCELED":updateStatusModalState.style = "INFO";- updateStatusModalState.title = "Abort task?";+ updateStatusModalState.title = "Abort issue?";break;}updateStatusModalState.payload = {@@ -529,25 +529,25 @@ export default {updateStatusModalState.show = true;};- const doTaskStatusTransition = (+ const doIssueStatusTransition = (payload: UpdateStatusModalStatePayload,comment?: string) => {- const taskStatusPatch: TaskStatusPatch = {+ const issueStatusPatch: IssueStatusPatch = {updaterId: currentUser.value.id,status: payload.transition.to,comment: comment ? comment.trim() : undefined,};store- .dispatch("task/updateTaskStatus", {- taskId: (state.task as Task).id,- taskStatusPatch,+ .dispatch("issue/updateIssueStatus", {+ issueId: (state.issue as Issue).id,+ issueStatusPatch,})- .then((updatedTask) => {+ .then((updatedIssue) => {if (payload.transition.to == "DONE" &&- taskTemplate.value.type == "bytebase.database.schema.update"+ issueTemplate.value.type == "bytebase.database.schema.update") {store.dispatch("uistate/saveIntroStateByKey", {key: "table.create",@@ -570,7 +570,7 @@ export default {};store.dispatch("stage/updateStageStatus", {- taskId: (state.task as Task).id,+ issueId: (state.issue as Issue).id,stageId,stageStatusPatch,});@@ -578,27 +578,27 @@ export default {const updateAssigneeId = (newAssigneeId: PrincipalId) => {if (state.new) {- (state.task as TaskNew).assigneeId = newAssigneeId;+ (state.issue as IssueNew).assigneeId = newAssigneeId;} else {- patchTask({+ patchIssue({assigneeId: newAssigneeId,});}};const updateSubscriberIdList = (newSubscriberIdList: PrincipalId[]) => {- patchTask({+ patchIssue({subscriberIdList: newSubscriberIdList,});};- const updateCustomField = (field: TaskField, value: any) => {+ const updateCustomField = (field: IssueField, value: any) => {console.log("updateCustomField", field.name, value);- if (!isEqual(state.task.payload[field.id], value)) {- state.task.payload[field.id] = value;+ if (!isEqual(state.issue.payload[field.id], value)) {+ state.issue.payload[field.id] = value;if (!state.new) {- patchTask({- payload: state.task.payload,+ patchIssue({+ payload: state.issue.payload,});}}@@ -606,30 +606,32 @@ export default {const doCreate = () => {store- .dispatch("task/createTask", state.task)- .then((createdTask) => {- router.push(`/task/${taskSlug(createdTask.name, createdTask.id)}`);+ .dispatch("issue/createIssue", state.issue)+ .then((createdIssue) => {+ router.push(+ `/issue/${issueSlug(createdIssue.name, createdIssue.id)}`+ );}).catch((error) => {console.log(error);});};- const patchTask = (- taskPatch: Omit<TaskPatch, "updaterId">,- postUpdated?: (updatedTask: Task) => void+ const patchIssue = (+ issuePatch: Omit<IssuePatch, "updaterId">,+ postUpdated?: (updatedIssue: Issue) => void) => {store- .dispatch("task/patchTask", {- taskId: (state.task as Task).id,- taskPatch: {- ...taskPatch,+ .dispatch("issue/patchIssue", {+ issueId: (state.issue as Issue).id,+ issuePatch: {+ ...issuePatch,updaterId: currentUser.value.id,},})- .then((updatedTask) => {+ .then((updatedIssue) => {if (postUpdated) {- postUpdated(updatedTask);+ postUpdated(updatedIssue);}}).catch((error) => {@@ -639,12 +641,12 @@ export default {const workflowType = computed((): WorkflowType => {- if (state.task.stageList.length > 1) {+ if (state.issue.stageList.length > 1) {return "MULTI_STAGE";}if (- state.task.stageList.length == 1 &&- state.task.stageList[0].stepList.length > 1+ state.issue.stageList.length == 1 &&+ state.issue.stageList[0].stepList.length > 1) {return "SINGLE_STAGE";}@@ -653,23 +655,23 @@ export default {);const allowCreate = computed(() => {- const newTask = state.task as TaskNew;- if (isEmpty(newTask.name)) {+ const newIssue = state.issue as IssueNew;+ if (isEmpty(newIssue.name)) {return false;}- if (!newTask.assigneeId) {+ if (!newIssue.assigneeId) {return false;}- if (newTaskTemplate.value.fieldList) {- for (const field of newTaskTemplate.value.fieldList.filter(+ if (newIssueTemplate.value.fieldList) {+ for (const field of newIssueTemplate.value.fieldList.filter((item) => item.category == "INPUT")) {if (field.type != "Boolean" && // Switch is boolean value which always is presentfield.required &&- !field.resolved(taskContext.value)+ !field.resolved(issueContext.value)) {return false;}@@ -679,33 +681,33 @@ export default {});const allowEditSidebar = computed(() => {- // For now, we only allow assignee to update the field when the task+ // For now, we only allow assignee to update the field when the issue// is 'OPEN'. This reduces flexibility as creator must ask assignee to// change any fields if there is typo. On the other hand, this avoids// the trouble that the creator changes field value when the creator- // is performing the task based on the old value.+ // is performing the issue based on the old value.// For now, we choose to be on the safe side at the cost of flexibility.return (state.new ||- ((state.task as Task).status == "OPEN" &&- currentUser.value.id == (state.task as Task).assignee?.id)+ ((state.issue as Issue).status == "OPEN" &&+ currentUser.value.id == (state.issue as Issue).assignee?.id));});const allowEditOutput = computed(() => {return (state.new ||- ((state.task as Task).status == "OPEN" &&- currentUser.value.id == (state.task as Task).assignee?.id)+ ((state.issue as Issue).status == "OPEN" &&+ currentUser.value.id == (state.issue as Issue).assignee?.id));});const allowEditNameAndDescription = computed(() => {return (state.new ||- ((state.task as Task).status == "OPEN" &&- (currentUser.value.id == (state.task as Task).assignee?.id ||- currentUser.value.id == (state.task as Task).creator.id))+ ((state.issue as Issue).status == "OPEN" &&+ (currentUser.value.id == (state.issue as Issue).assignee?.id ||+ currentUser.value.id == (state.issue as Issue).creator.id)));});@@ -713,36 +715,38 @@ export default {return state.new;});- const showTaskStageFlowBar = computed(() => {+ const showIssueStageFlowBar = computed(() => {return !state.new && workflowType.value != "SINGLE_STEP";});- const showTaskOutputPanel = computed(() => {+ const showIssueOutputPanel = computed(() => {return !state.new && outputFieldList.value.length > 0;});- const showTaskSqlPanel = computed(() => {+ const showIssueSqlPanel = computed(() => {return (- state.task.type == "bytebase.general" ||- state.task.type == "bytebase.database.schema.update"+ state.issue.type == "bytebase.general" ||+ state.issue.type == "bytebase.database.schema.update");});- const showTaskRollbackSqlPanel = computed(() => {- return state.task.type == "bytebase.database.schema.update";+ const showIssueRollbackSqlPanel = computed(() => {+ return state.issue.type == "bytebase.database.schema.update";});const applicableStatusTransitionList = computed(- (): TaskStatusTransition[] => {- const list: TaskStatusTransitionType[] = [];- if (currentUser.value.id === (state.task as Task).assignee?.id) {+ (): IssueStatusTransition[] => {+ const list: IssueStatusTransitionType[] = [];+ if (currentUser.value.id === (state.issue as Issue).assignee?.id) {list.push(- ...ASSIGNEE_APPLICABLE_ACTION_LIST.get((state.task as Task).status)!+ ...ASSIGNEE_APPLICABLE_ACTION_LIST.get(+ (state.issue as Issue).status+ )!);}- if (currentUser.value.id === (state.task as Task).creator.id) {+ if (currentUser.value.id === (state.issue as Issue).creator.id) {CREATOR_APPLICABLE_ACTION_LIST.get(- (state.task as Task).status+ (state.issue as Issue).status)!.forEach((item) => {if (list.indexOf(item) == -1) {list.push(item);@@ -752,7 +756,7 @@ export default {return list.filter((item) => {- if (pendingResolve(state.task as Task)) {+ if (pendingResolve(state.issue as Issue)) {if (item == "NEXT") {return false;}@@ -764,8 +768,8 @@ export default {return true;}).map(- (type: TaskStatusTransitionType) =>- TASK_STATUS_TRANSITION_LIST.get(type)!+ (type: IssueStatusTransitionType) =>+ ISSUE_STATUS_TRANSITION_LIST.get(type)!);});@@ -778,8 +782,8 @@ export default {updateSql,updateRollbackSql,allowTransition,- tryStartTaskStatusTransition,- doTaskStatusTransition,+ tryStartIssueStatusTransition,+ doIssueStatusTransition,updateAssigneeId,updateSubscriberIdList,updateCustomField,@@ -788,17 +792,17 @@ export default {workflowType,allowCreate,currentUser,- taskTemplate,+ issueTemplate,outputFieldList,inputFieldList,allowEditSidebar,allowEditOutput,allowEditNameAndDescription,allowEditSql,- showTaskStageFlowBar,- showTaskOutputPanel,- showTaskSqlPanel,- showTaskRollbackSqlPanel,+ showIssueStageFlowBar,+ showIssueOutputPanel,+ showIssueSqlPanel,+ showIssueRollbackSqlPanel,applicableStatusTransitionList,};},diff --git a/frontend/src/views/TaskHighlightPanel.vue b/frontend/src/views/IssueHighlightPanel.vuesimilarity index 70%rename from frontend/src/views/TaskHighlightPanel.vuerename to frontend/src/views/IssueHighlightPanel.vueindex 5320dbdb16..be1cb1bdda 100644--- a/frontend/src/views/TaskHighlightPanel.vue+++ b/frontend/src/views/IssueHighlightPanel.vue@@ -4,10 +4,10 @@<div class="flex flex-col"><div class="flex items-center"><div>- <TaskStatusIcon+ <IssueStatusIconv-if="!$props.new"- :taskStatus="task.status"- :stageStatus="activeStage(task).status"+ :issueStatus="issue.status"+ :stageStatus="activeStage(issue).status"/></div><BBTextField@@ -17,21 +17,21 @@:focusOnMount="$props.new":bordered="false":value="state.name"- :placeholder="'Task name'"+ :placeholder="'Issue name'"@end-editing="(text) => trySaveName(text)"/></div><div v-if="!$props.new"><p class="text-sm text-control-light">- #{{ task.id }} opened by+ #{{ issue.id }} opened by<router-link- :to="`/u/${task.creator.id}`"+ :to="`/u/${issue.creator.id}`"class="font-medium text-control hover:underline"- >{{ task.creator.name }}</router-link+ >{{ issue.creator.name }}</router-link>at<span href="#" class="font-medium text-control">{{- moment(task.updatedTs).format("LLL")+ moment(issue.updatedTs).format("LLL")}}</span></p></div>@@ -45,9 +45,9 @@<script lang="ts">import { reactive, watch, PropType } from "vue";-import TaskStatusIcon from "../components/TaskStatusIcon.vue";+import IssueStatusIcon from "../components/IssueStatusIcon.vue";import { activeStage } from "../utils";-import { Task } from "../types";+import { Issue } from "../types";interface LocalState {editing: boolean;@@ -55,12 +55,12 @@ interface LocalState {}export default {- name: "TaskHighlightPanel",+ name: "IssueHighlightPanel",emits: ["update-name"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},new: {required: true,@@ -71,23 +71,23 @@ export default {type: Boolean,},},- components: { TaskStatusIcon },+ components: { IssueStatusIcon },setup(props, { emit }) {const state = reactive<LocalState>({editing: false,- name: props.task.name,+ name: props.issue.name,});watch(- () => props.task,- (curTask, _) => {- state.name = curTask.name;+ () => props.issue,+ (curIssue, _) => {+ state.name = curIssue.name;});const trySaveName = (text: string) => {state.name = text;- if (text != props.task.name) {+ if (text != props.issue.name) {emit("update-name", state.name);}};diff --git a/frontend/src/views/TaskOutputPanel.vue b/frontend/src/views/IssueOutputPanel.vuesimilarity index 81%rename from frontend/src/views/TaskOutputPanel.vuerename to frontend/src/views/IssueOutputPanel.vueindex d25fd7b159..65e20a7dea 100644--- a/frontend/src/views/TaskOutputPanel.vue+++ b/frontend/src/views/IssueOutputPanel.vue@@ -2,7 +2,7 @@<h2 class="px-4 text-lg font-medium">Output<span class="text-base font-normal text-control-light">- (these fields must be filled by the assignee before resolving the task)+ (these fields must be filled by the assignee before resolving the issue)</span></h2>@@ -18,7 +18,9 @@class="ml-2 normal-link">{{- task.type == "bytebase.database.create" ? "+ Create" : "+ Grant"+ issue.type == "bytebase.database.create"+ ? "+ Create"+ : "+ Grant"}}</router-link></template>@@ -103,18 +105,18 @@View</router-link></template>- <template v-if="task.type == 'bytebase.database.create'">+ <template v-if="issue.type == 'bytebase.database.create'"><div- v-if="field.resolved(taskContext)"+ v-if="field.resolved(issueContext)"class="text-sm text-success">(Created)</div><div v-else class="text-sm text-error">(To be created)</div></template>- <template v-else-if="task.type == 'bytebase.database.grant'">+ <template v-else-if="issue.type == 'bytebase.database.grant'"><div- v-if="field.resolved(taskContext)"+ v-if="field.resolved(issueContext)"class="text-sm text-success">(Granted)@@ -135,22 +137,22 @@ import isEqual from "lodash-es/isEqual";import { toClipboard } from "@soerenmartius/vue3-clipboard";import DatabaseSelect from "../components/DatabaseSelect.vue";import { fullDatabasePath } from "../utils";-import { TaskField, TaskBuiltinFieldId, TaskContext } from "../plugins";-import { DatabaseId, DataSource, EnvironmentId, Task } from "../types";+import { IssueField, IssueBuiltinFieldId, IssueContext } from "../plugins";+import { DatabaseId, DataSource, EnvironmentId, Issue } from "../types";interface LocalState {}export default {- name: "TaskOutputPanel",+ name: "IssueOutputPanel",emits: ["update-custom-field"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},fieldList: {required: true,- type: Object as PropType<TaskField[]>,+ type: Object as PropType<IssueField[]>,},allowEdit: {required: true,@@ -168,21 +170,21 @@ export default {const environmentId = computed((): EnvironmentId => {- return props.task.payload[TaskBuiltinFieldId.ENVIRONMENT];+ return props.issue.payload[IssueBuiltinFieldId.ENVIRONMENT];});- const fieldValue = (field: TaskField): string => {- return props.task.payload[field.id];+ const fieldValue = (field: IssueField): string => {+ return props.issue.payload[field.id];};- const taskContext = computed(- (): TaskContext => {+ const issueContext = computed(+ (): IssueContext => {return {store,currentUser: currentUser.value,new: false,- task: props.task,+ issue: props.issue,};});@@ -192,8 +194,8 @@ export default {return false;}return (- props.task.type == "bytebase.database.create" ||- props.task.type == "bytebase.database.grant"+ props.issue.type == "bytebase.database.create" ||+ props.issue.type == "bytebase.database.grant");});@@ -201,32 +203,32 @@ export default {return link?.trim().length > 0;};- const databaseActionLink = (field: TaskField): string => {+ const databaseActionLink = (field: IssueField): string => {const queryParamList: string[] = [];- if (props.task.type == "bytebase.database.create") {+ if (props.issue.type == "bytebase.database.create") {if (environmentId.value) {queryParamList.push(`environment=${environmentId.value}`);}- const databaseName = props.task.payload[TaskBuiltinFieldId.DATABASE];+ const databaseName = props.issue.payload[IssueBuiltinFieldId.DATABASE];queryParamList.push(`name=${databaseName}`);- queryParamList.push(`task=${props.task.id}`);+ queryParamList.push(`issue=${props.issue.id}`);- queryParamList.push(`from=${props.task.type}`);+ queryParamList.push(`from=${props.issue.type}`);return "/db/new?" + queryParamList.join("&");}- if (props.task.type == "bytebase.database.grant") {- const databaseId = props.task.payload[TaskBuiltinFieldId.DATABASE];+ if (props.issue.type == "bytebase.database.grant") {+ const databaseId = props.issue.payload[IssueBuiltinFieldId.DATABASE];if (databaseId) {const database = store.getters["database/databaseById"](databaseId);if (database) {// TODO: Hard-code from DatabaseGrantTemplateconst READ_ONLY_ID = 100;- const readOnly = props.task.payload[READ_ONLY_ID];+ const readOnly = props.issue.payload[READ_ONLY_ID];let dataSourceId;for (const dataSource of database.dataSourceList) {if (readOnly && dataSource.type == "RO") {@@ -243,9 +245,9 @@ export default {queryParamList.push(`datasource=${dataSourceId}`);- queryParamList.push(`grantee=${props.task.creator.id}`);+ queryParamList.push(`grantee=${props.issue.creator.id}`);- queryParamList.push(`task=${props.task.id}`);+ queryParamList.push(`issue=${props.issue.id}`);return "/db/grant?" + queryParamList.join("&");}@@ -256,7 +258,7 @@ export default {return "";};- const databaseViewLink = (field: TaskField): string => {+ const databaseViewLink = (field: IssueField): string => {if (field.type == "Database") {const databaseId = fieldValue(field);if (databaseId) {@@ -269,8 +271,8 @@ export default {return "";};- const copyText = (field: TaskField) => {- toClipboard(props.task.payload[field.id]).then(() => {+ const copyText = (field: IssueField) => {+ toClipboard(props.issue.payload[field.id]).then(() => {store.dispatch("notification/pushNotification", {module: "bytebase",style: "INFO",@@ -294,7 +296,7 @@ export default {};const trySaveCustomField = (- field: TaskField,+ field: IssueField,value: string | DatabaseId) => {if (!isEqual(value, fieldValue(field))) {@@ -306,7 +308,7 @@ export default {state,environmentId,fieldValue,- taskContext,+ issueContext,allowEditDatabase,isValidLink,databaseActionLink,diff --git a/frontend/src/views/TaskSidebar.vue b/frontend/src/views/IssueSidebar.vuesimilarity index 83%rename from frontend/src/views/TaskSidebar.vuerename to frontend/src/views/IssueSidebar.vueindex 34900e1b02..6b014a5e90 100644--- a/frontend/src/views/TaskSidebar.vue+++ b/frontend/src/views/IssueSidebar.vue@@ -8,9 +8,9 @@</h2><div class="col-span-2"><span class="flex items-center space-x-2">- <TaskStatusIcon :taskStatus="task.status" :size="'normal'" />+ <IssueStatusIcon :issueStatus="issue.status" :size="'normal'" /><span class="text-main capitalize">- {{ task.status.toLowerCase() }}+ {{ issue.status.toLowerCase() }}</span></span></div>@@ -19,11 +19,11 @@<h2 class="textlabel flex items-center col-span-1 col-start-1">Assignee<span v-if="$props.new" class="text-red-600">*</span></h2>- <!-- Only DBA can be assigned to the task -->+ <!-- Only DBA can be assigned to the issue --><div class="col-span-2"><PrincipalSelect:disabled="!allowEditAssignee"- :selectedId="$props.new ? task.assigneeId : task.assignee?.id"+ :selectedId="$props.new ? issue.assigneeId : issue.assignee?.id":allowedRoleList="['DBA']"@select-principal-id="(principalId) => {@@ -153,14 +153,14 @@Updated</h2><span class="textfield col-span-2">- {{ moment(task.updatedTs).format("LLL") }}</span+ {{ moment(issue.updatedTs).format("LLL") }}</span><h2 class="textlabel flex items-center col-span-1 col-start-1">Created</h2><span class="textfield col-span-2">- {{ moment(task.createdTs).format("LLL") }}</span+ {{ moment(issue.createdTs).format("LLL") }}</span><h2 class="textlabel flex items-center col-span-1 col-start-1">Creator@@ -168,13 +168,13 @@<ul class="col-span-2"><li class="flex justify-start items-center space-x-2"><div class="flex-shrink-0">- <BBAvatar :size="'small'" :username="task.creator.name" />+ <BBAvatar :size="'small'" :username="issue.creator.name" /></div><router-link- :to="`/u/${task.creator.id}`"+ :to="`/u/${issue.creator.id}`"class="text-sm font-medium text-main hover:underline">- {{ task.creator.name }}+ {{ issue.creator.name }}</router-link></li></ul>@@ -188,8 +188,8 @@class="textlabel flex items-center col-span-1 col-start-1 whitespace-nowrap">{{- task.subscriberList.length +- (task.subscriberList.length > 1 ? " subscribers" : " subscriber")+ issue.subscriberList.length ++ (issue.subscriberList.length > 1 ? " subscribers" : " subscriber")}}</h2><div v-if="subscriberList.length > 0" class="col-span-3 col-start-1">@@ -239,8 +239,8 @@ import DatabaseSelect from "../components/DatabaseSelect.vue";import EnvironmentSelect from "../components/EnvironmentSelect.vue";import ProjectSelect from "../components/ProjectSelect.vue";import PrincipalSelect from "../components/PrincipalSelect.vue";-import TaskStatusIcon from "../components/TaskStatusIcon.vue";-import { TaskField, DatabaseFieldPayload } from "../plugins";+import IssueStatusIcon from "../components/IssueStatusIcon.vue";+import { IssueField, DatabaseFieldPayload } from "../plugins";import {Database,DatabaseId,@@ -248,8 +248,8 @@ import {EnvironmentId,Principal,Project,- Task,- TaskNew,+ Issue,+ IssueNew,UNKNOWN_ID,} from "../types";import { activeDatabaseId, isDBAOrOwner } from "../utils";@@ -257,16 +257,16 @@ import { activeDatabaseId, isDBAOrOwner } from "../utils";interface LocalState {}export default {- name: "TaskSidebar",+ name: "IssueSidebar",emits: ["update-assignee-id","update-subscriber-list","update-custom-field",],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task | TaskNew>,+ type: Object as PropType<Issue | IssueNew>,},new: {required: true,@@ -274,7 +274,7 @@ export default {},fieldList: {required: true,- type: Object as PropType<TaskField[]>,+ type: Object as PropType<IssueField[]>,},allowEdit: {required: true,@@ -286,7 +286,7 @@ export default {ProjectSelect,EnvironmentSelect,PrincipalSelect,- TaskStatusIcon,+ IssueStatusIcon,},setup(props, { emit }) {const store = useStore();@@ -294,27 +294,27 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());- const fieldValue = (field: TaskField): string | DatabaseFieldPayload => {- return props.task.payload[field.id];+ const fieldValue = (field: IssueField): string | DatabaseFieldPayload => {+ return props.issue.payload[field.id];};const database = computed((): Database => {const databaseId = props.new- ? (props.task as TaskNew).stageList[0].databaseId- : activeDatabaseId(props.task as Task);+ ? (props.issue as IssueNew).stageList[0].databaseId+ : activeDatabaseId(props.issue as Issue);return store.getters["database/databaseById"](databaseId);});const project = computed((): Project => {- // For new task, we derive the project from the 1st stage's database.- // For existing task, we use task's project. We can't derive from the stage's database because- // database may be transferred to a different project after creating the task.+ // For new issue, we derive the project from the 1st stage's database.+ // For existing issue, we use issue's project. We can't derive from the stage's database because+ // database may be transferred to a different project after creating the issue.return props.new? database.value.project- : (props.task as Task).project;+ : (props.issue as Issue).project;});@@ -325,7 +325,7 @@ export default {);const isCurrentUserSubscribed = computed((): boolean => {- for (const principal of (props.task as Task).subscriberList) {+ for (const principal of (props.issue as Issue).subscriberList) {if (currentUser.value.id == principal.id) {return true;}@@ -335,7 +335,7 @@ export default {const subscriberList = computed((): Principal[] => {const list: Principal[] = [];- (props.task as Task).subscriberList.forEach((principal: Principal) => {+ (props.issue as Issue).subscriberList.forEach((principal: Principal) => {// Put the current user at the front if in the list.if (currentUser.value.id == principal.id) {list.unshift(principal);@@ -347,20 +347,20 @@ export default {});const allowEditAssignee = computed(() => {- // We allow the current assignee or DBA to re-assign the task.- // Though only DBA can be assigned to the task, the current+ // We allow the current assignee or DBA to re-assign the issue.+ // Though only DBA can be assigned to the issue, the current// assignee might not have DBA role in case its role is revoked after- // being assigned to the task.+ // being assigned to the issue.return (props.new ||- ((props.task as Task).status == "OPEN" &&- (currentUser.value.id == (props.task as Task).assignee?.id ||+ ((props.issue as Issue).status == "OPEN" &&+ (currentUser.value.id == (props.issue as Issue).assignee?.id ||isDBAOrOwner(currentUser.value.role))));});const trySaveCustomField = (- field: TaskField,+ field: IssueField,value: string | EnvironmentId | DatabaseFieldPayload) => {if (!isEqual(value, fieldValue(field))) {@@ -368,7 +368,7 @@ export default {}};- const trySaveDatabaseNew = (field: TaskField, isNew: boolean) => {+ const trySaveDatabaseNew = (field: IssueField, isNew: boolean) => {// Do a deep clone to prevent caller accidentally changes the original data.const payload: DatabaseFieldPayload = cloneDeep(fieldValue(field)@@ -377,7 +377,7 @@ export default {trySaveCustomField(field, payload);};- const trySaveDatabaseName = (field: TaskField, value: string) => {+ const trySaveDatabaseName = (field: IssueField, value: string) => {// Do a deep clone to prevent caller accidentally changes the original data.const payload: DatabaseFieldPayload = cloneDeep(fieldValue(field)@@ -386,7 +386,7 @@ export default {trySaveCustomField(field, payload);};- const trySaveDatabaseId = (field: TaskField, value: DatabaseId) => {+ const trySaveDatabaseId = (field: IssueField, value: DatabaseId) => {// Do a deep clone to prevent caller accidentally changes the original data.const payload: DatabaseFieldPayload = cloneDeep(fieldValue(field)@@ -395,7 +395,7 @@ export default {trySaveCustomField(field, payload);};- const trySaveDatabaseReadOnly = (field: TaskField, value: boolean) => {+ const trySaveDatabaseReadOnly = (field: IssueField, value: boolean) => {// Do a deep clone to prevent caller accidentally changes the original data.const payload: DatabaseFieldPayload = cloneDeep(fieldValue(field)@@ -405,9 +405,9 @@ export default {};const toggleSubscription = () => {- const list = cloneDeep((props.task as Task).subscriberList);+ const list = cloneDeep((props.issue as Issue).subscriberList);if (isCurrentUserSubscribed.value) {- const index = (props.task as Task).subscriberList.findIndex(+ const index = (props.issue as Issue).subscriberList.findIndex((item: Principal) => {return item.id == currentUser.value.id;}diff --git a/frontend/src/views/TaskSqlPanel.vue b/frontend/src/views/IssueSqlPanel.vuesimilarity index 86%rename from frontend/src/views/TaskSqlPanel.vuerename to frontend/src/views/IssueSqlPanel.vueindex f55e5a723c..8684183f5a 100644--- a/frontend/src/views/TaskSqlPanel.vue+++ b/frontend/src/views/IssueSqlPanel.vue@@ -53,7 +53,7 @@@input="(e) => {sizeToFit(e.target);- // When creating the task, we will emit the event on keystroke to update the in-memory state.+ // When creating the issue, we will emit the event on keystroke to update the in-memory state.if ($props.new) {$emit('update-sql', state.editSql);}@@ -87,7 +87,7 @@ import {watch,computed,} from "vue";-import { Task } from "../types";+import { Issue } from "../types";import { sizeToFit } from "../utils";import command from "../store/modules/command";@@ -97,12 +97,12 @@ interface LocalState {}export default {- name: "TaskSqlPanel",+ name: "IssueSqlPanel",emits: ["update-sql"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},new: {required: true,@@ -121,13 +121,13 @@ export default {setup(props, { emit }) {const editSqlTextArea = ref();- const effectiveSql = (task: Task): string => {- return (props.rollback ? task.rollbackSql : task.sql) || "";+ const effectiveSql = (issue: Issue): string => {+ return (props.rollback ? issue.rollbackSql : issue.sql) || "";};const state = reactive<LocalState>({editing: false,- editSql: effectiveSql(props.task),+ editSql: effectiveSql(props.issue),});const keyboardHandler = (e: KeyboardEvent) => {@@ -136,11 +136,11 @@ export default {cancelEdit();} else if (e.code == "Enter" && e.metaKey) {if (props.rollback) {- if (state.editSql != props.task.rollbackSql) {+ if (state.editSql != props.issue.rollbackSql) {saveEdit();}} else {- if (state.editSql != props.task.sql) {+ if (state.editSql != props.issue.sql) {saveEdit();}}@@ -170,7 +170,7 @@ export default {window.removeEventListener("resize", resizeTextAreaHandler);});- // Reset the edit state after creating the task.+ // Reset the edit state after creating the issue.watch(() => props.new,(curNew, prevNew) => {@@ -182,12 +182,12 @@ export default {const allowSave = computed(() => {return props.rollback- ? state.editSql != props.task.rollbackSql- : state.editSql != props.task.sql;+ ? state.editSql != props.issue.rollbackSql+ : state.editSql != props.issue.sql;});const beginEdit = () => {- state.editSql = effectiveSql(props.task);+ state.editSql = effectiveSql(props.issue);state.editing = true;nextTick(() => {editSqlTextArea.value.focus();@@ -195,14 +195,14 @@ export default {};const saveEdit = () => {- emit("update-sql", state.editSql, (updatedTask: Task) => {- state.editSql = effectiveSql(updatedTask);+ emit("update-sql", state.editSql, (updatedIssue: Issue) => {+ state.editSql = effectiveSql(updatedIssue);state.editing = false;});};const cancelEdit = () => {- state.editSql = effectiveSql(props.task);+ state.editSql = effectiveSql(props.issue);state.editing = false;};diff --git a/frontend/src/views/TaskStageFlow.vue b/frontend/src/views/IssueStageFlow.vuesimilarity index 94%rename from frontend/src/views/TaskStageFlow.vuerename to frontend/src/views/IssueStageFlow.vueindex a71c2a8eac..5f07315500 100644--- a/frontend/src/views/TaskStageFlow.vue+++ b/frontend/src/views/IssueStageFlow.vue@@ -18,7 +18,7 @@><template v-if="stage.status === 'PENDING'"><span- v-if="activeStage(task).id === stage.id"+ v-if="activeStage(issue).id === stage.id"class="h-1.5 w-1.5 bg-blue-600 rounded-full"aria-hidden="true"></span>@@ -82,7 +82,7 @@</span><divv-if="- activeStage(task).id === stage.id &&+ activeStage(issue).id === stage.id &&applicableStageTransitionList.length > 0"class="flex flex-row space-x-1 mr-4"@@ -231,7 +231,7 @@><StageStatusTransitionForm:okText="modalState.okText"- :task="task"+ :issue="issue":transition="modalState.transition"@submit="(transition, comment) => {@@ -253,7 +253,7 @@ import { computed, reactive, PropType } from "vue";import { useStore } from "vuex";import StageStatusTransitionForm from "../components/StageStatusTransitionForm.vue";import {- Task,+ Issue,StageId,StageStatus,StageStatusTransitionType,@@ -303,12 +303,12 @@ interface ModalState {}export default {- name: "TaskStageFlow",+ name: "IssueStageFlow",emits: ["change-stage-status"],props: {- task: {+ issue: {required: true,- type: Object as PropType<Task>,+ type: Object as PropType<Issue>,},},components: { StageStatusTransitionForm },@@ -325,13 +325,13 @@ export default {const currentUser = computed(() => store.getters["auth/currentUser"]());const stageList = computed<FlowItem[]>(() => {- return props.task.stageList.map((stage) => {+ return props.issue.stageList.map((stage) => {return {id: stage.id,title: stage.name,status: stage.status,link: (): string => {- return `/task/${props.task.id}`;+ return `/issue/${props.issue.id}`;},};});@@ -340,7 +340,7 @@ export default {const stageIconClass = (stage: FlowItem) => {switch (stage.status) {case "PENDING":- if (activeStage(props.task).id === stage.id) {+ if (activeStage(props.issue).id === stage.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 stageTextClass = (stage: FlowItem) => {let textClass =- activeStage(props.task).id === stage.id+ activeStage(props.issue).id === stage.id? "font-medium ": "font-normal ";switch (stage.status) {@@ -366,7 +366,7 @@ export default {case "DONE":return textClass + "text-control";case "PENDING":- if (activeStage(props.task).id === stage.id) {+ if (activeStage(props.issue).id === stage.id) {return textClass + "text-blue-600";}return textClass + "text-control";@@ -378,12 +378,12 @@ export default {};const applicableStageTransitionList = computed(() => {- const stage = activeStage(props.task as Task);+ const stage = activeStage(props.issue as Issue);const list: StageStatusTransitionType[] = [];- if (currentUser.value.id === (props.task as Task).assignee?.id) {+ if (currentUser.value.id === (props.issue as Issue).assignee?.id) {list.push(...ASSIGNEE_APPLICABLE_STAGE_ACTION_LIST.get(stage.status)!);}- if (currentUser.value.id === (props.task as Task).creator.id) {+ if (currentUser.value.id === (props.issue as Issue).creator.id) {CREATOR_APPLICABLE_STAGE_ACTION_LIST.get(stage.status)!.forEach((item) => {if (list.indexOf(item) == -1) {@@ -409,7 +409,7 @@ export default {modalState.title =transition.actionName +' "' +- activeStage(props.task as Task).name ++ activeStage(props.issue as Issue).name +'" ?';modalState.transition = transition;modalState.show = true;diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vueindex cf70f1ef1d..6c7afad045 100644--- a/frontend/src/views/ProjectDashboard.vue+++ b/frontend/src/views/ProjectDashboard.vue@@ -69,10 +69,10 @@ export default {// Select "All"return list;}- return list.filter((task) => {+ return list.filter((issue) => {return (!state.searchText ||- task.name.toLowerCase().includes(state.searchText.toLowerCase())+ issue.name.toLowerCase().includes(state.searchText.toLowerCase()));});};diff --git a/frontend/src/views/ProjectDetail.vue b/frontend/src/views/ProjectDetail.vueindex 60941f874f..659a3bb109 100644--- a/frontend/src/views/ProjectDetail.vue+++ b/frontend/src/views/ProjectDetail.vue@@ -23,17 +23,17 @@<DatabaseTable :mode="'PROJECT'" :databaseList="databaseList" /></div><div class="space-y-2">- <p class="text-lg font-medium leading-7 text-main">Tasks</p>- <TaskTable+ <p class="text-lg font-medium leading-7 text-main">Issues</p>+ <IssueTable:mode="'PROJECT'"- :taskSectionList="[+ :issueSectionList="[{title: 'In progress',- list: state.progressTaskList,+ list: state.progressIssueList,},{title: 'Recently Closed',- list: state.closedTaskList,+ list: state.closedIssueList,},]"/>@@ -83,8 +83,8 @@ import ArchiveBanner from "../components/ArchiveBanner.vue";import DatabaseTable from "../components/DatabaseTable.vue";import ProjectGeneralSettingPanel from "../components/ProjectGeneralSettingPanel.vue";import ProjectMemberPanel from "../components/ProjectMemberPanel.vue";-import TaskTable from "../components/TaskTable.vue";-import { ProjectPatch, Task } from "../types";+import IssueTable from "../components/IssueTable.vue";+import { ProjectPatch, Issue } from "../types";const OVERVIEW_TAB = 0;const REPO_TAB = 1;@@ -92,8 +92,8 @@ const SETTING_TAB = 2;interface LocalState {selectedIndex: number;- progressTaskList: Task[];- closedTaskList: Task[];+ progressIssueList: Issue[];+ closedIssueList: Issue[];}export default {@@ -103,7 +103,7 @@ export default {DatabaseTable,ProjectGeneralSettingPanel,ProjectMemberPanel,- TaskTable,+ IssueTable,},props: {projectSlug: {@@ -115,8 +115,8 @@ export default {const store = useStore();const state = reactive<LocalState>({selectedIndex: OVERVIEW_TAB,- progressTaskList: [],- closedTaskList: [],+ progressIssueList: [],+ closedIssueList: [],});const currentUser = computed(() => store.getters["auth/currentUser"]());@@ -142,26 +142,29 @@ export default {watchEffect(prepareDatabaseList);- const prepareTaskList = () => {+ const prepareIssueList = () => {store- .dispatch("task/fetchTaskListForProject", idFromSlug(props.projectSlug))- .then((taskList: Task[]) => {- state.progressTaskList = [];- state.closedTaskList = [];- for (const task of taskList) {+ .dispatch(+ "issue/fetchIssueListForProject",+ idFromSlug(props.projectSlug)+ )+ .then((issueList: Issue[]) => {+ state.progressIssueList = [];+ state.closedIssueList = [];+ for (const issue of issueList) {// "OPEN"- if (task.status === "OPEN") {- state.progressTaskList.push(task);+ if (issue.status === "OPEN") {+ state.progressIssueList.push(issue);}// "DONE" or "CANCELED"- else if (task.status === "DONE" || task.status === "CANCELED") {- state.closedTaskList.push(task);+ else if (issue.status === "DONE" || issue.status === "CANCELED") {+ state.closedIssueList.push(issue);}}});};- watchEffect(prepareTaskList);+ watchEffect(prepareIssueList);// Only the project owner can archive/restore the project info.// This means even the workspace owner won't be able to edit it.