Skip to content

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

refactor: remove legacy issue detail page and cleanup IssueV1 components (#18968)

boojackfe0e370272ac
diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
index a0b3ab4a4a..0ac9d18875 100644
--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepPanel.vue
@@ -190,7 +190,7 @@ import {
InstanceSelect,
ProjectSelect,
} from "@/components/v2";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
experimentalCreateIssueByPlan,
useCurrentProjectV1,
@@ -410,7 +410,7 @@ const create = async () => {
{ skipRollout: true }
);
router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(createdIssue.name),
issueId: extractIssueUID(createdIssue.name),
diff --git a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
index ffcf207ee6..89c5fa1322 100644
--- a/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
+++ b/frontend/src/components/GrantRequestPanel/GrantRequestPanel.vue
@@ -55,7 +55,7 @@ import IssueLabels from "@/components/IssueV1/components/Sidebar/IssueLabels.vue
import AddProjectMemberForm from "@/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue";
import { Drawer, DrawerContent } from "@/components/v2";
import { issueServiceClientConnect } from "@/connect";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { useCurrentUserV1, useProjectV1Store } from "@/store";
import type { DatabaseResource } from "@/types";
import { getUserEmailInBinding } from "@/types";
@@ -173,7 +173,7 @@ const doCreateIssue = async () => {
const response = await issueServiceClientConnect.createIssue(request);
const route = router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(response.name),
issueId: extractIssueUID(response.name),
diff --git a/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue b/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue
deleted file mode 100644
index d54d46f70e..0000000000
--- a/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue
+++ /dev/null
@@ -1,174 +0,0 @@
-<template>
- <div ref="containerRef" class="h-full flex flex-col">
- <div class="border-b">
- <BannerSection v-if="!isCreating" />
- <FeatureAttention :feature="PlanFeature.FEATURE_APPROVAL_WORKFLOW" />
- <HeaderSection />
- </div>
-
- <div class="flex-1 flex flex-row">
- <div
- class="flex-1 flex flex-col hide-scrollbar divide-y overflow-x-hidden py-2"
- >
- <div
- class="w-full mx-auto flex flex-col justify-start items-start px-4 mb-4 gap-y-4"
- >
- <div
- v-if="requestRole"
- class="w-full flex flex-col justify-start items-start"
- >
- <span class="flex items-center textinfolabel mb-2">
- {{ $t("role.self") }}
- </span>
- <div class="flex flex-row justify-start items-start">
- {{ displayRoleTitle(requestRole) }}
- </div>
- </div>
- <div
- v-if="condition?.databaseResources"
- class="w-full flex flex-col justify-start items-start"
- >
- <span class="flex items-center textinfolabel mb-2">
- {{ $t("common.database") }}
- </span>
- <div
- class="w-full flex flex-row justify-start items-start flex-wrap gap-2 gap-x-4"
- >
- <span v-if="condition.databaseResources.length === 0">{{
- $t("issue.grant-request.all-databases")
- }}</span>
- <DatabaseResourceTable
- v-else
- class="w-full"
- :database-resource-list="condition.databaseResources"
- />
- </div>
- </div>
- <div class="w-full flex flex-col justify-start items-start">
- <span class="flex items-center textinfolabel mb-2">
- {{ $t("issue.grant-request.expired-at") }}
- </span>
- <div>
- {{
- condition?.expiredTime
- ? dayjs(new Date(condition.expiredTime)).format("LLL")
- : $t("project.members.never-expires")
- }}
- </div>
- </div>
- </div>
-
- <DescriptionSection v-if="isCreating" />
- <IssueCommentSection v-if="!isCreating" />
- </div>
-
- <div
- v-if="sidebarMode == 'DESKTOP'"
- class="hide-scrollbar border-l"
- :style="{
- width: `${desktopSidebarWidth}px`,
- }"
- >
- <Sidebar />
- </div>
- </div>
- </div>
-
- <template v-if="sidebarMode === 'MOBILE'">
- <!-- mobile sidebar -->
- <Drawer :show="mobileSidebarOpen" @close="mobileSidebarOpen = false">
- <div
- style="
- min-width: 240px;
- width: 80vw;
- max-width: 320px;
- padding: 0.5rem 0;
- "
- >
- <Sidebar />
- </div>
- </Drawer>
- </template>
-
- <IssueReviewActionPanel
- :action="ongoingIssueReviewAction?.action"
- @close="ongoingIssueReviewAction = undefined"
- />
- <IssueStatusActionPanel
- :action="ongoingIssueStatusAction?.action"
- @close="ongoingIssueStatusAction = undefined"
- />
-</template>
-
-<script setup lang="ts">
-import { computedAsync } from "@vueuse/core";
-import { computed, ref } from "vue";
-import { FeatureAttention } from "@/components/FeatureGuard";
-import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";
-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import { displayRoleTitle } from "@/utils";
-import { convertFromCELString } from "@/utils/issue/cel";
-import { provideSidebarContext } from "../Plan/logic";
-import { Drawer } from "../v2";
-import {
- BannerSection,
- DatabaseResourceTable,
- DescriptionSection,
- HeaderSection,
- IssueCommentSection,
- IssueReviewActionPanel,
- IssueStatusActionPanel,
- Sidebar,
-} from "./components";
-import type { IssueReviewAction, IssueStatusAction } from "./logic";
-import { useIssueContext, usePollIssue } from "./logic";
-
-const containerRef = ref<HTMLElement>();
-const { isCreating, issue, events } = useIssueContext();
-
-const ongoingIssueReviewAction = ref<{
- action: IssueReviewAction;
-}>();
-const ongoingIssueStatusAction = ref<{
- action: IssueStatusAction;
-}>();
-
-const requestRole = computed(() => {
- return issue.value.grantRequest?.role;
-});
-
-const condition = computedAsync(async () => {
- const conditionExpression = await convertFromCELString(
- issue.value.grantRequest?.condition?.expression ?? ""
- );
- return conditionExpression;
-});
-
-usePollIssue();
-
-useEmitteryEventListener(
- events,
- "perform-issue-review-action",
- ({ action }) => {
- ongoingIssueReviewAction.value = {
- action,
- };
- }
-);
-
-useEmitteryEventListener(
- events,
- "perform-issue-status-action",
- ({ action }) => {
- ongoingIssueStatusAction.value = {
- action,
- };
- }
-);
-
-const {
- mode: sidebarMode,
- desktopSidebarWidth,
- mobileSidebarOpen,
-} = provideSidebarContext(containerRef);
-</script>
diff --git a/frontend/src/components/IssueV1/IssueDetailPage.vue b/frontend/src/components/IssueV1/IssueDetailPage.vue
deleted file mode 100644
index 6b89627c88..0000000000
--- a/frontend/src/components/IssueV1/IssueDetailPage.vue
+++ /dev/null
@@ -1,226 +0,0 @@
-<template>
- <div ref="containerRef" class="h-full flex flex-col">
- <div v-if="isLoading" class="flex items-center justify-center h-full">
- <BBSpin />
- </div>
- <template v-else>
- <div class="border-b bg-white">
- <BannerSection v-if="!isCreating" />
- <FeatureAttention :feature="PlanFeature.FEATURE_APPROVAL_WORKFLOW" />
-
- <HeaderSection />
- </div>
- <div class="flex-1 flex flex-row">
- <div
- class="flex-1 flex flex-col hide-scrollbar divide-y divide-gray-200 overflow-x-hidden bg-white"
- >
- <StageSection />
-
- <TaskListSection />
-
- <TaskRunSection v-if="!isCreating" />
-
- <SQLCheckSection v-if="isCreating" />
- <PlanCheckSection v-if="!isCreating" />
-
- <StatementSection />
-
- <DescriptionSection v-if="isCreating" />
- <IssueCommentSection v-if="!isCreating" />
- </div>
-
- <div
- v-if="sidebarMode == 'DESKTOP'"
- class="hide-scrollbar border-l border-gray-200"
- :style="{
- width: `${desktopSidebarWidth}px`,
- }"
- >
- <Sidebar />
- </div>
- </div>
-
- <template v-if="sidebarMode === 'MOBILE'">
- <!-- mobile sidebar -->
- <Drawer :show="mobileSidebarOpen" @close="mobileSidebarOpen = false">
- <div
- style="
- min-width: 240px;
- width: 80vw;
- max-width: 320px;
- padding: 0.5rem;
- "
- >
- <Sidebar v-if="sidebarMode === 'MOBILE'" />
- </div>
- </Drawer>
- </template>
-
- <IssueReviewActionPanel
- :action="ongoingIssueReviewAction?.action"
- @close="ongoingIssueReviewAction = undefined"
- />
- <IssueStatusActionPanel
- :action="ongoingIssueStatusAction?.action"
- @close="ongoingIssueStatusAction = undefined"
- />
- <TaskRolloutActionPanel
- :action="ongoingTaskRolloutAction?.action"
- :task-list="ongoingTaskRolloutAction?.taskList ?? []"
- @close="ongoingTaskRolloutAction = undefined"
- />
- </template>
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed, onMounted, ref } from "vue";
-import { useRoute, useRouter } from "vue-router";
-import { BBSpin } from "@/bbkit";
-import { FeatureAttention } from "@/components/FeatureGuard";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
-} from "@/router/dashboard/projectV1";
-import { useCurrentProjectV1 } from "@/store";
-import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
-import { type Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import { extractIssueUID, extractProjectResourceName } from "@/utils";
-import { SQLCheckSection } from "../Plan/components";
-import { providePlanSQLCheckContext } from "../Plan/components/SQLCheckSection";
-import { provideSidebarContext } from "../Plan/logic";
-import { Drawer } from "../v2";
-import {
- BannerSection,
- DescriptionSection,
- HeaderSection,
- IssueCommentSection,
- IssueReviewActionPanel,
- IssueStatusActionPanel,
- PlanCheckSection,
- Sidebar,
- StageSection,
- StatementSection,
- TaskListSection,
- TaskRolloutActionPanel,
- TaskRunSection,
-} from "./components";
-import type {
- IssueReviewAction,
- IssueStatusAction,
- TaskRolloutAction,
-} from "./logic";
-import { specForTask, useIssueContext, usePollIssue } from "./logic";
-
-const router = useRouter();
-const route = useRoute();
-const { enabledNewLayout } = useIssueLayoutVersion();
-const { isCreating, issue, selectedTask, events } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const containerRef = ref<HTMLElement>();
-const isLoading = ref(true);
-
-const ongoingIssueReviewAction = ref<{
- action: IssueReviewAction;
-}>();
-const ongoingIssueStatusAction = ref<{
- action: IssueStatusAction;
-}>();
-const ongoingTaskRolloutAction = ref<{
- action: TaskRolloutAction;
- taskList: Task[];
-}>();
-
-usePollIssue();
-
-events.on("perform-issue-review-action", ({ action }) => {
- ongoingIssueReviewAction.value = {
- action,
- };
-});
-
-events.on("perform-issue-status-action", ({ action }) => {
- ongoingIssueStatusAction.value = {
- action,
- };
-});
-
-events.on("perform-task-rollout-action", async ({ action, tasks }) => {
- ongoingTaskRolloutAction.value = {
- action,
- taskList: tasks,
- };
-});
-
-providePlanSQLCheckContext({
- project,
- plan: computed(() => issue.value.planEntity as Plan),
- selectedSpec: computed(
- () =>
- specForTask(
- issue.value.planEntity as Plan,
- selectedTask.value
- ) as Plan_Spec
- ),
- selectedTask: selectedTask,
-});
-
-const {
- mode: sidebarMode,
- desktopSidebarWidth,
- mobileSidebarOpen,
-} = provideSidebarContext(containerRef);
-
-onMounted(() => {
- // Always redirect creating database issue to new issue layout.
- if (
- issue.value.planEntity?.specs.every(
- (spec) => spec.config.case === "createDatabaseConfig"
- )
- ) {
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- issueId: extractIssueUID(issue.value.name),
- },
- query: route.query,
- });
- return;
- }
-
- if (
- enabledNewLayout.value &&
- issue.value.type === Issue_Type.DATABASE_CHANGE &&
- issue.value.planEntity?.specs.every(
- (spec) => spec.config.case === "changeDatabaseConfig"
- )
- ) {
- if (isCreating.value) {
- // Redirect to plans creation page with original query parameters
- router.replace({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- planId: "create",
- },
- query: route.query,
- });
- } else {
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- issueId: extractIssueUID(issue.value.name),
- },
- query: route.query,
- });
- }
- } else {
- isLoading.value = false;
- }
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/BannerSection.vue b/frontend/src/components/IssueV1/components/BannerSection.vue
deleted file mode 100644
index 0e8c7f4659..0000000000
--- a/frontend/src/components/IssueV1/components/BannerSection.vue
+++ /dev/null
@@ -1,86 +0,0 @@
-<template>
- <div
- v-if="showPendingReview"
- class="h-8 w-full text-base font-medium bg-accent text-white flex justify-center items-center"
- >
- {{ $t("issue.waiting-for-review") }}
- </div>
- <div
- v-else-if="showRejectedReview"
- class="h-8 w-full text-base font-medium bg-warning text-white flex justify-center items-center"
- >
- {{ $t("issue.review-sent-back") }}
- </div>
- <div
- v-else-if="showClosedBanner"
- class="h-8 w-full text-base font-medium bg-gray-400 text-white flex justify-center items-center"
- >
- {{ $t("common.closed") }}
- </div>
- <div
- v-else-if="showSuccessBanner"
- class="h-8 w-full text-base font-medium text-white flex justify-center items-center"
- :class="isUnfinishedResolvedIssue ? 'bg-warning' : 'bg-success'"
- >
- {{ $t("common.done") }}
- <span v-if="isUnfinishedResolvedIssue" class="text-sm ml-2">
- {{ $t("issue.some-tasks-are-not-executed-successfully") }}
- </span>
- </div>
- <div
- v-else-if="showPendingRollout"
- class="h-8 w-full text-base font-medium bg-accent text-white flex justify-center items-center"
- >
- {{ $t("issue.awaiting-rollout") }}
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import {
- Issue_ApprovalStatus,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { activeTaskInRollout, isDatabaseChangeRelatedIssue } from "@/utils";
-import {
- isUnfinishedResolvedTask as checkUnfinishedResolvedTask,
- useIssueContext,
-} from "../logic";
-
-const { issue } = useIssueContext();
-
-const showPendingReview = computed(() => {
- return (
- issue.value.status === IssueStatus.OPEN &&
- issue.value.approvalStatus === Issue_ApprovalStatus.PENDING
- );
-});
-
-const showRejectedReview = computed(() => {
- return (
- issue.value.status === IssueStatus.OPEN &&
- issue.value.approvalStatus === Issue_ApprovalStatus.REJECTED
- );
-});
-
-const showClosedBanner = computed(() => {
- return issue.value.status === IssueStatus.CANCELED;
-});
-
-const showSuccessBanner = computed(() => {
- return issue.value.status === IssueStatus.DONE;
-});
-
-const showPendingRollout = computed(() => {
- if (issue.value.status !== IssueStatus.OPEN) return false;
- if (!isDatabaseChangeRelatedIssue(issue.value)) return false;
-
- const task = activeTaskInRollout(issue.value.rolloutEntity);
- return task.status === Task_Status.NOT_STARTED;
-});
-
-const isUnfinishedResolvedIssue = computed(() => {
- return checkUnfinishedResolvedTask(issue.value);
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/BatchIssueActionsV1.vue b/frontend/src/components/IssueV1/components/BatchIssueActionsV1.vue
index c0ef338dae..3110ab5f20 100644
--- a/frontend/src/components/IssueV1/components/BatchIssueActionsV1.vue
+++ b/frontend/src/components/IssueV1/components/BatchIssueActionsV1.vue
@@ -50,12 +50,12 @@ import { computed, reactive, ref } from "vue";
import { TooltipButton } from "@/components/v2";
import { refreshIssueList } from "@/store";
import type { ComposedIssue } from "@/types";
-import type { IssueStatusAction } from "../logic";
+import { BatchIssueStatusActionPanel } from "./Panel";
+import type { IssueStatusAction } from "./Panel/issueStatusAction";
import {
getApplicableIssueStatusActionList,
issueStatusActionDisplayName,
-} from "../logic";
-import { BatchIssueStatusActionPanel } from "./Panel";
+} from "./Panel/issueStatusAction";
type LocalState = {
isRequesting: boolean;
diff --git a/frontend/src/components/IssueV1/components/DescriptionSection/DescriptionSection.vue b/frontend/src/components/IssueV1/components/DescriptionSection/DescriptionSection.vue
deleted file mode 100644
index 2e5bda75a5..0000000000
--- a/frontend/src/components/IssueV1/components/DescriptionSection/DescriptionSection.vue
+++ /dev/null
@@ -1,196 +0,0 @@
-<template>
- <div class="px-4 py-2 flex flex-col gap-y-2">
- <div class="flex items-center justify-between">
- <span class="textlabel">
- {{ title }}
- </span>
-
- <div
- v-if="!isCreating && allowEditIssue"
- class="flex items-center gap-x-2"
- >
- <NButton v-if="!state.isEditing" size="tiny" @click.prevent="beginEdit">
- {{ $t("common.edit") }}
- </NButton>
- <NButton
- v-if="state.isEditing"
- size="tiny"
- :disabled="state.description === issue.description"
- :loading="state.isUpdating"
- @click.prevent="saveEdit"
- >
- {{ $t("common.save") }}
- </NButton>
- <NButton
- v-if="state.isEditing"
- size="tiny"
- quaternary
- @click.prevent="cancelEdit"
- >
- {{ $t("common.cancel") }}
- </NButton>
- </div>
- </div>
-
- <div class="">
- <NInput
- v-if="isCreating || state.isEditing"
- ref="inputRef"
- v-model:value="state.description"
- :placeholder="$t('issue.add-some-description')"
- :autosize="{ minRows: 3, maxRows: 10 }"
- :disabled="state.isUpdating"
- :loading="state.isUpdating"
- :maxlength="10000"
- style="
- width: 100%;
- --n-placeholder-color: rgb(var(--color-control-placeholder));
- "
- type="textarea"
- size="small"
- @update:value="onDescriptionChange"
- />
- <div
- v-else
- class="min-h-12 max-h-64 whitespace-pre-wrap px-4 py-3 text-sm bg-white rounded-lg border border-gray-200 overflow-y-auto"
- >
- <template v-if="issue.description">
- <iframe
- v-if="issue.description"
- ref="contentPreviewArea"
- :srcdoc="renderedContent"
- class="rounded-md w-full overflow-hidden"
- />
- </template>
- <span v-else class="text-gray-400">
- {{ $t("issue.add-some-description") }}
- </span>
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { create } from "@bufbuild/protobuf";
-import { NButton, NInput } from "naive-ui";
-import { computed, nextTick, reactive, ref, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRenderMarkdown } from "@/components/MarkdownEditor";
-import { issueServiceClientConnect, planServiceClientConnect } from "@/connect";
-import { pushNotification, useCurrentProjectV1 } from "@/store";
-import {
- IssueSchema,
- UpdateIssueRequestSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import {
- PlanSchema,
- UpdatePlanRequestSchema,
-} from "@/types/proto-es/v1/plan_service_pb";
-import { isGrantRequestIssue } from "@/utils";
-import { useIssueContext } from "../../logic";
-
-type LocalState = {
- isEditing: boolean;
- isUpdating: boolean;
- description: string;
-};
-
-const { t } = useI18n();
-const {
- isCreating,
- issue,
- allowChange: allowEditIssue,
- events,
-} = useIssueContext();
-const { project } = useCurrentProjectV1();
-const contentPreviewArea = ref<HTMLIFrameElement>();
-
-const state = reactive<LocalState>({
- isEditing: false,
- isUpdating: false,
- description: issue.value.description,
-});
-
-const inputRef = ref<InstanceType<typeof NInput>>();
-
-const title = computed(() => {
- return isGrantRequestIssue(issue.value)
- ? t("common.reason")
- : t("common.description");
-});
-
-const onDescriptionChange = (description: string) => {
- if (isCreating.value) {
- issue.value.description = description;
- }
-};
-
-const beginEdit = () => {
- state.description = issue.value.description;
- state.isEditing = true;
- nextTick(() => {
- inputRef.value?.focus();
- });
-};
-
-const saveEdit = async () => {
- try {
- state.isUpdating = true;
- if (issue.value.plan) {
- const request = create(UpdatePlanRequestSchema, {
- plan: create(PlanSchema, {
- name: issue.value.plan,
- description: state.description,
- }),
- updateMask: { paths: ["description"] },
- });
- await planServiceClientConnect.updatePlan(request);
- } else {
- const request = create(UpdateIssueRequestSchema, {
- issue: create(IssueSchema, {
- name: issue.value.name,
- description: state.description,
- }),
- updateMask: { paths: ["description"] },
- });
- await issueServiceClientConnect.updateIssue(request);
- }
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- events.emit("status-changed", { eager: true });
- state.isEditing = false;
- } finally {
- state.isUpdating = false;
- }
-};
-
-const cancelEdit = () => {
- state.description = issue.value.description;
- state.isEditing = false;
-};
-
-const { renderedContent } = useRenderMarkdown(
- computed(() => issue.value.description),
- contentPreviewArea,
- project
-);
-
-// Reset the edit state after creating the issue.
-watch(isCreating, (curr, prev) => {
- if (!curr && prev) {
- state.isEditing = false;
- }
-});
-
-watch(
- () => issue.value,
- (issue) => {
- if (state.isEditing) return;
- state.description = issue.description;
- },
- { immediate: true }
-);
-</script>
diff --git a/frontend/src/components/IssueV1/components/DescriptionSection/index.ts b/frontend/src/components/IssueV1/components/DescriptionSection/index.ts
deleted file mode 100644
index 4652881be2..0000000000
--- a/frontend/src/components/IssueV1/components/DescriptionSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import DescriptionSection from "./DescriptionSection.vue";
-
-export default DescriptionSection;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue
deleted file mode 100644
index 90cc2a7bbf..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/Actions.vue
+++ /dev/null
@@ -1,68 +0,0 @@
-<template>
- <div class="flex flex-col items-end">
- <CreateButton v-if="actionType === 'CREATE'" />
-
- <TinySQLEditorButton v-if="actionType === 'SQL-EDITOR'" />
-
- <IssueReviewButtonGroup v-if="actionType === 'REVIEW'" />
-
- <CombinedRolloutButtonGroup v-if="actionType === 'ROLLOUT'" />
- </div>
-</template>
-
-<script setup lang="ts">
-import { asyncComputed } from "@vueuse/core";
-import { computed } from "vue";
-import { extractUserId, useCurrentUserV1 } from "@/store";
-import {
- Issue_ApprovalStatus,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import { checkRoleContainsAnyPermission, isGrantRequestIssue } from "@/utils";
-import { useIssueContext } from "../../../logic";
-import { CreateButton } from "./create";
-import { TinySQLEditorButton } from "./request";
-import { IssueReviewButtonGroup } from "./review";
-import { CombinedRolloutButtonGroup } from "./rollout";
-
-type ActionType = "CREATE" | "SQL-EDITOR" | "REVIEW" | "ROLLOUT";
-
-const currentUser = useCurrentUserV1();
-const { isCreating, issue } = useIssueContext();
-const rolloutReady = computed(() => {
- const approvalStatus = issue.value.approvalStatus;
- return (
- approvalStatus === Issue_ApprovalStatus.APPROVED ||
- approvalStatus === Issue_ApprovalStatus.SKIPPED
- );
-});
-
-const isFinishedGrantRequestIssueByCurrentUser = computed(() => {
- if (isCreating.value) return false;
- if (issue.value.status !== IssueStatus.DONE) return false;
- if (!isGrantRequestIssue(issue.value)) return false;
- return extractUserId(issue.value.creator) === currentUser.value.email;
-});
-
-const actionType = asyncComputed(async (): Promise<ActionType | undefined> => {
- if (isCreating.value) {
- return "CREATE";
- }
-
- if (isGrantRequestIssue(issue.value)) {
- if (isFinishedGrantRequestIssueByCurrentUser.value) {
- const role = issue.value.grantRequest?.role;
- if (role && checkRoleContainsAnyPermission(role, "bb.sql.select")) {
- return "SQL-EDITOR";
- }
- }
- return "REVIEW";
- }
-
- if (rolloutReady.value) {
- return "ROLLOUT";
- }
-
- return "REVIEW";
-}, undefined);
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue
deleted file mode 100644
index 4fde18383b..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/ExtraActionDropdownItem.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-<template>
- <NTooltip :disabled="errors.length === 0" placement="left">
- <template #trigger>
- {{ option.label }}
- </template>
- <template #default>
- <ErrorList :errors="errors" />
- </template>
- </NTooltip>
-</template>
-
-<script setup lang="ts">
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { ErrorList } from "@/components/IssueV1/components/common";
-import type { IssueStatusAction } from "@/components/IssueV1/logic";
-import {
- allowUserToApplyIssueStatusAction,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import type { ExtraActionOption } from "../types";
-
-const props = defineProps<{
- option: ExtraActionOption;
-}>();
-
-const { issue } = useIssueContext();
-
-const errors = computed(() => {
- const errors: string[] = [];
- const { type, action } = props.option;
- if (type === "ISSUE") {
- const [ok, reason] = allowUserToApplyIssueStatusAction(
- issue.value,
- action as IssueStatusAction
- );
- if (!ok) {
- errors.push(reason);
- }
- }
- return errors;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue
deleted file mode 100644
index c0ee29ec56..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButton.vue
+++ /dev/null
@@ -1,54 +0,0 @@
-<template>
- <NTooltip :disabled="errors.length === 0" placement="top">
- <template #trigger>
- <NButton
- :disabled="errors.length > 0"
- size="medium"
- tag="div"
- v-bind="issueStatusActionButtonProps(action)"
- @click.prevent="$emit('perform-action', action)"
- >
- {{ issueStatusActionDisplayName(action) }}
- </NButton>
- </template>
-
- <template #default>
- <ErrorList :errors="errors" />
- </template>
- </NTooltip>
-</template>
-
-<script setup lang="ts">
-import { NButton, NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { ErrorList } from "@/components/IssueV1/components/common";
-import type { IssueStatusAction } from "@/components/IssueV1/logic";
-import {
- allowUserToApplyIssueStatusAction,
- issueStatusActionButtonProps,
- issueStatusActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-
-const props = defineProps<{
- action: IssueStatusAction;
-}>();
-
-defineEmits<{
- (event: "perform-action", action: IssueStatusAction): void;
-}>();
-
-const { issue } = useIssueContext();
-
-const errors = computed(() => {
- const errors: string[] = [];
- const [ok, reason] = allowUserToApplyIssueStatusAction(
- issue.value,
- props.action
- );
- if (!ok) {
- errors.push(reason);
- }
- return errors;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue
deleted file mode 100644
index 5b50ba9616..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/IssueStatusActionButtonGroup.vue
+++ /dev/null
@@ -1,142 +0,0 @@
-<template>
- <div v-if="displayMode === 'BUTTON'" class="flex items-center gap-x-2">
- <IssueStatusActionButton
- v-for="(action, index) in issueStatusActionList"
- :key="index"
- :action="action"
- @perform-action="
- (action) => events.emit('perform-issue-status-action', { action })
- "
- />
-
- <NDropdown
- v-if="extraActionList.length > 0"
- trigger="click"
- placement="bottom-end"
- :options="extraActionList"
- :render-option="renderDropdownOption"
- @select="handleDropdownSelect"
- >
- <NButton :quaternary="true" size="medium" style="--n-padding: 0 4px">
- <heroicons:ellipsis-vertical class="w-6 h-6" />
- </NButton>
- </NDropdown>
- </div>
-
- <NDropdown
- v-if="displayMode === 'DROPDOWN' && mergedDropdownActionList.length > 0"
- trigger="click"
- placement="bottom-end"
- :options="mergedDropdownActionList"
- :render-option="renderDropdownOption"
- @select="handleDropdownSelect"
- >
- <NButton :quaternary="true" size="medium" style="--n-padding: 0 4px">
- <heroicons:ellipsis-vertical class="w-6 h-6" />
- </NButton>
- </NDropdown>
-</template>
-
-<script setup lang="ts">
-import { type DropdownOption, NButton, NDropdown } from "naive-ui";
-import type { VNode } from "vue";
-import { computed, h } from "vue";
-import { useI18n } from "vue-i18n";
-import { DropdownItemWithErrorList } from "@/components/IssueV1/components/common";
-import type {
- IssueStatusAction,
- TaskRolloutAction,
-} from "@/components/IssueV1/logic";
-import {
- allowUserToApplyIssueStatusAction,
- issueStatusActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import type { ExtraActionOption } from "../types";
-import IssueStatusActionButton from "./IssueStatusActionButton.vue";
-
-type IssueActionDropdownOption = ExtraActionOption & {
- description?: string;
-};
-
-const props = defineProps<{
- displayMode: "BUTTON" | "DROPDOWN";
- issueStatusActionList: IssueStatusAction[];
- extraActionList: ExtraActionOption[];
-}>();
-
-const { t } = useI18n();
-const { issue, events } = useIssueContext();
-
-const issueStatusActionDropdownOptions = computed(() => {
- return props.issueStatusActionList.map<IssueActionDropdownOption>(
- (action) => {
- const [ok, reason] = allowUserToApplyIssueStatusAction(
- issue.value,
- action
- );
- return {
- key: action,
- label: issueStatusActionDisplayName(action),
- type: "ISSUE",
- action: action,
- target: issue.value,
- disabled: !ok,
- description: reason,
- };
- }
- );
-});
-
-const mergedDropdownActionList = computed(() => {
- return [...issueStatusActionDropdownOptions.value, ...props.extraActionList];
-});
-
-const renderDropdownOption = ({
- node,
- option,
-}: {
- node: VNode;
- option: DropdownOption;
-}) => {
- const { disabled, description } = option as IssueActionDropdownOption;
- const errors = disabled
- ? [
- description ||
- t("issue.error.you-are-not-allowed-to-perform-this-action"),
- ]
- : [];
- return h(
- DropdownItemWithErrorList,
- {
- errors,
- placement: "left",
- },
- {
- default: () => node,
- }
- );
-};
-
-const handleDropdownSelect = (key: string, dropdownOption: DropdownOption) => {
- const option = dropdownOption as ExtraActionOption;
- if (option.type === "ISSUE") {
- events.emit("perform-issue-status-action", {
- action: option.action as IssueStatusAction,
- });
- }
- if (option.type === "TASK-BATCH") {
- events.emit("perform-task-rollout-action", {
- action: option.action as TaskRolloutAction,
- tasks: option.target as Task[],
- });
- }
- if (option.type === "TASK") {
- events.emit("perform-task-rollout-action", {
- action: option.action as TaskRolloutAction,
- tasks: [option.target as Task],
- });
- }
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/index.ts
deleted file mode 100644
index 543cf7568b..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/IssueStatusActionButtonGroup/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import IssueStatusActionButtonGroup from "./IssueStatusActionButtonGroup.vue";
-
-export default IssueStatusActionButtonGroup;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/index.ts
deleted file mode 100644
index 0f556f0e6a..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import IssueStatusActionButtonGroup from "./IssueStatusActionButtonGroup";
-
-export * from "./types";
-export { IssueStatusActionButtonGroup };
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts
deleted file mode 100644
index e94597994e..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/common/types.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import type { DropdownOption } from "naive-ui";
-import type {
- IssueStatusAction,
- TaskRolloutAction,
-} from "@/components/IssueV1/logic";
-import type { ComposedIssue } from "@/types";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-
-export type ExtraAction<T extends "ISSUE" | "TASK" | "TASK-BATCH"> = {
- type: T;
- action: T extends "ISSUE" ? IssueStatusAction : TaskRolloutAction;
- target: T extends "ISSUE"
- ? ComposedIssue
- : T extends "TASK"
- ? Task
- : T extends "TASK-BATCH"
- ? Task[]
- : unknown;
-};
-
-export type ExtraActionOption = DropdownOption &
- ExtraAction<"ISSUE" | "TASK" | "TASK-BATCH">;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue
deleted file mode 100644
index e58763363f..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue
+++ /dev/null
@@ -1,362 +0,0 @@
-<template>
- <NTooltip :disabled="issueCreateErrorList.length === 0" placement="top">
- <template #trigger>
- <NButton
- type="primary"
- size="medium"
- tag="div"
- :disabled="issueCreateErrorList.length > 0 || loading"
- :loading="loading"
- @click="doCreateIssue"
- >
- {{ loading ? $t("common.creating") : $t("common.create") }}
- </NButton>
- </template>
-
- <template #default>
- <ErrorList :errors="issueCreateErrorList" />
- </template>
- </NTooltip>
-
- <!-- prevent clicking the page when creating in progress -->
- <div
- v-if="loading"
- v-zindexable="{ enabled: true }"
- class="fixed inset-0 pointer-events-auto flex flex-col items-center justify-center"
- @click.stop.prevent
- />
-
- <SQLCheckPanel
- v-if="showSQLCheckResultPanel && databaseForTask(project, selectedTask)"
- :project="issue.project"
- :database="databaseForTask(project, selectedTask)"
- :advices="
- checkResultMap[databaseForTask(project, selectedTask).name].advices
- "
- :affected-rows="
- checkResultMap[databaseForTask(project, selectedTask).name].affectedRows
- "
- :risk-level="
- checkResultMap[databaseForTask(project, selectedTask).name].riskLevel
- "
- :confirm="sqlCheckConfirmDialog"
- :override-title="$t('issue.sql-check.sql-review-violations')"
- />
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { NButton, NTooltip } from "naive-ui";
-import { zindexable as vZindexable } from "vdirs";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRouter } from "vue-router";
-import { ErrorList } from "@/components/IssueV1/components/common";
-import { getValidIssueLabels } from "@/components/IssueV1/components/IssueLabelSelector.vue";
-import {
- isValidStage,
- specForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { getLocalSheetByName, isValidSpec } from "@/components/Plan";
-import { getSpecChangeType } from "@/components/Plan/components/SQLCheckSection/common";
-import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { SQLCheckPanel } from "@/components/SQLCheck";
-import { STATEMENT_SKIP_CHECK_THRESHOLD } from "@/components/SQLCheck/common";
-import {
- issueServiceClientConnect,
- planServiceClientConnect,
- releaseServiceClientConnect,
- rolloutServiceClientConnect,
-} from "@/connect";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import {
- pushNotification,
- useCurrentProjectV1,
- useSheetV1Store,
-} from "@/store";
-import {
- CreateIssueRequestSchema,
- Issue_Type,
- IssueSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan_ExportDataConfig } from "@/types/proto-es/v1/plan_service_pb";
-import {
- CreatePlanRequestSchema,
- type Plan_ChangeDatabaseConfig,
-} from "@/types/proto-es/v1/plan_service_pb";
-import {
- CheckReleaseRequestSchema,
- Release_Type,
-} from "@/types/proto-es/v1/release_service_pb";
-import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import {
- type Defer,
- databaseForTask,
- defer,
- extractProjectResourceName,
- extractSheetUID,
- flattenTaskV1List,
- getSheetStatement,
- hasPermissionToCreateChangeDatabaseIssueInProject,
- issueV1Slug,
- sheetNameOfTaskV1,
-} from "@/utils";
-
-const { t } = useI18n();
-const router = useRouter();
-const { isCreating, issue, events, selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const { resultMap: checkResultMap, upsertResult: upsertCheckResult } =
- usePlanSQLCheckContext();
-const sheetStore = useSheetV1Store();
-const loading = ref(false);
-const showSQLCheckResultPanel = ref(false);
-const sqlCheckConfirmDialog = ref<Defer<boolean>>();
-
-const issueCreateErrorList = computed(() => {
- const errorList: string[] = [];
- if (!hasPermissionToCreateChangeDatabaseIssueInProject(project.value)) {
- errorList.push(t("common.missing-required-permission"));
- }
- if (!issue.value.title.trim()) {
- errorList.push("Missing issue title");
- }
- if (issue.value.rolloutEntity) {
- if (
- !issue.value.rolloutEntity.stages.every((stage) => isValidStage(stage))
- ) {
- errorList.push("Missing SQL statement in some stages");
- }
- } else {
- if (issue.value.planEntity) {
- if (!issue.value.planEntity.specs.every((spec) => isValidSpec(spec))) {
- errorList.push("Missing SQL statement in some specs");
- }
- }
- }
- if (
- project.value.forceIssueLabels &&
- getValidIssueLabels(issue.value.labels, project.value.issueLabels)
- .length === 0
- ) {
- errorList.push(
- t("project.settings.issue-related.labels.force-issue-labels.warning")
- );
- }
- return errorList;
-});
-
-const doCreateIssue = async () => {
- // Prevent race condition: check if already creating
- if (loading.value) {
- return;
- }
- loading.value = true;
-
- // Run SQL check for database change issues.
- if (
- issue.value.type === Issue_Type.DATABASE_CHANGE &&
- !(await runSQLCheckForIssue())
- ) {
- loading.value = false;
- return;
- }
-
- try {
- await createSheets();
- const createdPlan = await createPlan(
- issue.value.title,
- issue.value.description
- );
- if (!createdPlan) {
- loading.value = false;
- return;
- }
-
- issue.value.plan = createdPlan.name;
- issue.value.planEntity = createdPlan;
-
- const issueCreate = create(IssueSchema, {
- ...issue.value,
- });
- const request = create(CreateIssueRequestSchema, {
- parent: issue.value.project,
- issue: issueCreate,
- });
- const createdIssue = await issueServiceClientConnect.createIssue(request);
-
- const rolloutRequest = create(CreateRolloutRequestSchema, {
- parent: createdPlan.name,
- });
- await rolloutServiceClientConnect.createRollout(rolloutRequest);
-
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.value.project),
- issueSlug: issueV1Slug(createdIssue.name, createdIssue.title),
- },
- });
- } catch (error) {
- console.error("Failed to create issue:", error);
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: t("common.error"),
- description: String(error),
- });
- loading.value = false;
- }
-};
-
-// Create sheets for spec configs and update their resource names.
-const createSheets = async () => {
- const configWithSheetList: (
- | Plan_ChangeDatabaseConfig
- | Plan_ExportDataConfig
- )[] = [];
- const pendingCreateSheetMap = new Map<string, Sheet>();
-
- const specList = issue.value.planEntity?.specs ?? [];
- for (const spec of specList) {
- const config =
- spec.config?.case === "changeDatabaseConfig"
- ? spec.config.value
- : spec.config?.case === "exportDataConfig"
- ? spec.config.value
- : null;
- if (!config) continue;
- configWithSheetList.push(config);
- if (pendingCreateSheetMap.has(config.sheet)) continue;
- const uid = extractSheetUID(config.sheet);
- if (uid.startsWith("-")) {
- // The sheet is pending create
- const sheet = getLocalSheetByName(config.sheet);
- pendingCreateSheetMap.set(sheet.name, sheet);
- }
- }
- const pendingCreateSheetList = Array.from(pendingCreateSheetMap.values());
- const sheetNameMap = new Map<string, string>();
- for (let i = 0; i < pendingCreateSheetList.length; i++) {
- const sheet = pendingCreateSheetList[i];
- const createdSheet = await sheetStore.createSheet(
- issue.value.project,
- sheet
- );
- sheetNameMap.set(sheet.name, createdSheet.name);
- }
- configWithSheetList.forEach((config) => {
- const uid = extractSheetUID(config.sheet);
- if (uid.startsWith("-")) {
- config.sheet = sheetNameMap.get(config.sheet) ?? "";
- }
- });
-};
-
-const createPlan = async (title: string, description: string) => {
- const plan = issue.value.planEntity;
- if (!plan) return;
- const request = create(CreatePlanRequestSchema, {
- parent: issue.value.project,
- plan: {
- ...plan,
- title,
- description,
- },
- });
- const response = await planServiceClientConnect.createPlan(request);
- return response;
-};
-
-const runSQLCheckForIssue = async () => {
- if (
- !isCreating.value ||
- ![Issue_Type.DATABASE_CHANGE, Issue_Type.DATABASE_EXPORT].includes(
- issue.value.type
- )
- ) {
- return;
- }
-
- const flattenTasks = flattenTaskV1List(issue.value.rolloutEntity);
- const statementTargetsMap = new Map<string, string[]>();
- for (const task of flattenTasks) {
- const sheetName = sheetNameOfTaskV1(task);
- let sheet: Sheet | undefined;
- if (extractSheetUID(sheetName).startsWith("-")) {
- sheet = getLocalSheetByName(sheetName);
- } else {
- sheet = await sheetStore.getOrFetchSheetByName(sheetName);
- }
- if (!sheet) continue;
- const statement = getSheetStatement(sheet);
- const database = databaseForTask(project.value, task);
- if (!statement) {
- continue;
- }
- if (statement.length > STATEMENT_SKIP_CHECK_THRESHOLD) {
- continue;
- }
- statementTargetsMap.set(
- statement,
- statementTargetsMap.get(statement)?.concat(database.name) ?? [
- database.name,
- ]
- );
- }
- for (const [statement, targets] of statementTargetsMap.entries()) {
- const request = create(CheckReleaseRequestSchema, {
- parent: issue.value.project,
- release: {
- type: Release_Type.VERSIONED,
- files: [
- {
- // Use "0" for dummy version.
- version: "0",
- statement: new TextEncoder().encode(statement),
- enableGhost: getSpecChangeType(
- specForTask(issue.value.planEntity, selectedTask.value)
- ),
- },
- ],
- },
- targets: targets,
- });
- const response = await releaseServiceClientConnect.checkRelease(request);
- // Upsert check result for each target.
- for (const r of response.results) {
- upsertCheckResult(r.target, r);
- }
- }
-
- for (const checkResult of Object.values(checkResultMap.value)) {
- const hasErrors = checkResult.advices.some((advice) => {
- return advice.status === Advice_Level.ERROR;
- });
- // Focus on the first task with error.
- if (hasErrors) {
- loading.value = false;
- const task = flattenTaskV1List(issue.value.rolloutEntity).find((t) => {
- return t.target === checkResult.target;
- });
- if (task) {
- events.emit("select-task", { task });
- const d = defer<boolean>();
- sqlCheckConfirmDialog.value = d;
- d.promise.finally(() => {
- sqlCheckConfirmDialog.value = undefined;
- showSQLCheckResultPanel.value = false;
- });
- showSQLCheckResultPanel.value = true;
- return await d.promise;
- }
- return false;
- }
- }
-
- return true;
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/index.ts
deleted file mode 100644
index b30ba24e7e..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import CreateButton from "./CreateButton.vue";
-
-export { CreateButton };
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/index.ts
deleted file mode 100644
index 9793717924..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Actions from "./Actions.vue";
-
-export default Actions;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/TinySQLEditorButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/TinySQLEditorButton.vue
deleted file mode 100644
index ba80409c77..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/TinySQLEditorButton.vue
+++ /dev/null
@@ -1,60 +0,0 @@
-<template>
- <NButton type="primary" @click="gotoSQLEditor">
- <template #icon>
- <heroicons-solid:terminal class="w-5 h-5" />
- </template>
- {{ $t("sql-editor.self") }}
- </NButton>
-</template>
-
-<script setup lang="ts">
-import { NButton } from "naive-ui";
-import { useRouter } from "vue-router";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import {
- SQL_EDITOR_DATABASE_MODULE,
- SQL_EDITOR_HOME_MODULE,
-} from "@/router/sqlEditor";
-import { useDatabaseV1Store } from "@/store";
-import { isValidDatabaseName } from "@/types";
-import {
- extractInstanceResourceName,
- extractProjectResourceName,
-} from "@/utils";
-import { convertFromCELString } from "@/utils/issue/cel";
-
-const router = useRouter();
-const { issue } = useIssueContext();
-
-const gotoSQLEditor = async () => {
- const grantRequest = issue.value.grantRequest!;
- const conditionExpression = await convertFromCELString(
- grantRequest.condition?.expression ?? ""
- );
- if (
- conditionExpression.databaseResources !== undefined &&
- conditionExpression.databaseResources.length > 0
- ) {
- const databaseResourceName =
- conditionExpression.databaseResources[0].databaseFullName;
- const db =
- await useDatabaseV1Store().getOrFetchDatabaseByName(databaseResourceName);
- if (isValidDatabaseName(db.name)) {
- const url = router.resolve({
- name: SQL_EDITOR_DATABASE_MODULE,
- params: {
- project: extractProjectResourceName(db.project),
- instance: extractInstanceResourceName(db.instance),
- database: db.databaseName,
- },
- });
- window.open(url.fullPath, "__BLANK");
- return;
- }
- }
- const url = router.resolve({
- name: SQL_EDITOR_HOME_MODULE,
- });
- window.open(url.fullPath, "__BLANK");
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/index.ts
deleted file mode 100644
index ce433ca37e..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import TinySQLEditorButton from "./TinySQLEditorButton.vue";
-
-export { TinySQLEditorButton };
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue
deleted file mode 100644
index d97e8ba247..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/IssueReviewButtonGroup.vue
+++ /dev/null
@@ -1,146 +0,0 @@
-<template>
- <div class="flex items-stretch gap-x-3">
- <ReviewActionButton
- v-for="action in issueReviewActionList"
- :key="action"
- :action="action"
- @perform-action="
- (action) => events.emit('perform-issue-review-action', { action })
- "
- />
-
- <IssueStatusActionButtonGroup
- :display-mode="displayMode"
- :issue-status-action-list="issueStatusActionList"
- :extra-action-list="forceRolloutActionList"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { IssueReviewAction } from "@/components/IssueV1";
-import {
- getApplicableIssueStatusActionList,
- getApplicableStageRolloutActionList,
- getApplicableTaskRolloutActionList,
- taskRolloutActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1";
-import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
-import {
- Issue_ApprovalStatus,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import {
- hasProjectPermissionV2,
- hasWorkspacePermissionV2,
- isDatabaseChangeRelatedIssue,
-} from "@/utils";
-import type { ExtraActionOption } from "../common";
-import { IssueStatusActionButtonGroup } from "../common";
-import ReviewActionButton from "./ReviewActionButton.vue";
-
-const { t } = useI18n();
-const currentUser = useCurrentUserV1();
-const { issue, isCreating, events, selectedTask, selectedStage } =
- useIssueContext();
-const { project } = useCurrentProjectV1();
-
-const shouldShowApproveOrReject = computed(() => {
- if (
- issue.value.status === IssueStatus.CANCELED ||
- issue.value.status === IssueStatus.DONE ||
- isCreating.value
- ) {
- return false;
- }
-
- // Must be pending approval
- if (issue.value.approvalStatus !== Issue_ApprovalStatus.PENDING) {
- return false;
- }
-
- // Hide review actions if self-approval is disabled
- if (
- !project.value.allowSelfApproval &&
- currentUser.value.email === extractUserId(issue.value.creator)
- ) {
- return false;
- }
-
- return true;
-});
-
-const shouldShowReRequestReview = computed(() => {
- return (
- extractUserId(issue.value.creator) === currentUser.value.email &&
- issue.value.approvalStatus === Issue_ApprovalStatus.REJECTED
- );
-});
-
-const issueReviewActionList = computed(() => {
- const actionList: IssueReviewAction[] = [];
- if (shouldShowApproveOrReject.value) {
- actionList.push("SEND_BACK", "APPROVE");
- }
- if (shouldShowReRequestReview.value) {
- actionList.push("RE_REQUEST");
- }
- return actionList;
-});
-
-const issueStatusActionList = computed(() => {
- return getApplicableIssueStatusActionList(issue.value);
-});
-const forceRolloutActionList = computed((): ExtraActionOption[] => {
- // If it's not a database change related issue, no force rollout actions.
- if (!isDatabaseChangeRelatedIssue(issue.value)) {
- return [];
- }
-
- if (
- !hasWorkspacePermissionV2("bb.taskRuns.create") &&
- !hasProjectPermissionV2(project.value, "bb.taskRuns.create")
- ) {
- // Only for users with permission to create task runs.
- return [];
- }
-
- const taskExtraActionOptions = getApplicableTaskRolloutActionList(
- issue.value,
- selectedTask.value
- ).map<ExtraActionOption>((action) => ({
- type: "TASK",
- action,
- target: selectedTask.value,
- label: `${t("common.force-verb", {
- verb: taskRolloutActionDisplayName(action).toLowerCase(),
- })}`,
- key: `force-${action}-task`,
- }));
- const stageExtraActionOptions = getApplicableStageRolloutActionList(
- issue.value,
- selectedStage.value
- ).map<ExtraActionOption>(({ action, tasks }) => {
- const taskActionName = taskRolloutActionDisplayName(action);
- const stageActionName = t("issue.action-to-current-stage", {
- action: taskActionName,
- });
- return {
- type: "TASK-BATCH",
- action,
- target: tasks,
- label: t("common.force-verb", { verb: stageActionName.toLowerCase() }),
- key: `force-${action}-stage`,
- };
- });
-
- return [...taskExtraActionOptions, ...stageExtraActionOptions];
-});
-
-const displayMode = computed(() => {
- return issueReviewActionList.value.length > 0 ? "DROPDOWN" : "BUTTON";
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/ReviewActionButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/ReviewActionButton.vue
deleted file mode 100644
index fcc20743f7..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/ReviewActionButton.vue
+++ /dev/null
@@ -1,126 +0,0 @@
-<template>
- <NTooltip :disabled="errors.length === 0" placement="top">
- <template #trigger>
- <NButton
- size="medium"
- tag="div"
- :disabled="errors.length > 0"
- :type="action === 'SEND_BACK' ? 'default' : 'primary'"
- @click="$emit('perform-action', action)"
- >
- {{ issueReviewActionDisplayName(action) }}
- </NButton>
- </template>
- <template #default>
- <ErrorList :errors="errors" />
- </template>
- </NTooltip>
-</template>
-
-<script setup lang="ts">
-import { NButton, NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { IssueReviewAction } from "@/components/IssueV1/logic";
-import {
- issueReviewActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import type { ErrorItem } from "@/components/misc/ErrorList.vue";
-import ErrorList from "@/components/misc/ErrorList.vue";
-import {
- candidatesOfApprovalStepV1,
- extractUserId,
- useCurrentUserV1,
-} from "@/store";
-import type { ComposedIssue } from "@/types";
-import {
- Issue_ApprovalStatus,
- Issue_Approver_Status,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import { displayRoleTitle, isUserIncludedInList } from "@/utils";
-
-const props = defineProps<{
- action: IssueReviewAction;
-}>();
-
-defineEmits<{
- (event: "perform-action", action: IssueReviewAction): void;
-}>();
-
-const { t } = useI18n();
-const { issue } = useIssueContext();
-
-const errors = computed(() => {
- if (allowUserToApplyReviewAction(issue.value, props.action)) {
- return [];
- }
-
- const errors: ErrorItem[] = [
- t("issue.error.you-are-not-allowed-to-perform-this-action"),
- ];
-
- const { approvalTemplate, approvers } = issue.value;
- if (!approvalTemplate) return errors;
-
- const rejectedIndex = approvers.findIndex(
- (ap) => ap.status === Issue_Approver_Status.REJECTED
- );
- const currentRoleIndex =
- rejectedIndex >= 0 ? rejectedIndex : approvers.length;
-
- const roles = approvalTemplate.flow?.roles ?? [];
- const role = roles[currentRoleIndex];
- if (!role) return errors;
-
- if (role) {
- const roleTitle = displayRoleTitle(role);
- if (roleTitle) {
- errors.push({
- error: roleTitle,
- indent: 1,
- });
- }
- }
-
- return errors;
-});
-
-const allowUserToApplyReviewAction = (
- issue: ComposedIssue,
- action: IssueReviewAction
-) => {
- if (
- issue.status === IssueStatus.CANCELED ||
- issue.status === IssueStatus.DONE ||
- issue.approvalStatus === Issue_ApprovalStatus.CHECKING ||
- issue.approvalStatus === Issue_ApprovalStatus.APPROVED ||
- issue.approvalStatus === Issue_ApprovalStatus.SKIPPED
- ) {
- return false;
- }
-
- const me = useCurrentUserV1();
-
- if (action === "RE_REQUEST") {
- return me.value.email === extractUserId(issue.creator);
- }
-
- const { approvalTemplate, approvers } = issue;
- if (!approvalTemplate) return false;
-
- const rejectedIndex = approvers.findIndex(
- (ap) => ap.status === Issue_Approver_Status.REJECTED
- );
- const currentRoleIndex =
- rejectedIndex >= 0 ? rejectedIndex : approvers.length;
-
- const roles = approvalTemplate.flow?.roles ?? [];
- const role = roles[currentRoleIndex];
- if (!role) return false;
-
- const candidates = candidatesOfApprovalStepV1(issue, role);
- return isUserIncludedInList(me.value.email, candidates);
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/index.ts
deleted file mode 100644
index 1ad1cd1161..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/review/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import IssueReviewButtonGroup from "./IssueReviewButtonGroup.vue";
-
-export { IssueReviewButtonGroup };
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue
deleted file mode 100644
index cb43300f70..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/CombinedRolloutButtonGroup.vue
+++ /dev/null
@@ -1,109 +0,0 @@
-<template>
- <div class="flex gap-x-3">
- <RolloutActionButtonGroup
- v-if="primaryTaskRolloutActionList.length > 0"
- :task-rollout-action-list="primaryTaskRolloutActionList"
- :stage-rollout-action-list="
- stageRolloutActionList.map((item) => item.action)
- "
- @perform-action="performRolloutAction"
- />
-
- <IssueStatusActionButtonGroup
- :display-mode="issueStatusButtonsDisplayMode"
- :issue-status-action-list="issueStatusActionList"
- :extra-action-list="extraActionList"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type { TaskRolloutAction } from "@/components/IssueV1/logic";
-import {
- getApplicableIssueStatusActionList,
- getApplicableStageRolloutActionList,
- getApplicableTaskRolloutActionList,
- PrimaryTaskRolloutActionList,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { canRolloutTasks } from "@/components/RolloutV1/components/taskPermissions";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import type { ExtraActionOption } from "../common";
-import { IssueStatusActionButtonGroup } from "../common";
-import type { RolloutAction } from "./common";
-import RolloutActionButtonGroup from "./RolloutActionButtonGroup.vue";
-
-const { t } = useI18n();
-const { issue, selectedStage, selectedTask, events } = useIssueContext();
-
-const issueStatusActionList = computed(() => {
- return getApplicableIssueStatusActionList(issue.value);
-});
-
-const taskRolloutActionList = computed(() => {
- return getApplicableTaskRolloutActionList(issue.value, selectedTask.value);
-});
-
-const stageRolloutActionList = computed(() => {
- return getApplicableStageRolloutActionList(
- issue.value,
- selectedStage.value,
- false /* !allowSkipPendingTasks */
- );
-});
-
-const primaryTaskRolloutActionList = computed(() => {
- return taskRolloutActionList.value.filter((action) =>
- PrimaryTaskRolloutActionList.includes(action)
- );
-});
-
-const allowUserToSkipTask = computed(() => {
- const skip = stageRolloutActionList.value.find(
- (item) => item.action === "SKIP"
- );
- if (!skip) return false;
- return canRolloutTasks(skip.tasks, issue.value);
-});
-
-const extraActionList = computed(() => {
- const list: ExtraActionOption[] = [];
- const skip = stageRolloutActionList.value.find(
- (item) => item.action === "SKIP"
- );
- if (skip) {
- list.push({
- label: t("task.skip-failed-in-current-stage"),
- key: "skip-failed-tasks-in-current-stage",
- type: "TASK-BATCH",
- action: "SKIP",
- target: skip.tasks,
- disabled: !allowUserToSkipTask.value,
- });
- }
- return list;
-});
-
-const issueStatusButtonsDisplayMode = computed(() => {
- return primaryTaskRolloutActionList.value.length > 0 ? "DROPDOWN" : "BUTTON";
-});
-
-const performRolloutAction = async (params: RolloutAction) => {
- const { action, target } = params;
- if (target === "TASK") {
- return performBatchTaskAction(action, [selectedTask.value]);
- }
- if (target === "STAGE") {
- return performBatchTaskAction(action, selectedStage.value.tasks);
- }
-};
-
-const performBatchTaskAction = async (
- action: TaskRolloutAction,
- tasks: Task[]
-) => {
- events.emit("perform-task-rollout-action", { action, tasks });
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue
deleted file mode 100644
index baffc65f44..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButton.vue
+++ /dev/null
@@ -1,105 +0,0 @@
-<template>
- <NTooltip :disabled="errors.length === 0" placement="top">
- <template #trigger>
- <ContextMenuButton
- :preference-key="`bb-rollout-action-${action}`"
- :action-list="actionList"
- :default-action-key="`${action}-STAGE`"
- size="medium"
- @click="$emit('perform-action', ($event as RolloutButtonAction).params)"
- />
- </template>
- <template #default>
- <ErrorList :errors="errors" />
- </template>
- </NTooltip>
-</template>
-
-<script setup lang="ts">
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import type {
- StageRolloutAction,
- TaskRolloutAction,
-} from "@/components/IssueV1/logic";
-import {
- taskRolloutActionButtonProps,
- taskRolloutActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import type { ErrorItem } from "@/components/misc/ErrorList.vue";
-import ErrorList from "@/components/misc/ErrorList.vue";
-import { canRolloutTasks } from "@/components/RolloutV1/components/taskPermissions";
-import { ContextMenuButton } from "@/components/v2";
-import type { RolloutAction, RolloutButtonAction } from "./common";
-
-const props = defineProps<{
- action: TaskRolloutAction;
- stageRolloutActionList: StageRolloutAction[];
-}>();
-
-defineEmits<{
- (event: "perform-action", action: RolloutAction): void;
-}>();
-
-const { t } = useI18n();
-const { issue, selectedTask } = useIssueContext();
-
-const errors = computed(() => {
- const errors: ErrorItem[] = [];
- if (!canRolloutTasks([selectedTask.value], issue.value)) {
- errors.push(t("issue.error.you-are-not-allowed-to-perform-this-action"));
- }
- return errors;
-});
-
-const actionList = computed(() => {
- const { action } = props;
-
- const text = taskRolloutActionDisplayName(action, selectedTask.value);
- const actionProps: RolloutButtonAction["props"] = {
- ...taskRolloutActionButtonProps(action),
- tag: "div",
- disabled: errors.value.length > 0,
- };
- if (selectedTask.value.payload?.case === "databaseDataExport") {
- return [
- {
- key: `${action}-STAGE`,
- text,
- props: actionProps,
- params: {
- action,
- target: "STAGE",
- },
- },
- ];
- }
-
- const actionList: RolloutButtonAction[] = [
- {
- key: `${action}-TASK`,
- text,
- props: actionProps,
- params: {
- action,
- target: "TASK",
- },
- },
- ];
- if (props.stageRolloutActionList.includes(action)) {
- actionList.push({
- key: `${action}-STAGE`,
- text: t("issue.action-to-current-stage", { action: text }),
- props: actionProps,
- params: {
- action,
- target: "STAGE",
- },
- });
- }
-
- return actionList;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButtonGroup.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButtonGroup.vue
deleted file mode 100644
index 26a2bf8a0b..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/RolloutActionButtonGroup.vue
+++ /dev/null
@@ -1,29 +0,0 @@
-<template>
- <div class="flex items-center gap-x-3">
- <RolloutActionButton
- v-for="action in taskRolloutActionList"
- :key="action"
- :action="action"
- :stage-rollout-action-list="stageRolloutActionList"
- @perform-action="$emit('perform-action', $event)"
- />
- </div>
-</template>
-
-<script lang="ts" setup>
-import type {
- StageRolloutAction,
- TaskRolloutAction,
-} from "@/components/IssueV1/logic";
-import type { RolloutAction } from "./common";
-import RolloutActionButton from "./RolloutActionButton.vue";
-
-defineProps<{
- taskRolloutActionList: TaskRolloutAction[];
- stageRolloutActionList: StageRolloutAction[];
-}>();
-
-defineEmits<{
- (event: "perform-action", action: RolloutAction): void;
-}>();
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/common.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/common.ts
deleted file mode 100644
index f1e4594d7c..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/common.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import type {
- StageRolloutAction,
- TaskRolloutAction,
-} from "@/components/IssueV1/logic";
-import type { ContextMenuButtonAction } from "@/components/v2";
-
-export type RolloutAction<T = "TASK" | "STAGE"> = {
- target: T;
- action: T extends "TASK" ? TaskRolloutAction : StageRolloutAction;
-};
-
-export type RolloutButtonAction = ContextMenuButtonAction<RolloutAction>;
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/index.ts
deleted file mode 100644
index e2a444895c..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/rollout/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import CombinedRolloutButtonGroup from "./CombinedRolloutButtonGroup.vue";
-
-export { CombinedRolloutButtonGroup };
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue b/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue
deleted file mode 100644
index bb3d91dfae..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/HeaderSection.vue
+++ /dev/null
@@ -1,86 +0,0 @@
-<template>
- <div
- class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2 py-2"
- :class="sidebarMode === 'MOBILE' ? 'pl-4 pr-2' : 'px-4'"
- >
- <div class="flex-1 flex items-center gap-x-2">
- <IssueStatusIcon
- v-if="!isCreating"
- :issue-status="issue.status"
- :task-status="issueTaskStatus"
- :issue="issue"
- />
-
- <Title />
- </div>
-
- <div class="flex flex-row items-center justify-end">
- <router-link v-if="rolloutRoute" :to="rolloutRoute">
- <NButton quaternary size="small">
- <template #icon>
- <ExternalLinkIcon class="w-4 h-4" />
- </template>
- {{ $t("common.rollout") }}
- </NButton>
- </router-link>
-
- <Actions />
-
- <NButton
- v-if="sidebarMode === 'MOBILE'"
- :quaternary="true"
- size="medium"
- style="--n-padding: 0 4px"
- @click="mobileSidebarOpen = true"
- >
- <MenuIcon class="w-6 h-6" />
- </NButton>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { ExternalLinkIcon, MenuIcon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { computed } from "vue";
-import type { RouteLocationRaw } from "vue-router";
-import { useSidebarContext } from "@/components/Plan";
-import { PROJECT_V1_ROUTE_PLAN_ROLLOUT } from "@/router/dashboard/projectV1";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- activeTaskInRollout,
- extractPlanUID,
- extractProjectResourceName,
- isDatabaseChangeRelatedIssue,
-} from "@/utils";
-import { useIssueContext } from "../../logic";
-import IssueStatusIcon from "../IssueStatusIcon.vue";
-import Actions from "./Actions";
-import Title from "./Title.vue";
-
-const { isCreating, issue } = useIssueContext();
-
-const rolloutRoute = computed((): RouteLocationRaw | undefined => {
- const plan = issue.value.planEntity;
- if (!plan || !plan.hasRollout) return undefined;
-
- return {
- name: PROJECT_V1_ROUTE_PLAN_ROLLOUT,
- params: {
- projectId: extractProjectResourceName(plan.name),
- planId: extractPlanUID(plan.name),
- },
- };
-});
-
-const issueTaskStatus = computed(() => {
- // For grant request issue, we always show the status as "NOT_STARTED" as task status.
- if (!isDatabaseChangeRelatedIssue(issue.value)) {
- return Task_Status.NOT_STARTED;
- }
-
- return activeTaskInRollout(issue.value.rolloutEntity).status;
-});
-
-const { mode: sidebarMode, mobileSidebarOpen } = useSidebarContext();
-</script>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Title.vue b/frontend/src/components/IssueV1/components/HeaderSection/Title.vue
deleted file mode 100644
index bc00227686..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/Title.vue
+++ /dev/null
@@ -1,147 +0,0 @@
-<template>
- <div class="flex-1">
- <NInput
- :value="state.title"
- :style="style"
- :loading="state.isUpdating"
- :disabled="!allowEditIssue || state.isUpdating"
- size="medium"
- required
- class="bb-issue-title-input"
- @focus="state.isEditing = true"
- @blur="onBlur"
- @keyup.enter="onEnter"
- @update:value="onUpdateValue"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { NInput } from "naive-ui";
-import type { CSSProperties } from "vue";
-import { computed, reactive, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { issueServiceClientConnect, planServiceClientConnect } from "@/connect";
-import { pushNotification } from "@/store";
-import {
- IssueSchema,
- UpdateIssueRequestSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import {
- PlanSchema,
- UpdatePlanRequestSchema,
-} from "@/types/proto-es/v1/plan_service_pb";
-import { useIssueContext } from "../../logic";
-
-type ViewMode = "EDIT" | "VIEW";
-
-const { t } = useI18n();
-const {
- isCreating,
- issue,
- allowChange: allowEditIssue,
- events,
-} = useIssueContext();
-
-const state = reactive({
- isEditing: false,
- isUpdating: false,
- title: issue.value.title,
-});
-
-const viewMode = computed((): ViewMode => {
- if (isCreating.value) return "EDIT";
- return state.isEditing ? "EDIT" : "VIEW";
-});
-
-const style = computed(() => {
- const style: CSSProperties = {
- cursor: "default",
- "--n-color-disabled": "transparent",
- "--n-font-size": "18px",
- "font-weight": "bold",
- };
- const border =
- viewMode.value === "EDIT"
- ? "1px solid rgb(var(--color-control-border))"
- : "none";
- style["--n-border"] = border;
- style["--n-border-disabled"] = border;
-
- return style;
-});
-
-const onBlur = async () => {
- const cleanup = () => {
- state.isEditing = false;
- state.isUpdating = false;
- };
-
- if (isCreating.value) {
- cleanup();
- return;
- }
- if (state.title === issue.value.title) {
- cleanup();
- return;
- }
- try {
- state.isUpdating = true;
- if (issue.value.plan) {
- const request = create(UpdatePlanRequestSchema, {
- plan: create(PlanSchema, {
- name: issue.value.plan,
- title: state.title,
- }),
- updateMask: { paths: ["title"] },
- });
- await planServiceClientConnect.updatePlan(request);
- } else {
- const request = create(UpdateIssueRequestSchema, {
- issue: create(IssueSchema, {
- name: issue.value.name,
- title: state.title,
- }),
- updateMask: { paths: ["title"] },
- });
- await issueServiceClientConnect.updateIssue(request);
- }
- events.emit("status-changed", { eager: true });
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- } finally {
- cleanup();
- }
-};
-
-const onEnter = (e: Event) => {
- const input = e.target as HTMLInputElement;
- input.blur();
-};
-
-const onUpdateValue = (title: string) => {
- state.title = title;
- if (isCreating.value) {
- issue.value.title = title;
- }
-};
-
-watch(
- () => issue.value.title,
- (title) => {
- state.title = title;
- }
-);
-</script>
-
-<style>
-.bb-issue-title-input input {
- cursor: text !important;
- color: var(--n-text-color) !important;
- text-decoration-color: var(--n-text-color) !important;
-}
-</style>
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/index.ts b/frontend/src/components/IssueV1/components/HeaderSection/index.ts
deleted file mode 100644
index 3843a93df5..0000000000
--- a/frontend/src/components/IssueV1/components/HeaderSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import HeaderSection from "./HeaderSection.vue";
-
-export default HeaderSection;
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue
deleted file mode 100644
index 62c03b94f9..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentList.vue
+++ /dev/null
@@ -1,240 +0,0 @@
-<template>
- <div class="flex flex-col">
- <ul>
- <IssueCreatedCommentV1
- :issue-comments="issueComments"
- :issue="issue"
- @update-issue="handleUpdateIssue"
- />
- <IssueCommentView
- class="group"
- v-for="(item, index) in issueComments"
- :key="item.name"
- :issue="issue"
- :index="index"
- :is-last="index === issueComments.length - 1"
- :issue-comment="item"
- >
- <template v-if="allowEditIssueComment(item)" #subject-suffix>
- <!-- Edit Comment Button-->
- <NButton
- v-if="!state.editCommentMode"
- quaternary
- size="tiny"
- class="text-gray-500 hover:text-gray-700"
- @click.prevent="onUpdateComment(item)"
- >
- <PencilIcon class="w-3.5 h-3.5" />
- </NButton>
- </template>
-
- <template v-if="item.comment" #comment>
- <MarkdownEditor
- :mode="
- state.editCommentMode &&
- state.activeComment?.name === item.name
- ? 'editor'
- : 'preview'
- "
- :content="item.comment"
- :project="project"
- :maxlength="65536"
- :max-height="Number.MAX_SAFE_INTEGER"
- @change="(val: string) => (state.editComment = val)"
- @submit="doUpdateComment"
- />
- <div
- v-if="
- state.editCommentMode &&
- state.activeComment?.name === item.name
- "
- class="flex gap-x-2 mt-2 items-center justify-end"
- >
- <NButton quaternary size="small" @click.prevent="cancelEditComment">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- size="small"
- :disabled="!allowUpdateComment"
- @click.prevent="doUpdateComment"
- >
- {{ $t("common.save") }}
- </NButton>
- </div>
- </template>
- </IssueCommentView>
- </ul>
-
- <div v-if="!state.editCommentMode && allowCreateComment" class="mt-2">
- <div class="flex gap-3">
- <div class="shrink-0 pt-1">
- <UserAvatar :user="currentUser" />
- </div>
- <div class="min-w-0 flex-1">
- <h3 class="sr-only" id="issue-comment-editor"></h3>
- <MarkdownEditor
- mode="editor"
- :content="state.newComment"
- :project="project"
- :maxlength="65536"
- @change="(val: string) => (state.newComment = val)"
- @submit="doCreateComment(state.newComment)"
- />
- <div class="mt-3 flex items-center justify-end">
- <NButton
- type="primary"
- :disabled="state.newComment.length == 0"
- @click.prevent="doCreateComment(state.newComment)"
- >
- {{ $t("common.comment") }}
- </NButton>
- </div>
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { PencilIcon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { computed, onMounted, reactive, watch, watchEffect } from "vue";
-import { useRoute } from "vue-router";
-import MarkdownEditor from "@/components/MarkdownEditor";
-import UserAvatar from "@/components/User/UserAvatar.vue";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useCurrentProjectV1,
- useCurrentUserV1,
- useIssueCommentStore,
-} from "@/store";
-import type { ComposedIssue } from "@/types";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import { ListIssueCommentsRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import { hasProjectPermissionV2 } from "@/utils";
-import { useIssueContext } from "../../logic";
-import { IssueCommentView } from "./IssueCommentView";
-import IssueCreatedCommentV1 from "./IssueCommentView/IssueCreatedCommentV1.vue";
-
-interface LocalState {
- editCommentMode: boolean;
- activeComment?: IssueComment;
- editComment: string;
- newComment: string;
-}
-
-const route = useRoute();
-
-const { project } = useCurrentProjectV1();
-const { issue } = useIssueContext();
-
-const state = reactive<LocalState>({
- editCommentMode: false,
- editComment: "",
- newComment: "",
-});
-
-const currentUser = useCurrentUserV1();
-const issueCommentStore = useIssueCommentStore();
-
-const prepareIssueComments = async () => {
- await issueCommentStore.listIssueComments(
- create(ListIssueCommentsRequestSchema, {
- parent: issue.value.name,
- // Try to get all comments at once with max page size.
- pageSize: 1000,
- })
- );
-};
-
-watchEffect(prepareIssueComments);
-
-const issueComments = computed(() => {
- return issueCommentStore.getIssueComments(issue.value.name);
-});
-
-const allowCreateComment = computed(() => {
- return hasProjectPermissionV2(project.value, "bb.issueComments.create");
-});
-
-const cancelEditComment = () => {
- state.activeComment = undefined;
- state.editCommentMode = false;
- state.editComment = "";
-};
-
-const doCreateComment = async (comment: string) => {
- await issueCommentStore.createIssueComment({
- issueName: issue.value.name,
- comment,
- });
- state.newComment = "";
- await prepareIssueComments();
-};
-
-const allowEditIssueComment = (comment: IssueComment) => {
- const commentType = getIssueCommentType(comment);
- // Check if comment is user-editable
- const isEditable =
- commentType === IssueCommentType.USER_COMMENT ||
- (commentType === IssueCommentType.APPROVAL && comment.comment !== "");
-
- if (!isEditable) {
- return false;
- }
- if (currentUser.value.email === extractUserId(comment.creator)) {
- return true;
- }
- return hasProjectPermissionV2(project.value, "bb.issueComments.update");
-};
-
-const onUpdateComment = (issueComment: IssueComment) => {
- state.activeComment = issueComment;
- state.editCommentMode = true;
- state.editComment = issueComment.comment;
-};
-
-const doUpdateComment = async () => {
- if (!state.activeComment) {
- return;
- }
- if (!state.editComment) {
- return;
- }
-
- await issueCommentStore.updateIssueComment({
- issueCommentName: state.activeComment.name,
- comment: state.editComment,
- });
- cancelEditComment();
-};
-
-const allowUpdateComment = computed(() => {
- return state.editComment && state.editComment != state.activeComment!.comment;
-});
-
-const handleUpdateIssue = (updatedIssue: ComposedIssue) => {
- Object.assign(issue.value, updatedIssue);
-};
-
-onMounted(() => {
- watch(
- () => route.hash,
- (hash) => {
- if (hash.match(/^#activity(\d+)/)) {
- // use '#activity' element as a fallback
- const elem =
- document.querySelector(hash) || document.querySelector("#activity");
- // We use `setTimeout` here since this should be executed very late.
- setTimeout(() => elem?.scrollIntoView());
- }
- },
- {
- immediate: true,
- }
- );
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentSection.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentSection.vue
deleted file mode 100644
index 131658fbc9..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentSection.vue
+++ /dev/null
@@ -1,15 +0,0 @@
-<template>
- <div class="px-6 py-5 flex flex-col gap-y-5">
- <div class="flex items-center justify-between">
- <span class="text-base font-semibold text-gray-900">
- {{ $t("common.activity") }}
- </span>
- </div>
-
- <IssueCommentList />
- </div>
-</template>
-
-<script lang="ts" setup>
-import IssueCommentList from "./IssueCommentList.vue";
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionCreator.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionCreator.vue
deleted file mode 100644
index 4e634d7261..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionCreator.vue
+++ /dev/null
@@ -1,49 +0,0 @@
-<template>
- <component
- :is="'router-link'"
- v-if="userEmail !== userStore.systemBotUser?.email"
- v-bind="bindings"
- class="font-semibold text-gray-900 whitespace-nowrap hover:underline"
- >
- {{ user?.title }}
- </component>
- <div v-else class="inline-flex items-center gap-1">
- <span class="font-medium text-main whitespace-nowrap">
- {{ user?.title }}
- </span>
- <SystemBotTag />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { computed } from "vue";
-import SystemBotTag from "@/components/misc/SystemBotTag.vue";
-import { extractUserId, useUserStore } from "@/store";
-
-const props = defineProps<{
- // Format: users/{email}
- creator: string;
-}>();
-
-const userStore = useUserStore();
-
-const userEmail = computed(() => {
- return extractUserId(props.creator);
-});
-
-const user = computedAsync(() => {
- return userStore.getOrFetchUserByIdentifier(props.creator);
-});
-
-const bindings = computed(() => {
- return {
- to: `/users/${userEmail.value}`,
- activeClass: "",
- exactActiveClass: "",
- onClick: (e: MouseEvent) => {
- e.stopPropagation();
- },
- };
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue
deleted file mode 100644
index 14e8576b91..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionIcon.vue
+++ /dev/null
@@ -1,200 +0,0 @@
-<template>
- <div class="relative">
- <div v-if="icon === 'system'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <img class="mt-1" src="@/assets/logo-icon.svg" alt="Bytebase" />
- </div>
- </div>
- <div v-else-if="icon === 'avatar'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <UserAvatar
- :user="user"
- override-class="w-7 h-7 font-medium"
- override-text-size="0.8rem"
- />
- </div>
- </div>
- <div v-else-if="icon === 'create'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <PlusIcon class="w-5 h-5 text-control" />
- </div>
- </div>
- <div v-else-if="icon === 'update'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <PencilIcon class="w-4 h-4 text-control" />
- </div>
- </div>
- <div
- v-else-if="icon === 'run' || icon === 'rollout'"
- class="relative pl-0.5"
- >
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <PlayCircleIcon class="w-5 h-5 text-control" />
- </div>
- </div>
- <div v-else-if="icon === 'approve-review'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-success rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <ThumbsUpIcon class="w-4 h-4 text-white" />
- </div>
- </div>
- <div v-else-if="icon === 'reject-review'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-warning rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <PencilIcon class="w-4 h-4 text-white" />
- </div>
- </div>
- <div v-else-if="icon === 're-request-review'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center icon-re-request-review"
- >
- <PlayIcon class="w-4 h-4 text-control ml-px" />
- </div>
- </div>
- <div v-else-if="icon === 'cancel'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <MinusIcon class="w-5 h-5 text-control" />
- </div>
- </div>
- <div v-else-if="icon === 'fail'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <CircleAlertIcon class="w-5 h-5 text-error" />
- </div>
- </div>
- <div v-else-if="icon === 'complete'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-white rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <CheckCircle2Icon class="w-6 h-6 text-success" />
- </div>
- </div>
- <div v-else-if="icon === 'skip'" class="relative pl-1">
- <div
- class="w-6 h-6 bg-gray-200 rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <SkipIcon class="w-5 h-5 text-gray-500" />
- </div>
- </div>
- <div v-else-if="icon === 'commit'" class="relative pl-0.5">
- <div
- class="w-7 h-7 bg-control-bg rounded-full ring-4 ring-white flex items-center justify-center"
- >
- <CodeIcon class="w-5 h-5 text-control" />
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import {
- CheckCircle2Icon,
- CircleAlertIcon,
- CodeIcon,
- MinusIcon,
- PencilIcon,
- PlayCircleIcon,
- PlayIcon,
- PlusIcon,
- ThumbsUpIcon,
-} from "lucide-vue-next";
-import { computed } from "vue";
-import { SkipIcon } from "@/components/Icon";
-import UserAvatar from "@/components/User/UserAvatar.vue";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import { IssueComment_Approval_Status } from "@/types/proto-es/v1/issue_service_pb";
-
-type ActionIconType =
- | "avatar"
- | "system"
- | "create"
- | "update"
- | "run"
- | "approve-review"
- | "reject-review"
- | "re-request-review"
- | "rollout"
- | "cancel"
- | "fail"
- | "complete"
- | "skip"
- | "commit";
-
-const props = defineProps<{
- issueComment: IssueComment;
-}>();
-
-const userStore = useUserStore();
-
-const user = computedAsync(() => {
- return userStore.getOrFetchUserByIdentifier(props.issueComment.creator);
-});
-
-const icon = computed((): ActionIconType => {
- const { issueComment } = props;
- const commentType = getIssueCommentType(issueComment);
- if (
- commentType === IssueCommentType.APPROVAL &&
- issueComment.event?.case === "approval"
- ) {
- const { status } = issueComment.event.value;
- switch (status) {
- case IssueComment_Approval_Status.APPROVED:
- return "approve-review";
- case IssueComment_Approval_Status.REJECTED:
- return "reject-review";
- case IssueComment_Approval_Status.PENDING:
- return "re-request-review";
- }
- } else if (
- commentType === IssueCommentType.ISSUE_UPDATE &&
- issueComment.event?.case === "issueUpdate"
- ) {
- const { toTitle, toDescription, toLabels, fromLabels } =
- issueComment.event.value;
- if (
- toTitle !== undefined ||
- toDescription !== undefined ||
- toLabels.length !== 0 ||
- fromLabels.length !== 0
- ) {
- return "update";
- }
- // Otherwise, show avatar icon based on the creator.
- } else if (commentType === IssueCommentType.PLAN_SPEC_UPDATE) {
- return "update";
- }
-
- return extractUserId(issueComment.creator) == userStore.systemBotUser?.email
- ? "system"
- : "avatar";
-});
-</script>
-
-<style scoped>
-.icon-re-request-review :deep(path) {
- stroke-width: 3 !important;
-}
-</style>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
deleted file mode 100644
index 27ee5016d4..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/ActionSentence.vue
+++ /dev/null
@@ -1,139 +0,0 @@
-<template>
- <Renderer />
-</template>
-
-<script lang="tsx" setup>
-import { defineComponent } from "vue";
-import { Translation, useI18n } from "vue-i18n";
-import { SpecLink } from "@/components/v2";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
-import type { ComposedIssue } from "@/types";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import {
- IssueComment_Approval_Status,
- IssueStatus,
-} from "@/types/proto-es/v1/issue_service_pb";
-import {
- extractPlanUID,
- extractProjectResourceName,
- getSpecDisplayInfo,
-} from "@/utils";
-import StatementUpdate from "./StatementUpdate.vue";
-
-const props = defineProps<{
- issue: ComposedIssue;
- issueComment: IssueComment;
-}>();
-
-const { t } = useI18n();
-const userStore = useUserStore();
-
-const maybeAutomaticallyVerb = (
- issueComment: IssueComment,
- verb: string
-): string => {
- if (extractUserId(issueComment.creator) !== userStore.systemBotUser?.email) {
- return verb;
- }
- return t("activity.sentence.xxx-automatically", {
- verb,
- });
-};
-
-const renderActionSentence = () => {
- const { issueComment } = props;
- const commentType = getIssueCommentType(issueComment);
- if (
- commentType === IssueCommentType.APPROVAL &&
- issueComment.event?.case === "approval"
- ) {
- const { status } = issueComment.event.value;
- let verb = "";
- if (status === IssueComment_Approval_Status.APPROVED) {
- verb = t("custom-approval.issue-review.approved-issue");
- } else if (status === IssueComment_Approval_Status.REJECTED) {
- verb = t("custom-approval.issue-review.rejected-issue");
- } else if (status === IssueComment_Approval_Status.PENDING) {
- verb = t("custom-approval.issue-review.re-requested-review");
- }
- if (verb) {
- return maybeAutomaticallyVerb(issueComment, verb);
- }
- } else if (
- commentType === IssueCommentType.ISSUE_UPDATE &&
- issueComment.event?.case === "issueUpdate"
- ) {
- const {
- fromTitle,
- toTitle,
- fromDescription,
- toDescription,
- fromStatus,
- toStatus,
- fromLabels,
- toLabels,
- } = issueComment.event.value;
- if (fromTitle !== undefined && toTitle !== undefined) {
- return t("activity.sentence.changed-from-to", {
- name: t("issue.issue-name").toLowerCase(),
- oldValue: fromTitle,
- newValue: toTitle,
- });
- } else if (fromDescription !== undefined && toDescription !== undefined) {
- // Description could be very long, so we don't display it.
- return t("activity.sentence.changed-description");
- } else if (fromStatus !== undefined && toStatus !== undefined) {
- if (toStatus === IssueStatus.DONE) {
- return t("activity.sentence.resolved-issue");
- } else if (toStatus === IssueStatus.CANCELED) {
- return t("activity.sentence.canceled-issue");
- } else if (toStatus === IssueStatus.OPEN) {
- return t("activity.sentence.reopened-issue");
- }
- } else if (fromLabels.length !== 0 || toLabels.length !== 0) {
- return t("activity.sentence.changed-labels");
- }
- } else if (
- commentType === IssueCommentType.PLAN_SPEC_UPDATE &&
- issueComment.event?.case === "planSpecUpdate"
- ) {
- const { spec, fromSheet, toSheet } = issueComment.event.value;
- if (fromSheet !== undefined && toSheet !== undefined) {
- const specs = props.issue.planEntity?.specs ?? [];
- const specInfo = getSpecDisplayInfo(specs, spec);
- const planName = props.issue.planEntity?.name ?? props.issue.plan;
- const projectName = extractProjectResourceName(props.issue.project);
- const planUID = extractPlanUID(planName);
-
- return (
- <Translation keypath="dynamic.activity.sentence.modified-sql-of-spec-link">
- {{
- spec: () => (
- <SpecLink
- projectName={projectName}
- planUID={planUID}
- specId={specInfo?.specId ?? ""}
- displayIndex={specInfo?.displayIndex ?? 0}
- />
- ),
- link: () => (
- <StatementUpdate oldSheet={fromSheet} newSheet={toSheet} />
- ),
- }}
- </Translation>
- );
- }
- }
- return "";
-};
-
-const Renderer = defineComponent({
- name: "ActionSentenceRenderer",
- render: () => <span>{renderActionSentence()}</span>,
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
deleted file mode 100644
index a79f9d0dcb..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentAction.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
- <div class="min-w-0 flex-1">
- <div
- class="rounded-lg border overflow-hidden"
- :class="
- $slots.comment
- ? 'ml-3 border-gray-200 bg-white'
- : 'ml-1 border-transparent'
- "
- >
- <div class="px-3 py-2" :class="$slots.comment ? 'bg-gray-50' : ''">
- <div class="flex items-center justify-between">
- <div class="flex items-center gap-x-2 text-sm min-w-0 flex-wrap">
- <ActionCreator
- v-if="
- extractUserId(issueComment.creator) !==
- userStore.systemBotUser?.email ||
- getIssueCommentType(issueComment) ===
- IssueCommentType.USER_COMMENT
- "
- :creator="issueComment.creator"
- />
-
- <ActionSentence
- :issue="issue"
- :issue-comment="issueComment"
- class="text-gray-600 wrap-break-word min-w-0"
- />
-
- <HumanizeTs
- :ts="
- getTimeForPbTimestampProtoEs(issueComment.createTime, 0) / 1000
- "
- class="text-gray-500"
- />
-
- <span
- v-if="
- getTimeForPbTimestampProtoEs(issueComment.createTime) !==
- getTimeForPbTimestampProtoEs(issueComment.updateTime) &&
- getIssueCommentType(issueComment) ===
- IssueCommentType.USER_COMMENT
- "
- class="text-gray-500 text-xs"
- >
- ({{ $t("common.edited") }})
- </span>
- </div>
-
- <slot name="subject-suffix"></slot>
- </div>
- </div>
- <div
- v-if="$slots.comment"
- class="px-4 py-3 border-t border-gray-200 text-sm text-gray-700 whitespace-pre-wrap wrap-break-word"
- >
- <slot name="comment" />
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import HumanizeTs from "@/components/misc/HumanizeTs.vue";
-import {
- extractUserId,
- getIssueCommentType,
- IssueCommentType,
- useUserStore,
-} from "@/store";
-import { type ComposedIssue, getTimeForPbTimestampProtoEs } from "@/types";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import ActionCreator from "./ActionCreator.vue";
-import ActionSentence from "./ActionSentence.vue";
-
-defineProps<{
- issue: ComposedIssue;
- index: number;
- issueComment: IssueComment;
- rollout?: Rollout;
-}>();
-
-const userStore = useUserStore();
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentView.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentView.vue
deleted file mode 100644
index 7d47555c0a..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCommentView.vue
+++ /dev/null
@@ -1,42 +0,0 @@
-<template>
- <li>
- <div :id="`#${issueComment.name}`" class="relative pb-4">
- <span
- v-if="!isLast"
- class="absolute left-4 -ml-px h-full w-0.5 bg-gray-200"
- aria-hidden="true"
- ></span>
- <div class="relative flex items-start">
- <div class="pt-1.5">
- <ActionIcon :issue-comment="issueComment" />
- </div>
-
- <IssueCommentAction
- :issue="issue"
- :index="index"
- :issue-comment="issueComment"
- >
- <template v-for="(_, name) in $slots" :key="name" #[name]>
- <slot :name="name" />
- </template>
- </IssueCommentAction>
- </div>
- </div>
- </li>
-</template>
-
-<script lang="ts" setup>
-import type { ComposedIssue } from "@/types";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import ActionIcon from "./ActionIcon.vue";
-import IssueCommentAction from "./IssueCommentAction.vue";
-
-defineProps<{
- issue: ComposedIssue;
- isLast: boolean;
- index: number;
- issueComment: IssueComment;
- rollout?: Rollout;
-}>();
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedCommentV1.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedCommentV1.vue
deleted file mode 100644
index a9d58ba796..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/IssueCreatedCommentV1.vue
+++ /dev/null
@@ -1,214 +0,0 @@
-<template>
- <li>
- <div class="relative pb-4">
- <span
- v-if="issueComments.length > 0"
- class="absolute left-4 -ml-px h-full w-0.5 bg-block-border"
- aria-hidden="true"
- ></span>
- <div class="relative flex items-start">
- <div class="relative">
- <div class="pt-1.5 bg-white"></div>
- <UserAvatar override-class="w-7 h-7 font-medium" :user="creator" />
- <div
- class="absolute -bottom-1 -right-1 w-4 h-4 bg-control-bg rounded-full ring-2 ring-white flex items-center justify-center"
- >
- <PlusIcon class="w-4 h-4 text-control" />
- </div>
- </div>
-
- <div class="ml-3 min-w-0 flex-1">
- <div class="rounded-lg border border-gray-200 bg-white">
- <div class="px-3 py-2 bg-gray-50">
- <div class="flex items-center justify-between">
- <div
- class="flex items-center gap-x-2 text-sm min-w-0 flex-wrap"
- >
- <ActionCreator :creator="issue.creator" />
- <span class="text-gray-600 wrap-break-word min-w-0">{{
- $t("activity.sentence.created-issue")
- }}</span>
- <HumanizeTs
- :ts="
- getTimeForPbTimestampProtoEs(issue.createTime, 0) / 1000
- "
- class="text-gray-500"
- />
- </div>
- <NButton
- v-if="allowEdit && !state.isEditing"
- quaternary
- size="tiny"
- @click.prevent="startEdit"
- >
- <PencilIcon class="w-3.5 h-3.5" />
- </NButton>
- </div>
- </div>
- <div
- class="px-4 py-3 border-t border-gray-200 text-sm text-gray-700"
- >
- <p v-if="!state.isEditing && !description">
- <i class="text-gray-400 italic">{{
- $t("issue.no-description-provided")
- }}</i>
- </p>
- <MarkdownEditor
- v-else
- :mode="state.isEditing ? 'editor' : 'preview'"
- :content="state.isEditing ? state.editContent : description"
- :project="project"
- @change="(val: string) => (state.editContent = val)"
- @submit="saveEdit"
- />
- <div
- v-if="state.isEditing"
- class="flex gap-x-2 mt-2 items-center justify-end"
- >
- <NButton quaternary size="small" @click.prevent="cancelEdit">
- {{ $t("common.cancel") }}
- </NButton>
- <NButton
- size="small"
- :disabled="!allowSave"
- :loading="state.isSaving"
- @click.prevent="saveEdit"
- >
- {{ $t("common.save") }}
- </NButton>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </li>
-</template>
-
-<script lang="ts" setup>
-import { create } from "@bufbuild/protobuf";
-import { PencilIcon, PlusIcon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { computed, reactive } from "vue";
-import MarkdownEditor from "@/components/MarkdownEditor";
-import HumanizeTs from "@/components/misc/HumanizeTs.vue";
-import UserAvatar from "@/components/User/UserAvatar.vue";
-import { issueServiceClientConnect, planServiceClientConnect } from "@/connect";
-import { useCurrentProjectV1, useCurrentUserV1, useUserStore } from "@/store";
-import { type ComposedIssue, getTimeForPbTimestampProtoEs } from "@/types";
-import type { IssueComment } from "@/types/proto-es/v1/issue_service_pb";
-import { UpdateIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import {
- PlanSchema,
- UpdatePlanRequestSchema,
-} from "@/types/proto-es/v1/plan_service_pb";
-import { hasProjectPermissionV2 } from "@/utils";
-import ActionCreator from "./ActionCreator.vue";
-
-const props = defineProps<{
- issue: ComposedIssue;
- issueComments: IssueComment[];
-}>();
-
-const emit = defineEmits<{
- (event: "update-issue", issue: ComposedIssue): void;
-}>();
-
-const currentUser = useCurrentUserV1();
-const userStore = useUserStore();
-const { project } = useCurrentProjectV1();
-
-const state = reactive({
- isEditing: false,
- editContent: "",
- isSaving: false,
-});
-
-const creator = computed(() => {
- return userStore.getUserByIdentifier(props.issue.creator);
-});
-
-const description = computed(() => {
- // Try to get description from plan first, then fallback to issue description
- return (
- (props.issue.plan
- ? props.issue.planEntity?.description
- : props.issue.description) || ""
- );
-});
-
-const allowEdit = computed(() => {
- // Always allow if the current user is the creator.
- if (currentUser.value.name === creator.value?.name) {
- return true;
- }
- // Check for plan update permission if we have a plan, otherwise issue update.
- if (props.issue.plan) {
- return hasProjectPermissionV2(project.value, "bb.plans.update");
- }
- return hasProjectPermissionV2(project.value, "bb.issues.update");
-});
-
-const allowSave = computed(() => {
- return state.editContent !== description.value;
-});
-
-const startEdit = () => {
- state.editContent = description.value;
- state.isEditing = true;
-};
-
-const cancelEdit = () => {
- state.isEditing = false;
- state.editContent = "";
-};
-
-const saveEdit = async () => {
- if (!allowSave.value) return;
-
- try {
- state.isSaving = true;
-
- if (props.issue.plan) {
- // Update plan description
- const planPatch = create(PlanSchema, {
- name: props.issue.plan,
- description: state.editContent,
- });
- const request = create(UpdatePlanRequestSchema, {
- plan: planPatch,
- updateMask: { paths: ["description"] },
- });
- const response = await planServiceClientConnect.updatePlan(request);
- if (props.issue.planEntity) {
- const updatedIssue = {
- ...props.issue,
- planEntity: response,
- };
- emit("update-issue", updatedIssue);
- }
- } else {
- // Update issue description
- const request = create(UpdateIssueRequestSchema, {
- issue: {
- ...props.issue,
- description: state.editContent,
- },
- updateMask: { paths: ["description"] },
- });
- const response = await issueServiceClientConnect.updateIssue(request);
- const updatedIssue = {
- ...props.issue,
- ...response,
- };
- emit("update-issue", updatedIssue);
- }
-
- cancelEdit();
- } catch (error) {
- console.error("Failed to update description:", error);
- } finally {
- state.isSaving = false;
- }
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
deleted file mode 100644
index 5af10d096c..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StageName.vue
+++ /dev/null
@@ -1,20 +0,0 @@
-<template>
- <span class="font-medium text-main">
- <EnvironmentV1Name
- :link="false"
- :environment="environmentStore.getEnvironmentByName(stage.environment)"
- />
- </span>
-</template>
-
-<script lang="ts" setup>
-import { EnvironmentV1Name } from "@/components/v2";
-import { useEnvironmentV1Store } from "@/store";
-import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
-
-defineProps<{
- stage: Stage;
-}>();
-
-const environmentStore = useEnvironmentV1Store();
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StatementUpdate.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StatementUpdate.vue
deleted file mode 100644
index 080d36372c..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/StatementUpdate.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-<template>
- <NButton text type="primary" v-bind="$attrs" @click="showPanel = true">
- {{ $t("common.view-details") }}
- </NButton>
-
- <BBModal
- v-if="showPanel"
- :title="$t('common.detail')"
- header-class="border-0!"
- container-class="pt-0!"
- @close="showPanel = false"
- >
- <div
- style="width: calc(100vw - 9rem); height: calc(100vh - 10rem)"
- class="relative"
- >
- <DiffEditor
- v-if="!isPreparingOldStatement && !isPreparingNewStatement"
- class="w-full h-full border rounded-md overflow-clip"
- :original="oldStatement"
- :modified="newStatement"
- :readonly="true"
- />
- <div
- v-else
- class="absolute inset-0 flex flex-col items-center justify-center"
- >
- <BBSpin />
- </div>
- </div>
- </BBModal>
-</template>
-
-<script setup lang="ts">
-import { asyncComputed } from "@vueuse/core";
-import { NButton } from "naive-ui";
-import { ref } from "vue";
-import { BBModal, BBSpin } from "@/bbkit";
-import { DiffEditor } from "@/components/MonacoEditor";
-import { useSheetV1Store } from "@/store";
-import { UNKNOWN_ID } from "@/types";
-import { extractSheetUID, getSheetStatement } from "@/utils";
-
-const props = defineProps<{
- // Format: projects/{project}/sheets/{sheet}
- oldSheet: string;
- // Format: projects/{project}/sheets/{sheet}
- newSheet: string;
-}>();
-
-const showPanel = ref(false);
-
-const prepareStatement = async (sheetName: string) => {
- if (extractSheetUID(sheetName) === String(UNKNOWN_ID)) return "";
- // Use any (basic or full) view of sheets here to save data size
- const sheet = await useSheetV1Store().getOrFetchSheetByName(sheetName);
- if (!sheet) return "";
- return getSheetStatement(sheet);
-};
-
-const isPreparingOldStatement = ref(false);
-const isPreparingNewStatement = ref(false);
-
-const oldStatement = asyncComputed(
- () => {
- return prepareStatement(props.oldSheet);
- },
- "",
- {
- evaluating: isPreparingOldStatement,
- lazy: true,
- }
-);
-
-const newStatement = asyncComputed(
- () => {
- return prepareStatement(props.newSheet);
- },
- "",
- {
- evaluating: isPreparingNewStatement,
- lazy: true,
- }
-);
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue
deleted file mode 100644
index eb1e1c6731..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/TaskName.vue
+++ /dev/null
@@ -1,81 +0,0 @@
-<template>
- <router-link
- :to="link"
- exact-active-class=""
- class="font-medium text-main hover:border-b hover:border-b-main"
- @click="toTop"
- >
- <span>{{ databaseForTask(projectOfIssue(issue), task).databaseName }}</span>
- </router-link>
-</template>
-
-<script lang="ts" setup>
-import scrollIntoView from "scroll-into-view-if-needed";
-import { computed } from "vue";
-import type { LocationQueryRaw } from "vue-router";
-import { projectOfIssue } from "@/components/IssueV1/logic";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_ROLLOUT_TASK,
-} from "@/router/dashboard/projectV1";
-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- databaseForTask,
- extractPlanUIDFromRolloutName,
- extractProjectResourceName,
- extractStageNameFromTaskName,
- extractStageUID,
- extractTaskUID,
- issueV1Slug,
-} from "@/utils";
-
-const props = defineProps<{
- issue: Issue;
- task: Task;
-}>();
-
-const { enabledNewLayout } = useIssueLayoutVersion();
-
-const link = computed(() => {
- const { issue, task } = props;
-
- if (enabledNewLayout.value) {
- return {
- name: PROJECT_V1_ROUTE_PLAN_ROLLOUT_TASK,
- params: {
- projectId: extractProjectResourceName(task.name),
- planId: extractPlanUIDFromRolloutName(task.name),
- stageId: extractStageUID(extractStageNameFromTaskName(task.name)),
- taskId: extractTaskUID(task.name),
- },
- };
- } else {
- const query: LocationQueryRaw = {
- task: extractTaskUID(task.name),
- stage: extractStageUID(task.name),
- };
-
- return {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.name),
- issueSlug: issueV1Slug(issue.name, issue.title),
- },
- query,
- };
- }
-});
-
-const toTop = () => {
- const taskElem = document.querySelector(
- `[data-task-id="${extractTaskUID(props.task.name)}"]`
- );
- if (taskElem) {
- scrollIntoView(taskElem, {
- scrollMode: "if-needed",
- });
- }
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/index.ts b/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/index.ts
deleted file mode 100644
index da913ab5a2..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/IssueCommentView/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import IssueCommentView from "./IssueCommentView.vue";
-
-export { IssueCommentView };
diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/index.ts b/frontend/src/components/IssueV1/components/IssueCommentSection/index.ts
deleted file mode 100644
index 078c74bb18..0000000000
--- a/frontend/src/components/IssueV1/components/IssueCommentSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import IssueCommentSection from "./IssueCommentSection.vue";
-
-export default IssueCommentSection;
diff --git a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue b/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
index f5a54a9a2b..3f67642814 100644
--- a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
+++ b/frontend/src/components/IssueV1/components/IssueStatusIcon.vue
@@ -62,7 +62,7 @@ import { useI18n } from "vue-i18n";
import type { ComposedIssue } from "@/types";
import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { isUnfinishedResolvedTask as checkUnfinishedResolvedTask } from "../logic";
+import { isUnfinishedResolvedTask as checkUnfinishedResolvedTask } from "@/utils";
export type SizeType = "small" | "normal";
diff --git a/frontend/src/components/IssueV1/components/IssueTableV1.vue b/frontend/src/components/IssueV1/components/IssueTableV1.vue
index 8f025d40bb..cb93cd26f4 100644
--- a/frontend/src/components/IssueV1/components/IssueTableV1.vue
+++ b/frontend/src/components/IssueV1/components/IssueTableV1.vue
@@ -49,7 +49,6 @@ import BatchIssueActionsV1 from "@/components/IssueV1/components/BatchIssueActio
import CurrentApproverV1 from "@/components/IssueV1/components/CurrentApproverV1.vue";
import { UserNameCell } from "@/components/v2/Model/cells";
import { useElementVisibilityInScrollParent } from "@/composables/useElementVisibilityInScrollParent";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { useUserStore } from "@/store";
import {
type ComposedIssue,
@@ -61,8 +60,8 @@ import {
getHighlightHTMLByRegExp,
getIssueRoute,
humanizeTs,
+ projectOfIssue,
} from "@/utils";
-import { projectOfIssue } from "../logic";
import IssueLabelSelector, {
getValidIssueLabels,
} from "./IssueLabelSelector.vue";
@@ -94,7 +93,6 @@ const props = withDefaults(
const { t } = useI18n();
const router = useRouter();
const userStore = useUserStore();
-const { enabledNewLayout } = useIssueLayoutVersion();
const state = reactive<LocalState>({
selectedIssueNameList: new Set(),
});
@@ -254,7 +252,7 @@ const columnList = computed((): DataTableColumn<ComposedIssue>[] => {
});
const issueUrl = (issue: ComposedIssue) => {
- const issueRoute = getIssueRoute(issue, undefined, enabledNewLayout.value);
+ const issueRoute = getIssueRoute(issue);
const route = router.resolve({
name: issueRoute.name,
params: issueRoute.params,
diff --git a/frontend/src/components/IssueV1/components/Panel/BatchIssueStatusActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/BatchIssueStatusActionPanel.vue
index 603c9b046b..50f507a672 100644
--- a/frontend/src/components/IssueV1/components/Panel/BatchIssueStatusActionPanel.vue
+++ b/frontend/src/components/IssueV1/components/Panel/BatchIssueStatusActionPanel.vue
@@ -43,7 +43,7 @@
</div>
</template>
<template #footer>
- <div v-if="action" class="flex justify-end gap-x-3">
+ <div v-if="action" class="flex justify-end gap-x-2">
<NButton @click="$emit('close')">
{{ $t("common.cancel") }}
</NButton>
@@ -63,17 +63,17 @@ import { create } from "@bufbuild/protobuf";
import { NButton, NInput } from "naive-ui";
import { computed, reactive, ref } from "vue";
import { useI18n } from "vue-i18n";
-import type { IssueStatusAction } from "@/components/IssueV1/logic";
-import {
- IssueStatusActionToIssueStatusMap,
- issueStatusActionButtonProps,
- issueStatusActionDisplayName,
-} from "@/components/IssueV1/logic";
import { issueServiceClientConnect } from "@/connect";
import { pushNotification } from "@/store";
import type { ComposedIssue } from "@/types";
import { BatchUpdateIssuesStatusRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import CommonDrawer from "./CommonDrawer.vue";
+import type { IssueStatusAction } from "./issueStatusAction";
+import {
+ IssueStatusActionToIssueStatusMap,
+ issueStatusActionButtonProps,
+ issueStatusActionDisplayName,
+} from "./issueStatusAction";
type LocalState = {
loading: boolean;
diff --git a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
deleted file mode 100644
index 37d8dfc836..0000000000
--- a/frontend/src/components/IssueV1/components/Panel/IssueReviewActionPanel.vue
+++ /dev/null
@@ -1,241 +0,0 @@
-<template>
- <CommonDrawer
- :show="action !== undefined"
- :title="title"
- :loading="state.loading"
- @show="resetState"
- @close="$emit('close')"
- >
- <template #default>
- <div v-if="action" class="flex flex-col gap-y-4 px-1">
- <div class="flex flex-col gap-y-1">
- <div class="font-medium text-control">
- {{ $t("common.issue") }}
- </div>
- <div class="textinfolabel">
- {{ issue.title }}
- </div>
- </div>
-
- <PlanCheckRunBar
- v-if="issue.planCheckRunList.length > 0"
- class="shrink-0 flex-col gap-y-1"
- label-class="text-base!"
- :allow-run-checks="false"
- :plan-name="issue.plan"
- :plan-check-run-list="issue.planCheckRunList"
- :database="database"
- />
-
- <div v-if="planCheckErrors.length > 0" class="flex flex-col">
- <ErrorList :errors="planCheckErrors" :bullets="false" class="text-sm">
- <template #prefix>
- <heroicons:exclamation-triangle
- class="text-warning w-4 h-4 inline-block mr-1 mb-px"
- />
- </template>
- </ErrorList>
- </div>
-
- <div class="flex flex-col gap-y-1">
- <p class="font-medium text-control">
- {{ $t("common.comment") }}
- <RequiredStar v-show="props.action === 'SEND_BACK'" />
- </p>
- <NInput
- v-model:value="comment"
- type="textarea"
- :placeholder="$t('issue.leave-a-comment')"
- :autosize="{
- minRows: 3,
- maxRows: 10,
- }"
- />
- </div>
- </div>
- </template>
- <template #footer>
- <div
- v-if="action"
- class="w-full flex flex-row justify-between items-center gap-2"
- >
- <div>
- <NCheckbox
- v-if="showPerformActionAnyway"
- v-model:checked="performActionAnyway"
- >
- {{
- $t("issue.action-anyway", {
- action: issueReviewActionDisplayName(action),
- })
- }}
- </NCheckbox>
- </div>
- <div class="flex justify-end gap-x-3">
- <NButton @click="$emit('close')">
- {{ $t("common.cancel") }}
- </NButton>
-
- <NTooltip :disabled="confirmErrors.length === 0" placement="top">
- <template #trigger>
- <NButton
- type="primary"
- :disabled="confirmErrors.length > 0"
- @click="handleConfirm"
- >
- {{ $t("common.confirm") }}
- </NButton>
- </template>
- <template #default>
- <ErrorList :errors="confirmErrors" />
- </template>
- </NTooltip>
- </div>
- </div>
- </template>
- </CommonDrawer>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { NButton, NCheckbox, NInput, NTooltip } from "naive-ui";
-import { computed, reactive, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import type { IssueReviewAction } from "@/components/IssueV1/logic";
-import {
- issueReviewActionDisplayName,
- planCheckRunSummaryForIssue,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import PlanCheckRunBar from "@/components/PlanCheckRun/PlanCheckRunBar.vue";
-import RequiredStar from "@/components/RequiredStar.vue";
-import { issueServiceClientConnect } from "@/connect";
-import { useCurrentProjectV1 } from "@/store";
-import {
- ApproveIssueRequestSchema,
- RejectIssueRequestSchema,
- RequestIssueRequestSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import { databaseForTask } from "@/utils";
-import { ErrorList } from "../common";
-import CommonDrawer from "./CommonDrawer.vue";
-
-type LocalState = {
- loading: boolean;
-};
-
-const props = defineProps<{
- action?: IssueReviewAction;
-}>();
-const emit = defineEmits<{
- (event: "close"): void;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- loading: false,
-});
-const { events, issue, selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const comment = ref("");
-const performActionAnyway = ref(false);
-
-const title = computed(() => {
- switch (props.action) {
- case "APPROVE":
- return t("custom-approval.issue-review.approve-issue");
- case "SEND_BACK":
- return t("custom-approval.issue-review.send-back-issue");
- case "RE_REQUEST":
- return t("custom-approval.issue-review.re-request-review-issue");
- }
- return ""; // Make linter happy
-});
-
-const database = computed(() =>
- databaseForTask(project.value, selectedTask.value)
-);
-
-const showPerformActionAnyway = computed(() => {
- return planCheckErrors.value.length > 0;
-});
-
-const planCheckErrors = computed(() => {
- const errors: string[] = [];
- if (props.action === "APPROVE") {
- const summary = planCheckRunSummaryForIssue(issue.value);
- if (summary.errorCount > 0 || summary.warnCount) {
- errors.push(
- t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"
- )
- );
- }
- if (summary.runningCount > 0) {
- errors.push(
- t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-are-still-running"
- )
- );
- }
- }
-
- return errors;
-});
-
-const confirmErrors = computed(() => {
- const errors: string[] = [];
- if (props.action === "SEND_BACK" && comment.value === "") {
- errors.push(
- t(
- "custom-approval.issue-review.disallow-approve-reason.x-field-is-required",
- {
- field: t("common.comment"),
- }
- )
- );
- }
- if (planCheckErrors.value.length > 0 && !performActionAnyway.value) {
- errors.push(...planCheckErrors.value);
- }
- return errors;
-});
-
-const handleConfirm = async () => {
- const { action } = props;
- if (!action) return;
- state.loading = true;
- try {
- if (action === "APPROVE") {
- const request = create(ApproveIssueRequestSchema, {
- name: issue.value.name,
- comment: comment.value,
- });
- await issueServiceClientConnect.approveIssue(request);
- } else if (action === "RE_REQUEST") {
- const request = create(RequestIssueRequestSchema, {
- name: issue.value.name,
- comment: comment.value,
- });
- await issueServiceClientConnect.requestIssue(request);
- } else if (action === "SEND_BACK") {
- const request = create(RejectIssueRequestSchema, {
- name: issue.value.name,
- comment: comment.value,
- });
- await issueServiceClientConnect.rejectIssue(request);
- }
-
- // notify the issue logic to update issue status
- events.emit("status-changed", { eager: true });
- } finally {
- state.loading = false;
- emit("close");
- }
-};
-
-const resetState = () => {
- comment.value = "";
- performActionAnyway.value = false;
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue
deleted file mode 100644
index 5920f25a65..0000000000
--- a/frontend/src/components/IssueV1/components/Panel/IssueStatusActionPanel.vue
+++ /dev/null
@@ -1,198 +0,0 @@
-<template>
- <CommonDrawer
- :show="action !== undefined"
- :title="title"
- :loading="state.loading"
- @show="comment = ''"
- @close="$emit('close')"
- >
- <template #default>
- <div v-if="action" class="flex flex-col gap-y-4 px-1">
- <div class="flex flex-col gap-y-1">
- <div class="font-medium text-control">
- {{ $t("common.issue") }}
- </div>
- <div class="textinfolabel">
- {{ issue.title }}
- </div>
- </div>
-
- <div v-if="issueStatusActionErrors.length > 0" class="flex flex-col">
- <ErrorList
- :errors="issueStatusActionErrors"
- bullets="none"
- class="text-sm"
- >
- <template #prefix>
- <heroicons:exclamation-triangle
- class="text-warning w-4 h-4 inline-block mr-1 mb-px"
- />
- </template>
- </ErrorList>
- </div>
-
- <div class="flex flex-col gap-y-1">
- <p class="font-medium text-control">
- {{ $t("common.comment") }}
- </p>
- <NInput
- v-model:value="comment"
- type="textarea"
- :placeholder="$t('issue.leave-a-comment')"
- :autosize="{
- minRows: 3,
- maxRows: 10,
- }"
- />
- </div>
- </div>
- </template>
- <template #footer>
- <div
- v-if="action"
- class="w-full flex flex-row justify-between items-center gap-2"
- >
- <div>
- <NCheckbox
- v-if="showPerformActionAnyway"
- v-model:checked="performActionAnyway"
- >
- {{
- $t("issue.action-anyway", {
- action: issueStatusActionDisplayName(action),
- })
- }}
- </NCheckbox>
- </div>
- <div class="flex justify-end gap-x-3">
- <NButton @click="$emit('close')">
- {{ $t("common.cancel") }}
- </NButton>
- <NTooltip :disabled="confirmErrors.length === 0" placement="top">
- <template #trigger>
- <NButton
- :disabled="confirmErrors.length > 0"
- v-bind="confirmButtonProps"
- @click="handleConfirm(action!, comment)"
- >
- {{ $t("common.confirm") }}
- </NButton>
- </template>
- <template #default>
- <ErrorList :errors="confirmErrors" />
- </template>
- </NTooltip>
- </div>
- </div>
- </template>
- </CommonDrawer>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { NButton, NCheckbox, NInput, NTooltip } from "naive-ui";
-import { computed, reactive, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import type { IssueStatusAction } from "@/components/IssueV1/logic";
-import {
- IssueStatusActionToIssueStatusMap,
- issueStatusActionButtonProps,
- issueStatusActionDisplayName,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import ErrorList from "@/components/misc/ErrorList.vue";
-import { issueServiceClientConnect } from "@/connect";
-import { pushNotification } from "@/store";
-import { BatchUpdateIssuesStatusRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { flattenTaskV1List } from "@/utils";
-import CommonDrawer from "./CommonDrawer.vue";
-
-type LocalState = {
- loading: boolean;
-};
-
-const props = defineProps<{
- action?: IssueStatusAction;
-}>();
-const emit = defineEmits<{
- (event: "close"): void;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- loading: false,
-});
-const { events, issue } = useIssueContext();
-const comment = ref("");
-const performActionAnyway = ref(false);
-
-const title = computed(() => {
- const { action } = props;
-
- switch (action) {
- case "CLOSE":
- return t("issue.status-transition.modal.close");
- case "REOPEN":
- return t("issue.status-transition.modal.reopen");
- }
- return "";
-});
-
-const showPerformActionAnyway = computed(() => {
- return issueStatusActionErrors.value.length > 0;
-});
-
-const issueStatusActionErrors = computed(() => {
- const tasks = flattenTaskV1List(issue.value.rolloutEntity);
- if (tasks.some((task) => task.status === Task_Status.RUNNING)) {
- return [t("issue.status-transition.error.some-tasks-are-still-running")];
- }
- return [];
-});
-
-const confirmErrors = computed(() => {
- const errors: string[] = [];
- if (issueStatusActionErrors.value.length > 0 && !performActionAnyway.value) {
- errors.push(...issueStatusActionErrors.value);
- }
- return errors;
-});
-
-const confirmButtonProps = computed(() => {
- if (!props.action) return {};
- const p = issueStatusActionButtonProps(props.action);
- if (p.type === "default") {
- p.type = "primary";
- }
- return p;
-});
-
-const handleConfirm = async (
- action: IssueStatusAction,
- comment: string | undefined
-) => {
- state.loading = true;
- try {
- const request = create(BatchUpdateIssuesStatusRequestSchema, {
- parent: issue.value.project,
- issues: [issue.value.name],
- status: IssueStatusActionToIssueStatusMap[action],
- reason: comment ?? "",
- });
- await issueServiceClientConnect.batchUpdateIssuesStatus(request);
-
- // notify the issue logic to update issue status
- events.emit("status-changed", { eager: true });
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- emit("close");
- } finally {
- state.loading = false;
- }
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue b/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue
deleted file mode 100644
index 8405158ee1..0000000000
--- a/frontend/src/components/IssueV1/components/Panel/RolloutTaskDatabaseName.vue
+++ /dev/null
@@ -1,35 +0,0 @@
-<template>
- <div class="flex items-center flex-1 gap-x-1 overflow-hidden">
- <InstanceV1Name
- :instance="db.instanceResource"
- :plain="true"
- :link="false"
- text-class="shrink-0 whitespace-nowrap"
- />
-
- <heroicons-outline:chevron-right class="shrink-0 text-control-light" />
-
- <NPerformantEllipsis class="flex-1">
- {{ db.databaseName }}
- </NPerformantEllipsis>
- </div>
-</template>
-
-<script setup lang="ts">
-import { NPerformantEllipsis } from "naive-ui";
-import { computed } from "vue";
-import { InstanceV1Name } from "@/components/v2";
-import { useCurrentProjectV1 } from "@/store";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask } from "@/utils";
-
-const props = defineProps<{
- task: Task;
-}>();
-
-const { project } = useCurrentProjectV1();
-
-const db = computed(() => {
- return databaseForTask(project.value, props.task);
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue b/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
deleted file mode 100644
index c1b23b5b66..0000000000
--- a/frontend/src/components/IssueV1/components/Panel/TaskRolloutActionPanel.vue
+++ /dev/null
@@ -1,674 +0,0 @@
-<template>
- <CommonDrawer
- :show="action !== undefined"
- :title="title"
- :loading="state.loading"
- @show="resetState"
- @close="$emit('close')"
- >
- <template #default>
- <div
- v-if="action"
- class="flex flex-col gap-y-4 h-full overflow-y-hidden px-1"
- >
- <!-- Error Alert -->
- <NAlert
- v-if="validationErrors.length > 0"
- type="error"
- :title="$t('rollout.task-execution-errors')"
- >
- <ul class="list-disc list-inside flex flex-col gap-y-1">
- <li
- v-for="(error, index) in validationErrors"
- :key="index"
- class="text-sm"
- >
- {{ error }}
- </li>
- </ul>
- </NAlert>
-
- <!-- Warning Alert -->
- <NAlert
- v-if="validationWarnings.length > 0"
- type="warning"
- :title="$t('rollout.task-execution-notices')"
- >
- <ul class="list-disc list-inside flex flex-col gap-y-1">
- <li
- v-for="(warning, index) in validationWarnings"
- :key="index"
- class="text-sm"
- >
- {{ warning }}
- </li>
- </ul>
- </NAlert>
-
- <template v-if="stage">
- <div
- class="flex flex-row gap-x-2 shrink-0 overflow-y-hidden justify-start items-center"
- >
- <label class="font-medium text-control">
- {{ $t("common.stage") }}
- </label>
- <EnvironmentV1Name
- :environment="
- environmentStore.getEnvironmentByName(stage.environment)
- "
- :link="false"
- />
- </div>
- </template>
- <div
- class="flex flex-col gap-y-1 shrink overflow-y-hidden justify-start"
- >
- <label class="font-medium text-control">
- {{ $t("common.task", filteredTasks.length) }}
- <span class="font-mono opacity-80" v-if="filteredTasks.length > 1"
- >({{ filteredTasks.length }})</span
- >
- </label>
- <div class="flex-1 overflow-y-auto">
- <NScrollbar class="max-h-64">
- <ul class="text-sm flex flex-col gap-y-2">
- <li
- v-for="task in filteredTasks"
- :key="task.name"
- class="flex items-center"
- >
- <NTag
- v-if="semanticTaskType(task.type)"
- class="mr-2"
- size="small"
- >
- <span class="inline-block text-center">
- {{ semanticTaskType(task.type) }}
- </span>
- </NTag>
- <RolloutTaskDatabaseName :task="task" />
- </li>
- </ul>
- </NScrollbar>
- </div>
- </div>
-
- <PlanCheckRunBar
- v-if="
- (action === 'ROLLOUT' ||
- action === 'RETRY' ||
- action === 'RESTART') &&
- planCheckRunList.length > 0
- "
- class="shrink-0 flex-col gap-y-1"
- label-class="text-base!"
- :allow-run-checks="false"
- :plan-name="issue.plan"
- :plan-check-run-list="planCheckRunList"
- :database="database"
- />
-
- <!-- Only show comment/reason field for SKIP action -->
- <div v-if="action === 'SKIP'" class="flex flex-col gap-y-1 shrink-0">
- <p class="font-medium text-control">
- {{ $t("common.comment") }}
- </p>
- <NInput
- v-model:value="comment"
- type="textarea"
- :placeholder="$t('issue.leave-a-comment')"
- :autosize="{
- minRows: 3,
- maxRows: 10,
- }"
- />
- </div>
-
- <div
- v-if="showScheduledTimePicker"
- class="flex flex-col gap-y-3 shrink-0"
- >
- <div class="flex items-center">
- <NCheckbox
- :checked="runTimeInMS === undefined"
- @update:checked="
- (checked) =>
- (runTimeInMS = checked
- ? undefined
- : Date.now() + DEFAULT_RUN_DELAY_MS)
- "
- >
- {{ $t("task.run-immediately.self") }}
- </NCheckbox>
- </div>
- <div v-if="runTimeInMS !== undefined" class="flex flex-col gap-y-1">
- <p class="font-medium text-control">
- {{ $t("task.scheduled-time", filteredTasks.length) }}
- </p>
- <NDatePicker
- v-model:value="runTimeInMS"
- type="datetime"
- :placeholder="$t('task.select-scheduled-time')"
- :is-date-disabled="
- (date: number) => date < dayjs().startOf('day').valueOf()
- "
- format="yyyy-MM-dd HH:mm:ss"
- clearable
- />
- </div>
- </div>
- </div>
- </template>
- <template #footer>
- <div
- v-if="action"
- class="w-full flex flex-row justify-between items-center gap-x-2"
- >
- <div>
- <NCheckbox
- v-if="showPerformActionAnyway"
- v-model:checked="performActionAnyway"
- >
- {{
- $t("issue.action-anyway", {
- action: taskRolloutActionDialogButtonName(action, taskList),
- })
- }}
- </NCheckbox>
- </div>
-
- <div class="flex justify-end gap-x-3">
- <NButton @click="$emit('close')">
- {{ $t("common.cancel") }}
- </NButton>
-
- <NTooltip :disabled="confirmErrors.length === 0" placement="top">
- <template #trigger>
- <NButton
- :disabled="confirmErrors.length > 0"
- v-bind="taskRolloutActionButtonProps(action)"
- @click="handleConfirm(action!)"
- >
- {{ taskRolloutActionDialogButtonName(action, taskList) }}
- </NButton>
- </template>
- <template #default>
- <ErrorList :errors="confirmErrors" />
- </template>
- </NTooltip>
- </div>
- </div>
- </template>
- </CommonDrawer>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { TimestampSchema } from "@bufbuild/protobuf/wkt";
-import dayjs from "dayjs";
-import { head, uniqBy } from "lodash-es";
-import {
- NAlert,
- NButton,
- NCheckbox,
- NDatePicker,
- NInput,
- NScrollbar,
- NTag,
- NTooltip,
-} from "naive-ui";
-import { computed, reactive, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import type { TaskRolloutAction } from "@/components/IssueV1/logic";
-import {
- semanticTaskType,
- stageForTask,
- taskRolloutActionButtonProps,
- taskRolloutActionDialogButtonName,
- taskRolloutActionDisplayName,
- taskRunListForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
-import PlanCheckRunBar from "@/components/PlanCheckRun/PlanCheckRunBar.vue";
-import { EnvironmentV1Name } from "@/components/v2";
-import { rolloutServiceClientConnect } from "@/connect";
-import {
- pushNotification,
- useCurrentProjectV1,
- useEnvironmentV1Store,
-} from "@/store";
-import { Issue_Approver_Status } from "@/types/proto-es/v1/issue_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- BatchCancelTaskRunsRequestSchema,
- BatchRunTasksRequestSchema,
- BatchSkipTasksRequestSchema,
- Task_Status,
- TaskRun_Status,
-} from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask } from "@/utils";
-import { ErrorList } from "../common";
-import CommonDrawer from "./CommonDrawer.vue";
-import RolloutTaskDatabaseName from "./RolloutTaskDatabaseName.vue";
-
-// Default delay for running tasks if not scheduled immediately.
-const DEFAULT_RUN_DELAY_MS = 60000;
-
-type LocalState = {
- loading: boolean;
-};
-
-const props = defineProps<{
- action?: TaskRolloutAction;
- taskList: Task[];
-}>();
-const emit = defineEmits<{
- (event: "close"): void;
-}>();
-
-const { t } = useI18n();
-const state = reactive<LocalState>({
- loading: false,
-});
-const { project } = useCurrentProjectV1();
-const { issue, selectedTask, events, getPlanCheckRunsForTask } =
- useIssueContext();
-const environmentStore = useEnvironmentV1Store();
-const comment = ref("");
-const runTimeInMS = ref<number | undefined>(undefined);
-const performActionAnyway = ref(false);
-
-// Check issue approval status
-const issueApprovalStatus = computed(() => {
- if (!issue?.value || !props.action) {
- return { isApproved: true, hasIssue: false };
- }
-
- const currentIssue = issue.value;
- const approvalTemplate = currentIssue.approvalTemplate;
-
- // Check if issue has approval template
- if (!approvalTemplate || (approvalTemplate.flow?.roles || []).length === 0) {
- return { isApproved: true, hasIssue: true };
- }
-
- // Simple check based on all approvers being approved (no rejections)
- const hasRejections = currentIssue.approvers.some(
- (app) => app.status === Issue_Approver_Status.REJECTED
- );
-
- if (hasRejections) {
- return { isApproved: false, hasIssue: true, status: "rejected" };
- }
-
- // Check if all required approvals are present
- const approvedCount = currentIssue.approvers.filter(
- (app) => app.status === Issue_Approver_Status.APPROVED
- ).length;
-
- const requiredApprovalsCount = approvalTemplate.flow?.roles?.length || 0;
-
- const isApproved = approvedCount >= requiredApprovalsCount;
-
- return {
- isApproved,
- hasIssue: true,
- status: isApproved ? "approved" : "pending",
- };
-});
-
-const title = computed(() => {
- if (!props.action) return "";
-
- const action = taskRolloutActionDisplayName(props.action, selectedTask.value);
- if (filteredTasks.value.length > 1) {
- return t("task.action-all-tasks-in-current-stage", { action });
- }
- return action;
-});
-
-const database = computed(() =>
- databaseForTask(project.value, selectedTask.value)
-);
-
-const stage = computed(() => {
- const firstTask = head(props.taskList);
- if (!firstTask) return undefined;
- return stageForTask(issue.value, firstTask);
-});
-
-const showScheduledTimePicker = computed(() => {
- return (
- props.action === "ROLLOUT" ||
- props.action === "RETRY" ||
- props.action === "RESTART"
- );
-});
-
-const filteredTasks = computed(() => {
- let filteredTaskList = props.taskList;
- if (props.action === "RETRY") {
- // For RETRY action, we only want to retry tasks that are not done or skipped.
- filteredTaskList = filteredTaskList.filter(
- (task) => task.status === Task_Status.FAILED
- );
- } else if (props.action === "RESTART") {
- // For RESTART action, we only want to restart tasks that are running or pending.
- filteredTaskList = filteredTaskList.filter(
- (task) => task.status === Task_Status.CANCELED
- );
- } else if (props.action === "CANCEL") {
- // For CANCEL action, we only want to cancel tasks that are running or pending.
- filteredTaskList = filteredTaskList.filter((task) =>
- [Task_Status.RUNNING, Task_Status.PENDING].includes(task.status)
- );
- } else if (props.action === "SKIP") {
- // For SKIP action, we only want to skip tasks that are not done or skipped.
- filteredTaskList = filteredTaskList.filter(
- (task) => ![Task_Status.DONE, Task_Status.SKIPPED].includes(task.status)
- );
- } else if (props.action === "ROLLOUT") {
- filteredTaskList = filteredTaskList.filter(
- (task) =>
- ![
- Task_Status.DONE,
- Task_Status.SKIPPED,
- TaskRun_Status.RUNNING,
- ].includes(task.status)
- );
- }
- return filteredTaskList;
-});
-
-const hasPreviousUnrolledStages = computed(() => {
- if (!stage.value) return false;
- const stages = issue.value.rolloutEntity?.stages;
- if (!stages) return false;
- const stageIndex = stages.findIndex((s) => s.name === stage.value?.name);
- return stages.slice(0, stageIndex).some((s) =>
- s.tasks.some(
- // Done or skipped tasks are considered as rolled.
- // Otherwise, it's considered as unrolled.
- (t) => ![Task_Status.DONE, Task_Status.SKIPPED].includes(t.status)
- )
- );
-});
-
-const showPerformActionAnyway = computed(() => {
- // Only show bypass option when there are warnings but NO errors
- return (
- validationWarnings.value.length > 0 && validationErrors.value.length === 0
- );
-});
-
-const planCheckRunList = computed(() => {
- const list = filteredTasks.value.flatMap(getPlanCheckRunsForTask);
- return uniqBy(list, (checkRun) => checkRun.name);
-});
-
-// Plan check error validation based on project settings
-const planCheckError = computed(() => {
- if (
- !(
- props.action === "ROLLOUT" ||
- props.action === "RETRY" ||
- props.action === "RESTART"
- )
- ) {
- return undefined;
- }
-
- const summary = planCheckRunSummaryForCheckRunList(planCheckRunList.value);
-
- // If no enforcement is specified, default to no validation
- if (!project.value.requirePlanCheckNoError) {
- return undefined;
- }
-
- if (summary.runningCount > 0) {
- return t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-are-still-running"
- );
- }
-
- if (summary.errorCount > 0) {
- return t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"
- );
- }
-
- return undefined;
-});
-
-// Plan check warning validation for non-blocking plan check results
-const planCheckWarning = computed(() => {
- if (
- !(
- props.action === "ROLLOUT" ||
- props.action === "RETRY" ||
- props.action === "RESTART"
- )
- ) {
- return undefined;
- }
-
- const summary = planCheckRunSummaryForCheckRunList(planCheckRunList.value);
- if (
- summary.successCount +
- summary.warnCount +
- summary.errorCount +
- summary.runningCount ===
- 0
- ) {
- return undefined;
- }
-
- // If enforcement is disabled, show any plan check issues as warnings
- if (!project.value.requirePlanCheckNoError) {
- if (summary.runningCount > 0) {
- return t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-are-still-running"
- );
- }
- if (summary.errorCount > 0 || summary.warnCount > 0) {
- return t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"
- );
- }
- }
-
- return undefined;
-});
-
-// Collect blocking validation errors
-const validationErrors = computed(() => {
- if (!props.action) return [];
-
- const errors: string[] = [];
-
- // Permission errors - always block rollout
- if (filteredTasks.value.length > 0) {
- // Check basic task permissions here if needed
- }
-
- // No active tasks to cancel - blocking error
- if (
- props.action === "CANCEL" &&
- filteredTasks.value.length > 0 &&
- !filteredTasks.value.some(
- (task) =>
- task.status === Task_Status.PENDING ||
- task.status === Task_Status.RUNNING
- )
- ) {
- errors.push(t("rollout.no-active-task-to-cancel"));
- }
-
- if (
- props.action === "ROLLOUT" ||
- props.action === "RETRY" ||
- props.action === "RESTART"
- ) {
- // Issue approval errors (only if policy requires it) - HARD BLOCK
- const requiresIssueApproval = project.value.requireIssueApproval;
-
- if (
- requiresIssueApproval &&
- issueApprovalStatus.value.hasIssue &&
- !issueApprovalStatus.value.isApproved
- ) {
- const isRejected = issueApprovalStatus.value.status === "rejected";
- errors.push(
- isRejected
- ? t("issue.approval.rejected-error")
- : t("issue.approval.pending-error")
- );
- }
-
- // Plan check errors (based on rollout policy) - HARD BLOCK
- if (planCheckError.value) {
- errors.push(planCheckError.value);
- }
- }
-
- return errors;
-});
-
-// Collect validation warnings that don't block rollout
-const validationWarnings = computed(() => {
- if (!props.action) return [];
-
- const warnings: string[] = [];
-
- // Basic validation warnings
- if (filteredTasks.value.length === 0) {
- warnings.push(t("common.no-data"));
- }
-
- if (
- props.action === "ROLLOUT" ||
- props.action === "RETRY" ||
- props.action === "RESTART"
- ) {
- // Validate scheduled time if not running immediately
- if (runTimeInMS.value !== undefined && runTimeInMS.value <= Date.now()) {
- warnings.push(t("task.error.scheduled-time-must-be-in-the-future"));
- }
-
- // Plan check warnings (non-blocking plan check results)
- if (planCheckWarning.value) {
- warnings.push(planCheckWarning.value);
- }
-
- // Issue approval warnings (when not required by policy but issue is not approved)
- const requiresIssueApproval = project.value.requireIssueApproval;
-
- if (
- !requiresIssueApproval &&
- issueApprovalStatus.value.hasIssue &&
- !issueApprovalStatus.value.isApproved
- ) {
- const isRejected = issueApprovalStatus.value.status === "rejected";
- warnings.push(
- isRejected
- ? t("issue.approval.rejected-error")
- : t("issue.approval.pending-error")
- );
- }
-
- // Previous stages incomplete warning
- if (hasPreviousUnrolledStages.value) {
- warnings.push(
- t("issue.status-transition.warning.some-previous-stages-are-not-done")
- );
- }
- }
-
- return warnings;
-});
-
-const confirmErrors = computed(() => {
- const errors: string[] = [];
-
- // Always block on validation errors
- if (validationErrors.value.length > 0) {
- errors.push(...validationErrors.value);
- }
-
- // Block on warnings unless bypassed
- if (!performActionAnyway.value && validationWarnings.value.length > 0) {
- errors.push(...validationWarnings.value);
- }
-
- return errors;
-});
-
-const handleConfirm = async (action: TaskRolloutAction) => {
- state.loading = true;
- try {
- const stage = stageForTask(issue.value, props.taskList[0]);
- if (!stage) return;
- if (action === "ROLLOUT" || action === "RETRY" || action === "RESTART") {
- // Prepare the request parameters
- const request = create(BatchRunTasksRequestSchema, {
- parent: stage.name,
- tasks: filteredTasks.value.map((task) => task.name),
- });
- if (runTimeInMS.value !== undefined) {
- // Convert timestamp to protobuf Timestamp format
- const runTimeSeconds = Math.floor(runTimeInMS.value / 1000);
- const runTimeNanos = (runTimeInMS.value % 1000) * 1000000;
- request.runTime = create(TimestampSchema, {
- seconds: BigInt(runTimeSeconds),
- nanos: runTimeNanos,
- });
- }
- await rolloutServiceClientConnect.batchRunTasks(request);
- } else if (action === "SKIP") {
- const request = create(BatchSkipTasksRequestSchema, {
- parent: stage.name,
- tasks: filteredTasks.value.map((task) => task.name),
- reason: comment.value,
- });
- await rolloutServiceClientConnect.batchSkipTasks(request);
- } else if (action === "CANCEL") {
- const taskRunListToCancel = filteredTasks.value
- .map((task) => {
- const taskRunList = taskRunListForTask(issue.value, task);
- const currentRunningTaskRun = taskRunList.find(
- (taskRun) =>
- taskRun.status === TaskRun_Status.RUNNING ||
- taskRun.status === TaskRun_Status.PENDING
- );
- return currentRunningTaskRun;
- })
- .filter((taskRun) => taskRun !== undefined);
- if (taskRunListToCancel.length > 0) {
- const request = create(BatchCancelTaskRunsRequestSchema, {
- parent: `${stage.name}/tasks/-`,
- taskRuns: taskRunListToCancel.map((taskRun) => taskRun.name),
- });
- await rolloutServiceClientConnect.batchCancelTaskRuns(request);
- }
- }
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: title.value,
- });
-
- // notify the issue logic to update issue status
- events.emit("status-changed", { eager: true });
- } finally {
- state.loading = false;
- emit("close");
- }
-};
-
-const resetState = () => {
- comment.value = "";
- runTimeInMS.value = undefined;
- performActionAnyway.value = false;
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/Panel/index.ts b/frontend/src/components/IssueV1/components/Panel/index.ts
index 278a6b667c..ecce7079af 100644
--- a/frontend/src/components/IssueV1/components/Panel/index.ts
+++ b/frontend/src/components/IssueV1/components/Panel/index.ts
@@ -1,11 +1 @@
-import BatchIssueStatusActionPanel from "./BatchIssueStatusActionPanel.vue";
-import IssueReviewActionPanel from "./IssueReviewActionPanel.vue";
-import IssueStatusActionPanel from "./IssueStatusActionPanel.vue";
-import TaskRolloutActionPanel from "./TaskRolloutActionPanel.vue";
-
-export {
- IssueStatusActionPanel,
- IssueReviewActionPanel,
- TaskRolloutActionPanel,
- BatchIssueStatusActionPanel,
-};
+export { default as BatchIssueStatusActionPanel } from "./BatchIssueStatusActionPanel.vue";
diff --git a/frontend/src/components/IssueV1/logic/action/issue.ts b/frontend/src/components/IssueV1/components/Panel/issueStatusAction.ts
similarity index 62%
rename from frontend/src/components/IssueV1/logic/action/issue.ts
rename to frontend/src/components/IssueV1/components/Panel/issueStatusAction.ts
index 74faffde3e..91eff23fd4 100644
--- a/frontend/src/components/IssueV1/logic/action/issue.ts
+++ b/frontend/src/components/IssueV1/components/Panel/issueStatusAction.ts
@@ -1,16 +1,8 @@
import type { ButtonProps } from "naive-ui";
import { t } from "@/plugins/i18n";
-import { extractUserId, useCurrentUserV1 } from "@/store";
import type { ComposedIssue } from "@/types";
import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- flattenTaskV1List,
- hasProjectPermissionV2,
- isDatabaseDataExportIssue,
- isGrantRequestIssue,
-} from "@/utils";
-import { projectOfIssue } from "..";
+import { isDatabaseDataExportIssue, isGrantRequestIssue } from "@/utils";
export type IssueStatusAction = "CLOSE" | "REOPEN";
@@ -85,26 +77,3 @@ export const issueStatusActionButtonProps = (
};
}
};
-
-export const allowUserToApplyIssueStatusAction = (
- issue: ComposedIssue,
- action: IssueStatusAction
-): [boolean /** ok */, string /** reason */] => {
- const user = useCurrentUserV1();
- const project = projectOfIssue(issue);
- // User does not have permission to update the issue and is not the creator of the issue.
- if (
- !hasProjectPermissionV2(project, "bb.issues.update") &&
- extractUserId(issue.creator) !== user.value.email
- ) {
- return [false, t("issue.error.you-don-have-privilege-to-edit-this-issue")];
- }
- if (action === "CLOSE") {
- const tasks = flattenTaskV1List(issue.rolloutEntity);
- // The issue cannot be closed if some tasks are running.
- if (tasks.some((task) => task.status === Task_Status.RUNNING)) {
- return [false, t("issue.error.cannot-close-issue-with-running-tasks")];
- }
- }
- return [true, ""];
-};
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue b/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue
deleted file mode 100644
index 9fd8b23eaf..0000000000
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/PlanCheckSection.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-<template>
- <PlanCheckRunBar
- v-if="show"
- class="px-4 py-2"
- :allow-run-checks="allowRunChecks"
- :database="database"
- :plan-name="issue.plan"
- :plan-check-run-list="planCheckRunList"
- />
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import {
- planSpecHasPlanChecks,
- specForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import PlanCheckRunBar from "@/components/PlanCheckRun/PlanCheckRunBar.vue";
-import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
-import {
- databaseForTask,
- hasProjectPermissionV2,
- isValidTaskName,
-} from "@/utils";
-
-const currentUser = useCurrentUserV1();
-const { issue, selectedTask, getPlanCheckRunsForTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-
-const show = computed(() => {
- const spec = specForTask(issue.value.planEntity, selectedTask.value);
- if (!spec) {
- return false;
- }
- return planSpecHasPlanChecks(spec);
-});
-
-const database = computed(() =>
- databaseForTask(project.value, selectedTask.value)
-);
-
-const allowRunChecks = computed(() => {
- // Allowing below users to run plan checks:
- // - the creator of the issue
- // - ones who have bb.planCheckRuns.run permission in the project
- const me = currentUser.value;
- if (extractUserId(issue.value.creator) === me.email) {
- return true;
- }
- if (hasProjectPermissionV2(project.value, "bb.planCheckRuns.run")) {
- return true;
- }
- return false;
-});
-
-const planCheckRunList = computed(() => {
- // If a task is selected, show plan checks for the task.
- if (selectedTask.value && isValidTaskName(selectedTask.value.name)) {
- return getPlanCheckRunsForTask(selectedTask.value);
- }
- // Otherwise, show plan checks for the issue.
- return issue.value.planCheckRunList;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/PlanCheckSection/index.ts b/frontend/src/components/IssueV1/components/PlanCheckSection/index.ts
deleted file mode 100644
index b84a918147..0000000000
--- a/frontend/src/components/IssueV1/components/PlanCheckSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import PlanCheckSection from "./PlanCheckSection.vue";
-
-export default PlanCheckSection;
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
deleted file mode 100644
index 89f6c7d657..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue
+++ /dev/null
@@ -1,110 +0,0 @@
-<template>
- <TaskRollbackSection v-if="shouldShowTaskRollbackSection" />
- <PreBackupSection v-else-if="shouldShowPreBackupSection" />
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import {
- latestTaskRunForTask,
- specForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { PreBackupSection } from "@/components/Plan/components/Configuration";
-import { providePreBackupSettingContext } from "@/components/Plan/components/Configuration/PreBackupSection/context";
-import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
-import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, hasProjectPermissionV2 } from "@/utils";
-import { instanceV1SupportsPriorBackupRollback } from "@/utils/v1/instance";
-import TaskRollbackSection from "./TaskRollbackSection.vue";
-
-const { isCreating, issue, selectedTask, events } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const plan = computed(() => issue.value.planEntity as Plan);
-const currentUser = useCurrentUserV1();
-
-const {
- shouldShow: shouldShowPreBackupSection,
- enabled: preBackupEnabled,
- events: preBackupEvents,
-} = providePreBackupSettingContext({
- isCreating,
- project,
- plan,
- selectedSpec: computed(() =>
- specForTask(issue.value.planEntity as Plan, selectedTask.value)
- ),
- allowChange: computed(() => {
- // Allow changes when creating
- if (isCreating.value) {
- return true;
- }
-
- // Disallow changes if the plan has started rollout.
- if (plan.value.hasRollout) {
- return false;
- }
-
- // If issue is not open, disallow
- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {
- return false;
- }
-
- // Allowed to the plan/issue creator.
- if (currentUser.value.email === extractUserId(plan.value.creator)) {
- return true;
- }
-
- return hasProjectPermissionV2(project.value, "bb.plans.update");
- }),
-});
-
-const database = computed(() =>
- databaseForTask(project.value, selectedTask.value)
-);
-
-const latestTaskRun = computed(() =>
- latestTaskRunForTask(issue.value, selectedTask.value)
-);
-
-const shouldShowTaskRollbackSection = computed((): boolean => {
- if (!shouldShowPreBackupSection.value) {
- return false;
- }
- if (!preBackupEnabled.value) {
- return false;
- }
- if (
- !instanceV1SupportsPriorBackupRollback(
- database.value.instanceResource.engine
- )
- ) {
- return false;
- }
- if (!latestTaskRun.value) {
- return false;
- }
- if (latestTaskRun.value.status !== TaskRun_Status.DONE) {
- return false;
- }
- if (!latestTaskRun.value.hasPriorBackup) {
- return false;
- }
- return true;
-});
-
-preBackupEvents.on("update", () => {
- events.emit("status-changed", {
- eager: true,
- });
-});
-
-defineExpose({
- shouldShow: computed(
- () =>
- shouldShowTaskRollbackSection.value || shouldShowPreBackupSection.value
- ),
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackButton.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackButton.vue
deleted file mode 100644
index 9b1e2dad02..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackButton.vue
+++ /dev/null
@@ -1,116 +0,0 @@
-<template>
- <NButton size="small" :loading="isLoading" @click="createRestoreIssue">
- <template #icon>
- <Undo2Icon class="w-4 h-auto" />
- </template>
- {{ $t("common.rollback") }}
- </NButton>
-</template>
-
-<script lang="ts" setup>
-import { create } from "@bufbuild/protobuf";
-import { Undo2Icon } from "lucide-vue-next";
-import { NButton } from "naive-ui";
-import { v4 as uuidv4 } from "uuid";
-import { computed, ref } from "vue";
-import type { LocationQueryRaw } from "vue-router";
-import { useRouter } from "vue-router";
-import {
- latestTaskRunForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import { rolloutServiceClientConnect } from "@/connect";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
-import {
- pushNotification,
- useCurrentProjectV1,
- useSheetV1Store,
- useStorageStore,
-} from "@/store";
-import { PreviewTaskRunRollbackRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- extractIssueUID,
- extractProjectResourceName,
- hasProjectPermissionV2,
- sheetNameOfTaskV1,
-} from "@/utils";
-
-const router = useRouter();
-const { issue, selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-
-const isLoading = ref(false);
-
-const allowRollback = computed((): boolean => {
- return hasProjectPermissionV2(project.value, "bb.issues.create");
-});
-
-const latestTaskRun = computed(() =>
- latestTaskRunForTask(issue.value, selectedTask.value)
-);
-
-const createRestoreIssue = async () => {
- if (!allowRollback.value) {
- return;
- }
- if (!latestTaskRun.value?.hasPriorBackup) {
- return;
- }
-
- const sheetName = sheetNameOfTaskV1(selectedTask.value);
- const sheet = useSheetV1Store().getSheetByName(sheetName);
- if (!sheet) {
- pushNotification({
- module: "bytebase",
- style: "CRITICAL",
- title: `Sheet ${sheetName} not found`,
- });
- return;
- }
-
- isLoading.value = true;
- const request = create(PreviewTaskRunRollbackRequestSchema, {
- name: latestTaskRun.value.name,
- });
- const response =
- await rolloutServiceClientConnect.previewTaskRunRollback(request);
- const { statement } = response;
- isLoading.value = false;
-
- const { enabledNewLayout } = useIssueLayoutVersion();
- const sqlStorageKey = `bb.issues.sql.${uuidv4()}`;
- useStorageStore().put(sqlStorageKey, statement);
- const query: LocationQueryRaw = {
- template: "bb.issue.database.update",
- name: `Rollback ${selectedTask.value.target} in issue#${extractIssueUID(issue.value.name)}`,
- databaseList: selectedTask.value.target,
- description: `This issue is created to rollback the data of ${selectedTask.value.target} in issue #${extractIssueUID(issue.value.name)}`,
- sqlStorageKey,
- };
-
- if (enabledNewLayout.value) {
- router.push({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.value.name),
- planId: "create",
- specId: "placeholder",
- },
- query,
- });
- } else {
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(issue.value.name),
- issueSlug: "create",
- },
- query,
- });
- }
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackSection.vue
deleted file mode 100644
index e6a331b463..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/TaskRollbackSection.vue
+++ /dev/null
@@ -1,31 +0,0 @@
-<template>
- <div
- class="w-full flex items-center justify-between gap-x-2 gap-y-1 flex-wrap whitespace-nowrap"
- >
- <NTooltip>
- <template #trigger>
- <div class="textlabel flex items-center">
- <span>{{ $t("task.prior-backup") }}</span>
- <span
- class="ml-1 px-1 py-0.5 rounded-lg text-xs bg-green-100 text-green-800"
- >
- {{ $t("common.on") }}
- </span>
- </div>
- </template>
- <template #default>
- <div class="max-w-[20rem]">
- {{ $t("task.prior-backup-tips") }}
- </div>
- </template>
- </NTooltip>
- <div class="flex items-center">
- <TaskRollbackButton />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NTooltip } from "naive-ui";
-import TaskRollbackButton from "./TaskRollbackButton.vue";
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/index.ts b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/index.ts
deleted file mode 100644
index 9ded4d6044..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import PreBackupSection from "./PreBackupSection.vue";
-
-export default PreBackupSection;
diff --git a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
deleted file mode 100644
index f17cbfc8ec..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue
+++ /dev/null
@@ -1,47 +0,0 @@
-<template>
- <div
- v-if="isValidReleaseName(release.name) && ready"
- class="w-full text-sm text-control-light flex gap-x-2 items-center"
- >
- <PackageIcon class="w-5 h-auto shrink-0" />
- <a
- :href="`/${release.name}`"
- target="_blank"
- class="normal-link truncate"
- >
- {{ releaseId }}
- </a>
- <NTag v-if="release.state === State.DELETED" size="small" type="default">
- {{ $t("common.abandoned") }}
- </NTag>
- </div>
-</template>
-
-<script setup lang="ts">
-import { PackageIcon } from "lucide-vue-next";
-import { NTag } from "naive-ui";
-import { computed } from "vue";
-import { specForTask, useIssueContext } from "@/components/IssueV1";
-import { useReleaseByName } from "@/store";
-import { isValidReleaseName } from "@/types";
-import { State } from "@/types/proto-es/v1/common_pb";
-
-const { issue, selectedTask } = useIssueContext();
-
-const releaseName = computed(() => {
- const spec = specForTask(issue.value.planEntity, selectedTask.value);
- if (spec?.config?.case === "changeDatabaseConfig") {
- return spec.config.value.release;
- }
- return "";
-});
-
-const { release, ready } = useReleaseByName(
- computed(() => releaseName.value || "")
-);
-
-const releaseId = computed(() => {
- const parts = release.value.name.split("/");
- return parts[parts.length - 1] || release.value.name;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue b/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
deleted file mode 100644
index 75acd4dfec..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/Sidebar.vue
+++ /dev/null
@@ -1,179 +0,0 @@
-<template>
- <div class="flex flex-col gap-y-4 py-4 px-4">
- <ReleaseInfo />
- <TaskCheckSummarySection />
-
- <!-- Review section -->
- <ApprovalFlowSection
- v-if="!isCreating"
- :issue="issue"
- @issue-updated="
- events.emit('status-changed', {
- eager: true,
- })
- "
- />
- <div v-else class="flex flex-col gap-y-1">
- <div
- class="text-sm font-semibold text-gray-700 flex items-center gap-x-1"
- >
- {{ $t("issue.approval-flow.self") }}
- <FeatureBadge :feature="PlanFeature.FEATURE_APPROVAL_WORKFLOW" />
- </div>
- <div class="text-control-placeholder text-xs">
- {{ $t("issue.approval-flow.pre-issue-created-tips") }}
- </div>
- </div>
-
- <IssueLabels
- :project="project"
- :value="issue.labels"
- :disabled="!allowChange"
- @update:value="onIssueLabelsUpdate"
- />
-
- <div
- v-show="
- selectedSpec && (shouldShowPreBackupSection || shouldShowGhostSection)
- "
- class="flex flex-col gap-y-2"
- >
- <div class="border-t border-gray-200 -mx-4" />
- <NTooltip v-if="selectedSpec" :showArrow="false">
- <template #trigger>
- <p class="text-sm font-medium text-gray-600">
- {{ $t("plan.options.self") }}
- <span class="opacity-80">
- ({{
- targetsForSpec(selectedSpec).length === flattenSpecCount
- ? $t("plan.options.applies-to-all-tasks")
- : $t("plan.options.applies-to-some-tasks", {
- count: targetsForSpec(selectedSpec).length,
- total: flattenSpecCount,
- })
- }})
- </span>
- </p>
- </template>
- {{ $t("plan.options.split-into-multiple-issues-tip") }}
- </NTooltip>
- <PreBackupSection ref="preBackupSectionRef" />
- <GhostSection v-if="shouldShowGhostSection" />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { create } from "@bufbuild/protobuf";
-import { NTooltip } from "naive-ui";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import { FeatureBadge } from "@/components/FeatureGuard";
-import { targetsForSpec } from "@/components/Plan";
-import { GhostSection } from "@/components/Plan/components/Configuration";
-import { provideGhostSettingContext } from "@/components/Plan/components/Configuration/GhostSection/context";
-import { ApprovalFlowSection } from "@/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection";
-import { issueServiceClientConnect } from "@/connect";
-import {
- extractUserId,
- pushNotification,
- useCurrentProjectV1,
- useCurrentUserV1,
-} from "@/store";
-import {
- IssueSchema,
- IssueStatus,
- UpdateIssueRequestSchema,
-} from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
-import { hasProjectPermissionV2 } from "@/utils";
-import { specForTask, useIssueContext } from "../../logic";
-import IssueLabels from "./IssueLabels.vue";
-import PreBackupSection from "./PreBackupSection";
-import ReleaseInfo from "./ReleaseInfo.vue";
-import TaskCheckSummarySection from "./TaskCheckSummarySection";
-
-const { t } = useI18n();
-const { isCreating, selectedTask, issue, events, allowChange } =
- useIssueContext();
-const { project } = useCurrentProjectV1();
-const preBackupSectionRef = ref<InstanceType<typeof PreBackupSection>>();
-const currentUser = useCurrentUserV1();
-
-const selectedSpec = computed(() =>
- specForTask(issue.value.planEntity as Plan, selectedTask.value)
-);
-
-const flattenSpecCount = computed(
- () =>
- issue.value.planEntity?.specs.reduce(
- (acc, spec) => acc + targetsForSpec(spec).length,
- 0
- ) || 0
-);
-
-const plan = computed(() => issue.value.planEntity as Plan);
-
-const { shouldShow: shouldShowGhostSection, events: ghostEvents } =
- provideGhostSettingContext({
- isCreating,
- plan,
- selectedSpec,
- allowChange: computed(() => {
- // Allow changes when creating
- if (isCreating.value) {
- return true;
- }
-
- // Disallow changes if the plan has started rollout.
- if (plan.value.hasRollout) {
- return false;
- }
-
- // If issue is not open, disallow
- if (issue?.value && issue.value.status !== IssueStatus.OPEN) {
- return false;
- }
-
- // Allowed to the plan/issue creator.
- if (currentUser.value.email === extractUserId(plan.value.creator)) {
- return true;
- }
-
- return hasProjectPermissionV2(project.value, "bb.plans.update");
- }),
- });
-
-const shouldShowPreBackupSection = computed(() => {
- return preBackupSectionRef.value?.shouldShow ?? false;
-});
-
-const onIssueLabelsUpdate = async (labels: string[]) => {
- if (isCreating.value) {
- issue.value.labels = labels;
- } else {
- const issuePatch = create(IssueSchema, {
- ...issue.value,
- labels,
- });
- const request = create(UpdateIssueRequestSchema, {
- issue: issuePatch,
- updateMask: { paths: ["labels"] },
- });
- const updated = await issueServiceClientConnect.updateIssue(request);
- Object.assign(issue.value, updated);
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- }
-};
-
-ghostEvents.on("update", () => {
- events.emit("status-changed", {
- eager: true,
- });
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue
deleted file mode 100644
index ede36c546b..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/AffectedRowsView.vue
+++ /dev/null
@@ -1,115 +0,0 @@
-<template>
- <NPopover v-if="shouldShow" trigger="hover" placement="bottom">
- <template #trigger>
- <NTag round>
- <span class="text-gray-400 text-sm mr-1">{{
- $t("task.check-type.affected-rows.self")
- }}</span>
- <span class="text-sm font-medium">
- {{ affectedRows }}
- </span>
- </NTag>
- </template>
- <div
- class="flex flex-col justify-start items-start w-72 max-h-128 overflow-auto"
- >
- <p class="text-sm text-gray-400">
- {{ $t("task.check-type.affected-rows.description") }}
- </p>
- <div class="w-full flex flex-col mt-1 gap-y-1">
- <div
- class="w-full flex flex-row justify-between items-center gap-1 group hover:opacity-90 cursor-pointer"
- v-for="item in affectedTasks"
- :key="item.task.name"
- @click="onClickTask(item.task)"
- >
- <span class="group-hover:underline truncate">
- {{ databaseForTask(projectOfIssue(issue), item.task).databaseName }}
- </span>
- <span
- class="shrink-0 opacity-80"
- >
- {{ item.count }}
- </span>
- </div>
- </div>
- </div>
- </NPopover>
-</template>
-
-<script setup lang="ts">
-import { NPopover, NTag } from "naive-ui";
-import { computed } from "vue";
-import { projectOfIssue, useIssueContext } from "@/components/IssueV1/logic";
-import { type PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, flattenTaskV1List } from "@/utils";
-
-const props = defineProps<{
- taskSummaryReportMap: Map<string, PlanCheckRun>;
-}>();
-
-const { issue, events } = useIssueContext();
-
-const tasks = computed(() => flattenTaskV1List(issue.value.rolloutEntity));
-
-const affectedTasks = computed(() => {
- const tempMap = new Map<string, { task: Task; count: bigint }>();
-
- for (const [taskName, planCheckRun] of props.taskSummaryReportMap.entries()) {
- if (
- planCheckRun.results.every(
- (result) =>
- result.report?.case !== "sqlSummaryReport" ||
- result.report.value.affectedRows === undefined
- )
- ) {
- continue;
- }
-
- const task = tasks.value.find((t) => t.name === taskName);
- if (!task) {
- continue;
- }
-
- const count = planCheckRun.results.reduce((acc, result) => {
- if (result.report?.case === "sqlSummaryReport") {
- return acc + (result.report.value.affectedRows || 0n);
- }
- return acc;
- }, 0n);
-
- tempMap.set(taskName, { task, count });
- }
- return Array.from(tempMap.values()).sort((a, b) => Number(b.count - a.count));
-});
-
-const summaryReportResults = computed(() =>
- Array.from(props.taskSummaryReportMap.values()).flatMap(
- (report) => report.results
- )
-);
-
-const affectedRows = computed(() =>
- summaryReportResults.value.reduce((acc, result) => {
- if (result.report?.case === "sqlSummaryReport") {
- return acc + (result.report.value.affectedRows || 0n);
- }
- return acc;
- }, 0n)
-);
-
-const shouldShow = computed(() =>
- summaryReportResults.value.some(
- (result) =>
- result.report?.case === "sqlSummaryReport" &&
- result.report.value.affectedRows !== undefined
- )
-);
-
-const onClickTask = (task: Task) => {
- events.emit("select-task", { task });
-};
-
-defineExpose({ shouldShow });
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue
deleted file mode 100644
index b6be67e343..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/FailedTasksView.vue
+++ /dev/null
@@ -1,79 +0,0 @@
-<template>
- <NPopover v-if="shouldShow" trigger="hover" placement="bottom">
- <template #trigger>
- <NTag round type="error">
- <span class="text-red-400 text-sm mr-1">{{ $t("common.errors") }}</span>
- <span class="text-sm font-medium">
- {{ failedTasks.length }}
- </span>
- </NTag>
- </template>
- <div
- class="flex flex-col justify-start items-start w-72 max-h-128 overflow-auto"
- >
- <div class="w-full flex flex-col mt-1 divide-y">
- <div
- class="w-full group hover:opacity-90 cursor-pointer py-2 first:pt-0"
- v-for="task in failedTasks"
- :key="task.name"
- @click="onClickTask(task)"
- >
- <p class="group-hover:underline truncate">
- {{ databaseForTask(projectOfIssue(issue), task).databaseName }}
- </p>
- <p class="text-xs leading-4 text-error line-clamp-2">
- {{ failedMessageOfTask(task.name) }}
- </p>
- </div>
- </div>
- </div>
- </NPopover>
-</template>
-
-<script setup lang="ts">
-import { NPopover, NTag } from "naive-ui";
-import { computed } from "vue";
-import { projectOfIssue, useIssueContext } from "@/components/IssueV1";
-import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { databaseForTask, flattenTaskV1List } from "@/utils";
-
-const props = defineProps<{
- taskSummaryReportMap: Map<string, PlanCheckRun>;
-}>();
-
-const { issue, events } = useIssueContext();
-
-const tasks = computed(() => flattenTaskV1List(issue.value.rolloutEntity));
-
-const failedTasks = computed(() => {
- const tempList: Task[] = [];
- props.taskSummaryReportMap.forEach((planCheckRun, taskId) => {
- for (const result of planCheckRun.results) {
- if (result.status === Advice_Level.ERROR) {
- tempList.push(tasks.value.find((task) => task.name === taskId) as Task);
- break;
- }
- }
- });
- return tempList;
-});
-
-const shouldShow = computed(() => failedTasks.value.length > 0);
-
-const failedMessageOfTask = (task: string) => {
- const taskSummaryReport = props.taskSummaryReportMap.get(task);
- if (!taskSummaryReport) return "";
- const failedResults = taskSummaryReport.results.filter(
- (result) => result.status === Advice_Level.ERROR
- );
- return failedResults.map((result) => result.content).join("\n");
-};
-
-const onClickTask = (task: Task) => {
- events.emit("select-task", { task });
-};
-
-defineExpose({ shouldShow });
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue
deleted file mode 100644
index 1e12a820ef..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/TaskCheckSummarySection.vue
+++ /dev/null
@@ -1,88 +0,0 @@
-<template>
- <div v-show="shouldShow" class="flex flex-col gap-y-2">
- <div class="flex items-center gap-x-1 textlabel">
- <span>{{ $t("common.summary") }}</span>
- </div>
- <div
- class="w-full flex flex-row justify-start items-center gap-1 flex-wrap"
- >
- <AffectedRowsView
- ref="affectedRowsViewRef"
- :task-summary-report-map="taskSummaryReportMap"
- />
- <FailedTasksView
- ref="failedTasksViewRef"
- :task-summary-report-map="taskSummaryReportMap"
- />
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { computed, ref } from "vue";
-import { useIssueContext } from "@/components/IssueV1";
-import {
- type PlanCheckRun,
- type PlanCheckRun_Result,
- PlanCheckRun_Result_Type,
- PlanCheckRunSchema,
-} from "@/types/proto-es/v1/plan_service_pb";
-import { flattenTaskV1List, isDatabaseChangeRelatedIssue } from "@/utils";
-import AffectedRowsView from "./AffectedRowsView.vue";
-import FailedTasksView from "./FailedTasksView.vue";
-
-const { issue, isCreating } = useIssueContext();
-
-const affectedRowsViewRef = ref<InstanceType<typeof AffectedRowsView>>();
-const failedTasksViewRef = ref<InstanceType<typeof FailedTasksView>>();
-
-const shouldShow = computed(() => {
- if (isCreating.value) return false;
- if (!isDatabaseChangeRelatedIssue(issue.value)) {
- return false;
- }
- if (
- !affectedRowsViewRef.value?.shouldShow &&
- !failedTasksViewRef.value?.shouldShow
- ) {
- return false;
- }
- return true;
-});
-
-const tasks = computed(() => flattenTaskV1List(issue.value.rolloutEntity));
-
-// With consolidated model, create synthetic PlanCheckRuns per task
-// containing only the summary report results for that task's target
-const taskSummaryReportMap = computed(() => {
- const { planCheckRunList } = issue.value;
- const tempMap = new Map<string, PlanCheckRun>();
-
- for (const task of tasks.value) {
- // Find all summary report results that match this task's target
- const taskResults: PlanCheckRun_Result[] = [];
-
- for (const run of planCheckRunList) {
- const matchingResults = run.results.filter(
- (result) =>
- result.type === PlanCheckRun_Result_Type.STATEMENT_SUMMARY_REPORT &&
- result.target === task.target
- );
- taskResults.push(...matchingResults);
- }
-
- if (taskResults.length > 0) {
- // Create a synthetic PlanCheckRun with just the results for this task
- tempMap.set(
- task.name,
- create(PlanCheckRunSchema, {
- results: taskResults,
- })
- );
- }
- }
-
- return tempMap;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/index.ts b/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/index.ts
deleted file mode 100644
index 4c7f2738fb..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/TaskCheckSummarySection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import TaskCheckSummarySection from "./TaskCheckSummarySection.vue";
-
-export default TaskCheckSummarySection;
diff --git a/frontend/src/components/IssueV1/components/Sidebar/index.ts b/frontend/src/components/IssueV1/components/Sidebar/index.ts
deleted file mode 100644
index 15fb2428a0..0000000000
--- a/frontend/src/components/IssueV1/components/Sidebar/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Sidebar from "./Sidebar.vue";
-
-export default Sidebar;
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageCard.vue b/frontend/src/components/IssueV1/components/StageSection/StageCard.vue
deleted file mode 100644
index 450624a3ad..0000000000
--- a/frontend/src/components/IssueV1/components/StageSection/StageCard.vue
+++ /dev/null
@@ -1,241 +0,0 @@
-<template>
- <div class="stage" :class="stageClass">
- <TaskStatusIcon
- :task="activeTaskInStage"
- :status="activeTaskInStage.status"
- />
-
- <div class="text" @click="handleClickStage">
- <div
- class="text-sm min-w-32 flex items-center gap-x-1 lg:min-w-fit with-underline whitespace-nowrap"
- >
- <heroicons:arrow-small-right
- v-if="isActiveStage"
- class="w-5 h-5 inline-block"
- />
- <span>{{ $t("common.stage") }}</span>
- <span>-</span>
- <i18n-t
- v-if="!isCreating && isActiveStage"
- keypath="issue.stage-select.current"
- >
- <template #name>
- <EnvironmentV1Name :environment="environment" :link="false" />
- </template>
- </i18n-t>
- <span v-else>{{ environment.title }}</span>
- </div>
- <div class="text-xs flex gap-1 flex-row items-center">
- <div class="whitespace-no-wrap with-underline">
- {{ $t("common.task", 2) }}
- </div>
- <StageSummary :stage="stage as Stage" />
- </div>
- </div>
-
- <NTooltip v-if="isCreating && !isValid" trigger="hover" placement="top">
- <template #trigger>
- <heroicons:exclamation-circle-solid
- class="w-6 h-6 ml-2 text-error hover:text-error-hover"
- />
- </template>
- <span>{{ $t("issue.missing-sql-statement") }}</span>
- </NTooltip>
- <NTooltip
- v-if="
- !isCreating &&
- (planCheckStatus === Advice_Level.ERROR ||
- planCheckStatus === Advice_Level.WARNING)
- "
- trigger="hover"
- placement="top"
- >
- <template #trigger>
- <heroicons:exclamation-circle-solid
- class="w-6 h-6 ml-2"
- :class="[
- planCheckStatus === Advice_Level.ERROR
- ? 'text-error hover:text-error-hover'
- : 'text-warning hover:text-warning-hover',
- ]"
- />
- </template>
- <span>{{
- $t(
- "custom-approval.issue-review.disallow-approve-reason.some-task-checks-didnt-pass"
- )
- }}</span>
- </NTooltip>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { first, uniqBy } from "lodash-es";
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import {
- isTaskFinished,
- isValidStage,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
-import { EnvironmentV1Name } from "@/components/v2";
-import { useEnvironmentV1Store } from "@/store";
-import { EMPTY_TASK_NAME } from "@/types";
-import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { activeTaskInStageV1 } from "@/utils";
-import TaskStatusIcon from "../TaskStatusIcon.vue";
-import StageSummary from "./StageSummary.vue";
-
-const props = defineProps<{
- stage: Stage;
-}>();
-
-const {
- isCreating,
- selectedTask,
- selectedStage,
- events,
- getPlanCheckRunsForTask,
-} = useIssueContext();
-const environmentStore = useEnvironmentV1Store();
-
-const activeTaskInStage = computed(() => {
- return activeTaskInStageV1(props.stage);
-});
-
-const isValid = computed(() => {
- return isValidStage(props.stage);
-});
-
-const isSelectedStage = computed(() => {
- return props.stage === selectedStage.value;
-});
-
-const isActiveStage = computed(() => {
- if (isCreating.value) {
- return false;
- }
-
- const taskFound = props.stage.tasks.find(
- (t) => t.name === selectedTask.value.name
- );
- if (taskFound && !isTaskFinished(taskFound)) {
- // A stage is "Active" if the ActiveTaskOfPipeline is inside this stage
- return true;
- }
-
- return false;
-});
-
-const stageClass = computed(() => {
- const classList: string[] = [];
- if (isCreating.value) {
- classList.push("create");
- if (!isValid.value) {
- classList.push("invalid");
- }
- }
- if (isSelectedStage.value) classList.push("selected");
- if (isActiveStage.value) classList.push("active");
- const task = activeTaskInStage.value;
- classList.push(`status_${Task_Status[task.status].toLowerCase()}`);
-
- return classList;
-});
-
-const environment = computed(() =>
- environmentStore.getEnvironmentByName(props.stage.environment)
-);
-
-const planCheckStatus = computed((): Advice_Level => {
- if (isCreating.value) return Advice_Level.ADVICE_LEVEL_UNSPECIFIED;
- const planCheckList = uniqBy(
- props.stage.tasks.flatMap(getPlanCheckRunsForTask),
- (checkRun) => checkRun.name
- );
- const summary = planCheckRunSummaryForCheckRunList(planCheckList);
- if (summary.errorCount > 0) {
- return Advice_Level.ERROR;
- }
- if (summary.warnCount > 0) {
- return Advice_Level.WARNING;
- }
- return Advice_Level.SUCCESS;
-});
-
-const activeOrFirstTaskInStage = (stage: Stage) => {
- if (isCreating.value) {
- return first(stage.tasks);
- }
- const activeTask = activeTaskInStageV1(stage);
- if (activeTask.name === EMPTY_TASK_NAME) {
- return first(stage.tasks);
- }
- return activeTask;
-};
-
-const handleClickStage = () => {
- const { stage } = props;
- if (stage === selectedStage.value) return;
-
- if (stage) {
- const task = activeOrFirstTaskInStage(stage);
- if (task) {
- events.emit("select-task", { task });
- }
- }
-};
-</script>
-
-<style scoped lang="postcss">
-.stage {
- cursor: default;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- width: 100%;
- font-size: 0.875rem;
- line-height: 1.25rem;
- position: relative;
-}
-@media (min-width: 1024px) {
- .stage {
- flex: 1 1 0%;
- }
-}
-.stage.selected .text .with-underline {
- text-decoration-line: underline;
-}
-
-.stage .text {
- cursor: pointer;
- flex: 1 1 0%;
- margin-left: 1rem;
- display: flex;
- flex-direction: column;
- row-gap: 0.125rem;
-}
-.stage.active .text {
- font-weight: 700;
-}
-.stage.status_done .text {
- color: var(--color-control);
-}
-.stage.status_pending .text,
-.stage.status_pending_approval .text {
- color: var(--color-control);
-}
-.stage.active.status_pending .text,
-.stage.active.status_pending_approval .text {
- color: var(--color-info);
-}
-.stage.status_running .text {
- color: var(--color-info);
-}
-.stage.status_failed .text {
- color: var(--color-red-500);
-}
-</style>
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageSection.vue b/frontend/src/components/IssueV1/components/StageSection/StageSection.vue
deleted file mode 100644
index 3e3ab02fe5..0000000000
--- a/frontend/src/components/IssueV1/components/StageSection/StageSection.vue
+++ /dev/null
@@ -1,60 +0,0 @@
-<template>
- <div class="w-full flex flex-col divide-y">
- <template v-if="stageList.length > 0">
- <div class="px-0">
- <NScrollbar :x-scrollable="true" class="max-h-[180px] sm:max-h-max">
- <div
- class="flex flex-col sm:flex-row justify-between divide-y sm:divide-y-0"
- >
- <template v-for="(stage, index) in stageList" :key="stage.name">
- <StageCard
- :stage="stage"
- :index="index"
- class="h-[54px] px-2 sm:px-0"
- :class="[
- index === 0 && 'sm:pl-4',
- index === stageList.length - 1 && 'sm:pr-4',
- ]"
- />
- <div
- v-if="index < stageList.length - 1"
- class="hidden sm:block w-3.5 h-[54px] mr-2 pointer-events-none shrink-0"
- aria-hidden="true"
- >
- <svg
- class="h-full w-full text-gray-300"
- viewBox="0 0 22 80"
- fill="none"
- preserveAspectRatio="none"
- >
- <path
- d="M0 -2L20 40L0 82"
- vector-effect="non-scaling-stroke"
- stroke="currentcolor"
- stroke-linejoin="round"
- />
- </svg>
- </div>
- </template>
- </div>
- </NScrollbar>
- </div>
- </template>
- <template v-else>
- <NEmpty class="py-6" />
- </template>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NEmpty, NScrollbar } from "naive-ui";
-import { computed } from "vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import StageCard from "./StageCard.vue";
-
-const { issue } = useIssueContext();
-
-const stageList = computed(() => {
- return issue.value.rolloutEntity?.stages || [];
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue b/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
deleted file mode 100644
index 6946856df1..0000000000
--- a/frontend/src/components/IssueV1/components/StageSection/StageSummary.vue
+++ /dev/null
@@ -1,52 +0,0 @@
-<template>
- <div class="text-gray-500">
- <span>(</span>
- <template v-if="!isCreating">
- <span>{{ summary.done + summary.canceled }}</span>
- <span>/</span>
- </template>
- <span>{{ summary.total }}</span>
- <span>)</span>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { useIssueContext } from "../../logic";
-
-const props = defineProps<{
- stage: Stage;
-}>();
-
-const { isCreating } = useIssueContext();
-
-const summary = computed(() => {
- const tasks = props.stage.tasks;
- const summary = {
- done: 0,
- failed: 0,
- canceled: 0,
- running: 0,
- total: tasks.length,
- };
- tasks.forEach((task) => {
- switch (task.status) {
- case Task_Status.DONE:
- summary.done++;
- break;
- case Task_Status.FAILED:
- summary.failed++;
- break;
- case Task_Status.CANCELED:
- summary.canceled++;
- break;
- case Task_Status.RUNNING:
- summary.running++;
- break;
- }
- });
- return summary;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/StageSection/index.ts b/frontend/src/components/IssueV1/components/StageSection/index.ts
deleted file mode 100644
index 0c240e16c6..0000000000
--- a/frontend/src/components/IssueV1/components/StageSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import StageSection from "./StageSection.vue";
-
-export default StageSection;
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
deleted file mode 100644
index 401154372c..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue
+++ /dev/null
@@ -1,71 +0,0 @@
-<template>
- <NPopover trigger="hover" placement="bottom">
- <template #trigger>
- <NButton size="tiny">
- <template #icon>
- <EllipsisVerticalIcon />
- </template>
- </NButton>
- </template>
-
- <div class="flex flex-col items-start justify-start">
- <template v-if="shouldShowInstanceRoleSelect">
- <InstanceRoleSelect />
- </template>
- <template
- v-if="shouldShowInstanceRoleSelect && shouldShowTransactionModeToggle"
- >
- <NDivider class="my-2!" />
- </template>
- <template v-if="shouldShowTransactionModeToggle">
- <TransactionModeToggle />
- </template>
- </div>
- </NPopover>
-</template>
-
-<script setup lang="tsx">
-import { EllipsisVerticalIcon } from "lucide-vue-next";
-import { NButton, NDivider, NPopover } from "naive-ui";
-import { computed } from "vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import { useCurrentProjectV1 } from "@/store";
-import { Engine } from "@/types/proto-es/v1/common_pb";
-import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, instanceV1SupportsTransactionMode } from "@/utils";
-import InstanceRoleSelect from "./InstanceRoleSelect.vue";
-import TransactionModeToggle from "./TransactionModeToggle.vue";
-
-const { selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-
-const database = computed(() => {
- return databaseForTask(project.value, selectedTask.value);
-});
-
-const shouldShowInstanceRoleSelect = computed(() => {
- // Only works for postgres.
- const engine = database.value.instanceResource.engine;
- if (engine !== Engine.POSTGRES) {
- return false;
- }
- if (selectedTask.value.type !== Task_Type.DATABASE_MIGRATE) {
- return false;
- }
- return true;
-});
-
-const shouldShowTransactionModeToggle = computed(() => {
- // Check if the engine supports transaction mode
- if (
- !instanceV1SupportsTransactionMode(database.value.instanceResource.engine)
- ) {
- return false;
- }
- // Only show for DDL/DML tasks
- if (selectedTask.value.type !== Task_Type.DATABASE_MIGRATE) {
- return false;
- }
- return true;
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
deleted file mode 100644
index 09544a55a6..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue
+++ /dev/null
@@ -1,533 +0,0 @@
-<template>
- <div class="flex flex-col gap-y-2">
- <div class="flex items-center justify-between">
- <div class="flex items-center gap-x-4">
- <div class="flex items-center gap-x-1 text-sm font-medium">
- <span
- :class="isEmpty(state.statement) ? 'text-red-600' : 'text-control'"
- >
- {{ statementTitle }}
- </span>
- <RequiredStar v-if="isCreating" />
- </div>
- </div>
-
- <div class="flex items-center justify-end gap-x-2">
- <template v-if="isCreating">
- <template v-if="allowEditStatementWhenCreating">
- <EditorActionPopover />
- <SQLUploadButton
- size="tiny"
- :loading="state.isUploadingFile"
- @update:sql="handleUpdateStatement"
- >
- {{ $t("issue.upload-sql") }}
- </SQLUploadButton>
- </template>
- </template>
-
- <template v-else>
- <template v-if="!state.isEditing">
- <template v-if="shouldShowEditButton">
- <!-- for small size sheets, show full featured UI editing button group -->
- <NTooltip :disabled="denyEditStatementReasons.length === 0">
- <template #trigger>
- <NButton
- v-if="!isSheetOversize"
- size="tiny"
- tag="div"
- :disabled="denyEditStatementReasons.length > 0"
- @click.prevent="beginEdit"
- >
- {{ $t("common.edit") }}
- </NButton>
- <!-- for oversized sheets, only allow to upload and overwrite the sheet -->
- <SQLUploadButton
- v-else
- size="tiny"
- :loading="state.isUploadingFile"
- @update:sql="handleUpdateStatementAndOverwrite"
- >
- {{ $t("issue.upload-sql") }}
- </SQLUploadButton>
- </template>
- <template #default>
- <ErrorList :errors="denyEditStatementReasons" />
- </template>
- </NTooltip>
- </template>
- </template>
- <template v-else>
- <EditorActionPopover />
- <SQLUploadButton
- size="tiny"
- :loading="state.isUploadingFile"
- @update:sql="handleUpdateStatement"
- >
- {{ $t("issue.upload-sql") }}
- </SQLUploadButton>
- <NButton
- v-if="state.isEditing"
- size="tiny"
- :disabled="!allowSaveSQL"
- @click.prevent="saveEdit"
- >
- {{ $t("common.save") }}
- </NButton>
- <NButton
- v-if="state.isEditing"
- size="tiny"
- quaternary
- @click.prevent="cancelEdit"
- >
- {{ $t("common.cancel") }}
- </NButton>
- </template>
- </template>
- </div>
- </div>
-
- <BBAttention
- v-if="isSheetOversize"
- type="warning"
- :title="$t('issue.statement-from-sheet-warning')"
- >
- <template #action>
- <DownloadSheetButton v-if="sheetName" :sheet="sheetName" size="small" />
- </template>
- </BBAttention>
-
- <div
- ref="editorContainerElRef"
- class="whitespace-pre-wrap overflow-hidden min-h-[120px] relative"
- :data-height="editorContainerHeight"
- >
- <MonacoEditor
- ref="monacoEditorRef"
- class="w-full h-auto max-h-[240px] min-h-[120px] border rounded-[3px]"
- :filename="filename"
- :content="state.statement"
- :language="language"
- :auto-focus="false"
- :readonly="isEditorReadonly"
- :dialect="dialect"
- :advices="isEditorReadonly || isCreating ? markers : []"
- :auto-height="{ min: 120, max: 240 }"
- :auto-complete-context="{
- instance: database.instance,
- database: database.name,
- scene: 'all',
- }"
- @update:content="handleStatementChange"
- />
- <div class="absolute bottom-[3px] right-[18px]">
- <NButton
- size="small"
- :quaternary="true"
- style="--n-padding: 0 5px"
- @click="state.showEditorModal = true"
- >
- <template #icon>
- <ExpandIcon class="w-4 h-4" />
- </template>
- </NButton>
- </div>
- </div>
- </div>
-
- <BBModal
- v-model:show="state.showEditorModal"
- :title="statementTitle"
- :trap-focus="true"
- header-class="border-b-0!"
- container-class="pt-0! overflow-hidden!"
- >
- <div
- id="modal-editor-container"
- style="
- width: calc(100vw - 10rem);
- height: calc(100vh - 10rem);
- overflow: hidden;
- position: relative;
- "
- class="border rounded-[3px]"
- >
- <MonacoEditor
- v-if="state.showEditorModal"
- class="w-full h-full"
- :filename="filename"
- :content="state.statement"
- :language="language"
- :auto-focus="false"
- :readonly="isEditorReadonly"
- :dialect="dialect"
- :advices="isEditorReadonly || isCreating ? markers : []"
- :auto-complete-context="{
- instance: database.instance,
- database: database.name,
- scene: 'all',
- }"
- @update:content="handleStatementChange"
- />
- </div>
- </BBModal>
-</template>
-
-<script setup lang="ts">
-import { create } from "@bufbuild/protobuf";
-import { useElementSize } from "@vueuse/core";
-import { cloneDeep, isEmpty } from "lodash-es";
-import { ExpandIcon } from "lucide-vue-next";
-import { NButton, NTooltip, useDialog } from "naive-ui";
-import { computed, reactive, ref, toRef, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { BBAttention, BBModal } from "@/bbkit";
-import { ErrorList } from "@/components/IssueV1/components/common";
-import {
- allowUserToEditStatementForTask,
- isTaskEditable,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { MonacoEditor } from "@/components/MonacoEditor";
-import { extensionNameOfLanguage } from "@/components/MonacoEditor/utils";
-import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";
-import { createEmptyLocalSheet } from "@/components/Plan";
-import RequiredStar from "@/components/RequiredStar.vue";
-import DownloadSheetButton from "@/components/Sheet/DownloadSheetButton.vue";
-import { planServiceClientConnect } from "@/connect";
-import {
- pushNotification,
- useCurrentProjectV1,
- useSheetV1Store,
-} from "@/store";
-import type { SQLDialect } from "@/types";
-import { dialectOfEngineV1 } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";
-import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";
-import type { Advice } from "@/types/proto-es/v1/sql_service_pb";
-import {
- databaseForTask,
- flattenTaskV1List,
- getSheetStatement,
- getStatementSize,
- setSheetStatement,
- useInstanceV1EditorLanguage,
-} from "@/utils";
-import { useSQLAdviceMarkers } from "../useSQLAdviceMarkers";
-import { provideEditorContext } from "./context";
-import EditorActionPopover from "./EditorActionPopover.vue";
-import type { EditState } from "./useTempEditState";
-import { useTempEditState } from "./useTempEditState";
-
-type LocalState = EditState & {
- showFeatureModal: boolean;
- showEditorModal: boolean;
- isUploadingFile: boolean;
-};
-
-const props = defineProps<{
- advices?: Advice[];
-}>();
-
-const { t } = useI18n();
-const context = useIssueContext();
-const { events, isCreating, issue, selectedTask } = context;
-const { project } = useCurrentProjectV1();
-const dialog = useDialog();
-const editorContainerElRef = ref<HTMLElement>();
-const monacoEditorRef = ref<InstanceType<typeof MonacoEditor>>();
-const { height: editorContainerHeight } = useElementSize(editorContainerElRef);
-
-const state = reactive<LocalState>({
- isEditing: false,
- statement: "",
- showFeatureModal: false,
- showEditorModal: false,
- isUploadingFile: false,
-});
-
-const database = computed(() => {
- return databaseForTask(project.value, selectedTask.value);
-});
-
-const language = useInstanceV1EditorLanguage(
- computed(() => database.value.instanceResource)
-);
-const filename = computed(() => {
- const name = selectedTask.value.name;
- const ext = extensionNameOfLanguage(language.value);
- return `${name}.${ext}`;
-});
-const dialect = computed((): SQLDialect => {
- const db = database.value;
- return dialectOfEngineV1(db.instanceResource.engine);
-});
-const statementTitle = computed(() => {
- return language.value === "sql" ? t("common.sql") : t("common.statement");
-});
-const { markers } = useSQLAdviceMarkers(context, toRef(props, "advices"));
-
-const allowEditStatementWhenCreating = computed(() => {
- // Do not allow to edit statement for the plan with release source.
- if (
- (
- issue.value.planEntity?.specs?.filter(
- (spec) =>
- spec.config?.case === "changeDatabaseConfig" &&
- spec.config.value.release
- ) ?? []
- ).length > 0
- ) {
- return false;
- }
- return true;
-});
-
-/**
- * to set the MonacoEditor as readonly
- * This happens when
- * - Not in edit mode
- * - Disallowed to edit statement
- */
-const isEditorReadonly = computed(() => {
- if (isCreating.value) {
- return !allowEditStatementWhenCreating.value;
- }
- return !state.isEditing || isSheetOversize.value || false;
-});
-
-const {
- sheet,
- sheetName,
- sheetReady,
- sheetStatement,
- reset: resetTempEditState,
-} = useTempEditState(state);
-
-const isSheetOversize = computed(() => {
- if (isCreating.value) return false;
- if (state.isEditing) return false;
- if (!sheetReady.value) return false;
- if (!sheet.value) return false;
- return (
- getStatementSize(getSheetStatement(sheet.value)) < sheet.value.contentSize
- );
-});
-
-const denyEditStatementReasons = computed(() =>
- allowUserToEditStatementForTask(issue.value, selectedTask.value)
-);
-
-const shouldShowEditButton = computed(() => {
- // Need not to show "Edit" while the issue is still pending create.
- if (isCreating.value) {
- return false;
- }
- // If the issue is not open, don't show the edit button.
- if (issue.value.status !== IssueStatus.OPEN) {
- return false;
- }
- // Do not allow to edit statement for the plan with release source.
- if (
- (
- issue.value.planEntity?.specs?.filter(
- (spec) =>
- spec.config?.case === "changeDatabaseConfig" &&
- spec.config.value.release
- ) ?? []
- ).length > 0
- ) {
- return false;
- }
- for (const task of flattenTaskV1List(issue.value.rolloutEntity)) {
- if (!isTaskEditable(task)) {
- // If the task is not editable, don't show the edit button.
- return false;
- }
- }
- // Will show another button group as [Upload][Cancel][Save]
- // while editing
- if (state.isEditing) {
- return false;
- }
- return true;
-});
-
-const allowSaveSQL = computed((): boolean => {
- if (state.statement === "") {
- // Not allowed if the statement is empty.
- return false;
- }
- if (!sheetReady.value) {
- return false;
- }
- if (state.statement === sheetStatement.value) {
- // Not allowed if the statement is not modified.
- return false;
- }
-
- // Allowed to save otherwise
- return true;
-});
-
-const beginEdit = () => {
- state.isEditing = true;
-};
-
-const saveEdit = async () => {
- try {
- await updateStatement(state.statement);
- resetTempEditState();
- } finally {
- state.isEditing = false;
- }
-};
-
-const cancelEdit = () => {
- state.statement = sheetStatement.value;
- state.isEditing = false;
-};
-
-const showOverwriteConfirmDialog = () => {
- return new Promise((resolve, reject) => {
- // Show a confirm dialog before replacing if the editing statement is not empty.
- dialog.create({
- positiveText: t("common.confirm"),
- negativeText: t("common.cancel"),
- title: t("issue.overwrite-current-statement"),
- autoFocus: false,
- closable: false,
- maskClosable: false,
- closeOnEsc: false,
- onNegativeClick: () => {
- reject();
- },
- onPositiveClick: () => {
- resolve(undefined);
- },
- });
- });
-};
-
-const handleUpdateStatementAndOverwrite = async (
- statement: string,
- filename: string
-) => {
- try {
- await showOverwriteConfirmDialog();
- } catch {
- return;
- }
-
- state.isEditing = true;
- state.statement = statement;
- await handleUpdateStatement(statement, filename);
-};
-
-const handleUpdateStatement = async (statement: string, _filename: string) => {
- try {
- state.isUploadingFile = true;
- handleStatementChange(statement);
- resetTempEditState();
- } finally {
- state.isUploadingFile = false;
- }
-};
-
-const updateStatement = async (statement: string) => {
- const planPatch = cloneDeep(issue.value.planEntity);
- if (!planPatch) {
- // Should not reach here.
- throw new Error("Plan is not defined. Cannot update statement.");
- }
-
- const sheet = create(SheetSchema, {
- ...createEmptyLocalSheet(),
- });
- setSheetStatement(sheet, statement);
- const createdSheet = await useSheetV1Store().createSheet(
- issue.value.project,
- sheet
- );
-
- // Update all specs with the created sheet.
- for (const spec of planPatch.specs) {
- if (spec.config?.case === "changeDatabaseConfig") {
- spec.config.value.sheet = createdSheet.name;
- } else if (spec.config?.case === "exportDataConfig") {
- spec.config.value.sheet = createdSheet.name;
- }
- }
-
- const request = create(UpdatePlanRequestSchema, {
- plan: planPatch,
- updateMask: { paths: ["specs"] },
- });
- const response = await planServiceClientConnect.updatePlan(request);
-
- issue.value.planEntity = response;
-
- events.emit("status-changed", { eager: true });
-
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
-};
-
-const handleStatementChange = (value: string) => {
- if (isEditorReadonly.value) {
- return;
- }
-
- state.statement = value;
- if (isCreating.value) {
- // When creating an issue, update the local sheet directly.
- if (!sheet.value) return;
- setSheetStatement(sheet.value, value);
- }
-};
-
-watch(
- sheetStatement,
- (statement, oldStatement) => {
- // Don't overwrite user's edits if they're currently in edit mode
- if (state.isEditing) {
- return;
- }
-
- // Don't overwrite if the user has made local changes since the last
- // sheet update (i.e., current state doesn't match the old sheet statement)
- if (oldStatement !== undefined && state.statement !== oldStatement) {
- return;
- }
-
- // Safe to update: not editing and no divergence from previous sheet state
- state.statement = statement;
- },
- { immediate: true }
-);
-
-watch(isCreating, (curr, prev) => {
- // Reset the edit state after creating the issue.
- if (!curr && prev) {
- state.isEditing = false;
- }
-});
-
-provideEditorContext({
- statement: computed(() => state.statement),
- setStatement: handleStatementChange,
-});
-
-defineExpose({
- get editor() {
- return monacoEditorRef.value;
- },
- get isEditing() {
- return state.isEditing;
- },
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/InstanceRoleSelect.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/InstanceRoleSelect.vue
deleted file mode 100644
index 5f227508be..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/InstanceRoleSelect.vue
+++ /dev/null
@@ -1,111 +0,0 @@
-<template>
- <div class="w-full flex flex-row justify-start items-center gap-2">
- <span class="shrink-0">{{ $t("common.role.self") }}</span>
- <NSelect
- v-model:value="state.selectedRole"
- class="w-40! grow"
- consistent-menu-width
- size="small"
- :options="options"
- :placeholder="$t('instance.select-database-user')"
- :filterable="true"
- :virtual-scroll="true"
- :fallback-option="false"
- />
- </div>
-</template>
-
-<script setup lang="tsx">
-import { create } from "@bufbuild/protobuf";
-import { NSelect, type SelectOption } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import { instanceRoleServiceClientConnect } from "@/connect";
-import { useCurrentProjectV1 } from "@/store";
-import type { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";
-import { ListInstanceRolesRequestSchema } from "@/types/proto-es/v1/instance_role_service_pb";
-import { databaseForTask } from "@/utils";
-import { useEditorContext } from "./context";
-import { parseStatement, updateRoleSetter } from "./directiveUtils";
-
-interface LocalState {
- selectedRole?: string;
-}
-
-const editorContext = useEditorContext();
-
-const { selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const state = reactive<LocalState>({});
-
-const database = computed(() => {
- return databaseForTask(project.value, selectedTask.value);
-});
-
-const instanceRoles = ref<InstanceRole[]>([]);
-
-watch(
- () => database.value.instance,
- async () => {
- const request = create(ListInstanceRolesRequestSchema, {
- parent: database.value.instance,
- });
- const response =
- await instanceRoleServiceClientConnect.listInstanceRoles(request);
- instanceRoles.value = response.roles;
- },
- {
- immediate: true,
- }
-);
-
-const options = computed(() => {
- return instanceRoles.value.map<SelectOption>((instanceRole) => {
- return {
- value: instanceRole.roleName,
- label: instanceRole.roleName,
- };
- });
-});
-
-watch(
- () => selectedTask.value.name,
- async () => {
- // Initialize selected role from statement
- const parsed = parseStatement(editorContext.statement.value);
- if (parsed.roleSetterBlock) {
- // Extract role name from the role setter block
- const match = parsed.roleSetterBlock.match(
- /SET ROLE ([a-zA-Z_][a-zA-Z0-9_]{0,62});/
- );
- if (match) {
- state.selectedRole = match[1];
- } else {
- state.selectedRole = undefined;
- }
- } else {
- state.selectedRole = undefined;
- }
- },
- {
- immediate: true,
- }
-);
-
-watch(
- () => state.selectedRole,
- async () => {
- if (state.selectedRole) {
- setRoleInTaskStatement(state.selectedRole);
- }
- }
-);
-
-const setRoleInTaskStatement = (roleName: string) => {
- const updatedStatement = updateRoleSetter(
- editorContext.statement.value,
- roleName
- );
- editorContext.setStatement(updatedStatement);
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/TransactionModeToggle.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/TransactionModeToggle.vue
deleted file mode 100644
index 67551d4ca0..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/TransactionModeToggle.vue
+++ /dev/null
@@ -1,90 +0,0 @@
-<template>
- <div class="flex flex-row justify-start items-center gap-2">
- <span class="shrink-0 text-sm">{{
- $t("issue.transaction-mode.label")
- }}</span>
- <NTooltip>
- <template #trigger>
- <NSwitch
- v-model:value="isTransactionOn"
- size="small"
- :disabled="shouldDisableTransactionMode"
- >
- <template #checked>
- {{ $t("issue.transaction-mode.on") }}
- </template>
- <template #unchecked>
- {{ $t("issue.transaction-mode.off") }}
- </template>
- </NSwitch>
- </template>
- <template #default>
- <div class="max-w-xs">
- <div v-if="isTransactionOn">
- {{ $t("issue.transaction-mode.on-tooltip") }}
- </div>
- <div v-else>
- {{ $t("issue.transaction-mode.off-tooltip") }}
- </div>
- </div>
- </template>
- </NTooltip>
- </div>
-</template>
-
-<script setup lang="tsx">
-import { NSwitch, NTooltip } from "naive-ui";
-import { computed, ref, watch } from "vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import { getDefaultTransactionMode } from "@/utils";
-import { useEditorContext } from "./context";
-import { parseStatement, updateTransactionMode } from "./directiveUtils";
-
-const editorContext = useEditorContext();
-const { selectedTask } = useIssueContext();
-
-// Transaction mode can be configured for all supported engines
-const shouldDisableTransactionMode = computed(() => {
- return false;
-});
-
-// Default transaction mode
-const getDefaultForCurrentTask = () => {
- return getDefaultTransactionMode();
-};
-
-const isTransactionOn = ref(getDefaultForCurrentTask());
-
-// Watch for task changes to reset defaults
-watch(
- () => selectedTask.value.name,
- () => {
- // Parse existing statement for transaction mode
- const parsed = parseStatement(editorContext.statement.value);
- if (parsed.transactionMode !== undefined) {
- isTransactionOn.value = parsed.transactionMode === "on";
- } else {
- // Use default if no directive found
- isTransactionOn.value = getDefaultForCurrentTask();
- }
- },
- { immediate: true }
-);
-
-// Update statement when transaction mode changes
-watch(
- () => isTransactionOn.value,
- () => {
- updateStatementWithTransactionMode();
- }
-);
-
-const updateStatementWithTransactionMode = () => {
- const mode = isTransactionOn.value ? "on" : "off";
- const updatedStatement = updateTransactionMode(
- editorContext.statement.value,
- mode
- );
- editorContext.setStatement(updatedStatement);
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/context.ts b/frontend/src/components/IssueV1/components/StatementSection/EditorView/context.ts
deleted file mode 100644
index 62b477d529..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/context.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import type { InjectionKey, Ref } from "vue";
-import { inject, provide } from "vue";
-
-export type EditorContext = {
- statement: Ref<string>;
- setStatement: (statement: string) => void;
-};
-
-export const KEY = Symbol(
- "bb.issue.context.editor-view"
-) as InjectionKey<EditorContext>;
-
-export const useEditorContext = () => {
- return inject(KEY)!;
-};
-
-export const provideEditorContext = (context: EditorContext) => {
- provide(KEY, context);
- return context;
-};
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/directiveUtils.ts b/frontend/src/components/IssueV1/components/StatementSection/EditorView/directiveUtils.ts
deleted file mode 100644
index e7d521d8ba..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/directiveUtils.ts
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Utilities for managing SQL directives and special statements in the editor.
- *
- * Directives are special comments that must appear at specific positions:
- * - Transaction mode directive: Must be on line 1
- *
- * Special statements are SQL statements that get special handling:
- * - SET ROLE statement: Can appear anywhere but is handled specially by backend
- */
-
-// Transaction mode directive pattern
-const TXN_MODE_REGEX = /^\s*--\s*txn-mode\s*=\s*(on|off)\s*$/i;
-
-// PostgreSQL role setter pattern
-// Matches PostgreSQL identifier rules: starts with letter/underscore, up to 63 chars
-const ROLE_SETTER_REGEX =
- /\/\*\s*=== Bytebase Role Setter\. DO NOT EDIT\. === \*\/\s*SET ROLE ([a-zA-Z_][a-zA-Z0-9_]{0,62});/;
-
-export interface ParsedStatement {
- // Line 1 directive (currently only transaction mode)
- transactionMode?: "on" | "off";
- // Role setter block if present
- roleSetterBlock?: string;
- // The main SQL content (everything except directives and role setter)
- mainContent: string;
-}
-
-/**
- * Parses a SQL statement into its components.
- */
-export function parseStatement(statement: string): ParsedStatement {
- const lines = statement.split("\n");
- const result: ParsedStatement = {
- mainContent: "",
- };
-
- let currentIndex = 0;
-
- // Check line 1 for transaction mode directive
- if (lines.length > 0 && TXN_MODE_REGEX.test(lines[0])) {
- const match = lines[0].match(TXN_MODE_REGEX);
- if (match) {
- result.transactionMode = match[1].toLowerCase() as "on" | "off";
- currentIndex = 1;
- }
- }
-
- // Check for role setter block (can be anywhere in the remaining content)
- const remainingContent = lines.slice(currentIndex).join("\n");
- const roleSetterMatch = remainingContent.match(ROLE_SETTER_REGEX);
-
- if (roleSetterMatch) {
- result.roleSetterBlock = roleSetterMatch[0];
- // Remove the role setter block from the content
- result.mainContent = remainingContent.replace(ROLE_SETTER_REGEX, "").trim();
- } else {
- result.mainContent = remainingContent.trim();
- }
-
- return result;
-}
-
-/**
- * Rebuilds a SQL statement from its components, ensuring proper ordering.
- */
-export function buildStatement(components: ParsedStatement): string {
- const parts: string[] = [];
-
- // Line 1: Transaction mode directive (if present)
- if (components.transactionMode !== undefined) {
- parts.push(`-- txn-mode = ${components.transactionMode}`);
- }
-
- // Role setter block (if present) - place it before main content
- if (components.roleSetterBlock) {
- parts.push(components.roleSetterBlock);
- }
-
- // Main SQL content
- if (components.mainContent) {
- parts.push(components.mainContent);
- }
-
- return parts.filter((part) => part.length > 0).join("\n");
-}
-
-/**
- * Updates the transaction mode in a statement while preserving other components.
- */
-export function updateTransactionMode(
- statement: string,
- mode: "on" | "off"
-): string {
- const parsed = parseStatement(statement);
- parsed.transactionMode = mode;
- return buildStatement(parsed);
-}
-
-/**
- * Updates the role setter in a statement while preserving other components.
- */
-export function updateRoleSetter(
- statement: string,
- roleName: string | null
-): string {
- const parsed = parseStatement(statement);
-
- if (roleName) {
- parsed.roleSetterBlock = `/* === Bytebase Role Setter. DO NOT EDIT. === */\nSET ROLE ${roleName};`;
- } else {
- parsed.roleSetterBlock = undefined;
- }
-
- return buildStatement(parsed);
-}
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/index.ts b/frontend/src/components/IssueV1/components/StatementSection/EditorView/index.ts
deleted file mode 100644
index 8a654810d1..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import EditorView from "./EditorView.vue";
-
-export default EditorView;
diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/useTempEditState.ts b/frontend/src/components/IssueV1/components/StatementSection/EditorView/useTempEditState.ts
deleted file mode 100644
index 2f1ac59497..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/useTempEditState.ts
+++ /dev/null
@@ -1,118 +0,0 @@
-import { computed, nextTick, ref, watch } from "vue";
-import { UNKNOWN_ID } from "@/types";
-import { useIssueContext } from "../../../logic";
-import { useTaskSheet } from "../useTaskSheet";
-
-export type EditState = {
- isEditing: boolean;
- statement: string;
-};
-
-export const useTempEditState = (state: EditState) => {
- const { isCreating, selectedTask } = useIssueContext();
- const { sheet, sheetName, sheetReady, sheetStatement } = useTaskSheet();
-
- let stopWatching = () => {
- // noop
- };
-
- const startWatching = () => {
- const tempEditStateMap = new Map<string, EditState>();
- const isSwitchingTask = ref(false);
-
- // The issue page is polling the issue entity, making the reference obj
- // of `selectedTask` changes every time.
- // So we need to watch the id instead of the object ref.
- const selectedTaskName = computed((): string => {
- if (isCreating.value) return String(UNKNOWN_ID);
- return selectedTask.value.name;
- });
-
- watch(selectedTaskName, () => {
- // When switching task, set the switch flag to true
- // to temporarily disable change listeners.
- isSwitchingTask.value = true;
- nextTick(() => {
- isSwitchingTask.value = false;
- });
- });
-
- const handleEditChange = () => {
- // When we are switching between tasks, this will also be triggered.
- // But we shouldn't update the temp store.
- if (isSwitchingTask.value) {
- return;
- }
- // Save the temp edit state before switching task.
- tempEditStateMap.set(selectedTaskName.value, {
- isEditing: state.isEditing,
- statement: state.statement,
- });
- };
-
- const afterTaskNameChange = (name: string) => {
- // Try to restore the saved temp edit state after switching task.
- const storedState = tempEditStateMap.get(name);
- if (storedState) {
- // If found the stored temp edit state, restore it.
- Object.assign(state, storedState);
- } else {
- // Restore to the task's default state otherwise.
- state.isEditing = false;
- state.statement = sheetStatement.value;
- }
- };
-
- // Save the temp editing state before switching tasks
- const stopWatchBeforeChange = watch(
- [() => state.isEditing, () => state.statement],
- handleEditChange,
- { immediate: true }
- );
- const stopWatchAfterChange = watch(
- selectedTaskName,
- afterTaskNameChange,
- { flush: "post" } // Listen to the event AFTER selectedTaskId changed
- );
-
- return () => {
- tempEditStateMap.clear();
- stopWatchBeforeChange();
- stopWatchAfterChange();
- };
- };
-
- watch(
- isCreating,
- () => {
- if (!isCreating.value) {
- // If we are opening an existed issue, we should listen and store the
- // temp editing states.
- stopWatching = startWatching();
- } else {
- // If we are creating an issue, we don't need the temp editing state
- // feature since all tasks are still in editing mode.
- if (stopWatching) {
- stopWatching();
- }
- }
- },
- { immediate: true }
- );
-
- const reset = () => {
- stopWatching();
-
- if (!isCreating.value) {
- stopWatching = startWatching();
- }
- };
-
- return {
- reset,
- sheet,
- sheetName,
- sheetReady,
- sheetStatement,
- };
-};
diff --git a/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue b/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue
deleted file mode 100644
index 0aba6d809c..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/StatementSection.vue
+++ /dev/null
@@ -1,67 +0,0 @@
-<template>
- <div v-if="viewMode !== 'NONE'" class="px-4 py-2 flex flex-col gap-y-2">
- <EditorView
- v-if="viewMode === 'EDITOR'"
- ref="editorViewRef"
- :advices="advices"
- />
- </div>
-</template>
-
-<script setup lang="ts">
-import { computed, nextTick, ref } from "vue";
-import { useRouter } from "vue-router";
-import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { useRouteChangeGuard } from "@/composables/useRouteChangeGuard";
-import { useCurrentProjectV1 } from "@/store";
-import { TaskTypeListWithStatement } from "@/types";
-import { databaseForTask, isValidTaskName } from "@/utils";
-import { useIssueContext } from "../../logic";
-import EditorView from "./EditorView";
-
-const router = useRouter();
-const { isCreating, selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const { resultMap } = usePlanSQLCheckContext();
-
-const editorViewRef = ref<InstanceType<typeof EditorView>>();
-
-const advices = computed(() => {
- const database = databaseForTask(project.value, selectedTask.value);
- return resultMap.value[database.name]?.advices || [];
-});
-
-type ViewMode = "NONE" | "EDITOR";
-
-const viewMode = computed((): ViewMode => {
- if (isValidTaskName(selectedTask.value.name)) {
- const task = selectedTask.value;
- const { type } = task;
- if (TaskTypeListWithStatement.includes(type)) {
- return "EDITOR";
- }
- }
- return "NONE";
-});
-
-router.afterEach((to) => {
- if (to.hash) {
- scrollToLineByHash(to.hash);
- }
-});
-
-const scrollToLineByHash = (hash: string) => {
- const match = hash.match(/^#L(\d+)$/);
- if (!match) return;
- const lineNumber = parseInt(match[1], 10);
- nextTick(() => {
- editorViewRef.value?.editor?.monacoEditor?.editor?.codeEditor?.revealLineNearTop(
- lineNumber
- );
- });
-};
-
-useRouteChangeGuard(
- computed(() => isCreating.value || (editorViewRef.value?.isEditing ?? false))
-);
-</script>
diff --git a/frontend/src/components/IssueV1/components/StatementSection/index.ts b/frontend/src/components/IssueV1/components/StatementSection/index.ts
deleted file mode 100644
index 2895e1f4a0..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import StatementSection from "./StatementSection.vue";
-
-export default StatementSection;
diff --git a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts b/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts
deleted file mode 100644
index b939e1681f..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/useSQLAdviceMarkers.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import { maxBy } from "lodash-es";
-import { computed, type Ref } from "vue";
-import type { AdviceOption } from "@/components/MonacoEditor";
-import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
-import { PlanCheckRun_Result_Type } from "@/types/proto-es/v1/plan_service_pb";
-import { type Advice, Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { extractPlanCheckRunUID } from "@/utils";
-import { type IssueContext } from "../../logic";
-
-export const useSQLAdviceMarkers = (
- context: IssueContext,
- advices: Ref<Advice[] | undefined> | undefined
-) => {
- const { isCreating } = context;
- const markers = computed(() => {
- if (isCreating.value) {
- if (!advices) return [];
- if (!advices.value) return [];
- return advices.value
- .filter((advice) => {
- // Filter out advices without valid position (line 0 means unknown)
- const line = advice.startPosition?.line ?? 0;
- return line > 0;
- })
- .map<AdviceOption>((advice) => {
- const line = advice.startPosition!.line;
- const column = advice.startPosition!.column || 1;
- const code = advice.code;
- return {
- severity:
- advice.status === Advice_Level.ERROR ? "ERROR" : "WARNING",
- message: advice.content,
- source: `${advice.title} (${code}) L${line}:C${column}`,
- startLineNumber: line,
- endLineNumber: line,
- startColumn: column,
- endColumn: column,
- };
- });
- } else {
- const { selectedTask, getPlanCheckRunsForTask } = context;
- const planCheckRunList = getPlanCheckRunsForTask(selectedTask.value);
-
- // With consolidated model, filter results by type instead of checkRuns
- return getLatestAdviceOptions(
- planCheckRunList,
- PlanCheckRun_Result_Type.STATEMENT_ADVISE
- );
- }
- });
- return { markers };
-};
-
-const getLatestAdviceOptions = (
- planCheckRunList: PlanCheckRun[],
- resultType: PlanCheckRun_Result_Type
-) => {
- const latest = maxBy(planCheckRunList, (checkRun) =>
- parseInt(extractPlanCheckRunUID(checkRun.name), 10)
- );
- if (!latest) {
- return [];
- }
- // Filter results by type
- const resultList = latest.results.filter(
- (result) => result.type === resultType
- );
- return resultList
- .filter(
- (result) =>
- result.status === Advice_Level.ERROR ||
- result.status === Advice_Level.WARNING
- )
- .filter(
- (result) =>
- result.report?.case === "sqlReviewReport" &&
- result.report.value.startPosition !== undefined
- )
- .filter((result) => {
- // Filter out results without valid position (line 0 means unknown)
- const sqlReviewReport =
- result.report?.case === "sqlReviewReport" ? result.report.value : null;
- const line = sqlReviewReport?.startPosition?.line ?? 0;
- return line > 0;
- })
- .map<AdviceOption>((result) => {
- const sqlReviewReport =
- result.report?.case === "sqlReviewReport" ? result.report.value : null;
- const line = sqlReviewReport!.startPosition!.line;
- const column = sqlReviewReport!.startPosition!.column || 1;
- const code = result.code;
- return {
- severity: result.status === Advice_Level.ERROR ? "ERROR" : "WARNING",
- message: result.content,
- source: `${result.title} (${code}) L${line}:C${column}`,
- startLineNumber: line,
- endLineNumber: line,
- startColumn: column,
- endColumn: column,
- };
- });
-};
diff --git a/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts b/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts
deleted file mode 100644
index 3ad4c4eb6c..0000000000
--- a/frontend/src/components/IssueV1/components/StatementSection/useTaskSheet.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { computedAsync } from "@vueuse/core";
-import { computed, ref } from "vue";
-import { getLocalSheetByName } from "@/components/Plan";
-import { useSheetV1Store } from "@/store";
-import {
- extractSheetUID,
- getSheetStatement,
- setSheetStatement,
- sheetNameOfTaskV1,
-} from "@/utils";
-import { useIssueContext } from "../../logic";
-
-export const useTaskSheet = () => {
- const sheetStore = useSheetV1Store();
- const { selectedTask } = useIssueContext();
-
- const sheetName = computed(() => {
- return sheetNameOfTaskV1(selectedTask.value);
- });
- const isFetchingSheet = ref(false);
- const sheetReady = computed(() => {
- return !isFetchingSheet.value;
- });
- const sheet = computedAsync(
- async () => {
- const name = sheetName.value;
- const uid = extractSheetUID(name);
- if (uid.startsWith("-")) {
- return getLocalSheetByName(name);
- }
- // Use any view(basic or full) of sheets here to save data size.
- return await sheetStore.getOrFetchSheetByName(name);
- },
- undefined,
- {
- evaluating: isFetchingSheet,
- }
- );
- const sheetStatement = computed({
- get() {
- if (!sheetReady.value || !sheet.value) return "";
- return getSheetStatement(sheet.value);
- },
- set(statement) {
- if (!sheetReady.value || !sheet.value) return;
- setSheetStatement(sheet.value, statement);
- },
- });
-
- return {
- sheet,
- sheetName,
- sheetReady,
- sheetStatement,
- };
-};
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue
deleted file mode 100644
index d71e4e81a7..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/CurrentTaskSection.vue
+++ /dev/null
@@ -1,148 +0,0 @@
-<template>
- <div class="px-4 py-2 flex flex-row items-center gap-x-4">
- <span class="textlabel">{{ $t("task.current-task") }}</span>
- <div class="flex items-center flex-wrap gap-1">
- <InstanceV1Name
- v-if="databaseCreationStatus === 'EXISTED'"
- :instance="coreDatabaseInfo.instanceResource"
- :plain="true"
- :link="link"
- >
- <template
- v-if="
- database &&
- formatEnvironmentName(instanceEnvironment.id) !==
- database.effectiveEnvironment
- "
- #prefix
- >
- <EnvironmentV1Name
- :environment="instanceEnvironment"
- :plain="true"
- :show-icon="false"
- :link="link"
- text-class="text-control-light"
- />
- </template>
- </InstanceV1Name>
- <span v-else>
- <!-- For creating database issues, we will only show the resource id of target instance. -->
- {{ extractInstanceResourceName(selectedTask.target) }}
- </span>
-
- <ChevronRightIcon class="text-control-light" :size="16" />
-
- <div class="flex items-center gap-x-1">
- <DatabaseIcon class="text-control-light" :size="16" />
-
- <template
- v-if="
- databaseCreationStatus === 'EXISTED' ||
- databaseCreationStatus === 'CREATED'
- "
- >
- <EnvironmentV1Name
- :environment="coreDatabaseInfo.effectiveEnvironmentEntity"
- :plain="true"
- :show-icon="false"
- :link="link"
- text-class="text-control-light"
- />
-
- <DatabaseV1Name
- :database="coreDatabaseInfo"
- :plain="true"
- :link="link"
- :show-not-found="true"
- />
- </template>
- <span v-else>
- {{ coreDatabaseInfo.databaseName }}
- </span>
-
- <span
- v-if="databaseCreationStatus !== 'EXISTED'"
- class="text-control-light"
- >
- {{
- databaseCreationStatus === "CREATED"
- ? $t("task.database-create.created")
- : $t("task.database-create.pending")
- }}
- </span>
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computedAsync } from "@vueuse/core";
-import { ChevronRightIcon, DatabaseIcon } from "lucide-vue-next";
-import { computed } from "vue";
-import { useIssueContext } from "@/components/IssueV1/logic";
-import {
- DatabaseV1Name,
- EnvironmentV1Name,
- InstanceV1Name,
-} from "@/components/v2";
-import {
- useCurrentProjectV1,
- useDatabaseV1Store,
- useEnvironmentV1Store,
-} from "@/store";
-import { formatEnvironmentName, isValidDatabaseName } from "@/types";
-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, extractInstanceResourceName } from "@/utils";
-
-type DatabaseCreationStatus = "EXISTED" | "PENDING_CREATE" | "CREATED";
-
-withDefaults(
- defineProps<{
- link?: boolean;
- }>(),
- {
- link: true,
- }
-);
-
-const { selectedTask } = useIssueContext();
-const { project } = useCurrentProjectV1();
-
-const coreDatabaseInfo = computed(() => {
- return databaseForTask(project.value, selectedTask.value);
-});
-
-const databaseCreationStatus = computed((): DatabaseCreationStatus => {
- const task = selectedTask.value;
-
- // For database create task, see if its task status is "DONE"
- if (task.type === Task_Type.DATABASE_CREATE) {
- if (task.status === Task_Status.DONE) return "CREATED";
- else return "PENDING_CREATE";
- }
-
- return "EXISTED";
-});
-
-const database = computedAsync(async () => {
- const maybeExistedDatabase = coreDatabaseInfo.value;
- if (isValidDatabaseName(maybeExistedDatabase.name)) {
- return maybeExistedDatabase;
- }
- if (databaseCreationStatus.value === "CREATED") {
- const name = coreDatabaseInfo.value.name;
- const maybeCreatedDatabase =
- await useDatabaseV1Store().getOrFetchDatabaseByName(name);
- if (isValidDatabaseName(maybeCreatedDatabase.name)) {
- return maybeCreatedDatabase;
- }
- }
- return undefined;
-}, undefined);
-
-const instanceEnvironment = computed(() => {
- return useEnvironmentV1Store().getEnvironmentByName(
- database.value?.instanceResource.environment ?? ""
- );
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
deleted file mode 100644
index d0e1c83c43..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskCard.vue
+++ /dev/null
@@ -1,123 +0,0 @@
-<template>
- <div
- :class="
- twMerge(
- 'task',
- 'group px-1.5 py-1 cursor-pointer border rounded-sm lg:flex-1 flex justify-between items-stretch overflow-hidden gap-x-1',
- taskClass
- )
- "
- :data-task-name="isCreating ? '-creating-' : task.name"
- @click="onClickTask(task)"
- >
- <div class="w-full flex-1 flex flex-col gap-y-1">
- <div class="w-full flex items-start gap-1">
- <div class="w-full flex items-center flex-1 gap-x-1 overflow-x-auto">
- <TaskStatusIcon
- :status="task.status"
- :task="task"
- class="transform scale-75"
- />
- <span class="name">{{ database.databaseName }}</span>
- <router-link
- class="hidden group-hover:block hover:opacity-80"
- v-if="
- task.type !== Task_Type.DATABASE_CREATE &&
- isValidDatabaseName(database.name)
- "
- :to="databaseV1Url(database)"
- target="_blank"
- >
- <ExternalLinkIcon :size="16" />
- </router-link>
- <NTooltip v-if="showGhostTag">
- <template #trigger>
- <NTag size="small" round type="primary">gh-ost</NTag>
- </template>
- <span>{{ $t("task.online-migration.self") }}</span>
- </NTooltip>
- </div>
- <TaskExtraActionsButton :task="task" />
- </div>
- <div class="flex items-center justify-between px-1 text-sm">
- <div class="flex flex-1 items-center whitespace-pre-wrap">
- <InstanceV1Name :instance="instance" :link="false" />
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script setup lang="ts">
-import { ExternalLinkIcon } from "lucide-vue-next";
-import { NTag, NTooltip } from "naive-ui";
-import { twMerge } from "tailwind-merge";
-import { computed } from "vue";
-import { InstanceV1Name } from "@/components/v2";
-import { useCurrentProjectV1 } from "@/store";
-import { isValidDatabaseName } from "@/types";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, databaseV1Url } from "@/utils";
-import { specForTask, useInstanceForTask, useIssueContext } from "../../logic";
-import TaskStatusIcon from "../TaskStatusIcon.vue";
-import TaskExtraActionsButton from "./TaskExtraActionsButton.vue";
-
-const props = defineProps<{
- task: Task;
-}>();
-
-const { isCreating, issue, selectedTask, events } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const selected = computed(() => props.task === selectedTask.value);
-
-const showGhostTag = computed(() => {
- const spec = specForTask(issue.value.planEntity, props.task);
- return (
- spec?.config?.case === "changeDatabaseConfig" &&
- !spec.config.value?.release &&
- spec.config.value?.enableGhost === true
- );
-});
-
-const taskClass = computed(() => {
- const { task } = props;
- const classes: string[] = [];
- if (selected.value) classes.push("selected");
- if (isCreating.value) classes.push("create");
- classes.push(`status_${Task_Status[task.status].toLowerCase()}`);
- return classes;
-});
-
-const database = computed(() => databaseForTask(project.value, props.task));
-const { instance } = useInstanceForTask(props.task);
-
-const onClickTask = (task: Task) => {
- events.emit("select-task", { task });
-};
-</script>
-
-<style scoped lang="postcss">
-.task.selected {
- border-color: var(--color-info);
- background-color: var(--color-info);
- background-opacity: 0.05;
-}
-.task .name {
- white-space: nowrap;
- word-break: break-all;
-}
-.task.status_done .name {
- color: var(--color-control);
-}
-.task.status_pending .name,
-.task.status_not_started .name {
- color: var(--color-control);
-}
-.task.status_running .name {
- color: var(--color-info);
-}
-.task.status_failed .name {
- color: var(--color-red-500);
-}
-</style>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue
deleted file mode 100644
index 940c2bcd69..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskExtraActionsButton.vue
+++ /dev/null
@@ -1,113 +0,0 @@
-<template>
- <NDropdown
- v-if="options.length > 0"
- trigger="click"
- placement="bottom-end"
- :options="options"
- :render-option="renderOption"
- @select="handleSelect"
- >
- <NButton
- quaternary
- size="tiny"
- style="--n-padding: 0 1px; --n-icon-size: 20px"
- @click="($event) => $event.stopPropagation()"
- >
- <template #icon>
- <heroicons:ellipsis-vertical-solid class="w-5 h-5" />
- </template>
- </NButton>
- </NDropdown>
-</template>
-
-<script setup lang="ts">
-import type { DropdownOption } from "naive-ui";
-import { NButton, NDropdown } from "naive-ui";
-import type { VNode } from "vue";
-import { computed, h } from "vue";
-import { useI18n } from "vue-i18n";
-import type { TaskRolloutAction } from "@/components/IssueV1/logic";
-import {
- getApplicableTaskRolloutActionList,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { canRolloutTasks } from "@/components/RolloutV1/components/taskPermissions";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { DropdownItemWithErrorList } from "../common";
-
-type ExtraTaskRolloutActionDropdownOption = DropdownOption & {
- action: TaskRolloutAction;
- tasks: Task[];
-};
-
-const props = defineProps<{
- task: Task;
-}>();
-
-const { t } = useI18n();
-const { events, isCreating, selectedTask, issue } = useIssueContext();
-
-const actionList = computed(() => {
- return getApplicableTaskRolloutActionList(
- issue.value,
- props.task,
- true /* allowSkipPendingTask */
- );
-});
-
-const allowUserToSkipTask = computed(() => {
- return canRolloutTasks([props.task], issue.value);
-});
-
-const options = computed((): ExtraTaskRolloutActionDropdownOption[] => {
- if (isCreating.value) {
- return [];
- }
- const { task } = props;
- if (task.name !== selectedTask.value.name) {
- return [];
- }
- const SKIP = actionList.value.includes("SKIP");
- if (!SKIP) {
- return [];
- }
- return [
- {
- key: "skip",
- label: t("task.skip"),
- action: "SKIP",
- tasks: [task],
- disabled: !allowUserToSkipTask.value,
- },
- ];
-});
-
-const renderOption = ({
- node,
- option,
-}: {
- node: VNode;
- option: DropdownOption;
-}) => {
- const errors = option.disabled
- ? [t("issue.error.you-are-not-allowed-to-perform-this-action")]
- : [];
- return h(
- DropdownItemWithErrorList,
- { errors },
- {
- default: () => node,
- }
- );
-};
-
-const handleSelect = (key: string) => {
- const option = options.value.find((opt) => opt.key === key);
- if (!option) return;
- const { action, tasks } = option;
- events.emit("perform-task-rollout-action", {
- action,
- tasks,
- });
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
deleted file mode 100644
index c0e5b238ac..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskFilter.vue
+++ /dev/null
@@ -1,124 +0,0 @@
-<template>
- <div class="w-full flex flex-row gap-4">
- <div class="flex items-center justify-between">
- <h3 class="textlabel">
- {{ $t("common.task", 2) }}
- <span>({{ taskList.length }})</span>
- </h3>
- </div>
- <div class="flex flex-row gap-2 items-center">
- <div
- class="bg-gray-50 pl-2 p-1 flex flex-row items-center rounded-full gap-1"
- >
- <span class="text-sm mr-1 text-gray-600">{{
- isCreating ? $t("issue.sql-check.sql-checks") : $t("task.task-checks")
- }}</span>
- <template v-for="status in ADVICE_STATUS_FILTERS" :key="status">
- <NTag
- v-if="getTaskCount(undefined, status) > 0"
- :disabled="disabled"
- :size="'small'"
- round
- checkable
- :checked="adviceStatusList.includes(status)"
- @update:checked="
- (checked) => {
- emit(
- 'update:adviceStatusList',
- checked
- ? [...adviceStatusList, status]
- : adviceStatusList.filter((s) => s !== status)
- );
- }
- "
- >
- <template #avatar>
- <AdviceStatusIcon :status="status" />
- </template>
- <span class="select-none">{{
- getTaskCount(undefined, status)
- }}</span>
- </NTag>
- </template>
- </div>
- <div
- v-if="!isCreating"
- class="bg-gray-50 pl-2 p-1 flex flex-row items-center rounded-full gap-1"
- >
- <span class="text-sm mr-1 text-gray-600">{{
- $t("common.status")
- }}</span>
- <template v-for="status in TASK_STATUS_FILTERS" :key="status">
- <NTag
- v-if="getTaskCount(status) > 0"
- :disabled="disabled"
- :size="'small'"
- round
- checkable
- :checked="taskStatusList.includes(status)"
- @update:checked="
- (checked) => {
- emit(
- 'update:taskStatusList',
- checked
- ? [...taskStatusList, status]
- : taskStatusList.filter((s) => s !== status)
- );
- }
- "
- >
- <template #avatar>
- <TaskStatusIconV1 :status="status" :size="'small'" />
- </template>
- <span class="select-none">{{ getTaskCount(status) }}</span>
- </NTag>
- </template>
- </div>
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { NTag } from "naive-ui";
-import { computed } from "vue";
-import AdviceStatusIcon from "@/components/Plan/components/SQLCheckSection/AdviceStatusIcon.vue";
-import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { useIssueContext } from "../../logic";
-import TaskStatusIconV1 from "../TaskStatusIconV1.vue";
-import { filterTask } from "./filter";
-
-defineProps<{
- disabled: boolean;
- taskStatusList: Task_Status[];
- adviceStatusList: Advice_Level[];
-}>();
-
-const emit = defineEmits<{
- (event: "update:taskStatusList", taskStatusList: Task_Status[]): void;
- (event: "update:adviceStatusList", adviceStatusList: Advice_Level[]): void;
-}>();
-
-// Using unified task status filters from constants
-const ADVICE_STATUS_FILTERS: Advice_Level[] = [
- Advice_Level.ADVICE_LEVEL_UNSPECIFIED,
- Advice_Level.SUCCESS,
- Advice_Level.WARNING,
- Advice_Level.ERROR,
-];
-
-const issueContext = useIssueContext();
-const { resultMap } = usePlanSQLCheckContext();
-
-const { isCreating, selectedStage } = issueContext;
-
-const taskList = computed(() => selectedStage.value.tasks);
-
-const getTaskCount = (status?: Task_Status, adviceStatus?: Advice_Level) => {
- return taskList.value.filter((task) =>
- filterTask(issueContext, resultMap.value, task, { status, adviceStatus })
- ).length;
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
deleted file mode 100644
index 9d0c891f35..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskListSection.vue
+++ /dev/null
@@ -1,270 +0,0 @@
-<template>
- <div class="relative">
- <div
- v-if="shouldShowTaskFilter"
- class="w-full sticky top-0 z-10 bg-white px-4 pt-2 pb-1"
- >
- <TaskFilter
- :disabled="stageState.isRequesting || !stageState.initialized"
- :task-status-list="stageState.taskStatusFilters"
- :advice-status-list="stageState.adviceStatusFilters"
- @update:advice-status-list="
- (adviceStatusFilters) => updateStageState({ adviceStatusFilters })
- "
- @update:task-status-list="
- (taskStatusFilters) => updateStageState({ taskStatusFilters })
- "
- />
- </div>
- <div class="relative w-full">
- <div
- v-if="!stageState.initialized && stageState.isRequesting"
- class="w-full flex items-center justify-center py-8"
- >
- <BBSpin />
- </div>
- <div
- ref="taskBar"
- class="task-list gap-2 px-4 py-2 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 3xl:grid-cols-5 4xl:grid-cols-6 overflow-y-auto"
- :class="{
- 'more-bottom': taskBarScrollState.bottom,
- 'more-top': taskBarScrollState.top,
- }"
- :style="{
- 'max-height': `${MAX_LIST_HEIGHT}px`,
- }"
- >
- <TaskCard
- v-for="(task, i) in filteredTaskList.slice(0, stageState.index)"
- :key="i"
- :task="task"
- />
- <div
- v-if="filteredTaskList.length > stageState.index"
- class="col-span-full flex flex-row items-center justify-end"
- >
- <NButton
- size="small"
- quaternary
- :loading="stageState.isRequesting"
- @click="loadNextPage"
- >
- {{ $t("common.load-more") }}
- </NButton>
- </div>
- </div>
- </div>
- </div>
-
- <CurrentTaskSection v-if="shouldShowCurrentTaskView" />
-</template>
-
-<script lang="ts" setup>
-import { useDebounceFn } from "@vueuse/core";
-import { NButton } from "naive-ui";
-import { computed, reactive, ref, watch } from "vue";
-import { BBSpin } from "@/bbkit";
-import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { useVerticalScrollState } from "@/composables/useScrollState";
-import { useCurrentProjectV1, useDatabaseV1Store } from "@/store";
-import { DEBOUNCE_SEARCH_DELAY } from "@/types";
-import type { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import type { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { databaseForTask, isDev } from "@/utils";
-import { useIssueContext } from "../../logic";
-import CurrentTaskSection from "./CurrentTaskSection.vue";
-import { filterTask } from "./filter";
-import TaskCard from "./TaskCard.vue";
-import TaskFilter from "./TaskFilter.vue";
-
-interface StageState {
- // Index is the current number of tasks to show.
- index: number;
- initialized: boolean;
- taskStatusFilters: Task_Status[];
- adviceStatusFilters: Advice_Level[];
- isRequesting: boolean;
-}
-
-interface LocalState {
- pageStatePerStage: Map<string, StageState>;
-}
-
-const MAX_LIST_HEIGHT = 256;
-
-// The default number of tasks to show per page.
-// This is set to 4 in development mode for easier testing.
-const TASK_PER_PAGE = isDev() ? 4 : 20;
-
-const state = reactive<LocalState>({
- pageStatePerStage: new Map<string, StageState>(),
-});
-
-const issueContext = useIssueContext();
-const { selectedStage, selectedTask } = issueContext;
-const { project } = useCurrentProjectV1();
-const { resultMap } = usePlanSQLCheckContext();
-const taskBar = ref<HTMLDivElement>();
-const taskBarScrollState = useVerticalScrollState(taskBar, MAX_LIST_HEIGHT);
-const dbStore = useDatabaseV1Store();
-
-const taskList = computed(() => {
- return selectedStage.value.tasks;
-});
-
-const stageState = computed(
- () =>
- state.pageStatePerStage.get(selectedStage.value.name) ?? {
- index: 0,
- initialized: false,
- taskStatusFilters: [],
- adviceStatusFilters: [],
- isRequesting: false,
- }
-);
-
-const updateStageState = (patch: Partial<StageState>) => {
- state.pageStatePerStage.set(selectedStage.value.name, {
- ...stageState.value,
- ...patch,
- });
-};
-
-const filteredTaskList = computed(() => {
- return taskList.value.filter((task) => {
- if (stageState.value.taskStatusFilters.length > 0) {
- if (!stageState.value.taskStatusFilters.includes(task.status)) {
- return false;
- }
- }
- if (stageState.value.adviceStatusFilters.length > 0) {
- if (
- !stageState.value.adviceStatusFilters.some((status) =>
- filterTask(issueContext, resultMap.value, task, {
- adviceStatus: status,
- })
- )
- ) {
- return false;
- }
- }
- return true;
- });
-});
-
-const shouldShowTaskFilter = computed(() => {
- return taskList.value.length > 10;
-});
-
-const shouldShowCurrentTaskView = computed(() => {
- if (stageState.value.index === 0) {
- return false;
- }
- // Only show the current task view when the selected task is not in the filtered task list.
- const visibleTasks = filteredTaskList.value.slice(0, stageState.value.index);
- return !visibleTasks.some((task) => task.name === selectedTask.value.name);
-});
-
-const loadMore = useDebounceFn(async () => {
- const fromIndex = stageState.value.index;
- const toIndex = fromIndex + TASK_PER_PAGE;
-
- const databaseNames = filteredTaskList.value
- .slice(fromIndex, toIndex)
- .map((task) => databaseForTask(project.value, task).name);
-
- try {
- await dbStore.batchGetOrFetchDatabases(databaseNames);
- } catch {
- // Ignore errors
- // If the issue type is create database,
- // the API will throw error cause it cannot found the pending created database.
- } finally {
- updateStageState({
- index: toIndex,
- initialized: true,
- });
- }
-}, DEBOUNCE_SEARCH_DELAY);
-
-const loadNextPage = async () => {
- if (stageState.value.isRequesting) {
- return;
- }
- updateStageState({
- isRequesting: true,
- });
- try {
- await loadMore();
- } catch {
- // Ignore errors
- } finally {
- updateStageState({
- isRequesting: false,
- });
- }
-};
-
-watch(
- [
- () => stageState.value.taskStatusFilters,
- () => stageState.value.adviceStatusFilters,
- ],
- async () => {
- // Reset the index when the filters change.
- if (!stageState.value.isRequesting && stageState.value.initialized) {
- updateStageState({
- index: 0,
- });
- await loadNextPage();
- }
- }
-);
-
-watch(
- () => selectedStage.value.name,
- async () => {
- if (!stageState.value.initialized) {
- await loadNextPage();
- }
- },
- { immediate: true }
-);
-</script>
-
-<style scoped lang="postcss">
-.task-list::before {
- position: absolute;
- top: 0;
- height: 1rem;
- width: 100%;
- margin-left: -1rem;
- z-index: 10;
- pointer-events: none;
- transition-property: box-shadow;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 150ms;
- content: "";
- box-shadow: none;
-}
-.task-list::after {
- position: absolute;
- bottom: 0;
- height: 1rem;
- width: 100%;
- margin-left: -1rem;
- z-index: 10;
- pointer-events: none;
- transition-property: box-shadow;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 150ms;
- content: "";
- box-shadow: none;
-}
-.task-list.more-top::before {
- box-shadow: inset 0 0.3rem 0.25rem -0.25rem rgb(0 0 0 / 10%);
-}
-.task-list.more-bottom::after {
- box-shadow: inset 0 -0.3rem 0.25rem -0.25rem rgb(0 0 0 / 10%);
-}
-</style>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue b/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue
deleted file mode 100644
index 25ff1fa17c..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/TaskProgress.vue
+++ /dev/null
@@ -1,27 +0,0 @@
-<template>
- <NProgress
- type="circle"
- :percentage="percent"
- style="width: 2.5rem"
- :stroke-width="10"
- >
- <span v-if="task.status === Task_Status.DONE">
- <heroicons-outline:check class="w-8 h-8 text-success" />
- </span>
- </NProgress>
-</template>
-
-<script setup lang="ts">
-import { NProgress } from "naive-ui";
-import { computed } from "vue";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-
-defineProps<{
- task: Task;
-}>();
-
-const percent = computed(() => {
- return 0; // TODO
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts b/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
deleted file mode 100644
index bbd1794a46..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/filter.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
-import type { CheckReleaseResponse_CheckResult } from "@/types/proto-es/v1/release_service_pb";
-import type { Task, Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import type { IssueContext } from "../../logic";
-
-export const filterTask = (
- issueContext: IssueContext,
- sqlCheckResultMap: Record<string, CheckReleaseResponse_CheckResult>,
- task: Task,
- {
- status,
- adviceStatus,
- }: {
- status?: Task_Status;
- adviceStatus?: Advice_Level;
- }
-): boolean => {
- const { isCreating, getPlanCheckRunsForTask } = issueContext;
- if (status) {
- return task.status === status;
- }
- if (adviceStatus !== undefined) {
- if (isCreating.value) {
- const result = sqlCheckResultMap[task.target];
- if (adviceStatus === Advice_Level.ADVICE_LEVEL_UNSPECIFIED) {
- return !Boolean(result);
- }
- if (adviceStatus === Advice_Level.SUCCESS) {
- return result && result.advices.length === 0;
- }
- return (
- result &&
- result.advices.some((advice) => advice.status === adviceStatus)
- );
- } else {
- const checkRuns = getPlanCheckRunsForTask(task);
- const summary = planCheckRunSummaryForCheckRunList(checkRuns);
- if (summary.errorCount > 0) {
- return adviceStatus === Advice_Level.ERROR;
- } else if (summary.warnCount > 0) {
- return adviceStatus === Advice_Level.WARNING;
- } else {
- return adviceStatus === Advice_Level.SUCCESS;
- }
- }
- }
-
- return false;
-};
diff --git a/frontend/src/components/IssueV1/components/TaskListSection/index.ts b/frontend/src/components/IssueV1/components/TaskListSection/index.ts
deleted file mode 100644
index a3894328e7..0000000000
--- a/frontend/src/components/IssueV1/components/TaskListSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import TaskListSection from "./TaskListSection.vue";
-
-export default TaskListSection;
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
deleted file mode 100644
index 7b8df47779..0000000000
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue
+++ /dev/null
@@ -1,123 +0,0 @@
-<template>
- <div class="flex flex-col xl:flex-row xl:items-center xl:gap-x-1">
- <NEllipsis expand-trigger="click" line-clamp="2" :tooltip="false">
- <span>{{ comment }}</span>
- </NEllipsis>
- <template v-if="commentLink.link">
- <router-link
- v-if="commentLink.link.startsWith('/')"
- class="inline normal-link shrink-0"
- :to="commentLink.link"
- >
- {{ commentLink.title }}
- </router-link>
- <a
- v-else
- class="inline normal-link shrink-0"
- :href="commentLink.link"
- target="_blank"
- rel="noopener noreferrer"
- >
- {{ commentLink.title }}
- </a>
- </template>
- </div>
-</template>
-
-<script setup lang="tsx">
-import { last } from "lodash-es";
-import { NEllipsis } from "naive-ui";
-import { computed } from "vue";
-import { useI18n } from "vue-i18n";
-import { useCurrentProjectV1 } from "@/store";
-import { useTaskRunLogStore } from "@/store/modules/v1/taskRunLog";
-import {
- getDateForPbTimestampProtoEs,
- getTimeForPbTimestampProtoEs,
- unknownTask,
-} from "@/types";
-import type { TaskRun } from "@/types/proto-es/v1/rollout_service_pb";
-import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { isPostgresFamily } from "@/types/v1/instance";
-import { databaseForTask, extractTaskUID, flattenTaskV1List } from "@/utils";
-import { displayTaskRunLogEntryType } from "@/utils/v1/taskRunLog";
-import { useIssueContext } from "../../logic";
-
-export type CommentLink = {
- title: string;
- link: string;
-};
-
-const props = defineProps<{
- taskRun: TaskRun;
-}>();
-
-const { issue } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const { t } = useI18n();
-const taskRunLogStore = useTaskRunLogStore();
-
-const earliestAllowedTime = computed(() => {
- return props.taskRun.runTime
- ? getTimeForPbTimestampProtoEs(props.taskRun.runTime)
- : null;
-});
-
-const comment = computed(() => {
- const { taskRun } = props;
- if (taskRun.status === TaskRun_Status.PENDING) {
- if (earliestAllowedTime.value) {
- return t("task-run.status.enqueued-with-rollout-time", {
- time: new Date(earliestAllowedTime.value).toLocaleString(),
- });
- }
- return t("task-run.status.enqueued");
- } else if (taskRun.status === TaskRun_Status.RUNNING) {
- if (taskRun.schedulerInfo) {
- const cause = taskRun.schedulerInfo.waitingCause;
- if (cause?.cause?.case === "parallelTasksLimit") {
- return t("task-run.status.waiting-max-tasks-per-rollout", {
- time: getDateForPbTimestampProtoEs(
- taskRun.schedulerInfo.reportTime
- )?.toLocaleString(),
- });
- }
- }
-
- const taskRunLog = taskRunLogStore.getTaskRunLog(taskRun.name);
- const lastLogEntry = last(taskRunLog.entries);
- if (lastLogEntry) {
- return displayTaskRunLogEntryType(lastLogEntry.type);
- }
- }
- return taskRun.detail || "-";
-});
-
-const commentLink = computed((): CommentLink => {
- const { taskRun } = props;
- const taskUID = extractTaskUID(taskRun.name);
- const task =
- flattenTaskV1List(issue.value.rolloutEntity).find(
- (task) => extractTaskUID(task.name) === taskUID
- ) ?? unknownTask();
- if (taskRun.status === TaskRun_Status.FAILED) {
- const db = databaseForTask(project.value, task);
- // Cast a wide net to catch migration version error
- if (comment.value.includes("version")) {
- return {
- title: t("common.troubleshoot"),
- link: "https://docs.bytebase.com/change-database/troubleshoot/?source=console#duplicate-version",
- };
- } else if (isPostgresFamily(db.instanceResource.engine)) {
- return {
- title: t("common.troubleshoot"),
- link: "https://docs.bytebase.com/change-database/troubleshoot/?source=console#postgresql",
- };
- }
- }
- return {
- title: "",
- link: "",
- };
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
deleted file mode 100644
index ea5092f71b..0000000000
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunSection.vue
+++ /dev/null
@@ -1,35 +0,0 @@
-<template>
- <div
- v-if="flattenTaskRunList.length > 0"
- class="px-4 py-2 flex flex-col gap-y-4"
- >
- <TaskRunTable :task-run-list="flattenTaskRunList" />
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed, watchEffect } from "vue";
-import {
- taskRunListForTask,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { useTaskRunLogStore } from "@/store/modules/v1/taskRunLog";
-import { TaskRun_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import TaskRunTable from "./TaskRunTable.vue";
-
-const { issue, selectedTask } = useIssueContext();
-const taskRunLogStore = useTaskRunLogStore();
-
-const flattenTaskRunList = computed(() => {
- return taskRunListForTask(issue.value, selectedTask.value);
-});
-
-watchEffect(async () => {
- // Fetching the latest task run log for running task runs of selected task.
- for (const taskRun of flattenTaskRunList.value) {
- if (taskRun.status === TaskRun_Status.RUNNING) {
- await taskRunLogStore.fetchTaskRunLog(taskRun.name);
- }
- }
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
deleted file mode 100644
index bf8626b50f..0000000000
--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunTable.vue
+++ /dev/null
@@ -1,170 +0,0 @@
-<template>
- <NDataTable
- size="small"
- :row-key="rowKey"
- :columns="columnList"
- :data="taskRunList"
- />
-
- <Drawer v-model:show="taskRunDetailContext.show">
- <DrawerContent
- :title="$t('common.detail')"
- style="width: calc(100vw - 14rem)"
- >
- <TaskRunDetail
- v-if="taskRunDetailContext.taskRun"
- :key="taskRunDetailContext.taskRun.name"
- :task-run="taskRunDetailContext.taskRun"
- :database="databaseForTask(project, selectedTask)"
- />
- </DrawerContent>
- </Drawer>
-</template>
-
-<script lang="tsx" setup>
-import { create } from "@bufbuild/protobuf";
-import { type Duration, DurationSchema } from "@bufbuild/protobuf/wkt";
-import { type DataTableColumn, NButton, NDataTable } from "naive-ui";
-import { computed, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import HumanizeDate from "@/components/misc/HumanizeDate.vue";
-import TaskRunDetail from "@/components/RolloutV1/components/TaskRunDetail.vue";
-import TaskRunStatusIcon from "@/components/RolloutV1/components/TaskRunStatusIcon.vue";
-import { Drawer, DrawerContent } from "@/components/v2";
-import { useCurrentProjectV1 } from "@/store";
-import {
- getDateForPbTimestampProtoEs,
- getTimeForPbTimestampProtoEs,
-} from "@/types";
-import {
- type TaskRun,
- TaskRun_Status,
-} from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, humanizeDurationV1 } from "@/utils";
-import { useIssueContext } from "../../logic";
-import TaskRunComment from "./TaskRunComment.vue";
-
-defineOptions({
- inheritAttrs: false,
-});
-
-defineProps<{
- taskRunList: TaskRun[];
-}>();
-
-const { t } = useI18n();
-const { project } = useCurrentProjectV1();
-const { selectedTask } = useIssueContext();
-
-const taskRunDetailContext = ref<{
- show: boolean;
- taskRun?: TaskRun;
-}>({
- show: false,
-});
-
-const rowKey = (taskRun: TaskRun) => {
- return taskRun.name;
-};
-
-const columnList = computed((): DataTableColumn<TaskRun>[] => {
- return [
- {
- key: "status",
- title: "",
- width: 30,
- render: (taskRun: TaskRun) => (
- <TaskRunStatusIcon status={taskRun.status} />
- ),
- },
- {
- key: "comment",
- title: t("task.comment"),
- width: "60%",
- className: "",
- minWidth: 140,
- resizable: true,
- render: (taskRun: TaskRun) => (
- <div class="flex flex-row justify-start items-center">
- <TaskRunComment taskRun={taskRun} />
- </div>
- ),
- },
- {
- key: "createTime",
- title: t("task.created"),
- width: 100,
- render: (taskRun: TaskRun) => (
- <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.createTime)} />
- ),
- },
- {
- key: "startTime",
- title: t("task.started"),
- width: 100,
- render: (taskRun: TaskRun) => (
- <HumanizeDate date={getDateForPbTimestampProtoEs(taskRun.startTime)} />
- ),
- },
- {
- key: "executionDuration",
- title: t("task.execution-time"),
- width: 120,
- render: (taskRun: TaskRun) => {
- return humanizeDurationV1(executionDurationOfTaskRun(taskRun));
- },
- },
- {
- key: "actions",
- title: "",
- width: 60,
- render: (taskRun: TaskRun) =>
- shouldShowDetailButton(taskRun) ? (
- <NButton size="tiny" onClick={() => showDetail(taskRun)}>
- {t("common.detail")}
- </NButton>
- ) : null,
- },
- ];
-});
-
-const executionDurationOfTaskRun = (taskRun: TaskRun): Duration | undefined => {
- const { startTime, updateTime } = taskRun;
- if (!startTime || !updateTime) {
- return undefined;
- }
- if (startTime.seconds === 0n) {
- return undefined;
- }
- if (taskRun.status === TaskRun_Status.RUNNING) {
- const elapsedMS = Date.now() - getTimeForPbTimestampProtoEs(startTime);
- return create(DurationSchema, {
- seconds: BigInt(Math.floor(elapsedMS / 1000)),
- nanos: (elapsedMS % 1000) * 1e6,
- });
- }
- const startMS = getTimeForPbTimestampProtoEs(startTime);
- const updateMS = getTimeForPbTimestampProtoEs(updateTime);
- const elapsedMS = updateMS - startMS;
- return create(DurationSchema, {
- seconds: BigInt(Math.floor(elapsedMS / 1000)),
- nanos: (elapsedMS % 1000) * 1e6,
- });
-};
-
-const shouldShowDetailButton = (taskRun: TaskRun) => {
- return [
- TaskRun_Status.RUNNING,
- TaskRun_Status.DONE,
- TaskRun_Status.FAILED,
- TaskRun_Status.CANCELED,
- ].includes(taskRun.status);
-};
-
-const showDetail = (taskRun: TaskRun) => {
- taskRunDetailContext.value = {
- show: true,
- taskRun,
- };
-};
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/index.ts b/frontend/src/components/IssueV1/components/TaskRunSection/index.ts
deleted file mode 100644
index 86345305d4..0000000000
--- a/frontend/src/components/IssueV1/components/TaskRunSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import TaskRunSection from "./TaskRunSection.vue";
-
-export default TaskRunSection;
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue b/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
deleted file mode 100644
index 0eb1cc9818..0000000000
--- a/frontend/src/components/IssueV1/components/TaskStatusIcon.vue
+++ /dev/null
@@ -1,132 +0,0 @@
-<template>
- <div
- class="relative flex shrink-0 items-center justify-center select-none w-6 h-6 overflow-hidden"
- :class="classes"
- >
- <template v-if="checkStatus === Advice_Level.ERROR">
- <CircleAlertIcon class="text-error" />
- </template>
- <template v-else-if="checkStatus === Advice_Level.WARNING">
- <TriangleAlertIcon class="text-warning" />
- </template>
- <template
- v-else-if="
- status === Task_Status.NOT_STARTED ||
- status === Task_Status.STATUS_UNSPECIFIED
- "
- >
- <heroicons-outline:user class="w-4 h-4" />
- </template>
- <template v-else-if="status === Task_Status.PENDING">
- <span class="h-1.5 w-1.5 bg-control rounded-full" aria-hidden="true" />
- </template>
- <template v-else-if="status === Task_Status.RUNNING">
- <div class="flex h-2.5 w-2.5 relative overflow-visible">
- <span
- class="w-full h-full rounded-full z-0 absolute animate-ping-slow"
- style="background-color: rgba(37, 99, 235, 0.5); /* bg-info/50 */"
- aria-hidden="true"
- />
- <span
- class="w-full h-full rounded-full z-1 bg-info"
- aria-hidden="true"
- />
- </div>
- </template>
- <template v-else-if="status === Task_Status.SKIPPED">
- <SkipIcon class="w-5 h-5" />
- </template>
- <template v-else-if="status === Task_Status.DONE">
- <heroicons-solid:check class="w-5 h-5" />
- </template>
- <template v-else-if="status === Task_Status.FAILED">
- <span
- class="h-2.5 w-2.5 rounded-full text-center pb-6 font-medium text-base"
- aria-hidden="true"
- >!</span
- >
- </template>
- <template v-else-if="status === Task_Status.CANCELED">
- <heroicons-solid:minus-sm
- class="w-6 h-6 rounded-full select-none bg-white border-2 border-gray-400 text-gray-400"
- />
- </template>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { CircleAlertIcon, TriangleAlertIcon } from "lucide-vue-next";
-import { computed } from "vue";
-import { SkipIcon } from "@/components/Icon";
-import { usePlanSQLCheckContext } from "@/components/Plan/components/SQLCheckSection/context";
-import { useCurrentProjectV1 } from "@/store";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { databaseForTask } from "@/utils";
-import { planCheckStatusForTask, useIssueContext } from "../logic";
-
-const props = defineProps<{
- status: Task_Status;
- task?: Task;
- ignoreCheckStatus?: boolean;
-}>();
-
-const { isCreating } = useIssueContext();
-const { project } = useCurrentProjectV1();
-const { resultMap } = usePlanSQLCheckContext();
-
-const checkStatus = computed(() => {
- if (props.ignoreCheckStatus) return undefined;
- if (!props.task) return undefined;
- if (isCreating.value) {
- const checkResult =
- resultMap.value[databaseForTask(project.value, props.task).name];
- if (!checkResult) return undefined;
-
- if (
- checkResult.advices.some((advice) => advice.status === Advice_Level.ERROR)
- ) {
- return Advice_Level.ERROR;
- } else if (
- checkResult.advices.some(
- (advice) => advice.status === Advice_Level.WARNING
- )
- ) {
- return Advice_Level.WARNING;
- }
- return undefined;
- }
- return planCheckStatusForTask(props.task);
-});
-
-const classes = computed((): string => {
- if (Boolean(checkStatus.value)) {
- return "";
- }
-
- switch (props.status) {
- case Task_Status.NOT_STARTED:
- case Task_Status.STATUS_UNSPECIFIED:
- if (!isCreating.value) {
- return "bg-white border-2 border-info text-info rounded-full";
- }
- return "bg-white border-2 border-control rounded-full";
- case Task_Status.PENDING:
- if (!isCreating.value) {
- return "bg-white border-2 border-info text-info rounded-full";
- }
- return "bg-white border-2 border-control rounded-full";
- case Task_Status.RUNNING:
- return "bg-white border-2 border-info text-info rounded-full";
- case Task_Status.SKIPPED:
- return "bg-gray-200 text-gray-500 rounded-full";
- case Task_Status.DONE:
- return "bg-success text-white rounded-full";
- case Task_Status.FAILED:
- return "bg-error text-white rounded-full";
- default:
- return "";
- }
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue b/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
deleted file mode 100644
index 05f9b023fb..0000000000
--- a/frontend/src/components/IssueV1/components/TaskStatusIconV1.vue
+++ /dev/null
@@ -1,120 +0,0 @@
-<template>
- <NTooltip :disabled="!showTooltip">
- <template #trigger>
- <div
- class="relative flex shrink-0 items-center justify-center select-none overflow-hidden"
- :class="[classes, containerSize]"
- >
- <template
- v-if="
- status === Task_Status.NOT_STARTED ||
- status === Task_Status.STATUS_UNSPECIFIED
- "
- >
- <heroicons-outline:user class="w-4 h-4" />
- </template>
- <template v-else-if="status === Task_Status.PENDING">
- <span
- class="h-1.5 w-1.5 bg-control rounded-full"
- aria-hidden="true"
- />
- </template>
- <template v-else-if="status === Task_Status.RUNNING">
- <div class="flex h-2.5 w-2.5 relative overflow-visible">
- <span
- class="w-full h-full rounded-full z-0 absolute animate-ping-slow"
- style="background-color: rgba(37, 99, 235, 0.5); /* bg-info/50 */"
- aria-hidden="true"
- />
- <span
- class="w-full h-full rounded-full z-1 bg-info"
- aria-hidden="true"
- />
- </div>
- </template>
- <template v-else-if="status === Task_Status.SKIPPED">
- <SkipIcon class="w-5 h-5" />
- </template>
- <template v-else-if="status === Task_Status.DONE">
- <heroicons-solid:check class="w-5 h-5" />
- </template>
- <template v-else-if="status === Task_Status.FAILED">
- <span
- class="h-2.5 w-2.5 rounded-full text-center pb-6 font-medium text-base"
- aria-hidden="true"
- >!</span
- >
- </template>
- <template v-else-if="status === Task_Status.CANCELED">
- <heroicons-solid:minus-sm
- class="rounded-full select-none bg-white border-2 border-gray-400 text-gray-400"
- :class="containerSize"
- />
- </template>
- </div>
- </template>
- {{ Task_Status[status] }}
- </NTooltip>
-</template>
-
-<script lang="ts" setup>
-import { NTooltip } from "naive-ui";
-import { computed } from "vue";
-import { SkipIcon } from "@/components/Icon";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { useIssueContext } from "../logic";
-
-const props = withDefaults(
- defineProps<{
- status: Task_Status;
- size?: "small" | "medium" | "large";
- showTooltip?: boolean;
- }>(),
- {
- size: "medium",
- showTooltip: true,
- }
-);
-
-const { isCreating } = useIssueContext();
-
-const containerSize = computed((): string => {
- switch (props.size) {
- case "small":
- return "w-4 h-4";
- case "medium":
- return "w-6 h-6";
- case "large":
- return "w-8 h-8";
- default:
- return "w-6 h-6";
- }
-});
-
-const classes = computed((): string => {
- const borderSize = props.size === "small" ? "border" : "border-2";
- switch (props.status) {
- case Task_Status.NOT_STARTED:
- case Task_Status.STATUS_UNSPECIFIED:
- if (!isCreating.value) {
- return `bg-white border-info text-info rounded-full ${borderSize}`;
- }
- return `bg-white border-control rounded-full ${borderSize}`;
- case Task_Status.PENDING:
- if (!isCreating.value) {
- return `bg-white border-info text-info rounded-full ${borderSize}`;
- }
- return `bg-white border-control rounded-full ${borderSize}`;
- case Task_Status.RUNNING:
- return `bg-white border-info text-info rounded-full ${borderSize}`;
- case Task_Status.SKIPPED:
- return "bg-gray-200 text-gray-500 rounded-full";
- case Task_Status.DONE:
- return "bg-success text-white rounded-full";
- case Task_Status.FAILED:
- return "bg-error text-white rounded-full";
- default:
- return "";
- }
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/common/DropdownItemWithErrorList.vue b/frontend/src/components/IssueV1/components/common/DropdownItemWithErrorList.vue
deleted file mode 100644
index 3de4e2e66e..0000000000
--- a/frontend/src/components/IssueV1/components/common/DropdownItemWithErrorList.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <NTooltip
- :disabled="errors.length === 0"
- :keep-alive-on-hover="false"
- style="width: max-content"
- >
- <template #trigger>
- <slot />
- </template>
- <template #default>
- <ErrorList :errors="errors" />
- </template>
- </NTooltip>
-</template>
-
-<script lang="ts" setup>
-import { NTooltip } from "naive-ui";
-import ErrorList from "./ErrorList.vue";
-
-defineProps<{
- errors: string[];
-}>();
-</script>
diff --git a/frontend/src/components/IssueV1/components/common/ErrorList.vue b/frontend/src/components/IssueV1/components/common/ErrorList.vue
deleted file mode 100644
index da82a653fe..0000000000
--- a/frontend/src/components/IssueV1/components/common/ErrorList.vue
+++ /dev/null
@@ -1,23 +0,0 @@
-<template>
- <ul
- class="flex flex-col whitespace-nowrap"
- :class="[errors.length > 1 && bullets && 'list-disc pl-4']"
- >
- <li v-for="(error, i) in errors" :key="i">
- <slot name="prefix" />
- {{ error }}
- </li>
- </ul>
-</template>
-
-<script setup lang="ts">
-withDefaults(
- defineProps<{
- errors: string[];
- bullets?: boolean;
- }>(),
- {
- bullets: true,
- }
-);
-</script>
diff --git a/frontend/src/components/IssueV1/components/common/index.ts b/frontend/src/components/IssueV1/components/common/index.ts
deleted file mode 100644
index 0cdc6f3693..0000000000
--- a/frontend/src/components/IssueV1/components/common/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import DropdownItemWithErrorList from "./DropdownItemWithErrorList.vue";
-import ErrorList from "./ErrorList.vue";
-import TaskSpinner from "./TaskSpinner.vue";
-
-export { ErrorList, DropdownItemWithErrorList, TaskSpinner };
diff --git a/frontend/src/components/IssueV1/components/index.ts b/frontend/src/components/IssueV1/components/index.ts
index 4118ec3646..98572530ee 100644
--- a/frontend/src/components/IssueV1/components/index.ts
+++ b/frontend/src/components/IssueV1/components/index.ts
@@ -1,27 +1,5 @@
-import BannerSection from "./BannerSection.vue";
-import DescriptionSection from "./DescriptionSection";
-import HeaderSection from "./HeaderSection";
-import IssueCommentSection from "./IssueCommentSection";
import { IssueSearch } from "./IssueSearch";
-import PlanCheckSection from "./PlanCheckSection";
-import Sidebar from "./Sidebar";
-import StageSection from "./StageSection";
-import StatementSection from "./StatementSection";
-import TaskListSection from "./TaskListSection";
-import TaskRunSection from "./TaskRunSection";
-export * from "./Panel";
export * from "./GrantRequest";
-export {
- BannerSection,
- HeaderSection,
- StageSection,
- TaskListSection,
- TaskRunSection,
- PlanCheckSection,
- StatementSection,
- DescriptionSection,
- IssueSearch,
- Sidebar,
- IssueCommentSection,
-};
+export * from "./Panel";
+export { IssueSearch };
diff --git a/frontend/src/components/IssueV1/index.ts b/frontend/src/components/IssueV1/index.ts
deleted file mode 100644
index 5607abf290..0000000000
--- a/frontend/src/components/IssueV1/index.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import GrantRequestIssueDetailPage from "./GrantRequestIssueDetailPage.vue";
-import IssueDetailPage from "./IssueDetailPage.vue";
-
-export * from "./logic";
-
-export { IssueDetailPage, GrantRequestIssueDetailPage };
diff --git a/frontend/src/components/IssueV1/logic/action/index.ts b/frontend/src/components/IssueV1/logic/action/index.ts
deleted file mode 100644
index 7ff80e105b..0000000000
--- a/frontend/src/components/IssueV1/logic/action/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from "./review";
-export * from "./issue";
-export * from "./task";
-export * from "./stage";
diff --git a/frontend/src/components/IssueV1/logic/action/review.ts b/frontend/src/components/IssueV1/logic/action/review.ts
deleted file mode 100644
index 82e06837de..0000000000
--- a/frontend/src/components/IssueV1/logic/action/review.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { t } from "@/plugins/i18n";
-
-export type IssueReviewAction = "APPROVE" | "SEND_BACK" | "RE_REQUEST";
-
-export const issueReviewActionDisplayName = (action: IssueReviewAction) => {
- switch (action) {
- case "APPROVE":
- return t("common.approve");
- case "SEND_BACK":
- return t("common.reject");
- case "RE_REQUEST":
- return t("custom-approval.issue-review.re-request-review");
- }
-};
diff --git a/frontend/src/components/IssueV1/logic/action/stage.ts b/frontend/src/components/IssueV1/logic/action/stage.ts
deleted file mode 100644
index 23d18ba454..0000000000
--- a/frontend/src/components/IssueV1/logic/action/stage.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
-import type { TaskRolloutAction } from "./task";
-import { getApplicableTaskRolloutActionList } from "./task";
-
-export type StageRolloutAction = Extract<
- TaskRolloutAction,
- "ROLLOUT" | "CANCEL" | "RETRY" | "SKIP" | "RESTART"
->;
-export const StageRolloutActionList: StageRolloutAction[] = [
- "ROLLOUT",
- "CANCEL",
- "RETRY",
- "SKIP",
- "RESTART",
-];
-
-export const getApplicableStageRolloutActionList = (
- issue: ComposedIssue,
- stage: Stage,
- allowSkipPendingTasks = false // If set to true, only FAILED tasks can be skipped
-) => {
- if (issue.status !== IssueStatus.OPEN) {
- return [];
- }
-
- const applicableActionsMap: Record<StageRolloutAction, Task[]> = {
- ROLLOUT: [],
- CANCEL: [],
- RETRY: [],
- SKIP: [],
- RESTART: [],
- };
- stage.tasks.forEach((task) => {
- const actions = getApplicableTaskRolloutActionList(
- issue,
- task,
- allowSkipPendingTasks
- );
- StageRolloutActionList.forEach((action) => {
- if (actions.includes(action)) {
- applicableActionsMap[action].push(task);
- }
- });
- });
-
- const actions: { action: StageRolloutAction; tasks: Task[] }[] = [];
- StageRolloutActionList.forEach((action) => {
- const tasks = applicableActionsMap[action];
- if (tasks.length > 1) {
- actions.push({
- action,
- tasks,
- });
- }
- });
- return actions;
-};
diff --git a/frontend/src/components/IssueV1/logic/action/task.ts b/frontend/src/components/IssueV1/logic/action/task.ts
deleted file mode 100644
index d22805d142..0000000000
--- a/frontend/src/components/IssueV1/logic/action/task.ts
+++ /dev/null
@@ -1,116 +0,0 @@
-import { head } from "lodash-es";
-import type { ButtonProps } from "naive-ui";
-import { t } from "@/plugins/i18n";
-import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-
-export type TaskRolloutAction =
- | "ROLLOUT" // NOT_STARTED -> PENDING
- | "RETRY" // FAILED -> NOT_STARTED
- | "CANCEL" // ? -> CANCELLED
- | "SKIP" // ? -> SKIPPED
- | "RESTART"; // ? -> NOT_STARTED
-
-// Primary actions will be displayed as big buttons.
-export const PrimaryTaskRolloutActionList: TaskRolloutAction[] = [
- "ROLLOUT",
- "CANCEL",
- "RETRY",
- "RESTART",
-];
-
-// Secondary actions will be folded in the context menu.
-export const SecondaryTaskRolloutActionList: TaskRolloutAction[] = ["SKIP"];
-
-export const CancelableTaskTypeList: Task_Type[] = [Task_Type.DATABASE_MIGRATE];
-
-export const TaskRolloutActionMap: Record<Task_Status, TaskRolloutAction[]> = {
- [Task_Status.NOT_STARTED]: ["ROLLOUT", "SKIP"],
- [Task_Status.PENDING]: ["CANCEL"], // Only DDL/DML can be cancelled
- [Task_Status.RUNNING]: ["CANCEL"], // Only DDL/DML can be cancelled
- [Task_Status.SKIPPED]: [],
- [Task_Status.DONE]: [],
- [Task_Status.FAILED]: ["RETRY", "SKIP"],
- [Task_Status.CANCELED]: ["RESTART", "SKIP"],
-
- // Only to make TypeScript compiler happy
- [Task_Status.STATUS_UNSPECIFIED]: [],
-};
-
-export const getApplicableTaskRolloutActionList = (
- issue: ComposedIssue,
- task: Task,
- allowSkipPendingTask = false // If set to true, only FAILED tasks can be skipped
-): TaskRolloutAction[] => {
- if (issue.status !== IssueStatus.OPEN) {
- return [];
- }
- const list = TaskRolloutActionMap[task.status];
- return list.filter((action) => {
- if (action === "CANCEL") {
- return CancelableTaskTypeList.includes(task.type);
- }
- if (action === "SKIP") {
- if (task.status !== Task_Status.FAILED && !allowSkipPendingTask) {
- return false;
- }
- }
-
- return true;
- });
-};
-
-export const taskRolloutActionDisplayName = (
- action: TaskRolloutAction,
- task?: Task
-) => {
- switch (action) {
- case "ROLLOUT":
- return task?.type === Task_Type.DATABASE_EXPORT
- ? t("common.export")
- : t("common.rollout");
- case "CANCEL":
- return t("common.cancel");
- case "RETRY":
- return t("common.retry");
- case "RESTART":
- return t("common.restart");
- case "SKIP":
- return t("common.skip");
- }
-};
-
-export const taskRolloutActionDialogButtonName = (
- action: TaskRolloutAction,
- tasks: Task[]
-) => {
- if (action === "CANCEL") {
- // Avoiding [Cancel] [Cancel] button group scene
- return t("task.cancel-task", tasks.length);
- }
- return taskRolloutActionDisplayName(action, head(tasks));
-};
-
-export const taskRolloutActionButtonProps = (
- action: TaskRolloutAction
-): ButtonProps => {
- switch (action) {
- case "ROLLOUT":
- return {
- type: "primary",
- };
- case "RESTART":
- return {
- type: "primary",
- };
- case "RETRY":
- return {
- type: "primary",
- };
- }
- return {
- type: "default",
- };
-};
diff --git a/frontend/src/components/IssueV1/logic/base.ts b/frontend/src/components/IssueV1/logic/base.ts
deleted file mode 100644
index beb1eaa474..0000000000
--- a/frontend/src/components/IssueV1/logic/base.ts
+++ /dev/null
@@ -1,152 +0,0 @@
-import Emittery from "emittery";
-import { first, isEqual } from "lodash-es";
-import { computed, ref, watch } from "vue";
-import { useRoute, useRouter } from "vue-router";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
-import { emptyStage, emptyTask } from "@/types";
-import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
-import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- activeStageInRollout,
- activeTaskInStageV1,
- extractStageUID,
- extractTaskUID,
- flattenTaskV1List,
- indexOrUIDFromSlug,
- stageV1Slug,
- taskV1Slug,
- uidFromSlug,
-} from "@/utils";
-import type { IssueContext, IssueEvents } from "./context";
-import { planCheckRunListForTask } from "./plan-check";
-import { stageForTask } from "./utils";
-
-const state = {
- uid: -101,
-};
-export const nextUID = () => {
- return String(state.uid--);
-};
-
-export const useBaseIssueContext = (
- context: Pick<IssueContext, "isCreating" | "ready" | "issue">
-): Partial<IssueContext> => {
- const { isCreating, issue } = context;
- const route = useRoute();
- const router = useRouter();
-
- const events: IssueEvents = new Emittery();
-
- const rollout = computed(() => issue.value.rolloutEntity);
- const tasks = computed(() => flattenTaskV1List(rollout.value));
-
- const selectedStage = computed((): Stage => {
- const stageSlug = route.query.stage as string;
- const taskSlug = route.query.task as string;
- const stageList = rollout.value?.stages || [];
-
- // Stage slug is now always the environment ID
- if (stageSlug) {
- const stageFound = stageList.find(
- (stage) => extractStageUID(stage.name) === stageSlug
- );
- if (stageFound) {
- return stageFound;
- }
- } else if (taskSlug) {
- const taskUID = String(uidFromSlug(taskSlug));
- for (const stage of stageList) {
- if (
- stage.tasks.findIndex(
- (task) => extractTaskUID(task.name) === taskUID
- ) >= 0
- ) {
- return stage;
- }
- }
- }
-
- // fallback
- if (isCreating.value) {
- return first(stageList) ?? emptyStage();
- }
- return activeStageInRollout(rollout.value);
- });
- const selectedTask = computed((): Task => {
- const taskSlug = route.query.task as string;
- const { tasks } = selectedStage.value;
- // Index is used when `isCreating === true`
- // UID is used when otherwise
- if (taskSlug) {
- const indexOrUID = indexOrUIDFromSlug(taskSlug);
- if (isCreating.value) {
- if (indexOrUID < tasks.length) {
- return tasks[indexOrUID];
- }
- } else {
- const taskFound = tasks.find(
- (task) => extractTaskUID(task.name) === String(indexOrUID)
- );
- if (taskFound) {
- return taskFound;
- }
- }
- }
-
- // fallback
- if (isCreating.value) {
- return first(tasks) ?? emptyTask();
- }
- return activeTaskInStageV1(selectedStage.value);
- });
-
- events.on("select-task", ({ task }) => {
- const stage = stageForTask(issue.value, task);
- if (!stage) return;
- // Always use stage slug (environment ID)
- const stageParam = stageV1Slug(stage);
- const taskParam = isCreating.value
- ? String(stage.tasks.indexOf(task))
- : taskV1Slug(task);
-
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- query: {
- ...route.query,
- stage: stageParam,
- task: taskParam,
- },
- hash: route.hash,
- });
- });
-
- const planCheckRunMapForTask = ref<Map<string, PlanCheckRun[]>>(new Map());
-
- const getPlanCheckRunsForTask = (task: Task) => {
- return planCheckRunMapForTask.value.get(task.name) || [];
- };
-
- watch(
- () => issue.value,
- (now, old) => {
- // Only recompute planCheckRunMapForTask when planCheckRunList changes.
- if (isEqual(old?.planCheckRunList, now.planCheckRunList)) return;
- const cacheMap = new Map<string, PlanCheckRun[]>();
- for (const task of tasks.value) {
- cacheMap.set(task.name, planCheckRunListForTask(issue.value, task));
- }
- planCheckRunMapForTask.value = cacheMap;
- },
- {
- deep: true,
- immediate: true,
- }
- );
-
- return {
- events,
- selectedStage,
- selectedTask,
- getPlanCheckRunsForTask,
- };
-};
diff --git a/frontend/src/components/IssueV1/logic/context.ts b/frontend/src/components/IssueV1/logic/context.ts
deleted file mode 100644
index 91e4ec9a80..0000000000
--- a/frontend/src/components/IssueV1/logic/context.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import type Emittery from "emittery";
-import { v4 as uuidv4 } from "uuid";
-import type { ComputedRef, InjectionKey, Ref } from "vue";
-import { inject, provide } from "vue";
-import type { ComposedIssue } from "@/types";
-import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
-import type { Stage, Task } from "@/types/proto-es/v1/rollout_service_pb";
-import type {
- IssueReviewAction,
- IssueStatusAction,
- TaskRolloutAction,
-} from "./action";
-
-export type IssueEvents = Emittery<{
- "status-changed": { eager: boolean };
- "select-task": { task: Task };
- "perform-issue-review-action": { action: IssueReviewAction };
- "perform-issue-status-action": { action: IssueStatusAction };
- "perform-task-rollout-action": { action: TaskRolloutAction; tasks: Task[] };
-}>;
-
-export type IssueContext = {
- // Basic fields
- isCreating: Ref<boolean>;
- ready: Ref<boolean>;
- issue: Ref<ComposedIssue>;
- allowChange: ComputedRef<boolean>;
-
- // UI status
- selectedStage: Ref<Stage>;
- selectedTask: Ref<Task>;
-
- // UI events
- events: IssueEvents;
-
- // misc
- reInitialize: (overrides?: Record<string, string>) => Promise<void>;
-
- // utility functions
- getPlanCheckRunsForTask: (task: Task) => PlanCheckRun[];
-};
-
-const KEY = Symbol(
- `bb.issue.context.${uuidv4()}`
-) as InjectionKey<IssueContext>;
-
-export const useIssueContext = () => {
- return inject(KEY)!;
-};
-
-export const provideIssueContext = (context: Partial<IssueContext>) => {
- provide(KEY, context as IssueContext);
-};
diff --git a/frontend/src/components/IssueV1/logic/index.ts b/frontend/src/components/IssueV1/logic/index.ts
deleted file mode 100644
index 102105f97d..0000000000
--- a/frontend/src/components/IssueV1/logic/index.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export * from "./context";
-export * from "./base";
-export * from "./rollout";
-export * from "./utils";
-export * from "./initialize";
-export * from "./action";
-export * from "./plan-check";
-export * from "./task-run";
-export * from "./poll";
diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.ts
deleted file mode 100644
index 7ac3a4c23b..0000000000
--- a/frontend/src/components/IssueV1/logic/initialize/create.ts
+++ /dev/null
@@ -1,127 +0,0 @@
-import { reactive } from "vue";
-import { useRoute } from "vue-router";
-import {
- buildPlan,
- type CreatePlanParams,
- extractInitialSQLFromQuery,
- generateRolloutPreview,
- getLocalSheetByName,
-} from "@/components/Plan";
-import { useCurrentUserV1, useProjectV1Store, useSheetV1Store } from "@/store";
-import { projectNamePrefix } from "@/store/modules/v1/common";
-import type { IssueType } from "@/types";
-import { emptyIssue, TaskTypeListWithStatement } from "@/types";
-import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
-import type { Stage } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- extractEnvironmentResourceName,
- extractSheetUID,
- getSheetStatement,
- sheetNameOfTaskV1,
-} from "@/utils";
-import { nextUID } from "../base";
-
-export const createIssueSkeleton = async (
- route: ReturnType<typeof useRoute>,
- query: Record<string, string>
-) => {
- const projectName = route.params.projectId as string;
- const project = await useProjectV1Store().getOrFetchProjectByName(
- `${projectNamePrefix}${projectName}`
- );
- const template = query.template as IssueType | undefined;
- if (!template) {
- throw new Error(
- "Template is required to create a plan skeleton. Please provide a valid template."
- );
- }
- const params: CreatePlanParams = {
- project,
- template,
- query,
- initialSQL: await extractInitialSQLFromQuery(query),
- };
-
- const issue = await buildIssue(params);
- const plan = await buildPlan(params);
- issue.plan = plan.name;
- issue.planEntity = plan;
-
- const rollout = await generateRolloutFromPlan(plan, params);
- issue.rolloutEntity = rollout;
-
- const description = query.description;
- if (description) {
- issue.description = description;
- }
-
- return issue;
-};
-
-const buildIssue = async (params: CreatePlanParams) => {
- const { project, query } = params;
- const issue = emptyIssue();
- const me = useCurrentUserV1();
- issue.creator = `users/${me.value.email}`;
- issue.project = project.name;
- issue.name = `${project.name}/issues/${nextUID()}`;
- issue.status = IssueStatus.OPEN;
- // Only set title from query if enforceIssueTitle is false.
- if (!project.enforceIssueTitle) {
- issue.title = query.name;
- }
-
- const template = query.template as IssueType | undefined;
- if (template === "bb.issue.database.data.export") {
- issue.type = Issue_Type.DATABASE_EXPORT;
- } else {
- issue.type = Issue_Type.DATABASE_CHANGE;
- }
-
- return issue;
-};
-
-const generateRolloutFromPlan = async (
- plan: Plan,
- params: CreatePlanParams
-) => {
- const rollout = await generateRolloutPreview(plan, params.project.name);
-
- // Touch UIDs for each object for local referencing
- rollout.name = `${params.project.name}/plans/${nextUID()}/rollout`;
- rollout.stages.forEach((stage) => {
- // Use environment ID as stage ID
- const environmentID = extractEnvironmentResourceName(stage.environment);
- stage.name = `${rollout.name}/stages/${environmentID}`;
- stage.tasks.forEach((task) => {
- task.name = `${stage.name}/tasks/${nextUID()}`;
- });
- });
-
- return reactive(rollout);
-};
-
-export const isValidStage = (stage: Stage): boolean => {
- for (const task of stage.tasks) {
- if (TaskTypeListWithStatement.includes(task.type)) {
- const sheetName = sheetNameOfTaskV1(task);
- const uid = extractSheetUID(sheetName);
- if (uid.startsWith("-")) {
- const sheet = getLocalSheetByName(sheetName);
- if (getSheetStatement(sheet).length === 0) {
- return false;
- }
- } else {
- const sheet = useSheetV1Store().getSheetByName(sheetName);
- if (!sheet) {
- return false;
- }
- if (getSheetStatement(sheet).length === 0) {
- return false;
- }
- }
- }
- }
- return true;
-};
diff --git a/frontend/src/components/IssueV1/logic/initialize/index.ts b/frontend/src/components/IssueV1/logic/initialize/index.ts
deleted file mode 100644
index d8e2ff5458..0000000000
--- a/frontend/src/components/IssueV1/logic/initialize/index.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import type { MaybeRef } from "vue";
-import { computed, ref, unref, watch } from "vue";
-import type { LocationQuery } from "vue-router";
-import { useRoute, useRouter } from "vue-router";
-import {
- experimentalFetchIssueByUID,
- useCurrentUserV1,
- extractUserId,
-} from "@/store";
-import { emptyIssue, EMPTY_ID, UNKNOWN_ID, type ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Project } from "@/types/proto-es/v1/project_service_pb";
-import { uidFromSlug, hasProjectPermissionV2 } from "@/utils";
-import { createIssueSkeleton } from "./create";
-import { WORKSPACE_ROUTE_404 } from "@/router/dashboard/workspaceRoutes";
-
-export * from "./create";
-
-export function useInitializeIssue(
- issueSlug: MaybeRef<string>,
- project: MaybeRef<Project>,
- redirectNotFound: boolean = true
-) {
- const isCreating = computed(() => {
- return (
- unref(issueSlug).toLowerCase() == "new" ||
- unref(issueSlug).toLowerCase() === "create"
- );
- });
- const uid = computed(() => {
- const slug = unref(issueSlug);
- if (slug.toLowerCase() === "new") return String(EMPTY_ID);
- if (slug.toLowerCase() === "create") return String(EMPTY_ID);
- const uid = Number(uidFromSlug(slug));
- if (uid > 0) return String(uid);
- return String(UNKNOWN_ID);
- });
- const route = useRoute();
- const router = useRouter();
- const isInitializing = ref(false);
- const currentUser = useCurrentUserV1();
-
- const issue = ref<ComposedIssue>(emptyIssue());
-
- const runner = async (uid: string, url: string) => {
- const issue =
- uid === String(EMPTY_ID)
- ? await createIssueSkeleton(
- route,
- convertRouterQuery(router.resolve(url).query)
- )
- : await experimentalFetchIssueByUID(uid, unref(project).name);
- return {
- issue,
- url,
- };
- };
-
- watch(
- [uid],
- ([uid]) => {
- if (uid === String(UNKNOWN_ID) && redirectNotFound) {
- router.push({ name: WORKSPACE_ROUTE_404 });
- return;
- }
- const url = route.fullPath;
- isInitializing.value = true;
- runner(uid, url).then((result) => {
- if (result.url !== route.fullPath) {
- // the url changed, drop the outdated result
- return;
- }
- issue.value = result.issue;
- isInitializing.value = false;
- });
- },
- { immediate: true }
- );
-
- const reInitialize = async (overrides: Record<string, string> = {}) => {
- const url = route.fullPath;
- const query = convertRouterQuery(router.resolve(url).query);
- try {
- const updated = await createIssueSkeleton(route, {
- ...query,
- ...overrides,
- });
- issue.value = updated;
- } catch {
- // Nothing
- }
- };
-
- const allowChange = computed(() => {
- if (isCreating.value) {
- return hasProjectPermissionV2(unref(project), "bb.issues.create");
- }
-
- if (issue.value.status !== IssueStatus.OPEN) {
- return false;
- }
-
- if (extractUserId(issue.value.creator) === currentUser.value.email) {
- // Allowed if current user is the creator.
- return true;
- }
-
- return hasProjectPermissionV2(unref(project), "bb.issues.update");
- });
-
- return { isCreating, issue, isInitializing, reInitialize, allowChange };
-}
-
-export const convertRouterQuery = (query: LocationQuery) => {
- const kv: Record<string, string> = {};
- for (const key of Object.keys(query)) {
- const value = query[key];
- if (typeof value === "string") {
- kv[key] = value;
- }
- }
- return kv;
-};
diff --git a/frontend/src/components/IssueV1/logic/plan-check.ts b/frontend/src/components/IssueV1/logic/plan-check.ts
deleted file mode 100644
index ac292d45f7..0000000000
--- a/frontend/src/components/IssueV1/logic/plan-check.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { planCheckRunSummaryForCheckRunList } from "@/components/PlanCheckRun/common";
-import type { ComposedIssue } from "@/types";
-import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
-import { databaseForTask } from "@/utils";
-import { projectOfIssue, useIssueContext } from ".";
-
-export const planSpecHasPlanChecks = (spec: Plan_Spec) => {
- if (spec.config?.case === "createDatabaseConfig") {
- return false;
- }
- if (spec.config?.case === "changeDatabaseConfig") {
- return true;
- }
- if (spec.config?.case === "exportDataConfig") {
- return true;
- }
- return false;
-};
-
-export const planCheckRunListForTask = (issue: ComposedIssue, task: Task) => {
- const target = databaseForTask(projectOfIssue(issue), task).name;
-
- // With consolidated model, return runs that have results for this target
- return issue.planCheckRunList.filter((run) => {
- return run.results.some((result) => result.target === target);
- });
-};
-
-export const planCheckStatusForTask = (task: Task) => {
- const { getPlanCheckRunsForTask } = useIssueContext();
- if (
- task.status === Task_Status.PENDING ||
- task.status === Task_Status.NOT_STARTED
- ) {
- const summary = planCheckRunSummaryForCheckRunList(
- getPlanCheckRunsForTask(task)
- );
- if (summary.errorCount > 0) return Advice_Level.ERROR;
- if (summary.warnCount > 0) return Advice_Level.WARNING;
- }
- return undefined;
-};
-
-export const planCheckRunSummaryForIssue = (issue: ComposedIssue) => {
- // With consolidated model, just use all plan check runs
- return planCheckRunSummaryForCheckRunList(issue.planCheckRunList);
-};
diff --git a/frontend/src/components/IssueV1/logic/poll.ts b/frontend/src/components/IssueV1/logic/poll.ts
deleted file mode 100644
index 9bfa7606b2..0000000000
--- a/frontend/src/components/IssueV1/logic/poll.ts
+++ /dev/null
@@ -1,99 +0,0 @@
-import { isEqual } from "lodash-es";
-import { watch } from "vue";
-import { useProgressivePoll } from "@/composables/useProgressivePoll";
-import {
- experimentalFetchIssueByUID,
- useChangelogStore,
- useDBSchemaV1Store,
- useInstanceV1Store,
-} from "@/store";
-import { useListCache } from "@/store/modules/v1/cache";
-import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { databaseForTask, extractIssueUID, flattenTaskV1List } from "@/utils";
-import { useIssueContext } from "./context";
-import { projectOfIssue } from "./utils";
-
-const clearCache = (issue: ComposedIssue) => {
- const changelogStore = useChangelogStore();
- const tasks = flattenTaskV1List(issue.rolloutEntity);
-
- for (const task of tasks) {
- const database = databaseForTask(projectOfIssue(issue), task);
- switch (task.type) {
- case Task_Type.DATABASE_CREATE:
- useInstanceV1Store()
- .syncInstance(database.instance, false /* not enable full sync */)
- .then(() => {
- const cache = useListCache("database");
- cache.deleteCache(database.instance);
- cache.deleteCache(database.project);
- });
- break;
- case Task_Type.DATABASE_EXPORT:
- case Task_Type.TYPE_UNSPECIFIED:
- continue;
- case Task_Type.DATABASE_MIGRATE:
- // Always clear the schema cache for MIGRATE tasks
- useDBSchemaV1Store().removeCache(database.name);
- break;
- default:
- useDBSchemaV1Store().removeCache(database.name);
- changelogStore.clearCache(database.name);
- }
- }
-};
-
-export const usePollIssue = () => {
- const { isCreating, ready, issue, events } = useIssueContext();
-
- const refreshIssue = () => {
- if (isCreating.value || !ready.value) return;
- experimentalFetchIssueByUID(
- extractIssueUID(issue.value.name),
- issue.value.project
- ).then((updatedIssue) => {
- if (
- issue.value.status !== IssueStatus.DONE &&
- updatedIssue.status === IssueStatus.DONE
- ) {
- clearCache(updatedIssue);
- }
-
- if (!isEqual(issue.value, updatedIssue)) {
- issue.value = updatedIssue;
- }
- });
- };
-
- const poller = useProgressivePoll(refreshIssue, {
- interval: {
- min: 500,
- max: 10000,
- growth: 2,
- jitter: 500,
- },
- });
-
- watch(
- () => [isCreating.value, ready.value],
- () => {
- if (!isCreating.value && ready.value) {
- poller.start();
- } else {
- poller.stop();
- }
- },
- {
- immediate: true,
- }
- );
-
- events.on("status-changed", ({ eager }) => {
- if (eager) {
- refreshIssue();
- poller.restart();
- }
- });
-};
diff --git a/frontend/src/components/IssueV1/logic/rollout.ts b/frontend/src/components/IssueV1/logic/rollout.ts
deleted file mode 100644
index f62d74e28b..0000000000
--- a/frontend/src/components/IssueV1/logic/rollout.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-import { head, includes } from "lodash-es";
-import { t } from "@/plugins/i18n";
-import { extractUserId, useCurrentUserV1 } from "@/store";
-import type { ComposedIssue } from "@/types";
-import { Issue_Type, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { extractDatabaseGroupName, hasProjectPermissionV2 } from "@/utils";
-import { projectOfIssue, specForTask } from ".";
-
-export const isGroupingChangeTaskV1 = (issue: ComposedIssue, task: Task) => {
- const spec = specForTask(issue.planEntity, task);
- if (!spec) {
- return false;
- }
- const target =
- spec.config?.case === "changeDatabaseConfig"
- ? head(spec.config.value.targets)
- : undefined;
- const databaseGroup = extractDatabaseGroupName(target ?? "");
- return databaseGroup !== "";
-};
-
-export const allowUserToEditStatementForTask = (
- issue: ComposedIssue,
- task: Task
-): string[] => {
- const user = useCurrentUserV1();
- const denyReasons: string[] = [];
-
- if (
- issue.type !== Issue_Type.DATABASE_CHANGE &&
- issue.type !== Issue_Type.DATABASE_EXPORT
- ) {
- denyReasons.push("Only database related issue type can be changed");
- }
- if (issue.status !== IssueStatus.OPEN) {
- denyReasons.push("The issue is not open");
- }
- if (issue.planEntity?.hasRollout) {
- denyReasons.push("Cannot edit statement after rollout");
- }
-
- if (task.type === Task_Type.DATABASE_CREATE) {
- // For standard mode projects, we are not allowed to edit the database
- // creation SQL statement.
- denyReasons.push("Cannot edit database creation statement");
- }
-
- // if not creating, we are allowed to edit sql statement only when:
- // - user is the creator
- // - OR user has plans.update permission in the project
- if (!isTaskEditable(task)) {
- denyReasons.push(`${Task_Status[task.status]} task is not editable`);
- }
-
- if (extractUserId(issue.creator) !== user.value.email) {
- const project = projectOfIssue(issue);
- if (!hasProjectPermissionV2(project, "bb.plans.update")) {
- denyReasons.push(
- t("issue.error.you-don-have-privilege-to-edit-this-issue")
- );
- }
- }
- return denyReasons;
-};
-
-export const isTaskEditable = (task: Task): boolean => {
- if (
- includes(
- [Task_Status.NOT_STARTED, Task_Status.FAILED, Task_Status.CANCELED],
- task.status
- )
- ) {
- return true;
- }
- return false;
-};
-
-export const isTaskFinished = (task: Task): boolean => {
- return [Task_Status.DONE, Task_Status.SKIPPED].includes(task.status);
-};
-
-export const semanticTaskType = (type: Task_Type) => {
- switch (type) {
- case Task_Type.DATABASE_CREATE:
- return t("task.type.database-create");
- case Task_Type.DATABASE_MIGRATE:
- return t("task.type.migrate");
- case Task_Type.DATABASE_EXPORT:
- return t("task.type.database-export");
- case Task_Type.GENERAL:
- return t("task.type.general");
- default:
- return "";
- }
-};
diff --git a/frontend/src/components/IssueV1/logic/task-run.ts b/frontend/src/components/IssueV1/logic/task-run.ts
deleted file mode 100644
index 8e1f993d5f..0000000000
--- a/frontend/src/components/IssueV1/logic/task-run.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { first, orderBy } from "lodash-es";
-import type { ComposedIssue } from "@/types";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { extractTaskRunUID, extractTaskUID } from "@/utils";
-
-export const taskRunListForTask = (issue: ComposedIssue, task: Task) => {
- return issue.rolloutTaskRunList.filter(
- (taskRun) => extractTaskUID(taskRun.name) === extractTaskUID(task.name)
- );
-};
-
-export const latestTaskRunForTask = (issue: ComposedIssue, task: Task) => {
- const taskRunList = taskRunListForTask(issue, task);
- return first(
- orderBy(
- taskRunList,
- (taskRun) => Number(extractTaskRunUID(taskRun.name)),
- "desc"
- )
- );
-};
diff --git a/frontend/src/components/IssueV1/logic/utils.ts b/frontend/src/components/IssueV1/logic/utils.ts
deleted file mode 100644
index aba0008586..0000000000
--- a/frontend/src/components/IssueV1/logic/utils.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-import { create } from "@bufbuild/protobuf";
-import {
- projectNamePrefix,
- useDatabaseV1Store,
- useEnvironmentV1Store,
- useInstanceResourceByName,
- useProjectV1Store,
-} from "@/store";
-import {
- type ComposedDatabase,
- type ComposedIssue,
- isValidDatabaseName,
- isValidInstanceName,
- unknownDatabase,
- unknownInstance,
-} from "@/types";
-import { State } from "@/types/proto-es/v1/common_pb";
-import { InstanceResourceSchema } from "@/types/proto-es/v1/instance_service_pb";
-import { type Issue, IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
-import type { Project } from "@/types/proto-es/v1/project_service_pb";
-import type { Task } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import {
- extractDatabaseResourceName,
- extractProjectResourceName,
- flattenTaskV1List,
- isValidIssueName,
-} from "@/utils";
-
-export const projectOfIssue = (issue: Issue): Project => {
- return useProjectV1Store().getProjectByName(
- `${projectNamePrefix}${extractProjectResourceName(issue.name)}`
- );
-};
-
-export const useInstanceForTask = (task: Task) => {
- let instanceName: string = "";
- switch (task.type) {
- case Task_Type.DATABASE_CREATE:
- instanceName = task.target;
- break;
- case Task_Type.DATABASE_MIGRATE:
- case Task_Type.DATABASE_EXPORT:
- instanceName = extractDatabaseResourceName(task.target).instance;
- break;
- default:
- }
-
- if (!isValidInstanceName(instanceName)) {
- return {
- instance: {
- ...unknownInstance(),
- name: instanceName,
- },
- ready: true,
- };
- }
-
- return useInstanceResourceByName(instanceName);
-};
-
-export const mockDatabase = (projectEntity: Project, database: string) => {
- // Database not found, it's probably NOT_FOUND (maybe dropped actually)
- // Mock a database using all known resources
- const db = unknownDatabase();
- db.project = projectEntity.name;
-
- db.name = database;
- const { instance, databaseName } = extractDatabaseResourceName(db.name);
- db.databaseName = databaseName;
- db.instance = instance;
- const { instance: instanceFromStore } = useInstanceResourceByName(instance);
- // Create InstanceResource from the instance data
- const instanceData = instanceFromStore.value;
- db.instanceResource = create(InstanceResourceSchema, {
- name: instanceData.name,
- engine: instanceData.engine,
- title: instanceData.title,
- activation: instanceData.activation ?? true,
- dataSources: instanceData.dataSources ?? [],
- environment: instanceData.environment,
- engineVersion: instanceData.engineVersion ?? "",
- });
- db.environment = db.instanceResource.environment;
- db.effectiveEnvironment = db.instanceResource.environment;
- db.effectiveEnvironmentEntity = useEnvironmentV1Store().getEnvironmentByName(
- db.instanceResource.environment ?? ""
- );
- db.state = State.DELETED;
- return db;
-};
-
-export const extractCoreDatabaseInfoFromDatabaseCreateTask = (
- project: Project,
- task: Task,
- plan?: Plan
-) => {
- const coreDatabaseInfo = (
- instanceName: string,
- databaseName: string
- ): ComposedDatabase => {
- const name = `${instanceName}/databases/${databaseName}`;
- const maybeExistedDatabase = useDatabaseV1Store().getDatabaseByName(name);
- if (isValidDatabaseName(maybeExistedDatabase.name)) {
- return maybeExistedDatabase;
- }
-
- const environmentStore = useEnvironmentV1Store();
- const { instance: instanceFromStore } =
- useInstanceResourceByName(instanceName);
- // Create InstanceResource from the instance data
- const instanceData = instanceFromStore.value;
- const instanceResource = create(InstanceResourceSchema, {
- name: instanceData.name,
- engine: instanceData.engine,
- title: instanceData.title,
- activation: instanceData.activation ?? true,
- dataSources: instanceData.dataSources ?? [],
- environment: instanceData.environment,
- engineVersion: instanceData.engineVersion ?? "",
- });
- const effectiveEnvironmentEntity = environmentStore.getEnvironmentByName(
- instanceResource.environment ?? ""
- );
- return {
- ...unknownDatabase(),
- name,
- databaseName,
- instance: instanceName,
- project: project.name,
- projectEntity: project,
- effectiveEnvironment: instanceResource.environment,
- effectiveEnvironmentEntity: effectiveEnvironmentEntity,
- instanceResource,
- };
- };
-
- if (task.payload?.case === "databaseCreate") {
- const instance = task.target;
- // Get database name from plan spec
- const spec = plan?.specs?.find((s) => s.id === task.specId);
- const createConfig =
- spec?.config?.case === "createDatabaseConfig"
- ? spec.config.value
- : undefined;
- const databaseName = createConfig?.database || "";
- return coreDatabaseInfo(instance, databaseName);
- }
-
- return unknownDatabase();
-};
-
-export const specForTask = (plan: Plan | undefined, task: Task) => {
- if (!plan) return undefined;
- return (plan.specs || []).find((spec) => spec.id === task.specId);
-};
-
-export const stageForTask = (issue: ComposedIssue, task: Task) => {
- const rollout = issue.rolloutEntity;
- return rollout?.stages.find(
- (stage) => stage.tasks.findIndex((t) => t.name === task.name) >= 0
- );
-};
-
-export const isUnfinishedResolvedTask = (issue: ComposedIssue | undefined) => {
- if (!issue) {
- return false;
- }
- if (!isValidIssueName(issue.name)) {
- return false;
- }
- if (issue.status !== IssueStatus.DONE) {
- return false;
- }
- return flattenTaskV1List(issue.rolloutEntity).some((task) => {
- return ![Task_Status.DONE, Task_Status.SKIPPED].includes(task.status);
- });
-};
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
index 27b82e949e..6a2e835cd9 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue
@@ -81,7 +81,7 @@ import { getLocalSheetByName, usePlanContext } from "@/components/Plan/logic";
import RequiredStar from "@/components/RequiredStar.vue";
import { issueServiceClientConnect, planServiceClientConnect } from "@/connect";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL,
} from "@/router/dashboard/projectV1";
import {
@@ -256,7 +256,7 @@ const doCreateDataExportIssue = async () => {
// Redirect to issue detail page
nextTick(() => {
router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(createdPlan.name),
issueId: extractIssueUID(createdIssue.name),
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue
index ba19ca84c5..e2ddb64427 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateIssueButton.vue
@@ -79,7 +79,7 @@ import {
import { usePlanCheckStatus, usePlanContext } from "@/components/Plan/logic";
import RequiredStar from "@/components/RequiredStar.vue";
import { issueServiceClientConnect } from "@/connect";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
pushNotification,
useCurrentProjectV1,
@@ -212,7 +212,7 @@ const doCreateIssue = async () => {
nextTick(() => {
router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(plan.value.name),
issueId: extractIssueUID(createdIssue.name),
diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vue
index 0ac6c7c0da..88f3445a46 100644
--- a/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/registry/components/IssueReviewButton.vue
@@ -166,7 +166,7 @@ import { ErrorList } from "@/components/Plan/components/common";
import { usePlanContext } from "@/components/Plan/logic";
import { issueServiceClientConnect } from "@/connect";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_ROLLOUT,
} from "@/router/dashboard/projectV1";
import {
@@ -381,7 +381,7 @@ const handlePostActionNavigation = (
// For APPROVE (not last) and REJECT, redirect to issue page
nextTick(() => {
router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(issueValue.name),
issueId: extractIssueUID(issueValue.name),
diff --git a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
index 720f39f337..d627b3400d 100644
--- a/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
+++ b/frontend/src/components/Plan/components/HeaderSection/HeaderSection.vue
@@ -49,7 +49,7 @@ import { NButton, NTag } from "naive-ui";
import { computed } from "vue";
import { useRoute } from "vue-router";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
} from "@/router/dashboard/projectV1";
@@ -73,7 +73,7 @@ const isPlanDetailPage = computed(() => {
});
const isIssueDetailPage = computed(() => {
- return route.name === PROJECT_V1_ROUTE_ISSUE_DETAIL_V1;
+ return route.name === PROJECT_V1_ROUTE_ISSUE_DETAIL;
});
const hasSidebar = computed(() => {
diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue
index 2289cffa99..03a74cc3aa 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseCreateView.vue
@@ -67,7 +67,6 @@
<script lang="ts" setup>
import { computed, watchEffect } from "vue";
-import { extractCoreDatabaseInfoFromDatabaseCreateTask } from "@/components/IssueV1/logic/utils";
import TaskStatus from "@/components/Rollout/kits/TaskStatus.vue";
import TaskRunTable from "@/components/RolloutV1/components/TaskRunTable.vue";
import {
@@ -84,6 +83,7 @@ import {
import type { Plan_CreateDatabaseConfig } from "@/types/proto-es/v1/plan_service_pb";
import { Task_Status } from "@/types/proto-es/v1/rollout_service_pb";
import { isValidInstanceName } from "@/types/v1/instance";
+import { extractCoreDatabaseInfoFromDatabaseCreateTask } from "@/utils";
import { extractInstanceResourceName } from "@/utils/v1/instance";
import { usePlanContext } from "../..";
diff --git a/frontend/src/components/Plan/components/IssueReviewView/IssueBaseLayout.vue b/frontend/src/components/Plan/components/IssueReviewView/IssueBaseLayout.vue
index b1ef71d1a5..ef244fd0ab 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/IssueBaseLayout.vue
+++ b/frontend/src/components/Plan/components/IssueReviewView/IssueBaseLayout.vue
@@ -36,65 +36,17 @@
</template>
<script setup lang="ts">
-import { computed, unref } from "vue";
-import { provideIssueContext, useBaseIssueContext } from "@/components/IssueV1";
import { Drawer } from "@/components/v2";
-import { extractUserId, useCurrentProjectV1, useCurrentUserV1 } from "@/store";
-import type { ComposedIssue } from "@/types";
-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";
-import { hasProjectPermissionV2 } from "@/utils";
import { usePlanContextWithIssue } from "../..";
import { useSidebarContext } from "../../logic/sidebar";
import { ActivitySection } from "./ActivitySection";
import { Sidebar } from "./Sidebar";
-const { project, ready } = useCurrentProjectV1();
-const { plan, issue, rollout } = usePlanContextWithIssue();
-const currentUser = useCurrentUserV1();
+usePlanContextWithIssue();
const {
mode: sidebarMode,
desktopSidebarWidth,
mobileSidebarOpen,
} = useSidebarContext();
-
-const issueBaseContext = useBaseIssueContext({
- // Always set to false.
- isCreating: computed(() => false),
- ready,
- issue: computed(() => issue.value as ComposedIssue),
-});
-
-const allowChange = computed(() => {
- // Disallow changes if the issue is not open.
- if (issue.value.status !== IssueStatus.OPEN) {
- return false;
- }
-
- // Allow changes if the current user is the creator of the issue or has the necessary permissions.
- return (
- extractUserId(issue.value.creator) === currentUser.value.email ||
- hasProjectPermissionV2(unref(project), "bb.issues.update")
- );
-});
-
-// TODO(steven): remove ComposedIssue.
-const composedIssue = computed(() => {
- const composedIssue = issue.value as ComposedIssue;
- composedIssue.project = unref(project).name;
- composedIssue.plan = unref(plan).name;
- composedIssue.planEntity = unref(plan);
- if (rollout?.value) {
- composedIssue.rolloutEntity = rollout.value;
- }
- return composedIssue;
-});
-
-provideIssueContext({
- isCreating: computed(() => false),
- ready,
- allowChange,
- issue: composedIssue,
- ...issueBaseContext,
-});
</script>
diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
index b585922cea..44d150cb0c 100644
--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/useApprovalStep.ts
@@ -4,7 +4,6 @@ import { uniq } from "lodash-es";
import type { Ref } from "vue";
import { computed, ref, watchEffect } from "vue";
import { useI18n } from "vue-i18n";
-import { useIssueContext } from "@/components/IssueV1";
import { tryUsePlanContext } from "@/components/Plan/logic";
import { issueServiceClientConnect } from "@/connect";
import {
@@ -48,7 +47,6 @@ export function useApprovalStep(
const { t } = useI18n();
const { project } = useCurrentProjectV1();
const planContext = tryUsePlanContext();
- const issueContext = planContext ? undefined : useIssueContext();
const currentUser = useCurrentUserV1();
const userStore = useUserStore();
const roleStore = useRoleStore();
@@ -105,8 +103,6 @@ export function useApprovalStep(
await issueServiceClientConnect.requestIssue(request);
if (planContext) {
planContext.events.emit("status-changed", { eager: true });
- } else {
- issueContext?.events.emit("status-changed", { eager: true });
}
pushNotification({
diff --git a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
index cb996e76a3..42c8403154 100644
--- a/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
+++ b/frontend/src/components/Plan/components/PlanDataTable/PlanDataTable.vue
@@ -20,7 +20,6 @@ import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import Timestamp from "@/components/misc/Timestamp.vue";
import { UserNameCell } from "@/components/v2/Model/cells";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";
import { useUserStore } from "@/store";
import { unknownUser } from "@/types";
@@ -40,7 +39,6 @@ withDefaults(
const { t } = useI18n();
const router = useRouter();
const userStore = useUserStore();
-const { enabledNewLayout } = useIssueLayoutVersion();
const columnList = computed((): DataTableColumn<Plan>[] => {
const columns: (DataTableColumn<Plan> & { hide?: boolean })[] = [
@@ -50,8 +48,7 @@ const columnList = computed((): DataTableColumn<Plan>[] => {
ellipsis: true,
resizable: true,
render: (plan) => {
- const showDraftTag =
- enabledNewLayout.value && plan.issue === "" && !plan.hasRollout;
+ const showDraftTag = plan.issue === "" && !plan.hasRollout;
const isDeleted = plan.state === State.DELETED;
return (
<div
diff --git a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
index 0a9d56f8b4..473b3c6971 100644
--- a/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
+++ b/frontend/src/components/Plan/components/SQLCheckSection/SQLCheckBadge.vue
@@ -35,7 +35,7 @@
import { CheckIcon, CircleAlertIcon, TriangleAlertIcon } from "lucide-vue-next";
import { NTag } from "naive-ui";
import { computed, ref } from "vue";
-import { TaskSpinner } from "@/components/IssueV1/components/common";
+import TaskSpinner from "@/components/misc/TaskSpinner.vue";
import { SQLCheckPanel } from "@/components/SQLCheck";
import type { Advice } from "@/types/proto-es/v1/sql_service_pb";
import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";
diff --git a/frontend/src/components/Plan/logic/issue.ts b/frontend/src/components/Plan/logic/issue.ts
index 3ce5adf331..5725f02771 100644
--- a/frontend/src/components/Plan/logic/issue.ts
+++ b/frontend/src/components/Plan/logic/issue.ts
@@ -1,10 +1,6 @@
import type { LocationQueryRaw } from "vue-router";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { router } from "@/router";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import {
useDatabaseV1Store,
useDBGroupStore,
@@ -23,7 +19,6 @@ export const preCreateIssue = async (project: string, targets: string[]) => {
const databaseStore = useDatabaseV1Store();
const dbGroupStore = useDBGroupStore();
const projectStore = useProjectV1Store();
- const { enabledNewLayout } = useIssueLayoutVersion();
const databaseNames: string[] = [];
for (const target of targets) {
@@ -43,62 +38,41 @@ export const preCreateIssue = async (project: string, targets: string[]) => {
// Fetch project to check enforce_issue_title setting
const projectEntity = await projectStore.getOrFetchProjectByName(project);
- if (enabledNewLayout.value) {
- // New CI/CD layout: navigate to plan detail page
- const query: LocationQueryRaw = {
- template: type,
- };
+ // Navigate to plan detail page
+ const query: LocationQueryRaw = {
+ template: type,
+ };
- if (isDatabaseGroup) {
- const databaseGroupName = targets[0];
- query.databaseGroupName = databaseGroupName;
- // Only set title from generated if enforceIssueTitle is false.
- if (!projectEntity.enforceIssueTitle) {
- query.name = generateIssueTitle(type, [
- extractDatabaseGroupName(databaseGroupName),
- ]);
- }
- } else {
- query.databaseList = targets.join(",");
- // Only set title from generated if enforceIssueTitle is false.
- if (!projectEntity.enforceIssueTitle) {
- query.name = generateIssueTitle(
- type,
- targets.map((db) => {
- const { databaseName } = extractDatabaseResourceName(db);
- return databaseName;
- })
- );
- }
+ if (isDatabaseGroup) {
+ const databaseGroupName = targets[0];
+ query.databaseGroupName = databaseGroupName;
+ // Only set title from generated if enforceIssueTitle is false.
+ if (!projectEntity.enforceIssueTitle) {
+ query.name = generateIssueTitle(type, [
+ extractDatabaseGroupName(databaseGroupName),
+ ]);
}
-
- router.push({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(project),
- planId: "create",
- specId: "placeholder",
- },
- query,
- });
} else {
- // Legacy layout: navigate to issue detail page
- const query: LocationQueryRaw = {
- template: type,
- databaseList: targets.join(","),
- };
+ query.databaseList = targets.join(",");
// Only set title from generated if enforceIssueTitle is false.
if (!projectEntity.enforceIssueTitle) {
- query.name = generateIssueTitle(type, databaseNames);
+ query.name = generateIssueTitle(
+ type,
+ targets.map((db) => {
+ const { databaseName } = extractDatabaseResourceName(db);
+ return databaseName;
+ })
+ );
}
-
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(project),
- issueSlug: "create",
- },
- query,
- });
}
+
+ router.push({
+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(project),
+ planId: "create",
+ specId: "placeholder",
+ },
+ query,
+ });
};
diff --git a/frontend/src/components/Plan/logic/plan.ts b/frontend/src/components/Plan/logic/plan.ts
index 23cbe0fffe..da18ce1446 100644
--- a/frontend/src/components/Plan/logic/plan.ts
+++ b/frontend/src/components/Plan/logic/plan.ts
@@ -1,5 +1,4 @@
import { head } from "lodash-es";
-import { mockDatabase } from "@/components/IssueV1/logic/utils";
import { useDatabaseV1Store, useDBGroupStore } from "@/store";
import {
isValidDatabaseGroupName,
@@ -10,6 +9,7 @@ import { Engine } from "@/types/proto-es/v1/common_pb";
import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";
import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";
import type { Project } from "@/types/proto-es/v1/project_service_pb";
+import { mockDatabase } from "@/utils";
export const databaseForSpec = (project: Project, spec: Plan_Spec) => {
const targets = targetsForSpec(spec);
diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.ts
index 30c539591b..0e7d763c21 100644
--- a/frontend/src/components/Plan/logic/poller/poller.ts
+++ b/frontend/src/components/Plan/logic/poller/poller.ts
@@ -13,7 +13,7 @@ import {
import { useRoute } from "vue-router";
import { useProgressivePoll } from "@/composables/useProgressivePoll";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
@@ -171,7 +171,7 @@ export const provideResourcePoller = () => {
];
if (includes(planRoutes, routeName)) return ["plan"];
- if (includes([PROJECT_V1_ROUTE_ISSUE_DETAIL_V1], routeName)) {
+ if (includes([PROJECT_V1_ROUTE_ISSUE_DETAIL], routeName)) {
if (planType.value === "CHANGE_DATABASE") {
return ["plan", "issue"];
} else {
@@ -340,7 +340,7 @@ export const provideResourcePoller = () => {
PROJECT_V1_ROUTE_PLAN_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
],
routeName
);
diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
index 7568f0fa9f..25ee3d019a 100644
--- a/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunBadge.vue
@@ -42,7 +42,7 @@ import { CheckIcon, CircleAlertIcon, TriangleAlertIcon } from "lucide-vue-next";
import { NTag } from "naive-ui";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
-import { TaskSpinner } from "@/components/IssueV1/components/common";
+import TaskSpinner from "@/components/misc/TaskSpinner.vue";
import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";
import {
PlanCheckRun_Result_Type,
diff --git a/frontend/src/components/ProfileDropdown.vue b/frontend/src/components/ProfileDropdown.vue
index 9e54a89e4b..ea224e67e0 100644
--- a/frontend/src/components/ProfileDropdown.vue
+++ b/frontend/src/components/ProfileDropdown.vue
@@ -15,13 +15,12 @@
<script lang="tsx" setup>
import type { DropdownOption } from "naive-ui";
-import { NDropdown, NSwitch } from "naive-ui";
+import { NDropdown } from "naive-ui";
import { storeToRefs } from "pinia";
import { twMerge } from "tailwind-merge";
import { computed, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { useLanguage } from "@/composables/useLanguage";
import { WORKSPACE_ROUTE_LANDING } from "@/router/dashboard/workspaceRoutes";
import { SQL_EDITOR_HOME_MODULE } from "@/router/sqlEditor";
@@ -87,8 +86,6 @@ const resetQuickstart = () => {
showDropdown.value = false;
};
-const { enabledNewLayout, toggleLayout } = useIssueLayoutVersion();
-
const toggleLocale = (lang: string) => {
setLocale(lang);
showDropdown.value = false;
@@ -320,24 +317,6 @@ const options = computed((): DropdownOption[] => [
return <Version tooltipProps={{ placement: "left" }} />;
},
},
- {
- key: "enable-new-layout",
- type: "render",
- render() {
- return (
- <div class="menu-item">
- <div class="flex flex-row items-center gap-x-2 justify-between">
- <span>{t("issue.new-layout")}</span>
- <NSwitch
- size="small"
- value={enabledNewLayout.value}
- onUpdate:value={toggleLayout}
- />
- </div>
- </div>
- );
- },
- },
{
key: "header-divider",
type: "divider",
diff --git a/frontend/src/components/Project/useProjectSidebar.ts b/frontend/src/components/Project/useProjectSidebar.ts
index 1ddf1f55ed..6c4ce32dc3 100644
--- a/frontend/src/components/Project/useProjectSidebar.ts
+++ b/frontend/src/components/Project/useProjectSidebar.ts
@@ -2,9 +2,6 @@ import {
CircleDot,
Database,
DownloadIcon,
- LayoutList,
- PackageIcon,
- PlayCircle,
Settings,
Users,
Workflow,
@@ -12,7 +9,6 @@ import {
import { computed, h, type MaybeRef, unref } from "vue";
import { useRoute } from "vue-router";
import type { SidebarItem } from "@/components/v2/Sidebar/type";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { t } from "@/plugins/i18n";
import {
PROJECT_V1_ROUTE_AUDIT_LOGS,
@@ -41,63 +37,38 @@ interface ProjectSidebarItem extends SidebarItem {
export const useProjectSidebar = (project: MaybeRef<Project>) => {
const route = useRoute();
- const { enabledNewLayout } = useIssueLayoutVersion();
const isDefaultProject = computed((): boolean => {
return unref(project).name === DEFAULT_PROJECT_NAME;
});
const projectSidebarItemList = computed((): ProjectSidebarItem[] => {
- const cicdRoutes: ProjectSidebarItem[] = enabledNewLayout.value
- ? [
- {
- title: "CI/CD",
- icon: () => h(Workflow),
- type: "div",
- expand: true,
- hide: isDefaultProject.value,
- children: [
- {
- title: t("plan.plans"),
- path: PROJECT_V1_ROUTE_PLANS,
- type: "div",
- },
- {
- title: t("rollout.rollouts"),
- path: PROJECT_V1_ROUTE_ROLLOUTS,
- type: "div",
- },
- {
- title: t("release.releases"),
- path: PROJECT_V1_ROUTE_RELEASES,
- type: "div",
- },
- ],
- },
- ]
- : [
- {
- title: t("release.releases"),
- path: PROJECT_V1_ROUTE_RELEASES,
- icon: () => h(PackageIcon),
- type: "div",
- hide: isDefaultProject.value,
- },
+ const cicdRoutes: ProjectSidebarItem[] = [
+ {
+ title: "CI/CD",
+ icon: () => h(Workflow),
+ type: "div",
+ expand: true,
+ hide: isDefaultProject.value,
+ children: [
{
title: t("plan.plans"),
- icon: () => h(LayoutList),
path: PROJECT_V1_ROUTE_PLANS,
type: "div",
- hide: isDefaultProject.value,
},
{
title: t("rollout.rollouts"),
path: PROJECT_V1_ROUTE_ROLLOUTS,
- icon: () => h(PlayCircle),
type: "div",
- hide: isDefaultProject.value,
},
- ];
+ {
+ title: t("release.releases"),
+ path: PROJECT_V1_ROUTE_RELEASES,
+ type: "div",
+ },
+ ],
+ },
+ ];
const databaseRoutes: ProjectSidebarItem[] = [
{
@@ -133,9 +104,8 @@ export const useProjectSidebar = (project: MaybeRef<Project>) => {
type: "div",
hide: isDefaultProject.value,
},
- ...(enabledNewLayout.value
- ? [...cicdRoutes, ...databaseRoutes]
- : [...databaseRoutes, ...cicdRoutes]),
+ ...cicdRoutes,
+ ...databaseRoutes,
{
title: t("export-center.self"),
icon: () => h(DownloadIcon),
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
index ce8948d917..7ac9dcd913 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/RoleDescription.vue
@@ -21,8 +21,8 @@ import { pushNotification } from "@/store";
import { UNKNOWN_ID } from "@/types";
import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";
import {
+ extractIssueUID,
extractProjectResourceName,
- issueV1Slug,
isValidIssueName,
} from "@/utils";
@@ -62,7 +62,7 @@ const gotoIssuePage = async () => {
name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: extractProjectResourceName(issue.name),
- issueSlug: issueV1Slug(issue.name, issue.title),
+ issueId: extractIssueUID(issue.name),
},
});
window.open(route.href, "_blank");
diff --git a/frontend/src/components/RolloutV1/components/RolloutBreadcrumb.vue b/frontend/src/components/RolloutV1/components/RolloutBreadcrumb.vue
index 91ed716f10..79c0853cce 100644
--- a/frontend/src/components/RolloutV1/components/RolloutBreadcrumb.vue
+++ b/frontend/src/components/RolloutV1/components/RolloutBreadcrumb.vue
@@ -22,7 +22,7 @@ import { useI18n } from "vue-i18n";
import { type RouteLocationRaw, RouterLink, useRoute } from "vue-router";
import { usePlanContext } from "@/components/Plan/logic";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL,
PROJECT_V1_ROUTE_PLAN_ROLLOUT,
PROJECT_V1_ROUTE_PLAN_ROLLOUT_STAGE,
@@ -96,7 +96,7 @@ const breadcrumbItems = computed<BreadcrumbItem[]>(() => {
items.push({
label: `${t("common.issue")} #${issueUID.value}`,
route: {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: { projectId: projectId.value, issueId: issueUID.value },
},
clickable: true,
diff --git a/frontend/src/components/SyncDatabaseSchemaV1/index.vue b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
index 91db42bc92..e50bfe69f9 100644
--- a/frontend/src/components/SyncDatabaseSchemaV1/index.vue
+++ b/frontend/src/components/SyncDatabaseSchemaV1/index.vue
@@ -84,12 +84,8 @@ import { useI18n } from "vue-i18n";
import { type LocationQueryRaw, useRoute, useRouter } from "vue-router";
import { BBSpin } from "@/bbkit";
import { StepTab } from "@/components/v2";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { useRouteChangeGuard } from "@/composables/useRouteChangeGuard";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import { WORKSPACE_ROOT_MODULE } from "@/router/dashboard/workspaceRoutes";
import {
useChangelogStore,
@@ -330,7 +326,6 @@ const tryFinishSetup = async () => {
return;
}
- const { enabledNewLayout } = useIssueLayoutVersion();
const targetDatabaseList = targetDatabaseViewRef.value.targetDatabaseList;
const query: LocationQueryRaw = {
template: "bb.issue.database.update",
@@ -353,26 +348,15 @@ const tryFinishSetup = async () => {
targetDatabaseList.map((db) => db.databaseName)
);
- if (enabledNewLayout.value) {
- router.push({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(props.project.name),
- planId: "create",
- specId: "placeholder",
- },
- query,
- });
- } else {
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(props.project.name),
- issueSlug: "create",
- },
- query,
- });
- }
+ router.push({
+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(props.project.name),
+ planId: "create",
+ specId: "placeholder",
+ },
+ query,
+ });
};
const cancelSetup = () => {
diff --git a/frontend/src/components/IssueV1/components/common/TaskSpinner.vue b/frontend/src/components/misc/TaskSpinner.vue
similarity index 100%
rename from frontend/src/components/IssueV1/components/common/TaskSpinner.vue
rename to frontend/src/components/misc/TaskSpinner.vue
diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
index 72b6d742b0..9f4e7cad90 100644
--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
+++ b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseOperations.vue
@@ -126,9 +126,7 @@ import { preCreateIssue } from "@/components/Plan/logic/issue";
import { TransferDatabaseForm } from "@/components/TransferDatabaseForm";
import TransferOutDatabaseForm from "@/components/TransferOutDatabaseForm";
import { Drawer } from "@/components/v2";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
} from "@/router/dashboard/projectV1";
@@ -263,7 +261,6 @@ const generateMultiDb = async (
selectedProjectName.value
);
- const { enabledNewLayout } = useIssueLayoutVersion();
const query: LocationQueryRaw = {
template: type,
databaseList: props.databases.map((db) => db.name).join(","),
@@ -277,30 +274,17 @@ const generateMultiDb = async (
}
const isDataExport = type === "bb.issue.database.data.export";
- if (isDataExport || enabledNewLayout.value) {
- // Use CI/CD UI for data export issues or when new layout is enabled
- router.push({
- name: isDataExport
- ? PROJECT_V1_ROUTE_PLAN_DETAIL
- : PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(selectedProjectName.value),
- planId: "create",
- ...(isDataExport ? {} : { specId: "placeholder" }),
- },
- query,
- });
- } else {
- // Legacy UI for database update when new layout is disabled
- router.push({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(selectedProjectName.value),
- issueSlug: "create",
- },
- query,
- });
- }
+ router.push({
+ name: isDataExport
+ ? PROJECT_V1_ROUTE_PLAN_DETAIL
+ : PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(selectedProjectName.value),
+ planId: "create",
+ ...(isDataExport ? {} : { specId: "placeholder" }),
+ },
+ query,
+ });
};
const syncSchema = async () => {
diff --git a/frontend/src/composables/useIssueLayoutVersion.ts b/frontend/src/composables/useIssueLayoutVersion.ts
deleted file mode 100644
index 00381a7a76..0000000000
--- a/frontend/src/composables/useIssueLayoutVersion.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { useLocalStorage } from "@vueuse/core";
-import { useActuatorV1Store, useCurrentUserV1 } from "@/store";
-import { isDev } from "@/utils";
-
-const STORAGE_KEY = "bb.issue.layout";
-
-// When releasing a new version as default, increment this number.
-// This helps to reset user preferences to the new default layout.
-const CURRENT_DEFAULT_VERSION = 2;
-
-// Send event to hub.bytebase.com when switching to legacy layout.
-async function trackLayoutSwitch() {
- try {
- const actuatorStore = useActuatorV1Store();
- const currentUser = useCurrentUserV1();
-
- const workspaceId = actuatorStore.info?.workspaceId;
- const email = currentUser.value.email;
- const version = actuatorStore.version;
- const commit = actuatorStore.gitCommitBE;
-
- // Only track when switching to legacy layout
- if (!workspaceId || !email) {
- return;
- }
-
- // Send event to hub.bytebase.com
- await fetch("https://hub.bytebase.com/v1/events", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- workspaceId,
- email,
- version,
- commit,
- consoleCicdLayoutSwitchToLegacy: {
- reason: "",
- },
- }),
- });
- } catch {
- // Silently fail if tracking fails - don't block user action
- }
-}
-
-export function useIssueLayoutVersion() {
- // Store whether user prefers the new layout (true) or old layout (false).
- const enabled = useLocalStorage<boolean>(`${STORAGE_KEY}.enabled`, true);
-
- // Store the version number when user last made a choice
- const lastVersion = useLocalStorage<number>(
- `${STORAGE_KEY}.version`,
- CURRENT_DEFAULT_VERSION
- );
-
- // If a new version is released and user hasn't made a choice for it,
- // reset to the new default (true)
- if (lastVersion.value < CURRENT_DEFAULT_VERSION) {
- enabled.value = true;
- lastVersion.value = CURRENT_DEFAULT_VERSION;
- }
-
- // Toggle between layouts
- const toggleLayout = () => {
- const switchingToLegacy = enabled.value === true;
- enabled.value = !enabled.value;
- lastVersion.value = CURRENT_DEFAULT_VERSION;
-
- // Track the switch event when switching to legacy layout in production.
- if (switchingToLegacy && !isDev()) {
- trackLayoutSwitch();
- }
-
- // Reload the window to ensure clean state transition.
- window.location.reload();
- };
-
- return {
- enabledNewLayout: enabled,
- toggleLayout,
- };
-}
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 2946e4fc44..09f4060fd9 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -163,7 +163,6 @@
"load-more": "Load more",
"rows-per-page": "Rows per page",
"access-denied": "Access denied",
- "restart": "Restart",
"want-help": "Want help",
"operation": "Operation",
"discard-changes": "Discard changes",
@@ -210,7 +209,6 @@
"clear-filters": "Clear filters",
"license": "License",
"view-details": "View details",
- "force-verb": "Force {verb}",
"untitled": "Untitled",
"missing-required-permission": "Missing required permissions {permissions}",
"missing-required-permission-for-resource": "Missing required permissions for resource {resource}",
@@ -245,8 +243,6 @@
"title": "Title",
"text-wrap": "Text Wrap",
"catalog": "Catalog",
- "summary": "Summary",
- "errors": "Errors",
"removed": "Removed",
"submit": "Submit",
"draft": "Draft",
@@ -275,7 +271,6 @@
"description": "Detect outdated version. Please refresh the page."
},
"task": {
- "current-task": "Current task",
"checking": "Checking...",
"check-result": {
"title-general": "Check result"
@@ -304,13 +299,10 @@
"pending": "Pending",
"not-started": "Not started"
},
- "skip": "Skip",
"task-checks": "Task checks",
"prior-backup": "Prior backup",
- "skip-failed-in-current-stage": "Skip failed tasks in current stage",
"execution-time": "Execution time",
"run-checks": "Run checks",
- "action-all-tasks-in-current-stage": "{action} all tasks in current stage",
"cancel-task": "Cancel task | Cancel tasks",
"skip-task": "Skip task | Skip tasks",
"run-task": "Run task | Run tasks",
@@ -353,10 +345,6 @@
"advice-split-statement-to-single-online-migration-issue": "Advice splitting this statement to single online migration issue."
},
"prior-backup-tips": "Backup affected data ahead of time. Only applies to data changes (UPDATE, DELETE), not schema changes.",
- "database-create": {
- "created": "Created",
- "pending": "Pending"
- },
"executed-by": "Executed by",
"affected-rows": "Affected rows",
"type": {
@@ -961,15 +949,8 @@
"modal": {
"reopen": "Reopen issue?",
"close": "Close issue?"
- },
- "warning": {
- "some-previous-stages-are-not-done": "Some previous stages are not done."
- },
- "error": {
- "some-tasks-are-still-running": "Some tasks are still running"
}
},
- "add-some-description": "Add some description...",
"leave-a-comment": "Leave a comment...",
"no-description-provided": "No description provided",
"comment-editor": {
@@ -1042,24 +1023,17 @@
"creator": "Creator",
"current-approver": "Current approver"
},
- "stage-select": {
- "current": "{name} (current)"
- },
"migration-mode": {
"online": {
"description": "Based on gh-ost. For large tables, it can reduce the table lock duration from hours to seconds {link}."
}
},
- "new-issue": "@:common.new @:common.issue",
- "action-to-current-stage": "{action} current stage",
"upload-sql": "Upload SQL",
"statement-from-sheet-warning": "Due to the SQL being oversized, it has been truncated to display, and editing is disabled. You can upload a new SQL file to overwrite it.",
"overwrite-current-statement": "Overwrite current SQL statement",
"upload-sql-file-max-size-exceeded": "Max file size ({size}) exceeded.",
"transaction-mode": {
"label": "Transaction Mode",
- "on": "ON",
- "off": "OFF",
"on-tooltip": "Wraps all statements in a single transaction (BEGIN/COMMIT).",
"off-tooltip": "Executes statements individually in auto-commit mode. Statements are committed immediately and cannot be rolled back if a later statement fails.",
"execution-order-note": "Non-transactional statements will be executed last."
@@ -1073,8 +1047,7 @@
"close": "Close"
},
"approval-flow": {
- "self": "Approval flow",
- "pre-issue-created-tips": "After an issue is created, Bytebase will automatically match the corresponding custom approval based on the type and risk level of the issue."
+ "self": "Approval flow"
},
"risk-level": {
"self": "Risk level",
@@ -1082,8 +1055,6 @@
"moderate": "Moderate",
"high": "High"
},
- "awaiting-rollout": "Awaiting rollout",
- "waiting-for-review": "Waiting for review",
"issue-name": "Issue name",
"grant-request": {
"details": "Request Details",
@@ -1095,7 +1066,6 @@
"custom-date": "Custom date",
"custom-date-placeholder": "Select expiration date and time"
},
- "review-sent-back": "Review sent back",
"action-anyway": "{action} anyway",
"sql-check": {
"sql-checks": "SQL checks",
@@ -1106,14 +1076,9 @@
"sql-review-violations": "SQL Review Violations"
},
"error": {
- "you-don-have-privilege-to-edit-this-issue": "You don't have privilege to edit this issue",
- "you-are-not-allowed-to-perform-this-action": "You are not allowed to perform this action",
- "cannot-close-issue-with-running-tasks": "Cannot close issue with running tasks",
"statement-cannot-be-modified": "Statement cannot be modified after the issue is created"
},
"unfinished-resolved-issue-tips": "This issue is marked as \"Done\" but some of its tasks are not executed successfully.",
- "some-tasks-are-not-executed-successfully": "(Some tasks are not executed successfully)",
- "missing-sql-statement": "SQL statement missing.",
"data-export": {
"options": "Options",
"limits": "Limits",
@@ -1161,11 +1126,8 @@
"reject-description": "Submit feedback and request changes"
},
"approval": {
- "rejected-error": "Issue approval has been rejected.",
- "pending-error": "Issue approval is pending.",
"approved-and-waiting-for-rollout": "This issue has been approved and is ready to rollout."
- },
- "new-layout": "New CI/CD Layout"
+ }
},
"plan": {
"plans": "Plans",
@@ -1218,9 +1180,6 @@
},
"options": {
"self": "Options",
- "applies-to-all-tasks": "Applies to all tasks",
- "applies-to-some-tasks": "Applies to some tasks {count}/{total}",
- "split-into-multiple-issues-tip": "If you want to configure different options for each task, please split into multiple issues.",
"no-options-available": "No options available"
},
"editor": {
@@ -1258,9 +1217,7 @@
"rollout": {
"rollouts": "Rollouts",
"bypass-stage-requirements": "Bypass warnings",
- "task-execution-notices": "Task execution notices",
"task-execution-errors": "Task execution errors",
- "no-active-task-to-cancel": "No active task to cancel.",
"stage": {
"self": "Stage | Stages",
"run-stage": "Run Tasks",
@@ -2682,7 +2639,6 @@
"first-match-wins": "Rules are evaluated in order. First matching rule applies."
},
"issue-review": {
- "approve-issue": "Approve issue?",
"generating-approval-flow": "Generating approval flow",
"approved-issue": "approved issue",
"rejected-issue": "rejected issue",
@@ -2691,9 +2647,7 @@
"some-task-checks-are-still-running": "Some task checks are still running.",
"x-field-is-required": "{field} is required"
},
- "send-back-issue": "Send back issue?",
"re-request-review": "Re-request review",
- "re-request-review-issue": "Re-request review issue?",
"re-request-review-success": "Review re-requested successfully",
"re-requested-review": "re-requested issue review",
"approved-by": "Approved by",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 7fcb9b6317..f922b3c95a 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -163,7 +163,6 @@
"load-more": "Cargar más",
"rows-per-page": "Filas por página",
"access-denied": "Acceso denegado",
- "restart": "Reiniciar",
"want-help": "Buscar Ayuda",
"operation": "Operación",
"discard-changes": "Descartar cambios",
@@ -210,7 +209,6 @@
"clear-filters": "Limpiar filtros",
"license": "Licencia",
"view-details": "Ver detalles",
- "force-verb": "forzar {verbo}",
"untitled": "Intitulado",
"missing-required-permission": "Faltan permisos requeridos {permissions}",
"missing-required-permission-for-resource": "Faltan permisos requeridos para el recurso {resource}",
@@ -238,8 +236,6 @@
"title": "Título",
"text-wrap": "Ajuste de texto",
"catalog": "Catálogo",
- "summary": "Resumen",
- "errors": "Errores",
"removed": "Remoto",
"submit": "Entregar",
"draft": "Borrador",
@@ -275,7 +271,6 @@
"description": "Se ha detectado una versión obsoleta. Por favor, actualice la página."
},
"task": {
- "current-task": "Tarea actual",
"checking": "Comprobando...",
"check-result": {
"title-general": "Comprobar resultado"
@@ -304,13 +299,10 @@
"pending": "Pendiente",
"not-started": "No iniciado"
},
- "skip": "Saltar",
"task-checks": "Comprobaciones de tarea",
"prior-backup": "Respaldo previo",
- "skip-failed-in-current-stage": "Saltar tareas fallidas en la etapa actual",
"execution-time": "Tiempo de ejecución",
"run-checks": "Ejecutar comprobaciones",
- "action-all-tasks-in-current-stage": "{action} todas las tareas en la etapa actual",
"cancel-task": "Cancelar tarea | Cancelar tareas",
"skip-task": "Saltar tarea | Saltar tareas",
"run-task": "Ejecutar tarea | Ejecutar tareas",
@@ -353,10 +345,6 @@
"advice-split-statement-to-single-online-migration-issue": "Se recomienda dividir esta declaración en un único problema de migración en línea."
},
"prior-backup-tips": "Copia de seguridad de los datos afectados con anticipación. Solo aplica a cambios de datos (UPDATE, DELETE), no a cambios de esquema.",
- "database-create": {
- "created": "Creado",
- "pending": "Pendiente"
- },
"executed-by": "Ejecutado por",
"affected-rows": "Filas afectadas",
"type": {
@@ -961,15 +949,8 @@
"modal": {
"reopen": "¿Reabrir incidencia?",
"close": "¿Cerrar el problema?"
- },
- "warning": {
- "some-previous-stages-are-not-done": "Algunas etapas anteriores no están realizadas."
- },
- "error": {
- "some-tasks-are-still-running": "Algunas tareas aún se están ejecutando"
}
},
- "add-some-description": "Agregar alguna descripción...",
"leave-a-comment": "Dejar un comentario...",
"no-description-provided": "No se proporcionó ninguna descripción",
"comment-editor": {
@@ -1042,24 +1023,17 @@
"creator": "Creador",
"current-approver": "Aprobador actual"
},
- "stage-select": {
- "current": "{name} (actual)"
- },
"migration-mode": {
"online": {
"description": "Basado en gh-ost. Para tablas grandes, puede reducir la duración del bloqueo de la tabla de horas a segundos {link}."
}
},
- "new-issue": "@:common.new @:common.issue",
- "action-to-current-stage": "{action} etapa actual",
"upload-sql": "Cargar SQL",
"statement-from-sheet-warning": "Debido a que el SQL es demasiado grande, se ha truncado para mostrarlo y la edición está deshabilitada. Puede cargar un nuevo archivo SQL para sobrescribirlo.",
"overwrite-current-statement": "Sobrescribir la declaración SQL actual",
"upload-sql-file-max-size-exceeded": "Se ha excedido el tamaño máximo del archivo ({size}).",
"transaction-mode": {
"label": "Modo de transacción",
- "on": "Activado",
- "off": "Desactivado",
"on-tooltip": "Envuelve todas las declaraciones en una sola transacción (BEGIN/COMMIT).",
"off-tooltip": "Ejecuta declaraciones individualmente en modo de confirmación automática. Las declaraciones se confirman inmediatamente y no se pueden revertir si una declaración posterior falla.",
"execution-order-note": "Las declaraciones no transaccionales se ejecutarán en último lugar."
@@ -1073,8 +1047,7 @@
"close": "Cerca"
},
"approval-flow": {
- "self": "Flujo de aprobación",
- "pre-issue-created-tips": "Después de crear un problema, Bytebase coincidirá automáticamente con la aprobación personalizada correspondiente según el tipo y nivel de riesgo del problema."
+ "self": "Flujo de aprobación"
},
"risk-level": {
"self": "Nivel de riesgo",
@@ -1082,8 +1055,6 @@
"moderate": "Moderado",
"high": "Alto"
},
- "awaiting-rollout": "Esperando para implementar",
- "waiting-for-review": "Esperando revisión",
"issue-name": "Nombre de la incidencia",
"grant-request": {
"details": "Detalles de la solicitud",
@@ -1095,7 +1066,6 @@
"custom-date": "Fecha personalizada",
"custom-date-placeholder": "Seleccione la fecha y hora de vencimiento"
},
- "review-sent-back": "Revisión devuelta",
"action-anyway": "{action} de todos modos",
"sql-check": {
"sql-checks": "Comprobaciones SQL",
@@ -1106,14 +1076,9 @@
"sql-review-violations": "Infracciones de revisión de SQL"
},
"error": {
- "you-don-have-privilege-to-edit-this-issue": "No tienes privilegios para editar este número.",
- "you-are-not-allowed-to-perform-this-action": "No tienes permiso para realizar esta acción.",
- "cannot-close-issue-with-running-tasks": "No se puede cerrar el problema con las tareas en ejecución",
"statement-cannot-be-modified": "La declaración no se puede modificar una vez creado el problema"
},
"unfinished-resolved-issue-tips": "Este problema está marcado como \"Listo\", pero algunas de sus tareas no se ejecutan correctamente.",
- "some-tasks-are-not-executed-successfully": "(Algunas tareas no se ejecutan correctamente)",
- "missing-sql-statement": "Sentencia SQL faltante.",
"data-export": {
"options": "Opciones de exportación",
"limits": "Límites",
@@ -1161,11 +1126,8 @@
"reject-description": "Envíe comentarios y solicite cambios"
},
"approval": {
- "rejected-error": "Se ha rechazado la aprobación del problema.",
- "pending-error": "La aprobación del problema está pendiente.",
"approved-and-waiting-for-rollout": "Este problema ha sido aprobado y está listo para implementarse."
- },
- "new-layout": "Nuevo diseño de CI/CD"
+ }
},
"plan": {
"plans": "Planes",
@@ -1218,9 +1180,6 @@
},
"options": {
"self": "Opciones",
- "applies-to-all-tasks": "Se aplica a todas las tareas.",
- "applies-to-some-tasks": "Se aplica a algunas tareas {count}/{total}",
- "split-into-multiple-issues-tip": "Si desea configurar diferentes opciones para cada tarea, divídala en varios problemas.",
"no-options-available": "No hay opciones disponibles"
},
"editor": {
@@ -1258,9 +1217,7 @@
"rollout": {
"rollouts": "Despliegues",
"bypass-stage-requirements": "Advertencias de bypass",
- "task-execution-notices": "Avisos de ejecución de tareas",
"task-execution-errors": "Errores de ejecución de tareas",
- "no-active-task-to-cancel": "No hay ninguna tarea activa para cancelar.",
"stage": {
"self": "Escenario | Escenarios",
"run-stage": "Ejecutar tareas",
@@ -2682,7 +2639,6 @@
"first-match-wins": "Las reglas se evalúan en orden. Se aplica la primera regla coincidente."
},
"issue-review": {
- "approve-issue": "¿Aprobar incidencia?",
"generating-approval-flow": "Generando flujo de aprobación",
"approved-issue": "incidencia aprobada",
"rejected-issue": "incidencia rechazada",
@@ -2691,9 +2647,7 @@
"some-task-checks-are-still-running": "Algunas comprobaciones de tareas aún se están ejecutando",
"x-field-is-required": "{field} se requiere"
},
- "send-back-issue": "¿Devolver el problema?",
"re-request-review": "Volver a solicitar revisión",
- "re-request-review-issue": "¿Volver a solicitar revisión?",
"re-request-review-success": "Revisión solicitada nuevamente con éxito",
"re-requested-review": "revisión de problema nuevamente solicitada",
"approved-by": "Aprobado por",
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index 66cdd04671..a1f378e5c2 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -163,7 +163,6 @@
"load-more": "もっと読み込む",
"rows-per-page": "ページあたりの行数",
"access-denied": "アクセスが拒否されました",
- "restart": "再起動",
"want-help": "ユーザーグループに参加する",
"operation": "操作",
"discard-changes": "変更をキャンセルする",
@@ -210,7 +209,6 @@
"clear-filters": "フィルタをクリア",
"license": "ライセンス",
"view-details": "詳細を確認する",
- "force-verb": "フォース{verb}",
"untitled": "名前のない",
"missing-required-permission": "必要な権限がありません {permissions}",
"missing-required-permission-for-resource": "リソース {resource} に必要な権限がありません",
@@ -238,8 +236,6 @@
"title": "タイトル",
"text-wrap": "テキストの折り返し",
"catalog": "カタログ",
- "summary": "まとめ",
- "errors": "エラー",
"removed": "削除されました",
"submit": "提出する",
"draft": "下書き",
@@ -275,7 +271,6 @@
"description": "古いバージョンが検出されました。ページを更新してください。"
},
"task": {
- "current-task": "現在のタスク",
"checking": "検査中…",
"check-result": {
"title-general": "テスト結果"
@@ -304,13 +299,10 @@
"pending": "保留中",
"not-started": "開始されていません"
},
- "skip": "飛び越える",
"task-checks": "タスクのチェック項目",
"prior-backup": "影響を受けるデータの事前バックアップ",
- "skip-failed-in-current-stage": "現在のステージで失敗したタスクをスキップします",
"execution-time": "実行時間",
"run-checks": "実行チェック",
- "action-all-tasks-in-current-stage": "{action}現在のステージのすべてのタスク",
"cancel-task": "タスクをキャンセルする",
"skip-task": "タスクをスキップ | タスクをスキップ",
"run-task": "タスクを実行 | タスクを実行",
@@ -353,10 +345,6 @@
"advice-split-statement-to-single-online-migration-issue": "このステートメントを 1 つのオンライン移行の問題に分割することをアドバイスします。"
},
"prior-backup-tips": "影響を受けるデータを事前にバックアップします。データ変更(UPDATE、DELETE)のみに適用され、スキーマ変更には適用されません。",
- "database-create": {
- "created": "作成済み",
- "pending": "保留中"
- },
"executed-by": "実行者",
"affected-rows": "影響を受けた行数",
"type": {
@@ -961,15 +949,8 @@
"modal": {
"reopen": "イシューを再開しますか?",
"close": "問題を閉じますか?"
- },
- "warning": {
- "some-previous-stages-are-not-done": "以前のステージの一部が完了していません。"
- },
- "error": {
- "some-tasks-are-still-running": "一部のタスクはまだ実行中です"
}
},
- "add-some-description": "説明を追加してください…",
"leave-a-comment": "コメントを残す…",
"no-description-provided": "説明なし",
"comment-editor": {
@@ -1042,24 +1023,17 @@
"creator": "作成者",
"current-approver": "現在の承認者"
},
- "stage-select": {
- "current": "{name} (現在)"
- },
"migration-mode": {
"online": {
"description": "gh-ostをベースにしています。大規模なテーブルの場合、テーブルのロック時間を数時間から数秒 {link} に短縮できます。"
}
},
- "new-issue": "@:common.new@:common.issue",
- "action-to-current-stage": "{action}現在の段階",
"upload-sql": "SQLのアップロード",
"statement-from-sheet-warning": "SQL が大きすぎるため、表示時に切り捨てられ、編集が無効になっています。新しい SQL ファイルをアップロードして上書きすることができます。",
"overwrite-current-statement": "現在の SQL ステートメントを上書きする",
"upload-sql-file-max-size-exceeded": "アップロード ファイルのサイズは {size} を超えることはできません。",
"transaction-mode": {
"label": "トランザクションモード",
- "on": "オン",
- "off": "オフ",
"on-tooltip": "すべてのステートメントを単一のトランザクション(BEGIN/COMMIT)でラップします。",
"off-tooltip": "自動コミットモードで個別にステートメントを実行します。ステートメントは即座にコミットされ、後続のステートメントが失敗してもロールバックできません。",
"execution-order-note": "非トランザクション ステートメントは最後に実行されます。"
@@ -1073,8 +1047,7 @@
"close": "閉じる"
},
"approval-flow": {
- "self": "承認の流れ",
- "pre-issue-created-tips": "イシューが作成されると、システムはイシューのタイプとリスク レベルに基づいて、対応するカスタム承認を自動的に照合します。"
+ "self": "承認の流れ"
},
"risk-level": {
"self": "リスクレベル",
@@ -1082,8 +1055,6 @@
"moderate": "適度",
"high": "高い"
},
- "awaiting-rollout": "リリース待ち",
- "waiting-for-review": "モデレート済み",
"issue-name": "イシュー名",
"grant-request": {
"details": "リクエストの詳細",
@@ -1095,7 +1066,6 @@
"custom-date": "カスタム日付",
"custom-date-placeholder": "有効期限と時刻を選択します"
},
- "review-sent-back": "レビューが返されました",
"action-anyway": "まだ {action} が必要です",
"sql-check": {
"sql-checks": "SQLチェック項目",
@@ -1106,14 +1076,9 @@
"sql-review-violations": "SQL監査ルール違反"
},
"error": {
- "you-don-have-privilege-to-edit-this-issue": "このイシューを編集する権限がありません",
- "you-are-not-allowed-to-perform-this-action": "このアクションを実行する権限がありません",
- "cannot-close-issue-with-running-tasks": "実行中のタスクに関する問題を解決できません",
"statement-cannot-be-modified": "問題の作成後にステートメントを変更することはできません"
},
"unfinished-resolved-issue-tips": "イシューは「完了」とマークされましたが、一部のタスクは正常に実行されませんでした。",
- "some-tasks-are-not-executed-successfully": "(一部のタスクは正常に実行されませんでした)",
- "missing-sql-statement": "SQL ステートメントが欠落しています。",
"data-export": {
"options": "設定項目",
"limits": "制限",
@@ -1161,11 +1126,8 @@
"reject-description": "フィードバックを送信して変更をリクエストする"
},
"approval": {
- "rejected-error": "問題の承認が拒否されました。",
- "pending-error": "問題の承認が保留中です。",
"approved-and-waiting-for-rollout": "この問題は承認されており、展開する準備ができています。"
- },
- "new-layout": "新しいCI/CDレイアウト"
+ }
},
"plan": {
"plans": "予定",
@@ -1218,9 +1180,6 @@
},
"options": {
"self": "オプション",
- "applies-to-all-tasks": "すべてのタスクに適用",
- "applies-to-some-tasks": "一部のタスクに適用されます {count}/{total}",
- "split-into-multiple-issues-tip": "タスクごとに異なるオプションを設定する場合は、複数の問題に分割してください。",
"no-options-available": "利用可能なオプションはありません"
},
"editor": {
@@ -1258,9 +1217,7 @@
"rollout": {
"rollouts": "ロールアウト",
"bypass-stage-requirements": "バイパス警告",
- "task-execution-notices": "タスク実行通知",
"task-execution-errors": "タスク実行エラー",
- "no-active-task-to-cancel": "キャンセルするアクティブなタスクはありません。",
"stage": {
"self": "ステージ | ステージ",
"run-stage": "タスクを実行",
@@ -2682,7 +2639,6 @@
"first-match-wins": "ルールは順番に評価されます。最初に一致するルールが適用されます。"
},
"issue-review": {
- "approve-issue": "イシューを承認しますか?",
"generating-approval-flow": "承認フローが生成されています",
"approved-issue": "イシューを承認する",
"rejected-issue": "イシューを却下した",
@@ -2691,9 +2647,7 @@
"some-task-checks-are-still-running": "確認すべき実行中のタスクがまだあります",
"x-field-is-required": "{field}は必須です"
},
- "send-back-issue": "イシューを却下しますか?",
"re-request-review": "再度承認をリクエストする",
- "re-request-review-issue": "イシューの承認を再度リクエストしますか?",
"re-request-review-success": "レビューの再リクエストが完了しました",
"re-requested-review": "イシューの承認を再度リクエストします",
"approved-by": "承認者",
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index 698575b8c9..ece50abbf7 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -163,7 +163,6 @@
"load-more": "Tải thêm",
"rows-per-page": "Số dòng mỗi trang",
"access-denied": "Truy cập bị từ chối",
- "restart": "Khởi động lại",
"want-help": "Cần trợ giúp",
"operation": "Thao tác",
"discard-changes": "Hủy thay đổi",
@@ -210,7 +209,6 @@
"clear-filters": "Xóa bộ lọc",
"license": "Giấy phép",
"view-details": "Xem chi tiết",
- "force-verb": "Buộc {verb}",
"untitled": "Không tiêu đề",
"missing-required-permission": "Thiếu quyền cần thiết {permissions}",
"missing-required-permission-for-resource": "Thiếu quyền cần thiết cho tài nguyên {resource}",
@@ -238,8 +236,6 @@
"title": "Tiêu đề",
"text-wrap": "Ngắt dòng văn bản",
"catalog": "Danh mục",
- "summary": "Tóm tắt",
- "errors": "Lỗi",
"removed": "LOẠI BỎ",
"submit": "Nộp",
"draft": "Bản nháp",
@@ -275,7 +271,6 @@
"description": "Đã phát hiện phiên bản lỗi thời. Vui lòng làm mới trang."
},
"task": {
- "current-task": "Nhiệm vụ hiện tại",
"checking": "Đang kiểm tra...",
"check-result": {
"title-general": "Kết quả kiểm tra"
@@ -304,13 +299,10 @@
"pending": "Đang chờ",
"not-started": "Chưa bắt đầu"
},
- "skip": "Bỏ qua",
"task-checks": "Kiểm tra tác vụ",
"prior-backup": "Sao lưu trước",
- "skip-failed-in-current-stage": "Bỏ qua các tác vụ thất bại trong giai đoạn hiện tại",
"execution-time": "Thời gian thực thi",
"run-checks": "Chạy kiểm tra",
- "action-all-tasks-in-current-stage": "{action} tất cả các tác vụ trong giai đoạn hiện tại",
"cancel-task": "Hủy tác vụ | Hủy các tác vụ",
"skip-task": "Bỏ qua nhiệm vụ | Bỏ qua nhiệm vụ",
"run-task": "Chạy tác vụ | Chạy tác vụ",
@@ -353,10 +345,6 @@
"advice-split-statement-to-single-online-migration-issue": "Đề nghị chia câu lệnh này thành một vấn đề di chuyển trực tuyến."
},
"prior-backup-tips": "Sao lưu dữ liệu bị ảnh hưởng trước thời hạn. Chỉ áp dụng cho thay đổi dữ liệu (UPDATE, DELETE), không áp dụng cho thay đổi cấu trúc.",
- "database-create": {
- "created": "Đã tạo",
- "pending": "Đang chờ xử lý"
- },
"executed-by": "Được thực hiện bởi",
"affected-rows": "Hàng bị ảnh hưởng",
"type": {
@@ -961,15 +949,8 @@
"modal": {
"reopen": "Mở lại vấn đề?",
"close": "Đóng vấn đề?"
- },
- "warning": {
- "some-previous-stages-are-not-done": "Một số giai đoạn trước chưa được thực hiện."
- },
- "error": {
- "some-tasks-are-still-running": "Một số tác vụ vẫn đang chạy"
}
},
- "add-some-description": "Thêm mô tả...",
"leave-a-comment": "Để lại bình luận...",
"no-description-provided": "Không có mô tả nào được cung cấp",
"comment-editor": {
@@ -1042,24 +1023,17 @@
"creator": "Người tạo",
"current-approver": "Người phê duyệt hiện tại"
},
- "stage-select": {
- "current": "{name} (hiện tại)"
- },
"migration-mode": {
"online": {
"description": "Dựa trên gh-ost. Đối với các bảng lớn, nó có thể giảm thời gian khóa bảng từ hàng giờ xuống còn vài giây {link}."
}
},
- "new-issue": "@:common.new @:common.issue",
- "action-to-current-stage": "{action} giai đoạn hiện tại",
"upload-sql": "Tải lên SQL",
"statement-from-sheet-warning": "Do kích thước SQL vượt quá, nó đã bị cắt bớt để hiển thị và chỉnh sửa bị vô hiệu hóa. Bạn có thể tải lên một tệp SQL mới để ghi đè nó.",
"overwrite-current-statement": "Ghi đè câu lệnh SQL hiện tại",
"upload-sql-file-max-size-exceeded": "Vượt quá kích thước tệp tối đa ({size}).",
"transaction-mode": {
"label": "Chế độ giao dịch",
- "on": "Bật",
- "off": "Tắt",
"on-tooltip": "Gói tất cả các câu lệnh trong một giao dịch duy nhất (BEGIN/COMMIT).",
"off-tooltip": "Thực thi các câu lệnh riêng lẻ trong chế độ tự động commit. Các câu lệnh được commit ngay lập tức và không thể khôi phục nếu câu lệnh sau đó thất bại.",
"execution-order-note": "Các câu lệnh không liên quan đến giao dịch sẽ được thực hiện cuối cùng."
@@ -1073,8 +1047,7 @@
"close": "Đóng"
},
"approval-flow": {
- "self": "Quy trình phê duyệt",
- "pre-issue-created-tips": "Sau khi một vấn đề được tạo, Bytebase sẽ tự động khớp với phê duyệt tùy chỉnh tương ứng dựa trên loại và mức độ rủi ro của vấn đề."
+ "self": "Quy trình phê duyệt"
},
"risk-level": {
"self": "Mức độ rủi ro",
@@ -1082,8 +1055,6 @@
"moderate": "Trung bình",
"high": "Cao"
},
- "awaiting-rollout": "Đang chờ triển khai",
- "waiting-for-review": "Đang chờ xem xét",
"issue-name": "Tên vấn đề",
"grant-request": {
"details": "Yêu cầu chi tiết",
@@ -1095,7 +1066,6 @@
"custom-date": "Ngày tùy chỉnh",
"custom-date-placeholder": "Chọn ngày và giờ hết hạn"
},
- "review-sent-back": "Đánh giá đã gửi lại",
"action-anyway": "{action} bằng mọi cách",
"sql-check": {
"sql-checks": "Kiểm tra SQL",
@@ -1106,14 +1076,9 @@
"sql-review-violations": "Vi phạm đánh giá SQL"
},
"error": {
- "you-don-have-privilege-to-edit-this-issue": "Bạn không có quyền chỉnh sửa vấn đề này",
- "you-are-not-allowed-to-perform-this-action": "Bạn không được phép thực hiện hành động này",
- "cannot-close-issue-with-running-tasks": "Không thể đóng vấn đề với các tác vụ đang chạy",
"statement-cannot-be-modified": "Không thể sửa đổi câu lệnh sau khi vấn đề được tạo"
},
"unfinished-resolved-issue-tips": "Vấn đề này được đánh dấu là \"Hoàn tất\" nhưng một số tác vụ của nó không được thực hiện thành công.",
- "some-tasks-are-not-executed-successfully": "(Một số tác vụ không được thực hiện thành công)",
- "missing-sql-statement": "Thiếu câu lệnh SQL",
"data-export": {
"options": "Tùy chọn",
"limits": "Giới hạn",
@@ -1161,11 +1126,8 @@
"reject-description": "Gửi phản hồi và yêu cầu thay đổi"
},
"approval": {
- "rejected-error": "Đã từ chối phê duyệt vấn đề.",
- "pending-error": "Đang chờ phê duyệt vấn đề.",
"approved-and-waiting-for-rollout": "Phiên bản này đã được chấp thuận và sẵn sàng triển khai."
- },
- "new-layout": "Bố cục CI/CD mới"
+ }
},
"plan": {
"plans": "Kế hoạch",
@@ -1218,9 +1180,6 @@
},
"options": {
"self": "Tùy chọn",
- "applies-to-all-tasks": "Áp dụng cho tất cả các nhiệm vụ",
- "applies-to-some-tasks": "Áp dụng cho một số tác vụ {count}/{total}",
- "split-into-multiple-issues-tip": "Nếu bạn muốn cấu hình các tùy chọn khác nhau cho mỗi tác vụ, vui lòng chia thành nhiều vấn đề.",
"no-options-available": "Không có tùy chọn nào khả dụng"
},
"editor": {
@@ -1258,9 +1217,7 @@
"rollout": {
"rollouts": "Triển khai",
"bypass-stage-requirements": "Bỏ qua cảnh báo",
- "task-execution-notices": "Thông báo thực hiện nhiệm vụ",
"task-execution-errors": "Lỗi thực hiện tác vụ",
- "no-active-task-to-cancel": "Không có tác vụ nào đang hoạt động để hủy.",
"stage": {
"self": "Giai đoạn | Các giai đoạn",
"run-stage": "Chạy tác vụ",
@@ -2682,7 +2639,6 @@
"first-match-wins": "Các quy tắc được đánh giá theo thứ tự. Quy tắc phù hợp đầu tiên sẽ được áp dụng."
},
"issue-review": {
- "approve-issue": "Phê duyệt vấn đề?",
"generating-approval-flow": "Đang tạo quy trình phê duyệt",
"approved-issue": "đã phê duyệt vấn đề",
"rejected-issue": "đã từ chối vấn đề",
@@ -2691,9 +2647,7 @@
"some-task-checks-are-still-running": "Một số kiểm tra tác vụ vẫn đang chạy",
"x-field-is-required": "{field} là bắt buộc"
},
- "send-back-issue": "Gửi lại vấn đề?",
"re-request-review": "Yêu cầu xem xét lại",
- "re-request-review-issue": "Yêu cầu xem xét lại vấn đề?",
"re-request-review-success": "Yêu cầu xem xét lại đã được thực hiện thành công.",
"re-requested-review": "đã yêu cầu xem xét lại vấn đề",
"approved-by": "Được chấp thuận bởi",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 34188fac2a..44a5b717a0 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -163,7 +163,6 @@
"load-more": "加载更多",
"rows-per-page": "每页行数",
"access-denied": "拒绝访问",
- "restart": "重启",
"want-help": "加入用户群",
"operation": "操作",
"discard-changes": "取消修改",
@@ -210,7 +209,6 @@
"clear-filters": "清除过滤",
"license": "证书",
"view-details": "查看详情",
- "force-verb": "强制{verb}",
"untitled": "未命名",
"missing-required-permission": "缺少必需的权限 {permissions}",
"missing-required-permission-for-resource": "缺少资源 {resource} 的必需权限",
@@ -238,8 +236,6 @@
"title": "标题",
"text-wrap": "文本折行",
"catalog": "Catalog",
- "summary": "总结",
- "errors": "错误",
"removed": "已移除",
"submit": "提交",
"draft": "草稿",
@@ -275,7 +271,6 @@
"description": "检测到过时版本。请刷新页面。"
},
"task": {
- "current-task": "当前任务",
"checking": "检查中…",
"check-result": {
"title-general": "检查结果"
@@ -304,13 +299,10 @@
"pending": "待执行",
"not-started": "未开始"
},
- "skip": "跳过",
"task-checks": "任务检查项",
"prior-backup": "预备份受影响数据",
- "skip-failed-in-current-stage": "跳过当前阶段失败的任务",
"execution-time": "执行时间",
"run-checks": "运行检查",
- "action-all-tasks-in-current-stage": "{action}当前阶段的所有任务",
"cancel-task": "取消任务",
"skip-task": "跳过任务 | 跳过任务",
"run-task": "运行任务 | 运行任务",
@@ -353,10 +345,6 @@
"advice-split-statement-to-single-online-migration-issue": "建议将该语句拆分成单独的在线大表变更工单。"
},
"prior-backup-tips": "提前备份受影响的数据。仅适用于数据变更(UPDATE、DELETE),不适用于结构变更。",
- "database-create": {
- "created": "已创建",
- "pending": "待创建"
- },
"executed-by": "执行者",
"affected-rows": "影响行数",
"type": {
@@ -961,15 +949,8 @@
"modal": {
"reopen": "重开工单?",
"close": "关闭工单?"
- },
- "warning": {
- "some-previous-stages-are-not-done": "存在之前的阶段尚未完成。"
- },
- "error": {
- "some-tasks-are-still-running": "部分任务仍在运行"
}
},
- "add-some-description": "添加一些描述…",
"leave-a-comment": "发表一条评论…",
"no-description-provided": "未提供描述",
"comment-editor": {
@@ -1042,24 +1023,17 @@
"creator": "创建人",
"current-approver": "当前审批人"
},
- "stage-select": {
- "current": "{name}(当前)"
- },
"migration-mode": {
"online": {
"description": "基于 gh-ost。对于大表,可以把锁表的时间从小时级降低到秒级 {link}。"
}
},
- "new-issue": "@:common.new@:common.issue",
- "action-to-current-stage": "{action}当前阶段",
"upload-sql": "上传 SQL",
"statement-from-sheet-warning": "由于 SQL 文件过大,因此被截断以便显示,并且编辑功能已禁用。你可以上传新的 SQL 文件以将其覆盖。",
"overwrite-current-statement": "覆盖当前的 SQL 语句",
"upload-sql-file-max-size-exceeded": "上传文件大小不能超过 {size}。",
"transaction-mode": {
"label": "事务模式",
- "on": "开启",
- "off": "关闭",
"on-tooltip": "将所有语句包装在单个事务中(BEGIN/COMMIT)。",
"off-tooltip": "以自动提交模式单独执行语句。语句立即提交,如果后续语句失败则无法回滚。",
"execution-order-note": "非事务性语句将最后执行。"
@@ -1073,8 +1047,7 @@
"close": "关闭"
},
"approval-flow": {
- "self": "审批流",
- "pre-issue-created-tips": "在工单创建后,系统将根据工单的类型和风险等级自动匹配相应的自定义审批。"
+ "self": "审批流"
},
"risk-level": {
"self": "风险等级",
@@ -1082,8 +1055,6 @@
"moderate": "中风险",
"high": "高风险"
},
- "awaiting-rollout": "等待发布",
- "waiting-for-review": "等待审核",
"issue-name": "工单名称",
"grant-request": {
"details": "请求详细",
@@ -1095,7 +1066,6 @@
"custom-date": "自定义日期",
"custom-date-placeholder": "选择到期日期和时间"
},
- "review-sent-back": "审核被退回",
"action-anyway": "仍要{action}",
"sql-check": {
"sql-checks": "SQL 检查项",
@@ -1106,14 +1076,9 @@
"sql-review-violations": "违反的 SQL 审核规则"
},
"error": {
- "you-don-have-privilege-to-edit-this-issue": "您没有权限编辑此工单",
- "you-are-not-allowed-to-perform-this-action": "您无权执行此操作",
- "cannot-close-issue-with-running-tasks": "无法关闭还存在运行中任务的工单",
"statement-cannot-be-modified": "工单创建后,语句将无法修改"
},
"unfinished-resolved-issue-tips": "该工单被标记为「已完成」,但其中部分任务并未成功执行。",
- "some-tasks-are-not-executed-successfully": "(部分任务并未成功执行)",
- "missing-sql-statement": "SQL 语句缺失。",
"data-export": {
"options": "配置项",
"limits": "限制",
@@ -1161,11 +1126,8 @@
"reject-description": "提交反馈并要求修改"
},
"approval": {
- "rejected-error": "此工单已被退回。",
- "pending-error": "此工单正在等待审批。",
"approved-and-waiting-for-rollout": "该工单已批准,等待发布。"
- },
- "new-layout": "使用新版 CI/CD 页面"
+ }
},
"plan": {
"plans": "变更计划",
@@ -1218,9 +1180,6 @@
},
"options": {
"self": "配置项",
- "applies-to-all-tasks": "适用于所有任务",
- "applies-to-some-tasks": "适用于部分任务 {count}/{total}",
- "split-into-multiple-issues-tip": "如果您想为每个任务设置不同的配置项,请拆分成多个工单。",
"no-options-available": "暂无可配置项"
},
"editor": {
@@ -1258,9 +1217,7 @@
"rollout": {
"rollouts": "发布任务",
"bypass-stage-requirements": "绕过提醒",
- "task-execution-notices": "任务执行提醒",
"task-execution-errors": "任务执行警告",
- "no-active-task-to-cancel": "没有要取消的任务。",
"stage": {
"self": "阶段 | 阶段",
"run-stage": "运行任务",
@@ -2682,7 +2639,6 @@
"first-match-wins": "规则按顺序评估,第一个匹配的规则将被应用。"
},
"issue-review": {
- "approve-issue": "批准工单?",
"generating-approval-flow": "正在生成审批流",
"approved-issue": "批准工单",
"rejected-issue": "驳回工单",
@@ -2691,9 +2647,7 @@
"some-task-checks-are-still-running": "尚有运行中的任务检查项。",
"x-field-is-required": "{field}为必填项"
},
- "send-back-issue": "退回工单?",
"re-request-review": "请求再次审批",
- "re-request-review-issue": "请求再次审批工单?",
"re-request-review-success": "已成功请求再次审批",
"re-requested-review": "再次请求审批工单",
"approved-by": "已批准",
diff --git a/frontend/src/router/dashboard/projectV1.ts b/frontend/src/router/dashboard/projectV1.ts
index d5fc27be95..55204613c5 100644
--- a/frontend/src/router/dashboard/projectV1.ts
+++ b/frontend/src/router/dashboard/projectV1.ts
@@ -15,7 +15,6 @@ export const PROJECT_V1_ROUTE_DATABASE_GROUPS_CREATE = `${PROJECT_V1_ROUTE_DASHB
export const PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.database-group.detail`;
export const PROJECT_V1_ROUTE_ISSUES = `${PROJECT_V1_ROUTE_DASHBOARD}.issue`;
export const PROJECT_V1_ROUTE_ISSUE_DETAIL = `${PROJECT_V1_ROUTE_ISSUES}.detail`;
-export const PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 = `${PROJECT_V1_ROUTE_ISSUES}.detail.v1`;
export const PROJECT_V1_ROUTE_PLANS = `${PROJECT_V1_ROUTE_DASHBOARD}.plan`;
export const PROJECT_V1_ROUTE_PLAN_DETAIL = `${PROJECT_V1_ROUTE_DASHBOARD}.plan.detail`;
export const PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS = `${PROJECT_V1_ROUTE_PLAN_DETAIL}.specs`;
@@ -73,7 +72,7 @@ const issueRoutes: RouteRecordRaw[] = [
},
{
path: "issues/:issueId(\\d+)",
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
meta: {
requiredPermissionList: () => ["bb.issues.get"],
},
@@ -233,31 +232,28 @@ const projectV1Routes: RouteRecordRaw[] = [
},
{
path: "issues",
+ name: PROJECT_V1_ROUTE_ISSUES,
meta: {
title: () => t("common.issues"),
+ requiredPermissionList: () => ["bb.issues.list"],
},
+ component: () => import("@/views/project/ProjectIssueDashboard.vue"),
props: true,
- children: [
- {
- path: "",
- name: PROJECT_V1_ROUTE_ISSUES,
- meta: {
- requiredPermissionList: () => ["bb.issues.list"],
- },
- component: () =>
- import("@/views/project/ProjectIssueDashboard.vue"),
- props: true,
- },
- {
- path: ":issueSlug",
+ },
+ // Redirect legacy issue slug format (e.g., "my-issue-123") to new numeric format
+ {
+ path: "issues/:issueSlug",
+ redirect: (to) => {
+ const { issueSlug, projectId } = to.params;
+ // Extract issue ID from slug (last part after the final hyphen)
+ const match = String(issueSlug).match(/-(\d+)$/);
+ const issueId = match ? match[1] : issueSlug;
+ return {
name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- meta: {
- requiredPermissionList: () => ["bb.issues.get"],
- },
- component: () => import("@/views/project/ProjectIssueDetail.vue"),
- props: true,
- },
- ],
+ params: { projectId, issueId },
+ query: to.query,
+ };
+ },
},
{
path: "plans",
diff --git a/frontend/src/utils/v1/issue/issue.ts b/frontend/src/utils/v1/issue/issue.ts
index 0c0f0cc685..e6324945d1 100644
--- a/frontend/src/utils/v1/issue/issue.ts
+++ b/frontend/src/utils/v1/issue/issue.ts
@@ -1,20 +1,34 @@
+import { create } from "@bufbuild/protobuf";
import dayjs from "dayjs";
-import slug from "slug";
import { t } from "@/plugins/i18n";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
-} from "@/router/dashboard/projectV1";
-import { type ComposedIssue, EMPTY_ID, UNKNOWN_ID } from "@/types";
-import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
+ projectNamePrefix,
+ useDatabaseV1Store,
+ useEnvironmentV1Store,
+ useInstanceResourceByName,
+ useProjectV1Store,
+} from "@/store";
+import {
+ type ComposedDatabase,
+ type ComposedIssue,
+ EMPTY_ID,
+ isValidDatabaseName,
+ UNKNOWN_ID,
+ unknownDatabase,
+} from "@/types";
+import { State } from "@/types/proto-es/v1/common_pb";
+import { InstanceResourceSchema } from "@/types/proto-es/v1/instance_service_pb";
+import {
+ type Issue,
+ Issue_Type,
+ IssueStatus,
+} from "@/types/proto-es/v1/issue_service_pb";
import type { Plan } from "@/types/proto-es/v1/plan_service_pb";
-import type { Rollout } from "@/types/proto-es/v1/rollout_service_pb";
-import { Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
-import { extractProjectResourceName } from "../project";
-
-export const issueV1Slug = (name: string, title: string = "issue") => {
- return [slug(title), extractIssueUID(name)].join("-");
-};
+import type { Project } from "@/types/proto-es/v1/project_service_pb";
+import type { Rollout, Task } from "@/types/proto-es/v1/rollout_service_pb";
+import { Task_Status, Task_Type } from "@/types/proto-es/v1/rollout_service_pb";
+import { extractDatabaseResourceName, extractProjectResourceName } from "..";
export const extractIssueUID = (name: string) => {
const pattern = /(?:^|\/)issues\/(\d+)(?:$|\/)/;
@@ -103,89 +117,135 @@ export const generateIssueTitle = (
};
/**
- * Determines whether an issue should use the new CICD layout route.
+ * Gets the route name and params for an issue.
*
- * Rules:
- * - Grant request issues: ALWAYS use new layout
- * - Create database issues: ALWAYS use new layout
- * - Data export issues: ALWAYS use new layout
- * - Issues without rollout: ALWAYS use new layout (legacy UI cannot display them)
- * - Database changing issues: Use new layout ONLY when enabledNewLayout is true
+ * @param issue - The issue object (must have name)
+ * @returns Route configuration with name and params
*/
-export const shouldUseNewIssueLayout = (
- issue: { type?: Issue_Type; name?: string },
- plan?: Plan,
- enabledNewLayout = true
-): boolean => {
- // Grant request issues always use new layout
- if (issue.type === Issue_Type.GRANT_REQUEST) {
- return true;
- }
+export const getIssueRoute = (issue: {
+ name: string;
+}): {
+ name: string;
+ params: { projectId: string; issueId: string };
+} => {
+ const projectId = extractProjectResourceName(issue.name);
+ return {
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
+ params: {
+ projectId,
+ issueId: extractIssueUID(issue.name),
+ },
+ };
+};
- // Check if it's a create database or export data plan
- if (plan?.specs) {
- const isCreatingDatabasePlan = plan.specs.every(
- (spec) => spec.config?.case === "createDatabaseConfig"
- );
- const isExportDataPlan = plan.specs.every(
- (spec) => spec.config?.case === "exportDataConfig"
- );
+export const projectOfIssue = (issue: Issue): Project => {
+ return useProjectV1Store().getProjectByName(
+ `${projectNamePrefix}${extractProjectResourceName(issue.name)}`
+ );
+};
- if (isCreatingDatabasePlan || isExportDataPlan) {
- return true;
- }
+export const isUnfinishedResolvedTask = (issue: ComposedIssue | undefined) => {
+ if (!issue) {
+ return false;
}
-
- // Database export issue type always uses new layout
- if (issue.type === Issue_Type.DATABASE_EXPORT) {
- return true;
+ if (!isValidIssueName(issue.name)) {
+ return false;
}
-
- // Issues without rollout must use new layout (legacy UI cannot display them)
- if (plan && plan.hasRollout === false) {
- return true;
+ if (issue.status !== IssueStatus.DONE) {
+ return false;
}
+ return flattenTaskV1List(issue.rolloutEntity).some((task) => {
+ return ![Task_Status.DONE, Task_Status.SKIPPED].includes(task.status);
+ });
+};
- // For database changing issues, respect the layout preference
- return enabledNewLayout;
+export const mockDatabase = (projectEntity: Project, database: string) => {
+ // Database not found, it's probably NOT_FOUND (maybe dropped actually)
+ // Mock a database using all known resources
+ const db = unknownDatabase();
+ db.project = projectEntity.name;
+
+ db.name = database;
+ const { instance, databaseName } = extractDatabaseResourceName(db.name);
+ db.databaseName = databaseName;
+ db.instance = instance;
+ const { instance: instanceFromStore } = useInstanceResourceByName(instance);
+ // Create InstanceResource from the instance data
+ const instanceData = instanceFromStore.value;
+ db.instanceResource = create(InstanceResourceSchema, {
+ name: instanceData.name,
+ engine: instanceData.engine,
+ title: instanceData.title,
+ activation: instanceData.activation ?? true,
+ dataSources: instanceData.dataSources ?? [],
+ environment: instanceData.environment,
+ engineVersion: instanceData.engineVersion ?? "",
+ });
+ db.environment = db.instanceResource.environment;
+ db.effectiveEnvironment = db.instanceResource.environment;
+ db.effectiveEnvironmentEntity = useEnvironmentV1Store().getEnvironmentByName(
+ db.instanceResource.environment ?? ""
+ );
+ db.state = State.DELETED;
+ return db;
};
-/**
- * Gets the appropriate route name and params for an issue based on its type and layout settings.
- *
- * @param issue - The issue object (must have name, and optionally type)
- * @param plan - Optional plan object to check for create database or export data specs
- * @param enabledNewLayout - Whether the new layout is enabled (default: true)
- * @returns Route configuration with name and params
- */
-export const getIssueRoute = (
- issue: { type?: Issue_Type; name: string; title?: string },
- plan?: Plan,
- enabledNewLayout = true
-): {
- name: string;
- params: { projectId: string; issueSlug?: string; issueId?: string };
-} => {
- const projectId = extractProjectResourceName(issue.name);
- const useNewLayout = shouldUseNewIssueLayout(issue, plan, enabledNewLayout);
+export const extractCoreDatabaseInfoFromDatabaseCreateTask = (
+ project: Project,
+ task: Task,
+ plan?: Plan
+) => {
+ const coreDatabaseInfo = (
+ instanceName: string,
+ databaseName: string
+ ): ComposedDatabase => {
+ const name = `${instanceName}/databases/${databaseName}`;
+ const maybeExistedDatabase = useDatabaseV1Store().getDatabaseByName(name);
+ if (isValidDatabaseName(maybeExistedDatabase.name)) {
+ return maybeExistedDatabase;
+ }
- if (useNewLayout) {
- // Use new CICD layout route with numeric issueId
- return {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: {
- projectId,
- issueId: extractIssueUID(issue.name),
- },
- };
- } else {
- // Use legacy route with issueSlug
+ const environmentStore = useEnvironmentV1Store();
+ const { instance: instanceFromStore } =
+ useInstanceResourceByName(instanceName);
+ // Create InstanceResource from the instance data
+ const instanceData = instanceFromStore.value;
+ const instanceResource = create(InstanceResourceSchema, {
+ name: instanceData.name,
+ engine: instanceData.engine,
+ title: instanceData.title,
+ activation: instanceData.activation ?? true,
+ dataSources: instanceData.dataSources ?? [],
+ environment: instanceData.environment,
+ engineVersion: instanceData.engineVersion ?? "",
+ });
+ const effectiveEnvironmentEntity = environmentStore.getEnvironmentByName(
+ instanceResource.environment ?? ""
+ );
return {
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId,
- issueSlug: issueV1Slug(issue.name, issue.title || "issue"),
- },
+ ...unknownDatabase(),
+ name,
+ databaseName,
+ instance: instanceName,
+ project: project.name,
+ projectEntity: project,
+ effectiveEnvironment: instanceResource.environment,
+ effectiveEnvironmentEntity: effectiveEnvironmentEntity,
+ instanceResource,
};
+ };
+
+ if (task.payload?.case === "databaseCreate") {
+ const instance = task.target;
+ // Get database name from plan spec
+ const spec = plan?.specs?.find((s) => s.id === task.specId);
+ const createConfig =
+ spec?.config?.case === "createDatabaseConfig"
+ ? spec.config.value
+ : undefined;
+ const databaseName = createConfig?.database || "";
+ return coreDatabaseInfo(instance, databaseName);
}
+
+ return unknownDatabase();
};
diff --git a/frontend/src/utils/v1/issue/rollout.ts b/frontend/src/utils/v1/issue/rollout.ts
index 60b8dfcbcf..752f265b52 100644
--- a/frontend/src/utils/v1/issue/rollout.ts
+++ b/frontend/src/utils/v1/issue/rollout.ts
@@ -1,7 +1,5 @@
import { last } from "lodash-es";
import { useI18n } from "vue-i18n";
-import { extractCoreDatabaseInfoFromDatabaseCreateTask } from "@/components/IssueV1";
-import { mockDatabase } from "@/components/IssueV1/logic/utils";
import { TASK_STATUS_FILTERS } from "@/components/Plan/constants/task";
import { useDatabaseV1Store } from "@/store";
import {
@@ -25,7 +23,11 @@ import {
Task_Type,
TaskRun_Status,
} from "@/types/proto-es/v1/rollout_service_pb";
-import { flattenTaskV1List } from "./issue";
+import {
+ extractCoreDatabaseInfoFromDatabaseCreateTask,
+ flattenTaskV1List,
+ mockDatabase,
+} from "./issue";
export const extractPlanUIDFromRolloutName = (name: string) => {
const pattern = /(?:^|\/)plans\/([^/]+)\/rollout(?:$|\/)/;
diff --git a/frontend/src/views/project/IssueDetailV1View.vue b/frontend/src/views/project/IssueDetailV1View.vue
index a75abace26..bc58894379 100644
--- a/frontend/src/views/project/IssueDetailV1View.vue
+++ b/frontend/src/views/project/IssueDetailV1View.vue
@@ -19,7 +19,6 @@
<script lang="ts" setup>
import { computed, onMounted, ref } from "vue";
-import { useRoute, useRouter } from "vue-router";
import { BBSpin } from "@/bbkit";
import { usePlanContextWithIssue } from "@/components/Plan";
import { DatabaseChangeView } from "@/components/Plan/components/IssueReviewView/DatabaseChangeView";
@@ -27,10 +26,7 @@ import DatabaseCreateView from "@/components/Plan/components/IssueReviewView/Dat
import DatabaseExportView from "@/components/Plan/components/IssueReviewView/DatabaseExportView.vue";
import GrantRequestView from "@/components/Plan/components/IssueReviewView/GrantRequestView.vue";
import IssueBaseLayout from "@/components/Plan/components/IssueReviewView/IssueBaseLayout.vue";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { Issue_Type } from "@/types/proto-es/v1/issue_service_pb";
-import { issueV1Slug } from "@/utils";
enum IssueType {
CREATE_DATABASE = "CREATE_DATABASE",
@@ -39,15 +35,12 @@ enum IssueType {
DATABASE_CHANGE = "DATABASE_CHANGE",
}
-const props = defineProps<{
+defineProps<{
projectId: string;
issueId: string;
}>();
-const router = useRouter();
-const route = useRoute();
const { plan, issue } = usePlanContextWithIssue();
-const { enabledNewLayout } = useIssueLayoutVersion();
const isLoading = ref(true);
const issueType = computed(() => {
@@ -65,30 +58,6 @@ const issueType = computed(() => {
});
onMounted(() => {
- // Redirect to legacy layout for database change issues when new layout is disabled
- const usesNewLayoutOnly =
- issueType.value === IssueType.CREATE_DATABASE ||
- issueType.value === IssueType.EXPORT_DATA ||
- issueType.value === IssueType.GRANT_REQUEST;
-
- // Only redirect to legacy UI if:
- // 1. New layout is disabled
- // 2. Issue type is not new-layout-only
- // 3. Rollout exists (legacy UI cannot display issues without rollout)
- if (!enabledNewLayout.value && !usesNewLayoutOnly && plan.value.hasRollout) {
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: props.projectId,
- issueSlug: issueV1Slug(
- `projects/${props.projectId}/issues/${props.issueId}`,
- "issue"
- ),
- },
- query: route.query,
- });
- return;
- }
isLoading.value = false;
});
</script>
diff --git a/frontend/src/views/project/PlanSpecDetailView.vue b/frontend/src/views/project/PlanSpecDetailView.vue
index 583d37c5e4..6fcd8d446e 100644
--- a/frontend/src/views/project/PlanSpecDetailView.vue
+++ b/frontend/src/views/project/PlanSpecDetailView.vue
@@ -9,7 +9,7 @@ import { computed, onMounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import { usePlanContext } from "@/components/Plan";
import { SpecDetailView } from "@/components/Plan/components";
-import { PROJECT_V1_ROUTE_ISSUE_DETAIL_V1 } from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";
import { extractIssueUID } from "@/utils";
const route = useRoute();
@@ -23,7 +23,7 @@ onMounted(() => {
const hasIssue = !!plan.value.issue;
if (hasIssue) {
router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: route.params.projectId,
issueId: extractIssueUID(plan.value.issue),
diff --git a/frontend/src/views/project/PlanSpecsView.vue b/frontend/src/views/project/PlanSpecsView.vue
index 8e0deb084c..4358e11544 100644
--- a/frontend/src/views/project/PlanSpecsView.vue
+++ b/frontend/src/views/project/PlanSpecsView.vue
@@ -6,7 +6,7 @@ import { head } from "lodash-es";
import { useRoute, useRouter } from "vue-router";
import { usePlanContext } from "@/components/Plan";
import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ PROJECT_V1_ROUTE_ISSUE_DETAIL,
PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
} from "@/router/dashboard/projectV1";
import { extractIssueUID } from "@/utils";
@@ -29,7 +29,7 @@ const isDatabaseChangePlan = plan.value.specs.some(
if (hasIssue && isDatabaseChangePlan) {
router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
+ name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
params: {
projectId: route.params.projectId,
issueId: extractIssueUID(plan.value.issue),
diff --git a/frontend/src/views/project/ProjectIssueDetail.vue b/frontend/src/views/project/ProjectIssueDetail.vue
deleted file mode 100644
index 742c0ebbf0..0000000000
--- a/frontend/src/views/project/ProjectIssueDetail.vue
+++ /dev/null
@@ -1,164 +0,0 @@
-<template>
- <div class="relative overflow-x-hidden h-full">
- <template v-if="ready">
- <GrantRequestIssueDetailPage v-if="isGrantRequestIssue(issue)" />
- <IssueDetailPage v-else />
- </template>
- <div v-else class="w-full h-full flex flex-col items-center justify-center">
- <NSpin />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { useTitle } from "@vueuse/core";
-import Emittery from "emittery";
-import { NSpin } from "naive-ui";
-import { computed, onMounted, toRef, watch } from "vue";
-import { useI18n } from "vue-i18n";
-import { useRoute, useRouter } from "vue-router";
-import {
- GrantRequestIssueDetailPage,
- IssueDetailPage,
- provideIssueContext,
- useBaseIssueContext,
- useInitializeIssue,
-} from "@/components/IssueV1";
-import {
- type PlanCheckRunEvents,
- providePlanCheckRunContext,
-} from "@/components/PlanCheckRun/context";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import { useBodyLayoutContext } from "@/layouts/common";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
-} from "@/router/dashboard/projectV1";
-import { projectNamePrefix, useProjectByName, useUIStateStore } from "@/store";
-import {
- extractIssueUID,
- extractProjectResourceName,
- isGrantRequestIssue,
- isValidIssueName,
- shouldUseNewIssueLayout,
-} from "@/utils";
-
-defineOptions({
- inheritAttrs: false,
-});
-
-const props = defineProps<{
- projectId: string;
- issueSlug: string;
-}>();
-
-const { t } = useI18n();
-const router = useRouter();
-const route = useRoute();
-const { enabledNewLayout } = useIssueLayoutVersion();
-
-const { project, ready: projectReady } = useProjectByName(
- computed(() => `${projectNamePrefix}${props.projectId}`)
-);
-
-const { isCreating, issue, isInitializing, reInitialize, allowChange } =
- useInitializeIssue(toRef(props, "issueSlug"), project);
-const ready = computed(() => {
- return !isInitializing.value && !!issue.value && projectReady.value;
-});
-const uiStateStore = useUIStateStore();
-
-const issueBaseContext = useBaseIssueContext({
- isCreating,
- ready,
- issue,
-});
-
-provideIssueContext({
- isCreating,
- issue,
- ready,
- reInitialize,
- allowChange,
- ...issueBaseContext,
-});
-
-providePlanCheckRunContext(
- {
- events: (() => {
- const emittery: PlanCheckRunEvents = new Emittery();
- emittery.on("status-changed", () => {
- // If the status of plan checks changes, trigger a refresh.
- issueBaseContext.events?.emit("status-changed", { eager: true });
- });
- return emittery;
- })(),
- },
- true /* root */
-);
-
-const { overrideMainContainerClass } = useBodyLayoutContext();
-
-overrideMainContainerClass("py-0! px-0!");
-
-onMounted(() => {
- if (!uiStateStore.getIntroStateByKey("issue.visit")) {
- uiStateStore.saveIntroStateByKey({
- key: "issue.visit",
- newState: true,
- });
- }
-});
-
-// Watch for when the issue data is ready and handle redirects
-watch(
- ready,
- (isReady) => {
- if (!isReady) return;
-
- // Determine if this issue should use the new layout based on issue type and user preference
- const shouldRedirect = shouldUseNewIssueLayout(
- issue.value,
- issue.value.planEntity,
- enabledNewLayout.value
- );
-
- if (shouldRedirect) {
- if (isCreating.value) {
- // Redirect creation to plan creation page
- router.replace({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- planId: "create",
- },
- query: route.query,
- });
- } else {
- // Redirect existing issues to new issue detail layout
- router.replace({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL_V1,
- params: {
- projectId: extractProjectResourceName(project.value.name),
- issueId: extractIssueUID(issue.value.name),
- },
- query: route.query,
- });
- }
- }
- },
- { immediate: true }
-);
-
-const documentTitle = computed(() => {
- if (isCreating.value) {
- return t("issue.new-issue");
- } else {
- if (ready.value && isValidIssueName(issue.value.name)) {
- return issue.value.title;
- }
- }
- return t("common.loading");
-});
-useTitle(documentTitle);
-</script>
diff --git a/frontend/src/views/project/ProjectPlanDashboard.vue b/frontend/src/views/project/ProjectPlanDashboard.vue
index 182bc0f277..ff5549c482 100644
--- a/frontend/src/views/project/ProjectPlanDashboard.vue
+++ b/frontend/src/views/project/ProjectPlanDashboard.vue
@@ -80,7 +80,6 @@ import { getLocalSheetByName, targetsForSpec } from "@/components/Plan";
import AddSpecDrawer from "@/components/Plan/components/AddSpecDrawer.vue";
import PlanDataTable from "@/components/Plan/components/PlanDataTable";
import PagedTable from "@/components/v2/Model/PagedTable.vue";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import {
useCurrentProjectV1,
@@ -113,7 +112,6 @@ interface LocalState {
const { t } = useI18n();
const me = useCurrentUserV1();
-const { enabledNewLayout } = useIssueLayoutVersion();
const { project, ready } = useCurrentProjectV1();
const userStore = useUserStore();
const showAddSpecDrawer = ref(false);
@@ -264,17 +262,9 @@ const planSearchParams = computed(() => {
});
const mergedPlanFind = computed(() => {
- const defaultFind = enabledNewLayout.value
- ? {}
- : // Default find for legacy layout.
- {
- hasIssue: false,
- hasRollout: false,
- };
return buildPlanFindBySearchParams(planSearchParams.value, {
// Only show change database plans.
specType: "change_database_config",
- ...defaultFind,
});
});
diff --git a/frontend/src/views/sql-editor/EditorCommon/ExecuteHint.vue b/frontend/src/views/sql-editor/EditorCommon/ExecuteHint.vue
index 3ac04f09c0..a201805009 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ExecuteHint.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ExecuteHint.vue
@@ -46,11 +46,7 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { useRouter } from "vue-router";
import { EnvironmentV1Name } from "@/components/v2";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import {
pushNotification,
useDatabaseV1Store,
@@ -131,7 +127,6 @@ const gotoCreateIssue = async () => {
emit("close");
- const { enabledNewLayout } = useIssueLayoutVersion();
const db = await useDatabaseV1Store().getOrFetchDatabaseByName(database);
const sqlStorageKey = `bb.issues.sql.${uuidv4()}`;
useStorageStore().put(sqlStorageKey, statement.value);
@@ -143,24 +138,15 @@ const gotoCreateIssue = async () => {
sqlStorageKey,
};
- const route = enabledNewLayout.value
- ? router.resolve({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(db.project),
- planId: "create",
- specId: "placeholder",
- },
- query,
- })
- : router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(db.project),
- issueSlug: "create",
- },
- query,
- });
+ const route = router.resolve({
+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(db.project),
+ planId: "create",
+ specId: "placeholder",
+ },
+ query,
+ });
window.open(route.fullPath, "_blank");
};
diff --git a/frontend/src/views/sql-editor/SQLEditorHomePage.vue b/frontend/src/views/sql-editor/SQLEditorHomePage.vue
index cf13c4158c..c668ba0a15 100644
--- a/frontend/src/views/sql-editor/SQLEditorHomePage.vue
+++ b/frontend/src/views/sql-editor/SQLEditorHomePage.vue
@@ -70,11 +70,7 @@ import IAMRemindModal from "@/components/IAMRemindModal.vue";
import Quickstart from "@/components/Quickstart.vue";
import { Drawer } from "@/components/v2";
import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";
-import { useIssueLayoutVersion } from "@/composables/useIssueLayoutVersion";
-import {
- PROJECT_V1_ROUTE_ISSUE_DETAIL,
- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
-} from "@/router/dashboard/projectV1";
+import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";
import {
useDatabaseV1Store,
useSQLEditorStore,
@@ -119,7 +115,6 @@ useEmitteryEventListener(
editorEvents,
"alter-schema",
async ({ databaseName, schema, table }) => {
- const { enabledNewLayout } = useIssueLayoutVersion();
const database = await databaseStore.getOrFetchDatabaseByName(databaseName);
const exampleSQL = ["ALTER TABLE"];
if (table) {
@@ -135,24 +130,15 @@ useEmitteryEventListener(
databaseList: database.name,
sql: exampleSQL.join(" "),
};
- const route = enabledNewLayout.value
- ? router.resolve({
- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
- params: {
- projectId: extractProjectResourceName(database.project),
- planId: "create",
- specId: "placeholder",
- },
- query,
- })
- : router.resolve({
- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,
- params: {
- projectId: extractProjectResourceName(database.project),
- issueSlug: "create",
- },
- query,
- });
+ const route = router.resolve({
+ name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,
+ params: {
+ projectId: extractProjectResourceName(database.project),
+ planId: "create",
+ specId: "placeholder",
+ },
+ query,
+ });
window.open(route.fullPath, "_blank");
}
);