Skip to content

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

chore: remove unused components (#12200)

boojack384a49e16f2d
diff --git a/frontend/src/components/IssueV1/SQLReviewIssueDetailPage.vue b/frontend/src/components/IssueV1/SQLReviewIssueDetailPage.vue
deleted file mode 100644
index a60121fdfc..0000000000
--- a/frontend/src/components/IssueV1/SQLReviewIssueDetailPage.vue
+++ /dev/null
@@ -1,118 +0,0 @@
-<template>
- <div ref="containerRef" class="h-full flex flex-col">
- <div class="border-b">
- <div class="issue-debug">phase: {{ phase }}</div>
- <BannerSection v-if="!isCreating" />
-
- <HeaderSection />
- </div>
- <div class="flex-1 flex flex-row">
- <div
- class="flex-1 flex flex-col hide-scrollbar divide-y overflow-x-hidden"
- >
- <ReviewIssueSpecSection />
- <SQLCheckSection v-if="isCreating" />
- <PlanCheckSection v-if="!isCreating" />
- <StatementSection />
- <DescriptionSection />
- <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 v-if="sidebarMode === 'MOBILE'" />
- </div>
- </Drawer>
- </template>
-
- <IssueReviewActionPanel
- :action="ongoingIssueReviewAction?.action"
- @close="ongoingIssueReviewAction = undefined"
- />
- <IssueStatusActionPanel
- :action="ongoingIssueStatusAction?.action"
- @close="ongoingIssueStatusAction = undefined"
- />
-
- <div class="issue-debug">
- <pre class="text-xs">{{ JSON.stringify(issue, null, " ") }}</pre>
- </div>
-</template>
-
-<script setup lang="ts">
-import { ref } from "vue";
-import { provideSQLCheckContext } from "../SQLCheck";
-import { Drawer } from "../v2";
-import {
- BannerSection,
- HeaderSection,
- PlanCheckSection,
- StatementSection,
- DescriptionSection,
- IssueCommentSection,
- Sidebar,
- IssueReviewActionPanel,
- IssueStatusActionPanel,
- SQLCheckSection,
- ReviewIssueSpecSection,
-} from "./components";
-import type { IssueReviewAction, IssueStatusAction } from "./logic";
-import {
- provideIssueSidebarContext,
- useIssueContext,
- usePollIssue,
-} from "./logic";
-
-const containerRef = ref<HTMLElement>();
-const { isCreating, phase, issue, events } = useIssueContext();
-
-const ongoingIssueReviewAction = ref<{
- action: IssueReviewAction;
-}>();
-const ongoingIssueStatusAction = ref<{
- action: IssueStatusAction;
-}>();
-
-usePollIssue();
-
-events.on("perform-issue-review-action", ({ action }) => {
- ongoingIssueReviewAction.value = {
- action,
- };
-});
-
-events.on("perform-issue-status-action", ({ action }) => {
- ongoingIssueStatusAction.value = {
- action,
- };
-});
-
-provideSQLCheckContext();
-
-const {
- mode: sidebarMode,
- desktopSidebarWidth,
- mobileSidebarOpen,
-} = provideIssueSidebarContext(containerRef);
-</script>
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewIssueSpecSection.vue b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewIssueSpecSection.vue
deleted file mode 100644
index ab66bc31b3..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewIssueSpecSection.vue
+++ /dev/null
@@ -1,48 +0,0 @@
-<template>
- <div class="w-full flex flex-col divide-y">
- <template v-if="selectedSpec">
- <div class="w-full flex flex-row items-center py-2 px-2 sm:px-4">
- <span class="textlabel mr-4">{{ $t("common.database") }}</span>
- <DatabaseInfo :database="database" />
- </div>
- <div class="w-full py-2 px-2 sm:px-4">
- <ReviewOptionSection />
- </div>
- </template>
- <template v-else>
- <NoPermissionPlaceholder
- v-if="placeholder === 'PERMISSION_DENIED'"
- class="!border-0"
- />
- <NoDataPlaceholder v-else class="!border-0" />
- </template>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { computed } from "vue";
-import DatabaseInfo from "@/components/DatabaseInfo.vue";
-import { databaseForSpec, useIssueContext } from "@/components/IssueV1/logic";
-import NoDataPlaceholder from "@/components/misc/NoDataPlaceholder.vue";
-import NoPermissionPlaceholder from "@/components/misc/NoPermissionPlaceholder.vue";
-import { useCurrentUserV1 } from "@/store";
-import { hasProjectPermissionV2 } from "@/utils";
-import ReviewOptionSection from "./ReviewOptionSection";
-
-const { isCreating, issue, selectedSpec } = useIssueContext();
-const me = useCurrentUserV1();
-
-const database = computed(() => {
- return databaseForSpec(issue.value, selectedSpec.value);
-});
-
-const placeholder = computed(() => {
- if (
- isCreating.value &&
- !hasProjectPermissionV2(issue.value.projectEntity, me.value, "bb.plans.get")
- ) {
- return "PERMISSION_DENIED";
- }
- return "NO_DATA";
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/ReviewOptionSection.vue b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/ReviewOptionSection.vue
deleted file mode 100644
index e6bd1c90b6..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/ReviewOptionSection.vue
+++ /dev/null
@@ -1,165 +0,0 @@
-<template>
- <div class="w-full flex flex-col">
- <div class="w-full flex flex-row justify-between items-center mb-1">
- <span class="textlabel mr-4">{{ $t("issue.data-export.options") }}</span>
- <div
- v-if="showEditButtons"
- class="flex flex-row justify-end items-center gap-2"
- >
- <NTooltip
- v-if="!state.isEditing"
- :disabled="denyEditReasons.length === 0"
- >
- <template #trigger>
- <NButton
- size="tiny"
- tag="div"
- :disabled="denyEditReasons.length > 0"
- @click="state.isEditing = true"
- >
- {{ $t("common.edit") }}
- </NButton>
- </template>
- <template #default>
- <ErrorList :errors="denyEditReasons" />
- </template>
- </NTooltip>
- <template v-else>
- <NButton size="tiny" @click="handleSaveEdit">
- {{ $t("common.save") }}
- </NButton>
- <NButton size="tiny" quaternary @click.prevent="handleCancelEdit">
- {{ $t("common.cancel") }}
- </NButton>
- </template>
- </div>
- </div>
- <div class="w-full h-8 flex flex-row justify-start items-center">
- <span class="textinfolabel inline-block mr-2 !min-w-[64px]">{{
- $t("issue.sql-review.statement-type")
- }}</span>
- <StatementTypeSelector
- :key="refreshKey"
- v-model:statement-type="state.statementType"
- :editable="optionsEditable"
- />
- </div>
- </div>
-</template>
-
-<script lang="ts" setup>
-import { cloneDeep } from "lodash-es";
-import { NButton, NTooltip } from "naive-ui";
-import { computed, watch, reactive, ref } from "vue";
-import { useI18n } from "vue-i18n";
-import {
- notifyNotEditableLegacyIssue,
- useIssueContext,
-} from "@/components/IssueV1/logic";
-import { planServiceClient } from "@/grpcweb";
-import { pushNotification, useCurrentUserV1 } from "@/store";
-import { IssueStatus } from "@/types/proto/v1/issue_service";
-import {
- Plan_ChangeDatabaseConfig_Type,
- Plan_ChangeDatabaseConfig,
-} from "@/types/proto/v1/plan_service";
-import { hasProjectPermissionV2 } from "@/utils";
-import StatementTypeSelector from "./StatementTypeSelector.vue";
-import type { StatementType } from "./types";
-
-interface LocalState {
- statementType: StatementType;
- isEditing: boolean;
-}
-
-const { t } = useI18n();
-const { issue, isCreating, selectedSpec, events } = useIssueContext();
-const currentUser = useCurrentUserV1();
-const refreshKey = ref(0);
-
-const state = reactive<LocalState>({
- statementType:
- (selectedSpec.value.changeDatabaseConfig?.type as StatementType) ||
- Plan_ChangeDatabaseConfig_Type.MIGRATE,
- isEditing: false,
-});
-
-const showEditButtons = computed(() => {
- return !isCreating.value && issue.value.status === IssueStatus.OPEN;
-});
-
-const optionsEditable = computed(() => {
- return isCreating.value || (showEditButtons.value && state.isEditing);
-});
-
-const denyEditReasons = computed(() => {
- const reasons: string[] = [];
- if (
- !hasProjectPermissionV2(
- issue.value.projectEntity,
- currentUser.value,
- "bb.plans.update"
- )
- ) {
- reasons.push("Permission denied");
- }
- return reasons;
-});
-
-const handleCancelEdit = () => {
- state.isEditing = false;
- state.statementType =
- (selectedSpec.value.changeDatabaseConfig?.type as StatementType) ||
- Plan_ChangeDatabaseConfig_Type.MIGRATE;
- // Trigger a re-render of the child components.
- refreshKey.value++;
-};
-
-const handleSaveEdit = async () => {
- const planPatch = cloneDeep(issue.value.planEntity);
- if (!planPatch) {
- notifyNotEditableLegacyIssue();
- return;
- }
-
- const distinctSpecIds = new Set([selectedSpec.value.id]);
- const specsToPatch = planPatch.steps
- .flatMap((step) => step.specs)
- .filter((spec) => distinctSpecIds.has(spec.id));
- for (let i = 0; i < specsToPatch.length; i++) {
- const spec = specsToPatch[i];
- const config = spec.changeDatabaseConfig;
- if (!config) continue;
- config.type = state.statementType;
- }
-
- const updatedPlan = await planServiceClient.updatePlan({
- plan: planPatch,
- updateMask: ["steps"],
- });
- issue.value.planEntity = updatedPlan;
-
- events.emit("status-changed", { eager: true });
- pushNotification({
- module: "bytebase",
- style: "SUCCESS",
- title: t("common.updated"),
- });
- handleCancelEdit();
-};
-
-watch(
- () => state.statementType,
- () => {
- if (!isCreating.value) {
- return;
- }
- selectedSpec.value.changeDatabaseConfig =
- Plan_ChangeDatabaseConfig.fromPartial({
- ...selectedSpec.value.changeDatabaseConfig,
- type: state.statementType,
- });
- },
- { deep: true }
-);
-</script>
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/StatementTypeSelector.vue b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/StatementTypeSelector.vue
deleted file mode 100644
index b7c199aa84..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/StatementTypeSelector.vue
+++ /dev/null
@@ -1,59 +0,0 @@
-<template>
- <NRadioGroup
- v-if="editable"
- :value="statementType"
- @update:value="handleUpdate"
- >
- <NRadio
- v-for="item in availableStatementTypes"
- :key="item"
- :value="item"
- :label="stringifyStatementType(item)"
- />
- </NRadioGroup>
- <template v-else>
- <span class="text-base">{{ stringifyStatementType(statementType) }}</span>
- </template>
-</template>
-
-<script setup lang="ts">
-import { NRadioGroup, NRadio } from "naive-ui";
-import { computed } from "vue";
-import { onMounted } from "vue";
-import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
-import type { StatementType } from "./types";
-
-const props = defineProps<{
- statementType: StatementType;
- editable?: boolean;
-}>();
-
-const emit = defineEmits<{
- (event: "update:statement-type", value: StatementType): void;
-}>();
-
-const availableStatementTypes = computed((): StatementType[] => [
- Plan_ChangeDatabaseConfig_Type.MIGRATE,
- Plan_ChangeDatabaseConfig_Type.DATA,
-]);
-
-const handleUpdate = (value: StatementType) => {
- emit("update:statement-type", value);
-};
-
-const stringifyStatementType = (statementType: StatementType) => {
- if (statementType === Plan_ChangeDatabaseConfig_Type.MIGRATE) {
- return "DDL";
- } else if (statementType === Plan_ChangeDatabaseConfig_Type.DATA) {
- return "DML";
- } else {
- return "Unknown";
- }
-};
-
-onMounted(() => {
- if (!availableStatementTypes.value.includes(props.statementType)) {
- handleUpdate(availableStatementTypes.value[0]);
- }
-});
-</script>
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/index.ts b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/index.ts
deleted file mode 100644
index 8fa34a60a1..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ReviewOptionSection from "./ReviewOptionSection.vue";
-
-export default ReviewOptionSection;
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/types.ts b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/types.ts
deleted file mode 100644
index 9bbe08824e..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/ReviewOptionSection/types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";
-
-export type StatementType =
- | Plan_ChangeDatabaseConfig_Type.MIGRATE
- | Plan_ChangeDatabaseConfig_Type.DATA;
diff --git a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/index.ts b/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/index.ts
deleted file mode 100644
index f139491fd6..0000000000
--- a/frontend/src/components/IssueV1/components/ReviewIssueSpecSection/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import ReviewIssueSpecSection from "./ReviewIssueSpecSection.vue";
-
-export default ReviewIssueSpecSection;
diff --git a/frontend/src/components/IssueV1/components/index.ts b/frontend/src/components/IssueV1/components/index.ts
index 0ffa2b572b..ad79525dc0 100644
--- a/frontend/src/components/IssueV1/components/index.ts
+++ b/frontend/src/components/IssueV1/components/index.ts
@@ -5,7 +5,6 @@ import HeaderSection from "./HeaderSection";
import IssueCommentSection from "./IssueCommentSection";
import IssueSearch from "./IssueSearch";
import PlanCheckSection from "./PlanCheckSection";
-import ReviewIssueSpecSection from "./ReviewIssueSpecSection";
import SQLCheckSection from "./SQLCheckSection";
import Sidebar from "./Sidebar";
import StageSection from "./StageSection";
@@ -29,5 +28,4 @@ export {
SQLCheckSection,
DataExportSection,
IssueCommentSection,
- ReviewIssueSpecSection,
};
diff --git a/frontend/src/views/project/ProjectIssueDetail.vue b/frontend/src/views/project/ProjectIssueDetail.vue
index fce741cd5b..93b44d9ff2 100644
--- a/frontend/src/views/project/ProjectIssueDetail.vue
+++ b/frontend/src/views/project/ProjectIssueDetail.vue
@@ -3,10 +3,7 @@
<template v-if="ready">
<GrantRequestIssueDetailPage v-if="isGrantRequestIssue(issue)" />
<DataExportIssueDetailPage v-else-if="isDatabaseDataExportIssue(issue)" />
- <template v-else>
- <IssueDetailPage v-if="!!issue.rollout" />
- <SQLReviewIssueDetailPage v-else />
- </template>
+ <IssueDetailPage v-else />
</template>
<div v-else class="w-full h-full flex flex-col items-center justify-center">
<NSpin />
@@ -32,7 +29,6 @@ import {
useBaseIssueContext,
useInitializeIssue,
} from "@/components/IssueV1";
-import SQLReviewIssueDetailPage from "@/components/IssueV1/SQLReviewIssueDetailPage.vue";
import { useBodyLayoutContext } from "@/layouts/common";
import { useUIStateStore } from "@/store";
import { UNKNOWN_ID } from "@/types";