Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore(frontend): sweep orphan Vue files + untangle expr.ts h() callbacks (#20331)
boojack06c44ccf4b49
diff --git a/frontend/src/bbkit/BBAvatar.vue b/frontend/src/bbkit/BBAvatar.vuedeleted file mode 100644index 460991ed35..0000000000--- a/frontend/src/bbkit/BBAvatar.vue+++ /dev/null@@ -1,149 +0,0 @@-<template>- <!-- This div is used to insulate it from outside element to prevent resizing the BBAvatar -->- <div>- <div- class="flex justify-center items-center select-none"- :class="textClass"- :style="[style]"- >- <slot>{{ initials }}</slot>- </div>- </div>-</template>--<script lang="ts" setup>-import isChinese from "is-chinese";-import { computed } from "vue";-import type { VueClass } from "@/utils";-import { hashCode } from "./BBUtil";-import type { BBAvatarSizeType } from "./types";--const BACKGROUND_COLOR_LIST: string[] = [- "#64748B",- "#EF4444",- "#F97316",- "#EAB308",- "#84CC16",- "#22C55E",- "#10B981",- "#06B6D4",- "#0EA5E9",- "#3B82F6",- "#6366F1",- "#8B5CF6",- "#A855F7",- "#D946EF",- "#EC4899",- "#F43F5E",-];--const sizeClassMap: Map<BBAvatarSizeType, string> = new Map([- ["MINI", "w-[18px] h-[18px] font-medium"],- ["TINY", "w-4 h-4"],- ["SMALL", "w-6 h-6 font-medium"],- ["NORMAL", "w-8 h-8 font-medium"],- ["LARGE", "w-24 h-24 font-medium"],- ["HUGE", "w-36 h-36 font-medium"],-]);--const fontStyleClassMap: Map<BBAvatarSizeType, string> = new Map([- ["MINI", "0.5rem"], // customized font size- ["TINY", "0.5rem"], // customized font size- ["SMALL", "0.675rem"], // customized font size- ["NORMAL", "0.875rem"], // text-sm- ["LARGE", "2.25rem"], // text-4xl- ["HUGE", "3rem"], // text-5xl-]);--const props = withDefaults(- defineProps<{- username?: string;- email?: string;- size?: BBAvatarSizeType;- rounded?: boolean;- backgroundColor?: string;- overrideClass?: VueClass;- overrideTextSize?: string;- }>(),- {- username: "",- email: "",- size: "NORMAL",- rounded: true,- backgroundColor: "",- overrideClass: undefined,- overrideTextSize: undefined,- }-);--const initials = computed(() => {- if (props.username === "?") {- return "?";- }-- // Priority- // 1. First Chinese character- // 2. At most the first 2 letters in email- // Fallback if email is invalid- // 1. The first and the last initial letter in title- // 2. The first initial letter in title-- const chars = props.username.split("");- for (let i = 0; i < chars.length; i++) {- const ch = chars[i];- if (isChinese(ch)) {- return ch;- }- }-- if (props.email) {- const nameInEmail = props.email.split("@")[0] ?? "";- if (nameInEmail.length >= 2) {- return nameInEmail.substring(0, 2).toUpperCase();- }- if (nameInEmail.length === 1) {- return nameInEmail.charAt(0).toUpperCase();- }- }-- const parts = props.username.split(/[ -]/);- let initials = "";- for (let i = 0; i < parts.length; i++) {- for (let j = 0; j < parts[i].length; j++) {- // Skip non-alphabet leading letters- if (/[a-zA-Z0-9]/.test(parts[i].charAt(j))) {- initials += parts[i].charAt(j);- break;- }- }- }- if (initials.length <= 2) {- return initials.toUpperCase();- }- // If there are more than 2 initials, we will pick the first and last initial.- // Displaying > 2 letters in a circle doesn't look good.- return (initials[0] + initials[initials.length - 1]).toUpperCase();-});--const backgroundColor = computed(() => {- return (- props.backgroundColor ||- BACKGROUND_COLOR_LIST[- (hashCode(props.username) & 0xfffffff) % BACKGROUND_COLOR_LIST.length- ]- );-});--const style = computed(() => {- return {- borderRadius: props.rounded ? "50%" : 0,- backgroundColor: backgroundColor.value,- color: "white",- "font-size": props.overrideTextSize ?? fontStyleClassMap.get(props.size),- };-});--const textClass = computed(() => {- return props.overrideClass ?? sizeClassMap.get(props.size);-});-</script>diff --git a/frontend/src/bbkit/index.ts b/frontend/src/bbkit/index.tsindex 5345018c57..8c45fb5b4a 100644--- a/frontend/src/bbkit/index.ts+++ b/frontend/src/bbkit/index.ts@@ -1,6 +1,5 @@import BBAlert from "./BBAlert.vue";import BBAttention from "./BBAttention.vue";-import BBAvatar from "./BBAvatar.vue";import BBButtonConfirm from "./BBButtonConfirm.vue";import BBModal from "./BBModal.vue";import BBSpin from "./BBSpin.vue";@@ -8,12 +7,4 @@ import BBTextField from "./BBTextField.vue";export * from "./types";-export {- BBAlert,- BBAttention,- BBAvatar,- BBButtonConfirm,- BBModal,- BBSpin,- BBTextField,-};+export { BBAlert, BBAttention, BBButtonConfirm, BBModal, BBSpin, BBTextField };diff --git a/frontend/src/components/EllipsisText.vue b/frontend/src/components/EllipsisText.vuedeleted file mode 100644index 2da0886566..0000000000--- a/frontend/src/components/EllipsisText.vue+++ /dev/null@@ -1,41 +0,0 @@-<template>- <component- :is="performant ? NPerformantEllipsis : NEllipsis"- :line-clamp="lineClamp"- :tooltip="{- showArrow: true,- raw: true,- contentStyle: tooltipStyle,- }"- >- <slot></slot>- </component>-</template>--<script lang="ts" setup>-import { NEllipsis, NPerformantEllipsis } from "naive-ui";--withDefaults(- defineProps<{- performant?: boolean;- lineClamp?: number;- }>(),- {- performant: false,- lineClamp: undefined,- }-);--const tooltipStyle = `- border-radius: 0.25rem;- background-color: rgb(0 0 0 / var(--tw-bg-opacity));- --tw-bg-opacity: 0.75;- padding-left: 0.5rem;- padding-right: 0.5rem;- padding-top: 0.25rem;- padding-bottom: 0.25rem;- --tw-text-opacity: 1;- color: rgb(255 255 255 / var(--tw-text-opacity));- max-width: 80vw;-`;-</script>diff --git a/frontend/src/components/ExprEditor/context.ts b/frontend/src/components/ExprEditor/context.tsdeleted file mode 100644index 05e11a84a1..0000000000--- a/frontend/src/components/ExprEditor/context.ts+++ /dev/null@@ -1,35 +0,0 @@-import { type InjectionKey, inject, provide, type Ref } from "vue";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";-import type { Factor, Operator } from "@/plugins/cel";--export type OptionConfig = {- search?: (params: {- search: string;- pageToken: string;- pageSize: number;- }) => Promise<{- nextPageToken: string;- options: ResourceSelectOption<unknown>[];- }>;- fetch?: (names: string[]) => Promise<ResourceSelectOption<unknown>[]>;- fallback?: (value: string) => ResourceSelectOption<unknown>;- options: ResourceSelectOption<unknown>[];-};--export type ExprEditorContext = {- readonly: Ref<boolean>;- enableRawExpression: Ref<boolean>;- factorList: Ref<Factor[]>;- optionConfigMap: Ref<Map<Factor, OptionConfig>>;- factorOperatorOverrideMap: Ref<Map<Factor, Operator[]> | undefined>;-};--export const KEY = Symbol("bb.expr-editor") as InjectionKey<ExprEditorContext>;--export const useExprEditorContext = () => {- return inject(KEY)!;-};--export const provideExprEditorContext = (context: ExprEditorContext) => {- provide(KEY, context);-};diff --git a/frontend/src/components/FeatureGuard/FeatureBadge.vue b/frontend/src/components/FeatureGuard/FeatureBadge.vuedeleted file mode 100644index 897fffa731..0000000000--- a/frontend/src/components/FeatureGuard/FeatureBadge.vue+++ /dev/null@@ -1,115 +0,0 @@-<!-- This component is used when uses don't have available plan to access the feature, or the instance is missing required license. -->-<!-- Normally this should be a blocker to use the feature -->-<template>- <div- v-if="instanceMissingLicense"- class="text-accent cursor-pointer"- v-bind="$attrs"- @click="- (e: MouseEvent) => {- e.stopPropagation();- e.preventDefault();- gotoInstanceAssignment();- }- "- >- <NTooltip :show-arrow="true">- <template #trigger>- <Lock class="w-5 h-5" />- </template>- <span class="w-56 text-sm">- {{ $t("subscription.instance-assignment.missing-license-attention") }}- </span>- </NTooltip>- </div>- <div v-else-if="!hasFeature" class="text-accent" v-bind="$attrs">- <NTooltip :show-arrow="true">- <template #trigger>- <router-link- v-if="clickable"- :to="autoSubscriptionRoute()"- exact-active-class=""- >- <SparklesIcon class="w-5 h-5" />- </router-link>- <span v-else>- <SparklesIcon class="w-5 h-5" />- </span>- </template>- <span class="w-56 text-sm">- {{- $t("subscription.require-subscription", {- requiredPlan: $t(- `subscription.plan.${PlanType[- subscriptionStore.getMinimumRequiredPlan(feature)- ].toLowerCase()}.title`- ),- })- }}- </span>- </NTooltip>- </div>-</template>--<script lang="ts" setup>-import { Lock, SparklesIcon } from "lucide-vue-next";-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import { useRouter } from "vue-router";-import { INSTANCE_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";-import { useSubscriptionV1Store } from "@/store";-import type {- Instance,- InstanceResource,-} from "@/types/proto-es/v1/instance_service_pb";-import {- PlanFeature,- PlanType,-} from "@/types/proto-es/v1/subscription_service_pb";-import { autoSubscriptionRoute, hasWorkspacePermissionV2 } from "@/utils";--const props = withDefaults(- defineProps<{- feature: PlanFeature;- instance?: Instance | InstanceResource;- showInstanceMissingLicense?: boolean;- clickable?: boolean;- }>(),- {- instance: undefined,- clickable: false,- showInstanceMissingLicense: true,- }-);--const router = useRouter();-const subscriptionStore = useSubscriptionV1Store();--const hasFeature = computed(() => {- return subscriptionStore.hasInstanceFeature(props.feature);-});--const instanceMissingLicense = computed(() => {- return (- props.showInstanceMissingLicense &&- subscriptionStore.instanceMissingLicense(props.feature, props.instance)- );-});--const canManageSubscription = computed((): boolean => {- return hasWorkspacePermissionV2("bb.instances.update");-});--const gotoInstanceAssignment = () => {- if (!canManageSubscription.value) {- return;- }- router.push({- name: INSTANCE_ROUTE_DASHBOARD,- query: {- assignLicense: "1",- instances: props.instance?.name,- },- });-};-</script>diff --git a/frontend/src/components/FeatureGuard/FeatureModal.vue b/frontend/src/components/FeatureGuard/FeatureModal.vuedeleted file mode 100644index 9dedb7617f..0000000000--- a/frontend/src/components/FeatureGuard/FeatureModal.vue+++ /dev/null@@ -1,177 +0,0 @@-<template>- <BBModal v-if="open && feature" :title="title" @close="$emit('cancel')">- <div class="min-w-0 md:min-w-100 max-w-4xl mb-2">- <div class="flex items-start gap-x-2 mt-3">- <div class="flex items-center">- <Lock- v-if="instanceMissingLicense"- class="text-accent w-6 h-6"- />- <SparklesIcon v-else class="h-6 w-6 text-accent" />- </div>- <h3- id="modal-headline"- class="flex self-center text-lg leading-6 font-medium text-gray-900"- >- {{ $t(`dynamic.subscription.features.${featureKey}.title`) }}- </h3>- </div>- <div class="mt-4">- <p class="whitespace-pre-wrap">- {{ $t(`dynamic.subscription.features.${featureKey}.desc`) }}- </p>- </div>- <div class="mt-3">- <p class="whitespace-pre-wrap">- <i18n-t- v-if="instanceMissingLicense"- keypath="subscription.instance-assignment.missing-license-attention"- />- <i18n-t- v-else-if="requiredPlan !== PlanType.FREE"- keypath="subscription.required-plan-with-trial"- >- <template #requiredPlan>- <span class="font-bold text-accent">- {{- $t(- `subscription.plan.${PlanType[requiredPlan].toLowerCase()}.title`- )- }}- </span>- </template>- <template v-if="!hasPermission" #startTrial>- {{ $t("subscription.contact-to-upgrade") }}- </template>- <template v-else #startTrial>- {{- $t("subscription.trial-for-days", {- days: subscriptionStore.trialingDays,- })- }}- </template>- </i18n-t>- <i18n-t v-else keypath="subscription.trial-for-days">- <template #days>- {{ subscriptionStore.trialingDays }}- </template>- </i18n-t>- </p>- </div>- <div class="mt-7 flex justify-end gap-x-2">- <NButton- v-if="!hasPermission"- type="primary"- @click.prevent="$emit('cancel')"- >- {{ $t("common.ok") }}- </NButton>- <template v-else-if="subscriptionStore.showTrial">- <NButton type="primary" @click.prevent="trialSubscription">- {{- $t("subscription.request-n-days-trial", {- days: subscriptionStore.trialingDays,- })- }}- </NButton>- </template>- <NButton v-else type="primary" @click.prevent="ok">- {{- instanceMissingLicense- ? $t("subscription.instance-assignment.assign-license")- : $t("common.learn-more")- }}- </NButton>- </div>- </div>- </BBModal>-</template>--<script lang="ts" setup>-import { Lock, SparklesIcon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useRouter } from "vue-router";-import { BBModal } from "@/bbkit";-import { INSTANCE_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";-import { useSubscriptionV1Store } from "@/store";-import { ENTERPRISE_INQUIRE_LINK } from "@/types";-import type {- Instance,- InstanceResource,-} from "@/types/proto-es/v1/instance_service_pb";-import {- PlanFeature,- PlanType,-} from "@/types/proto-es/v1/subscription_service_pb";-import { autoSubscriptionRoute, hasWorkspacePermissionV2 } from "@/utils";--const props = withDefaults(- defineProps<{- open: boolean;- feature?: PlanFeature;- instance?: Instance | InstanceResource;- }>(),- {- feature: PlanFeature.FEATURE_UNSPECIFIED,- instance: undefined,- }-);--const emit = defineEmits(["cancel"]);-const { t } = useI18n();-const router = useRouter();--const subscriptionStore = useSubscriptionV1Store();-const hasPermission = hasWorkspacePermissionV2("bb.settings.set");--const instanceMissingLicense = computed(() => {- return subscriptionStore.instanceMissingLicense(- props.feature,- props.instance- );-});--const title = computed(() => {- if (instanceMissingLicense.value) {- return t("subscription.instance-assignment.require-license");- }- return t("subscription.disabled-feature");-});--const ok = () => {- if (instanceMissingLicense.value) {- router.push({- name: INSTANCE_ROUTE_DASHBOARD,- query: {- assignLicense: "1",- instances: props.instance?.name,- },- });- } else {- router.push(autoSubscriptionRoute());- }- emit("cancel");-};--const requiredPlan = computed(() =>- subscriptionStore.getMinimumRequiredPlan(props.feature)-);--const featureKey = computed(() => {- return PlanFeature[props.feature].split(".").join("-");-});--const trialSubscription = () => {- window.open(ENTERPRISE_INQUIRE_LINK, "_blank");-};-</script>--<style scoped>-@media (min-width: 768px) {- .md\:min-w-400 {- min-width: 400px;- }-}-</style>diff --git a/frontend/src/components/FeatureGuard/index.ts b/frontend/src/components/FeatureGuard/index.tsdeleted file mode 100644index 180817061d..0000000000--- a/frontend/src/components/FeatureGuard/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import FeatureBadge from "./FeatureBadge.vue";-import FeatureModal from "./FeatureModal.vue";--export { FeatureBadge, FeatureModal };diff --git a/frontend/src/components/HighlightCodeBlock.vue b/frontend/src/components/HighlightCodeBlock.vuedeleted file mode 100644index d7c953e901..0000000000--- a/frontend/src/components/HighlightCodeBlock.vue+++ /dev/null@@ -1,96 +0,0 @@-<template>- <!-- eslint-disable-next-line vue/no-v-text-v-html-on-component -->- <component :is="tag" :class="[language, $attrs.class]" v-html="highlightedCode" />-</template>--<script lang="ts" setup>-import hljs from "highlight.js/lib/core";-import { computed, onMounted, ref, watch } from "vue";--const props = withDefaults(- defineProps<{- code: string;- language?: string;- tag?: string;- lazy?: boolean;- }>(),- {- language: "sql",- tag: "pre",- lazy: false,- }-);--defineOptions({- inheritAttrs: false,-});--const isReady = ref(!props.lazy);-const cachedHtml = ref("");--const highlightedCode = computed(() => {- if (!isReady.value) {- return escapeHtml(props.code);- }- return cachedHtml.value || escapeHtml(props.code);-});--const escapeHtml = (text: string): string => {- if (!text) return "";- return text- .replace(/&/g, "&")- .replace(/</g, "<")- .replace(/>/g, ">");-};--const doHighlight = () => {- if (!props.code) {- cachedHtml.value = "";- isReady.value = true;- return;- }-- try {- const result = hljs.highlight(props.code, {- language: props.language,- ignoreIllegals: true,- });- cachedHtml.value = result.value;- } catch {- cachedHtml.value = escapeHtml(props.code);- }- isReady.value = true;-};--const scheduleHighlight = () => {- if (props.lazy) {- if (typeof requestIdleCallback !== "undefined") {- requestIdleCallback(() => doHighlight(), { timeout: 100 });- } else {- setTimeout(doHighlight, 0);- }- } else {- doHighlight();- }-};--// Initialize-if (!props.lazy) {- doHighlight();-}--onMounted(() => {- if (props.lazy) {- scheduleHighlight();- }-});--// Watch for changes-watch(- () => [props.code, props.language] as const,- () => {- isReady.value = false;- scheduleHighlight();- }-);-</script>diff --git a/frontend/src/components/Icon/CheckIcon.vue b/frontend/src/components/Icon/CheckIcon.vuedeleted file mode 100644index 04bd58fb43..0000000000--- a/frontend/src/components/Icon/CheckIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <CheckIcon class="w-3 h-3" />-</template>--<script setup lang="ts">-import { Check as CheckIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/ColumnIcon.vue b/frontend/src/components/Icon/ColumnIcon.vuedeleted file mode 100644index cde42e4819..0000000000--- a/frontend/src/components/Icon/ColumnIcon.vue+++ /dev/null@@ -1,22 +0,0 @@-<template>- <svg- xmlns="http://www.w3.org/2000/svg"- width="24"- height="24"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2"- stroke-linecap="round"- stroke-linejoin="round"- class="lucide lucide-columns-3 text-gray-500"- v-bind="$attrs"- >- <rect width="18" height="18" x="3" y="3" rx="2" />- <path d="M9 3v18" />- </svg>-</template>--<script setup lang="ts">-// Based on lucide:columns-3 and removing the second gap line-</script>diff --git a/frontend/src/components/Icon/DatabaseIcon.vue b/frontend/src/components/Icon/DatabaseIcon.vuedeleted file mode 100644index 97663ac01a..0000000000--- a/frontend/src/components/Icon/DatabaseIcon.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <div class="relative">- <DatabaseIcon v-bind="$attrs" />- </div>-</template>-<script setup lang="ts">-import { Database as DatabaseIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/EngineIcon.vue b/frontend/src/components/Icon/EngineIcon.vuedeleted file mode 100644index 1dcf1d7cb6..0000000000--- a/frontend/src/components/Icon/EngineIcon.vue+++ /dev/null@@ -1,22 +0,0 @@-<template>- <img- :class="twMerge('h-4 w-auto mx-auto object-contain', customClass)"- :src="icon"- />-</template>--<script lang="ts" setup>-import { twMerge } from "tailwind-merge";-import { computed } from "vue";-import { EngineIconPath } from "@/components/InstanceForm/constants";-import type { Engine } from "@/types/proto-es/v1/common_pb";--const props = defineProps<{- engine: Engine;- customClass?: string;-}>();--const icon = computed(() => {- return EngineIconPath[props.engine];-});-</script>diff --git a/frontend/src/components/Icon/ExternalTableIcon.vue b/frontend/src/components/Icon/ExternalTableIcon.vuedeleted file mode 100644index e3b6f2eeca..0000000000--- a/frontend/src/components/Icon/ExternalTableIcon.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <div class="relative">- <TablePropertiesIcon v-bind="$attrs" />- </div>-</template>-<script setup lang="ts">-import { TablePropertiesIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/ForeignKeyIcon.vue b/frontend/src/components/Icon/ForeignKeyIcon.vuedeleted file mode 100644index 9bdbc3caed..0000000000--- a/frontend/src/components/Icon/ForeignKeyIcon.vue+++ /dev/null@@ -1,9 +0,0 @@-<template>- <div class="relative">- <LinkIcon class="w-4 h-4" v-bind="$attrs" />- </div>-</template>--<script setup lang="ts">-import { LinkIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/FunctionIcon.vue b/frontend/src/components/Icon/FunctionIcon.vuedeleted file mode 100644index c547453e3f..0000000000--- a/frontend/src/components/Icon/FunctionIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <SquareFunctionIcon class="text-gray-400" />-</template>--<script setup lang="ts">-import { SquareFunctionIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/IndexIcon.vue b/frontend/src/components/Icon/IndexIcon.vuedeleted file mode 100644index 8069a3e25c..0000000000--- a/frontend/src/components/Icon/IndexIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <DiamondIcon class="w-3 h-3" />-</template>--<script setup lang="ts">-import { Diamond as DiamondIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/PackageIcon.vue b/frontend/src/components/Icon/PackageIcon.vuedeleted file mode 100644index af8c22a31a..0000000000--- a/frontend/src/components/Icon/PackageIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <PackageIcon class="text-gray-400" />-</template>--<script setup lang="ts">-import { PackageIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/PrimaryKeyIcon.vue b/frontend/src/components/Icon/PrimaryKeyIcon.vuedeleted file mode 100644index 1651ad42fe..0000000000--- a/frontend/src/components/Icon/PrimaryKeyIcon.vue+++ /dev/null@@ -1,9 +0,0 @@-<template>- <div class="relative overflow-hidden">- <KeyIcon class="w-full h-full mx-auto text-amber-500" />- </div>-</template>--<script setup lang="ts">-import { Key as KeyIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/ProcedureIcon.vue b/frontend/src/components/Icon/ProcedureIcon.vuedeleted file mode 100644index b9f87f2d4a..0000000000--- a/frontend/src/components/Icon/ProcedureIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <ParenthesesIcon class="text-gray-400" />-</template>--<script setup lang="ts">-import { ParenthesesIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/SchemaIcon.vue b/frontend/src/components/Icon/SchemaIcon.vuedeleted file mode 100644index 97b2209867..0000000000--- a/frontend/src/components/Icon/SchemaIcon.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <div class="relative">- <SchemaIcon v-bind="$attrs" />- </div>-</template>-<script setup lang="ts">-import { BoxIcon as SchemaIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/SequenceIcon.vue b/frontend/src/components/Icon/SequenceIcon.vuedeleted file mode 100644index d21bbd7b3e..0000000000--- a/frontend/src/components/Icon/SequenceIcon.vue+++ /dev/null@@ -1,9 +0,0 @@-<template>- <div class="relative w-4 h-4 inline-flex items-center justify-center">- <div- class="border-y border-current w-3.5 h-3 inline-flex items-center justify-center text-[7px] overflow-visible whitespace-nowrap font-semibold"- >- <span class="leading-3">123</span>- </div>- </div>-</template>diff --git a/frontend/src/components/Icon/SkipIcon.vue b/frontend/src/components/Icon/SkipIcon.vuedeleted file mode 100644index 5c9b0f63da..0000000000--- a/frontend/src/components/Icon/SkipIcon.vue+++ /dev/null@@ -1,14 +0,0 @@-<template>- <svg- xmlns="http://www.w3.org/2000/svg"- xmlns:xlink="http://www.w3.org/1999/xlink"- viewBox="0 0 24 24"- >- <g fill="none">- <path- d="M21.5 3.75a.75.75 0 0 0-1.5 0v3.4c-1.154-1.388-2.65-2.563-4.528-3.145a11.185 11.185 0 0 0-7.233.192c-2.316.862-4.504 2.61-5.646 4.693a.75.75 0 1 0 1.315.72c.944-1.722 2.825-3.252 4.854-4.007a9.685 9.685 0 0 1 6.266-.165c1.702.527 3.071 1.664 4.13 3.062H15.25a.75.75 0 0 0 0 1.5h5.5a.75.75 0 0 0 .75-.75v-5.5zM8 14a.5.5 0 0 0-.5.5v4a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 0-.5-.5H8zm-2 .5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4z"- fill="currentColor"- ></path>- </g>- </svg>-</template>diff --git a/frontend/src/components/Icon/TableIcon.vue b/frontend/src/components/Icon/TableIcon.vuedeleted file mode 100644index d81e64f405..0000000000--- a/frontend/src/components/Icon/TableIcon.vue+++ /dev/null@@ -1,8 +0,0 @@-<template>- <div class="relative">- <TableIcon v-bind="$attrs" />- </div>-</template>-<script setup lang="ts">-import { TableIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/TablePartitionIcon.vue b/frontend/src/components/Icon/TablePartitionIcon.vuedeleted file mode 100644index cb88e9b483..0000000000--- a/frontend/src/components/Icon/TablePartitionIcon.vue+++ /dev/null@@ -1,7 +0,0 @@-<template>- <TableRowsSplitIcon class="opacity-75" :stroke-width="1.75" />-</template>--<script setup lang="ts">-import { TableRowsSplitIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/TriggerIcon.vue b/frontend/src/components/Icon/TriggerIcon.vuedeleted file mode 100644index ee5fab7210..0000000000--- a/frontend/src/components/Icon/TriggerIcon.vue+++ /dev/null@@ -1,12 +0,0 @@-<template>- <div class="relative">- <ZapIcon class="text-amber-500" v-bind="$attrs" />- </div>-</template>-<script setup lang="ts">-import { ZapIcon } from "lucide-vue-next";--defineOptions({- inheritAttrs: false,-});-</script>diff --git a/frontend/src/components/Icon/ViewIcon.vue b/frontend/src/components/Icon/ViewIcon.vuedeleted file mode 100644index 21e8af4ca2..0000000000--- a/frontend/src/components/Icon/ViewIcon.vue+++ /dev/null@@ -1,14 +0,0 @@-<template>- <div class="relative">- <TableIcon v-bind="$attrs" class="text-gray-400" />- <GlassesIcon- class="absolute bottom-0 right-0 w-3/4 h-3/4"- stroke="rgb(var(--color-accent))"- fill="white"- :stroke-width="3.5"- />- </div>-</template>-<script setup lang="ts">-import { GlassesIcon, TableIcon } from "lucide-vue-next";-</script>diff --git a/frontend/src/components/Icon/index.ts b/frontend/src/components/Icon/index.tsdeleted file mode 100644index 51c6093663..0000000000--- a/frontend/src/components/Icon/index.ts+++ /dev/null@@ -1,39 +0,0 @@-import CheckIcon from "./CheckIcon.vue";-import ColumnIcon from "./ColumnIcon.vue";-import DatabaseIcon from "./DatabaseIcon.vue";-import EngineIcon from "./EngineIcon.vue";-import ExternalTableIcon from "./ExternalTableIcon.vue";-import ForeignKeyIcon from "./ForeignKeyIcon.vue";-import FunctionIcon from "./FunctionIcon.vue";-import IndexIcon from "./IndexIcon.vue";-import PackageIcon from "./PackageIcon.vue";-import PrimaryKeyIcon from "./PrimaryKeyIcon.vue";-import ProcedureIcon from "./ProcedureIcon.vue";-import SchemaIcon from "./SchemaIcon.vue";-import SequenceIcon from "./SequenceIcon.vue";-import SkipIcon from "./SkipIcon.vue";-import TableIcon from "./TableIcon.vue";-import TablePartitionIcon from "./TablePartitionIcon.vue";-import TriggerIcon from "./TriggerIcon.vue";-import ViewIcon from "./ViewIcon.vue";--export {- SkipIcon,- EngineIcon,- DatabaseIcon,- SchemaIcon,- TableIcon,- ExternalTableIcon,- ViewIcon,- ProcedureIcon,- FunctionIcon,- IndexIcon,- PrimaryKeyIcon,- ColumnIcon,- TablePartitionIcon,- ForeignKeyIcon,- PackageIcon,- SequenceIcon,- TriggerIcon,- CheckIcon,-};diff --git a/frontend/src/components/InputWithTemplate/AutoWidthInput.vue b/frontend/src/components/InputWithTemplate/AutoWidthInput.vuedeleted file mode 100644index ff3fd53e81..0000000000--- a/frontend/src/components/InputWithTemplate/AutoWidthInput.vue+++ /dev/null@@ -1,78 +0,0 @@-<template>- <div>- <div ref="divRef" class="fixed invisible text-base leading-6">- {{ state.data }}- </div>- <input- ref="inputRef"- v-model="state.data"- :style="`width: ${state.width}px;`"- :disabled="disabled"- class="px-0 m-0 py-1 bg-transparent shadow-none ring-0 border-0 border-none outline-hidden focus:shadow-none focus:ring-0 focus:border-0 focus:border-none"- type="text"- @keyup="(e) => $emit('keyup', e)"- @keydown="(e) => $emit('keydown', e)"- @mouseup="(e) => $emit('mouseup', e)"- />- </div>-</template>--<script lang="ts" setup>-import { nextTick, reactive, ref, watch, watchEffect } from "vue";--const props = defineProps({- value: {- default: "",- type: String,- },- maxWidth: {- default: 0,- type: Number,- },- disabled: {- type: Boolean,- default: false,- },-});--const minimumWidth = 1;--const emit = defineEmits<{- (event: "change", data: string): void;- (event: "keyup", e: KeyboardEvent): void;- (event: "keydown", e: KeyboardEvent): void;- (event: "mouseup", e: MouseEvent): void;-}>();--const state = reactive<{ data: string; width: number }>({- data: props.value,- width: 0,-});--const inputRef = ref<HTMLInputElement>();-const divRef = ref<HTMLDivElement>();--watch(- () => state.data,- (val) => {- nextTick(updateWidth);- emit("change", val);- }-);--watch(- () => props.value,- (val) => {- state.data = val;- nextTick(updateWidth);- }-);--const updateWidth = () => {- const width = divRef.value?.offsetWidth ?? state.width;- state.width = Math.min(props.maxWidth ?? width, width);- state.width = Math.max(state.width, minimumWidth);-};--watchEffect(updateWidth);-</script>diff --git a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue b/frontend/src/components/InputWithTemplate/InputWithTemplate.vuedeleted file mode 100644index 3102ed2f9c..0000000000--- a/frontend/src/components/InputWithTemplate/InputWithTemplate.vue+++ /dev/null@@ -1,334 +0,0 @@-<template>- <div class="border border-gray-300 rounded-sm">- <div class="flex flex-wrap gap-2 p-3 bg-gray-50 rounded-sm">- <div v-for="template in templateList" :key="template.id">- <NTooltip :disabled="!template.description">- <template #trigger>- <div- class="px-4 py-1 rounded-sm text-sm font-sm font-normal border border-gray-300 bg-gray-100 cursor-pointer hover:bg-gray-200"- @click="() => onTemplateAdd(template)"- >- {{ template.id }}- </div>- </template>- <span v-if="template.description" class="whitespace-nowrap">- {{ $t(template.description) }}- </span>- </NTooltip>- </div>- </div>- <div class="p-2 border-t border-gray-300">- <div ref="containerRef" class="flex flex-wrap items-center gap-1">- <div- v-for="(data, i) in state.templateInputs"- :key="i"- :ref="(el) => (itemRefs[i] = el as HTMLElement)"- >- <NTag- v-if="data.type == 'template'"- :closable="!disabled"- @close="() => onTemplateRemove(i)"- >- {{ data.value }}- </NTag>- <AutoWidthInput- v-else- :value="data.value"- :max-width="state.inputMaxWidth"- :disabled="disabled"- @keyup="(e) => onKeyup(i, e)"- @keydown="onKeydown(i, itemRefs[i].querySelector('input'))"- @mouseup="onKeydown(i, itemRefs[i].querySelector('input'))"- @change="(val) => onTemplateChange(i, val)"- />- </div>- <input- ref="inputRef"- v-model="state.inputData"- class="flex-1 px-0 m-0 py-1 bg-transparent shadow-none ring-0 border-0 border-none outline-hidden focus:shadow-none focus:ring-0 focus:border-0 focus:border-none"- type="text"- :disabled="disabled"- @keydown.delete="onInputDataDeleteEnter"- @keyup.delete="onInputDataDeleteLeave"- @keydown="onKeydown(state.templateInputs.length, inputRef)"- @mouseup="onKeydown(state.templateInputs.length, inputRef)"- @keyup.left="(e) => onKeyup(state.templateInputs.length, e)"- />- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { NTag, NTooltip } from "naive-ui";-import type { PropType } from "vue";-import { onMounted, onUnmounted, reactive, ref, watch, watchEffect } from "vue";-import AutoWidthInput from "./AutoWidthInput.vue";-import type { Template, TemplateInput } from "./types";-import { InputType } from "./types";-import { getTemplateInputs, KEY_EVENT, templateInputsToString } from "./utils";--interface LocalState {- inputData: string;- inputMaxWidth: number;- templateInputs: TemplateInput[];- inputCursorPosition: Map<number, number>;-}--const props = defineProps({- value: {- default: "",- type: String,- },- templateList: {- require: true,- default: () => [],- type: Array as PropType<Template[]>,- },- disabled: {- type: Boolean,- default: false,- },-});--const emit = defineEmits(["change"]);--const templateInputs = getTemplateInputs(props.value, props.templateList);-let inputData = "";--if (- templateInputs.length > 0 &&- templateInputs[templateInputs.length - 1].type === InputType.String-) {- inputData = templateInputs.pop()?.value ?? inputData;-}--const state = reactive<LocalState>({- inputData,- inputMaxWidth: 0,- templateInputs,- inputCursorPosition: new Map<number, number>(),-});--watch(- () => state.templateInputs,- (val) => {- emit("change", `${templateInputsToString(val)}${state.inputData}`);- },- { deep: true }-);--watch(- () => state.inputData,- (val) => {- emit("change", `${templateInputsToString(state.templateInputs)}${val}`);- }-);--const itemRefs = ref<HTMLElement[]>([]);-const containerRef = ref<HTMLDivElement>();-const inputRef = ref<HTMLInputElement>();--watchEffect(() => {- if (containerRef.value) {- state.inputMaxWidth = containerRef.value.offsetWidth;- }-});--const onWindowResize = () => {- if (containerRef.value) {- state.inputMaxWidth = containerRef.value.offsetWidth;- }-};--const onInputDataDeleteEnter = () => {- if (!state.inputData && state.templateInputs.length > 0) {- const last = state.templateInputs.slice(-1)[0];- if (last.type === InputType.Template) {- state.templateInputs.pop();- }- }-};--const onInputDataDeleteLeave = () => {- if (!state.inputData && state.templateInputs.length > 0) {- const last = state.templateInputs.slice(-1)[0];- if (last && last.type === InputType.String) {- state.inputData = state.templateInputs.pop()?.value ?? state.inputData;- }- }-};--// Store the cursor position in key down event.-const onKeydown = (i: number, input: HTMLInputElement | null | undefined) => {- const selectionEnd = input?.selectionEnd;- if (!Number.isNaN(selectionEnd)) {- state.inputCursorPosition.set(i, selectionEnd!);- }-};--const onKeyup = (i: number, e: KeyboardEvent) => {- switch (e.key) {- case KEY_EVENT.BACKSPACE:- case KEY_EVENT.DELETE:- if (state.templateInputs[i].value === "") {- if (i === 0 || state.inputCursorPosition.get(i) === 0) {- // remove the empty data- onTemplateRemove(i);- if (- i - 1 >= 0 &&- state.templateInputs[i - 1].type === InputType.Template- ) {- // remove the previous data (should be the template type)- onTemplateRemove(i - 1);- }- // try to focus the input from i-1 index- focusPreInput(i - 1);- }- }- break;- case KEY_EVENT.LEFT: {- const left = state.inputCursorPosition.get(i);- // if the cursor is at the first position, we try to focus on the previous input.- if (left === 0) {- focusPreInput(i - 1);- state.inputCursorPosition.delete(i);- }- break;- }- case KEY_EVENT.RIGHT: {- const right = state.inputCursorPosition.get(i);- // if the cursor is at the last position, we try to focus on the next input.- if (right === state.templateInputs[i].value.length) {- focusNextInput(i + 1);- state.inputCursorPosition.delete(i);- }- break;- }- }-};--const focusNextInput = (i: number) => {- let j = i;- while (j <= state.templateInputs.length - 1) {- const input = state.templateInputs[j];- if (input && input.type === InputType.String) {- // make sure the next input will be focused on the first position.- itemRefs.value[j].querySelector("input")?.setSelectionRange(0, 0);- itemRefs.value[j].querySelector("input")?.focus();- break;- }- j++;- }- if (j === state.templateInputs.length) {- inputRef.value?.setSelectionRange(0, 0);- inputRef.value?.focus();- }-};--const focusPreInput = (i: number) => {- let j = i;- while (j >= 0) {- const input = state.templateInputs[j];- if (input && input.type === InputType.String) {- // make sure the next input will be focused on the last position.- itemRefs.value[j]- .querySelector("input")- ?.setSelectionRange(input.value.length, input.value.length);- itemRefs.value[j].querySelector("input")?.focus();- break;- }- j--;- }-};--const onTemplateChange = (i: number, data: string) => {- const target = state.templateInputs[i];- if (!target) {- return;- }-- state.templateInputs = [- ...state.templateInputs.slice(0, i),- {- value: data,- type: target.type,- },- ...state.templateInputs.slice(i + 1),- ];-};--const onTemplateAdd = (template: Template) => {- // clear position cache.- state.inputCursorPosition = new Map<number, number>();-- if (state.inputData) {- // If the last input contains user's input, we also need to add it- state.templateInputs.push({- value: state.inputData,- type: InputType.String,- });- }-- state.templateInputs.push({- value: template.id,- type: InputType.Template,- });-- state.inputData = "";- inputRef.value?.focus();-};--const onTemplateRemove = (i: number) => {- if (i < 0 || i >= state.templateInputs.length) {- return;- }-- // clear position cache.- state.inputCursorPosition = new Map<number, number>();-- state.templateInputs = [- ...state.templateInputs.slice(0, i),- ...state.templateInputs.slice(i + 1),- ];-- if (state.templateInputs.length === 0) {- return;- }-- const index = i - 1;- if (index < 0 || index >= state.templateInputs.length) {- return;- }-- const template = state.templateInputs[index];- if (template.type !== InputType.String) {- return;- }-- if (i === state.templateInputs.length) {- // If the last value is string, we need to extract it into the last input.- state.inputData = `${state.templateInputs.pop()?.value ?? ""}${- state.inputData- }`;- } else if (state.templateInputs[i].type === InputType.String) {- // Join the adjacent string value- state.templateInputs = [- ...state.templateInputs.slice(0, index),- {- value: `${template.value}${state.templateInputs[i].value}`,- type: InputType.String,- },- ...state.templateInputs.slice(i + 1),- ];- }-};--onMounted(() => {- window.addEventListener("resize", onWindowResize);-});--onUnmounted(() => {- window.removeEventListener("resize", onWindowResize);-});-</script>diff --git a/frontend/src/components/InputWithTemplate/index.ts b/frontend/src/components/InputWithTemplate/index.tsdeleted file mode 100644index e2a8dd824c..0000000000--- a/frontend/src/components/InputWithTemplate/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import InputWithTemplate from "./InputWithTemplate.vue";--export { InputWithTemplate };-export * from "./types";diff --git a/frontend/src/components/InputWithTemplate/types.ts b/frontend/src/components/InputWithTemplate/types.tsdeleted file mode 100644index 04d00a9bb2..0000000000--- a/frontend/src/components/InputWithTemplate/types.ts+++ /dev/null@@ -1,14 +0,0 @@-export interface Template {- id: string;- description?: string;-}--export enum InputType {- String = "string",- Template = "template",-}--export interface TemplateInput {- value: string;- type: InputType;-}diff --git a/frontend/src/components/InputWithTemplate/utils.ts b/frontend/src/components/InputWithTemplate/utils.tsdeleted file mode 100644index 642022ca39..0000000000--- a/frontend/src/components/InputWithTemplate/utils.ts+++ /dev/null@@ -1,108 +0,0 @@-import type { Template, TemplateInput } from "./types";-import { InputType } from "./types";--const TEMPLATE_BRACKET_LEFT = "{{";-const TEMPLATE_BRACKET_RIGHT = "}}";--// getTemplateInputs will convert the string value into TemplateInput array.-// For example:-// "abc{{template}}" -> [{value: "abc", type: "string"}, {value: "template", type: "template"}]-// "abc{{not_template}}{{template}}" -> [{value: "abc{{not_template}}", type: "string"}, {value: "template", type: "template"}]-// "abc{{not_template}}{{template}}}}" -> [{value: "abc{{not_template}}", type: "string"}, {value: "template", type: "template"}, {value: "}}", type: "string"}]-// "{{abc{{}}{{template}}}}" -> [{value: "{{abc{{}}", type: "string"}, {value: "template", type: "template"}, {value: "}}", type: "string"}]-export const getTemplateInputs = (- value: string,- templateList: Template[]-): TemplateInput[] => {- let start = 0;- let end = 0;- const res: TemplateInput[] = [];- const templateSet = new Set<string>(templateList.map((t) => t.id));-- while (end <= value.length - 1) {- if (- value.slice(end, end + 2) === TEMPLATE_BRACKET_RIGHT &&- value.slice(start, start + 2) === TEMPLATE_BRACKET_LEFT- ) {- // When the end pointer meet the "}}" and the start pointer is "{{"- // we can extract the string slice as template or normal string.- const str = value.slice(start + 2, end);- if (templateSet.has(str)) {- res.push({- value: str,- type: InputType.Template,- });- } else {- res.push({- value: `${TEMPLATE_BRACKET_LEFT}${str}${TEMPLATE_BRACKET_RIGHT}`,- type: InputType.String,- });- }- end += 2;- start = end;- } else if (value.slice(end, end + 2) === TEMPLATE_BRACKET_LEFT) {- // When the end pointer meet the "{{"- // we should reset the position of the start pointer.- res.push({- value: value.slice(start, end),- type: InputType.String,- });- start = end;- end += 2;- } else {- end += 1;- }- }-- if (start < end) {- res.push({- value: value.slice(start, end),- type: InputType.String,- });- }-- // Join the adjacent string value- return res.reduce((result, data) => {- if (data.type === InputType.Template) {- return [...result, data];- }-- let str = data.value;-- if (- result.length > 0 &&- result[result.length - 1].type === InputType.String- ) {- str = `${result.pop()?.value ?? ""}${str}`;- }-- return [- ...result,- {- value: str,- type: InputType.String,- },- ];- }, [] as TemplateInput[]);-};--// templateInputsToString will convert TemplateInput array into string-// For example:-// [{value: "abc", type: "string"}, {value: "template", type: "template"}] -> "abc{{template}}"-export const templateInputsToString = (inputs: TemplateInput[]): string => {- return inputs- .filter((input) => input.value)- .map((input) =>- input.type === InputType.String- ? input.value- : `${TEMPLATE_BRACKET_LEFT}${input.value}${TEMPLATE_BRACKET_RIGHT}`- )- .join("");-};--export const KEY_EVENT = {- LEFT: "ArrowLeft",- RIGHT: "ArrowRight",- DELETE: "Delete",- BACKSPACE: "Backspace",-};diff --git a/frontend/src/components/Member/MemberDataTable/cells/RoleCell.vue b/frontend/src/components/Member/MemberDataTable/cells/RoleCell.vuedeleted file mode 100644index d8730343ac..0000000000--- a/frontend/src/components/Member/MemberDataTable/cells/RoleCell.vue+++ /dev/null@@ -1,54 +0,0 @@-<template>- <component- :is="hasRolePermission ? 'router-link' : 'div'"- :to="{- name: WORKSPACE_ROUTE_ROLES,- query: {- role: binding.role,- },- }"- >- <NTag- :bordered="bordered"- :class="isBindingPolicyExpired(binding) ? 'line-through' : ''"- style="background-color: transparent !important;"- >- <div class="flex items-center gap-x-1 cursor-pointer">- <NTooltip v-if="scope === 'workspace'">- <template #trigger>- <Building2Icon class="w-4 h-auto mr-1" />- </template>- {{ $t("project.members.workspace-level-roles") }}- </NTooltip>- {{ displayRoleTitle(binding.role) }}- <span v-if="count !== undefined" class="font-normal text-control-light">- ({{ count }})- </span>- </div>- </NTag>- </component>-</template>--<script lang="tsx" setup>-import { Building2Icon } from "lucide-vue-next";-import { NTag, NTooltip } from "naive-ui";-import { computed } from "vue";-import { WORKSPACE_ROUTE_ROLES } from "@/router/dashboard/workspaceRoutes";-import type { Binding } from "@/types/proto-es/v1/iam_policy_pb";-import {- displayRoleTitle,- hasWorkspacePermissionV2,- isBindingPolicyExpired,-} from "@/utils";--defineProps<{- binding: Binding;- scope: "workspace" | "project";- count?: number;- bordered: boolean;-}>();--const hasRolePermission = computed(() =>- hasWorkspacePermissionV2("bb.roles.list")-);-</script>\ No newline at end of filediff --git a/frontend/src/components/Member/MemberDataTable/cells/UserRolesCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserRolesCell.vuedeleted file mode 100644index c933b270af..0000000000--- a/frontend/src/components/Member/MemberDataTable/cells/UserRolesCell.vue+++ /dev/null@@ -1,39 +0,0 @@-<template>- <div class="flex flex-row items-center flex-wrap gap-1">- <RoleCell- v-for="r in workspaceLevelRoles"- :key="r"- :binding="create(BindingSchema, {- role: r,- })"- :bordered="true"- :scope="'workspace'"- />- <RoleCell- v-for="(binding, index) in projectRoleBindings"- :key="getProjectRoleBindingKey(binding, index)"- :bordered="true"- :binding="binding" :scope="'project'"- />- </div>-</template>--<script lang="ts" setup>-import { create } from "@bufbuild/protobuf";-import { computed } from "vue";-import { BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";-import { sortRoles } from "@/utils";-import { getProjectRoleBindingKey } from "../../projectRoleBindings";-import type { MemberRole } from "../../types";-import RoleCell from "./RoleCell.vue";--const props = defineProps<{- role: MemberRole;-}>();--const workspaceLevelRoles = computed(() => {- return sortRoles([...props.role.workspaceLevelRoles]);-});--const projectRoleBindings = computed(() => props.role.projectRoleBindings);-</script>diff --git a/frontend/src/components/MonacoEditor/DiffEditor.vue b/frontend/src/components/MonacoEditor/DiffEditor.vuedeleted file mode 100644index e04924b0c9..0000000000--- a/frontend/src/components/MonacoEditor/DiffEditor.vue+++ /dev/null@@ -1,187 +0,0 @@-<template>- <div ref="containerRef" class="relative bb-monaco-diff-editor">- <div- v-if="!isEditorLoaded"- class="absolute inset-0 flex flex-col items-center justify-center"- >- <BBSpin />- </div>- </div>-</template>--<script lang="ts" setup>-import * as monaco from "monaco-editor";-import { v4 as uuidv4 } from "uuid";-import {- computed,- nextTick,- onBeforeUnmount,- onMounted,- ref,- shallowRef,- toRef,- watch,-} from "vue";-import { BBSpin } from "@/bbkit";-import type { Language } from "@/types";-import type { AutoHeightOptions } from "./composables";-import { useAutoHeight, useOptionByKey, useOptions } from "./composables";-import { createMonacoDiffEditor } from "./editor";-import { useMonacoTextModel } from "./text-model";-import type {- IStandaloneDiffEditor,- IStandaloneDiffEditorConstructionOptions,- MonacoModule,-} from "./types";-import { extensionNameOfLanguage } from "./utils";--export type DiffEditorAutoHeightOptions = AutoHeightOptions & {- alignment: "original" | "modified";-};--const props = withDefaults(- defineProps<{- original?: string;- modified?: string;- language?: Language;- readonly?: boolean;- options?: IStandaloneDiffEditorConstructionOptions;- autoHeight?: DiffEditorAutoHeightOptions;- }>(),- {- original: "",- modified: "",- language: "sql",- readonly: false,- options: undefined,- autoHeight: undefined,- }-);--const emit = defineEmits<{- (e: "update:modified", modified: string): void;- (e: "ready", monaco: MonacoModule, editor: IStandaloneDiffEditor): void;-}>();--const containerRef = ref<HTMLDivElement>();-// use shallowRef to avoid deep conversion which will cause page crash.-const editorRef = shallowRef<IStandaloneDiffEditor>();-const disposed = ref(false);--const isEditorLoaded = ref(false);--const useDiffModels = (monaco: MonacoModule, editor: IStandaloneDiffEditor) => {- const language = toRef(props, "language");- const original = useMonacoTextModel(- computed(() => `${uuidv4()}.${extensionNameOfLanguage(props.language)}`),- toRef(props, "original"),- language- );- const modified = useMonacoTextModel(- computed(() => `${uuidv4()}.${extensionNameOfLanguage(props.language)}`),- toRef(props, "modified"),- language- );-- watch(- [original, modified, disposed],- ([original, modified, disposed]) => {- if (disposed) return;- if (!original) return;- if (!modified) return;- editor.setModel({- original: original,- modified: modified,- });- },- {- immediate: true,- }- );-};--const useModifiedContent = (- monaco: MonacoModule,- editor: IStandaloneDiffEditor-) => {- const modified = ref(getModifiedContent(editor));- const update = () => {- modified.value = getModifiedContent(editor);- };-- editor.onDidChangeModel(update);- editor.onDidUpdateDiff(update);-- return modified;-};--const getModifiedContent = (editor: IStandaloneDiffEditor) => {- const model = editor.getModel();- if (!model) return "";-- return model.modified.getValue();-};--onMounted(async () => {- const container = containerRef.value;- if (!container) {- // Give up creating monaco editor if the component has been unmounted- // very quickly.- console.debug(- "<MonacoEditor> has been unmounted before monaco-editor initialized"- );- return;- }-- const editor = await createMonacoDiffEditor({ container });- useDiffModels(monaco, editor);- // Use "plugin" composable features- useOptionByKey(monaco, editor, "readOnly", toRef(props, "readonly"));- useOptions(monaco, editor, toRef(props, "options"));- const modifiedContent = useModifiedContent(monaco, editor);- if (props.autoHeight) {- useAutoHeight(- monaco,- props.autoHeight.alignment === "original"- ? editor.getOriginalEditor()- : editor.getModifiedEditor(),- containerRef,- toRef(props, "autoHeight")- );- }-- editorRef.value = editor;- isEditorLoaded.value = true;-- await nextTick();- nextTick(() => {- emit("ready", monaco, editor);- });- watch(modifiedContent, () => {- emit("update:modified", modifiedContent.value);- });-});--onBeforeUnmount(() => {- disposed.value = true;- editorRef.value?.dispose();-});--defineExpose({- get editor() {- return editorRef.value;- },-});-</script>--<style lang="postcss" scoped>-.bb-monaco-diff-editor :deep(.monaco-editor .monaco-mouse-cursor-text) {- box-shadow: none !important;-}-.bb-monaco-diff-editor :deep(.monaco-editor .scroll-decoration) {- display: none !important;-}-.bb-monaco-diff-editor :deep(.monaco-editor .line-numbers) {- padding-right: 0.5rem;-}-</style>diff --git a/frontend/src/components/MonacoEditor/MonacoEditor.vue b/frontend/src/components/MonacoEditor/MonacoEditor.vuedeleted file mode 100644index aa654a2524..0000000000--- a/frontend/src/components/MonacoEditor/MonacoEditor.vue+++ /dev/null@@ -1,76 +0,0 @@-<template>- <MonacoTextModelEditor- ref="textModelEditorRef"- class="bb-monaco-editor"- :model="model"- @update:content="handleContentChange"- @update:selection="emit('update:selection', $event)"- @update:active-content="(c) => (activeContent = c)"- >- <template v-if="$slots['corner-prefix']" #corner-prefix>- <slot name="corner-prefix" />- </template>- <template v-if="$slots['corner-suffix']" #corner-suffix>- <slot name="corner-suffix" />- </template>- </MonacoTextModelEditor>-</template>--<script setup lang="ts">-import { v4 as uuidv4 } from "uuid";-import { computed, ref, toRef } from "vue";-import MonacoTextModelEditor from "./MonacoTextModelEditor.vue";-import { useMonacoTextModel } from "./text-model";-import type { MonacoEditorEmits, MonacoEditorProps } from "./types";-import { extensionNameOfLanguage } from "./utils";--const textModelEditorRef = ref<InstanceType<typeof MonacoTextModelEditor>>();--const props = withDefaults(defineProps<MonacoEditorProps>(), {- filename: undefined,- language: "sql",-});-const emit = defineEmits<MonacoEditorEmits>();--const content = computed({- get() {- return props.content;- },- set(content) {- emit("update:content", content);- },-});--const activeContent = ref<string>("");--const handleContentChange = (value: string) => {- content.value = value;-};--const filename = computed(() => {- if (props.filename) return props.filename;-- return `${uuidv4()}.${extensionNameOfLanguage(props.language)}`;-});--const model = useMonacoTextModel(filename, content, toRef(props, "language"));--defineExpose({- get editor() {- return textModelEditorRef.value;- },- getActiveStatement: () => activeContent.value,-});-</script>--<style lang="postcss" scoped>-.bb-monaco-editor :deep(.monaco-editor .monaco-mouse-cursor-text) {- box-shadow: none !important;-}-.bb-monaco-editor :deep(.monaco-editor .scroll-decoration) {- display: none !important;-}-.bb-monaco-editor :deep(.monaco-editor .line-numbers) {- padding-right: 0.5rem;-}-</style>diff --git a/frontend/src/components/MonacoEditor/MonacoTextModelEditor.vue b/frontend/src/components/MonacoEditor/MonacoTextModelEditor.vuedeleted file mode 100644index ce98f747b3..0000000000--- a/frontend/src/components/MonacoEditor/MonacoTextModelEditor.vue+++ /dev/null@@ -1,320 +0,0 @@-<template>- <div ref="containerRef" v-bind="$attrs" class="relative bb-monaco-editor">- <div- v-if="!ready"- class="absolute inset-0 flex flex-col items-center justify-center"- >- <BBSpin />- </div>- <div- v-if="ready && !contentRef && placeholder"- class="bb-monaco-editor--placeholder absolute pointer-events-none font-mono text-control-placeholder"- >- {{ placeholder }}- </div>-- <div- class="absolute top-[3px] right-[18px] flex gap-1 items-center justify-end z-30"- >- <slot name="corner-prefix" />-- <NPopover v-if="ready && !readonly" placement="bottom-end">- <template #trigger>- <div- class="w-4 h-4 flex justify-center items-center cursor-pointer opacity-50 hover:opacity-100 transition-all"- >- <div- class="w-3 h-3 rounded-full"- :class="connectionStateIndicatorClass"- />- </div>- </template>- <template #default>- <div class="flex flex-col gap-1">- <div class="inline-flex gap-1">- <span>Language server</span>- <span>{{ connectionStateText }}</span>- </div>- <div- v-if="connectionHeartbeatText"- class="text-xs text-control-placeholder"- >- {{ connectionHeartbeatText }}- </div>- </div>- </template>- </NPopover>-- <slot name="corner-suffix" />- </div>- </div>-</template>--<script lang="ts" setup>-import { throttle } from "lodash-es";-import * as monaco from "monaco-editor";-import { NPopover } from "naive-ui";-import {- computed,- nextTick,- onBeforeUnmount,- onMounted,- ref,- shallowRef,- toRef,- watch,-} from "vue";-import { BBSpin } from "@/bbkit";-import type { SQLDialect } from "@/types";-import { formatAbsoluteDateTime } from "@/utils";-import {- type AutoCompleteContext,- type AutoHeightOptions,- type FormatContentOptions,- useActiveRangeByCursor,- useAdvices,- useAutoComplete,- useAutoHeight,- useContent,- useDecoration,- useFormatContent,- useLineHighlights,- useLSPConnectionState,- useModel,- useOptionByKey,- useOptions,- useOverrideSuggestIcons,- useSelectedContent,- useSelection,-} from "./composables";-import { createMonacoEditor } from "./editor";-import type {- AdviceOption,- IStandaloneCodeEditor,- IStandaloneEditorConstructionOptions,- ITextModel,- LineHighlightOption,- MonacoModule,- Selection as MonacoSelection,-} from "./types";--const props = withDefaults(- defineProps<{- enableDecorations?: boolean;- model?: ITextModel;- dialect?: SQLDialect;- readonly?: boolean;- autoFocus?: boolean;- autoHeight?: AutoHeightOptions;- autoCompleteContext?: AutoCompleteContext;- advices?: AdviceOption[];- lineHighlights?: LineHighlightOption[];- options?: IStandaloneEditorConstructionOptions;- formatContentOptions?: FormatContentOptions;- placeholder?: string;- }>(),- {- dialect: undefined,- readonly: false,- autoFocus: true,- autoHeight: undefined,- autoCompleteContext: undefined,- advices: () => [],- lineHighlights: () => [],- options: undefined,- formatContentOptions: undefined,- placeholder: undefined,- }-);--const emit = defineEmits<{- (e: "update:content", content: string): void;- (e: "update:active-content", activeContent: string): void;- (e: "select-content", content: string): void;- (e: "update:selection", selection: MonacoSelection | null): void;- (e: "ready", monaco: MonacoModule, editor: IStandaloneCodeEditor): void;-}>();--const containerRef = ref<HTMLDivElement>();-// use shallowRef to avoid deep conversion which will cause page crash.-const editorRef = shallowRef<IStandaloneCodeEditor>();-const ready = ref(false);-const contentRef = ref("");-const activeContent = ref("");-const { connectionState, connectionHeartbeat } = useLSPConnectionState();-const connectionStateIndicatorClass = computed(() => {- const state = connectionState.value;- if (state === "ready") {- return "bg-green-500";- }- if (state === "initial" || state === "reconnecting") {- return "bg-yellow-500";- }- return "bg-gray-500";-});-const connectionStateText = computed(() => {- const state = connectionState.value;- if (state === "ready") {- return "connected";- }- if (state === "initial" || state === "reconnecting") {- return "connecting";- }- return "disconnected";-});-const connectionHeartbeatText = computed(() => {- if (connectionState.value !== "ready") return "";- const timestamp = connectionHeartbeat.value?.timestamp;- if (!timestamp) return "";- const time = formatAbsoluteDateTime(timestamp);- return `Last heartbeat at ${time}`;-});--onMounted(async () => {- const container = containerRef.value;- if (!container) {- // Give up creating monaco editor if the component has been unmounted- // very quickly.- console.debug(- "<MonacoEditor> has been unmounted before monaco-editor initialized"- );- return;- }-- try {- const editor = await createMonacoEditor({- container,- options: {- readOnly: props.readonly,- ...props.options,- },- });-- editorRef.value = editor;-- // Use "plugin" composable features- useOptionByKey(monaco, editor, "readOnly", toRef(props, "readonly"));- useOptions(monaco, editor, toRef(props, "options"));- useModel(monaco, editor, toRef(props, "model"));- useFormatContent(- monaco,- editor,- toRef(props, "dialect"),- toRef(props, "formatContentOptions")- );- const content = useContent(monaco, editor);- const selection = useSelection(editor);- const selectedContent = useSelectedContent(editor, selection);- const activeRangeByCursor = useActiveRangeByCursor(editor);- useAdvices(monaco, editor, toRef(props, "advices"));- useLineHighlights(monaco, editor, toRef(props, "lineHighlights"));- useAutoHeight(monaco, editor, containerRef, toRef(props, "autoHeight"));- useAutoComplete(- monaco,- editor,- toRef(props, "autoCompleteContext"),- toRef(props, "readonly")- );- useOverrideSuggestIcons(monaco, editor);-- ready.value = true;-- await nextTick();- emit("ready", monaco, editor);-- if (!props.readonly && props.enableDecorations) {- useDecoration(monaco, editor, selection, activeRangeByCursor);- }-- // set the editor focus when the tab is selected- if (!props.readonly && props.autoFocus) {- editor.focus();- }-- contentRef.value = content.value;-- // Combine content watcher with ref update- watch(content, () => {- contentRef.value = content.value;- emit("update:content", content.value);- });-- // Throttle the selection/activeRange processing to reduce overhead- const throttledSelectionHandler = throttle(- ([newSelection, newActiveRangeByCursor]: [- monaco.Selection | null,- monaco.IRange | undefined,- ]) => {- // Emit selection update- emit("update:selection", newSelection);-- // Calculate active content- const hasSelection =- newSelection &&- (newSelection.startLineNumber !== newSelection.endLineNumber ||- newSelection.startColumn !== newSelection.endColumn);- const activeRange = hasSelection- ? newSelection- : newActiveRangeByCursor;- activeContent.value = activeRange- ? props.model?.getValueInRange(activeRange) || ""- : "";- emit("update:active-content", activeContent.value);- },- 100, // 100ms throttle for selection updates- { leading: true, trailing: true }- );-- // Combine selection and activeRange watchers to avoid duplicate processing- watch(- [() => selection.value, () => activeRangeByCursor.value],- throttledSelectionHandler- );-- // Keep selectedContent watcher separate as it has different trigger conditions- watch(- () => selectedContent.value,- () => {- emit("select-content", selectedContent.value);- }- );- } catch (ex) {- console.error("[MonacoEditor] initialize failed", ex);- }-});--onBeforeUnmount(() => {- editorRef.value?.dispose();-});--defineExpose({- get codeEditor() {- return editorRef.value;- },-});-</script>--<style>-.editor-widget.suggest-widget .signature-label {- margin-left: 0.5rem;-}-</style>--<style scoped>-.bb-monaco-editor .bb-monaco-editor--placeholder {- font-family: "Droid Sans Mono", monospace;- font-size: 14px;- left: 52px;- top: 8px;-}-.bb-monaco-editor :deep(.monaco-editor .peekview-title .filename) {- display: none !important;-}-.bb-monaco-editor :deep(.monaco-editor .peekview-title .dirname) {- margin-left: 0 !important;-}-.bb-monaco-editor :deep(.monaco-editor) {- outline: none !important;- box-shadow: none !important;-}-</style>diff --git a/frontend/src/components/MonacoEditor/WrappedDiffEditor.vue b/frontend/src/components/MonacoEditor/WrappedDiffEditor.vuedeleted file mode 100644index 8222e79d76..0000000000--- a/frontend/src/components/MonacoEditor/WrappedDiffEditor.vue+++ /dev/null@@ -1,52 +0,0 @@-<template>- <Suspense>- <DiffEditor ref="diffEditorRef" v-bind="$attrs" />- <template #fallback>- <div ref="spinnerWrapperElRef" :class="classes">- <BBSpin />- </div>- </template>- </Suspense>-</template>--<script setup lang="ts">-import { useParentElement } from "@vueuse/core";-import { computed, defineAsyncComponent, ref } from "vue";-import { BBSpin } from "@/bbkit";--const DiffEditor = defineAsyncComponent(() => import("./DiffEditor.vue"));--const diffEditorRef = ref<InstanceType<typeof DiffEditor>>();-const spinnerWrapperElRef = ref<HTMLElement>();-const parentElRef = useParentElement(spinnerWrapperElRef);--const classes = computed(() => {- const classes: string[] = [- "flex",- "flex-col",- "items-center",- "justify-center",- ];- const parent = parentElRef.value;- if (parent) {- const { position, display } = getComputedStyle(parent);- if (["relative", "absolute", "fixed"].includes(position)) {- classes.push("absolute", "inset-0", "bg-white/50");- return classes;- }- if (["flex", "inline-flex"].includes(display)) {- classes.push("w-full", "h-full", "flex-1");- return classes;- }- }-- classes.push("w-full", "h-full");- return classes;-});--defineExpose({- get diffEditor() {- return diffEditorRef.value;- },-});-</script>diff --git a/frontend/src/components/MonacoEditor/WrappedMonacoEditor.vue b/frontend/src/components/MonacoEditor/WrappedMonacoEditor.vuedeleted file mode 100644index 7a79a834d6..0000000000--- a/frontend/src/components/MonacoEditor/WrappedMonacoEditor.vue+++ /dev/null@@ -1,60 +0,0 @@-<template>- <Suspense>- <MonacoEditor ref="monacoEditorRef" v-bind="typedAttrs" />- <template #fallback>- <div ref="spinnerWrapperElRef" :class="classes">- <BBSpin />- </div>- </template>- </Suspense>-</template>--<script setup lang="ts">-import { useParentElement } from "@vueuse/core";-import { computed, defineAsyncComponent, ref, useAttrs } from "vue";-import { BBSpin } from "@/bbkit";-import type { MonacoEditorEmits, MonacoEditorProps } from "./types";--type MonacoEditorAttrs = MonacoEditorProps &- MonacoEditorEmits &- Record<string, unknown>;--const MonacoEditor = defineAsyncComponent(() => import("./MonacoEditor.vue"));--const spinnerWrapperElRef = ref<HTMLElement>();-const parentElRef = useParentElement(spinnerWrapperElRef);-const monacoEditorRef = ref<InstanceType<typeof MonacoEditor>>();--const attrs = useAttrs();-const typedAttrs = computed(() => attrs as MonacoEditorAttrs);--const classes = computed(() => {- const classes: string[] = [- "flex",- "flex-col",- "items-center",- "justify-center",- ];- const parent = parentElRef.value;- if (parent) {- const { position, display } = getComputedStyle(parent);- if (["relative", "absolute", "fixed"].includes(position)) {- classes.push("absolute", "inset-0", "bg-white/50");- return classes;- }- if (["flex", "inline-flex"].includes(display)) {- classes.push("w-full", "h-full", "flex-1");- return classes;- }- }-- classes.push("w-full", "h-full");- return classes;-});--defineExpose({- get monacoEditor() {- return monacoEditorRef.value;- },-});-</script>diff --git a/frontend/src/components/MonacoEditor/composables/common.ts b/frontend/src/components/MonacoEditor/composables/common.tsdeleted file mode 100644index ad921de783..0000000000--- a/frontend/src/components/MonacoEditor/composables/common.ts+++ /dev/null@@ -1,33 +0,0 @@-import * as monaco from "monaco-editor";-import { ref } from "vue";-import type { Language } from "@/types";-import { SupportedLanguages } from "../types";--export type EditorType =- | monaco.editor.IStandaloneCodeEditor- | monaco.editor.IStandaloneDiffEditor;--export const useTextModelLanguage = (- editor: monaco.editor.IStandaloneCodeEditor-) => {- const language = ref(normalizeLanguage(editor.getModel()?.getLanguageId()));-- editor.onDidChangeModel(() => {- language.value = normalizeLanguage(editor.getModel()?.getLanguageId());- });- editor.onDidChangeModelLanguage((e) => {- language.value = normalizeLanguage(e.newLanguage);- });-- return language;-};--const normalizeLanguage = (lang: string | undefined) => {- if (!lang) return undefined;- if (- SupportedLanguages.findIndex((definition) => definition.id === lang) >= 0- ) {- return lang as Language;- }- return undefined;-};diff --git a/frontend/src/components/MonacoEditor/composables/index.ts b/frontend/src/components/MonacoEditor/composables/index.tsdeleted file mode 100644index a62bc8e160..0000000000--- a/frontend/src/components/MonacoEditor/composables/index.ts+++ /dev/null@@ -1,14 +0,0 @@-export * from "./useOptions";-export * from "./useModel";-export * from "./useContent";-export * from "./useSelectedContent";-export * from "./useSelection";-export * from "./useFormatContent";-export * from "./useAdvices";-export * from "./useLineHighlights";-export * from "./useAutoHeight";-export * from "./useAutoComplete";-export * from "./useLSPConnectionState";-export * from "./useOverrideSuggestIcons";-export * from "./useActiveRangeByCursor";-export * from "./useDecoration";diff --git a/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts b/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.tsdeleted file mode 100644index 259b91e8ad..0000000000--- a/frontend/src/components/MonacoEditor/composables/useActiveRangeByCursor.ts+++ /dev/null@@ -1,200 +0,0 @@-import { debounce, orderBy } from "lodash-es";-import * as monaco from "monaco-editor";-import { computed, ref, watchEffect } from "vue";--interface WebSocketMessage {- method: string;- params: unknown;-}--interface StatementRangeMessage {- uri: string;- ranges: {- end: {- line: number;- character: number;- };- start: {- line: number;- character: number;- };- }[];-}--const rangeChangeEvent = "$/textDocument/statementRanges";--export const useActiveRangeByCursor = (- editor: monaco.editor.IStandaloneCodeEditor-) => {- // Use in-memory ref instead of localStorage to avoid I/O on every update- const statementRangeByUri = ref<Map<string, monaco.IRange[]>>(new Map());- const activeCursorPosition = ref<- { line: number; column: number } | undefined- >();-- // Debounce cursor position updates to reduce computation frequency- const updateCursorPosition = debounce(- (e: monaco.editor.ICursorPositionChangedEvent) => {- activeCursorPosition.value = {- line: e.position.lineNumber,- column: e.position.column,- };- },- 50 // 50ms debounce for cursor movement- );-- editor.onDidChangeCursorPosition(updateCursorPosition);-- const activeRange = computed((): monaco.IRange | undefined => {- const cursorPos = activeCursorPosition.value;- if (!cursorPos) {- return;- }-- const model = editor.getModel();- if (!model) {- return;- }-- const ranges = statementRangeByUri.value.get(model.uri.toString());- if (!ranges || ranges.length === 0) {- return;- }-- // Use binary search for better performance with many ranges- let activeRange: monaco.IRange | undefined = undefined;- const cursorLine = cursorPos.line;- const cursorCol = cursorPos.column;-- // Quick search through ranges- for (let i = 0; i < ranges.length; i++) {- const range = ranges[i];-- // Skip ranges before cursor line- if (range.endLineNumber < cursorLine) {- continue;- }-- // Found a range containing the cursor line- if (- range.startLineNumber <= cursorLine &&- range.endLineNumber >= cursorLine- ) {- // Check column position- if (range.endColumn >= cursorCol) {- activeRange = range;- break;- }-- // Check if this is the last matching range- if (- i === ranges.length - 1 ||- ranges[i + 1].startLineNumber > cursorLine- ) {- activeRange = range;- break;- }- }-- // Passed cursor position, stop searching- if (range.startLineNumber > cursorLine) {- break;- }- }-- if (!activeRange) {- return;- }-- // Only check last line if multi-line range- if (activeRange.endLineNumber > activeRange.startLineNumber) {- const lastLineStatement = model.getValueInRange({- startLineNumber: activeRange.endLineNumber,- startColumn: 1,- endLineNumber: activeRange.endLineNumber,- endColumn: activeRange.endColumn,- });-- if (!lastLineStatement) {- const adjustedRange = {- startLineNumber: activeRange.startLineNumber,- startColumn: activeRange.startColumn,- endLineNumber: activeRange.endLineNumber - 1,- endColumn: Infinity,- };-- // Return adjusted range only if cursor is within it- if (cursorLine <= adjustedRange.endLineNumber) {- return adjustedRange;- }- return;- }- }-- return activeRange;- });-- import("../lsp-client").then(async ({ connectionWebSocket }) => {- let messageHandler: ((msg: MessageEvent) => void) | null = null;-- watchEffect(() => {- if (!connectionWebSocket.value) {- return;- }-- connectionWebSocket.value?.then((ws) => {- // Remove old listener if it exists- if (messageHandler) {- ws.removeEventListener("message", messageHandler);- }-- // Create optimized message handler- messageHandler = (msg: MessageEvent) => {- try {- if (!msg || !msg.data) {- return;- }-- // Early exit if not our message type (avoid parsing)- if (!msg.data.includes(rangeChangeEvent)) {- return;- }-- const data = JSON.parse(msg.data) as WebSocketMessage;- if (data.method !== rangeChangeEvent) {- return;- }- const rangeMessage = data.params as StatementRangeMessage;- if (!rangeMessage.uri || !Array.isArray(rangeMessage.ranges)) {- return;- }-- // Process and cache the ranges- const processedRanges = orderBy(- rangeMessage.ranges,- (range) => range.start,- "asc"- ).map((range) => {- // The position starts from 1 in the editor.- return {- startLineNumber: range.start.line + 1,- endLineNumber: range.end.line + 1,- startColumn: range.start.character + 1,- endColumn: range.end.character + 1,- };- });-- // Update the ref (which serves as our cache)- statementRangeByUri.value.set(rangeMessage.uri, processedRanges);- } catch {- // nothing- }- };-- ws.addEventListener("message", messageHandler);- });- });- });-- return activeRange;-};diff --git a/frontend/src/components/MonacoEditor/composables/useAdvices.ts b/frontend/src/components/MonacoEditor/composables/useAdvices.tsdeleted file mode 100644index 4143d89792..0000000000--- a/frontend/src/components/MonacoEditor/composables/useAdvices.ts+++ /dev/null@@ -1,107 +0,0 @@-import { create } from "@bufbuild/protobuf";-import { maxBy } from "lodash-es";-import * as monaco from "monaco-editor";-import { unref, watchEffect } from "vue";-import type { MaybeRef } from "@/types";-import { PositionSchema } from "@/types/proto-es/v1/common_pb";-import { callCssVariable, escapeMarkdown } from "@/utils";-import { batchConvertPositionToMonacoPosition } from "@/utils/v1/position";-import type { AdviceOption, MonacoModule } from "../types";--export const useAdvices = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- advices: MaybeRef<AdviceOption[]>-) => {- watchEffect((onCleanup) => {- const _advices = unref(advices);- const maxSeverity =- maxBy(- _advices.map((m) => m.severity),- (s) => levelOfSeverity(s)- ) ?? "WARNING";- const content = editor.getModel()?.getValue() ?? "";- const protoStartPositions = _advices.map((advice) => {- return create(PositionSchema, {- line: advice.startLineNumber,- column: advice.startColumn,- });- });- const protoEndPositions = _advices.map((advice) => {- return create(PositionSchema, {- line: advice.endLineNumber,- column: advice.endColumn,- });- });- const monacoStartPosition = batchConvertPositionToMonacoPosition(- protoStartPositions,- content- );- const monacoEndPosition = batchConvertPositionToMonacoPosition(- protoEndPositions,- content- );-- const decorators = editor.createDecorationsCollection(- _advices.map((advice, index) => {- return {- range: new monaco.Range(- monacoStartPosition[index].lineNumber,- monacoStartPosition[index].column,- monacoEndPosition[index].lineNumber,- monacoEndPosition[index].column- ),- options: {- className:- maxSeverity === "ERROR" ? "squiggly-error" : "squiggly-warning",- minimap: {- color: { id: "minimap.errorHighlight" },- position: monaco.editor.MinimapPosition.Inline,- },- overviewRuler: {- color: { id: "editorOverviewRuler.errorForeground" },- position: monaco.editor.OverviewRulerLane.Right,- },- showIfCollapsed: true,- stickiness:- monaco.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,- zIndex: 30,- hoverMessage: {- value: buildHoverMessage(advice),- isTrusted: true,- },- },- };- })- );- onCleanup(() => {- decorators.clear();- });- });-};--const buildHoverMessage = (advice: AdviceOption) => {- const COLORS = {- WARNING: callCssVariable("--color-warning"),- ERROR: callCssVariable("--color-error"),- };-- const { severity, message, source } = advice;- const parts: string[] = [];- parts.push(`<span style="color:${COLORS[severity]};">[${severity}]</span>`);- if (source) {- parts.push(` ${escapeMarkdown(source)}`);- }- parts.push(`\n${escapeMarkdown(message)}`);- return parts.join("");-};--const levelOfSeverity = (severity: AdviceOption["severity"]) => {- switch (severity) {- case "WARNING":- return 0;- case "ERROR":- return 1;- }- throw new Error(`unsupported value "${severity}"`);-};diff --git a/frontend/src/components/MonacoEditor/composables/useAutoComplete.ts b/frontend/src/components/MonacoEditor/composables/useAutoComplete.tsdeleted file mode 100644index 2f748a1a9c..0000000000--- a/frontend/src/components/MonacoEditor/composables/useAutoComplete.ts+++ /dev/null@@ -1,87 +0,0 @@-import { debounce } from "lodash-es";-import * as monaco from "monaco-editor";-import type { Ref } from "vue";-import { computed, watch } from "vue";-import { UNKNOWN_ID } from "@/types";-import {- extractDatabaseResourceName,- extractInstanceResourceName,-} from "@/utils";-import type { MonacoModule } from "../types";--export type AutoCompleteContextScene = "query" | "all";--export type AutoCompleteContext = {- instance: string; // instances/{instance}- database?: string; // instances/{instance}/databases/{database_name}- schema?: string;- scene?: AutoCompleteContextScene;-};--type SetMetadataParams = {- instanceId: string; // instances/{instance}- databaseName: string;- schema?: string;- scene?: AutoCompleteContextScene;-};--export const useAutoComplete = async (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- context: Ref<AutoCompleteContext | undefined>,- readonly: Ref<boolean | undefined>-) => {- const params = computed(() => {- const p: SetMetadataParams = {- instanceId: "",- databaseName: "",- scene: context.value?.scene,- };- const ctx = context.value;- if (ctx) {- const instance = extractInstanceResourceName(ctx.instance);- if (instance && instance !== String(UNKNOWN_ID)) {- p.instanceId = ctx.instance;- }- const { databaseName } = extractDatabaseResourceName(ctx.database ?? "");- if (databaseName && databaseName !== String(UNKNOWN_ID)) {- p.databaseName = databaseName;- }- if (ctx.schema !== undefined) {- p.schema = ctx.schema;- }- }- return p;- });-- // Debounce LSP metadata updates to reduce WebSocket requests- const debouncedSetMetadata = debounce(async (params: SetMetadataParams) => {- if (readonly.value) {- return;- }-- // Initialize LSP client if not already initialized.- try {- const { executeCommand, initializeLSPClient } = await import(- "../lsp-client"- );- const client = await initializeLSPClient();- const result = await executeCommand(client, "setMetadata", [params]);- console.debug(- `[MonacoEditor] setMetadata(${JSON.stringify(params)}): ${JSON.stringify(- result- )}`- );- } catch (err) {- console.error("[MonacoEditor] Failed to initialize LSP client", err);- }- }, 500); // 500ms debounce to significantly reduce LSP requests-- watch(- [() => JSON.stringify(params.value), () => readonly.value],- () => {- debouncedSetMetadata(params.value);- },- { immediate: true }- );-};diff --git a/frontend/src/components/MonacoEditor/composables/useAutoHeight.ts b/frontend/src/components/MonacoEditor/composables/useAutoHeight.tsdeleted file mode 100644index 0e695ea00a..0000000000--- a/frontend/src/components/MonacoEditor/composables/useAutoHeight.ts+++ /dev/null@@ -1,54 +0,0 @@-import * as monaco from "monaco-editor";-import type { Ref } from "vue";-import { unref, watch } from "vue";-import type { MaybeRef } from "@/types";-import { minmax } from "@/utils";-import type { MonacoModule } from "../types";-import { useContent } from "./useContent";--export type AutoHeightOptions = {- min?: number;- max?: number;- padding?: number;-};--export const useAutoHeight = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- containerRef: Ref<HTMLElement | undefined>,- opts: MaybeRef<AutoHeightOptions | undefined>-) => {- const updateHeight = (height: number | undefined = undefined) => {- const _opts = unref(opts);- if (!_opts) return;-- const container = containerRef.value;- if (!container) return;- const { min, max, padding } = _opts;-- container.style.height = `${- height ??- minmax(- editor.getContentHeight() + (padding ?? 0),- min ?? 0,- max ?? Number.MAX_SAFE_INTEGER- )- }px`;- };-- const content = useContent(monaco, editor);-- watch(- [content, () => unref(opts)],- () => {- if (unref(opts)) {- updateHeight();- }- },- {- immediate: true,- }- );-- return updateHeight;-};diff --git a/frontend/src/components/MonacoEditor/composables/useContent.ts b/frontend/src/components/MonacoEditor/composables/useContent.tsdeleted file mode 100644index e1ed6977c5..0000000000--- a/frontend/src/components/MonacoEditor/composables/useContent.ts+++ /dev/null@@ -1,33 +0,0 @@-import { debounce } from "lodash-es";-import * as monaco from "monaco-editor";-import { ref } from "vue";-import type { MonacoModule } from "../types";--export const useContent = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor-) => {- const content = ref(getContent(editor));-- // Debounce content updates to reduce excessive reactive updates- const debouncedUpdate = debounce(() => {- content.value = getContent(editor);- }, 50); // Short debounce to balance responsiveness and performance-- const update = () => {- // For model changes, update immediately- content.value = getContent(editor);- };-- editor.onDidChangeModel(update);- editor.onDidChangeModelContent(debouncedUpdate);-- return content;-};--const getContent = (editor: monaco.editor.IStandaloneCodeEditor) => {- const model = editor.getModel();- if (!model) return "";-- return model.getValue();-};diff --git a/frontend/src/components/MonacoEditor/composables/useDecoration.ts b/frontend/src/components/MonacoEditor/composables/useDecoration.tsdeleted file mode 100644index 20199735d4..0000000000--- a/frontend/src/components/MonacoEditor/composables/useDecoration.ts+++ /dev/null@@ -1,41 +0,0 @@-import * as monaco from "monaco-editor";-import { computed, type Ref, ref, type ShallowRef, watch } from "vue";-import type { MonacoModule } from "../types";--export const useDecoration = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- selection: ShallowRef<monaco.Selection | null>,- activeRange: Ref<monaco.IRange | undefined | null>-) => {- const decorationsCollection =- ref<monaco.editor.IEditorDecorationsCollection>();-- const hasSelection = computed(() => {- return (- selection.value &&- (selection.value.startLineNumber !== selection.value.endLineNumber ||- selection.value.startColumn !== selection.value.endColumn)- );- });-- watch([() => selection.value, () => activeRange.value], () => {- decorationsCollection.value?.clear();- // Has manual selection or no active range, do not highlight.- if (hasSelection.value || !activeRange.value) {- return;- }- decorationsCollection.value = editor.createDecorationsCollection([- {- range: activeRange.value,- options: {- isWholeLine: false,- shouldFillLineOnLineBreak: true,- className: "bg-gray-200",- },- },- ]);- });-- return { activeRange };-};diff --git a/frontend/src/components/MonacoEditor/composables/useFormatContent.ts b/frontend/src/components/MonacoEditor/composables/useFormatContent.tsdeleted file mode 100644index 9872d2bc54..0000000000--- a/frontend/src/components/MonacoEditor/composables/useFormatContent.ts+++ /dev/null@@ -1,69 +0,0 @@-import * as monaco from "monaco-editor";-import type { Ref } from "vue";-import { unref, watchEffect } from "vue";-import type { SQLDialect } from "@/types";-import type { MonacoModule } from "../types";-import { formatEditorContent } from "../utils";-import { useTextModelLanguage } from "./common";--export type FormatContentOptions = {- disabled: boolean;- callback?: (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor- ) => void;-};--const defaultOptions = (): FormatContentOptions => ({- disabled: false,-});--export const useFormatContent = async (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- dialect: Ref<SQLDialect | undefined>,- options: Ref<FormatContentOptions | undefined>-) => {- const language = useTextModelLanguage(editor);- let action: monaco.IDisposable | undefined = undefined;-- watchEffect(() => {- const opts = {- ...defaultOptions(),- ...unref(options),- };-- if (action) {- action.dispose();- action = undefined;- }- if (opts.disabled) return;-- if (language.value === "sql") {- // add `Format SQL` action into context menu- action = editor.addAction({- id: "format-sql",- label: "Format SQL",- keybindings: [- monaco.KeyMod.Alt | monaco.KeyMod.Shift | monaco.KeyCode.KeyF,- ],- contextMenuGroupId: "operation",- contextMenuOrder: 1,- run: async () => {- if (opts.callback) {- opts.callback(monaco, editor);- return;- }- const readonly = editor.getOption(- monaco.editor.EditorOption.readOnly- );- if (readonly) return;- await formatEditorContent(editor, dialect.value);- },- });- } else {- // When the language is "javascript", we can still use Alt+Shift+F to- // format the document (the native feature of monaco-editor).- }- });-};diff --git a/frontend/src/components/MonacoEditor/composables/useLSPConnectionState.ts b/frontend/src/components/MonacoEditor/composables/useLSPConnectionState.tsdeleted file mode 100644index 4613e8c9f4..0000000000--- a/frontend/src/components/MonacoEditor/composables/useLSPConnectionState.ts+++ /dev/null@@ -1,20 +0,0 @@-import { ref, watchEffect } from "vue";-import type { ConnectionState } from "../lsp-client";--export const useLSPConnectionState = () => {- const connectionState = ref<ConnectionState["state"]>();- const connectionHeartbeat = ref<ConnectionState["heartbeat"]>();-- import("../lsp-client").then(- ({ connectionState: state, connectionHeartbeat: heartbeat }) => {- watchEffect(() => {- connectionState.value = state.value;- });- watchEffect(() => {- connectionHeartbeat.value = heartbeat.value;- });- }- );-- return { connectionState, connectionHeartbeat };-};diff --git a/frontend/src/components/MonacoEditor/composables/useLineHighlights.ts b/frontend/src/components/MonacoEditor/composables/useLineHighlights.tsdeleted file mode 100644index d701b0eafd..0000000000--- a/frontend/src/components/MonacoEditor/composables/useLineHighlights.ts+++ /dev/null@@ -1,38 +0,0 @@-import * as monaco from "monaco-editor";-import { unref, watchEffect } from "vue";-import type { MaybeRef } from "@/types";-import type { LineHighlightOption, MonacoModule } from "../types";--export const useLineHighlights = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- options: MaybeRef<LineHighlightOption[]>-) => {- watchEffect((onCleanup) => {- const opts = unref(options);- requestAnimationFrame(() => {- const decorators = editor.createDecorationsCollection(- opts.map((opt) => {- return {- range: new monaco.Range(- opt.startLineNumber,- 1,- opt.endLineNumber,- Infinity- ),- options: {- ...opt.options,- blockPadding: [3, 3, 3, 3],- stickiness:- monaco.editor.TrackedRangeStickiness- .AlwaysGrowsWhenTypingAtEdges,- },- };- })- );- onCleanup(() => {- decorators.clear();- });- });- });-};diff --git a/frontend/src/components/MonacoEditor/composables/useModel.ts b/frontend/src/components/MonacoEditor/composables/useModel.tsdeleted file mode 100644index f1ec8d1a63..0000000000--- a/frontend/src/components/MonacoEditor/composables/useModel.ts+++ /dev/null@@ -1,38 +0,0 @@-import * as monaco from "monaco-editor";-import type { Ref } from "vue";-import { watch } from "vue";-import type { MonacoModule } from "../types";--// Store ViewState (e.g., selection and scroll position) for each TextModel-export const ViewStateMapByUri = new Map<- string,- monaco.editor.ICodeEditorViewState | null->();--export const useModel = (- monaco: MonacoModule,- editor: monaco.editor.IStandaloneCodeEditor,- model: Ref<monaco.editor.ITextModel | undefined>-) => {- watch(- model,- (newModel, oldModel) => {- if (oldModel) {- // Save ViewState for oldModel- const uri = oldModel.uri.toString();- const vs = editor.saveViewState();- ViewStateMapByUri.set(uri, vs);- }-- editor.setModel(newModel ?? null);-- if (newModel) {- // Restore ViewState for newModel- const uri = newModel.uri.toString();- const vs = ViewStateMapByUri.get(uri);- editor.restoreViewState(vs ?? null);- }- },- { immediate: true }- );-};diff --git a/frontend/src/components/MonacoEditor/composables/useOptions.ts b/frontend/src/components/MonacoEditor/composables/useOptions.tsdeleted file mode 100644index 95b89afe54..0000000000--- a/frontend/src/components/MonacoEditor/composables/useOptions.ts+++ /dev/null@@ -1,43 +0,0 @@-import * as monaco from "monaco-editor";-import type { Ref } from "vue";-import { unref, watch, watchEffect } from "vue";-import type { MaybeRef } from "@/types";-import type { MonacoModule } from "../types";-import type { EditorType } from "./common";--type OptionsType<E> = E extends monaco.editor.IStandaloneCodeEditor- ? monaco.editor.IEditorOptions- : E extends monaco.editor.IStandaloneDiffEditor- ? monaco.editor.IDiffEditorOptions- : never;--export const useOptions = <E extends EditorType>(- monaco: MonacoModule,- editor: E,- options: Ref<OptionsType<E> | undefined>-) => {- watch(- options,- (opts) => {- if (!opts) return;- editor.updateOptions(opts);- },- { deep: true, immediate: true }- );-};--export const useOptionByKey = <- E extends EditorType,- K extends keyof OptionsType<E>,->(- monaco: MonacoModule,- editor: E,- key: K,- value: MaybeRef<OptionsType<E>[K] | undefined>-) => {- watchEffect(() => {- editor.updateOptions({- [key]: unref(value),- });- });-};diff --git a/frontend/src/components/MonacoEditor/composables/useOverrideSuggestIcons.ts b/frontend/src/components/MonacoEditor/composables/useOverrideSuggestIcons.tsdeleted file mode 100644index 4e384aa71e..0000000000--- a/frontend/src/components/MonacoEditor/composables/useOverrideSuggestIcons.ts+++ /dev/null@@ -1,108 +0,0 @@-import { useStyleTag } from "@vueuse/core";-import SchemaIconSVG from "lucide-static/icons/box.svg?raw";-import FunctionIconSVG from "lucide-static/icons/square-function.svg?raw";-import TableIconSVG from "lucide-static/icons/table.svg?raw";-import * as monaco from "monaco-editor";-import type { MonacoModule } from "../types";--// Base on heroicons-outline:circle-stack-const DatabaseIconSVG = `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">- <path stroke-linecap="round" stroke-linejoin="round" d="M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125" />-</svg>-`;--// Based on lucide:columns-3 and removing the second gap line-const ColumnIconSVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-columns-3">- <rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>-</svg>`;--// Combine lucide:table and lucide:glasses-// See <ViewIcon /> for more details-const ViewIconSVG = {- normal: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" stroke-linecap="round" stroke-linejoin="round">- <g stroke="rgb(156 163 175)" stroke-width="2" >- <path d="M12 3v18"/>- <rect width="18" height="18" x="3" y="3" rx="2"/>- <path d="M3 9h18M3 15h18"/>- </g>- <g transform="scale(.75)" transform-origin="100% 100%" stroke="rgb(79 70 229)" stroke-width="3.5">- <circle cx="6" cy="15" r="4"/>- <circle cx="18" cy="15" r="4"/>- <path d="M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2m-7.5-2L5 7c.7-1.3 1.4-2 3-2m13.5 8L19 7c-.7-1.3-1.5-2-3-2"/>- </g>-</svg>`,- active: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" stroke-linecap="round" stroke-linejoin="round">- <g stroke="#fff" stroke-width="2" >- <path d="M12 3v18"/>- <rect width="18" height="18" x="3" y="3" rx="2"/>- <path d="M3 9h18M3 15h18"/>- </g>- <g transform="scale(.75)" transform-origin="100% 100%" stroke="rgb(79 70 229)" stroke-width="3.5">- <circle cx="6" cy="15" r="4"/>- <circle cx="18" cy="15" r="4"/>- <path d="M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2m-7.5-2L5 7c.7-1.3 1.4-2 3-2m13.5 8L19 7c-.7-1.3-1.5-2-3-2"/>- </g>-</svg>`,-};--type MonochromeIconOverride = { css: string; url: string };-type ColoredIconOverride = {- css: string;- url: { normal: string; active: string };-};--const content2DataURL = (content: string, mimeType = "image/svg+xml") => {- return `data:${mimeType};base64,${btoa(content)}`;-};--const MonochromeIconOverrides: MonochromeIconOverride[] = [- { css: "module", url: content2DataURL(SchemaIconSVG) },- { css: "class", url: content2DataURL(DatabaseIconSVG) },- { css: "field", url: content2DataURL(TableIconSVG) },- { css: "interface", url: content2DataURL(ColumnIconSVG) },- { css: "function", url: content2DataURL(FunctionIconSVG) },-];-const ColoredIconOverrides: ColoredIconOverride[] = [- {- css: "variable",- url: {- normal: content2DataURL(ViewIconSVG.normal),- active: content2DataURL(ViewIconSVG.active),- },- },-];--const createMonochromeCSS = (icon: MonochromeIconOverride) => {- return `.monaco-editor .suggest-widget .monaco-list .monaco-list-row .suggest-icon.codicon.codicon-symbol-${icon.css}:before {- content: " " !important;- width: 16px;- height: 16px;- background-color: currentColor;- mask-image: url(${icon.url});- mask-size: 100% 100%;-}`;-};--const createColoredCSS = (icon: ColoredIconOverride) => {- return `.monaco-editor .suggest-widget .monaco-list .monaco-list-row .suggest-icon.codicon.codicon-symbol-${icon.css}:before {- content: " " !important;- width: 16px;- height: 16px;- background-image: url(${icon.url.normal});- background-size: 100% 100%;-}-.monaco-editor .suggest-widget .monaco-list .monaco-list-row.focused .suggest-icon.codicon.codicon-symbol-${icon.css}:before {- background-image: url(${icon.url.active});-}`;-};--export const useOverrideSuggestIcons = (- _monaco: MonacoModule,- _editor: monaco.editor.IStandaloneCodeEditor-) => {- const style = [- ...MonochromeIconOverrides.map(createMonochromeCSS),- ...ColoredIconOverrides.map(createColoredCSS),- ].join("\n");- useStyleTag(style);-};diff --git a/frontend/src/components/MonacoEditor/composables/useSelectedContent.ts b/frontend/src/components/MonacoEditor/composables/useSelectedContent.tsdeleted file mode 100644index 1953d072df..0000000000--- a/frontend/src/components/MonacoEditor/composables/useSelectedContent.ts+++ /dev/null@@ -1,18 +0,0 @@-import * as monaco from "monaco-editor";-import { ref, type ShallowRef, watchEffect } from "vue";--export const useSelectedContent = (- editor: monaco.editor.IStandaloneCodeEditor,- selection: ShallowRef<monaco.Selection | null>-) => {- const selectedContent = ref<string>("");-- watchEffect(() => {- const model = editor.getModel();- if (selection.value && model) {- selectedContent.value = model.getValueInRange(selection.value);- }- });-- return selectedContent;-};diff --git a/frontend/src/components/MonacoEditor/composables/useSelection.ts b/frontend/src/components/MonacoEditor/composables/useSelection.tsdeleted file mode 100644index 1e5a2a612a..0000000000--- a/frontend/src/components/MonacoEditor/composables/useSelection.ts+++ /dev/null@@ -1,24 +0,0 @@-import * as monaco from "monaco-editor";-import { shallowRef } from "vue";--export const useSelection = (editor: monaco.editor.IStandaloneCodeEditor) => {- const selection = shallowRef<monaco.Selection | null>(getSelection(editor));- const update = () => {- selection.value = getSelection(editor);- };-- // Only update selection when cursor selection actually changes- editor.onDidChangeCursorSelection(update);- editor.onDidChangeModel(update);- // REMOVED: onDidChangeModelContent - selection doesn't change when typing- // This was causing unnecessary updates on every keystroke-- return selection;-};--const getSelection = (editor: monaco.editor.IStandaloneCodeEditor) => {- const model = editor.getModel();- if (!model) return null;- const selection = editor.getSelection();- return selection;-};diff --git a/frontend/src/components/MonacoEditor/editor.ts b/frontend/src/components/MonacoEditor/editor.tsdeleted file mode 100644index 65dd80be3e..0000000000--- a/frontend/src/components/MonacoEditor/editor.ts+++ /dev/null@@ -1,164 +0,0 @@-import type * as MonacoType from "monaco-editor";-import type { Language } from "@/types";-import { defer } from "@/utils";-import { loadMonacoEditor } from "./lazy-editor";-import { initializeMonacoServices } from "./services";--const state = {- themeInitialized: false,-};--const MonacoEditorReadyDefer = defer<void>();--export const MonacoEditorReady = MonacoEditorReadyDefer.promise;--const initializeTheme = () => {- if (state.themeInitialized) return;-- state.themeInitialized = true;-};--const initialize = async () => {- await initializeMonacoServices();- initializeTheme();-};--export const createMonacoEditor = async (config: {- container: HTMLElement;- options?: MonacoType.editor.IStandaloneEditorConstructionOptions;-}): Promise<MonacoType.editor.IStandaloneCodeEditor> => {- await initialize();- const monaco = await loadMonacoEditor();-- // Create monaco editor.- const editor = monaco.editor.create(config.container, {- ...{- // https://github.com/microsoft/vscode/blob/main/src/vs/monaco.d.ts#L3824- experimentalEditContextEnabled: false,- },- ...defaultEditorOptions(),- ...config.options,- });-- // Disable "Cannot edit in read-only editor" tooltip- // https://github.com/microsoft/monaco-editor/discussions/4156- editor.getContribution("editor.contrib.readOnlyMessageController")?.dispose();-- MonacoEditorReadyDefer.resolve(undefined);-- return editor;-};--export const createMonacoDiffEditor = async (config: {- container: HTMLElement;- options?: MonacoType.editor.IStandaloneDiffEditorConstructionOptions;-}): Promise<MonacoType.editor.IStandaloneDiffEditor> => {- await initialize();- const monaco = await loadMonacoEditor();-- // Create monaco diff editor.- const editor = monaco.editor.createDiffEditor(config.container, {- ...{- // https://github.com/microsoft/vscode/blob/main/src/vs/monaco.d.ts#L3824- experimentalEditContextEnabled: false,- },- ...defaultDiffEditorOptions(),- ...config.options,- });-- // Disable "Cannot edit in read-only editor" tooltip- // https://github.com/microsoft/monaco-editor/discussions/4156- editor- .getModifiedEditor()- .getContribution("editor.contrib.readOnlyMessageController")- ?.dispose();-- MonacoEditorReadyDefer.resolve();-- return editor;-};--export const setMonacoModelLanguage = async (- model: MonacoType.editor.ITextModel,- language: Language-): Promise<void> => {- const monaco = await loadMonacoEditor();- monaco.editor.setModelLanguage(model, language);-};--export const defaultEditorOptions =- (): MonacoType.editor.IStandaloneEditorConstructionOptions => {- return {- // Learn more: https://github.com/microsoft/monaco-editor/issues/311- renderValidationDecorations: "on",- // Learn more: https://github.com/microsoft/monaco-editor/issues/4270- accessibilitySupport: "off",- theme: "vs",- tabSize: 2,- insertSpaces: true,- autoClosingQuotes: "never",- detectIndentation: false,- folding: false,- automaticLayout: true,- minimap: {- enabled: false,- },- wordWrap: "on",- fixedOverflowWidgets: true,- fontSize: 14,- lineHeight: 24,- scrollBeyondLastLine: false,- suggestFontSize: 12,- padding: {- top: 8,- bottom: 8,- },- renderLineHighlight: "none",- codeLens: false,- scrollbar: {- alwaysConsumeMouseWheel: false,- },- inlineSuggest: {- showToolbar: "never",- },- wordBasedSuggestions: "currentDocument",- lineNumbers: "on",- cursorStyle: "line",- glyphMargin: false,- };- };--export const defaultDiffEditorOptions =- (): MonacoType.editor.IStandaloneDiffEditorConstructionOptions => {- return {- // Learn more: https://github.com/microsoft/monaco-editor/issues/311- enableSplitViewResizing: false,- // Learn more: https://github.com/microsoft/monaco-editor/issues/4270- accessibilitySupport: "off",- renderValidationDecorations: "on",- theme: "vs",- autoClosingQuotes: "never",- folding: false,- automaticLayout: true,- minimap: {- enabled: false,- },- wordWrap: "off",- fixedOverflowWidgets: true,- fontSize: 14,- lineHeight: 24,- scrollBeyondLastLine: false,- padding: {- top: 8,- bottom: 8,- },- renderLineHighlight: "none",- codeLens: false,- scrollbar: {- alwaysConsumeMouseWheel: false,- },- inlineSuggest: {- showToolbar: "never",- },- };- };diff --git a/frontend/src/components/MonacoEditor/index.ts b/frontend/src/components/MonacoEditor/index.tsdeleted file mode 100644index 625547734e..0000000000--- a/frontend/src/components/MonacoEditor/index.ts+++ /dev/null@@ -1,6 +0,0 @@-import WrappedDiffEditor from "./WrappedDiffEditor.vue";-import WrappedMonacoEditor from "./WrappedMonacoEditor.vue";--export * from "./types";--export { WrappedMonacoEditor as MonacoEditor, WrappedDiffEditor as DiffEditor };diff --git a/frontend/src/components/MonacoEditor/lazy-editor.ts b/frontend/src/components/MonacoEditor/lazy-editor.tsdeleted file mode 100644index ce49387409..0000000000--- a/frontend/src/components/MonacoEditor/lazy-editor.ts+++ /dev/null@@ -1,27 +0,0 @@-import type * as monaco from "monaco-editor";-import { defer } from "@/utils";--// Lazy load monaco-editor to reduce initial bundle size-let monacoModule: typeof monaco | undefined;-const monacoLoadDefer = defer<typeof monaco>();--export const loadMonacoEditor = async (): Promise<typeof monaco> => {- if (monacoModule) {- return monacoModule;- }-- // Dynamic import of monaco-editor (will create a separate chunk)- monacoModule = await import("monaco-editor");- monacoLoadDefer.resolve(monacoModule);-- return monacoModule;-};--export const getMonacoEditor = async (): Promise<typeof monaco> => {- return monacoLoadDefer.promise;-};--// Helper to check if monaco is already loaded-export const isMonacoLoaded = (): boolean => {- return monacoModule !== undefined;-};diff --git a/frontend/src/components/MonacoEditor/lsp-client.ts b/frontend/src/components/MonacoEditor/lsp-client.tsdeleted file mode 100644index ed99030d3e..0000000000--- a/frontend/src/components/MonacoEditor/lsp-client.ts+++ /dev/null@@ -1,338 +0,0 @@-import { omit, throttle } from "lodash-es";-import { MonacoLanguageClient } from "monaco-languageclient";-import type { ExecuteCommandParams } from "vscode-languageclient";-import { CloseAction, ErrorAction, State } from "vscode-languageclient";-import {- toSocket,- WebSocketMessageReader,- WebSocketMessageWriter,-} from "vscode-ws-jsonrpc";-import { shallowReactive, toRef } from "vue";-import { refreshTokens } from "@/connect/refreshToken";-import { sleep } from "@/utils";-import {- createUrl,- errorNotification,- MAX_RETRIES,- messages,- progressiveDelay,- WEBSOCKET_HEARTBEAT_INTERVAL,- WEBSOCKET_TIMEOUT,-} from "./utils";--export type ConnectionState = {- url: string;- state: "initial" | "ready" | "closed" | "reconnecting";- ws: Promise<WebSocket> | undefined;- lastCommand: ExecuteCommandParams | undefined;- retries: number;- heartbeat: {- timer: ReturnType<typeof setTimeout> | undefined;- counter: number;- timestamp: number;- };-};--// In dev mode, BB_GRPC_LOCAL points directly to the backend (e.g. http://localhost:8080).-// Use it for the WebSocket URL to bypass the Vite proxy which doesn't reliably forward-// WebSocket upgrades in Vite 7.-const lspHost = (() => {- const grpcLocal = import.meta.env.BB_GRPC_LOCAL;- if (grpcLocal) {- try {- return new URL(grpcLocal).host;- } catch {- // ignore- }- }- return location.host;-})();--const conn = shallowReactive<ConnectionState>({- url: createUrl(lspHost, "/lsp").toString(),- state: "initial",- ws: undefined,- lastCommand: undefined,- retries: 0,- heartbeat: shallowReactive({- timer: undefined,- counter: 0,- timestamp: 0,- }),-});--const connectWebSocket = () => {- if (conn.ws) {- return conn.ws;- }-- const connect = (- resolve: (value: WebSocket | PromiseLike<WebSocket>) => void,- reject: (reason?: unknown) => void- ) => {- const ws = new WebSocket(conn.url);- const retries = conn.retries++;-- switch (conn.state) {- case "closed":- return reject(`Connection is closed`);- case "initial":- break;- case "ready":- case "reconnecting":- conn.state = "reconnecting";- break;- }-- const delay = progressiveDelay(retries);- console.debug(- `[LSP-Client] try connecting: state=${conn.state} retries=${retries} delay=${delay}`- );-- sleep(delay).then(() => {- const handleError = (code: number, reason: string) => {- if (conn.state === "closed" || conn.state === "ready") {- return;- }-- if (conn.retries >= MAX_RETRIES) {- conn.state = "closed";- return reject(- `${messages.disconnected()}: max retries exceeded (${MAX_RETRIES}). code=${code} reason="${reason}"`- );- }- return connect(resolve, reject);- };-- const timer = setTimeout(() => {- handleError(-1, "timeout");- }, WEBSOCKET_TIMEOUT);-- ws.addEventListener("open", () => {- clearTimeout(timer);- console.debug(`[LSP-Client] WebSocket open`);- if (conn.state === "ready" || conn.state === "closed") {- return;- }- conn.state = "ready";- conn.retries = 0; // reset retry counter- useHeartbeat(ws);- resolve(ws);- });- ws.addEventListener("close", (e) => {- clearTimeout(timer);- console.debug(- `[LSP-Client] WebSocket close state=${conn.state} code=${e.code} reason=${e.reason}`- );- handleError(e.code, e.reason);- });- });- };-- const promise = new Promise<WebSocket>(connect);- conn.ws = promise;- return promise;-};--const state = {- client: undefined as MonacoLanguageClient | undefined,- clientInitialized: undefined as Promise<MonacoLanguageClient> | undefined,-};--const reconnect = async () => {- conn.ws = undefined;- conn.state = "initial";- conn.retries = 0;-- await refreshTokens();-- if (state.client) {- try {- state.client.dispose();- } catch {- // Ignore disposal errors on a dead client.- }- state.client = undefined;- }- state.clientInitialized = undefined;-- await initializeLSPClient();-};--const createLanguageClient = async (): Promise<MonacoLanguageClient> => {- const ws = await connectWebSocket();- const socket = toSocket(ws);- const reader = new WebSocketMessageReader(socket);- const writer = new WebSocketMessageWriter(socket);- // NOTE: We cannot debounce textDocument/didChange as it breaks LSP incremental sync- const client = new MonacoLanguageClient({- name: "Bytebase Language Client",- clientOptions: {- // use a language id as a document selector- // "sql" for SQL-based engines, "javascript" for MongoDB- documentSelector: ["sql", "javascript"],- // Optimize initialization options- initializationOptions: {- // Request server to batch/throttle expensive operations- performanceMode: true,- // Reduce diagnostic frequency- diagnosticDelay: 500,- // Disable expensive features during typing- disableFeaturesWhileTyping: true,- },- // Configure which capabilities to enable- middleware: {- // Throttle hover requests- provideHover: throttle(async (document, position, token, next) => {- return next(document, position, token);- }, 300),- // Throttle completion requests- provideCompletionItem: throttle(- async (document, position, context, token, next) => {- // Only trigger completion on specific characters- const triggerCharacters = [".", ",", "(", " "];- if (- context.triggerKind === 1 &&- !triggerCharacters.includes(context.triggerCharacter || "")- ) {- return { items: [] }; // Return empty for non-trigger characters- }- return next(document, position, context, token);- },- 200- ),- },- // disable the default error handler- errorHandler: {- error: (error, message, count) => {- console.debug("[MonacoLanguageClient] error", error, message, count);- return {- action: ErrorAction.Continue,- };- },- closed: () => {- console.debug("[MonacoLanguageClient] closed");- // Do NOT use CloseAction.Restart — MonacoLanguageClient's- // createMessageTransports() always returns the original- // (now dead) reader/writer, so restart reuses dead transports.- // Instead, recreate the entire client with a fresh WebSocket.- reconnect().catch((err) => errorNotification(err));- return {- action: CloseAction.DoNotRestart,- };- },- },- },- messageTransports: {- reader,- writer,- },- });-- return client;-};--const createWebSocketAndStartClient = (): {- languageClient: Promise<MonacoLanguageClient>;-} => {- const languageClient = (async () => {- const languageClient = await createLanguageClient();- languageClient.onDidChangeState((e) => {- if (e.newState === State.Running) {- const { lastCommand } = conn;- if (lastCommand) {- // When LSP Client is reconnected, the LSP context (e.g. setMetadata)- // will be cleared.- // So we need to catch the last command, and re-send it to recover- // the context- executeCommand(- languageClient,- lastCommand.command,- lastCommand.arguments- );- }- }- });-- try {- await languageClient.start();- } catch (err) {- // LSP Client startup failed.- errorNotification(err);- }-- return languageClient;- })();-- return {- languageClient,- };-};--const initializeRunner = async () => {- const client = await createWebSocketAndStartClient().languageClient;- state.client = client;- return client;-};--export const initializeLSPClient = () => {- if (state.clientInitialized) {- return state.clientInitialized;- }-- const job = initializeRunner();- state.clientInitialized = job;- return job;-};--export const executeCommand = async (- client: MonacoLanguageClient,- command: string,- args: unknown[] | undefined-) => {- const executeCommandParams: ExecuteCommandParams = {- command,- arguments: args,- };- conn.lastCommand = executeCommandParams;- const result = await client.sendRequest(- "workspace/executeCommand",- executeCommandParams- );- return result;-};--const useHeartbeat = (ws: WebSocket) => {- const cleanup = () => {- clearTimeout(conn.heartbeat.timer);- conn.heartbeat = {- timer: undefined,- counter: 0,- timestamp: 0,- };- };-- ws.addEventListener("error", cleanup);- ws.addEventListener("close", cleanup);-- const ping = () => {- conn.heartbeat.counter++;- conn.heartbeat.timestamp = Date.now();- ws.send(- JSON.stringify({- jsonrpc: "2.0",- method: "$ping",- params: {- state: omit(conn.heartbeat, "timer"),- },- })- );- conn.heartbeat.timer = setTimeout(ping, WEBSOCKET_HEARTBEAT_INTERVAL);- };-- ping();-};--export const connectionState = toRef(conn, "state");-export const connectionHeartbeat = toRef(conn, "heartbeat");-export const connectionWebSocket = toRef(conn, "ws");diff --git a/frontend/src/components/MonacoEditor/services.ts b/frontend/src/components/MonacoEditor/services.tsdeleted file mode 100644index 1edc758d7c..0000000000--- a/frontend/src/components/MonacoEditor/services.ts+++ /dev/null@@ -1,99 +0,0 @@-import "@codingame/monaco-vscode-javascript-default-extension";-import getLanguagesServiceOverride from "@codingame/monaco-vscode-languages-service-override";-import "@codingame/monaco-vscode-sql-default-extension";-import getTextMateServiceOverride from "@codingame/monaco-vscode-textmate-service-override";-import "@codingame/monaco-vscode-theme-defaults-default-extension";-import getThemeServiceOverride from "@codingame/monaco-vscode-theme-service-override";-import "vscode/localExtensionHost";--// Vue and React both ship their own Monaco wrappers during the React migration.-// Without the guards below, whichever module evaluates second would clobber-// `window.MonacoEnvironment` (losing worker labels the other side needs) and-// re-trigger `@codingame/monaco-vscode-api` `initialize`, which is a *global*-// one-shot — the second call rejects and leaves the editor spinner stuck-// forever until a hard refresh. See BYT-9242.--type WorkerLoader = () => Worker;--const workerLoaders: Partial<Record<string, WorkerLoader>> = {- editorWorkerService: () =>- new Worker(- new URL("monaco-editor/esm/vs/editor/editor.worker.js", import.meta.url),- { type: "module" }- ),- TextEditorWorker: () =>- new Worker(- new URL("monaco-editor/esm/vs/editor/editor.worker.js", import.meta.url),- { type: "module" }- ),- TextMateWorker: () =>- new Worker(- new URL(- "@codingame/monaco-vscode-textmate-service-override/worker",- import.meta.url- ),- { type: "module" }- ),- textMateWorker: () =>- new Worker(- new URL(- "@codingame/monaco-vscode-textmate-service-override/worker",- import.meta.url- ),- { type: "module" }- ),-};--const previousEnvironment = window.MonacoEnvironment;-const previousGetWorker = previousEnvironment?.getWorker;--window.MonacoEnvironment = {- ...previousEnvironment,- getWorker: function (moduleId, label) {- const workerFactory = workerLoaders[label];- if (workerFactory) {- return workerFactory();- }- if (previousGetWorker) {- return previousGetWorker(moduleId, label);- }- throw new Error(`Worker ${label} not found`);- },-};--// Share the init promise across both Vue and React Monaco wrappers. The-// underlying `@codingame/monaco-vscode-api` `initialize` is a global one-shot,-// so both sides must await the same promise rather than each caching its own.-const GLOBAL_INIT_KEY = "__bytebaseMonacoServicesInitPromise__";--type GlobalWithMonacoInit = typeof globalThis & {- [GLOBAL_INIT_KEY]?: Promise<void>;-};--const initializeRunner = async () => {- const { initialize: initializeServices } = await import(- "@codingame/monaco-vscode-api"- );- await initializeServices({- ...getTextMateServiceOverride(),- ...getThemeServiceOverride(),- ...getLanguagesServiceOverride(),- });-};--export const initializeMonacoServices = async (): Promise<void> => {- const g = globalThis as GlobalWithMonacoInit;- if (g[GLOBAL_INIT_KEY]) {- return g[GLOBAL_INIT_KEY];- }-- const job = initializeRunner().catch((err) => {- // Allow a retry on the next call instead of caching a rejected promise.- if (g[GLOBAL_INIT_KEY] === job) {- g[GLOBAL_INIT_KEY] = undefined;- }- throw err;- });- g[GLOBAL_INIT_KEY] = job;- return job;-};diff --git a/frontend/src/components/MonacoEditor/sqlFormatter.ts b/frontend/src/components/MonacoEditor/sqlFormatter.tsdeleted file mode 100644index a623213a44..0000000000--- a/frontend/src/components/MonacoEditor/sqlFormatter.ts+++ /dev/null@@ -1,39 +0,0 @@-import type { FormatOptionsWithLanguage } from "sql-formatter";-import type { SQLDialect } from "../../types";--type FormatResult = {- data: string;- error: Error | null;-};--type FormatterLanguage = FormatOptionsWithLanguage["language"];--const convertDialectToFormatterLanguage = (- dialect: SQLDialect | undefined-): FormatterLanguage => {- if (dialect === "MYSQL" || dialect === "TIDB" || dialect === "OCEANBASE")- return "mysql";- if (dialect === "POSTGRES") return "postgresql";- if (dialect === "SNOWFLAKE") return "snowflake";- return "sql";-};--const formatSQL = async (- sql: string,- dialect: SQLDialect | undefined-): Promise<FormatResult> => {- const { format } = await import("sql-formatter");- const options: Partial<FormatOptionsWithLanguage> = {- language: convertDialectToFormatterLanguage(dialect),- };-- try {- console.debug("[formatSQL]", JSON.stringify(options));- const formatted = format(sql, options);- return { data: formatted, error: null };- } catch (error) {- return { data: "", error: error as Error };- }-};--export default formatSQL;diff --git a/frontend/src/components/MonacoEditor/text-model.ts b/frontend/src/components/MonacoEditor/text-model.tsdeleted file mode 100644index bee385126d..0000000000--- a/frontend/src/components/MonacoEditor/text-model.ts+++ /dev/null@@ -1,99 +0,0 @@-import { debounce } from "lodash-es";-import type * as MonacoType from "monaco-editor";-import { isRef, markRaw, ref, shallowRef, unref, watch } from "vue";-import type { Language, MaybeRef } from "@/types";-import { MonacoEditorReady } from "./editor";-import { getMonacoEditor } from "./lazy-editor";--const ready = ref(false);--MonacoEditorReady.then(() => (ready.value = true));--// Store TextModel uniq by filename.-const TextModelMapByFilename = new Map<string, MonacoType.editor.ITextModel>();--export const getUriByFilename = async (filename: string) => {- const monaco = await getMonacoEditor();- return monaco.Uri.parse(`file:///workspace/${filename}`);-};--const createTextModel = async (- filename: string,- content: string,- language: string-) => {- console.debug("[createTextModel]", filename);- if (TextModelMapByFilename.has(filename)) {- return TextModelMapByFilename.get(filename)!;- }-- const monaco = await getMonacoEditor();- const uri = await getUriByFilename(filename);- const model = monaco.editor.createModel(content, language, uri);- TextModelMapByFilename.set(filename, model);- return model;-};--export const useMonacoTextModel = (- filename: MaybeRef<string>,- content: MaybeRef<string>,- language: MaybeRef<Language>,- sync: boolean = true-) => {- const model = shallowRef<MonacoType.editor.ITextModel>();-- watch(- [ready, () => unref(filename), () => unref(language)],- async ([ready, filename, language]) => {- if (!ready) return;- const m = markRaw(- await createTextModel(filename, unref(content), language)- );-- if (sync && isRef(content)) {- m.onDidChangeContent(() => {- const c = m.getValue();- if (c !== content.value) {- // Write-back edited content to content ref.- content.value = c;- }- });- }-- model.value = m;- },- { immediate: true }- );-- // Debounced content sync to reduce excessive model updates- const debouncedUpdateModel = debounce(- (model: MonacoType.editor.ITextModel, content: string) => {- if (model.getValue() === content) return;- model.setValue(content);- },- 50- );-- watch(- [model, () => unref(content)],- ([model, content]) => {- if (!model) return;- if (model.getValue() === content) return;-- // For significant content changes or initial loads, update immediately- const currentValue = model.getValue();- if (- currentValue === "" ||- Math.abs(content.length - currentValue.length) > 100- ) {- model.setValue(content);- } else {- // For minor edits, use debounced update- debouncedUpdateModel(model, content);- }- },- { immediate: true }- );-- return model;-};diff --git a/frontend/src/components/MonacoEditor/types.ts b/frontend/src/components/MonacoEditor/types.tsdeleted file mode 100644index a85c10bf72..0000000000--- a/frontend/src/components/MonacoEditor/types.ts+++ /dev/null@@ -1,63 +0,0 @@-import type * as monaco from "monaco-editor";-import type { Language } from "@/types";--export type MonacoModule = typeof monaco;--export type IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;-export type IStandaloneEditorConstructionOptions =- monaco.editor.IStandaloneEditorConstructionOptions;-export type IStandaloneDiffEditor = monaco.editor.IStandaloneDiffEditor;-export type IStandaloneDiffEditorConstructionOptions =- monaco.editor.IStandaloneDiffEditorConstructionOptions;--export type ITextModel = monaco.editor.ITextModel;--export type AdviceOption = {- severity: "ERROR" | "WARNING";- message: string;- source?: string;- startLineNumber: number; // starts from 1- startColumn: number; // starts from 1- endLineNumber: number; // starts from 1- endColumn: number; // starts from 1-};--export type LineHighlightOption = {- startLineNumber: number; // starts from 1- endLineNumber: number; // starts from 1- options: monaco.editor.IModelDecorationOptions;-};--export const SupportedLanguages: monaco.languages.ILanguageExtensionPoint[] = [- {- id: "sql",- extensions: [".sql"],- aliases: ["SQL", "sql"],- mimetypes: ["application/x-sql"],- },- {- id: "javascript",- extensions: [".js"],- aliases: ["JS", "js"],- mimetypes: ["application/javascript"],- },- {- id: "redis",- extensions: [".redis"],- aliases: ["REDIS", "redis"],- mimetypes: ["application/redis"],- },-];--export type Selection = monaco.Selection;--export type MonacoEditorProps = {- content: string;- filename?: string;- language?: Language;-};--export type MonacoEditorEmits = {- (event: "update:content", content: string): void;- (event: "update:selection", selection: Selection | null): void;-};diff --git a/frontend/src/components/MonacoEditor/utils.ts b/frontend/src/components/MonacoEditor/utils.tsdeleted file mode 100644index c879eda762..0000000000--- a/frontend/src/components/MonacoEditor/utils.ts+++ /dev/null@@ -1,171 +0,0 @@-import { ExternalLinkIcon } from "lucide-vue-next";-import { Range } from "monaco-editor";-import { h, isRef, unref, watch } from "vue";-import { t } from "@/plugins/i18n";-import { pushNotification } from "@/store";-import type { Language, MaybeRef, SQLDialect } from "@/types";-import { minmax } from "@/utils";-import sqlFormatter from "./sqlFormatter";-import type { IStandaloneCodeEditor, Selection } from "./types";--// Max retires in a retry serial. Will be reset after a success connection-export const MAX_RETRIES = 5;-// Progressive delay in a retry serial. Avoiding to flood the server.-export const RECONNECTION_DELAY = {- max: 1000,- min: 100,- growth: 1.5,-};-// Timeout to setup connection in EACH attempt-export const WEBSOCKET_TIMEOUT = 5000;-export const WEBSOCKET_HEARTBEAT_INTERVAL = 10 * 1000; // 10 seconds--export const messages = {- title: () => t("sql-editor.web-socket.errors.title"),- description: () => t("sql-editor.web-socket.errors.description"),- disconnected: () => t("sql-editor.web-socket.errors.disconnected"),-};--export const extensionNameOfLanguage = (lang: Language) => {- switch (lang) {- case "sql":- return "sql";- case "javascript":- return "js";- case "redis":- return "redis";- case "json":- return "json";- }- // A simple fallback- console.warn("unexpected language", lang);- return "sql";-};--export const useEditorContextKey = <- T extends string | number | boolean | null | undefined,->(- editor: IStandaloneCodeEditor,- key: string,- valueOrRef: MaybeRef<T>-) => {- const contextKey = editor.createContextKey<T>(key, unref(valueOrRef));- if (isRef(valueOrRef)) {- watch(valueOrRef, (value) => contextKey?.set(value));- }- return contextKey;-};--export const trySetContentWithUndo = (- editor: IStandaloneCodeEditor,- content: string,- source: string | undefined = undefined-) => {- editor.executeEdits(source, [- {- range: new Range(1, 1, Number.MAX_SAFE_INTEGER, 1),- text: "",- forceMoveMarkers: true,- },- {- range: new Range(1, 1, 1, 1),- text: content,- forceMoveMarkers: true,- },- ]);-};--export const formatEditorContent = async (- editor: IStandaloneCodeEditor,- dialect: SQLDialect | undefined-) => {- const model = editor.getModel();- if (!model) return;- const sql = model.getValue();- const { data, error } = await sqlFormatter(sql, dialect);- if (error) {- return;- }- const pos = editor.getPosition();-- trySetContentWithUndo(editor, data, "Format content");-- if (pos) {- // Not that smart but best efforts to keep the cursor position- editor.setPosition(pos);- }-};--export const createUrl = (- host: string,- path: string,- secure: boolean = location.protocol === "https:"-) => {- const protocol = secure ? "wss" : "ws";- const url = new URL(`${protocol}://${host}${path}`);- return url;-};--const extractErrorMessage = (err: unknown) => {- if (typeof err === "string") {- return err;- }- if (typeof (err as Error).message === "string") {- return (err as Error).message;- }- return String(err);-};--export const errorNotification = (err: unknown) => {- pushNotification({- module: "bytebase",- style: "CRITICAL",- title: messages.title(),- description: () => {- const message = extractErrorMessage(err);- return [- h("p", {}, messages.description()),- message ? h("p", {}, message) : null,- h(- "a",- {- href: "https://docs.bytebase.com/administration/production-setup/#enable-https-and-websocket",- target: "__BLANK",- class: "inline-flex items-center normal-link",- },- [- t("common.learn-more"),- h(ExternalLinkIcon, { class: "w-4 h-4 ml-1" }),- ]- ),- ];- },- });-};--export const progressiveDelay = (serial: number) => {- if (serial === 0) {- return 0;- }- return minmax(- RECONNECTION_DELAY.min * Math.pow(RECONNECTION_DELAY.growth, serial - 1),- RECONNECTION_DELAY.min,- RECONNECTION_DELAY.max- );-};--export const positionWithOffset = (- line: number,- column: number,- selection?: Selection | null-) => {- if (!selection || selection.isEmpty()) {- return [line, column];- }- // Convert 1-based relative position to absolute position.- // Position proto uses 1-based line and column.- // Monaco also uses 1-based line and column.- // delta() takes 0-based offsets, so subtract 1 from both.- const pos = selection.getStartPosition().delta(line - 1, column - 1);- return [pos.lineNumber, pos.column];-};diff --git a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue b/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vuedeleted file mode 100644index b1a4270cca..0000000000--- a/frontend/src/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue+++ /dev/null@@ -1,102 +0,0 @@-<template>- <div class="flex items-center gap-x-2">- <UsersIcon v-if="showIcon" class="w-8" />- <div>- <div class="flex items-center gap-x-2">- <NEllipsis- :line-clamp="1"- :tooltip="true"- :class="deleted ? 'line-through' : ''"- >- <component- :is="allowGetGroup && link ? 'router-link' : 'div'"- :class="allowGetGroup && link && 'normal-link'"- :active-class="''"- :exact-active-class="''"- :to="{- name: WORKSPACE_ROUTE_USERS,- query: {- name: group.name,- },- }"- >- <HighlightLabelText- :text="group.title"- :keyword="keyword"- />- </component>- </NEllipsis>- <NTag v-if="deleted" size="small" round type="error">- {{ $t("common.deleted") }}- </NTag>- <NTag v-else-if="group.source" size="small" round type="primary">- {{ group.source }}- </NTag>- <span v-if="showMember" class="font-normal text-control-light">- {{- `(${$t("settings.members.groups.n-members", { n: group.members.length })})`- }}- </span>- <UserRolesCell v-if="role" :role="role" />- </div>- <NEllipsis- v-if="showName"- :line-clamp="1"- :tooltip="true"- >- <HighlightLabelText- class="textinfolabel text-sm"- :text="group.name"- :keyword="keyword"- />- </NEllipsis>- </div>- </div>-</template>--<script lang="ts" setup>-import { UsersIcon } from "lucide-vue-next";-import { NEllipsis, NTag } from "naive-ui";-import { computed } from "vue";-import UserRolesCell from "@/components/Member/MemberDataTable/cells/UserRolesCell.vue";-import type { MemberRole } from "@/components/Member/types";-import { HighlightLabelText } from "@/components/v2";-import { WORKSPACE_ROUTE_USERS } from "@/router/dashboard/workspaceRoutes";-import { extractUserEmail, useCurrentUserV1 } from "@/store";-import type { Group } from "@/types/proto-es/v1/group_service_pb";-import { hasWorkspacePermissionV2 } from "@/utils";--const props = withDefaults(- defineProps<{- group: Group;- role?: MemberRole;- showIcon?: boolean;- showName?: boolean;- showMember?: boolean;- link?: boolean;- deleted?: boolean;- keyword?: string;- }>(),- {- showIcon: true,- showName: true,- role: undefined,- link: true,- deleted: false,- showMember: true,- }-);--const currentUser = useCurrentUserV1();--const allowGetGroup = computed(() => {- if (- props.group.members.find(- (member) => extractUserEmail(member.member) === currentUser.value.name- )- ) {- return true;- }- return hasWorkspacePermissionV2("bb.groups.get");-});-</script>diff --git a/frontend/src/components/misc/ErrorList.vue b/frontend/src/components/misc/ErrorList.vuedeleted file mode 100644index 7ff91f026f..0000000000--- a/frontend/src/components/misc/ErrorList.vue+++ /dev/null@@ -1,71 +0,0 @@-<template>- <ul- class="flex flex-col"- :class="[showBullets && 'list-disc pl-4']"- >- <li- v-for="(item, i) in errors"- :key="i"- :style="itemStyle(item)"- class="wrap-break-word"- >- <slot name="prefix" />- <component v-if="isJSXElement(itemText(item))" :is="itemText(item)" />- <span v-else>{{ itemText(item) }}</span>- </li>- </ul>-</template>--<script setup lang="tsx">-import { computed, isVNode } from "vue";-import type { JSX } from "vue/jsx-runtime";--export type NestedError = {- error: string | JSX.Element;- indent: number;-};--export type ErrorItem = string | JSX.Element | NestedError;--const isJSXElement = (item: unknown): item is JSX.Element => {- return isVNode(item);-};--const props = withDefaults(- defineProps<{- errors: ErrorItem[];- bullets?: "on-demand" | "always" | "none";- }>(),- {- bullets: "on-demand",- }-);--const showBullets = computed(() => {- switch (props.bullets) {- case "on-demand":- return props.errors.length > 1;- case "always":- return true;- default:- return false;- }-});--const itemStyle = (item: ErrorItem) => {- if (typeof item === "string") {- return "";- }- if ("indent" in item) {- return `margin-left: ${item.indent}rem;`;- }- return "";-};--const itemText = (item: ErrorItem) => {- if (typeof item === "string" || isJSXElement(item)) {- return item;- }- return item.error;-};-</script>diff --git a/frontend/src/components/v2/Button/ContextMenuButton.vue b/frontend/src/components/v2/Button/ContextMenuButton.vuedeleted file mode 100644index dac395ca44..0000000000--- a/frontend/src/components/v2/Button/ContextMenuButton.vue+++ /dev/null@@ -1,126 +0,0 @@-<template>- <NButtonGroup v-if="currentAction" :size="size">- <NButton- v-bind="currentAction.props"- @click="$emit('click', currentAction)"- >- <template #icon>- <slot name="icon" :action="currentAction" />- </template>- <slot name="default" :action="currentAction">- {{ currentAction.text }}- </slot>- </NButton>-- <NPopselect- v-if="options.length > 1"- :value="currentActionKey"- :options="options"- placement="bottom-end"- trigger="click"- @update:value="changeActionKey"- >- <NButton- :style="dropdownButtonStyle(currentAction)"- v-bind="currentAction.props"- >- <ChevronDown />- </NButton>- </NPopselect>- </NButtonGroup>-</template>--<script setup lang="ts">-import { useLocalStorage } from "@vueuse/core";-import { head } from "lodash-es";-import { ChevronDown } from "lucide-vue-next";-import type { ButtonGroupProps, SelectOption } from "naive-ui";-import { NButton, NButtonGroup, NPopselect } from "naive-ui";-import type { CSSProperties } from "vue";-import { computed, ref } from "vue";-import { storageKeyContextMenu } from "@/utils";-import type { ContextMenuButtonAction } from "./types";--const props = withDefaults(- defineProps<{- preferenceKey: string;- actionList: ContextMenuButtonAction[];- defaultActionKey: string;- size?: ButtonGroupProps["size"];- }>(),- {- size: "small",- }-);--defineEmits<{- (event: "click", action: ContextMenuButtonAction): void;-}>();--const getStorage = () => {- const { preferenceKey } = props;- if (!preferenceKey) return undefined;- return useLocalStorage(- storageKeyContextMenu(preferenceKey),- props.defaultActionKey,- {- listenToStorageChanges: false,- }- );-};--// Load user stored default action from localStorage if possible.-// The stored default action may not be in the actionList this time.-// Fallback to the first action if not found.-// But we won't mutate the stored value.-const getDefaultActionKey = (): string | undefined => {- const storage = getStorage();- if (storage && storage.value) {- return storage.value;- }- if (props.defaultActionKey) {- return props.defaultActionKey;- }-- return props.actionList[0]?.key;-};--const currentActionKey = ref(getDefaultActionKey());-const currentAction = computed(() => {- const key = currentActionKey.value;- if (!key) return undefined;- return (- props.actionList.find((action) => action.key === key) ??- head(props.actionList)- );-});--const options = computed(() => {- return props.actionList.map<SelectOption>((action) => ({- label: action.text,- value: action.key,- }));-});--const changeActionKey = (key: string) => {- const action = props.actionList.find((action) => action.key === key);- if (action) {- const storage = getStorage();- if (storage) {- storage.value = action.key;- }- }- currentActionKey.value = key;-};--const dropdownButtonStyle = (action: ContextMenuButtonAction) => {- const style: CSSProperties = {- "--n-padding": "0 6px",- };- if (action.props?.type === "primary") {- style["--n-padding"] = "0 8px";- style["border-left"] = "0.5px solid rgb(var(--color-accent-hover))";- }- return style;-};-</script>diff --git a/frontend/src/components/v2/Button/CopyButton.vue b/frontend/src/components/v2/Button/CopyButton.vuedeleted file mode 100644index dd8858b4f6..0000000000--- a/frontend/src/components/v2/Button/CopyButton.vue+++ /dev/null@@ -1,69 +0,0 @@-<template>- <NButton- v-if="isSupported"- v-bind="$attrs"- :text="text"- :size="size"- :disabled="disabled || isEmpty"- @click="handleCopy"- >- <template #icon>- <CopyIcon />- </template>- <slot />- </NButton>-</template>--<script lang="ts" setup>-import { useClipboard } from "@vueuse/core";-import { CopyIcon } from "lucide-vue-next";-import { NButton } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { pushNotification } from "@/store";--const props = withDefaults(- defineProps<{- content: string | (() => string);- text?: boolean;- disabled?: boolean;- size?: "tiny" | "small" | "medium" | "large";- }>(),- {- text: true,- disabled: false,- size: "tiny",- }-);--const { copy: copyTextToClipboard, isSupported } = useClipboard({- legacy: true,-});-const { t } = useI18n();--const isEmpty = computed(() => {- if (typeof props.content === "function") {- return false;- }- return !props.content;-});--const handleCopy = () => {- if (!isSupported.value) {- return;- }- let value = "";- if (typeof props.content === "function") {- value = props.content();- } else {- value = props.content;- }- copyTextToClipboard(value).then(() => {- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("common.copied"),- });- });-};-</script>diff --git a/frontend/src/components/v2/Button/DeleteConfirmButton.vue b/frontend/src/components/v2/Button/DeleteConfirmButton.vuedeleted file mode 100644index e0e8bec806..0000000000--- a/frontend/src/components/v2/Button/DeleteConfirmButton.vue+++ /dev/null@@ -1,37 +0,0 @@-<template>- <NPopconfirm @positive-click="handleDelete">- <template #trigger>- <NButton- type="error"- quaternary- size="small"- style="--n-padding: 0 6px"- @click.stop- >- <template #icon>- <Trash2 />- </template>- <template #default>- {{ $t("common.delete") }}- </template>- </NButton>- </template>-- <template #default>- <div>{{ $t("bbkit.confirm-button.sure-to-delete") }}</div>- </template>- </NPopconfirm>-</template>--<script setup lang="ts">-import { Trash2 } from "lucide-vue-next";-import { NButton, NPopconfirm } from "naive-ui";--const emit = defineEmits<{- (event: "confirm"): void;-}>();--const handleDelete = async () => {- emit("confirm");-};-</script>diff --git a/frontend/src/components/v2/Button/ErrorTipsButton.vue b/frontend/src/components/v2/Button/ErrorTipsButton.vuedeleted file mode 100644index 6edaddf655..0000000000--- a/frontend/src/components/v2/Button/ErrorTipsButton.vue+++ /dev/null@@ -1,49 +0,0 @@-<template>- <NTooltip- :disabled="disabled || (errors ?? []).length === 0"- v-bind="tooltipProps"- >- <template #trigger>- <NButton- tag="div"- :disabled="disabled || (errors ?? []).length > 0"- v-bind="{- ...$attrs,- ...buttonProps,- }"- @click="$emit('click', $event)"- >- <template #icon>- <slot name="icon" />- </template>- <template #default>- <slot name="default" />- </template>- </NButton>- </template>- <template #default>- <slot name="tooltip" :errors="errors">- <ErrorList :errors="errors ?? []" :class="errorListClass" />- </slot>- </template>- </NTooltip>-</template>--<script setup lang="ts">-import type { ButtonProps, TooltipProps } from "naive-ui";-import { NButton, NTooltip } from "naive-ui";-import ErrorList from "@/components/misc/ErrorList.vue";-import type { VueClass } from "@/utils";--defineProps<{- disabled?: boolean;- errors?: string[];- tooltipProps?: TooltipProps;- buttonProps?: ButtonProps;- errorListClass?: VueClass;-}>();--defineEmits<{- (event: "click", e: MouseEvent): void;-}>();-</script>diff --git a/frontend/src/components/v2/Button/MiniActionButton.vue b/frontend/src/components/v2/Button/MiniActionButton.vuedeleted file mode 100644index c384f9d5b6..0000000000--- a/frontend/src/components/v2/Button/MiniActionButton.vue+++ /dev/null@@ -1,38 +0,0 @@-<template>- <NButton- quaternary- size="tiny"- :type="type"- style="--n-padding: 4px"- :disabled="disabled"- v-bind="$attrs"- @click="$emit('click', $event)"- >- <template #icon>- <slot />- </template>- <template #default>- <slot name="text" />- </template>- </NButton>-</template>--<script setup lang="ts">-import { NButton } from "naive-ui";--defineProps<{- disabled?: boolean;- type?:- | "default"- | "tertiary"- | "primary"- | "success"- | "info"- | "warning"- | "error";-}>();--defineEmits<{- (event: "click", e: MouseEvent): void;-}>();-</script>diff --git a/frontend/src/components/v2/Button/TooltipButton.vue b/frontend/src/components/v2/Button/TooltipButton.vuedeleted file mode 100644index 4779cb6f19..0000000000--- a/frontend/src/components/v2/Button/TooltipButton.vue+++ /dev/null@@ -1,57 +0,0 @@-<template>- <NTooltip v-bind="tooltipProps" :disabled="!tooltipEnabled">- <template #trigger>- <NButton- v-bind="$attrs"- tag="div"- :disabled="disabled"- @click="$emit('click')"- >- <template #icon>- <slot name="icon" />- </template>- <template #default>- <slot />- </template>- </NButton>- </template>- <template #default>- <slot name="tooltip" />- </template>- </NTooltip>-</template>--<script lang="ts" setup>-import { NButton, NTooltip, type TooltipProps } from "naive-ui";-import { computed, useSlots } from "vue";-import type { TooltipMode } from "./types";--const props = withDefaults(- defineProps<{- disabled: boolean;- tooltipMode: TooltipMode;- tooltipProps?: TooltipProps;- }>(),- {- disabled: false,- tooltipMode: "ALWAYS",- tooltipProps: undefined,- }-);--defineEmits<{- (event: "click"): void;-}>();--const slots = useSlots();--const tooltipEnabled = computed(() => {- // Disable tooltip if no tooltip contents- if (!slots.tooltip) return false;- // Enable tooltip when tooltipMode is "ALWAYS"- if (props.tooltipMode === "ALWAYS") return true;- // Enable tooltip if button is disabled- // Disable tooltip otherwise- return props.disabled;-});-</script>diff --git a/frontend/src/components/v2/Button/index.ts b/frontend/src/components/v2/Button/index.tsdeleted file mode 100644index 9e49680b7f..0000000000--- a/frontend/src/components/v2/Button/index.ts+++ /dev/null@@ -1,16 +0,0 @@-import ContextMenuButton from "./ContextMenuButton.vue";-import CopyButton from "./CopyButton.vue";-import DeleteConfirmButton from "./DeleteConfirmButton.vue";-import ErrorTipsButton from "./ErrorTipsButton.vue";-import MiniActionButton from "./MiniActionButton.vue";-import TooltipButton from "./TooltipButton.vue";--export {- ContextMenuButton,- TooltipButton,- ErrorTipsButton,- MiniActionButton,- DeleteConfirmButton,- CopyButton,-};-export * from "./types";diff --git a/frontend/src/components/v2/Button/types.ts b/frontend/src/components/v2/Button/types.tsdeleted file mode 100644index 7de0afacf5..0000000000--- a/frontend/src/components/v2/Button/types.ts+++ /dev/null@@ -1,10 +0,0 @@-import { type ButtonProps } from "naive-ui";--export type ContextMenuButtonAction<T = unknown> = {- key: string;- text: string;- props?: ButtonProps;- params: T;-};--export type TooltipMode = "ALWAYS" | "DISABLED-ONLY";diff --git a/frontend/src/components/v2/Container/Drawer.vue b/frontend/src/components/v2/Container/Drawer.vuedeleted file mode 100644index a6132c6496..0000000000--- a/frontend/src/components/v2/Container/Drawer.vue+++ /dev/null@@ -1,54 +0,0 @@-<template>- <NDrawer- width="auto"- :show="show"- :auto-focus="false"- :trap-focus="false"- :close-on-esc="false"- :data-overlay-stack-id="id"- :data-overlay-stack-upmost="upmost"- v-bind="$attrs"- @update:show="onUpdateShow"- >- <slot />- </NDrawer>-</template>--<script setup lang="ts">-import { toRef } from "@vueuse/core";-import { NDrawer } from "naive-ui";-import { useOverlayStack } from "@/components/misc/OverlayStackManager.vue";-import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";--const props = withDefaults(- defineProps<{- show?: boolean;- closeOnEsc?: boolean;- }>(),- {- show: true,- closeOnEsc: true,- }-);-const emit = defineEmits<{- (event: "update:show", show: boolean): void;- (event: "close"): void;-}>();--const onUpdateShow = (show: boolean) => {- emit("update:show", show);-- if (!show) {- emit("close");- }-};--const { id, upmost, events } = useOverlayStack(toRef(props, "show"));--useEmitteryEventListener(events, "esc", () => {- if (upmost.value && props.closeOnEsc) {- emit("update:show", false);- emit("close");- }-});-</script>diff --git a/frontend/src/components/v2/Container/DrawerContent.vue b/frontend/src/components/v2/Container/DrawerContent.vuedeleted file mode 100644index e9e815ef88..0000000000--- a/frontend/src/components/v2/Container/DrawerContent.vue+++ /dev/null@@ -1,36 +0,0 @@-<template>- <NDrawerContent- class="relative"- :closable="closable"- :title="title"- v-bind="contentProps"- >- <template v-if="$slots.header" #header>- <slot name="header" />- </template>-- <slot />-- <template v-if="$slots.footer" #footer>- <slot name="footer" />- </template>- </NDrawerContent>-</template>--<script setup lang="ts">-import type { DrawerContentProps } from "naive-ui";-import { NDrawerContent } from "naive-ui";--withDefaults(- defineProps<{- title?: string;- closable?: boolean;- contentProps?: DrawerContentProps;- }>(),- {- title: undefined,- closable: true,- contentProps: undefined,- }-);-</script>diff --git a/frontend/src/components/v2/Container/index.ts b/frontend/src/components/v2/Container/index.tsdeleted file mode 100644index c7d7dce72a..0000000000--- a/frontend/src/components/v2/Container/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import Drawer from "./Drawer.vue";-import DrawerContent from "./DrawerContent.vue";--export { Drawer, DrawerContent };diff --git a/frontend/src/components/v2/Form/DropdownInput.vue b/frontend/src/components/v2/Form/DropdownInput.vuedeleted file mode 100644index 0c6f163277..0000000000--- a/frontend/src/components/v2/Form/DropdownInput.vue+++ /dev/null@@ -1,117 +0,0 @@-<template>- <NDropdown- v-if="allowInputValue"- ref="dropdownRef"- trigger="click"- placement="bottom-start"- :options="dropdownOptions"- :width="consistentMenuWidth ? 'trigger' : undefined"- style="max-height: 20rem; overflow-y: auto; overflow-x: hidden"- v-bind="dropdownProps"- @select="$emit('update:value', $event as string)"- >- <NInput- :value="value"- v-bind="$attrs"- @update:value="$emit('update:value', $event)"- >- <template #suffix>- <!-- use the same icon and style with NSelect -->- <NElement- v-if="!$attrs.disabled"- tag="button"- style="color: var(--placeholder-color)"- class="absolute top-1/2 right-[9px] -translate-y-1/2 cursor-pointer"- :class="suffixClass"- :style="suffixStyle"- >- <svg- viewBox="0 0 16 16"- fill="none"- xmlns="http://www.w3.org/2000/svg"- class="w-4 h-4"- >- <path- d="M3.14645 5.64645C3.34171 5.45118 3.65829 5.45118 3.85355 5.64645L8 9.79289L12.1464 5.64645C12.3417 5.45118 12.6583 5.45118 12.8536 5.64645C13.0488 5.84171 13.0488 6.15829 12.8536 6.35355L8.35355 10.8536C8.15829 11.0488 7.84171 11.0488 7.64645 10.8536L3.14645 6.35355C2.95118 6.15829 2.95118 5.84171 3.14645 5.64645Z"- fill="currentColor"- ></path>- </svg>- </NElement>- </template>- </NInput>- </NDropdown>- <NSelect- v-else- :value="value"- :options="options"- :consistent-menu-width="consistentMenuWidth"- v-bind="$attrs"- @update:value="$emit('update:value', $event as string)"- />-</template>--<script setup lang="ts">-import type { DropdownOption, DropdownProps, SelectOption } from "naive-ui";-import { NDropdown, NElement, NInput, NSelect } from "naive-ui";-import { computed, h, ref } from "vue";-import type { VueClass, VueStyle } from "@/utils";--const props = withDefaults(- defineProps<{- value?: string | undefined | null;- allowInputValue?: boolean;- allowFilter?: boolean;- options: SelectOption[];- dropdownProps?: DropdownProps;- suffixClass?: VueClass;- suffixStyle?: VueStyle;- consistentMenuWidth?: boolean;- }>(),- {- value: undefined,- allowInputValue: true,- allowFilter: false,- dropdownProps: undefined,- suffixClass: undefined,- suffixStyle: undefined,- consistentMenuWidth: true,- }-);-const emit = defineEmits<{- (event: "update:value", value: string): void;-}>();--const dropdownRef = ref();--const dropdownOptions = computed(() => {- return props.options- .map<DropdownOption>((opt) => ({- key: opt.value,- ...opt,- type: "render",- render: () =>- h(- "div",- {- class:- "px-3 py-2 textinfo text-sm hover:bg-gray-100 cursor-pointer",- },- opt.value- ),- props: {- onClick: () => {- emit("update:value", opt.value as string);- if (dropdownRef.value) {- dropdownRef.value.doUpdateShow(false);- }- },- },- }))- .filter((opt: DropdownOption) => {- if (!props.value || !props.allowFilter) {- return true;- }- return (opt.key as string).startsWith(props.value);- });-});-</script>diff --git a/frontend/src/components/v2/Form/InlineInput.vue b/frontend/src/components/v2/Form/InlineInput.vuedeleted file mode 100644index 3d937c6ce3..0000000000--- a/frontend/src/components/v2/Form/InlineInput.vue+++ /dev/null@@ -1,53 +0,0 @@-<template>- <NInput- v-if="!disabled"- :value="value"- :style="style"- v-bind="$attrs"- @focus="focused = true"- @blur="focused = false"- @update:value="$emit('update:value', $event)"- />- <NPerformantEllipsis- v-else- style="padding: 0 var(--n-padding-right) 0 var(--n-padding-left)"- v-bind="$attrs"- >- {{ value }}- </NPerformantEllipsis>-</template>--<script setup lang="ts">-import { NInput, NPerformantEllipsis } from "naive-ui";-import type { CSSProperties } from "vue";-import { computed, ref } from "vue";--defineOptions({- inheritAttrs: false,-});--defineProps<{- value: string | undefined | null;- disabled?: boolean;-}>();-defineEmits<{- (event: "update:value", value: string): void;-}>();--const focused = ref(false);--const style = computed(() => {- const style: CSSProperties = {- cursor: "default",- "--n-color": "transparent",- "--n-color-disabled": "transparent",- };- const border = focused.value- ? "1px solid rgb(var(--color-control-border))"- : "none";- style["--n-border"] = border;- style["--n-border-disabled"] = border;-- return style;-});-</script>diff --git a/frontend/src/components/v2/Form/MissingExternalURLAttention.vue b/frontend/src/components/v2/Form/MissingExternalURLAttention.vuedeleted file mode 100644index e2a7623295..0000000000--- a/frontend/src/components/v2/Form/MissingExternalURLAttention.vue+++ /dev/null@@ -1,45 +0,0 @@--<template>- <BBAttention- v-if="- !externalUrl- "- type="error"- :title="$t('banner.external-url')"- :description="- $t('settings.general.workspace.external-url.description')- "- >- <template #action>- <NButton- v-if="hasWorkspacePermissionV2('bb.settings.setWorkspaceProfile')"- type="primary"- size="small"- @click="configureSetting"- >- {{ $t("common.configure-now") }}- </NButton>- </template>- </BBAttention>-</template>--<script lang="tsx" setup>-import { NButton } from "naive-ui";-import { computed } from "vue";-import { useRouter } from "vue-router";-import { BBAttention } from "@/bbkit";-import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";-import { useActuatorV1Store } from "@/store";-import { hasWorkspacePermissionV2 } from "@/utils";--const router = useRouter();-const externalUrl = computed(- () => useActuatorV1Store().serverInfo?.externalUrl ?? ""-);--const configureSetting = () => {- router.push({- name: SETTING_ROUTE_WORKSPACE_GENERAL,- });-};-</script>\ No newline at end of filediff --git a/frontend/src/components/v2/Form/RadioGrid.vue b/frontend/src/components/v2/Form/RadioGrid.vuedeleted file mode 100644index 81912a60c8..0000000000--- a/frontend/src/components/v2/Form/RadioGrid.vue+++ /dev/null@@ -1,50 +0,0 @@-<template>- <div class="grid">- <NButton- v-for="(option, index) in options"- :key="option.value"- class="bb-radio-grid--button"- size="large"- ghost- :type="option.value === value ? 'primary' : 'default'"- :disabled="disabled"- v-bind="buttonProps ? buttonProps(option.value, index) : undefined"- @click="$emit('update:value', option.value)"- >- <div class="flex flex-row items-center gap-x-2 min-w-0">- <NRadio- :checked="value === option.value"- :disabled="disabled"- size="large"- class="pointer-events-none"- v-bind="radioProps ? radioProps(option.value, index) : undefined"- />- <slot name="item" :option="option" :index="index" />- </div>- </NButton>- </div>-</template>--<script setup lang="ts">-import type { ButtonProps, RadioProps } from "naive-ui";-import { NButton, NRadio } from "naive-ui";-import type { RadioGridOption } from "./types";--defineProps<{- value?: string | number | undefined | null;- options: RadioGridOption<string | number>[];- disabled?: boolean;- buttonProps?: (value: string | number, index: number) => ButtonProps;- radioProps?: (value: string | number, index: number) => RadioProps;-}>();-defineEmits<{- (event: "update:value", value: string | number): void;-}>();-</script>--<style lang="postcss" scoped>-.bb-radio-grid--button :deep(.n-button__content) {- width: 100%;- justify-content: flex-start;-}-</style>diff --git a/frontend/src/components/v2/Form/ResourceIdField.vue b/frontend/src/components/v2/Form/ResourceIdField.vuedeleted file mode 100644index aafd05ca3a..0000000000--- a/frontend/src/components/v2/Form/ResourceIdField.vue+++ /dev/null@@ -1,308 +0,0 @@-<template>- <div v-if="visible">- <template v-if="readonly || !state.manualEdit">- <div class="textinfolabel text-sm gap-x-1 flex items-start flex-wrap">- <div class="gap-x-1 flex items-center">- {{ $t("resource-id.self", { resource: resourceName }) }}:- <div- v-if="state.resourceId"- class="text-gray-600 font-medium mr-1 flex items-center gap-x-1"- >- {{ state.resourceId }}- <CopyButton v-if="readonly && value" :content="value" />- </div>- <span v-else class="text-control-placeholder italic">- <EMPTY>- </span>- </div>- <div v-if="!readonly">- <span>- {{ $t("resource-id.cannot-be-changed-later") }}- </span>- <span- class="text-accent font-medium cursor-pointer hover:opacity-80 ml-1"- @click="state.manualEdit = true"- >- {{ $t("common.edit") }}- </span>- </div>- </div>- </template>- <div v-else :class="state.manualEdit && editingClass">- <label for="name" class="textlabel flex flex-row items-center">- {{ $t("resource-id.self", { resource: resourceName }) }}- <span class="ml-0.5 text-error">*</span>- </label>- <div class="textinfolabel mb-2 mt-1">- {{ $t("resource-id.description", { resource: resourceName }) }}- </div>- <NInput- :value="state.resourceId"- :status="inputStatus"- :placeholder="$t('resource-id.self', { resource: resourceName })"- v-bind="inputProps"- @update:value="handleResourceIdInput($event)"- />- </div>- <ul- v-if="state.validatedMessages.length > 0"- class="w-full my-2 flex flex-col gap-y-2 list-disc list-outside pl-4"- >- <li- v-for="validateMessage in state.validatedMessages"- :key="validateMessage.message"- class="wrap-break-word w-full text-xs"- :class="[- validateMessage.type === 'warning' && 'text-yellow-600',- validateMessage.type === 'error' && 'text-red-600',- ]"- >- {{ validateMessage.message }}- </li>- </ul>- </div>-</template>--<script lang="ts" setup>-import { Code } from "@connectrpc/connect";-import { type InputProps, NInput } from "naive-ui";-import { computed, reactive, watch } from "vue";-import { useI18n } from "vue-i18n";-import { CopyButton } from "@/components/v2";-import type { ResourceId, ValidatedMessage } from "@/types";-import { randomString } from "@/utils";-import { getErrorCode } from "@/utils/connect";--// characters is the validated characters for resource id.-const characters = "abcdefghijklmnopqrstuvwxyz1234567890-";--// randomCharacter returns a random character from the english alphabet.-const randomCharacter = (ch?: string): string => {- const characters = "abcdefghijklmnopqrstuvwxyz";- const index = ch- ? ch.charCodeAt(0) % characters.length- : Math.floor(Math.random() * characters.length);- return characters.charAt(index);-};--const resourceIdPattern = /^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;--interface LocalState {- resourceId: string;- manualEdit: boolean;- validatedMessages: ValidatedMessage[];-}--type ResourceType =- | "environment"- | "instance"- | "project"- | "idp"- | "role"- | "database-group"- | "review-config";--const props = withDefaults(- defineProps<{- value?: string;- resourceType: ResourceType;- resourceTitle?: string;- suffix?: boolean;- readonly?: boolean;- inputProps?: Partial<InputProps>;- editingClass?: string;- validate?: (resourceId: ResourceId) => Promise<ValidatedMessage[]>;- // fetchResource will be used to check if the resource id is duplicate.- fetchResource?: (resourceId: ResourceId) => Promise<unknown>;- }>(),- {- value: "",- resourceTitle: "",- suffix: false,- readonly: false,- inputProps: undefined,- editingClass: "",- validate: () => Promise.resolve([]),- }-);--const emit = defineEmits<{- (event: "update:value", value: string): void;-}>();--const { t } = useI18n();-const state = reactive<LocalState>({- resourceId: props.value,- manualEdit: false,- validatedMessages: [],-});-let initialized = false;-// Won't change after the component instance initialized.-const randomSuffix = randomString(4).toLowerCase();--const resourceName = computed(() => {- return t(`dynamic.resource.${props.resourceType}`);-});--const visible = computed(() => {- if (props.readonly) {- return !!state.resourceId;- }- return true;-});--const inputStatus = computed(() => {- const { validatedMessages } = state;- if (validatedMessages.some((m) => m.type === "error")) return "error";- if (validatedMessages.some((m) => m.type === "warning")) return "warning";- return undefined;-});--const handleResourceIdInput = (newValue: string) => {- if (!state.manualEdit) {- return;- }-- state.validatedMessages = [];- handleResourceIdChange(newValue);-};--const handleResourceIdChange = async (newValue: string) => {- state.resourceId = newValue;- state.validatedMessages = [];-- emit("update:value", newValue);-- // common validation for resource id (min length, max length, pattern).- if (state.resourceId === "") {- state.validatedMessages.push({- type: "error",- message: t("resource-id.validation.empty", {- resource: resourceName.value,- }),- });- } else if (state.resourceId.length < 1) {- state.validatedMessages.push({- type: "error",- message: t("resource-id.validation.minlength", {- resource: resourceName.value,- }),- });- } else if (state.resourceId.length > 64) {- state.validatedMessages.push({- type: "error",- message: t("resource-id.validation.overflow", {- resource: resourceName.value,- }),- });- } else if (!resourceIdPattern.test(state.resourceId)) {- state.validatedMessages.push({- type: "error",- message: t("resource-id.validation.pattern", {- resource: resourceName.value,- }),- });- }-- // custom validation for resource id. (e.g. check if the resource id is already used)- if (props.validate) {- const messages = await props.validate(state.resourceId);- if (Array.isArray(messages)) {- state.validatedMessages.push(...messages);- }- }-- if (props.fetchResource && state.resourceId && !props.readonly) {- try {- const resource = await props.fetchResource(state.resourceId);- if (resource) {- state.validatedMessages.push({- type: "error",- message: t("resource-id.validation.duplicated", {- resource: resourceName.value,- }),- });- }- } catch (error) {- if (getErrorCode(error) !== Code.NotFound) {- throw error;- }- }- }-};--watch(- () => props.value,- (newValue) => {- state.resourceId = newValue;- }-);--const escape = (str: string) => {- return str- .toLowerCase()- .split("")- .map((char) => {- if (char === " ") return "-";- if (char.match(/\s/)) return "";- if (characters.includes(char)) return char;- return randomCharacter(char);- })- .join("")- .toLowerCase();-};--watch(- () => props.resourceTitle,- async (resourceTitle) => {- if (props.readonly) {- return;- }- if (state.manualEdit) {- return;- }-- // If we are not in manual edit mode, update the auto-generated resource id- // according to resource title.- const parts: string[] = [];- if (resourceTitle) {- const escapedTitle = escape(resourceTitle);- if (props.suffix) {- parts.push(escapedTitle, randomSuffix);- } else if (escapedTitle) {- parts.push(escapedTitle);- } else {- parts.push(randomString(4).toLowerCase());- }- }- const name = parts.join("-");- await handleResourceIdChange(name);-- // We should keep the first auto-generated resource id is valid.- if (!initialized) {- const messages = state.validatedMessages;- if (messages.length > 0) {- await handleResourceIdChange(- name + "-" + randomString(4).toLowerCase()- );- return;- }- }- initialized = true;- },- {- immediate: true,- }-);--defineExpose({- resourceId: computed(() => state.resourceId),- isValidated: computed(() => {- return state.validatedMessages.length === 0;- }),- // Allow parent to inject validation errors (e.g. from Create API returning ALREADY_EXISTS).- addValidationError: (message: string) => {- state.validatedMessages.push({ type: "error", message });- },-});-</script>diff --git a/frontend/src/components/v2/Form/SearchBox.vue b/frontend/src/components/v2/Form/SearchBox.vuedeleted file mode 100644index 4a2aaf854a..0000000000--- a/frontend/src/components/v2/Form/SearchBox.vue+++ /dev/null@@ -1,58 +0,0 @@-<template>- <NInput- ref="inputRef"- :value="value"- :size="size"- :clearable="!!value"- :placeholder="placeholder"- style="max-width: 18rem; flex: 1 1 0%"- v-bind="$attrs"- @update:value="$emit('update:value', $event)"- >- <template #prefix>- <SearchIcon class="w-4 h-auto text-gray-300" />- </template>- </NInput>-</template>--<script lang="ts" setup>-import { SearchIcon } from "lucide-vue-next";-import { NInput } from "naive-ui";-import { computed, onMounted, ref, useAttrs } from "vue";-import { useI18n } from "vue-i18n";--const props = withDefaults(- defineProps<{- value?: string;- autofocus?: boolean;- size?: "tiny" | "small" | "medium" | "large";- }>(),- {- value: "",- autofocus: false,- size: "medium",- }-);--defineEmits<{- (event: "update:value", value: string): void;-}>();--const inputRef = ref<InstanceType<typeof NInput>>();-const attrs = useAttrs();-const { t } = useI18n();--const placeholder = computed(() => {- return (attrs.placeholder as string) ?? t("common.search");-});--onMounted(() => {- if (props.autofocus) {- inputRef.value?.inputElRef?.focus();- }-});--defineExpose({- inputRef,-});-</script>diff --git a/frontend/src/components/v2/Form/SpinnerButton.vue b/frontend/src/components/v2/Form/SpinnerButton.vuedeleted file mode 100644index 07bf8d7a3b..0000000000--- a/frontend/src/components/v2/Form/SpinnerButton.vue+++ /dev/null@@ -1,65 +0,0 @@-<template>- <NPopconfirm- v-bind="popconfirmProps"- :disabled="!tooltip"- @positive-click="handleConfirm"- >- <template #trigger>- <NButton- :loading="loading"- style="--n-icon-margin: 4px; --n-icon-size: 14px"- v-bind="buttonAttrs"- >- <slot />- </NButton>- </template>-- <div v-if="tooltip" :class="tooltipClass">{{ tooltip }}</div>- </NPopconfirm>-</template>--<script lang="ts">-import { defineComponent } from "vue";--defineComponent({- inheritAttrs: false,-});-</script>--<script lang="ts" setup>-import { omit } from "lodash-es";-import {- type ButtonProps,- NButton,- NPopconfirm,- type PopconfirmProps,-} from "naive-ui";-import { computed, ref, useAttrs } from "vue";-import type { VueClass } from "@/utils";--export interface SpinnerButtonProps extends /* @vue-ignore */ ButtonProps {- onConfirm: () => Promise<void>;- tooltip?: string;- tooltipClass?: VueClass;- popconfirmProps?: PopconfirmProps;-}-const props = defineProps<SpinnerButtonProps>();--const attrs = useAttrs();-const buttonAttrs = computed(() =>- omit(attrs, "tooltip", "tooltipClass", "popconfirmProps")-);--const loading = ref(false);--const handleConfirm = async () => {- if (loading.value) return;-- loading.value = true;- try {- await props.onConfirm();- } finally {- loading.value = false;- }-};-</script>diff --git a/frontend/src/components/v2/Form/SpinnerSelect.vue b/frontend/src/components/v2/Form/SpinnerSelect.vuedeleted file mode 100644index 505baebf6c..0000000000--- a/frontend/src/components/v2/Form/SpinnerSelect.vue+++ /dev/null@@ -1,34 +0,0 @@-<template>- <NSelect v-bind="$attrs" :loading="loading" @update:value="handleUpdate" />-</template>--<script lang="ts">-import { defineComponent } from "vue";--defineComponent({- inheritAttrs: false,-});-</script>--<script lang="ts" setup>-import { NSelect, type SelectProps } from "naive-ui";-import { ref } from "vue";--export interface SpinnerSelectProps extends /* @vue-ignore */ SelectProps {- onUpdate: (value: string | undefined) => Promise<void>;-}-const props = defineProps<SpinnerSelectProps>();--const loading = ref(false);--const handleUpdate = async (value: string | undefined) => {- if (loading.value) return;-- loading.value = true;- try {- await props.onUpdate(value);- } finally {- loading.value = false;- }-};-</script>diff --git a/frontend/src/components/v2/Form/SpinnerSwitch.vue b/frontend/src/components/v2/Form/SpinnerSwitch.vuedeleted file mode 100644index 2b53391ea5..0000000000--- a/frontend/src/components/v2/Form/SpinnerSwitch.vue+++ /dev/null@@ -1,26 +0,0 @@-<template>- <NSwitch :loading="loading" @update:value="handleToggle" />-</template>--<script lang="ts" setup>-import { NSwitch, type SwitchProps } from "naive-ui";-import { ref } from "vue";--export interface SpinnerSwitchProps extends /* @vue-ignore */ SwitchProps {- onToggle: (on: boolean) => Promise<void>;-}-const props = defineProps<SpinnerSwitchProps>();--const loading = ref(false);--const handleToggle = async (on: boolean) => {- if (loading.value) return;-- loading.value = true;- try {- await props.onToggle(on);- } finally {- loading.value = false;- }-};-</script>diff --git a/frontend/src/components/v2/Form/StepTab.vue b/frontend/src/components/v2/Form/StepTab.vuedeleted file mode 100644index dc3da50b5b..0000000000--- a/frontend/src/components/v2/Form/StepTab.vue+++ /dev/null@@ -1,124 +0,0 @@-<template>- <div v-bind="$attrs" :class="[!sticky && 'flex flex-col gap-y-8']">- <div- :class="[- 'px-0.5',- sticky && 'pt-2 pb-4 sticky top-0 bg-white z-10',- headerClass,- ]"- >- <NSteps :current="currentIndex + 1" size="small" :status="'process'">- <NStep- v-for="(step, i) in stepList"- :key="i"- :title="step.title"- :description="step.description"- />- </NSteps>- </div>-- <div :class="[sticky && 'mb-8', paneClass]">- <template v-for="(step, index) in stepList" :key="index">- <slot- v-if="currentIndex == index"- :name="index"- :next="- () => {- $emit('update:currentIndex', currentIndex + 1);- }- "- />- </template>- </div>-- <div- v-if="showFooter"- class="pt-4 border-t border-block-border flex items-center gap-x-2 justify-between"- :class="[sticky && 'pb-4 bg-white sticky bottom-0 z-10', footerClass]"- >- <div>- <NButton v-if="showCancel" @click.prevent="$emit('cancel')">- {{ cancelTitle }}- </NButton>- </div>-- <div class="flex items-center justify-between gap-x-2">- <NButton- v-if="currentIndex != 0"- v-bind="backButtonProps"- @click.prevent="$emit('update:currentIndex', currentIndex - 1)"- >- <ChevronLeft- class="-ml-1 mr-1 h-5 w-5 text-control-light"- />- <span> {{ $t("common.back") }}</span>- </NButton>- <NButton- v-if="currentIndex == stepList.length - 1"- :disabled="!allowNext"- type="primary"- v-bind="finishButtonProps"- @click.prevent="$emit('finish')"- >- {{ finishTitle }}- </NButton>- <NButton- v-else-if="!stepList[currentIndex].hideNext"- :disabled="!allowNext"- type="primary"- v-bind="nextButtonProps"- @click.prevent="$emit('update:currentIndex', currentIndex + 1)"- >- {{ $t("common.next") }}- </NButton>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { ChevronLeft } from "lucide-vue-next";-import type { ButtonProps } from "naive-ui";-import { NButton, NStep, NSteps } from "naive-ui";-import { t } from "@/plugins/i18n";-import type { VueClass } from "@/utils/types";--withDefaults(- defineProps<{- currentIndex: number;- showCancel?: boolean;- allowNext?: boolean;- showFooter?: boolean;- sticky?: boolean;- cancelTitle?: string;- finishTitle?: string;- paneClass?: VueClass;- headerClass?: VueClass;- footerClass?: VueClass;- stepList: { title: string; description?: string; hideNext?: boolean }[];- backButtonProps?: ButtonProps;- nextButtonProps?: ButtonProps;- finishButtonProps?: ButtonProps;- }>(),- {- showCancel: true,- allowNext: true,- showFooter: true,- sticky: false,- cancelTitle: () => t("common.cancel"),- finishTitle: () => t("common.finish"),- paneClass: undefined,- headerClass: undefined,- footerClass: undefined,- backButtonProps: undefined,- nextButtonProps: undefined,- finishButtonProps: undefined,- }-);--defineEmits<{- (event: "cancel"): void;- (event: "finish"): void;- (event: "update:currentIndex", step: number): void;-}>();-</script>diff --git a/frontend/src/components/v2/Form/Switch.vue b/frontend/src/components/v2/Form/Switch.vuedeleted file mode 100644index abf11b611c..0000000000--- a/frontend/src/components/v2/Form/Switch.vue+++ /dev/null@@ -1,39 +0,0 @@-<template>- <NSwitch- class="bb-switch"- style="- --n-width: max(- var(--n-rail-width),- calc(var(--n-rail-width) + var(--n-button-width) - var(--n-rail-height))- );- "- v-bind="$attrs"- >- <template v-if="text" #checked>- <span style="font-size: 10px">{{ $t("common.on") }}</span>- </template>- <template v-if="text" #unchecked>- <span style="font-size: 10px">{{ $t("common.off") }}</span>- </template>- </NSwitch>-</template>--<script lang="ts" setup>-import { NSwitch } from "naive-ui";--defineProps<{- text?: boolean;-}>();-</script>--<style lang="postcss" scoped>-.bb-switch :deep(.n-switch__checked) {- padding-right: calc(var(--n-rail-height) - var(--n-offset) + 1px) !important;-}-.bb-switch :deep(.n-switch__unchecked) {- padding-left: calc(var(--n-rail-height) - var(--n-offset) + 1px) !important;-}-.bb-switch :deep(.n-switch__button-placeholder) {- width: calc(1.25 * var(--n-rail-height)) !important;-}-</style>diff --git a/frontend/src/components/v2/Form/index.ts b/frontend/src/components/v2/Form/index.tsdeleted file mode 100644index 23504f90b8..0000000000--- a/frontend/src/components/v2/Form/index.ts+++ /dev/null@@ -1,26 +0,0 @@-import DropdownInput from "./DropdownInput.vue";-import InlineInput from "./InlineInput.vue";-import RadioGrid from "./RadioGrid.vue";-import ResourceIdField from "./ResourceIdField.vue";-import SearchBox from "./SearchBox.vue";-import SpinnerButton from "./SpinnerButton.vue";-import SpinnerSelect from "./SpinnerSelect.vue";-import SpinnerSwitch from "./SpinnerSwitch.vue";-import StepTab from "./StepTab.vue";-import Switch from "./Switch.vue";-import MissingExternalURLAttention from "./MissingExternalURLAttention.vue";--export * from "./types";-export {- DropdownInput,- InlineInput,- RadioGrid,- SpinnerSwitch,- SpinnerButton,- SpinnerSelect,- SearchBox,- ResourceIdField,- Switch,- StepTab,- MissingExternalURLAttention,-};diff --git a/frontend/src/components/v2/Form/types.ts b/frontend/src/components/v2/Form/types.tsdeleted file mode 100644index 4f04ea6ab7..0000000000--- a/frontend/src/components/v2/Form/types.ts+++ /dev/null@@ -1,8 +0,0 @@-export type RadioGridOption<T extends string | number> = {- value: T;- label?: string;-};-export type RadioGridItem<T extends string | number> = {- option: RadioGridOption<T>;- index: number;-};diff --git a/frontend/src/components/v2/Model/DatabaseV1Name.vue b/frontend/src/components/v2/Model/DatabaseV1Name.vuedeleted file mode 100644index e42a7ed591..0000000000--- a/frontend/src/components/v2/Model/DatabaseV1Name.vue+++ /dev/null@@ -1,57 +0,0 @@-<template>- <component- :is="shouldShowLink ? 'router-link' : NEllipsis"- v-bind="bindings"- class="inline-flex items-center gap-x-1"- :class="[- shouldShowLink && !plain && 'normal-link',- shouldShowLink && 'hover:underline',- isDeleted && 'text-control-light line-through',- ]"- >- <HighlightLabelText :text="extractDatabaseResourceName(database.name).databaseName" :keyword="keyword" />- </component>-</template>--<script lang="ts" setup>-import { NEllipsis } from "naive-ui";-import { computed } from "vue";-import { State } from "@/types/proto-es/v1/common_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import { autoDatabaseRoute, extractDatabaseResourceName } from "@/utils";-import HighlightLabelText from "./HighlightLabelText.vue";--const props = withDefaults(- defineProps<{- database: Database;- link?: boolean;- plain?: boolean;- keyword?: string;- }>(),- {- link: true,- plain: false,- keyword: "",- }-);--const isDeleted = computed(() => props.database.state === State.DELETED);--const shouldShowLink = computed(() => {- return props.link && props.database.state === State.ACTIVE;-});--const bindings = computed(() => {- if (shouldShowLink.value) {- return {- to: autoDatabaseRoute(props.database),- activeClass: "",- exactActiveClass: "",- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- }- return {};-});-</script>diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue b/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vuedeleted file mode 100644index 8f94215818..0000000000--- a/frontend/src/components/v2/Model/DatabaseV1Table/DatabaseV1Table.vue+++ /dev/null@@ -1,314 +0,0 @@-<template>- <div ref="tableRef">- <NDataTable- key="database-table"- size="small"- :columns="columnList"- :data="databaseList"- :striped="true"- :bordered="bordered"- :pagination="pagination"- :loading="loading"- :scroll-x="scrollX"- :row-key="(data: Database) => data.name"- :checked-row-keys="props.selectedDatabaseNames"- :row-props="rowProps"- @update:checked-row-keys="- (val) => $emit('update:selected-database-names', val as string[])- "- @update:sorter="$emit('update:sorters', $event)"- />- </div>-</template>--<script setup lang="tsx">-import { useElementSize } from "@vueuse/core";-import { CheckCircleIcon, XCircleIcon } from "lucide-vue-next";-import {- type DataTableColumn,- type DataTableSortState,- NDataTable,- NTooltip,-} from "naive-ui";-import { computed, ref } from "vue";-import { useI18n } from "vue-i18n";-import { EnvironmentV1Name, InstanceV1Name } from "@/components/v2";-import {- DatabaseNameCell,- LabelsCell,- ProjectNameCell,-} from "@/components/v2/Model/cells";-import {- type Database,- SyncStatus,-} from "@/types/proto-es/v1/database_service_pb";-import {- getDatabaseEnvironment,- getDatabaseProject,- getInstanceResource,- hostPortOfInstanceV1,- TailwindBreakpoints,-} from "@/utils";-import { extractReleaseUID } from "@/utils/v1/release";-import { mapSorterStatus } from "../utils";--type DatabaseDataTableColumn = DataTableColumn<Database> & {- hide?: boolean;-};--export type Mode =- | "ALL"- | "ALL_SHORT"- | "ALL_TINY"- | "INSTANCE"- | "PROJECT"- | "PROJECT_SHORT";--const props = withDefaults(- defineProps<{- mode?: Mode;- databaseList: Database[];- bordered?: boolean;- loading?: boolean;- showSelection?: boolean;- singleSelection?: boolean;- schemaless?: boolean;- rowClickable?: boolean;- selectedDatabaseNames?: string[];- keyword?: string;- rowClick?: (e: MouseEvent, val: Database) => void;- selectDisabled?: (db: Database) => boolean;- pagination?:- | false- | {- defaultPageSize: number;- disabled: boolean;- };- sorters?: DataTableSortState[];- }>(),- {- mode: "ALL",- bordered: true,- showSelection: true,- rowClickable: true,- keyword: undefined,- selectedDatabaseNames: () => [],- pagination: false,- selectDisabled: (_: Database) => false,- }-);--const emit = defineEmits<{- (event: "update:selected-database-names", val: string[]): void;- (event: "update:sorters", sorters: DataTableSortState[]): void;-}>();--const { t } = useI18n();-const tableRef = ref<HTMLDivElement>();-const { width: tableWidth } = useElementSize(tableRef);-const showExtendedColumns = computed(- () => tableWidth.value > TailwindBreakpoints.md-);--const columnList = computed((): DatabaseDataTableColumn[] => {- const SELECTION: DatabaseDataTableColumn = {- type: "selection",- multiple: !props.singleSelection,- hide: !props.showSelection,- disabled: props.selectDisabled,- cellProps: () => {- return {- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- },- };- const NAME: DatabaseDataTableColumn = {- key: "name",- title: t("common.name"),- minWidth: 120,- resizable: true,- render: (data) => {- return <DatabaseNameCell database={data} keyword={props.keyword} />;- },- };- const ENVIRONMENT: DatabaseDataTableColumn = {- key: "environment",- title: t("common.environment"),- minWidth: 120,- resizable: true,- render: (data) => (- <EnvironmentV1Name- environment={getDatabaseEnvironment(data)}- link={false}- showColor={true}- keyword={props.keyword}- />- ),- };- const SCHEMA_VERSION: DatabaseDataTableColumn = {- key: "release",- title: t("common.release"),- minWidth: 140,- resizable: true,- hide: props.schemaless || !showExtendedColumns.value,- render: (data) => {- const release = data.release;- return release ? extractReleaseUID(release) : "-";- },- };- const PROJECT: DatabaseDataTableColumn = {- key: "project",- title: t("common.project"),- resizable: true,- ellipsis: true,- hide: !showExtendedColumns.value,- render: (data) => (- <ProjectNameCell- project={getDatabaseProject(data)}- keyword={props.keyword}- />- ),- };- const INSTANCE: DatabaseDataTableColumn = {- key: "instance",- title: t("common.instance"),- minWidth: 120,- resizable: true,- render: (data) => (- <InstanceV1Name- instance={getInstanceResource(data)}- link={false}- tag="div"- />- ),- };- const ADDRESS: DatabaseDataTableColumn = {- key: "address",- title: t("common.address"),- resizable: true,- hide: !showExtendedColumns.value,- ellipsis: {- tooltip: true,- },- render: (data) => hostPortOfInstanceV1(getInstanceResource(data)),- };- const DATABASE_LABELS: DatabaseDataTableColumn = {- key: "labels",- title: t("common.labels"),- resizable: true,- hide: !showExtendedColumns.value,- render: (data) => (- <LabelsCell labels={data.labels} showCount={1} placeholder="-" />- ),- };- const SYNC_STATUS: DatabaseDataTableColumn = {- key: "sync-status",- title: t("database.sync-status"),- minWidth: 100,- render: (data) => {- if (data.syncStatus === SyncStatus.FAILED) {- return (- <NTooltip>- {{- trigger: () => <XCircleIcon class="w-4 h-4 text-error" />,- default: () => data.syncError || t("database.sync-status-failed"),- }}- </NTooltip>- );- }- return <CheckCircleIcon class="w-4 h-4 text-success" />;- },- };-- const columnsMap = new Map<Mode, DatabaseDataTableColumn[]>([- [- "ALL",- [- NAME,- ENVIRONMENT,- SCHEMA_VERSION,- PROJECT,- INSTANCE,- ADDRESS,- DATABASE_LABELS,- SYNC_STATUS,- ],- ],- [- "ALL_SHORT",- [NAME, ENVIRONMENT, SCHEMA_VERSION, PROJECT, INSTANCE, SYNC_STATUS],- ],- ["ALL_TINY", [NAME, ENVIRONMENT, PROJECT, INSTANCE, SYNC_STATUS]],- [- "INSTANCE",- [- NAME,- ENVIRONMENT,- SCHEMA_VERSION,- PROJECT,- DATABASE_LABELS,- SYNC_STATUS,- ],- ],- [- "PROJECT",- [- NAME,- ENVIRONMENT,- SCHEMA_VERSION,- INSTANCE,- ADDRESS,- DATABASE_LABELS,- SYNC_STATUS,- ],- ],- [- "PROJECT_SHORT",- [NAME, ENVIRONMENT, SCHEMA_VERSION, INSTANCE, ADDRESS, SYNC_STATUS],- ],- ]);-- const columns: DatabaseDataTableColumn[] = (- [- SELECTION,- ...(columnsMap.get(props.mode) || []),- ] as DatabaseDataTableColumn[]- ).filter((column) => !column.hide);- return mapSorterStatus(columns, props.sorters);-});--const scrollX = computed(() => {- return columnList.value.reduce((sum, col) => {- return sum + ((col as { minWidth?: number }).minWidth ?? 100);- }, 0);-});--const rowProps = (database: Database) => {- return {- style: props.rowClickable ? "cursor: pointer;" : "",- onClick: (e: MouseEvent) => {- if (!props.rowClickable) {- return;- }-- if (props.singleSelection) {- emit("update:selected-database-names", [database.name]);- } else {- const selectedDatabaseNameList = new Set(props.selectedDatabaseNames);- if (selectedDatabaseNameList.has(database.name)) {- selectedDatabaseNameList.delete(database.name);- } else {- selectedDatabaseNameList.add(database.name);- }- emit("update:selected-database-names", [...selectedDatabaseNameList]);- }-- if (props.rowClick) {- props.rowClick(e, database);- }- },- };-};-</script>diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/PagedDatabaseTable.vue b/frontend/src/components/v2/Model/DatabaseV1Table/PagedDatabaseTable.vuedeleted file mode 100644index f973119ebd..0000000000--- a/frontend/src/components/v2/Model/DatabaseV1Table/PagedDatabaseTable.vue+++ /dev/null@@ -1,111 +0,0 @@-<template>- <PagedTable- ref="databasePagedTable"- :session-key="`bb.databases-table.${parent}`"- :fetch-list="fetchDatabases"- :class="customClass"- :footer-class="footerClass"- :order-keys="['name', 'project', 'instance']"- >- <template #table="{ list, loading, sorters, onSortersUpdate }">- <DatabaseV1Table- v-bind="$attrs"- :key="`database-table.${parent}`"- :loading="loading"- :database-list="list"- :keyword="filter.query"- :row-click="handleDatabaseClick"- :sorters="sorters"- @update:sorters="onSortersUpdate"- />- </template>- </PagedTable>-</template>--<script setup lang="tsx">-import { ref, watch } from "vue";-import type { ComponentExposed } from "vue-component-type-helpers";-import { useRouter } from "vue-router";-import PagedTable from "@/components/v2/Model/PagedTable.vue";-import { type DatabaseFilter, useDatabaseV1Store } from "@/store";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import { autoDatabaseRoute } from "@/utils";-import DatabaseV1Table from "./DatabaseV1Table.vue";--const props = withDefaults(- defineProps<{- filter?: DatabaseFilter;- parent: string;- customClass?: string;- footerClass?: string;- customClick?: boolean;- }>(),- {- filter: () => ({}),- customClass: "",- footerClass: "",- customClick: false,- }-);--const emit = defineEmits<{- (event: "row-click", e: MouseEvent, val: Database): void;-}>();--const databaseStore = useDatabaseV1Store();-const router = useRouter();--const databasePagedTable = ref<ComponentExposed<typeof PagedTable<Database>>>();--const fetchDatabases = async ({- pageToken,- pageSize,- refresh,- orderBy,-}: {- pageToken: string;- pageSize: number;- refresh?: boolean;- orderBy?: string;-}) => {- const { nextPageToken, databases } = await databaseStore.fetchDatabases({- pageToken,- pageSize,- parent: props.parent,- filter: props.filter,- orderBy,- // Skip cache removal when refresh is false (loading more data).- skipCacheRemoval: !refresh,- });- return {- nextPageToken,- list: databases,- };-};--watch(- [() => props.filter, () => props.parent],- () => databasePagedTable.value?.refresh(),- { deep: true }-);--const handleDatabaseClick = (event: MouseEvent, database: Database) => {- if (props.customClick) {- emit("row-click", event, database);- } else {- const url = router.resolve(autoDatabaseRoute(database)).fullPath;- if (event.ctrlKey || event.metaKey) {- window.open(url, "_blank");- } else {- router.push(url);- }- }-};--defineExpose({- updateCache: (databases: Database[]) => {- databasePagedTable.value?.updateCache(databases);- },- refresh: () => databasePagedTable.value?.refresh(),-});-</script>diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/index.ts b/frontend/src/components/v2/Model/DatabaseV1Table/index.tsdeleted file mode 100644index 7aa81e9c77..0000000000--- a/frontend/src/components/v2/Model/DatabaseV1Table/index.ts+++ /dev/null@@ -1,4 +0,0 @@-import DatabaseV1Table from "./DatabaseV1Table.vue";-import PagedDatabaseTable from "./PagedDatabaseTable.vue";--export { PagedDatabaseTable, DatabaseV1Table };diff --git a/frontend/src/components/v2/Model/DatabaseView.vue b/frontend/src/components/v2/Model/DatabaseView.vuedeleted file mode 100644index 19cb114fed..0000000000--- a/frontend/src/components/v2/Model/DatabaseView.vue+++ /dev/null@@ -1,38 +0,0 @@-<template>- <div class="flex flex-row justify-start items-center gap-x-1" v-bind="$attrs">- <FeatureBadge- :feature="PlanFeature.FEATURE_DATABASE_GROUPS"- class="mr-2"- :instance="getInstanceResource(database)"- />- <InstanceV1EngineIcon :instance="getInstanceResource(database)" />- <EnvironmentV1Name- text-class="text-control-light"- :environment="getDatabaseEnvironment(database)"- :plain="true"- :show-icon="false"- :link="false"- />- <DatabaseV1Name- :database="database"- :plain="true"- :show-icon="false"- :link="false"- />- </div>-</template>--<script lang="ts" setup>-import { FeatureBadge } from "@/components/FeatureGuard";-import { DatabaseV1Name, EnvironmentV1Name } from "@/components/v2";-import { useDatabaseV1ByName } from "@/store";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { getDatabaseEnvironment, getInstanceResource } from "@/utils";-import { InstanceV1EngineIcon } from "./Instance";--const props = defineProps<{- database: string;-}>();--const { database } = useDatabaseV1ByName(props.database);-</script>diff --git a/frontend/src/components/v2/Model/EnvironmentV1Name.vue b/frontend/src/components/v2/Model/EnvironmentV1Name.vuedeleted file mode 100644index 89ab083029..0000000000--- a/frontend/src/components/v2/Model/EnvironmentV1Name.vue+++ /dev/null@@ -1,126 +0,0 @@-<template>- <component- :is="isLink ? 'router-link' : tag"- v-bind="bindings"- class="inline-flex items-center gap-x-1"- :class="[isLink && !plain && 'normal-link', isLink && 'hover:underline']"- :style="- showColor && !isMissing && backgroundColorRgb- ? {- backgroundColor: `rgba(${backgroundColorRgb}, 0.1)`,- borderTopColor: `rgb(${backgroundColorRgb})`,- color: `rgb(${backgroundColorRgb})`,- padding: '0 6px',- borderRadius: '4px',- }- : {}- "- >- <span class="select-none inline-block truncate" :class="textClass">- <span v-if="isUnset" class="text-control-light italic">{{ t("common.unassigned") }}</span>- <span v-else-if="isDeleted" class="text-control-light line-through">- {{ environment.title }}- </span>- <HighlightLabelText v-else :text="environment.title" :keyword="keyword" />- <slot name="suffix">- {{ suffix }}- </slot>- </span>- <ProductionEnvironmentV1Icon- v-if="showIcon && !isMissing"- :environment="environment"- :class="iconClass ?? 'text-current!'"- :tooltip="tooltip"- />- </component>-</template>--<script lang="ts" setup>-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { useEnvironmentV1Store } from "@/store";-import {- formatEnvironmentName,- isValidEnvironmentName,- NULL_ENVIRONMENT_NAME,- UNKNOWN_ENVIRONMENT_NAME,-} from "@/types";-import type { Environment } from "@/types/v1/environment";-import type { VueClass } from "@/utils";-import { hexToRgb } from "@/utils";-import HighlightLabelText from "./HighlightLabelText.vue";-import ProductionEnvironmentV1Icon from "./ProductionEnvironmentV1Icon.vue";--const props = withDefaults(- defineProps<{- environment: Environment;- tag?: string;- link?: boolean;- plain?: boolean;- iconClass?: VueClass;- tooltip?: boolean;- suffix?: string;- showIcon?: boolean;- textClass?: string;- keyword?: string;- showColor?: boolean;- }>(),- {- tag: "span",- link: true,- plain: false,- iconClass: undefined,- tooltip: false,- suffix: "",- showIcon: true,- textClass: "",- keyword: "",- showColor: true,- }-);--const { t } = useI18n();-const environmentStore = useEnvironmentV1Store();--const isUnset = computed(- () =>- props.environment.name === UNKNOWN_ENVIRONMENT_NAME ||- props.environment.name === NULL_ENVIRONMENT_NAME-);--const isDeleted = computed(() => {- if (isUnset.value) return false;- const real = environmentStore.getEnvironmentByName(- props.environment.name,- false- );- return !isValidEnvironmentName(real.name);-});--const isMissing = computed(() => isUnset.value || isDeleted.value);--const isLink = computed(() => props.link && !isMissing.value);--const bindings = computed(() => {- if (isLink.value) {- return {- to: {- path: `/${formatEnvironmentName(props.environment.id)}`,- },- activeClass: "",- exactActiveClass: "",- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- }- return {};-});--const backgroundColorRgb = computed(() => {- if (!props.environment.color) {- return "";- }- return hexToRgb(props.environment.color).join(", ");-});-</script>diff --git a/frontend/src/components/v2/Model/HighlightLabelText.vue b/frontend/src/components/v2/Model/HighlightLabelText.vuedeleted file mode 100644index 21ad2955fa..0000000000--- a/frontend/src/components/v2/Model/HighlightLabelText.vue+++ /dev/null@@ -1,23 +0,0 @@-<template>- <span v-if="!keyword?.trim()" v-bind="$attrs">{{ text }}</span>- <!-- eslint-disable-next-line vue/no-v-html -->- <span v-else v-bind="$attrs" v-html="html" />-</template>--<script lang="ts" setup>-import { computed } from "vue";-import { getHighlightHTMLByRegExp } from "@/utils";--const props = defineProps<{- text: string;- keyword?: string;-}>();--const html = computed(() => {- return getHighlightHTMLByRegExp(- props.text,- props.keyword?.trim() ?? "",- false /* !caseSensitive */- );-});-</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue b/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vuedeleted file mode 100644index 3caac2242e..0000000000--- a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue+++ /dev/null@@ -1,43 +0,0 @@-<template>- <RadioGrid- :value="engine"- :options="options"- @update:value="$emit('update:engine', $event as Engine)"- >- <template #item="{ option }">- <div class="flex flex-row items-center gap-x-1 min-w-0" :title="option.label">- <RichEngineName- :engine="option.value as Engine"- tag="p"- class="text-center text-sm text-main! min-w-0 truncate"- />- <slot name="suffix" :engine="option.value" />- </div>- </template>- </RadioGrid>-</template>--<script setup lang="ts">-import { computed } from "vue";-import { RadioGrid, type RadioGridOption } from "@/components/v2";-import type { Engine } from "@/types/proto-es/v1/common_pb";-import { engineNameV1 } from "@/utils";-import RichEngineName from "./RichEngineName.vue";--type EngineOption = RadioGridOption<Engine>;--const props = defineProps<{- engine: Engine | undefined;- engineList: Engine[];-}>();-defineEmits<{- (event: "update:engine", engine: Engine): void;-}>();--const options = computed(() => {- return props.engineList.map<EngineOption>((engine) => ({- value: engine,- label: engineNameV1(engine),- }));-});-</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceRoleTable/InstanceRoleTable.vue b/frontend/src/components/v2/Model/Instance/InstanceRoleTable/InstanceRoleTable.vuedeleted file mode 100644index 925aa54d0f..0000000000--- a/frontend/src/components/v2/Model/Instance/InstanceRoleTable/InstanceRoleTable.vue+++ /dev/null@@ -1,41 +0,0 @@-<template>- <NDataTable- size="small"- :columns="columns"- :data="instanceRoleList"- :striped="true"- :bordered="true"- v-bind="$attrs"- />-</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 { InstanceRole } from "@/types/proto-es/v1/instance_role_service_pb";--defineProps<{- instanceRoleList: InstanceRole[];-}>();--const { t } = useI18n();-const columns = computed((): DataTableColumn<InstanceRole>[] => [- {- title: t("common.user"),- key: "user",- width: 200,- render: (instanceRole) => instanceRole.roleName,- },- {- title: t("instance.grants"),- key: "grants",- render: (instanceRole) => (- <div class="whitespace-pre-wrap break-all">- {(instanceRole.attribute ?? "").replaceAll("\n", "\n\n")}- </div>- ),- },-]);-</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceRoleTable/index.ts b/frontend/src/components/v2/Model/Instance/InstanceRoleTable/index.tsdeleted file mode 100644index 1fafbe7df6..0000000000--- a/frontend/src/components/v2/Model/Instance/InstanceRoleTable/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import InstanceRoleTable from "./InstanceRoleTable.vue";--export default InstanceRoleTable;diff --git a/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vue b/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vuedeleted file mode 100644index e402fc8bb4..0000000000--- a/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vue+++ /dev/null@@ -1,57 +0,0 @@-<template>- <NTooltip :disabled="!tooltip || !instance.engineVersion">- <template #trigger>- <div :class="sizeClass" class="relative shrink-0" v-bind="$attrs">- <EngineIcon custom-class="w-full h-full" :engine="instance.engine" />- <div- v-if="showStatus"- class="bg-green-400 border-surface-high rounded-full absolute border-2"- style="bottom: -3px; height: 9px; right: -3px; width: 9px"- />- </div>- </template>- <span>{{ instance.engineVersion }}</span>- </NTooltip>-</template>--<script lang="ts" setup>-import { NTooltip } from "naive-ui";-import type { PropType } from "vue";-import { computed } from "vue";-import { EngineIcon } from "@/components/Icon";-import type {- Instance,- InstanceResource,-} from "@/types/proto-es/v1/instance_service_pb";--type Size = "small" | "medium" | "large";--const props = defineProps({- instance: {- required: true,- type: Object as PropType<Instance | InstanceResource>,- },- showStatus: {- type: Boolean,- default: false,- },- tooltip: {- type: Boolean,- default: true,- },- size: {- type: String as PropType<Size>,- default: "small", // default to small.- },-});--const sizeClass = computed(() => {- if (props.size === "large") {- return "w-6 h-6";- } else if (props.size === "medium") {- return "w-5 h-5";- } else {- return "w-4 h-4";- }-});-</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceV1Name.vue b/frontend/src/components/v2/Model/Instance/InstanceV1Name.vuedeleted file mode 100644index 2bca93bb10..0000000000--- a/frontend/src/components/v2/Model/Instance/InstanceV1Name.vue+++ /dev/null@@ -1,103 +0,0 @@-<template>- <div class="inline-flex items-center gap-x-2">- <component- :is="showLink ? 'router-link' : tag"- v-bind="bindings"- class="inline-flex items-center gap-x-1"- :class="[- showLink && !plain && 'normal-link',- showLink && 'hover:underline',- ]"- >- <InstanceV1EngineIcon- v-if="icon && iconPosition === 'prefix'"- :instance="instance"- />-- <slot name="prefix" />-- <NEllipsis :disabled="!tooltip" :line-clamp="1" :class="textClass">- <HighlightLabelText :text="instanceV1Name(instance)" :keyword="keyword" />- </NEllipsis>-- <InstanceV1EngineIcon- v-if="icon && iconPosition === 'suffix'"- :instance="instance"- />- </component>-- <NTag v-if="isArchived" size="small" type="default">- {{ $t("common.archived") }}- </NTag>- </div>-</template>--<script lang="ts" setup>-import { NEllipsis, NTag } from "naive-ui";-import { computed } from "vue";-import { INSTANCE_ROUTE_DETAIL } from "@/router/dashboard/instance";-import { State } from "@/types/proto-es/v1/common_pb";-import type {- Instance,- InstanceResource,-} from "@/types/proto-es/v1/instance_service_pb";-import {- extractInstanceResourceName,- hasWorkspacePermissionV2,- instanceV1Name,-} from "@/utils";-import HighlightLabelText from "../HighlightLabelText.vue";-import InstanceV1EngineIcon from "./InstanceV1EngineIcon.vue";--const props = withDefaults(- defineProps<{- instance: Instance | InstanceResource;- tag?: string;- link?: boolean;- icon?: boolean;- plain?: boolean;- tooltip?: boolean;- iconPosition?: "prefix" | "suffix";- textClass?: string;- keyword?: string;- }>(),- {- tag: "span",- link: true,- icon: true,- plain: false,- tooltip: true,- iconPosition: "prefix",- textClass: "",- keyword: "",- }-);--const isArchived = computed(() => {- return "state" in props.instance && props.instance.state === State.DELETED;-});--const bindings = computed(() => {- if (props.link) {- return {- to: {- name: INSTANCE_ROUTE_DETAIL,- params: {- instanceId: extractInstanceResourceName(props.instance.name),- },- },- activeClass: "",- exactActiveClass: "",- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- }- return {};-});--// Only show the link if the user has permission to view the instance.-const showLink = computed(- () => props.link && hasWorkspacePermissionV2("bb.instances.get")-);-</script>diff --git a/frontend/src/components/v2/Model/Instance/RichEngineName.vue b/frontend/src/components/v2/Model/Instance/RichEngineName.vuedeleted file mode 100644index 6a1e987e61..0000000000--- a/frontend/src/components/v2/Model/Instance/RichEngineName.vue+++ /dev/null@@ -1,41 +0,0 @@-<template>- <component :is="tag" class="flex items-center gap-x-0.5">- <EngineIcon :engine="engine" />- {{ title }}- <span v-if="subtitle" class="text-xs! textinfolabel">- {{ subtitle }}- </span>- </component>-</template>--<script setup lang="ts">-import { computed } from "vue";-import { EngineIcon } from "@/components/Icon";-import type { Engine } from "@/types/proto-es/v1/common_pb";-import { engineNameV1 } from "@/utils";--const RE_SUBTITLE = /\(.+?\)/;--const props = withDefaults(- defineProps<{- tag?: string;- engine: Engine;- }>(),- {- tag: "div",- }-);--const name = computed(() => engineNameV1(props.engine));--const subtitle = computed(() => {- const match = name.value.match(RE_SUBTITLE);- if (!match) return "";- return match[0];-});--const title = computed(() => {- if (!subtitle.value) return name.value;- return name.value.replace(subtitle.value, "").trim();-});-</script>diff --git a/frontend/src/components/v2/Model/Instance/index.ts b/frontend/src/components/v2/Model/Instance/index.tsdeleted file mode 100644index 5b22cf3b30..0000000000--- a/frontend/src/components/v2/Model/Instance/index.ts+++ /dev/null@@ -1,13 +0,0 @@-import InstanceEngineRadioGrid from "./InstanceEngineRadioGrid.vue";-import InstanceRoleTable from "./InstanceRoleTable";-import InstanceV1EngineIcon from "./InstanceV1EngineIcon.vue";-import InstanceV1Name from "./InstanceV1Name.vue";-import RichEngineName from "./RichEngineName.vue";--export {- InstanceEngineRadioGrid,- InstanceV1Name,- InstanceV1EngineIcon,- InstanceRoleTable,- RichEngineName,-};diff --git a/frontend/src/components/v2/Model/PagedTable.vue b/frontend/src/components/v2/Model/PagedTable.vuedeleted file mode 100644index 1091cf97da..0000000000--- a/frontend/src/components/v2/Model/PagedTable.vue+++ /dev/null@@ -1,350 +0,0 @@-<template>- <div class="flex flex-col gap-y-4">- <slot- name="table"- :list="dataList"- :loading="isLoading"- :sorters="sorters"- :on-sorters-update="onSortersUpdate"- />-- <div :class="['flex items-center justify-end gap-x-2', footerClass]">- <div class="flex items-center gap-x-2">- <div class="textinfolabel">- {{ $t("common.rows-per-page") }}- </div>- <NSelect- :value="pageSize"- style="width: 5rem"- size="small"- :options="pageSizeOptions"- @update:value="onPageSizeChange"- />- </div>-- <NButton- v-if="!hideLoadMore && hasMore"- quaternary- size="small"- :loading="isFetching"- @click="loadMore"- >- <span class="textinfolabel">- {{ $t("common.load-more") }}- </span>- </NButton>- </div>- </div>-</template>--<script lang="ts" setup generic="T extends { name: string }">-import { useDebounceFn } from "@vueuse/core";-import { sortBy, uniq } from "lodash-es";-import { type DataTableSortState, NButton, NSelect } from "naive-ui";-import { computed, onMounted, onUnmounted, ref, shallowRef, watch } from "vue";-import { useAuthStore, useCurrentUserV1 } from "@/store";-import {- getDefaultPagination,- storageKeyPagedTable,- useDynamicLocalStorage,-} from "@/utils";--// ============================================================================-// Props & Emits-// ============================================================================--const props = withDefaults(- defineProps<{- sessionKey: string;- hideLoadMore?: boolean;- footerClass?: string;- debounce?: number;- fetchList: (params: {- pageSize: number;- pageToken: string;- refresh?: boolean;- orderBy?: string;- }) => Promise<{ nextPageToken?: string; list: T[] }>;- orderKeys?: string[];- }>(),- {- hideLoadMore: false,- footerClass: "",- debounce: 500,- orderKeys: () => [],- }-);--const emit = defineEmits<{- "list:update": [list: T[]];-}>();--// ============================================================================-// Stores-// ============================================================================--const authStore = useAuthStore();-const currentUser = useCurrentUserV1();--// ============================================================================-// State-// ============================================================================--// Core data state-const dataList = shallowRef<T[]>([]);-const nextPageToken = ref("");--// Fetch state-const isFetching = ref(false);-const ready = ref(false);-const error = ref<Error | null>(null);--// Request management-let abortController: AbortController | null = null;--// ============================================================================-// Computed-// ============================================================================--// Loading state: true if fetching OR if no fetch has completed yet-// This prevents showing "No Data" before the first request finishes-const isLoading = computed(() => isFetching.value || !ready.value);--// Whether there are more pages to load-const hasMore = computed(() => Boolean(nextPageToken.value));--// ============================================================================-// Sorting-// ============================================================================--const sorters = ref<DataTableSortState[]>(- props.orderKeys.map((key) => ({- columnKey: key,- order: false,- sorter: true,- }))-);--const orderBy = computed(() =>- sorters.value- .filter((sorter) => sorter.order)- .map((sorter) => {- const key = sorter.columnKey.toString();- const order = sorter.order === "ascend" ? "asc" : "desc";- return `${key} ${order}`;- })- .join(", ")-);--const onSortersUpdate = (- sortStates: DataTableSortState[] | DataTableSortState | null-) => {- if (!sortStates) return;-- const states = Array.isArray(sortStates) ? sortStates : [sortStates];- for (const state of states) {- const index = sorters.value.findIndex(- (s) => s.columnKey === state.columnKey- );- if (index >= 0) {- sorters.value[index] = state;- }- }-};--// ============================================================================-// Pagination-// ============================================================================--const pageSizeOptions = computed(() => {- const defaultPageSize = getDefaultPagination();- return sortBy(uniq([defaultPageSize, 50, 100, 200, 500])).map((num) => ({- value: num,- label: String(num),- }));-});--const sessionState = useDynamicLocalStorage<{ pageSize: number }>(- computed(() =>- storageKeyPagedTable(props.sessionKey, currentUser.value.email)- ),- { pageSize: pageSizeOptions.value[0].value }-);--const pageSize = computed(() => {- const stored = sessionState.value.pageSize;- const defaultSize = pageSizeOptions.value[0].value;-- // Guard against invalid values from corrupted localStorage- if (- !Number.isFinite(stored) ||- !pageSizeOptions.value.some((o) => o.value === stored)- ) {- return defaultSize;- }- return Math.max(defaultSize, stored);-});--// ============================================================================-// Data Fetching-// ============================================================================--const fetchData = async (isRefresh: boolean) => {- if (!authStore.isLoggedIn || authStore.unauthenticatedOccurred) {- return;- }-- // Cancel any in-flight request- abortController?.abort();- abortController = new AbortController();-- isFetching.value = true;- error.value = null;-- try {- const result = await props.fetchList({- pageSize: pageSize.value,- pageToken: isRefresh ? "" : nextPageToken.value,- refresh: isRefresh,- orderBy: orderBy.value,- });-- // Check if request was aborted- if (abortController.signal.aborted) {- return;- }-- if (isRefresh) {- dataList.value = result.list;- } else {- dataList.value = [...dataList.value, ...result.list];- }-- nextPageToken.value = result.nextPageToken ?? "";- ready.value = true;- } catch (e) {- // Ignore abort errors- if (e instanceof Error && e.name === "AbortError") {- return;- }- console.error(e);- error.value = e instanceof Error ? e : new Error(String(e));- ready.value = true;- } finally {- isFetching.value = false;- }-};--// Debounced refresh for internal triggers (watchers)-const debouncedRefresh = useDebounceFn(() => {- nextPageToken.value = "";- fetchData(true);-}, props.debounce);--// Immediate refresh that returns a Promise - for external callers-const refresh = async () => {- nextPageToken.value = "";- await fetchData(true);-};--const loadMore = async () => {- if (!hasMore.value || isFetching.value) return;- await fetchData(false);-};--// ============================================================================-// Event Handlers-// ============================================================================--const onPageSizeChange = (size: number) => {- sessionState.value.pageSize = size;- debouncedRefresh();-};--// ============================================================================-// Cache Management-// ============================================================================--const updateCache = (items: T[]) => {- const updated = [...dataList.value];- let hasChanges = false;-- for (const item of items) {- hasChanges = true;- const index = updated.findIndex((d) => d.name === item.name);- if (index >= 0) {- updated[index] = item;- } else {- updated.push(item);- }- }-- if (hasChanges) {- dataList.value = updated;- }-};--const removeCache = (item: T) => {- const index = dataList.value.findIndex((d) => d.name === item.name);- if (index >= 0) {- const updated = [...dataList.value];- updated.splice(index, 1);- dataList.value = updated;- }-};--// ============================================================================-// Lifecycle-// ============================================================================--onMounted(() => {- fetchData(true);-});--onUnmounted(() => {- abortController?.abort();-});--// ============================================================================-// Watchers-// ============================================================================--// Re-fetch on auth changes-watch(- () => authStore.authSessionKey,- () => {- if (!authStore.isLoggedIn || authStore.unauthenticatedOccurred) {- return;- }- sessionState.value = { pageSize: pageSize.value };- debouncedRefresh();- }-);--// Emit list updates-watch(dataList, (list) => emit("list:update", list));--// Re-fetch when sort order changes (debounced to handle rapid changes)-watch(orderBy, () => debouncedRefresh());--// ============================================================================-// Exposed API-// ============================================================================--defineExpose({- // Methods- refresh,- loadMore,- updateCache,- removeCache,-- // State (readonly access)- dataList,- orderBy,- isLoading,- isFetching,- hasMore,- ready,- error,-});-</script>diff --git a/frontend/src/components/v2/Model/Plan/SpecLink.vue b/frontend/src/components/v2/Model/Plan/SpecLink.vuedeleted file mode 100644index 1ed0ffa18b..0000000000--- a/frontend/src/components/v2/Model/Plan/SpecLink.vue+++ /dev/null@@ -1,36 +0,0 @@-<template>- <RouterLink- v-if="canLink"- :to="{- name: PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL,- params: {- projectId: projectName,- planId: planUID,- specId: specId,- },- }"- class="inline-flex items-center gap-1 hover:underline"- >- {{ $t("plan.spec.change") }}- <NTag size="tiny" round> #{{ displayIndex }} </NTag>- </RouterLink>- <span v-else>{{ $t("plan.spec.change") }}</span>-</template>--<script lang="ts" setup>-import { NTag } from "naive-ui";-import { computed } from "vue";-import { RouterLink } from "vue-router";-import { PROJECT_V1_ROUTE_PLAN_DETAIL_SPEC_DETAIL } from "@/router/dashboard/projectV1";--const props = defineProps<{- projectName: string;- planUID: string;- specId: string;- displayIndex: number;-}>();--const canLink = computed(() => {- return props.projectName && props.planUID && props.specId;-});-</script>diff --git a/frontend/src/components/v2/Model/Plan/index.ts b/frontend/src/components/v2/Model/Plan/index.tsdeleted file mode 100644index 9136e32723..0000000000--- a/frontend/src/components/v2/Model/Plan/index.ts+++ /dev/null@@ -1 +0,0 @@-export { default as SpecLink } from "./SpecLink.vue";diff --git a/frontend/src/components/v2/Model/ProductionEnvironmentV1Icon.vue b/frontend/src/components/v2/Model/ProductionEnvironmentV1Icon.vuedeleted file mode 100644index 0305f0e768..0000000000--- a/frontend/src/components/v2/Model/ProductionEnvironmentV1Icon.vue+++ /dev/null@@ -1,46 +0,0 @@-<template>- <NTooltip v-if="enabled" :disabled="!tooltip" placement="top">- <template #trigger>- <ShieldAlert- class="text-control inline-block shrink-0"- :class="tooltip ? 'pointer-events-auto' : 'pointer-events-none'"- v-bind="$attrs"- />- </template>-- <span>{{ t("environment.production-environment") }}</span>- </NTooltip>-</template>--<script lang="ts" setup>-import { ShieldAlert } from "lucide-vue-next";-import { NTooltip } from "naive-ui";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { featureToRef } from "@/store";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import type { Environment } from "@/types/v1/environment";--const { t } = useI18n();--const props = withDefaults(- defineProps<{- environment: Environment;- tooltip?: boolean;- }>(),- {- tooltip: false,- }-);--const hasEnvironmentTierPolicyFeature = featureToRef(- PlanFeature.FEATURE_ENVIRONMENT_TIERS-);--const enabled = computed((): boolean => {- if (!hasEnvironmentTierPolicyFeature.value) {- return false;- }- return props.environment?.tags?.protected === "protected";-});-</script>diff --git a/frontend/src/components/v2/Model/ProjectV1Name.vue b/frontend/src/components/v2/Model/ProjectV1Name.vuedeleted file mode 100644index 23b2704088..0000000000--- a/frontend/src/components/v2/Model/ProjectV1Name.vue+++ /dev/null@@ -1,52 +0,0 @@-<template>- <component- :is="link ? 'router-link' : tag"- v-bind="bindings"- class="inline-flex items-center gap-x-1"- :class="link && !plain && 'normal-link'"- >- <NPerformantEllipsis :line-clamp="1" :tooltip="true">- <HighlightLabelText :text="projectV1Name(project)" :keyword="keyword" />- </NPerformantEllipsis>- </component>-</template>--<script lang="ts" setup>-import { NPerformantEllipsis } from "naive-ui";-import { computed } from "vue";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import { autoProjectRoute, projectV1Name } from "@/utils";-import HighlightLabelText from "./HighlightLabelText.vue";--const props = withDefaults(- defineProps<{- project: Project;- tag?: string;- link?: boolean;- plain?: boolean;- hash?: string;- keyword?: string;- }>(),- {- tag: "span",- link: true,- plain: false,- hash: "",- keyword: "",- }-);--const bindings = computed(() => {- if (props.link) {- return {- to: autoProjectRoute(props.project),- activeClass: "",- exactActiveClass: "",- onClick: (e: MouseEvent) => {- e.stopPropagation();- },- };- }- return {};-});-</script>diff --git a/frontend/src/components/v2/Model/RichDatabaseName.vue b/frontend/src/components/v2/Model/RichDatabaseName.vuedeleted file mode 100644index 3c96990e92..0000000000--- a/frontend/src/components/v2/Model/RichDatabaseName.vue+++ /dev/null@@ -1,101 +0,0 @@-<template>- <NPopover :disabled="!tooltip">- <template #trigger>- <div v-bind="$attrs" class="flex flex-row justify-start items-center gap-x-1">- <ProjectV1Name- v-if="showProject"- :project="getDatabaseProject(database)"- :link="false"- />-- <ChevronRightIcon- v-if="showProject && showArrow"- class="w-3"- />-- <div- v-if="showInstance || showEngineIcon"- class="flex flex-row items-center gap-x-1"- >- <InstanceV1EngineIcon- v-if="showEngineIcon"- :instance="getInstanceResource(database)"- />- <InstanceV1Name- v-if="showInstance"- :instance="getInstanceResource(database)"- :icon="false"- :link="false"- />- </div>-- <ChevronRightIcon- v-if="(showInstance || showEngineIcon) && showArrow"- class="w-3"- />-- <div class="flex flex-row items-center gap-x-1">- <EnvironmentV1Name- v-if="showEnvironment"- :environment="getDatabaseEnvironment(database)"- :link="false"- :show-icon="showProductionEnvironmentIcon"- text-class="text-control-light"- />- <DatabaseV1Name- :database="database"- :link="false"- :show-icon="false"- :keyword="keyword"- />- </div>- </div>- </template>- <template #default>- <InstanceV1Name- v-if="tooltip === 'instance'"- :instance="getInstanceResource(database)"- :link="false"- />- </template>- </NPopover>-</template>--<script setup lang="ts">-import { ChevronRightIcon } from "lucide-vue-next";-import { NPopover } from "naive-ui";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import {- getDatabaseEnvironment,- getDatabaseProject,- getInstanceResource,-} from "@/utils";-import DatabaseV1Name from "./DatabaseV1Name.vue";-import EnvironmentV1Name from "./EnvironmentV1Name.vue";-import { InstanceV1EngineIcon, InstanceV1Name } from "./Instance";-import ProjectV1Name from "./ProjectV1Name.vue";--withDefaults(- defineProps<{- database: Database;- showProject?: boolean;- showEngineIcon?: boolean;- showInstance?: boolean;- showArrow?: boolean;- showEnvironment?: boolean;- showProductionEnvironmentIcon?: boolean;- tooltip?: "instance" | undefined;- keyword?: string;- }>(),- {- showProject: false,- showEngineIcon: true,- showInstance: true,- showArrow: true,- showEnvironment: true,- showProductionEnvironmentIcon: true,- tooltip: undefined,- keyword: "",- }-);-</script>diff --git a/frontend/src/components/v2/Model/cells/DatabaseNameCell.vue b/frontend/src/components/v2/Model/cells/DatabaseNameCell.vuedeleted file mode 100644index 938344b11f..0000000000--- a/frontend/src/components/v2/Model/cells/DatabaseNameCell.vue+++ /dev/null@@ -1,23 +0,0 @@-<template>- <DatabaseV1Name- :database="database"- :link="false"- tag="span"- :keyword="keyword"- />-</template>--<script setup lang="ts">-import { DatabaseV1Name } from "@/components/v2";-import type { Database } from "@/types/proto-es/v1/database_service_pb";--withDefaults(- defineProps<{- database: Database;- keyword?: string;- }>(),- {- keyword: undefined,- }-);-</script>diff --git a/frontend/src/components/v2/Model/cells/LabelsCell.vue b/frontend/src/components/v2/Model/cells/LabelsCell.vuedeleted file mode 100644index bae79fd2ac..0000000000--- a/frontend/src/components/v2/Model/cells/LabelsCell.vue+++ /dev/null@@ -1,51 +0,0 @@-<template>- <NTooltip :disabled="Object.keys(labels).length <= minimumShowCount">- <template #trigger>- <div- v-if="Object.entries(labels).length > 0"- class="flex items-center gap-x-1"- >- <div- v-for="[key, label] in displayLabels"- :key="key"- class="rounded-lg bg-gray-100 group-hover:bg-gray-200 py-0.5 px-2 text-sm"- >- {{ `${key}:${label}` }}- </div>- <span v-if="Object.keys(labels).length > minimumShowCount">...</span>- </div>- <div v-else>{{ placeholder }}</div>- </template>- <div class="text-sm flex flex-col gap-y-1">- <div v-for="[key, label] in Object.entries(labels)" :key="key">- {{ `${key}:${label}` }}- </div>- </div>- </NTooltip>-</template>--<script setup lang="ts">-import { NTooltip } from "naive-ui";-import { computed } from "vue";--const props = withDefaults(- defineProps<{- labels: {- [key: string]: string;- };- showCount: number;- placeholder?: string;- }>(),- {- placeholder: "",- }-);--const minimumShowCount = computed(() => {- return Math.max(1, props.showCount);-});--const displayLabels = computed(() => {- return Object.entries(props.labels).slice(0, minimumShowCount.value);-});-</script>diff --git a/frontend/src/components/v2/Model/cells/ProjectNameCell.vue b/frontend/src/components/v2/Model/cells/ProjectNameCell.vuedeleted file mode 100644index d69ec2f9d1..0000000000--- a/frontend/src/components/v2/Model/cells/ProjectNameCell.vue+++ /dev/null@@ -1,39 +0,0 @@-<template>- <div class="flex flex-row gap-x-2 items-center">- <ProjectV1Name- :project="project"- :link="link"- tag="div"- :keyword="keyword"- />-- <NTag v-if="project.state === State.DELETED" size="small" type="default">- {{ $t("common.archived") }}- </NTag>-- <slot name="suffix">- {{ suffix }}- </slot>- </div>-</template>--<script setup lang="ts">-import { NTag } from "naive-ui";-import { ProjectV1Name } from "@/components/v2";-import { State } from "@/types/proto-es/v1/common_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";--withDefaults(- defineProps<{- project: Project;- link?: boolean;- keyword?: string;- suffix?: string;- }>(),- {- link: false,- keyword: undefined,- suffix: "",- }-);-</script>diff --git a/frontend/src/components/v2/Model/cells/UserLink.vue b/frontend/src/components/v2/Model/cells/UserLink.vuedeleted file mode 100644index a51258d7bb..0000000000--- a/frontend/src/components/v2/Model/cells/UserLink.vue+++ /dev/null@@ -1,49 +0,0 @@-<template>- <component- :is="isLink ? 'router-link' : 'div'"- :class="isLink && 'normal-link'"- :to="{- name: WORKSPACE_ROUTE_USER_PROFILE,- params: {- principalEmail: email,- },- }"- >- <HighlightLabelText- :keyword="keyword ?? ''"- :text="title"- />- </component>-</template>--<script lang="tsx" setup>-import { computed } from "vue";-import { HighlightLabelText } from "@/components/v2";-import { WORKSPACE_ROUTE_USER_PROFILE } from "@/router/dashboard/workspaceRoutes";-import { AccountType, getAccountTypeByEmail } from "@/types";-import { hasWorkspacePermissionV2 } from "@/utils";--const props = withDefaults(- defineProps<{- email: string;- title: string;- keyword?: string;- link?: boolean;- }>(),- {- link: true,- }-);--const isEndUser = computed(- () => getAccountTypeByEmail(props.email) === AccountType.USER-);--const isLink = computed(- () =>- props.email &&- props.link &&- isEndUser.value &&- hasWorkspacePermissionV2("bb.users.get")-);-</script>\ No newline at end of filediff --git a/frontend/src/components/v2/Model/cells/UserNameCell.vue b/frontend/src/components/v2/Model/cells/UserNameCell.vuedeleted file mode 100644index 37f2ef276f..0000000000--- a/frontend/src/components/v2/Model/cells/UserNameCell.vue+++ /dev/null@@ -1,179 +0,0 @@-<template>- <div class="flex flex-row items-center" :class="gapClass">- <BBAvatar :username="avatarUsername" :email="avatarEmail" :size="avatarSize" />-- <div class="flex flex-row items-center min-w-0">- <div class="flex flex-col min-w-0">- <div class="flex flex-row items-center gap-x-1 min-w-0">- <div class="truncate" :class="isDeleted ? 'line-through' : ''">- <HighlightLabelText- v-if="onClickUser"- class="truncate max-w-40 cursor-pointer"- :keyword="keyword"- :text="user.title"- @click="onClickUser(user, $event)"- />- <UserLink- v-else- :keyword="keyword"- :title="user.title"- :email="user.email"- :link="link && getAccountTypeByEmail(user.email) === AccountType.USER"- />- </div>- <slot name="suffix">- </slot>- <NTag v-if="isDeleted" :size="tagSize" type="error" round>- {{$t("common.deleted")}}- </NTag>- <template v-else>- <NTag v-if="user.profile?.source && showSource" :size="tagSize" round type="info">- {{ user.profile.source }}- </NTag>- <NTag v-if="currentUserV1.name === user.name" :size="tagSize" round type="success">- {{ $t("common.you") }}- </NTag>- <NTag- v-if="userAccountType === AccountType.SERVICE_ACCOUNT || userAccountType === AccountType.WORKLOAD_IDENTITY"- :size="tagSize"- round- type="info"- >- {{- userAccountType === AccountType.SERVICE_ACCOUNT- ? $t("settings.members.service-account")- : $t("settings.members.workload-identity")- }}- </NTag>- <NTag v-if="user.mfaEnabled && showMfaEnabled" :size="tagSize" type="success" round>- {{ $t("two-factor.enabled") }}- </NTag>- </template>- </div>- <slot name="footer">- <NEllipsis- v-if="showEmail"- class="textinfolabel"- :line-clamp="1"- :tooltip="true"- >- <HighlightLabelText- class="truncate max-w-40"- :keyword="keyword"- :text="user.email"- />- </NEllipsis>- </slot>- </div>- <div- v-if="!isDeleted && getAccountTypeByEmail(user.email) === AccountType.SERVICE_ACCOUNT && allowEdit && hasPermission"- class="ml-3 text-xs"- >- <CopyButton- v-if="user.serviceKey"- quaternary- size="small"- :text="false"- :tertiary="true"- :content="user.serviceKey"- >- {{ $t("settings.members.copy-service-key") }}- </CopyButton>- <NButton- v-else- tertiary- size="small"- @click.prevent="$emit('reset-service-key', user)"- >- <template #icon>- <ReplyIcon class="w-4 h-4" />- </template>- {{ $t("settings.members.reset-service-key") }}- </NButton>- </div>- </div>- </div>-</template>--<script lang="ts" setup>-import { ReplyIcon } from "lucide-vue-next";-import { NButton, NEllipsis, NTag } from "naive-ui";-import { computed } from "vue";-import { BBAvatar } from "@/bbkit";-import { CopyButton, HighlightLabelText } from "@/components/v2";-import { useCurrentUserV1 } from "@/store";-import { AccountType, getAccountTypeByEmail, UNKNOWN_ID } from "@/types";-import { State } from "@/types/proto-es/v1/common_pb";-import type { User } from "@/types/proto-es/v1/user_service_pb";-import { hasWorkspacePermissionV2 } from "@/utils";-import UserLink from "./UserLink.vue";--const props = withDefaults(- defineProps<{- user: User;- allowEdit?: boolean;- keyword?: string;- size?: "tiny" | "small" | "medium";- link?: boolean;- showSource?: boolean;- showMfaEnabled?: boolean;- showEmail?: boolean;- onClickUser?: (user: User, event: MouseEvent) => void;- }>(),- {- allowEdit: true,- size: "medium",- link: true,- showSource: true,- showMfaEnabled: true,- showEmail: true,- }-);--defineEmits<{- (event: "reset-service-key", user: User): void;-}>();--const currentUserV1 = useCurrentUserV1();--const hasPermission = computed(() => {- return hasWorkspacePermissionV2("bb.serviceAccounts.update");-});--const isDeleted = computed(() => props.user.state === State.DELETED);--const tagSize = computed(() => {- if (props.size === "tiny") {- return "tiny";- }- return "small";-});--const avatarSize = computed(() => {- switch (props.size) {- case "tiny":- return "TINY";- case "small":- return "SMALL";- default:- return "NORMAL";- }-});--const avatarUsername = computed(() =>- props.user.name === `users/${UNKNOWN_ID}` ? "?" : props.user.title-);--const avatarEmail = computed(() =>- props.user.name === `users/${UNKNOWN_ID}` ? undefined : props.user.email-);--const userAccountType = computed(() => getAccountTypeByEmail(props.user.email));--const gapClass = computed(() => {- if (props.size === "tiny") {- return "gap-x-1";- }- return "gap-x-2";-});-</script>diff --git a/frontend/src/components/v2/Model/cells/index.ts b/frontend/src/components/v2/Model/cells/index.tsdeleted file mode 100644index 72d0246f1a..0000000000--- a/frontend/src/components/v2/Model/cells/index.ts+++ /dev/null@@ -1,13 +0,0 @@-import DatabaseNameCell from "./DatabaseNameCell.vue";-import LabelsCell from "./LabelsCell.vue";-import ProjectNameCell from "./ProjectNameCell.vue";-import UserNameCell from "./UserNameCell.vue";-import UserLink from "./UserLink.vue";--export {- DatabaseNameCell,- LabelsCell,- ProjectNameCell,- UserNameCell,- UserLink,-};diff --git a/frontend/src/components/v2/Model/index.ts b/frontend/src/components/v2/Model/index.tsdeleted file mode 100644index b7637d98c2..0000000000--- a/frontend/src/components/v2/Model/index.ts+++ /dev/null@@ -1,22 +0,0 @@-import DatabaseV1Name from "./DatabaseV1Name.vue";-import DatabaseView from "./DatabaseView.vue";-import EnvironmentV1Name from "./EnvironmentV1Name.vue";-import HighlightLabelText from "./HighlightLabelText.vue";-import RichEngineName from "./Instance/RichEngineName.vue";-import ProductionEnvironmentV1Icon from "./ProductionEnvironmentV1Icon.vue";-import ProjectV1Name from "./ProjectV1Name.vue";-import RichDatabaseName from "./RichDatabaseName.vue";--export * from "./Instance";-export * from "./Plan";-export * from "./DatabaseV1Table";-export {- DatabaseV1Name,- RichDatabaseName,- EnvironmentV1Name,- ProductionEnvironmentV1Icon,- ProjectV1Name,- DatabaseView,- RichEngineName,- HighlightLabelText,-};diff --git a/frontend/src/components/v2/Model/utils.ts b/frontend/src/components/v2/Model/utils.tsdeleted file mode 100644index e9812a00ec..0000000000--- a/frontend/src/components/v2/Model/utils.ts+++ /dev/null@@ -1,29 +0,0 @@-import { type DataTableColumn, type DataTableSortState } from "naive-ui";--export const mapSorterStatus = <T>(- columns: DataTableColumn<T>[],- sorters?: DataTableSortState[]-): DataTableColumn<T>[] => {- if (!sorters) {- return columns;- }-- return columns.map((column) => {- if (column.type) {- return column;- }- const sorterIndex = sorters.findIndex(- (s) => s.columnKey === column.key.toString()- );- if (sorterIndex < 0) {- return column;- }- return {- ...column,- sorter: {- multiple: sorterIndex,- },- sortOrder: sorters[sorterIndex].order,- };- });-};diff --git a/frontend/src/components/v2/Select/AccountSelect.vue b/frontend/src/components/v2/Select/AccountSelect.vuedeleted file mode 100644index 3147397ce1..0000000000--- a/frontend/src/components/v2/Select/AccountSelect.vue+++ /dev/null@@ -1,523 +0,0 @@-<template>- <div>- <RemoteResourceSelector- ref="remoteResourceSelectorRef"- v-bind="$attrs"- :multiple="multiple"- :disabled="disabled"- :size="size"- :value="value"- :tag="true"- :remote="true"- :additional-options="additionalOptions"- :render-label="renderLabel"- :render-tag="renderTag"- :search="handleSearch"- @update:value="(val) => $emit('update:value', val)"- />- <div v-if="errorMessage" class="text-red-600 mt-0.5">- {{ errorMessage }}- </div>- </div>-</template>--<script lang="tsx" setup>-import { create } from "@bufbuild/protobuf";-import { computedAsync } from "@vueuse/core";-import { computed, ref } from "vue";-import type { ComponentExposed } from "vue-component-type-helpers";-import { useI18n } from "vue-i18n";-import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";-import { HighlightLabelText } from "@/components/v2";-import { UserNameCell } from "@/components/v2/Model/cells";-import {- ensureGroupIdentifier,- ensureServiceAccountFullName,- ensureWorkloadIdentityFullName,- extractServiceAccountId,- extractWorkloadIdentityId,- getUserFullNameByType,- groupNamePrefix,- serviceAccountToUser,- useGroupStore,- useServiceAccountStore,- useUserStore,- useWorkloadIdentityStore,- workloadIdentityToUser,-} from "@/store";-import {- AccountType,- allUsersUser,- getAccountTypeByEmail,- getAccountTypeByFullname,- unknownGroup,-} from "@/types";-import type { Group } from "@/types/proto-es/v1/group_service_pb";-import { ServiceAccountSchema } from "@/types/proto-es/v1/service_account_service_pb";-import { WorkloadIdentitySchema } from "@/types/proto-es/v1/workload_identity_service_pb";-import { hasWorkspacePermissionV2 } from "@/utils";-import { extractGrpcErrorMessage } from "@/utils/connect";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,- searchUsersWithFallback,- type UserResource,-} from "./RemoteResourceSelector/utils";--interface AccountResource {- type: "user" | "group";- name: string;- resource: Group | UserResource;-}--const props = defineProps<{- multiple?: boolean;- disabled?: boolean;- size?: SelectSize;- value?: string | string[] | undefined; // fullname- projectName?: string;- // allUsers is a special user that represents all users in the project.- includeAllUsers: boolean;- includeServiceAccount: boolean;- includeWorkloadIdentity: boolean;- // When true, allow typing arbitrary emails that don't match existing users.- // Used in SaaS mode to invite users who haven't signed up yet.- allowArbitraryEmail?: boolean;-}>();--defineEmits<{- // the value is the fullname, for example:- // users/{email}, groups/{email}, workloadIdentities/{email}, serviceAccounts/{email}- (event: "update:value", value: string[] | string | undefined): void;-}>();--const { t } = useI18n();-const combinedPageToken = ref<{- user: string;- group: string;-}>({- user: "",- group: "",-});-const errorMessage = ref<string | undefined>();-const remoteResourceSelectorRef =- ref<ComponentExposed<typeof RemoteResourceSelector<AccountResource>>>();--const userStore = useUserStore();-const groupStore = useGroupStore();-const serviceAccountStore = useServiceAccountStore();-const workloadIdentityStore = useWorkloadIdentityStore();--const hasListGroupPermission = computed(() =>- hasWorkspacePermissionV2("bb.groups.list")-);-const hasGetWorkloadIdentityPermission = computed(() =>- hasWorkspacePermissionV2("bb.workloadIdentities.get")-);-const hasGetServiceAccountPermission = computed(() =>- hasWorkspacePermissionV2("bb.serviceAccounts.get")-);--const getUserOption = (- user: UserResource-): ResourceSelectOption<AccountResource> => ({- resource: {- type: "user",- name: getUserFullNameByType(user),- resource: user,- },- value: getUserFullNameByType(user),- label: user.title,-});--const getGroupOption = (- group: Group-): ResourceSelectOption<AccountResource> => ({- resource: {- type: "group",- name: group.name,- resource: group,- },- value: group.name,- label: group.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<AccountResource>[] = [];- if (props.includeAllUsers) {- options.push(getUserOption(allUsersUser()));- }-- let values: string[] = [];- if (Array.isArray(props.value)) {- values = props.value;- } else if (props.value) {- values = [props.value];- }-- const groupNames: string[] = [];- const userNames: string[] = [];- for (const fullname of values) {- if (fullname.startsWith(groupNamePrefix)) {- groupNames.push(fullname);- continue;- }- const userType = getAccountTypeByFullname(fullname);- switch (userType) {- case AccountType.SERVICE_ACCOUNT:- if (!hasGetServiceAccountPermission.value) {- continue;- }- const sa = await serviceAccountStore.getOrFetchServiceAccount(- fullname,- true- );- options.push(getUserOption(serviceAccountToUser(sa)));- break;- case AccountType.WORKLOAD_IDENTITY:- if (!hasGetWorkloadIdentityPermission.value) {- continue;- }- const wi = await workloadIdentityStore.getOrFetchWorkloadIdentity(- fullname,- true- );- options.push(getUserOption(workloadIdentityToUser(wi)));- break;- default:- userNames.push(fullname);- break;- }- }-- const groups = await groupStore.batchGetOrFetchGroups(groupNames);- for (const group of groups) {- if (group) {- options.push(getGroupOption(group));- }- }-- // Ensure users are fetched into store- await userStore.batchGetOrFetchUsers(userNames);- // Get all users from store- for (const email of userNames) {- const user = userStore.getUserByIdentifier(email);- if (user) {- options.push(getUserOption(user));- }- }-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- errorMessage.value = undefined;- if (!params.pageToken) {- combinedPageToken.value = {- user: "",- group: "",- };- }-- try {- const resp = await fetchAccounts(params);- return resp;- } catch (error) {- errorMessage.value = extractGrpcErrorMessage(error);- return {- nextPageToken: "",- options: [],- };- } finally {- if (errorMessage.value) {- setTimeout(() => remoteResourceSelectorRef.value?.close(), 500);- }- }-};--const fetchAccounts = async (params: {- search: string;- pageToken: string;- pageSize: number;-}): Promise<{- nextPageToken: string;- options: ResourceSelectOption<AccountResource>[];-}> => {- let userType = getAccountTypeByFullname(params.search);- if (userType === AccountType.USER) {- // If the params.search doesn't have the prefix,- // we will try to guess the type by email suffix.- userType = getAccountTypeByEmail(params.search);- }- switch (userType) {- case AccountType.SERVICE_ACCOUNT:- if (!props.includeServiceAccount) {- return {- nextPageToken: "",- options: [],- };- }- if (!hasGetServiceAccountPermission.value) {- const email = extractServiceAccountId(params.search);- return {- nextPageToken: "",- options: [- getUserOption(- serviceAccountToUser(- create(ServiceAccountSchema, {- name: ensureServiceAccountFullName(params.search),- email: email,- title: email.split("@")[0],- })- )- ),- ],- };- }-- const sa = await serviceAccountStore.getOrFetchServiceAccount(- params.search,- true- );- return {- nextPageToken: "",- options: [getUserOption(serviceAccountToUser(sa))],- };- case AccountType.WORKLOAD_IDENTITY:- if (!props.includeWorkloadIdentity) {- return {- nextPageToken: "",- options: [],- };- }- if (!hasGetWorkloadIdentityPermission.value) {- const email = extractWorkloadIdentityId(params.search);- return {- nextPageToken: "",- options: [- getUserOption(- workloadIdentityToUser(- create(WorkloadIdentitySchema, {- name: ensureWorkloadIdentityFullName(params.search),- email: email,- title: email.split("@")[0],- })- )- ),- ],- };- }-- const wi = await workloadIdentityStore.getOrFetchWorkloadIdentity(- params.search,- true- );- return {- nextPageToken: "",- options: [getUserOption(workloadIdentityToUser(wi))],- };- default:- }-- const requests: Promise<ResourceSelectOption<AccountResource>[]>[] = [];-- if (!params.pageToken) {- requests.push(- handleSearchUser({- search: params.search,- pageToken: "",- pageSize: params.pageSize,- }),- handleSearchGroup({- search: params.search,- pageToken: "",- pageSize: params.pageSize,- })- );- } else {- if (combinedPageToken.value.user) {- requests.push(- handleSearchUser({- search: params.search,- pageToken: combinedPageToken.value.user,- pageSize: params.pageSize,- })- );- }- if (combinedPageToken.value.group) {- requests.push(- handleSearchGroup({- search: params.search,- pageToken: combinedPageToken.value.group,- pageSize: params.pageSize,- })- );- }- }-- const responses = await Promise.all(requests);- return {- nextPageToken:- combinedPageToken.value.user || combinedPageToken.value.group,- options: responses.reduce((resp, list) => {- resp.push(...list);- return resp;- }, []),- };-};--const handleSearchUser = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { users, nextPageToken } = await searchUsersWithFallback({- ...params,- project: props.projectName,- allowArbitraryEmail: props.allowArbitraryEmail,- });-- combinedPageToken.value.user = nextPageToken;- return users.map((user) => getUserOption(user));- // if (!hasListUserPermission.value) {- // return [getUserOption(unknownUser(ensureUserFullName(params.search)))];- // }-- // const { nextPageToken, users } = await userStore.fetchUserList({- // filter: {- // query: params.search,- // project: props.projectName,- // },- // pageToken: params.pageToken,- // pageSize: params.pageSize,- // });- // combinedPageToken.value.user = nextPageToken;- // const options = users.map((user) => getUserOption(user));-- // // In SaaS mode (allowArbitraryEmail), if no existing user matches and the- // // search looks like an email, offer it as a selectable option so admins- // // can add emails for users who haven't signed up yet.- // if (- // props.allowArbitraryEmail &&- // options.length === 0 &&- // !params.pageToken &&- // isValidEmail(params.search)- // ) {- // const fullname = ensureUserFullName(params.search);- // const user = {- // ...unknownUser(fullname),- // email: params.search,- // title: params.search,- // };- // const option = getUserOption(user, true /* isExternal */);- // options.push(option);- // }-- // return options;-};--const handleSearchGroup = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- if (- !hasListGroupPermission.value &&- params.search.startsWith(groupNamePrefix)- ) {- return [getGroupOption(unknownGroup(ensureGroupIdentifier(params.search)))];- }-- const { nextPageToken, groups } = await groupStore.fetchGroupList({- filter: {- query: params.search,- project: props.projectName,- },- pageToken: params.pageToken,- pageSize: params.pageSize,- });- combinedPageToken.value.group = nextPageToken;- return groups.map(getGroupOption);-};--const customLabel = (- resource: AccountResource,- keyword: string,- showName: boolean-) => {- if (resource.type === "group") {- return (- <GroupNameCell- showName={showName}- group={resource.resource as Group}- showIcon={false}- link={false}- keyword={keyword}- />- );- }-- const user = resource.resource as UserResource;- if (user.isExternal) {- return (- <div class="flex items-center gap-x-2 w-full py-0.5">- <HighlightLabelText keyword={keyword} text={user.email} />- <span class="ml-auto text-xs text-gray-400 whitespace-nowrap">- {t("settings.members.not-a-member")}- </span>- </div>- );- }-- return (- <UserNameCell- user={user}- allowEdit={false}- showMfaEnabled={false}- showSource={false}- showEmail={showName}- link={false}- size="small"- keyword={keyword}- onClickUser={() => {}}- >- {{- suffix: () =>- !showName && (- <span class="textinfolabel truncate">- (<HighlightLabelText keyword={keyword} text={user.email} />)- </span>- ),- }}- </UserNameCell>- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel: (resource: AccountResource, keyword: string) =>- customLabel(resource, keyword, true),- showResourceName: false,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel: (resource: AccountResource, keyword: string) =>- customLabel(resource, keyword, false),- });-});-</script>diff --git a/frontend/src/components/v2/Select/AnnouncementLevelSelect.vue b/frontend/src/components/v2/Select/AnnouncementLevelSelect.vuedeleted file mode 100644index 4ae1812c0e..0000000000--- a/frontend/src/components/v2/Select/AnnouncementLevelSelect.vue+++ /dev/null@@ -1,52 +0,0 @@-<template>- <NRadioGroup- :value="level"- :disabled="!allowEdit"- @update:value="$emit('update:level', $event)"- >- <NRadio- v-for="item in [- Announcement_AlertLevel.INFO,- Announcement_AlertLevel.WARNING,- Announcement_AlertLevel.CRITICAL,- ]"- :key="item"- :value="item"- >- {{- $t(- `dynamic.settings.general.workspace.announcement-alert-level.field.${AlertLevelToString(- item- ).toLowerCase()}`- )- }}- </NRadio>- </NRadioGroup>-</template>--<script setup lang="ts">-import { NRadio, NRadioGroup } from "naive-ui";-import { Announcement_AlertLevel } from "@/types/proto-es/v1/setting_service_pb";--defineProps<{- level?: Announcement_AlertLevel;- allowEdit: boolean;-}>();--defineEmits<{- (event: "update:level", level: Announcement_AlertLevel): void;-}>();--const AlertLevelToString = (level: Announcement_AlertLevel): string => {- switch (level) {- case Announcement_AlertLevel.INFO:- return "INFO";- case Announcement_AlertLevel.WARNING:- return "WARNING";- case Announcement_AlertLevel.CRITICAL:- return "CRITICAL";- default:- return "INFO";- }-};-</script>diff --git a/frontend/src/components/v2/Select/DatabaseSelect.vue b/frontend/src/components/v2/Select/DatabaseSelect.vuedeleted file mode 100644index f24a1eb3c9..0000000000--- a/frontend/src/components/v2/Select/DatabaseSelect.vue+++ /dev/null@@ -1,136 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- class="bb-database-select"- :multiple="multiple"- :disabled="disabled"- :size="size"- :value="value"- :render-label="renderLabel"- :render-tag="renderTag"- :additional-options="additionalOptions"- :search="handleSearch"- :filter="filter"- @update:value="(val) => $emit('update:value', val)"- />-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { computed } from "vue";-import { RichDatabaseName } from "@/components/v2";-import { useActuatorV1Store, useDatabaseV1Store } from "@/store";-import { type Engine } from "@/types/proto-es/v1/common_pb";-import type { Database } from "@/types/proto-es/v1/database_service_pb";-import { extractDatabaseResourceName } from "@/utils";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const props = withDefaults(- defineProps<{- value?: string | string[] | undefined;- environmentName?: string;- projectName?: string;- allowedEngineTypeList?: Engine[];- filter?: (database: Database) => boolean;- multiple?: boolean;- disabled?: boolean;- size?: SelectSize;- showInstance?: boolean;- }>(),- {- // empty equals no limit.- allowedEngineTypeList: () => [],- showInstance: true,- }-);--defineEmits<{- (event: "update:value", value: string[] | string | undefined): void;-}>();--const databaseStore = useDatabaseV1Store();-const actuatorStore = useActuatorV1Store();--const getOption = (db: Database) => {- return {- resource: db,- value: db.name,- label: extractDatabaseResourceName(db.name).databaseName,- };-};--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<Database>[] = [];-- let databaseNames: string[] = [];- if (Array.isArray(props.value)) {- databaseNames = props.value;- } else if (props.value) {- databaseNames = [props.value];- }-- const databases = await databaseStore.batchGetOrFetchDatabases(databaseNames);- options.push(...databases.map(getOption));-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { databases, nextPageToken } = await databaseStore.fetchDatabases({- parent: props.projectName ?? actuatorStore.workspaceResourceName,- filter: {- environment: props.environmentName,- engines: props.allowedEngineTypeList,- query: params.search,- },- pageToken: params.pageToken,- pageSize: params.pageSize,- silent: true,- });- return {- nextPageToken,- options: databases.map(getOption),- };-};--const customLabel = (database: Database, keyword: string) => {- return (- <RichDatabaseName- database={database}- keyword={keyword}- showProject={false}- showInstance={props.showInstance}- showArrow={props.showInstance}- />- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: true,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>diff --git a/frontend/src/components/v2/Select/EnvironmentSelect.vue b/frontend/src/components/v2/Select/EnvironmentSelect.vuedeleted file mode 100644index 0d9f94810a..0000000000--- a/frontend/src/components/v2/Select/EnvironmentSelect.vue+++ /dev/null@@ -1,140 +0,0 @@-<template>- <NSelect- v-bind="$attrs"- :filterable="true"- :virtual-scroll="true"- :placeholder="t('environment.select')"- :multiple="multiple"- :disabled="disabled || !hasPermission"- :size="size"- :value="value"- :options="options"- :render-label="renderLabel"- :render-tag="renderTag"- :filter="filterEnvironment"- :consistent-menu-width="true"- class="bb-environment-select"- @update:value="(val) => $emit('update:value', val)"- />-</template>--<script lang="tsx" setup>-import type { SelectOption } from "naive-ui";-import { NSelect } from "naive-ui";-import type { SelectBaseOption } from "naive-ui/lib/select/src/interface";-import { computed, type VNodeChild } from "vue";-import { useI18n } from "vue-i18n";-import { useEnvironmentV1Store } from "@/store";-import { formatEnvironmentName } from "@/types";-import type { Environment } from "@/types/v1/environment";-import { hasWorkspacePermissionV2 } from "@/utils";-import { EnvironmentV1Name } from "../Model";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const { t } = useI18n();--const props = withDefaults(- defineProps<{- value?: string[] | string | undefined;- includeArchived?: boolean;- showProductionIcon?: boolean;- multiple?: boolean;- disabled?: boolean;- size?: SelectSize;- filter?: (environment: Environment) => boolean;- renderSuffix?: (environment: Environment) => VNodeChild;- }>(),- {- showProductionIcon: true,- }-);--defineEmits<{- (event: "update:value", name: string[] | string | undefined): void;-}>();--const environmentV1Store = useEnvironmentV1Store();--const hasPermission = computed(() =>- hasWorkspacePermissionV2("bb.settings.getEnvironment")-);--const rawEnvironmentList = computed(() => {- return environmentV1Store.environmentList;-});--const combinedEnvironmentList = computed(() => {- let list = rawEnvironmentList.value;- if (props.filter) {- list = list.filter(props.filter);- }-- return list;-});--const options = computed(() => {- return combinedEnvironmentList.value.map<ResourceSelectOption<Environment>>(- (environment) => {- return {- resource: environment,- value: formatEnvironmentName(environment.id),- label: environment.title,- };- }- );-});--const customLabel = (environment: Environment) => {- return (- <div class="flex items-center gap-x-2">- <EnvironmentV1Name- environment={environment}- showIcon={props.showProductionIcon}- link={false}- />- {props.renderSuffix ? props.renderSuffix(environment) : null}- </div>- );-};--const renderLabel = (option: SelectOption, selected: boolean) =>- getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: true,- })(option as ResourceSelectOption<Environment>, selected, "");--const renderTag = ({- option,- handleClose,-}: {- option: SelectBaseOption;- handleClose: () => void;-}) => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- })({- option: option as ResourceSelectOption<Environment>,- handleClose,- });-};--const filterEnvironment = (pattern: string, option: SelectOption) => {- const { value, label } = option;- const search = pattern.trim().toLowerCase();- return (- (value as string).toLowerCase().includes(search) ||- (label as string).toLowerCase().includes(search)- );-};-</script>diff --git a/frontend/src/components/v2/Select/GroupSelect.vue b/frontend/src/components/v2/Select/GroupSelect.vuedeleted file mode 100644index 37d3bb440a..0000000000--- a/frontend/src/components/v2/Select/GroupSelect.vue+++ /dev/null@@ -1,120 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- :value="value"- :disabled="disabled"- :multiple="multiple"- :size="size"- :render-label="renderLabel"- :render-tag="renderTag"- :additional-options="additionalOptions"- :search="handleSearch"- @update:value="(val) => $emit('update:value', val)"- />-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { computed } from "vue";-import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";-import { useGroupStore } from "@/store";-import type { Group } from "@/types/proto-es/v1/group_service_pb";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const props = defineProps<{- value?: string[] | string | undefined;- disabled?: boolean;- multiple?: boolean;- projectName?: string;- size?: SelectSize;-}>();--defineEmits<{- (event: "update:value", val: string[] | string | undefined): void;-}>();--const groupStore = useGroupStore();--const getOption = (group: Group): ResourceSelectOption<Group> => ({- resource: group,- value: group.name,- label: group.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<Group>[] = [];-- let groupNames: string[] = [];- if (Array.isArray(props.value)) {- groupNames = props.value;- } else if (props.value) {- groupNames = [props.value];- }-- const groups = await groupStore.batchGetOrFetchGroups(groupNames);- for (const group of groups) {- if (group) {- options.push(getOption(group));- }- }-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { groups, nextPageToken } = await groupStore.fetchGroupList({- filter: {- query: params.search,- project: props.projectName,- },- pageToken: params.pageToken,- pageSize: params.pageSize,- });-- return {- nextPageToken,- options: groups.map(getOption),- };-};--const customLabel = (group: Group, keyword: string) => {- return (- <GroupNameCell- showName={false}- group={group}- showIcon={false}- link={false}- keyword={keyword}- />- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: true,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>diff --git a/frontend/src/components/v2/Select/InstanceSelect.vue b/frontend/src/components/v2/Select/InstanceSelect.vuedeleted file mode 100644index 5de57db0d3..0000000000--- a/frontend/src/components/v2/Select/InstanceSelect.vue+++ /dev/null@@ -1,160 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- :multiple="false"- :disabled="disabled"- :size="size"- :value="value"- :render-label="renderLabel"- :render-tag="renderTag"- :consistent-menu-width="false"- class="bb-instance-select"- :additional-options="additionalOptions"- :search="handleSearch"- @update:value="(val) => $emit('update:value', val as (string | undefined))"- />-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { ChevronRightIcon } from "lucide-vue-next";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { EnvironmentV1Name, InstanceV1Name } from "@/components/v2";-import { useEnvironmentV1Store, useInstanceV1Store } from "@/store";-import {- isValidInstanceName,- UNKNOWN_INSTANCE_NAME,- unknownInstance,-} from "@/types";-import { type Engine } from "@/types/proto-es/v1/common_pb";-import type { Instance } from "@/types/proto-es/v1/instance_service_pb";-import { supportedEngineV1List } from "@/utils";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const props = withDefaults(- defineProps<{- value?: string | undefined;- environmentName?: string;- projectName?: string;- allowedEngineList?: Engine[];- disabled?: boolean;- size?: SelectSize;- }>(),- {- allowedEngineList: () => supportedEngineV1List(),- }-);--defineEmits<{- (event: "update:value", value: string | undefined): void;-}>();--const { t } = useI18n();-const instanceStore = useInstanceV1Store();-const environmentStore = useEnvironmentV1Store();--const getOption = (instance: Instance): ResourceSelectOption<Instance> => ({- resource: instance,- value: instance.name,- label: instance.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<Instance>[] = [];- if (props.value === UNKNOWN_INSTANCE_NAME) {- const dummyAll = {- ...unknownInstance(),- title: t("instance.all"),- };- options.push(getOption(dummyAll));- }-- if (isValidInstanceName(props.value)) {- const instance = await instanceStore.getOrFetchInstanceByName(props.value);- options.push(getOption(instance));- }- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { instances, nextPageToken } = await instanceStore.fetchInstanceList({- pageToken: params.pageToken,- pageSize: params.pageSize,- filter: {- engines: props.allowedEngineList,- query: params.search,- environment: props.environmentName,- project: props.projectName,- },- silent: true,- });-- return {- nextPageToken,- options: instances.map(getOption),- };-};--const customLabel = (instance: Instance, keyword: string) => {- const isUnknown = instance.name === UNKNOWN_INSTANCE_NAME;- const environment = environmentStore.getEnvironmentByName(- instance.environment ?? ""- );-- return (- <div class="flex items-center gap-x-1">- {isUnknown ? null : (- <EnvironmentV1Name- environment={environment}- plain={true}- link={false}- />- )}- {isUnknown ? null : <ChevronRightIcon class="w-3" />}- <InstanceV1Name- instance={instance}- keyword={keyword}- plain={true}- link={false}- />- </div>- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: false,- customLabel,- showResourceName: true,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: false,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>--<style lang="postcss" scoped>-.bb-instance-select- :deep(.n-base-selection--active .bb-instance-select--engine-icon) {- opacity: 0.3;-}-</style>diff --git a/frontend/src/components/v2/Select/ProjectSelect.vue b/frontend/src/components/v2/Select/ProjectSelect.vuedeleted file mode 100644index de867bc5f9..0000000000--- a/frontend/src/components/v2/Select/ProjectSelect.vue+++ /dev/null@@ -1,141 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- :multiple="multiple"- :disabled="disabled"- :size="size"- :value="value"- :render-label="renderLabel"- :render-tag="renderTag"- class="bb-project-select"- :additional-options="additionalOptions"- :search="handleSearch"- :filter="filter"- @update:value="(val) => $emit('update:value', val)"- >- <template v-if="$slots.empty" #empty>- <slot name="empty" />- </template>- </RemoteResourceSelector>-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { computed, type VNodeChild } from "vue";-import { useI18n } from "vue-i18n";-import { ProjectNameCell } from "@/components/v2/Model/cells";-import { useProjectV1Store } from "@/store";-import {- isDefaultProject,- UNKNOWN_PROJECT_NAME,- unknownProject,-} from "@/types";-import type { Project } from "@/types/proto-es/v1/project_service_pb";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const props = defineProps<{- disabled?: boolean;- value?: string[] | string | undefined; // UNKNOWN_PROJECT_NAME to "ALL"- includeAll?: boolean;- includeDefaultProject?: boolean;- multiple?: boolean;- size?: SelectSize;- renderSuffix?: (project: Project) => VNodeChild;- filter?: (project: Project) => boolean;-}>();--defineEmits<{- (event: "update:value", name: string[] | string | undefined): void;-}>();--const { t } = useI18n();-const projectStore = useProjectV1Store();--const getOption = (project: Project): ResourceSelectOption<Project> => ({- resource: project,- value: project.name,- label: isDefaultProject(project.name)- ? t("common.unassigned")- : project.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<Project>[] = [];-- let projectNames: string[] = [];- if (Array.isArray(props.value)) {- projectNames = props.value;- } else if (props.value) {- projectNames = [props.value];- }-- if (projectNames.includes(UNKNOWN_PROJECT_NAME) || props.includeAll) {- const dummyAll = {- ...unknownProject(),- title: t("project.all"),- };- options.unshift(getOption(dummyAll));- }-- const projects = await projectStore.batchGetOrFetchProjects(projectNames);- options.push(...projects.map(getOption));-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { projects, nextPageToken } = await projectStore.fetchProjectList({- filter: {- query: params.search,- excludeDefault: !props.includeDefaultProject,- },- pageToken: params.pageToken,- pageSize: params.pageSize,- });-- return {- nextPageToken,- options: projects.map(getOption),- };-};--const customLabel = (project: Project, keyword: string) => {- if (!project) return null;- return (- <ProjectNameCell project={project} keyword={keyword}>- {{- suffix: () => (props.renderSuffix ? props.renderSuffix(project) : null),- }}- </ProjectNameCell>- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: true,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>diff --git a/frontend/src/components/v2/Select/RemoteResourceSelector/index.vue b/frontend/src/components/v2/Select/RemoteResourceSelector/index.vuedeleted file mode 100644index 31dbcd3a6f..0000000000--- a/frontend/src/components/v2/Select/RemoteResourceSelector/index.vue+++ /dev/null@@ -1,218 +0,0 @@-<template>- <NSelect- v-bind="$attrs"- v-model:show="show"- :loading="isLoadingNextPage"- :filterable="true"- :clearable="true"- :remote="remote"- :virtual-scroll="true"- :multiple="multiple"- :value="value"- :disabled="disabled"- :options="options"- :fallback-option="fallbackOption"- :render-label="customLabel"- :render-tag="customTag"- :placeholder="placeholder ?? $t('common.search-for-more')"- :size="size"- :consistent-menu-width="consistentMenuWidth"- :reset-menu-on-options-change="false"- @search="handleSearch"- @click="onSelectorOpen"- @update:value="$emit('update:value', $event)"- >- <template #empty>- <slot name="empty">- <BBSpin v-if="isLoadingNextPage" />- </slot>- </template>- <template #action>- <NButton- v-if="pageToken"- class="w-full!"- quaternary- :loading="isLoadingNextPage"- @click="() => onNextPage(true)">- {{ $t("common.load-more") }}- </NButton>- </template>- </NSelect>-</template>--<script lang="tsx" setup generic="T">-import { useDebounceFn } from "@vueuse/core";-import type { SelectOption } from "naive-ui";-import { NButton, NSelect } from "naive-ui";-import type { SelectBaseOption } from "naive-ui/lib/select/src/interface";-import { computed, nextTick, type Ref, ref, type VNodeChild, watch } from "vue";-import { BBSpin } from "@/bbkit";-import { DEBOUNCE_SEARCH_DELAY } from "@/types";-import { getDefaultPagination } from "@/utils";-import type { ResourceSelectOption, SelectSize } from "./types";--const props = withDefaults(- defineProps<{- remote?: boolean;- placeholder?: string;- multiple?: boolean;- disabled?: boolean;- value?: string[] | string | undefined;- consistentMenuWidth?: boolean;- size?: SelectSize;- additionalOptions?: ResourceSelectOption<T>[];- renderLabel?: (- option: ResourceSelectOption<T>,- selected: boolean,- searchText: string- ) => VNodeChild;- renderTag?: (props: {- option: ResourceSelectOption<T>;- handleClose: () => void;- }) => VNodeChild;- filter?: (resource: T) => boolean;- search?: (params: {- search: string;- pageToken: string;- pageSize: number;- }) => Promise<{- nextPageToken: string | undefined;- options: ResourceSelectOption<T>[];- }>;- fallbackOption?: false | ((value: string) => ResourceSelectOption<T>);- filterable?: boolean;- }>(),- {- remote: true,- fallbackOption: false,- consistentMenuWidth: true,- filterable: true,- additionalOptions: () => [],- }-);--const emit = defineEmits<{- (event: "update:value", value: string[] | string | undefined): void;- (event: "open"): void;-}>();--const isLoadingNextPage = ref(false);-const pageToken = ref<string | undefined>("");-const searchText = ref("");-const show = ref(false);-const rawOptions = ref([]) as Ref<ResourceSelectOption<T>[]>;--const appendDataToRawList = (- data: ResourceSelectOption<T>[],- unshift: boolean = false-) => {- for (const item of data) {- if (!rawOptions.value.find((raw) => raw.value === item.value)) {- if (unshift) {- rawOptions.value.unshift(item);- } else {- rawOptions.value.push(item);- }- }- }-};--watch(- [- () => props.additionalOptions,- () => isLoadingNextPage.value,- () => searchText.value,- ],- ([additionalOptions, isLoadingNextPage, searchText]) => {- if (!isLoadingNextPage && !searchText) {- appendDataToRawList(additionalOptions, true);- }- },- { deep: true }-);--const onNextPage = async (openOptions: boolean) => {- if (!props.search) {- return;- }- isLoadingNextPage.value = true;- const { nextPageToken, options } = await props.search({- pageToken: pageToken.value ?? "",- pageSize: getDefaultPagination(),- search: searchText.value,- });-- if (!pageToken.value) {- rawOptions.value = options;- } else {- appendDataToRawList(options);- }-- pageToken.value = nextPageToken;- isLoadingNextPage.value = false;-- if (openOptions) {- nextTick(() => (show.value = true));- }-};--const onSelectorOpen = async () => {- if (props.disabled) {- return;- }- await handleSearch("");- emit("open");-};--const handleSearch = useDebounceFn(- async (search: string, openOptions: boolean = true) => {- searchText.value = search.trim();- pageToken.value = "";- await onNextPage(openOptions);- },- DEBOUNCE_SEARCH_DELAY-);--const customLabel = computed(() => {- const renderLabel = props.renderLabel;- if (renderLabel) {- return (option: SelectOption, selected: boolean) =>- renderLabel(- option as ResourceSelectOption<T>,- selected,- searchText.value- );- }- return undefined;-});--const customTag = computed(() => {- const renderTag = props.renderTag;- if (renderTag) {- return (params: { option: SelectBaseOption; handleClose: () => void }) =>- renderTag({- option: params.option as ResourceSelectOption<T>,- handleClose: params.handleClose,- });- }- return undefined;-});--const options = computed((): ResourceSelectOption<T>[] => {- const filter = props.filter;- if (!filter) {- return rawOptions.value;- }- return rawOptions.value.filter((raw) => raw.resource && filter(raw.resource));-});--defineExpose({- reset: async () => {- await handleSearch("", false);- },- options,- close: () => {- nextTick(() => (show.value = false));- },-});-</script>diff --git a/frontend/src/components/v2/Select/RemoteResourceSelector/utils.tsx b/frontend/src/components/v2/Select/RemoteResourceSelector/utils.tsxdeleted file mode 100644index 67bf478876..0000000000--- a/frontend/src/components/v2/Select/RemoteResourceSelector/utils.tsx+++ /dev/null@@ -1,142 +0,0 @@-import { NCheckbox, NTag } from "naive-ui";-import { type VNodeChild } from "vue";-import EllipsisText from "@/components/EllipsisText.vue";-import { HighlightLabelText } from "@/components/v2";-import { useUserStore } from "@/store";-import { unknownUser } from "@/types";-import type { User } from "@/types/proto-es/v1/user_service_pb";-import {- ensureUserFullName,- hasWorkspacePermissionV2,- isValidEmail,-} from "@/utils";-import type { ResourceSelectOption, SelectSize } from "./types";--export const getRenderLabelFunc =- <T extends { name: string }>(params: {- showResourceName?: boolean;- multiple?: boolean;- customLabel?: (resource: T, keyword: string) => VNodeChild;- }) =>- (option: ResourceSelectOption<T>, selected: boolean, searchText: string) => {- const { resource, label } = option;- const node = (- <div class="py-1">- {params.customLabel && resource ? (- params.customLabel(resource, searchText)- ) : (- <HighlightLabelText keyword={searchText} text={label} />- )}- {params.showResourceName && resource && (- <div>- <EllipsisText class="opacity-60 textinfolabel">- <HighlightLabelText keyword={searchText} text={resource.name} />- </EllipsisText>- </div>- )}- </div>- );- if (params.multiple) {- return (- <div class="flex items-center gap-x-2 py-2">- <NCheckbox checked={selected} size="small" />- {node}- </div>- );- }-- return node;- };--export const getRenderTagFunc =- <T,>(params: {- multiple?: boolean;- size?: SelectSize;- disabled?: boolean;- customLabel?: (resource: T, keyword: string) => VNodeChild;- }) =>- ({- option,- handleClose,- }: {- option: ResourceSelectOption<T>;- handleClose: () => void;- }) => {- const { resource, label } = option;- const node =- params.customLabel && resource ? params.customLabel(resource, "") : label;- if (params.multiple) {- return (- <NTag- size={params.size}- closable={!params.disabled}- onClose={handleClose}- >- {node}- </NTag>- );- }- return node;- };--export interface UserResource extends User {- // True for emails not yet registered as Bytebase users.- isExternal?: boolean;-}--export const searchUsersWithFallback = async (params: {- search: string;- project?: string;- pageToken: string;- pageSize: number;- allowArbitraryEmail?: boolean;-}): Promise<{- users: UserResource[];- nextPageToken: string;-}> => {- const hasListUserPermission = hasWorkspacePermissionV2("bb.users.list");-- if (!hasListUserPermission) {- return {- users: [unknownUser(ensureUserFullName(params.search))],- nextPageToken: "",- };- }-- const { nextPageToken, users } = await useUserStore().fetchUserList({- filter: {- query: params.search,- project: params.project,- },- pageToken: params.pageToken,- pageSize: params.pageSize,- });-- // In SaaS mode (allowArbitraryEmail), if no existing user matches and the- // search looks like an email, offer it as a selectable option so admins- // can add emails for users who haven't signed up yet.- if (- params.allowArbitraryEmail &&- users.length === 0 &&- !params.pageToken &&- isValidEmail(params.search)- ) {- const fullname = ensureUserFullName(params.search);- const user: UserResource = {- ...unknownUser(fullname),- email: params.search,- title: params.search,- isExternal: true,- };-- return {- users: [user],- nextPageToken: "",- };- }-- return {- nextPageToken,- users,- };-};diff --git a/frontend/src/components/v2/Select/RoleSelect.vue b/frontend/src/components/v2/Select/RoleSelect.vuedeleted file mode 100644index a0ea9675ad..0000000000--- a/frontend/src/components/v2/Select/RoleSelect.vue+++ /dev/null@@ -1,197 +0,0 @@-<template>- <NSelect- v-bind="$attrs"- :value="value"- :multiple="multiple"- :disabled="disabled || !hasPermission"- :clearable="clearable"- :options="availableRoleOptions"- :max-tag-count="'responsive'"- :filterable="true"- :render-label="renderLabel"- :render-tag="renderTag"- :placeholder="$t('settings.members.select-role', multiple ? 2 : 1)"- to="body"- @update:value="onValueUpdate"- />- <FeatureModal- :feature="PlanFeature.FEATURE_CUSTOM_ROLES"- :open="showFeatureModal"- @cancel="showFeatureModal = false"- />-</template>--<script setup lang="tsx">-import type { SelectGroupOption, SelectOption } from "naive-ui";-import { NSelect, NTag } from "naive-ui";-import type { SelectBaseOption } from "naive-ui/lib/select/src/interface";-import { computed, ref } from "vue";-import FeatureBadge from "@/components/FeatureGuard/FeatureBadge.vue";-import FeatureModal from "@/components/FeatureGuard/FeatureModal.vue";-import { t } from "@/plugins/i18n";-import { featureToRef, useRoleStore } from "@/store";-import {- PRESET_PROJECT_ROLES,- PRESET_ROLES,- PRESET_WORKSPACE_ROLES,-} from "@/types";-import type { Role } from "@/types/proto-es/v1/role_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import {- displayRoleDescription,- displayRoleTitle,- hasWorkspacePermissionV2,-} from "@/utils";--type RoleSelectOption = SelectOption & {- role: Role;-};--const props = withDefaults(- defineProps<{- value?: string[] | string | undefined;- disabled?: boolean;- clearable?: boolean;- multiple?: boolean;- suffix?: string;- includeWorkspaceRoles?: boolean;- filter?: (role: Role) => boolean;- }>(),- {- clearable: true,- includeWorkspaceRoles: true,- suffix: () =>- ` (${t("common.optional")}, ${t(- "role.project-roles.apply-to-all-projects"- ).toLocaleLowerCase()})`,- }-);--const emit = defineEmits<{- (event: "update:value", val: string | string[]): void;-}>();--const roleStore = useRoleStore();-const showFeatureModal = ref(false);-const hasCustomRoleFeature = featureToRef(PlanFeature.FEATURE_CUSTOM_ROLES);-const hasPermission = computed(() => hasWorkspacePermissionV2("bb.roles.list"));--const filterRole = (role: Role) => {- if (!props.filter) {- return true;- }- return props.filter(role);-};--const availableRoleOptions = computed(- (): (RoleSelectOption | SelectGroupOption)[] => {- const roleGroups: SelectGroupOption[] = [];-- if (props.includeWorkspaceRoles) {- roleGroups.push({- type: "group",- key: "workspace-roles",- label: t("role.workspace-roles.self"),- children: PRESET_WORKSPACE_ROLES.map(roleStore.getRoleByName)- .filter((role) => role && filterRole(role))- .map<RoleSelectOption>((role) => ({- label: displayRoleTitle(role!.name),- value: role!.name,- role: role!,- })),- });- }-- roleGroups.push({- type: "group",- key: "project-roles",- label: t("role.project-roles.self") + props.suffix,- children: PRESET_PROJECT_ROLES.map(roleStore.getRoleByName)- .filter((role) => role && filterRole(role))- .map<RoleSelectOption>((role) => ({- label: displayRoleTitle(role!.name),- value: role!.name,- role: role!,- })),- });-- const customRoles = roleStore.roleList.filter(- (role) => !PRESET_ROLES.includes(role.name) && filterRole(role)- );- if (customRoles.length > 0) {- roleGroups.push({- type: "group",- key: "custom-roles",- label: t("role.custom-roles.self") + props.suffix,- children: customRoles.map<RoleSelectOption>((role) => ({- label: displayRoleTitle(role.name),- value: role.name,- role,- })),- });- }-- return roleGroups;- }-);--const renderTag = ({- option,- handleClose,-}: {- option: SelectBaseOption;- handleClose: () => void;-}) => {- if (!props.multiple) {- return option.label as string;- }- return (- <NTag closable={!props.disabled} onClose={handleClose}>- {option.label as string}- </NTag>- );-};--const renderLabel = (option: SelectBaseOption & SelectGroupOption) => {- if (option.type === "group") {- return option.label as string;- }-- const { role, label } = option as SelectBaseOption as RoleSelectOption;- const isCustomRole = !PRESET_ROLES.includes(role.name);- const description = displayRoleDescription(role.name);-- return (- <div class="py-1">- <div class="flex items-center gap-x-1">- {label}- {!hasCustomRoleFeature.value && isCustomRole ? (- <FeatureBadge- feature={PlanFeature.FEATURE_CUSTOM_ROLES}- clickable={false}- />- ) : null}- </div>- {description && <div class="textinfolabel text-xs!">{description}</div>}- </div>- );-};--const includeCustomRole = (values: string[]) => {- return values.some((val) => !PRESET_ROLES.includes(val));-};--const onValueUpdate = (val: string | string[]) => {- let hasCustomRole = false;- if (Array.isArray(val)) {- hasCustomRole = includeCustomRole(val);- } else {- hasCustomRole = includeCustomRole([val]);- }- if (hasCustomRole && !hasCustomRoleFeature.value) {- showFeatureModal.value = true;- return;- }- emit("update:value", val);-};-</script>diff --git a/frontend/src/components/v2/Select/UserSelect.vue b/frontend/src/components/v2/Select/UserSelect.vuedeleted file mode 100644index f29788c801..0000000000--- a/frontend/src/components/v2/Select/UserSelect.vue+++ /dev/null@@ -1,154 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- :multiple="multiple"- :disabled="disabled"- :size="size"- :value="value"- :tag="true"- :remote="true"- :additional-options="additionalOptions"- :render-label="renderLabel"- :render-tag="renderTag"- :search="handleSearch"- :filter="filter"- @update:value="(val) => $emit('update:value', val)"- />-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { computed } from "vue";-import { useI18n } from "vue-i18n";-import { HighlightLabelText } from "@/components/v2";-import { UserNameCell } from "@/components/v2/Model/cells";-import { getUserFullNameByType, useUserStore } from "@/store";-import { type User } from "@/types/proto-es/v1/user_service_pb";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,- searchUsersWithFallback,- type UserResource,-} from "./RemoteResourceSelector/utils";--const props = defineProps<{- multiple?: boolean;- disabled?: boolean;- size?: SelectSize;- value?: string | string[] | undefined; // user fullname- projectName?: string;- filter?: (user: User) => boolean;- allowArbitraryEmail?: boolean;-}>();--defineEmits<{- // the value is user fullname- (event: "update:value", value: string[] | string | undefined): void;-}>();--const userStore = useUserStore();-const { t } = useI18n();--const getOption = (user: User): ResourceSelectOption<UserResource> => ({- resource: user,- value: getUserFullNameByType(user),- label: user.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<UserResource>[] = [];-- let userEmails: string[] = [];- if (Array.isArray(props.value)) {- userEmails = props.value;- } else if (props.value) {- userEmails = [props.value];- }-- // Ensure users are fetched into store- await userStore.batchGetOrFetchUsers(userEmails);-- // Get all users from store- for (const email of userEmails) {- const user = userStore.getUserByIdentifier(email);- if (user) {- options.push(getOption(user));- }- }-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { users, nextPageToken } = await searchUsersWithFallback({- ...params,- project: props.projectName,- allowArbitraryEmail: props.allowArbitraryEmail,- });- return {- nextPageToken,- options: users.map(getOption),- };-};--const customLabel = (user: UserResource, keyword: string) => {- if (user.isExternal) {- return (- <div class="flex items-center shrink gap-x-2 py-0.5">- <HighlightLabelText keyword={keyword} text={user.email} />- <span class="text-xs text-gray-400 whitespace-nowrap">- {t("settings.members.not-a-member")}- </span>- </div>- );- }-- return (- <UserNameCell- user={user}- allowEdit={false}- showMfaEnabled={false}- showSource={false}- showEmail={false}- link={false}- size="small"- keyword={keyword}- onClickUser={() => {}}- >- {{- suffix: () => (- <span class="textinfolabel truncate">- (<HighlightLabelText keyword={keyword} text={user.email} />)- </span>- ),- }}- </UserNameCell>- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: false,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>diff --git a/frontend/src/components/v2/Select/WorkloadIdentitySelect.vue b/frontend/src/components/v2/Select/WorkloadIdentitySelect.vuedeleted file mode 100644index 80eabe363a..0000000000--- a/frontend/src/components/v2/Select/WorkloadIdentitySelect.vue+++ /dev/null@@ -1,150 +0,0 @@-<template>- <RemoteResourceSelector- v-bind="$attrs"- :multiple="multiple"- :disabled="disabled"- :size="size"- :value="value"- :tag="!hasPermission"- :remote="hasPermission"- :additional-options="additionalOptions"- :render-label="renderLabel"- :render-tag="renderTag"- :search="handleSearch"- :filter="filter"- @update:value="(val) => $emit('update:value', val)"- />-</template>--<script lang="tsx" setup>-import { computedAsync } from "@vueuse/core";-import { computed } from "vue";-import { HighlightLabelText } from "@/components/v2";-import { UserNameCell } from "@/components/v2/Model/cells";-import {- useWorkloadIdentityStore,- workloadIdentityNamePrefix,- workloadIdentityToUser,-} from "@/store";-import type { WorkloadIdentity } from "@/types/proto-es/v1/workload_identity_service_pb";-import { hasWorkspacePermissionV2 } from "@/utils";-import RemoteResourceSelector from "./RemoteResourceSelector/index.vue";-import type {- ResourceSelectOption,- SelectSize,-} from "./RemoteResourceSelector/types";-import {- getRenderLabelFunc,- getRenderTagFunc,-} from "./RemoteResourceSelector/utils";--const props = defineProps<{- multiple?: boolean;- disabled?: boolean;- size?: SelectSize;- value?: string | string[] | undefined; // workloadIdentity fullname- parent: string; // e.g. "projects/{project}" for project-scoped identities- filter?: (wi: WorkloadIdentity) => boolean;-}>();--defineEmits<{- // the value is workloadIdentity fullname- (event: "update:value", value: string[] | string | undefined): void;-}>();--const workloadIdentityStore = useWorkloadIdentityStore();--const hasPermission = computed(() =>- hasWorkspacePermissionV2("bb.workloadIdentities.list")-);--const getOption = (- wi: WorkloadIdentity-): ResourceSelectOption<WorkloadIdentity> => ({- resource: wi,- value: `${workloadIdentityNamePrefix}${wi.email}`,- label: wi.title,-});--const additionalOptions = computedAsync(async () => {- const options: ResourceSelectOption<WorkloadIdentity>[] = [];-- let names: string[] = [];- if (Array.isArray(props.value)) {- names = props.value;- } else if (props.value) {- names = [props.value];- }-- for (const name of names) {- const wi = await workloadIdentityStore.getOrFetchWorkloadIdentity(- name,- true- );- options.push(getOption(wi));- }-- return options;-}, []);--const handleSearch = async (params: {- search: string;- pageToken: string;- pageSize: number;-}) => {- const { workloadIdentities, nextPageToken } =- await workloadIdentityStore.listWorkloadIdentities({- parent: props.parent,- filter: { query: params.search },- pageToken: params.pageToken,- pageSize: params.pageSize,- showDeleted: false,- });- return {- nextPageToken,- options: workloadIdentities.map(getOption),- };-};--const customLabel = (wi: WorkloadIdentity, keyword: string) => {- const user = workloadIdentityToUser(wi);- return (- <UserNameCell- user={user}- allowEdit={false}- showMfaEnabled={false}- showSource={false}- showEmail={false}- link={false}- size="small"- keyword={keyword}- onClickUser={() => {}}- >- {{- suffix: () => (- <span class="textinfolabel truncate">- (<HighlightLabelText keyword={keyword} text={wi.email} />)- </span>- ),- }}- </UserNameCell>- );-};--const renderLabel = computed(() => {- return getRenderLabelFunc({- multiple: props.multiple,- customLabel,- showResourceName: false,- });-});--const renderTag = computed(() => {- return getRenderTagFunc({- multiple: props.multiple,- disabled: props.disabled,- size: props.size,- customLabel,- });-});-</script>diff --git a/frontend/src/components/v2/Select/index.ts b/frontend/src/components/v2/Select/index.tsdeleted file mode 100644index dcb9698de8..0000000000--- a/frontend/src/components/v2/Select/index.ts+++ /dev/null@@ -1,23 +0,0 @@-import AnnouncementLevelSelect from "./AnnouncementLevelSelect.vue";-import DatabaseSelect from "./DatabaseSelect.vue";-import EnvironmentSelect from "./EnvironmentSelect.vue";-import GroupSelect from "./GroupSelect.vue";-import InstanceSelect from "./InstanceSelect.vue";-import ProjectSelect from "./ProjectSelect.vue";-import RoleSelect from "./RoleSelect.vue";-import UserSelect from "./UserSelect.vue";-import AccountSelect from "./AccountSelect.vue";-import WorkloadIdentitySelect from "./WorkloadIdentitySelect.vue";--export {- AnnouncementLevelSelect,- InstanceSelect,- DatabaseSelect,- EnvironmentSelect,- ProjectSelect,- UserSelect,- AccountSelect,- GroupSelect,- RoleSelect,- WorkloadIdentitySelect,-};diff --git a/frontend/src/components/v2/index.ts b/frontend/src/components/v2/index.tsdeleted file mode 100644index f792fd5f66..0000000000--- a/frontend/src/components/v2/index.ts+++ /dev/null@@ -1,5 +0,0 @@-export * from "./Select";-export * from "./Model";-export * from "./Form";-export * from "./Button";-export * from "./Container";diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex a7e58a0953..c433b77cb9 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -296,7 +296,6 @@"type-limit": "Only support {extension} file"},"filter-by-name": "Filter by name",- "finish": "Finish","fork": "Fork","from": "From","general": "General",@@ -339,9 +338,7 @@"no-data": "No data","no-license": "No license","not-started": "Not Started",- "off": "Off","ok": "OK",- "on": "On","only-creator-allowed-export": "Only the creator is allowed to export","operation": "Operation","operations": "Operations",@@ -787,7 +784,6 @@},"environment": {"delete-description": "Delete environment will also remove it from related instances and databases. You cannot undo this action",- "production-environment": "Production environment","reorder": "Reorder Environments","select": "Select environment","successfully-updated-environment": "Successfully updated environment '{name}'."@@ -873,7 +869,6 @@}}},- "all": "All instances","archive-instance-instance-name": "Archive instance '{0}'?","archived-instances-will-not-be-displayed": "Archived instances will not be displayed.","authentication-database": "Authentication Database",@@ -1428,7 +1423,6 @@}},"project": {- "all": "All projects","batch": {"archive": {"description": "This will archive the selected projects. You can restore them later if needed.",@@ -1464,8 +1458,7 @@},"members": {"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",- "workspace-level-roles": "Workspace level roles"+ "never-expires": "Never"},"overview": {"info-slot-content": "Bytebase periodically syncs the instance schema. Newly synced databases are first placed here. User should transfer them to the proper application project."@@ -1671,7 +1664,6 @@"validation": {"duplicated": "The {resource} ID already exists. Please choose another one.","empty": "The {resource} ID cannot be empty",- "minlength": "The {resource} ID is too short. It should have at least 1 character.","overflow": "The {resource} ID is too long. It should have less than 64 characters.","pattern": "The {resource} ID can have lowercase letters, digits, or hyphens. It must start with a lowercase letter and end with a letter or number."}@@ -1698,7 +1690,6 @@"self": "Project Releaser"},"project-roles": {- "apply-to-all-projects": "Apply to all projects","self": "Project roles"},"project-viewer": {@@ -2087,7 +2078,6 @@"inactive-service-accounts": "Inactive service accounts","inactive-users": "Inactive users","inactive-workload-identities": "Inactive workload identities",- "not-a-member": "Not a member yet","reset-service-key": "Reset Service Key","reset-service-key-alert": "This action cannot be undone. The old key will stop working immediately. Are you sure you want to reset this service key?","revoke-access": "Revoke Access",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 1bc0094e7c..91d16e095a 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -296,7 +296,6 @@"type-limit": "Solo se admiten archivos {extension}"},"filter-by-name": "Filtrar por nombre",- "finish": "Finalizar","fork": "Bifurcación","from": "Desde","general": "General",@@ -339,9 +338,7 @@"no-data": "Sin datos","no-license": "Sin licencia","not-started": "No iniciado",- "off": "Apagado","ok": "OK",- "on": "Encendido","only-creator-allowed-export": "Solo el creador puede exportar","operation": "Operación","operations": "Operaciones",@@ -787,7 +784,6 @@},"environment": {"delete-description": "Eliminar el entorno también lo eliminará de las instancias y bases de datos relacionadas. No se puede deshacer esta acción",- "production-environment": "Entorno de producción","reorder": "Reordenar entornos","select": "Seleccionar entorno","successfully-updated-environment": "entorno '{name}' actualizado exitosamente."@@ -873,7 +869,6 @@}}},- "all": "Todas las instancias","archive-instance-instance-name": "¿Archivar la instancia '{0}'?","archived-instances-will-not-be-displayed": "Las instancias archivadas no se mostrarán.","authentication-database": "Base de datos de autenticación",@@ -1428,7 +1423,6 @@}},"project": {- "all": "Todos los proyectos","batch": {"archive": {"description": "Esto archivará los proyectos seleccionados. Podrás restaurarlos más tarde si lo necesitas.",@@ -1464,8 +1458,7 @@},"members": {"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",- "workspace-level-roles": "Roles a nivel de espacio de trabajo"+ "never-expires": "Nunca caduca"},"overview": {"info-slot-content": "Bytebase sincroniza periódicamente el esquema de la instancia. Las bases de datos recién sincronizadas se colocan aquí primero. El usuario debe transferirlas al proyecto de aplicación adecuado."@@ -1671,7 +1664,6 @@"validation": {"duplicated": "El ID de {resource} ya existe. Por favor, elige otro.","empty": "El ID {resource} no puede estar vacío",- "minlength": "El ID de {resource} es demasiado corto. Debe tener al menos 1 carácter.","overflow": "El ID de {resource} es demasiado largo. Debe tener menos de 64 caracteres.","pattern": "La identificación {recurso} puede tener letras, dígitos o guiones minúsculas. Debe comenzar con una letra minúscula y terminar con una letra o número."}@@ -1698,7 +1690,6 @@"self": "Liberador del proyecto"},"project-roles": {- "apply-to-all-projects": "Aplicar a todos los proyectos","self": "Roles de proyecto"},"project-viewer": {@@ -2087,7 +2078,6 @@"inactive-service-accounts": "Cuentas de servicio inactivas","inactive-users": "Usuarios inactivos","inactive-workload-identities": "Identidades de carga de trabajo inactivas",- "not-a-member": "Aún no es miembro","reset-service-key": "Restablecer Clave de Servicio","reset-service-key-alert": "Esta acción no se puede deshacer. La clave antigua dejará de funcionar de inmediato. ¿Está seguro de que desea restablecer esta clave de servicio?","revoke-access": "Revocar acceso",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 5706e18813..f92a3f5743 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -296,7 +296,6 @@"type-limit": "タイプ {extension} のファイルのみがサポートされます"},"filter-by-name": "名前でフィルタリングする",- "finish": "仕上げる","fork": "フォーク","from": "開始","general": "全般",@@ -339,9 +338,7 @@"no-data": "データなし","no-license": "ライセンスがありません","not-started": "未開始",- "off": "オフ","ok": "わかりました",- "on": "オン","only-creator-allowed-export": "エクスポートは作成者のみが実行できます","operation": "操作","operations": "操作",@@ -787,7 +784,6 @@},"environment": {"delete-description": "環境を削除すると、関連するインスタンスとデータベースからも削除されます。この操作は元に戻せません",- "production-environment": "本番環境","reorder": "環境の並べ替え","select": "環境を選ぶ","successfully-updated-environment": "環境「{name}」は正常に更新されました"@@ -873,7 +869,6 @@}}},- "all": "すべてのインスタンス","archive-instance-instance-name": "インスタンス '{0}' をアーカイブしますか?","archived-instances-will-not-be-displayed": "アーカイブされたインスタンスは表示されなくなります。","authentication-database": "認証データベース",@@ -1428,7 +1423,6 @@}},"project": {- "all": "全てのアイテム","batch": {"archive": {"description": "選択したプロジェクトがアーカイブされます。必要に応じて後で復元できます。",@@ -1464,8 +1458,7 @@},"members": {"description": "プロジェクトメンバーのロールにより、プロジェクト内のデータベースとイシューを操作するための権限が決まります。プロジェクト所有者、ワークスペース管理者、および DBA はすべて、プロジェクトに対する完全な権限を持っています。",- "never-expires": "有効期限が切れることはありません",- "workspace-level-roles": "ワークスペースレベルのロール"+ "never-expires": "有効期限が切れることはありません"},"overview": {"info-slot-content": "Bytebase はインスタンスのスキーマを定期的に同期します。新しく同期されたデータベースは最初にここに配置され、その後、それらを適切なプロジェクトに転送できます。"@@ -1671,7 +1664,6 @@"validation": {"duplicated": "{resource} ID はすでに存在します。別のIDを使用してください。","empty": "{resource} ID は空にできません",- "minlength": "{resource} ID には少なくとも 1 文字が含まれている必要があります。","overflow": "{resource} ID は 64 文字未満である必要があります。","pattern": "{resource} ID には、小文字、数字、またはハイフンを持つことができます。\n小文字から始めて、文字または番号で終わる必要があります。"}@@ -1698,7 +1690,6 @@"self": "プロジェクト発行者"},"project-roles": {- "apply-to-all-projects": "すべてのプロジェクトに適用する","self": "プロジェクトのロール"},"project-viewer": {@@ -2087,7 +2078,6 @@"inactive-service-accounts": "非アクティブサービスアカウント","inactive-users": "非アクティブユーザー","inactive-workload-identities": "非アクティブワークロードID",- "not-a-member": "未参加","reset-service-key": "サービスキーのリセット","reset-service-key-alert": "古いサービス キーはすぐにリセットされ、この操作は元に戻すことはできません。サービス キーをリセットしてもよろしいですか?","revoke-access": "アクセスを取り消す",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex 11790a4fd7..9f1ee8387c 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -296,7 +296,6 @@"type-limit": "Chỉ hỗ trợ tệp {extension}"},"filter-by-name": "Lọc theo tên",- "finish": "Hoàn tất","fork": "Bản sao","from": "Từ","general": "Chung",@@ -339,9 +338,7 @@"no-data": "Không có dữ liệu","no-license": "Không có giấy phép","not-started": "Chưa bắt đầu",- "off": "Tắt","ok": "OK",- "on": "Bật","only-creator-allowed-export": "Chỉ người tạo mới được phép xuất","operation": "Thao tác","operations": "Các thao tác",@@ -787,7 +784,6 @@},"environment": {"delete-description": "Xóa môi trường cũng sẽ xóa nó khỏi các phiên bản và cơ sở dữ liệu liên quan. Bạn không thể hoàn tác hành động này.",- "production-environment": "Môi trường sản xuất","reorder": "Sắp xếp lại môi trường","select": "Chọn môi trường","successfully-updated-environment": "Đã cập nhật thành công môi trường '{name}'."@@ -873,7 +869,6 @@}}},- "all": "Tất cả phiên bản","archive-instance-instance-name": "Lưu trữ phiên bản '{0}'?","archived-instances-will-not-be-displayed": "Các phiên bản đã lưu trữ sẽ không được hiển thị.","authentication-database": "Cơ sở dữ liệu xác thực",@@ -1428,7 +1423,6 @@}},"project": {- "all": "Tất cả dự án","batch": {"archive": {"description": "Thao tác này sẽ lưu trữ các dự án đã chọn. Bạn có thể khôi phục chúng sau nếu cần.",@@ -1464,8 +1458,7 @@},"members": {"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ờ",- "workspace-level-roles": "Vai trò cấp độ không gian làm việc"+ "never-expires": "Không bao giờ"},"overview": {"info-slot-content": "Bytebase định kỳ đồng bộ hóa lược đồ phiên bản. Các cơ sở dữ liệu mới được đồng bộ hóa trước tiên được đặt ở đây. Người dùng nên chuyển chúng đến dự án ứng dụng thích hợp."@@ -1671,7 +1664,6 @@"validation": {"duplicated": "ID {resource} đã tồn tại. Vui lòng chọn một ID khác.","empty": "ID {resource} không được để trống",- "minlength": "ID {resource} quá ngắn. Nó phải có ít nhất 1 ký tự.","overflow": "ID {resource} quá dài. Nó phải có ít hơn 64 ký tự.","pattern": "ID {resource} có thể có chữ thường, chữ số hoặc dấu gạch nối. \nNó phải bắt đầu với một chữ cái viết thường và kết thúc bằng một chữ cái hoặc số."}@@ -1698,7 +1690,6 @@"self": "Người phát hành dự án"},"project-roles": {- "apply-to-all-projects": "Áp dụng cho tất cả các dự án","self": "Vai trò dự án"},"project-viewer": {@@ -2087,7 +2078,6 @@"inactive-service-accounts": "Tài khoản dịch vụ không hoạt động","inactive-users": "Người dùng không hoạt động","inactive-workload-identities": "Danh tính Workload không hoạt động",- "not-a-member": "Chưa là thành viên","reset-service-key": "Đặt lại Khóa Dịch vụ","reset-service-key-alert": "Hành động này không thể hoàn tác. Khóa cũ sẽ ngừng hoạt động ngay lập tức. Bạn có chắc chắn muốn đặt lại khóa dịch vụ này?","revoke-access": "Thu hồi Quyền truy cập",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 9c6cf4fee6..70223e4c3c 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -296,7 +296,6 @@"type-limit": "仅支持 {extension} 类型的文件"},"filter-by-name": "按名称过滤",- "finish": "完成","fork": "复刻","from": "从","general": "通用",@@ -339,9 +338,7 @@"no-data": "无数据","no-license": "无证书","not-started": "未开始",- "off": "关","ok": "OK",- "on": "开","only-creator-allowed-export": "只有创建者才能执行导出","operation": "操作","operations": "操作",@@ -787,7 +784,6 @@},"environment": {"delete-description": "删除环境也会将其从相关实例和数据库中删除。这个操作无法撤销",- "production-environment": "生产环境","reorder": "重新排序环境","select": "选择环境","successfully-updated-environment": "环境'{name}'更新成功"@@ -873,7 +869,6 @@}}},- "all": "所有实例","archive-instance-instance-name": "归档实例'{0}'?","archived-instances-will-not-be-displayed": "不再会显示已归档实例。","authentication-database": "认证数据库",@@ -1428,7 +1423,6 @@}},"project": {- "all": "所有项目","batch": {"archive": {"description": "这将归档所选项目。如有需要,您可以稍后恢复它们。",@@ -1464,8 +1458,7 @@},"members": {"description": "项目成员角色决定了操作项目中的数据库和工单的权限。项目的所有者,工作空间管理员和 DBA 都具有项目所有的权限。",- "never-expires": "永不过期",- "workspace-level-roles": "工作空间级别角色"+ "never-expires": "永不过期"},"overview": {"info-slot-content": "Bytebase 会定时同步实例的 schema,新同步的数据库会首先被置于这里,之后您可以再将他们转移到适当的项目中。"@@ -1671,7 +1664,6 @@"validation": {"duplicated": "{resource} ID 已存在。请使用其他 ID。","empty": "{resource} ID 不能为空",- "minlength": "{resource} ID 至少包含 1 个字符。","overflow": "{resource} ID 应该少于 64 个字符。","pattern": "{resource} ID 可以具有小写字母,数字或连字符。\n它必须从小写字母开始,并以字母或数字结尾。"}@@ -1698,7 +1690,6 @@"self": "项目发布者"},"project-roles": {- "apply-to-all-projects": "应用到所有项目","self": "项目角色"},"project-viewer": {@@ -2087,7 +2078,6 @@"inactive-service-accounts": "未激活服务账号","inactive-users": "未激活用户","inactive-workload-identities": "未激活工作负载身份",- "not-a-member": "尚未加入","reset-service-key": "重置 Service Key","reset-service-key-alert": "旧 Service Key 将立即被重置,该操作不可逆。确定要重置 Service Key 吗?","revoke-access": "撤销访问权限",diff --git a/frontend/src/plugins/highlight.ts b/frontend/src/plugins/highlight.tsindex cbdcddb3b7..16564ab515 100644--- a/frontend/src/plugins/highlight.ts+++ b/frontend/src/plugins/highlight.ts@@ -1,12 +1,9 @@import hljs from "highlight.js/lib/core";import sql from "highlight.js/lib/languages/sql";import "highlight.js/styles/github.css";-import type { App } from "vue";-import HighlightCodeBlock from "@/components/HighlightCodeBlock.vue";++hljs.registerLanguage("sql", sql);export default {- install(app: App) {- hljs.registerLanguage("sql", sql);- app.component("HighlightCodeBlock", HighlightCodeBlock);- },+ install() {},};diff --git a/frontend/src/react/components/CustomApproval/utils.ts b/frontend/src/react/components/CustomApproval/utils.tsindex a081a22be5..0fc2e0c973 100644--- a/frontend/src/react/components/CustomApproval/utils.ts+++ b/frontend/src/react/components/CustomApproval/utils.ts@@ -1,7 +1,5 @@import { create } from "@bufbuild/protobuf";import { v4 as uuidv4 } from "uuid";-import { type OptionConfig } from "@/components/ExprEditor/context";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";import type { ConditionGroupExpr } from "@/plugins/cel";import { ExprType, type Factor, SQLTypeList, wrapAsGroup } from "@/plugins/cel";import i18n from "@/react/i18n";@@ -11,6 +9,7 @@ import { PRESET_WORKSPACE_ROLES, PresetRoleType } from "@/types";import { Engine, RiskLevel } from "@/types/proto-es/v1/common_pb";import { ApprovalFlowSchema } from "@/types/proto-es/v1/issue_service_pb";import { WorkspaceApprovalSetting_Rule_Source } from "@/types/proto-es/v1/setting_service_pb";+import type { ResourceSelectOption } from "@/types/v2-shared";import {displayRoleTitle,engineNameV1,@@ -36,6 +35,7 @@ import {CEL_ATTRIBUTE_STATEMENT_TABLE_ROWS,CEL_ATTRIBUTE_STATEMENT_TEXT,} from "@/utils/cel-attributes";+import { type OptionConfig } from "@/utils/expr";export { formatApprovalFlow } from "@/utils/workspaceApprovalSetting";diff --git a/frontend/src/react/components/ExprEditor.tsx b/frontend/src/react/components/ExprEditor.tsxindex 7fb2a364f1..d951931c71 100644--- a/frontend/src/react/components/ExprEditor.tsx+++ b/frontend/src/react/components/ExprEditor.tsx@@ -54,24 +54,9 @@ import { cn } from "@/react/lib/utils";import { environmentNamePrefix } from "@/store/modules/v1/common";import { getDefaultPagination } from "@/utils";import { CEL_ATTRIBUTE_RESOURCE_ENVIRONMENT_ID } from "@/utils/cel-attributes";+import type { OptionConfig } from "@/utils/expr";-// ============================================================-// OptionConfig type-// ============================================================--export type OptionConfig = {- search?: (params: {- search: string;- pageToken: string;- pageSize: number;- }) => Promise<{- nextPageToken: string;- options: { value: string; label: string }[];- }>;- fetch?: (names: string[]) => Promise<{ value: string; label: string }[]>;- fallback?: (value: string) => { value: string; label: string };- options: { value: string; label: string }[];-};+export type { OptionConfig } from "@/utils/expr";// ============================================================// Helpersdiff --git a/frontend/src/react/components/sql-editor/AccessPane.test.tsx b/frontend/src/react/components/sql-editor/AccessPane.test.tsxindex 82ed8057d7..db4660ab5f 100644--- a/frontend/src/react/components/sql-editor/AccessPane.test.tsx+++ b/frontend/src/react/components/sql-editor/AccessPane.test.tsx@@ -45,7 +45,6 @@ vi.mock("@/store/modules/accessGrant", () => ({}));vi.mock("@/utils", () => ({getDefaultPagination: mocks.getDefaultPagination,- getAccessSearchOptions: vi.fn(() => []),}));vi.mock("@/views/sql-editor/events", () => ({diff --git a/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx b/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsxindex 96698262d3..4bfe87a9a1 100644--- a/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx+++ b/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx@@ -917,14 +917,6 @@ function EnvironmentTreeSection(props: {[selectedDatabaseNames]);- // Hide the env section entirely when it's the "unknown" bucket with no- // children (matches Vue's `v-if="env !== UNKNOWN || !treeIsEmpty"` guard).- if (isUnknownEnvironment && treeIsEmpty(treeByEnv.tree)) {- return null;- }-- const data = treeByEnv.tree.map(toTreeDataNode);-const expandedKeySet = useMemo(() => new Set(treeByEnv.expandedState.expandedKeys),[treeByEnv.expandedState.expandedKeys]@@ -945,6 +937,17 @@ function EnvironmentTreeSection(props: {[treeByEnv.tree, expandedKeySet]);+ // Hide the env section entirely when it's the "unknown" bucket with no+ // children (matches Vue's `v-if="env !== UNKNOWN || !treeIsEmpty"` guard).+ // Keep this guard AFTER all hook calls — early-returning before useMemo+ // calls would change the hook order across renders and trigger the+ // "Rendered more hooks than during the previous render" runtime error.+ if (isUnknownEnvironment && treeIsEmpty(treeByEnv.tree)) {+ return null;+ }++ const data = treeByEnv.tree.map(toTreeDataNode);+return (<div className="flex flex-col gap-y-1 pt-2 pb-2"><Tree<SQLEditorTreeNode>diff --git a/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx b/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsxindex eb00dc6c28..e98e688a76 100644--- a/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx+++ b/frontend/src/react/components/sql-editor/SchemaPane/SchemaPane.test.tsx@@ -137,8 +137,8 @@ vi.mock("@/views/sql-editor/events", () => ({vi.mock("@/composables/useExecuteSQL", () => ({useExecuteSQL: () => ({ execute: vi.fn() }),}));-vi.mock("@/components/MonacoEditor/sqlFormatter", () => ({- default: async (sql: string) => ({ data: sql, error: null }),+vi.mock("@/react/components/monaco/sqlFormatter", () => ({+ formatSQL: async (sql: string) => ({ data: sql, error: null }),}));vi.mock("@/react/components/HumanizeTs", () => ({diff --git a/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx b/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsxindex d205b0c02a..f788a3aa35 100644--- a/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx+++ b/frontend/src/react/components/sql-editor/SchemaPane/actions.test.tsx@@ -133,8 +133,8 @@ vi.mock("@/composables/useExecuteSQL", () => ({useExecuteSQL: () => ({ execute: vi.fn() }),}));-vi.mock("@/components/MonacoEditor/sqlFormatter", () => ({- default: async (sql: string) => ({ data: sql, error: null }),+vi.mock("@/react/components/monaco/sqlFormatter", () => ({+ formatSQL: async (sql: string) => ({ data: sql, error: null }),}));vi.mock("@/types/sqlEditor/tabViewState", () => ({diff --git a/frontend/src/react/components/ui/feature-modal.tsx b/frontend/src/react/components/ui/feature-modal.tsxindex 4774298555..c7b464769f 100644--- a/frontend/src/react/components/ui/feature-modal.tsx+++ b/frontend/src/react/components/ui/feature-modal.tsx@@ -36,7 +36,6 @@ const planLabel: Record<number, string> = {};/**- * Replaces frontend/src/components/FeatureGuard/FeatureModal.vue.* Subscription paywall dialog shown when the current plan doesn't include* a requested feature. Three copy variants:* - Instance missing license → lock icon, "assign license" CTA.diff --git a/frontend/src/react/lib/database-group/utils.ts b/frontend/src/react/lib/database-group/utils.tsindex 8d6abe9508..cb89fc1060 100644--- a/frontend/src/react/lib/database-group/utils.ts+++ b/frontend/src/react/lib/database-group/utils.ts@@ -1,6 +1,5 @@-import { type OptionConfig } from "@/components/ExprEditor/context";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";import type { Factor } from "@/plugins/cel";+import type { ResourceSelectOption } from "@/types/v2-shared";import {getDatabaseIdOptionConfig,getEnvironmentIdOptions,@@ -11,6 +10,7 @@ import {CEL_ATTRIBUTE_RESOURCE_ENVIRONMENT_ID,CEL_ATTRIBUTE_RESOURCE_INSTANCE_ID,} from "@/utils/cel-attributes";+import { type OptionConfig } from "@/utils/expr";export const FactorList: Factor[] = [CEL_ATTRIBUTE_RESOURCE_ENVIRONMENT_ID,diff --git a/frontend/src/react/lib/sensitive-data/components-utils.ts b/frontend/src/react/lib/sensitive-data/components-utils.tsindex 51dd858efb..844d10f38b 100644--- a/frontend/src/react/lib/sensitive-data/components-utils.ts+++ b/frontend/src/react/lib/sensitive-data/components-utils.ts@@ -1,14 +1,11 @@import { create } from "@bufbuild/protobuf";import { uniq } from "lodash-es";-// ResourceSelectOption sits in a v2/Select Vue dir but is a framework-neutral-// type alias over naive-ui's SelectOption. It can't move until ExprEditor/-// context's OptionConfig (which also references it) migrates to React.-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";import type { Factor, Operator } from "@/plugins/cel";import { CollectionOperatorList, EqualityOperatorList } from "@/plugins/cel";import { useSettingV1Store } from "@/store";import type { Algorithm } from "@/types/proto-es/v1/setting_service_pb";import { AlgorithmSchema } from "@/types/proto-es/v1/setting_service_pb";+import type { ResourceSelectOption } from "@/types/v2-shared";import { CEL_ATTRIBUTE_RESOURCE_PROJECT_ID } from "@/utils/cel-attributes";export const getClassificationLevelOptions = () => {diff --git a/frontend/src/react/no-react-to-vue-imports.test.ts b/frontend/src/react/no-react-to-vue-imports.test.tsindex 9dfbd20c83..11d06c144b 100644--- a/frontend/src/react/no-react-to-vue-imports.test.ts+++ b/frontend/src/react/no-react-to-vue-imports.test.ts@@ -18,16 +18,11 @@ const allowedVueImports = new Set([const vueImportPattern = /from\s+["']([^"']+\.vue)["']/g;-// Vue-side helper modules that have React equivalents in-// frontend/src/react/components/monaco/. React code must import from the-// React copy, not from the Vue dir. The Vue dir stays alive because the-// AI plugin (frontend/src/plugins/ai/) still uses the Vue Monaco-// components — but React must not reach across.+// Framework-neutral helpers that were moved out of components/ into the+// React layer. The Vue counterpart directories no longer exist; these+// entries lock the paths back from being recreated.const bannedReactToVueModulePrefixes = ["@/components/MonacoEditor",- // Framework-neutral helpers that were moved out of components/ into the- // React layer. The Vue counterpart directories no longer exist; this- // entry locks the path back from being recreated."@/components/Plan","@/components/SQLReview","@/components/ProjectMember",diff --git a/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx b/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsxindex 2466062ba5..028f26cde7 100644--- a/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx+++ b/frontend/src/react/pages/project/ProjectMaskingExemptionCreatePage.tsx@@ -3,7 +3,6 @@ import dayjs from "dayjs";import { CircleHelp } from "lucide-react";import { useCallback, useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";-import { type OptionConfig } from "@/components/ExprEditor/context";import type { ConditionGroupExpr, Factor, Operator } from "@/plugins/cel";import {buildCELExpr,@@ -55,6 +54,7 @@ import {CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,CEL_ATTRIBUTE_RESOURCE_TABLE_NAME,} from "@/utils/cel-attributes";+import { type OptionConfig } from "@/utils/expr";type RadioValue = "ALL" | "EXPRESSION" | "SELECT";diff --git a/frontend/src/react/pages/project/database-detail/catalog/GrantAccessDialog.tsx b/frontend/src/react/pages/project/database-detail/catalog/GrantAccessDialog.tsxindex 7b55f1e3f8..bd5c021185 100644--- a/frontend/src/react/pages/project/database-detail/catalog/GrantAccessDialog.tsx+++ b/frontend/src/react/pages/project/database-detail/catalog/GrantAccessDialog.tsx@@ -3,7 +3,6 @@ import dayjs from "dayjs";import { CircleHelp } from "lucide-react";import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { useTranslation } from "react-i18next";-import { type OptionConfig } from "@/components/ExprEditor/context";import type { ConditionGroupExpr, Factor, Operator } from "@/plugins/cel";import {buildCELExpr,@@ -61,6 +60,7 @@ import {CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,CEL_ATTRIBUTE_RESOURCE_TABLE_NAME,} from "@/utils/cel-attributes";+import { type OptionConfig } from "@/utils/expr";import {convertFromExpr,stringifyConditionExpression,diff --git a/frontend/src/types/sqlEditor/tab.ts b/frontend/src/types/sqlEditor/tab.tsindex 83b1e310e3..df90cf5c63 100644--- a/frontend/src/types/sqlEditor/tab.ts+++ b/frontend/src/types/sqlEditor/tab.ts@@ -1,5 +1,5 @@-import type { Selection as MonacoSelection } from "@/components/MonacoEditor";import { t } from "@/plugins/i18n";+import type { Selection as MonacoSelection } from "@/react/components/monaco/types";import { DataSourceType } from "@/types/proto-es/v1/instance_service_pb";import type { SQLResultSetV1 } from "../v1/sql";import type { SQLEditorConnection, SQLEditorQueryParams } from "./editor";diff --git a/frontend/src/components/v2/Select/RemoteResourceSelector/types.ts b/frontend/src/types/v2-shared.tssimilarity index 100%rename from frontend/src/components/v2/Select/RemoteResourceSelector/types.tsrename to frontend/src/types/v2-shared.tsdiff --git a/frontend/src/utils/accessGrant.ts b/frontend/src/utils/accessGrant.tsindex b4081f5c22..019deba8cb 100644--- a/frontend/src/utils/accessGrant.ts+++ b/frontend/src/utils/accessGrant.ts@@ -1,14 +1,5 @@import dayjs from "dayjs";-import { NTag } from "naive-ui";-import { h } from "vue";-import BBAvatar from "@/bbkit/BBAvatar.vue";-import type {- ScopeOption,- ValueOption,-} from "@/components/AdvancedSearch/types";-import { RichDatabaseName } from "@/components/v2";import { t } from "@/plugins/i18n";-import { useCurrentUserV1, useDatabaseV1Store, useUserStore } from "@/store";import { getTimeForPbTimestampProtoEs } from "@/types";import {type AccessGrant,@@ -18,8 +9,6 @@ import { ApprovalStatus } from "@/types/proto-es/v1/common_pb";import type { Issue } from "@/types/proto-es/v1/issue_service_pb";import { IssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { formatAbsoluteDateTime } from "@/utils/datetime";-import { getDefaultPagination } from "@/utils/pagination";-import { extractDatabaseResourceName } from "@/utils/v1/database";export type AccessGrantFilterStatus =| "ACTIVE"@@ -142,117 +131,3 @@ export const getAccessGrantStatusTagType = (return "default";}};--export const getAccessSearchOptions = ({- project,- showCreator,-}: {- project: string;- showCreator: boolean;-}): ScopeOption[] => {- const databaseStore = useDatabaseV1Store();- const userStore = useUserStore();- const me = useCurrentUserV1();-- const options: ScopeOption[] = [- {- id: "status",- title: t("common.status"),- allowMultiple: true,- options: [- {- value: AccessGrant_Status[AccessGrant_Status.ACTIVE],- keywords: ["active"],- render: () => t("common.active"),- },- {- value: AccessGrant_Status[AccessGrant_Status.PENDING],- keywords: ["pending"],- render: () => t("common.pending"),- },- {- value: "EXPIRED",- keywords: ["expired"],- render: () => t("sql-editor.expired"),- },- {- value: AccessGrant_Status[AccessGrant_Status.REVOKED],- keywords: ["revoked"],- render: () => t("common.revoked"),- },- ],- },- {- id: "database",- title: t("common.database"),- search: ({ keyword, nextPageToken: pageToken }) =>- databaseStore- .fetchDatabases({- parent: project,- pageToken: pageToken,- pageSize: getDefaultPagination(),- filter: { query: keyword },- })- .then((resp) => ({- nextPageToken: resp.nextPageToken,- options: resp.databases.map<ValueOption>((db) => {- const { database: dbName } = extractDatabaseResourceName(db.name);- return {- value: db.name,- keywords: [dbName, db.name],- custom: true,- render: () =>- h(RichDatabaseName, {- database: db,- showInstance: true,- showEngineIcon: true,- }),- };- }),- })),- },- ];-- if (showCreator) {- options.push({- id: "creator",- title: t("common.creator"),- search: ({ keyword, nextPageToken: pageToken }) =>- userStore- .fetchUserList({- pageToken,- pageSize: getDefaultPagination(),- filter: { query: keyword },- })- .then((resp) => ({- nextPageToken: resp.nextPageToken,- options: resp.users.map<ValueOption>((user) => ({- value: user.email,- keywords: [user.email, user.title],- render: () => {- const children = [- h(BBAvatar, { size: "TINY", username: user.title }),- h("span", user.title),- ];- if (user.name === me.value.name) {- children.push(- h(- NTag,- { size: "small", round: true, type: "success" },- { default: () => t("common.you") }- )- );- }- return h(- "div",- { class: "flex items-center gap-x-1" },- children- );- },- })),- })),- });- }-- return options;-};diff --git a/frontend/src/utils/expr.ts b/frontend/src/utils/expr.tsindex 7fa36ccb79..edcc710c90 100644--- a/frontend/src/utils/expr.ts+++ b/frontend/src/utils/expr.ts@@ -1,13 +1,3 @@-import { CheckIcon } from "lucide-vue-next";-import type { VNode } from "vue";-import { h } from "vue";-import { type OptionConfig } from "@/components/ExprEditor/context";-import {- EnvironmentV1Name,- InstanceV1Name,- RichDatabaseName,-} from "@/components/v2";-import type { ResourceSelectOption } from "@/components/v2/Select/RemoteResourceSelector/types";import {instanceNamePrefix,projectNamePrefix,@@ -26,111 +16,57 @@ import {extractProjectResourceName,} from "@/utils";-const getRenderOptionFunc = (resource: {- title: string | (() => VNode);- name: string;-}): ((info: { node: VNode; selected: boolean }) => VNode) => {- return (info: { node: VNode; selected: boolean }) => {- return h(- info.node,- { class: "flex items-center justify-between gap-x-4" },- [- h("div", { class: "flex flex-col px-1 py-1 z-10" }, [- typeof resource.title === "string"- ? h(- "div",- { class: `textlabel ${info.selected ? "text-accent!" : ""}` },- resource.title- )- : resource.title(),- h("div", { class: "opacity-60 textinfolabel" }, resource.name),- ]),- info.selected ? h(CheckIcon, { class: "w-4 z-10" }) : undefined,- ]- );- };+type LabeledOption = { value: string; label: string };++export type OptionConfig = {+ search?: (params: {+ search: string;+ pageToken: string;+ pageSize: number;+ }) => Promise<{+ nextPageToken: string;+ options: LabeledOption[];+ }>;+ fetch?: (names: string[]) => Promise<LabeledOption[]>;+ fallback?: (value: string) => LabeledOption;+ options: LabeledOption[];};-export const getEnvironmentIdOptions = () => {+export const getEnvironmentIdOptions = (): LabeledOption[] => {const environmentList = useEnvironmentV1Store().environmentList;- return environmentList.map<ResourceSelectOption<unknown>>((env) => {- const environmentId = env.id;- return {- label: `${env.title} (${environmentId})`,- value: environmentId,- render: getRenderOptionFunc({- name: env.name,- title: () =>- h(EnvironmentV1Name, {- environment: env,- link: false,- showColor: true,- }),- }),- };- });+ return environmentList.map((env) => ({+ label: `${env.title} (${env.id})`,+ value: env.id,+ }));};-const getProjectIdOption = (proj: Project) => {+const getProjectIdOption = (proj: Project): LabeledOption => {const projectId = extractProjectResourceName(proj.name);return {label: `${proj.title} (${projectId})`,value: projectId,- render: getRenderOptionFunc(proj),};};-const getDatabasFullNameOption = (database: Database) => {- return {- label: database.name,- value: database.name,- render: getRenderOptionFunc({- name: database.name,- title: () =>- h(RichDatabaseName, {- database,- showEngineIcon: true,- showInstance: true,- showProject: false,- showArrow: true,- }),- }),- };-};+const getDatabaseFullNameOption = (database: Database): LabeledOption => ({+ label: database.name,+ value: database.name,+});-const getInstanceIdOption = (ins: Instance) => {+const getInstanceIdOption = (ins: Instance): LabeledOption => {const instanceId = extractInstanceResourceName(ins.name);return {label: `${ins.title} (${instanceId})`,value: instanceId,- render: getRenderOptionFunc({- name: ins.name,- title: () =>- h(InstanceV1Name, {- instance: ins,- link: false,- }),- }),};};-const getDatabaseIdOptions = (databases: Database[]) => {- return databases.map<ResourceSelectOption<unknown>>((database) => {+const getDatabaseIdOptions = (databases: Database[]): LabeledOption[] => {+ return databases.map((database) => {const { databaseName } = extractDatabaseResourceName(database.name);return {label: databaseName,value: databaseName,- render: getRenderOptionFunc({- name: database.name,- title: () =>- h(RichDatabaseName, {- database,- showEngineIcon: true,- showInstance: false,- showProject: false,- showArrow: false,- }),- }),};});};@@ -145,11 +81,7 @@ export const getProjectIdOptionConfig = (): OptionConfig => {);return projects.map(getProjectIdOption);},- search: async (params: {- search: string;- pageToken: string;- pageSize: number;- }) => {+ search: async (params) => {return projectStore.fetchProjectList({pageSize: params.pageSize,@@ -178,7 +110,7 @@ export const getInstanceIdOptionConfig = (): OptionConfig => {store.getOrFetchInstanceByName(`${instanceNamePrefix}${instanceId}`)));- const options: ResourceSelectOption<unknown>[] = [];+ const options: LabeledOption[] = [];for (const instance of instances) {if (!isValidInstanceName(instance.name)) {continue;@@ -187,11 +119,7 @@ export const getInstanceIdOptionConfig = (): OptionConfig => {}return options;},- search: async (params: {- search: string;- pageToken: string;- pageSize: number;- }) => {+ search: async (params) => {return store.fetchInstanceList({pageSize: params.pageSize,@@ -213,20 +141,13 @@ export const getDatabaseIdOptionConfig = (parent: string): OptionConfig => {const dbStore = useDatabaseV1Store();return {options: [],- // Since we use the database name (not the fullname) as the value, we cannot fetch the resource because we don't know the instance id.- // While searching via query is possible, but the performance cost could be significant if there're multiple values.- // So provide the fallback to show the selected database name instead of the entire database entity.- fallback: (value: string) => {- return {- label: value,- value: value,- };- },- search: async (params: {- search: string;- pageToken: string;- pageSize: number;- }) => {+ // Since we use the database name (not the fullname) as the value, we cannot+ // fetch the resource because we don't know the instance id. While searching+ // via query is possible, the performance cost could be significant if there+ // are multiple values. So provide the fallback to show the selected+ // database name instead of the entire database entity.+ fallback: (value: string) => ({ label: value, value }),+ search: async (params) => {return dbStore.fetchDatabases({pageSize: params.pageSize,@@ -251,13 +172,9 @@ export const getDatabaseNameOptionConfig = (parent: string): OptionConfig => {options: [],fetch: async (names: string[]) => {const databases = await dbStore.batchGetOrFetchDatabases(names);- return databases.map(getDatabasFullNameOption);+ return databases.map(getDatabaseFullNameOption);},- search: async (params: {- search: string;- pageToken: string;- pageSize: number;- }) => {+ search: async (params) => {return dbStore.fetchDatabases({pageSize: params.pageSize,@@ -270,7 +187,7 @@ export const getDatabaseNameOptionConfig = (parent: string): OptionConfig => {}).then((resp) => ({nextPageToken: resp.nextPageToken,- options: resp.databases.map(getDatabasFullNameOption),+ options: resp.databases.map(getDatabaseFullNameOption),}));},};