Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat(frontend): ghost issue creation part.2 (#1366)
Liu Jifaed3336db94
diff --git a/frontend/src/components/Issue/PipelineGhostFlow.vue b/frontend/src/components/Issue/PipelineGhostFlow.vueindex 91dde9333d..c7c9a67f7a 100644--- a/frontend/src/components/Issue/PipelineGhostFlow.vue+++ b/frontend/src/components/Issue/PipelineGhostFlow.vue@@ -6,73 +6,64 @@</template></PipelineStageList>- <!--- We don't parse the tasks' dependency relationships here, since we have exactly 1- [sync->cutover->drop-original-table] thread in each stage.-- If we support multi-tenant-gh-ost mode in the future, we may have more than- one series of [sync->cutover->drop-original-table] threads.- Then we may repeat the horizon scroller. Each row is a thread of gh-ost migration.- -->- <NScrollbar x-scrollable>- <div class="task-list p-2 md:flex md:items-center relative">- <template v-for="(task, j) in taskList" :key="j">- <div- class="task px-2 py-1 cursor-pointer border rounded md:w-64 flex justify-between items-center"- :class="taskClass(task)"- @click="onClickTask(task, j)"- >- <div class="flex-1">- <div class="flex items-center pb-1">- <TaskStatusIcon- :create="create"- :active="isActiveTask(task)"- :status="task.status"- class="transform scale-75"- />- <heroicons-solid:arrow-narrow-right- v-if="isActiveTask(task)"- class="name w-5 h-5"- />- <div class="name">{{ databaseOfTask(task).name }}</div>- </div>- <div- class="flex items-center px-1 py-1 whitespace-pre-wrap break-all"- >- {{ taskNameOfTask(task) }}- </div>+ <div+ class="task-list p-2 lg:flex lg:items-center relative space-y-2 lg:space-y-0"+ >+ <template v-for="(task, i) in taskList" :key="i">+ <div+ class="task px-2 py-1 cursor-pointer border rounded lg:flex-1 flex justify-between items-center"+ :class="taskClass(task)"+ @click="onClickTask(task, i)"+ >+ <div class="flex-1">+ <div class="flex items-center pb-1">+ <TaskStatusIcon+ :create="create"+ :active="isActiveTask(task)"+ :status="task.status"+ class="transform scale-75"+ />+ <heroicons-solid:arrow-narrow-right+ v-if="isActiveTask(task)"+ class="name w-5 h-5"+ />+ <div class="name">{{ databaseOfTask(task).name }}</div></div>- <div v-if="getTaskProgress(task) > 0">- <BBProgressPie- class="w-9 h-9 text-info"- :thickness="2"- :percent="getTaskProgress(task)"- >- <template #default="{ percent }">- <span class="text-xs scale-90">{{ percent }}%</span>- </template>- </BBProgressPie>+ <div+ class="flex items-center px-1 py-1 whitespace-pre-wrap break-all"+ >+ {{ taskNameOfTask(task) }}</div></div>-- <div- v-if="j < taskList.length - 1"- class="hidden md:flex items-center justify-center w-4 h-2 overflow-visible relative"- >- <!-- show an arrow indicator between tasks -->- <heroicons-outline:chevron-right class="w-4 h-4" />+ <div v-if="getTaskProgress(task) > 0">+ <BBProgressPie+ class="w-9 h-9 text-info"+ :thickness="2"+ :percent="getTaskProgress(task)"+ >+ <template #default="{ percent }">+ <span class="text-xs scale-90">{{ percent }}%</span>+ </template>+ </BBProgressPie></div>- </template>- </div>+ </div>++ <div+ v-if="i < taskList.length - 1"+ class="hidden lg:flex items-center justify-center w-4 h-2 overflow-visible relative"+ >+ <!-- show an arrow indicator between tasks -->+ <heroicons-outline:chevron-right class="w-4 h-4" />+ </div>+ </template>+ </div>- <div class="absolute right-0 top-0 bottom-0 w-10 hidden md:block"></div>- </NScrollbar>+ <div class="absolute right-0 top-0 bottom-0 w-10 hidden md:block"></div></div></template><script lang="ts" setup>import { computed, watchEffect } from "vue";-import { NScrollbar } from "naive-ui";import { useI18n } from "vue-i18n";import type {Pipeline,diff --git a/frontend/src/components/Issue/logic/GhostModeProvider.ts b/frontend/src/components/Issue/logic/GhostModeProvider.tsindex 27a50d38de..9ccd81a7bc 100644--- a/frontend/src/components/Issue/logic/GhostModeProvider.ts+++ b/frontend/src/components/Issue/logic/GhostModeProvider.ts@@ -1,4 +1,5 @@import { computed, defineComponent } from "vue";+import { cloneDeep } from "lodash-es";import { provideIssueLogic, useIssueLogic } from "./index";import { maybeFormatStatementOnSave, useCommonLogic } from "./common";import {@@ -13,7 +14,7 @@ import { useDatabaseStore } from "@/store";export default defineComponent({name: "GhostModeProvider",setup() {- const { create, issue, selectedTask } = useIssueLogic();+ const { create, issue, selectedTask, createIssue } = useIssueLogic();const databaseStore = useDatabaseStore();// In gh-ost mode, each stage can own its SQL statement@@ -34,14 +35,14 @@ export default defineComponent({});const doCreate = () => {- const issueCreate = issue.value as IssueCreate;+ const issueCreate = cloneDeep(issue.value as IssueCreate);// for gh-ost mode, copy user edited tasks back to issue.createContext// only the first subtask (bb.task.database.schema.update.ghost.sync) has statementconst stageList = issueCreate.pipeline!.stageList;const createContext =issueCreate.createContext as UpdateSchemaGhostContext;- const detailList = createContext.updateSchemaDetailList;+ const detailList = createContext.updateSchemaGhostDetailList;stageList.forEach((stage, i) => {const detail = detailList[i];const syncTask = stage.taskList.find(@@ -54,6 +55,8 @@ export default defineComponent({detail.statement = maybeFormatStatementOnSave(syncTask.statement, db);detail.earliestAllowedTs = syncTask.earliestAllowedTs;});++ createIssue(issueCreate);};const logic = {diff --git a/frontend/src/plugins/issue/logic/initialize/ghost.ts b/frontend/src/plugins/issue/logic/initialize/ghost.tsindex 6137a2a338..59a9465201 100644--- a/frontend/src/plugins/issue/logic/initialize/ghost.ts+++ b/frontend/src/plugins/issue/logic/initialize/ghost.ts@@ -32,7 +32,7 @@ const buildNewGhostIssue = async (const databaseList = findDatabaseListByQuery(context);const createContext: UpdateSchemaGhostContext = {- updateSchemaDetailList: databaseList.map((db) => {+ updateSchemaGhostDetailList: databaseList.map((db) => {return {databaseId: db.id,databaseName: db.name,diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.tsindex 09840874f4..83c6ca186e 100644--- a/frontend/src/types/issue.ts+++ b/frontend/src/types/issue.ts@@ -60,7 +60,7 @@ export type UpdateSchemaContext = {};export type UpdateSchemaGhostContext = {- updateSchemaDetailList: UpdateSchemaGhostDetail[];+ updateSchemaGhostDetailList: UpdateSchemaGhostDetail[];};export type PITRContext = {