Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(frontend): sweep unused vue components and dead helpers (#20148)
boojack91a20b462572
diff --git a/frontend/scripts/find-dead-vue.mjs b/frontend/scripts/find-dead-vue.mjsnew file mode 100644index 0000000000..dd5e8cc831--- /dev/null+++ b/frontend/scripts/find-dead-vue.mjs@@ -0,0 +1,379 @@+// frontend/scripts/find-dead-vue.mjs+//+// Detects unreferenced Vue single-file components under src/components/ as part+// of the Vue → React migration sweep. A component counts as live if it is+// reachable from a fixed root set via:+// - explicit `from "..."` / `import("...")` / `import.meta.glob("...")` paths,+// including bare relative imports that Vite resolves to .vue;+// - PascalCase or kebab-case tag references in any live .vue template, mapped+// through the unplugin-vue-components registry at frontend/components.d.ts;+// - Vue Router lazy imports under src/router/.+//+// The script is intentionally a static scanner. It does not evaluate dynamic+// `:is="ComponentName"` strings, computed component names, or imports built+// from variables. Passing this scan does not prove a component is unused — the+// real gate is `pnpm --dir frontend build`, which fails on unresolved+// auto-imports. Use this scan to find candidates, then verify with build.+//+// Usage:+// node scripts/find-dead-vue.mjs # report only+// node scripts/find-dead-vue.mjs --delete # delete dead .vue files+// node scripts/find-dead-vue.mjs --react-only # list .vue whose importers+// # are all under src/react/++import { existsSync, readFileSync, readdirSync, statSync, unlinkSync } from "node:fs";+import { dirname, relative, resolve } from "node:path";+import { fileURLToPath } from "node:url";++const __dirname = dirname(fileURLToPath(import.meta.url));+const FRONTEND_ROOT = resolve(__dirname, "..");+const SRC = resolve(FRONTEND_ROOT, "src");+const COMPONENTS_DIR = resolve(SRC, "components");+const REGISTRY_FILE = resolve(FRONTEND_ROOT, "components.d.ts");++const args = new Set(process.argv.slice(2));+const MODE_DELETE = args.has("--delete");+const MODE_REACT_ONLY = args.has("--react-only");++// Files that are always live entry points (auto-roots).+const ROOT_FILES = [+ "src/main.ts",+ "src/explain-visualizer-main.ts",+ "src/init.ts",+ "src/App.vue",+ "src/AuthContext.vue",+ "src/NotificationContext.vue",+ "src/ExplainVisualizerApp.vue",+ "src/customAppProfile.ts",+ "src/DummyRootView.ts",+ "src/shell-bridge.test.ts",+];+// Whole subtrees that are always live: nothing inside is a candidate, and+// anything they import is reachable.+const ROOT_DIRS = [+ "src/layouts",+ "src/views",+ "src/router",+ "src/store",+ "src/plugins",+ "src/composables",+ "src/types",+ "src/utils",+ "src/connect",+ "src/locales",+ "src/bbkit",+ "src/react",+];++// File extensions to scan for imports.+const SOURCE_EXT = /\.(?:vue|ts|tsx|mts|cts|mjs|cjs|js)$/;++const listFiles = (dir, out = []) => {+ for (const entry of readdirSync(dir, { withFileTypes: true })) {+ const full = resolve(dir, entry.name);+ if (entry.isDirectory()) {+ // Skip generated noise.+ if (entry.name === "node_modules" || entry.name === "dist") continue;+ listFiles(full, out);+ } else if (entry.isFile() && SOURCE_EXT.test(entry.name)) {+ out.push(full);+ }+ }+ return out;+};++const toRel = (abs) => relative(FRONTEND_ROOT, abs).split("\\").join("/");++const isUnderAny = (abs, dirs) => {+ for (const d of dirs) {+ const full = resolve(FRONTEND_ROOT, d);+ if (abs === full || abs.startsWith(full + "/")) return true;+ }+ return false;+};++// Resolve a Vite-style import path (with @ alias, relative path, optional+// extension) to an absolute file path on disk, if it points to something we+// recognize. Returns null if it does not resolve to a real file.+const resolveImport = (specifier, fromFile) => {+ if (!specifier) return null;+ // Skip vendor packages and virtual modules.+ if (specifier.startsWith("~") || specifier.includes("?")) return null;+ if (+ !specifier.startsWith(".") &&+ !specifier.startsWith("@/") &&+ !specifier.startsWith("/")+ ) {+ return null;+ }++ let basePath;+ if (specifier.startsWith("@/")) {+ basePath = resolve(SRC, specifier.slice(2));+ } else if (specifier.startsWith("/")) {+ basePath = resolve(FRONTEND_ROOT, specifier.slice(1));+ } else {+ basePath = resolve(dirname(fromFile), specifier);+ }++ // Direct hit (with extension).+ if (existsSync(basePath) && statSync(basePath).isFile()) {+ return basePath;+ }+ // Try common extensions.+ for (const ext of [".vue", ".ts", ".tsx", ".js", ".mjs"]) {+ if (existsSync(basePath + ext)) {+ return basePath + ext;+ }+ }+ // Try directory index.+ for (const ext of [".vue", ".ts", ".tsx", ".js", ".mjs"]) {+ const indexPath = basePath + "/index" + ext;+ if (existsSync(indexPath)) {+ return indexPath;+ }+ }+ return null;+};++// Regex for `from "path"`, `import("path")`, and `import.meta.glob` literals.+const STATIC_FROM = /\bfrom\s+["']([^"']+)["']/g;+const DYNAMIC_IMPORT = /\bimport\s*\(\s*["']([^"']+)["']\s*\)/g;+const GLOB_LITERAL = /import\.meta\.glob\s*\(\s*(\[[^\]]*\]|["'][^"']+["'])/g;+// re-export: `export * from "x"`, `export { ... } from "x"`.+const EXPORT_FROM = /\bexport\s+(?:\*|\{[^}]*\})\s+from\s+["']([^"']+)["']/g;++// Pull all string literal imports out of a file and resolve to abs paths.+const collectImportsFromCode = (source, fromFile) => {+ const refs = new Set();+ const push = (specifier) => {+ const abs = resolveImport(specifier, fromFile);+ if (abs) refs.add(abs);+ };++ for (const m of source.matchAll(STATIC_FROM)) push(m[1]);+ for (const m of source.matchAll(DYNAMIC_IMPORT)) push(m[1]);+ for (const m of source.matchAll(EXPORT_FROM)) push(m[1]);+ for (const m of source.matchAll(GLOB_LITERAL)) {+ const inside = m[1];+ // Pull every quoted literal out of either a single string or an array.+ for (const lit of inside.matchAll(/["']([^"']+)["']/g)) {+ // import.meta.glob accepts a glob — strip the wildcard suffix and+ // walk the directory if it points at .vue files.+ const pat = lit[1];+ if (!pat.includes("*")) {+ push(pat);+ continue;+ }+ // Globs that include .vue: enumerate matching files under the base dir.+ if (!pat.endsWith(".vue") && !pat.includes("*.vue")) continue;+ const baseSpec = pat.replace(/\/\*\*\/.*$/, "").replace(/\/\*[^/]*$/, "");+ let baseAbs;+ if (baseSpec.startsWith("@/")) baseAbs = resolve(SRC, baseSpec.slice(2));+ else if (baseSpec.startsWith(".")) baseAbs = resolve(dirname(fromFile), baseSpec);+ else continue;+ if (!existsSync(baseAbs) || !statSync(baseAbs).isDirectory()) continue;+ for (const f of listFiles(baseAbs)) {+ if (f.endsWith(".vue")) refs.add(f);+ }+ }+ }+ return refs;+};++// Parse PascalCase / kebab-case tag references in a .vue (or .tsx) source.+// Returns a Set of normalized PascalCase names.+const TAG_PASCAL = /<([A-Z][A-Za-z0-9]*)\b/g;+const TAG_KEBAB = /<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/g;+const kebabToPascal = (s) =>+ s.replace(/(^|-)([a-z0-9])/g, (_, _dash, ch) => ch.toUpperCase());+const collectTagNames = (source) => {+ const names = new Set();+ for (const m of source.matchAll(TAG_PASCAL)) names.add(m[1]);+ for (const m of source.matchAll(TAG_KEBAB)) names.add(kebabToPascal(m[1]));+ return names;+};++// Parse components.d.ts into a Map<PascalName, absPath>.+const loadAutoImportRegistry = () => {+ if (!existsSync(REGISTRY_FILE)) {+ console.error(+ `error: ${toRel(REGISTRY_FILE)} not found. Run 'pnpm --dir frontend dev' or ` ++ "'pnpm --dir frontend build' once to let unplugin-vue-components generate it."+ );+ process.exit(2);+ }+ const source = readFileSync(REGISTRY_FILE, "utf-8");+ const map = new Map();+ // Match e.g. AccessGrantView: typeof import('./src/components/...vue')+ const re = /^\s*['"]?([A-Za-z][A-Za-z0-9:]*)['"]?:\s*typeof import\(['"]([^'"]+\.vue)['"]\)/gm;+ for (const m of source.matchAll(re)) {+ const [, name, relPath] = m;+ if (name.includes(":")) continue; // Icon resolver entries.+ const abs = resolve(FRONTEND_ROOT, relPath.replace(/^\.\//, ""));+ if (!map.has(name)) map.set(name, abs);+ }+ return map;+};++const loadFile = (abs) => {+ try {+ return readFileSync(abs, "utf-8");+ } catch {+ return "";+ }+};++// Build the directed reference graph and BFS from roots.+const buildGraph = () => {+ const allFiles = listFiles(SRC);+ const registry = loadAutoImportRegistry();++ // file → Set<file>+ const edges = new Map();+ for (const file of allFiles) {+ const source = loadFile(file);+ const refs = collectImportsFromCode(source, file);+ if (file.endsWith(".vue")) {+ // Auto-import: resolve PascalCase tag names through the registry.+ for (const name of collectTagNames(source)) {+ const target = registry.get(name);+ if (target) refs.add(target);+ }+ }+ edges.set(file, refs);+ }+ return { allFiles, edges, registry };+};++const seedRoots = (allFiles) => {+ const roots = new Set();+ for (const rel of ROOT_FILES) {+ const abs = resolve(FRONTEND_ROOT, rel);+ if (existsSync(abs)) roots.add(abs);+ }+ for (const file of allFiles) {+ if (isUnderAny(file, ROOT_DIRS)) roots.add(file);+ // Tests count as live importers.+ if (/\.test\.(?:ts|tsx|mts|cjs|js|mjs)$/.test(file)) roots.add(file);+ }+ return roots;+};++const traverse = (edges, roots) => {+ const live = new Set();+ const queue = [...roots];+ while (queue.length) {+ const file = queue.pop();+ if (live.has(file)) continue;+ live.add(file);+ const refs = edges.get(file);+ if (!refs) continue;+ for (const ref of refs) {+ if (!live.has(ref)) queue.push(ref);+ }+ }+ return live;+};++// Reverse-edge map: for each .vue, who imports it.+const buildReverseEdges = (edges) => {+ const rev = new Map();+ for (const [src, targets] of edges) {+ for (const t of targets) {+ if (!rev.has(t)) rev.set(t, new Set());+ rev.get(t).add(src);+ }+ }+ return rev;+};++const candidateVueFiles = (allFiles) =>+ allFiles.filter(+ (f) => f.endsWith(".vue") && f.startsWith(COMPONENTS_DIR + "/")+ );++const groupByDirectory = (files) => {+ const groups = new Map();+ for (const f of files) {+ const rel = toRel(f);+ const dir = rel.split("/").slice(0, -1).join("/");+ if (!groups.has(dir)) groups.set(dir, []);+ groups.get(dir).push(rel);+ }+ return [...groups.entries()].sort((a, b) => a[0].localeCompare(b[0]));+};++const printGroups = (label, files) => {+ if (files.length === 0) {+ console.log(`${label}: none`);+ return;+ }+ console.log(`${label} (${files.length}):`);+ for (const [dir, list] of groupByDirectory(files)) {+ console.log(` ${dir}/ (${list.length})`);+ for (const f of list.sort()) {+ console.log(` ${f}`);+ }+ }+};++const reportDead = (deadFiles) => {+ printGroups("Dead .vue files (no live importer)", deadFiles);+ console.log(`\nTotal dead: ${deadFiles.length}`);+};++const deleteDead = (deadFiles) => {+ for (const f of deadFiles) {+ unlinkSync(f);+ console.log(`deleted ${toRel(f)}`);+ }+ console.log(`\nDeleted ${deadFiles.length} files. Re-run without --delete to find newly-orphaned components.`);+};++const reactOnlyReport = (allVue, edges, reverseEdges) => {+ const reactRoot = resolve(SRC, "react") + "/";+ const candidates = [];+ for (const f of allVue) {+ const importers = reverseEdges.get(f);+ if (!importers || importers.size === 0) continue;+ let allReact = true;+ for (const i of importers) {+ if (!i.startsWith(reactRoot)) {+ allReact = false;+ break;+ }+ }+ if (allReact) candidates.push(f);+ }+ printGroups("Vue components imported only from src/react/", candidates);+};++const main = () => {+ const { allFiles, edges } = buildGraph();+ const roots = seedRoots(allFiles);+ const live = traverse(edges, roots);+ const candidates = candidateVueFiles(allFiles);++ if (MODE_REACT_ONLY) {+ const reverseEdges = buildReverseEdges(edges);+ reactOnlyReport(candidates, edges, reverseEdges);+ return;+ }++ const dead = candidates.filter((f) => !live.has(f));+ if (MODE_DELETE) {+ if (dead.length === 0) {+ console.log("No dead components to delete.");+ return;+ }+ deleteDead(dead);+ return;+ }++ reportDead(dead);+};++if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ main();+}diff --git a/frontend/src/components/Changelog/ChangelogDataTable.vue b/frontend/src/components/Changelog/ChangelogDataTable.vuedeleted file mode 100644index b862ea9539..0000000000--- a/frontend/src/components/Changelog/ChangelogDataTable.vue+++ /dev/null@@ -1,118 +0,0 @@-<template>- <NDataTable- key="changelog-table"- size="small"- :columns="columnList"- :data="changelogs"- :row-key="(changelog: Changelog) => changelog.name"- :striped="true"- :row-props="rowProps"- :loading="loading"- :checked-row-keys="selectedChangelogs"- @update:checked-row-keys="(keys) => $emit('update:selected-changelogs', keys as string[])"- />-</template>--<script lang="tsx" setup>-import { type DataTableColumn, NDataTable } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { getDateForPbTimestampProtoEs } from "@/types";-import type { Changelog } from "@/types/proto-es/v1/database_service_pb";-import { Changelog_Status } from "@/types/proto-es/v1/database_service_pb";-import { changelogLink } from "@/utils/v1/changelog";-import HumanizeDate from "../misc/HumanizeDate.vue";-import ChangelogStatusIcon from "./ChangelogStatusIcon.vue";--const props = defineProps<{- changelogs: Changelog[];- selectedChangelogs?: string[];- customClick?: boolean;- showSelection?: boolean;- loading?: boolean;-}>();--const emit = defineEmits<{- (event: "update:selected-changelogs", value: string[]): void;- (event: "row-click", changelog: Changelog): void;-}>();--const router = useRouter();-const { t } = useI18n();--const columnList = computed(() => {- const columns: (DataTableColumn<Changelog> & { hide?: boolean })[] = [- {- type: "selection",- hide: !props.showSelection,- width: "2rem",- disabled: (changelog) => {- return !allowToSelectChangelog(changelog);- },- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- },- {- key: "status",- width: 48,- render: (changelog) => {- return (- <ChangelogStatusIcon class="mx-auto" status={changelog.status} />- );- },- },- {- key: "created",- title: t("common.created-at"),- width: 180,- resizable: true,- render: (changelog) => {- return (- <HumanizeDate- date={getDateForPbTimestampProtoEs(changelog.createTime)}- />- );- },- },- {- key: "rollout",- title: t("common.rollout"),- resizable: true,- minWidth: 200,- ellipsis: {- tooltip: true,- },- render: (changelog) => changelog.planTitle || "-",- },- ];- return columns.filter((col) => !col.hide);-});--const rowProps = (changelog: Changelog) => {- return {- onClick: (e: MouseEvent) => {- if (props.customClick) {- emit("row-click", changelog);- return;- }-- const url = changelogLink(changelog);- if (e.ctrlKey || e.metaKey) {- window.open(url, "_blank");- } else {- router.push(url);- }- },- };-};--const allowToSelectChangelog = (changelog: Changelog) => {- return changelog.status === Changelog_Status.DONE;-};-</script>diff --git a/frontend/src/components/Changelog/ChangelogStatusIcon.vue b/frontend/src/components/Changelog/ChangelogStatusIcon.vuedeleted file mode 100644index 20d55fe0f7..0000000000--- a/frontend/src/components/Changelog/ChangelogStatusIcon.vue+++ /dev/null@@ -1,48 +0,0 @@-<template>- <span- class="flex items-center justify-center rounded-full select-none"- :class="iconClass()"- >- <template v-if="status === Changelog_Status.PENDING">- <span- class="h-2 w-2 bg-info rounded-full"- style="animation: pulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"- aria-hidden="true"- ></span>- </template>- <template v-else-if="status === Changelog_Status.DONE">- <heroicons-solid:check class="w-4 h-4" />- </template>- <template v-else-if="status === Changelog_Status.FAILED">- <span- class="h-2 w-2 rounded-full text-center pb-6 font-normal text-base"- aria-hidden="true"- >!</span- >- </template>- </span>-</template>--<script lang="ts" setup>-import type { PropType } from "vue";-import { Changelog_Status } from "@/types/proto-es/v1/database_service_pb";--const props = defineProps({- status: {- required: true,- type: Number as PropType<Changelog_Status>,- },-});--const iconClass = () => {- const iconClass = "w-5 h-5";- switch (props.status) {- case Changelog_Status.PENDING:- return iconClass + " bg-white border-2 border-info text-info";- case Changelog_Status.DONE:- return iconClass + " bg-success text-white";- case Changelog_Status.FAILED:- return iconClass + " bg-error text-white";- }-};-</script>diff --git a/frontend/src/components/Changelog/index.ts b/frontend/src/components/Changelog/index.tsdeleted file mode 100644index d6b6618549..0000000000--- a/frontend/src/components/Changelog/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import ChangelogDataTable from "./ChangelogDataTable.vue";-import ChangelogStatusIcon from "./ChangelogStatusIcon.vue";--export { ChangelogStatusIcon, ChangelogDataTable };diff --git a/frontend/src/components/ColumnDataTable/ClassificationCell.vue b/frontend/src/components/ColumnDataTable/ClassificationCell.vuedeleted file mode 100644index 6f25d21718..0000000000--- a/frontend/src/components/ColumnDataTable/ClassificationCell.vue+++ /dev/null@@ -1,68 +0,0 @@-<template>- <div class="flex items-center gap-x-1">- <ClassificationLevelBadge- :classification="classification"- :classification-config="classificationConfig"- />- <template v-if="!readonly && !disabled">- <NPopconfirm v-if="classification" @positive-click="removeClassification">- <template #trigger>- <MiniActionButton @click.stop="">- <XIcon class="w-3 h-3" />- </MiniActionButton>- </template>- <template #default>- <div>- {{ $t("settings.sensitive-data.remove-classification-tips") }}- </div>- </template>- </NPopconfirm>- <MiniActionButton v-if="classificationConfig" @click.prevent="openDrawer">- <PencilIcon class="w-3 h-3" />- </MiniActionButton>- </template>- </div>-- <SelectClassificationDrawer- v-if="classificationConfig"- :show="showClassificationDrawer"- :classification-config="classificationConfig"- @dismiss="showClassificationDrawer = false"- @apply="$emit('apply', $event)"- />-</template>--<script lang="ts" setup>-import { PencilIcon, XIcon } from "lucide-vue-next";-import { NPopconfirm } from "naive-ui";-import { ref } from "vue";-import ClassificationLevelBadge from "@/components/SensitiveData/components/ClassificationLevelBadge.vue";-import SelectClassificationDrawer from "@/components/SensitiveData/components/SelectClassificationDrawer.vue";-import { MiniActionButton } from "@/components/v2";-import type { Engine } from "@/types/proto-es/v1/common_pb";-import type { DataClassificationSetting_DataClassificationConfig as DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";--defineProps<{- classification?: string | undefined;- readonly?: boolean;- disabled?: boolean;- classificationConfig?: DataClassificationConfig;- engine: Engine;-}>();--const emit = defineEmits<{- (event: "apply", id: string): void;-}>();--const showClassificationDrawer = ref(false);--const openDrawer = (e: MouseEvent) => {- e.stopPropagation();- showClassificationDrawer.value = true;-};--const removeClassification = (e: MouseEvent) => {- e.stopPropagation();- emit("apply", "");-};-</script>diff --git a/frontend/src/components/ColumnDataTable/LabelsCell.vue b/frontend/src/components/ColumnDataTable/LabelsCell.vuedeleted file mode 100644index b5067890ce..0000000000--- a/frontend/src/components/ColumnDataTable/LabelsCell.vue+++ /dev/null@@ -1,74 +0,0 @@-<template>- <div class="flex items-center gap-x-1">- <LabelsCell :labels="labels" :show-count="2" />- <MiniActionButton v-if="!readonly" @click.prevent="openLabelsDrawer()">- <PencilIcon class="w-3 h-3" />- </MiniActionButton>- </div>-- <LabelEditorDrawer- v-if="state.showLabelsDrawer"- :show="true"- :readonly="!!readonly"- :title="$t('db.labels-for-resource', { resource: `'${column}'` })"- :labels="[labels]"- @dismiss="state.showLabelsDrawer = false"- @apply="onLabelsApply($event)"- />-</template>--<script lang="ts" setup>-import { PencilIcon } from "lucide-vue-next";-import { computed, reactive } from "vue";-import { useI18n } from "vue-i18n";-import { MiniActionButton } from "@/components/v2";-import { LabelsCell } from "@/components/v2/Model/cells";-import { getColumnCatalog, useDatabaseCatalog } from "@/store";-import LabelEditorDrawer from "../LabelEditorDrawer.vue";-import { updateColumnCatalog } from "./utils";--type LocalState = {- showLabelsDrawer: boolean;-};--const props = defineProps<{- database: string;- schema: string;- table: string;- column: string;- readonly?: boolean;-}>();--const state = reactive<LocalState>({- showLabelsDrawer: false,-});-const { t } = useI18n();--const databaseCatalog = useDatabaseCatalog(props.database, false);--const columnCatalog = computed(() =>- getColumnCatalog(- databaseCatalog.value,- props.schema,- props.table,- props.column- )-);--const labels = computed(() => columnCatalog.value?.labels ?? {});--const openLabelsDrawer = () => {- state.showLabelsDrawer = true;-};--const onLabelsApply = async (labelsList: { [key: string]: string }[]) => {- await updateColumnCatalog({- database: props.database,- schema: props.schema,- table: props.table,- column: props.column,- columnCatalog: { labels: labelsList[0] },- notification: t("common.update"),- });-};-</script>diff --git a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue b/frontend/src/components/ColumnDataTable/SemanticTypeCell.vuedeleted file mode 100644index c87281bf8c..0000000000--- a/frontend/src/components/ColumnDataTable/SemanticTypeCell.vue+++ /dev/null@@ -1,133 +0,0 @@-<template>- <div class="flex items-center gap-x-1">- <span v-if="semanticType?.title">{{ semanticType?.title }}</span>- <span v-else class="text-control-placeholder italic"> N/A </span>- <NPopconfirm- v-if="!readonly && semanticType"- @positive-click="() => onSemanticTypeApply('')"- >- <template #trigger>- <MiniActionButton v-if="!readonly && semanticType">- <XIcon class="w-3 h-3" />- </MiniActionButton>- </template>-- <template #default>- <div>- {{ $t("settings.sensitive-data.remove-semantic-type-tips") }}- </div>- </template>- </NPopconfirm>- <MiniActionButton v-if="!readonly" @click.prevent="openSemanticTypeDrawer">- <PencilIcon class="w-3 h-3" />- </MiniActionButton>- </div>-- <FeatureModal- :feature="PlanFeature.FEATURE_DATA_MASKING"- :instance="getInstanceResource(database)"- :open="state.showFeatureModal"- @cancel="state.showFeatureModal = false"- />-- <SemanticTypesDrawer- v-if="state.showSemanticTypesDrawer"- :show="true"- :semantic-type-list="semanticTypeList"- @dismiss="state.showSemanticTypesDrawer = false"- @apply="onSemanticTypeApply($event)"- />-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { PencilIcon, XIcon } from "lucide-vue-next";-import { NPopconfirm } from "naive-ui";-import { computed, reactive, watchEffect } from "vue";-import { MiniActionButton } from "@/components/v2";-import { useSettingV1Store, useSubscriptionV1Store } from "@/store";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- SemanticTypeSetting_SemanticTypeSchema,- Setting_SettingName,-} from "@/types/proto-es/v1/setting_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { getInstanceResource, hasWorkspacePermissionV2 } from "@/utils";-import FeatureModal from "../FeatureGuard/FeatureModal.vue";-import SemanticTypesDrawer from "./SemanticTypesDrawer.vue";--type LocalState = {- showFeatureModal: boolean;- showSemanticTypesDrawer: boolean;-};--const props = defineProps<{- semanticTypeId: string;- database: Database;- readonly?: boolean;-}>();--const emit = defineEmits<{- (event: "apply", id: string): Promise<void>;-}>();--const state = reactive<LocalState>({- showFeatureModal: false,- showSemanticTypesDrawer: false,-});-const subscriptionV1Store = useSubscriptionV1Store();-const settingV1Store = useSettingV1Store();--watchEffect(async () => {- await settingV1Store.getOrFetchSettingByName(- Setting_SettingName.SEMANTIC_TYPES,- true- );-});--const semanticTypeList = computed(() => {- const setting = settingV1Store.getSettingByName(- Setting_SettingName.SEMANTIC_TYPES- );- if (setting?.value?.value?.case === "semanticType") {- return setting.value.value.value.types ?? [];- }- return [];-});--const semanticType = computed(() => {- const id = props.semanticTypeId;- if (!id) return;- if (!hasWorkspacePermissionV2("bb.settings.get")) {- return create(SemanticTypeSetting_SemanticTypeSchema, {- id,- title: id,- });- }- return semanticTypeList.value.find((data) => data.id === id);-});--const hasSensitiveDataFeature = computed(() => {- return subscriptionV1Store.hasFeature(PlanFeature.FEATURE_DATA_MASKING);-});--const instanceMissingLicense = computed(() => {- return subscriptionV1Store.instanceMissingLicense(- PlanFeature.FEATURE_DATA_MASKING,- getInstanceResource(props.database)- );-});--const openSemanticTypeDrawer = () => {- if (!hasSensitiveDataFeature.value || instanceMissingLicense.value) {- state.showFeatureModal = true;- return;- }-- state.showSemanticTypesDrawer = true;-};--const onSemanticTypeApply = async (semanticType: string) => {- await emit("apply", semanticType);-};-</script>diff --git a/frontend/src/components/ColumnDataTable/SemanticTypesDrawer.vue b/frontend/src/components/ColumnDataTable/SemanticTypesDrawer.vuedeleted file mode 100644index 5df0d7dd42..0000000000--- a/frontend/src/components/ColumnDataTable/SemanticTypesDrawer.vue+++ /dev/null@@ -1,57 +0,0 @@-<template>- <Drawer :show="show" @close="$emit('dismiss')">- <DrawerContent :title="$t('settings.sensitive-data.semantic-types.self')">- <div class="flex flex-col gap-y-8 w-200 h-full">- <SemanticTypesTable- :row-clickable="true"- :size="'small'"- :semantic-item-list="semanticItemList"- @select="onApply($event)"- />- </div>- <template #footer>- <div class="w-full flex justify-between items-center">- <div class="w-full flex justify-end items-center gap-x-2">- <NButton @click.prevent="$emit('dismiss')">- {{ $t("common.cancel") }}- </NButton>- </div>- </div>- </template>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { computed } from "vue";-import { Drawer, DrawerContent } from "@/components/v2";-import type { SemanticTypeSetting_SemanticType } from "@/types/proto-es/v1/setting_service_pb";-import type { SemanticItem } from "./SemanticTypesTable.vue";-import SemanticTypesTable from "./SemanticTypesTable.vue";--const props = defineProps<{- show: boolean;- semanticTypeList: SemanticTypeSetting_SemanticType[];-}>();--const emit = defineEmits<{- (event: "dismiss"): void;- (event: "apply", id: string): void;-}>();--const semanticItemList = computed((): SemanticItem[] => {- return props.semanticTypeList.map((semanticType) => {- return {- dirty: false,- item: semanticType,- mode: "NORMAL",- };- });-});--const onApply = (semanticTypeId: string) => {- emit("apply", semanticTypeId);- emit("dismiss");-};-</script>diff --git a/frontend/src/components/ColumnDataTable/SemanticTypesTable.vue b/frontend/src/components/ColumnDataTable/SemanticTypesTable.vuedeleted file mode 100644index 66a69416a8..0000000000--- a/frontend/src/components/ColumnDataTable/SemanticTypesTable.vue+++ /dev/null@@ -1,174 +0,0 @@-<template>- <NDataTable- :size="size"- :data="semanticItemList"- :columns="columnList"- :striped="true"- :bordered="true"- :row-props="rowProps"- :row-key="(item: SemanticItem) => item.item.id"- />-</template>--<script lang="tsx" setup>-import { InfoIcon } from "lucide-vue-next";-import type { DataTableColumn } from "naive-ui";-import { NDataTable, NTooltip } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Algorithm,- SemanticTypeSetting_SemanticType,-} from "@/types/proto-es/v1/setting_service_pb";--export interface SemanticItem {- mode: "NORMAL";- dirty: boolean;- item: SemanticTypeSetting_SemanticType;-}--const props = withDefaults(- defineProps<{- size?: "small" | "medium" | "large";- semanticItemList: SemanticItem[];- rowClickable: boolean;- }>(),- { size: "medium" }-);--const emit = defineEmits<{- (event: "select", id: string): void;-}>();--const { t } = useI18n();--type MaskingType = "full-mask" | "range-mask" | "md5-mask" | "inner-outer-mask";--const getMaskingType = (- algorithm: Algorithm | undefined-): MaskingType | undefined => {- if (!algorithm?.mask) return undefined;- switch (algorithm.mask.case) {- case "fullMask":- return "full-mask";- case "rangeMask":- return "range-mask";- case "innerOuterMask":- return "inner-outer-mask";- case "md5Mask":- return "md5-mask";- default:- return undefined;- }-};--const isBuiltinSemanticType = (item: SemanticTypeSetting_SemanticType) => {- return item.id.startsWith("bb.");-};--const columnList = computed(() => {- const columns: DataTableColumn<SemanticItem>[] = [- {- key: "icon",- title: t("settings.sensitive-data.semantic-types.table.icon"),- width: 80,- align: "center",- render: (item) => {- if (item.item.icon) {- return (- <div class="flex items-center justify-center">- <img src={item.item.icon} class="w-6 h-6 object-contain" alt="" />- </div>- );- }- return (- <div class="flex items-center justify-center">- <span class="text-gray-400">-</span>- </div>- );- },- },- {- key: "id",- title: "ID",- width: 150,- resizable: true,- ellipsis: { tooltip: true },- render: (item) => item.item.id,- },- {- key: "title",- title: t("settings.sensitive-data.semantic-types.table.semantic-type"),- width: "minmax(min-content, auto)",- resizable: true,- ellipsis: { tooltip: true },- render: (item) => item.item.title,- },- {- key: "description",- title: t("settings.sensitive-data.semantic-types.table.description"),- width: 200,- resizable: true,- ellipsis: { tooltip: true },- render: (item) => item.item.description,- },- {- key: "algorithm",- title: t(- "settings.sensitive-data.semantic-types.table.masking-algorithm"- ),- width: "minmax(min-content, auto)",- resizable: true,- render: (item) => {- return (- <div class="flex items-center gap-x-1">- {isBuiltinSemanticType(item.item) ? (- <h3>- {t(- `dynamic.settings.sensitive-data.semantic-types.template.${item.item.id.split(".").join("-")}.title`- )}- </h3>- ) : (- <h3>- {getMaskingType(item.item.algorithm)- ? t(- `settings.sensitive-data.algorithms.${getMaskingType(item.item.algorithm)?.toLowerCase()}.self`- )- : "N/A"}- </h3>- )}- {isBuiltinSemanticType(item.item) && (- <NTooltip>- {{- trigger: () => <InfoIcon class="w-4" />,- default: () => (- <div class="whitespace-pre-line">- {t(- `dynamic.settings.sensitive-data.semantic-types.template.${item.item.id.split(".").join("-")}.algorithm.description`- )}- </div>- ),- }}- </NTooltip>- )}- </div>- );- },- },- ];-- return columns;-});--const rowProps = (item: SemanticItem) => {- return {- style: props.rowClickable ? "cursor: pointer;" : "",- onClick: () => {- if (!props.rowClickable) {- return;- }- emit("select", item.item.id);- },- };-};-</script>diff --git a/frontend/src/components/ColumnDataTable/index.vue b/frontend/src/components/ColumnDataTable/index.vuedeleted file mode 100644index afacd66b48..0000000000--- a/frontend/src/components/ColumnDataTable/index.vue+++ /dev/null@@ -1,293 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="filteredColumnList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :bordered="true"- :row-key="getColumnKey"- />-</template>--<script lang="ts" setup>-import type { DataTableColumn } from "naive-ui";-import { NCheckbox, NDataTable } from "naive-ui";-import { computed, h } from "vue";-import { useI18n } from "vue-i18n";-import { getColumnDefaultValuePlaceholder } from "@/components/SchemaEditorLite";-import {- getColumnCatalog,- useDatabaseCatalog,- useSubscriptionV1Store,-} from "@/store";-import { Engine } from "@/types/proto-es/v1/common_pb";-import type {- ColumnMetadata,- Database,- TableMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import type { DataClassificationSetting_DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import {- getDatabaseProject,- getInstanceResource,- hasProjectPermissionV2,-} from "@/utils";-import ClassificationCell from "./ClassificationCell.vue";-import LabelsCell from "./LabelsCell.vue";-import SemanticTypeCell from "./SemanticTypeCell.vue";-import { updateColumnCatalog } from "./utils";--defineOptions({- name: "ColumnDataTable",-});--const props = withDefaults(- defineProps<{- database: Database;- schema: string;- table: TableMetadata;- columnList: ColumnMetadata[];- classificationConfig?: DataClassificationSetting_DataClassificationConfig;- search?: string;- isExternalTable: boolean;- }>(),- {- classificationConfig: undefined,- search: "",- isExternalTable: false,- }-);--const { t } = useI18n();-const engine = computed(() => {- return getInstanceResource(props.database).engine;-});-const subscriptionV1Store = useSubscriptionV1Store();--const hasSensitiveDataFeature = computed(() => {- return subscriptionV1Store.hasFeature(PlanFeature.FEATURE_DATA_MASKING);-});--const showSensitiveColumn = computed(() => {- return (- !props.isExternalTable &&- hasSensitiveDataFeature.value &&- (engine.value === Engine.MYSQL ||- engine.value === Engine.TIDB ||- engine.value === Engine.POSTGRES ||- engine.value === Engine.REDSHIFT ||- engine.value === Engine.ORACLE ||- engine.value === Engine.SNOWFLAKE ||- engine.value === Engine.MSSQL ||- engine.value === Engine.BIGQUERY ||- engine.value === Engine.SPANNER ||- engine.value === Engine.CASSANDRA ||- engine.value === Engine.TRINO)- );-});--const showClassificationColumn = computed(() => {- return !props.isExternalTable && hasSensitiveDataFeature.value;-});--const showLabelsColumn = computed(() => {- return !props.isExternalTable;-});--const showCollationColumn = computed(() => {- return (- engine.value !== Engine.CLICKHOUSE && engine.value !== Engine.SNOWFLAKE- );-});--const hasDatabaseCatalogPermission = computed(() => {- return hasProjectPermissionV2(- getDatabaseProject(props.database),- "bb.databaseCatalogs.update"- );-});--const databaseCatalog = useDatabaseCatalog(props.database.name, false);--const getColumnKey = (column: ColumnMetadata) => {- return `${props.database.name}.${props.schema}.${props.table.name}.${column.name}`;-};--const columns = computed(() => {- const columns: (DataTableColumn<ColumnMetadata> & { hide?: boolean })[] = [- {- key: "name",- title: t("common.name"),- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return column.name;- },- },- {- key: "semanticType",- title: t("settings.sensitive-data.semantic-types.table.semantic-type"),- hide: !showSensitiveColumn.value,- resizable: true,- width: 180,- minWidth: 140,- render: (column) => {- const columnCatalog = getColumnCatalog(- databaseCatalog.value,- props.schema,- props.table.name,- column.name- );- return h(SemanticTypeCell, {- database: props.database,- semanticTypeId: columnCatalog.semanticType,- readonly: !hasDatabaseCatalogPermission.value,- onApply: (id: string) => onSemanticTypeApply(column.name, id),- });- },- },- {- key: "classification",- title: t("database.classification.self"),- hide: !showClassificationColumn.value,- width: 200,- minWidth: 140,- resizable: true,- render: (column) => {- const columnCatalog = getColumnCatalog(- databaseCatalog.value,- props.schema,- props.table.name,- column.name- );- return h(ClassificationCell, {- classification: columnCatalog.classification,- classificationConfig: props.classificationConfig,- engine: engine.value,- readonly: !hasDatabaseCatalogPermission.value,- onApply: (id: string) => onClassificationIdApply(column.name, id),- });- },- },- {- key: "type",- title: t("common.type"),- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return column.type;- },- },- {- key: "default",- title: t("common.default"),- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return getColumnDefaultValuePlaceholder(column);- },- },- {- key: "nullable",- title: t("database.nullable"),- resizable: true,- width: 140,- render: (column) => {- return h(NCheckbox, {- checked: column.nullable,- readonly: true,- });- },- },- {- key: "characterSet",- title: t("db.character-set"),- hide: engine.value === Engine.POSTGRES,- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return column.characterSet;- },- },- {- key: "collation",- title: t("db.collation"),- hide: !showCollationColumn.value,- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return column.collation;- },- },- {- key: "comment",- title: t("database.comment"),- resizable: true,- width: 140,- ellipsis: true,- render: (column) => {- return column.comment;- },- },- {- key: "labels",- title: t("common.labels"),- hide: !showLabelsColumn.value,- resizable: true,- width: 140,- render: (column) => {- return h(LabelsCell, {- database: props.database.name,- schema: props.schema,- table: props.table.name,- column: column.name,- readonly: !hasDatabaseCatalogPermission.value,- });- },- },- ];-- return columns.filter((column) => !column.hide);-});--const filteredColumnList = computed(() => {- if (props.search) {- return props.columnList.filter((column) => {- return column.name.toLowerCase().includes(props.search.toLowerCase());- });- }- return props.columnList;-});--const onClassificationIdApply = async (- column: string,- classification: string-) => {- await updateColumnCatalog({- database: props.database.name,- schema: props.schema,- table: props.table.name,- column,- columnCatalog: { classification },- notification: !classification ? t("common.removed") : t("common.update"),- });-};--const onSemanticTypeApply = async (column: string, semanticType: string) => {- await updateColumnCatalog({- database: props.database.name,- schema: props.schema,- table: props.table.name,- column,- columnCatalog: { semanticType },- notification: !semanticType ? t("common.removed") : t("common.update"),- });-};-</script>diff --git a/frontend/src/components/DBExtensionDataTable.vue b/frontend/src/components/DBExtensionDataTable.vuedeleted file mode 100644index d12193888b..0000000000--- a/frontend/src/components/DBExtensionDataTable.vue+++ /dev/null@@ -1,66 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="dbExtensionList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :bordered="true"- :loading="loading"- :row-key="(ex: ExtensionMetadata) => ex.name"- />-</template>--<script lang="ts" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type { ExtensionMetadata } from "@/types/proto-es/v1/database_service_pb";--withDefaults(- defineProps<{- dbExtensionList: ExtensionMetadata[];- loading?: boolean;- }>(),- {- dbExtensionList: () => [],- loading: false,- }-);--const { t } = useI18n();--const columns = computed(() => {- return [- {- key: "name",- title: t("common.name"),- render: (row) => {- return row.name;- },- },- {- key: "version",- title: t("common.version"),- render: (row) => {- return row.version;- },- },- {- key: "schema",- title: t("common.schema"),- render: (row) => {- return row.schema;- },- },- {- key: "description",- title: t("common.description"),- render: (row) => {- return row.description;- },- },- ] as DataTableColumn<ExtensionMetadata>[];-});-</script>diff --git a/frontend/src/components/Database/DatabaseOverviewInfo.vue b/frontend/src/components/Database/DatabaseOverviewInfo.vuedeleted file mode 100644index 87bb5307f0..0000000000--- a/frontend/src/components/Database/DatabaseOverviewInfo.vue+++ /dev/null@@ -1,87 +0,0 @@-<template>- <dl- class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2"- data-label="bb-database-overview-description-list"- >- <template v-if="instanceV1HasCollationAndCharacterSet(databaseEngine)">- <div class="col-span-1 col-start-1">- <dt class="text-sm font-medium text-control-light">- {{- databaseEngine === Engine.POSTGRES- ? $t("db.encoding")- : $t("db.character-set")- }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ databaseSchemaMetadata.characterSet }}- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("db.collation") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ databaseSchemaMetadata.collation }}- </dd>- </div>- </template>-- <div class="col-span-1 col-start-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.sync-status") }}- </dt>- <dd class="mt-1 text-sm text-main">- <template v-if="database.syncStatus === SyncStatus.FAILED">- <span class="text-error">{{ $t("database.sync-status-failed") }}</span>- <p class="text-xs text-gray-500 mt-1">{{ database.syncError }}</p>- </template>- <template v-else>- {{ database.state === State.ACTIVE ? "OK" : "NOT_FOUND" }}- </template>- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.last-sync") }}- </dt>- <dd class="mt-1 text-sm text-main">- <HumanizeDate- :date="- database.successfulSyncTime- ? new Date(Number(database.successfulSyncTime.seconds) * 1000)- : undefined- "- />- </dd>- </div>- </dl>-</template>--<script setup lang="ts">-import { computed } from "vue";-import { useDBSchemaV1Store } from "@/store";-import { Engine, State } from "@/types/proto-es/v1/common_pb";-import {- type Database,- SyncStatus,-} from "@/types/proto-es/v1/database_service_pb";-import {- getDatabaseEngine,- instanceV1HasCollationAndCharacterSet,-} from "@/utils";-import HumanizeDate from "../misc/HumanizeDate.vue";--const props = defineProps<{- database: Database;-}>();--const databaseEngine = computed(() => {- return getDatabaseEngine(props.database);-});--const databaseSchemaMetadata = computed(() => {- return useDBSchemaV1Store().getDatabaseMetadata(props.database.name);-});-</script>diff --git a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vuedeleted file mode 100644index 5e5f091e53..0000000000--- a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue+++ /dev/null@@ -1,318 +0,0 @@-<template>- <div class="w-full flex flex-col gap-y-4">- <FeatureAttention- :feature="PlanFeature.FEATURE_DATA_MASKING"- :instance="getInstanceResource(database)"- />- <div- class="flex flex-col gap-x-2 lg:flex-row gap-y-4 justify-between items-end lg:items-center"- >- <SearchBox v-model:value="state.searchText" style="max-width: 100%" />- <PermissionGuardWrapper- v-if="!isMaskingForNoSQL"- v-slot="slotProps"- :project="getDatabaseProject(database)"- :permissions="[- 'bb.policies.createMaskingExemptionPolicy',- 'bb.policies.updateMaskingExemptionPolicy',- 'bb.databaseCatalogs.get'- ]"- >- <NButton- type="primary"- :disabled="- slotProps.disabled ||- state.pendingGrantAccessColumn.length === 0- "- @click="onGrantAccessButtonClick"- >- <template #icon>- <ShieldCheckIcon v-if="hasSensitiveDataFeature" class="w-4" />- <FeatureBadge- v-else- :feature="PlanFeature.FEATURE_DATA_MASKING"- class="text-white"- :instance="getInstanceResource(database)"- />- </template>- {{ $t("settings.sensitive-data.grant-access") }}- </NButton>- </PermissionGuardWrapper>- </div>-- <SensitiveColumnTable- :database="database"- :row-clickable="false"- :row-selectable="!isMaskingForNoSQL"- :show-operation="hasUpdateCatalogPermission && hasSensitiveDataFeature"- :column-list="filteredColumnList"- v-model:checked-column-list="state.pendingGrantAccessColumn"- @delete="onColumnRemove"- />- </div>-- <FeatureModal- :feature="PlanFeature.FEATURE_DATA_MASKING"- :open="state.showFeatureModal"- :instance="getInstanceResource(database)"- @cancel="state.showFeatureModal = false"- />-- <GrantAccessDrawer- v-if="- state.showGrantAccessDrawer && state.pendingGrantAccessColumn.length > 0- "- :column-list="- state.pendingGrantAccessColumn.map((maskData) => ({- database,- maskData,- }))- "- :project-name="database.project"- @dismiss="- () => {- state.showGrantAccessDrawer = false;- state.pendingGrantAccessColumn = [];- }- "- />-</template>--<script lang="tsx" setup>-import { create } from "@bufbuild/protobuf";-import { ShieldCheckIcon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { computed, reactive, watch } from "vue";-import {- FeatureAttention,- FeatureBadge,- FeatureModal,-} from "@/components/FeatureGuard";-import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";-import SensitiveColumnTable from "@/components/SensitiveData/components/SensitiveColumnTable.vue";-import GrantAccessDrawer from "@/components/SensitiveData/GrantAccessDrawer.vue";-import type { MaskData } from "@/components/SensitiveData/types";-import { isCurrentColumnException } from "@/components/SensitiveData/utils";-import { SearchBox } from "@/components/v2";-import { featureToRef, useDatabaseCatalog, usePolicyV1Store } from "@/store";-import {- type ObjectSchema,- ObjectSchema_Type,-} from "@/types/proto-es/v1/database_catalog_service_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- MaskingExemptionPolicySchema,- PolicyType,-} from "@/types/proto-es/v1/org_policy_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import {- getDatabaseProject,- getInstanceResource,- hasProjectPermissionV2,- instanceV1MaskingForNoSQL,-} from "@/utils";--const props = defineProps<{- database: Database;-}>();--interface LocalState {- searchText: string;- showFeatureModal: boolean;- isLoading: boolean;- sensitiveList: MaskData[];- pendingGrantAccessColumn: MaskData[];- showGrantAccessDrawer: boolean;-}--const state = reactive<LocalState>({- searchText: "",- showFeatureModal: false,- isLoading: false,- sensitiveList: [],- pendingGrantAccessColumn: [],- showGrantAccessDrawer: false,-});--const isMaskingForNoSQL = computed(() =>- instanceV1MaskingForNoSQL(getInstanceResource(props.database))-);--const hasUpdateCatalogPermission = computed(() => {- return hasProjectPermissionV2(- getDatabaseProject(props.database),- "bb.databaseCatalogs.update"- );-});--const policyStore = usePolicyV1Store();--const hasSensitiveDataFeature = featureToRef(PlanFeature.FEATURE_DATA_MASKING);--const databaseCatalog = useDatabaseCatalog(props.database.name, false);--const flattenObjectSchema = (- parentPath: string,- objectSchema: ObjectSchema-): {- column: string;- semanticTypeId: string;- target: ObjectSchema;-}[] => {- switch (objectSchema.type) {- case ObjectSchema_Type.OBJECT:- const resp = [];- if (objectSchema.kind?.case === "structKind") {- for (const [key, schema] of Object.entries(- objectSchema.kind.value.properties ?? {}- )) {- resp.push(- ...flattenObjectSchema(- [parentPath, key].filter((i) => i).join("."),- schema- )- );- }- }- return resp;- case ObjectSchema_Type.ARRAY:- if (- objectSchema.kind?.case === "arrayKind" &&- objectSchema.kind.value.kind- ) {- return flattenObjectSchema(parentPath, objectSchema.kind.value.kind);- }- return [];- default:- return [- {- column: parentPath,- semanticTypeId: objectSchema.semanticType,- target: objectSchema,- },- ];- }-};--const updateList = async () => {- state.isLoading = true;- const sensitiveList: MaskData[] = [];-- for (const schema of databaseCatalog.value.schemas) {- for (const table of schema.tables) {- // Handle table with structured columns- if (table.kind?.case === "columns") {- for (const column of table.kind.value.columns ?? []) {- if (!column.semanticType && !column.classification) {- continue;- }- sensitiveList.push({- schema: schema.name,- table: table.name,- column: column.name,- semanticTypeId: column.semanticType,- classificationId: column.classification,- target: column,- });- }- }-- // Handle table with object schema- if (table.kind?.case === "objectSchema") {- const flattenItems = flattenObjectSchema("", table.kind.value);- sensitiveList.push(- ...flattenItems.map((item) => ({- ...item,- schema: schema.name,- table: table.name,- classificationId: "",- // TODO(ed/zp/danny): can we support classification for object schema?- disableClassification: true,- }))- );- }-- if (table.classification) {- sensitiveList.push({- schema: schema.name,- table: table.name,- column: "",- semanticTypeId: "",- // TODO(ed/zp/danny): can we support senamtic type for table catalog?- disableSemanticType: true,- classificationId: table.classification,- target: table,- });- }- }- }-- state.sensitiveList = sensitiveList;- state.isLoading = false;-};--watch(databaseCatalog, updateList, { immediate: true, deep: true });--const filteredColumnList = computed(() => {- let list = state.sensitiveList;- const searchText = state.searchText.trim().toLowerCase();- if (searchText) {- list = list.filter(- (item) =>- item.column.includes(searchText) ||- item.table.includes(searchText) ||- item.schema.includes(searchText)- );- }- return list;-});--const removeSensitiveColumn = async (sensitiveColumn: MaskData) => {- await removeMaskingExceptions(sensitiveColumn);-};--const removeMaskingExceptions = async (sensitiveColumn: MaskData) => {- const policy = await policyStore.getOrFetchPolicyByParentAndType({- parentPath: props.database.project,- policyType: PolicyType.MASKING_EXEMPTION,- });- if (!policy) {- return;- }-- const exceptions = (- policy.policy?.case === "maskingExemptionPolicy"- ? policy.policy.value.exemptions- : []- ).filter(- (exception) =>- !isCurrentColumnException(exception, {- database: props.database,- maskData: sensitiveColumn,- })- );-- policy.policy = {- case: "maskingExemptionPolicy",- value: create(MaskingExemptionPolicySchema, {- exemptions: exceptions,- }),- };- await policyStore.upsertPolicy({- parentPath: props.database.project,- policy,- });-};--const onColumnRemove = async (column: MaskData) => {- await removeSensitiveColumn(column);-};--const onGrantAccessButtonClick = () => {- if (!hasSensitiveDataFeature.value) {- state.showFeatureModal = true;- return;- }- state.showGrantAccessDrawer = true;-};-</script>diff --git a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue b/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vuedeleted file mode 100644index 918d807400..0000000000--- a/frontend/src/components/DatabaseAndGroupSelector/DatabaseAndGroupSelector.vue+++ /dev/null@@ -1,133 +0,0 @@-<template>- <NTabs- v-model:value="databaseSelectState.changeSource"- type="card"- size="small"- >- <NTabPane name="DATABASE" :tab="$t('common.databases')">- <AdvancedSearch- v-model:params="searchParams"- class="w-full mb-2"- :autofocus="false"- :placeholder="$t('database.filter-database')"- :scope-options="scopeOptions"- :cache-query="false"- />- <PagedDatabaseTable- mode="PROJECT_SHORT"- :show-selection="true"- :custom-click="true"- :parent="project.name"- :filter="filter"- :size="'small'"- v-model:selected-database-names="- databaseSelectState.selectedDatabaseNameList- "- />- </NTabPane>- <NTabPane name="GROUP" :tab="$t('common.database-group')">- <DatabaseGroupDataTable- :database-group-list="dbGroupList"- :show-selection="true"- :single-selection="true"- :show-external-link="true"- :selected-database-group-names="- databaseSelectState.selectedDatabaseGroup- ? [databaseSelectState.selectedDatabaseGroup]- : []- "- @update:selected-database-group-names="- databaseSelectState.selectedDatabaseGroup = head($event)- "- />- </NTabPane>- </NTabs>-</template>--<script lang="ts" setup>-import { head } from "lodash-es";-import { NTabPane, NTabs } from "naive-ui";-import { computed, reactive, ref, watch } from "vue";-import AdvancedSearch from "@/components/AdvancedSearch";-import DatabaseGroupDataTable from "@/components/DatabaseGroup/DatabaseGroupDataTable.vue";-import { PagedDatabaseTable } from "@/components/v2/Model/DatabaseV1Table";-import { useDBGroupListByProject } from "@/store";-import {- environmentNamePrefix,- instanceNamePrefix,-} from "@/store/modules/v1/common";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import {- CommonFilterScopeIdList,- extractProjectResourceName,- getValueFromSearchParams,- type SearchParams,- type SearchScope,-} from "@/utils";-import { useCommonSearchScopeOptions } from "../AdvancedSearch/useCommonSearchScopeOptions";-import type { DatabaseSelectState } from "./types";--const props = defineProps<{- project: Project;- value?: DatabaseSelectState;-}>();--const emit = defineEmits<{- (event: "close"): void;- (event: "update:value", state: DatabaseSelectState): void;-}>();--const readonlyScopes = computed((): SearchScope[] => [- {- id: "project",- value: extractProjectResourceName(props.project.name),- readonly: true,- },-]);--const searchParams = ref<SearchParams>({- query: "",- scopes: [...readonlyScopes.value],-});--const databaseSelectState = reactive<DatabaseSelectState>(- props.value || {- changeSource: "DATABASE",- selectedDatabaseNameList: [],- }-);--const { dbGroupList } = useDBGroupListByProject(props.project.name);--const selectedInstance = computed(() => {- return getValueFromSearchParams(- searchParams.value,- "instance",- instanceNamePrefix- );-});--const selectedEnvironment = computed(() => {- return getValueFromSearchParams(- searchParams.value,- "environment",- environmentNamePrefix- );-});--const filter = computed(() => ({- instance: selectedInstance.value,- environment: selectedEnvironment.value,- query: searchParams.value.query,-}));--const scopeOptions = useCommonSearchScopeOptions([...CommonFilterScopeIdList]);--watch(- () => databaseSelectState,- () => {- emit("update:value", databaseSelectState);- },- { deep: true }-);-</script>diff --git a/frontend/src/components/DatabaseAndGroupSelector/index.ts b/frontend/src/components/DatabaseAndGroupSelector/index.tsdeleted file mode 100644index bd3ff78e1a..0000000000--- a/frontend/src/components/DatabaseAndGroupSelector/index.ts+++ /dev/null@@ -1,5 +0,0 @@-import DatabaseAndGroupSelector from "./DatabaseAndGroupSelector.vue";--export * from "./types";--export default DatabaseAndGroupSelector;diff --git a/frontend/src/components/DatabaseAndGroupSelector/types.ts b/frontend/src/components/DatabaseAndGroupSelector/types.tsdeleted file mode 100644index d21f5a4ffb..0000000000--- a/frontend/src/components/DatabaseAndGroupSelector/types.ts+++ /dev/null@@ -1,5 +0,0 @@-export interface DatabaseSelectState {- changeSource: "DATABASE" | "GROUP";- selectedDatabaseNameList: string[];- selectedDatabaseGroup?: string;-}diff --git a/frontend/src/components/DatabaseDetail/sqlEditor.ts b/frontend/src/components/DatabaseDetail/sqlEditor.tsdeleted file mode 100644index 9c51416e13..0000000000--- a/frontend/src/components/DatabaseDetail/sqlEditor.ts+++ /dev/null@@ -1,53 +0,0 @@-import type { Router } from "vue-router";-import { SQL_EDITOR_DATABASE_MODULE } from "@/router/sqlEditor";-import { defaultProject, isDefaultProject } from "@/types";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- extractDatabaseResourceName,- extractInstanceResourceName,- extractProjectResourceName,- hasProjectPermissionV2,- isSQLEditorRoute,-} from "@/utils";--export const openSQLEditorForDatabase = ({- router,- database,- schema,- table,- onPermissionDenied,-}: {- router: Router;- database: Database;- schema?: string;- table?: string;- onPermissionDenied?: (database: Database) => void;-}) => {- if (isDefaultProject(database.project)) {- if (- !hasProjectPermissionV2(defaultProject(database.project), "bb.sql.select")- ) {- onPermissionDenied?.(database);- return;- }- }-- const { instance, databaseName } = extractDatabaseResourceName(database.name);- const route = router.resolve({- name: SQL_EDITOR_DATABASE_MODULE,- params: {- project: extractProjectResourceName(database.project),- instance: extractInstanceResourceName(instance),- database: databaseName,- },- query: {- schema: schema || undefined,- table: table || undefined,- },- });- if (isSQLEditorRoute(router)) {- router.push(route);- } else {- window.open(route.fullPath);- }-};diff --git a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue b/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vuedeleted file mode 100644index 4bd2fc3259..0000000000--- a/frontend/src/components/DatabaseGroup/DatabaseGroupDataTable.vue+++ /dev/null@@ -1,213 +0,0 @@-<template>- <NDataTable- v-bind="$attrs"- size="small"- :columns="columnList"- :data="data"- :striped="true"- :bordered="bordered"- :loading="loading"- :row-key="(data: DatabaseGroup) => data.name"- :checked-row-keys="selectedDatabaseGroupNames"- :row-props="rowProps"- :pagination="{ pageSize }"- :paginate-single-page="false"- @update:checked-row-keys="- (val) => $emit('update:selected-database-group-names', val as string[])- "- />-</template>--<script lang="tsx" setup>-import { EllipsisVerticalIcon, ExternalLinkIcon } from "lucide-vue-next";-import type { DataTableColumn, DropdownOption } from "naive-ui";-import { NButton, NDataTable, NDropdown, NEllipsis } from "naive-ui";-import { computed, h } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";-import { getProjectNameAndDatabaseGroupName } from "@/store";-import type { DatabaseGroup } from "@/types/proto-es/v1/database_group_service_pb";--type DatabaseGroupDataTableColumn = DataTableColumn<DatabaseGroup> & {- hide?: boolean;-};--const props = withDefaults(- defineProps<{- databaseGroupList: DatabaseGroup[];- bordered?: boolean;- loading?: boolean;- showSelection?: boolean;- showExternalLink?: boolean;- showActions?: boolean;- singleSelection?: boolean;- pageSize?: number;- onRowClick?: (e: MouseEvent, databaseGroup: DatabaseGroup) => void;- selectedDatabaseGroupNames?: string[];- }>(),- {- bordered: false,- pageSize: 20,- selectedDatabaseGroupNames: () => [],- }-);--const emit = defineEmits<{- (event: "update:selected-database-group-names", val: string[]): void;- (event: "delete", databaseGroup: DatabaseGroup): void;-}>();--const { t } = useI18n();-const router = useRouter();--const columnList = computed((): DatabaseGroupDataTableColumn[] => {- const rawColumnList: DatabaseGroupDataTableColumn[] = [- {- type: "selection",- multiple: !props.singleSelection,- hide: !props.showSelection,- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- },- {- key: "title",- title: t("common.name"),- width: 256,- ellipsis: true,- resizable: true,- render: (data) => data.title,- },- {- key: "expression",- title: t("database.expression"),- ellipsis: true,- render: (data) => {- if (!data.databaseExpr || data.databaseExpr.expression === "") {- return <span class="textinfolabel italic">{t("common.empty")}</span>;- }- return <NEllipsis>{data.databaseExpr.expression}</NEllipsis>;- },- },- {- key: "externalLink",- title: "",- width: 48,- hide: !props.showExternalLink,- render: (data) => {- const openExternalLink = (e: MouseEvent) => {- e.stopPropagation();- const [projectId, databaseGroupName] =- getProjectNameAndDatabaseGroupName(data.name);- const url = router.resolve({- name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,- params: {- projectId,- databaseGroupName,- },- }).fullPath;- window.open(url, "_blank");- };-- return (- <div- class="flex items-center justify-end cursor-pointer w-6 h-6 p-1 opacity-60 hover:opacity-100 hover:bg-white hover:shadow-sm rounded-sm"- onClick={openExternalLink}- >- <ExternalLinkIcon class="w-4 h-auto" />- </div>- );- },- },- {- key: "actions",- title: "",- width: 48,- hide: !props.showActions,- render: (data) => {- const dropdownOptions: DropdownOption[] = [- {- key: "delete",- label: t("common.delete"),- },- ];-- return h(- "div",- {- class: "flex justify-end",- onClick: (e: Event) => {- e.stopPropagation();- },- },- h(- NDropdown,- {- trigger: "click",- options: dropdownOptions,- onSelect: (key: string) => {- if (key === "delete") {- emit("delete", data);- }- },- },- {- default: () =>- h(- NButton,- {- size: "small",- quaternary: true,- class: "px-1!",- },- {- icon: () => h(EllipsisVerticalIcon, { class: "w-4 h-4" }),- }- ),- }- )- );- },- },- ];-- return rawColumnList.filter((column) => !column.hide);-});--const data = computed(() => {- return [...props.databaseGroupList];-});--const rowProps = (databaseGroup: DatabaseGroup) => {- return {- style: "cursor: pointer;",- onClick: (e: MouseEvent) => {- if (props.onRowClick) {- props.onRowClick(e, databaseGroup);- return;- }-- if (props.singleSelection) {- emit("update:selected-database-group-names", [databaseGroup.name]);- } else {- const selectedDatabaseGroupNameList = new Set(- props.selectedDatabaseGroupNames- );- if (selectedDatabaseGroupNameList.has(databaseGroup.name)) {- selectedDatabaseGroupNameList.delete(databaseGroup.name);- } else {- selectedDatabaseGroupNameList.add(databaseGroup.name);- }- emit("update:selected-database-group-names", [- ...selectedDatabaseGroupNameList,- ]);- }- },- };-};-</script>diff --git a/frontend/src/components/DatabaseGroup/index.ts b/frontend/src/components/DatabaseGroup/index.tsdeleted file mode 100644index 1d2871c665..0000000000--- a/frontend/src/components/DatabaseGroup/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import DatabaseGroupDataTable from "./DatabaseGroupDataTable.vue";--export { DatabaseGroupDataTable };diff --git a/frontend/src/components/DatabaseGroupIcon.vue b/frontend/src/components/DatabaseGroupIcon.vuedeleted file mode 100644index 3861ce4573..0000000000--- a/frontend/src/components/DatabaseGroupIcon.vue+++ /dev/null@@ -1,61 +0,0 @@-<template>- <svg- width="189"- height="189"- viewBox="0 0 189 189"- xmlns="http://www.w3.org/2000/svg"- >- <g>- <path- d="M10.8828 113.749V28.4373C10.8828 28.4373 22.8265 11.3749 57.5199 10.8062C92.2133 10.2374 106.432 28.4373 106.432 28.4373V113.749C106.432 113.749 85.9571 126.83 57.5199 125.693C29.0827 124.555 10.8828 113.749 10.8828 113.749Z"- fill="white"- stroke="currentColor"- stroke-width="10"- />- <path- d="M58.6575 51.6136C31.1303 51.6136 1.30908 44.1583 1.30908 28.6742C1.30908 13.1901 31.1303 5.73485 58.6575 5.73485C86.1848 5.73485 116.006 13.1901 116.006 28.6742C116.006 44.1583 86.1848 51.6136 58.6575 51.6136ZM58.6575 17.2045C28.8363 17.2045 12.7788 25.8068 12.7788 28.6742C12.7788 31.5416 28.8363 40.1439 58.6575 40.1439C88.4787 40.1439 104.536 31.5416 104.536 28.6742C104.536 25.8068 88.4787 17.2045 58.6575 17.2045Z"- fill="currentColor"- />- <path- d="M58.6575 131.901C31.1303 131.901 1.30908 124.446 1.30908 108.962V28.6742C1.30908 25.2333 3.60302 22.9394 7.04393 22.9394C10.4848 22.9394 12.7788 25.2333 12.7788 28.6742V108.962C12.7788 111.829 27.1159 120.432 58.6575 120.432C90.1992 120.432 104.536 111.829 104.536 108.962V28.6742C104.536 25.2333 106.83 22.9394 110.271 22.9394C113.712 22.9394 116.006 25.2333 116.006 28.6742V108.962C116.006 124.446 86.1848 131.901 58.6575 131.901V131.901Z"- fill="currentColor"- />- <path- d="M81.4072 131.949V46.6371C81.4072 46.6371 93.3509 29.5748 128.044 29.006C162.738 28.4373 176.956 46.6371 176.956 46.6371V131.949C176.956 131.949 156.482 145.03 128.044 143.893C99.6071 142.755 81.4072 131.949 81.4072 131.949Z"- fill="white"- stroke="currentColor"- stroke-width="10"- />- <path- d="M129.182 69.8135C101.655 69.8135 71.8335 62.3582 71.8335 46.8741C71.8335 31.39 101.655 23.9347 129.182 23.9347C156.709 23.9347 186.53 31.39 186.53 46.8741C186.53 62.3582 156.709 69.8135 129.182 69.8135ZM129.182 35.4044C99.3607 35.4044 83.3032 44.0066 83.3032 46.8741C83.3032 49.7415 99.3607 58.3438 129.182 58.3438C159.003 58.3438 175.061 49.7415 175.061 46.8741C175.061 44.0066 159.003 35.4044 129.182 35.4044Z"- fill="currentColor"- />- <path- d="M129.182 150.101C101.655 150.101 71.8335 142.646 71.8335 127.162V84.1743C71.8335 80.7333 73.4165 80.193 76.8574 80.193C80.2983 80.193 83.3032 80.7333 83.3032 84.1743V127.162C83.3032 130.029 97.6403 138.632 129.182 138.632C160.724 138.632 175.061 130.029 175.061 127.162V46.8741C175.061 43.4332 177.355 41.1392 180.796 41.1392C184.236 41.1392 186.53 43.4332 186.53 46.8741V127.162C186.53 142.646 156.709 150.101 129.182 150.101Z"- fill="currentColor"- />- <path- d="M33.6326 167.211V81.8993C33.6326 81.8993 45.5762 64.8369 80.2697 64.2682C114.963 63.6994 129.182 81.8993 129.182 81.8993V167.211C129.182 167.211 108.707 180.292 80.2697 179.155C51.8324 178.017 33.6326 167.211 33.6326 167.211Z"- fill="white"- stroke="currentColor"- stroke-width="10"- />- <path- d="M81.4073 105.076C53.88 105.076 24.0588 97.6203 24.0588 82.1362C24.0588 66.6522 53.88 59.1969 81.4073 59.1969C108.935 59.1969 138.756 66.6522 138.756 82.1362C138.756 97.6203 108.935 105.076 81.4073 105.076V105.076ZM81.4073 70.6666C51.5861 70.6666 35.5285 79.2688 35.5285 82.1362C35.5285 85.0037 51.5861 93.6059 81.4073 93.6059C111.228 93.6059 127.286 85.0037 127.286 82.1362C127.286 79.2688 111.228 70.6666 81.4073 70.6666V70.6666ZM81.4073 145.22C53.88 145.22 24.0588 137.764 24.0588 122.28C24.0588 118.839 26.3528 116.545 29.7937 116.545C33.2346 116.545 35.5285 118.839 35.5285 122.28C35.5285 125.148 49.8656 133.75 81.4073 133.75C112.949 133.75 127.286 125.148 127.286 122.28C127.286 118.839 129.58 116.545 133.021 116.545C136.462 116.545 138.756 118.839 138.756 122.28C138.756 137.764 108.935 145.22 81.4073 145.22V145.22Z"- fill="currentColor"- />- <path- d="M81.4073 185.363C53.88 185.363 24.0588 177.908 24.0588 162.424V82.1362C24.0588 78.6953 26.3528 76.4014 29.7937 76.4014C33.2346 76.4014 35.5285 78.6953 35.5285 82.1362V162.424C35.5285 165.291 49.8656 173.894 81.4073 173.894C112.949 173.894 127.286 165.291 127.286 162.424V82.1362C127.286 78.6953 129.58 76.4014 133.021 76.4014C136.462 76.4014 138.756 78.6953 138.756 82.1362V162.424C138.756 177.908 108.935 185.363 81.4073 185.363V185.363Z"- fill="currentColor"- />- </g>- </svg>-</template>--<script lang="ts">-import { defineComponent } from "vue";--export default defineComponent({- name: "DatabaseGroupIcon",-});-</script>diff --git a/frontend/src/components/DefinitionView.vue b/frontend/src/components/DefinitionView.vuedeleted file mode 100644index 16db4884b7..0000000000--- a/frontend/src/components/DefinitionView.vue+++ /dev/null@@ -1,70 +0,0 @@-<template>- <div class="relative w-full">- <div ref="containerRef" class="w-full overflow-hidden text-ellipsis">- <div class="w-full h-auto leading-5 whitespace-pre-wrap font-mono">- <template v-if="state.expanded">- {{ formattedDefinition }}- </template>- <NEllipsis- v-else- expand-trigger="click"- :line-clamp="3"- :tooltip="false"- >- {{ formattedDefinition }}- </NEllipsis>- </div>- </div>- <button- v-if="state.showExpandButton"- class="inline-block cursor-pointer px-2 py-1 rounded-sm text-xs shadow-sm bg-gray-50 hover:opacity-80"- @click="state.expanded = !state.expanded"- >- {{ $t("common." + (state.expanded ? "collapse" : "expand")) }}- <heroicons-outline:chevron-down- v-if="!state.expanded"- class="w-4 h-auto inline-block"- />- <heroicons-outline:chevron-up v-else class="w-4 h-auto inline-block" />- </button>- </div>-</template>--<script lang="ts" setup>-import { NEllipsis } from "naive-ui";-import { computed, onMounted, reactive, ref } from "vue";--const MAX_HEIGHT = 60;--interface LocalState {- showExpandButton: boolean;- expanded: boolean;-}--const props = defineProps({- definition: {- type: String,- default: "",- },-});--const state = reactive<LocalState>({- showExpandButton: false,- expanded: true,-});-const containerRef = ref<HTMLDivElement | null>(null);--const formattedDefinition = computed(() => {- return props.definition.trim();-});--onMounted(() => {- if (containerRef.value) {- const height = containerRef.value.clientHeight;- if (height > MAX_HEIGHT) {- state.showExpandButton = true;- state.expanded = false;- }- }-});-</script>diff --git a/frontend/src/components/EllipsisSQLView.vue b/frontend/src/components/EllipsisSQLView.vuedeleted file mode 100644index 0aa8f67dbd..0000000000--- a/frontend/src/components/EllipsisSQLView.vue+++ /dev/null@@ -1,66 +0,0 @@-<template>- <div- class="group grow-0 w-full flex flex-row justify-start items-center gap-2"- >- <p- class="overflow-hidden"- style="display: -webkit-box; -webkit-box-orient: vertical"- :style="[- {- '-webkit-line-clamp': lines,- },- contentStyle,- ]"- :class="contentClass"- >- <code class="text-sm break-all">{{ sql }}</code>- </p>- <div class="hidden group-hover:block shrink-0">- <NButton :size="'tiny'" @click="showModal = true">- <template #icon>- <Maximize2Icon />- </template>- </NButton>- </div>- </div>-- <BBModal- :show="showModal"- :title="$t('common.view-details')"- @close="showModal = false"- >- <div style="width: calc(100vw - 12rem); height: calc(100vh - 12rem)">- <MonacoEditor- :content="sql"- :readonly="true"- language="sql"- class="border w-full h-full grow"- />- </div>- </BBModal>-</template>--<script setup lang="ts">-import { Maximize2Icon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { ref } from "vue";-import { BBModal } from "@/bbkit";-import { MonacoEditor } from "@/components/MonacoEditor";-import type { VueClass, VueStyle } from "@/utils";--withDefaults(- defineProps<{- sql: string;- lines?: number;- contentClass?: VueClass;- contentStyle?: VueStyle;- }>(),- {- lines: 2,- contentClass: undefined,- contentStyle: undefined,- }-);--const showModal = ref(false);-</script>diff --git a/frontend/src/components/ExpirationSelector.vue b/frontend/src/components/ExpirationSelector.vuedeleted file mode 100644index f413ae5904..0000000000--- a/frontend/src/components/ExpirationSelector.vue+++ /dev/null@@ -1,255 +0,0 @@-<template>- <div class="w-full flex flex-col gap-y-3">- <NSelect- v-bind="$attrs"- :value="state.selected"- :options="selectOptions"- @update:value="onSelect"- />-- <div v-if="state.selected === -1" class="flex flex-col gap-y-2">- <NDatePicker- size="medium"- class="w-full"- :value="state.expirationTimestampInMS"- :actions="null"- :update-value-on-close="true"- type="datetime"- :is-date-disabled="isDateDisabled"- clearable- :placeholder="$t('issue.role-grant.custom-date-placeholder')"- @update:value="handleCustomDateChange"- />- <div v-if="maximumRoleExpiration" class="text-xs text-gray-500">- {{ $t("settings.general.workspace.maximum-role-expiration.self") }}:- {{ $t("common.date.days", { days: maximumRoleExpiration }) }}- </div>- </div>- <div- v-else- class="p-3 bg-gray-50 rounded-md text-sm text-gray-600"- >- <div v-if="state.expirationTimestampInMS">- {{ $t("common.access-expires") }}:- <span class="font-medium text-gray-900">- {{ formatExpirationDisplay(state.expirationTimestampInMS) }}- </span>- </div>- <div v-else>- {{ $t("project.members.role-never-expires") }}- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { useLocalStorage } from "@vueuse/core";-import dayjs from "dayjs";-import { NDatePicker, NSelect } from "naive-ui";-import { computed, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useSettingV1Store } from "@/store";-import { PresetRoleType } from "@/types";-import { formatAbsoluteDateTime, STORAGE_KEY_ROLES_EXPIRATION } from "@/utils";--interface ExpirationOption {- value: number;- label: string;-}--interface LocalState {- selected: number;- expirationTimestampInMS?: number;-}--const props = defineProps<{- timestampInMs?: number;- role: string;- useCachedSelection?: boolean;-}>();--const emit = defineEmits<{- (event: "update:timestampInMs", timestampInMS: number | undefined): void;-}>();--const { t } = useI18n();-const settingV1Store = useSettingV1Store();--// Remember the last selected expiration option-const lastSelectedExpiration = useLocalStorage<number>(- STORAGE_KEY_ROLES_EXPIRATION,- 7 // Default to 1 week-);--// Initialize state with intelligent defaults-const getInitialSelection = () => {- if (props.timestampInMs !== undefined) {- // If timestamp is provided, use custom date- return -1;- }- if (!props.useCachedSelection) {- return 0;- }- // Otherwise, use the last selected value if it's still valid- return lastSelectedExpiration.value;-};--const state = reactive<LocalState>({- selected: getInitialSelection(),- expirationTimestampInMS: props.timestampInMs,-});--const handleCustomDateChange = (val: number | null) => {- state.expirationTimestampInMS = val || undefined;-};--const maximumRoleExpiration = computed(() => {- if (props.role === PresetRoleType.PROJECT_OWNER) {- return undefined;- }- const seconds = settingV1Store.workspaceProfile.maximumRoleExpiration?.seconds- ? Number(settingV1Store.workspaceProfile.maximumRoleExpiration.seconds)- : undefined;- if (!seconds) {- return undefined;- }- return Math.floor(seconds / (60 * 60 * 24));-});--const formatExpirationDisplay = (timestampMs: number) => {- return formatAbsoluteDateTime(timestampMs);-};--const isDateDisabled = (date: number) => {- if (date < dayjs().startOf("day").valueOf()) {- return true;- }- if (!maximumRoleExpiration.value) {- return false;- }- return date > dayjs().add(maximumRoleExpiration.value, "days").valueOf();-};--const options = computed((): ExpirationOption[] => {- const baseOptions = [- {- value: 1,- label: t("common.date.days", { days: 1 }),- },- {- value: 3,- label: t("common.date.days", { days: 3 }),- },- {- value: 7,- label: t("common.date.week", { weeks: 1 }),- },- {- value: 30,- label: t("common.date.month", { months: 1 }),- },- {- value: 90,- label: t("common.date.months", { months: 3 }),- },- {- value: 180,- label: t("common.date.months", { months: 6 }),- },- {- value: 365,- label: t("common.date.year", { years: 1 }),- },- ];-- const availableOptions: ExpirationOption[] = [];-- // Add "Never expires" at the top if no maximum role expiration is set- if (!maximumRoleExpiration.value) {- availableOptions.push({- value: 0,- label: t("project.members.never-expires"),- });- }-- // Add custom date option prominently after "Never expires"- availableOptions.push({- value: -1,- label: t("issue.role-grant.custom-date"),- });-- // Add time-based options- if (maximumRoleExpiration.value) {- availableOptions.push(- ...baseOptions.filter(- (option) => option.value <= maximumRoleExpiration.value!- )- );- } else {- availableOptions.push(...baseOptions);- }-- return availableOptions;-});--const selectOptions = computed(() => {- return options.value.map((option) => ({- label: option.label,- value: option.value,- }));-});--const onSelect = (value: number) => {- if (value > 0) {- state.expirationTimestampInMS =- new Date().getTime() + value * 24 * 60 * 60 * 1000;- // Save preset selections to localStorage- lastSelectedExpiration.value = value;- } else if (value === 0) {- // Never expires - clear the timestamp- state.expirationTimestampInMS = undefined;- lastSelectedExpiration.value = value;- }- // For value === -1 (custom date), the timestamp is set by the date picker- // Don't save custom date selection as it's not reusable- state.selected = value;-- // Emit the change immediately for pre-defined options- if (value !== -1) {- emit("update:timestampInMs", state.expirationTimestampInMS);- }-};--watch(- () => props.role,- () => {- let value = state.selected;- if (!options.value.find((o) => o.value === state.selected)) {- const neverExpire = options.value.find((o) => o.value === 0);- if (neverExpire) {- value = neverExpire.value;- } else {- value = options.value[0].value;- }- }- onSelect(value);- },- { immediate: true }-);--watch(- () => state.expirationTimestampInMS,- () => {- emit("update:timestampInMs", state.expirationTimestampInMS);- }-);--defineExpose({- isValid: computed(() => {- if (state.expirationTimestampInMS === undefined) {- return !maximumRoleExpiration.value;- }- return state.expirationTimestampInMS > new Date().getTime();- }),-});-</script>diff --git a/frontend/src/components/ExprEditor/Condition.vue b/frontend/src/components/ExprEditor/Condition.vuedeleted file mode 100644index ecf52116ad..0000000000--- a/frontend/src/components/ExprEditor/Condition.vue+++ /dev/null@@ -1,49 +0,0 @@-<!-- eslint-disable vue/no-mutating-props -->--<template>- <NInputGroup class="w-full flex items-center overflow-x-hidden">- <FactorSelect :expr="expr" />-- <OperatorSelect :expr="expr" />-- <ValueInput :expr="expr" />-- <NButton- size="small"- type="default"- :disabled="readonly"- :style="'shrink: 0;padding-left: 0;padding-right: 0;--n-width: 28px;--n-color: white;'"- @click="$emit('remove')"- >- <heroicons:trash class="w-3.5 h-3.5" />- </NButton>- </NInputGroup>-</template>--<script lang="ts" setup>-import { NButton, NInputGroup } from "naive-ui";-import { watch } from "vue";-import { type ConditionExpr } from "@/plugins/cel";-import { FactorSelect, OperatorSelect, ValueInput } from "./components";-import { useExprEditorContext } from "./context";--const props = defineProps<{- expr: ConditionExpr;-}>();--const emit = defineEmits<{- (event: "remove"): void;- (event: "update"): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;--watch(- () => props.expr,- () => {- emit("update");- },- { deep: true }-);-</script>diff --git a/frontend/src/components/ExprEditor/ConditionGroup.vue b/frontend/src/components/ExprEditor/ConditionGroup.vuedeleted file mode 100644index adc09da759..0000000000--- a/frontend/src/components/ExprEditor/ConditionGroup.vue+++ /dev/null@@ -1,264 +0,0 @@-<template>- <div- class="w-full overflow-hidden flex flex-col gap-y-2 py-0.5"- :class="[root ? '' : 'border rounded-[3px] bg-gray-50']"- >- <div v-if="!root" class="pl-2.5 pr-1 text-gray-500 flex items-center">- <div class="flex-1">- <template v-if="args.length > 0">- <template v-if="operator === '_||_'">- {{ $t("cel.condition.group.or.description") }}- </template>- <template v-if="operator === '_&&_'">- {{ $t("cel.condition.group.and.description") }}- </template>- </template>- <template v-else>- <i18n-t- keypath="cel.condition.add-condition-in-group-placeholder"- tag="div"- class="inline-flex items-center"- >- <template #plus>- <heroicons:plus class="w-3 h-3 mx-1" />- </template>- </i18n-t>- </template>- </div>- <div class="flex items-center justify-end">- <NButton- size="tiny"- quaternary- type="default"- :style="`shrink: 0; padding-left: 0; padding-right: 0; --n-width: 22px;`"- :disabled="readonly"- @click="emit('remove')"- >- <heroicons:trash class="w-3.5 h-3.5" />- </NButton>- </div>- </div>-- <div v-if="root && args.length === 0" class="text-gray-500">- {{ $t("cel.condition.add-root-condition-placeholder") }}- </div>- <div- v-for="(operand, i) in args"- :key="i"- class="flex items-start gap-x-1 w-full"- :class="[root ? '' : 'px-1']"- >- <div class="w-14 shrink-0">- <div v-if="i === 0" class="pl-1.5 pt-1 text-control">Where</div>- <NSelect- v-else-if="i === 1"- v-model:value="operator"- :options="OPERATORS"- :consistent-menu-width="false"- :disabled="readonly"- size="small"- @update:value="$emit('update')"- />- <div v-else class="pl-2 pt-1 text-control lowercase">- {{ operatorLabel(operator) }}- </div>- </div>- <div class="flex-1 flex flex-col gap-y-1 overflow-x-hidden">- <ConditionGroup- v-if="isConditionGroupExpr(operand)"- :key="i"- :expr="operand"- @remove="removeConditionGroup(operand)"- @update="$emit('update')"- />- <Condition- v-if="isConditionExpr(operand)"- :expr="operand"- @remove="removeCondition(operand)"- @update="$emit('update')"- />- <RawString- v-if="isRawStringExpr(operand)"- :expr="operand"- @remove="removeRawString(operand)"- @update="$emit('update')"- />- </div>- </div>-- <div v-if="!root" class="pl-1.5 pb-1">- <NButton size="small" quaternary :disabled="readonly" @click="addCondition">- <template #icon- ><heroicons:plus class="w-4 h-4 text-gray-500"- /></template>- <span class="text-gray-500">{{ $t("cel.condition.add") }}</span>- </NButton>- <NButton size="small" quaternary :disabled="readonly" @click="addRawString">- <template #icon- ><heroicons:plus class="w-4 h-4 text-gray-500"- /></template>- <span class="text-gray-500">{{- $t("cel.condition.add-raw-expression")- }}</span>- </NButton>- </div>-- <div v-if="root" class="flex gap-x-1">- <NButton size="small" quaternary :disabled="readonly" @click="addCondition">- <template #icon><heroicons:plus class="w-4 h-4" /></template>- <span>{{ $t("cel.condition.add") }}</span>- </NButton>- <NButton size="small" quaternary :disabled="readonly" @click="addConditionGroup">- <template #icon><heroicons:plus class="w-4 h-4" /></template>- <span>{{ $t("cel.condition.add-group") }}</span>- <NTooltip>- <template #trigger>- <heroicons:question-mark-circle class="ml-1 w-3 h-3" />- </template>- <div class="max-w-[18rem]">- {{ $t("cel.condition.group.tooltip") }}- </div>- </NTooltip>- </NButton>- <NButton- v-if="enableRawExpression"- size="small"- quaternary- :disabled="readonly"- @click="addRawString"- >- <template #icon><heroicons:plus class="w-4 h-4" /></template>- <span>{{ $t("cel.condition.add-raw-expression") }}</span>- </NButton>- </div>- </div>-</template>--<script lang="ts" setup>-/* eslint-disable vue/no-mutating-props */-import { NButton, NSelect, NTooltip, type SelectOption } from "naive-ui";-import { computed } from "vue";-import {- type ConditionExpr,- type ConditionGroupExpr,- ExprType,- type Factor,- isBooleanFactor,- isConditionExpr,- isConditionGroupExpr,- isNumberFactor,- isRawStringExpr,- isStringFactor,- isTimestampFactor,- type LogicalOperator,- LogicalOperatorList,- type RawStringExpr,-} from "@/plugins/cel";-import Condition from "./Condition.vue";-import { getOperatorListByFactor } from "./components/common";-import { useExprEditorContext } from "./context";-import RawString from "./RawString.vue";--const props = defineProps<{- expr: ConditionGroupExpr;- root?: boolean;-}>();--const emit = defineEmits<{- (event: "remove"): void;- (event: "update"): void;-}>();--const { readonly, enableRawExpression, factorList, factorOperatorOverrideMap } =- useExprEditorContext();--const operator = computed({- get() {- return props.expr.operator;- },- set(op) {- props.expr.operator = op;- },-});-const args = computed(() => props.expr.args);--const operatorLabel = (op: LogicalOperator) => {- if (op === "_&&_") return "and";- if (op === "_||_") return "or";- throw new Error(`unknown logical operator "${op}"`);-};--const OPERATORS: SelectOption[] = [- { label: operatorLabel("_&&_"), value: "_&&_" },- { label: operatorLabel("_||_"), value: "_||_" },-];--const getDefaultValue = (factor: Factor): string | number | boolean | Date => {- if (isNumberFactor(factor)) return 0;- if (isBooleanFactor(factor)) return true;- if (isStringFactor(factor)) return "";- if (isTimestampFactor(factor)) return new Date();- return "";-};--const addCondition = () => {- const factor = factorList.value[0];- const operators = getOperatorListByFactor(- factor,- factorOperatorOverrideMap.value- );-- const operator = operators[0];- if (!operator) {- return;- }-- args.value.push({- type: ExprType.Condition,- operator,- args: [factor, getDefaultValue(factor)],- } as ConditionExpr);- emit("update");-};--const addRawString = () => {- args.value.push({- type: ExprType.RawString,- content: "",- });- emit("update");-};--const addConditionGroup = () => {- args.value.push({- type: ExprType.ConditionGroup,- operator: LogicalOperatorList[0],- args: [],- });- emit("update");-};--const removeCondition = (condition: ConditionExpr) => {- const index = args.value.indexOf(condition);- if (index >= 0) {- args.value.splice(index, 1);- emit("update");- }-};--const removeConditionGroup = (group: ConditionGroupExpr) => {- const index = args.value.indexOf(group);- if (index >= 0) {- args.value.splice(index, 1);- emit("update");- }-};--const removeRawString = (rawString: RawStringExpr) => {- const index = args.value.indexOf(rawString);- if (index >= 0) {- args.value.splice(index, 1);- emit("update");- }-};-</script>diff --git a/frontend/src/components/ExprEditor/ExprEditor.vue b/frontend/src/components/ExprEditor/ExprEditor.vuedeleted file mode 100644index b44e308976..0000000000--- a/frontend/src/components/ExprEditor/ExprEditor.vue+++ /dev/null@@ -1,62 +0,0 @@-<template>- <div class="bb-risk-expr-editor text-sm w-full">- <ConditionGroup :expr="expr" :root="true" @update="$emit('update')" />- </div>-</template>--<script lang="ts" setup>-import { toRef } from "vue";-import type { ConditionGroupExpr, Factor, Operator } from "@/plugins/cel";-import ConditionGroup from "./ConditionGroup.vue";-import { type OptionConfig, provideExprEditorContext } from "./context";--const props = withDefaults(- defineProps<{- expr: ConditionGroupExpr;- readonly?: boolean;- enableRawExpression?: boolean;- factorList: Factor[];- optionConfigMap?: Map<Factor, OptionConfig>;- factorOperatorOverrideMap?: Map<Factor, Operator[]>;- }>(),- {- readonly: false,- enableRawExpression: true,- factorOperatorOverrideMap: undefined,- optionConfigMap: () => new Map(),- }-);--defineEmits<{- (event: "update"): void;-}>();--provideExprEditorContext({- readonly: toRef(props, "readonly"),- enableRawExpression: toRef(props, "enableRawExpression"),- factorList: toRef(props, "factorList"),- optionConfigMap: toRef(props, "optionConfigMap"),- factorOperatorOverrideMap: toRef(props, "factorOperatorOverrideMap"),-});-</script>--<style>-.bb-risk-expr-editor .n-base-selection {- --n-padding-single: 0 22px 0 8px !important;- --n-padding-multiple: 3px 24px 0 5px !important;-}-.bb-risk-expr-editor .n-base-selection .n-base-suffix {- right: 5px !important;-}--.bb-risk-expr-editor .n-base-selection-tag-wrapper {- padding-right: 2px;-}--.bb-risk-expr-editor .n-button {- --n-padding: 0 6px 0 2px !important;-}-.bb-risk-expr-editor .n-button .n-button__icon {- margin-right: 0px !important;-}-</style>diff --git a/frontend/src/components/ExprEditor/RawString.vue b/frontend/src/components/ExprEditor/RawString.vuedeleted file mode 100644index a7efce127f..0000000000--- a/frontend/src/components/ExprEditor/RawString.vue+++ /dev/null@@ -1,50 +0,0 @@-<!-- eslint-disable vue/no-mutating-props -->--<template>- <NInputGroup class="w-full flex items-start overflow-x-hidden">- <NInput- v-model:value="expr.content"- type="textarea"- :autosize="{ minRows: 2, maxRows: 4 }"- placeholder="Enter raw CEL expression"- size="small"- />-- <NButton- size="small"- type="default"- :style="'shrink: 0;padding-left: 0;padding-right: 0;--n-width: 28px;--n-color: white;'"- :disabled="readonly"- @click="$emit('remove')"- >- <heroicons:trash class="w-3.5 h-3.5" />- </NButton>- </NInputGroup>-</template>--<script lang="ts" setup>-import { NButton, NInput, NInputGroup } from "naive-ui";-import { watch } from "vue";-import { type RawStringExpr } from "@/plugins/cel";-import { useExprEditorContext } from "./context";--const props = defineProps<{- expr: RawStringExpr;-}>();--const emit = defineEmits<{- (event: "remove"): void;- (event: "update"): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;--watch(- () => props.expr,- () => {- emit("update");- },- { deep: true }-);-</script>diff --git a/frontend/src/components/ExprEditor/components/FactorSelect.vue b/frontend/src/components/ExprEditor/components/FactorSelect.vuedeleted file mode 100644index 3be26137bc..0000000000--- a/frontend/src/components/ExprEditor/components/FactorSelect.vue+++ /dev/null@@ -1,52 +0,0 @@-<template>- <NSelect- v-model:value="factor"- :options="options"- :consistent-menu-width="false"- :disabled="readonly"- size="small"- style="width: auto; min-width: 7rem; shrink: 0"- />-</template>--<script lang="ts" setup>-/* eslint-disable vue/no-mutating-props */-import { NSelect, type SelectOption } from "naive-ui";-import { computed, watch } from "vue";-import { type ConditionExpr } from "@/plugins/cel";-import { useExprEditorContext } from "../context";-import { factorText } from "./common";--const props = defineProps<{- expr: ConditionExpr;-}>();--const { readonly, factorList } = useExprEditorContext();--const factor = computed({- get() {- return props.expr.args[0];- },- set(factor) {- props.expr.args[0] = factor;- },-});--const options = computed(() => {- return factorList.value.map<SelectOption>((v) => ({- label: factorText(v),- value: v,- }));-});--watch(- [factor, factorList],- () => {- if (factorList.value.length === 0) return;- if (!factorList.value.includes(factor.value)) {- factor.value = factorList.value[0];- }- },- { immediate: true }-);-</script>diff --git a/frontend/src/components/ExprEditor/components/MultiSelect.vue b/frontend/src/components/ExprEditor/components/MultiSelect.vuedeleted file mode 100644index 93d4d048dc..0000000000--- a/frontend/src/components/ExprEditor/components/MultiSelect.vue+++ /dev/null@@ -1,106 +0,0 @@-<template>- <RemoteResourceSelector- v-if="optionConfig.search"- size="small"- max-tag-count="responsive"- style="min-width: 12rem; width: auto; max-width: 20rem; overflow-x: hidden"- :multiple="true"- :disabled="readonly"- :value="value"- :search="optionConfig.search"- :additional-options="additionalOptions"- :consistent-menu-width="false"- :fallback-option="optionConfig.fallback"- @update:value="$emit('update:value', $event as string[])"- @open="initial"- />- <NSelect- v-else- :value="value"- :options="optionConfig.options"- :multiple="true"- :filterable="true"- :consistent-menu-width="false"- :clear-filter-after-select="false"- :placeholder="$t('cel.condition.select-value')"- :disabled="readonly"- max-tag-count="responsive"- size="small"- style="min-width: 12rem; width: auto; max-width: 20rem; overflow-x: hidden"- @update:value="$emit('update:value', $event)"- >- <template #action>- <NCheckbox- :label="$t('common.all')"- v-bind="checkAllState"- @update:checked="toggleCheckAll"- />- </template>- </NSelect>-</template>--<script lang="ts" setup>-import { NCheckbox, NSelect } from "naive-ui";-import { computed, onMounted, ref, toRef } from "vue";-import RemoteResourceSelector from "@/components/v2/Select/RemoteResourceSelector/index.vue";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";-import { type ConditionExpr } from "@/plugins/cel";-import { useExprEditorContext } from "../context";-import { initOptions, useSelectOptionConfig } from "./common";--const props = defineProps<{- value: string[];- expr: ConditionExpr;-}>();--const emit = defineEmits<{- (event: "update:value", value: string[]): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;-const { optionConfig } = useSelectOptionConfig(toRef(props, "expr"));-const additionalOptions = ref<ResourceSelectOption<unknown>[]>([]);--const initial = async () => {- if (props.value.length === 0) {- return;- }- const options = await initOptions(- props.value.filter(- (v) => !additionalOptions.value.find((option) => option.value === v)- ),- optionConfig.value- );- additionalOptions.value = options;-};--onMounted(async () => {- await initial();-});--const checkAllState = computed(() => {- const selected = new Set<string>(props.value);- const checked =- selected.size > 0 &&- optionConfig.value.options.every((opt) => {- return selected.has(opt.value);- });- const indeterminate = props.value.length > 0 && !checked;- return {- checked,- indeterminate,- };-});--const toggleCheckAll = (on: boolean) => {- if (on) {- emit(- "update:value",- optionConfig.value.options.map((opt) => opt.value as string)- );- } else {- emit("update:value", []);- }-};-</script>diff --git a/frontend/src/components/ExprEditor/components/MultiStringInput.vue b/frontend/src/components/ExprEditor/components/MultiStringInput.vuedeleted file mode 100644index 33425b50dc..0000000000--- a/frontend/src/components/ExprEditor/components/MultiStringInput.vue+++ /dev/null@@ -1,47 +0,0 @@-<template>- <NSelect- :value="value"- :filterable="true"- :multiple="true"- :tag="true"- :show-arrow="false"- :show="false"- :consistent-menu-width="false"- :placeholder="$t('cel.condition.input-value-press-enter')"- :disabled="readonly"- max-tag-count="responsive"- size="small"- style="min-width: 16rem; width: auto; overflow-x: hidden"- @update:value="onUpdate"- />-</template>--<script lang="ts" setup>-import { uniq } from "lodash-es";-import { NSelect } from "naive-ui";-import { useExprEditorContext } from "../context";--defineProps<{- value: string[];-}>();--const emit = defineEmits<{- (event: "update:value", value: string[]): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;--const onUpdate = (values: string[]) => {- emit(- "update:value",- uniq(- values- .join(",")- .split(",")- .map((val) => val.trim())- .filter((val) => val)- )- );-};-</script>diff --git a/frontend/src/components/ExprEditor/components/NumberInput.vue b/frontend/src/components/ExprEditor/components/NumberInput.vuedeleted file mode 100644index e0a0cd93e3..0000000000--- a/frontend/src/components/ExprEditor/components/NumberInput.vue+++ /dev/null@@ -1,27 +0,0 @@-<template>- <NInputNumber- :value="value"- :show-button="false"- :placeholder="$t('cel.condition.input-value')"- :disabled="readonly"- size="small"- style="width: auto; max-width: 5rem; overflow-x: hidden"- @update:value="$emit('update:value', $event ?? 0)"- />-</template>--<script lang="ts" setup>-import { NInputNumber } from "naive-ui";-import { useExprEditorContext } from "../context";--defineProps<{- value: number;-}>();--defineEmits<{- (event: "update:value", value: number): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;-</script>diff --git a/frontend/src/components/ExprEditor/components/OperatorSelect.vue b/frontend/src/components/ExprEditor/components/OperatorSelect.vuedeleted file mode 100644index 0775ed5a33..0000000000--- a/frontend/src/components/ExprEditor/components/OperatorSelect.vue+++ /dev/null@@ -1,70 +0,0 @@-<!-- eslint-disable vue/no-mutating-props -->-<template>- <NSelect- v-model:value="operator"- :options="options"- :consistent-menu-width="false"- :disabled="readonly"- size="small"- style="width: auto; max-width: 7rem; min-width: 2.5rem; shrink: 0"- />-</template>--<script lang="ts" setup>-/* eslint-disable vue/no-mutating-props */-import { NSelect, type SelectOption } from "naive-ui";-import { computed, watch } from "vue";-import {- type ConditionExpr,- type ConditionOperator,- type Operator,- operatorDisplayLabel,-} from "@/plugins/cel";-import { useExprEditorContext } from "../context";-import { getOperatorListByFactor } from "./common";--const props = defineProps<{- expr: ConditionExpr;-}>();--const context = useExprEditorContext();-const { readonly, factorOperatorOverrideMap } = context;--const operator = computed({- get() {- return props.expr.operator;- },- set(op) {- props.expr.operator = op;- },-});--const factor = computed(() => {- return props.expr.args[0];-});--const options = computed(() => {- const operators = getOperatorListByFactor(- factor.value,- factorOperatorOverrideMap.value- );- return operators.map(- (op: Operator): SelectOption => ({- label: operatorDisplayLabel(op),- value: op,- })- );-});--// normalize operator when factor changed-watch(- [options, () => props.expr.operator],- () => {- if (options.value.length === 0) return;- if (!options.value.find((opt) => opt.value === props.expr.operator)) {- props.expr.operator = options.value[0].value as ConditionOperator;- }- },- { immediate: true }-);-</script>diff --git a/frontend/src/components/ExprEditor/components/SingleSelect.vue b/frontend/src/components/ExprEditor/components/SingleSelect.vuedeleted file mode 100644index 6b9a6105c4..0000000000--- a/frontend/src/components/ExprEditor/components/SingleSelect.vue+++ /dev/null@@ -1,65 +0,0 @@-<template>- <RemoteResourceSelector- v-if="optionConfig.search"- size="small"- style="min-width: 7rem; width: auto; overflow-x: hidden"- :multiple="false"- :disabled="readonly"- :value="value"- :search="optionConfig.search"- :consistent-menu-width="false"- :additional-options="additionalOptions"- :fallback-option="optionConfig.fallback"- @update:value="$emit('update:value', $event as string)"- @open="initial"- />- <NSelect- v-else- size="small"- style="min-width: 7rem; width: auto; overflow-x: hidden"- :value="value"- :options="optionConfig.options"- :consistent-menu-width="false"- :filterable="true"- :placeholder="$t('cel.condition.select-value')"- :disabled="readonly"- @update:value="$emit('update:value', $event)"- />-</template>--<script lang="ts" setup>-import { NSelect } from "naive-ui";-import { onMounted, ref, toRef } from "vue";-import RemoteResourceSelector from "@/components/v2/Select/RemoteResourceSelector/index.vue";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";-import { type ConditionExpr } from "@/plugins/cel";-import { useExprEditorContext } from "../context";-import { initOptions, useSelectOptionConfig } from "./common";--const props = defineProps<{- value: string;- expr: ConditionExpr;-}>();--defineEmits<{- (event: "update:value", value: string): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;--const { optionConfig } = useSelectOptionConfig(toRef(props, "expr"));-const additionalOptions = ref<ResourceSelectOption<unknown>[]>([]);--const initial = async () => {- if (!props.value || additionalOptions.value[0]?.value === props.value) {- return;- }- const options = await initOptions([props.value], optionConfig.value);- additionalOptions.value = options;-};--onMounted(async () => {- await initial();-});-</script>diff --git a/frontend/src/components/ExprEditor/components/StringInput.vue b/frontend/src/components/ExprEditor/components/StringInput.vuedeleted file mode 100644index 35ad4ed8a2..0000000000--- a/frontend/src/components/ExprEditor/components/StringInput.vue+++ /dev/null@@ -1,26 +0,0 @@-<template>- <NInput- :value="value"- :placeholder="$t('cel.condition.input-value')"- :disabled="readonly"- size="small"- style="min-width: 7rem; width: auto; overflow-x: hidden"- @update:value="$emit('update:value', $event)"- />-</template>--<script lang="ts" setup>-import { NInput } from "naive-ui";-import { useExprEditorContext } from "../context";--defineProps<{- value: string;-}>();--defineEmits<{- (event: "update:value", value: string): void;-}>();--const context = useExprEditorContext();-const { readonly } = context;-</script>diff --git a/frontend/src/components/ExprEditor/components/ValueInput.vue b/frontend/src/components/ExprEditor/components/ValueInput.vuedeleted file mode 100644index 3b02ee0d72..0000000000--- a/frontend/src/components/ExprEditor/components/ValueInput.vue+++ /dev/null@@ -1,193 +0,0 @@-<template>- <template v-if="inputType === 'INPUT'">- <NumberInput- v-if="isNumberValue"- :value="getNumberValue()"- @update:value="setNumberValue($event)"- />- <StringInput- v-if="isStringValue"- :value="getStringValue()"- @update:value="setStringValue($event)"- />- </template>- <template v-if="inputType === 'SINGLE-SELECT'">- <SingleSelect- v-if="isNumberValue"- :value="`${getNumberValue()}`"- :expr="expr"- @update:value="setNumberValue(Number($event))"- />- <SingleSelect- v-if="isBoolValue"- :value="`${getBoolValue()}`"- :expr="expr"- @update:value="setBoolValue($event === 'true')"- />- <SingleSelect- v-if="isStringValue"- :value="getStringValue()"- :expr="expr"- @update:value="setStringValue($event as string)"- />- </template>- <template v-if="inputType === 'MULTI-SELECT'">- <MultiSelect- :value="getArrayValue().map(String)"- :expr="expr"- @update:value="- isNumberFactor(factor)- ? setArrayValue($event.map(Number))- : setArrayValue($event)- "- />- </template>- <template v-if="inputType === 'MULTI-INPUT'">- <MultiStringInput- :value="getStringArrayValue()"- :expr="expr"- @update:value="setArrayValue($event)"- />- </template>-</template>--<script lang="ts" setup>-/* eslint-disable vue/no-mutating-props */-import { isNumber } from "lodash-es";-import { computed, watch } from "vue";-import {- type ConditionExpr,- isBooleanFactor,- isCollectionOperator,- isCompareOperator,- isEqualityOperator,- isNumberFactor,- isStringFactor,- isStringOperator,-} from "@/plugins/cel";-import { useExprEditorContext } from "../context";-import MultiSelect from "./MultiSelect.vue";-import MultiStringInput from "./MultiStringInput.vue";-import NumberInput from "./NumberInput.vue";-import SingleSelect from "./SingleSelect.vue";-import StringInput from "./StringInput.vue";--type InputType = "INPUT" | "SINGLE-SELECT" | "MULTI-SELECT" | "MULTI-INPUT";--const props = defineProps<{- expr: ConditionExpr;-}>();--const operator = computed(() => {- return props.expr.operator;-});--const factor = computed(() => {- return props.expr.args[0];-});--const { optionConfigMap } = useExprEditorContext();--const isNumberValue = computed(() => {- if (isCompareOperator(operator.value)) return true;- if (isEqualityOperator(operator.value) && isNumberFactor(factor.value)) {- return true;- }- return false;-});-const isBoolValue = computed(() => {- if (isEqualityOperator(operator.value) && isBooleanFactor(factor.value)) {- return true;- }- return false;-});-const isStringValue = computed(() => {- if (isStringOperator(operator.value)) return true;- if (isEqualityOperator(operator.value) && isStringFactor(factor.value)) {- return true;- }- return false;-});-const isArrayValue = computed(() => {- return isCollectionOperator(operator.value);-});-const inputType = computed((): InputType => {- const optionConfig = optionConfigMap.value.get(factor.value);- const hasOption =- (optionConfig?.options.length ?? 0 > 0) || optionConfig?.search;-- if (isArrayValue.value) {- return hasOption ? "MULTI-SELECT" : "MULTI-INPUT";- }- if (isEqualityOperator(operator.value) || isCompareOperator(operator.value)) {- if (hasOption) {- return "SINGLE-SELECT";- }- }- return "INPUT";-});--const getNumberValue = () => {- const value = props.expr.args[1];- if (!isNumber(value)) return 0;- return value;-};-const setNumberValue = (value: number) => {- props.expr.args[1] = value;-};--const getBoolValue = () => {- const value = props.expr.args[1];- if (typeof value !== "boolean") return false;- return value;-};-const setBoolValue = (value: boolean) => {- props.expr.args[1] = value;-};--const getStringValue = () => {- const value = props.expr.args[1];- if (typeof value !== "string") return "";- return value;-};-const setStringValue = (value: string) => {- props.expr.args[1] = value;-};--const getArrayValue = () => {- const values = props.expr.args[1];- if (!Array.isArray(values)) return [];- return values;-};-const getStringArrayValue = () => getArrayValue() as string[];-const setArrayValue = (values: string[] | number[]) => {- props.expr.args[1] = values;-};--// clean up value type when factor and operator changed-watch(- [factor, operator],- ([factor, operator]) => {- if (isNumberFactor(factor)) {- if (isCollectionOperator(operator)) {- setArrayValue([]);- } else {- setNumberValue(0);- }- }- if (isBooleanFactor(factor)) {- setBoolValue(true);- }- if (isStringFactor(factor)) {- if (isCollectionOperator(operator)) {- setArrayValue([]);- } else {- setStringValue("");- }- }- },- {- immediate: false,- }-);-</script>diff --git a/frontend/src/components/ExprEditor/components/common.ts b/frontend/src/components/ExprEditor/components/common.tsdeleted file mode 100644index 6e0983ca64..0000000000--- a/frontend/src/components/ExprEditor/components/common.ts+++ /dev/null@@ -1,80 +0,0 @@-import type { ComputedRef, Ref } from "vue";-import { computed } from "vue";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";-import type { ConditionExpr } from "@/plugins/cel";-import {- type Factor,- getOperatorListByFactor as getRawOperatorListByFactor,- type Operator,-} from "@/plugins/cel";-import { t, te } from "@/plugins/i18n";-import { getDefaultPagination } from "@/utils";-import { type OptionConfig, useExprEditorContext } from "../context";--export const initOptions = async (- values: string[],- optionConfig: OptionConfig-): Promise<ResourceSelectOption<unknown>[]> => {- if (optionConfig.fetch) {- return await optionConfig.fetch(values);- }-- if (optionConfig.search && !optionConfig.fallback) {- // only use the batch search when not provide the fallback- const search = optionConfig.search;- const response = await Promise.all(- values.map((value) =>- search({- search: value,- pageToken: "",- pageSize: getDefaultPagination(),- })- )- );- return response.reduce<ResourceSelectOption<unknown>[]>((list, resp) => {- list.push(...resp.options);- return list;- }, []);- }-- return [];-};--export const useSelectOptionConfig = (- expr: Ref<ConditionExpr>-): {- optionConfig: ComputedRef<OptionConfig>;- factor: ComputedRef<string>;-} => {- const context = useExprEditorContext();- const { optionConfigMap } = context;-- const factor = computed(() => expr.value.args[0]);-- const optionConfig = computed(() => {- return optionConfigMap.value.get(factor.value) || { options: [] };- });-- return { optionConfig, factor };-};--const stringifyFactor = (factor: Factor) => {- return factor.replace(/\./g, "_");-};--export const factorText = (factor: Factor) => {- const keypath = `cel.factor.${stringifyFactor(factor)}`;- if (te(keypath)) {- return t(keypath);- }- return factor;-};--export const getOperatorListByFactor = (- factor: Factor,- factorOperatorOverrideMap: Map<Factor, Operator[]> | undefined-): Operator[] => {- return (- factorOperatorOverrideMap?.get(factor) ?? getRawOperatorListByFactor(factor)- );-};diff --git a/frontend/src/components/ExprEditor/components/index.ts b/frontend/src/components/ExprEditor/components/index.tsdeleted file mode 100644index faeac7beeb..0000000000--- a/frontend/src/components/ExprEditor/components/index.ts+++ /dev/null@@ -1,5 +0,0 @@-import FactorSelect from "./FactorSelect.vue";-import OperatorSelect from "./OperatorSelect.vue";-import ValueInput from "./ValueInput.vue";--export { FactorSelect, OperatorSelect, ValueInput };diff --git a/frontend/src/components/ExprEditor/index.ts b/frontend/src/components/ExprEditor/index.tsdeleted file mode 100644index 497ff06640..0000000000--- a/frontend/src/components/ExprEditor/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import ExprEditor from "./ExprEditor.vue";--export default ExprEditor;diff --git a/frontend/src/components/ExternalTableDataTable.vue b/frontend/src/components/ExternalTableDataTable.vuedeleted file mode 100644index e206976b24..0000000000--- a/frontend/src/components/ExternalTableDataTable.vue+++ /dev/null@@ -1,113 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="filteredData"- :row-props="rowProps"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :bordered="true"- :loading="loading"- :row-key="- (ex: ExternalTableMetadata) => `${database.name}.${schemaName}.${ex.name}`- "- />-- <ExternalTableDetailDrawer- :show="!!state.selectedTableName"- :database-name="database.name"- :schema-name="schemaName"- :external-table-name="state.selectedTableName ?? ''"- @dismiss="state.selectedTableName = undefined"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed, reactive } from "vue";-import { useI18n } from "vue-i18n";-import { HighlightLabelText } from "@/components/v2";-import type {- Database,- ExternalTableMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import ExternalTableDetailDrawer from "./ExternalTableDetailDrawer.vue";--type LocalState = {- selectedTableName?: string;-};--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- externalTableList: ExternalTableMetadata[];- search?: string;- loading?: boolean;- }>(),- {- schemaName: "",- search: "",- loading: false,- }-);--const { t } = useI18n();-const state = reactive<LocalState>({});--const columns = computed(() => {- return [- {- key: "name",- title: t("common.name"),- render: (row) => {- return <HighlightLabelText keyword={props.search} text={row.name} />;- },- },- {- key: "name",- title: t("database.external-server-name"),- render: (row) => {- return (- <HighlightLabelText- keyword={props.search}- text={row.externalServerName}- />- );- },- },- {- key: "name",- title: t("database.external-database-name"),- render: (row) => {- return (- <HighlightLabelText- keyword={props.search}- text={row.externalDatabaseName}- />- );- },- },- ] as DataTableColumn<ExternalTableMetadata>[];-});--const filteredData = computed(() => {- return props.externalTableList.filter((row) => {- return (- row.name.toLowerCase().includes(props.search) ||- row.externalServerName.toLowerCase().includes(props.search) ||- row.externalDatabaseName.toLowerCase().includes(props.search)- );- });-});--const rowProps = (row: ExternalTableMetadata) => {- return {- style: "cursor: pointer;",- onClick: () => {- state.selectedTableName = row.name;- },- };-};-</script>diff --git a/frontend/src/components/ExternalTableDetailDrawer.vue b/frontend/src/components/ExternalTableDetailDrawer.vuedeleted file mode 100644index 2260d66354..0000000000--- a/frontend/src/components/ExternalTableDetailDrawer.vue+++ /dev/null@@ -1,244 +0,0 @@-<template>- <Drawer :show="show" @close="$emit('dismiss')">- <DrawerContent :title="$t('database.foreign-table-detail')">- <div- v-if="externalTable"- class="flex-1 overflow-auto focus:outline-hidden w-[calc(100vw-256px)]"- tabindex="0"- >- <main class="flex-1 relative pb-8 overflow-y-auto">- <!-- Highlight Panel -->- <div- class="px-4 pb-4 border-b border-block-border md:flex md:items-center md:justify-between"- >- <div class="flex-1 min-w-0">- <!-- Summary -->- <div class="flex items-center">- <div>- <div class="flex items-center">- <h1- class="pt-2 pb-2.5 text-xl font-bold leading-6 text-main truncate flex items-center gap-x-3"- >- {{ getTableName(externalTable.name) }}- </h1>- </div>- </div>- </div>- <dl- class="flex flex-col gap-y-1 md:gap-y-0 md:flex-row md:flex-wrap"- >- <dt class="sr-only">{{ $t("common.environment") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.environment") }} - </span- >- <EnvironmentV1Name- :environment="effectiveEnvironment"- icon-class="textinfolabel"- />- </dd>- <dt class="sr-only">{{ $t("common.instance") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="ml-1 textlabel"- >{{ $t("common.instance") }} - </span- >- <InstanceV1Name :instance="instanceResource" />- </dd>- <dt class="sr-only">{{ $t("common.project") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.project") }} - </span- >- <ProjectV1Name- :project="projectEntity"- hash="#databases"- />- </dd>- <dt class="sr-only">{{ $t("common.database") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.database") }} - </span- >- <DatabaseV1Name :database="database" />- </dd>- <button- v-if="allowQuery"- type="button"- class="flex items-center text-sm textlabel cursor-pointer hover:text-accent md:mr-4 border-0 bg-transparent p-0"- @click.stop.prevent="gotoSQLEditor"- >- <span class="mr-1">{{ $t("sql-editor.self") }}</span>- <heroicons-solid:terminal class="w-5 h-5" />- </button>- </dl>- </div>- </div>-- <div class="mt-6">- <div class="max-w-6xl px-6 flex flex-col gap-y-6">- <!-- Description list -->- <dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-3">- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.external-server-name") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ externalTable.externalServerName }}- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.external-database-name") }}- </dt>- <dd class="mt-1 text-sm text-main">- {{ externalTable.externalDatabaseName }}- </dd>- </div>- </dl>- </div>- </div>-- <div class="mt-6 px-6">- <div class="mb-4 w-full flex flex-row justify-between items-center">- <div class="text-lg leading-6 font-medium text-main">- {{ $t("database.columns") }}- </div>- <div>- <SearchBox- :value="state.columnNameSearchKeyword"- :placeholder="$t('common.filter-by-name')"- @update:value="state.columnNameSearchKeyword = $event"- />- </div>- </div>- <ColumnDataTable- :database="database"- :schema="schemaName"- :table="create(TableMetadataSchema, {})"- :column-list="externalTable.columns"- :is-external-table="true"- :mask-data-list="[]"- :search="state.columnNameSearchKeyword"- />- </div>- </main>- </div>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { computedAsync } from "@vueuse/core";-import { computed, reactive, ref } from "vue";-import { useRouter } from "vue-router";-import {- DatabaseV1Name,- Drawer,- DrawerContent,- EnvironmentV1Name,- InstanceV1Name,- ProjectV1Name,- SearchBox,-} from "@/components/v2";-import { useDatabaseV1Store, useDBSchemaV1Store } from "@/store";-import { defaultProject, isDefaultProject } from "@/types";-import { TableMetadataSchema } from "@/types/proto-es/v1/database_service_pb";-import {- getDatabaseEnvironment,- getDatabaseProject,- getInstanceResource,- hasProjectPermissionV2,- hasSchemaProperty,- isDatabaseV1Queryable,-} from "@/utils";-import ColumnDataTable from "./ColumnDataTable/index.vue";-import { openSQLEditorForDatabase } from "./DatabaseDetail/sqlEditor";--interface LocalState {- columnNameSearchKeyword: string;- partitionTableNameSearchKeyword: string;-}--const props = defineProps<{- show: boolean;- // Format: /databases/:databaseName- databaseName: string;- schemaName: string;- externalTableName: string;-}>();--defineEmits(["dismiss"]);--const dbSchemaStore = useDBSchemaV1Store();-const databaseV1Store = useDatabaseV1Store();-const router = useRouter();-const state = reactive<LocalState>({- columnNameSearchKeyword: "",- partitionTableNameSearchKeyword: "",-});--const isFetchingTableMetadata = ref(false);-const externalTable = computedAsync(- async () => {- const { schemaName, externalTableName } = props;- if (!externalTableName) {- return;- }- const externalTableList = await dbSchemaStore.getOrFetchExternalTableList(- database.value.name,- schemaName- );- return externalTableList.find((t) => t.name === externalTableName);- },- undefined,- {- evaluating: isFetchingTableMetadata,- }-);--const database = computed(() => {- return databaseV1Store.getDatabaseByName(props.databaseName);-});--const instanceResource = computed(() => {- return getInstanceResource(database.value);-});--const projectEntity = computed(() => {- return getDatabaseProject(database.value);-});--const effectiveEnvironment = computed(() => {- return getDatabaseEnvironment(database.value);-});--const instanceEngine = computed(() => {- return instanceResource.value.engine;-});--const allowQuery = computed(() => {- if (isDefaultProject(database.value.project)) {- return hasProjectPermissionV2(- defaultProject(database.value.project),- "bb.sql.select"- );- }- return isDatabaseV1Queryable(database.value);-});--const gotoSQLEditor = () => {- openSQLEditorForDatabase({- router,- database: database.value,- });-};--const getTableName = (tableName: string) => {- if (hasSchemaProperty(instanceEngine.value)) {- return `"${props.schemaName}"."${tableName}"`;- }- return tableName;-};-</script>diff --git a/frontend/src/components/FunctionDataTable.vue b/frontend/src/components/FunctionDataTable.vuedeleted file mode 100644index 9f029ab192..0000000000--- a/frontend/src/components/FunctionDataTable.vue+++ /dev/null@@ -1,77 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="functionList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :bordered="true"- :loading="loading"- :row-key="(f: FunctionMetadata) => `${database.name}.${schemaName}.${f.signature || f.name}`"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Database,- FunctionMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { getInstanceResource, hasSchemaProperty } from "@/utils";-import EllipsisSQLView from "./EllipsisSQLView.vue";--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- functionList: FunctionMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const engine = computed(() => getInstanceResource(props.database).engine);--const columns = computed(() => {- const columns: (DataTableColumn<FunctionMetadata> & { hide?: boolean })[] = [- {- key: "name",- title: t("common.schema"),- hide: !hasSchemaProperty(engine.value),- ellipsis: {- tooltip: true,- },- render: () => {- return props.schemaName || t("db.schema.default");- },- },- {- key: "name",- title: t("common.name"),- ellipsis: {- tooltip: true,- },- render: (row) => {- return row.signature || row.name;- },- },- {- key: "name",- title: t("common.definition"),- render: (row) => {- return <EllipsisSQLView sql={row.definition} />;- },- },- ];-- return columns;-});-</script>diff --git a/frontend/src/components/IndexTable.vue b/frontend/src/components/IndexTable.vuedeleted file mode 100644index a45f57d160..0000000000--- a/frontend/src/components/IndexTable.vue+++ /dev/null@@ -1,100 +0,0 @@-<template>- <div v-for="(section, sectionIndex) in sectionList" :key="sectionIndex">- <h3 class="text-left pl-4 pt-4 pb-2 text-base font-medium text-gray-900">- {{ section.title }}- </h3>- <NDataTable- size="small"- :columns="columns"- :data="section.list"- :striped="true"- :bordered="true"- />- </div>-</template>--<script lang="ts" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { Engine } from "@/types/proto-es/v1/common_pb";-import type {- Database,- IndexMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { getInstanceResource } from "@/utils";--const props = defineProps({- database: {- required: true,- type: Object as PropType<Database>,- },- indexList: {- required: true,- type: Object as PropType<IndexMetadata[]>,- },-});--const { t } = useI18n();-const showVisibleColumn = computed(() => {- const engine = getInstanceResource(props.database).engine;- return engine !== Engine.POSTGRES && engine !== Engine.MONGODB;-});-const showCommentColumn = computed(() => {- const engine = getInstanceResource(props.database).engine;- return engine !== Engine.MONGODB;-});-const columns = computed((): DataTableColumn<IndexMetadata>[] => {- const cols: DataTableColumn<IndexMetadata>[] = [- {- title: t("database.expression"),- key: "expressions",- render: (row) => row.expressions.join(","),- },- ];-- cols.push({- title: t("database.unique"),- key: "unique",- render: (row) => String(row.unique),- });-- if (showVisibleColumn.value) {- cols.push({- title: t("database.visible"),- key: "visible",- render: (row) => String(row.visible),- });- }-- if (showCommentColumn.value) {- cols.push({- title: t("database.comment"),- key: "comment",- render: (row) => row.comment || "-",- });- }-- return cols;-});--const sectionList = computed(() => {- const sections: { title: string; list: IndexMetadata[] }[] = [];-- for (const index of props.indexList) {- const item = sections.find((item) => item.title === index.name);- if (item) {- item.list.push(index);- } else {- sections.push({- title: index.name,- list: [index],- });- }- }-- return sections;-});-</script>diff --git a/frontend/src/components/InstanceForm/index.ts b/frontend/src/components/InstanceForm/index.tsdeleted file mode 100644index 5760defb79..0000000000--- a/frontend/src/components/InstanceForm/index.ts+++ /dev/null@@ -1 +0,0 @@-export { EngineIconPath, defaultPortForEngine } from "./constants";diff --git a/frontend/src/components/InstanceRoleSelect.vue b/frontend/src/components/InstanceRoleSelect.vuedeleted file mode 100644index 2c66fb0f9e..0000000000--- a/frontend/src/components/InstanceRoleSelect.vue+++ /dev/null@@ -1,79 +0,0 @@-<template>- <NSelect- v-bind="$attrs"- :value="role"- :options="options"- :placeholder="$t('instance.select-database-user')"- :filter="filterByTitle"- :filterable="true"- :virtual-scroll="true"- :fallback-option="false"- @update:value="onRoleChange"- />-</template>--<script lang="ts" setup>-import { NSelect, type SelectOption } from "naive-ui";-import { computed, watch } from "vue";-import { useInstanceV1Store } from "@/store";-import type { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";--interface InstanceRoleSelectOption extends SelectOption {- value: string;- instanceRole: InstanceRole;-}--const props = defineProps<{- instanceName: string;- filter?: (role: InstanceRole) => boolean;- role?: string;-}>();--const emit = defineEmits<{- (event: "update:instance-role", role: InstanceRole | undefined): void;-}>();--const instanceV1Store = useInstanceV1Store();--const instanceRoles = computed(- () => instanceV1Store.getInstanceByName(props.instanceName)?.roles-);--watch(- () => props.instanceName,- async (instanceName) => {- if (instanceName) {- await instanceV1Store.getOrFetchInstanceByName(instanceName);- emit("update:instance-role", undefined);- }- },- { immediate: true }-);--const options = computed(() => {- return filteredInstanceRoleList.value.map<InstanceRoleSelectOption>(- (instanceRole) => {- return {- instanceRole,- value: instanceRole.name,- label: instanceRole.roleName,- };- }- );-});--const filteredInstanceRoleList = computed(() => {- if (!props.filter) return instanceRoles.value;- return instanceRoles.value.filter(props.filter);-});--const filterByTitle = (pattern: string, option: SelectOption) => {- const { instanceRole } = option as InstanceRoleSelectOption;- return instanceRole.roleName.toLowerCase().includes(pattern.toLowerCase());-};--const onRoleChange = (roleName: string | undefined) => {- const role = instanceRoles.value.find((role) => role.name === roleName);- emit("update:instance-role", role);-};-</script>diff --git a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue b/frontend/src/components/IssueV1/components/IssueStatusIcon.vuedeleted file mode 100644index 2fabde88a4..0000000000--- a/frontend/src/components/IssueV1/components/IssueStatusIcon.vue+++ /dev/null@@ -1,94 +0,0 @@-<template>- <NTooltip>- <template #trigger>- <span- class="flex items-center justify-center rounded-full select-none overflow-hidden shrink-0"- :class="issueIconClass()"- >- <template v-if="issueStatus === IssueStatus.OPEN">- <span- class="h-1.5 w-1.5 bg-info rounded-full"- aria-hidden="true"- ></span>- </template>- <template v-else-if="issueStatus === IssueStatus.DONE">- <heroicons-solid:check class="w-4 h-4" />- </template>- <template v-else-if="issueStatus === IssueStatus.CANCELED">- <heroicons-solid:minus class="w-5 h-5" />- </template>- </span>- </template>-- <template #default>- <div class="max-w-[24rem]">- {{- isUnfinishedResolvedIssue- ? $t("issue.unfinished-resolved-issue-tips")- : stringifyIssueStatus(props.issueStatus)- }}- </div>- </template>- </NTooltip>-</template>--<script lang="ts" setup>-import { NTooltip } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";-import { isUnfinishedResolvedTask as checkUnfinishedResolvedTask } from "@/utils";--export type SizeType = "small" | "normal";--const props = defineProps({- issueStatus: {- required: true,- type: Number as PropType<IssueStatus>,- },- size: {- type: String as PropType<SizeType>,- default: "normal",- },- issue: {- type: Object as PropType<Issue>,- default: undefined,- },-});--const { t } = useI18n();--const issueIconClass = () => {- const iconClass = props.size === "normal" ? "w-5 h-5" : "w-4 h-4";- switch (props.issueStatus) {- case IssueStatus.OPEN:- return iconClass + " bg-white border-2 border-info text-info";- case IssueStatus.CANCELED:- return iconClass + " bg-white border-2 text-gray-400 border-gray-400";- case IssueStatus.DONE:- return (- iconClass +- " text-white" +- (isUnfinishedResolvedIssue.value ? " bg-warning" : " bg-success")- );- }-};--const isUnfinishedResolvedIssue = computed(() => {- // In list contexts, we don't have rollout data, so pass undefined- return checkUnfinishedResolvedTask(props.issue, undefined);-});--const stringifyIssueStatus = (issueStatus: IssueStatus): string => {- if (issueStatus === IssueStatus.OPEN) {- return t("issue.table.open");- } else if (issueStatus === IssueStatus.DONE) {- return t("common.approved");- } else if (issueStatus === IssueStatus.CANCELED) {- return t("common.closed");- }- return "";-};-</script>diff --git a/frontend/src/components/IssueV1/components/index.ts b/frontend/src/components/IssueV1/components/index.tsdeleted file mode 100644index 2818c3f33d..0000000000--- a/frontend/src/components/IssueV1/components/index.ts+++ /dev/null@@ -1 +0,0 @@-export { default as IssueStatusIcon } from "./IssueStatusIcon.vue";diff --git a/frontend/src/components/Label/LabelEditorRow.vue b/frontend/src/components/Label/LabelEditorRow.vuedeleted file mode 100644index 54627dda72..0000000000--- a/frontend/src/components/Label/LabelEditorRow.vue+++ /dev/null@@ -1,77 +0,0 @@-<template>- <div class="flex flex-col gap-y-1">- <div class="text-sm flex gap-x-2">- <div class="flex flex-col">- <span class="text-xs font-medium mb-1"> Key {{ index + 1 }} </span>- <span v-if="readonly" class="leading-[34px]">- {{ kv.key }}- </span>- <NInput- v-else- :value="kv.key"- :placeholder="$t('setting.label.key-placeholder')"- :status="errors.key.length > 0 ? 'error' : undefined"- @update:value="$emit('update-key', $event)"- />- </div>- <div class="flex flex-col">- <span class="text-xs font-medium mb-1"> Value {{ index + 1 }} </span>- <div class="flex items-center gap-x-2">- <span v-if="readonly" class="leading-[34px]">- <template v-if="kv.value">{{ kv.value }}</template>- <span v-else class="text-control-placeholder">- {{ $t("label.empty-label-value") }}- </span>- </span>- <NInput- v-else- :value="kv.value"- :placeholder="$t('setting.label.value-placeholder')"- :status="errors.value.length > 0 ? 'error' : undefined"- @update:value="$emit('update-value', $event)"- />- <MiniActionButton- :class="['ml-1', readonly ? 'invisible' : 'visible']"- @click="$emit('remove')"- >- <Trash2Icon />- </MiniActionButton>- </div>- <div v-if="kv.message" class="textinfolabel">{{ kv.message }}</div>- </div>- <div />- </div>- <div v-if="combinedErrors.length > 0" class="text-xs text-error col-span-3">- <ErrorList :errors="combinedErrors" bullets="always" />- </div>- </div>-</template>--<script setup lang="ts">-import { Trash2Icon } from "lucide-vue-next";-import { NInput } from "naive-ui";-import { computed } from "vue";-import { MiniActionButton } from "@/components/v2";-import ErrorList from "../misc/ErrorList.vue";-import type { Label } from "./types";--const props = defineProps<{- kv: Label;- index: number;- readonly: boolean;- errors: {- key: string[];- value: string[];- };-}>();--defineEmits<{- (event: "update-key", key: string): void;- (event: "update-value", value: string): void;- (event: "remove"): void;-}>();--const combinedErrors = computed(() => {- return [...props.errors.key, ...props.errors.value];-});-</script>diff --git a/frontend/src/components/Label/LabelListEditor.vue b/frontend/src/components/Label/LabelListEditor.vuedeleted file mode 100644index 55c1f0216f..0000000000--- a/frontend/src/components/Label/LabelListEditor.vue+++ /dev/null@@ -1,145 +0,0 @@-<template>- <div class="flex flex-col gap-y-2">- <div- class="flex flex-wrap gap-x-2 gap-y-2"- >- <LabelEditorRow- v-for="(kv, i) in kvList"- :key="i"- :kv="kv"- :index="i"- :readonly="readonly"- :errors="errorsForKV(i)"- @update-key="updateKey(i, $event)"- @update-value="updateValue(i, $event)"- @remove="handleRemove(i)"- />- </div>-- <div>- <NButton size="small" :disabled="readonly || !allowAddLabel" @click="handleAdd">- <template #icon>- <heroicons:plus />- </template>- {{ $t("label.add-label") }}- </NButton>- </div>- </div>-</template>--<script lang="ts" setup>-import { cloneDeep } from "lodash-es";-import { NButton } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { MAX_LABEL_VALUE_LENGTH } from "@/utils";-import LabelEditorRow from "./LabelEditorRow.vue";-import type { Label } from "./types";--const props = defineProps<{- kvList: Label[];- readonly: boolean;- showErrors: boolean;-}>();--const emit = defineEmits<{- (event: "update:kvList", kvList: Label[]): void;-}>();--const { t } = useI18n();--const errorList = computed(() => {- const { kvList } = props;- const list: { key: string[]; value: string[] }[] = [];- for (let i = 0; i < kvList.length; i++) {- const kv = kvList[i];-- const { key, value } = kv;- const errors = {- key: [] as string[],- value: [] as string[],- };- if (!key) {- errors.key.push(t("label.error.key-necessary"));- } else {- if (kvList.filter((kv) => kv.key === key).length > 1) {- errors.key.push(t("label.error.key-duplicated"));- }- }- if (!value) {- if (!kv.allowEmpty) {- errors.value.push(t("label.error.value-necessary"));- }- } else if (value.length > MAX_LABEL_VALUE_LENGTH) {- errors.value.push(- t("label.error.max-value-length-exceeded", {- length: MAX_LABEL_VALUE_LENGTH,- })- );- }- list.push(errors);- }-- return list;-});--const errorsForKV = (index: number) => {- if (!props.showErrors) {- return { key: [], value: [] };- }- return errorList.value[index] ?? { key: [], value: [] };-};--const flattenErrorsForKV = (index: number) => {- const errors = errorsForKV(index);- return [...errors.key, ...errors.value];-};--const flattenErrors = computed(() => {- const flattenErrors: { key: string; errors: string[] }[] = [];- props.kvList.forEach((kv, i) => {- const { key } = kv;- const errors = flattenErrorsForKV(i);- if (errors.length > 0) {- flattenErrors.push({ key, errors });- }- });- return flattenErrors;-});--const allowAddLabel = computed(() => {- return flattenErrors.value.length === 0;-});--const updateKey = (index: number, key: string) => {- const list = cloneDeep(props.kvList);- const kv = list[index];- if (!kv) return;- kv.key = key;- emit("update:kvList", list);-};--const updateValue = (index: number, value: string) => {- const list = cloneDeep(props.kvList);- const kv = list[index];- if (!kv) return;- kv.value = value;- emit("update:kvList", list);-};--const handleRemove = (index: number) => {- const list = cloneDeep(props.kvList);- list.splice(index, 1);- emit("update:kvList", list);-};--const handleAdd = () => {- const list = cloneDeep(props.kvList);- emit("update:kvList", [...list, { key: "", value: "" }]);-};--defineExpose({- errorList,- flattenErrors,-});-</script>diff --git a/frontend/src/components/Label/index.ts b/frontend/src/components/Label/index.tsdeleted file mode 100644index 2c9c84ae3c..0000000000--- a/frontend/src/components/Label/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import LabelListEditor from "./LabelListEditor.vue";--export { LabelListEditor };diff --git a/frontend/src/components/Label/types.ts b/frontend/src/components/Label/types.tsdeleted file mode 100644index 9b9e0e185d..0000000000--- a/frontend/src/components/Label/types.ts+++ /dev/null@@ -1,6 +0,0 @@-export type Label = {- key: string;- value: string;- message?: string;- allowEmpty?: boolean;-};diff --git a/frontend/src/components/LabelEditorDrawer.vue b/frontend/src/components/LabelEditorDrawer.vuedeleted file mode 100644index 8f7a36cee3..0000000000--- a/frontend/src/components/LabelEditorDrawer.vue+++ /dev/null@@ -1,173 +0,0 @@-<template>- <Drawer :show="show" @close="$emit('dismiss')">- <DrawerContent :title="title" class="w-[40rem] max-w-[100vw]">- <BBAttention v-if="showWarning" class="mb-5" type="warning">- {{ $t("database.mixed-label-values-warning") }}- </BBAttention>- <LabelListEditor- ref="labelListEditorRef"- v-model:kv-list="state.kvList"- :readonly="readonly"- :show-errors="dirty"- />- <template #footer>- <div class="w-full flex justify-between items-center">- <div class="w-full flex justify-end items-center gap-x-2">- <NButton @click.prevent="$emit('dismiss')">- {{ $t("common.cancel") }}- </NButton>- <NButton- v-if="!readonly"- :disabled="!allowSave"- type="primary"- @click="onSave"- >- {{ $t("common.save") }}- </NButton>- </div>- </div>- </template>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { cloneDeep, isEqual } from "lodash-es";-import { NButton } from "naive-ui";-import { computed, reactive, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { BBAttention } from "@/bbkit";-import { LabelListEditor } from "@/components/Label";-import type { Label } from "@/components/Label/types";-import { Drawer, DrawerContent } from "@/components/v2";-import { convertKVListToLabels } from "@/utils";--const props = defineProps<{- show: boolean;- readonly: boolean;- title: string;- labels: {- [key: string]: string;- }[];-}>();-const emit = defineEmits<{- (event: "dismiss"): void;- (- event: "apply",- labels: {- [key: string]: string;- }[]- ): void;-}>();--type LocalState = {- kvList: Label[];-};--const { t } = useI18n();-const state = reactive<LocalState>({- kvList: [],-});-const labelListEditorRef = ref<InstanceType<typeof LabelListEditor>>();--const convertKVListToLabelsList = () => {- const labels = convertKVListToLabels(state.kvList);- return props.labels.map((oldLabel) => {- for (const label of state.kvList) {- if (!label.value) {- if (oldLabel[label.key]) {- labels[label.key] = oldLabel[label.key];- }- }- }- return labels;- });-};--const convertLabelsToKVList = () => {- interface TmpLabel {- [key: string]: {- value: string;- message?: string;- allowEmpty?: boolean;- };- }-- let tmp: TmpLabel = {};- if (props.labels.length > 0) {- tmp = Object.entries(props.labels[0]).reduce((resp, [key, value]) => {- resp[key] = {- value,- };- return resp;- }, {} as TmpLabel);- }- for (let i = 1; i < props.labels.length; i++) {- const label = cloneDeep(props.labels[i]);- for (const key of Object.keys(tmp)) {- if (!label[key] || label[key] !== tmp[key].value) {- tmp[key] = {- message: t("database.mixed-values-for-label"),- value: "",- allowEmpty: true,- };- }- delete label[key];- }- for (const [key, value] of Object.entries(label)) {- if (!tmp[key]) {- tmp[key] = {- value,- };- } else if (tmp[key].value !== value) {- tmp[key] = {- message: t("database.mixed-values-for-label"),- value: "",- allowEmpty: true,- };- }- }- }-- const list: Label[] = Object.entries(tmp).map(([key, obj]) => ({- key,- value: obj.value,- message: obj.message,- allowEmpty: obj.allowEmpty,- }));-- return list;-};--const dirty = computed(() => {- const original = convertLabelsToKVList();- const local = state.kvList;- return !isEqual(original, local);-});--const allowSave = computed(() => {- if (!dirty.value) return false;- const errors = labelListEditorRef.value?.flattenErrors ?? [];- return errors.length === 0;-});--const showWarning = computed(() => {- return state.kvList.some((kv) => !!kv.message);-});--const onSave = () => {- emit("apply", convertKVListToLabelsList());- emit("dismiss");-};--watch(- () => props.labels,- () => {- state.kvList = convertLabelsToKVList();- },- {- immediate: true,- deep: true,- }-);-</script>diff --git a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue b/frontend/src/components/MarkdownEditor/MarkdownEditor.vuedeleted file mode 100644index ea344e9057..0000000000--- a/frontend/src/components/MarkdownEditor/MarkdownEditor.vue+++ /dev/null@@ -1,630 +0,0 @@-<template>- <div>- <NTabs- v-if="mode === 'editor'"- v-model:value="state.activeTab"- type="line"- :size="'small'"- class="mb-2"- @update:value="handleTabChange"- >- <NTab name="write" :tab="$t('issue.comment-editor.write')" />- <NTab name="preview" :tab="$t('issue.comment-editor.preview')" />- <template v-if="!compact && state.activeTab === 'write'" #suffix>- <div class="flex items-center justify-end">- <NTooltip- v-for="(toolbar, i) in toolbarItems"- :key="i"- :show-arrow="true"- >- <template #trigger>- <NButton quaternary size="small" @click="toolbar.action">- <component :is="toolbar.icon" class="w-4 h-4" />- </NButton>- </template>- <span class="w-56 text-sm">- {{ toolbar.tooltip }}- </span>- </NTooltip>- </div>- </template>- </NTabs>-- <iframe- v-if="state.activeTab === 'preview' || state.showPreview"- ref="contentPreviewArea"- :srcdoc="renderedContent"- class="rounded-md w-full overflow-hidden"- />- <div v-else-if="mode === 'editor'" class="relative">- <textarea- ref="contentTextArea"- v-model="state.content"- rows="4"- class="block w-full px-4 py-3 resize-none whitespace-pre-wrap rounded-lg border border-gray-300 outline-hidden ring-0 text-sm"- :placeholder="placeholder || $t('issue.leave-a-comment')"- :maxlength="maxlength"- @mousedown="clearIssuePanel"- @input="(e: Event) => sizeToFit(e.target as HTMLTextAreaElement)"- @keyup="(e: KeyboardEvent) => adjustIssuePanelWithPosition(e)"- @keydown.enter="keyboardHandler"- @keydown.down="handleArrowDown"- @keydown.up="handleArrowUp"- ></textarea>- <div- ref="issuePanel"- class="border rounded-sm absolute hidden bg-white shadow-xs z-10"- >- <NScrollbar class="max-h-40">- <ul class="text-sm rounded-sm divide-y divide-solid">- <li- v-for="(issue, index) in filterIssueList"- :key="issue.name"- :class="[- 'px-3 py-2 hover:bg-gray-100 cursor-pointer flex items-center gap-x-2',- { 'bg-gray-100': state.activeIssueIndex === index },- ]"- @click="onIssueSelect(issue)"- @mouseenter="() => (state.activeIssueIndex = index)"- >- <IssueStatusIcon :issue-status="issue.status" />- <span class="opacity-60">#{{ extractIssueUID(issue.name) }}</span>- <div class="whitespace-nowrap">- <HighlightLabelText- :text="issue.title"- :keyword="issueSearchText"- />- </div>- </li>- </ul>- </NScrollbar>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { useDebounceFn } from "@vueuse/core";-import {- BoldIcon,- CodeIcon,- HashIcon,- HeadingIcon,- LinkIcon,-} from "lucide-vue-next";-import { NButton, NScrollbar, NTab, NTabs, NTooltip } from "naive-ui";-import type { Component } from "vue";-import { nextTick, onMounted, reactive, ref, toRef, watch } from "vue";-import { useI18n } from "vue-i18n";-import { HighlightLabelText } from "@/components/v2";-import { useIssueV1Store } from "@/store";-import { DEBOUNCE_SEARCH_DELAY } from "@/types";-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { extractIssueUID, sizeToFit } from "@/utils";-import IssueStatusIcon from "../IssueV1/components/IssueStatusIcon.vue";-import { useRenderMarkdown } from "./useRenderMarkdown";--interface LocalState {- showPreview: boolean;- content: string;- activeTab: "write" | "preview";- activeIssueIndex?: number;-}--interface Toolbar {- icon: Component;- tooltip: string;- action: () => void;-}--type EditorMode = "editor" | "preview";--const props = withDefaults(- defineProps<{- content: string;- mode: EditorMode;- project: Project;- placeholder?: string;- autofocus?: boolean;- maxlength?: number;- maxHeight?: number;- compact?: boolean;- }>(),- {- maxHeight: 192,- }-);--const emit = defineEmits<{- (event: "change", value: string): void;- (event: "submit"): void;-}>();--const state = reactive<LocalState>({- showPreview: props.mode === "preview",- content: props.content,- activeTab: props.mode === "preview" ? "preview" : "write",-});--const { t } = useI18n();-const issueV1Store = useIssueV1Store();-const issueSearchText = ref<string>("");--watch(- () => props.mode,- (mode) => {- state.showPreview = mode === "preview";- state.activeTab = mode === "preview" ? "preview" : "write";- }-);--const contentTextArea = ref<HTMLTextAreaElement>();-const contentPreviewArea = ref<HTMLIFrameElement>();-const issuePanel = ref<HTMLDivElement>();-const filterIssueList = ref<Issue[]>([]);--watch(- () => filterIssueList.value.length,- (length) => {- if (length === 0) {- if (issuePanel.value) {- issuePanel.value.style.display = "none";- }- state.activeIssueIndex = undefined;- } else if (contentTextArea.value && issuePanel.value) {- const position = getIssuePanelPosition(contentTextArea.value);- issuePanel.value.style.display = "block";- issuePanel.value.style.left = `${position.x}px`;- issuePanel.value.style.top = `${position.y + 25}px`;- state.activeIssueIndex = 0;- }- }-);--const { renderedContent } = useRenderMarkdown(- toRef(state, "content"),- contentPreviewArea,- toRef(props, "project"),- {- placeholder: `<span>${t("issue.comment-editor.nothing-to-preview")}</span>`,- maxHeight: props.maxHeight,- }-);--watch(- () => state.content,- (val) => emit("change", val)-);--watch(- () => props.content,- (val) => {- if (val !== state.content) {- state.content = val;- nextTick(() => sizeToFit(contentTextArea.value));- }- }-);--const handleTabChange = (value: string) => {- state.showPreview = value === "preview";- state.activeTab = value as "write" | "preview";-};--watch(- () => state.showPreview,- (preview) => {- if (!preview) {- nextTick(() => {- sizeToFit(contentTextArea.value);- contentTextArea.value?.focus();- });- }- }-);--onMounted(() => {- if (props.autofocus && !state.showPreview) {- nextTick(() => {- contentTextArea.value?.focus();- });- }-});--const keyboardHandler = (e: KeyboardEvent) => {- if (e.isComposing) return;- if (!contentTextArea.value) {- return;- }- if (contentTextArea.value !== document.activeElement) {- return;- }-- if (e.code !== "Enter") {- // For now we only trigger by the Enter event.- return;- }-- if (e.metaKey) {- emit("submit");- } else {- if (- filterIssueList.value.length > 0 &&- state.activeIssueIndex !== undefined- ) {- const selectedIssue = filterIssueList.value[state.activeIssueIndex];- if (selectedIssue) {- onIssueSelect(selectedIssue);- e.stopPropagation();- e.preventDefault();- return;- }- }-- if (autoComplete(state.content)) {- e.stopPropagation();- e.preventDefault();- }- }-};--const handleArrowDown = (e: KeyboardEvent) => {- if (filterIssueList.value.length === 0) {- return;- }-- e.preventDefault();- e.stopPropagation();-- if (state.activeIssueIndex === undefined) {- state.activeIssueIndex = 0;- } else if (state.activeIssueIndex < filterIssueList.value.length - 1) {- state.activeIssueIndex++;- }-};--const handleArrowUp = (e: KeyboardEvent) => {- if (filterIssueList.value.length === 0) {- return;- }-- e.preventDefault();- e.stopPropagation();-- if (state.activeIssueIndex === undefined) {- state.activeIssueIndex = 0;- } else if (state.activeIssueIndex > 0) {- state.activeIssueIndex--;- }-};--const autoComplete = (text: string) => {- if (!contentTextArea.value) {- return false;- }- const start = contentTextArea.value.selectionStart;- const end = contentTextArea.value.selectionEnd;- if (start !== end) {- return false;- }-- const lines = text.split("\n");- if (lines.length === 0) {- return false;- }-- const currentLineIndex = getActiveLineIndex(text, start);- const currentLine = lines[currentLineIndex];-- if (/^\s{0,}(\d{1,}\.|-)\s{1,}$/.test(currentLine)) {- // /^\s{0,}(\d{1,}\.|-)\s{1,}$/ matches "- ", " - " or "1. ", " 1. ", etc.- // if current line only contains "-" or number list like "1.", we will clear the line just like the GitHub.- lines[currentLineIndex] = "";- state.content = lines.join("\n");- nextTick(() => {- if (!contentTextArea.value) {- return;- }- const newPosition = getCursorPosition(lines.slice(0, currentLineIndex));- contentTextArea.value.setSelectionRange(newPosition, newPosition);- });- return true;- } else if (/^\s{0,}(\d{1,}\.|-)\s/.test(currentLine)) {- // else if current line also contains other text, we will auto-complete the markdown list.- // for example, the "- 12|3"(| is the cursor position) should be "- 12\n- 3"- const indent = new Array(- currentLine.length - currentLine.trimStart().length + 1- ).join(" ");- const indexInCurrentLine =- start - getCursorPosition(lines.slice(0, currentLineIndex));- const trimEnd = currentLine.slice(indexInCurrentLine);- lines[currentLineIndex] = currentLine.slice(0, indexInCurrentLine);-- let nextListStart = "-";- if (/^\s{0,}\d{1,}\.\s/.test(currentLine)) {- const guessListNumber = Number(currentLine.match(/\d+/)![0]) + 1;- nextListStart = `${guessListNumber}.`;- }- lines.splice(- currentLineIndex + 1,- 0,- `${indent}${nextListStart} ${trimEnd}`- );- state.content = lines.join("\n");-- nextTick(() => {- if (!contentTextArea.value) {- return;- }- const newPosition =- getCursorPosition(lines.slice(0, currentLineIndex + 2)) - 1;- contentTextArea.value.setSelectionRange(newPosition, newPosition);- });-- return true;- }-- return false;-};--// getActiveLineIndex returns the current line index for active cursor.-const getActiveLineIndex = (- content: string,- cursorPosition: number-): number => {- const lines = content.split("\n");-- let n = 0;- for (let i = 0; i < lines.length; i++) {- n += lines[i].length;- if (n >= cursorPosition) {- return i;- }- n++;- }- return lines.length - 1;-};--// getCursorPosition returns the index for active cursor in current line.-const getCursorPosition = (lines: string[]): number => {- let n = 0;- for (const line of lines) {- n += line.length;- n++;- }- return n;-};--const toolbarItems: Toolbar[] = [- {- icon: HeadingIcon,- tooltip: t("issue.comment-editor.toolbar.header"),- action: () => {- insertWithCursorPosition("### ", 4);- },- },- {- icon: BoldIcon,- tooltip: t("issue.comment-editor.toolbar.bold"),- action: () => {- insertWithCursorPosition("****", 2);- },- },- {- icon: CodeIcon,- tooltip: t("issue.comment-editor.toolbar.code"),- action: () => {- insertWithCursorPosition("```sql\n\n```", 7);- },- },- {- icon: LinkIcon,- tooltip: t("issue.comment-editor.toolbar.link"),- action: () => {- insertWithCursorPosition("[](url)", 1);- },- },- {- icon: HashIcon,- tooltip: t("issue.comment-editor.toolbar.hashtag"),- action: () => {- insertWithCursorPosition("#", 1);- },- },-];--// insertWithCursorPosition will insert the template, and put selected text (or current cursor position) in the template with specific position.-// Support templates:-// \n```\nsql{text}\n```\n-// **{text}**-// [{text}](url)-// ### {text}-const insertWithCursorPosition = (template: string, position: number) => {- if (!contentTextArea.value) {- return false;- }- const start = contentTextArea.value.selectionStart;- const end = contentTextArea.value.selectionEnd;-- const pendingInsert = `${template.slice(0, position)}${state.content.slice(- start,- end- )}${template.slice(position)}`;- const newContent = `${state.content.slice(- 0,- start- )}${pendingInsert}${state.content.slice(end)}`;-- state.content = newContent;-- nextTick(() => {- if (!contentTextArea.value) {- return;- }- contentTextArea.value.setSelectionRange(start + position, end + position);- contentTextArea.value.focus();-- if (template === "#") {- adjustIssuePanelWithPosition();- }- });-};--const clearIssuePanel = () => {- filterIssueList.value = [];-};--// onIssueSelect will replace the input issue id with the selected issue id.-// For example, if the text is "#12|" (| is the cursor position), and select the issue with id 1234,-// we will replace the "#12|" with "#1234 |"-const onIssueSelect = (issue: Issue) => {- if (!contentTextArea.value) {- return false;- }- const start = contentTextArea.value.selectionStart;- const end = contentTextArea.value.selectionEnd;- if (start !== end) {- return false;- }-- let replaceStart = start - 1;- while (replaceStart > 0) {- if (state.content[replaceStart] === "#") {- break;- }- replaceStart--;- }- replaceStart++;-- const content = state.content.split("");- const issueId = `${extractIssueUID(issue.name)} `;- content.splice(replaceStart, start - replaceStart, issueId);- state.content = content.join("");-- clearIssuePanel();-- nextTick(() => {- if (!contentTextArea.value) {- return;- }- const selectionDiff = issueId.length - (start - replaceStart);- contentTextArea.value.setSelectionRange(- start + selectionDiff,- end + selectionDiff- );- contentTextArea.value.focus();- });-- return;-};--const adjustIssuePanelWithPosition = useDebounceFn((e?: KeyboardEvent) => {- if (- e &&- (e.key === "ArrowDown" || e.key === "ArrowUp") &&- filterIssueList.value.length > 0- ) {- return;- }-- if (!contentTextArea.value || !issuePanel.value) {- return;- }-- clearIssuePanel();-- const start = contentTextArea.value.selectionStart;- const end = contentTextArea.value.selectionEnd;- if (start !== end || start === 0) {- return;- }-- const text = `${state.content.slice(0, start)}${- start === state.content.length ? " " : state.content[start]- }`;- const matches = text.match(/#\S{0,}\s$/);- if (!matches) {- return;- }-- const query = matches[0].slice(1).trimEnd();- const isQuery = Number.isNaN(parseInt(query));- issueSearchText.value = isQuery ? query : "";-- issueV1Store- .listIssues({- find: {- project: props.project.name,- query: isQuery ? query : "",- },- })- .then((resp) => {- if (!isQuery && query) {- filterIssueList.value = resp.issues.filter((issue) =>- extractIssueUID(issue.name).startsWith(query)- );- } else {- filterIssueList.value = resp.issues;- }- });-}, DEBOUNCE_SEARCH_DELAY);--const getIssuePanelPosition = (textArea: HTMLTextAreaElement) => {- const start = textArea.selectionStart;- const end = textArea.selectionEnd;- const copy = createDivCopyForTextarea(textArea);-- const range = document.createRange();- if (copy.firstChild) {- range.setStart(copy.firstChild, start);- range.setEnd(copy.firstChild, end);- }-- const selection = document.getSelection();- selection?.removeAllRanges();- selection?.addRange(range);-- const rect = range.getBoundingClientRect();- document.body.removeChild(copy);- textArea.selectionStart = start;- textArea.selectionEnd = end;- textArea.focus();-- return {- x: rect.left - textArea.scrollLeft,- y: rect.top - textArea.scrollTop,- };-};--const createDivCopyForTextarea = (textArea: HTMLTextAreaElement) => {- const copy = document.createElement("div");- copy.textContent = textArea.value;- const style = getComputedStyle(textArea);-- const styleKeys = [- "fontFamily",- "fontSize",- "fontWeight",- "wordWrap",- "whiteSpace",- "borderLeftWidth",- "borderTopWidth",- "borderRightWidth",- "borderBottomWidth",- ] as const;- styleKeys.forEach((key) => {- copy.style[key] = style[key];- });-- copy.style.overflow = "auto";- copy.style.width = textArea.offsetWidth + "px";- copy.style.height = textArea.offsetHeight + "px";- copy.style.position = "absolute";- copy.style.left = textArea.offsetLeft + "px";- copy.style.top = textArea.offsetTop + "px";-- document.body.appendChild(copy);- return copy;-};-</script>diff --git a/frontend/src/components/MarkdownEditor/index.ts b/frontend/src/components/MarkdownEditor/index.tsdeleted file mode 100644index 42dec1c912..0000000000--- a/frontend/src/components/MarkdownEditor/index.ts+++ /dev/null@@ -1,5 +0,0 @@-import MarkdownEditor from "./MarkdownEditor.vue";--export default MarkdownEditor;--export * from "./useRenderMarkdown";diff --git a/frontend/src/components/MarkdownEditor/resize-observer.ts b/frontend/src/components/MarkdownEditor/resize-observer.tsdeleted file mode 100644index e07b12f941..0000000000--- a/frontend/src/components/MarkdownEditor/resize-observer.ts+++ /dev/null@@ -1,22 +0,0 @@-document.addEventListener("DOMContentLoaded", () => {- const populateBodySize = () => {- const rect = document.body.getBoundingClientRect();- window.parent.postMessage(- {- source: "bb.markdown.renderer",- key: window.name,- width: rect.width,- height: rect.height,- },- "*"- );- };-- const ob = new ResizeObserver((entries) => {- const bodyEntry = entries.find((entry) => entry.target === document.body);- if (!bodyEntry) return;- populateBodySize();- });-- ob.observe(document.body);-});diff --git a/frontend/src/components/MarkdownEditor/useRenderMarkdown.ts b/frontend/src/components/MarkdownEditor/useRenderMarkdown.tsdeleted file mode 100644index 386af3c1b7..0000000000--- a/frontend/src/components/MarkdownEditor/useRenderMarkdown.ts+++ /dev/null@@ -1,178 +0,0 @@-import { useEventListener } from "@vueuse/core";-import { v1 as uuidv1 } from "uuid";-import type { MaybeRef, Ref } from "vue";-import { computed, ref, unref, watchEffect } from "vue";-import { useI18n } from "vue-i18n";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { ExtractPromiseType } from "@/utils";-import { extractProjectResourceName, minmax } from "@/utils";--export type UseRenderMarkdownOptions = {- minHeight: number;- maxHeight: number;- placeholder: string;-};--const defaultOptions = (): UseRenderMarkdownOptions => ({- minHeight: 24 /* 1 line */,- maxHeight: 192 /* 12rem */,- placeholder: "",-});--export const useRenderMarkdown = (- markdown: MaybeRef<string>,- iframeRef: Ref<HTMLIFrameElement | undefined>,- projectRef: MaybeRef<Project | undefined> = ref(),- options: Partial<UseRenderMarkdownOptions> | undefined = undefined-) => {- const windowName = uuidv1();- const mergedOptions = Object.assign(defaultOptions(), options);- const { t } = useI18n();- const request = Promise.all([- import("highlight.js/lib/core"),- import("highlight.js/styles/github.css?raw"),- import("@/assets/css/github-markdown-style.css?raw"),- import("markdown-it"),- import("dompurify"),- import("./resize-observer?raw"),- ]);- const modules = ref<ExtractPromiseType<typeof request>>();- request.then((dep) => {- modules.value = dep;- });- const deps = computed(() => {- if (!modules.value) return undefined;- const [- { default: hljs },- { default: codeStyle },- { default: markdownStyle },- { default: MarkdownIt },- { default: DOMPurify },- { default: resizeObserverScript },- ] = modules.value;- const md = new MarkdownIt({- html: true,- linkify: true,- highlight: function (code, lang) {- if (lang && hljs.getLanguage(lang)) {- try {- return hljs.highlight(code, { language: lang }).value;- } catch {- return "";- }- }-- return ""; // use external default escaping- },- });-- // See: https://github.com/cure53/DOMPurify/tree/main/demos#hook-to-open-all-links-in-a-new-window-link- // Add a hook to make all links open a new window- DOMPurify.addHook("afterSanitizeAttributes", function (node) {- // set all elements owning target to target=_blank- if ("target" in node) {- node.setAttribute("target", "_blank");- }- // set non-HTML/MathML links to xlink:show=new- if (- !node.hasAttribute("target") &&- (node.hasAttribute("xlink:href") || node.hasAttribute("href"))- ) {- node.setAttribute("xlink:show", "new");- }- });- return {- md,- codeStyle,- markdownStyle,- DOMPurify,- resizeObserverScript,- };- });-- const rawRenderedContent = computed(() => {- if (!deps.value) return "";- if (!unref(markdown)) return mergedOptions.placeholder;-- // we met a valid #{issue_id} in which issue_id is an integer and >= 0- // render a link to the issue- const formatted = unref(markdown)- .split(/(#\d+)\b/)- .map((part) => {- if (!part.startsWith("#")) {- return part;- }- const id = parseInt(part.slice(1), 10);- if (!Number.isNaN(id) && id > 0) {- const project = unref(projectRef);- if (project) {- // Here we assume that the referenced issue and the current issue are always- // in the same project- // if project is specified- const path = `projects/${extractProjectResourceName(- project.name- )}/issues/${id}`;- const url = `${window.location.origin}/${path}`;- return `[${t("common.issue")} #${id}](${url})`;- } else {- return `[${t("common.issue")} #${id}](${- window.location.origin- }/issue/${id})`;- }- }- return part;- })- .join("");- const { md, DOMPurify } = deps.value;- const rendered = md.render(formatted);- const html = DOMPurify.sanitize(rendered);- return html;- });-- const renderedContent = computed(() => {- if (!deps.value) return "";- const content = rawRenderedContent.value;-- const { codeStyle, markdownStyle, resizeObserverScript } = deps.value;-- return [- `<head>`,- `<style>${codeStyle}</style>`,- `<style>${markdownStyle}</style>`,- `</head>`,- `<body style="overflow: auto;" class="markdown-body">`,- content,- `</body>`,- `<script>${resizeObserverScript}</script>`,- ].join("\n");- });-- watchEffect(() => {- const iframe = iframeRef.value;- if (!iframe) return;- const win = iframe.contentWindow;- if (!win) return;- win.name = windowName;- });-- useEventListener("message", (e: MessageEvent) => {- if (e.data?.source !== "bb.markdown.renderer") return;- if (e.data.key !== windowName) return;- const iframe = iframeRef.value;- if (!iframe) return;- const win = iframe.contentWindow;- if (!win) return;- const height = (e.data.height as number) ?? 0;- const normalizedHeight = minmax(- height,- mergedOptions.minHeight,- mergedOptions.maxHeight- );- iframe.style.height = `${normalizedHeight + 2}px`;- });-- const ready = computed(() => {- return !!deps.value;- });- return { ready, renderedContent };-};diff --git a/frontend/src/components/Member/MembersBindingSelect.vue b/frontend/src/components/Member/MembersBindingSelect.vuedeleted file mode 100644index 2d1bbbfd8d..0000000000--- a/frontend/src/components/Member/MembersBindingSelect.vue+++ /dev/null@@ -1,115 +0,0 @@-<template>- <div class="w-full flex flex-col gap-y-2">- <i18n-t- v-if="projectName"- keypath="settings.members.select-in-project"- tag="span"- class="textinfolabel"- >- <template #project>- <span class="font-semibold">{{ projectName }}</span>- </template>- </i18n-t>- <div- class="w-full flex flex-col gap-y-2"- >- <div class="flex text-main items-center gap-x-1">- {{ $t("settings.members.select-account", 2 /* multiply*/) }}- <RequiredStar v-if="required" />- <NTooltip style="max-width: 20rem">- <template #trigger>- <CircleHelpIcon class="w-4 textinfolabel" />- </template>- <span>- {{ $t("settings.members.select-account-hint") }}- </span>- </NTooltip>- </div>- <AccountSelect- key="account-select"- :value="memberList"- :multiple="true"- :disabled="disabled"- :project-name="projectName"- :include-all-users="includeAllUsers"- :include-service-account="includeServiceAccount"- :include-workload-identity="includeWorkloadIdentity"- :allow-arbitrary-email="allowArbitraryEmail"- @update:value="onMemberListUpdate($event as string[])"- />- </div>- </div>-</template>--<script setup lang="ts">-import { uniq } from "lodash-es";-import { CircleHelpIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import RequiredStar from "@/components/RequiredStar.vue";-import { AccountSelect } from "@/components/v2";-import {- extractGroupEmail,- extractServiceAccountId,- extractUserEmail,- extractWorkloadIdentityId,- groupNamePrefix,- serviceAccountNamePrefix,- workloadIdentityNamePrefix,-} from "@/store";-import {- getGroupEmailInBinding,- getServiceAccountNameInBinding,- getUserEmailInBinding,- getWorkloadIdentityNameInBinding,-} from "@/types";-import { convertMemberToFullname } from "@/utils";--const props = defineProps<{- // member binding list, could be- // - user:{email}- // - group:{email}- // - serviceAccount:{email}- // - workloadIdentity:{email}- value: string[];- required: boolean;- projectName?: string;- disabled?: boolean;- includeAllUsers: boolean;- includeServiceAccount: boolean;- includeWorkloadIdentity: boolean;- allowArbitraryEmail?: boolean;-}>();--const emit = defineEmits<{- (event: "update:value", memberList: string[]): void;-}>();--const memberList = computed(() => {- return props.value.map(convertMemberToFullname);-});--const convertFullnameToMember = (fullname: string) => {- if (fullname.startsWith(groupNamePrefix)) {- const email = extractGroupEmail(fullname);- return getGroupEmailInBinding(email);- } else if (fullname.startsWith(serviceAccountNamePrefix)) {- const email = extractServiceAccountId(fullname);- return getServiceAccountNameInBinding(email);- } else if (fullname.startsWith(workloadIdentityNamePrefix)) {- const email = extractWorkloadIdentityId(fullname);- return getWorkloadIdentityNameInBinding(email);- } else {- const email = extractUserEmail(fullname);- return getUserEmailInBinding(email);- }-};--const onMemberListUpdate = (fullnameList: string[]) => {- const memberListInBinding = uniq(fullnameList)- .map(convertFullnameToMember)- .filter((member) => !!member);-- emit("update:value", memberListInBinding);-};-</script>diff --git a/frontend/src/components/MonacoEditor/themes/bb-dark.ts b/frontend/src/components/MonacoEditor/themes/bb-dark.tsdeleted file mode 100644index 5b35262e8a..0000000000--- a/frontend/src/components/MonacoEditor/themes/bb-dark.ts+++ /dev/null@@ -1,23 +0,0 @@-import type { editor as Editor } from "monaco-editor";-import { callCssVariable } from "@/utils";--export const getBBDarkTheme = (): Editor.IStandaloneThemeData => ({- base: "vs-dark",- inherit: true,- rules: [- {- foreground: callCssVariable("--color-matrix-green-hover"),- token: "keyword",- },- ],- colors: {- "editor.foreground": callCssVariable("--color-matrix-green"),- "editorCursor.foreground": callCssVariable("--color-matrix-green-hover"),- "editorLineNumber.foreground": callCssVariable("--color-matrix-green"),- "editorLineNumber.activeForeground": callCssVariable(- "--color-matrix-green-hover"- ),- "editor.wordHighlightBackground": "#00000000",- "editor.wordHighlightStrongBackground": "#00000000",- },-});diff --git a/frontend/src/components/MonacoEditor/themes/bb.ts b/frontend/src/components/MonacoEditor/themes/bb.tsdeleted file mode 100644index d39bcab798..0000000000--- a/frontend/src/components/MonacoEditor/themes/bb.ts+++ /dev/null@@ -1,18 +0,0 @@-import type { editor as Editor } from "monaco-editor";-import { callCssVariable } from "@/utils";--export const getBBTheme = (): Editor.IStandaloneThemeData => ({- base: "vs",- inherit: true,- rules: [],- colors: {- "editor.background": "#fffffe00",- "editorCursor.foreground": callCssVariable("--color-accent"),- "editorLineNumber.foreground": callCssVariable(- "--color-control-placeholder"- ),- "editorLineNumber.activeForeground": callCssVariable("--color-main"),- "editor.wordHighlightBackground": "#00000000",- "editor.wordHighlightStrongBackground": "#00000000",- },-});diff --git a/frontend/src/components/PackageDataTable.vue b/frontend/src/components/PackageDataTable.vuedeleted file mode 100644index 6932d480b1..0000000000--- a/frontend/src/components/PackageDataTable.vue+++ /dev/null@@ -1,73 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="packageList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :bordered="true"- :loading="loading"- :row-key="(p: PackageMetadata) => `${database.name}.${schemaName}.${p.name}`"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Database,- PackageMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { getInstanceResource, hasSchemaProperty } from "@/utils";-import EllipsisSQLView from "./EllipsisSQLView.vue";--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- packageList: PackageMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const engine = computed(() => getInstanceResource(props.database).engine);--const columns = computed(() => {- const columns: (DataTableColumn<PackageMetadata> & { hide?: boolean })[] = [- {- key: "name",- title: t("common.name"),- width: 240,- resizable: true,- minWidth: 120,- render: (row) => {- return getPackageName(row.name);- },- },- {- key: "definition",- title: t("common.definition"),- render: (row) => {- return <EllipsisSQLView sql={row.definition} />;- },- },- ];-- return columns.filter((column) => !column.hide);-});--const getPackageName = (packageName: string) => {- if (hasSchemaProperty(engine.value) && props.schemaName) {- return `"${props.schemaName}"."${packageName}"`;- }- return packageName;-};-</script>diff --git a/frontend/src/components/PartitionTablesDataTable.vue b/frontend/src/components/PartitionTablesDataTable.vuedeleted file mode 100644index ce24f0153f..0000000000--- a/frontend/src/components/PartitionTablesDataTable.vue+++ /dev/null@@ -1,111 +0,0 @@-<template>- <NDataTable- v-bind="$attrs"- :columns="dataTableColumns"- :data="dataTableRows"- :virtual-scroll="true"- :striped="true"- :max-height="640"- :row-key="(table: PartitionTableRowData) => table.name"- />-</template>--<script lang="ts" setup>-import { NDataTable } from "naive-ui";-import { computed, h } from "vue";-import { useI18n } from "vue-i18n";-import TextOverflowPopover from "@/components/misc/TextOverflowPopover.vue";-import type {- TableMetadata,- TablePartitionMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { TablePartitionMetadata_Type } from "@/types/proto-es/v1/database_service_pb";--type PartitionTableRowData = {- name: string;- type: string;- expression: string;- children: PartitionTableRowData[];-};--const props = defineProps<{- table: TableMetadata;- search?: string;-}>();--const { t } = useI18n();-const partitionTables = computed(() => props.table.partitions);--const dataTableColumns = computed(() => {- const NAME_COLUMN = {- title: t("common.name"),- key: "name",- resizable: true,- width: 140,- ellipsis: true,- };- const TYPE_COLUMN = {- title: t("common.type"),- key: "type",- resizable: true,- width: 140,- ellipsis: true,- };- const EXPRESSION_COLUMN = {- title: "Expression",- key: "expression",- resizable: true,- ellipsis: true,- render: (row: PartitionTableRowData) => {- return h(TextOverflowPopover, {- content: row.expression,- placement: "bottom",- lineWrap: false,- contentClass: "line-clamp-1 flex-1",- maxPopoverContentLength: 1000,- });- },- };-- return [NAME_COLUMN, TYPE_COLUMN, EXPRESSION_COLUMN].filter(- (column) => column- );-});--const dataTableRows = computed(() => {- const generateRows = (- partitionTables: TablePartitionMetadata[]- ): PartitionTableRowData[] => {- return partitionTables- .filter((table) =>- props.search- ? table.name.toLowerCase().includes(props.search?.toLowerCase())- : true- )- .map((table: TablePartitionMetadata) => {- return {- name: table.name,- type: stringifyPartitionTableType(table.type),- expression: table.expression,- children: generateRows(table.subpartitions),- };- });- };-- return generateRows(partitionTables.value);-});--const stringifyPartitionTableType = (- type: TablePartitionMetadata_Type-): string => {- if (type === TablePartitionMetadata_Type.HASH) {- return "HASH";- } else if (type === TablePartitionMetadata_Type.RANGE) {- return "RANGE";- } else if (type === TablePartitionMetadata_Type.LIST) {- return "LIST";- } else {- return "UNKNOWN";- }-};-</script>diff --git a/frontend/src/components/Plan/index.ts b/frontend/src/components/Plan/index.tsdeleted file mode 100644index f1104893b6..0000000000--- a/frontend/src/components/Plan/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./logic";diff --git a/frontend/src/components/Plan/logic/approval.ts b/frontend/src/components/Plan/logic/approval.tsdeleted file mode 100644index 31364869d6..0000000000--- a/frontend/src/components/Plan/logic/approval.ts+++ /dev/null@@ -1,19 +0,0 @@-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import { Issue_ApprovalStatus } from "@/types/proto-es/v1/issue_service_pb";--export const hasNoApprovalRequired = (issue: Issue | undefined): boolean => {- if (!issue) return false;- if (issue.approvalStatus === Issue_ApprovalStatus.CHECKING) return false;- const roles = issue.approvalTemplate?.flow?.roles ?? [];- return roles.length === 0;-};--export const isApprovalCompleted = (issue: Issue | undefined): boolean => {- if (!issue) return false;-- return (- issue.approvalStatus === Issue_ApprovalStatus.APPROVED ||- issue.approvalStatus === Issue_ApprovalStatus.SKIPPED ||- hasNoApprovalRequired(issue)- );-};diff --git a/frontend/src/components/Plan/logic/base.ts b/frontend/src/components/Plan/logic/base.tsdeleted file mode 100644index f331c1a385..0000000000--- a/frontend/src/components/Plan/logic/base.ts+++ /dev/null@@ -1,30 +0,0 @@-import Emittery from "emittery";-import { type ComputedRef, computed } from "vue";-import { State } from "@/types/proto-es/v1/common_pb";-import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";-import type { PlanContext, PlanEvents } from "./context";--export const useBasePlanContext = ({- plan,- issue,-}: Pick<PlanContext, "isCreating" | "plan" | "issue">): {- readonly: ComputedRef<boolean>;- events: PlanEvents;-} => {- const events: PlanEvents = new Emittery();-- const readonly = computed(() => {- if (plan.value.state === State.DELETED) {- return true;- }- if (issue?.value) {- return issue.value.status !== IssueStatus.OPEN;- }- return false;- });-- return {- readonly,- events,- };-};diff --git a/frontend/src/components/Plan/logic/context.ts b/frontend/src/components/Plan/logic/context.tsdeleted file mode 100644index bd36e72aea..0000000000--- a/frontend/src/components/Plan/logic/context.ts+++ /dev/null@@ -1,126 +0,0 @@-import type Emittery from "emittery";-import { v4 as uuidv4 } from "uuid";-import type { ComputedRef, InjectionKey, Ref } from "vue";-import { computed, inject, provide } from "vue";-import { useCurrentProjectV1, useCurrentUserV1 } from "@/store";-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import { type Project } from "@/types/proto-es/v1/project_service_pb";-import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";-import { hasProjectPermissionV2 } from "@/utils";--export type RefreshMode = "normal" | "fast-follow";--type IssueReviewAction = string;-type IssueStatusAction = string;--export type PlanEvents = Emittery<{- "status-changed": {- eager: boolean;- refreshMode?: RefreshMode;- };- "perform-issue-review-action": {- action: IssueReviewAction;- };- "perform-issue-status-action": { action: IssueStatusAction };- "resource-refresh-completed": {- resources: string[];- isManual: boolean;- };-}>;--export type PlanContext = {- // Basic fields- isCreating: Ref<boolean>;- plan: Ref<Plan>;- planCheckRuns: Ref<PlanCheckRun[]>;- issue: Ref<Issue | undefined>;- rollout: Ref<Rollout | undefined>;- taskRuns: Ref<TaskRun[]>;-- readonly: ComputedRef<boolean>;- allowEdit: ComputedRef<boolean>;- project: ComputedRef<Project>;- isCreator: ComputedRef<boolean>;-- // UI events- events: PlanEvents;-};--type InitPlanContext = Omit<PlanContext, "allowEdit" | "project" | "isCreator">;--const KEY = Symbol(`bb.plan.context.${uuidv4()}`) as InjectionKey<PlanContext>;--export const usePlanContext = () => {- const context = inject(KEY);- if (!context) {- throw new Error(- "usePlanContext must be called within a component that provides PlanContext"- );- }- return context;-};--export const emitPlanStatusChanged = (- events: PlanEvents,- options: {- eager?: boolean;- refreshMode?: RefreshMode;- } = {}-) => {- const { eager = true, refreshMode = "normal" } = options;- events.emit("status-changed", { eager, refreshMode });-};--export const tryUsePlanContext = () => {- return inject(KEY);-};--export const usePlanContextWithIssue = () => {- const context = inject(KEY)!;- if (!context.issue.value) {- throw new Error("Issue is required but not available in plan context");- }- return {- ...context,- issue: context.issue as Ref<Issue>,- };-};--export const usePlanContextWithRollout = () => {- const context = inject(KEY)!;- if (!context.rollout.value) {- throw new Error("Rollout is required but not available in plan context");- }- return {- ...context,- rollout: context.rollout as Ref<Rollout>,- taskRuns: context.taskRuns,- };-};--export const providePlanContext = (context: InitPlanContext) => {- const isCreator = computed(() => {- const currentUser = useCurrentUserV1();- return context.plan.value.creator === currentUser.value.name;- });-- const { project } = useCurrentProjectV1();-- const allowEdit = computed(() => {- if (isCreator.value) {- return true;- }- return hasProjectPermissionV2(project.value, "bb.plans.update");- });-- const planContext = {- ...context,- isCreator,- project,- allowEdit,- } as PlanContext;-- provide(KEY, planContext);- return planContext;-};diff --git a/frontend/src/components/Plan/logic/index.ts b/frontend/src/components/Plan/logic/index.tsdeleted file mode 100644index 7f8daf4596..0000000000--- a/frontend/src/components/Plan/logic/index.ts+++ /dev/null@@ -1,15 +0,0 @@-export * from "./context";-export * from "./approval";-export * from "./base";-export * from "./plan";-export * from "./initialize";-export * from "./sheet";-export * from "./plan-check";-export * from "./plan-check-status";-export * from "./useResolvedPlanCheckStatus";-export * from "./utils";-export * from "./sidebar";-export * from "./usePlanCheckStatus";-export * from "./usePlanLink";-export * from "./rolloutPreview";-export * from "./title";diff --git a/frontend/src/components/Plan/logic/initialize/create.ts b/frontend/src/components/Plan/logic/initialize/create.tsdeleted file mode 100644index 5717e1d7b6..0000000000--- a/frontend/src/components/Plan/logic/initialize/create.ts+++ /dev/null@@ -1,139 +0,0 @@-import { create as createProto } from "@bufbuild/protobuf";-import { head } from "lodash-es";-import { v4 as uuidv4 } from "uuid";-import { useRoute } from "vue-router";-import { useProjectV1Store } from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";-import {- Plan_ChangeDatabaseConfigSchema,- Plan_SpecSchema,- PlanSchema,-} from "@/types/proto-es/v1/plan_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { extractSheetUID, setSheetStatement } from "@/utils";-import { sheetNameForSpec, targetsForSpec } from "../plan";-import { getLocalSheetByName, getNextLocalSheetUID } from "../sheet";-import { extractInitialSQLFromQuery } from "./util";--type PlanTemplate = "bb.plan.change-database";--export type InitialSQL = {- sqlMap?: Record<string, string>;- sql?: string;-};--export type CreatePlanParams = {- project: Project;- template: PlanTemplate;- query: Record<string, string>;- initialSQL: InitialSQL;-};--const state = {- uid: -101,-};-const nextUID = () => {- return String(state.uid--);-};--export const createPlanSkeleton = 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 PlanTemplate | undefined;- if (!template || template !== "bb.plan.change-database") {- throw new Error(- "Only change-database plan creation is supported from the plan detail route."- );- }- const params: CreatePlanParams = {- project,- template,- query,- initialSQL: await extractInitialSQLFromQuery(query),- };- const plan = await buildPlan(params);- return plan;-};--export const buildPlan = async (params: CreatePlanParams) => {- const { project, query } = params;- const databaseNameList = (query.databaseList ?? "").split(",");- const plan = createProto(PlanSchema, {- name: `${project.name}/plans/${nextUID()}`,- title: query.name,- description: query.description,- });- const targets = query.databaseGroupName- ? [query.databaseGroupName]- : databaseNameList;- // If initialSQL.sqlMap is provided, we will use it to build multiple specs.- // Mainly used for sync schema.- const shouldUseMultiSpecs =- params.initialSQL.sqlMap &&- Object.keys(params.initialSQL.sqlMap).length > 0;- if (shouldUseMultiSpecs) {- for (const target of targets) {- const spec = await buildSpecForTargetsV1([target], params);- maybeSetInitialSQLForSpec(spec, params);- plan.specs.push(spec);- }- } else {- const spec = await buildSpecForTargetsV1(targets, params);- maybeSetInitialSQLForSpec(spec, params);- plan.specs = [spec];- }- return plan;-};--const buildSpecForTargetsV1 = async (- targets: string[],- { project, template }: CreatePlanParams,- sheetUID?: string-) => {- const sheet = `${project.name}/sheets/${sheetUID ?? getNextLocalSheetUID()}`;-- const spec = createProto(Plan_SpecSchema, {- id: uuidv4(),- });- switch (template) {- case "bb.plan.change-database": {- spec.config = {- case: "changeDatabaseConfig",- value: createProto(Plan_ChangeDatabaseConfigSchema, {- targets,- sheet,- enablePriorBackup: false,- }),- };- break;- }- }- return spec;-};--const maybeSetInitialSQLForSpec = (- spec: Plan_Spec,- params: CreatePlanParams-) => {- const sheet = sheetNameForSpec(spec);- if (!sheet) return;- const uid = extractSheetUID(sheet);- if (!uid.startsWith("-")) {- // If the sheet is a remote sheet, ignore initial SQL in URL query- return;- }- const target = head(targetsForSpec(spec));- // Priority: sqlMap[key] -> sql -> nothing- const sql =- params.initialSQL.sqlMap?.[target || ""] ?? params.initialSQL.sql ?? "";- if (sql) {- const sheetEntity = getLocalSheetByName(sheet);- setSheetStatement(sheetEntity, sql);- }-};diff --git a/frontend/src/components/Plan/logic/initialize/index.ts b/frontend/src/components/Plan/logic/initialize/index.tsdeleted file mode 100644index c5fe8ebe18..0000000000--- a/frontend/src/components/Plan/logic/initialize/index.ts+++ /dev/null@@ -1,277 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { ConnectError, Code } from "@connectrpc/connect";-import { computed, ref, unref, watch, type MaybeRef } from "vue";-import { useRoute, useRouter, type LocationQuery } from "vue-router";-import {- issueServiceClientConnect,- rolloutServiceClientConnect,-} from "@/connect";-import { projectNamePrefix, usePlanStore } from "@/store";-import { UNKNOWN_ID } from "@/types";-import {- GetIssueRequestSchema,- Issue_Type,-} from "@/types/proto-es/v1/issue_service_pb";-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import { GetRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";-import { getRolloutFromPlan, extractPlanNameFromRolloutName } from "@/utils";-import { unknownPlan } from "@/types/v1/issue/plan";-import { createPlanSkeleton } from "./create";-import {- WORKSPACE_ROUTE_403,- WORKSPACE_ROUTE_404,-} from "@/router/dashboard/workspaceRoutes";--export * from "./create";--export * from "./util";--const shouldLoadRolloutForPlan = (plan: Plan) => {- return plan.hasRollout;-};--export function useInitializePlan(- projectId: MaybeRef<string>,- planId: MaybeRef<string | undefined>,- issueId?: MaybeRef<string | undefined>,- legacyRolloutId?: MaybeRef<string | undefined>-) {- const isCreating = computed(() => {- const id = unref(planId) || unref(issueId) || unref(legacyRolloutId);- return id?.toLowerCase() === "create";- });-- const uid = computed(() => {- // If planId is provided, use it directly- if (unref(planId)) {- const id = unref(planId)!;- if (id.toLowerCase() === "create") return "create";- const uid = Number(id);- if (uid > 0) return String(uid);- return String(UNKNOWN_ID);- }- // Otherwise, if legacyRolloutId is provided, we'll fetch the plan from the rollout- if (unref(legacyRolloutId)) {- const id = unref(legacyRolloutId)!;- if (id.toLowerCase() === "create") return "create";- // For rollout-based initialization, return a special marker- return `rollout:${id}`;- }- // Otherwise, if issueId is provided, we'll fetch the plan from the issue- if (unref(issueId)) {- const id = unref(issueId)!;- if (id.toLowerCase() === "create") return "create";- // For issue-based initialization, return a special marker- return `issue:${id}`;- }- return String(UNKNOWN_ID);- });-- const route = useRoute();- const router = useRouter();- const planStore = usePlanStore();- const isInitializing = ref(true);-- const plan = ref<Plan>(unknownPlan());- const planCheckRuns = ref<PlanCheckRun[]>([]);- const issue = ref<Issue | undefined>(undefined);- const rollout = ref<Rollout | undefined>(undefined);- const taskRuns = ref<TaskRun[]>([]);-- const runner = async (uid: string, projectId: string, url: string) => {- let planResult: Plan;- let issueResult: Issue | undefined = undefined;- let rolloutResult: Rollout | undefined = undefined;-- if (uid === "create") {- // Creating a new plan- planResult = await createPlanSkeleton(- route,- convertRouterQuery(router.resolve(url).query)- );- } else if (uid.startsWith("rollout:")) {- // Fetch plan from rollout- const planUid = uid.substring(8);- const rolloutRequest = create(GetRolloutRequestSchema, {- name: `${projectNamePrefix}${projectId}/plans/${planUid}/rollout`,- });-- const newRollout =- await rolloutServiceClientConnect.getRollout(rolloutRequest);- rolloutResult = newRollout;-- // Extract plan name from rollout name- const planName = extractPlanNameFromRolloutName(rolloutResult.name);- if (!planName) {- throw new Error(- `Rollout ${planUid} does not have a valid plan reference in its name`- );- }-- // Fetch the plan using the extracted plan name- planResult = await planStore.fetchPlanByName(planName);-- // Fetch the associated issue if it exists via the plan- if (planResult.issue) {- try {- const issueRequest = create(GetIssueRequestSchema, {- name: planResult.issue,- });- const newIssue =- await issueServiceClientConnect.getIssue(issueRequest);- issueResult = newIssue;- } catch {- // Issue might not exist or we don't have permission, that's ok- }- }- } else if (uid.startsWith("issue:")) {- // Fetch plan from issue- const issueUid = uid.substring(6);- const request = create(GetIssueRequestSchema, {- name: `${projectNamePrefix}${projectId}/issues/${issueUid}`,- });-- const newIssue = await issueServiceClientConnect.getIssue(request);- issueResult = newIssue;-- if (!issueResult.plan) {- // Issue without plan - allow it to stay in CICD layout for issue-only view- // This is expected for grant requests, but may indicate a problem for other issue types- if (- issueResult.type !== Issue_Type.ROLE_GRANT &&- issueResult.type !== Issue_Type.ACCESS_GRANT- ) {- console.warn(- `Issue ${issueUid} of type ${issueResult.type} has no associated plan`,- issueResult- );- }- return {- plan: unknownPlan(),- issue: issueResult,- rollout: undefined,- url,- };- }-- // Fetch the plan using the issue's plan reference- planResult = await planStore.fetchPlanByName(issueResult.plan);-- if (shouldLoadRolloutForPlan(planResult)) {- try {- const rolloutName = getRolloutFromPlan(planResult.name);- const rolloutRequest = create(GetRolloutRequestSchema, {- name: rolloutName,- });- const newRollout =- await rolloutServiceClientConnect.getRollout(rolloutRequest);- rolloutResult = newRollout;- } catch (error) {- console.error("Failed to fetch rollout:", error);- // Rollout might not exist yet, that's ok- rolloutResult = undefined;- }- }- } else {- // Direct plan ID- planResult = await planStore.fetchPlanByName(- `${projectNamePrefix}${projectId}/plans/${uid}`- );-- // If we have a plan, try to fetch the associated issue if it exists- if (planResult.issue) {- const request = create(GetIssueRequestSchema, {- name: planResult.issue,- });- const newIssue = await issueServiceClientConnect.getIssue(request);- issueResult = newIssue;- }-- if (shouldLoadRolloutForPlan(planResult)) {- try {- const rolloutName = getRolloutFromPlan(planResult.name);- const rolloutRequest = create(GetRolloutRequestSchema, {- name: rolloutName,- });- const newRollout =- await rolloutServiceClientConnect.getRollout(rolloutRequest);- rolloutResult = newRollout;- } catch (error) {- console.error("Failed to fetch rollout:", error);- // Rollout might not exist yet, that's ok- rolloutResult = undefined;- }- }- }-- return {- plan: planResult,- issue: issueResult,- rollout: rolloutResult,- url,- };- };-- watch(- [uid, () => unref(projectId)],- async ([uid, projectId]) => {- if (uid === String(UNKNOWN_ID)) {- router.push({ name: WORKSPACE_ROUTE_404 });- return;- }- const url = route.fullPath;- isInitializing.value = true;-- try {- const result = await runner(uid, projectId, url);- if (result.url !== route.fullPath) {- // the url changed, drop the outdated result- return;- }- plan.value = result.plan;- issue.value = result.issue;- rollout.value = result.rollout;- isInitializing.value = false;- } catch (error: unknown) {- // Check Connect error type and handle accordingly- if (error instanceof ConnectError) {- if (error.code === Code.NotFound) {- router.push({ name: WORKSPACE_ROUTE_404 });- } else if (error.code === Code.PermissionDenied) {- router.push({ name: WORKSPACE_ROUTE_403 });- }- isInitializing.value = false;- return;- }-- isInitializing.value = false;- console.error("Error initializing plan:", error);- throw error;- }- },- { immediate: true }- );-- return {- isCreating,- plan,- planCheckRuns,- taskRuns,- issue,- rollout,- isInitializing,- };-}--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/Plan/logic/initialize/util.ts b/frontend/src/components/Plan/logic/initialize/util.tsdeleted file mode 100644index 997ad282ab..0000000000--- a/frontend/src/components/Plan/logic/initialize/util.ts+++ /dev/null@@ -1,57 +0,0 @@-import { useSheetV1Store, useStorageStore } from "@/store";-import type { Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";-import { extractSheetUID, getSheetStatement } from "@/utils";-import { sheetNameForSpec } from "../plan";-import { getLocalSheetByName } from "../sheet";-import type { InitialSQL } from "./create";--export const extractInitialSQLFromQuery = async (- query: Record<string, string>-): Promise<InitialSQL> => {- const storageStore = useStorageStore();- const sql = query.sql;- if (sql && typeof sql === "string") {- return {- sql,- };- }- const sqlStorageKey = query.sqlStorageKey;- if (sqlStorageKey && typeof sqlStorageKey === "string") {- const sql = (await storageStore.get<string>(sqlStorageKey)) || "";- return {- sql,- };- }- const sqlMapStorageKey = query.sqlMapStorageKey;- if (sqlMapStorageKey && typeof sqlMapStorageKey === "string") {- const sqlMap =- (await storageStore.get<Record<string, string>>(sqlMapStorageKey)) || {};- return { sqlMap };- }- return {};-};--export const isValidSpec = (spec: Plan_Spec): boolean => {- if (spec.config?.case === "changeDatabaseConfig") {- const sheetName = sheetNameForSpec(spec);- if (!sheetName) {- return false;- }- 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/Plan/logic/plan-check-status.ts b/frontend/src/components/Plan/logic/plan-check-status.tsdeleted file mode 100644index 9211f83221..0000000000--- a/frontend/src/components/Plan/logic/plan-check-status.ts+++ /dev/null@@ -1,77 +0,0 @@-import {- type PlanCheckRun,- PlanCheckRun_Status,-} from "@/types/proto-es/v1/plan_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";--/**- * Counts derived from `PlanCheckRun[]` (same shape as API `planCheckRunStatusCount` aggregates).- *- * Cost is O(total `results` across runs). The API returns one consolidated run per plan- * (`refreshPlanCheckRuns` stores `[response]`), so the dominant size is `run.results.length`,- * not the number of runs.- */-export interface PlanCheckStatusSummary {- running: number;- success: number;- warning: number;- error: number;- total: number;-}--export const EMPTY_PLAN_CHECK_STATUS_SUMMARY: PlanCheckStatusSummary = {- running: 0,- success: 0,- warning: 0,- error: 0,- total: 0,-};--/**- * Counts advice rows plus run-level RUNNING / FAILED, matching ChecksView grouping logic.- */-export function computePlanCheckStatusSummary(- runs: PlanCheckRun[]-): PlanCheckStatusSummary {- let running = 0;- let success = 0;- let warning = 0;- let error = 0;-- for (const checkRun of runs) {- if (checkRun.status === PlanCheckRun_Status.RUNNING) {- running++;- }- if (checkRun.status === PlanCheckRun_Status.FAILED) {- error++;- }- for (const result of checkRun.results) {- if (result.status === Advice_Level.ERROR) {- error++;- } else if (result.status === Advice_Level.WARNING) {- warning++;- } else if (result.status === Advice_Level.SUCCESS) {- success++;- }- }- }-- const total = running + success + warning + error;- return { running, success, warning, error, total };-}--/** Worst level for icon / badge emphasis (mirrors `usePlanCheckStatus` plan-level rules). */-export function overallAdviceLevelFromPlanCheckSummary(- summary: PlanCheckStatusSummary-): Advice_Level {- if (summary.error > 0) {- return Advice_Level.ERROR;- }- if (summary.warning > 0) {- return Advice_Level.WARNING;- }- if (summary.success > 0) {- return Advice_Level.SUCCESS;- }- return Advice_Level.SUCCESS;-}diff --git a/frontend/src/components/Plan/logic/plan-check.ts b/frontend/src/components/Plan/logic/plan-check.tsdeleted file mode 100644index 538543771c..0000000000--- a/frontend/src/components/Plan/logic/plan-check.ts+++ /dev/null@@ -1,88 +0,0 @@-import { flatten } from "lodash-es";-import { useDBGroupStore } from "@/store";-import { isValidDatabaseGroupName, isValidDatabaseName } from "@/types";-import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";-import {- type Plan_Spec,- type PlanCheckRun,- PlanCheckRun_Status,-} from "@/types/proto-es/v1/plan_service_pb";--/** Spec targets and slicing consolidated plan check runs per change. Counts: `plan-check-status.ts`. */--export const planSpecHasPlanChecks = (spec: Plan_Spec) => {- if (spec.config?.case === "changeDatabaseConfig") {- return true;- }- return false;-};--// flattenTargetsOfSpec flattens the targets of a plan spec, which can be a mix of database names and database group names.-export const flattenTargetsOfSpec = (spec: Plan_Spec): string[] => {- let rawTargets: string[] = [];- if (spec.config.case === "changeDatabaseConfig") {- rawTargets = spec.config.value.targets || [];- }- if (spec.config.case === "exportDataConfig") {- rawTargets = spec.config.value.targets || [];- }- const targets = flatten(- rawTargets.map((target) => {- if (isValidDatabaseName(target)) {- return target;- }- if (isValidDatabaseGroupName(target)) {- const dbGroup = useDBGroupStore().getDBGroupByName(- target,- DatabaseGroupView.FULL- );- return dbGroup?.matchedDatabases.map((db) => db.name);- }- return target;- })- ).filter(Boolean) as string[];- return targets;-};--/**- * Returns plan check runs scoped to `spec`: each run keeps only `results` whose- * `target` is in this spec’s flattened database list. Handles consolidated- * in-memory runs (one API row per plan with all databases).- */-export const planCheckRunListForSpec = (- planCheckRunList: PlanCheckRun[],- spec: Plan_Spec-): PlanCheckRun[] => {- const targets = flattenTargetsOfSpec(spec);- if (targets.length === 0) {- return [];- }-- // Set lookup: spec can list many DBs; consolidated runs can have huge `results`.- const targetSet = new Set(targets);-- return planCheckRunList.flatMap((run) => {- const matchingResults = run.results.filter((result) =>- targetSet.has(result.target)- );-- if (matchingResults.length > 0) {- return [{ ...run, results: matchingResults }];- }-- // In progress: no per-target rows yet.- if (- run.status === PlanCheckRun_Status.RUNNING &&- run.results.length === 0- ) {- return [{ ...run, results: [] }];- }-- // Run-level failure with no per-target breakdown.- if (run.status === PlanCheckRun_Status.FAILED && run.results.length === 0) {- return [{ ...run, results: [] }];- }-- return [];- });-};diff --git a/frontend/src/components/Plan/logic/plan.ts b/frontend/src/components/Plan/logic/plan.tsdeleted file mode 100644index 78105e6f2b..0000000000--- a/frontend/src/components/Plan/logic/plan.ts+++ /dev/null@@ -1,112 +0,0 @@-import { head } from "lodash-es";-import { useDatabaseV1Store, useDBGroupStore } from "@/store";-import {- isValidDatabaseGroupName,- isValidDatabaseName,- unknownDatabase,-} from "@/types";-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 { getInstanceResource, mockDatabase } from "@/utils";--export const databaseForSpec = (project: Project, spec: Plan_Spec) => {- const targets = targetsForSpec(spec);- if (targets.length === 0) {- return unknownDatabase();- }- const db = useDatabaseV1Store().getDatabaseByName(targets[0]);- if (!isValidDatabaseName(db.name)) {- return mockDatabase(project, targets[0]);- }- return db;-};--/**- *- * @returns empty string if no sheet found- */-export const sheetNameForSpec = (spec: Plan_Spec): string => {- if (spec.config.case === "changeDatabaseConfig") {- return spec.config.value.sheet ?? "";- }- if (spec.config.case === "exportDataConfig") {- return spec.config.value.sheet ?? "";- }- return "";-};--export const databaseEngineForSpec = async (- specOrTarget?: Plan_Spec | string-) => {- if (!specOrTarget) return Engine.ENGINE_UNSPECIFIED;-- const getTarget = (specOrTarget: Plan_Spec | string) => {- if (typeof specOrTarget === "string") {- return specOrTarget;- }- const targets = targetsForSpec(specOrTarget);- return head(targets);- };-- const target = getTarget(specOrTarget);- if (!target) return Engine.ENGINE_UNSPECIFIED;- if (isValidDatabaseName(target)) {- const db = await useDatabaseV1Store().getOrFetchDatabaseByName(- target,- true /* silent */- );- return getInstanceResource(db).engine;- }- if (isValidDatabaseGroupName(target)) {- const dbGroupStore = useDBGroupStore();- const dbGroup = await dbGroupStore.getOrFetchDBGroupByName(target, {- view: DatabaseGroupView.FULL,- });- // Might be flaky: use the first database in the db group- const dbName = head(dbGroup.matchedDatabases)?.name;- if (dbName) {- const db = await useDatabaseV1Store().getOrFetchDatabaseByName(- dbName,- /* silent */ true- );- if (isValidDatabaseName(db.name)) {- return getInstanceResource(db).engine;- }- }- }- return Engine.ENGINE_UNSPECIFIED;-};--export const isDatabaseChangeSpec = (spec?: Plan_Spec) => {- if (!spec) return false;- if (- spec.config.case === "changeDatabaseConfig" ||- spec.config.case === "exportDataConfig"- ) {- return targetsForSpec(spec).every(isValidDatabaseName);- }- return false;-};--export const isDBGroupChangeSpec = (spec?: Plan_Spec) => {- if (!spec) return false;- if (- spec.config.case === "changeDatabaseConfig" ||- spec.config.case === "exportDataConfig"- ) {- return targetsForSpec(spec).every(isValidDatabaseGroupName);- }- return false;-};--export const targetsForSpec = (spec: Plan_Spec): string[] => {- if (spec.config?.case === "changeDatabaseConfig") {- return spec.config.value.targets || [];- }- if (spec.config?.case === "exportDataConfig") {- return spec.config.value.targets || [];- }- return [];-};diff --git a/frontend/src/components/Plan/logic/poller/index.ts b/frontend/src/components/Plan/logic/poller/index.tsdeleted file mode 100644index 9facdfd7a9..0000000000--- a/frontend/src/components/Plan/logic/poller/index.ts+++ /dev/null@@ -1 +0,0 @@-export { provideResourcePoller, useResourcePoller } from "./poller";diff --git a/frontend/src/components/Plan/logic/poller/poller.ts b/frontend/src/components/Plan/logic/poller/poller.tsdeleted file mode 100644index 94c622f175..0000000000--- a/frontend/src/components/Plan/logic/poller/poller.ts+++ /dev/null@@ -1,502 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { includes, uniq } from "lodash-es";-import { v4 as uuidv4 } from "uuid";-import {- computed,- type InjectionKey,- inject,- provide,- ref,- watch,- watchEffect,-} from "vue";-import { useRoute } from "vue-router";-import { useProgressivePoll } from "@/composables/useProgressivePoll";-import {- PROJECT_V1_ROUTE_ISSUE_DETAIL,- PROJECT_V1_ROUTE_PLAN_DETAIL,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,-} from "@/router/dashboard/projectV1";-import { getRouteQueryString } from "@/router/dashboard/projectV1RouteHelpers";-import { useCurrentProjectV1 } from "@/store";-import { isValidRolloutName } from "@/types";-import { IssueSchema } from "@/types/proto-es/v1/issue_service_pb";-import {- RolloutSchema,- Task_Status,-} from "@/types/proto-es/v1/rollout_service_pb";-import {- getRolloutFromPlan,- isValidIssueName,- isValidPlanName,- sleep,-} from "@/utils";-import { usePlanContext } from "../context";-import {- refreshIssue,- refreshPlan,- refreshPlanCheckRuns,- refreshRollout,- refreshTaskRuns,- type TaskRunScope,-} from "./utils";--type ResourceType = "plan" | "planCheckRuns" | "issue" | "rollout" | "taskRuns";--// CI/CD-style polling: quick follow-up after user actions, then progressive backoff.-const POLLER_INTERVAL = { min: 1000, max: 30000, growth: 2, jitter: 250 };-const FAST_FOLLOW_REFRESH_DELAYS = [500, 1500, 3000];--const KEY = Symbol(- `bb.plan.poller.${uuidv4()}`-) as InjectionKey<ResourcePollerContext>;--// Resource refresh strategies-interface ResourceRefreshStrategy {- canRefresh: () => boolean;- refresh: () => Promise<void>;- canInitialize?: () => boolean;- initialize?: () => Promise<void>;-}--export const provideResourcePoller = () => {- const route = useRoute();- const { project } = useCurrentProjectV1();- const { isCreating, plan, planCheckRuns, taskRuns, issue, rollout, events } =- usePlanContext();-- // Extract stage/task scope from route params for scoped taskRuns polling- const taskRunScope = computed<TaskRunScope | undefined>(() => {- const stageId =- getRouteQueryString(route.query.stageId) ||- (route.params.stageId as string | undefined);- const taskId =- getRouteQueryString(route.query.taskId) ||- (route.params.taskId as string | undefined);- if (!stageId) return undefined;- return { stageId, taskId };- });-- // Consolidated state management- const pollerState = ref({- isRefreshing: false,- lastRefreshTime: 0,- hasInitialRefresh: false,- hasInitialResourceSetup: false,- isPollerRunning: false,- isInitializing: false, // Track if initialization is in progress- });- let actionRefreshSequenceId = 0;-- // Define refresh strategies for each resource- const resourceStrategies: Record<ResourceType, ResourceRefreshStrategy> = {- plan: {- canRefresh: () => !!plan.value && isValidPlanName(plan.value.name),- refresh: () => refreshPlan(plan),- },- planCheckRuns: {- canRefresh: () =>- !!plan.value && isValidPlanName(plan.value.name) && !!planCheckRuns,- refresh: () =>- refreshPlanCheckRuns(plan.value, project.value, planCheckRuns),- },- issue: {- canRefresh: () => !!issue?.value,- refresh: () => refreshIssue(issue),- canInitialize: () =>- !!(plan.value?.issue && isValidIssueName(plan.value.issue)),- initialize: async () => {- if (!plan.value?.issue) return;- issue.value = create(IssueSchema, { name: plan.value.issue });- await resourceStrategies.issue.refresh();- },- },- rollout: {- canRefresh: () =>- !!plan.value?.name && !!rollout && !!plan.value.hasRollout,- refresh: () => {- const rolloutName = getRolloutFromPlan(plan.value.name);- return refreshRollout(rolloutName, project.value, rollout);- },- canInitialize: () => {- if (!plan.value?.name) return false;- if (!plan.value.hasRollout) return false;- const rolloutName = getRolloutFromPlan(plan.value.name);- return isValidRolloutName(rolloutName);- },- initialize: async () => {- if (!plan.value?.name) return;- if (!plan.value.hasRollout) return;- const rolloutName = getRolloutFromPlan(plan.value.name);- rollout.value = create(RolloutSchema, { name: rolloutName });- await resourceStrategies.rollout.refresh();- },- },- taskRuns: {- canRefresh: () => !!rollout?.value && !!taskRuns,- refresh: () => {- if (!rollout.value) return Promise.resolve();- return refreshTaskRuns(- rollout.value,- project.value,- taskRuns,- taskRunScope.value- );- },- },- };-- const planType = computed(() => {- // Empty plan or no specs - default to CHANGE_DATABASE- if (plan.value.specs.length === 0) {- return "CHANGE_DATABASE";- }-- if (- plan.value.specs.every(- (spec) => spec.config.case === "createDatabaseConfig"- )- ) {- return "CREATE_DATABASE";- } else if (- plan.value.specs.every((spec) => spec.config.case === "exportDataConfig")- ) {- return "EXPORT_DATA";- }- return "CHANGE_DATABASE";- });-- const resourcesFromRoute = computed<ResourceType[]>(() => {- if (isCreating.value) return [];-- const routeName = route.name as string;- const planSpecRoutes = [- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,- ];-- // Plan Detail Page (unified view) — poll all resources- if (routeName === PROJECT_V1_ROUTE_PLAN_DETAIL) {- return ["plan", "planCheckRuns", "issue", "rollout", "taskRuns"];- }- // Plan spec routes still render the unified Plan Detail page.- if (includes(planSpecRoutes, routeName)) {- return ["plan", "planCheckRuns", "issue", "rollout", "taskRuns"];- }- if (includes([PROJECT_V1_ROUTE_ISSUE_DETAIL], routeName)) {- if (planType.value === "CHANGE_DATABASE") {- return ["plan", "issue"];- } else {- // For CREATE_DATABASE and EXPORT_DATA plans, we use the issue page to show the rollout and task runs.- return ["plan", "issue", "rollout", "taskRuns"];- }- }-- return ["plan", "planCheckRuns", "issue", "rollout", "taskRuns"];- });-- const resourcesToPolled = computed(() => uniq([...resourcesFromRoute.value]));-- const isPlanDone = computed(() => {- if (!rollout.value) return false;- const allTasks = rollout.value.stages.flatMap((stage) => stage.tasks);- return (- allTasks.length > 0 &&- allTasks.every(- (task) =>- task.status === Task_Status.DONE ||- task.status === Task_Status.SKIPPED- )- );- });-- // Initialize existing resources that are already on the plan- const initializeExistingResources = async () => {- if (- pollerState.value.hasInitialResourceSetup ||- pollerState.value.isInitializing ||- isCreating.value ||- !plan.value- ) {- return;- }-- pollerState.value.isInitializing = true;- try {- pollerState.value.hasInitialResourceSetup = true;- const initPromises: Promise<void>[] = [];-- // Initialize issue if needed- if (- resourceStrategies.issue.canInitialize?.() &&- resourceStrategies.issue.initialize- ) {- initPromises.push(resourceStrategies.issue.initialize());- }-- // Initialize rollout and taskRuns with proper sequencing- if (- resourceStrategies.rollout.canInitialize?.() &&- resourceStrategies.rollout.initialize- ) {- initPromises.push(- resourceStrategies.rollout.initialize().then(async () => {- if (resourceStrategies.taskRuns.canRefresh()) {- await resourceStrategies.taskRuns.refresh();- }- })- );- }-- if (initPromises.length > 0) {- await Promise.all(initPromises);- events.emit("status-changed", { eager: true });- }- } finally {- pollerState.value.isInitializing = false;- }- };-- // Unified refresh function (with backward compatibility)- const refreshResources = async (- resources: ResourceType[] = resourcesToPolled.value,- optionsOrForce: { force?: boolean; isManual?: boolean } | boolean = {}- ) => {- // Handle backward compatibility for boolean force parameter- const options =- typeof optionsOrForce === "boolean"- ? { force: optionsOrForce, isManual: true }- : optionsOrForce;- const { force = false, isManual = false } = options;-- if ((resources.length === 0 || pollerState.value.isRefreshing) && !force) {- return;- }-- pollerState.value.isRefreshing = true;- const refreshPromises: Promise<void>[] = [];-- try {- for (const resourceType of resources) {- const strategy = resourceStrategies[resourceType];- if (strategy.canRefresh()) {- refreshPromises.push(strategy.refresh());- }- }-- await Promise.all(refreshPromises);-- pollerState.value.lastRefreshTime = Date.now();- events.emit("resource-refresh-completed", { resources, isManual });- } finally {- pollerState.value.isRefreshing = false;- }-- if (force) {- resourcePoller.restart();- }- };-- const scheduleFastFollowRefreshes = (resources: ResourceType[]) => {- const sequenceId = ++actionRefreshSequenceId;-- void (async () => {- for (const retryDelay of FAST_FOLLOW_REFRESH_DELAYS) {- await sleep(retryDelay);- if (sequenceId !== actionRefreshSequenceId) {- return;- }- await refreshResources(resources, {- force: true,- isManual: false,- });- }- })();- };-- // Create the poller- const resourcePoller = useProgressivePoll(refreshResources, {- interval: POLLER_INTERVAL,- });-- // Reset poller state- const resetPollerState = () => {- pollerState.value.hasInitialRefresh = false;- pollerState.value.hasInitialResourceSetup = false;- pollerState.value.isPollerRunning = false;- };-- // Restart poller with clean state- const restartPoller = () => {- const shouldPoll =- !isCreating.value &&- !isPlanDone.value &&- resourcesToPolled.value.length > 0;- if (!shouldPoll) return;-- resourcePoller.stop();- resetPollerState();- resourcePoller.start();- pollerState.value.isPollerRunning = true;- };-- // Watch for route changes and restart poller when resources change- watch(- resourcesToPolled,- (newResources, oldResources) => {- if (!oldResources || newResources.length === 0) return;-- const newSorted = [...newResources].sort();- const oldSorted = [...oldResources].sort();- const resourcesChanged =- newSorted.length !== oldSorted.length ||- newSorted.some((resource, index) => resource !== oldSorted[index]);-- if (resourcesChanged) {- restartPoller();- }- },- { deep: true }- );-- // Watch for taskRunScope changes (stage/task navigation) and refresh taskRuns- watch(- taskRunScope,- async (newScope, oldScope) => {- const scopeChanged =- newScope?.stageId !== oldScope?.stageId ||- newScope?.taskId !== oldScope?.taskId;-- if (scopeChanged && resourceStrategies.taskRuns.canRefresh()) {- await resourceStrategies.taskRuns.refresh();- }- },- { deep: true }- );-- // Watch for plan issue/rollout changes on plan and issue pages- watch(- () => ({ issue: plan.value?.issue, hasRollout: plan.value?.hasRollout }),- async (newValues, oldValues) => {- const routeName = route.name as string;- const isRelevantRoute = includes(- [- PROJECT_V1_ROUTE_PLAN_DETAIL,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPECS,- PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,- PROJECT_V1_ROUTE_ISSUE_DETAIL,- ],- routeName- );-- if (!isRelevantRoute) return;-- const issueAdded = !oldValues?.issue && newValues.issue;- const rolloutAdded = !oldValues?.hasRollout && newValues.hasRollout;-- if (issueAdded && resourceStrategies.issue.initialize) {- await resourceStrategies.issue.initialize();- }- if (rolloutAdded && resourceStrategies.rollout.initialize) {- await resourceStrategies.rollout.initialize();- }- if (issueAdded || rolloutAdded) {- events.emit("status-changed", { eager: true });- }- }- );-- // Event listeners- events.on("status-changed", async ({ eager, refreshMode = "normal" }) => {- try {- const shouldFastFollow = refreshMode === "fast-follow";- if (eager) {- const resources = resourcesToPolled.value;- await refreshResources(resources, {- force: shouldFastFollow,- isManual: false,- });- if (shouldFastFollow) {- scheduleFastFollowRefreshes(resources);- }- } else if (shouldFastFollow) {- resourcePoller.restart();- scheduleFastFollowRefreshes(resourcesToPolled.value);- }- } catch (error) {- console.error("Error refreshing resources on status-changed:", error);- }- });-- events.on("perform-issue-review-action", async () => {- try {- await refreshResources(["issue"], { isManual: true });- events.emit("status-changed", { eager: true });- } catch (error) {- console.error("Error refreshing issue after review action:", error);- }- });-- events.on("perform-issue-status-action", async () => {- try {- await refreshResources(["issue"], { isManual: true });- events.emit("status-changed", { eager: true });- } catch (error) {- console.error("Error refreshing issue after status action:", error);- }- });-- // Main poller lifecycle management- watchEffect(async () => {- const activeResources = resourcesToPolled.value;- const shouldLoadResources = !isCreating.value && activeResources.length > 0;- const shouldPoll = shouldLoadResources && !isPlanDone.value;-- if (shouldLoadResources) {- await initializeExistingResources();-- if (shouldPoll && !pollerState.value.isPollerRunning) {- resourcePoller.start();- pollerState.value.isPollerRunning = true;- } else if (!shouldPoll && pollerState.value.isPollerRunning) {- resourcePoller.stop();- pollerState.value.isPollerRunning = false;- }-- if (!pollerState.value.hasInitialRefresh) {- pollerState.value.hasInitialRefresh = true;- setTimeout(async () => {- await refreshResources(activeResources, { isManual: false });- }, 100);- }- } else if (pollerState.value.isPollerRunning) {- resourcePoller.stop();- pollerState.value.isPollerRunning = false;- }- });-- const poller = {- refreshResources: (- resources?: ResourceType[],- optionsOrForce?: { force?: boolean; isManual?: boolean } | boolean- ) => refreshResources(resources, optionsOrForce),- isRefreshing: computed(() => pollerState.value.isRefreshing),- lastRefreshTime: computed(() => pollerState.value.lastRefreshTime),- };-- provide(KEY, poller);- return poller;-};--type ResourcePollerContext = ReturnType<typeof provideResourcePoller>;--export const useResourcePoller = () => {- const context = inject(KEY);- if (!context) {- throw new Error(- "useResourcePoller must be called within a component that provides PollerContext"- );- }- return context;-};diff --git a/frontend/src/components/Plan/logic/poller/utils.ts b/frontend/src/components/Plan/logic/poller/utils.tsdeleted file mode 100644index 498a7cdf38..0000000000--- a/frontend/src/components/Plan/logic/poller/utils.ts+++ /dev/null@@ -1,120 +0,0 @@-import { create } from "@bufbuild/protobuf";-import type { Ref } from "vue";-import {- issueServiceClientConnect,- planServiceClientConnect,- rolloutServiceClientConnect,-} from "@/connect";-import type { Issue } from "@/types/proto-es/v1/issue_service_pb";-import { GetIssueRequestSchema } from "@/types/proto-es/v1/issue_service_pb";-import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import {- GetPlanCheckRunRequestSchema,- GetPlanRequestSchema,-} from "@/types/proto-es/v1/plan_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { Rollout, TaskRun } from "@/types/proto-es/v1/rollout_service_pb";-import {- GetRolloutRequestSchema,- ListTaskRunsRequestSchema,-} from "@/types/proto-es/v1/rollout_service_pb";-import { hasProjectPermissionV2 } from "@/utils";--export const refreshPlan = async (plan: Ref<Plan>): Promise<void> => {- const request = create(GetPlanRequestSchema, {- name: plan.value.name,- });- const response = await planServiceClientConnect.getPlan(request);- plan.value = response;-};--export const refreshPlanCheckRuns = async (- plan: Plan,- project: Project,- planCheckRuns: Ref<PlanCheckRun[]>-): Promise<void> => {- if (!hasProjectPermissionV2(project, "bb.planCheckRuns.get")) {- return;- }-- const request = create(GetPlanCheckRunRequestSchema, {- name: `${plan.name}/planCheckRun`,- });- try {- const response = await planServiceClientConnect.getPlanCheckRun(request);- // One consolidated run per plan; large payloads are mostly `results[]`.- planCheckRuns.value = [response];- } catch {- // Plan check run might not exist yet- planCheckRuns.value = [];- }-};--export const refreshRollout = async (- rolloutName: string,- project: Project,- rollout: Ref<Rollout | undefined>-): Promise<void> => {- if (!hasProjectPermissionV2(project, "bb.rollouts.get")) {- return;- }-- const rolloutRequest = create(GetRolloutRequestSchema, {- name: rolloutName,- });- try {- const newRollout =- await rolloutServiceClientConnect.getRollout(rolloutRequest);- rollout.value = newRollout;- } catch (error) {- console.error("Failed to refresh rollout", error);- // Rollout might not exist yet- }-};--export const refreshIssue = async (- issue: Ref<Issue | undefined>-): Promise<void> => {- if (!issue.value) {- return;- }- const request = create(GetIssueRequestSchema, {- name: issue.value.name,- });- const newIssue = await issueServiceClientConnect.getIssue(request);- issue.value = newIssue;-};--export interface TaskRunScope {- stageId?: string;- taskId?: string;-}--export const refreshTaskRuns = async (- rollout: Rollout,- project: Project,- taskRuns: Ref<TaskRun[]>,- scope?: TaskRunScope-): Promise<void> => {- if (!hasProjectPermissionV2(project, "bb.taskRuns.list")) {- return;- }-- // Build parent path based on scope- // - No scope: fetch all task runs for the rollout- // - stageId only: fetch task runs for a specific stage- // - stageId + taskId: fetch task runs for a specific task- const stagePart = scope?.stageId ?? "-";- const taskPart = scope?.taskId ?? "-";- const parent = `${rollout.name}/stages/${stagePart}/tasks/${taskPart}`;-- const request = create(ListTaskRunsRequestSchema, {- parent,- });- try {- const response = await rolloutServiceClientConnect.listTaskRuns(request);- taskRuns.value = response.taskRuns;- } catch (error) {- console.error("Failed to refresh task runs", error);- }-};diff --git a/frontend/src/components/Plan/logic/rolloutPreview.ts b/frontend/src/components/Plan/logic/rolloutPreview.tsdeleted file mode 100644index 084661f42c..0000000000--- a/frontend/src/components/Plan/logic/rolloutPreview.ts+++ /dev/null@@ -1,239 +0,0 @@-import { create } from "@bufbuild/protobuf";-import {- useDatabaseV1Store,- useDBGroupStore,- useEnvironmentV1Store,-} from "@/store";-import { isValidDatabaseGroupName, isValidDatabaseName } from "@/types";-import { DatabaseGroupView } from "@/types/proto-es/v1/database_group_service_pb";-import type {- Plan,- Plan_ChangeDatabaseConfig,- Plan_Spec,-} from "@/types/proto-es/v1/plan_service_pb";-import type {- Rollout,- Stage,- Task,-} from "@/types/proto-es/v1/rollout_service_pb";-import {- RolloutSchema,- StageSchema,- Task_DatabaseUpdateSchema,- Task_Status,- Task_Type,- TaskSchema,-} from "@/types/proto-es/v1/rollout_service_pb";-import { targetsForSpec } from "./plan";--interface TaskCreate {- databaseName: string;- specId: string;- type: Task_Type;- sheet: string;-}--/**- * Generates a rollout preview from a plan without calling the backend.- * This replicates the backend's GetPipelineCreate and convertToRollout logic.- * Only handles ChangeDatabaseConfig specs.- */-export async function generateRolloutPreview(- plan: Plan,- projectName: string-): Promise<Rollout> {- // Step 1: Extract all database targets from specs and expand database groups- const allDatabaseNames = await extractAndExpandDatabaseTargets(plan.specs);- const dbStore = useDatabaseV1Store();-- // Step 2: Fetch databases that are not cached- await dbStore.batchGetOrFetchDatabases(allDatabaseNames);-- // Step 3: Generate tasks from specs- const tasks = await generateTasksFromSpecs(plan.specs);-- // Step 4: Get environment order from store- const environmentOrder = getEnvironmentOrder();-- // Step 5: Group tasks by environment and create stages- const stages = groupTasksIntoStages(tasks, environmentOrder, projectName);-- // Step 6: Build and return the rollout- return create(RolloutSchema, {- name: "", // Preview rollout has no name- title: plan.title,- stages,- });-}--async function extractAndExpandDatabaseTargets(- specs: Plan_Spec[]-): Promise<string[]> {- const databaseNames: string[] = [];-- for (const spec of specs) {- if (spec.config.case !== "changeDatabaseConfig") continue;-- const targets = targetsForSpec(spec);-- for (const target of targets) {- if (isValidDatabaseName(target)) {- databaseNames.push(target);- } else if (isValidDatabaseGroupName(target)) {- const expandedDbs = await expandDatabaseGroup(target);- databaseNames.push(...expandedDbs);- }- }- }-- return [...new Set(databaseNames)];-}--async function expandDatabaseGroup(- databaseGroupName: string-): Promise<string[]> {- const dbGroupStore = useDBGroupStore();- try {- const dbGroup = await dbGroupStore.getOrFetchDBGroupByName(- databaseGroupName,- { view: DatabaseGroupView.FULL, silent: true }- );- return dbGroup.matchedDatabases?.map((db) => db.name) ?? [];- } catch {- return [];- }-}--async function generateTasksFromSpecs(- specs: Plan_Spec[]-): Promise<TaskCreate[]> {- const tasks: TaskCreate[] = [];-- for (const spec of specs) {- if (spec.config.case !== "changeDatabaseConfig") continue;-- const specTasks = await generateChangeDatabaseTasks(- spec.id,- spec.config.value- );- tasks.push(...specTasks);- }-- return tasks;-}--async function generateChangeDatabaseTasks(- specId: string,- config: Plan_ChangeDatabaseConfig-): Promise<TaskCreate[]> {- const tasks: TaskCreate[] = [];-- let targets = config.targets ?? [];- if (targets.length === 1 && isValidDatabaseGroupName(targets[0])) {- targets = await expandDatabaseGroup(targets[0]);- }-- for (const target of targets) {- if (!isValidDatabaseName(target)) continue;-- tasks.push({- databaseName: target,- specId,- type: Task_Type.DATABASE_MIGRATE,- sheet: config.sheet,- });- }-- return tasks;-}--function getEnvironmentOrder(): string[] {- const environmentStore = useEnvironmentV1Store();- return environmentStore.environmentList.map((env) => env.name);-}--function groupTasksIntoStages(- tasks: TaskCreate[],- environmentOrder: string[],- projectName: string-): Stage[] {- const databaseStore = useDatabaseV1Store();-- // Group tasks by effectiveEnvironment- const tasksByEnv = new Map<string, TaskCreate[]>();-- for (const task of tasks) {- const db = databaseStore.getDatabaseByName(task.databaseName);- const env = db.effectiveEnvironment ?? "";- if (env === "") {- continue;- }-- let envTasks = tasksByEnv.get(env);- if (!envTasks) {- envTasks = [];- tasksByEnv.set(env, envTasks);- }- envTasks.push(task);- }-- // Build stages in environment order- const stages: Stage[] = [];-- // First, add stages for environments in the deployment order- for (const env of environmentOrder) {- const envTasks = tasksByEnv.get(env);- if (envTasks && envTasks.length > 0) {- stages.push(createStage(env, envTasks, projectName));- tasksByEnv.delete(env);- }- }-- // Then, add any remaining environments at the beginning (as backend does)- for (const [env, envTasks] of tasksByEnv) {- if (envTasks.length > 0) {- stages.unshift(createStage(env, envTasks, projectName));- }- }-- return stages;-}--function createStage(- environment: string,- tasks: TaskCreate[],- projectName: string-): Stage {- const envId = environment.replace("environments/", "") || "-";-- return create(StageSchema, {- name: `${projectName}/plans/-/rollout/stages/${envId}`,- id: envId,- environment: environment || "environments/-",- tasks: tasks.map((t, index) => createTask(t, envId, projectName, index)),- });-}--function createTask(- taskCreate: TaskCreate,- stageId: string,- projectName: string,- index: number-): Task {- return create(TaskSchema, {- name: `${projectName}/plans/-/rollout/stages/${stageId}/tasks/${index}`,- specId: taskCreate.specId,- status: Task_Status.NOT_STARTED,- type: taskCreate.type,- target: taskCreate.databaseName,- payload: {- case: "databaseUpdate",- value: create(Task_DatabaseUpdateSchema, {- source: {- case: "sheet",- value: taskCreate.sheet,- },- }),- },- });-}diff --git a/frontend/src/components/Plan/logic/sheet.ts b/frontend/src/components/Plan/logic/sheet.tsdeleted file mode 100644index 12f58b00d3..0000000000--- a/frontend/src/components/Plan/logic/sheet.ts+++ /dev/null@@ -1,35 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { reactive } from "vue";-import type { Sheet } from "@/types/proto-es/v1/sheet_service_pb";-import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";--const state = {- uid: -101,-};--const nextUID = () => {- return String(state.uid--);-};--const sheetsByName = reactive(new Map<string, Sheet>());--export const createEmptyLocalSheet = () => {- return reactive(create(SheetSchema, {}));-};--export const getNextLocalSheetUID = () => {- return nextUID();-};--export const getLocalSheetByName = (name: string): Sheet => {- const existed = sheetsByName.get(name);- if (existed) {- return existed;- }- const sheet = reactive({- ...createEmptyLocalSheet(),- name,- });- sheetsByName.set(name, sheet);- return sheet;-};diff --git a/frontend/src/components/Plan/logic/sidebar.ts b/frontend/src/components/Plan/logic/sidebar.tsdeleted file mode 100644index 77bd0d1cd8..0000000000--- a/frontend/src/components/Plan/logic/sidebar.ts+++ /dev/null@@ -1,51 +0,0 @@-import { useElementSize } from "@vueuse/core";-import type { InjectionKey, Ref } from "vue";-import { computed, inject, provide, ref } from "vue";--export type SidebarMode = "NONE" | "DESKTOP" | "MOBILE";--export type SidebarContext = {- mode: Ref<SidebarMode>;- containerWidth: Ref<number>;- desktopSidebarWidth: Ref<number>;- mobileSidebarOpen: Ref<boolean>;-};--const KEY = Symbol("bb.plan.detail.sidebar") as InjectionKey<SidebarContext>;--export const useSidebarContext = () => {- return inject(KEY)!;-};--export const provideSidebarContext = (- containerRef: Ref<HTMLElement | undefined>-) => {- const { width: containerWidth } = useElementSize(containerRef);- const MOBILE_SIDEBAR_THRESHOLD = 780;- const mode = computed((): SidebarMode => {- const cw = containerWidth.value;- if (cw === 0) {- // First render- return "NONE";- }- if (cw < MOBILE_SIDEBAR_THRESHOLD) {- return "MOBILE";- }- return "DESKTOP";- });- const desktopSidebarWidth = computed(() => {- const cw = containerWidth.value;- if (cw < 1280) return 240;- return 336;- });- const mobileSidebarOpen = ref(false);- const context: SidebarContext = {- mode,- containerWidth,- desktopSidebarWidth,- mobileSidebarOpen,- };-- provide(KEY, context);- return context;-};diff --git a/frontend/src/components/Plan/logic/useEditorState.ts b/frontend/src/components/Plan/logic/useEditorState.tsdeleted file mode 100644index edae27c6b0..0000000000--- a/frontend/src/components/Plan/logic/useEditorState.ts+++ /dev/null@@ -1,20 +0,0 @@-import { type Ref, ref } from "vue";--export interface EditorState {- isEditing: Ref<boolean>;-}--const editorState: EditorState = {- isEditing: ref(false),-};--export const useEditorState = () => {- const setEditingState = (editing: boolean) => {- editorState.isEditing.value = editing;- };-- return {- isEditing: editorState.isEditing,- setEditingState,- };-};diff --git a/frontend/src/components/Plan/logic/useNavigationGuard.ts b/frontend/src/components/Plan/logic/useNavigationGuard.tsdeleted file mode 100644index d12e0efb38..0000000000--- a/frontend/src/components/Plan/logic/useNavigationGuard.ts+++ /dev/null@@ -1,36 +0,0 @@-import { useDialog } from "naive-ui";-import { useI18n } from "vue-i18n";-import { useEditorState } from "./useEditorState";--export const useNavigationGuard = () => {- const dialog = useDialog();- const { t } = useI18n();- const editorState = useEditorState();-- const confirmNavigation = (): Promise<boolean> => {- return new Promise((resolve) => {- // If not editing, allow navigation- if (!editorState.isEditing.value) {- resolve(true);- return;- }-- // Show confirmation dialog when in editing mode- dialog.warning({- title: t("plan.editor.unsaved-changes"),- content: t("plan.editor.unsaved-changes-message"),- positiveText: t("common.leave"),- negativeText: t("common.stay"),- onPositiveClick: () => {- // Stop editing when user chooses to leave- editorState.setEditingState(false);- resolve(true);- },- onNegativeClick: () => resolve(false),- onClose: () => resolve(false),- });- });- };-- return { confirmNavigation };-};diff --git a/frontend/src/components/Plan/logic/usePlanCheckStatus.ts b/frontend/src/components/Plan/logic/usePlanCheckStatus.tsdeleted file mode 100644index 6ba96d14b9..0000000000--- a/frontend/src/components/Plan/logic/usePlanCheckStatus.ts+++ /dev/null@@ -1,91 +0,0 @@-import { type ComputedRef, computed, type Ref } from "vue";-import {- type Plan,- PlanCheckRun_Status,-} from "@/types/proto-es/v1/plan_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";-import {- EMPTY_PLAN_CHECK_STATUS_SUMMARY,- type PlanCheckStatusSummary,-} from "./plan-check-status";--export type { PlanCheckStatusSummary } from "./plan-check-status";--export const usePlanCheckStatus = (- plan: ComputedRef<Plan | undefined> | Ref<Plan | undefined>-) => {- const getCheckCount = (status: Advice_Level): number => {- if (!plan.value) return 0;- const statusKey = Advice_Level[status];- return plan.value.planCheckRunStatusCount?.[statusKey] || 0;- };-- const getOverallStatus = computed(() => {- if (!plan.value) return Advice_Level.ADVICE_LEVEL_UNSPECIFIED;-- const statusCount = plan.value.planCheckRunStatusCount || {};-- if (statusCount["ERROR"] > 0 || statusCount["FAILED"] > 0) {- return Advice_Level.ERROR;- } else if (statusCount["WARNING"] > 0) {- return Advice_Level.WARNING;- } else if (statusCount["SUCCESS"] > 0) {- return Advice_Level.SUCCESS;- }-- // Default to SUCCESS if no errors or warnings.- return Advice_Level.SUCCESS;- });-- const statusSummary = computed<PlanCheckStatusSummary>(() => {- if (!plan.value) {- return { ...EMPTY_PLAN_CHECK_STATUS_SUMMARY };- }-- const statusCount = plan.value.planCheckRunStatusCount || {};- const running =- statusCount[PlanCheckRun_Status[PlanCheckRun_Status.RUNNING]] || 0;- const success = statusCount[Advice_Level[Advice_Level.SUCCESS]] || 0;- const warning = statusCount[Advice_Level[Advice_Level.WARNING]] || 0;- const error = statusCount[Advice_Level[Advice_Level.ERROR]] || 0;- // Also count FAILED plan check runs as errors- const failed =- statusCount[PlanCheckRun_Status[PlanCheckRun_Status.FAILED]] || 0;- const totalError = error + failed;- const total = running + success + warning + totalError;-- return { running, success, warning, error: totalError, total };- });-- const hasAnyStatus = computed(() => {- const summary = statusSummary.value;- return summary.total > 0;- });-- const hasRunning = computed(() => {- return statusSummary.value.running > 0;- });-- const hasErrors = computed(() => {- return statusSummary.value.error > 0;- });-- const hasWarnings = computed(() => {- return statusSummary.value.warning > 0;- });-- const statusCountString = computed(() => {- return JSON.stringify(plan.value?.planCheckRunStatusCount || {});- });-- return {- getCheckCount,- getOverallStatus,- statusSummary,- hasAnyStatus,- hasRunning,- hasErrors,- hasWarnings,- statusCountString,- };-};diff --git a/frontend/src/components/Plan/logic/usePlanLink.ts b/frontend/src/components/Plan/logic/usePlanLink.tsdeleted file mode 100644index cf6330c289..0000000000--- a/frontend/src/components/Plan/logic/usePlanLink.ts+++ /dev/null@@ -1,35 +0,0 @@-import { computed } from "vue";-import { useRoute } from "vue-router";-import { PROJECT_V1_ROUTE_ISSUE_DETAIL } from "@/router/dashboard/projectV1";-import { isApprovalCompleted } from "./approval";-import { usePlanContext } from "./context";--/**- * Composable that determines whether the "Plan" link should be shown on the- * Issue page for database change plans.- */-export const usePlanLink = () => {- const route = useRoute();- const { plan, issue } = usePlanContext();-- const isDatabaseChangePlan = computed(() => {- return (- plan.value.specs.length > 0 &&- plan.value.specs.every(- (spec) => spec.config.case === "changeDatabaseConfig"- )- );- });-- const issueApproved = computed(() => isApprovalCompleted(issue.value));-- const shouldShow = computed(() => {- if (route.name !== PROJECT_V1_ROUTE_ISSUE_DETAIL) return false;- if (!isDatabaseChangePlan.value) return false;- return plan.value.hasRollout || issueApproved.value;- });-- return {- shouldShow,- };-};diff --git a/frontend/src/components/Plan/logic/useResolvedPlanCheckStatus.ts b/frontend/src/components/Plan/logic/useResolvedPlanCheckStatus.tsdeleted file mode 100644index d613959a4f..0000000000--- a/frontend/src/components/Plan/logic/useResolvedPlanCheckStatus.ts+++ /dev/null@@ -1,58 +0,0 @@-import { type ComputedRef, computed, type Ref } from "vue";-import type { Plan, PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";-import {- computePlanCheckStatusSummary,- overallAdviceLevelFromPlanCheckSummary,-} from "./plan-check-status";-import { usePlanCheckStatus } from "./usePlanCheckStatus";--/**- * Resolves plan check counts from either:- * - explicit `planCheckRuns` (e.g. filtered to the current spec), or- * - `plan.planCheckRunStatusCount` (API aggregate for the whole plan).- */-export const useResolvedPlanCheckStatus = (- plan: ComputedRef<Plan | undefined> | Ref<Plan | undefined>,- planCheckRunsOpt?:- | ComputedRef<PlanCheckRun[] | undefined>- | Ref<PlanCheckRun[] | undefined>-) => {- const planLevel = usePlanCheckStatus(plan);-- const runBasedSummary = computed(() => {- const runs = planCheckRunsOpt?.value;- if (runs === undefined) {- return undefined;- }- return computePlanCheckStatusSummary(runs);- });-- const statusSummary = computed(() => {- return runBasedSummary.value ?? planLevel.statusSummary.value;- });-- const hasAnyStatus = computed(() => statusSummary.value.total > 0);-- const overallAdviceLevel = computed((): Advice_Level => {- if (runBasedSummary.value !== undefined) {- return overallAdviceLevelFromPlanCheckSummary(runBasedSummary.value);- }- return planLevel.getOverallStatus.value;- });-- const hasRunning = computed(() => {- if (runBasedSummary.value !== undefined) {- return runBasedSummary.value.running > 0;- }- return planLevel.hasRunning.value;- });-- return {- statusSummary,- hasAnyStatus,- overallAdviceLevel,- hasRunning,- planLevel,- };-};diff --git a/frontend/src/components/Plan/logic/utils.ts b/frontend/src/components/Plan/logic/utils.tsdeleted file mode 100644index adcc4e9294..0000000000--- a/frontend/src/components/Plan/logic/utils.ts+++ /dev/null@@ -1,70 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { cloneDeep } from "lodash-es";-import { planServiceClientConnect } from "@/connect";-import { t } from "@/plugins/i18n";-import { projectNamePrefix, useProjectV1Store, useSheetV1Store } from "@/store";-import type { Plan, Plan_Spec } from "@/types/proto-es/v1/plan_service_pb";-import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { SheetSchema } from "@/types/proto-es/v1/sheet_service_pb";-import { extractProjectResourceName, setSheetStatement } from "@/utils";-import { createEmptyLocalSheet } from ".";--export const projectOfPlan = (plan: Plan): Project => {- const project = `projects/${extractProjectResourceName(plan.name)}`;- return useProjectV1Store().getProjectByName(project);-};--export const getSpecTitle = (spec: Plan_Spec): string => {- let title = "";- if (spec.config?.case === "createDatabaseConfig") {- title = t("plan.spec.type.create-database");- } else if (spec.config?.case === "changeDatabaseConfig") {- title = t("plan.spec.type.database-change");- } else if (spec.config?.case === "exportDataConfig") {- title = t("plan.spec.type.export-data");- } else {- title = t("plan.spec.type.unknown");- }- return title;-};--export const updateSpecSheetWithStatement = async (- plan: Plan,- spec: Plan_Spec,- statement: string-): Promise<void> => {- const planPatch = cloneDeep(plan);- const specToPatch = planPatch.specs.find((s) => s.id === spec.id);-- if (!specToPatch) {- throw new Error(- `Cannot find spec to patch for plan update ${JSON.stringify(spec)}`- );- }-- if (specToPatch.config.case !== "changeDatabaseConfig") {- throw new Error(- `Unsupported spec type for plan update ${JSON.stringify(specToPatch)}`- );- }-- const newSheet = create(SheetSchema, {- ...createEmptyLocalSheet(),- });- setSheetStatement(newSheet, statement);-- const projectName = `${projectNamePrefix}${extractProjectResourceName(plan.name)}`;- const createdSheet = await useSheetV1Store().createSheet(- projectName,- newSheet- );-- specToPatch.config.value.sheet = createdSheet.name;- const request = create(UpdatePlanRequestSchema, {- plan: planPatch,- updateMask: { paths: ["specs"] },- });-- await planServiceClientConnect.updatePlan(request);-};diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vuedeleted file mode 100644index 72fdfd8941..0000000000--- a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue+++ /dev/null@@ -1,565 +0,0 @@-<template>- <div class="flex flex-col gap-y-0.5">- <div v-if="showCancelButton">- <NButton secondary size="small" @click="cancelPlanCheckRun">- <template #icon>- <XIcon class="w-4 h-auto" />- </template>- {{ $t("common.cancel") }}- </NButton>- </div>-- <div- v-for="(row, i) in highlightTableRows"- :key="i"- :class="[- 'py-2 px-2 flex flex-col gap-y-2',- row.checkResult.status === Advice_Level.ERROR &&- 'border-error border rounded-sm',- row.checkResult.status === Advice_Level.WARNING &&- 'border-warning border rounded-sm',- ]"- >- <div class="flex items-center gap-x-3">- <div- class="relative w-5 h-5 flex shrink-0 items-center justify-center rounded-full select-none"- :class="statusIconClass(row.checkResult.status)"- >- <template v-if="row.checkResult.status === Advice_Level.SUCCESS">- <heroicons-solid:check class="w-4 h-4" />- </template>- <template v-if="row.checkResult.status === Advice_Level.WARNING">- <heroicons-outline:exclamation class="h-4 w-4" />- </template>- <template v-else-if="row.checkResult.status === Advice_Level.ERROR">- <span class="text-white font-medium text-base" aria-hidden="true">- !- </span>- </template>- </div>- <div v-if="showCategoryColumn" class="shrink-0">- {{ row.category }}- </div>- <div class="font-semibold">{{ row.title }}</div>-- <slot name="row-title-extra" :row="row" />- </div>-- <div class="textinfolabel flex flex-col gap-y-0.5">- <div>{{ row.checkResult.content }}</div>-- <OnlineMigrationDetail- v-if="row.checkResult.title === 'advice.online-migration'"- :row="row"- />-- <div- class="flex items-center justify-start divide-x divide-block-border"- >- <div- v-if="- row.checkResult.report.case === 'sqlReviewReport' &&- getActiveRule(row.checkResult.title)- "- class="pl-2 first:pl-0"- >- <span- class="normal-link"- @click="setActiveRule(row.checkResult.title)"- >{{ $t("sql-review.rule-detail") }}</span- >- </div>- <div- v-if="row.checkResult.report.case === 'sqlSummaryReport'"- class="pl-2 first:pl-0"- >- <span>- {{ row.checkResult.report.value.affectedRows }}- </span>- </div>-- <div class="pl-2 first:pl-0">- <a- v-if="row.link"- class="normal-link"- :href="row.link.url"- :target="row.link.target"- >- {{ row.link.title }}- </a>- </div>-- <!-- Only show the error line for latest plan check run -->- <div- v-if="- showCodeLocation &&- row.checkResult.report.case === 'sqlReviewReport' &&- row.checkResult.report.value.startPosition- "- class="pl-2 first:pl-0"- >- <span- class="normal-link"- @click="- convertPositionLineToMonacoLine(- row.checkResult.report.value.startPosition.line- )- "- >- Line- {{- convertPositionLineToMonacoLine(- row.checkResult.report.value.startPosition.line- )- }}- </span>- </div>- </div>- </div>- </div>-- <div- v-for="(row, i) in standardTableRows"- :key="i"- class="py-3 px-2 first:pt-2 flex flex-col gap-y-2"- >- <div class="flex items-center gap-x-3">- <div- class="relative w-5 h-5 flex shrink-0 items-center justify-center rounded-full select-none"- :class="statusIconClass(row.checkResult.status)"- >- <template v-if="row.checkResult.status === Advice_Level.SUCCESS">- <heroicons-solid:check class="w-4 h-4" />- </template>- <template v-if="row.checkResult.status === Advice_Level.WARNING">- <heroicons-outline:exclamation class="h-4 w-4" />- </template>- <template v-else-if="row.checkResult.status === Advice_Level.ERROR">- <span class="text-white font-medium text-base" aria-hidden="true">- !- </span>- </template>- </div>- <div v-if="showCategoryColumn" class="shrink-0">- {{ row.category }}- </div>- <div class="font-semibold">{{ row.title }}</div>- </div>- <div class="textinfolabel">- <span>{{ row.checkResult.content }}</span>- <template- v-if="- row.checkResult.report.case === 'sqlReviewReport' &&- getActiveRule(row.checkResult.title)- "- >- <span- class="ml-1 normal-link"- @click="setActiveRule(row.checkResult.title)"- >{{ $t("sql-review.rule-detail") }}</span- >- <span class="border-r border-control-border ml-1"></span>- </template>- <template v-if="row.checkResult.report.case === 'sqlSummaryReport'">- {{ row.checkResult.report.value.affectedRows }}- </template>-- <a- v-if="row.link"- class="ml-1 normal-link"- :href="row.link.url"- :target="row.link.target"- >- {{ row.link.title }}- </a>-- <!-- Only show the error line for latest plan check run -->- <template- v-if="- showCodeLocation &&- row.checkResult.report.case === 'sqlReviewReport' &&- row.checkResult.report.value.startPosition- "- >- <span class="border-r border-control-border ml-1"></span>- <span- class="ml-1 normal-link"- @click="- handleClickPlanCheckDetailLine(- convertPositionLineToMonacoLine(- row.checkResult.report.value.startPosition.line- )- )- "- >- Line- {{- convertPositionLineToMonacoLine(- row.checkResult.report.value.startPosition.line- )- }}- </span>- </template>- </div>- </div>-- <div- v-if="showSuccessPlaceholder"- class="py-3 px-2 first:pt-2 flex flex-col gap-y-2"- >- <div class="flex items-center gap-x-3">- <div- class="relative w-5 h-5 flex shrink-0 items-center justify-center rounded-full select-none"- :class="statusIconClass(Advice_Level.SUCCESS)"- >- <heroicons-solid:check class="w-4 h-4" />- </div>- <div class="font-semibold">OK</div>- </div>- <div class="textinfolabel">- <span>- {{ $t("sql-review.all-checks-passed") }}- </span>- </div>- </div>- </div>-- <SQLRuleEditDialog- v-if="state.activeRule"- :rule="state.activeRule"- :disabled="true"- @cancel="state.activeRule = undefined"- />-</template>--<script setup lang="ts">-import { create } from "@bufbuild/protobuf";-import { XIcon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { computed, reactive } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { SQLRuleEditDialog } from "@/components/SQLReview/components";-import { planServiceClientConnect } from "@/connect";-import { WORKSPACE_ROUTE_SQL_REVIEW } from "@/router/dashboard/workspaceRoutes";-import { useReviewPolicyForDatabase } from "@/store";-import type { RuleTemplateV2 } from "@/types";-import {- convertPolicyRuleToRuleTemplate,- GeneralErrorCode,- getRuleLocalization,- ruleTemplateMapV2,- ruleTypeToString,- SQLReviewPolicyErrorCode,-} from "@/types";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import type {- PlanCheckRun,- PlanCheckRun_Result,-} from "@/types/proto-es/v1/plan_service_pb";-import {- CancelPlanCheckRunRequestSchema,- PlanCheckRun_ResultSchema,- PlanCheckRun_Status,-} from "@/types/proto-es/v1/plan_service_pb";-import {- SQLReviewRule_Level,- SQLReviewRule_Type,-} from "@/types/proto-es/v1/review_config_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";-import { convertPositionLineToMonacoLine } from "@/utils/v1/position";-import { usePlanCheckRunContext } from "./context";-import { OnlineMigrationDetail } from "./detail";--interface ErrorCodeLink {- title: string;- target: string;- url: string;-}--export type PlanCheckDetailTableRow = {- checkResult: PlanCheckRun_Result;- category: string;- title: string;- link: ErrorCodeLink | undefined;-};--type LocalState = {- activeRule?: RuleTemplateV2;-};--const props = defineProps<{- planCheckRun: PlanCheckRun;- showCodeLocation?: boolean;- database?: Database;-}>();--const { t } = useI18n();-const router = useRouter();-const state = reactive<LocalState>({- activeRule: undefined,-});--const statusIconClass = (status: Advice_Level) => {- switch (status) {- case Advice_Level.SUCCESS:- return "bg-success text-white";- case Advice_Level.WARNING:- return "bg-warning text-white";- case Advice_Level.ERROR:- return "bg-error text-white";- }-};--const checkResultList = computed((): PlanCheckRun_Result[] => {- if (props.planCheckRun.status === PlanCheckRun_Status.DONE) {- return props.planCheckRun.results;- } else if (props.planCheckRun.status === PlanCheckRun_Status.FAILED) {- return [- create(PlanCheckRun_ResultSchema, {- status: Advice_Level.ERROR,- title: t("common.error"),- content: props.planCheckRun.error,- }),- ];- } else if (props.planCheckRun.status === PlanCheckRun_Status.CANCELED) {- return [- create(PlanCheckRun_ResultSchema, {- status: Advice_Level.WARNING,- title: t("common.canceled"),- content: props.planCheckRun.error,- }),- ];- }-- return [];-});--const showCancelButton = computed(- // Only allow canceling plan check run when it's running.- () => props.planCheckRun.status === PlanCheckRun_Status.RUNNING-);--const getRuleTemplateByType = (type: string) => {- // Convert string to enum- const typeKey = type as keyof typeof SQLReviewRule_Type;- const typeEnum = SQLReviewRule_Type[typeKey];- if (typeEnum === undefined) {- return;- }-- if (props.database?.instanceResource) {- return ruleTemplateMapV2- .get(props.database.instanceResource.engine)- ?.get(typeEnum);- }-- // fallback- for (const mapByType of ruleTemplateMapV2.values()) {- if (mapByType.has(typeEnum)) {- return mapByType.get(typeEnum);- }- }- return;-};--const isBuiltinRule = (type: string) => {- return type.startsWith("builtin.");-};--const builtinRuleType = (type: string): SQLReviewRule_Type | undefined => {- // Convert dot-separated to SCREAMING_SNAKE_CASE- const typeKey = type- .toUpperCase()- .replace(/\./g, "_")- .replace(/-/g, "_") as keyof typeof SQLReviewRule_Type;- return SQLReviewRule_Type[typeKey];-};--const builtinRuleLevel = (type: string): SQLReviewRule_Level => {- switch (type) {- case "builtin.prior-backup-check":- return SQLReviewRule_Level.ERROR;- default:- return SQLReviewRule_Level.ERROR;- }-};--const categoryAndTitle = (- checkResult: PlanCheckRun_Result-): [string, string] => {- if (checkResult.report.case === "sqlReviewReport") {- const code = checkResult.code;- if (!code) {- return ["", checkResult.title];- }- if (code === SQLReviewPolicyErrorCode.EMPTY_POLICY) {- const title = messageWithCode(checkResult.title, code);- return ["", title];- }- const rule = getRuleTemplateByType(checkResult.title);- if (rule) {- const ruleLocalization = getRuleLocalization(- ruleTypeToString(rule.type),- rule.engine- );- const key = `sql-review.category.${rule.category.toLowerCase()}`;- const category = t(key);- const title = messageWithCode(ruleLocalization.title, code);- return [category, title];- } else if (isBuiltinRule(checkResult.title)) {- return [- t("sql-review.category.builtin"),- messageWithCode(getRuleLocalization(checkResult.title).title, code),- ];- }- return ["", messageWithCode(checkResult.title, code)];- }- if (checkResult.report.case === "sqlSummaryReport") {- if (typeof checkResult.report.value?.affectedRows === "number") {- return [- "",- `${t("task.check-type.affected-rows.self")} (${t("task.check-type.affected-rows.description")})`,- ];- }- return ["", checkResult.title];- }-- return ["", checkResult.title];-};--const messageWithCode = (message: string, code: number) => {- return `${message} #${code}`;-};--const errorCodeLink = (- checkResult: PlanCheckRun_Result-): ErrorCodeLink | undefined => {- const code = checkResult.code;- switch (code) {- case undefined:- return;- case GeneralErrorCode.OK:- return;- case SQLReviewPolicyErrorCode.EMPTY_POLICY:- return {- title: t("sql-review.configure-policy"),- target: "__blank",- url: router.resolve({- name: WORKSPACE_ROUTE_SQL_REVIEW,- }).fullPath,- };- default: {- const errorCodeNamespace =- checkResult.report.case === "sqlReviewReport" ? "advisor" : "core";- const domain = "https://www.bytebase.com";- const path = `/docs/reference/error-code/${errorCodeNamespace}/`;- const query = `source=console#${code}`;- const url = `${domain}${path}?${query}`;- return {- title: t("common.view-doc"),- target: "__blank",- url: url,- };- }- }-};--const tableRows = computed(() => {- return checkResultList.value.map<PlanCheckDetailTableRow>((checkResult) => {- const [category, title] = categoryAndTitle(checkResult);- const link = errorCodeLink(checkResult);- return {- checkResult,- category,- title,- link,- };- });-});--const highlightRowFilter = (row: PlanCheckDetailTableRow) => {- return row.checkResult.title === "advice.online-migration";-};--const highlightTableRows = computed(() => {- return tableRows.value.filter(highlightRowFilter);-});--const standardTableRows = computed(() => {- return tableRows.value.filter((row) => !highlightRowFilter(row));-});--const showSuccessPlaceholder = computed(() => {- return (- props.planCheckRun.status === PlanCheckRun_Status.DONE &&- highlightTableRows.value.length === 0 &&- standardTableRows.value.length === 0- );-});--const showCategoryColumn = computed((): boolean =>- tableRows.value.some((row) => row.category !== "")-);--const reviewPolicy = useReviewPolicyForDatabase(- computed(() => {- return props.database;- })-);--const getActiveRule = (type: string): RuleTemplateV2 | undefined => {- const engine = props.database?.instanceResource?.engine;- if (isBuiltinRule(type) && engine) {- const typeEnum = builtinRuleType(type);- if (!typeEnum) {- return undefined;- }- return {- type: typeEnum,- category: "BUILTIN",- engine: engine,- level: builtinRuleLevel(type),- componentList: [],- };- }- // Convert string to enum for comparison- const typeKey = type as keyof typeof SQLReviewRule_Type;- const typeEnum = SQLReviewRule_Type[typeKey];-- const rule = reviewPolicy.value?.ruleList.find((rule) => {- if (engine && rule.engine !== engine) {- return false;- }- return rule.type === typeEnum;- });- if (!rule) {- return undefined;- }-- const ruleTemplate = getRuleTemplateByType(type);- if (!ruleTemplate) {- return undefined;- }-- return convertPolicyRuleToRuleTemplate(rule, ruleTemplate);-};--const setActiveRule = (type: string) => {- state.activeRule = getActiveRule(type);-};--const handleClickPlanCheckDetailLine = (line: number) => {- window.location.hash = `L${line}`;-};--const cancelPlanCheckRun = async () => {- const request = create(CancelPlanCheckRunRequestSchema, {- name: props.planCheckRun.name,- });- await planServiceClientConnect.cancelPlanCheckRun(request);- if (usePlanCheckRunContext()) {- usePlanCheckRunContext().events.emit("status-changed");- }-};-</script>diff --git a/frontend/src/components/PlanCheckRun/common.ts b/frontend/src/components/PlanCheckRun/common.tsdeleted file mode 100644index a1fc2d4946..0000000000--- a/frontend/src/components/PlanCheckRun/common.ts+++ /dev/null@@ -1,87 +0,0 @@-import {- type PlanCheckRun,- PlanCheckRun_Result_Type,- PlanCheckRun_Status,-} from "@/types/proto-es/v1/plan_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";--export const planCheckRunResultStatus = (checkRun: PlanCheckRun) => {- let status = Advice_Level.SUCCESS;-- for (const result of checkRun.results) {- if (result.status === Advice_Level.ERROR) {- return Advice_Level.ERROR;- }- if (result.status === Advice_Level.WARNING) {- status = Advice_Level.WARNING;- }- }- return status;-};--export const HiddenPlanCheckTypes = new Set<PlanCheckRun_Result_Type>([- PlanCheckRun_Result_Type.STATEMENT_SUMMARY_REPORT,-]);--export type PlanCheckRunSummary = {- runningCount: number;- successCount: number;- warnCount: number;- errorCount: number;-};--export const planCheckRunSummaryForCheckRunList = (- planCheckRuns: PlanCheckRun[]-) => {- const summary: PlanCheckRunSummary = {- runningCount: 0,- successCount: 0,- warnCount: 0,- errorCount: 0,- };-- for (const checkRun of planCheckRuns) {- if (checkRun.status === PlanCheckRun_Status.RUNNING) {- summary.runningCount++;- continue;- }- if (checkRun.status === PlanCheckRun_Status.FAILED) {- summary.errorCount++;- continue;- }- if (checkRun.status === PlanCheckRun_Status.CANCELED) {- continue;- }-- // For DONE status, analyze results by type-target- // Group results by type-target to count unique checks- const resultsByTypeTarget = new Map<string, Advice_Level>();- for (const result of checkRun.results) {- if (HiddenPlanCheckTypes.has(result.type)) {- continue;- }- const key = `${result.type}-${result.target}`;- const existing = resultsByTypeTarget.get(key);- // Keep worst status (ERROR > WARNING > SUCCESS)- if (!existing || result.status > existing) {- resultsByTypeTarget.set(key, result.status);- }- }-- for (const status of resultsByTypeTarget.values()) {- switch (status) {- case Advice_Level.SUCCESS:- summary.successCount++;- break;- case Advice_Level.WARNING:- summary.warnCount++;- break;- case Advice_Level.ERROR:- summary.errorCount++;- break;- }- }- }-- return summary;-};diff --git a/frontend/src/components/PlanCheckRun/context.ts b/frontend/src/components/PlanCheckRun/context.tsdeleted file mode 100644index 011d8d950c..0000000000--- a/frontend/src/components/PlanCheckRun/context.ts+++ /dev/null@@ -1,34 +0,0 @@-import type Emittery from "emittery";-import { v4 as uuidv4 } from "uuid";-import type { InjectionKey } from "vue";-import { inject, provide } from "vue";--export type PlanCheckRunEvents = Emittery<{- "status-changed": undefined;-}>;--export type PlanCheckRunContext = {- events: PlanCheckRunEvents;-};--const KEY = Symbol(- `bb.plan-check-run.context.${uuidv4()}`-) as InjectionKey<PlanCheckRunContext>;--export const usePlanCheckRunContext = () => {- return inject(KEY)!;-};--export const providePlanCheckRunContext = (- context: Partial<PlanCheckRunContext>,- root = false-) => {- if (!root) {- const parent = usePlanCheckRunContext();- context = {- ...parent,- ...context,- };- }- provide(KEY, context as PlanCheckRunContext);-};diff --git a/frontend/src/components/PlanCheckRun/detail/OnlineMigrationDetail.vue b/frontend/src/components/PlanCheckRun/detail/OnlineMigrationDetail.vuedeleted file mode 100644index 9e7512409d..0000000000--- a/frontend/src/components/PlanCheckRun/detail/OnlineMigrationDetail.vue+++ /dev/null@@ -1,22 +0,0 @@-<template>- <div v-if="code === 1802" class="textinfolabel">- {{- $t(- "task.online-migration.advice-split-statement-to-single-online-migration-issue"- )- }}- </div>-</template>--<script setup lang="ts">-import { computed } from "vue";-import type { PlanCheckDetailTableRow } from "../PlanCheckRunDetail.vue";--const props = defineProps<{- row: PlanCheckDetailTableRow;-}>();--const code = computed(() => {- return props.row.checkResult.code;-});-</script>diff --git a/frontend/src/components/PlanCheckRun/detail/index.ts b/frontend/src/components/PlanCheckRun/detail/index.tsdeleted file mode 100644index e08b0139db..0000000000--- a/frontend/src/components/PlanCheckRun/detail/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import OnlineMigrationDetail from "./OnlineMigrationDetail.vue";--export { OnlineMigrationDetail };diff --git a/frontend/src/components/Project/ProjectActionDropdown.vue b/frontend/src/components/Project/ProjectActionDropdown.vuedeleted file mode 100644index 66775fbd31..0000000000--- a/frontend/src/components/Project/ProjectActionDropdown.vue+++ /dev/null@@ -1,155 +0,0 @@-<template>- <NDropdown- trigger="click"- :options="dropdownOptions"- @select="handleSelect"- >- <NButton size="small" quaternary class="px-1!">- <template #icon>- <EllipsisVerticalIcon class="w-4 h-4" />- </template>- </NButton>- </NDropdown>-</template>--<script setup lang="ts">-import { EllipsisVerticalIcon } from "lucide-vue-next";-import type { DropdownOption } from "naive-ui";-import { NButton, NDropdown, useDialog } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";-import {- pushNotification,- useGracefulRequest,- useProjectV1Store,-} from "@/store";-import { State } from "@/types/proto-es/v1/common_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { hasProjectPermissionV2 } from "@/utils";--const props = defineProps<{- project: Project;-}>();--const emit = defineEmits<{- (e: "deleted"): void;-}>();--const { t } = useI18n();-const dialog = useDialog();-const projectStore = useProjectV1Store();-const router = useRouter();--const canArchive = computed(() =>- hasProjectPermissionV2(props.project, "bb.projects.delete")-);-const canRestore = computed(() =>- hasProjectPermissionV2(props.project, "bb.projects.undelete")-);--const dropdownOptions = computed((): DropdownOption[] => {- const options: DropdownOption[] = [];-- if (props.project.state === State.ACTIVE && canArchive.value) {- options.push({- key: "archive",- label: t("common.archive"),- });- } else if (props.project.state === State.DELETED && canRestore.value) {- options.push({- key: "restore",- label: t("common.restore"),- });- }-- if (canArchive.value || canRestore.value) {- options.push({- key: "delete",- label: t("common.delete"),- });- }-- return options;-});--const handleArchive = () => {- dialog.warning({- title: t("common.confirm-archive"),- content: t("project.settings.confirm-archive-project", {- name: props.project.title || props.project.name,- }),- negativeText: t("common.cancel"),- positiveText: t("common.archive"),- onPositiveClick: () => {- useGracefulRequest(async () => {- await projectStore.archiveProject(props.project);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: `${props.project.title || props.project.name} ${t("common.archived")}`,- });- router.push({ name: PROJECT_V1_ROUTE_DASHBOARD });- });- },- });-};--const handleRestore = () => {- dialog.info({- title: t("project.settings.restore.title"),- content:- t("project.settings.restore.title") +- ` '${props.project.title || props.project.name}'?`,- negativeText: t("common.cancel"),- positiveText: t("common.restore"),- onPositiveClick: () => {- useGracefulRequest(async () => {- await projectStore.restoreProject(props.project);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: `${props.project.title || props.project.name} ${t("common.restored")}`,- });- });- },- });-};--const handleDelete = () => {- dialog.warning({- title: t("common.confirm-delete"),- content:- t("project.settings.confirm-delete-project", {- name: props.project.title || props.project.name,- }) +- "\n\n" +- t("common.cannot-undo-this-action"),- negativeText: t("common.cancel"),- positiveText: t("common.delete"),- onPositiveClick: () => {- useGracefulRequest(async () => {- await projectStore.deleteProject(props.project.name);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: `${props.project.title || props.project.name} ${t("common.deleted")}`,- });- emit("deleted");- router.push({ name: PROJECT_V1_ROUTE_DASHBOARD });- });- },- });-};--const handleSelect = (key: string) => {- if (key === "archive") {- handleArchive();- } else if (key === "restore") {- handleRestore();- } else if (key === "delete") {- handleDelete();- }-};-</script>diff --git a/frontend/src/components/Project/useRecentProjects.ts b/frontend/src/components/Project/useRecentProjects.tsdeleted file mode 100644index d622dfe2d0..0000000000--- a/frontend/src/components/Project/useRecentProjects.ts+++ /dev/null@@ -1,77 +0,0 @@-import { computedAsync } from "@vueuse/core";-import { computed } from "vue";-import { useCurrentUserV1, useProjectV1Store } from "@/store";-import { isValidProjectName } from "@/types";-import { storageKeyRecentProjects, useDynamicLocalStorage } from "@/utils";--const MAX_RECENT_PROJECT = 5;--export const useRecentProjects = () => {- const projectV1Store = useProjectV1Store();- const currentUser = useCurrentUserV1();-- const recentViewProjectNames = useDynamicLocalStorage<string[]>(- computed(() => storageKeyRecentProjects(currentUser.value.email)),- []- );-- const setRecentProject = (name: string) => {- if (!name) {- return;- }- const index = recentViewProjectNames.value.findIndex(- (proj) => proj === name- );- if (index >= 0) {- recentViewProjectNames.value.splice(index, 1);- }-- recentViewProjectNames.value.unshift(name);- if (recentViewProjectNames.value.length > MAX_RECENT_PROJECT) {- recentViewProjectNames.value.pop();- }- };-- const recentViewProjects = computedAsync(async () => {- const projects = [];- const invalidProjects: string[] = [];-- try {- await projectV1Store.batchGetOrFetchProjects(- recentViewProjectNames.value- );- } catch {- // Some projects may have failed to fetch (e.g., 404), continue to check individually- }-- for (const projectName of recentViewProjectNames.value) {- try {- const project = projectV1Store.getProjectByName(projectName);- if (isValidProjectName(project.name)) {- // Only check if project exists, let ProjectRouteShell handle permission- projects.push(project);- } else {- // Project doesn't exist or is invalid- invalidProjects.push(projectName);- }- } catch {- // Project was deleted or fetch failed - mark for removal- invalidProjects.push(projectName);- }- }-- // Only clean up truly invalid/deleted projects- if (invalidProjects.length > 0) {- recentViewProjectNames.value = recentViewProjectNames.value.filter(- (name) => !invalidProjects.includes(name)- );- }-- return projects;- }, []);-- return {- setRecentProject,- recentViewProjects,- };-};diff --git a/frontend/src/components/ProvideDashboardContext.vue b/frontend/src/components/ProvideDashboardContext.vuedeleted file mode 100644index 5b35ace0ca..0000000000--- a/frontend/src/components/ProvideDashboardContext.vue+++ /dev/null@@ -1,34 +0,0 @@-<template>- <slot v-if="!isInitializing" />- <MaskSpinner v-else class="bg-white!" />-</template>--<script lang="ts" setup>-import { onMounted, ref } from "vue";-import { useRouter } from "vue-router";-import {- useEnvironmentV1Store,- useSettingV1Store,- useUIStateStore,-} from "@/store";-import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";-import MaskSpinner from "./misc/MaskSpinner.vue";--const router = useRouter();-const isInitializing = ref<boolean>(true);--onMounted(async () => {- await router.isReady();-- await Promise.all([- useEnvironmentV1Store().fetchEnvironments(),- useSettingV1Store().getOrFetchSettingByName(- Setting_SettingName.WORKSPACE_PROFILE- ),- ]);-- useUIStateStore().restoreState();-- isInitializing.value = false;-});-</script>diff --git a/frontend/src/components/Release/ReleaseDataTable.vue b/frontend/src/components/Release/ReleaseDataTable.vuedeleted file mode 100644index 8ab915510b..0000000000--- a/frontend/src/components/Release/ReleaseDataTable.vue+++ /dev/null@@ -1,218 +0,0 @@-<template>- <NDataTable- size="small"- :columns="columnList"- :data="sortedReleaseList"- :striped="true"- :bordered="bordered"- :loading="loading"- :row-key="(release) => release.name"- :checked-row-keys="Array.from(state.selectedReleaseNameList)"- :row-props="rowProps"- @update:checked-row-keys="handleSelectionChange"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable, NTag } from "naive-ui";-import { computed, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import HumanizeTs from "@/components/misc/HumanizeTs.vue";-import { getTimeForPbTimestampProtoEs } from "@/types";-import { State } from "@/types/proto-es/v1/common_pb";-import type { Release } from "@/types/proto-es/v1/release_service_pb";--interface LocalState {- selectedReleaseNameList: Set<string>;-}--// The max number of files to show in the table cell.-const MAX_SHOW_FILES_COUNT = 3;--const props = withDefaults(- defineProps<{- releaseList: Release[];- bordered?: boolean;- loading?: boolean;- showSelection?: boolean;- singleSelect?: boolean;- selectedRowKeys?: string[];- }>(),- {- loading: true,- bordered: false,- showSelection: false,- singleSelect: false,- selectedRowKeys: () => [],- }-);--const emit = defineEmits<{- (event: "update:checked-row-keys", keys: string[]): void;-}>();--const { t } = useI18n();-const router = useRouter();-const state = reactive<LocalState>({- selectedReleaseNameList: new Set(props.selectedRowKeys),-});--const columnList = computed(- (): (DataTableColumn<Release> & { hide?: boolean })[] => {- const columns: (DataTableColumn<Release> & { hide?: boolean })[] = [- {- type: "selection",- hide: !props.showSelection,- multiple: !props.singleSelect,- },- {- key: "name",- width: 300,- title: t("common.name"),- resizable: true,- render: (release) => {- const parts = release.name.split("/");- const releaseName = parts[parts.length - 1] || release.name;- return (- <p class="inline-flex w-full items-center gap-x-2">- <span- class={[- "shrink truncate",- release.state === State.DELETED &&- "text-control-light line-through",- ]}- >- {releaseName}- </span>- </p>- );- },- },- {- key: "files",- title: t("release.files"),- resizable: true,- ellipsis: true,- render: (release) => {- const showFiles = release.files.slice(0, MAX_SHOW_FILES_COUNT);- return (- <div class="flex flex-col items-start gap-1">- {showFiles.map((file) => (- <p class="w-full truncate">- {file.version && (- <NTag class="mr-2" size="small" round>- {file.version}- </NTag>- )}- {file.path}- </p>- ))}- {release.files.length > MAX_SHOW_FILES_COUNT && (- <p class="text-gray-400 text-xs italic">- {t("release.total-files", { count: release.files.length })}- </p>- )}- </div>- );- },- },- {- key: "createTime",- title: t("common.created-at"),- width: 128,- resizable: true,- render: (release) => (- <HumanizeTs- ts={getTimeForPbTimestampProtoEs(release.createTime, 0) / 1000}- />- ),- },- ];- return columns.filter((column) => !column.hide);- }-);--const sortedReleaseList = computed(() => {- return props.releaseList;-});--const rowProps = (release: Release) => {- return {- style: "cursor: pointer;",- onClick: (e: MouseEvent) => {- // Check if we're in selection mode- if (props.showSelection) {- // Don't toggle if clicking on the checkbox itself- const target = e.target as HTMLElement;- if (target.closest(".n-checkbox")) {- return;- }-- const releaseName = release.name;-- if (props.singleSelect) {- // For single select, simply select the clicked row- state.selectedReleaseNameList = new Set([releaseName]);- emit("update:checked-row-keys", [releaseName]);- } else {- // For multi-select, toggle the selection- if (state.selectedReleaseNameList.has(releaseName)) {- state.selectedReleaseNameList.delete(releaseName);- } else {- state.selectedReleaseNameList.add(releaseName);- }- emit(- "update:checked-row-keys",- Array.from(state.selectedReleaseNameList)- );- }- } else {- // Navigation mode when not in selection mode- const url = `/${release.name}`;- if (e.ctrlKey || e.metaKey) {- window.open(url, "_blank");- } else {- router.push(url);- }- }- },- };-};--const handleSelectionChange = (val: Array<string | number>) => {- const stringKeys = val.map((v) => String(v));- if (props.singleSelect && stringKeys.length > 1) {- // For single select, keep only the most recently selected item- const newSelection = stringKeys[stringKeys.length - 1];- state.selectedReleaseNameList = new Set([newSelection]);- emit("update:checked-row-keys", [newSelection]);- } else {- state.selectedReleaseNameList = new Set(stringKeys);- emit("update:checked-row-keys", stringKeys);- }-};--// Watch for external selection changes-watch(- () => props.selectedRowKeys,- (newKeys) => {- state.selectedReleaseNameList = new Set(newKeys);- }-);--// Clean up selected items that are no longer in the list-watch(- () => props.releaseList,- (list) => {- const oldReleaseNames = Array.from(state.selectedReleaseNameList.values());- const newReleaseNames = new Set(list.map((release) => release.name));- oldReleaseNames.forEach((name) => {- if (!newReleaseNames.has(name)) {- state.selectedReleaseNameList.delete(name);- }- });- }-);-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue b/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vuedeleted file mode 100644index dd76ee04e9..0000000000--- a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/ReleaseFileTable.vue+++ /dev/null@@ -1,154 +0,0 @@-<template>- <NDataTable- size="small"- :columns="columnList"- :data="files"- :row-props="rowProps"- :striped="true"- :row-key="(file) => file.path"- :checked-row-keys="selectedFileIds"- @update:checked-row-keys="(val) => onRowSelected(val as string[])"- />-</template>--<script setup lang="tsx">-import { type DataTableColumn, NDataTable } from "naive-ui";-import { computed, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import {- type Release_File,- Release_Type,-} from "@/types/proto-es/v1/release_service_pb";--const props = withDefaults(- defineProps<{- files: Release_File[];- releaseType: Release_Type;- showSelection?: boolean;- rowClickable?: boolean;- selectedFiles?: Release_File[];- }>(),- {- showSelection: false,- rowClickable: true,- selectedFiles: () => [],- }-);--const emit = defineEmits<{- (event: "row-click", e: MouseEvent, val: Release_File): void;- (event: "update:selected-files", val: Release_File[]): void;-}>();--const { t } = useI18n();--// Track currently selected file paths, initialize with prop values-const selectedFileIds = ref<string[]>(props.selectedFiles.map((f) => f.path));--const columnList = computed(() => {- const columns: (DataTableColumn<Release_File> & {- hide?: boolean;- })[] = [- {- type: "selection",- hide: !props.showSelection,- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- },- {- key: "version",- title: t("common.version"),- width: 160,- ellipsis: true,- className: "textlabel",- render: (file) => file.version,- },- {- key: "type",- title: t("common.type"),- width: 64,- resizable: true,- render: (file) => getReleaseFileTypeText(file),- },- {- key: "filename",- title: t("database.revision.filename"),- width: 128,- ellipsis: true,- render: (file) => file.path || "-",- },- ];- return columns.filter((column) => !column.hide);-});--const getReleaseFileTypeText = (_file: Release_File) => {- switch (props.releaseType) {- case Release_Type.DECLARATIVE:- return "SDL";- case Release_Type.VERSIONED:- // Ghost configuration is now in sheet content via directive (-- ghost = {...})- return t("issue.title.change-database");- case Release_Type.TYPE_UNSPECIFIED:- return "";- default:- props.releaseType satisfies never;- return "";- }-};--const rowProps = (file: Release_File) => {- return {- style: props.rowClickable || props.showSelection ? "cursor: pointer;" : "",- onClick: (e: MouseEvent) => {- // Check if we're in selection mode- if (props.showSelection) {- // Don't toggle if clicking on the checkbox itself- const target = e.target as HTMLElement;- if (target.closest(".n-checkbox")) {- return;- }-- // Trigger selection through NDataTable's mechanism- // We need to maintain the current selection and toggle this file- const currentSelectedIds = selectedFileIds.value;- const filePath = file.path;-- let newSelectedIds: string[];- if (currentSelectedIds.includes(filePath)) {- // Deselect- newSelectedIds = currentSelectedIds.filter((id) => id !== filePath);- } else {- // Select- newSelectedIds = [...currentSelectedIds, filePath];- }-- onRowSelected(newSelectedIds);- } else if (props.rowClickable) {- // Emit row-click event for other purposes- emit("row-click", e, file);- }- },- };-};--const onRowSelected = (val: string[]) => {- selectedFileIds.value = val;- emit(- "update:selected-files",- val.map((path) => props.files.find((f) => f.path === path)!)- );-};--// Watch for external selection changes-watch(- () => props.selectedFiles,- (newFiles) => {- selectedFileIds.value = newFiles.map((f) => f.path);- }-);-</script>diff --git a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.ts b/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.tsdeleted file mode 100644index 4d5929e26a..0000000000--- a/frontend/src/components/Release/ReleaseDetail/ReleaseFileTable/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import ReleaseFileTable from "./ReleaseFileTable.vue";--export default ReleaseFileTable;diff --git a/frontend/src/components/Release/VCSIcon.vue b/frontend/src/components/Release/VCSIcon.vuedeleted file mode 100644index 3f2aa62672..0000000000--- a/frontend/src/components/Release/VCSIcon.vue+++ /dev/null@@ -1,37 +0,0 @@-<template>- <img :class="['h-4 w-auto', customClass]" :src="icon" />-</template>--<script lang="ts" setup>-import { computed } from "vue";-import { VCSType } from "@/types/proto-es/v1/common_pb";--const props = defineProps<{- customClass?: string;- type: VCSType;-}>();--const icon = computed(() => {- let iconType = "";- switch (props.type) {- case VCSType.AZURE_DEVOPS:- iconType = "azure-devops";- break;- case VCSType.GITLAB:- iconType = "gitlab";- break;- case VCSType.GITHUB:- iconType = "github";- break;- case VCSType.BITBUCKET:- iconType = "bitbucket";- break;- default:- iconType = "";- }- if (iconType === "") {- return iconType;- }- return new URL(`../../assets/git/${iconType}.svg`, import.meta.url).href;-});-</script>diff --git a/frontend/src/components/RequireEnterpriseButton.vue b/frontend/src/components/RequireEnterpriseButton.vuedeleted file mode 100644index a9ee2e71a2..0000000000--- a/frontend/src/components/RequireEnterpriseButton.vue+++ /dev/null@@ -1,17 +0,0 @@-<template>- <NButton v-bind="$attrs" @click="requireSubscription">- <template #icon>- <slot name="icon"></slot>- </template>- <slot name="default"></slot>- </NButton>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { ENTERPRISE_INQUIRE_LINK } from "@/types";--const requireSubscription = () => {- window.open(ENTERPRISE_INQUIRE_LINK, "_blank");-};-</script>diff --git a/frontend/src/components/Revision/RevisionDataTable.vue b/frontend/src/components/Revision/RevisionDataTable.vuedeleted file mode 100644index 3e82ed5f90..0000000000--- a/frontend/src/components/Revision/RevisionDataTable.vue+++ /dev/null@@ -1,135 +0,0 @@-<template>- <NDataTable- key="revision-table"- size="small"- :columns="columnList"- :data="revisions"- :row-key="(revision: Revision) => revision.name"- :striped="true"- :row-props="rowProps"- :loading="loading"- :checked-row-keys="[...selectedRevisionNames]"- @update:checked-row-keys="- (keys) => (selectedRevisionNames = new Set(keys as string[]))- "- />-- <div- v-if="showSelection && selectedRevisionNames.size > 0"- class="sticky bottom-0 w-full flex items-center gap-x-2 bg-white py-2"- >- <NButton size="small" type="error" quaternary @click="onDelete">- <template #icon>- <TrashIcon class="w-4 h-auto" />- </template>- {{ $t("common.delete") }}- </NButton>- </div>-</template>--<script lang="tsx" setup>-import { TrashIcon } from "lucide-vue-next";-import { type DataTableColumn, NButton, NDataTable, useDialog } from "naive-ui";-import { computed, ref } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { useRevisionStore } from "@/store";-import { getDateForPbTimestampProtoEs } from "@/types";-import type { Revision } from "@/types/proto-es/v1/revision_service_pb";-import { getRevisionType, revisionLink } from "@/utils/v1/revision";-import HumanizeDate from "../misc/HumanizeDate.vue";--const props = defineProps<{- revisions: Revision[];- customClick?: boolean;- showSelection?: boolean;- loading?: boolean;-}>();--const emit = defineEmits<{- (event: "row-click", revision: Revision): void;- (event: "delete"): void;-}>();--const { t } = useI18n();-const router = useRouter();-const dialog = useDialog();-const revisionStore = useRevisionStore();--const selectedRevisionNames = ref<Set<string>>(new Set());--const columnList = computed(() => {- const columns: (DataTableColumn<Revision> & { hide?: boolean })[] = [- {- type: "selection",- hide: !props.showSelection,- width: "2rem",- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- },- {- key: "version",- title: t("common.version"),- minWidth: 160,- resizable: true,- render: (revision) => revision.version,- },- {- key: "type",- title: t("common.type"),- width: 128,- render: (revision) => getRevisionType(revision.type),- },- {- key: "created-at",- title: t("common.created-at"),- width: 180,- render: (revision) => (- <HumanizeDate- date={getDateForPbTimestampProtoEs(revision.createTime)}- />- ),- },- ];- return columns.filter((col) => !col.hide);-});--const rowProps = (revision: Revision) => {- return {- onClick: (e: MouseEvent) => {- if (props.customClick) {- emit("row-click", revision);- return;- }-- const url = revisionLink(revision);- if (e.ctrlKey || e.metaKey) {- window.open(url, "_blank");- } else {- router.push(url);- }- },- };-};--const onDelete = () => {- dialog.warning({- title: t("bbkit.confirm-button.sure-to-delete"),- content: t("database.revision.delete-confirm-dialog"),- negativeText: t("common.cancel"),- positiveText: t("common.confirm"),- onPositiveClick: async () => {- for (const name of selectedRevisionNames.value) {- await revisionStore.deleteRevision(name);- }- selectedRevisionNames.value = new Set();- emit("delete");- },- });-};-</script>diff --git a/frontend/src/components/Revision/index.ts b/frontend/src/components/Revision/index.tsdeleted file mode 100644index 2e60e931af..0000000000--- a/frontend/src/components/Revision/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import RevisionDataTable from "./RevisionDataTable.vue";--export { RevisionDataTable };diff --git a/frontend/src/components/Role/Setting/components/RequiredBasicPermissionAlert.vue b/frontend/src/components/Role/Setting/components/RequiredBasicPermissionAlert.vuedeleted file mode 100644index 0891ee34b0..0000000000--- a/frontend/src/components/Role/Setting/components/RequiredBasicPermissionAlert.vue+++ /dev/null@@ -1,32 +0,0 @@-<template>- <NAlert- v-if="permissions.length > 0"- v-bind="$attrs"- type="error"- :title="title"- >- <template #icon>- <ShieldAlertIcon />- </template>- <div>- {{ $t("common.required-workspace-permission") }}- <ul class="list-disc pl-4">- <li v-for="permission in permissions" :key="permission">- {{ permission }}- </li>- </ul>- <slot name="action" />- </div>- </NAlert>-</template>--<script lang="tsx" setup>-import { ShieldAlertIcon } from "lucide-vue-next";-import { NAlert } from "naive-ui";-import { type Permission } from "@/types";--defineProps<{- permissions: Permission[];- title: string;-}>();-</script>\ No newline at end of filediff --git a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/DatabaseResourceSelector.vuedeleted file mode 100644index 4b0630a6cb..0000000000--- a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/DatabaseResourceSelector.vue+++ /dev/null@@ -1,667 +0,0 @@-<template>- <div class="w-full relative flex flex-col gap-y-2">- <AdvancedSearch- v-model:params="params"- :autofocus="false"- :placeholder="$t('database.filter-database')"- :scope-options="scopeOptions"- :cache-query="false"- />- <NTransfer- id="database-resource-selector"- v-model:value="selectedValueList"- class="h-[min(512px,60vh)]"- :disabled="disabled"- :options="sourceTransferOptions"- :render-source-list="renderSourceList"- :render-target-list="renderTargetList"- />- <div- v-if="initializeStatus !== 'DONE'"- class="z-1 absolute inset-0 bg-white bg-opacity-80 flex flex-row justify-center items-center"- >- <BBSpin size="large" />- </div>- </div>-</template>--<script setup lang="tsx">-import { useDebounceFn } from "@vueuse/core";-import { orderBy, uniqBy } from "lodash-es";-import type { TransferRenderSourceList, TreeOption } from "naive-ui";-import { NButton, NTransfer, NTree } from "naive-ui";-import { computed, h, onMounted, ref, watch, watchEffect } from "vue";-import { useI18n } from "vue-i18n";-import { BBSpin } from "@/bbkit";-import AdvancedSearch from "@/components/AdvancedSearch";-import { useCommonSearchScopeOptions } from "@/components/AdvancedSearch/useCommonSearchScopeOptions";-import {- type DatabaseFilter,- useDatabaseV1Store,- useDBSchemaV1Store,-} from "@/store";-import {- environmentNamePrefix,- instanceNamePrefix,-} from "@/store/modules/v1/common";-import { type DatabaseResource, DEBOUNCE_SEARCH_DELAY } from "@/types";-import { Engine } from "@/types/proto-es/v1/common_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- CommonFilterScopeIdList,- extractProjectResourceName,- getDefaultPagination,- getValueFromSearchParams,- getValuesFromSearchParams,- type SearchParams,-} from "@/utils";-import type { DatabaseTreeOption } from "./common";-import {- flattenTreeOptions,- getSchemaOrTableTreeOptions,- mapTreeOptions,- parseStringToResource,-} from "./common";-import Label from "./Label.vue";--const props = defineProps<{- disabled?: boolean;- projectName: string;- includeCloumn: boolean;- databaseResources: DatabaseResource[];-}>();--const emit = defineEmits<{- (- e: "update:databaseResources",- databaseResourceList: DatabaseResource[]- ): void;-}>();--const databaseStore = useDatabaseV1Store();-const dbSchemaStore = useDBSchemaV1Store();-const { t } = useI18n();--const scopeOptions = useCommonSearchScopeOptions([- ...CommonFilterScopeIdList,- "project",- "label",- "engine",- "table",-]);--const parseResourceToKeys = (resource: DatabaseResource): string[] => {- const columns = [...(resource.columns ?? [])];- if (columns.length === 0) {- columns.push("");- }-- const keys: string[] = [];- for (const column of columns) {- const data = [- resource.databaseFullName,- "schemas",- resource.schema,- "tables",- resource.table,- "columns",- column,- ];- while (data.length > 0) {- const item = data.pop();- if (!item) {- data.pop();- continue;- }- data.push(item);- break;- }- keys.push(data.join("/"));- }-- return keys;-};--const getInitParams = (): SearchParams => {- return {- query: "",- scopes: [- {- id: "project",- value: extractProjectResourceName(props.projectName),- readonly: true,- },- ],- };-};--const params = ref<SearchParams>(getInitParams());-watch(- () => props.projectName,- () => (params.value = getInitParams()),- { immediate: true }-);--const selectedValueList = ref<string[]>([]);-const expandedKeys = ref<string[]>([]);-const indeterminateKeys = ref<string[]>([]);-const initializeStatus = ref<"PENDING" | "PROCESSING" | "DONE">("PENDING");-const databaseList = ref<Database[]>([]);-const fetchDataState = ref<{- nextPageToken?: string;- loading: boolean;-}>({- loading: false,-});--const cascadeLoopTreeNode = (- treeNode: DatabaseTreeOption,- callback: (node: DatabaseTreeOption) => void-) => {- callback(treeNode);- for (const child of treeNode?.children ?? []) {- cascadeLoopTreeNode(child, callback);- }-};--const selectedInstance = computed(() => {- return getValueFromSearchParams(params.value, "instance", instanceNamePrefix);-});--const selectedEnvironment = computed(() => {- return getValueFromSearchParams(- params.value,- "environment",- environmentNamePrefix- );-});--const selectedTable = computed(() => {- return getValueFromSearchParams(params.value, "table");-});--const collectExpandedKeys = async ({- database,- table,-}: {- database: string;- table: string;-}) => {- const databaseMetadata = await dbSchemaStore.getOrFetchDatabaseMetadata({- database,- });- if (!databaseMetadata) {- return;- }- expandedKeys.value.push(database);- for (const schema of databaseMetadata.schemas) {- expandedKeys.value.push(`${database}/schemas/${schema.name}`);- for (const t of schema.tables) {- if (t.name === table) {- expandedKeys.value.push(- `${database}/schemas/${schema.name}/tables/${t.name}`- );- }- }- }-};--const filterTableList = computed(() => {- if (!selectedTable.value) {- return undefined;- }-- return expandedKeys.value;-});--const selectedLabels = computed(() => {- return getValuesFromSearchParams(params.value, "label");-});--const selectedEngines = computed(() => {- return getValuesFromSearchParams(params.value, "engine").map(- (engine) => Engine[engine as keyof typeof Engine]- );-});--const databaseFilter = computed(- (): DatabaseFilter => ({- instance: selectedInstance.value,- environment: selectedEnvironment.value,- query: params.value.query,- labels: selectedLabels.value,- engines: selectedEngines.value,- table: selectedTable.value,- })-);--const fetchDatabaseList = useDebounceFn(async () => {- fetchDataState.value.loading = true;- const pageToken = fetchDataState.value.nextPageToken;-- try {- const { databases, nextPageToken } = await databaseStore.fetchDatabases({- pageSize: getDefaultPagination(),- pageToken,- parent: props.projectName,- filter: databaseFilter.value,- silent: true,- });-- if (pageToken) {- databaseList.value.push(...databases);- databaseList.value = uniqBy(databaseList.value, (db) => db.name);- } else {- databaseList.value = databases;- }- fetchDataState.value.nextPageToken = nextPageToken;- } finally {- fetchDataState.value.loading = false;- }-}, DEBOUNCE_SEARCH_DELAY);--const refreshData = async () => {- fetchDataState.value.nextPageToken = "";- expandedKeys.value = [];- await fetchDatabaseList();-- if (!params.value.query && params.value.scopes.length === 1) {- databaseList.value = uniqBy(- [- ...databaseList.value,- ...props.databaseResources.map((resource) =>- databaseStore.getDatabaseByName(resource.databaseFullName)- ),- ],- (db) => db.name- );- }-- if (databaseFilter.value.table) {- // expand all- for (const database of databaseList.value) {- await collectExpandedKeys({- database: database.name,- table: databaseFilter.value.table,- });- }- }-};--watch(- () => databaseFilter.value,- async () => {- await refreshData();- },- { deep: true }-);--onMounted(async () => {- await databaseStore.batchGetOrFetchDatabases(- props.databaseResources.map((resource) => resource.databaseFullName)- );- await refreshData();-- if (databaseList.value.length === 0) {- initializeStatus.value = "DONE";- }-});--const parseKeyToPathes = (key: string): string[] => {- if (!key) {- return [];- }-- const sections = key.split("/");- const nodePrefx = new Set(["schemas", "tables", "columns"]);- const resp: string[] = [];- const tmp: string[] = [];-- for (const section of sections) {- if (nodePrefx.has(section)) {- resp.push(tmp.join("/"));- }- tmp.push(section);- }-- if (tmp.length > 0) {- resp.push(tmp.join("/"));- }-- return resp;-};--const sourceTreeOptions = computed(() => {- return mapTreeOptions({- databaseList: databaseList.value,- includeCloumn: props.includeCloumn,- filterValueList: filterTableList.value,- });-});--const sourceTransferOptions = computed((): DatabaseTreeOption[] => {- const options = flattenTreeOptions(sourceTreeOptions.value);- return options;-});--watchEffect(async () => {- if (initializeStatus.value !== "PENDING") {- return;- }- if (sourceTransferOptions.value.length === 0) {- return;- }-- initializeStatus.value = "PROCESSING";-- const selectedKeys: string[] = [];- const databaseNames = new Set<string>();- for (const databaseResource of props.databaseResources) {- selectedKeys.push(...parseResourceToKeys(databaseResource));- databaseNames.add(databaseResource.databaseFullName);- }-- await Promise.all(- [...databaseNames].map(async (databaseName) => {- await dbSchemaStore.getOrFetchDatabaseMetadata({- database: databaseName,- });- })- );-- const newCheckedKeys = new Set<string>([]);- const newIndeterminateKeys = new Set<string>([]);- const newExpandedKeys = new Set(- // expand parents for selected keys- selectedKeys- .map((key) => {- const pathes = parseKeyToPathes(key);- // key: {db}/schemas/{schema}- // expaned: [{db}]- //- // key: {db}/schemas/{schema}/tables/{table}- // expaned: [{db}, {db}/schemas/{schema}]- //- // key: {db}/schemas/{schema}/tables/{table}/columns/{column}- // expaned: [{db}, {db}/schemas/{schema}, {db}/schemas/{schema}/tables/{table}]- pathes.pop();- return pathes;- })- .flat()- );-- for (const selectedKey of selectedKeys) {- const checkedNode = sourceTransferOptions.value.find(- (option) => option.value === selectedKey- );- if (!checkedNode) {- continue;- }- newCheckedKeys.add(selectedKey);- // loop to check and expand all children- cascadeLoopTreeNode(checkedNode, (treeNode) => {- newCheckedKeys.add(treeNode.value);- if (treeNode.children) {- newExpandedKeys.add(treeNode.value);- }- });-- // add parent pathes to indeterminate keys- const parentPathes = parseKeyToPathes(checkedNode.value);- parentPathes.pop();- while (parentPathes.length > 0) {- const parentPath = parentPathes.pop() as string;- // move the parent to the indeterminate keys.- if (!newCheckedKeys.has(parentPath)) {- newIndeterminateKeys.add(parentPath);- }- }- }-- selectedValueList.value = [...newCheckedKeys];- expandedKeys.value = [...newExpandedKeys];- indeterminateKeys.value = [...newIndeterminateKeys];-- initializeStatus.value = "DONE";-});--const onTreeNodeLoad = async (node: TreeOption) => {- const treeNode = node as DatabaseTreeOption;- if (treeNode.level === "databases") {- await dbSchemaStore.getOrFetchDatabaseMetadata({- database: treeNode.value,- });- const database = await databaseStore.getOrFetchDatabaseByName(- treeNode.value- );- const children = getSchemaOrTableTreeOptions({- database,- includeCloumn: props.includeCloumn,- });- if (children && children.length > 0) {- treeNode.children = children;- treeNode.isLeaf = false;- } else {- treeNode.isLeaf = true;- }- }-};--const renderSourceList: TransferRenderSourceList = ({ onCheck, pattern }) => {- return h(- "div",- { class: "flex flex-col gap-y-2 pb-4" },- {- default: () => [- h(NTree, {- keyField: "value",- cascade: true,- allowCheckingNotLoaded: true,- checkable: true,- selectable: false,- checkOnClick: true,- disabled: props.disabled,- data: sourceTreeOptions.value,- blockLine: true,- renderLabel: ({ option }: { option: TreeOption }) => {- return h(Label, {- option: option as DatabaseTreeOption,- keyword: pattern,- });- },- pattern,- showIrrelevantNodes: false,- expandedKeys: expandedKeys.value,- checkedKeys: selectedValueList.value,- indeterminateKeys: indeterminateKeys.value,- onLoad: onTreeNodeLoad,- onUpdateExpandedKeys: (keys: string[]) => {- expandedKeys.value = keys;- },- onUpdateCheckedKeys: async (- checkedKeys: string[],- _: Array<TreeOption | null>,- meta: { node: TreeOption | null; action: "check" | "uncheck" }- ) => {- if (!meta.node) {- return;- }-- const oldIndeterminateKeys = new Set(indeterminateKeys.value);- const newCheckedKeys = new Set(checkedKeys);- const oldCheckedKeys = new Set(selectedValueList.value);- const treeNode = meta.node as DatabaseTreeOption;-- const checkNodeAndAllChildren = async () => {- await onTreeNodeLoad(treeNode);- // refresh node in case the schema is updated- const checkedNode = sourceTransferOptions.value.find(- (option) => option.value === treeNode.value- );- if (checkedNode) {- // check and expand all children- cascadeLoopTreeNode(checkedNode, (treeNode) => {- newCheckedKeys.add(treeNode.value);- if (treeNode.children) {- expandedKeys.value.push(treeNode.value);- }- });- }- };-- if (meta.action === "check") {- oldIndeterminateKeys.delete(treeNode.value);- await checkNodeAndAllChildren();-- const parentPathes = parseKeyToPathes(treeNode.value);- parentPathes.pop();- while (parentPathes.length > 0) {- const parentPath = parentPathes.pop() as string;- // If users not manually select the parent,- // then DONOT check the parent,- // move the parent to the indeterminate keys instead.- if (- !oldCheckedKeys.has(parentPath) &&- newCheckedKeys.has(parentPath)- ) {- newCheckedKeys.delete(parentPath);- oldIndeterminateKeys.add(parentPath);- }- }- } else {- if (oldIndeterminateKeys.has(treeNode.value)) {- // uncheck an indeterminate key should be check- oldIndeterminateKeys.delete(treeNode.value);-- await checkNodeAndAllChildren();- } else {- // loop parent pathes to check if we need to update the indeterminate keys- const parentPathes = parseKeyToPathes(treeNode.value);- parentPathes.pop();- while (parentPathes.length > 0) {- const parentPath = parentPathes.pop() as string;- if (!oldIndeterminateKeys.has(parentPath)) {- continue;- }- if (- !checkedKeys.find((key) => key.startsWith(`${parentPath}/`))- ) {- oldIndeterminateKeys.delete(parentPath);- }- }- }- }-- selectedValueList.value = [...newCheckedKeys];- onCheck([...newCheckedKeys]);- indeterminateKeys.value = [...oldIndeterminateKeys];- },- }),- fetchDataState.value.nextPageToken- ? h(- "div",- { class: "w-full flex items-center justify-center" },- h(- NButton,- {- quaternary: true,- size: "small",- loading: fetchDataState.value.loading,- onClick: fetchDatabaseList,- },- {- default: () => t("common.load-more"),- }- )- )- : undefined,- ],- }- );-};--const targetTreeOptions = computed(() => {- if (selectedValueList.value.length === 0) {- return [];- }-- const nodes = mapTreeOptions({- databaseList: databaseList.value,- filterValueList: selectedValueList.value,- includeCloumn: props.includeCloumn,- });-- for (const databaseNode of nodes) {- if (!databaseNode.children || databaseNode.children.length === 0) {- databaseNode.isLeaf = true;- }- }- return nodes;-});--const renderTargetList: TransferRenderSourceList = () => {- return h(NTree, {- keyField: "value",- checkable: false,- selectable: false,- defaultExpandAll: true,- disabled: props.disabled,- data: targetTreeOptions.value,- blockLine: true,- virtualScroll: true,- style: "height: calc(100% - 44px)",- renderLabel: ({ option }: { option: TreeOption }) => {- const node = option as DatabaseTreeOption;- return (- <Label- option={node}- class={- selectedValueList.value.includes(node.value)- ? "text-indigo-700 font-medium"- : "textinfolabel"- }- />- );- },- showIrrelevantNodes: false,- checkedKeys: selectedValueList.value,- });-};--watch(selectedValueList, (selectedValueList) => {- const orderedList = orderBy(selectedValueList, (item) => item.length, "asc");- const filteredKeyList: string[] = [];- for (const key of orderedList) {- const parentExisted = filteredKeyList.some((parent) =>- key.startsWith(`${parent}/`)- );- // If the parent node is selected, means all children should be selected.- // So we can ignore the children.- // For example, select table "employee"."public"."employee" and all its fields "emp_no" & "name",- // we only need the "employee"."public"."employee" to build the database resource,- // and the expression only need table level too (ignore the column means column = "*")- if (!parentExisted) {- filteredKeyList.push(key);- }- }-- const resources = filteredKeyList.map(parseStringToResource);- const resourceMap = new Map<string, DatabaseResource>();- for (const resource of resources) {- if (!resource) {- continue;- }- const tmp: DatabaseResource = {- ...resource,- columns: [],- };- const key = parseResourceToKeys(tmp)[0];- if (!resourceMap.has(key)) {- resourceMap.set(key, tmp);- }- resourceMap.get(key)?.columns?.push(...(resource.columns ?? []));- }-- emit("update:databaseResources", [...resourceMap.values()]);-});-</script>diff --git a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/Label.vue b/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/Label.vuedeleted file mode 100644index b63e18d48f..0000000000--- a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/Label.vue+++ /dev/null@@ -1,77 +0,0 @@-<template>- <div class="w-full flex items-center truncate gap-x-1">- <span v-if="environment" class="text-gray-400">- (<EnvironmentV1Name :environment="environment" :link="false" />)- </span>- <Prefix />- <!-- eslint-disable-next-line vue/no-v-html -->- <span v-html="optionName" />- <span v-if="database" class="ml-1 text-gray-500 flex flex-row items-center">- (<InstanceV1Name- :instance="getInstanceResource(database)"- :link="false"- class="whitespace-nowrap"- />)- </span>- </div>-</template>--<script setup lang="ts">-import { computedAsync } from "@vueuse/core";-import { computed, h } from "vue";-import { EnvironmentV1Name, InstanceV1Name } from "@/components/v2";-import { useDatabaseV1Store } from "@/store";-import {- getDatabaseEnvironment,- getHighlightHTMLByRegExp,- getInstanceResource,-} from "@/utils";-import DatabaseIcon from "~icons/heroicons-outline/circle-stack";-import TableIcon from "~icons/heroicons-outline/table-cells";-import SchemaIcon from "~icons/heroicons-outline/view-columns";-import type { DatabaseTreeOption } from "./common";--const props = defineProps<{- option: DatabaseTreeOption;- keyword?: string;-}>();--const option = computed(() => props.option);--const database = computedAsync(() => {- const { option } = props;- if (option.level !== "databases") return undefined;- return useDatabaseV1Store().getOrFetchDatabaseByName(option.value);-});--const environment = computed(() => {- const { option } = props;- if (option.level !== "databases") return undefined;- if (!database.value) return undefined;- return getDatabaseEnvironment(database.value);-});--const Prefix = () => {- if (option.value.level === "databases") {- return h(DatabaseIcon, {- class: "w-4 h-auto text-gray-400 shrink-0",- });- } else if (option.value.level === "schemas") {- return h(SchemaIcon, {- class: "w-4 h-auto text-gray-400 shrink-0",- });- } else if (option.value.level === "tables") {- return h(TableIcon, {- class: "w-4 h-auto text-gray-400 shrink-0",- });- }- return null;-};--const optionName = computed(() => {- const name = option.value?.label ?? "";- const keyword = (props.keyword ?? "").trim();-- return getHighlightHTMLByRegExp(name, keyword, false /* !caseSensitive */);-});-</script>diff --git a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vue b/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vuedeleted file mode 100644index 7f241a5053..0000000000--- a/frontend/src/components/RoleGrantPanel/DatabaseResourceForm/index.vue+++ /dev/null@@ -1,286 +0,0 @@-<template>- <div class="w-full mb-2">- <NRadioGroup- :value="state.radioValue"- :disabled="disabled || state.loading"- class="w-full flex! flex-col sm:flex-row justify-start sm:items-center gap-2 sm:gap-4"- @update:value="onSelectUpdate"- >- <NTooltip trigger="hover">- <template #trigger>- <NRadio- :value="'ALL'"- :label="$t('issue.role-grant.all-databases')"- />- </template>- {{ $t("issue.role-grant.all-databases-tip") }}- </NTooltip>- <NRadio class="leading-6!" :value="'EXPRESSION'" :disabled="!project">- <div class="flex items-center gap-x-1">- <FeatureBadge :feature="requiredFeature" />- <span>{{ $t("issue.role-grant.use-cel") }}</span>- </div>- </NRadio>- <NRadio class="leading-6!" :value="'SELECT'" :disabled="!project">- <div class="flex items-center gap-x-1">- <FeatureBadge :feature="requiredFeature" />- <span>{{ $t("issue.role-grant.manually-select") }}</span>- </div>- </NRadio>- </NRadioGroup>- </div>- <div- v-if="state.radioValue === 'SELECT'"- class="w-full flex flex-row justify-start items-center"- >- <DatabaseResourceSelector- v-model:database-resources="state.databaseResources"- :disabled="disabled || state.loading"- :project-name="project.name"- :include-cloumn="includeCloumn"- />- </div>- <ExprEditor- v-if="state.radioValue === 'EXPRESSION'"- :expr="state.expr"- :readonly="disabled || state.loading"- :factor-list="factorList"- :option-config-map="factorOptionConfigMap"- :factor-operator-override-map="factorOperatorOverrideMap"- />- <FeatureModal- :open="state.showFeatureModal"- :feature="requiredFeature"- @cancel="state.showFeatureModal = false"- />-</template>--<script lang="ts" setup>-import { cloneDeep, head } from "lodash-es";-import { NRadio, NRadioGroup, NTooltip } from "naive-ui";-import { computed, reactive, watch } from "vue";-import ExprEditor from "@/components/ExprEditor";-import { type OptionConfig } from "@/components/ExprEditor/context";-import { FeatureBadge, FeatureModal } from "@/components/FeatureGuard";-import { getClassificationLevelOptions } from "@/components/SensitiveData/components/utils";-import type { ConditionGroupExpr, Factor, Operator } from "@/plugins/cel";-import {- buildCELExpr,- emptySimpleExpr,- resolveCELExpr,- validateSimpleExpr,- wrapAsGroup,-} from "@/plugins/cel";-import { hasFeature, useProjectByName } from "@/store";-import { type DatabaseResource } from "@/types";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import {- batchConvertCELStringToParsedExpr,- getDatabaseNameOptionConfig,-} from "@/utils";-import {- CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,- CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME,- CEL_ATTRIBUTE_RESOURCE_DATABASE,- CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,- CEL_ATTRIBUTE_RESOURCE_TABLE_NAME,-} from "@/utils/cel-attributes";-import {- convertFromExpr,- stringifyConditionExpression,-} from "@/utils/issue/cel";-import DatabaseResourceSelector from "./DatabaseResourceSelector.vue";--type RadioValue = "ALL" | "EXPRESSION" | "SELECT";--interface LocalState {- loading: boolean;- radioValue?: RadioValue;- expr: ConditionGroupExpr;- showFeatureModal: boolean;- databaseResources: DatabaseResource[];-}--const props = withDefaults(- defineProps<{- disabled?: boolean;- projectName: string;- requiredFeature: PlanFeature;- includeCloumn: boolean;- includeClassificationLevel?: boolean;- databaseResources?: DatabaseResource[];- }>(),- {- disabled: false,- includeClassificationLevel: false,- databaseResources: undefined,- }-);--const state = reactive<LocalState>({- loading: false,- showFeatureModal: false,- databaseResources: props.databaseResources || [],- expr: wrapAsGroup(emptySimpleExpr()),-});--const convertToDatabaseResourceList = async (expr: ConditionGroupExpr) => {- try {- const parsedExpr = await buildCELExpr(expr);- if (!parsedExpr) {- return;- }- const conditionExpr = convertFromExpr(parsedExpr);- return conditionExpr.databaseResources;- } catch {- return;- }-};--const convertToConditionGroupExpr = async (- databaseResources: DatabaseResource[]-) => {- if (databaseResources.length === 0) {- return wrapAsGroup(emptySimpleExpr());- }-- try {- const expression = stringifyConditionExpression({- databaseResources,- });-- const parsedExprs = await batchConvertCELStringToParsedExpr([expression]);- const celExpr = head(parsedExprs);- if (celExpr) {- return wrapAsGroup(resolveCELExpr(celExpr));- }- } catch {- return;- }-};--const onSelectUpdate = async (select: RadioValue) => {- if (!hasRequiredFeature.value && select !== "ALL") {- state.showFeatureModal = true;- return;- }-- state.loading = true;- if (select === "EXPRESSION" && state.radioValue === "SELECT") {- // parse DatabaseResource[] to ConditionGroupExpr- const expr = await convertToConditionGroupExpr(state.databaseResources);- if (expr) {- state.expr = expr;- }- } else if (select === "SELECT" && state.radioValue === "EXPRESSION") {- // parse ConditionGroupExpr to DatabaseResource[]- const resources = await convertToDatabaseResourceList(state.expr);- if (resources) {- state.databaseResources = resources;- }- }- state.radioValue = select;- state.loading = false;-};--watch(- () => props.databaseResources,- async (databaseResources) => {- state.databaseResources = cloneDeep(databaseResources ?? []);- if (!databaseResources || databaseResources.length <= 0) {- state.radioValue = "ALL";- return;- }-- state.loading = true;- const expr = await convertToConditionGroupExpr(databaseResources);- if (expr) {- state.expr = expr;- state.radioValue = "EXPRESSION";- } else {- // fallback- state.radioValue = "SELECT";- }- state.loading = false;- },- { immediate: true, deep: true }-);--const { project } = useProjectByName(computed(() => props.projectName));-const hasRequiredFeature = computed(() => hasFeature(props.requiredFeature));--const factorList = computed((): Factor[] => {- const list: Factor[] = [- CEL_ATTRIBUTE_RESOURCE_DATABASE,- CEL_ATTRIBUTE_RESOURCE_TABLE_NAME,- CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,- ];- if (props.includeCloumn) {- list.push(CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME);- }- if (props.includeClassificationLevel) {- list.push(CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL);- }- return list;-});--const factorOperatorOverrideMap = new Map<Factor, Operator[]>([- [CEL_ATTRIBUTE_RESOURCE_DATABASE, ["_==_", "@in"]],- [CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME, ["_==_"]],- [CEL_ATTRIBUTE_RESOURCE_TABLE_NAME, ["_==_", "@in"]],- [CEL_ATTRIBUTE_RESOURCE_COLUMN_NAME, ["_==_", "@in"]],- [- CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,- ["_==_", "_!=_", "_<_", "_<=_", "_>=_", "_>_"],- ],-]);--const factorOptionConfigMap = computed((): Map<Factor, OptionConfig> => {- return factorList.value.reduce((map, factor) => {- if (factor === CEL_ATTRIBUTE_RESOURCE_DATABASE) {- map.set(factor, getDatabaseNameOptionConfig(props.projectName));- } else if (factor === CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL) {- map.set(factor, {- options: getClassificationLevelOptions(),- });- } else {- map.set(factor, {- options: [],- });- }- return map;- }, new Map<Factor, OptionConfig>());-});--defineExpose({- getDatabaseResources: async () => {- switch (state.radioValue) {- case "SELECT":- return state.databaseResources;- case "EXPRESSION": {- const resources = await convertToDatabaseResourceList(state.expr);- return resources;- }- default:- return undefined;- }- },- getExpr: () => {- if (state.radioValue !== "EXPRESSION") {- return undefined;- }- return state.expr;- },- isValid: computed(() => {- switch (state.radioValue) {- case "SELECT":- return state.databaseResources.length > 0;- case "EXPRESSION":- return validateSimpleExpr(state.expr);- default:- return true;- }- }),- isExpression: computed(() => state.radioValue === "EXPRESSION"),-});-</script>diff --git a/frontend/src/components/RolloutV1/constants.ts b/frontend/src/components/RolloutV1/constants.tsdeleted file mode 100644index 8b05d91482..0000000000--- a/frontend/src/components/RolloutV1/constants.ts+++ /dev/null@@ -1,10 +0,0 @@-/**- * Number of tasks to display per page in the task list- */-export const DEFAULT_PAGE_SIZE = 10;--/**- * Maximum characters to display in expanded SQL statement view.- * Larger statements are truncated to avoid performance issues with syntax highlighting.- */-export const MAX_STATEMENT_DISPLAY_SIZE = 10000;diff --git a/frontend/src/components/RolloutV1/index.ts b/frontend/src/components/RolloutV1/index.tsdeleted file mode 100644index 04aef1a889..0000000000--- a/frontend/src/components/RolloutV1/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./constants/task";diff --git a/frontend/src/components/RolloutV1/types.ts b/frontend/src/components/RolloutV1/types.tsdeleted file mode 100644index 18cad823e5..0000000000--- a/frontend/src/components/RolloutV1/types.ts+++ /dev/null@@ -1,8 +0,0 @@-/**- * Shared types for Rollout View v2 components- */--/**- * Available task actions for rollout operations- */-export type TaskAction = "RUN" | "SKIP" | "CANCEL";diff --git a/frontend/src/components/SQLCheck/SQLCheckButton.vue b/frontend/src/components/SQLCheck/SQLCheckButton.vuedeleted file mode 100644index a6bd6cb3ff..0000000000--- a/frontend/src/components/SQLCheck/SQLCheckButton.vue+++ /dev/null@@ -1,271 +0,0 @@-<template>- <div class="flex flex-row items-center gap-2">- <slot- name="result"- :is-running="isRunning"- :advices="filteredAdvices"- :affected-rows="checkResult?.affectedRows"- :risk-level="checkResult?.riskLevel"- >- <SQLCheckSummary- v-if="filteredAdvices && !isRunning"- :database="database"- :advices="filteredAdvices"- @click="showDetailPanel = true"- />- </slot>-- <NPopover :disabled="statementErrors.length === 0" to="body">- <template #trigger>- <NButton- style="--n-padding: 0 14px 0 10px"- :disabled="statementErrors.length > 0"- :style="buttonStyle"- tag="div"- v-bind="buttonProps"- @click="handleButtonClick"- >- <template #icon>- <BBSpin v-if="isRunning" :size="20" />- <heroicons-outline:play v-else class="w-4 h-4" />- </template>- <template #default>- <template v-if="isRunning">- {{ $t("task.checking") }}- </template>- <template v-else>- {{ $t("task.run-checks") }}- </template>- </template>- </NButton>- </template>- <template #default>- <ErrorList :errors="statementErrors" />- </template>- </NPopover>-- <SQLCheckPanel- v-if="checkResult && filteredAdvices && showDetailPanel"- :project="database.project"- :database="database"- :advices="filteredAdvices"- :affected-rows="checkResult.affectedRows"- :risk-level="checkResult.riskLevel"- :confirm="confirmDialog"- :override-title="$t('issue.sql-check.sql-review-violations')"- :show-code-location="showCodeLocation"- :allow-force-continue="allowForceContinue"- :ignore-issue-creation-restriction="ignoreIssueCreationRestriction"- @close="onPanelClose"- >- <template #row-title-extra="{ row }">- <slot name="row-title-extra" :row="row" :confirm="confirmDialog" />- </template>- </SQLCheckPanel>- </div>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { asyncComputed } from "@vueuse/core";-import type { ButtonProps } from "naive-ui";-import { NButton, NPopover } from "naive-ui";-import { computed, onMounted, onUnmounted, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { BBSpin } from "@/bbkit";-import { releaseServiceClientConnect } from "@/connect";-import type {- Database,- DatabaseMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import type { CheckReleaseResponse } from "@/types/proto-es/v1/release_service_pb";-import {- CheckReleaseRequestSchema,- CheckReleaseResponseSchema,- Release_Type,-} from "@/types/proto-es/v1/release_service_pb";-import type { Advice } from "@/types/proto-es/v1/sql_service_pb";-import { Advice_Level, AdviceSchema } from "@/types/proto-es/v1/sql_service_pb";-import type { Defer, VueStyle } from "@/utils";-import { defer } from "@/utils";-import ErrorList from "../misc/ErrorList.vue";-import { STATEMENT_SKIP_CHECK_THRESHOLD } from "./common";-import { useSQLCheckContext } from "./context";-import SQLCheckPanel from "./SQLCheckPanel.vue";-import SQLCheckSummary from "./SQLCheckSummary.vue";--const props = withDefaults(- defineProps<{- getStatement: () => Promise<{- errors: string[];- statement: string;- }>;- database: Database;- databaseMetadata?: DatabaseMetadata;- buttonProps?: ButtonProps;- buttonStyle?: VueStyle;- showCodeLocation?: boolean;- ignoreIssueCreationRestriction?: boolean;- adviceFilter?: (advices: Advice, index: number) => boolean;- }>(),- {- databaseMetadata: undefined,- buttonProps: undefined,- buttonStyle: undefined,- showCodeLocation: undefined,- ignoreIssueCreationRestriction: false,- adviceFilter: undefined,- }-);--const emit = defineEmits<{- (event: "update:advices", advices: Advice[] | undefined): void;-}>();--const { t } = useI18n();-const isRunning = ref(false);-const showDetailPanel = ref(false);-const allowForceContinue = ref(true);-const context = useSQLCheckContext();-const confirmDialog = ref<Defer<boolean>>();-const checkResult = ref<CheckReleaseResponse | undefined>();--const filteredAdvices = computed(() => {- const { adviceFilter } = props;- const advices = checkResult.value?.results.flatMap((r) => r.advices);- if (!advices) return undefined;- if (!adviceFilter) {- return advices;- }- return advices?.filter(adviceFilter);-});--const statementErrors = asyncComputed(async () => {- const { statement, errors } = await props.getStatement();- if (errors.length > 0) {- return errors;- }- if (statement.length === 0) {- return [t("issue.sql-check.statement-is-required")];- }- if (new Blob([statement]).size > STATEMENT_SKIP_CHECK_THRESHOLD) {- return [t("issue.sql-check.statement-is-too-large")];- }- return [];-}, []);--const runCheckInternal = async (statement: string) => {- const { database } = props;- const request = create(CheckReleaseRequestSchema, {- parent: database.project,- release: {- type: Release_Type.VERSIONED,- files: [- {- // Use "0" for dummy version.- version: "0",- // Ghost directive (-- ghost = {...}) is embedded in the statement if enabled- statement: new TextEncoder().encode(statement),- },- ],- },- targets: [database.name],- });- const response = await releaseServiceClientConnect.checkRelease(request);- return response;-};--const handleButtonClick = async () => {- await runChecks();-- if (hasError.value) {- const d = defer<boolean>();- d.promise.finally(onPanelClose);- showDetailPanel.value = true;- return d.promise;- }-};--const runChecks = async () => {- if (statementErrors.value.length > 0) {- return;- }-- const handleErrors = (errors: string[]) => {- // Mock the pre-check errors to advices.- checkResult.value = create(CheckReleaseResponseSchema, {- results: [- {- advices: errors.map((err) =>- create(AdviceSchema, {- title: "Pre check",- status: Advice_Level.WARNING,- content: err,- })- ),- },- ],- });- isRunning.value = false;- };-- isRunning.value = true;- const { statement, errors } = await props.getStatement();- allowForceContinue.value = errors.length === 0;- if (new Blob([statement]).size > STATEMENT_SKIP_CHECK_THRESHOLD) {- return handleErrors([t("issue.sql-check.statement-is-too-large")]);- }- if (errors.length > 0) {- return handleErrors(errors);- }- try {- checkResult.value = await runCheckInternal(statement);- } finally {- isRunning.value = false;- }-};--const onPanelClose = () => {- showDetailPanel.value = false;- confirmDialog.value = undefined;-};--const hasError = computed(() => {- return filteredAdvices.value?.some(- (advice) =>- advice.status === Advice_Level.ERROR ||- advice.status === Advice_Level.WARNING- );-});--onMounted(() => {- if (!context) return;- context.runSQLCheck.value = async () => {- if (statementErrors.value.length > 0) {- return true;- }-- await runChecks();- if (hasError.value) {- const d = defer<boolean>();- confirmDialog.value = d;- d.promise.finally(onPanelClose);-- showDetailPanel.value = true;-- return d.promise;- }-- return true;- };-});--onUnmounted(() => {- if (!context) return;- context.runSQLCheck.value = undefined;-});--watch(filteredAdvices, (advices) => {- emit("update:advices", advices);-});-</script>diff --git a/frontend/src/components/SQLCheck/SQLCheckPanel.vue b/frontend/src/components/SQLCheck/SQLCheckPanel.vuedeleted file mode 100644index fd69afcb4d..0000000000--- a/frontend/src/components/SQLCheck/SQLCheckPanel.vue+++ /dev/null@@ -1,160 +0,0 @@-<template>- <BBModal- :title="overrideTitle ?? $t('task.check-result.title-general')"- class="w-4xl!"- header-class="whitespace-pre-wrap break-all gap-x-1"- container-class="pt-0! -mt-px"- mask-closable- @close="onClose"- >- <div class="w-full flex flex-row gap-2 mb-2">- <NTag round v-if="riskLevelText">- <span class="text-gray-400 text-sm mr-1">{{- $t("issue.risk-level.self")- }}</span>- <span class="text-sm font-medium">- {{ riskLevelText }}- </span>- </NTag>- <NTag round v-if="riskLevelText || (affectedRows && affectedRows > 0)">- <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>- </div>- <PlanCheckRunDetail- :plan-check-run="planCheckRun"- :database="database"- :show-code-location="showCodeLocation"- >- <template #row-title-extra="{ row }">- <slot name="row-title-extra" :row="row" />- </template>- </PlanCheckRunDetail>-- <div- v-if="confirm"- class="flex flex-row justify-end items-center gap-x-3 mt-3"- >- <NButton @click="onClose">- {{ $t("issue.sql-check.back-to-edit") }}- </NButton>- <NButton- v-if="allowForceContinue && !restrictIssueCreationForSQLReview"- type="primary"- @click="confirm!.resolve(true)"- >- {{ $t("common.continue-anyway") }}- </NButton>- </div>- </BBModal>-</template>--<script setup lang="ts">-import { create as createProto } from "@bufbuild/protobuf";-import { NButton, NTag } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { BBModal } from "@/bbkit";-import PlanCheckRunDetail from "@/components/PlanCheckRun/PlanCheckRunDetail.vue";-import { useProjectV1Store } from "@/store";-import { RiskLevel } from "@/types/proto-es/v1/common_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import type { PlanCheckRun } from "@/types/proto-es/v1/plan_service_pb";-import {- PlanCheckRun_Result_SqlReviewReportSchema,- PlanCheckRun_ResultSchema,- PlanCheckRun_Status,- PlanCheckRunSchema,-} from "@/types/proto-es/v1/plan_service_pb";-import { type Advice, Advice_Level } from "@/types/proto-es/v1/sql_service_pb";-import type { Defer } from "@/utils";--const props = withDefaults(- defineProps<{- project: string;- advices: Advice[];- database?: Database;- affectedRows?: bigint;- riskLevel?: RiskLevel;- overrideTitle?: string;- confirm?: Defer<boolean>;- showCodeLocation?: boolean;- allowForceContinue?: boolean;- }>(),- {- showCodeLocation: false,- allowForceContinue: true,- overrideTitle: undefined,- confirm: undefined,- }-);--const emit = defineEmits<{- (event: "close"): void;-}>();--const { t } = useI18n();-const projectStore = useProjectV1Store();--// disallow creating issues if advice statuses contains any error.-const restrictIssueCreationForSQLReview = computed((): boolean => {- const project = projectStore.getProjectByName(props.project);- return (- (project?.enforceSqlReview || false) &&- props.advices.some((advice) => advice.status === Advice_Level.ERROR)- );-});--const riskLevelText = computed(() => {- const { riskLevel } = props;- if (riskLevel === RiskLevel.LOW) {- return t("issue.risk-level.low");- } else if (riskLevel === RiskLevel.MODERATE) {- return t("issue.risk-level.moderate");- } else if (riskLevel === RiskLevel.HIGH) {- return t("issue.risk-level.high");- }- return "";-});--const planCheckRun = computed((): PlanCheckRun => {- return createProto(PlanCheckRunSchema, {- status: PlanCheckRun_Status.DONE,- results: props.advices.map((advice) => {- let status = Advice_Level.ADVICE_LEVEL_UNSPECIFIED;- switch (advice.status) {- case Advice_Level.SUCCESS:- status = Advice_Level.SUCCESS;- break;- case Advice_Level.WARNING:- status = Advice_Level.WARNING;- break;- case Advice_Level.ERROR:- status = Advice_Level.ERROR;- break;- }- return createProto(PlanCheckRun_ResultSchema, {- status,- title: advice.title,- code: advice.code,- content: advice.content,- report: {- case: "sqlReviewReport",- value: createProto(PlanCheckRun_Result_SqlReviewReportSchema, {- startPosition: advice.startPosition,- }),- },- });- }),- });-});--const onClose = () => {- props.confirm?.resolve(false);- emit("close");-};-</script>diff --git a/frontend/src/components/SQLCheck/SQLCheckSummary.vue b/frontend/src/components/SQLCheck/SQLCheckSummary.vuedeleted file mode 100644index 2580b1b991..0000000000--- a/frontend/src/components/SQLCheck/SQLCheckSummary.vue+++ /dev/null@@ -1,56 +0,0 @@-<template>- <div v-if="summary.warningCount === 0 && summary.errorCount === 0">- <heroicons:check class="w-4 h-4 text-success" />- </div>- <NButton v-else quaternary size="small" @click="$emit('click')">- <div class="inline-flex items-center gap-x-1">- <heroicons:exclamation-circle class="w-4 h-4 text-error" />- <span>{{ summary.errorCount }}</span>- <heroicons:exclamation-triangle class="w-4 h-4 text-warning" />- <span>{{ summary.warningCount }}</span>- </div>- </NButton>-</template>--<script setup lang="ts">-import { NButton } from "naive-ui";-import { computed } from "vue";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import type { Advice } from "@/types/proto-es/v1/sql_service_pb";-import { Advice_Level } from "@/types/proto-es/v1/sql_service_pb";--type Summary = {- successCount: number;- warningCount: number;- errorCount: number;-};--const props = defineProps<{- database: Database;- advices: Advice[];-}>();--defineEmits<{- (event: "click"): void;-}>();--const summary = computed(() => {- const summary: Summary = {- successCount: 0,- warningCount: 0,- errorCount: 0,- };- props.advices.forEach((advice) => {- if (advice.status === Advice_Level.SUCCESS) {- summary.successCount++;- }- if (advice.status === Advice_Level.WARNING) {- summary.warningCount++;- }- if (advice.status === Advice_Level.ERROR) {- summary.errorCount++;- }- });- return summary;-});-</script>diff --git a/frontend/src/components/SQLCheck/common.ts b/frontend/src/components/SQLCheck/common.tsdeleted file mode 100644index 452e7f9ea3..0000000000--- a/frontend/src/components/SQLCheck/common.ts+++ /dev/null@@ -1,3 +0,0 @@-// STATEMENT_SKIP_CHECK_THRESHOLD is the MaxSheetCheckSize in the backend.-// Default to 2MB.-export const STATEMENT_SKIP_CHECK_THRESHOLD = 2 * 1024 * 1024;diff --git a/frontend/src/components/SQLCheck/context.ts b/frontend/src/components/SQLCheck/context.tsdeleted file mode 100644index d30a7838ce..0000000000--- a/frontend/src/components/SQLCheck/context.ts+++ /dev/null@@ -1,24 +0,0 @@-import type { InjectionKey, Ref } from "vue";-import { inject, provide, ref } from "vue";--export type SQLCheckContext = {- runSQLCheck: Ref<(() => Promise<boolean>) | undefined>;-};--export const KEY = Symbol(- "bb.sql-check.context"-) as InjectionKey<SQLCheckContext>;--export const useSQLCheckContext = () => {- return inject(KEY)!;-};--export const provideSQLCheckContext = () => {- const context: SQLCheckContext = {- runSQLCheck: ref(),- };-- provide(KEY, context);-- return context;-};diff --git a/frontend/src/components/SQLCheck/index.ts b/frontend/src/components/SQLCheck/index.tsdeleted file mode 100644index ffa6133839..0000000000--- a/frontend/src/components/SQLCheck/index.ts+++ /dev/null@@ -1,6 +0,0 @@-import SQLCheckButton from "./SQLCheckButton.vue";-import SQLCheckPanel from "./SQLCheckPanel.vue";-import SQLCheckSummary from "./SQLCheckSummary.vue";--export * from "./context";-export { SQLCheckButton, SQLCheckPanel, SQLCheckSummary };diff --git a/frontend/src/components/SQLReview/components/RuleConfigComponents/RuleConfig.vue b/frontend/src/components/SQLReview/components/RuleConfigComponents/RuleConfig.vuedeleted file mode 100644index acc13eb7c6..0000000000--- a/frontend/src/components/SQLReview/components/RuleConfigComponents/RuleConfig.vue+++ /dev/null@@ -1,119 +0,0 @@-<template>- <div class="flex flex-col gap-y-4">- <div- v-for="(config, index) in rule.componentList"- :key="index"- class="flex flex-col gap-y-1"- >- <div- v-if="config.payload.type !== 'BOOLEAN'"- class="flex items-center gap-x-1"- >- <p- :class="[- 'font-medium',- size !== 'small' && 'text-lg text-control mb-2',- ]"- >- {{ configTitle(config) }}- </p>- <NTooltip v-if="configTooltip(config)">- <template #trigger>- <CircleHelpIcon class="w-4" />- </template>- <span>{{ configTooltip(config) }}</span>- </NTooltip>- </div>- <StringComponent- v-if="config.payload.type === 'STRING'"- :value="payload[index] as string"- :config="config"- :disabled="disabled"- @update:value="payload[index] = $event"- />- <NumberComponent- v-if="config.payload.type === 'NUMBER'"- :value="payload[index] as number"- :config="config"- :disabled="disabled"- @update:value="payload[index] = $event"- />- <BooleanComponent- v-else-if="config.payload.type === 'BOOLEAN'"- :title="configTitle(config)"- :tooltip="configTooltip(config)"- :value="payload[index] as boolean"- :config="config"- :disabled="disabled"- @update:value="payload[index] = $event"- />- <StringArrayComponent- v-else-if="- config.payload.type === 'STRING_ARRAY' &&- Array.isArray(payload[index])- "- :value="payload[index] as string[]"- :config="config"- :disabled="disabled"- @update:value="payload[index] = $event"- />- <TemplateComponent- v-else-if="config.payload.type === 'TEMPLATE'"- :rule-type="ruleTypeToString(rule.type)"- :value="payload[index] as string"- :config="config"- :disabled="disabled"- @update:value="payload[index] = $event"- />- </div>- </div>-</template>--<script setup lang="ts">-import { CircleHelpIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";-import { ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import type { RuleConfigComponent, RuleTemplateV2 } from "@/types/sqlReview";-import { getRuleLocalizationKey, ruleTypeToString } from "@/types/sqlReview";-import BooleanComponent from "./BooleanComponent.vue";-import NumberComponent from "./NumberComponent.vue";-import StringArrayComponent from "./StringArrayComponent.vue";-import StringComponent from "./StringComponent.vue";-import TemplateComponent from "./TemplateComponent.vue";-import type { PayloadValueType } from "./types";-import { getRulePayload } from "./utils";--const props = defineProps<{- rule: RuleTemplateV2;- disabled: boolean;- size: "small" | "medium";-}>();--const { t, te } = useI18n();-const payload = ref<PayloadValueType[]>([]);--const configTitle = (config: RuleConfigComponent): string => {- const key = `sql-review.rule.${getRuleLocalizationKey(- ruleTypeToString(props.rule.type)- )}.component.${config.key}.title`;- return t(key);-};--const configTooltip = (config: RuleConfigComponent): string => {- const key = `sql-review.rule.${getRuleLocalizationKey(- ruleTypeToString(props.rule.type)- )}.component.${config.key}.tooltip`;- return te(key) ? t(key) : "";-};--watch(- () => props.rule.componentList,- () => (payload.value = getRulePayload(props.rule)),- { immediate: true }-);--defineExpose({- payload,-});-</script>diff --git a/frontend/src/components/SQLReview/components/RuleLevelSwitch.vue b/frontend/src/components/SQLReview/components/RuleLevelSwitch.vuedeleted file mode 100644index 473413ebf3..0000000000--- a/frontend/src/components/SQLReview/components/RuleLevelSwitch.vue+++ /dev/null@@ -1,108 +0,0 @@-<template>- <div class="flex items-center" :class="[!editable && 'pointer-events-none']">- <button- v-for="item in availableLevel"- :key="item.level"- :disabled="disabled || !editable"- :class="['button', item.class, level === item.level && 'active']"- @click="$emit('level-change', item.level)"- >- {{ item.title }}- </button>- </div>-</template>--<script lang="ts" setup>-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { SQLReviewRule_Level } from "@/types/proto-es/v1/review_config_service_pb";--const props = withDefaults(- defineProps<{- level: SQLReviewRule_Level;- disabled?: boolean;- editable?: boolean;- }>(),- {- disabled: false,- editable: true,- }-);--defineEmits<{- (event: "level-change", level: SQLReviewRule_Level): void;-}>();--const { t } = useI18n();--const availableLevel = computed(() => {- return [- {- level: SQLReviewRule_Level.ERROR,- title: t("sql-review.level.error"),- class: "error",- },- {- level: SQLReviewRule_Level.WARNING,- title: t("sql-review.level.warning"),- class: "warning",- },- ].filter((item) => props.editable || props.level === item.level);-});-</script>--<style lang="postcss" scoped>-.button {- position: relative;- padding-top: 0.25rem;- padding-bottom: 0.25rem;- width: 4.5rem;- white-space: nowrap;- border-width: 1px;- border-color: var(--color-control-border);- color: var(--color-control);- font-weight: 500;-}-.button:hover {- z-index: 2;-}-.button:disabled {- cursor: not-allowed;- background-color: var(--color-control-bg);- opacity: 0.5;-}-.button:not(:first-child) {- margin-left: -1px;-}-.button:first-child {- border-top-left-radius: 0.25rem;- border-bottom-left-radius: 0.25rem;-}-.button:last-child {- border-top-right-radius: 0.25rem;- border-bottom-right-radius: 0.25rem;-}-.button.active {- z-index: 1;-}-.button.error.active {- background-color: var(--color-red-100);- color: var(--color-red-800);- border-color: var(--color-red-800);-}-.button.warning.active {- background-color: var(--color-yellow-100);- color: var(--color-yellow-800);- border-color: var(--color-yellow-800);-}-.button:not(:disabled).error:hover {- background-color: var(--color-red-100);- color: var(--color-red-800);- border-color: var(--color-red-800);-}-.button:not(:disabled).warning:hover {- background-color: var(--color-yellow-100);- color: var(--color-yellow-800);- border-color: var(--color-yellow-800);-}-</style>diff --git a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue b/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vuedeleted file mode 100644index fba81cbf5b..0000000000--- a/frontend/src/components/SQLReview/components/SQLReviewPolicyDataTable.vue+++ /dev/null@@ -1,186 +0,0 @@-<template>- <NDataTable- key="sql-review-table"- :size="size"- :striped="true"- :columns="columns"- :data="reviewList"- :row-props="rowProps"- :row-key="(review: SQLReviewPolicy) => review.id"- />-</template>--<script setup lang="tsx">-import { CheckIcon, PencilIcon, Trash2Icon, XIcon } from "lucide-vue-next";-import type { DataTableColumn } from "naive-ui";-import { NCheckbox, NDataTable, NPopconfirm, NTag } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { MiniActionButton } from "@/components/v2";-import Resource from "@/components/v2/ResourceOccupiedModal/Resource.vue";-import { pushNotification, useSQLReviewStore } from "@/store";-import type { SQLReviewPolicy } from "@/types";-import { getHighlightHTMLByRegExp, hasWorkspacePermissionV2 } from "@/utils";--const props = withDefaults(- defineProps<{- size?: "small" | "medium";- reviewList: SQLReviewPolicy[];- filter?: string;- customClick?: boolean;- allowEdit: boolean;- }>(),- {- size: "medium",- filter: "",- customClick: false,- }-);--const emit = defineEmits<{- (event: "row-click", review: SQLReviewPolicy): void;- (event: "edit", review: SQLReviewPolicy): void;- (event: "delete", review: SQLReviewPolicy): void;-}>();--const { t } = useI18n();-const sqlReviewStore = useSQLReviewStore();--const columns = computed(- (): (DataTableColumn<SQLReviewPolicy> & { hide?: boolean })[] => {- return [- {- title: t("common.name"),- key: "name",- width: 200,- resizable: true,- render: (review: SQLReviewPolicy) => {- return <div innerHTML={highlight(review.name)} />;- },- },- {- title: t("common.resource"),- key: "resource",- resizable: true,- width: 250,- render: (review: SQLReviewPolicy) => {- return (- <div class="flex flex-wrap gap-2">- {review.resources.length === 0 && <span>-</span>}- {review.resources.map((resource) => {- return (- <NTag key={resource} size="small" type="primary">- <Resource- resource={resource}- showPrefix={true}- link={true}- />- </NTag>- );- })}- </div>- );- },- },- {- title: t("sql-review.enabled-rules"),- key: "rules",- render: (review: SQLReviewPolicy) => {- return <span>{review.ruleList.length}</span>;- },- },- {- title: () => {- return <div class="capitalize">{t("common.enabled")}</div>;- },- key: "enabled",- width: "7rem",- render: (review: SQLReviewPolicy) => {- return props.allowEdit ? (- <NCheckbox- disabled={!hasUpdatePolicyPermission.value || !props.allowEdit}- checked={review.enforce}- onUpdate:checked={(on) => toggleReviewEnabled(review, on)}- />- ) : review.enforce ? (- <CheckIcon class="w-4 h-4 textinfolabel" />- ) : (- <XIcon class="w-4 h-4 textinfolabel" />- );- },- },- {- title: t("common.operations"),- key: "operations",- width: "10rem",- hide: !props.allowEdit,- render: (review: SQLReviewPolicy) => {- return (- <div class="flex items-center gap-x-2">- {hasDeletePolicyPermission.value && (- <NPopconfirm- positiveButtonProps={{ type: "error" }}- onPositiveClick={() => emit("delete", review)}- >- {{- trigger: () => (- <MiniActionButton type="error">- <Trash2Icon />- </MiniActionButton>- ),- default: () => t("common.delete") + ` '${review.name}'?`,- }}- </NPopconfirm>- )}- <MiniActionButton onClick={() => emit("edit", review)}>- <PencilIcon />- </MiniActionButton>- </div>- );- },- },- ].filter((item) => !item.hide);- }-);--const highlight = (content: string) => {- return getHighlightHTMLByRegExp(- content,- props.filter.toLowerCase().split(" "),- /* !caseSensitive */ false,- /* className */ "bg-yellow-100"- );-};--const rowProps = (review: SQLReviewPolicy) => {- return {- style: props.customClick ? "cursor: pointer;" : "",- onClick: () => {- if (props.customClick) {- emit("row-click", review);- return;- }- },- };-};--const hasUpdatePolicyPermission = computed(() => {- return hasWorkspacePermissionV2("bb.reviewConfigs.update");-});--const hasDeletePolicyPermission = computed(() => {- return hasWorkspacePermissionV2("bb.reviewConfigs.delete");-});--const toggleReviewEnabled = async (review: SQLReviewPolicy, on: boolean) => {- await sqlReviewStore.upsertReviewPolicy({- id: review.id,- enforce: on,- });- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });-};-</script>diff --git a/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue b/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vuedeleted file mode 100644index 671b4334d8..0000000000--- a/frontend/src/components/SQLReview/components/SQLRuleEditDialog.vue+++ /dev/null@@ -1,120 +0,0 @@-<template>- <BBModal- :title="getRuleLocalization(ruleTypeToString(rule.type), rule.engine).title"- @close="$emit('cancel')"- >- <div class="flex flex-col gap-y-4 w-[calc(100vw-5rem)] sm:w-[40rem] pb-1">- <div class="flex flex-col gap-y-1">- <div class="flex items-center gap-x-2">- <h3 class="text-lg text-control font-medium">- {{ $t("common.name") }}- </h3>- <div class="flex items-center gap-x-2">- <RichEngineName- :engine="rule.engine"- tag="p"- class="text-center text-sm text-main!"- />- </div>- </div>- <div class="textinfolabel flex items-center gap-x-2">- {{ getRuleLocalization(ruleTypeToString(rule.type), rule.engine).title }}- <a- :href="`https://docs.bytebase.com/sql-review/review-rules#${rule.type}`"- target="__blank"- class="flex flex-row gap-x-2 items-center text-base text-gray-500 hover:text-gray-900"- >- <heroicons-outline:external-link class="w-4 h-4" />- </a>- </div>- </div>- <div class="flex flex-col gap-y-1">- <h3 class="text-lg text-control font-medium">- {{ $t("sql-review.level.name") }}- </h3>- <div class="flex items-center gap-x-2 text-sm">- <RuleLevelSwitch- :level="state.level"- :disabled="disabled"- @level-change="state.level = $event"- />- </div>- </div>- <div class="flex flex-col gap-y-1">- <h3 class="text-lg text-control font-medium">- {{ $t("common.description") }}- </h3>- <div class="text-sm text-gray-700">- {{ getRuleLocalization(ruleTypeToString(rule.type), rule.engine).description || $t('common.description') }}- </div>- </div>- <RuleConfig- ref="ruleConfig"- :disabled="disabled"- :rule="rule"- :size="'medium'"- />- <div class="mt-4 pt-2 border-t flex justify-end gap-x-3">- <NButton @click.prevent="$emit('cancel')">- {{ $t("common.cancel") }}- </NButton>- <NButton type="primary" :disabled="disabled" @click.prevent="confirm">- {{ $t("common.confirm") }}- </NButton>- </div>- </div>- </BBModal>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { nextTick, reactive, ref, watch } from "vue";-import { BBModal } from "@/bbkit";-import { payloadValueListToComponentList } from "@/components/SQLReview/components";-import { RichEngineName } from "@/components/v2";-import { SQLReviewRule_Level } from "@/types/proto-es/v1/review_config_service_pb";-import type { RuleTemplateV2 } from "@/types/sqlReview";-import { getRuleLocalization, ruleTypeToString } from "@/types/sqlReview";-import RuleConfig from "./RuleConfigComponents/RuleConfig.vue";-import RuleLevelSwitch from "./RuleLevelSwitch.vue";--type LocalState = {- level: SQLReviewRule_Level;-};--const props = defineProps<{- rule: RuleTemplateV2;- disabled: boolean;-}>();--const emit = defineEmits<{- (event: "update:rule", update: Partial<RuleTemplateV2>): void;- (event: "cancel"): void;-}>();--const ruleConfig = ref<InstanceType<typeof RuleConfig>>();--const state = reactive<LocalState>({- level: props.rule.level,-});--watch(- () => props.rule.level,- () => {- state.level = props.rule.level;- }-);--const confirm = () => {- emit("update:rule", {- componentList: payloadValueListToComponentList(- props.rule,- ruleConfig.value?.payload ?? []- ),- level: state.level,- });- nextTick(() => {- emit("cancel");- });-};-</script>diff --git a/frontend/src/components/SQLReview/components/index.ts b/frontend/src/components/SQLReview/components/index.tsdeleted file mode 100644index 2750499f8c..0000000000--- a/frontend/src/components/SQLReview/components/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import SQLRuleEditDialog from "./SQLRuleEditDialog.vue";--export { SQLRuleEditDialog };-export * from "./utils";diff --git a/frontend/src/components/SQLReview/index.ts b/frontend/src/components/SQLReview/index.tsdeleted file mode 100644index 40b494c5f8..0000000000--- a/frontend/src/components/SQLReview/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from "./components";diff --git a/frontend/src/components/SchemaEditorLite/Aside/NodeCheckbox/SchemaNodeCheckbox.vue b/frontend/src/components/SchemaEditorLite/Aside/NodeCheckbox/SchemaNodeCheckbox.vuedeleted file mode 100644index 57329dd6e4..0000000000--- a/frontend/src/components/SchemaEditorLite/Aside/NodeCheckbox/SchemaNodeCheckbox.vue+++ /dev/null@@ -1,40 +0,0 @@-<template>- <NCheckbox- :checked="state.checked"- :indeterminate="state.indeterminate"- size="small"- @update:checked="update"- @click.prevent.stop- />-</template>--<script setup lang="ts">-import { NCheckbox } from "naive-ui";-import { computed } from "vue";-import { useSchemaEditorContext } from "../../context";-import type { TreeNodeForSchema } from "../common";--const props = defineProps<{- node: TreeNodeForSchema;-}>();--const { getAllTablesSelectionState, updateAllTablesSelection } =- useSchemaEditorContext();--const state = computed(() => {- return getAllTablesSelectionState(- props.node.db,- props.node.metadata,- props.node.metadata.schema.tables- );-});--const update = (on: boolean) => {- updateAllTablesSelection(- props.node.db,- props.node.metadata,- props.node.metadata.schema.tables,- on- );-};-</script>diff --git a/frontend/src/components/SchemaEditorLite/algorithm/utils.ts b/frontend/src/components/SchemaEditorLite/algorithm/utils.tsdeleted file mode 100644index b00480a744..0000000000--- a/frontend/src/components/SchemaEditorLite/algorithm/utils.ts+++ /dev/null@@ -1,63 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { cloneDeep } from "lodash-es";-import type {- DatabaseCatalog,- SchemaCatalog,- TableCatalog,-} from "@/types/proto-es/v1/database_catalog_service_pb";-import { TableCatalog_ColumnsSchema } from "@/types/proto-es/v1/database_catalog_service_pb";-import type {- DatabaseMetadata,- SchemaMetadata,- TableMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { keyBy } from "@/utils";--export const cleanupUnusedCatalog = (- metadata: DatabaseMetadata,- catalog: DatabaseCatalog-) => {- const cleanupColumnCatalog = (- table: TableMetadata,- tableCatalog: TableCatalog- ) => {- const columnMap = keyBy(table.columns, (column) => column.name);- // Remove unused column catalog- if (tableCatalog.kind?.case !== "columns") {- tableCatalog.kind = {- case: "columns",- value: create(TableCatalog_ColumnsSchema, {}),- };- }- tableCatalog.kind.value.columns = tableCatalog.kind.value.columns.filter(- (cc) => columnMap.has(cc.name)- );- };- const cleanupTableCatalog = (- schema: SchemaMetadata,- schemaCatalog: SchemaCatalog- ) => {- const tableMap = keyBy(schema.tables, (table) => table.name);- // Remove unused table catalog- schemaCatalog.tables = schemaCatalog.tables.filter((tc) =>- tableMap.has(tc.name)- );- // Recursively cleanup column catalog- schemaCatalog.tables.forEach((tc) => {- cleanupColumnCatalog(tableMap.get(tc.name)!, tc);- });- };-- const schemaMap = keyBy(metadata.schemas, (schema) => schema.name);- const response = cloneDeep(catalog);- // Remove unused schema catalog- response.schemas = response.schemas.filter((sc) => schemaMap.has(sc.name));- // Recursively cleanup table catalog- response.schemas.forEach((sc) => {- const schema = schemaMap.get(sc.name)!;- cleanupTableCatalog(schema, sc);- });- // Cleanup empty schema catalog- response.schemas = response.schemas.filter((sc) => sc.tables.length > 0);- return response;-};diff --git a/frontend/src/components/SensitiveData/GrantAccessDrawer.vue b/frontend/src/components/SensitiveData/GrantAccessDrawer.vuedeleted file mode 100644index 58a2b7c637..0000000000--- a/frontend/src/components/SensitiveData/GrantAccessDrawer.vue+++ /dev/null@@ -1,33 +0,0 @@-<template>- <Drawer :show="true" @close="() => emit('dismiss')">- <DrawerContent- :title="$t('settings.sensitive-data.grant-access')"- class="w-5xl max-w-[100vw] relative grant-access-drawer"- >- <GrantAccessForm- :column-list="columnList"- :project-name="projectName"- @dismiss="() => emit('dismiss')"- />- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import GrantAccessForm from "@/components/SensitiveData/GrantAccessForm.vue";-import { Drawer, DrawerContent } from "@/components/v2";-import type { SensitiveColumn } from "./types";--defineProps<{- columnList: SensitiveColumn[];- projectName: string;-}>();--const emit = defineEmits(["dismiss"]);-</script>--<style scoped lang="postcss">-.grant-access-drawer :deep(.n-drawer-body-content-wrapper) {- padding-bottom: 0 !important;-}-</style>diff --git a/frontend/src/components/SensitiveData/GrantAccessForm.vue b/frontend/src/components/SensitiveData/GrantAccessForm.vuedeleted file mode 100644index c2d517f2ed..0000000000--- a/frontend/src/components/SensitiveData/GrantAccessForm.vue+++ /dev/null@@ -1,273 +0,0 @@-<template>- <FormLayout :title="title">- <template #body>- <div class="flex flex-col gap-y-8">- <div class="w-full">- <div class="flex items-center gap-x-1 mb-2">- <span class="text-main">- {{ $t("common.resources") }}- </span>- <RequiredStar />- </div>- <DatabaseResourceForm- ref="databaseResourceFormRef"- :database-resources="databaseResources"- :project-name="projectName"- :required-feature="PlanFeature.FEATURE_DATA_MASKING"- :include-cloumn="true"- :include-classification-level="true"- />- </div>-- <div class="w-full">- <p class="mb-2 text-main">- {{ $t("common.reason") }}- </p>- <NInput- v-model:value="state.description"- :placeholder="$t('common.description')"- />- </div>-- <div class="w-full">- <p class="mb-2 text-main">- {{ $t("common.expiration") }}- </p>- <NDatePicker- v-model:value="state.expirationTimestamp"- style="width: 100%"- type="datetime"- :actions="null"- :update-value-on-close="true"- :is-date-disabled="(date: number) => date < dayjs().startOf('day').valueOf()"- clearable- />- <span v-if="!state.expirationTimestamp" class="textinfolabel">{{- $t("settings.sensitive-data.never-expires")- }}</span>- </div>-- <MembersBindingSelect- v-model:value="state.memberList"- :required="true"- :include-all-users="false"- :include-service-account="true"- :include-workload-identity="true"- />- </div>- </template>- <template #footer>- <div class="flex justify-end items-center">- <div class="flex items-center gap-x-2">- <NButton @click.prevent="onDismiss">- {{ $t("common.cancel") }}- </NButton>- <NButton- :disabled="submitDisabled || state.processing"- type="primary"- @click.prevent="onSubmit"- >- {{ $t("common.confirm") }}- </NButton>- </div>- </div>- </template>- </FormLayout>-</template>--<script lang="tsx" setup>-import { create } from "@bufbuild/protobuf";-import { NButton, NDatePicker, NInput } from "naive-ui";-import { computed, onMounted, reactive, ref } from "vue";-import { useI18n } from "vue-i18n";-import MembersBindingSelect from "@/components/Member/MembersBindingSelect.vue";-import RequiredStar from "@/components/RequiredStar.vue";-import DatabaseResourceForm from "@/components/RoleGrantPanel/DatabaseResourceForm/index.vue";-import FormLayout from "@/components/v2/Form/FormLayout.vue";-import { buildCELExpr } from "@/plugins/cel";-import { pushNotification, usePolicyV1Store, useSettingV1Store } from "@/store";-import { ExprSchema } from "@/types/proto-es/google/type/expr_pb";-import type {- MaskingExemptionPolicy_Exemption,- Policy,-} from "@/types/proto-es/v1/org_policy_service_pb";-import {- MaskingExemptionPolicy_ExemptionSchema,- MaskingExemptionPolicySchema,- PolicyResourceType,- PolicyType,-} from "@/types/proto-es/v1/org_policy_service_pb";-import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { batchConvertParsedExprToCELString } from "@/utils";-import { rewriteResourceDatabase } from "./exemptionDataUtils";-import type { SensitiveColumn } from "./types";-import {- convertSensitiveColumnToDatabaseResource,- getExpressionsForDatabaseResource,-} from "./utils";--const props = defineProps<{- columnList: SensitiveColumn[];- projectName: string;- title?: string;-}>();--const emit = defineEmits(["dismiss"]);--const settingStore = useSettingV1Store();-onMounted(async () => {- await settingStore.getOrFetchSettingByName(- Setting_SettingName.DATA_CLASSIFICATION,- true- );-});--interface LocalState {- memberList: string[];- expirationTimestamp?: number;- processing: boolean;- description: string;-}--const state = reactive<LocalState>({- memberList: [],- processing: false,- description: "",-});-const databaseResourceFormRef =- ref<InstanceType<typeof DatabaseResourceForm>>();--const databaseResources = computed(() => {- return props.columnList.map(convertSensitiveColumnToDatabaseResource);-});--const policyStore = usePolicyV1Store();-const { t } = useI18n();--const resetState = () => {- state.expirationTimestamp = undefined;- state.memberList = [];- state.processing = false;-};--const onDismiss = () => {- emit("dismiss");- resetState();-};--const submitDisabled = computed(() => {- if (state.memberList.length === 0) {- return true;- }- return !databaseResourceFormRef.value?.isValid;-});--const onSubmit = async () => {- state.processing = true;-- try {- const pendingUpdate = await getPendingUpdatePolicy(props.projectName);- await policyStore.upsertPolicy({- parentPath: props.projectName,- policy: pendingUpdate,- });- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.created"),- });- onDismiss();- } finally {- state.processing = false;- }-};--const getPendingUpdatePolicy = async (- parentPath: string-): Promise<Partial<Policy>> => {- const exemptions: MaskingExemptionPolicy_Exemption[] = [];-- const extraExpressions: string[] = [];- if (state.expirationTimestamp) {- extraExpressions.push(- `request.time < timestamp("${new Date(- state.expirationTimestamp- ).toISOString()}")`- );- }-- // When using CEL expression mode, build the expression string directly- // to preserve non-resource conditions like resource.classification_level.- const expr = databaseResourceFormRef.value?.getExpr?.();- if (expr) {- const parsedExpr = await buildCELExpr(expr);- if (parsedExpr) {- let [celString] = await batchConvertParsedExprToCELString([parsedExpr]);- // The expression editor uses `resource.database` as a convenience factor- // (e.g., resource.database == "instances/X/databases/Y"), but the backend- // masking exemption CEL evaluator only supports resource.instance_id and- // resource.database_name. Rewrite to the backend-compatible form.- celString = rewriteResourceDatabase(celString);- const parts = [celString, ...extraExpressions].filter((e) => e);- exemptions.push(- create(MaskingExemptionPolicy_ExemptionSchema, {- members: state.memberList,- condition: create(ExprSchema, {- description: state.description,- expression: parts.length > 0 ? parts.join(" && ") : "",- }),- })- );- }- } else {- // ALL or SELECT mode: use database resource conversion- const databaseResources =- await databaseResourceFormRef.value?.getDatabaseResources();-- const resourceExpressions = (- databaseResources?.map(getExpressionsForDatabaseResource) ?? [[""]]- ).map((parts) => parts.filter((e) => e).join(" && "));-- // Combine multiple resources with || into a single condition.- let resourceCondition = "";- const nonEmpty = resourceExpressions.filter((e) => e);- if (nonEmpty.length === 1) {- resourceCondition = nonEmpty[0];- } else if (nonEmpty.length > 1) {- resourceCondition = nonEmpty.map((e) => `(${e})`).join(" || ");- }-- const parts = [resourceCondition, ...extraExpressions].filter((e) => e);- exemptions.push(- create(MaskingExemptionPolicy_ExemptionSchema, {- members: state.memberList,- condition: create(ExprSchema, {- description: state.description,- expression: parts.length > 0 ? parts.join(" && ") : "",- }),- })- );- }-- const policy = await policyStore.getOrFetchPolicyByParentAndType({- parentPath,- policyType: PolicyType.MASKING_EXEMPTION,- });- const existed =- policy?.policy?.case === "maskingExemptionPolicy"- ? policy.policy.value.exemptions- : [];- return {- name: policy?.name,- type: PolicyType.MASKING_EXEMPTION,- resourceType: PolicyResourceType.PROJECT,- policy: {- case: "maskingExemptionPolicy",- value: create(MaskingExemptionPolicySchema, {- exemptions: [...existed, ...exemptions],- }),- },- };-};-</script>diff --git a/frontend/src/components/SensitiveData/components/ClassificationLevelBadge.vue b/frontend/src/components/SensitiveData/components/ClassificationLevelBadge.vuedeleted file mode 100644index 591eedbee8..0000000000--- a/frontend/src/components/SensitiveData/components/ClassificationLevelBadge.vue+++ /dev/null@@ -1,60 +0,0 @@-<template>- <NPerformantEllipsis v-if="showText" :line-clamp="1">- <span v-if="columnClassification">- {{ columnClassification.title }}- </span>- <span v-else class="text-control-placeholder italic">- {{ placeholder }}- </span>- </NPerformantEllipsis>- <span v-if="level" :class="['ml-1 px-1 py-0.5 rounded text-xs whitespace-nowrap', levelColor]">- {{ level.title }}- </span>-</template>--<script lang="ts" setup>-import { NPerformantEllipsis } from "naive-ui";-import { computed } from "vue";-import type { DataClassificationSetting_DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";--const props = withDefaults(- defineProps<{- showText?: boolean;- classification?: string;- classificationConfig?: DataClassificationSetting_DataClassificationConfig;- placeholder?: string;- }>(),- {- showText: true,- classification: undefined,- classificationConfig: undefined,- placeholder: "N/A",- }-);--const bgColorList = [- "bg-green-200",- "bg-yellow-200",- "bg-orange-300",- "bg-amber-500",- "bg-red-500",-];--const columnClassification = computed(() => {- if (!props.classification || !props.classificationConfig) {- return;- }- return props.classificationConfig.classification[props.classification];-});--const levelColor = computed(() => {- const lvl = columnClassification.value?.level ?? 0;- return bgColorList[lvl - 1] ?? "bg-gray-200";-});--const level = computed(() => {- return (props.classificationConfig?.levels ?? []).find(- (l) => l.level === columnClassification.value?.level- );-});-</script>diff --git a/frontend/src/components/SensitiveData/components/SelectClassificationDrawer.vue b/frontend/src/components/SensitiveData/components/SelectClassificationDrawer.vuedeleted file mode 100644index 9fa9ca1bbb..0000000000--- a/frontend/src/components/SensitiveData/components/SelectClassificationDrawer.vue+++ /dev/null@@ -1,45 +0,0 @@-<template>- <Drawer :show="show" @close="$emit('dismiss')">- <DrawerContent :title="$t('schema-template.classification.select')">- <div class="w-[25rem] h-full">- <ReactPageMount- page="ClassificationTree"- :config="classificationConfig"- :onApply="onApply"- />- </div>-- <template #footer>- <div class="w-full flex justify-between items-center">- <div class="w-full flex justify-end items-center gap-x-3">- <NButton @click.prevent="$emit('dismiss')">- {{ $t("common.cancel") }}- </NButton>- </div>- </div>- </template>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { Drawer, DrawerContent } from "@/components/v2";-import ReactPageMount from "@/react/ReactPageMount.vue";-import type { DataClassificationSetting_DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";--defineProps<{- show: boolean;- classificationConfig: DataClassificationSetting_DataClassificationConfig;-}>();--const emit = defineEmits<{- (event: "dismiss"): void;- (event: "apply", classificationId: string): void;-}>();--const onApply = (classificationId: string) => {- emit("apply", classificationId);- emit("dismiss");-};-</script>diff --git a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vuedeleted file mode 100644index bb3a29b803..0000000000--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue+++ /dev/null@@ -1,283 +0,0 @@-<template>- <NDataTable- key="sensitive-column-table"- :columns="dataTableColumns"- :data="columnList"- :row-key="itemKey"- :checked-row-keys="checkedItemKeys"- size="small"- @update:checked-row-keys="handleUpdateCheckedRowKeys($event as string[])"- />-</template>--<script lang="tsx" setup>-import { create } from "@bufbuild/protobuf";-import { TrashIcon } from "lucide-vue-next";-import { type DataTableColumn, NDataTable, NPopconfirm } from "naive-ui";-import { computed, h, withModifiers } from "vue";-import { useI18n } from "vue-i18n";-import { RouterLink } from "vue-router";-import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";-import SemanticTypeCell from "@/components/ColumnDataTable/SemanticTypeCell.vue";-import type {- MaskData,- MaskDataTarget,-} from "@/components/SensitiveData/types";-import { MiniActionButton } from "@/components/v2";-import {- pushNotification,- useDatabaseCatalog,- useDatabaseCatalogV1Store,- useSettingV1Store,-} from "@/store";-import type {- ColumnCatalog,- ObjectSchema,- TableCatalog,-} from "@/types/proto-es/v1/database_catalog_service_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import { DataClassificationSetting_DataClassificationConfigSchema } from "@/types/proto-es/v1/setting_service_pb";-import {- autoDatabaseRoute,- getDatabaseProject,- getInstanceResource,-} from "@/utils";--const props = defineProps<{- database: Database;- showOperation: boolean;- rowClickable: boolean;- rowSelectable: boolean;- columnList: MaskData[];- checkedColumnList: MaskData[];-}>();--const emit = defineEmits<{- (event: "delete", item: MaskData): void;- (event: "update:checkedColumnList", list: MaskData[]): void;-}>();--const { t } = useI18n();-const settingStore = useSettingV1Store();-const dbCatalogStore = useDatabaseCatalogV1Store();--const itemKey = (item: MaskData) => {- const parts = [];- const { schema, table, column } = item;- if (schema) {- parts.push(schema);- }- parts.push(table, column);- return parts.join("::");-};--const databaseCatalog = useDatabaseCatalog(props.database.name, false);--const classificationConfig = computed(() => {- return (- settingStore.getProjectClassification(- getDatabaseProject(props.database).dataClassificationConfigId- ) ?? create(DataClassificationSetting_DataClassificationConfigSchema, {})- );-});--const checkedItemKeys = computed(() => {- return props.checkedColumnList.map(itemKey);-});--const dataTableColumns = computed(() => {- const columns: DataTableColumn<MaskData>[] = [- {- key: "table",- title: t("common.table"),- resizable: true,- width: "minmax(min-content, auto)",- render(item) {- return (- <div>- <RouterLink- to={{- ...autoDatabaseRoute(props.database),- query: {- schema: item.schema,- table: item.table,- },- hash: "overview",- }}- class="normal-link"- exactActiveClass=""- >- {item.schema ? `${item.schema}.${item.table}` : item.table}- </RouterLink>- </div>- );- },- },- {- key: "column",- title: t("database.column"),- resizable: true,- width: "minmax(min-content, auto)",- render(item) {- return item.column || "-";- },- },- {- key: "semantic-type",- title: t("settings.sensitive-data.semantic-types.table.semantic-type"),- width: "minmax(min-content, auto)",- resizable: true,- render(item) {- return (- <SemanticTypeCell- database={props.database}- semanticTypeId={item.semanticTypeId}- readonly={!props.showOperation || item.disableSemanticType}- onApply={(id: string) => onSemanticTypeApply(item, id)}- />- );- },- },- {- key: "classification",- title: t("database.classification.self"),- width: "minmax(min-content, auto)",- resizable: true,- render(item) {- return (- <ClassificationCell- classification={item.classificationId}- classificationConfig={classificationConfig.value}- engine={getInstanceResource(props.database).engine}- readonly={!props.showOperation || item.disableClassification}- onApply={(id: string) => onClassificationIdApply(item, id)}- />- );- },- },- ];- if (props.showOperation) {- columns.push({- key: "operation",- title: t("common.operation"),- width: "6rem",- render(item) {- return h(- NPopconfirm,- {- onPositiveClick: () => {- onMaskingClear(item);- },- },- {- trigger: () => {- return h(- MiniActionButton,- {- tag: "div",- onClick: withModifiers(() => {- // noop- }, ["stop", "prevent"]),- },- {- default: () => h(TrashIcon, { class: "w-4 h-4" }),- }- );- },- default: () =>- h(- "div",- { class: "whitespace-nowrap" },- t("settings.sensitive-data.remove-sensitive-column-tips")- ),- }- );- },- });- }- if (props.rowSelectable) {- columns.unshift({- type: "selection",- multiple: true,- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- });- }- return columns;-});--const hasSemanticType = (- target: MaskDataTarget-): target is ColumnCatalog | ObjectSchema => {- return "semanticType" in target;-};--const hasClassificationType = (- target: MaskDataTarget-): target is ColumnCatalog | TableCatalog => {- return "classification" in target;-};--const onSemanticTypeApply = async (item: MaskData, semanticType: string) => {- if (!hasSemanticType(item.target)) {- return;- }- item.target.semanticType = semanticType;- await dbCatalogStore.updateDatabaseCatalog(databaseCatalog.value);-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });-};--const onClassificationIdApply = async (- item: MaskData,- classification: string-) => {- if (!hasClassificationType(item.target)) {- return;- }- item.target.classification = classification;- await dbCatalogStore.updateDatabaseCatalog(databaseCatalog.value);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });-};--const onMaskingClear = async (item: MaskData) => {- if (hasSemanticType(item.target)) {- item.target.semanticType = "";- }- if (hasClassificationType(item.target)) {- item.target.classification = "";- }- await dbCatalogStore.updateDatabaseCatalog(databaseCatalog.value);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.removed"),- });- emit("delete", item);-};--const handleUpdateCheckedRowKeys = (keys: string[]) => {- const keysSet = new Set(keys);- const checkedList: MaskData[] = [];- for (const column of props.columnList) {- const key = itemKey(column);- if (keysSet.has(key)) {- checkedList.push(column);- }- }- emit("update:checkedColumnList", checkedList);-};-</script>diff --git a/frontend/src/components/SequenceDataTable.vue b/frontend/src/components/SequenceDataTable.vuedeleted file mode 100644index 3e3bddb03d..0000000000--- a/frontend/src/components/SequenceDataTable.vue+++ /dev/null@@ -1,139 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="sequenceList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :row-key="- (sequence: SequenceMetadata) => `${database.name}.${schemaName}.${sequence.name}`- "- :loading="loading"- :bordered="true"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NCheckbox, NDataTable, NPerformantEllipsis } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Database,- SequenceMetadata,-} from "@/types/proto-es/v1/database_service_pb";--withDefaults(- defineProps<{- database: Database;- schemaName?: string;- sequenceList: SequenceMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const columns = computed(() => {- const columns: (DataTableColumn<SequenceMetadata> & {- hide?: boolean;- })[] = [- {- key: "name",- title: t("common.name"),- resizable: true,- render: (seq) => {- return (- <NPerformantEllipsis>- {{- default: () => seq.name,- }}- </NPerformantEllipsis>- );- },- },- {- key: "dataType",- title: t("db.sequence.data-type"),- resizable: true,- render: (seq) => {- return seq.dataType;- },- },- {- key: "start",- title: t("db.sequence.start"),- resizable: true,- render: (seq) => {- return seq.start;- },- },- {- key: "minValue",- title: t("db.sequence.min-value"),- resizable: true,- render: (seq) => {- return seq.minValue;- },- },- {- key: "maxValue",- title: t("db.sequence.max-value"),- resizable: true,- render: (seq) => {- return (- <NPerformantEllipsis>- {{- default: () => seq.maxValue,- }}- </NPerformantEllipsis>- );- },- },- {- key: "increment",- title: t("db.sequence.increment"),- resizable: true,- render: (seq) => {- return seq.increment;- },- },- {- key: "cycle",- title: t("db.sequence.cycle"),- resizable: true,- render: (seq) => {- return <NCheckbox checked={seq.cycle} disabled={true} />;- },- },- {- key: "cacheSize",- title: t("db.sequence.cacheSize"),- resizable: true,- render: (seq) => {- return seq.cacheSize;- },- },- {- key: "lastValue",- title: t("db.sequence.lastValue"),- resizable: true,- render: (seq) => {- return (- <NPerformantEllipsis>- {{- default: () => seq.lastValue,- }}- </NPerformantEllipsis>- );- },- },- ];-- return columns.filter((column) => !column.hide);-});-</script>diff --git a/frontend/src/components/Sheet/DownloadSheetButton.vue b/frontend/src/components/Sheet/DownloadSheetButton.vuedeleted file mode 100644index 5910c5e9ae..0000000000--- a/frontend/src/components/Sheet/DownloadSheetButton.vue+++ /dev/null@@ -1,46 +0,0 @@-<template>- <NButton :loading="downloading" @click="downloadSheet">- {{ $t("common.download") }}- </NButton>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { NButton } from "naive-ui";-import { ref } from "vue";-import { sheetServiceClientConnect } from "@/connect";-import { GetSheetRequestSchema } from "@/types/proto-es/v1/sheet_service_pb";--const props = defineProps<{- sheet: string;-}>();--const downloading = ref(false);--const downloadSheet = async () => {- try {- downloading.value = true;-- const request = create(GetSheetRequestSchema, {- name: props.sheet,- raw: true,- });- const response = await sheetServiceClientConnect.getSheet(request);-- // Extract sheet ID from the name to use as filename- const sheetId = response.name.split("/").pop() || "sheet";- const filename = `${sheetId}.sql`;- const content = new TextDecoder().decode(response.content);-- const blob = new Blob([content], { type: "text/plain" });- const downloadLink = document.createElement("a");- downloadLink.href = URL.createObjectURL(blob);- downloadLink.download = filename;- document.body.appendChild(downloadLink);- downloadLink.click();- URL.revokeObjectURL(downloadLink.href);- } finally {- downloading.value = false;- }-};-</script>diff --git a/frontend/src/components/ShowMoreIcon.vue b/frontend/src/components/ShowMoreIcon.vuedeleted file mode 100644index c1ede56922..0000000000--- a/frontend/src/components/ShowMoreIcon.vue+++ /dev/null@@ -1,21 +0,0 @@-<template>- <NTooltip trigger="hover">- <template #trigger>- <heroicons-outline:question-mark-circle class="w-5 h-5" v-bind="$attrs" />- </template>- {{ content }}- </NTooltip>-</template>--<script lang="ts" setup>-import { NTooltip } from "naive-ui";--withDefaults(- defineProps<{- content: string;- }>(),- {- content: "",- }-);-</script>diff --git a/frontend/src/components/SingleFileSelector.vue b/frontend/src/components/SingleFileSelector.vuedeleted file mode 100644index be7bfccd56..0000000000--- a/frontend/src/components/SingleFileSelector.vue+++ /dev/null@@ -1,135 +0,0 @@-<template>- <div- class="transition-all hover:bg-gray-100"- :class="[- state.dropAreaActive ? 'bg-gray-300 opacity-100' : '',- disabled ? 'cursor-not-allowed' : 'cursor-pointer',- ]"- @click="onUploaderClick"- @drop="onFileDrop"- @dragover.prevent- @dragenter="state.dropAreaActive = true"- @dragleave="state.dropAreaActive = false"- >- <input- ref="uploader"- name="uploader"- type="file"- :accept="supportFileExtensions.join(',')"- class="sr-only hidden"- :disabled="disabled"- @input="onFileChange"- />- <slot>- <NEmpty v-if="showNoDataPlaceholder" class="py-4"></NEmpty>- <div class="text-sm text-gray-600 inline-flex pointer-events-none">- <span- class="relative cursor-pointer rounded-md font-medium text-indigo-600 hover:text-indigo-500 focus-within:outline-hidden focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-indigo-500"- >- {{ $t("settings.general.workspace.select-logo") }}- </span>- <p class="pl-1">- {{ $t("settings.general.workspace.drag-logo") }}- </p>- </div>- <p class="text-xs text-gray-500 pointer-events-none">- {{- $t("settings.general.workspace.logo-upload-tip", {- extension: supportFileExtensions.join(", "),- size: maxFileSizeInMiB,- })- }}- </p>- </slot>- </div>-</template>--<script lang="ts" setup>-import { NEmpty } from "naive-ui";-import { reactive, ref } from "vue";-import { useI18n } from "vue-i18n";-import { pushNotification } from "@/store";--interface LocalState {- dropAreaActive: boolean;-}--const props = defineProps<{- maxFileSizeInMiB: number;- disabled?: boolean;- supportFileExtensions: string[];- showNoDataPlaceholder: boolean;-}>();--const emit = defineEmits(["on-select"]);--const { t } = useI18n();--const state = reactive<LocalState>({- dropAreaActive: false,-});--const uploader = ref<HTMLInputElement>();--const onUploaderClick = () => {- uploader.value?.click();-};--const onFileChange = () => {- selectFile(uploader.value?.files);-};--const onFileDrop = (e: DragEvent) => {- e.preventDefault();- state.dropAreaActive = false;-- if (props.disabled) {- return;- }-- const files = e.dataTransfer?.files;- selectFile(files);-};--const selectFile = (files: FileList | null | undefined) => {- if (!files || !files.length) {- return;- }-- const file = files.item(0);- if (!file || !validFile(file)) {- return;- }- emit("on-select", file);- if (uploader.value) {- uploader.value.value = "";- }-};--const validFile = (file: File): boolean => {- const extension = file.name.toLowerCase().split(".").slice(-1)[0];- if (!props.supportFileExtensions.includes(`.${extension}`)) {- pushNotification({- module: "bytebase",- style: "CRITICAL",- title: t("common.file-selector.type-limit", {- extension: props.supportFileExtensions.join(", "),- }),- });- return false;- }-- if (file.size > props.maxFileSizeInMiB * 1024 * 1024) {- pushNotification({- module: "bytebase",- style: "CRITICAL",- title: t("common.file-selector.size-limit", {- size: props.maxFileSizeInMiB,- }),- });- return false;- }-- return true;-};-</script>diff --git a/frontend/src/components/StreamTable.vue b/frontend/src/components/StreamTable.vuedeleted file mode 100644index 1143a5f321..0000000000--- a/frontend/src/components/StreamTable.vue+++ /dev/null@@ -1,94 +0,0 @@-<template>- <NDataTable- size="small"- :columns="columns"- :data="streamList"- :striped="true"- :bordered="true"- :loading="loading"- />-</template>--<script lang="ts" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed, h } from "vue";-import { useI18n } from "vue-i18n";-import DefinitionView from "@/components/DefinitionView.vue";-import type {- Database,- StreamMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import {- StreamMetadata_Mode,- StreamMetadata_Type,-} from "@/types/proto-es/v1/database_service_pb";--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- streamList: StreamMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const stringifyStreamType = (t: StreamMetadata_Type): string => {- if (t === StreamMetadata_Type.DELTA) {- return "Delta";- }- return "-";-};--const stringifyStreamMode = (mode: StreamMetadata_Mode): string => {- if (mode === StreamMetadata_Mode.APPEND_ONLY) {- return "Append only";- } else if (mode === StreamMetadata_Mode.INSERT_ONLY) {- return "Insert only";- } else if (mode === StreamMetadata_Mode.MODE_UNSPECIFIED) {- return "default";- }- return "-";-};--const columns = computed((): DataTableColumn<StreamMetadata>[] => {- return [- {- title: t("common.schema"),- key: "schema",- render: () => props.schemaName,- },- {- title: t("common.name"),- key: "name",- render: (row) => row.name || "-",- },- {- title: t("common.table"),- key: "tableName",- render: (row) => row.tableName || "-",- },- {- title: t("common.type"),- key: "type",- render: (row) => stringifyStreamType(row.type),- },- {- title: t("common.mode"),- key: "mode",- render: (row) => stringifyStreamMode(row.mode),- },- {- title: t("common.definition"),- key: "definition",- render: (row) => h(DefinitionView, { definition: row.definition }),- },- ];-});-</script>diff --git a/frontend/src/components/SystemLabel.vue b/frontend/src/components/SystemLabel.vuedeleted file mode 100644index 6de9afd2a1..0000000000--- a/frontend/src/components/SystemLabel.vue+++ /dev/null@@ -1,15 +0,0 @@-<template>- <span- class="inline-flex items-center px-2 py-0.5 rounded-lg text-xs font-semibold bg-gray-100 text-gray-800"- >- {{ $t("common.system") }}- </span>-</template>--<script lang="ts">-import { defineComponent } from "vue";--export default defineComponent({- name: "SystemLabel",-});-</script>diff --git a/frontend/src/components/TableDataTable.vue b/frontend/src/components/TableDataTable.vuedeleted file mode 100644index 47f48ea8d4..0000000000--- a/frontend/src/components/TableDataTable.vue+++ /dev/null@@ -1,261 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="mixedTableList"- :row-props="rowProps"- :max-height="640"- :virtual-scroll="true"- :row-key="- (table: TableMetadata) => `${database.name}.${schemaName}.${table.name}`- "- :striped="true"- :bordered="true"- :loading="loading"- />-- <TableDetailDrawer- :show="!!state.selectedTableName"- :database-name="database.name"- :schema-name="schemaName"- :table-name="state.selectedTableName ?? ''"- :classification-config="classificationConfig"- @apply-classification="- (table: string, id: string) => onClassificationIdApply(table, id)- "- @dismiss="state.selectedTableName = undefined"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed, onMounted, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRoute, useRouter } from "vue-router";-import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";-import { updateTableCatalog } from "@/components/ColumnDataTable/utils";-import { HighlightLabelText } from "@/components/v2";-import {- featureToRef,- getTableCatalog,- useDatabaseCatalog,- useSettingV1Store,-} from "@/store/modules";-import { Engine } from "@/types/proto-es/v1/common_pb";-import type {- Database,- TableMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import {- bytesToString,- getDatabaseProject,- getInstanceResource,- hasSchemaProperty,-} from "@/utils";-import TableDetailDrawer from "./TableDetailDrawer.vue";--type LocalState = {- selectedTableName?: string;-};--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- tableList: TableMetadata[];- search?: string;- loading?: boolean;- }>(),- {- schemaName: "",- search: "",- loading: false,- }-);--const { t } = useI18n();-const route = useRoute();-const router = useRouter();-const state = reactive<LocalState>({});-const settingStore = useSettingV1Store();--onMounted(async () => {- const table = route.query.table as string;- if (table) {- state.selectedTableName = table;- }- await settingStore.getOrFetchSettingByName(- Setting_SettingName.DATA_CLASSIFICATION,- true- );-});--watch(- () => state.selectedTableName,- (table) => {- router.push({- query: {- table,- schema: props.schemaName ? props.schemaName : undefined,- },- });- }-);--const classificationConfig = computed(() => {- return settingStore.getProjectClassification(- getDatabaseProject(props.database).dataClassificationConfigId- );-});--const hasSensitiveDataFeature = featureToRef(PlanFeature.FEATURE_DATA_MASKING);--const engine = computed(() => getInstanceResource(props.database).engine);--const isPostgres = computed(() => engine.value === Engine.POSTGRES);--const hasEngineProperty = computed(() => {- return !isPostgres.value;-});--const hasPartitionTables = computed(() => {- return (- // Only show partition tables for PostgreSQL.- engine.value === Engine.POSTGRES- );-});--const databaseCatalog = useDatabaseCatalog(props.database.name, false);--const columns = computed(() => {- const columns: (DataTableColumn<TableMetadata> & { hide?: boolean })[] = [- {- key: "schema",- title: t("common.schema"),- hide: !hasSchemaProperty(engine.value),- ellipsis: {- tooltip: true,- },- render: () => {- return props.schemaName || t("db.schema.default");- },- },- {- key: "name",- title: t("common.name"),- ellipsis: {- tooltip: true,- },- render: (row) => {- return <HighlightLabelText keyword={props.search} text={row.name} />;- },- },- {- key: "engine",- title: t("database.engine"),- hide: !hasEngineProperty.value,- render: (row) => {- return row.engine;- },- },- {- key: "classification",- title: t("database.classification.self"),- hide: !hasSensitiveDataFeature.value,- resizable: true,- minWidth: 140,- render: (table) => {- const tableCatalog = getTableCatalog(- databaseCatalog.value,- props.schemaName,- table.name- );- return (- <ClassificationCell- classification={tableCatalog?.classification}- classificationConfig={classificationConfig.value}- engine={engine.value}- onApply={(id: string) => onClassificationIdApply(table.name, id)}- />- );- },- },- {- key: "partitioned",- title: t("database.partitioned"),- hide: !hasPartitionTables.value,- render: (table) => {- return table.partitions.length > 0 ? "True" : "";- },- },- {- key: "rowCountEst",- title: t("database.row-count-est"),- render: (row) => {- return String(row.rowCount);- },- },- {- key: "dataSize",- title: t("database.data-size"),- render: (row) => {- return bytesToString(Number(row.dataSize));- },- },- {- key: "indexSize",- title: t("database.index-size"),- render: (row) => {- return bytesToString(Number(row.indexSize));- },- },- {- key: "comment",- title: t("database.comment"),- ellipsis: {- tooltip: true,- },- render: (row) => {- return row.comment;- },- },- ];-- return columns.filter((column) => !column.hide);-});--const rowProps = (row: TableMetadata) => {- return {- style: "cursor: pointer;",- onClick: () => {- state.selectedTableName = row.name;- },- };-};--const mixedTableList = computed(() => {- const tableList = props.tableList;- if (props.search) {- return tableList.filter((table) => {- return table.name.toLowerCase().includes(props.search);- });- }- return tableList;-});--const onClassificationIdApply = async (- table: string,- classification: string-) => {- await updateTableCatalog({- database: props.database.name,- schema: props.schemaName,- table,- tableCatalog: {- classification,- },- });-};-</script>diff --git a/frontend/src/components/TableDetailDrawer.vue b/frontend/src/components/TableDetailDrawer.vuedeleted file mode 100644index 2bf492566a..0000000000--- a/frontend/src/components/TableDetailDrawer.vue+++ /dev/null@@ -1,565 +0,0 @@-<template>- <Drawer :show="show" @close="$emit('dismiss')">- <DrawerContent- :title="$t('database.table-detail')"- :content-props="{- bodyContentClass: 'relative',- }"- >- <div class="focus:outline-hidden w-[calc(100vw-256px)]" tabindex="0">- <MaskSpinner v-if="isFetchingTableMetadata" />- <main v-if="table" class="flex-1 relative pb-8 overflow-y-auto">- <!-- Highlight Panel -->- <div- class="px-4 pb-4 border-b border-block-border md:flex md:items-center md:justify-between"- >- <div class="flex-1 min-w-0">- <!-- Summary -->- <div class="flex items-center">- <div>- <div class="flex items-center">- <h1- class="pt-2 pb-2.5 text-xl font-bold leading-6 text-main truncate flex items-center gap-x-3"- >- {{ getTableName(table.name) }}- </h1>- </div>- </div>- </div>- <dl- class="flex flex-col gap-y-1 md:gap-y-0 md:flex-row md:flex-wrap"- >- <dt class="sr-only">{{ $t("common.environment") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.environment") }} - </span- >- <EnvironmentV1Name- :environment="effectiveEnvironment"- icon-class="textinfolabel"- />- </dd>- <dt class="sr-only">{{ $t("common.instance") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="ml-1 textlabel"- >{{ $t("common.instance") }} - </span- >- <InstanceV1Name :instance="instanceResource" />- </dd>- <dt class="sr-only">{{ $t("common.project") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.project") }} - </span- >- <ProjectV1Name- :project="projectEntity"- hash="#databases"- />- </dd>- <dt class="sr-only">{{ $t("common.database") }}</dt>- <dd class="flex items-center text-sm md:mr-4">- <span class="textlabel"- >{{ $t("common.database") }} - </span- >- <DatabaseV1Name :database="database" />- </dd>- <button- v-if="allowQuery"- type="button"- class="flex items-center text-sm textlabel cursor-pointer hover:text-accent md:mr-4 border-0 bg-transparent p-0"- @click.stop.prevent="gotoSQLEditor"- >- <span class="mr-1">{{ $t("sql-editor.self") }}</span>- <heroicons-solid:terminal class="w-5 h-5" />- </button>- <NPopover- trigger="click"- placement="bottom"- v-if="supportGetStringSchema(instanceEngineNew)"- @update:show="(show: boolean) => show"- >- <template #trigger>- <NButton- quaternary- size="tiny"- class="px-1!"- v-bind="$attrs"- >- <span class="textlabel"- >{{ $t("database.view-definition") }}- </span>- <CodeIcon class="ml-1 w-4 h-4" />- </NButton>- </template>- <TableSchemaViewer- class="w-lg! h-80!"- :database="database"- :schema="schemaName"- :object="tableName"- :type="GetSchemaStringRequest_ObjectType.TABLE"- />- </NPopover>- </dl>- </div>- </div>-- <div class="mt-6">- <div class="max-w-6xl px-6 flex flex-col gap-y-6">- <!-- Description list -->- <dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-3">- <div- v-if="hasTableEngineProperty(instanceEngineNew)"- class="col-span-1"- >- <dt class="text-sm font-medium text-control-light">- {{ $t("database.engine") }}- </dt>- <dd class="mt-1 text-semibold">- {{ table.engine }}- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.classification.self") }}- </dt>- <dd class="mt-1 flex flex-row items-center">- <ClassificationCell- :classification="tableCatalog.classification"- :classification-config="classificationConfig"- :engine="instanceEngineNew"- @apply="- (id: string) =>- $emit('apply-classification', tableName, id)- "- />- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.row-count-estimate") }}- </dt>- <dd class="mt-1 text-semibold">- {{ table.rowCount }}- </dd>- </div>-- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("database.data-size") }}- </dt>- <dd class="mt-1 text-semibold">- {{ bytesToString(Number(table.dataSize)) }}- </dd>- </div>-- <div- v-if="hasIndexSizeProperty(instanceEngineNew)"- class="col-span-1"- >- <dt class="text-sm font-medium text-control-light">- {{ $t("database.index-size") }}- </dt>- <dd class="mt-1 text-semibold">- {{ bytesToString(Number(table.indexSize)) }}- </dd>- </div>-- <template- v-if="- instanceV1HasCollationAndCharacterSet(instanceEngineNew)- "- >- <div class="col-span-1">- <dt class="text-sm font-medium text-control-light">- {{ $t("db.collation") }}- </dt>- <dd class="mt-1 text-semibold">- {{ table.collation }}- </dd>- </div>- </template>- </dl>- </div>- </div>-- <div v-if="shouldShowPartitionTablesDataTable" class="mt-6 px-6">- <div class="mb-4 w-full flex flex-row justify-between items-center">- <div class="text-lg leading-6 font-medium text-main">- {{ $t("database.partition-tables") }}- </div>- <div>- <SearchBox- :value="state.partitionTableNameSearchKeyword"- :placeholder="$t('common.filter-by-name')"- @update:value="state.partitionTableNameSearchKeyword = $event"- />- </div>- </div>- <PartitionTablesDataTable- :table="table"- :search="state.partitionTableNameSearchKeyword"- />- </div>-- <div- v-if="instanceV1SupportsColumn(instanceEngineNew)"- class="mt-6 px-6 flex flex-col gap-y-4"- >- <div class="w-full flex flex-row justify-between items-center">- <div class="text-lg leading-6 font-medium text-main">- {{ $t("database.columns") }}- </div>- <div>- <SearchBox- :value="state.columnNameSearchKeyword"- :placeholder="$t('common.filter-by-name')"- @update:value="state.columnNameSearchKeyword = $event"- />- </div>- </div>-- <ColumnDataTable- :database="database"- :schema="schemaName"- :table="table"- :is-external-table="false"- :column-list="table.columns"- :classification-config="classificationConfig"- :search="state.columnNameSearchKeyword"- />- </div>-- <div- v-if="instanceV1SupportsIndex(instanceEngineNew)"- class="mt-6 px-6 flex flex-col gap-y-4"- >- <div class="text-lg leading-6 font-medium text-main">- {{ $t("database.indexes") }}- </div>- <IndexTable :database="database" :index-list="table.indexes" />- </div>-- <div- v-if="instanceV1SupportsTrigger(instanceEngineNew)"- class="mt-6 px-6 flex flex-col gap-y-4"- >- <div class="text-lg leading-6 font-medium text-main">- {{ $t("db.triggers") }}- </div>- <TriggerDataTable- :database="database"- :schema-name="schemaName"- :table-name="tableName"- :trigger-list="table.triggers"- />- </div>-- <div- v-if="instanceV1MaskingForNoSQL(instanceEngineNew)"- class="mt-6 px-6 flex flex-col gap-y-4"- >- <div>- <div class="text-lg leading-6 font-medium text-main">- {{ $t("common.catalog") }}- </div>- <span class="text-sm text-gray-400 -translate-y-2">- {{ $t("db.catalog.description") }}- <a- href="https://api.bytebase.com/#tag/databasecatalogservice/PATCH/v1/instances/{instance}/databases/{database}/catalog"- target="__blank"- class="normal-link"- >- {{ $t("common.view-doc") }}- </a>- </span>- </div>- <NInput- type="textarea"- :autosize="{- minRows: 15,- maxRows: 50,- }"- :disabled="!hasDatabaseCatalogPermission"- v-model:value="state.tableCatalog"- />- <div- v-if="state.tableCatalog !== initTableCatalog"- class="w-full flex items-center justify-end gap-x-2 mt-2"- >- <NButton- type="primary"- :loading="state.isUploading"- @click="onCatalogUpload"- >- {{ $t("common.upload") }}- </NButton>- </div>- </div>- </main>- </div>- </DrawerContent>- </Drawer>-</template>--<script lang="ts" setup>-import { create, fromJsonString, toJsonString } from "@bufbuild/protobuf";-import { computedAsync } from "@vueuse/core";-import { cloneDeep } from "lodash-es";-import { CodeIcon } from "lucide-vue-next";-import { NButton, NInput, NPopover } from "naive-ui";-import { computed, reactive, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";-import TableSchemaViewer from "@/components/TableSchemaViewer.vue";-import {- DatabaseV1Name,- Drawer,- DrawerContent,- EnvironmentV1Name,- InstanceV1Name,- ProjectV1Name,- SearchBox,-} from "@/components/v2";-import {- getTableCatalog,- pushNotification,- useDatabaseCatalog,- useDatabaseCatalogV1Store,- useDatabaseV1Store,- useDBSchemaV1Store,-} from "@/store";-import { defaultProject, isDefaultProject } from "@/types";-import { Engine } from "@/types/proto-es/v1/common_pb";-import {- SchemaCatalogSchema,- TableCatalogSchema,-} from "@/types/proto-es/v1/database_catalog_service_pb";-import { GetSchemaStringRequest_ObjectType } from "@/types/proto-es/v1/database_service_pb";-import type { DataClassificationSetting_DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";-import {- bytesToString,- getDatabaseEnvironment,- getDatabaseProject,- getInstanceResource,- hasIndexSizeProperty,- hasProjectPermissionV2,- hasSchemaProperty,- hasTableEngineProperty,- instanceV1HasCollationAndCharacterSet,- instanceV1MaskingForNoSQL,- instanceV1SupportsColumn,- instanceV1SupportsIndex,- instanceV1SupportsTrigger,- isDatabaseV1Queryable,- supportGetStringSchema,-} from "@/utils";-import ColumnDataTable from "./ColumnDataTable/index.vue";-import { openSQLEditorForDatabase } from "./DatabaseDetail/sqlEditor";-import IndexTable from "./IndexTable.vue";-import MaskSpinner from "./misc/MaskSpinner.vue";-import PartitionTablesDataTable from "./PartitionTablesDataTable.vue";-import TriggerDataTable from "./TriggerDataTable.vue";--interface LocalState {- columnNameSearchKeyword: string;- partitionTableNameSearchKeyword: string;- tableCatalog: string;- isUploading: boolean;-}--const props = defineProps<{- show: boolean;- // Format: /databases/:databaseName- databaseName: string;- schemaName: string;- tableName: string;- classificationConfig?: DataClassificationSetting_DataClassificationConfig;-}>();--defineEmits<{- (event: "dismiss"): void;- (event: "apply-classification", table: string, id: string): void;-}>();--const { t } = useI18n();-const databaseV1Store = useDatabaseV1Store();-const dbSchemaStore = useDBSchemaV1Store();-const catalogStore = useDatabaseCatalogV1Store();-const router = useRouter();--const databaseCatalog = useDatabaseCatalog(props.databaseName, false);-const tableCatalog = computed(() =>- getTableCatalog(databaseCatalog.value, props.schemaName, props.tableName)-);--const initTableCatalog = computed(() => {- if (!tableCatalog.value) {- return toJsonString(- TableCatalogSchema,- create(TableCatalogSchema, {- name: props.tableName,- }),- { prettySpaces: 2 }- );- }-- return toJsonString(TableCatalogSchema, tableCatalog.value, {- prettySpaces: 2,- });-});--const state = reactive<LocalState>({- columnNameSearchKeyword: "",- partitionTableNameSearchKeyword: "",- tableCatalog: "{}",- isUploading: false,-});-const isFetchingTableMetadata = ref(false);--const table = computedAsync(- async () => {- const { databaseName, tableName, schemaName } = props;- if (!tableName) {- return undefined;- }- return dbSchemaStore.getOrFetchTableMetadata({- database: databaseName,- schema: schemaName,- table: tableName,- silent: false,- });- },- undefined,- {- evaluating: isFetchingTableMetadata,- }-);--const instanceResource = computed(() => {- return getInstanceResource(database.value);-});--const projectEntity = computed(() => {- return getDatabaseProject(database.value);-});--const effectiveEnvironment = computed(() => {- return getDatabaseEnvironment(database.value);-});--const hasDatabaseCatalogPermission = computed(() => {- return hasProjectPermissionV2(- projectEntity.value,- "bb.databaseCatalogs.update"- );-});--watch(- () => initTableCatalog.value,- (catalog) => {- state.tableCatalog = catalog;- },- { immediate: true, deep: true }-);--const onCatalogUpload = async () => {- const catalog = fromJsonString(TableCatalogSchema, state.tableCatalog);- if (catalog.name !== props.tableName) {- pushNotification({- module: "bytebase",- style: "CRITICAL",- title: t("common.error"),- description: `catalog name must be ${props.tableName}`,- });- return;- }- state.isUploading = true;-- try {- const pendingUploadCatalog = cloneDeep(databaseCatalog.value);- const schemaCatalog = pendingUploadCatalog.schemas.find(- (schemaCatalog) => schemaCatalog.name === props.schemaName- );- if (schemaCatalog) {- const index = schemaCatalog.tables.findIndex(- (t) => t.name === props.tableName- );- if (index >= 0) {- schemaCatalog.tables[index] = catalog;- } else {- schemaCatalog.tables.push(catalog);- }- } else {- pendingUploadCatalog.schemas.push(- create(SchemaCatalogSchema, {- name: props.schemaName,- tables: [catalog],- })- );- }- await catalogStore.updateDatabaseCatalog(pendingUploadCatalog);-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.updated"),- });- } finally {- state.isUploading = false;- }-};--const database = computed(() => {- return databaseV1Store.getDatabaseByName(props.databaseName);-});--const instanceEngine = computed(() => {- return instanceResource.value.engine;-});--const instanceEngineNew = computed(() => {- return instanceEngine.value;-});--const allowQuery = computed(() => {- if (isDefaultProject(database.value.project)) {- return hasProjectPermissionV2(- defaultProject(database.value.project),- "bb.sql.select"- );- }- return isDatabaseV1Queryable(database.value);-});--const gotoSQLEditor = () => {- openSQLEditorForDatabase({- router,- database: database.value,- schema: props.schemaName,- table: props.tableName,- });-};--const hasPartitionTables = computed(() => {- return (- // Only show partition tables for PostgreSQL.- instanceResource.value.engine === Engine.POSTGRES &&- table.value &&- table.value.partitions.length > 0- );-});--const shouldShowPartitionTablesDataTable = computed(() => {- return hasPartitionTables.value;-});--const getTableName = (tableName: string) => {- if (hasSchemaProperty(instanceEngine.value) && props.schemaName) {- return `"${props.schemaName}"."${tableName}"`;- }- return tableName;-};-</script>diff --git a/frontend/src/components/TableSchemaViewer.vue b/frontend/src/components/TableSchemaViewer.vuedeleted file mode 100644index 08b57c632e..0000000000--- a/frontend/src/components/TableSchemaViewer.vue+++ /dev/null@@ -1,75 +0,0 @@-<template>- <div- class="w-full h-auto flex flex-col justify-start items-center"- v-bind="$attrs"- >- <div class="w-full flex flex-row justify-between items-center gap-x-2 mb-2">- <div class="textlabel flex-1 truncate">- {{ resourceName }}- </div>- <div class="flex flex-row justify-end items-center">- <CopyButton :content="schemaString || ''" />- </div>- </div>- <MonacoEditor- :content="schemaString || ''"- :readonly="true"- class="border w-full h-auto grow"- />- </div>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { computed, nextTick, onMounted, ref } from "vue";-import { MonacoEditor } from "@/components/MonacoEditor";-import { CopyButton } from "@/components/v2";-import { databaseServiceClientConnect } from "@/connect";-import type {- Database,- GetSchemaStringRequest_ObjectType,-} from "@/types/proto-es/v1/database_service_pb";-import { GetSchemaStringRequestSchema } from "@/types/proto-es/v1/database_service_pb";-import { getInstanceResource, hasSchemaProperty } from "@/utils";--const props = defineProps<{- database: Database;- schema?: string;- object?: string;- type?: GetSchemaStringRequest_ObjectType;-}>();--const schemaString = ref<string | null>(null);--const engine = computed(() => {- return getInstanceResource(props.database).engine;-});--const resourceName = computed(() => {- if (props.object) {- if (hasSchemaProperty(engine.value)) {- return `${props.schema}.${props.object}`;- } else {- return props.object;- }- }- if (props.schema) {- return props.schema;- }- return props.database.name;-});--onMounted(async () => {- nextTick(async () => {- const request = create(GetSchemaStringRequestSchema, {- name: `${props.database.name}/schemaString`,- type: props.type,- schema: props.schema,- object: props.object,- });- const response =- await databaseServiceClientConnect.getSchemaString(request);- schemaString.value = response.schemaString.trim();- });-});-</script>diff --git a/frontend/src/components/TaskTable.vue b/frontend/src/components/TaskTable.vuedeleted file mode 100644index a3daa0bc74..0000000000--- a/frontend/src/components/TaskTable.vue+++ /dev/null@@ -1,87 +0,0 @@-<template>- <NDataTable- size="small"- :columns="columns"- :data="taskList"- :striped="true"- :bordered="true"- :loading="loading"- />-</template>--<script lang="ts" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed, h } from "vue";-import { useI18n } from "vue-i18n";-import DefinitionView from "@/components/DefinitionView.vue";-import type {- Database,- TaskMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { TaskMetadata_State } from "@/types/proto-es/v1/database_service_pb";--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- taskList: TaskMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const stringifyTaskState = (state: TaskMetadata_State): string => {- if (state === TaskMetadata_State.STARTED) {- return "Started";- } else if (state === TaskMetadata_State.SUSPENDED) {- return "Suspended";- }- return "-";-};--const columns = computed((): DataTableColumn<TaskMetadata>[] => {- return [- {- title: t("common.schema"),- key: "schema",- render: () => props.schemaName,- },- {- title: t("common.name"),- key: "name",- render: (row) => row.name || "-",- },- {- title: t("common.warehouse"),- key: "warehouse",- render: (row) => row.warehouse || "-",- },- {- title: t("common.schedule"),- key: "schedule",- render: (row) => row.schedule || "-",- },- {- title: t("common.state"),- key: "state",- render: (row) => stringifyTaskState(row.state),- },- {- title: t("common.condition"),- key: "condition",- render: (row) => row.condition || "-",- },- {- title: t("common.definition"),- key: "definition",- render: (row) => h(DefinitionView, { definition: row.definition }),- },- ];-});-</script>diff --git a/frontend/src/components/TransferDatabaseForm/TransferDatabaseForm.vue b/frontend/src/components/TransferDatabaseForm/TransferDatabaseForm.vuedeleted file mode 100644index 93ea33bfb3..0000000000--- a/frontend/src/components/TransferDatabaseForm/TransferDatabaseForm.vue+++ /dev/null@@ -1,235 +0,0 @@-<template>- <DrawerContent :title="$t('quick-action.transfer-in-db-title')">- <div class="px-4 w-[calc(100vw-8rem)] lg:w-240 max-w-[calc(100vw-8rem)]">- <div class="flex flex-col gap-y-4">- <TransferSourceSelector- v-model:transfer-source="state.transferSource"- v-model:search-text="state.searchText"- v-model:environment="state.environmentFilter"- v-model:instance="state.instanceFilter"- :source-project-name="sourceProject.name"- :has-permission-for-default-project="hasPermissionForDefaultProject"- />- <ProjectSelect- v-if="state.transferSource == 'OTHER'"- class="w-48!"- :include-all="false"- :include-default-project="true"- :value="state.fromProjectName"- :filter="filterSourceProject"- @update:value="changeProjectFilter($event as (string | undefined))"- />- <template- v-if="state.transferSource === 'OTHER' && !state.fromProjectName"- >- <!-- Empty -->- </template>- <div v-else class="w-full relative">- <PagedDatabaseTable- mode="PROJECT_SHORT"- :parent="sourceProjectName"- :filter="filter"- :show-selection="true"- :custom-click="true"- v-model:selected-database-names="state.selectedDatabaseNameList"- />- </div>- </div>- </div>-- <template #footer>- <div class="flex-1 flex items-center justify-between">- <NTooltip :disabled="state.selectedDatabaseNameList.length === 0">- <template #trigger>- <div class="textinfolabel">- {{- $t("database.selected-n-databases", {- n: state.selectedDatabaseNameList.length,- })- }}- </div>- </template>- <div class="mx-2">- <ul class="list-disc">- <li v-for="db in selectedDatabaseList" :key="db.name">- {{ extractDatabaseResourceName(db.name).databaseName }}- </li>- </ul>- </div>- </NTooltip>- <div class="flex items-center gap-x-3">- <NButton @click.prevent="$emit('dismiss')">- {{ $t("common.cancel") }}- </NButton>- <NButton- type="primary"- :disabled="!allowTransfer"- @click.prevent="transferDatabase"- >- {{ $t("common.transfer") }}- </NButton>- </div>- </div>- </template>- </DrawerContent>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";-import { NButton, NTooltip } from "naive-ui";-import { computed, reactive, toRef, watchEffect } from "vue";-import {- pushNotification,- useActuatorV1Store,- useDatabaseV1Store,- useProjectByName,-} from "@/store";-import { formatEnvironmentName, isValidProjectName } from "@/types";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- BatchUpdateDatabasesRequestSchema,- DatabaseSchema$,- UpdateDatabaseRequestSchema,-} from "@/types/proto-es/v1/database_service_pb";-import type { InstanceResource } from "@/types/proto-es/v1/instance_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import type { Environment } from "@/types/v1/environment";-import { extractDatabaseResourceName, hasWorkspacePermissionV2 } from "@/utils";-import { DrawerContent, ProjectSelect } from "../v2";-import { PagedDatabaseTable } from "../v2/Model/DatabaseV1Table";-import TransferSourceSelector from "./TransferSourceSelector.vue";-import type { TransferSource } from "./utils";--interface LocalState {- transferSource: TransferSource;- instanceFilter: InstanceResource | undefined;- environmentFilter: Environment | undefined;- searchText: string;- loading: boolean;- selectedDatabaseNameList: string[];- fromProjectName: string | undefined;-}--const props = withDefaults(- defineProps<{- projectName: string;- onSuccess?: (databases: Database[]) => void;- }>(),- {- onSuccess: (_: Database[]) => {},- }-);--const emit = defineEmits<{- (e: "dismiss"): void;-}>();--const actuatorStore = useActuatorV1Store();-const databaseStore = useDatabaseV1Store();--const state = reactive<LocalState>({- transferSource: "DEFAULT",- instanceFilter: undefined,- environmentFilter: undefined,- searchText: "",- selectedDatabaseNameList: [],- fromProjectName: undefined,- loading: false,-});-const { project } = useProjectByName(toRef(props, "projectName"));--const defaultProjectName = computed(- () => actuatorStore.serverInfo?.defaultProject ?? ""-);--const sourceProjectName = computed(() => {- if (state.transferSource === "DEFAULT") {- return defaultProjectName.value;- }- if (state.fromProjectName) {- return state.fromProjectName;- }- return defaultProjectName.value;-});--const { project: sourceProject } = useProjectByName(sourceProjectName);--const filter = computed(() => ({- instance: state.instanceFilter?.name,- environment: state.environmentFilter- ? formatEnvironmentName(state.environmentFilter.id)- : undefined,- query: state.searchText,-}));--const allowTransfer = computed(() => state.selectedDatabaseNameList.length > 0);--const selectedDatabaseList = computed(() =>- state.selectedDatabaseNameList.map((name) =>- databaseStore.getDatabaseByName(name)- )-);--const hasPermissionForDefaultProject = computed(() => {- return (- hasWorkspacePermissionV2("bb.databases.list") &&- hasWorkspacePermissionV2("bb.projects.update")- );-});--watchEffect(() => {- if (!hasPermissionForDefaultProject.value) {- state.transferSource = "OTHER";- }-});--const changeProjectFilter = (name: string | undefined) => {- if (!name || !isValidProjectName(name)) {- state.fromProjectName = undefined;- } else {- state.fromProjectName = name;- }-};--const filterSourceProject = (project: Project) => {- return project.name !== props.projectName;-};--const transferDatabase = async () => {- try {- state.loading = true;-- const updated = await useDatabaseV1Store().batchUpdateDatabases(- create(BatchUpdateDatabasesRequestSchema, {- parent: "-",- requests: selectedDatabaseList.value.map((database) => {- return create(UpdateDatabaseRequestSchema, {- database: create(DatabaseSchema$, {- name: database.name,- project: props.projectName,- }),- updateMask: create(FieldMaskSchema, { paths: ["project"] }),- });- }),- })- );-- const displayDatabaseName =- selectedDatabaseList.value.length > 1- ? `${selectedDatabaseList.value.length} databases`- : `'${extractDatabaseResourceName(selectedDatabaseList.value[0].name).databaseName}'`;-- props.onSuccess(updated);- emit("dismiss");-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: `Successfully transferred ${displayDatabaseName} to project '${project.value.title}'.`,- });- } finally {- state.loading = false;- }-};-</script>diff --git a/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue b/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vuedeleted file mode 100644index ff56bfbace..0000000000--- a/frontend/src/components/TransferDatabaseForm/TransferSourceSelector.vue+++ /dev/null@@ -1,108 +0,0 @@-<template>- <div>- <div- class="flex flex-col md:flex-row md:items-center gap-y-2 justify-between"- >- <div class="radio-set-row">- <NRadioGroup- :value="transferSource"- class="gap-x-4"- size="large"- @update:value="$emit('update:transferSource', $event)"- >- <NRadio :value="'OTHER'">- {{ $t("quick-action.from-projects") }}- </NRadio>- <NRadio v-if="hasPermissionForDefaultProject" :value="'DEFAULT'">- {{ $t("quick-action.from-unassigned-databases") }}- </NRadio>- </NRadioGroup>- </div>- <NInputGroup style="width: auto">- <EnvironmentSelect- class="w-40!"- :value="- environment ? formatEnvironmentName(environment.id) : undefined- "- @update:value="changeEnvironmentFilter($event as (string | undefined))"- />- <InstanceSelect- class="w-40!"- :project-name="sourceProjectName"- :value="instance?.name ?? ''"- :environment-name="environment?.name"- @update:value="changeInstanceFilter"- />- <SearchBox- class="w-40!"- :value="searchText"- :placeholder="$t('database.filter-database')"- @update:value="$emit('update:search-text', $event)"- />- </NInputGroup>- </div>- <div v-if="transferSource == 'DEFAULT'" class="textinfolabel mt-2">- {{ $t("quick-action.unassigned-db-hint") }}- </div>- </div>-</template>--<script lang="ts" setup>-import { NInputGroup, NRadio, NRadioGroup } from "naive-ui";-import { InstanceSelect, SearchBox } from "@/components/v2";-import { useEnvironmentV1Store, useInstanceResourceByName } from "@/store";-import {- formatEnvironmentName,- isValidEnvironmentName,- isValidInstanceName,-} from "@/types";-import { type InstanceResource } from "@/types/proto-es/v1/instance_service_pb";-import type { Environment } from "@/types/v1/environment";-import EnvironmentSelect from "../v2/Select/EnvironmentSelect.vue";-import type { TransferSource } from "./utils";--withDefaults(- defineProps<{- sourceProjectName: string;- transferSource: TransferSource;- hasPermissionForDefaultProject: boolean;- instance?: InstanceResource;- environment?: Environment;- searchText: string;- }>(),- {- instance: undefined,- environment: undefined,- searchText: "",- }-);--const emit = defineEmits<{- (event: "update:transferSource", src: TransferSource): void;- (event: "update:instance", instance: InstanceResource | undefined): void;- (event: "update:environment", env: Environment | undefined): void;- (event: "update:search-text", searchText: string): void;-}>();--const changeEnvironmentFilter = (name: string | undefined) => {- emit("update:instance", undefined);- if (!isValidEnvironmentName(name)) {- return emit("update:environment", undefined);- }- emit(- "update:environment",- useEnvironmentV1Store().getEnvironmentByName(name)- );-};--const changeInstanceFilter = (name: string | undefined) => {- if (!isValidInstanceName(name)) {- return emit("update:instance", undefined);- }-- emit(- "update:instance",- useInstanceResourceByName(name).instance.value as InstanceResource- );-};-</script>diff --git a/frontend/src/components/TransferDatabaseForm/index.ts b/frontend/src/components/TransferDatabaseForm/index.tsdeleted file mode 100644index 095f1297f1..0000000000--- a/frontend/src/components/TransferDatabaseForm/index.ts+++ /dev/null@@ -1,5 +0,0 @@-import TransferDatabaseForm from "./TransferDatabaseForm.vue";--export * from "./utils";--export { TransferDatabaseForm };diff --git a/frontend/src/components/TransferDatabaseForm/utils.ts b/frontend/src/components/TransferDatabaseForm/utils.tsdeleted file mode 100644index cc3b083244..0000000000--- a/frontend/src/components/TransferDatabaseForm/utils.ts+++ /dev/null@@ -1 +0,0 @@-export type TransferSource = "DEFAULT" | "OTHER";diff --git a/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vue b/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vuedeleted file mode 100644index 1a62ed1122..0000000000--- a/frontend/src/components/TransferOutDatabaseForm/TransferOutDatabaseForm.vue+++ /dev/null@@ -1,220 +0,0 @@-<template>- <DrawerContent :title="$t('database.transfer-database-to')">- <div- class="w-[calc(100vw-8rem)] lg:w-240 max-w-[calc(100vw-8rem)] h-full flex flex-col gap-y-2"- >- <div- v-if="loading"- class="absolute inset-0 z-10 bg-white/70 flex items-center justify-center"- >- <BBSpin />- </div>- <div v-else class="flex flex-col gap-y-4 pb-4">- <span class="text-main text-base">- {{ $t("database.transfer.select-databases") }}- <span class="text-red-500">*</span>- </span>- <DatabaseV1Table- :database-list="databaseList"- :show-selection="true"- v-model:selected-database-names="selectedDatabaseNameList"- />- <NDivider class="w-full" />- <NRadioGroup v-model:value="transfer" class="gap-x-4">- <NRadio value="project">- <span class="text-main text-base">- {{ $t("database.transfer.select-target-project") }}- </span>- </NRadio>- <NRadio v-if="showUnassignOption" value="unassign">- <span class="text-main text-base">- {{ $t("database.unassign") }}- </span>- </NRadio>- </NRadioGroup>- <ProjectSelect- v-if="transfer === 'project'"- v-model:value="targetProjectName"- />- </div>- </div>-- <template #footer>- <div class="flex items-center justify-end gap-x-3">- <NButton @click="$emit('dismiss')">{{ $t("common.cancel") }}</NButton>- <NTooltip :disabled="allowTransfer">- <template #trigger>- <NButton- type="primary"- :disabled="!allowTransfer"- tag="div"- @click="doTransfer"- >- {{ $t("common.transfer") }}- </NButton>- </template>- <ul>- <li v-for="(error, i) in validationErrors" :key="i">- {{ error }}- </li>- </ul>- </NTooltip>- </div>- </template>- </DrawerContent>-</template>--<script setup lang="ts">-import { create } from "@bufbuild/protobuf";-import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";-import { NButton, NDivider, NRadio, NRadioGroup, NTooltip } from "naive-ui";-import { computed, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { BBSpin } from "@/bbkit";-import { DrawerContent, ProjectSelect } from "@/components/v2";-import {- pushNotification,- useActuatorV1Store,- useDatabaseV1Store,- useProjectV1Store,-} from "@/store";-import { isDefaultProject, isValidProjectName } from "@/types";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- BatchUpdateDatabasesRequestSchema,- DatabaseSchema$,- UpdateDatabaseRequestSchema,-} from "@/types/proto-es/v1/database_service_pb";-import { autoProjectRoute, extractDatabaseResourceName } from "@/utils";-import DatabaseV1Table from "../v2/Model/DatabaseV1Table/DatabaseV1Table.vue";--const props = withDefaults(- defineProps<{- databaseList: Database[];- selectedDatabaseNames?: string[];- onSuccess?: (databases: Database[]) => void;- }>(),- {- selectedDatabaseNames: () => [],- onSuccess: (_: Database[]) => {},- }-);--const emit = defineEmits<{- (e: "dismiss"): void;-}>();--const { t } = useI18n();-const router = useRouter();-const actuatorStore = useActuatorV1Store();-const projectStore = useProjectV1Store();-const databaseStore = useDatabaseV1Store();-const loading = ref(false);-const transfer = ref<"project" | "unassign">("project");--const selectedDatabaseNameList = ref<string[]>(- props.selectedDatabaseNames ?? []-);--watch(- () => props.selectedDatabaseNames ?? [],- (list) => (selectedDatabaseNameList.value = list),- { immediate: true }-);--const selectedDatabaseList = computed(() => {- return selectedDatabaseNameList.value.map((name) => {- return databaseStore.getDatabaseByName(name);- });-});--const showUnassignOption = computed(() => {- return selectedDatabaseList.value.some((db) => !isDefaultProject(db.project));-});--const targetProjectName = ref<string>();--watch(- () => transfer.value,- (transfer) => {- if (transfer === "unassign") {- targetProjectName.value = actuatorStore.serverInfo?.defaultProject ?? "";- } else {- targetProjectName.value = undefined;- }- }-);--const validationErrors = computed(() => {- const errors: string[] = [];- if (!targetProjectName.value) {- errors.push(t("database.transfer.errors.select-target-project"));- }- if (selectedDatabaseNameList.value.length === 0) {- errors.push(t("database.transfer.errors.select-at-least-one-database"));- }- return errors;-});--const allowTransfer = computed(() => {- return validationErrors.value.length === 0;-});--const doTransfer = async () => {- const name = targetProjectName.value;- if (!name || !isValidProjectName(name)) {- return;- }-- const target = await projectStore.getOrFetchProjectByName(name);- if (!target) {- return;- }-- const databaseList = selectedDatabaseList.value.filter(- (db) => db.project !== target.name- );-- try {- loading.value = true;-- if (databaseList.length > 0) {- await useDatabaseV1Store().batchUpdateDatabases(- create(BatchUpdateDatabasesRequestSchema, {- parent: "-",- requests: databaseList.map((database) => {- return create(UpdateDatabaseRequestSchema, {- database: create(DatabaseSchema$, {- name: database.name,- project: target.name,- }),- updateMask: create(FieldMaskSchema, { paths: ["project"] }),- });- }),- })- );-- const displayDatabaseName =- databaseList.length > 1- ? `${databaseList.length} databases`- : `'${extractDatabaseResourceName(databaseList[0].name).databaseName}'`;-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: `Successfully transferred ${displayDatabaseName} to project '${target.title}'.`,- });-- router.push({- ...autoProjectRoute(target),- });- }-- props.onSuccess(databaseList);- emit("dismiss");- } finally {- loading.value = false;- }-};-</script>diff --git a/frontend/src/components/TransferOutDatabaseForm/index.ts b/frontend/src/components/TransferOutDatabaseForm/index.tsdeleted file mode 100644index 29b114a308..0000000000--- a/frontend/src/components/TransferOutDatabaseForm/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import TransferOutDatabaseForm from "./TransferOutDatabaseForm.vue";--export default TransferOutDatabaseForm;diff --git a/frontend/src/components/TriggerDataTable.vue b/frontend/src/components/TriggerDataTable.vuedeleted file mode 100644index cfdd373362..0000000000--- a/frontend/src/components/TriggerDataTable.vue+++ /dev/null@@ -1,112 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="triggerList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :row-key="(trigger: TriggerMetadata) => `${database.name}.${schemaName}.${tableName}.${trigger.name}`"- :bordered="true"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable, NPerformantEllipsis } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Database,- TriggerMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import EllipsisSQLView from "./EllipsisSQLView.vue";--defineProps({- database: {- required: true,- type: Object as PropType<Database>,- },- schemaName: {- type: String,- default: "",- },- tableName: {- type: String,- default: "",- },- triggerList: {- required: true,- type: Object as PropType<TriggerMetadata[]>,- },-});--const { t } = useI18n();--const columns = computed(() => {- const columns: (DataTableColumn<TriggerMetadata> & { hide?: boolean })[] = [- {- key: "name",- title: t("common.name"),- resizable: true,- render: (trigger) => {- return trigger.name;- },- },- {- key: "event",- title: t("db.trigger.event"),- resizable: true,- render: (trigger) => {- return trigger.event;- },- },- {- key: "timing",- title: t("db.trigger.timing"),- resizable: true,- render: (trigger) => {- return trigger.timing;- },- },- {- key: "body",- title: t("db.trigger.body"),- resizable: true,- render: (trigger) => {- return (- <EllipsisSQLView- sql={trigger.body}- lines={1}- contentStyle="line-height: 25px"- />- );- },- },- {- key: "sql-mode",- title: "SQL mode",- resizable: true,- render: (trigger) => {- return (- <NPerformantEllipsis>- {{- default: () => trigger.sqlMode,- tooltip: () => (- <div- class="text-wrap whitespace-pre wrap-break-word break-all"- style="max-width: calc(min(33vw, 320px))"- >- {trigger.sqlMode.replaceAll(",", ",\n")}- </div>- ),- }}- </NPerformantEllipsis>- );- },- },- ];-- return columns.filter((column) => !column.hide);-});-</script>diff --git a/frontend/src/components/TroubleshootLink.vue b/frontend/src/components/TroubleshootLink.vuedeleted file mode 100644index 958e3a5d19..0000000000--- a/frontend/src/components/TroubleshootLink.vue+++ /dev/null@@ -1,25 +0,0 @@-<template>- <a- class="inline-flex items-center"- :class="[color === 'normal' ? 'normal-link' : 'light-link']"- :href="url"- target="__BLANK"- >- 🐞 {{ $t("common.troubleshoot") }}- </a>-</template>--<script lang="ts" setup>-import type { PropType } from "vue";--defineProps({- url: {- type: String,- required: true,- },- color: {- type: String as PropType<"normal" | "light">,- default: "normal",- },-});-</script>diff --git a/frontend/src/components/UpgradeSubscriptionButton.vue b/frontend/src/components/UpgradeSubscriptionButton.vuedeleted file mode 100644index 1984a690a3..0000000000--- a/frontend/src/components/UpgradeSubscriptionButton.vue+++ /dev/null@@ -1,41 +0,0 @@-<template>- <div- v-if="actionText != ''"- class="flex items-center justify-end mt-2 md:mt-0 md:ml-2"- >- <NButton type="primary" class="whitespace-nowrap" @click.prevent="onClick">- {{ $t(actionText) }}- </NButton>- </div>-</template>--<script lang="ts" setup>-import { NButton } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { SETTING_ROUTE_WORKSPACE_SUBSCRIPTION } from "@/router/dashboard/workspaceSetting";-import { useSubscriptionV1Store } from "@/store";-import { ENTERPRISE_INQUIRE_LINK } from "@/types";--const { t } = useI18n();-const router = useRouter();-const subscriptionStore = useSubscriptionV1Store();--const actionText = computed(() => {- if (!subscriptionStore.showTrial) {- return t("subscription.upgrade");- }- return t("subscription.request-n-days-trial", {- days: subscriptionStore.trialingDays,- });-});--const onClick = () => {- if (subscriptionStore.showTrial) {- window.open(ENTERPRISE_INQUIRE_LINK, "_blank");- } else {- router.push({ name: SETTING_ROUTE_WORKSPACE_SUBSCRIPTION });- }-};-</script>diff --git a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vue b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vuedeleted file mode 100644index ac16bc9b6a..0000000000--- a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupMemberNameCell.vue+++ /dev/null@@ -1,51 +0,0 @@-<template>- <UserNameCell- :allow-edit="false"- :show-mfa-enabled="false"- :show-source="false"- :user="user"- :on-click-user="onClickUser"- >- <template #suffix>- <NTag- v-if="role"- size="small"- round- class="mx-1"- :type="role === GroupMember_Role.OWNER ? 'primary' : 'default'"- >- {{- (() => {- switch (role) {- case GroupMember_Role.OWNER:- return $t("settings.members.groups.form.role.owner");- case GroupMember_Role.MEMBER:- return $t("settings.members.groups.form.role.member");- default:- return "ROLE UNRECOGNIZED";- }- })()- }}- </NTag>- </template>- </UserNameCell>-</template>--<script lang="ts" setup>-import { NTag } from "naive-ui";-import { UserNameCell } from "@/components/v2/Model/cells";-import { GroupMember_Role } from "@/types/proto-es/v1/group_service_pb";-import { type User } from "@/types/proto-es/v1/user_service_pb";--withDefaults(- defineProps<{- user: User;- role?: GroupMember_Role;- onClickUser?: (user: User, event: MouseEvent) => void;- }>(),- {- role: undefined,- onClickUser: undefined,- }-);-</script>diff --git a/frontend/src/components/ViewDataTable.vue b/frontend/src/components/ViewDataTable.vuedeleted file mode 100644index 797acd6a58..0000000000--- a/frontend/src/components/ViewDataTable.vue+++ /dev/null@@ -1,77 +0,0 @@-<template>- <NDataTable- :columns="columns"- :data="viewList"- :max-height="640"- :virtual-scroll="true"- :striped="true"- :loading="loading"- :row-key="(view: ViewMetadata) => `${database.name}.${schemaName}.${view.name}`"- :bordered="true"- />-</template>--<script lang="tsx" setup>-import type { DataTableColumn } from "naive-ui";-import { NDataTable } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import type {- Database,- ViewMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import { getInstanceResource, hasSchemaProperty } from "@/utils";-import EllipsisSQLView from "./EllipsisSQLView.vue";--const props = withDefaults(- defineProps<{- database: Database;- schemaName?: string;- viewList: ViewMetadata[];- loading?: boolean;- }>(),- {- schemaName: "",- loading: false,- }-);--const { t } = useI18n();--const engine = computed(() => getInstanceResource(props.database).engine);--const columns = computed(() => {- const columns: (DataTableColumn<ViewMetadata> & { hide?: boolean })[] = [- {- key: "name",- title: t("common.name"),- render: (row) => {- return getViewName(row.name);- },- },- {- key: "name",- title: t("common.definition"),- render: (row) => {- return <EllipsisSQLView sql={row.definition} />;- },- },- {- key: "name",- title: t("common.comment"),- render: (row) => {- return row.comment;- },- },- ];-- return columns.filter((column) => !column.hide);-});--const getViewName = (viewName: string) => {- if (hasSchemaProperty(engine.value) && props.schemaName) {- return `"${props.schemaName}"."${viewName}"`;- }- return viewName;-};-</script>diff --git a/frontend/src/components/WorkspaceInstanceLicenseStats.vue b/frontend/src/components/WorkspaceInstanceLicenseStats.vuedeleted file mode 100644index a946a48685..0000000000--- a/frontend/src/components/WorkspaceInstanceLicenseStats.vue+++ /dev/null@@ -1,70 +0,0 @@-<template>- <div v-bind="$attrs">- <dt class="text-main">- {{- subscriptionStore.currentPlan === PlanType.FREE- ? $t("subscription.max-instance-count")- : $t("subscription.instance-assignment.used-and-total-license")- }}- </dt>- <div class="mt-1 text-4xl flex items-center gap-2">- <span v-if="subscriptionStore.currentPlan === PlanType.FREE">- {{ subscriptionStore.instanceCountLimit }}- </span>- <template v-else>- <span- >{{ activateLicenseCount }}- <span class="font-mono text-gray-500">/</span>- {{ totalLicenseCount }}</span- >- <NButton text size="large">- <template #icon>- <PencilIcon- class="h-8 w-8"- @click="gotoInstanceAssignment"- />- </template>- </NButton>- </template>- </div>- </div>-</template>--<script lang="ts" setup>-import { PencilIcon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { storeToRefs } from "pinia";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { INSTANCE_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";-import { useActuatorV1Store, useSubscriptionV1Store } from "@/store";-import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";--const { t } = useI18n();-const router = useRouter();-const subscriptionStore = useSubscriptionV1Store();-const actuatorStore = useActuatorV1Store();--const { instanceLicenseCount } = storeToRefs(subscriptionStore);--const totalLicenseCount = computed((): string => {- if (instanceLicenseCount.value === Number.MAX_VALUE) {- return t("common.unlimited");- }- return `${instanceLicenseCount.value}`;-});--const activateLicenseCount = computed((): string => {- return `${actuatorStore.activatedInstanceCount}`;-});--const gotoInstanceAssignment = () => {- router.push({- name: INSTANCE_ROUTE_DASHBOARD,- query: {- assignLicense: "1",- },- });-};-</script>diff --git a/frontend/src/components/misc/DroppableTextarea.vue b/frontend/src/components/misc/DroppableTextarea.vuedeleted file mode 100644index 9720992c6c..0000000000--- a/frontend/src/components/misc/DroppableTextarea.vue+++ /dev/null@@ -1,175 +0,0 @@-<template>- <div- ref="container"- class="droppable-textarea relative"- :class="{- reading: state.reading,- 'drop-over': isOverDropZone,- }"- >- <NInput- ref="inputRef"- v-model:value="state.value"- :placeholder="placeholder"- type="textarea"- v-bind="$attrs"- :disabled="disabled"- />-- <div- v-if="!state.value"- class="absolute bottom-2 left-[50%] -translate-x-1/2 flex flex-col items-center justify-center border border-control-border hover:border-accent border-dashed text-xs text-control-placeholder hover:text-accent p-2 rounded-md"- >- Or drag and drop files here.- <input- v-if="!disabled"- type="file"- class="absolute inset-0 opacity-0 cursor-pointer"- title=""- @change="handleFileChange"- />- </div>-- <div- v-if="isOverDropZone || state.reading"- class="absolute inset-0 pointer-events-none flex flex-col items-center justify-center bg-white/50 border border-accent border-dashed text-accent"- :style="{- borderRadius,- }"- >- <heroicons:arrow-up-tray v-if="isOverDropZone" class="w-8 h-8 color" />- <BBSpin v-if="state.reading" />- </div>- </div>-</template>--<script lang="ts">-export default {- inheritAttrs: false,-};-</script>--<script lang="ts" setup>-import { useDropZone, useMutationObserver } from "@vueuse/core";-import { head } from "lodash-es";-import { NInput } from "naive-ui";-import { computed, onMounted, reactive, ref, watch } from "vue";-import { useI18n } from "vue-i18n";-import { BBSpin } from "@/bbkit";-import { pushNotification } from "@/store";-import { readFileAsArrayBuffer } from "@/utils";--type LocalState = {- value: string | undefined;- reading: boolean;-};--const props = withDefaults(- defineProps<{- value: string | undefined;- placeholder?: string;- maxFileSize?: number; // in MB- disabled?: boolean;- }>(),- {- placeholder: undefined,- maxFileSize: 1,- disabled: false,- }-);--const emit = defineEmits<{- (name: "update:value", value: string | undefined): void;-}>();--const { t } = useI18n();-const state = reactive<LocalState>({- value: props.value,- reading: false,-});-const container = ref<HTMLDivElement>();-const inputRef = ref<InstanceType<typeof NInput>>();-const inputWrapperRef = computed(- () => inputRef.value?.wrapperElRef as HTMLDivElement | undefined-);-const borderRadius = ref("");--watch(- () => props.value,- (value) => (state.value = value)-);--watch(- () => state.value,- (value) => emit("update:value", value)-);--const onDrop = async (files: File[] | FileList | null) => {- // called when files are dropped on zone- const file = head(files);- if (file) {- const { maxFileSize } = props;- if (maxFileSize > 0 && file.size > maxFileSize * 1024 * 1024) {- pushNotification({- module: "bytebase",- style: "WARN",- title: t("common.file-selector.size-limit", { size: maxFileSize }),- });- return;- }-- state.reading = true;- try {- const { arrayBuffer } = await readFileAsArrayBuffer(file);- const decoder = new TextDecoder("utf-8");- const statement = decoder.decode(arrayBuffer);- state.value = statement;- } catch (error) {- pushNotification({- module: "bytebase",- style: "WARN",- title: `Read file error`,- description: String(error),- });- }- state.reading = false;- }-};--const handleFileChange = (e: Event) => {- const target = e.target as HTMLInputElement;- onDrop(target.files);-};--const { isOverDropZone } = useDropZone(container, onDrop);--const updateBorderRadius = (element: HTMLElement) => {- borderRadius.value = getComputedStyle(element).borderRadius;-};-useMutationObserver(- inputWrapperRef,- (records) => {- updateBorderRadius(records[0].target as HTMLElement);- },- {- attributeFilter: ["style", "class"],- attributes: true,- }-);-onMounted(() => {- const wrapper = inputWrapperRef.value;- if (wrapper) {- updateBorderRadius(wrapper);- }-});-</script>--<style lang="postcss" scoped>-.droppable-textarea.reading {- pointer-events: none;-}-.droppable-textarea.drop-over :deep(.n-input__state-border),-.droppable-textarea.reading :deep(.n-input__state-border) {- border-style: dashed;-}-</style>diff --git a/frontend/src/components/misc/HumanizeDate.vue b/frontend/src/components/misc/HumanizeDate.vuedeleted file mode 100644index 29d788c3cf..0000000000--- a/frontend/src/components/misc/HumanizeDate.vue+++ /dev/null@@ -1,32 +0,0 @@-<template>- <slot v-if="!date || date.getTime() === 0" name="placeholder">- <span v-bind="$attrs">-</span>- </slot>- <NTooltip v-else trigger="hover">- <template #trigger>- <span v-bind="$attrs">{{ humanized }}</span>- </template>-- <span class="whitespace-nowrap">{{ detail }}</span>- </NTooltip>-</template>--<script lang="ts" setup>-import { NTooltip } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { formatAbsoluteDateTime, humanizeDate } from "@/utils";--const props = defineProps({- date: {- type: Object as PropType<Date>,- default: undefined,- },-});--const humanized = computed(() => humanizeDate(props.date));--const detail = computed(() =>- formatAbsoluteDateTime(props.date?.getTime() ?? 0)-);-</script>diff --git a/frontend/src/components/misc/HumanizeTs.vue b/frontend/src/components/misc/HumanizeTs.vuedeleted file mode 100644index caaefcf41e..0000000000--- a/frontend/src/components/misc/HumanizeTs.vue+++ /dev/null@@ -1,27 +0,0 @@-<template>- <NTooltip trigger="hover">- <template #trigger>- <span v-bind="$attrs">{{ humanized }}</span>- </template>-- <span class="whitespace-nowrap">{{ detail }}</span>- </NTooltip>-</template>--<script lang="ts" setup>-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import { formatAbsoluteDateTime } from "@/utils/datetime";-import { humanizeTs } from "@/utils/util";--const props = defineProps({- ts: {- type: Number,- required: true,- },-});--const humanized = computed(() => humanizeTs(props.ts));--const detail = computed(() => formatAbsoluteDateTime(props.ts * 1000));-</script>diff --git a/frontend/src/components/misc/SystemBotTag.vue b/frontend/src/components/misc/SystemBotTag.vuedeleted file mode 100644index 25323228e0..0000000000--- a/frontend/src/components/misc/SystemBotTag.vue+++ /dev/null@@ -1,18 +0,0 @@-<template>- <NTag :size="size" round type="info">- {{ $t("settings.members.system-bot") }}- </NTag>-</template>--<script lang="ts" setup>-import { NTag } from "naive-ui";--withDefaults(- defineProps<{- size?: "tiny" | "small" | "medium" | "large";- }>(),- {- size: "small",- }-);-</script>diff --git a/frontend/src/components/misc/TaskSpinner.vue b/frontend/src/components/misc/TaskSpinner.vuedeleted file mode 100644index 5ce2098fc7..0000000000--- a/frontend/src/components/misc/TaskSpinner.vue+++ /dev/null@@ -1,22 +0,0 @@-<template>- <svg- class="animate-spin"- xmlns="http://www.w3.org/2000/svg"- fill="none"- viewBox="0 0 24 24"- >- <circle- class="opacity-25"- cx="12"- cy="12"- r="10"- stroke="currentColor"- stroke-width="4"- />- <path- class="opacity-75"- fill="currentColor"- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"- />- </svg>-</template>diff --git a/frontend/src/components/misc/TextOverflowPopover.vue b/frontend/src/components/misc/TextOverflowPopover.vuedeleted file mode 100644index 0f4bffd9f7..0000000000--- a/frontend/src/components/misc/TextOverflowPopover.vue+++ /dev/null@@ -1,93 +0,0 @@-<template>- <NPopover- :disabled="popoverDisabled"- :placement="placement"- style="max-height: 300px"- width="trigger"- scrollable- >- <div v-if="codeMode" :class="codeClass">- <slot name="popover-header" />- <highlight-code-block- :code="displayPopoverContent"- class="whitespace-pre-wrap"- />- </div>- <div v-else class="whitespace-pre-wrap">- {{ displayPopoverContent }}- </div>-- <template #trigger>- <slot name="default" :display-content="displayContent">- <span :class="contentClass" v-bind="$attrs">{{ displayContent }}</span>- </slot>- </template>- </NPopover>-</template>--<script lang="ts" setup>-import type { PopoverPlacement } from "naive-ui";-import { NPopover } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import type { VueClass } from "@/utils";--const props = defineProps({- content: {- type: String,- default: "",- },- maxLength: {- type: Number,- default: 100,- },- maxPopoverContentLength: {- type: Number,- default: 10000,- },- placement: {- type: String as PropType<PopoverPlacement>,- default: "top",- },- contentClass: {- type: [String, Object, Array] as PropType<VueClass>,- default: undefined,- },- codeClass: {- type: [String, Object, Array] as PropType<VueClass>,- default: undefined,- },- codeMode: {- type: Boolean,- default: true,- },- lineWrap: {- type: Boolean,- default: true,- },- lineBreakReplacer: {- type: String,- default: "",- },-});--const displayContent = computed(() => {- const { content, lineWrap, maxLength } = props;- if (lineWrap) return content;- const displayContent = content.replace(/\n/g, props.lineBreakReplacer);- return displayContent.length <= maxLength- ? displayContent- : displayContent.substring(0, maxLength) + "...";-});--const displayPopoverContent = computed(() => {- const { content, maxPopoverContentLength } = props;- return content.length <= maxPopoverContentLength- ? content- : content.substring(0, maxPopoverContentLength) + "...";-});--const popoverDisabled = computed(() => {- return displayContent.value === props.content;-});-</script>diff --git a/frontend/src/components/misc/Timestamp.vue b/frontend/src/components/misc/Timestamp.vuedeleted file mode 100644index 64c4dd9737..0000000000--- a/frontend/src/components/misc/Timestamp.vue+++ /dev/null@@ -1,67 +0,0 @@-<template>- <NTooltip v-if="hasValidTimestamp" :disabled="!showTooltip" class="text-sm">- <template #trigger>- <span class="text-control-light" :class="customClass">- {{ humanizedTime }}- </span>- </template>- <template #default>- <div class="whitespace-nowrap">- {{ fullDateTime }}- </div>- </template>- </NTooltip>- <span v-else class="text-control-light" :class="customClass">- {{ fallbackText }}- </span>-</template>--<script setup lang="ts">-import type { Timestamp } from "@bufbuild/protobuf/wkt";-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import { getTimeForPbTimestampProtoEs } from "@/types/timestamp";-import { formatAbsoluteDateTime } from "@/utils";-import { humanizeTs } from "@/utils/util";--interface Props {- timestamp?: Timestamp;- fallbackText?: string;- showTooltip?: boolean;- customClass?: string;-}--const props = withDefaults(defineProps<Props>(), {- fallbackText: "-",- showTooltip: true,- customClass: "",-});--// Check if we have a valid timestamp-const hasValidTimestamp = computed(() => {- return props.timestamp && (props.timestamp.seconds || props.timestamp.nanos);-});--// Get timestamp in milliseconds-const timestampInMilliseconds = computed(() => {- if (!hasValidTimestamp.value) return null;- return getTimeForPbTimestampProtoEs(props.timestamp, 0);-});--// Convert to seconds for humanizeTs-const timestampInSeconds = computed(() => {- if (!timestampInMilliseconds.value) return null;- return Math.floor(timestampInMilliseconds.value / 1000);-});--// Humanized time using the existing humanizeTs function-const humanizedTime = computed(() => {- if (!timestampInSeconds.value) return props.fallbackText;- return humanizeTs(timestampInSeconds.value);-});--const fullDateTime = computed(() => {- if (!timestampInMilliseconds.value) return "";- return formatAbsoluteDateTime(timestampInMilliseconds.value);-});-</script>diff --git a/frontend/src/components/v2/Button/ResourceHardDeleteButton.vue b/frontend/src/components/v2/Button/ResourceHardDeleteButton.vuedeleted file mode 100644index 4368d95dc6..0000000000--- a/frontend/src/components/v2/Button/ResourceHardDeleteButton.vue+++ /dev/null@@ -1,72 +0,0 @@-<template>- <BBButtonConfirm- v-if="resource.state === State.DELETED"- :type="'DELETE'"- :button-text="$t('common.hard-delete.self')"- :ok-text="$t('common.hard-delete.self')"- :require-confirm="true"- :confirm-title="$t('common.hard-delete.title', { name: resource.title })"- :positive-button-props="{- disabled: disabled,- }"- class="border-none!"- @confirm="handleDelete"- >- <div class="mt-3">- <div class="text-sm mb-3 flex flex-col gap-y-2">- <div>- {{- $t("common.hard-delete.description", {- resources: [$t("common.database"), $t("changelog.self")].join(- ","- ),- })- }}- </div>- <i18n-t tag="div" keypath="common.hard-delete.double-comfirm">- <template #name>- <span class="bg-gray-200 rounded-sm py-1 px-2">- {{ resource.name }}- </span>- </template>- </i18n-t>- </div>- <NInput v-model:value="inputText" />- </div>- </BBButtonConfirm>-</template>--<script- lang="tsx"- setup- generic="T extends { name: string; title: string; state: State }"->-import { NInput } from "naive-ui";-import { computed, ref } from "vue";-import { useI18n } from "vue-i18n";-import { BBButtonConfirm } from "@/bbkit";-import { pushNotification } from "@/store";-import { State } from "@/types/proto-es/v1/common_pb";--const props = defineProps<{- resource: T;-}>();--const emit = defineEmits<{- (event: "delete", resource: string): Promise<void>;-}>();--const inputText = ref<string>();-const { t } = useI18n();--const disabled = computed(() => inputText.value !== props.resource.name);--const handleDelete = async () => {- await emit("delete", props.resource.name);- pushNotification({- module: "bytebase",- style: "INFO",- title: t("common.hard-delete.notification", { name: props.resource.title }),- });-};-</script>diff --git a/frontend/src/components/v2/Form/FormLayout.vue b/frontend/src/components/v2/Form/FormLayout.vuedeleted file mode 100644index 0f4d7e7ac6..0000000000--- a/frontend/src/components/v2/Form/FormLayout.vue+++ /dev/null@@ -1,28 +0,0 @@-<template>- <div class="h-full flex flex-col">- <div class="flex-1 mb-6 px-4">- <slot name="title">- <div v-if="title" class="text-lg leading-6 font-medium text-main">- {{ title }}- </div>- <NDivider v-if="title" />- </slot>- <slot name="body" />- </div>- <div class="w-full sticky bottom-0 z-10">- <div- class="w-full py-4 px-4 border-t border-block-border bg-white"- >- <slot name="footer" />- </div>- </div>- </div>-</template>--<script setup lang="tsx">-import { NDivider } from "naive-ui";--defineProps<{- title?: string;-}>();-</script>diff --git a/frontend/src/components/v2/Model/DatabaseGroupName.vue b/frontend/src/components/v2/Model/DatabaseGroupName.vuedeleted file mode 100644index 99fce0d715..0000000000--- a/frontend/src/components/v2/Model/DatabaseGroupName.vue+++ /dev/null@@ -1,66 +0,0 @@-<template>- <component- :is="isDeleted ? tag : link ? 'router-link' : tag"- v-bind="bindings"- class="inline-flex items-center gap-x-1"- :class="[- !isDeleted && link && !plain && 'normal-link',- isDeleted && 'text-control-light line-through',- ]"- >- <span>{{ isDeleted ? $t("database-group.deleted") : databaseGroup.title }}</span>- </component>-</template>--<script lang="ts" setup>-import { computed } from "vue";-import { PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL } from "@/router/dashboard/projectV1";-import { getProjectNameAndDatabaseGroupName } from "@/store/modules/v1/common";-import { isValidDatabaseGroupName } from "@/types";-import type { DatabaseGroup } from "@/types/proto-es/v1/database_group_service_pb";--const props = withDefaults(- defineProps<{- databaseGroup: DatabaseGroup;- tag?: string;- link?: boolean;- plain?: boolean;- }>(),- {- tag: "span",- link: true,- plain: false,- }-);--const isDeleted = computed(() => {- return !isValidDatabaseGroupName(props.databaseGroup?.name);-});--const bindings = computed(() => {- if (!props.databaseGroup) {- return {};- }-- const [projectId, databaseGroupName] = getProjectNameAndDatabaseGroupName(- props.databaseGroup.name- );- if (props.link) {- return {- to: {- name: PROJECT_V1_ROUTE_DATABASE_GROUP_DETAIL,- params: {- projectId,- databaseGroupName,- },- },- activeClass: "",- exactActiveClass: "",- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- }- return {};-});-</script>diff --git a/frontend/src/components/v2/ResourceOccupiedModal/Resource.vue b/frontend/src/components/v2/ResourceOccupiedModal/Resource.vuedeleted file mode 100644index 0377554438..0000000000--- a/frontend/src/components/v2/ResourceOccupiedModal/Resource.vue+++ /dev/null@@ -1,22 +0,0 @@-<template>- <div class="flex items-center gap-x-1">- <span v-if="showPrefix && resourcePrefix">{{ `${resourcePrefix}: ` }}</span>- <component :is="resourceComponent" />- </div>-</template>--<script lang="tsx" setup>-import { computed } from "vue";-import { useResourceByName } from "./useResourceByName.ts";--const props = defineProps<{- resource: string;- link?: boolean;- showPrefix?: boolean;-}>();--const { resourcePrefix, resourceComponent } = useResourceByName({- resource: computed(() => props.resource ?? ""),- link: props.link,-});-</script>diff --git a/frontend/src/components/v2/ResourceOccupiedModal/ResourceOccupiedModal.vue b/frontend/src/components/v2/ResourceOccupiedModal/ResourceOccupiedModal.vuedeleted file mode 100644index 7bbbac91f4..0000000000--- a/frontend/src/components/v2/ResourceOccupiedModal/ResourceOccupiedModal.vue+++ /dev/null@@ -1,89 +0,0 @@-<template>- <BBModal- v-model:show="modalVisible"- :title="$t('common.warning')"- :show-close="true"- :close-on-esc="true"- @close="handleClose"- >- <div- class="w-120 max-w-full pt-2 pb-4 text-control wrap-break-word text-sm"- >- <div v-if="resources.length === 0">- {{ $t("resource.delete-warning", { name: target }) }}- </div>- <div v-else class="flex flex-col gap-y-2">- <p>- {{- description ||- $t("resource.delete-warning-with-resources", {- name: target,- })- }}- </p>- <ul class="list-disc">- <Resource- v-for="(resource, i) in resources"- :key="i"- :show-prefix="true"- :link="true"- :resource="resource"- />- </ul>- <p v-if="!description">{{ $t("resource.delete-warning-retry") }}</p>- </div>- </div>-- <div class="pt-4 border-t border-block-border flex justify-end gap-x-3">- <NButton size="small" @click.prevent="handleClose">- {{ $t("common.cancel") }}- </NButton>- <NButton- v-if="showPositiveButton"- type="warning"- size="small"- data-label="bb-modal-confirm-button"- @click.prevent="handleSubmit"- >- {{ $t("common.continue-anyway") }}- </NButton>- </div>- </BBModal>-</template>--<script lang="tsx" setup>-import { NButton } from "naive-ui";-import { ref } from "vue";-import { BBModal } from "@/bbkit";-import Resource from "./Resource.vue";--defineProps<{- target: string;- description?: string;- resources: string[];- showPositiveButton: boolean;-}>();--const emit = defineEmits<{- (event: "on-submit"): void;- (event: "on-close"): void;-}>();--const modalVisible = ref(false);--const open = () => {- modalVisible.value = true;-};--const handleClose = () => {- modalVisible.value = false;- emit("on-close");-};--const handleSubmit = () => {- modalVisible.value = false;- emit("on-submit");-};--defineExpose({ open });-</script>diff --git a/frontend/src/components/v2/ResourceOccupiedModal/useResourceByName.ts b/frontend/src/components/v2/ResourceOccupiedModal/useResourceByName.tsdeleted file mode 100644index 2e4d6387a7..0000000000--- a/frontend/src/components/v2/ResourceOccupiedModal/useResourceByName.ts+++ /dev/null@@ -1,160 +0,0 @@-import { computed, h, type Ref, watchEffect } from "vue";-import { EnvironmentV1Name, RichDatabaseName } from "@/components/v2";-import { ProjectNameCell } from "@/components/v2/Model/cells";-import { t } from "@/plugins/i18n";-import {- useDatabaseV1Store,- useEnvironmentV1Store,- useProjectV1Store,- useUserStore,-} from "@/store";-import {- environmentNamePrefix,- isDatabaseName,- projectNamePrefix,- userNamePrefix,-} from "@/store/modules/v1/common";-import {- formatEnvironmentName,- isValidDatabaseName,- isValidEnvironmentName,- isValidProjectName,-} from "@/types";-import { hasWorkspacePermissionV2 } from "@/utils";--type ResourceType =- | "environment"- | "project"- | "database"- | "workspace"- | "user";--export const useResourceByName = ({- resource,- link,-}: {- resource: Ref<string>;- link?: boolean;-}) => {- const environmentV1Store = useEnvironmentV1Store();- const databaseStore = useDatabaseV1Store();- const projectStore = useProjectV1Store();- const userStore = useUserStore();-- const resourceType = computed((): ResourceType | undefined => {- if (resource.value === "workspace") {- return "workspace";- }- if (resource.value.startsWith(environmentNamePrefix)) {- return "environment";- } else if (isDatabaseName(resource.value)) {- return "database";- } else if (resource.value.startsWith(projectNamePrefix)) {- return "project";- } else if (resource.value.startsWith(userNamePrefix)) {- return "user";- }- return undefined;- });-- const resourcePrefix = computed(() => {- switch (resourceType.value) {- case "environment":- return t("common.environment");- case "project":- return t("common.project");- case "database":- return t("common.database");- case "user":- return t("common.user");- default:- return "";- }- });-- watchEffect(async () => {- switch (resourceType.value) {- case "database":- if (hasWorkspacePermissionV2("bb.databases.get")) {- await databaseStore.getOrFetchDatabaseByName(resource.value);- }- return;- case "environment":- if (hasWorkspacePermissionV2("bb.settings.getEnvironment")) {- environmentV1Store.getEnvironmentByName(resource.value);- }- return;- case "project":- if (hasWorkspacePermissionV2("bb.projects.get")) {- await projectStore.getOrFetchProjectByName(- resource.value,- true /* silent */- );- }- return;- case "user":- await userStore.getOrFetchUserByIdentifier({- identifier: resource.value,- });- return;- }- });-- const resourceComponent = computed(() => {- switch (resourceType.value) {- case "environment": {- const environment = environmentV1Store.getEnvironmentByName(- resource.value- );- if (!isValidEnvironmentName(formatEnvironmentName(environment.id))) {- return h("div", resource.value);- }- return h(EnvironmentV1Name, { environment, link });- }- case "database": {- const database = databaseStore.getDatabaseByName(resource.value);- if (!isValidDatabaseName(database.name)) {- return h("div", resource.value);- }- return h(RichDatabaseName, {- database,- showArrow: false,- showInstance: false,- });- }- case "project": {- const project = projectStore.getProjectByName(resource.value);- if (!isValidProjectName(project.name)) {- return h("div", resource.value);- }- return h(ProjectNameCell, {- project,- mode: "ALL_SHORT",- link,- });- }- case "user": {- const user = userStore.getUserByIdentifier(resource.value);- if (!user) {- return h("div", resource.value);- }- return h(- "a",- {- class: "flex items-center gap-x-2 normal-link underline",- href: `/${user.name}`,- },- `${user.title} (${user.email})`- );- }- default:- return h("div", resource.value);- }- });-- return {- resourceType,- resourcePrefix,- resourceComponent,- };-};diff --git a/frontend/src/components/v2/Sidebar/utils.ts b/frontend/src/components/v2/Sidebar/utils.tsdeleted file mode 100644index d9c2d9f500..0000000000--- a/frontend/src/components/v2/Sidebar/utils.ts+++ /dev/null@@ -1,36 +0,0 @@-import type { RouteRecordRaw } from "vue-router";-import type { Permission } from "@/types";--export const getFlattenRoutes = (- routes: RouteRecordRaw[],- permissions: Permission[] = []-): {- name: string;- permissions: Permission[];-}[] => {- return routes.reduce(- (list, v1Route) => {- const requiredPermissionListFunc = v1Route.meta?.requiredPermissionList;- const requiredPermissionList = requiredPermissionListFunc- ? requiredPermissionListFunc()- : [];-- if (v1Route.name && v1Route.name.toString() !== "") {- list.push({- name: v1Route.name.toString(),- permissions: [...permissions, ...requiredPermissionList],- });- }- if (v1Route.children) {- list.push(- ...getFlattenRoutes(v1Route.children, [- ...permissions,- ...requiredPermissionList,- ])- );- }- return list;- },- [] as { name: string; permissions: Permission[] }[]- );-};diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 23701b862b..91949e0e1a 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -203,7 +203,6 @@"common": {"Default": "Default","access-denied": "Access denied",- "access-expires": "Access Expires","action-required": "Action Required","activated": "Activated","active": "Active",@@ -237,7 +236,6 @@"collapse": "Collapse","column": "Column","comment": "Comment",- "condition": "Condition","configure": "Configure","configure-now": "Configure now","confirm": "Confirm",@@ -257,13 +255,7 @@"database": "Database","database-group": "Database Group | Database Groups","databases": "Databases",- "date": {- "days": "{days} days",- "month": "1 month",- "months": "{months} months",- "week": "1 week",- "year": "1 year"- },+ "date": {},"deactivate": "Deactivate","default": "default","definition": "Definition",@@ -314,13 +306,7 @@"go-back": "Go back","google-chat": "Google Chat","groups": "Groups",- "hard-delete": {- "description": "This resource and other related resources will be hard-deleted. You cannot undo this action",- "double-comfirm": "To confirm deletion, please type: {name}",- "notification": "Successfully delete the resource '{name}'.",- "self": "Hard-delete",- "title": "Hard-delete {name}?"- },+ "hard-delete": {},"history": "History","home": "Home","id": "ID",@@ -336,7 +322,6 @@"language": "Language","lark": "Lark","learn-more": "Learn more",- "leave": "Leave","leave-without-saving": "Leave without saving?","license": "License","line": "Line",@@ -348,7 +333,6 @@"minutes": "Minutes","missing-required-permission": "Missing required permissions {permissions}","missing-required-permission-for-resource": "Missing required permissions for resource {resource}",- "mode": "Mode","n-items-selected": "{n} items selected","n-more": "+{n} more","name": "Name",@@ -409,7 +393,6 @@"rows-per-page": "Rows per page","run": "Run","save": "Save",- "schedule": "Schedule","schema": "Schema","scope": "Scope","search": "Search",@@ -434,7 +417,6 @@"state": "State","statement": "Statement","status": "Status",- "stay": "Stay","submit": "Submit","succeed": "Succeed","success": "Success",@@ -468,7 +450,6 @@"view-doc": "View doc","visibility": "Visibility","want-help": "Want help",- "warehouse": "Warehouse","warning": "Warning","webhooks": "Webhooks","wecom": "WeCom",@@ -652,13 +633,11 @@"reference": "Reference"},"foreign-keys": "Foreign keys",- "foreign-table-detail": "Foreign table detail","index-size": "Index size","indexes": "Indexes","labels": "Database Labels","last-sync": "Last sync","mixed-label-values-warning": "Some of the selected resources have mixed values for the same key. Only edit these key-value pairs if you intend to change them.",- "mixed-values-for-label": "This selected label have mixed values","nullable": "Nullable","partition-tables": "Partition tables","partitioned": "Partitioned",@@ -736,23 +715,15 @@"select": "Select table","select-tip": "Please select a table to start."},- "table-detail": "Table detail","transfer": {- "errors": {- "select-at-least-one-database": "Select at least one database",- "select-target-project": "Select target project"- },- "select-databases": "Select databases",- "select-target-project": "Select target project"+ "errors": {}},- "transfer-database-to": "Transfer databases to target project","transfer-project": "Transfer Project","unassign": "Unassign","unassign-alert-description": "The selected databases will be removed from the project","unassign-alert-title": "Unassign databases","unassigned-databases": "Unassigned databases","unique": "Unique",- "view-definition": "View definition","visible": "Visible"},"database-group": {@@ -760,7 +731,6 @@"self": "Condition"},"delete-group": "Delete the database group {name}",- "deleted": "Deleted database group","matched-database": "Matched database","no-matched-databases": "No matched databases","select": "Select database group",@@ -779,7 +749,6 @@"failed-to-sync-schema": "Failed to sync schema","failed-to-sync-schema-for-database-database-value-name": "Failed to sync schema for database '{0}'.","functions": "Functions",- "labels-for-resource": "Labels for {resource}","n-databases-had-sync-errors": "{0} database(s) had sync errors","packages": "Packages","partitions": "Partitions",@@ -1221,8 +1190,6 @@"all-databases": "All","all-databases-tip": "All current and future databases in this project.","column-scope-select-disabled": "Manually select is unavailable for column-scoped selections.",- "custom-date": "Custom date",- "custom-date-placeholder": "Select expiration date and time","details": "Request Details","expired-at": "Expired at","manually-select": "Manually select",@@ -1235,12 +1202,7 @@"sort": "Sort","updated": "Update time"},- "sql-check": {- "back-to-edit": "Back to edit",- "sql-review-violations": "SQL Review Violations",- "statement-is-required": "SQL statement is required",- "statement-is-too-large": "As the current statement size exceeds 2MB, the SQL check will be skipped."- },+ "sql-check": {},"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.","status-transition": {"modal": {@@ -1274,7 +1236,6 @@"transaction-mode": {"label": "Transaction Mode"},- "unfinished-resolved-issue-tips": "This issue is marked as \"Done\" but some of its tasks are not executed successfully.","upload-sql": "Upload SQL","upload-sql-file-max-size-exceeded": "Max file size ({size}) exceeded.","waiting-approval": "Waiting for Approval"@@ -1347,9 +1308,7 @@"placeholder": "Add a description"},"editor": {- "save-changes-before-continuing": "Please save or cancel your changes before continuing",- "unsaved-changes": "Unsaved Changes",- "unsaved-changes-message": "You have unsaved changes. Are you sure you want to leave?"+ "save-changes-before-continuing": "Please save or cancel your changes before continuing"},"go-to-plan-page": "Go to Plan page","isolation-level": {@@ -1401,10 +1360,7 @@"spec": {"change": "Change","type": {- "create-database": "Create Database",- "database-change": "Database Change",- "export-data": "Export Data",- "unknown": "Unknown"+ "database-change": "Database Change"}},"state": {@@ -1517,7 +1473,6 @@"allow-ddl": "Allow running DDL/DML statements in the selected environments.","description": "Project members determine the permission to operate database and issues inside the project. Project Owner, Workspace Admin and Workspace DBA all have full project permissions.","never-expires": "Never",- "role-never-expires": "This role never expires.","workspace-level-roles": "Workspace level roles"},"overview": {@@ -1659,11 +1614,7 @@"quick-action": {"create-db": "Create database","create-project": "Create Project",- "from-projects": "From other projects",- "from-unassigned-databases": "Unassigned databases",- "request-export-data": "Request Export",- "transfer-in-db-title": "Transfer in database",- "unassigned-db-hint": "Newly synced databases start unassigned and must be moved to a project for use."+ "request-export-data": "Request Export"},"quick-start": {"guide": "click on the step to try it out",@@ -2185,13 +2136,11 @@"search-member": "Search member","select-account": "Select account | Select accounts","select-account-hint": "You can search for users and groups, or input the entire email to select the service account or workload identity.",- "select-in-project": "Select users or groups in {project}","select-role": "Select role | Select roles","service-account": "Service Account","service-accounts": "Service Accounts","service-key-copied": "Service Key copied to clipboard, please keep it in secret.","show-inactive": "Show inactive accounts",- "system-bot": "System Bot","table": {"account": "Account","groups": "Groups",@@ -2298,8 +2247,6 @@},"grant-access": "Grant Access","never-expires": "Never expires",- "remove-classification-tips": "Remove the classification for this column?",- "remove-semantic-type-tips": "Remove the semantic type for this column?","remove-sensitive-column-tips": "Expose this column?","semantic-types": {"label": "Columns having the same semantic type will use the same masking algorithms.",@@ -2636,7 +2583,6 @@"sql-review": {"add-or-remove-rules": "Add or remove rules","add-rules": "Add rules",- "all-checks-passed": "All checkes passed.","attach-resource": {"change-resources": "Change attached resources","label": "You can apply the SQL review policy to environments or projects. The database will use the project-level policy if it exists, or fallback to the environment-level policy.",@@ -2646,9 +2592,7 @@"override-warning": "Following resources already bound with other SQL review policies. Click \"{button}\" will override the config.","self": "Attach to resources"},- "category": {- "builtin": "Built-in"- },+ "category": {},"configure-policy": "Configure policy","create": {"basic-info": {@@ -2685,7 +2629,6 @@"policy-removed": "Successfully removed the review policy.","policy-update-failed": "Failed to update the review policy.","policy-updated": "Successfully updated the review policy.",- "rule-detail": "Rule detail","select-all": "Select all","select-review-rules": "Select SQL review rules","title": "SQL Review"@@ -2794,9 +2737,7 @@"task": {"affected-rows": "Affected rows","cancel-task": "Cancel task | Cancel tasks",- "check-result": {- "title-general": "Check result"- },+ "check-result": {},"check-type": {"affected-rows": {"description": "Estimated by statistical information.",@@ -2823,12 +2764,10 @@"no-skippable-tasks": "No skippable tasks","no-tasks-selected": "No tasks selected","online-migration": {- "advice-split-statement-to-single-online-migration-issue": "Advice splitting this statement to single online migration issue.","self": "Online migration"},"only-showing-latest-n-runs": "Only showing latest {n} runs","prior-backup": "Prior backup",- "run-checks": "Run checks","run-history": "Run History","run-immediately": {"description": "Tasks will start executing as soon as you click Run. No delay or scheduling required.",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 10b801a12d..6a2ad447d3 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -203,7 +203,6 @@"common": {"Default": "Predeterminado","access-denied": "Acceso denegado",- "access-expires": "El acceso expira","action-required": "Acción requerida","activated": "Activado","active": "Activo",@@ -237,7 +236,6 @@"collapse": "Colapsar","column": "Columna","comment": "Comentario",- "condition": "Condición","configure": "Configurar","configure-now": "Configurar ahora","confirm": "Confirmar",@@ -257,13 +255,7 @@"database": "Base de datos","database-group": "Grupo de bases de datos | Grupos de bases de datos","databases": "Bases de datos",- "date": {- "days": "{days} días",- "month": "1 mes",- "months": "{months} meses",- "week": "1 semana",- "year": "1 año"- },+ "date": {},"deactivate": "Desactivar","default": "predeterminado","definition": "Definición",@@ -314,13 +306,7 @@"go-back": "Volver","google-chat": "Google Chat","groups": "Grupos",- "hard-delete": {- "description": "Este recurso y otros recursos relacionados se eliminarán definitivamente. No se puede deshacer esta acción",- "double-comfirm": "Para confirmar la eliminación, escriba: {name}",- "notification": "Se eliminó exitosamente el recurso '{name}'.",- "self": "Eliminación permanente",- "title": "¿Eliminar definitivamente {name}?"- },+ "hard-delete": {},"history": "Historial","home": "Inicio","id": "ID",@@ -336,7 +322,6 @@"language": "Idioma","lark": "Lark","learn-more": "Aprender más",- "leave": "Dejar","leave-without-saving": "¿Salir sin guardar?","license": "Licencia","line": "Línea",@@ -348,7 +333,6 @@"minutes": "Minutos","missing-required-permission": "Faltan permisos requeridos {permissions}","missing-required-permission-for-resource": "Faltan permisos requeridos para el recurso {resource}",- "mode": "Modo","n-items-selected": "{n} elementos seleccionados","n-more": "+{n} más","name": "Nombre",@@ -409,7 +393,6 @@"rows-per-page": "Filas por página","run": "Ejecutar","save": "Guardar",- "schedule": "Horario","schema": "Esquema","scope": "Alcance","search": "Buscar",@@ -434,7 +417,6 @@"state": "Estado","statement": "Declaración","status": "Estado",- "stay": "Permanecer","submit": "Enviar","succeed": "Tener éxito","success": "Éxito",@@ -468,7 +450,6 @@"view-doc": "Ver doc","visibility": "Visibilidad","want-help": "Buscar Ayuda",- "warehouse": "Almacén","warning": "Advertencia","webhooks": "Webhooks","wecom": "WeCom",@@ -652,13 +633,11 @@"reference": "Referencia"},"foreign-keys": "claves foráneas",- "foreign-table-detail": "Detalle de la tabla externa","index-size": "Tamaño del índice","indexes": "Índices","labels": "Etiquetas de base de datos","last-sync": "Última sincronización","mixed-label-values-warning": "Algunos de los recursos seleccionados tienen valores mixtos para la misma clave. Solo edite estos pares clave-valor si tiene la intención de cambiarlos.",- "mixed-values-for-label": "Esta etiqueta seleccionada tiene valores mixtos.","nullable": "Anulable","partition-tables": "Tablas de particiones","partitioned": "Particionado",@@ -736,23 +715,15 @@"select": "Seleccionar tabla","select-tip": "Seleccione una mesa para comenzar."},- "table-detail": "Detalle de la tabla","transfer": {- "errors": {- "select-at-least-one-database": "Seleccione al menos una base de datos",- "select-target-project": "Seleccionar proyecto de destino"- },- "select-databases": "Seleccionar bases de datos",- "select-target-project": "Seleccionar proyecto de destino"+ "errors": {}},- "transfer-database-to": "Transferir bases de datos al proyecto de destino","transfer-project": "Transferir proyecto","unassign": "Desasignar","unassign-alert-description": "Las bases de datos seleccionadas serán eliminadas del proyecto","unassign-alert-title": "Desasignar bases de datos","unassigned-databases": "Bases de datos no asignadas","unique": "Único",- "view-definition": "Ver definición","visible": "Visible"},"database-group": {@@ -760,7 +731,6 @@"self": "Condición"},"delete-group": "Eliminar el grupo de bases de datos {name}",- "deleted": "Grupo de bases de datos eliminado","matched-database": "Base de datos coincidente","no-matched-databases": "No hay bases de datos coincidentes","select": "Seleccionar grupo de bases de datos",@@ -779,7 +749,6 @@"failed-to-sync-schema": "No se pudo sincronizar el esquema","failed-to-sync-schema-for-database-database-value-name": "Error al sincronizar el esquema para la base de datos '{0}'.","functions": "Funciones",- "labels-for-resource": "Etiquetas para {resource}","n-databases-had-sync-errors": "{0} base(s) de datos tuvieron errores de sincronización","packages": "Paquetes","partitions": "Particiones",@@ -1221,8 +1190,6 @@"all-databases": "todas las bases de datos","all-databases-tip": "Todas las bases de datos actuales y futuras de este proyecto.","column-scope-select-disabled": "La selección manual no está disponible para selecciones con alcance de columna.",- "custom-date": "Fecha personalizada",- "custom-date-placeholder": "Seleccione la fecha y hora de vencimiento","details": "Detalles de la solicitud","expired-at": "tiempo de caducidad","manually-select": "selección manual",@@ -1235,12 +1202,7 @@"sort": "Ordenar","updated": "Fecha de actualización"},- "sql-check": {- "back-to-edit": "Volver a editar",- "sql-review-violations": "Infracciones de revisión de SQL",- "statement-is-required": "Se requiere una declaración SQL",- "statement-is-too-large": "Como el tamaño de la declaración actual supera 2MB, se omitirá la comprobación de SQL."- },+ "sql-check": {},"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.","status-transition": {"modal": {@@ -1274,7 +1236,6 @@"transaction-mode": {"label": "Modo de transacción"},- "unfinished-resolved-issue-tips": "Este problema está marcado como \"Aprobado\", pero algunas de sus tareas no se ejecutan correctamente.","upload-sql": "Cargar SQL","upload-sql-file-max-size-exceeded": "Se ha excedido el tamaño máximo del archivo ({size}).","waiting-approval": "A la espera de la aprobación"@@ -1347,9 +1308,7 @@"placeholder": "Añadir descripción"},"editor": {- "save-changes-before-continuing": "Guarde o cancele sus cambios antes de continuar.",- "unsaved-changes": "Cambios no guardados",- "unsaved-changes-message": "Tienes cambios sin guardar. ¿Estás seguro de que quieres salir?"+ "save-changes-before-continuing": "Guarde o cancele sus cambios antes de continuar."},"go-to-plan-page": "Ir a la página del plan","isolation-level": {@@ -1401,10 +1360,7 @@"spec": {"change": "Cambiar","type": {- "create-database": "Crear base de datos",- "database-change": "Cambio de base de datos",- "export-data": "Exportar datos",- "unknown": "Desconocido"+ "database-change": "Cambio de base de datos"}},"state": {@@ -1517,7 +1473,6 @@"allow-ddl": "Permitir ejecutar sentencias DDL/DML en los entornos seleccionados.","description": "Los miembros del proyecto determinan el permiso para operar la base de datos y los problemas dentro del proyecto. El propietario del proyecto, el administrador del espacio de trabajo y el DBA del espacio de trabajo tienen permisos completos para el proyecto.","never-expires": "Nunca caduca",- "role-never-expires": "Este rol nunca expira.","workspace-level-roles": "Roles a nivel de espacio de trabajo"},"overview": {@@ -1659,11 +1614,7 @@"quick-action": {"create-db": "Crear base de datos","create-project": "Crear Proyecto",- "from-projects": "De otro proyecto",- "from-unassigned-databases": "Bases de datos no asignadas",- "request-export-data": "Solicitar exportación",- "transfer-in-db-title": "Transferir base de datos",- "unassigned-db-hint": "Las bases de datos recién sincronizadas comienzan sin asignar y deben ser asignadas a un proyecto para su uso."+ "request-export-data": "Solicitar exportación"},"quick-start": {"guide": "haga clic en el paso para probarlo",@@ -2185,13 +2136,11 @@"search-member": "Buscar miembro","select-account": "Seleccionar cuenta | Seleccionar cuentas","select-account-hint": "Puede buscar usuarios y grupos, o introducir el correo electrónico completo para seleccionar la cuenta de servicio o identidad de carga de trabajo.",- "select-in-project": "Seleccione usuarios o grupos en {project}","select-role": "Seleccionar rol | Seleccionar roles","service-account": "Cuenta de Servicio","service-accounts": "Cuentas de Servicio","service-key-copied": "Clave de Servicio copiada al portapapeles, por favor manténgala en secreto.","show-inactive": "Mostrar cuentas inactivas",- "system-bot": "Bot del Sistema","table": {"account": "Cuenta","groups": "Grupos",@@ -2298,8 +2247,6 @@},"grant-access": "Autorizará el acceso","never-expires": "Nunca expira",- "remove-classification-tips": "¿Eliminar la clasificación de esta columna?",- "remove-semantic-type-tips": "¿Eliminar el tipo semántico de esta columna?","remove-sensitive-column-tips": "¿Exponer esta columna?","semantic-types": {"label": "Las columnas que tengan el mismo tipo semántico utilizarán los mismos algoritmos de enmascaramiento.",@@ -2636,7 +2583,6 @@"sql-review": {"add-or-remove-rules": "Agregar o eliminar reglas","add-rules": "Agregar reglas",- "all-checks-passed": "Todas las comprobaciones pasaron","attach-resource": {"change-resources": "Cambiar recursos adjuntos","label": "Puede aplicar la política de revisión a entornos o proyectos. Un recurso sólo puede vincular una política. La base de datos utilizará la política de revisión de SQL adjunta al proyecto; de lo contrario, recurrirá a la política de entorno.",@@ -2646,9 +2592,7 @@"override-warning": "Siguiendo los recursos ya vinculados con otras políticas de revisión de SQL. Haga clic en \"{button}\" para anular la configuración.","self": "Adjuntar a recursos"},- "category": {- "builtin": "Integrado"- },+ "category": {},"configure-policy": "Configurar política","create": {"basic-info": {@@ -2685,7 +2629,6 @@"policy-removed": "La política de revisión se eliminó correctamente.","policy-update-failed": "No se pudo actualizar la política de revisión.","policy-updated": "La política de revisión se actualizó correctamente.",- "rule-detail": "Detalle de la regla","select-all": "Seleccionar todo","select-review-rules": "Seleccionar reglas de revisión de SQL","title": "Revisión de SQL"@@ -2794,9 +2737,7 @@"task": {"affected-rows": "Filas afectadas","cancel-task": "Cancelar tarea | Cancelar tareas",- "check-result": {- "title-general": "Comprobar resultado"- },+ "check-result": {},"check-type": {"affected-rows": {"description": "Estimado por información estadística.",@@ -2823,12 +2764,10 @@"no-skippable-tasks": "No hay tareas que se puedan omitir","no-tasks-selected": "No hay tareas seleccionadas","online-migration": {- "advice-split-statement-to-single-online-migration-issue": "Se recomienda dividir esta declaración en un único problema de migración en línea.","self": "Migración en línea"},"only-showing-latest-n-runs": "Solo se muestran las últimas {n} ejecuciones","prior-backup": "Respaldo previo",- "run-checks": "Ejecutar comprobaciones","run-history": "Historial de ejecución","run-immediately": {"description": "Las tareas comenzarán a ejecutarse en cuanto haga clic en \"Ejecutar\". No requiere demora ni programación.",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex b8e11e3312..5671529beb 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -203,7 +203,6 @@"common": {"Default": "デフォルト","access-denied": "アクセスが拒否されました",- "access-expires": "アクセスは期限切れです","action-required": "対応が必要","activated": "有効化しました","active": "アクティブ",@@ -237,7 +236,6 @@"collapse": "閉じる","column": "列","comment": "コメント",- "condition": "状態","configure": "設定","configure-now": "今すぐ設定する","confirm": "確認する",@@ -257,13 +255,7 @@"database": "データベース","database-group": "データベースグループ | データベースグループ","databases": "データベース",- "date": {- "days": "{days} 日",- "month": "1 か月",- "months": "{months} 月",- "week": "1 週間",- "year": "1 年"- },+ "date": {},"deactivate": "無効化","default": "デフォルト","definition": "意味",@@ -314,13 +306,7 @@"go-back": "戻る","google-chat": "Google Chat","groups": "グループ",- "hard-delete": {- "description": "このリソースとその他の関連リソースは物理的に削除されます。この操作は元に戻せません",- "double-comfirm": "削除を確認するには、{name} と入力してください。",- "notification": "リソース '{name}' を正常に削除しました。",- "self": "ハード削除",- "title": "{name} を物理的に削除しますか?"- },+ "hard-delete": {},"history": "履歴","home": "ホームページ","id": "ID",@@ -336,7 +322,6 @@"language": "言語","lark": "Lark","learn-more": "もっと詳しく知る",- "leave": "離れる","leave-without-saving": "変更を保存していませんか?","license": "ライセンス","line": "行",@@ -348,7 +333,6 @@"minutes": "分","missing-required-permission": "必要な権限がありません {permissions}","missing-required-permission-for-resource": "リソース {resource} に必要な権限がありません",- "mode": "モデル","n-items-selected": "{n} 件選択済み","n-more": "+{n} もっと","name": "名前",@@ -409,7 +393,6 @@"rows-per-page": "ページあたりの行数","run": "実行","save": "保存",- "schedule": "プラン","schema": "スキーマ","scope": "スコープ","search": "検索",@@ -434,7 +417,6 @@"state": "ステート","statement": "ステートメント","status": "ステータス",- "stay": "滞在する","submit": "提出する","succeed": "成功する","success": "成功",@@ -468,7 +450,6 @@"view-doc": "ドキュメントを見る","visibility": "可視性","want-help": "ユーザーグループに参加する",- "warehouse": "倉庫","warning": "警告する","webhooks": "Webhook","wecom": "WeCom",@@ -652,13 +633,11 @@"reference": "参照"},"foreign-keys": "外部キー",- "foreign-table-detail": "外部テーブルの詳細","index-size": "インデックスサイズ","indexes": "索引","labels": "データベースラベル","last-sync": "最後の同期","mixed-label-values-warning": "選択されたリソースの一部は、同じキーに対して異なる値を持っています。これらのキーと値のペアを変更する場合にのみ編集してください。",- "mixed-values-for-label": "タグの値が異なります","nullable": "null も可能","partition-tables": "パーティションテーブル","partitioned": "パーティション",@@ -736,23 +715,15 @@"select": "テーブルを選択","select-tip": "開始するにはテーブルを選択してください。"},- "table-detail": "テーブルの詳細","transfer": {- "errors": {- "select-at-least-one-database": "少なくとも 1 つのデータベースを選択してください",- "select-target-project": "対象プロジェクトを選択"- },- "select-databases": "データベースの選択",- "select-target-project": "対象プロジェクトを選択"+ "errors": {}},- "transfer-database-to": "データベースをターゲットプロジェクトに転送します","transfer-project": "プロジェクトの転送","unassign": "割り当てを解除する","unassign-alert-description": "選択したデータベースがプロジェクトから削除されます","unassign-alert-title": "データベースの割り当てを解除する","unassigned-databases": "未割り当てのデータベース","unique": "個性的",- "view-definition": "ビューの定義","visible": "見える"},"database-group": {@@ -760,7 +731,6 @@"self": "状態"},"delete-group": "データベースグループを削除する",- "deleted": "削除されたデータベースグループ","matched-database": "マッチングデータベース","no-matched-databases": "一致するデータベースはありません","select": "データベースグループを選択",@@ -779,7 +749,6 @@"failed-to-sync-schema": "スキーマの同期に失敗しました","failed-to-sync-schema-for-database-database-value-name": "データベース '{0}' のスキーマを同期できませんでした。","functions": "関数",- "labels-for-resource": "{resource} のタグ","n-databases-had-sync-errors": "{0} 個のデータベースで同期エラーが発生しました","packages": "パッケージ","partitions": "パーティション",@@ -1221,8 +1190,6 @@"all-databases": "すべてのデータベース","all-databases-tip": "このプロジェクトに属する現在および将来のすべてのデータベース。","column-scope-select-disabled": "列単位の選択では手動選択を使用できません。",- "custom-date": "カスタム日付",- "custom-date-placeholder": "有効期限と時刻を選択します","details": "リクエストの詳細","expired-at": "有効期限","manually-select": "手動選択",@@ -1235,12 +1202,7 @@"sort": "並べ替え","updated": "更新日時"},- "sql-check": {- "back-to-edit": "編集に戻る",- "sql-review-violations": "SQL レビュールール違反",- "statement-is-required": "SQL文が必要です",- "statement-is-too-large": "現在のステートメント サイズが 1MB を超えているため、SQL チェックはスキップされます。"- },+ "sql-check": {},"statement-from-sheet-warning": "SQL が大きすぎるため、表示時に切り捨てられ、編集が無効になっています。新しい SQL ファイルをアップロードして上書きすることができます。","status-transition": {"modal": {@@ -1274,7 +1236,6 @@"transaction-mode": {"label": "トランザクションモード"},- "unfinished-resolved-issue-tips": "イシューは「承認済み」とマークされましたが、一部のタスクは正常に実行されませんでした。","upload-sql": "SQLのアップロード","upload-sql-file-max-size-exceeded": "アップロード ファイルのサイズは {size} を超えることはできません。","waiting-approval": "承認待ち"@@ -1347,9 +1308,7 @@"placeholder": "説明を追加"},"editor": {- "save-changes-before-continuing": "続行する前に変更を保存またはキャンセルしてください",- "unsaved-changes": "保存されていない変更",- "unsaved-changes-message": "保存されていない変更があります。終了してもよろしいですか?"+ "save-changes-before-continuing": "続行する前に変更を保存またはキャンセルしてください"},"go-to-plan-page": "プランページへ移動","isolation-level": {@@ -1401,10 +1360,7 @@"spec": {"change": "変化","type": {- "create-database": "データベースの作成",- "database-change": "データベースの変更",- "export-data": "データのエクスポート",- "unknown": "未知"+ "database-change": "データベースの変更"}},"state": {@@ -1517,7 +1473,6 @@"allow-ddl": "選択した環境で DDL/DML ステートメントの実行を許可する。","description": "プロジェクトメンバーのロールにより、プロジェクト内のデータベースとイシューを操作するための権限が決まります。プロジェクト所有者、ワークスペース管理者、および DBA はすべて、プロジェクトに対する完全な権限を持っています。","never-expires": "有効期限が切れることはありません",- "role-never-expires": "このロールには有効期限はありません。","workspace-level-roles": "ワークスペースレベルのロール"},"overview": {@@ -1659,11 +1614,7 @@"quick-action": {"create-db": "データベースの作成","create-project": "作成するプロジェクト",- "from-projects": "他のプロジェクトから",- "from-unassigned-databases": "割り当てられていないデータベース",- "request-export-data": "データ出力を申請する",- "transfer-in-db-title": "データベースへの転送",- "unassigned-db-hint": "新しく同期されたデータベースは最初は割り当てられていないため、使用するにはプロジェクトに移動する必要があります。"+ "request-export-data": "データ出力を申請する"},"quick-start": {"guide": "クリックしてステップを試してみましょう",@@ -2185,13 +2136,11 @@"search-member": "メンバーを検索","select-account": "アカウントを選択 | アカウントを選択","select-account-hint": "ユーザーやグループを検索するか、完全なメールアドレスを入力してサービスアカウントまたはワークロードアイデンティティを選択できます。",- "select-in-project": "{project} 内のユーザーまたはグループを選択してください","select-role": "ロールを選択 | ロールを選択","service-account": "サービスアカウント","service-accounts": "サービスアカウント","service-key-copied": "サービスキーはコピーされています。公開しないでください","show-inactive": "非アクティブなアカウントを表示",- "system-bot": "ロボットアシスタント","table": {"account": "アカウント","groups": "グループ",@@ -2298,8 +2247,6 @@},"grant-access": "許可されたアクセス","never-expires": "有効期限なし",- "remove-classification-tips": "この列の分類を削除しますか?",- "remove-semantic-type-tips": "この列のセマンティック タイプを削除しますか?","remove-sensitive-column-tips": "このデータ列を表示しますか?","semantic-types": {"label": "同じセマンティック タイプの列は、同じマスキング アルゴリズムを使用します。",@@ -2636,7 +2583,6 @@"sql-review": {"add-or-remove-rules": "ルールを追加または削除する","add-rules": "ルールを追加する",- "all-checks-passed": "すべてのチェックに合格しました","attach-resource": {"change-resources": "バインドされたリソースを変更する","label": "SQL レビューポリシーは環境リソースまたはプロジェクト リソースにバインドする必要があり、対応するリソースの下にあるすべてのデータベースに影響します。データベースがプロジェクト レベルと環境レベルの両方のポリシーの影響を受ける場合、プロジェクト レベルのポリシーのみが有効になります。",@@ -2646,9 +2592,7 @@"override-warning": "次のリソースは、他の SQL レビューポリシーにバインドされています。 \"{button}\" をクリックすると設定が上書きされます。","self": "リソースにバインドする"},- "category": {- "builtin": "ビルトイン"- },+ "category": {},"configure-policy": "SQL レビューポリシーを設定する","create": {"basic-info": {@@ -2685,7 +2629,6 @@"policy-removed": "SQL レビューポリシーが削除されました","policy-update-failed": "レビューポリシーの更新に失敗しました。","policy-updated": "SQL レビューポリシーが更新されました",- "rule-detail": "ルールの詳細","select-all": "すべて選択","select-review-rules": "SQL レビュールールを選択","title": "SQL レビューポリシー"@@ -2794,9 +2737,7 @@"task": {"affected-rows": "影響を受けた行数","cancel-task": "タスクをキャンセルする",- "check-result": {- "title-general": "テスト結果"- },+ "check-result": {},"check-type": {"affected-rows": {"description": "統計情報から推定。",@@ -2823,12 +2764,10 @@"no-skippable-tasks": "スキップ可能なタスクはありません","no-tasks-selected": "タスクが選択されていません","online-migration": {- "advice-split-statement-to-single-online-migration-issue": "このステートメントを 1 つのオンライン移行イシューに分割することをアドバイスします。","self": "オンラインでの大規模なテーブル変更"},"only-showing-latest-n-runs": "最新の {n} 実行のみを表示","prior-backup": "影響を受けるデータの事前バックアップ",- "run-checks": "実行チェック","run-history": "実行履歴","run-immediately": {"description": "「実行」をクリックするとすぐにタスクの実行が開始されます。遅延やスケジュール設定は必要ありません。",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex eabdaf7d39..4640d73a65 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -203,7 +203,6 @@"common": {"Default": "Mặc định","access-denied": "Truy cập bị từ chối",- "access-expires": "Truy cập hết hạn","action-required": "Cần thực hiện hành động","activated": "Đã kích hoạt","active": "Hoạt động",@@ -237,7 +236,6 @@"collapse": "Thu gọn","column": "Cột","comment": "Bình luận",- "condition": "Điều kiện","configure": "Cấu hình","configure-now": "Cấu hình ngay","confirm": "Xác nhận",@@ -257,13 +255,7 @@"database": "Cơ sở dữ liệu","database-group": "Nhóm cơ sở dữ liệu | Nhóm cơ sở dữ liệu","databases": "Cơ sở dữ liệu",- "date": {- "days": "{days} ngày",- "month": "1 tháng",- "months": "{months} tháng",- "week": "1 tuần",- "year": "1 năm"- },+ "date": {},"deactivate": "Hủy kích hoạt","default": "Mặc định","definition": "Định nghĩa",@@ -314,13 +306,7 @@"go-back": "Quay lại","google-chat": "Google Chat","groups": "Nhóm",- "hard-delete": {- "description": "Tài nguyên này và các tài nguyên liên quan khác sẽ bị xóa cứng. Bạn không thể hoàn tác hành động này.",- "double-comfirm": "Để xác nhận xóa, vui lòng nhập: {name}",- "notification": "Xóa thành công tài nguyên '{name}'.",- "self": "Xóa cứng",- "title": "Xóa cứng {name}?"- },+ "hard-delete": {},"history": "Lịch sử","home": "Trang chủ","id": "ID",@@ -336,7 +322,6 @@"language": "Ngôn ngữ","lark": "Lark","learn-more": "Tìm hiểu thêm",- "leave": "Rời khỏi","leave-without-saving": "Thoát mà không lưu?","license": "Giấy phép","line": "Dòng",@@ -348,7 +333,6 @@"minutes": "Phút","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}",- "mode": "Chế độ","n-items-selected": "Đã chọn {n} mục","n-more": "+{n} nữa","name": "Tên",@@ -409,7 +393,6 @@"rows-per-page": "Số dòng mỗi trang","run": "Chạy","save": "Lưu",- "schedule": "Lịch trình","schema": "Lược đồ","scope": "Phạm vi","search": "Tìm kiếm",@@ -434,7 +417,6 @@"state": "Trạng thái","statement": "Câu lệnh","status": "Trạng thái",- "stay": "Ở lại","submit": "Nộp","succeed": "Thành công","success": "Thành công",@@ -468,7 +450,6 @@"view-doc": "Xem tài liệu","visibility": "Hiển thị","want-help": "Cần trợ giúp",- "warehouse": "Kho","warning": "Cảnh báo","webhooks": "Webhooks","wecom": "WeCom",@@ -652,13 +633,11 @@"reference": "Tham chiếu"},"foreign-keys": "Khóa ngoại",- "foreign-table-detail": "Chi tiết bảng ngoại","index-size": "Kích thước chỉ mục","indexes": "Chỉ mục","labels": "Nhãn cơ sở dữ liệu","last-sync": "Lần đồng bộ cuối cùng","mixed-label-values-warning": "Một số tài nguyên đã chọn có các giá trị khác nhau cho cùng một khóa. Chỉ chỉnh sửa các cặp khóa-giá trị này nếu bạn muốn thay đổi chúng.",- "mixed-values-for-label": "Nhãn đã chọn này có các giá trị hỗn hợp","nullable": "Có thể null","partition-tables": "Bảng phân vùng","partitioned": "Đã phân vùng",@@ -736,23 +715,15 @@"select": "Chọn bảng","select-tip": "Vui lòng chọn một bảng để bắt đầu."},- "table-detail": "Chi tiết bảng","transfer": {- "errors": {- "select-at-least-one-database": "Chọn ít nhất một cơ sở dữ liệu",- "select-target-project": "Chọn dự án đích"- },- "select-databases": "Chọn cơ sở dữ liệu",- "select-target-project": "Chọn dự án đích"+ "errors": {}},- "transfer-database-to": "Chuyển cơ sở dữ liệu sang dự án đích","transfer-project": "Chuyển dự án","unassign": "Hủy gán","unassign-alert-description": "Các cơ sở dữ liệu đã chọn sẽ bị xóa khỏi dự án","unassign-alert-title": "Hủy gán cơ sở dữ liệu","unassigned-databases": "Cơ sở dữ liệu chưa được gán","unique": "Duy nhất",- "view-definition": "Định nghĩa khung nhìn","visible": "Hiển thị"},"database-group": {@@ -760,7 +731,6 @@"self": "Điều kiện"},"delete-group": "Xóa nhóm cơ sở dữ liệu {name}",- "deleted": "Nhóm cơ sở dữ liệu đã xóa","matched-database": "Cơ sở dữ liệu phù hợp","no-matched-databases": "Không có cơ sở dữ liệu phù hợp","select": "Chọn nhóm cơ sở dữ liệu",@@ -779,7 +749,6 @@"failed-to-sync-schema": "Không đồng bộ hóa được lược đồ","failed-to-sync-schema-for-database-database-value-name": "Không đồng bộ hóa được lược đồ cho cơ sở dữ liệu '{0}'.","functions": "Hàm",- "labels-for-resource": "Nhãn cho {resource}","n-databases-had-sync-errors": "{0} cơ sở dữ liệu gặp lỗi đồng bộ","packages": "Gói","partitions": "Phân vùng",@@ -1221,8 +1190,6 @@"all-databases": "Tất cả","all-databases-tip": "Tất cả cơ sở dữ liệu hiện tại và tương lai trong dự án này.","column-scope-select-disabled": "Không thể chọn thủ công cho phạm vi ở mức cột.",- "custom-date": "Ngày tùy chỉnh",- "custom-date-placeholder": "Chọn ngày và giờ hết hạn","details": "Yêu cầu chi tiết","expired-at": "Hết hạn vào","manually-select": "Chọn thủ công",@@ -1235,12 +1202,7 @@"sort": "Sắp xếp","updated": "Thời gian cập nhật"},- "sql-check": {- "back-to-edit": "Quay lại chỉnh sửa",- "sql-review-violations": "Vi phạm đánh giá SQL",- "statement-is-required": "Câu lệnh SQL là bắt buộc",- "statement-is-too-large": "Vì kích thước câu lệnh hiện tại vượt quá 2MB, việc kiểm tra SQL sẽ bị bỏ qua."- },+ "sql-check": {},"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ó.","status-transition": {"modal": {@@ -1274,7 +1236,6 @@"transaction-mode": {"label": "Chế độ giao dịch"},- "unfinished-resolved-issue-tips": "Vấn đề này được đánh dấu là \"Đã phê duyệt\" nhưng một số tác vụ của nó không được thực hiện thành công.","upload-sql": "Tải lên SQL","upload-sql-file-max-size-exceeded": "Vượt quá kích thước tệp tối đa ({size}).","waiting-approval": "Đang chờ phê duyệt"@@ -1347,9 +1308,7 @@"placeholder": "Thêm mô tả"},"editor": {- "save-changes-before-continuing": "Vui lòng lưu hoặc hủy thay đổi của bạn trước khi tiếp tục",- "unsaved-changes": "Những thay đổi chưa lưu",- "unsaved-changes-message": "Bạn chưa lưu thay đổi. Bạn có chắc chắn muốn thoát không?"+ "save-changes-before-continuing": "Vui lòng lưu hoặc hủy thay đổi của bạn trước khi tiếp tục"},"go-to-plan-page": "Đi tới trang kế hoạch","isolation-level": {@@ -1401,10 +1360,7 @@"spec": {"change": "Thay đổi","type": {- "create-database": "Tạo cơ sở dữ liệu",- "database-change": "Thay đổi cơ sở dữ liệu",- "export-data": "Xuất dữ liệu",- "unknown": "Không rõ"+ "database-change": "Thay đổi cơ sở dữ liệu"}},"state": {@@ -1517,7 +1473,6 @@"allow-ddl": "Cho phép chạy câu lệnh DDL/DML trong các môi trường đã chọn.","description": "Thành viên dự án xác định quyền để vận hành cơ sở dữ liệu và các vấn đề bên trong dự án. Chủ sở hữu dự án, Quản trị viên không gian làm việc và DBA không gian làm việc đều có toàn quyền dự án.","never-expires": "Không bao giờ",- "role-never-expires": "Vai trò này không bao giờ hết hạn.","workspace-level-roles": "Vai trò cấp độ không gian làm việc"},"overview": {@@ -1659,11 +1614,7 @@"quick-action": {"create-db": "Tạo cơ sở dữ liệu","create-project": "Tạo Dự án",- "from-projects": "Từ các dự án khác",- "from-unassigned-databases": "Cơ sở dữ liệu chưa được gán",- "request-export-data": "Yêu cầu Xuất",- "transfer-in-db-title": "Chuyển vào cơ sở dữ liệu",- "unassigned-db-hint": "Các cơ sở dữ liệu mới được đồng bộ hóa bắt đầu chưa được gán và phải được chuyển đến một dự án để sử dụng."+ "request-export-data": "Yêu cầu Xuất"},"quick-start": {"guide": "nhấp vào bước để thử",@@ -2185,13 +2136,11 @@"search-member": "Tìm kiếm thành viên","select-account": "Chọn tài khoản | Chọn tài khoản","select-account-hint": "Bạn có thể tìm kiếm người dùng và nhóm, hoặc nhập toàn bộ email để chọn tài khoản dịch vụ hoặc danh tính khối lượng công việc.",- "select-in-project": "Chọn người dùng hoặc nhóm trong {project}","select-role": "Chọn vai trò | Chọn vai trò","service-account": "Tài khoản dịch vụ","service-accounts": "Tài khoản dịch vụ","service-key-copied": "Khóa Dịch vụ đã được sao chép vào khay nhớ tạm, vui lòng giữ bí mật.","show-inactive": "Hiển thị tài khoản không hoạt động",- "system-bot": "Bot hệ thống","table": {"account": "Tài khoản","groups": "Nhóm",@@ -2298,8 +2247,6 @@},"grant-access": "Cấp quyền truy cập","never-expires": "Không bao giờ hết hạn",- "remove-classification-tips": "Xóa phân loại cho cột này?",- "remove-semantic-type-tips": "Xóa loại ngữ nghĩa cho cột này?","remove-sensitive-column-tips": "Hiển thị cột này?","semantic-types": {"label": "Các cột có cùng loại ngữ nghĩa sẽ sử dụng cùng một thuật toán che.",@@ -2636,7 +2583,6 @@"sql-review": {"add-or-remove-rules": "Thêm hoặc xóa quy tắc","add-rules": "Thêm quy tắc",- "all-checks-passed": "Tất cả kiểm tra đã vượt qua","attach-resource": {"change-resources": "Thay đổi tài nguyên đính kèm","label": "Bạn có thể áp dụng chính sách đánh giá SQL cho môi trường hoặc dự án. Cơ sở dữ liệu sẽ sử dụng chính sách cấp dự án nếu có, hoặc quay lại chính sách cấp môi trường.",@@ -2646,9 +2592,7 @@"override-warning": "Các tài nguyên sau đã được liên kết với các chính sách đánh giá SQL khác. Nhấp vào \"{button}\" sẽ ghi đè cấu hình.","self": "Đính kèm vào tài nguyên"},- "category": {- "builtin": "Tích hợp sẵn"- },+ "category": {},"configure-policy": "Định cấu hình chính sách","create": {"basic-info": {@@ -2685,7 +2629,6 @@"policy-removed": "Đã xóa thành công chính sách đánh giá.","policy-update-failed": "Không cập nhật được chính sách đánh giá.","policy-updated": "Đã cập nhật thành công chính sách đánh giá.",- "rule-detail": "Chi tiết quy tắc","select-all": "Chọn tất cả","select-review-rules": "Chọn quy tắc đánh giá SQL","title": "Đánh giá SQL"@@ -2794,9 +2737,7 @@"task": {"affected-rows": "Hàng bị ảnh hưởng","cancel-task": "Hủy tác vụ | Hủy các tác vụ",- "check-result": {- "title-general": "Kết quả kiểm tra"- },+ "check-result": {},"check-type": {"affected-rows": {"description": "Ước tính theo thông tin thống kê.",@@ -2823,12 +2764,10 @@"no-skippable-tasks": "Không có nhiệm vụ nào có thể bỏ qua","no-tasks-selected": "Không có nhiệm vụ nào được chọn","online-migration": {- "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.","self": "Di chuyển trực tuyến"},"only-showing-latest-n-runs": "Chỉ hiển thị các lần chạy {n} mới nhất","prior-backup": "Sao lưu trước",- "run-checks": "Chạy kiểm tra","run-history": "Lịch sử chạy","run-immediately": {"description": "Các tác vụ sẽ bắt đầu thực thi ngay khi bạn nhấp vào Chạy. Không cần trì hoãn hay lên lịch.",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex fe280a340e..b0b740c9fc 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -203,7 +203,6 @@"common": {"Default": "默认","access-denied": "拒绝访问",- "access-expires": "访问到期","action-required": "需要操作","activated": "已激活","active": "开启",@@ -237,7 +236,6 @@"collapse": "收起","column": "列","comment": "评论",- "condition": "条件","configure": "配置","configure-now": "现在配置","confirm": "确认",@@ -257,13 +255,7 @@"database": "数据库","database-group": "数据库分组","databases": "数据库",- "date": {- "days": "{days} 天",- "month": "1 个月",- "months": "{months} 个月",- "week": "1 周",- "year": "1 年"- },+ "date": {},"deactivate": "禁用","default": "默认","definition": "定义",@@ -314,13 +306,7 @@"go-back": "返回","google-chat": "Google Chat","groups": "分组",- "hard-delete": {- "description": "此资源和其他相关资源将被硬删除。这个操作无法撤销",- "double-comfirm": "要确认删除,请输入:{name}",- "notification": "成功删除资源“{name}”。",- "self": "彻底删除",- "title": "彻底删除 {name}?"- },+ "hard-delete": {},"history": "历史记录","home": "主页","id": "ID",@@ -336,7 +322,6 @@"language": "语言","lark": "Lark","learn-more": "了解更多",- "leave": "离开","leave-without-saving": "不保存变动?","license": "证书","line": "行",@@ -348,7 +333,6 @@"minutes": "分钟","missing-required-permission": "缺少必需的权限 {permissions}","missing-required-permission-for-resource": "缺少资源 {resource} 的必需权限",- "mode": "模式","n-items-selected": "已选 {n} 项","n-more": "+{n} 更多","name": "名称",@@ -409,7 +393,6 @@"rows-per-page": "每页行数","run": "运行","save": "保存",- "schedule": "计划","schema": "Schema","scope": "范围","search": "搜索",@@ -434,7 +417,6 @@"state": "状态","statement": "语句","status": "状态",- "stay": "停留","submit": "提交","succeed": "成功","success": "成功",@@ -468,7 +450,6 @@"view-doc": "查看文档","visibility": "可见性","want-help": "加入用户群",- "warehouse": "仓库","warning": "警告","webhooks": "Webhook","wecom": "企业微信",@@ -652,13 +633,11 @@"reference": "引用"},"foreign-keys": "外键",- "foreign-table-detail": "外部表详情","index-size": "索引大小","indexes": "索引","labels": "数据库标签","last-sync": "最后一次同步","mixed-label-values-warning": "部分标签拥有不同的值,编辑标签将会批量应用。仅在您打算更改时再编辑这些键值对。",- "mixed-values-for-label": "该标签拥有不同的值","nullable": "可为空","partition-tables": "分区表","partitioned": "分区",@@ -736,23 +715,15 @@"select": "选择表","select-tip": "请选择一个表来开始查询。"},- "table-detail": "表详情","transfer": {- "errors": {- "select-at-least-one-database": "至少选择一个数据库",- "select-target-project": "选择目标项目"- },- "select-databases": "选择数据库",- "select-target-project": "选择目标项目"+ "errors": {}},- "transfer-database-to": "将数据库转移到目标项目","transfer-project": "转移项目","unassign": "取消分配","unassign-alert-description": "选定的数据库将从项目中移除","unassign-alert-title": "取消分配数据库","unassigned-databases": "未分配的数据库","unique": "Unique",- "view-definition": "查看定义","visible": "Visible"},"database-group": {@@ -760,7 +731,6 @@"self": "条件"},"delete-group": "删除数据库组 {name}",- "deleted": "已删除的数据库组","matched-database": "相匹配的数据库","no-matched-databases": "没有匹配的数据库","select": "选择数据库分组",@@ -779,7 +749,6 @@"failed-to-sync-schema": "同步 schema 失败","failed-to-sync-schema-for-database-database-value-name": "为数据库'{0}'同步 schema 失败。","functions": "函数",- "labels-for-resource": "{resource}的标签","n-databases-had-sync-errors": "{0} 个数据库同步出错","packages": "包","partitions": "分区",@@ -1221,8 +1190,6 @@"all-databases": "所有数据库","all-databases-tip": "所有当前和未来属于这个项目的数据库。","column-scope-select-disabled": "列级范围的选择不能使用手动选择。",- "custom-date": "自定义日期",- "custom-date-placeholder": "选择到期日期和时间","details": "请求详细","expired-at": "过期时间","manually-select": "手动选择",@@ -1235,12 +1202,7 @@"sort": "排序","updated": "更新时间"},- "sql-check": {- "back-to-edit": "返回编辑",- "sql-review-violations": "违反的 SQL 审核规则",- "statement-is-required": "SQL 语句不能为空",- "statement-is-too-large": "当前语句大小超过 2MB,将跳过 SQL 检查。"- },+ "sql-check": {},"statement-from-sheet-warning": "由于 SQL 文件过大,因此被截断以便显示,并且编辑功能已禁用。你可以上传新的 SQL 文件以将其覆盖。","status-transition": {"modal": {@@ -1274,7 +1236,6 @@"transaction-mode": {"label": "事务模式"},- "unfinished-resolved-issue-tips": "该工单被标记为「已完成」,但其中部分任务并未成功执行。","upload-sql": "上传 SQL","upload-sql-file-max-size-exceeded": "上传文件大小不能超过 {size}。","waiting-approval": "等待审批"@@ -1347,9 +1308,7 @@"placeholder": "添加描述"},"editor": {- "save-changes-before-continuing": "请保存或取消更改,然后再继续",- "unsaved-changes": "未保存的更改",- "unsaved-changes-message": "有未保存的更改。您确定要离开吗?"+ "save-changes-before-continuing": "请保存或取消更改,然后再继续"},"go-to-plan-page": "前往变更计划页","isolation-level": {@@ -1401,10 +1360,7 @@"spec": {"change": "变更项","type": {- "create-database": "创建数据库",- "database-change": "数据库变更",- "export-data": "导出数据",- "unknown": "未知"+ "database-change": "数据库变更"}},"state": {@@ -1517,7 +1473,6 @@"allow-ddl": "允许在所选环境中执行 DDL/DML 语句。","description": "项目成员角色决定了操作项目中的数据库和工单的权限。项目的所有者,工作空间管理员和 DBA 都具有项目所有的权限。","never-expires": "永不过期",- "role-never-expires": "此角色没有过期时间。","workspace-level-roles": "工作空间级别角色"},"overview": {@@ -1659,11 +1614,7 @@"quick-action": {"create-db": "创建数据库","create-project": "创建项目",- "from-projects": "从其他项目",- "from-unassigned-databases": "未分配的数据库",- "request-export-data": "申请导出数据",- "transfer-in-db-title": "转进数据库",- "unassigned-db-hint": "新同步的数据库起先是未分配的状态,必须移至一个项目以供使用。"+ "request-export-data": "申请导出数据"},"quick-start": {"guide": "可点击步骤进行尝试",@@ -2185,13 +2136,11 @@"search-member": "搜索成员","select-account": "选择账户 | 选择账户","select-account-hint": "您可以搜索用户和组,或输入完整的电子邮件地址来选择服务账号或工作负载身份。",- "select-in-project": "选择 {project} 内的用户或群组","select-role": "选择角色 | 选择角色","service-account": "服务账号","service-accounts": "服务账号","service-key-copied": "Service Key 已复制,请勿泄漏","show-inactive": "显示已停用账户",- "system-bot": "机器人助手","table": {"account": "账户","groups": "群组",@@ -2298,8 +2247,6 @@},"grant-access": "授权访问","never-expires": "无过期时间",- "remove-classification-tips": "删除此列的分类吗?",- "remove-semantic-type-tips": "删除此列的语义类型吗?","remove-sensitive-column-tips": "不再对此列数据脱敏?","semantic-types": {"label": "具有相同语义类型的列会使用相同的脱敏算法。",@@ -2636,7 +2583,6 @@"sql-review": {"add-or-remove-rules": "添加或删除规则","add-rules": "添加规则",- "all-checks-passed": "所有检查都通过了","attach-resource": {"change-resources": "更改绑定的资源","label": "审核策略需要绑定到环境资源或项目资源上,并影响对应资源下所有数据库。若一个数据库同时受到项目级别与环境级别策略影响,则只有项目级别策略生效。",@@ -2646,9 +2592,7 @@"override-warning": "以下资源已与其他 SQL 审核策略绑定。点击\"{button}\"将覆盖配置。","self": "绑定到资源"},- "category": {- "builtin": "内置"- },+ "category": {},"configure-policy": "配置审核策略","create": {"basic-info": {@@ -2685,7 +2629,6 @@"policy-removed": "审核策略已删除","policy-update-failed": "审核策略更新失败","policy-updated": "审核策略已更新",- "rule-detail": "规则详情","select-all": "选择全部","select-review-rules": "选择 SQL 审核规则","title": "SQL 审核策略"@@ -2794,9 +2737,7 @@"task": {"affected-rows": "影响行数","cancel-task": "取消任务",- "check-result": {- "title-general": "检查结果"- },+ "check-result": {},"check-type": {"affected-rows": {"description": "根据统计信息估算。",@@ -2823,12 +2764,10 @@"no-skippable-tasks": "没有可跳过的任务","no-tasks-selected": "未选择任何任务","online-migration": {- "advice-split-statement-to-single-online-migration-issue": "建议将该语句拆分成单独的在线大表变更工单。","self": "在线大表变更"},"only-showing-latest-n-runs": "仅显示最近 {n} 条记录","prior-backup": "预备份受影响数据",- "run-checks": "运行检查","run-history": "执行历史","run-immediately": {"description": "点击“运行”后,任务将立即开始执行。",