Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: retire unused issue type in frontend (#12092)
boojackaab928fa917b
diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vueindex 32dd6377a0..dbf74e0802 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue@@ -32,7 +32,7 @@ import { NTooltip, NButton } from "naive-ui";import { zindexable as vZindexable } from "vdirs";import { computed, nextTick, ref, toRaw } from "vue";import { useI18n } from "vue-i18n";-import { useRoute, useRouter } from "vue-router";+import { useRouter } from "vue-router";import { getValidIssueLabels } from "@/components/IssueV1/components/IssueLabelSelector.vue";import { ErrorList } from "@/components/IssueV1/components/common";import {@@ -51,7 +51,7 @@ import {planServiceClient,rolloutServiceClient,} from "@/grpcweb";-import { emitWindowEvent, type TemplateType } from "@/plugins";+import { emitWindowEvent } from "@/plugins";import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";import { useCurrentUserV1, useDatabaseV1Store, useSheetV1Store } from "@/store";import type { ComposedIssue } from "@/types";@@ -75,7 +75,6 @@ import {const MAX_FORMATTABLE_STATEMENT_SIZE = 10000; // 10K charactersconst { t } = useI18n();-const route = useRoute();const router = useRouter();const { issue, formatOnSave } = useIssueContext();const { runSQLCheck } = useSQLCheckContext();@@ -155,18 +154,15 @@ const doCreateIssue = async () => {planEntity: createdPlan,};- // Don't create rollout for review issue template.- if ((route.query.template as TemplateType) !== "bb.issue.sql-review") {- const createdRollout = await rolloutServiceClient.createRollout({- parent: issue.value.project,- rollout: {- plan: createdPlan.name,- },- });+ const createdRollout = await rolloutServiceClient.createRollout({+ parent: issue.value.project,+ rollout: {+ plan: createdPlan.name,+ },+ });- composedIssue.rollout = createdRollout.name;- composedIssue.rolloutEntity = createdRollout;- }+ composedIssue.rollout = createdRollout.name;+ composedIssue.rolloutEntity = createdRollout;await emitIssueCreateWindowEvent(composedIssue);nextTick(() => {diff --git a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vueindex 3907afc531..c67d18012f 100644--- a/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue+++ b/frontend/src/components/IssueV1/components/SQLCheckSection/SQLCheckSection.vue@@ -38,7 +38,6 @@<script lang="ts" setup>import { computed } from "vue";-import { useRoute } from "vue-router";import {useIssueContext,databaseForTask,@@ -46,7 +45,6 @@ import {databaseForSpec,} from "@/components/IssueV1/logic";import { SQLCheckButton } from "@/components/SQLCheck";-import type { TemplateType } from "@/plugins";import { TaskTypeListWithStatement } from "@/types";import { Plan_ChangeDatabaseConfig_Type } from "@/types/proto/v1/plan_service";import { Task_Type } from "@/types/proto/v1/rollout_service";@@ -56,7 +54,6 @@ import { useEditSheet } from "../StatementSection/useEditSheet";import OnlineMigrationAdviceExtra from "./OnlineMigrationAdviceExtra.vue";import SQLCheckBadge from "./SQLCheckBadge.vue";-const route = useRoute();const { issue, selectedTask, selectedSpec, events } = useIssueContext();const { sheetStatement } = useEditSheet();@@ -68,15 +65,7 @@ const database = computed(() => {: databaseForSpec(issue.value, selectedSpec.value);});-const issueTemplate = computed(() => {- return route.query.template as TemplateType;-});-const show = computed(() => {- if (issueTemplate.value === "bb.issue.sql-review") {- return true;- }-const type = selectedTask.value.type;if (type === Task_Type.DATABASE_SCHEMA_BASELINE) {return false;diff --git a/frontend/src/components/IssueV1/logic/initialize/create.ts b/frontend/src/components/IssueV1/logic/initialize/create.tsindex d71dc20d27..7d32537133 100644--- a/frontend/src/components/IssueV1/logic/initialize/create.ts+++ b/frontend/src/components/IssueV1/logic/initialize/create.ts@@ -85,16 +85,9 @@ export const createIssueSkeleton = async (issue.plan = plan.name;issue.planEntity = plan;- const issueTemplate = query.template as TemplateType | undefined;- // Don't initial rollout for SQL review issue.- if (issueTemplate === "bb.issue.sql-review") {- issue.rollout = "";- issue.rolloutEntity = undefined;- } else {- const rollout = await previewPlan(plan, params);- issue.rollout = rollout.name;- issue.rolloutEntity = rollout;- }+ const rollout = await previewPlan(plan, params);+ issue.rollout = rollout.name;+ issue.rolloutEntity = rollout;const description = query.description;if (description) {@@ -396,15 +389,6 @@ export const buildSpecForTarget = async (sheet,});}- if (template === "bb.issue.sql-review") {- // SQL review issues is reusing the same plan config type as changing database.- spec.changeDatabaseConfig = Plan_ChangeDatabaseConfig.fromJSON({- target,- sheet,- // TODO(steven): let user choose type in UI.- type: Plan_ChangeDatabaseConfig_Type.DATA,- });- }return spec;};diff --git a/frontend/src/components/ReviewIssuePrepForm/ReviewIssuePrepForm.vue b/frontend/src/components/ReviewIssuePrepForm/ReviewIssuePrepForm.vuedeleted file mode 100644index 60e7502cc2..0000000000--- a/frontend/src/components/ReviewIssuePrepForm/ReviewIssuePrepForm.vue+++ /dev/null@@ -1,248 +0,0 @@-<template>- <DrawerContent>- <template #header>- <div class="flex flex-col gap-y-1">- <span>- {{ $t("review-center.review-sql") }}- </span>- </div>- </template>-- <div- class="space-y-4 h-full w-[calc(100vw-8rem)] lg:w-[60rem] max-w-[calc(100vw-8rem)] overflow-x-auto"- >- <div v-if="ready">- <div class="space-y-3">- <div class="w-full flex items-center space-x-2">- <AdvancedSearch- v-model:params="state.params"- :placeholder="$t('database.filter-database')"- :scope-options="scopeOptions"- />- <DatabaseLabelFilter- v-model:selected="state.selectedLabels"- :database-list="rawDatabaseList"- :placement="'left-start'"- />- </div>- <DatabaseV1Table- mode="ALL_SHORT"- :database-list="filteredDatabaseList"- :show-sql-editor-button="false"- :single-selection="true"- @update:selected-databases="handleDatabasesSelectionChanged"- />- </div>- </div>- <div- v-if="!ready"- class="w-full h-[20rem] flex items-center justify-center"- >- <BBSpin />- </div>- </div>-- <template #footer>- <div class="flex-1 flex items-center justify-between">- <div></div>-- <div class="flex items-center justify-end gap-x-3">- <NButton @click.prevent="cancel">- {{ $t("common.cancel") }}- </NButton>- <NButton- type="primary"- :disabled="!state.selectedDatabaseUid"- @click="navigateToIssuePage"- >- {{ $t("common.next") }}- </NButton>- </div>- </div>- </template>- </DrawerContent>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { computed, reactive } from "vue";-import { useRouter } from "vue-router";-import AdvancedSearch from "@/components/AdvancedSearch";-import DatabaseV1Table from "@/components/v2/Model/DatabaseV1Table";-import type { TemplateType } from "@/plugins";-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";-import {- useCurrentUserV1,- useSearchDatabaseV1List,- useDatabaseV1Store,- useProjectV1Store,-} from "@/store";-import type { ComposedDatabase } from "@/types";-import { UNKNOWN_ID, DEFAULT_PROJECT_V1_NAME } from "@/types";-import { State } from "@/types/proto/v1/common";-import type { SearchParams } from "@/utils";-import {- filterDatabaseV1ByKeyword,- sortDatabaseV1List,- extractEnvironmentResourceName,- extractInstanceResourceName,- generateIssueName,- extractProjectResourceName,-} from "@/utils";-import { useCommonSearchScopeOptions } from "../AdvancedSearch/useCommonSearchScopeOptions";-import { DatabaseLabelFilter, DrawerContent } from "../v2";--type LocalState = {- label: string;- selectedDatabaseUid?: string;- selectedLabels: { key: string; value: string }[];- params: SearchParams;-};--const props = defineProps({- projectId: {- type: String,- default: undefined,- },-});--const emit = defineEmits(["dismiss"]);--const router = useRouter();-const currentUserV1 = useCurrentUserV1();-const projectV1Store = useProjectV1Store();-const databaseV1Store = useDatabaseV1Store();--const state = reactive<LocalState>({- label: "environment",- selectedLabels: [],- params: {- query: "",- scopes: [],- },-});--const scopeOptions = useCommonSearchScopeOptions(- computed(() => state.params),- ["project", "instance", "environment"]-);--const selectedProject = computed(() => {- if (props.projectId) {- return projectV1Store.getProjectByUID(props.projectId);- }- const filter = state.params.scopes.find(- (scope) => scope.id === "project"- )?.value;- if (filter) {- return projectV1Store.getProjectByName(`projects/${filter}`);- }- return undefined;-});--const selectedInstance = computed(() => {- return (- state.params.scopes.find((scope) => scope.id === "instance")?.value ??- `${UNKNOWN_ID}`- );-});--const selectedEnvironment = computed(() => {- return (- state.params.scopes.find((scope) => scope.id === "environment")?.value ??- `${UNKNOWN_ID}`- );-});--const { ready } = useSearchDatabaseV1List({- filter: "instance = instances/-",-});--const rawDatabaseList = computed(() => {- let list: ComposedDatabase[] = [];- if (selectedProject.value) {- list = databaseV1Store.databaseListByProject(selectedProject.value.name);- } else {- list = databaseV1Store.databaseListByUser(currentUserV1.value);- }- list = list.filter(- (db) =>- db.syncState == State.ACTIVE && db.project !== DEFAULT_PROJECT_V1_NAME- );- return list;-});--const filteredDatabaseList = computed(() => {- let list = [...rawDatabaseList.value];-- list = list.filter((db) => {- if (selectedEnvironment.value !== `${UNKNOWN_ID}`) {- return (- extractEnvironmentResourceName(db.effectiveEnvironment) ===- selectedEnvironment.value- );- }- if (selectedInstance.value !== `${UNKNOWN_ID}`) {- return (- extractInstanceResourceName(db.instance) === selectedInstance.value- );- }- return filterDatabaseV1ByKeyword(db, state.params.query.trim(), [- "name",- "environment",- "instance",- "project",- ]);- });-- const labels = state.selectedLabels;- if (labels.length > 0) {- list = list.filter((db) => {- return labels.some((kv) => db.labels[kv.key] === kv.value);- });- }-- return sortDatabaseV1List(list);-});--const handleDatabasesSelectionChanged = (- selectedDatabaseNameList: Set<string>-): void => {- if (selectedDatabaseNameList.size !== 1) {- return;- }- state.selectedDatabaseUid = databaseV1Store.getDatabaseByName(- Array.from(selectedDatabaseNameList)[0]- )?.uid;-};--const navigateToIssuePage = async () => {- if (!state.selectedDatabaseUid) {- return;- }-- const selectedDatabase = filteredDatabaseList.value.find(- (db) => db.uid === state.selectedDatabaseUid- ) as ComposedDatabase;-- const project = selectedDatabase?.projectEntity;- const issueType: TemplateType = "bb.issue.sql-review";- const query: Record<string, any> = {- template: issueType,- name: generateIssueName(issueType, [selectedDatabase.databaseName]),- databaseList: selectedDatabase.name,- };- router.push({- name: PROJECT_V1_ROUTE_ISSUE_DETAIL,- params: {- projectId: extractProjectResourceName(project.name),- issueSlug: "create",- },- query,- });-};--const cancel = () => {- emit("dismiss");-};-</script>diff --git a/frontend/src/components/ReviewIssuePrepForm/index.ts b/frontend/src/components/ReviewIssuePrepForm/index.tsdeleted file mode 100644index d22af7d8f6..0000000000--- a/frontend/src/components/ReviewIssuePrepForm/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import ReviewIssuePrepForm from "./ReviewIssuePrepForm.vue";--export default ReviewIssuePrepForm;diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.tsindex 0c7abe368f..57ed7c3731 100644--- a/frontend/src/types/issue.ts+++ b/frontend/src/types/issue.ts@@ -20,14 +20,11 @@ type IssueTypeDatabase =type IssueTypeGrantRequest = "bb.issue.grant.request";-type IssueTypeSQLReview = "bb.issue.sql-review";-export type IssueType =| IssueTypeGeneral| IssueTypeDataSource| IssueTypeDatabase- | IssueTypeGrantRequest- | IssueTypeSQLReview;+ | IssueTypeGrantRequest;export type IssueStatus = "OPEN" | "DONE" | "CANCELED";diff --git a/frontend/src/utils/issue/index.ts b/frontend/src/utils/issue/index.tsindex 8fbba0437a..2815807cae 100644--- a/frontend/src/utils/issue/index.ts+++ b/frontend/src/utils/issue/index.ts@@ -4,8 +4,7 @@ export const generateIssueName = (type:| "bb.issue.database.schema.update"| "bb.issue.database.data.update"- | "bb.issue.database.data.export"- | "bb.issue.sql-review",+ | "bb.issue.database.data.export",databaseNameList: string[],isOnlineMode = false) => {@@ -24,9 +23,7 @@ export const generateIssueName = (? `Edit schema`: type === "bb.issue.database.data.update"? `Change data`- : type === "bb.issue.database.data.export"- ? "Export data"- : "Review SQL"+ : "Export data");}const datetime = dayjs().format("@MM-DD HH:mm");