Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: fe connect rpc, common (#16687)
p0ny5127510b0bee
diff --git a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.tsindex 636b4bddc9..e6dcd9b798 100644--- a/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts+++ b/frontend/src/components/AdvancedSearch/useCommonSearchScopeOptions.ts@@ -15,7 +15,7 @@ import {useProjectV1Store,} from "@/store";import type { MaybeRef } from "@/types";-import { engineToJSON } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { SearchScopeId } from "@/utils";import {environmentV1Name,@@ -27,6 +27,7 @@ import {hasWorkspacePermissionV2,} from "@/utils";import type { ScopeOption, ValueOption } from "./types";+import { convertEngineToOld } from "@/utils/v1/common-conversions";export const useCommonSearchScopeOptions = (supportOptionIdList: MaybeRef<SearchScopeId[]>@@ -113,7 +114,7 @@ export const useCommonSearchScopeOptions = (keywords: [name,ins.title,- engineToJSON(ins.engine),+ String(ins.engine),extractEnvironmentResourceName(ins.environment),],render: () => {@@ -171,8 +172,8 @@ export const useCommonSearchScopeOptions = (description: t("issue.advanced-search.scope.engine.description"),options: supportedEngineV1List().map((engine) => {return {- value: engine,- keywords: [engineToJSON(engine).toLowerCase()],+ value: convertEngineToOld(engine),+ keywords: [Engine[engine].toLowerCase()],render: () => h(RichEngineName, { engine, tag: "p" }),};}),@@ -196,7 +197,7 @@ export const useCommonSearchScopeOptions = (],allowMultiple: false,}),- } as Record<SearchScopeId, () => ScopeOption>;+ } as Partial<Record<SearchScopeId, () => ScopeOption>>;const scopes: ScopeOption[] = [];for (const id of unref(supportOptionIdList)) {diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vueindex f4f57b7aa3..f33fe235e3 100644--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue@@ -149,7 +149,8 @@ import {} from "@/store";import type { ComposedDatabase } from "@/types";import { dialectOfEngineV1, isValidProjectName, unknownProject } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { DatabaseCatalog } from "@/types/proto/v1/database_catalog_service";import type { DatabaseMetadata } from "@/types/proto/v1/database_service";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";@@ -248,12 +249,12 @@ const databaseList = computed(() => {});// Returns the type if it's uniq.-// Returns Engine.UNRECOGNIZED if there are more than ONE types.+// Returns Engine.ENGINE_UNSPECIFIED if there are more than ONE types.const databaseEngine = computed((): Engine => {const engineTypes = uniq(- databaseList.value.map((db) => db.instanceResource.engine)+ databaseList.value.map((db) => convertEngineToNew(db.instanceResource.engine)));- if (engineTypes.length !== 1) return Engine.UNRECOGNIZED;+ if (engineTypes.length !== 1) return Engine.ENGINE_UNSPECIFIED;return engineTypes[0];});diff --git a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vueindex 6e0eaf94bc..e5f343e8d3 100644--- a/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue+++ b/frontend/src/components/Changelist/ChangelistDashboard/CreateChangelistPanel.vue@@ -169,8 +169,9 @@ import {Changelist,Changelist_Change as Change,} from "@/types/proto/v1/changelist_service";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { Sheet } from "@/types/proto/v1/sheet_service";+import { convertEngineToOld } from "@/utils/v1/common-conversions";import {ENCODINGS,extractChangelistResourceName,@@ -269,7 +270,7 @@ const doCreate = async () => {const { name, arrayBuffer } = f;const sheet = Sheet.fromPartial({title: name,- engine: Engine.ENGINE_UNSPECIFIED, // TODO(jim)+ engine: convertEngineToOld(Engine.ENGINE_UNSPECIFIED), // TODO(jim)});const content = new TextDecoder(state.encoding).decode(arrayBuffer);setSheetStatement(sheet, content);diff --git a/frontend/src/components/Changelog/ChangelogDetail.vue b/frontend/src/components/Changelog/ChangelogDetail.vueindex 2407ee1d1e..2e15c0e7ec 100644--- a/frontend/src/components/Changelog/ChangelogDetail.vue+++ b/frontend/src/components/Changelog/ChangelogDetail.vue@@ -139,7 +139,8 @@ import {useDatabaseV1ByName,} from "@/store";import { getDateForPbTimestamp } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { Changelog } from "@/types/proto/v1/database_service";import {changelog_TypeToJSON,@@ -221,7 +222,7 @@ const affectedTables = computed(() => {});const showSchemaSnapshot = computed(() => {- return database.value.instanceResource.engine !== Engine.RISINGWAVE;+ return convertEngineToNew(database.value.instanceResource.engine) !== Engine.RISINGWAVE;});// "Show diff" feature is enabled when current migration has changed the schema.diff --git a/frontend/src/components/ColumnDataTable/ClassificationCell.vue b/frontend/src/components/ColumnDataTable/ClassificationCell.vueindex 41bc972d78..957cea270b 100644--- a/frontend/src/components/ColumnDataTable/ClassificationCell.vue+++ b/frontend/src/components/ColumnDataTable/ClassificationCell.vue@@ -38,7 +38,7 @@ import { NPopconfirm } from "naive-ui";import { ref, computed } from "vue";import ClassificationLevelBadge from "@/components/SchemaTemplate/ClassificationLevelBadge.vue";import { MiniActionButton } from "@/components/v2";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { DataClassificationSetting_DataClassificationConfig as DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";import SelectClassificationDrawer from "../SchemaTemplate/SelectClassificationDrawer.vue";import { supportSetClassificationFromComment } from "./utils";diff --git a/frontend/src/components/ColumnDataTable/index.vue b/frontend/src/components/ColumnDataTable/index.vueindex 3d8257e975..bb7292c46e 100644--- a/frontend/src/components/ColumnDataTable/index.vue+++ b/frontend/src/components/ColumnDataTable/index.vue@@ -23,8 +23,9 @@ import {getColumnCatalog,} from "@/store";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type {ColumnMetadata,TableMetadata,@@ -59,7 +60,7 @@ const props = withDefaults(const { t } = useI18n();const engine = computed(() => {- return props.database.instanceResource.engine;+ return convertEngineToNew(props.database.instanceResource.engine);});const subscriptionV1Store = useSubscriptionV1Store();diff --git a/frontend/src/components/ColumnDataTable/utils.ts b/frontend/src/components/ColumnDataTable/utils.tsindex 49cff5a9b9..6495006161 100644--- a/frontend/src/components/ColumnDataTable/utils.ts+++ b/frontend/src/components/ColumnDataTable/utils.ts@@ -1,7 +1,7 @@import { cloneDeep } from "lodash-es";import { t } from "@/plugins/i18n";import { pushNotification, useDatabaseCatalogV1Store } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {SchemaCatalog,ColumnCatalog,diff --git a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vueindex a88650e528..4e5e424fb5 100644--- a/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue+++ b/frontend/src/components/CreateDatabasePrepForm/CreateDatabasePrepForm.vue@@ -53,7 +53,7 @@</span></div>- <div v-if="selectedInstance.engine === Engine.MONGODB" class="w-full">+ <div v-if="selectedInstance.engine === convertEngineToOld(Engine.MONGODB)" class="w-full"><label for="name" class="textlabel">{{ $t("create-db.new-collection-name") }}<span class="text-red-600">*</span>@@ -67,7 +67,7 @@/></div>- <div v-if="selectedInstance.engine === Engine.CLICKHOUSE" class="w-full">+ <div v-if="selectedInstance.engine === convertEngineToOld(Engine.CLICKHOUSE)" class="w-full"><label for="name" class="textlabel">{{ $t("create-db.cluster") }}</label>@@ -110,8 +110,8 @@<div class="w-full"><label for="charset" class="textlabel">{{- selectedInstance.engine === Engine.POSTGRES ||- selectedInstance.engine === Engine.REDSHIFT+ selectedInstance.engine === convertEngineToOld(Engine.POSTGRES) ||+ selectedInstance.engine === convertEngineToOld(Engine.REDSHIFT)? $t("db.encoding"): $t("db.character-set")}}</label@@ -121,7 +121,7 @@name="charset"type="text"class="mt-1 w-full"- :placeholder="defaultCharsetOfEngineV1(selectedInstance.engine)"+ :placeholder="defaultCharsetOfEngineV1(convertEngineToNew(selectedInstance.engine))"/></div>@@ -135,7 +135,7 @@type="text"class="mt-1 w-full":placeholder="- defaultCollationOfEngineV1(selectedInstance.engine) || 'default'+ defaultCollationOfEngineV1(convertEngineToNew(selectedInstance.engine)) || 'default'"/></div>@@ -172,7 +172,8 @@ import {isValidProjectName,UNKNOWN_PROJECT_NAME,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToOld, convertEngineToNew } from "@/utils/v1/common-conversions";import type { InstanceRole } from "@/types/proto/v1/instance_role_service";import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";import type { Plan_CreateDatabaseConfig } from "@/types/proto/v1/plan_service";@@ -236,7 +237,9 @@ const isReservedName = computed(() => {return state.databaseName.toLowerCase() == "bytebase";});-const supportedEngines = computed(() => enginesSupportCreateDatabase());+const supportedEngines = computed(() =>+ enginesSupportCreateDatabase()+);const allowCreate = computed(() => {return (@@ -274,7 +277,7 @@ const requireDatabaseOwnerName = computed((): boolean => {return false;}return [Engine.POSTGRES, Engine.REDSHIFT, Engine.COCKROACHDB].includes(- instance.engine+ convertEngineToNew(instance.engine));});@@ -335,10 +338,10 @@ const createV1 = async () => {characterSet:state.characterSet ||- defaultCharsetOfEngineV1(selectedInstance.value.engine),+ defaultCharsetOfEngineV1(convertEngineToNew(selectedInstance.value.engine)),collation:state.collation ||- defaultCollationOfEngineV1(selectedInstance.value.engine),+ defaultCollationOfEngineV1(convertEngineToNew(selectedInstance.value.engine)),cluster: state.cluster,owner,};diff --git a/frontend/src/components/Database/DatabaseOverviewInfo.vue b/frontend/src/components/Database/DatabaseOverviewInfo.vueindex ce43246bae..8ad9c888d4 100644--- a/frontend/src/components/Database/DatabaseOverviewInfo.vue+++ b/frontend/src/components/Database/DatabaseOverviewInfo.vue@@ -3,11 +3,11 @@class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-2"data-label="bb-database-overview-description-list">- <template v-if="instanceV1HasCollationAndCharacterSet(databaseEngine)">+ <template v-if="instanceV1HasCollationAndCharacterSet(convertEngineToNew(databaseEngine))"><div class="col-span-1 col-start-1"><dt class="text-sm font-medium text-control-light">{{- databaseEngine === Engine.POSTGRES+ convertEngineToNew(databaseEngine) === Engine.POSTGRES? $t("db.encoding"): $t("db.character-set")}}@@ -33,7 +33,7 @@</dt><dd class="mt-1 text-sm text-main"><span>- {{ database.state === State.ACTIVE ? "OK" : "NOT_FOUND" }}+ {{ convertStateToNew(database.state) === State.ACTIVE ? "OK" : "NOT_FOUND" }}</span></dd></div>@@ -53,7 +53,8 @@import { computed } from "vue";import { useDBSchemaV1Store } from "@/store";import { getDateForPbTimestamp, type ComposedDatabase } from "@/types";-import { Engine, State } from "@/types/proto/v1/common";+import { Engine, State } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew, convertStateToNew } from "@/utils/v1/common-conversions";import { instanceV1HasCollationAndCharacterSet } from "@/utils";const props = defineProps<{diff --git a/frontend/src/components/Database/DatabaseOverviewPanel.vue b/frontend/src/components/Database/DatabaseOverviewPanel.vueindex ad39222f4f..67efb0ae65 100644--- a/frontend/src/components/Database/DatabaseOverviewPanel.vue+++ b/frontend/src/components/Database/DatabaseOverviewPanel.vue@@ -17,10 +17,10 @@/></div>- <template v-if="databaseEngine !== Engine.REDIS">+ <template v-if="convertEngineToNew(databaseEngine) !== Engine.REDIS"><div class="mb-4 w-full flex flex-row justify-between items-center"><div class="text-lg leading-6 font-medium text-main">- <span v-if="databaseEngine === Engine.MONGODB">{{+ <span v-if="convertEngineToNew(databaseEngine) === Engine.MONGODB">{{$t("db.collections")}}</span><span v-else>{{ $t("db.tables") }}</span>@@ -50,7 +50,7 @@<templatev-if="- databaseEngine === Engine.POSTGRES || databaseEngine === Engine.HIVE+ convertEngineToNew(databaseEngine) === Engine.POSTGRES || convertEngineToNew(databaseEngine) === Engine.HIVE"><div@@ -73,7 +73,7 @@/></template>- <template v-if="databaseEngine === Engine.POSTGRES">+ <template v-if="convertEngineToNew(databaseEngine) === Engine.POSTGRES"><div class="mt-6 text-lg leading-6 font-medium text-main mb-4">{{ $t("db.extensions") }}</div>@@ -82,8 +82,8 @@<templatev-if="- databaseEngine === Engine.POSTGRES ||- databaseEngine === Engine.MSSQL+ convertEngineToNew(databaseEngine) === Engine.POSTGRES ||+ convertEngineToNew(databaseEngine) === Engine.MSSQL"><div class="mt-6 text-lg leading-6 font-medium text-main mb-4">@@ -96,7 +96,7 @@/></template>- <template v-if="instanceV1SupportsSequence(databaseEngine)">+ <template v-if="instanceV1SupportsSequence(convertEngineToNew(databaseEngine))"><div class="mt-6 text-lg leading-6 font-medium text-main mb-4">{{ $t("db.sequences") }}</div>@@ -107,7 +107,7 @@/></template>- <template v-if="databaseEngine === Engine.SNOWFLAKE">+ <template v-if="convertEngineToNew(databaseEngine) === Engine.SNOWFLAKE"><div class="mt-6 text-lg leading-6 font-medium text-main mb-4">{{ $t("db.streams") }}</div>@@ -127,7 +127,7 @@/></template>- <template v-if="instanceV1SupportsPackage(databaseEngine)">+ <template v-if="instanceV1SupportsPackage(convertEngineToNew(databaseEngine))"><div class="mt-6 text-lg leading-6 font-medium text-main mb-4">{{ $t("db.packages") }}</div>@@ -159,7 +159,8 @@ import ViewDataTable from "@/components/ViewDataTable.vue";import { SQL_EDITOR_SETTING_DATABASES_MODULE } from "@/router/sqlEditor";import { useDBSchemaV1Store } from "@/store";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {hasSchemaProperty,instanceV1SupportsPackage,@@ -197,7 +198,7 @@ const databaseEngine = computed(() => {});const hasSchemaPropertyV1 = computed(() => {- return hasSchemaProperty(databaseEngine.value);+ return hasSchemaProperty(convertEngineToNew(databaseEngine.value));});watch(diff --git a/frontend/src/components/ExternalTableDetailDrawer.vue b/frontend/src/components/ExternalTableDetailDrawer.vueindex 609dd72b63..1faddbde5b 100644--- a/frontend/src/components/ExternalTableDetailDrawer.vue+++ b/frontend/src/components/ExternalTableDetailDrawer.vue@@ -145,6 +145,7 @@ import {hasSchemaProperty,isDatabaseV1Queryable,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import ColumnDataTable from "./ColumnDataTable/index.vue";import { SQLEditorButtonV1 } from "./DatabaseDetail";@@ -205,7 +206,7 @@ const allowQuery = computed(() => {});const getTableName = (tableName: string) => {- if (hasSchemaProperty(instanceEngine.value)) {+ if (hasSchemaProperty(convertEngineToNew(instanceEngine.value))) {return `"${props.schemaName}"."${tableName}"`;}return tableName;diff --git a/frontend/src/components/FunctionDataTable.vue b/frontend/src/components/FunctionDataTable.vueindex 586fb35c57..380e5c00b3 100644--- a/frontend/src/components/FunctionDataTable.vue+++ b/frontend/src/components/FunctionDataTable.vue@@ -19,6 +19,7 @@ import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";import type { FunctionMetadata } from "@/types/proto/v1/database_service";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import EllipsisSQLView from "./EllipsisSQLView.vue";const props = defineProps({@@ -45,7 +46,7 @@ const columns = computed(() => {{key: "name",title: t("common.schema"),- hide: !hasSchemaProperty(engine.value),+ hide: !hasSchemaProperty(convertEngineToNew(engine.value)),ellipsis: {tooltip: true,},diff --git a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vueindex 1258dd085e..38854ab399 100644--- a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue+++ b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/DatabaseResourceSelector.vue@@ -50,13 +50,13 @@ import {type ComposedDatabase,type DatabaseResource,} from "@/types";-import { engineFromJSON } from "@/types/proto/v1/common";import {getDefaultPagination,type SearchParams,CommonFilterScopeIdList,extractProjectResourceName,} from "@/utils";+import { convertScopeValueToEngine } from "@/utils/v1/common-conversions";import Label from "./Label.vue";import type { DatabaseTreeOption } from "./common";import {@@ -225,7 +225,7 @@ const selectedLabels = computed(() => {const selectedEngines = computed(() => {return params.value.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => convertScopeValueToEngine(scope.value));});const databaseFilter = computed(diff --git a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/common.ts b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/common.tsindex cc15419fc2..db79c4164c 100644--- a/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/common.ts+++ b/frontend/src/components/GrantRequestPanel/DatabaseResourceForm/common.ts@@ -8,6 +8,7 @@ import {import type { ComposedDatabase, DatabaseResource } from "@/types";import type { TableMetadata } from "@/types/proto/v1/database_service";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";export type DatabaseResourceType =| "databases"@@ -125,7 +126,7 @@ export const getSchemaOrTableTreeOptions = ({if (!databaseMetadata) {return undefined;}- if (hasSchemaProperty(database.instanceResource.engine)) {+ if (hasSchemaProperty(convertEngineToNew(database.instanceResource.engine))) {const schemaNodes = databaseMetadata.schemas.map((schema): DatabaseTreeOption<"schemas"> => {const value = `${database.name}/schemas/${schema.name}`;diff --git a/frontend/src/components/Icon/EngineIcon.vue b/frontend/src/components/Icon/EngineIcon.vueindex 6fe1a53dc9..1dcf1d7cb6 100644--- a/frontend/src/components/Icon/EngineIcon.vue+++ b/frontend/src/components/Icon/EngineIcon.vue@@ -9,7 +9,7 @@import { twMerge } from "tailwind-merge";import { computed } from "vue";import { EngineIconPath } from "@/components/InstanceForm/constants";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";const props = defineProps<{engine: Engine;diff --git a/frontend/src/components/IndexTable.vue b/frontend/src/components/IndexTable.vueindex b1d8ed29bd..a1014afde1 100644--- a/frontend/src/components/IndexTable.vue+++ b/frontend/src/components/IndexTable.vue@@ -20,8 +20,9 @@ import type { PropType } from "vue";import { computed } from "vue";import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { IndexMetadata } from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";const props = defineProps({database: {@@ -36,13 +37,15 @@ const props = defineProps({const { t } = useI18n();const showVisibleColumn = computed(() => {+ const engine = convertEngineToNew(props.database.instanceResource.engine);return (- props.database.instanceResource.engine !== Engine.POSTGRES &&- props.database.instanceResource.engine !== Engine.MONGODB+ engine !== Engine.POSTGRES &&+ engine !== Engine.MONGODB);});const showCommentColumn = computed(() => {- return props.database.instanceResource.engine !== Engine.MONGODB;+ const engine = convertEngineToNew(props.database.instanceResource.engine);+ return engine !== Engine.MONGODB;});const columns = computed((): DataTableColumn<IndexMetadata>[] => {const cols: DataTableColumn<IndexMetadata>[] = [diff --git a/frontend/src/components/InstanceAssignment.vue b/frontend/src/components/InstanceAssignment.vueindex 13ce7a6472..92b4e7dd1e 100644--- a/frontend/src/components/InstanceAssignment.vue+++ b/frontend/src/components/InstanceAssignment.vue@@ -90,10 +90,10 @@ import {useActuatorV1Store,} from "@/store";import { environmentNamePrefix } from "@/store/modules/v1/common";-import { engineFromJSON } from "@/types/proto/v1/common";import { Instance } from "@/types/proto/v1/instance_service";import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";import { type SearchParams, hasWorkspacePermissionV2 } from "@/utils";+import { convertScopeValueToEngine } from "@/utils/v1/common-conversions";import LearnMoreLink from "./LearnMoreLink.vue";const props = withDefaults(@@ -149,7 +149,7 @@ const selectedEnvironment = computed(() => {const selectedEngines = computed(() => {return state.params.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => convertScopeValueToEngine(scope.value));});const filter = computed(() => ({diff --git a/frontend/src/components/InstanceForm/Buttons.vue b/frontend/src/components/InstanceForm/Buttons.vueindex be53442c01..33948d7860 100644--- a/frontend/src/components/InstanceForm/Buttons.vue+++ b/frontend/src/components/InstanceForm/Buttons.vue@@ -56,7 +56,7 @@ import {useInstanceV1Store,useSubscriptionV1Store,} from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {DataSource,DataSourceType,@@ -64,6 +64,7 @@ import {} from "@/types/proto/v1/instance_service";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { defer, isValidSpannerHost } from "@/utils";+import { convertEngineToOld } from "@/utils/v1/common-conversions";import { cloneDeep, isEqual } from "lodash-es";import { NButton } from "naive-ui";import { computed, ref } from "vue";@@ -136,7 +137,7 @@ const allowUpdate = computed((): boolean => {return false;}}- if (basicInfo.value.engine === Engine.SPANNER) {+ if (basicInfo.value.engine === convertEngineToOld(Engine.SPANNER)) {if (!isValidSpannerHost(adminDataSource.value.host)) {return false;}diff --git a/frontend/src/components/InstanceForm/DataSourceSection/CreateDataSourceExample.vue b/frontend/src/components/InstanceForm/DataSourceSection/CreateDataSourceExample.vueindex 7e05829d5d..edce7b2037 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/CreateDataSourceExample.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/CreateDataSourceExample.vue@@ -214,7 +214,7 @@ import {DATASOURCE_ADMIN_USER_NAME,DATASOURCE_READONLY_USER_NAME,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {DataSourceType,DataSource_AuthenticationType,diff --git a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vueindex 4f3dcf8a8b..2fc318ab76 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue@@ -2,22 +2,22 @@<!-- eslint-disable vue/no-mutating-props --><templatev-if="- basicInfo.engine !== Engine.SPANNER &&- basicInfo.engine !== Engine.BIGQUERY &&- basicInfo.engine !== Engine.DYNAMODB &&- basicInfo.engine !== Engine.DATABRICKS+ convertEngineToNew(basicInfo.engine) !== Engine.SPANNER &&+ convertEngineToNew(basicInfo.engine) !== Engine.BIGQUERY &&+ convertEngineToNew(basicInfo.engine) !== Engine.DYNAMODB &&+ convertEngineToNew(basicInfo.engine) !== Engine.DATABRICKS"><divv-if="- basicInfo.engine === Engine.MYSQL ||- basicInfo.engine === Engine.POSTGRES ||- basicInfo.engine === Engine.COSMOSDB ||- basicInfo.engine === Engine.MSSQL+ convertEngineToNew(basicInfo.engine) === Engine.MYSQL ||+ convertEngineToNew(basicInfo.engine) === Engine.POSTGRES ||+ convertEngineToNew(basicInfo.engine) === Engine.COSMOSDB ||+ convertEngineToNew(basicInfo.engine) === Engine.MSSQL"class="mt-2 sm:col-span-3 sm:col-start-1">- <template v-if="basicInfo.engine === Engine.COSMOSDB">+ <template v-if="convertEngineToNew(basicInfo.engine) === Engine.COSMOSDB"><NRadioGroupv-model:value="dataSource.authenticationType"class="textlabel"@@ -28,7 +28,7 @@</NRadio></NRadioGroup></template>- <template v-else-if="basicInfo.engine === Engine.MSSQL">+ <template v-else-if="convertEngineToNew(basicInfo.engine) === Engine.MSSQL"><NRadioGroupv-model:value="dataSource.authenticationType"class="textlabel"@@ -61,7 +61,7 @@</template></div><div- v-else-if="basicInfo.engine === Engine.HIVE"+ v-else-if="convertEngineToNew(basicInfo.engine) === Engine.HIVE"class="mt-2 sm:col-span-3 sm:col-start-1"><NRadioGroup@@ -77,7 +77,7 @@<CreateDataSourceExampleclass-name="sm:col-span-3 border-none mt-2":create-instance-flag="isCreating"- :engine="basicInfo.engine"+ :engine="convertEngineToNew(basicInfo.engine)":data-source-type="dataSource.type":authentication-type="dataSource.authenticationType"/>@@ -176,7 +176,7 @@class="mt-2 w-full":disabled="!allowEdit":placeholder="- basicInfo.engine === Engine.CLICKHOUSE ? $t('common.default') : ''+ convertEngineToNew(basicInfo.engine) === Engine.CLICKHOUSE ? $t('common.default') : ''"/></div>@@ -707,7 +707,7 @@<divv-if="- basicInfo.engine === Engine.REDIS &&+ convertEngineToNew(basicInfo.engine) === Engine.REDIS &&dataSource.redisType === DataSource_RedisType.SENTINEL">@@ -768,8 +768,8 @@</template><templatev-if="- basicInfo.engine === Engine.SPANNER ||- basicInfo.engine === Engine.BIGQUERY+ convertEngineToNew(basicInfo.engine) === Engine.SPANNER ||+ convertEngineToNew(basicInfo.engine) === Engine.BIGQUERY"><div class="mt-2 sm:col-span-3 sm:col-start-1">@@ -797,7 +797,7 @@/></template>- <template v-if="basicInfo.engine === Engine.ORACLE">+ <template v-if="convertEngineToNew(basicInfo.engine) === Engine.ORACLE"><OracleSIDAndServiceNameInputv-model:sid="dataSource.sid"v-model:service-name="dataSource.serviceName"@@ -805,7 +805,7 @@/></template>- <template v-if="basicInfo.engine === Engine.SNOWFLAKE">+ <template v-if="convertEngineToNew(basicInfo.engine) === Engine.SNOWFLAKE"><div class="mt-4 sm:col-span-3 sm:col-start-1"><div class="textlabel block">{{ $t("data-source.ssh.private-key") }}@@ -832,7 +832,7 @@ MIIEvQ...</div></template>- <template v-if="basicInfo.engine === Engine.DATABRICKS">+ <template v-if="convertEngineToNew(basicInfo.engine) === Engine.DATABRICKS"><div><div class="textlabel black mt-4">Warehouse ID@@ -1037,7 +1037,7 @@ MIIEvQ...<template v-if="dataSource.pendingCreate"><SslCertificateFormV1:value="dataSource"- :engine-type="basicInfo.engine"+ :engine-type="convertEngineToNew(basicInfo.engine)":disabled="!allowEdit"@change="handleSSLChange"/>@@ -1046,7 +1046,7 @@ MIIEvQ...<template v-if="dataSource.updateSsl"><SslCertificateFormV1:value="dataSource"- :engine-type="basicInfo.engine"+ :engine-type="convertEngineToNew(basicInfo.engine)":disabled="!allowEdit"@change="handleSSLChange"/>@@ -1107,7 +1107,7 @@ import LearnMoreLink from "@/components/LearnMoreLink.vue";import DroppableTextarea from "@/components/misc/DroppableTextarea.vue";import type { DataSourceOptions } from "@/types/dataSource";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { DataSource } from "@/types/proto/v1/instance_service";import {DataSourceExternalSecret,@@ -1125,6 +1125,7 @@ import {SASLConfig,} from "@/types/proto/v1/instance_service";import { onlyAllowNumber } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { EditDataSource } from "../common";import { useInstanceFormContext } from "../context";import CreateDataSourceExample from "./CreateDataSourceExample.vue";diff --git a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceSection.vue b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceSection.vueindex f4d95f647f..7fa588deaf 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceSection.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceSection.vue@@ -15,8 +15,9 @@<script setup lang="ts">import { DATASOURCE_READONLY_USER_NAME } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { DataSourceType } from "@/types/proto/v1/instance_service";+import { convertEngineToOld } from "@/utils/v1/common-conversions";import { wrapEditDataSource } from "../common";import { useInstanceFormContext } from "../context";import CreateReadOnlyDataSourceTips from "./CreateReadOnlyDataSourceTips.vue";@@ -45,9 +46,9 @@ const handleCreateRODataSource = () => {username: DATASOURCE_READONLY_USER_NAME,};if (- basicInfo.value.engine === Engine.SPANNER ||- basicInfo.value.engine === Engine.BIGQUERY ||- basicInfo.value.engine === Engine.DYNAMODB+ basicInfo.value.engine === convertEngineToOld(Engine.SPANNER) ||+ basicInfo.value.engine === convertEngineToOld(Engine.BIGQUERY) ||+ basicInfo.value.engine === convertEngineToOld(Engine.DYNAMODB)) {ds.host = adminDataSource.value.host;}diff --git a/frontend/src/components/InstanceForm/DataSourceSection/SslCertificateFormV1.vue b/frontend/src/components/InstanceForm/DataSourceSection/SslCertificateFormV1.vueindex 95016c7cd5..04da3d8c21 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/SslCertificateFormV1.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/SslCertificateFormV1.vue@@ -49,7 +49,7 @@ import { cloneDeep } from "lodash-es";import { NTabs, NTabPane } from "naive-ui";import { computed, reactive, watch } from "vue";import DroppableTextarea from "@/components/misc/DroppableTextarea.vue";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { DataSource } from "@/types/proto/v1/instance_service";type WithSslOptions = Partial<Pick<DataSource, "sslCa" | "sslCert" | "sslKey">>;diff --git a/frontend/src/components/InstanceForm/Form.vue b/frontend/src/components/InstanceForm/Form.vueindex 168101352a..d8c724f2f1 100644--- a/frontend/src/components/InstanceForm/Form.vue+++ b/frontend/src/components/InstanceForm/Form.vue@@ -3,14 +3,14 @@<div class="divide-y divide-block-border w-[850px]"><InstanceEngineRadioGridv-if="isCreating"- :engine="convertOldEngineToNew(basicInfo.engine)"- :engine-list="supportedEngineV1List().map(convertOldEngineToNew)"+ :engine="convertEngineToNew(basicInfo.engine)"+ :engine-list="supportedEngineV1List()"class="w-full mb-6 grid-cols-4 gap-2"- @update:engine="(newEngine: NewEngine) => changeInstanceEngine(convertNewEngineToOld(newEngine))"+ @update:engine="(newEngine: Engine) => changeInstanceEngine(newEngine)">- <template #suffix="{ engine }: { engine: NewEngine }">+ <template #suffix="{ engine }: { engine: Engine }"><BBBetaBadge- v-if="isEngineBeta(convertNewEngineToOld(engine))"+ v-if="isEngineBeta(engine)"class="absolute -top-1.5 -right-1 rounded text-xs !bg-gray-500 px-1 !py-0 z-10"/></template>@@ -104,13 +104,13 @@</div><div class="sm:col-span-3 sm:col-start-1">- <template v-if="basicInfo.engine === Engine.SPANNER">+ <template v-if="basicInfo.engine === convertEngineToOld(Engine.SPANNER)"><SpannerHostInputv-model:host="adminDataSource.host":allow-edit="allowEdit"/></template>- <template v-if="basicInfo.engine === Engine.BIGQUERY">+ <template v-if="basicInfo.engine === convertEngineToOld(Engine.BIGQUERY)"><BigQueryHostInputv-model:host="adminDataSource.host":allow-edit="allowEdit"@@ -118,7 +118,7 @@</template><template v-else><label for="host" class="textlabel block">- <template v-if="basicInfo.engine === Engine.SNOWFLAKE">+ <template v-if="basicInfo.engine === convertEngineToOld(Engine.SNOWFLAKE)">{{ $t("instance.account-locator") }}<span class="text-red-600 mr-2">*</span><LearnMoreLink@@ -126,7 +126,7 @@class="text-sm"/></template>- <template v-else-if="basicInfo.engine === Engine.COSMOSDB">+ <template v-else-if="basicInfo.engine === convertEngineToOld(Engine.COSMOSDB)">{{ $t("instance.endpoint") }}<span class="text-red-600 mr-2">*</span></template>@@ -149,7 +149,7 @@<template v-else>{{ $t("instance.host-or-socket") }}<span- v-if="basicInfo.engine !== Engine.DYNAMODB"+ v-if="basicInfo.engine !== convertEngineToOld(Engine.DYNAMODB)"class="text-red-600 mr-2">*</span>@@ -159,7 +159,7 @@v-model:value="adminDataSource.host"required:placeholder="- basicInfo.engine === Engine.SNOWFLAKE+ basicInfo.engine === convertEngineToOld(Engine.SNOWFLAKE)? $t('instance.your-snowflake-account-locator'): $t('instance.sentence.host.none-snowflake')"@@ -167,7 +167,7 @@:disabled="!allowEdit"/><div- v-if="basicInfo.engine === Engine.SNOWFLAKE"+ v-if="basicInfo.engine === convertEngineToOld(Engine.SNOWFLAKE)"class="mt-2 textinfolabel">{{ $t("instance.sentence.proxy.snowflake") }}@@ -177,10 +177,10 @@<templatev-if="- basicInfo.engine !== Engine.SPANNER &&- basicInfo.engine !== Engine.BIGQUERY &&- basicInfo.engine !== Engine.DATABRICKS &&- basicInfo.engine !== Engine.COSMOSDB &&+ basicInfo.engine !== convertEngineToOld(Engine.SPANNER) &&+ basicInfo.engine !== convertEngineToOld(Engine.BIGQUERY) &&+ basicInfo.engine !== convertEngineToOld(Engine.DATABRICKS) &&+ basicInfo.engine !== convertEngineToOld(Engine.COSMOSDB) &&adminDataSource.authenticationType !==DataSource_AuthenticationType.GOOGLE_CLOUD_SQL_IAM"@@ -200,7 +200,7 @@</template><div- v-if="basicInfo.engine === Engine.MONGODB"+ v-if="basicInfo.engine === convertEngineToOld(Engine.MONGODB)"class="sm:col-span-4 sm:col-start-1"><label@@ -224,7 +224,7 @@</div><div- v-if="basicInfo.engine === Engine.REDIS"+ v-if="basicInfo.engine === convertEngineToOld(Engine.REDIS)"class="sm:col-span-4 sm:col-start-1 space-y-2"><label@@ -319,7 +319,7 @@</div><div- v-if="basicInfo.engine === Engine.MONGODB && !adminDataSource.srv"+ v-if="basicInfo.engine === convertEngineToOld(Engine.MONGODB) && !adminDataSource.srv"class="sm:col-span-2 sm:col-start-1"><label for="replicaSet" class="textlabel">@@ -335,7 +335,7 @@<divv-if="- basicInfo.engine === Engine.MONGODB &&+ basicInfo.engine === convertEngineToOld(Engine.MONGODB) &&!adminDataSource.srv &&adminDataSource.additionalAddresses.length === 0"@@ -386,7 +386,7 @@<label for="external-link" class="textlabel inline-flex"><span class>{{- basicInfo.engine === Engine.SNOWFLAKE+ basicInfo.engine === convertEngineToOld(Engine.SNOWFLAKE)? $t("instance.snowflake-web-console"): $t("instance.external-link")}}@@ -399,7 +399,7 @@<heroicons-outline:external-link class="w-4 h-4" /></button></label>- <template v-if="basicInfo.engine === Engine.SNOWFLAKE">+ <template v-if="basicInfo.engine === convertEngineToOld(Engine.SNOWFLAKE)"><NInputrequiredclass="mt-1 w-full"@@ -423,7 +423,7 @@</div><!-- Connection Info -->- <template v-if="basicInfo.engine !== Engine.DYNAMODB">+ <template v-if="basicInfo.engine !== convertEngineToOld(Engine.DYNAMODB)"><p class="mt-6 pt-4 w-full text-lg leading-6 font-medium text-gray-900">{{ $t("instance.connection-info") }}</p>@@ -460,7 +460,7 @@</div><div- v-if="basicInfo.engine !== Engine.DYNAMODB && isCreating"+ v-if="basicInfo.engine !== convertEngineToOld(Engine.DYNAMODB) && isCreating"class="mt-6 pt-4 space-y-1"><p class="w-full text-lg leading-6 font-medium text-gray-900">@@ -519,8 +519,7 @@ import {import { adaptComposedInstance, type ComposedInstance } from "@/types";import { UNKNOWN_ID, isValidEnvironmentName } from "@/types";import type { Duration } from "@/types/proto/google/protobuf/duration";-import { Engine } from "@/types/proto/v1/common";-import { Engine as NewEngine } from "@/types/proto-es/v1/common_pb";+import { Engine } from "@/types/proto-es/v1/common_pb";import { DataSource_AuthenticationType } from "@/types/proto/v1/instance_service";import { DataSource_RedisType } from "@/types/proto/v1/instance_service";import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";@@ -532,76 +531,8 @@ import {urlfy,supportedEngineV1List,} from "@/utils";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";-// Engine conversion functions-// Old proto uses string values, new proto-es uses numeric values-const convertOldEngineToNew = (engine: Engine): NewEngine => {- switch (engine) {- case "ENGINE_UNSPECIFIED": return NewEngine.ENGINE_UNSPECIFIED;- case "MYSQL": return NewEngine.MYSQL;- case "POSTGRES": return NewEngine.POSTGRES;- case "CLICKHOUSE": return NewEngine.CLICKHOUSE;- case "SNOWFLAKE": return NewEngine.SNOWFLAKE;- case "SQLITE": return NewEngine.SQLITE;- case "TIDB": return NewEngine.TIDB;- case "MONGODB": return NewEngine.MONGODB;- case "REDIS": return NewEngine.REDIS;- case "ORACLE": return NewEngine.ORACLE;- case "SPANNER": return NewEngine.SPANNER;- case "MSSQL": return NewEngine.MSSQL;- case "REDSHIFT": return NewEngine.REDSHIFT;- case "MARIADB": return NewEngine.MARIADB;- case "OCEANBASE": return NewEngine.OCEANBASE;- case "DM": return NewEngine.DM;- case "RISINGWAVE": return NewEngine.RISINGWAVE;- case "OCEANBASE_ORACLE": return NewEngine.OCEANBASE_ORACLE;- case "STARROCKS": return NewEngine.STARROCKS;- case "DORIS": return NewEngine.DORIS;- case "HIVE": return NewEngine.HIVE;- case "ELASTICSEARCH": return NewEngine.ELASTICSEARCH;- case "BIGQUERY": return NewEngine.BIGQUERY;- case "DATABRICKS": return NewEngine.DATABRICKS;- case "COCKROACHDB": return NewEngine.COCKROACHDB;- case "COSMOSDB": return NewEngine.COSMOSDB;- case "CASSANDRA": return NewEngine.CASSANDRA;- case "TRINO": return NewEngine.TRINO;- default: return NewEngine.ENGINE_UNSPECIFIED;- }-};--const convertNewEngineToOld = (engine: NewEngine): Engine => {- switch (engine) {- case NewEngine.ENGINE_UNSPECIFIED: return Engine.ENGINE_UNSPECIFIED;- case NewEngine.MYSQL: return Engine.MYSQL;- case NewEngine.POSTGRES: return Engine.POSTGRES;- case NewEngine.CLICKHOUSE: return Engine.CLICKHOUSE;- case NewEngine.SNOWFLAKE: return Engine.SNOWFLAKE;- case NewEngine.SQLITE: return Engine.SQLITE;- case NewEngine.TIDB: return Engine.TIDB;- case NewEngine.MONGODB: return Engine.MONGODB;- case NewEngine.REDIS: return Engine.REDIS;- case NewEngine.ORACLE: return Engine.ORACLE;- case NewEngine.SPANNER: return Engine.SPANNER;- case NewEngine.MSSQL: return Engine.MSSQL;- case NewEngine.REDSHIFT: return Engine.REDSHIFT;- case NewEngine.MARIADB: return Engine.MARIADB;- case NewEngine.OCEANBASE: return Engine.OCEANBASE;- case NewEngine.DM: return Engine.DM;- case NewEngine.RISINGWAVE: return Engine.RISINGWAVE;- case NewEngine.OCEANBASE_ORACLE: return Engine.OCEANBASE_ORACLE;- case NewEngine.STARROCKS: return Engine.STARROCKS;- case NewEngine.DORIS: return Engine.DORIS;- case NewEngine.HIVE: return Engine.HIVE;- case NewEngine.ELASTICSEARCH: return Engine.ELASTICSEARCH;- case NewEngine.BIGQUERY: return Engine.BIGQUERY;- case NewEngine.DATABRICKS: return Engine.DATABRICKS;- case NewEngine.COCKROACHDB: return Engine.COCKROACHDB;- case NewEngine.COSMOSDB: return Engine.COSMOSDB;- case NewEngine.CASSANDRA: return Engine.CASSANDRA;- case NewEngine.TRINO: return Engine.TRINO;- default: return Engine.ENGINE_UNSPECIFIED;- }-};import LearnMoreLink from "../LearnMoreLink.vue";import BigQueryHostInput from "./BigQueryHostInput.vue";@@ -690,14 +621,14 @@ const currentRedisConnectionType = computed(() => {});const showAdditionalAddresses = computed(() => {- if (basicInfo.value.engine === Engine.CASSANDRA) {+ if (basicInfo.value.engine === convertEngineToOld(Engine.CASSANDRA)) {return true;}- if (basicInfo.value.engine === Engine.MONGODB && !adminDataSource.value.srv) {+ if (basicInfo.value.engine === convertEngineToOld(Engine.MONGODB) && !adminDataSource.value.srv) {return true;}if (- basicInfo.value.engine === Engine.REDIS &&+ basicInfo.value.engine === convertEngineToOld(Engine.REDIS) &&(adminDataSource.value.redisType === DataSource_RedisType.CLUSTER ||adminDataSource.value.redisType === DataSource_RedisType.SENTINEL)) {@@ -734,7 +665,7 @@ const changeInstanceEngine = (engine: Engine) => {: "host.docker.internal";}}- basicInfo.value.engine = engine;+ basicInfo.value.engine = convertEngineToOld(engine);};const handleChangeSyncDatabases = (databases: string[]) => {diff --git a/frontend/src/components/InstanceForm/InstanceForm.vue b/frontend/src/components/InstanceForm/InstanceForm.vueindex 11736e66d9..23229c2981 100644--- a/frontend/src/components/InstanceForm/InstanceForm.vue+++ b/frontend/src/components/InstanceForm/InstanceForm.vue@@ -17,8 +17,9 @@ import { useI18n } from "vue-i18n";import { onBeforeRouteLeave } from "vue-router";import { useEmitteryEventListener } from "@/composables/useEmitteryEventListener";import { useActuatorV1Store, useSettingV1Store } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { Instance } from "@/types/proto/v1/instance_service";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";import { FeatureModal } from "../FeatureGuard";import { defaultPortForEngine } from "./constants";import { provideInstanceFormContext } from "./context";@@ -70,7 +71,7 @@ onMounted(async () => {adminDataSource.value.host = actuatorStore.isDocker? "host.docker.internal": "127.0.0.1";- if (basicInfo.value.engine === Engine.DYNAMODB) {+ if (basicInfo.value.engine === convertEngineToOld(Engine.DYNAMODB)) {adminDataSource.value.host = "";}adminDataSource.value.srv = false;@@ -83,7 +84,7 @@ watch(() => basicInfo.value.engine,() => {if (isCreating.value) {- adminDataSource.value.port = defaultPortForEngine(basicInfo.value.engine);+ adminDataSource.value.port = defaultPortForEngine(convertEngineToNew(basicInfo.value.engine));}},{diff --git a/frontend/src/components/InstanceForm/common.ts b/frontend/src/components/InstanceForm/common.tsindex 00e439d65e..33f1c5c1fa 100644--- a/frontend/src/components/InstanceForm/common.ts+++ b/frontend/src/components/InstanceForm/common.ts@@ -6,9 +6,10 @@ import {UNKNOWN_ENVIRONMENT_NAME,UNKNOWN_INSTANCE_NAME,} from "@/types";-import { Engine, State } from "@/types/proto/v1/common";import type { DataSource, Instance } from "@/types/proto/v1/instance_service";import { DataSourceType } from "@/types/proto/v1/instance_service";+import { Engine, State } from "@/types/proto-es/v1/common_pb";+import { convertEngineToOld, convertStateToOld } from "@/utils/v1/common-conversions";import { PlanType } from "@/types/proto-es/v1/subscription_service_pb";import { calcUpdateMask } from "@/utils";@@ -66,9 +67,9 @@ export const extractBasicInfo = (instance: Instance | undefined): BasicInfo => {return {name: instance?.name ?? UNKNOWN_INSTANCE_NAME,- state: instance?.state ?? State.ACTIVE,+ state: instance?.state ?? convertStateToOld(State.ACTIVE),title: instance?.title ?? t("instance.new-instance"),- engine: instance?.engine ?? Engine.MYSQL,+ engine: instance?.engine ?? convertEngineToOld(Engine.MYSQL),externalLink: instance?.externalLink ?? "",environment: instance?.environment ?? UNKNOWN_ENVIRONMENT_NAME,activation: instancediff --git a/frontend/src/components/InstanceForm/constants.ts b/frontend/src/components/InstanceForm/constants.tsindex c0605f8d89..bbe9835c3d 100644--- a/frontend/src/components/InstanceForm/constants.ts+++ b/frontend/src/components/InstanceForm/constants.ts@@ -1,64 +1,64 @@import { computed } from "vue";-import { Engine } from "@/types/proto/v1/common";+import { Engine as OldEngine } from "@/types/proto-es/v1/common_pb";import { supportedEngineV1List } from "@/utils";-export const defaultPortForEngine = (engine: Engine) => {+export const defaultPortForEngine = (engine: OldEngine) => {switch (engine) {- case Engine.CLICKHOUSE:+ case OldEngine.CLICKHOUSE:return "9000";- case Engine.MYSQL:+ case OldEngine.MYSQL:return "3306";- case Engine.POSTGRES:+ case OldEngine.POSTGRES:return "5432";- case Engine.SNOWFLAKE:+ case OldEngine.SNOWFLAKE:return "";- case Engine.SQLITE:+ case OldEngine.SQLITE:return "";- case Engine.TIDB:+ case OldEngine.TIDB:return "4000";- case Engine.MONGODB:+ case OldEngine.MONGODB:return "27017";- case Engine.REDIS:+ case OldEngine.REDIS:return "6379";- case Engine.ORACLE:+ case OldEngine.ORACLE:return "1521";- case Engine.SPANNER:+ case OldEngine.SPANNER:return "";- case Engine.MSSQL:+ case OldEngine.MSSQL:return "1433";- case Engine.REDSHIFT:+ case OldEngine.REDSHIFT:return "5439";- case Engine.MARIADB:+ case OldEngine.MARIADB:return "3306";- case Engine.OCEANBASE:+ case OldEngine.OCEANBASE:return "2883";- case Engine.DM:+ case OldEngine.DM:return "5236";- case Engine.RISINGWAVE:+ case OldEngine.RISINGWAVE:return "4566";- case Engine.OCEANBASE_ORACLE:+ case OldEngine.OCEANBASE_ORACLE:return "1521";- case Engine.STARROCKS:+ case OldEngine.STARROCKS:return "9030";- case Engine.DORIS:+ case OldEngine.DORIS:return "9030";- case Engine.HIVE:+ case OldEngine.HIVE:return "10000";- case Engine.ELASTICSEARCH:+ case OldEngine.ELASTICSEARCH:return "9200";- case Engine.BIGQUERY:+ case OldEngine.BIGQUERY:return "";- case Engine.DYNAMODB:+ case OldEngine.DYNAMODB:return "";- case Engine.DATABRICKS:+ case OldEngine.DATABRICKS:return "";- case Engine.COCKROACHDB:+ case OldEngine.COCKROACHDB:return "26257";- case Engine.COSMOSDB:+ case OldEngine.COSMOSDB:return "";- case Engine.CASSANDRA:+ case OldEngine.CASSANDRA:return "9042";- case Engine.TRINO:+ case OldEngine.TRINO:return "8080";}throw new Error("engine port unknown");@@ -69,48 +69,48 @@ export const EngineList = computed(() => {});export const EngineIconPath: Record<string, string> = {- [Engine.MYSQL]: new URL("@/assets/db/mysql.png", import.meta.url).href,- [Engine.POSTGRES]: new URL("@/assets/db/postgres.png", import.meta.url).href,- [Engine.TIDB]: new URL("@/assets/db/tidb.png", import.meta.url).href,- [Engine.SNOWFLAKE]: new URL("@/assets/db/snowflake.png", import.meta.url)+ [OldEngine.MYSQL]: new URL("@/assets/db/mysql.png", import.meta.url).href,+ [OldEngine.POSTGRES]: new URL("@/assets/db/postgres.png", import.meta.url).href,+ [OldEngine.TIDB]: new URL("@/assets/db/tidb.png", import.meta.url).href,+ [OldEngine.SNOWFLAKE]: new URL("@/assets/db/snowflake.png", import.meta.url).href,- [Engine.CLICKHOUSE]: new URL("@/assets/db/clickhouse.png", import.meta.url)+ [OldEngine.CLICKHOUSE]: new URL("@/assets/db/clickhouse.png", import.meta.url).href,- [Engine.MONGODB]: new URL("@/assets/db/mongodb.png", import.meta.url).href,- [Engine.SPANNER]: new URL("@/assets/db/spanner.png", import.meta.url).href,- [Engine.REDIS]: new URL("@/assets/db/redis.png", import.meta.url).href,- [Engine.ORACLE]: new URL("@/assets/db/oracle.svg", import.meta.url).href,- [Engine.DM]: new URL("@/assets/db/dm.png", import.meta.url).href,- [Engine.MSSQL]: new URL("@/assets/db/mssql.svg", import.meta.url).href,- [Engine.REDSHIFT]: new URL("@/assets/db/redshift.svg", import.meta.url).href,- [Engine.MARIADB]: new URL("@/assets/db/mariadb.png", import.meta.url).href,- [Engine.OCEANBASE]: new URL(+ [OldEngine.MONGODB]: new URL("@/assets/db/mongodb.png", import.meta.url).href,+ [OldEngine.SPANNER]: new URL("@/assets/db/spanner.png", import.meta.url).href,+ [OldEngine.REDIS]: new URL("@/assets/db/redis.png", import.meta.url).href,+ [OldEngine.ORACLE]: new URL("@/assets/db/oracle.svg", import.meta.url).href,+ [OldEngine.DM]: new URL("@/assets/db/dm.png", import.meta.url).href,+ [OldEngine.MSSQL]: new URL("@/assets/db/mssql.svg", import.meta.url).href,+ [OldEngine.REDSHIFT]: new URL("@/assets/db/redshift.svg", import.meta.url).href,+ [OldEngine.MARIADB]: new URL("@/assets/db/mariadb.png", import.meta.url).href,+ [OldEngine.OCEANBASE]: new URL("@/assets/db/oceanbase-mysql.svg",import.meta.url).href,- [Engine.OCEANBASE_ORACLE]: new URL(+ [OldEngine.OCEANBASE_ORACLE]: new URL("@/assets/db/oceanbase-oracle.svg",import.meta.url).href,- [Engine.RISINGWAVE]: new URL("@/assets/db/risingwave.png", import.meta.url)+ [OldEngine.RISINGWAVE]: new URL("@/assets/db/risingwave.png", import.meta.url).href,- [Engine.STARROCKS]: new URL("@/assets/db/starrocks.png", import.meta.url)+ [OldEngine.STARROCKS]: new URL("@/assets/db/starrocks.png", import.meta.url).href,- [Engine.DORIS]: new URL("@/assets/db/doris.png", import.meta.url).href,- [Engine.HIVE]: new URL("@/assets/db/hive.svg", import.meta.url).href,- [Engine.ELASTICSEARCH]: new URL(+ [OldEngine.DORIS]: new URL("@/assets/db/doris.png", import.meta.url).href,+ [OldEngine.HIVE]: new URL("@/assets/db/hive.svg", import.meta.url).href,+ [OldEngine.ELASTICSEARCH]: new URL("@/assets/db/elasticsearch.svg",import.meta.url).href,- [Engine.BIGQUERY]: new URL("@/assets/db/bigquery.svg", import.meta.url).href,- [Engine.DYNAMODB]: new URL("@/assets/db/dynamodb.svg", import.meta.url).href,- [Engine.DATABRICKS]: new URL("@/assets/db/databricks.svg", import.meta.url)+ [OldEngine.BIGQUERY]: new URL("@/assets/db/bigquery.svg", import.meta.url).href,+ [OldEngine.DYNAMODB]: new URL("@/assets/db/dynamodb.svg", import.meta.url).href,+ [OldEngine.DATABRICKS]: new URL("@/assets/db/databricks.svg", import.meta.url).href,- [Engine.COCKROACHDB]: new URL("@/assets/db/cockroachdb.png", import.meta.url)+ [OldEngine.COCKROACHDB]: new URL("@/assets/db/cockroachdb.png", import.meta.url).href,- [Engine.COSMOSDB]: new URL("@/assets/db/cosmosdb.svg", import.meta.url).href,- [Engine.CASSANDRA]: new URL("@/assets/db/cassandra.svg", import.meta.url).href,- [Engine.TRINO]: new URL("@/assets/db/trino.svg", import.meta.url).href,+ [OldEngine.COSMOSDB]: new URL("@/assets/db/cosmosdb.svg", import.meta.url).href,+ [OldEngine.CASSANDRA]: new URL("@/assets/db/cassandra.svg", import.meta.url).href,+ [OldEngine.TRINO]: new URL("@/assets/db/trino.svg", import.meta.url).href,};export const MongoDBConnectionStringSchemaList = [diff --git a/frontend/src/components/InstanceForm/context.ts b/frontend/src/components/InstanceForm/context.tsindex cdad96845a..fba6762dc3 100644--- a/frontend/src/components/InstanceForm/context.ts+++ b/frontend/src/components/InstanceForm/context.ts@@ -21,8 +21,9 @@ import {useSubscriptionV1Store,} from "@/store";import { isValidEnvironmentName, unknownEnvironment } from "@/types";-import { Engine, State } from "@/types/proto/v1/common";import { Instance, type DataSource } from "@/types/proto/v1/instance_service";+import { Engine, State } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew, convertStateToNew, convertStateToOld } from "@/utils/v1/common-conversions";import {DataSourceExternalSecret_AuthType,DataSourceExternalSecret_SecretType,@@ -79,7 +80,7 @@ export const provideInstanceFormContext = (baseContext: {if (isCreating.value) return true;return (- instance.value?.state === State.ACTIVE &&+ convertStateToNew(instance.value?.state || convertStateToOld(State.STATE_UNSPECIFIED)) === State.ACTIVE &&hasWorkspacePermissionV2("bb.instances.update"));});@@ -140,11 +141,11 @@ export const provideInstanceFormContext = (baseContext: {return !!ds.region;}- if (basicInfo.value.engine === Engine.ORACLE) {+ if (convertEngineToNew(basicInfo.value.engine) === Engine.ORACLE) {if (!ds.sid && !ds.serviceName) {return false;}- } else if (basicInfo.value.engine === Engine.DATABRICKS) {+ } else if (convertEngineToNew(basicInfo.value.engine) === Engine.DATABRICKS) {if (!ds.warehouseId) {return false;}@@ -215,7 +216,7 @@ export const provideInstanceFormContext = (baseContext: {) {return false;}- if (basicInfo.value.engine === Engine.SPANNER) {+ if (convertEngineToNew(basicInfo.value.engine) === Engine.SPANNER) {return (basicInfo.value.title.trim() &&isValidSpannerHost(adminDataSource.value.host) &&@@ -224,14 +225,14 @@ export const provideInstanceFormContext = (baseContext: {}// Check Host- if (basicInfo.value.engine !== Engine.DYNAMODB) {+ if (convertEngineToNew(basicInfo.value.engine) !== Engine.DYNAMODB) {if (adminDataSource.value.host === "") {return false;}}// Redis Check Master Name- if (basicInfo.value.engine === Engine.REDIS) {+ if (convertEngineToNew(basicInfo.value.engine) === Engine.REDIS) {if (adminDataSource.value.redisType === DataSource_RedisType.SENTINEL &&adminDataSource.value.masterName === ""@@ -285,11 +286,11 @@ export const provideInstanceFormContext = (baseContext: {if (!showDatabase.value) {ds.database = "";}- if (instance.engine !== Engine.ORACLE) {+ if (convertEngineToNew(instance.engine) !== Engine.ORACLE) {ds.sid = "";ds.serviceName = "";}- if (instance.engine !== Engine.MONGODB) {+ if (convertEngineToNew(instance.engine) !== Engine.MONGODB) {ds.srv = false;ds.authenticationDatabase = "";}diff --git a/frontend/src/components/InstanceForm/specs.ts b/frontend/src/components/InstanceForm/specs.tsindex 619ab3443d..db5f15d834 100644--- a/frontend/src/components/InstanceForm/specs.ts+++ b/frontend/src/components/InstanceForm/specs.ts@@ -1,9 +1,10 @@import { computed, type Ref } from "vue";-import { Engine } from "@/types/proto/v1/common";import { DataSourceType } from "@/types/proto/v1/instance_service";+import { Engine } from "@/types/proto-es/v1/common_pb";import { instanceV1HasExtraParameters, instanceV1HasSSH, instanceV1HasSSL } from "@/utils";import type { BasicInfo, EditDataSource } from "./common";import { defaultPortForEngine } from "./constants";+import { convertEngineToNew } from "@/utils/v1/common-conversions";export const useInstanceSpecs = (basicInfo: Ref<BasicInfo>,@@ -12,27 +13,27 @@ export const useInstanceSpecs = () => {const showDatabase = computed((): boolean => {return (- (basicInfo.value.engine === Engine.POSTGRES ||- basicInfo.value.engine === Engine.REDSHIFT ||- basicInfo.value.engine === Engine.COCKROACHDB ||- basicInfo.value.engine === Engine.MSSQL) &&+ (convertEngineToNew(basicInfo.value.engine) === Engine.POSTGRES ||+ convertEngineToNew(basicInfo.value.engine) === Engine.REDSHIFT ||+ convertEngineToNew(basicInfo.value.engine) === Engine.COCKROACHDB ||+ convertEngineToNew(basicInfo.value.engine) === Engine.MSSQL) &&editingDataSource.value?.type === DataSourceType.ADMIN);});const showSSL = computed((): boolean => {- return instanceV1HasSSL(basicInfo.value.engine);+ return instanceV1HasSSL(convertEngineToNew(basicInfo.value.engine));});const showSSH = computed((): boolean => {- return instanceV1HasSSH(basicInfo.value.engine);+ return instanceV1HasSSH(convertEngineToNew(basicInfo.value.engine));});const isEngineBeta = (_engine: Engine): boolean => {return false;};const defaultPort = computed(() => {- return defaultPortForEngine(basicInfo.value.engine);+ return defaultPortForEngine(convertEngineToNew(basicInfo.value.engine));});const instanceLink = computed(() => {- if (basicInfo.value.engine === Engine.SNOWFLAKE) {+ if (convertEngineToNew(basicInfo.value.engine) === Engine.SNOWFLAKE) {if (adminDataSource.value.host) {return `https://${adminDataSource.value.host.split("@")[0]@@ -44,24 +45,24 @@ export const useInstanceSpecs = (const allowEditPort = computed(() => {// MongoDB doesn't support specify port if using srv record.return !(- basicInfo.value.engine === Engine.MONGODB && editingDataSource.value?.srv+ convertEngineToNew(basicInfo.value.engine) === Engine.MONGODB && editingDataSource.value?.srv);});const allowUsingEmptyPassword = computed(() => {- return basicInfo.value.engine !== Engine.SPANNER;+ return convertEngineToNew(basicInfo.value.engine) !== Engine.SPANNER;});const showAuthenticationDatabase = computed((): boolean => {- return basicInfo.value.engine === Engine.MONGODB;+ return convertEngineToNew(basicInfo.value.engine) === Engine.MONGODB;});const hasReadonlyReplicaHost = computed((): boolean => {- return basicInfo.value.engine !== Engine.SPANNER;+ return convertEngineToNew(basicInfo.value.engine) !== Engine.SPANNER;});const hasReadonlyReplicaPort = computed((): boolean => {- return basicInfo.value.engine !== Engine.SPANNER;+ return convertEngineToNew(basicInfo.value.engine) !== Engine.SPANNER;});const hasExtraParameters = computed((): boolean => {- return instanceV1HasExtraParameters(basicInfo.value.engine);+ return instanceV1HasExtraParameters(convertEngineToNew(basicInfo.value.engine));});return {diff --git a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportFormatSelector.vue b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportFormatSelector.vueindex 366a88258b..124561d3b6 100644--- a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportFormatSelector.vue+++ b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportFormatSelector.vue@@ -4,11 +4,11 @@v-for="formatItem in availableExportFormats":key="formatItem":value="formatItem"- :label="exportFormatToJSON(formatItem)"+ :label="exportFormatToString(formatItem)"/></NRadioGroup><template v-else>- <span class="text-base">{{ exportFormatToJSON(format) }}</span>+ <span class="text-base">{{ exportFormatToString(format) }}</span></template></template>@@ -16,7 +16,8 @@import { NRadioGroup, NRadio } from "naive-ui";import { computed } from "vue";import { onMounted } from "vue";-import { ExportFormat, exportFormatToJSON } from "@/types/proto/v1/common";+import { ExportFormat } from "@/types/proto-es/v1/common_pb";+import { exportFormatToString } from "@/utils/v1/common-conversions";const props = defineProps<{format: ExportFormat;diff --git a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vueindex 2597a64a83..d7b4097ccc 100644--- a/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue+++ b/frontend/src/components/IssueV1/components/DataExportSection/ExportOptionSection/ExportOptionSection.vue@@ -40,7 +40,7 @@}}</span><ExportFormatSelector:key="refreshKey"- v-model:format="state.config.format"+ v-model:format="convertedFormat":editable="optionsEditable"/></div>@@ -71,6 +71,7 @@ import { create } from "@bufbuild/protobuf";import { planServiceClientConnect } from "@/grpcweb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";+import { convertExportFormatToNew, convertExportFormatToOld } from "@/utils/v1/common-conversions";import { pushNotification } from "@/store";import { IssueStatus } from "@/types/proto/v1/issue_service";import {@@ -111,6 +112,16 @@ const denyEditTaskReasons = computed(() =>allowUserToEditStatementForTask(issue.value, selectedTask.value));+// Convert between old and new ExportFormat types+const convertedFormat = computed({+ get() {+ return convertExportFormatToNew(state.config.format);+ },+ set(value) {+ state.config.format = convertExportFormatToOld(value);+ }+});+const handleCancelEdit = () => {state.isEditing = false;state.config = Plan_ExportDataConfig.fromPartial({diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vueindex 447ba99ca5..acbe26526f 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/create/CreateButton.vue@@ -86,7 +86,7 @@ import {ReleaseFileType,} from "@/types/proto-es/v1/release_service_pb";import { CreateRolloutRequestSchema } from "@/types/proto-es/v1/rollout_service_pb";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import { Issue, Issue_Type } from "@/types/proto/v1/issue_service";import type { Plan_ExportDataConfig } from "@/types/proto/v1/plan_service";import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";@@ -113,6 +113,7 @@ import {convertOldPlanToNew,convertNewPlanToOld,} from "@/utils/v1/plan-conversions";+import { convertEngineToOld } from "@/utils/v1/common-conversions";import {convertNewCheckReleaseResponseToOld,convertOldChangeTypeToNew,@@ -236,9 +237,9 @@ const createSheets = async () => {// The sheet is pending createconst sheet = getLocalSheetByName(config.sheet);const engine = await databaseEngineForSpec(spec);- sheet.engine = engine;+ sheet.engine = convertEngineToOld(engine as Engine);pendingCreateSheetMap.set(sheet.name, sheet);- await maybeFormatSQL(sheet, engine);+ await maybeFormatSQL(sheet, engine as Engine);}}const pendingCreateSheetList = Array.from(pendingCreateSheetMap.values());diff --git a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vueindex ebfa1b9b26..f91fcdc6d7 100644--- a/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue+++ b/frontend/src/components/IssueV1/components/HeaderSection/Actions/request/ExportArchiveDownloadButton.vue@@ -33,8 +33,8 @@ import { useIssueContext } from "@/components/IssueV1";import { issueServiceClientConnect } from "@/grpcweb";import { BatchUpdateIssuesStatusRequestSchema, IssueStatus as NewIssueStatus } from "@/types/proto-es/v1/issue_service_pb";import { useSQLStore } from "@/store";-import { ExportFormat } from "@/types/proto/v1/common";import { IssueStatus } from "@/types/proto/v1/issue_service";+import { ExportFormat } from "@/types/proto-es/v1/common_pb";import {Plan_ExportDataConfig,Plan_Spec,@@ -45,6 +45,7 @@ import {} from "@/types/proto/v1/rollout_service";import { ExportRequest } from "@/types/proto/v1/sql_service";import { flattenTaskV1List } from "@/utils";+import { convertExportFormatToNew } from "@/utils/v1/common-conversions";interface LocalState {isExporting: boolean;@@ -110,7 +111,7 @@ const getExportFileType = (exportDataConfig: Plan_ExportDataConfig) => {if (exportDataConfig.password) {return "application/zip";}- switch (exportDataConfig.format) {+ switch (convertExportFormatToNew(exportDataConfig.format)) {case ExportFormat.CSV:return "text/csv";case ExportFormat.JSON:diff --git a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vueindex e82b7a1cac..28214a7a75 100644--- a/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue+++ b/frontend/src/components/IssueV1/components/IssueCommentSection/Subscribers/SubscriberList.vue@@ -45,11 +45,12 @@ import { updateIssueSubscribers, useIssueContext } from "@/components/IssueV1";import UserAvatar from "@/components/User/UserAvatar.vue";import { useUserStore } from "@/store";import { DEBOUNCE_SEARCH_DELAY, unknownUser } from "@/types";-import { State } from "@/types/proto/v1/common";import { type User } from "@/types/proto/v1/user_service";import { UserType } from "@/types/proto/v1/user_service";+import { State } from "@/types/proto-es/v1/common_pb";import { getDefaultPagination } from "@/utils";import SubscriberListItem from "./SubscriberListItem.vue";+import { convertStateToOld } from "@/utils/v1/common-conversions";defineProps<{readonly?: boolean;@@ -101,7 +102,7 @@ const options = computed(() => {const subscribers = new Set(issue.value.subscribers);const options = state.rawUserList.filter(- (user) => user.userType === UserType.USER && user.state === State.ACTIVE+ (user) => user.userType === UserType.USER && user.state === convertStateToOld(State.ACTIVE)).map<UserSelectOption>((user) => ({user,diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vueindex 65955cf102..08bd428822 100644--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/PreBackupSection.vue@@ -14,6 +14,7 @@ import { PreBackupSection } from "@/components/Plan/components/Configuration";import { providePreBackupSettingContext } from "@/components/Plan/components/Configuration/PreBackupSection/context";import { databaseForTask } from "@/components/Rollout/RolloutDetail";import { useCurrentProjectV1 } from "@/store";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { Plan } from "@/types/proto/v1/plan_service";import { TaskRun_Status } from "@/types/proto/v1/rollout_service";import TaskRollbackSection from "./TaskRollbackSection.vue";@@ -53,7 +54,7 @@ const shouldShowTaskRollbackSection = computed((): boolean => {return false;}if (- !ROLLBACK_AVAILABLE_ENGINES.includes(database.value.instanceResource.engine)+ !ROLLBACK_AVAILABLE_ENGINES.includes(convertEngineToNew(database.value.instanceResource.engine))) {return false;}diff --git a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/common.ts b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/common.tsindex 9e86235fbc..11c00ed3eb 100644--- a/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/common.ts+++ b/frontend/src/components/IssueV1/components/Sidebar/PreBackupSection/common.ts@@ -1,4 +1,4 @@-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";export const ROLLBACK_AVAILABLE_ENGINES = [Engine.MYSQL,diff --git a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vueindex d6ebf143ee..03cd67c85a 100644--- a/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue+++ b/frontend/src/components/IssueV1/components/Sidebar/ReleaseInfo.vue@@ -9,7 +9,7 @@target="_blank"class="normal-link truncate":class="{- 'line-through opacity-60': release.state === State.DELETED,+ 'line-through opacity-60': release.state === convertStateToOld(State.DELETED),}">{{ release.title || release.name }}@@ -23,7 +23,8 @@ import { computed } from "vue";import { specForTask, useIssueContext } from "@/components/IssueV1";import { useReleaseByName } from "@/store";import { isValidReleaseName } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";const { issue, selectedTask } = useIssueContext();diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vueindex 0dd5e68dea..ae35b453bd 100644--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorActionPopover.vue@@ -25,9 +25,10 @@ import { computed } from "vue";import { useIssueContext } from "@/components/IssueV1/logic";import { databaseForTask } from "@/components/Rollout/RolloutDetail";import { useCurrentProjectV1 } from "@/store";-import { Engine } from "@/types/proto/v1/common";import { Task_Type } from "@/types/proto/v1/rollout_service";+import { Engine } from "@/types/proto-es/v1/common_pb";import { useInstanceV1EditorLanguage } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import FormatOnSaveCheckbox from "./FormatOnSaveCheckbox.vue";import InstanceRoleSelect from "./InstanceRoleSelect.vue";@@ -44,7 +45,8 @@ const language = useInstanceV1EditorLanguage(const shouldShowInstanceRoleSelect = computed(() => {// Only works for postgres.- if (![Engine.POSTGRES].includes(database.value.instanceResource.engine)) {+ const engine = convertEngineToNew(database.value.instanceResource.engine);+ if (![Engine.POSTGRES].includes(engine)) {return false;}// Only works for DDL/DML, exclude creating database and schema baseline.diff --git a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vueindex 923b5734ca..11f7317adf 100644--- a/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/IssueV1/components/StatementSection/EditorView/EditorView.vue@@ -194,6 +194,7 @@ import { create } from "@bufbuild/protobuf";import { planServiceClientConnect } from "@/grpcweb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";import { emitWindowEvent } from "@/plugins";import {pushNotification,@@ -205,6 +206,7 @@ import { dialectOfEngineV1 } from "@/types";import { IssueStatus } from "@/types/proto/v1/issue_service";import { Sheet } from "@/types/proto/v1/sheet_service";import type { Advice } from "@/types/proto/v1/sql_service";+import type { Engine } from "@/types/proto-es/v1/common_pb";import {flattenTaskV1List,getSheetStatement,@@ -267,7 +269,7 @@ const filename = computed(() => {});const dialect = computed((): SQLDialect => {const db = database.value;- return dialectOfEngineV1(db.instanceResource.engine);+ return dialectOfEngineV1(convertEngineToNew(db.instanceResource.engine));});const statementTitle = computed(() => {return language.value === "sql" ? t("common.sql") : t("common.statement");@@ -456,7 +458,7 @@ const updateStatement = async (statement: string) => {const sheet = Sheet.fromPartial({...createEmptyLocalSheet(),title: issue.value.title,- engine: await databaseEngineForSpec(head(planPatch.specs)),+ engine: convertEngineToOld(await databaseEngineForSpec(head(planPatch.specs)) as Engine),});setSheetStatement(sheet, statement);const createdSheet = await useSheetV1Store().createSheet(diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vueindex 362325935e..351a8fc18f 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunComment.vue@@ -41,6 +41,7 @@ import {} from "@/types";import { TaskRun_Status, Task_Type } from "@/types/proto/v1/rollout_service";import { databaseV1Url, extractTaskUID, flattenTaskV1List } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { extractChangelogUID } from "@/utils/v1/changelog";import { useIssueContext } from "../../logic";import { displayTaskRunLogEntryType } from "./TaskRunLogTable/common";@@ -172,7 +173,7 @@ const commentLink = computed((): CommentLink => {title: t("common.troubleshoot"),link: "https://docs.bytebase.com/change-database/troubleshoot/?source=console#duplicate-version",};- } else if (isPostgresFamily(db.instanceResource.engine)) {+ } else if (isPostgresFamily(convertEngineToNew(db.instanceResource.engine))) {return {title: t("common.troubleshoot"),link: "https://docs.bytebase.com/change-database/troubleshoot/?source=console#postgresql",diff --git a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vueindex cc8a0cd477..35f667e9d5 100644--- a/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue+++ b/frontend/src/components/IssueV1/components/TaskRunSection/TaskRunDetail.vue@@ -29,8 +29,9 @@ import { NButton, NTabs, NTabPane } from "naive-ui";import { computed, reactive, ref, watch } from "vue";import { databaseForTask } from "@/components/Rollout/RolloutDetail";import { useSheetV1Store, useCurrentProjectV1 } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { TaskRun_Status, type TaskRun } from "@/types/proto/v1/rollout_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useIssueContext } from "../../logic";import TaskRunLogTable from "./TaskRunLogTable";import TaskRunSession from "./TaskRunSession";@@ -61,7 +62,7 @@ const sheet = computed(() =>const showTaskRunSessionTab = computed(() =>TASK_RUN_SESSION_SUPPORTED_ENGINES.includes(- database.value.instanceResource.engine+ convertEngineToNew(database.value.instanceResource.engine)));diff --git a/frontend/src/components/IssueV1/logic/utils.ts b/frontend/src/components/IssueV1/logic/utils.tsindex a8e4fb0902..b947bdfbf1 100644--- a/frontend/src/components/IssueV1/logic/utils.ts+++ b/frontend/src/components/IssueV1/logic/utils.ts@@ -13,7 +13,8 @@ import {unknownEnvironment,unknownInstance,} from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { IssueStatus } from "@/types/proto/v1/issue_service";import type { Plan } from "@/types/proto/v1/plan_service";import { Task, Task_Status, Task_Type } from "@/types/proto/v1/rollout_service";@@ -83,7 +84,7 @@ export const mockDatabase = (useEnvironmentV1Store().getEnvironmentByName(db.instanceResource.environment) ?? unknownEnvironment();- db.state = State.DELETED;+ db.state = convertStateToOld(State.DELETED);return db;};diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vueindex c98c122efd..d38d012623 100644--- a/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue+++ b/frontend/src/components/Member/MemberDataTable/cells/UserNameCell.vue@@ -5,7 +5,7 @@<div class="flex flex-row items-center"><div class="flex flex-col"><div class="flex flex-row items-center space-x-2">- <div :class="user.state === State.DELETED ? 'line-through' : ''">+ <div :class="convertStateToNew(user.state) === State.DELETED ? 'line-through' : ''"><spanv-if="onClickUser"class="normal-link truncate max-w-[10rem]"@@ -28,7 +28,7 @@</router-link></div><NTag- v-if="user.state === State.DELETED"+ v-if="convertStateToNew(user.state) === State.DELETED"size="small"roundtype="error"@@ -62,7 +62,8 @@ import YouTag from "@/components/misc/YouTag.vue";import { useCurrentUserV1, usePermissionStore } from "@/store";import { SYSTEM_BOT_USER_NAME } from "@/types";import { unknownUser } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import { User, UserType } from "@/types/proto/v1/user_service";import type { MemberBinding } from "../../types";diff --git a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vueindex ae33ed0d3e..1c66be9d96 100644--- a/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue+++ b/frontend/src/components/Member/MemberDataTable/cells/UserOperationsCell.vue@@ -40,7 +40,8 @@ import { PencilIcon, Trash2Icon } from "lucide-vue-next";import { NButton, NPopconfirm } from "naive-ui";import { computed } from "vue";import { unknownUser, SYSTEM_BOT_USER_NAME } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import type { MemberBinding } from "../../types";const props = defineProps<{@@ -72,6 +73,6 @@ const allowUpdate = computed(() => {// Cannot edit the member binding for [email protected], but can edit allUsersreturn false;}- return user.state === State.ACTIVE;+ return convertStateToNew(user.state) === State.ACTIVE;});</script>diff --git a/frontend/src/components/Member/utils.ts b/frontend/src/components/Member/utils.tsindex b490a249a3..7acec7dc37 100644--- a/frontend/src/components/Member/utils.ts+++ b/frontend/src/components/Member/utils.ts@@ -9,7 +9,8 @@ import {getGroupEmailInBinding,groupBindingPrefix,} from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { Group } from "@/types/proto/v1/group_service";import { IamPolicy } from "@/types/proto/v1/iam_policy";import { User, UserType } from "@/types/proto/v1/user_service";@@ -70,7 +71,7 @@ const getMemberBinding = async (name: `${userNamePrefix}${email}`,email: email,userType: UserType.USER,- state: State.DELETED,+ state: convertStateToOld(State.DELETED),});}memberBinding = {diff --git a/frontend/src/components/MonacoEditor/composables/useAdvices.ts b/frontend/src/components/MonacoEditor/composables/useAdvices.tsindex 51f3681ef1..4143d89792 100644--- a/frontend/src/components/MonacoEditor/composables/useAdvices.ts+++ b/frontend/src/components/MonacoEditor/composables/useAdvices.ts@@ -1,7 +1,9 @@+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";@@ -20,16 +22,16 @@ export const useAdvices = () ?? "WARNING";const content = editor.getModel()?.getValue() ?? "";const protoStartPositions = _advices.map((advice) => {- return {+ return create(PositionSchema, {line: advice.startLineNumber,column: advice.startColumn,- };+ });});const protoEndPositions = _advices.map((advice) => {- return {+ return create(PositionSchema, {line: advice.endLineNumber,column: advice.endColumn,- };+ });});const monacoStartPosition = batchConvertPositionToMonacoPosition(protoStartPositions,diff --git a/frontend/src/components/PackageDataTable.vue b/frontend/src/components/PackageDataTable.vueindex 3994549dc5..3d13125ee4 100644--- a/frontend/src/components/PackageDataTable.vue+++ b/frontend/src/components/PackageDataTable.vue@@ -19,6 +19,7 @@ import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";import type { PackageMetadata } from "@/types/proto/v1/database_service";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import EllipsisSQLView from "./EllipsisSQLView.vue";const props = defineProps({@@ -65,7 +66,7 @@ const columns = computed(() => {});const getPackageName = (packageName: string) => {- if (hasSchemaProperty(engine.value) && props.schemaName) {+ if (hasSchemaProperty(convertEngineToNew(engine.value)) && props.schemaName) {return `"${props.schemaName}"."${packageName}"`;}return packageName;diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/common.tsindex eade8f7af3..13d7760a2c 100644--- a/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/common.ts@@ -1,6 +1,7 @@import { isDBGroupChangeSpec } from "@/components/Plan/logic";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {Plan_ChangeDatabaseConfig_Type,type Plan_Spec,@@ -14,14 +15,15 @@ export const MIN_GHOST_SUPPORT_MYSQL_VERSION = "5.6.0";export const MIN_GHOST_SUPPORT_MARIADB_VERSION = "10.6.0";export const allowGhostForDatabase = (database: ComposedDatabase) => {+ const engine = convertEngineToNew(database.instanceResource.engine);return (- (database.instanceResource.engine === Engine.MYSQL &&+ (engine === Engine.MYSQL &&semverCompare(database.instanceResource.engineVersion,MIN_GHOST_SUPPORT_MYSQL_VERSION,"gte")) ||- (database.instanceResource.engine === Engine.MARIADB &&+ (engine === Engine.MARIADB &&semverCompare(database.instanceResource.engineVersion,MIN_GHOST_SUPPORT_MARIADB_VERSION,diff --git a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts b/frontend/src/components/Plan/components/Configuration/GhostSection/context.tsindex 633bfcad69..156fc2cb0d 100644--- a/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/GhostSection/context.ts@@ -4,6 +4,7 @@ import { computed, inject, provide, unref } from "vue";import { targetsForSpec } from "@/components/Plan/logic";import { useCurrentUserV1, extractUserId, useDatabaseV1Store } from "@/store";import { isValidDatabaseName, type ComposedProject } from "@/types";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { Issue, IssueStatus } from "@/types/proto/v1/issue_service";import type { Plan, Plan_Spec } from "@/types/proto/v1/plan_service";import {@@ -70,7 +71,7 @@ export const provideGhostSettingContext = (refs: {selectedSpec.value &&allowGhostForSpec(selectedSpec.value) &&databases.value.every((db) =>- GHOST_AVAILABLE_ENGINES.includes(db.instanceResource.engine)+ GHOST_AVAILABLE_ENGINES.includes(convertEngineToNew(db.instanceResource.engine))) &&!isNullOrUndefined(getGhostEnabledForSpec(selectedSpec.value)));diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSwitch.vue b/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSwitch.vueindex 2dae5f9e23..b2b20151bd 100644--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSwitch.vue+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/PreBackupSwitch.vue@@ -30,6 +30,7 @@ import { targetsForSpec } from "@/components/Plan/logic";import type { ErrorItem } from "@/components/misc/ErrorList.vue";import ErrorList from "@/components/misc/ErrorList.vue";import { pushNotification } from "@/store";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {PRE_BACKUP_AVAILABLE_ENGINES,usePreBackupSettingContext,@@ -70,7 +71,7 @@ const errors = computed(() => {// Check for unsupported database enginesconst unsupportedEngineDatabases = databases.value.filter(- (db) => !PRE_BACKUP_AVAILABLE_ENGINES.includes(db.instanceResource.engine)+ (db) => !PRE_BACKUP_AVAILABLE_ENGINES.includes(convertEngineToNew(db.instanceResource.engine)));if (unsupportedEngineDatabases.length > 0) {errors.push(@@ -104,7 +105,7 @@ const databasesNotMeetingRequirements = computed(() => {// Check if database doesn't have backup availableif (!db.backupAvailable) return true;// Check if database engine is not supported- if (!PRE_BACKUP_AVAILABLE_ENGINES.includes(db.instanceResource.engine)) {+ if (!PRE_BACKUP_AVAILABLE_ENGINES.includes(convertEngineToNew(db.instanceResource.engine))) {return true;}return false;diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/common.ts b/frontend/src/components/Plan/components/Configuration/PreBackupSection/common.tsindex 0050e7baee..fb67e272f3 100644--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/common.ts+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/common.ts@@ -1,4 +1,4 @@-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";export const BACKUP_AVAILABLE_ENGINES = [Engine.MYSQL,diff --git a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.tsindex acb6178f2a..6bcb4a66a6 100644--- a/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts+++ b/frontend/src/components/Plan/components/Configuration/PreBackupSection/context.ts@@ -15,7 +15,8 @@ import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew } from "@/utils/v1/plan-conversions";import { useCurrentUserV1, extractUserId, useDatabaseV1Store } from "@/store";import { isValidDatabaseName, type ComposedProject } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { IssueStatus, type Issue } from "@/types/proto/v1/issue_service";import {Plan_ChangeDatabaseConfig_Type,@@ -84,7 +85,7 @@ export const providePreBackupSettingContext = (refs: {// If any of the databases in the spec is not supported, do not show.if (!databases.value.every((db) =>- BACKUP_AVAILABLE_ENGINES.includes(db.instanceResource.engine)+ BACKUP_AVAILABLE_ENGINES.includes(convertEngineToNew(db.instanceResource.engine)))) {return false;diff --git a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vueindex 85578d92c1..36ddb92b90 100644--- a/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue+++ b/frontend/src/components/Plan/components/HeaderSection/Actions/create/CreateButton.vue@@ -46,6 +46,8 @@ import { usePlanContext } from "@/components/Plan/logic";import { planServiceClientConnect } from "@/grpcweb";import { CreatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";+import { convertEngineToOld } from "@/utils/v1/common-conversions";+import { Engine } from "@/types/proto-es/v1/common_pb";import { PROJECT_V1_ROUTE_PLAN_DETAIL } from "@/router/dashboard/projectV1";import { useCurrentProjectV1, useSheetV1Store } from "@/store";import { type Plan_ChangeDatabaseConfig } from "@/types/proto/v1/plan_service";@@ -128,7 +130,7 @@ const createSheets = async () => {// The sheet is pending createconst sheet = getLocalSheetByName(config.sheet);const engine = await databaseEngineForSpec(spec);- sheet.engine = engine;+ sheet.engine = convertEngineToOld((engine ?? Engine.ENGINE_UNSPECIFIED) as Engine);pendingCreateSheetMap.set(sheet.name, sheet);}}diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalCandidate.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalCandidate.vueindex a82de16eb5..51d16501ec 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalCandidate.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalCandidate.vue@@ -22,7 +22,8 @@import { computedAsync } from "@vueuse/core";import UserAvatar from "@/components/User/UserAvatar.vue";import { useCurrentUserV1, useUserStore } from "@/store";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import { UserType } from "@/types/proto/v1/user_service";const props = defineProps<{@@ -38,7 +39,7 @@ const candidateUser = computedAsync(async () => {if (!user) {return;}- if (user.userType !== UserType.USER || user.state !== State.ACTIVE) {+ if (user.userType !== UserType.USER || convertStateToNew(user.state) !== State.ACTIVE) {return;}return user;diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vueindex 16617f85ea..7175e54cf6 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalStepItem.vue@@ -78,13 +78,14 @@ import { useI18n } from "vue-i18n";import { useCurrentUserV1, useUserStore, useCurrentProjectV1 } from "@/store";import { userNamePrefix } from "@/store/modules/v1/common";import { SYSTEM_BOT_EMAIL } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import type {ApprovalStep,Issue,Issue_Approver,} from "@/types/proto/v1/issue_service";import type { User as UserType } from "@/types/proto/v1/user_service";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { memberMapToRolesInProjectIAM } from "@/utils";import ApprovalUserView from "./ApprovalUserView.vue";import PotentialApprovers from "./PotentialApprovers.vue";@@ -246,7 +247,7 @@ const potentialApprovers = computedAsync(async () => {const users: UserType[] = [];for (const email of filteredCandidateEmails.value) {const user = await userStore.getOrFetchUserByIdentifier(email);- if (user && user.state === State.ACTIVE) {+ if (user && user.state === convertStateToOld(State.ACTIVE)) {users.push(user);}}diff --git a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vueindex 07225a78d5..ad1187fc98 100644--- a/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/Sidebar/ApprovalFlowSection/ApprovalUserView.vue@@ -19,8 +19,9 @@ import { NTag } from "naive-ui";import { computed } from "vue";import UserAvatar from "@/components/User/UserAvatar.vue";import { useCurrentUserV1, useUserStore } from "@/store";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { UserType } from "@/types/proto/v1/user_service";+import { convertStateToOld } from "@/utils/v1/common-conversions";type SizeType = "tiny" | "small" | "normal";@@ -54,7 +55,7 @@ const candidateUser = computedAsync(async () => {if (!user) {return;}- if (user.userType !== UserType.USER || user.state !== State.ACTIVE) {+ if (user.userType !== UserType.USER || user.state !== convertStateToOld(State.ACTIVE)) {return;}return user;diff --git a/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue b/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vueindex 78dec6dd98..7a513e3af3 100644--- a/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue+++ b/frontend/src/components/Plan/components/SpecDetailView/AllTargetsDrawer.vue@@ -91,7 +91,8 @@ import {isValidDatabaseName,isValidInstanceName,} from "@/types";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {extractInstanceResourceName,instanceV1Name,@@ -261,7 +262,7 @@ const loadAllTargets = async () => {name: database?.databaseName || target,instance: instance ? instanceV1Name(instance) : "",environment: database?.effectiveEnvironmentEntity?.title || "",- engine: instance?.engine,+ engine: instance?.engine ? convertEngineToNew(instance.engine) : undefined,};});diff --git a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vueindex 432470dd45..fcf2abc2bc 100644--- a/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue+++ b/frontend/src/components/Plan/components/SpecDetailView/TargetListSection.vue@@ -125,7 +125,8 @@ import {batchGetOrFetchDatabases,getProjectNameAndDatabaseGroupName,} from "@/store";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {extractInstanceResourceName,instanceV1Name,@@ -253,7 +254,7 @@ const tableData = computed((): TargetRow[] => {name: database?.databaseName || target,instance: instance ? instanceV1Name(instance) : "",environment: database?.effectiveEnvironmentEntity?.title || "",- engine: instance?.engine,+ engine: instance?.engine ? convertEngineToNew(instance.engine) : undefined,};});});diff --git a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vueindex 024c7d7a69..c3ca057490 100644--- a/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue+++ b/frontend/src/components/Plan/components/StatementSection/EditorView/EditorView.vue@@ -188,6 +188,8 @@ import { create } from "@bufbuild/protobuf";import { planServiceClientConnect } from "@/grpcweb";import { UpdatePlanRequestSchema } from "@/types/proto-es/v1/plan_service_pb";import { convertOldPlanToNew, convertNewPlanToOld } from "@/utils/v1/plan-conversions";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";+import { Engine } from "@/types/proto-es/v1/common_pb";import {pushNotification,useCurrentProjectV1,@@ -240,7 +242,7 @@ const filename = computed(() => {});const dialect = computed((): SQLDialect => {const db = database.value;- return dialectOfEngineV1(db.instanceResource.engine);+ return dialectOfEngineV1(convertEngineToNew(db.instanceResource.engine));});const statementTitle = computed(() => {return language.value === "sql" ? t("common.sql") : t("common.statement");@@ -396,10 +398,11 @@ const updateStatement = async (statement: string) => {const specsToPatch = planPatch.specs.filter((spec) => spec.id === selectedSpec.value.id);+ const specEngine = await databaseEngineForSpec(head(specsToPatch));const sheet = Sheet.fromPartial({...createEmptyLocalSheet(),title: plan.value.title,- engine: await databaseEngineForSpec(head(specsToPatch)),+ engine: convertEngineToOld((specEngine ?? Engine.ENGINE_UNSPECIFIED) as Engine),});setSheetStatement(sheet, statement);const createdSheet = await useSheetV1Store().createSheet(diff --git a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vueindex dd0e9f0832..7162861666 100644--- a/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue+++ b/frontend/src/components/Plan/components/StatementSection/ReleaseView/ReleaseView.vue@@ -105,7 +105,7 @@</h4><div class="text-xs"><span class="text-gray-500"- >{{ getVCSTypeText(release.vcsSource.vcsType) }}:</span+ >{{ getVCSTypeText(convertVCSTypeToNew(release.vcsSource.vcsType)) }}:</span><av-if="release.vcsSource.url"@@ -154,9 +154,10 @@ import { useI18n } from "vue-i18n";import { BBSpin } from "@/bbkit";import { useReleaseByName } from "@/store";import { isValidReleaseName, getDateForPbTimestamp } from "@/types";-import { VCSType } from "@/types/proto/v1/common";+import { VCSType } from "@/types/proto-es/v1/common_pb";import { ReleaseFileType } from "@/types/proto/v1/release_service";import type { Release_File_ChangeType } from "@/types/proto/v1/release_service";+import { convertVCSTypeToNew } from "@/utils/v1/common-conversions";import { usePlanSpecContext } from "../../SpecDetailView/context";const { t } = useI18n();diff --git a/frontend/src/components/Plan/logic/plan.ts b/frontend/src/components/Plan/logic/plan.tsindex 44eaaab669..f754d43be0 100644--- a/frontend/src/components/Plan/logic/plan.ts+++ b/frontend/src/components/Plan/logic/plan.ts@@ -7,7 +7,7 @@ import {unknownDatabase,type ComposedProject,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { Plan_Spec } from "@/types/proto/v1/plan_service";export const databaseForSpec = (project: ComposedProject, spec: Plan_Spec) => {diff --git a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue b/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vueindex 406ccbfd09..c9ffd6ffa8 100644--- a/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue+++ b/frontend/src/components/PlanCheckRun/PlanCheckRunDetail.vue@@ -244,6 +244,7 @@ import { create } from "@bufbuild/protobuf";import { SQLRuleEditDialog } from "@/components/SQLReview/components";import { planServiceClientConnect } from "@/grpcweb";import { BatchCancelPlanCheckRunsRequestSchema } from "@/types/proto-es/v1/plan_service_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { WORKSPACE_ROUTE_SQL_REVIEW } from "@/router/dashboard/workspaceRoutes";import { useReviewPolicyForDatabase } from "@/store";import {@@ -342,7 +343,7 @@ const showCancelButton = computed(const getRuleTemplateByType = (type: string) => {if (props.database) {return ruleTemplateMapV2- .get(props.database.instanceResource.engine)+ .get(convertEngineToNew(props.database.instanceResource.engine))?.get(type);}@@ -494,13 +495,13 @@ const getActiveRule = (type: string): RuleTemplateV2 | undefined => {return {type,category: "BUILTIN",- engine,+ engine: convertEngineToNew(engine),level: builtinRuleLevel(type),componentList: [],};}const rule = reviewPolicy.value?.ruleList.find((rule) => {- if (engine && rule.engine !== engine) {+ if (engine && rule.engine !== convertEngineToNew(engine)) {return false;}return rule.type === type;diff --git a/frontend/src/components/Project/ProjectArchiveRestoreButton.vue b/frontend/src/components/Project/ProjectArchiveRestoreButton.vueindex 45a3ae15dd..0ea5e4cfb8 100644--- a/frontend/src/components/Project/ProjectArchiveRestoreButton.vue+++ b/frontend/src/components/Project/ProjectArchiveRestoreButton.vue@@ -1,6 +1,6 @@<template><template v-if="allowArchiveOrRestore">- <template v-if="project.state === State.ACTIVE">+ <template v-if="project.state === convertStateToOld(State.ACTIVE)"><BBButtonConfirm:type="'ARCHIVE'":button-text="$t('project.settings.archive.btn-text')"@@ -21,7 +21,7 @@</div></BBButtonConfirm></template>- <template v-else-if="project.state === State.DELETED">+ <template v-else-if="project.state === convertStateToOld(State.DELETED)"><BBButtonConfirm:type="'RESTORE'":button-text="$t('project.settings.restore.btn-text')"@@ -46,7 +46,8 @@ import { BBButtonConfirm } from "@/bbkit";import { PROJECT_V1_ROUTE_DASHBOARD } from "@/router/dashboard/workspaceRoutes";import { useProjectV1Store } from "@/store";import type { ComposedProject } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { hasWorkspacePermissionV2 } from "@/utils";const props = defineProps<{@@ -59,7 +60,7 @@ const router = useRouter();const force = ref(false);const allowArchiveOrRestore = computed(() => {- if (props.project.state === State.ACTIVE) {+ if (props.project.state === convertStateToOld(State.ACTIVE)) {return hasWorkspacePermissionV2("bb.projects.delete");}return hasWorkspacePermissionV2("bb.projects.undelete");diff --git a/frontend/src/components/ProjectDatabasesPanel.vue b/frontend/src/components/ProjectDatabasesPanel.vueindex 441cf6b861..7fe3e585eb 100644--- a/frontend/src/components/ProjectDatabasesPanel.vue+++ b/frontend/src/components/ProjectDatabasesPanel.vue@@ -63,7 +63,7 @@ import {} from "@/store/modules/v1/common";import type { ComposedDatabase, ComposedProject } from "@/types";import { isValidDatabaseName } from "@/types";-import { engineFromJSON } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { SearchParams, SearchScope } from "@/utils";import {CommonFilterScopeIdList,@@ -160,7 +160,11 @@ const selectedLabels = computed(() => {const selectedEngines = computed(() => {return state.params.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => {+ // Convert string engine name to Engine enum+ const engineKey = scope.value.toUpperCase();+ return Engine[engineKey as keyof typeof Engine] ?? Engine.ENGINE_UNSPECIFIED;+ });});const selectedDriftedValue = computed(() => {diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vueindex 329ef4a1f0..fc4cf680b6 100644--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue@@ -139,9 +139,10 @@ import {} from "@/store";import type { ComposedProject, DatabaseResource } from "@/types";import { PresetRoleType } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import type { Binding } from "@/types/proto/v1/iam_policy";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { displayRoleTitle, checkRoleContainsAnyPermission } from "@/utils";import { convertFromExpr, buildConditionExpr } from "@/utils/issue/cel";import { getBindingIdentifier } from "../utils";@@ -206,7 +207,7 @@ const isDateDisabled = (date: number) => {};const allowRemoveRole = () => {- if (props.project.state === State.DELETED) {+ if (props.project.state === convertStateToOld(State.DELETED)) {return false;}diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vueindex 1cb8522bc6..1f02a57527 100644--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue@@ -157,8 +157,9 @@ import {} from "@/store";import type { ComposedProject, DatabaseResource } from "@/types";import { PresetRoleType, PRESET_ROLES } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { Binding } from "@/types/proto/v1/iam_policy";+import { convertStateToOld } from "@/utils/v1/common-conversions";import {displayRoleTitle,hasProjectPermissionV2,@@ -372,7 +373,7 @@ const getDataTableColumns = (// 1. Disallow removing the last OWNER.// 2. Allow workspace roles who can manage project. This helps when the project OWNER is no longer available.const allowRemoveRole = (role: string) => {- if (props.project.state === State.DELETED) {+ if (props.project.state === convertStateToOld(State.DELETED)) {return false;}if (props.binding.type === "groups") {diff --git a/frontend/src/components/Release/ReleaseDataTable.vue b/frontend/src/components/Release/ReleaseDataTable.vueindex 20db130429..28cffc4903 100644--- a/frontend/src/components/Release/ReleaseDataTable.vue+++ b/frontend/src/components/Release/ReleaseDataTable.vue@@ -21,8 +21,9 @@ import { useI18n } from "vue-i18n";import { useRouter } from "vue-router";import { BBAvatar } from "@/bbkit";import { getTimeForPbTimestamp, type ComposedRelease } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { getReleaseFileStatement, humanizeTs } from "@/utils";+import { convertStateToOld } from "@/utils/v1/common-conversions";interface LocalState {selectedReleaseNameList: Set<string>;@@ -62,7 +63,7 @@ const columnList = computed(return (<p class="inline-flex w-full"><span class="shrink truncate">{release.title}</span>- {release.state === State.DELETED && (+ {release.state === convertStateToOld(State.DELETED) && (<NTag class="shrink-0" type="warning" size="small" round>{t("common.archived")}</NTag>diff --git a/frontend/src/components/Release/ReleaseDetail/BasicInfo.vue b/frontend/src/components/Release/ReleaseDetail/BasicInfo.vueindex 0b16e29908..a06a8ae54d 100644--- a/frontend/src/components/Release/ReleaseDetail/BasicInfo.vue+++ b/frontend/src/components/Release/ReleaseDetail/BasicInfo.vue@@ -11,10 +11,10 @@}}</span></div><div- v-if="vcsSource && vcsSource?.vcsType !== VCSType.VCS_TYPE_UNSPECIFIED"+ v-if="vcsSource && vcsSource?.vcsType !== convertVCSTypeToOld(VCSType.VCS_TYPE_UNSPECIFIED)"class="flex flex-row items-center gap-1">- <VCSIcon custom-class="h-4" :type="vcsSource.vcsType" />+ <VCSIcon custom-class="h-4" :type="convertVCSTypeToNew(vcsSource.vcsType)" /><EllipsisText><a:href="vcsSource.url"@@ -35,7 +35,8 @@ import { BBAvatar } from "@/bbkit";import EllipsisText from "@/components/EllipsisText.vue";import VCSIcon from "@/components/VCS/VCSIcon.vue";import { getDateForPbTimestamp } from "@/types";-import { VCSType } from "@/types/proto/v1/common";+import { VCSType } from "@/types/proto-es/v1/common_pb";+import { convertVCSTypeToNew, convertVCSTypeToOld } from "@/utils/v1/common-conversions";import { humanizeDate } from "@/utils";import { useReleaseDetailContext } from "./context";diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vueindex b9ad9e1ce7..0eec691dcc 100644--- a/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/NavBar.vue@@ -1,19 +1,20 @@<template>- <ArchiveBanner v-if="release.state === State.DELETED" />+ <ArchiveBanner v-if="release.state === convertStateToOld(State.DELETED)" /><div class="w-full flex flex-row items-center justify-between gap-x-4"><div class="flex-1 p-0.5 overflow-hidden truncate"><TitleEditor /></div><div class="flex items-center justify-end gap-x-3">- <ApplyToDatabaseButton v-if="release.state === State.ACTIVE" />+ <ApplyToDatabaseButton v-if="release.state === convertStateToOld(State.ACTIVE)" /></div></div></template><script setup lang="ts">import ArchiveBanner from "@/components/ArchiveBanner.vue";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { useReleaseDetailContext } from "../context";+import { convertStateToOld } from "@/utils/v1/common-conversions";import ApplyToDatabaseButton from "./ApplyToDatabaseButton.vue";import TitleEditor from "./TitleEditor.vue";diff --git a/frontend/src/components/Release/ReleaseDetail/NavBar/TitleEditor.vue b/frontend/src/components/Release/ReleaseDetail/NavBar/TitleEditor.vueindex 9f11b18147..a98d13b4f5 100644--- a/frontend/src/components/Release/ReleaseDetail/NavBar/TitleEditor.vue+++ b/frontend/src/components/Release/ReleaseDetail/NavBar/TitleEditor.vue@@ -5,7 +5,7 @@:style="style":loading="state.isUpdating":disabled="state.isUpdating"- :readonly="release.state !== State.ACTIVE"+ :readonly="release.state !== convertStateToOld(State.ACTIVE)"autosizerequired@focus="state.isEditing = true"@@ -21,9 +21,10 @@ import type { CSSProperties } from "vue";import { computed, reactive, watch } from "vue";import { useI18n } from "vue-i18n";import { pushNotification, useReleaseStore } from "@/store";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { Release } from "@/types/proto/v1/release_service";import { useReleaseDetailContext } from "../context";+import { convertStateToOld } from "@/utils/v1/common-conversions";const { t } = useI18n();const { release } = useReleaseDetailContext();diff --git a/frontend/src/components/Release/ReleaseDetail/ReleaseArchiveRestoreButton.vue b/frontend/src/components/Release/ReleaseDetail/ReleaseArchiveRestoreButton.vueindex 09ef5689a4..1767614f28 100644--- a/frontend/src/components/Release/ReleaseDetail/ReleaseArchiveRestoreButton.vue+++ b/frontend/src/components/Release/ReleaseDetail/ReleaseArchiveRestoreButton.vue@@ -1,6 +1,6 @@<template><BBButtonConfirm- v-if="release.state === State.ACTIVE"+ v-if="convertStateToNew(release.state) === State.ACTIVE":type="'ARCHIVE'":button-text="$t('release.archive-this-release')":require-confirm="true"@@ -11,7 +11,7 @@@confirm="archiveOrRestoreRelease(true)"/><BBButtonConfirm- v-else-if="release.state === State.DELETED"+ v-else-if="convertStateToNew(release.state) === State.DELETED":type="'RESTORE'":button-text="$t('common.restore')":require-confirm="false"@@ -23,7 +23,8 @@<script setup lang="ts">import { BBButtonConfirm } from "@/bbkit";import { useReleaseStore } from "@/store";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import { useReleaseDetailContext } from "./context";const { release } = useReleaseDetailContext();diff --git a/frontend/src/components/SQLReview/SQLReviewConfig.vue b/frontend/src/components/SQLReview/SQLReviewConfig.vueindex 538b9adfe8..0d7c2f5841 100644--- a/frontend/src/components/SQLReview/SQLReviewConfig.vue+++ b/frontend/src/components/SQLReview/SQLReviewConfig.vue@@ -43,7 +43,7 @@<script lang="ts" setup>import { NButton, NEmpty } from "naive-ui";import { ref } from "vue";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { RuleTemplateV2 } from "@/types/sqlReview";import SQLReviewRulesSelectPanel from "./components/SQLReviewRulesSelectPanel.vue";import SQLReviewTabsByEngine from "./components/SQLReviewTabsByEngine.vue";diff --git a/frontend/src/components/SQLReview/SQLReviewCreation.vue b/frontend/src/components/SQLReview/SQLReviewCreation.vueindex ece190fc53..42bac0263b 100644--- a/frontend/src/components/SQLReview/SQLReviewCreation.vue+++ b/frontend/src/components/SQLReview/SQLReviewCreation.vue@@ -71,7 +71,7 @@ import {ruleIsAvailableInSubscription,TEMPLATE_LIST_V2 as builtInTemplateList,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { SQLReviewRuleLevel } from "@/types/proto/v1/org_policy_service";import { hasWorkspacePermissionV2, sqlReviewPolicySlug } from "@/utils";import SQLReviewConfig from "./SQLReviewConfig.vue";diff --git a/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue b/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vueindex 56f6162840..05144eb5a8 100644--- a/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewRulesSelectPanel.vue@@ -45,7 +45,7 @@<script setup lang="ts">import { NButton } from "naive-ui";import { Drawer, DrawerContent } from "@/components/v2";-import { type Engine, engineFromJSON } from "@/types/proto/v1/common";+import { type Engine } from "@/types/proto-es/v1/common_pb";import { ruleTemplateMapV2 } from "@/types/sqlReview";import type { RuleTemplateV2 } from "@/types/sqlReview";import SQLReviewTabsByEngine from "./SQLReviewTabsByEngine.vue";@@ -85,8 +85,8 @@ const onSelectedRuleKeysUpdateForEngine = (engine: Engine, keys: string[]) => {continue;}const [engineStr, ruleKey] = key.split(":");- const engine = engineFromJSON(engineStr);- const rule = ruleTemplateMapV2.get(engine)?.get(ruleKey);+ const engineNum = parseInt(engineStr) as Engine;+ const rule = ruleTemplateMapV2.get(engineNum)?.get(ruleKey);if (rule) {emit("rule-select", rule);}@@ -95,8 +95,8 @@ const onSelectedRuleKeysUpdateForEngine = (engine: Engine, keys: string[]) => {// keys remained in the oldSelectedKeys is not selected.for (const oldKey of oldSelectedKeys) {const [engineStr, ruleKey] = oldKey.split(":");- const engine = engineFromJSON(engineStr);- const rule = props.selectedRuleMap.get(engine)?.get(ruleKey);+ const engineNum = parseInt(engineStr) as Engine;+ const rule = props.selectedRuleMap.get(engineNum)?.get(ruleKey);if (rule) {emit("rule-remove", rule);}diff --git a/frontend/src/components/SQLReview/components/SQLReviewTabsByEngine.vue b/frontend/src/components/SQLReview/components/SQLReviewTabsByEngine.vueindex 8164bff462..30ddd258d2 100644--- a/frontend/src/components/SQLReview/components/SQLReviewTabsByEngine.vue+++ b/frontend/src/components/SQLReview/components/SQLReviewTabsByEngine.vue@@ -31,17 +31,17 @@ import { NTabs, NTabPane } from "naive-ui";import { ref, watch, computed } from "vue";import { RichEngineName } from "@/components/v2";import type { RuleTemplateV2 } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { supportedEngineV1List } from "@/utils";-const selectedEngine = ref<Engine>(Engine.UNRECOGNIZED);+const selectedEngine = ref<Engine>(0); // UNSPECIFIEDconst props = defineProps<{ruleMapByEngine: Map<Engine, Map<string, RuleTemplateV2>>;}>();watch(- () => [...props.ruleMapByEngine.keys()][0] ?? Engine.UNRECOGNIZED,+ () => [...props.ruleMapByEngine.keys()][0] ?? 0, // UNSPECIFIED(engine) => (selectedEngine.value = engine),{ immediate: true });diff --git a/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue b/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vueindex cfae36f042..8050391ff3 100644--- a/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue+++ b/frontend/src/components/SQLReview/components/SQLRuleTableWithFilter.vue@@ -40,7 +40,7 @@ import {SQLRuleTable,} from "@/components/SQLReview/components";import type { RuleTemplateV2 } from "@/types";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { RuleListWithCategory } from "./SQLReviewCategoryTabFilter.vue";import { getRuleKey } from "./utils";diff --git a/frontend/src/components/SchemaDiagram/Navigator/Navigator.vue b/frontend/src/components/SchemaDiagram/Navigator/Navigator.vueindex 7b3f0accc8..a8dc621520 100644--- a/frontend/src/components/SchemaDiagram/Navigator/Navigator.vue+++ b/frontend/src/components/SchemaDiagram/Navigator/Navigator.vue@@ -6,7 +6,7 @@><div class="p-1 space-y-2"><SchemaSelector- v-if="hasSchemaProperty(database.instanceResource.engine)"+ v-if="hasSchemaProperty(convertEngineToNew(database.instanceResource.engine))":schemas="databaseMetadata.schemas"v-model:value="selectedSchemaNames"/>@@ -42,6 +42,7 @@import { NInput } from "naive-ui";import { reactive } from "vue";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSchemaDiagramContext } from "../common";import SchemaSelector from "./SchemaSelector.vue";import Tree from "./Tree.vue";diff --git a/frontend/src/components/SchemaDiagram/Navigator/Tree.vue b/frontend/src/components/SchemaDiagram/Navigator/Tree.vueindex 7ed1c2acea..352d970a51 100644--- a/frontend/src/components/SchemaDiagram/Navigator/Tree.vue+++ b/frontend/src/components/SchemaDiagram/Navigator/Tree.vue@@ -20,6 +20,7 @@import { NTree, type TreeOption } from "naive-ui";import { computed, h } from "vue";import { isDescendantOf, hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSchemaDiagramContext } from "../common";import { DEFAULT_PADDINGS } from "../common/const";import { Label, Prefix, Suffix } from "./TreeNode";@@ -39,7 +40,7 @@ const context = useSchemaDiagramContext();const { selectedSchemas, events, database } = context;const isFlatTree = computed(() => {- return hasSchemaProperty(database.value.instanceResource.engine);+ return hasSchemaProperty(convertEngineToNew(database.value.instanceResource.engine));});const treeData = computed(() => {diff --git a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue b/frontend/src/components/SchemaEditorLite/Aside/Tree.vueindex 4f9e7a08f7..c1c0046362 100644--- a/frontend/src/components/SchemaEditorLite/Aside/Tree.vue+++ b/frontend/src/components/SchemaEditorLite/Aside/Tree.vue@@ -129,6 +129,7 @@ import {getHighlightHTMLByKeyWords,isDescendantOf,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import FunctionNameModal from "../Modals/FunctionNameModal.vue";import ProcedureNameModal from "../Modals/ProcedureNameModal.vue";import SchemaNameModal from "../Modals/SchemaNameModal.vue";@@ -560,7 +561,7 @@ const renderSuffix = ({ option }: { option: TreeOption }) => {});if (node.type === "database") {const { engine } = node.db.instanceResource;- if (engineSupportsMultiSchema(engine)) {+ if (engineSupportsMultiSchema(convertEngineToNew(engine))) {icons.push(menuIcon);}}@@ -644,7 +645,7 @@ const handleDuplicateTable = (treeNode: TreeNodeForTable) => {for (const index of newTable.indexes) {let name = `${index.name}_${MD5(`${newTable.name}_${Date.now()}`).toString().slice(0, 6)}`;if (index.primary) {- const fixedName = getFixedPrimaryKey(engine);+ const fixedName = getFixedPrimaryKey(convertEngineToNew(engine));// If the primary key name is fixed, use it instead.if (fixedName) {name = fixedName;diff --git a/frontend/src/components/SchemaEditorLite/Aside/common.ts b/frontend/src/components/SchemaEditorLite/Aside/common.tsindex 5229d26200..4e53b23a64 100644--- a/frontend/src/components/SchemaEditorLite/Aside/common.ts+++ b/frontend/src/components/SchemaEditorLite/Aside/common.ts@@ -11,6 +11,7 @@ import type {} from "@/types/proto/v1/database_service";import type { InstanceResource } from "@/types/proto/v1/instance_service";import { groupBy } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSchemaEditorContext } from "../context";import { keyForResource } from "../context/common";import {@@ -304,7 +305,7 @@ export const useBuildTree = () => {map.set(tableGroupNode.key, tableGroupNode);// Views- if (engineSupportsEditViews(db.instanceResource.engine)) {+ if (engineSupportsEditViews(convertEngineToNew(db.instanceResource.engine))) {const viewGroupNode: TreeNodeForGroup<"view"> = {type: "group",group: "view",@@ -330,7 +331,7 @@ export const useBuildTree = () => {map.set(viewGroupNode.key, viewGroupNode);}// Procedures- if (engineSupportsEditProcedures(db.instanceResource.engine)) {+ if (engineSupportsEditProcedures(convertEngineToNew(db.instanceResource.engine))) {const procedureGroupNode: TreeNodeForGroup<"procedure"> = {type: "group",group: "procedure",@@ -356,7 +357,7 @@ export const useBuildTree = () => {map.set(procedureGroupNode.key, procedureGroupNode);}// Functions- if (engineSupportsEditFunctions(db.instanceResource.engine)) {+ if (engineSupportsEditFunctions(convertEngineToNew(db.instanceResource.engine))) {const functionGroupNode: TreeNodeForGroup<"function"> = {type: "group",group: "function",diff --git a/frontend/src/components/SchemaEditorLite/Aside/context-menu.ts b/frontend/src/components/SchemaEditorLite/Aside/context-menu.tsindex 9f1e549233..cd241fa53c 100644--- a/frontend/src/components/SchemaEditorLite/Aside/context-menu.ts+++ b/frontend/src/components/SchemaEditorLite/Aside/context-menu.ts@@ -3,8 +3,9 @@ import type { DropdownOption } from "naive-ui";import { computed, reactive, type Ref } from "vue";import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { isDescendantOf } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSchemaEditorContext } from "../context";import { engineSupportsMultiSchema } from "../spec";import type {@@ -81,8 +82,9 @@ export const useContextMenu = (): ContextMenuContext => {if (typeof node.db === "undefined") return [];const { engine } = (node.db as ComposedDatabase).instanceResource;+ const protoEsEngine = convertEngineToNew(engine);if (node.type === "database") {- if (engineSupportsMultiSchema(engine)) {+ if (engineSupportsMultiSchema(protoEsEngine)) {return [{key: "create-schema",@@ -94,7 +96,7 @@ export const useContextMenu = (): ContextMenuContext => {}if (node.type === "schema") {const options: DropdownOption[] = [];- if (engine === Engine.POSTGRES) {+ if (protoEsEngine === Engine.POSTGRES) {const status = getSchemaStatus(node.db, node.metadata);if (status === "dropped") {options.push({diff --git a/frontend/src/components/SchemaEditorLite/Modals/EditColumnForeignKeyModal.vue b/frontend/src/components/SchemaEditorLite/Modals/EditColumnForeignKeyModal.vueindex 5df1719b8c..71db43e94e 100644--- a/frontend/src/components/SchemaEditorLite/Modals/EditColumnForeignKeyModal.vue+++ b/frontend/src/components/SchemaEditorLite/Modals/EditColumnForeignKeyModal.vue@@ -91,6 +91,7 @@ import type {} from "@/types/proto/v1/database_service";import { ForeignKeyMetadata } from "@/types/proto/v1/database_service";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSchemaEditorContext } from "../context";import {removeColumnFromForeignKey,@@ -195,7 +196,7 @@ const allowConfirm = computed(() => {return state.foreignKeyName !== "" && referencedColumn.value !== undefined;});const shouldShowSchemaSelector = computed(() => {- return hasSchemaProperty(engine.value);+ return hasSchemaProperty(convertEngineToNew(engine.value));});const referenceTips = computed(() => {return shouldShowSchemaSelector.valuediff --git a/frontend/src/components/SchemaEditorLite/Modals/TableNameModal.vue b/frontend/src/components/SchemaEditorLite/Modals/TableNameModal.vueindex ff6cba4169..4a8908251a 100644--- a/frontend/src/components/SchemaEditorLite/Modals/TableNameModal.vue+++ b/frontend/src/components/SchemaEditorLite/Modals/TableNameModal.vue@@ -36,7 +36,7 @@ import { useI18n } from "vue-i18n";import { BBModal } from "@/bbkit";import { useNotificationStore } from "@/store";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type {DatabaseMetadata,SchemaMetadata,@@ -47,6 +47,7 @@ import {} from "@/types/proto/v1/database_service";import { useSchemaEditorContext } from "../context";import { upsertColumnPrimaryKey } from "../edit";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";// Table name must start with a non-space character, end with a non-space character, and can contain space in between.const tableNameFieldRegexp = /^\S[\S ]*\S?$/;@@ -124,10 +125,10 @@ const handleConfirmButtonClick = async () => {const column = ColumnMetadata.fromPartial({});column.name = "id";const engine = props.database.instanceResource.engine;- column.type = engine === Engine.POSTGRES ? "integer" : "int";+ column.type = engine === convertEngineToOld(Engine.POSTGRES) ? "integer" : "int";column.comment = "";table.columns.push(column);- upsertColumnPrimaryKey(engine, table, column.name);+ upsertColumnPrimaryKey(convertEngineToNew(engine), table, column.name);markEditStatus(props.database,{diff --git a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vueindex 6005a2e4c2..043752bfe8 100644--- a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue@@ -132,7 +132,7 @@<DrawerContent :title="$t('schema-template.table-template.self')"><div class="w-[calc(100vw-36rem)] min-w-[64rem] max-w-[calc(100vw-8rem)]"><TableTemplates- :engine="convertOldEngineToNew(engine)"+ :engine="convertEngineToNew(engine)":readonly="true"@apply="handleApplyTemplate"/>@@ -145,8 +145,9 @@import SchemaDiagram, { SchemaDiagramIcon } from "@/components/SchemaDiagram";import { Drawer, DrawerContent } from "@/components/v2";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";-import { Engine as NewEngine } from "@/types/proto-es/v1/common_pb";++import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToOld, convertEngineToNew } from "@/utils/v1/common-conversions";import {ColumnMetadata,DatabaseMetadata,@@ -187,67 +188,6 @@ const emit = defineEmits<{(event: "update:selected-schema-name", schema: string | undefined): void;}>();-// Conversion function for Engine types at service boundaries-const convertNewEngineToOld = (engine: NewEngine): Engine => {- switch (engine) {- case NewEngine.ENGINE_UNSPECIFIED: return Engine.ENGINE_UNSPECIFIED;- case NewEngine.MYSQL: return Engine.MYSQL;- case NewEngine.POSTGRES: return Engine.POSTGRES;- case NewEngine.CLICKHOUSE: return Engine.CLICKHOUSE;- case NewEngine.SNOWFLAKE: return Engine.SNOWFLAKE;- case NewEngine.SQLITE: return Engine.SQLITE;- case NewEngine.TIDB: return Engine.TIDB;- case NewEngine.MONGODB: return Engine.MONGODB;- case NewEngine.REDIS: return Engine.REDIS;- case NewEngine.ORACLE: return Engine.ORACLE;- case NewEngine.SPANNER: return Engine.SPANNER;- case NewEngine.MSSQL: return Engine.MSSQL;- case NewEngine.REDSHIFT: return Engine.REDSHIFT;- case NewEngine.MARIADB: return Engine.MARIADB;- case NewEngine.OCEANBASE: return Engine.OCEANBASE;- case NewEngine.DM: return Engine.DM;- case NewEngine.RISINGWAVE: return Engine.RISINGWAVE;- case NewEngine.OCEANBASE_ORACLE: return Engine.OCEANBASE_ORACLE;- case NewEngine.STARROCKS: return Engine.STARROCKS;- case NewEngine.DORIS: return Engine.DORIS;- case NewEngine.HIVE: return Engine.HIVE;- case NewEngine.ELASTICSEARCH: return Engine.ELASTICSEARCH;- case NewEngine.BIGQUERY: return Engine.BIGQUERY;- case NewEngine.DATABRICKS: return Engine.DATABRICKS;- default: return Engine.ENGINE_UNSPECIFIED;- }-};--// Conversion function from old Engine types to new Engine types-const convertOldEngineToNew = (engine: Engine): NewEngine => {- switch (engine) {- case Engine.ENGINE_UNSPECIFIED: return NewEngine.ENGINE_UNSPECIFIED;- case Engine.MYSQL: return NewEngine.MYSQL;- case Engine.POSTGRES: return NewEngine.POSTGRES;- case Engine.CLICKHOUSE: return NewEngine.CLICKHOUSE;- case Engine.SNOWFLAKE: return NewEngine.SNOWFLAKE;- case Engine.SQLITE: return NewEngine.SQLITE;- case Engine.TIDB: return NewEngine.TIDB;- case Engine.MONGODB: return NewEngine.MONGODB;- case Engine.REDIS: return NewEngine.REDIS;- case Engine.ORACLE: return NewEngine.ORACLE;- case Engine.SPANNER: return NewEngine.SPANNER;- case Engine.MSSQL: return NewEngine.MSSQL;- case Engine.REDSHIFT: return NewEngine.REDSHIFT;- case Engine.MARIADB: return NewEngine.MARIADB;- case Engine.OCEANBASE: return NewEngine.OCEANBASE;- case Engine.DM: return NewEngine.DM;- case Engine.RISINGWAVE: return NewEngine.RISINGWAVE;- case Engine.OCEANBASE_ORACLE: return NewEngine.OCEANBASE_ORACLE;- case Engine.STARROCKS: return NewEngine.STARROCKS;- case Engine.DORIS: return NewEngine.DORIS;- case Engine.HIVE: return NewEngine.HIVE;- case Engine.ELASTICSEARCH: return NewEngine.ELASTICSEARCH;- case Engine.BIGQUERY: return NewEngine.BIGQUERY;- case Engine.DATABRICKS: return NewEngine.DATABRICKS;- default: return NewEngine.ENGINE_UNSPECIFIED;- }-};// Conversion function for TableMetadata at service boundariesconst convertNewTableToOld = (newTable: NewTableMetadata): TableMetadata => {@@ -322,13 +262,13 @@ const selectedSchema = computed(() => {);});const shouldShowSchemaSelector = computed(() => {- return engine.value === Engine.POSTGRES;+ return convertEngineToNew(engine.value) === Engine.POSTGRES;});const allowCreateTable = computed(() => {const schema = selectedSchema.value;if (!schema) return false;- if (engine.value === Engine.POSTGRES) {+ if (convertEngineToNew(engine.value) === Engine.POSTGRES) {const status = getSchemaStatus(props.db, {schema,});@@ -436,7 +376,7 @@ const handleApplyTemplate = (template: SchemaTemplateSetting_TableTemplate) => {if (!template.table) {return;}- if (convertNewEngineToOld(template.engine) !== engine.value) {+ if (convertEngineToOld(template.engine) !== engine.value) {return;}diff --git a/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vueindex 2ecdfca68f..26e0ee84ee 100644--- a/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/IndexesEditor/IndexesEditor.vue@@ -33,7 +33,8 @@ import { computed, h, ref } from "vue";import { useI18n } from "vue-i18n";import { InlineInput } from "@/components/v2";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type {DatabaseMetadata,IndexMetadata,@@ -173,7 +174,7 @@ const columns = computed(() => {render: (index) => {const allowTurnOnOrOffPrimary = () => {// Do not allow to edit primary key for TiDB.- if (props.db.instanceResource.engine === Engine.TIDB) {+ if (convertEngineToNew(props.db.instanceResource.engine) === Engine.TIDB) {return false;}diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vueindex 9618d5bc0b..641098c401 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/TableColumnEditor.vue@@ -69,7 +69,7 @@ import { InlineInput } from "@/components/v2";import { useSettingV1Store, hasFeature } from "@/store";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { ColumnCatalog } from "@/types/proto/v1/database_catalog_service";import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import type {@@ -94,7 +94,6 @@ import {SemanticTypeCell,LabelsCell,} from "./components";-import { convertEngineToNew } from "@/utils/v1/setting-conversions";interface LocalState {pendingUpdateColumn?: ColumnMetadata;@@ -631,7 +630,7 @@ const schemaTemplateColumnTypes = computed(() => {const columnTypes = setting.value.value.value.columnTypes;if (columnTypes && columnTypes.length > 0) {const columnType = columnTypes.find(- (columnType) => columnType.engine === convertEngineToNew(props.engine)+ (columnType) => columnType.engine === props.engine);if (columnType && columnType.enabled) {return columnType.types;diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vueindex 25e50db39d..1991624d10 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DataTypeCell.vue@@ -20,7 +20,7 @@ import type { SelectOption } from "naive-ui";import type { CSSProperties } from "vue";import { computed, ref, onMounted } from "vue";import { DropdownInput } from "@/components/v2";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { ColumnMetadata } from "@/types/proto/v1/database_service";import { getDataTypeSuggestionList } from "@/utils";diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DefaultValueCell.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DefaultValueCell.vueindex 1370c4dcfb..6f19a6e94c 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DefaultValueCell.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/DefaultValueCell.vue@@ -69,7 +69,7 @@ import {getColumnDefaultDisplayString,getColumnDefaultValuePlaceholder,} from "@/components/SchemaEditorLite/utils";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { ColumnMetadata } from "@/types/proto/v1/database_service";type DefaultValueSelectOption = SelectOption & {diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/ForeignKeyCell.vue b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/ForeignKeyCell.vueindex 684217155c..161c2512ca 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/ForeignKeyCell.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableColumnEditor/components/ForeignKeyCell.vue@@ -44,6 +44,7 @@ import type {SchemaMetadata,TableMetadata,} from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { engineSupportsMultiSchema } from "../../../spec";const props = defineProps<{@@ -90,7 +91,7 @@ const referencedNameForFk = (fk: ForeignKeyMetadata) => {(column) => column.name === fk.referencedColumns[position]);- if (engineSupportsMultiSchema(props.db.instanceResource.engine)) {+ if (engineSupportsMultiSchema(convertEngineToNew(props.db.instanceResource.engine))) {return `${referencedSchema.name}.${referencedTable.name}(${referencedColumn?.name})`;} else {return `${referencedTable.name}(${referencedColumn?.name})`;diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vueindex d411cce894..8474d9050d 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue@@ -175,7 +175,7 @@<DrawerContent :title="$t('schema-template.field-template.self')"><div class="w-[calc(100vw-36rem)] min-w-[64rem] max-w-[calc(100vw-8rem)]"><FieldTemplates- :engine="convertOldEngineToNew(engine)"+ :engine="engine":readonly="true"@apply="handleApplyColumnTemplate"/>@@ -189,8 +189,8 @@ import { IndexIcon, TablePartitionIcon } from "@/components/Icon";import { Drawer, DrawerContent } from "@/components/v2";import { pushNotification } from "@/store/modules";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";-import { Engine as NewEngine } from "@/types/proto-es/v1/common_pb";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {DatabaseCatalog,SchemaCatalog,@@ -276,67 +276,6 @@ const {selectionEnabled,} = useSchemaEditorContext();-// Conversion function for Engine types at service boundaries-const convertNewEngineToOld = (engine: NewEngine): Engine => {- switch (engine) {- case NewEngine.ENGINE_UNSPECIFIED: return Engine.ENGINE_UNSPECIFIED;- case NewEngine.MYSQL: return Engine.MYSQL;- case NewEngine.POSTGRES: return Engine.POSTGRES;- case NewEngine.CLICKHOUSE: return Engine.CLICKHOUSE;- case NewEngine.SNOWFLAKE: return Engine.SNOWFLAKE;- case NewEngine.SQLITE: return Engine.SQLITE;- case NewEngine.TIDB: return Engine.TIDB;- case NewEngine.MONGODB: return Engine.MONGODB;- case NewEngine.REDIS: return Engine.REDIS;- case NewEngine.ORACLE: return Engine.ORACLE;- case NewEngine.SPANNER: return Engine.SPANNER;- case NewEngine.MSSQL: return Engine.MSSQL;- case NewEngine.REDSHIFT: return Engine.REDSHIFT;- case NewEngine.MARIADB: return Engine.MARIADB;- case NewEngine.OCEANBASE: return Engine.OCEANBASE;- case NewEngine.DM: return Engine.DM;- case NewEngine.RISINGWAVE: return Engine.RISINGWAVE;- case NewEngine.OCEANBASE_ORACLE: return Engine.OCEANBASE_ORACLE;- case NewEngine.STARROCKS: return Engine.STARROCKS;- case NewEngine.DORIS: return Engine.DORIS;- case NewEngine.HIVE: return Engine.HIVE;- case NewEngine.ELASTICSEARCH: return Engine.ELASTICSEARCH;- case NewEngine.BIGQUERY: return Engine.BIGQUERY;- case NewEngine.DATABRICKS: return Engine.DATABRICKS;- default: return Engine.ENGINE_UNSPECIFIED;- }-};--// Conversion function from old Engine types to new Engine types-const convertOldEngineToNew = (engine: Engine): NewEngine => {- switch (engine) {- case Engine.ENGINE_UNSPECIFIED: return NewEngine.ENGINE_UNSPECIFIED;- case Engine.MYSQL: return NewEngine.MYSQL;- case Engine.POSTGRES: return NewEngine.POSTGRES;- case Engine.CLICKHOUSE: return NewEngine.CLICKHOUSE;- case Engine.SNOWFLAKE: return NewEngine.SNOWFLAKE;- case Engine.SQLITE: return NewEngine.SQLITE;- case Engine.TIDB: return NewEngine.TIDB;- case Engine.MONGODB: return NewEngine.MONGODB;- case Engine.REDIS: return NewEngine.REDIS;- case Engine.ORACLE: return NewEngine.ORACLE;- case Engine.SPANNER: return NewEngine.SPANNER;- case Engine.MSSQL: return NewEngine.MSSQL;- case Engine.REDSHIFT: return NewEngine.REDSHIFT;- case Engine.MARIADB: return NewEngine.MARIADB;- case Engine.OCEANBASE: return NewEngine.OCEANBASE;- case Engine.DM: return NewEngine.DM;- case Engine.RISINGWAVE: return NewEngine.RISINGWAVE;- case Engine.OCEANBASE_ORACLE: return NewEngine.OCEANBASE_ORACLE;- case Engine.STARROCKS: return NewEngine.STARROCKS;- case Engine.DORIS: return NewEngine.DORIS;- case Engine.HIVE: return NewEngine.HIVE;- case Engine.ELASTICSEARCH: return NewEngine.ELASTICSEARCH;- case Engine.BIGQUERY: return NewEngine.BIGQUERY;- case Engine.DATABRICKS: return NewEngine.DATABRICKS;- default: return NewEngine.ENGINE_UNSPECIFIED;- }-};// Conversion function for ColumnMetadata at service boundariesconst convertNewColumnToOld = (newColumn: NewColumnMetadata): ColumnMetadata => {@@ -357,8 +296,8 @@ const convertNewColumnToOld = (newColumn: NewColumnMetadata): ColumnMetadata =>// classification, labels, effectiveMaskingLevel are not available in old proto types});};-const engine = computed(() => {- return props.db.instanceResource.engine;+const engine = computed((): Engine => {+ return convertEngineToNew(props.db.instanceResource.engine);});const state = reactive<LocalState>({mode: "COLUMNS",@@ -490,7 +429,7 @@ const handleApplyColumnTemplate = (if (!template.column) {return;}- if (convertNewEngineToOld(template.engine) !== engine.value) {+ if (template.engine !== engine.value) {return;}const column = convertNewColumnToOld(template.column);diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vueindex 037b9f9069..257a211fe0 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableList/TableList.vue@@ -31,7 +31,7 @@<DrawerContent :title="$t('schema-template.table-template.self')"><div class="w-[calc(100vw-36rem)] min-w-[64rem] max-w-[calc(100vw-8rem)]"><TableTemplates- :engine="convertOldEngineToNew(engine)"+ :engine="convertEngineToNew(engine)":readonly="true"@apply="handleApplyTemplate"/>@@ -41,11 +41,16 @@</template><script lang="ts" setup>+import { useElementSize } from "@vueuse/core";+import { pick } from "lodash-es";+import type { DataTableColumn, DataTableInst } from "naive-ui";+import { NCheckbox, NDataTable } from "naive-ui";+import { computed, h, reactive, ref } from "vue";+import { useI18n } from "vue-i18n";import ClassificationCell from "@/components/ColumnDataTable/ClassificationCell.vue";import { Drawer, DrawerContent, InlineInput } from "@/components/v2";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";-import { Engine as NewEngine } from "@/types/proto-es/v1/common_pb";+import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto-es/v1/setting_service_pb";import {TableCatalog,TableCatalog_Columns,@@ -54,20 +59,13 @@ import {DatabaseMetadata,SchemaMetadata,TableMetadata,- ColumnMetadata,} from "@/types/proto/v1/database_service";-import type {- TableMetadata as NewTableMetadata,- ColumnMetadata as NewColumnMetadata,-} from "@/types/proto-es/v1/database_service_pb";-import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto-es/v1/setting_service_pb";+import {+ convertEngineToNew,+ convertEngineToOld,+} from "@/utils/v1/common-conversions";+import { convertNewTableMetadataToOld } from "@/utils/v1/database-conversions";import TableTemplates from "@/views/SchemaTemplate/TableTemplates.vue";-import { useElementSize } from "@vueuse/core";-import { pick } from "lodash-es";-import type { DataTableColumn, DataTableInst } from "naive-ui";-import { NCheckbox, NDataTable } from "naive-ui";-import { computed, h, reactive, ref } from "vue";-import { useI18n } from "vue-i18n";import { useSchemaEditorContext } from "../../context";import { markUUID } from "../common";import { NameCell, OperationCell, SelectionCell } from "./components";@@ -117,102 +115,6 @@ const {classificationConfig,} = useSchemaEditorContext();-// Conversion function for Engine types at service boundaries-const convertNewEngineToOld = (engine: NewEngine): Engine => {- switch (engine) {- case NewEngine.ENGINE_UNSPECIFIED: return Engine.ENGINE_UNSPECIFIED;- case NewEngine.MYSQL: return Engine.MYSQL;- case NewEngine.POSTGRES: return Engine.POSTGRES;- case NewEngine.CLICKHOUSE: return Engine.CLICKHOUSE;- case NewEngine.SNOWFLAKE: return Engine.SNOWFLAKE;- case NewEngine.SQLITE: return Engine.SQLITE;- case NewEngine.TIDB: return Engine.TIDB;- case NewEngine.MONGODB: return Engine.MONGODB;- case NewEngine.REDIS: return Engine.REDIS;- case NewEngine.ORACLE: return Engine.ORACLE;- case NewEngine.SPANNER: return Engine.SPANNER;- case NewEngine.MSSQL: return Engine.MSSQL;- case NewEngine.REDSHIFT: return Engine.REDSHIFT;- case NewEngine.MARIADB: return Engine.MARIADB;- case NewEngine.OCEANBASE: return Engine.OCEANBASE;- case NewEngine.DM: return Engine.DM;- case NewEngine.RISINGWAVE: return Engine.RISINGWAVE;- case NewEngine.OCEANBASE_ORACLE: return Engine.OCEANBASE_ORACLE;- case NewEngine.STARROCKS: return Engine.STARROCKS;- case NewEngine.DORIS: return Engine.DORIS;- case NewEngine.HIVE: return Engine.HIVE;- case NewEngine.ELASTICSEARCH: return Engine.ELASTICSEARCH;- case NewEngine.BIGQUERY: return Engine.BIGQUERY;- case NewEngine.DATABRICKS: return Engine.DATABRICKS;- default: return Engine.ENGINE_UNSPECIFIED;- }-};--// Conversion function from old Engine types to new Engine types-const convertOldEngineToNew = (engine: Engine): NewEngine => {- switch (engine) {- case Engine.ENGINE_UNSPECIFIED: return NewEngine.ENGINE_UNSPECIFIED;- case Engine.MYSQL: return NewEngine.MYSQL;- case Engine.POSTGRES: return NewEngine.POSTGRES;- case Engine.CLICKHOUSE: return NewEngine.CLICKHOUSE;- case Engine.SNOWFLAKE: return NewEngine.SNOWFLAKE;- case Engine.SQLITE: return NewEngine.SQLITE;- case Engine.TIDB: return NewEngine.TIDB;- case Engine.MONGODB: return NewEngine.MONGODB;- case Engine.REDIS: return NewEngine.REDIS;- case Engine.ORACLE: return NewEngine.ORACLE;- case Engine.SPANNER: return NewEngine.SPANNER;- case Engine.MSSQL: return NewEngine.MSSQL;- case Engine.REDSHIFT: return NewEngine.REDSHIFT;- case Engine.MARIADB: return NewEngine.MARIADB;- case Engine.OCEANBASE: return NewEngine.OCEANBASE;- case Engine.DM: return NewEngine.DM;- case Engine.RISINGWAVE: return NewEngine.RISINGWAVE;- case Engine.OCEANBASE_ORACLE: return NewEngine.OCEANBASE_ORACLE;- case Engine.STARROCKS: return NewEngine.STARROCKS;- case Engine.DORIS: return NewEngine.DORIS;- case Engine.HIVE: return NewEngine.HIVE;- case Engine.ELASTICSEARCH: return NewEngine.ELASTICSEARCH;- case Engine.BIGQUERY: return NewEngine.BIGQUERY;- case Engine.DATABRICKS: return NewEngine.DATABRICKS;- default: return NewEngine.ENGINE_UNSPECIFIED;- }-};--// Conversion function for TableMetadata at service boundaries-const convertNewTableToOld = (newTable: NewTableMetadata): TableMetadata => {- return TableMetadata.fromPartial({- name: newTable.name,- columns: newTable.columns.map(convertNewColumnToOld),- engine: newTable.engine,- collation: newTable.collation,- userComment: newTable.userComment,- comment: newTable.comment,- indexes: [], // Initialize empty, will be handled separately if needed- partitions: [], // Initialize empty, will be handled separately if needed- foreignKeys: [], // Initialize empty, will be handled separately if needed- });-};--// Conversion function for ColumnMetadata at service boundaries-const convertNewColumnToOld = (newColumn: NewColumnMetadata): ColumnMetadata => {- return ColumnMetadata.fromPartial({- name: newColumn.name,- position: newColumn.position,- hasDefault: newColumn.hasDefault,- defaultNull: newColumn.defaultNull,- defaultString: newColumn.defaultString,- defaultExpression: newColumn.defaultExpression,- onUpdate: newColumn.onUpdate,- nullable: newColumn.nullable,- type: newColumn.type,- characterSet: newColumn.characterSet,- collation: newColumn.collation,- userComment: newColumn.userComment,- comment: newColumn.comment,- // classification, labels, effectiveMaskingLevel are not available in old proto types- });-};const dataTableRef = ref<DataTableInst>();const containerElRef = ref<HTMLElement>();const tableHeaderElRef = computed(@@ -266,7 +168,7 @@ const catalogForTable = (table: string) => {const showClassification = computed(() => {return showClassificationColumn(- engine.value,+ convertEngineToNew(engine.value),classificationConfig.value?.classificationFromConfig ?? false);});@@ -373,7 +275,7 @@ const columns = computed(() => {classification: catalog.classification,readonly: readonly.value,disabled: isDroppedSchema.value || isDroppedTable(table),- engine: engine.value,+ engine: convertEngineToNew(engine.value),classificationConfig: classificationConfig.value,onApply: (id: string) => {state.activeTable = table;@@ -474,11 +376,11 @@ const handleApplyTemplate = (template: SchemaTemplateSetting_TableTemplate) => {if (!template.table) {return;}- if (convertNewEngineToOld(template.engine) !== engine.value) {+ if (convertEngineToOld(template.engine) !== engine.value) {return;}- const table = convertNewTableToOld(template.table);+ const table = convertNewTableMetadataToOld(template.table);/* eslint-disable-next-line vue/no-mutating-props */props.schema.tables.push(table);const metadata = metadataForTable(table);diff --git a/frontend/src/components/SchemaEditorLite/context/index.ts b/frontend/src/components/SchemaEditorLite/context/index.tsindex 7ae38a9cae..0095b3de82 100644--- a/frontend/src/components/SchemaEditorLite/context/index.ts+++ b/frontend/src/components/SchemaEditorLite/context/index.ts@@ -4,7 +4,7 @@ import { inject, provide, computed } from "vue";import { supportSetClassificationFromComment } from "@/components/ColumnDataTable/utils";import { useSettingV1Store } from "@/store";import type { ComposedProject } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { RebuildMetadataEditReset } from "../algorithm/rebuild";import type { EditTarget, RolloutObject } from "../types";import { useEditCatalogs } from "./config";diff --git a/frontend/src/components/SchemaEditorLite/edit.ts b/frontend/src/components/SchemaEditorLite/edit.tsindex f1a93e56cc..b59baf6b94 100644--- a/frontend/src/components/SchemaEditorLite/edit.ts+++ b/frontend/src/components/SchemaEditorLite/edit.ts@@ -1,6 +1,6 @@import { MD5 } from "crypto-js";import { pull, pullAt } from "lodash-es";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type {ForeignKeyMetadata,TableMetadata,diff --git a/frontend/src/components/SchemaEditorLite/spec.ts b/frontend/src/components/SchemaEditorLite/spec.tsindex 714ceba57c..4c21044d28 100644--- a/frontend/src/components/SchemaEditorLite/spec.ts+++ b/frontend/src/components/SchemaEditorLite/spec.ts@@ -1,4 +1,4 @@-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { hasSchemaProperty } from "@/utils";export const engineSupportsEditIndexes = (engine: Engine) => {diff --git a/frontend/src/components/SchemaEditorLite/utils/columnDefaultValue.ts b/frontend/src/components/SchemaEditorLite/utils/columnDefaultValue.tsindex 0a5739086c..94bb04a76a 100644--- a/frontend/src/components/SchemaEditorLite/utils/columnDefaultValue.ts+++ b/frontend/src/components/SchemaEditorLite/utils/columnDefaultValue.ts@@ -1,6 +1,6 @@import type { DropdownOption } from "naive-ui";import { t } from "@/plugins/i18n";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { ColumnMetadata } from "@/types/proto/v1/database_service";import type { ColumnDefaultValue } from "@/types/v1/schemaEditor";diff --git a/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue b/frontend/src/components/SchemaTemplate/FieldTemplateForm.vueindex cb56c1342a..fc81e07055 100644--- a/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue+++ b/frontend/src/components/SchemaTemplate/FieldTemplateForm.vue@@ -278,7 +278,6 @@ import {convertKVListToLabels,convertLabelsToKVList,} from "@/utils";-import { convertEngineToOld } from "@/utils/v1/setting-conversions";import ClassificationLevelBadge from "./ClassificationLevelBadge.vue";import SelectClassificationDrawer from "./SelectClassificationDrawer.vue";import { engineList, categoryList, classificationConfig } from "./utils";@@ -361,7 +360,7 @@ const dirty = computed(() => {});const dataTypeOptions = computed(() => {- return getDataTypeSuggestionList(convertEngineToOld(state.engine)).map<SelectOption>(+ return getDataTypeSuggestionList(state.engine).map<SelectOption>((dataType) => {return {label: dataType,@@ -381,7 +380,7 @@ const categoryOptions = computed(() => {const defaultValueOptions = computed(() => {if (!state.column) return [];return getColumnDefaultValueOptions(- convertEngineToOld(state.engine),+ state.engine,state.column.type).map<SelectOption>((opt) => ({value: opt.key,@@ -498,7 +497,7 @@ const handleColumnDefaultInput = (value: string) => {column.defaultNull = false;// If column is text type or has default string, we will treat user's input as string.if (- isTextOfColumnType(convertEngineToOld(state.engine), column.type) ||+ isTextOfColumnType(state.engine, column.type) ||column.defaultString !== undefined) {column.defaultString = value;diff --git a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vueindex 641f0b3382..db312914d5 100644--- a/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue+++ b/frontend/src/components/SchemaTemplate/FieldTemplateTable.vue@@ -31,7 +31,6 @@ import {import { EngineIcon } from "../Icon";import ClassificationLevelBadge from "./ClassificationLevelBadge.vue";import { classificationConfig } from "./utils";-import { convertEngineToOld } from "@/utils/v1/setting-conversions";const props = defineProps<{engine?: Engine;@@ -60,7 +59,7 @@ const columns = computed(key: "name",render: (item) => (<div class="flex justify-start items-center">- <EngineIcon engine={convertEngineToOld(item.engine)} customClass="ml-0 mr-1" />+ <EngineIcon engine={item.engine} customClass="ml-0 mr-1" />{item.column?.name ?? ""}</div>),diff --git a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue b/frontend/src/components/SchemaTemplate/TableTemplateForm.vueindex 503e3c7f80..fdb94b5677 100644--- a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue+++ b/frontend/src/components/SchemaTemplate/TableTemplateForm.vue@@ -222,7 +222,6 @@ import {convertNewDatabaseCatalogToOld,convertOldTableCatalogToNew,} from "@/utils/v1/database-catalog-conversions";-import { convertEngineToOld as convertNewEngineToOld } from "@/utils/v1/setting-conversions";import FieldTemplates from "@/views/SchemaTemplate/FieldTemplates.vue";import { cloneDeep, isEqual, pull } from "lodash-es";import { PencilIcon, PlusIcon, XIcon } from "lucide-vue-next";@@ -264,7 +263,7 @@ const editingForTableEditor = computed(() => {databaseMetadata: convertNewDatabaseMetadataToOld(e.databaseMetadata),schemaMetadata: convertNewSchemaMetadataToOld(e.schemaMetadata),tableMetadata: convertNewTableMetadataToOld(e.tableMetadata),- engine: convertNewEngineToOld(e.engine),+ engine: e.engine,};});@@ -348,7 +347,7 @@ const categoryOptions = computed(() => {});const allowReorderColumns = computed(() => {- return instanceV1AllowsReorderColumns(convertNewEngineToOld(editing.value.engine));+ return instanceV1AllowsReorderColumns(editing.value.engine);});const submitDisabled = computed(() => {@@ -467,7 +466,7 @@ const setColumnPrimaryKey = (oldColumn: any, isPrimaryKey: boolean) => {column.nullable = false;const oldTableMetadata = convertNewTableMetadataToOld(editing.value.tableMetadata);upsertColumnPrimaryKey(- convertNewEngineToOld(editing.value.engine),+ editing.value.engine,oldTableMetadata,column.name);diff --git a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue b/frontend/src/components/SchemaTemplate/TableTemplateTable.vueindex 85e701e419..1295c72354 100644--- a/frontend/src/components/SchemaTemplate/TableTemplateTable.vue+++ b/frontend/src/components/SchemaTemplate/TableTemplateTable.vue@@ -19,7 +19,6 @@ import { useI18n } from "vue-i18n";import { MiniActionButton } from "@/components/v2";import { useSettingV1Store } from "@/store";import { Engine } from "@/types/proto-es/v1/common_pb";-import { Engine as LegacyEngine } from "@/types/proto/v1/common";import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto-es/v1/setting_service_pb";import {SchemaTemplateSettingSchema,@@ -45,58 +44,6 @@ const emit = defineEmits<{const { t } = useI18n();const settingStore = useSettingV1Store();-// Conversion function for Engine type conflicts-const convertEngineForIcon = (engine: Engine): LegacyEngine => {- switch (engine) {- case Engine.MYSQL:- return "MYSQL" as LegacyEngine;- case Engine.POSTGRES:- return "POSTGRES" as LegacyEngine;- case Engine.ORACLE:- return "ORACLE" as LegacyEngine;- case Engine.TIDB:- return "TIDB" as LegacyEngine;- case Engine.SNOWFLAKE:- return "SNOWFLAKE" as LegacyEngine;- case Engine.CLICKHOUSE:- return "CLICKHOUSE" as LegacyEngine;- case Engine.MONGODB:- return "MONGODB" as LegacyEngine;- case Engine.REDIS:- return "REDIS" as LegacyEngine;- case Engine.SQLITE:- return "SQLITE" as LegacyEngine;- case Engine.MSSQL:- return "MSSQL" as LegacyEngine;- case Engine.MARIADB:- return "MARIADB" as LegacyEngine;- case Engine.BIGQUERY:- return "BIGQUERY" as LegacyEngine;- case Engine.SPANNER:- return "SPANNER" as LegacyEngine;- case Engine.DATABRICKS:- return "DATABRICKS" as LegacyEngine;- case Engine.RISINGWAVE:- return "RISINGWAVE" as LegacyEngine;- case Engine.OCEANBASE:- return "OCEANBASE" as LegacyEngine;- case Engine.DYNAMODB:- return "DYNAMODB" as LegacyEngine;- case Engine.HIVE:- return "HIVE" as LegacyEngine;- case Engine.ELASTICSEARCH:- return "ELASTICSEARCH" as LegacyEngine;- case Engine.STARROCKS:- return "STARROCKS" as LegacyEngine;- case Engine.DORIS:- return "DORIS" as LegacyEngine;- case Engine.CASSANDRA:- return "CASSANDRA" as LegacyEngine;- default:- return "ENGINE_UNSPECIFIED" as LegacyEngine;- }-};-const columns = computed((): DataTableColumn<SchemaTemplateSetting_TableTemplate>[] => {const cols: DataTableColumn<SchemaTemplateSetting_TableTemplate>[] = [@@ -110,7 +57,7 @@ const columns = computed(key: "name",render: (item) => (<div class="flex justify-start items-center">- <EngineIcon engine={convertEngineForIcon(item.engine)} customClass="ml-0 mr-1" />+ <EngineIcon engine={item.engine} customClass="ml-0 mr-1" />{item.table?.name ?? ""}</div>),diff --git a/frontend/src/components/SchemaTemplate/TableTemplateView.vue b/frontend/src/components/SchemaTemplate/TableTemplateView.vueindex d7d791161b..f3b66ff2d4 100644--- a/frontend/src/components/SchemaTemplate/TableTemplateView.vue+++ b/frontend/src/components/SchemaTemplate/TableTemplateView.vue@@ -28,7 +28,7 @@</div></div><TableTemplateTable- :engine="engine ? convertEngineToNew(engine) : undefined"+ :engine="engine":readonly="readonly":template-list="filteredTemplateList"class="flex-1"@@ -42,9 +42,8 @@import { NCheckbox, NEmpty } from "naive-ui";import { reactive, computed } from "vue";import { useI18n } from "vue-i18n";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto-es/v1/setting_service_pb";-import { convertEngineToNew } from "@/utils/v1/setting-conversions";import TableTemplateTable from "./TableTemplateTable.vue";interface LocalState {diff --git a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vueindex 16c0e60557..60cb7d9657 100644--- a/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue+++ b/frontend/src/components/SensitiveData/components/SensitiveColumnTable.vue@@ -30,6 +30,7 @@ import type { ComposedDatabase } from "@/types";import { create } from "@bufbuild/protobuf";import { DataClassificationSetting_DataClassificationConfigSchema } from "@/types/proto-es/v1/setting_service_pb";import { autoDatabaseRoute } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";const props = defineProps<{database: ComposedDatabase;@@ -158,7 +159,7 @@ const dataTableColumns = computed(() => {<ClassificationCellclassification={item.classificationId}classificationConfig={classificationConfig.value}- engine={props.database.instanceResource.engine}+ engine={convertEngineToNew(props.database.instanceResource.engine)}readonly={!props.showOperation || item.disableClassification}onApply={(id: string) => onClassificationIdApply(item, id)}/>diff --git a/frontend/src/components/SyncDatabaseSchemaV1/DiffViewPanel.vue b/frontend/src/components/SyncDatabaseSchemaV1/DiffViewPanel.vueindex 9fc384d76e..9d9e6d8373 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/DiffViewPanel.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/DiffViewPanel.vue@@ -56,7 +56,7 @@ import { ref } from "vue";import { MonacoEditor } from "@/components/MonacoEditor";import { CopyButton } from "@/components/v2";import { dialectOfEngineV1 } from "@/types";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import SchemaDiffViewer from "./SchemaDiffViewer.vue";defineProps<{diff --git a/frontend/src/components/SyncDatabaseSchemaV1/RawSQLEditor.vue b/frontend/src/components/SyncDatabaseSchemaV1/RawSQLEditor.vueindex 751b0f858c..02ec588ab5 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/RawSQLEditor.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/RawSQLEditor.vue@@ -36,7 +36,7 @@ import { computed, nextTick, reactive } from "vue";import { MonacoEditor } from "@/components/MonacoEditor";import SQLUploadButton from "@/components/misc/SQLUploadButton.vue";import { dialectOfEngineV1, type ComposedProject } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { engineNameV1 } from "@/utils";import { ALLOWED_ENGINES, type RawSQLState } from "./types";diff --git a/frontend/src/components/SyncDatabaseSchemaV1/SelectTargetDatabasesView.vue b/frontend/src/components/SyncDatabaseSchemaV1/SelectTargetDatabasesView.vueindex d7779a0085..72551421eb 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/SelectTargetDatabasesView.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/SelectTargetDatabasesView.vue@@ -169,7 +169,8 @@ import {type ComposedDatabase,type ComposedProject,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import DiffViewPanel from "./DiffViewPanel.vue";import SourceSchemaInfo from "./SourceSchemaInfo.vue";import TargetDatabasesSelectPanel from "./TargetDatabasesSelectPanel.vue";@@ -370,7 +371,7 @@ onMounted(async () => {if (isValidDatabaseName(targetDatabaseName)) {const database =await databaseStore.getOrFetchDatabaseByName(targetDatabaseName);- if (database && database.instanceResource.engine === props.sourceEngine) {+ if (database && convertEngineToNew(database.instanceResource.engine) === props.sourceEngine) {state.selectedDatabaseNameList = [targetDatabaseName];state.selectedDatabaseName = targetDatabaseName;}diff --git a/frontend/src/components/SyncDatabaseSchemaV1/SourceSchemaInfo.vue b/frontend/src/components/SyncDatabaseSchemaV1/SourceSchemaInfo.vueindex a1a96dc83c..c1e454cfde 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/SourceSchemaInfo.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/SourceSchemaInfo.vue@@ -35,7 +35,7 @@ import { computed } from "vue";import { useI18n } from "vue-i18n";import { useDatabaseV1Store } from "@/store";import { isValidDatabaseName, type ComposedProject } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {databaseV1Url,engineNameV1,diff --git a/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue b/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vueindex b1885b1073..a63537a4c0 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/TargetDatabasesSelectPanel.vue@@ -74,7 +74,7 @@ import {instanceNamePrefix,environmentNamePrefix,} from "@/store/modules/v1/common";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import { CommonFilterScopeIdList, extractProjectResourceName } from "@/utils";import type { SearchParams, SearchScope } from "@/utils";import AdvancedSearch from "../AdvancedSearch";diff --git a/frontend/src/components/SyncDatabaseSchemaV1/index.vue b/frontend/src/components/SyncDatabaseSchemaV1/index.vueindex 35290b2c82..8bc38ed2b7 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/index.vue+++ b/frontend/src/components/SyncDatabaseSchemaV1/index.vue@@ -91,7 +91,8 @@ import {} from "@/store";import type { ComposedProject } from "@/types";import { isValidDatabaseName, isValidEnvironmentName } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { ChangelogView } from "@/types/proto/v1/database_service";import { extractProjectResourceName, generateIssueTitle } from "@/utils";import {@@ -174,7 +175,7 @@ const sourceEngine = computed(() => {const database = databaseStore.getDatabaseByName(changelogSourceSchemaState.databaseName);- return database.instanceResource.engine;+ return convertEngineToNew(database.instanceResource.engine);} else {return rawSQLState.engine;}diff --git a/frontend/src/components/SyncDatabaseSchemaV1/types.ts b/frontend/src/components/SyncDatabaseSchemaV1/types.tsindex de0f91c58e..c9771b96d3 100644--- a/frontend/src/components/SyncDatabaseSchemaV1/types.ts+++ b/frontend/src/components/SyncDatabaseSchemaV1/types.ts@@ -1,4 +1,4 @@-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";export enum SourceSchemaType {SCHEMA_HISTORY_VERSION,diff --git a/frontend/src/components/TableDataTable.vue b/frontend/src/components/TableDataTable.vueindex e602156022..683918d937 100644--- a/frontend/src/components/TableDataTable.vue+++ b/frontend/src/components/TableDataTable.vue@@ -35,10 +35,11 @@ import {useSettingV1Store,} from "@/store/modules";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { TableMetadata } from "@/types/proto/v1/database_service";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { bytesToString, hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { DataTableColumn } from "naive-ui";import { NDataTable } from "naive-ui";import type { PropType } from "vue";@@ -103,7 +104,7 @@ const classificationConfig = computed(() => {const hasSensitiveDataFeature = featureToRef(PlanFeature.FEATURE_DATA_MASKING);-const engine = computed(() => props.database.instanceResource.engine);+const engine = computed(() => convertEngineToNew(props.database.instanceResource.engine));const isPostgres = computed(() => engine.value === Engine.POSTGRES || engine.value === Engine.RISINGWAVEdiff --git a/frontend/src/components/TableDetailDrawer.vue b/frontend/src/components/TableDetailDrawer.vueindex ee8024ffcb..7149e7e910 100644--- a/frontend/src/components/TableDetailDrawer.vue+++ b/frontend/src/components/TableDetailDrawer.vue@@ -74,7 +74,7 @@<NPopovertrigger="click"placement="bottom"- v-if="supportGetStringSchema(instanceEngine)"+ v-if="supportGetStringSchema(instanceEngineNew)"@update:show="(show: boolean) => show"><template #trigger>@@ -107,7 +107,7 @@<!-- Description list --><dl class="grid grid-cols-1 gap-x-4 gap-y-4 sm:grid-cols-3"><div- v-if="hasTableEngineProperty(instanceEngine)"+ v-if="hasTableEngineProperty(instanceEngineNew)"class="col-span-1"><dt class="text-sm font-medium text-control-light">@@ -126,7 +126,7 @@<ClassificationCell:classification="tableCatalog.classification":classification-config="classificationConfig"- :engine="instanceEngine"+ :engine="instanceEngineNew"@apply="(id: string) =>$emit('apply-classification', tableName, id)@@ -154,7 +154,7 @@</div><div- v-if="hasIndexSizeProperty(instanceEngine)"+ v-if="hasIndexSizeProperty(instanceEngineNew)"class="col-span-1"><dt class="text-sm font-medium text-control-light">@@ -166,7 +166,7 @@</div><template- v-if="instanceV1HasCollationAndCharacterSet(instanceEngine)"+ v-if="instanceV1HasCollationAndCharacterSet(instanceEngineNew)"><div class="col-span-1"><dt class="text-sm font-medium text-control-light">@@ -201,7 +201,7 @@</div><div- v-if="instanceV1SupportsColumn(instanceEngine)"+ v-if="instanceV1SupportsColumn(instanceEngineNew)"class="mt-6 px-6 space-y-4"><div class="w-full flex flex-row justify-between items-center">@@ -229,7 +229,7 @@</div><div- v-if="instanceV1SupportsIndex(instanceEngine)"+ v-if="instanceV1SupportsIndex(instanceEngineNew)"class="mt-6 px-6 space-y-4"><div class="text-lg leading-6 font-medium text-main">@@ -239,7 +239,7 @@</div><div- v-if="instanceV1SupportsTrigger(instanceEngine)"+ v-if="instanceV1SupportsTrigger(instanceEngineNew)"class="mt-6 px-6 space-y-4"><div class="text-lg leading-6 font-medium text-main">@@ -254,7 +254,7 @@</div><div- v-if="instanceV1MaskingForNoSQL(instanceEngine)"+ v-if="instanceV1MaskingForNoSQL(instanceEngineNew)"class="mt-6 px-6 space-y-4"><div>@@ -328,7 +328,7 @@ import {} from "@/store";import { DEFAULT_PROJECT_NAME, defaultProject } from "@/types";import type { DataClassificationSetting_DataClassificationConfig } from "@/types/proto-es/v1/setting_service_pb";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {TableCatalog,ObjectSchema,@@ -351,6 +351,7 @@ import {isDatabaseV1Queryable,supportGetStringSchema,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import ColumnDataTable from "./ColumnDataTable/index.vue";import { SQLEditorButtonV1 } from "./DatabaseDetail";import IndexTable from "./IndexTable.vue";@@ -514,6 +515,10 @@ const instanceEngine = computed(() => {return database.value.instanceResource.engine;});+const instanceEngineNew = computed(() => {+ return convertEngineToNew(instanceEngine.value);+});+const allowQuery = computed(() => {if (database.value.project === DEFAULT_PROJECT_NAME) {return hasProjectPermissionV2(defaultProject(), "bb.sql.select");@@ -524,7 +529,7 @@ const allowQuery = computed(() => {const hasPartitionTables = computed(() => {return (// Only show partition tables for PostgreSQL.- database.value.instanceResource.engine === Engine.POSTGRES &&+ convertEngineToNew(database.value.instanceResource.engine) === Engine.POSTGRES &&table.value &&table.value.partitions.length > 0);@@ -535,7 +540,7 @@ const shouldShowPartitionTablesDataTable = computed(() => {});const getTableName = (tableName: string) => {- if (hasSchemaProperty(instanceEngine.value) && props.schemaName) {+ if (hasSchemaProperty(convertEngineToNew(instanceEngine.value)) && props.schemaName) {return `"${props.schemaName}"."${tableName}"`;}return tableName;diff --git a/frontend/src/components/TableSchemaViewer.vue b/frontend/src/components/TableSchemaViewer.vueindex 56244b7392..7197086532 100644--- a/frontend/src/components/TableSchemaViewer.vue+++ b/frontend/src/components/TableSchemaViewer.vue@@ -33,6 +33,7 @@ import {} from "@/types/proto-es/v1/database_service_pb";import { hasSchemaProperty } from "@/utils";import { convertOldObjectTypeToNew } from "@/utils/v1/database-conversions";+import { convertEngineToNew } from "@/utils/v1/common-conversions";const props = defineProps<{database: ComposedDatabase;@@ -49,7 +50,7 @@ const engine = computed(() => {const resourceName = computed(() => {if (props.object) {- if (hasSchemaProperty(engine.value)) {+ if (hasSchemaProperty(convertEngineToNew(engine.value))) {return `${props.schema}.${props.object}`;} else {return props.object;diff --git a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vueindex 773cf87fca..6630753626 100644--- a/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue+++ b/frontend/src/components/User/Settings/UserDataTable/cells/UserOperationsCell.vue@@ -59,9 +59,10 @@ import { NButton, NPopconfirm } from "naive-ui";import { computed } from "vue";import { useI18n } from "vue-i18n";import { useUserStore, pushNotification, useCurrentUserV1 } from "@/store";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { type User, UserType } from "@/types/proto/v1/user_service";import { hasWorkspacePermissionV2 } from "@/utils";+import { convertStateToOld } from "@/utils/v1/common-conversions";const props = defineProps<{user: User;@@ -90,7 +91,7 @@ const allowUpdateUser = computed(() => {if (props.user.userType === UserType.SYSTEM_BOT) {return false;}- return props.user.state === State.ACTIVE;+ return props.user.state === convertStateToOld(State.ACTIVE);});const allowDeleteUser = computed(() => {@@ -102,7 +103,7 @@ const allowDeleteUser = computed(() => {});const allowReactiveUser = computed(() => {- return allowUndelete.value && props.user.state === State.DELETED;+ return allowUndelete.value && props.user.state === convertStateToOld(State.DELETED);});const changeRowStatus = async (state: State) => {diff --git a/frontend/src/components/VCS/VCSIcon.vue b/frontend/src/components/VCS/VCSIcon.vueindex 23f1e0ed0b..3f2aa62672 100644--- a/frontend/src/components/VCS/VCSIcon.vue+++ b/frontend/src/components/VCS/VCSIcon.vue@@ -4,7 +4,7 @@<script lang="ts" setup>import { computed } from "vue";-import { VCSType } from "@/types/proto/v1/common";+import { VCSType } from "@/types/proto-es/v1/common_pb";const props = defineProps<{customClass?: string;diff --git a/frontend/src/components/ViewDataTable.vue b/frontend/src/components/ViewDataTable.vueindex a1f159fc46..efa6869820 100644--- a/frontend/src/components/ViewDataTable.vue+++ b/frontend/src/components/ViewDataTable.vue@@ -19,6 +19,7 @@ import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";import type { ViewMetadata } from "@/types/proto/v1/database_service";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import EllipsisSQLView from "./EllipsisSQLView.vue";const props = defineProps({@@ -69,7 +70,7 @@ const columns = computed(() => {});const getViewName = (viewName: string) => {- if (hasSchemaProperty(engine.value) && props.schemaName) {+ if (hasSchemaProperty(convertEngineToNew(engine.value)) && props.schemaName) {return `"${props.schemaName}"."${viewName}"`;}return viewName;diff --git a/frontend/src/components/v2/Model/DatabaseV1Name.vue b/frontend/src/components/v2/Model/DatabaseV1Name.vueindex fda970e6df..f422400435 100644--- a/frontend/src/components/v2/Model/DatabaseV1Name.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Name.vue@@ -10,7 +10,7 @@><HighlightLabelText :text="database.databaseName" :keyword="keyword" /><span- v-if="showNotFound && database.state === State.DELETED"+ v-if="showNotFound && convertStateToNew(database.state) === State.DELETED"class="text-control-placeholder">(NOT_FOUND)@@ -23,7 +23,8 @@ import { NEllipsis } from "naive-ui";import { computed } from "vue";import { useRouter } from "vue-router";import type { ComposedDatabase } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import { autoDatabaseRoute } from "@/utils";import HighlightLabelText from "./HighlightLabelText.vue";@@ -45,7 +46,7 @@ const props = withDefaults(const router = useRouter();const shouldShowLink = computed(() => {- return props.link && props.database.state === State.ACTIVE;+ return props.link && convertStateToNew(props.database.state) === State.ACTIVE;});const bindings = computed(() => {diff --git a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vueindex e24b592d77..5fe2feef47 100644--- a/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue+++ b/frontend/src/components/v2/Model/DatabaseV1Table/cells/ProjectNameCell.vue@@ -11,7 +11,7 @@{{ suffix }}</slot>- <NTooltip v-if="project.state === State.DELETED">+ <NTooltip v-if="convertStateToNew(project.state) === State.DELETED"><template #trigger><heroicons-outline:archive class="w-4 h-4 text-control" /></template>@@ -25,7 +25,8 @@<script setup lang="ts">import { NTooltip } from "naive-ui";import { ProjectV1Name } from "@/components/v2";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import type { Project } from "@/types/proto/v1/project_service";import type { Mode } from "../DatabaseV1Table.vue";diff --git a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue b/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vueindex 1ea5436c3e..bc34c78239 100644--- a/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue+++ b/frontend/src/components/v2/Model/Instance/InstanceEngineRadioGrid.vue@@ -7,7 +7,7 @@<template #item="{ option }: RadioGridItem<Engine>"><div class="flex flex-row items-center gap-x-1"><RichEngineName- :engine="convertEngineToOld(option.value)"+ :engine="option.value"tag="p"class="text-center text-sm !text-main"/>@@ -27,7 +27,6 @@ import {type RadioGridOption,} from "../../Form";import RichEngineName from "./RichEngineName.vue";-import { convertEngineToOld } from "@/utils/v1/setting-conversions";type EngineOption = RadioGridOption<Engine>;@@ -42,7 +41,7 @@ defineEmits<{const options = computed(() => {return props.engineList.map<EngineOption>((engine) => ({value: engine,- label: engineNameV1(convertEngineToOld(engine)),+ label: engineNameV1(engine),}));});</script>diff --git a/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vue b/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vueindex 818840c59b..c9364f989e 100644--- a/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vue+++ b/frontend/src/components/v2/Model/Instance/InstanceV1EngineIcon.vue@@ -2,7 +2,7 @@<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" />+ <EngineIcon custom-class="w-full h-full" :engine="convertEngineToNew(instance.engine)" /><divv-if="showStatus"class="bg-green-400 border-surface-high rounded-full absolute border-2"@@ -19,6 +19,7 @@ import { NTooltip } from "naive-ui";import { computed } from "vue";import type { PropType } from "vue";import { EngineIcon } from "@/components/Icon";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type {Instance,InstanceResource,diff --git a/frontend/src/components/v2/Model/Instance/RichEngineName.vue b/frontend/src/components/v2/Model/Instance/RichEngineName.vueindex 9f78f99aae..56ec678339 100644--- a/frontend/src/components/v2/Model/Instance/RichEngineName.vue+++ b/frontend/src/components/v2/Model/Instance/RichEngineName.vue@@ -11,7 +11,7 @@<script setup lang="ts">import { computed } from "vue";import { EngineIcon } from "@/components/Icon";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import { engineNameV1 } from "@/utils";const RE_SUBTITLE = /\(.+?\)/;diff --git a/frontend/src/components/v2/Select/DatabaseSelect.vue b/frontend/src/components/v2/Select/DatabaseSelect.vueindex 4b519fdf49..f28c83cdef 100644--- a/frontend/src/components/v2/Select/DatabaseSelect.vue+++ b/frontend/src/components/v2/Select/DatabaseSelect.vue@@ -28,7 +28,7 @@ import {isValidDatabaseName,unknownDatabase,} from "@/types";-import { type Engine } from "@/types/proto/v1/common";+import { type Engine } from "@/types/proto-es/v1/common_pb";import {instanceV1Name,supportedEngineV1List,diff --git a/frontend/src/components/v2/Select/InstanceSelect.vue b/frontend/src/components/v2/Select/InstanceSelect.vueindex 3f57af4906..9e29de7532 100644--- a/frontend/src/components/v2/Select/InstanceSelect.vue+++ b/frontend/src/components/v2/Select/InstanceSelect.vue@@ -28,7 +28,7 @@ import {unknownInstance,type ComposedInstance,} from "@/types";-import { type Engine } from "@/types/proto/v1/common";+import { type Engine } from "@/types/proto-es/v1/common_pb";import type { InstanceResource } from "@/types/proto/v1/instance_service";import { supportedEngineV1List, getDefaultPagination } from "@/utils";import { InstanceV1EngineIcon } from "../Model/Instance";diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.tsindex 61db060496..48a939d33c 100644--- a/frontend/src/composables/useExecuteSQL.ts+++ b/frontend/src/composables/useExecuteSQL.ts@@ -40,7 +40,8 @@ import type {} from "@/types";import { isValidDatabaseName } from "@/types";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { DatabaseGroupView } from "@/types/proto/v1/database_group_service";import {Advice,@@ -434,8 +435,8 @@ const useExecuteSQL = () => {});if (- database.instanceResource.engine === Engine.MONGODB ||- database.instanceResource.engine === Engine.COSMOSDB+ convertEngineToNew(database.instanceResource.engine) === Engine.MONGODB ||+ convertEngineToNew(database.instanceResource.engine) === Engine.COSMOSDB) {flattenNoSQLResult(resultSet);}diff --git a/frontend/src/layouts/ProjectV1Layout.vue b/frontend/src/layouts/ProjectV1Layout.vueindex d992b949b9..6ca9e18350 100644--- a/frontend/src/layouts/ProjectV1Layout.vue+++ b/frontend/src/layouts/ProjectV1Layout.vue@@ -1,6 +1,6 @@<template><template v-if="initialized">- <ArchiveBanner v-if="project.state === State.DELETED" class="py-2" />+ <ArchiveBanner v-if="convertStateToNew(project.state) === State.DELETED" class="py-2" /><template v-if="isDefaultProject"><h1 class="mb-4 text-xl font-bold leading-6 text-main truncate">{{ $t("database.unassigned-databases") }}@@ -94,7 +94,8 @@ import {UNKNOWN_PROJECT_NAME,} from "@/types";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToNew } from "@/utils/v1/common-conversions";import { hasProjectPermissionV2 } from "@/utils";import { useBodyLayoutContext } from "./common";@@ -177,7 +178,7 @@ const hasPermission = computed(() => {});const allowEdit = computed(() => {- if (project.value.state === State.DELETED) {+ if (convertStateToNew(project.value.state) === State.DELETED) {return false;}@@ -194,7 +195,7 @@ const hasRequestRoleFeature = featureToRef();const quickActionListForDatabase = computed(() => {- if (project.value.state !== State.ACTIVE) {+ if (convertStateToNew(project.value.state) !== State.ACTIVE) {return [];}diff --git a/frontend/src/plugins/ai/components/ProvideAIContext.vue b/frontend/src/plugins/ai/components/ProvideAIContext.vueindex 323943a9c6..af8dc3682e 100644--- a/frontend/src/plugins/ai/components/ProvideAIContext.vue+++ b/frontend/src/plugins/ai/components/ProvideAIContext.vue@@ -12,6 +12,7 @@ import {} from "@/store";import { AISettingSchema, Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { create } from "@bufbuild/protobuf";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { wrapRefAsPromise } from "@/utils";import Emittery from "emittery";import { storeToRefs } from "pinia";@@ -55,7 +56,7 @@ const store = useConversationStore();const context: AIContext = {aiSetting: aiSetting,- engine: computed(() => instance.value.engine),+ engine: computed(() => convertEngineToNew(instance.value.engine)),databaseMetadata,schema,showHistoryDialog,diff --git a/frontend/src/plugins/ai/logic/prompt.ts b/frontend/src/plugins/ai/logic/prompt.tsindex 0ff0bb74dc..92a9200749 100644--- a/frontend/src/plugins/ai/logic/prompt.ts+++ b/frontend/src/plugins/ai/logic/prompt.ts@@ -1,4 +1,4 @@-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { DatabaseMetadata } from "@/types/proto/v1/database_service";import { engineNameV1 } from "@/utils";diff --git a/frontend/src/plugins/ai/types/context.ts b/frontend/src/plugins/ai/types/context.tsindex e51d8724e6..f2dcb823a2 100644--- a/frontend/src/plugins/ai/types/context.ts+++ b/frontend/src/plugins/ai/types/context.ts@@ -1,4 +1,4 @@-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import type { DatabaseMetadata } from "@/types/proto/v1/database_service";import type { AISetting } from "@/types/proto-es/v1/setting_service_pb";import type Emittery from "emittery";diff --git a/frontend/src/plugins/i18n.test.ts b/frontend/src/plugins/i18n.test.tsindex 3e9739ac4a..fbeef4b902 100644--- a/frontend/src/plugins/i18n.test.ts+++ b/frontend/src/plugins/i18n.test.ts@@ -1,5 +1,4 @@import { describe, expect, test } from "vitest";-import { engineToJSON } from "@/types/proto/v1/common";import { sQLReviewRuleLevelToJSON } from "@/types/proto/v1/org_policy_service";import { TEMPLATE_LIST_V2, getRuleLocalizationKey } from "../types/sqlReview";import { mergedLocalMessage } from "./i18n-messages";@@ -61,7 +60,7 @@ describe("Test i18n for SQL review", () => {expect(!!i18nForSQLReview["engine"][- engineToJSON(rule.engine).toLowerCase()+ String(rule.engine).toLowerCase()]).toBe(true);diff --git a/frontend/src/store/modules/release.ts b/frontend/src/store/modules/release.tsindex 2d1fac6f05..1a7320a0c5 100644--- a/frontend/src/store/modules/release.ts+++ b/frontend/src/store/modules/release.ts@@ -7,9 +7,10 @@ import { releaseServiceClientConnect } from "@/grpcweb";import { silentContextKey } from "@/grpcweb/context-key";import type { MaybeRef, ComposedRelease, Pagination } from "@/types";import { isValidReleaseName, unknownRelease, unknownUser } from "@/types";-import { State } from "@/types/proto/v1/common";import type { DeepPartial, Release } from "@/types/proto/v1/release_service";import { Release as ReleaseProto } from "@/types/proto/v1/release_service";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import {GetReleaseRequestSchema,ListReleasesRequestSchema,@@ -95,7 +96,7 @@ export const useReleaseStore = defineStore("release", () => {const request = create(DeleteReleaseRequestSchema, { name });await releaseServiceClientConnect.deleteRelease(request);if (releaseMapByName.get(name)) {- releaseMapByName.get(name)!.state = State.DELETED;+ releaseMapByName.get(name)!.state = convertStateToOld(State.DELETED);}};diff --git a/frontend/src/store/modules/sqlReview.ts b/frontend/src/store/modules/sqlReview.tsindex d4082613e2..39ee5f2da7 100644--- a/frontend/src/store/modules/sqlReview.ts+++ b/frontend/src/store/modules/sqlReview.ts@@ -28,6 +28,7 @@ import {convertOldReviewConfigToNew,} from "@/utils/v1/review-config-conversions";import { usePolicyV1Store } from "./v1/policy";+import { convertEngineToNew, convertEngineToOld } from "@/utils/v1/common-conversions";const reviewConfigTagName = "bb.tag.review_config";@@ -71,7 +72,7 @@ const convertToSQLReviewPolicy = (const rule: SchemaPolicyRule = {type: r.type,level: r.level,- engine: r.engine,+ engine: convertEngineToNew(r.engine),comment: r.comment,};if (r.payload && r.payload !== "{}") {@@ -198,7 +199,7 @@ export const useSQLReviewStore = defineStore("sqlReview", {return {type: r.type as string,level: r.level,- engine: r.engine,+ engine: convertEngineToOld(r.engine),comment: r.comment,payload: r.payload ? JSON.stringify(r.payload) : "{}",};diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.tsindex 7b2cbb9c6c..8670cd5159 100644--- a/frontend/src/store/modules/user.ts+++ b/frontend/src/store/modules/user.ts@@ -14,7 +14,8 @@ import {unknownUser,userBindingPrefix,} from "@/types";-import { State, stateToJSON } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import type { UpdateUserRequest, User } from "@/types/proto/v1/user_service";import { UserType, userTypeToJSON } from "@/types/proto/v1/user_service";import {@@ -54,7 +55,9 @@ const getListUserFilter = (params: UserFilter) => {filter.push(`project == "${params.project}"`);}if (params.state === State.DELETED) {- filter.push(`state == "${stateToJSON(params.state)}"`);+ // Convert proto-es State to old proto State for JSON serialization+ const oldState = convertStateToOld(params.state);+ filter.push(`state == "${oldState}"`);}return filter.join(" && ");@@ -157,7 +160,7 @@ export const useUserStore = defineStore("user", () => {name: user.name,});await userServiceClientConnect.deleteUser(request);- user.state = State.DELETED;+ user.state = convertStateToOld(State.DELETED);await actuatorStore.fetchServerInfo();return user;};diff --git a/frontend/src/store/modules/v1/database.ts b/frontend/src/store/modules/v1/database.tsindex 2fb7e01db1..20fbc81474 100644--- a/frontend/src/store/modules/v1/database.ts+++ b/frontend/src/store/modules/v1/database.ts@@ -32,7 +32,8 @@ import {unknownEnvironment,unknownInstanceResource,} from "@/types";-import { type Engine, engineToJSON } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToOld } from "@/utils/v1/common-conversions";import type {Database,UpdateDatabaseRequest,@@ -95,13 +96,13 @@ const getListDatabaseFilter = (filter: DatabaseFilter): string => {// engine filter should be:// engine in ["MYSQL", "POSTGRES"]params.push(- `engine in [${filter.engines.map((e) => `"${engineToJSON(e)}"`).join(", ")}]`+ `engine in [${filter.engines.map((e) => `"${convertEngineToOld(e)}"`).join(", ")}]`);} else if (filter.excludeEngines && filter.excludeEngines.length > 0) {// engine filter should be:// !(engine in ["REDIS", "MONGODB"])params.push(- `!(engine in [${filter.excludeEngines.map((e) => `"${engineToJSON(e)}"`).join(", ")}])`+ `!(engine in [${filter.excludeEngines.map((e) => `"${convertEngineToOld(e)}"`).join(", ")}])`);}if (!isNullOrUndefined(filter.drifted)) {diff --git a/frontend/src/store/modules/v1/instance.ts b/frontend/src/store/modules/v1/instance.tsindex 0124f1e3d1..70881ad789 100644--- a/frontend/src/store/modules/v1/instance.ts+++ b/frontend/src/store/modules/v1/instance.ts@@ -34,8 +34,9 @@ import {isValidInstanceName,isValidEnvironmentName,} from "@/types";-import type { Engine } from "@/types/proto/v1/common";-import { State, stateToJSON, engineToJSON } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld, convertEngineToOld } from "@/utils/v1/common-conversions";import type {DataSource,Instance,@@ -78,11 +79,11 @@ const getListInstanceFilter = (params: InstanceFilter) => {// engine filter should be:// engine in ["MYSQL", "POSTGRES"]list.push(- `engine in [${params.engines.map((e) => `"${engineToJSON(e)}"`).join(", ")}]`+ `engine in [${params.engines.map((e) => `"${convertEngineToOld(e)}"`).join(", ")}]`);}if (params.state === State.DELETED) {- list.push(`state == "${stateToJSON(params.state)}"`);+ list.push(`state == "${convertStateToOld(params.state)}"`);}return list.join(" && ");};@@ -138,7 +139,7 @@ export const useInstanceV1Store = defineStore("instance_v1", () => {force,});await instanceServiceClientConnect.deleteInstance(request);- instance.state = State.DELETED;+ instance.state = convertStateToOld(State.DELETED);const composed = await upsertInstances([instance]);return composed[0];};@@ -147,7 +148,7 @@ export const useInstanceV1Store = defineStore("instance_v1", () => {name: instance.name,});await instanceServiceClientConnect.undeleteInstance(request);- instance.state = State.ACTIVE;+ instance.state = convertStateToOld(State.ACTIVE);const composed = await upsertInstances([instance]);return composed[0];};diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.tsindex 12448dac62..e4d753c16c 100644--- a/frontend/src/store/modules/v1/project.ts+++ b/frontend/src/store/modules/v1/project.ts@@ -16,7 +16,8 @@ import {DEFAULT_PROJECT_NAME,isValidProjectName,} from "@/types";-import { State, stateToJSON } from "@/types/proto/v1/common";+import { State as NewState } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import type {Project,ListProjectsResponse,@@ -39,7 +40,7 @@ import { useProjectIamPolicyStore } from "./projectIamPolicy";export interface ProjectFilter {query?: string;excludeDefault?: boolean;- state?: State;+ state?: NewState;}const getListProjectFilter = (params: ProjectFilter) => {@@ -53,8 +54,8 @@ const getListProjectFilter = (params: ProjectFilter) => {if (params.excludeDefault) {list.push("exclude_default == true");}- if (params.state === State.DELETED) {- list.push(`state == "${stateToJSON(params.state)}"`);+ if (params.state === NewState.DELETED) {+ list.push(`state == "${convertStateToOld(params.state)}"`);}return list.join(" && ");};@@ -92,7 +93,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {return projectList.value;}return projectList.value.filter(- (project) => project.state === State.ACTIVE+ (project) => project.state === convertStateToOld(NewState.ACTIVE));};const getProjectByName = (name: string) => {@@ -131,7 +132,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {...params,pageToken,filter: getListProjectFilter(params.filter ?? {}),- showDeleted: params.filter?.state === State.DELETED ? true : false,+ showDeleted: params.filter?.state === NewState.DELETED ? true : false,});const connectResponse = await projectServiceClientConnect.listProjects(request, { contextValues });resp = {@@ -143,7 +144,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {...params,pageToken,filter: getListProjectFilter(params.filter ?? {}),- showDeleted: params.filter?.state === State.DELETED ? true : false,+ showDeleted: params.filter?.state === NewState.DELETED ? true : false,});const connectResponse = await projectServiceClientConnect.searchProjects(request, { contextValues });resp = {@@ -207,7 +208,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {force,});await projectServiceClientConnect.deleteProject(request);- project.state = State.DELETED;+ project.state = convertStateToOld(NewState.DELETED);await upsertProjectMap([project]);};const batchDeleteProjects = async (projectNames: string[], force = false) => {@@ -223,7 +224,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {if (project && project.name !== UNKNOWN_PROJECT_NAME) {// Extract Project properties (excluding iamPolicy)const { iamPolicy: _iamPolicy, ...projectData } = project;- return { ...projectData, state: State.DELETED };+ return { ...projectData, state: convertStateToOld(NewState.DELETED) };}return null;})diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.tsindex e57ba76a09..5d6d83011c 100644--- a/frontend/src/store/modules/v1/sheet.ts+++ b/frontend/src/store/modules/v1/sheet.ts@@ -5,8 +5,8 @@ import { sheetServiceClientConnect } from "@/grpcweb";import { useCache } from "@/store/cache";import type { MaybeRef } from "@/types";import { UNKNOWN_ID } from "@/types";-import { Engine, engineToJSON } from "@/types/proto/v1/common";import { Sheet } from "@/types/proto/v1/sheet_service";+import { Engine } from "@/types/proto-es/v1/common_pb";import {CreateSheetRequestSchema,GetSheetRequestSchema,@@ -14,6 +14,7 @@ import {} from "@/types/proto-es/v1/sheet_service_pb";import { convertNewSheetToOld, convertOldSheetToNew } from "@/utils/v1/sheet-conversions";import { extractSheetUID, getSheetStatement } from "@/utils";+import { convertEngineToOld } from "@/utils/v1/common-conversions";export type SheetView = "FULL" | "BASIC";type SheetCacheKey = [string /* uid */, SheetView];@@ -42,15 +43,13 @@ export const useSheetV1Store = defineStore("sheet_v1", () => {// CRUDconst createSheet = async (parent: string, sheet: Partial<Sheet>) => {- if (!sheet.engine || sheet.engine === Engine.ENGINE_UNSPECIFIED) {- const engineStr = sheet.engine- ? engineToJSON(sheet.engine)- : "<undefined>";+ if (!sheet.engine || sheet.engine === convertEngineToOld(Engine.ENGINE_UNSPECIFIED)) {+ const engineStr = sheet.engine || "<undefined>";console.warn(`[SheetService.CreateSheet] sheet.engine unspecified: ${engineStr}`);- sheet.engine = Engine.ENGINE_UNSPECIFIED;+ sheet.engine = convertEngineToOld(Engine.ENGINE_UNSPECIFIED);}const fullSheet = Sheet.fromPartial(sheet);const request = create(CreateSheetRequestSchema, {diff --git a/frontend/src/types/sqlEditor/editor.ts b/frontend/src/types/sqlEditor/editor.tsindex 1585fb347e..fb71c790bf 100644--- a/frontend/src/types/sqlEditor/editor.ts+++ b/frontend/src/types/sqlEditor/editor.ts@@ -1,5 +1,5 @@import type * as monaco from "monaco-editor";-import { Engine } from "../proto/v1/common";+import { Engine } from "../proto-es/v1/common_pb";export type EditorModel = monaco.editor.ITextModel;export type EditorPosition = monaco.Position;@@ -47,7 +47,7 @@ export const dialectOfEngine = (engine = "unknown"): SQLDialect => {};export const dialectOfEngineV1 = (- engine: Engine = Engine.UNRECOGNIZED+ engine: Engine = Engine.ENGINE_UNSPECIFIED): SQLDialect => {return EngineToSQLDialectMap.get(engine) ?? "MYSQL";};diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.tsindex 014cfb3b7e..e8f2b47d3c 100644--- a/frontend/src/types/sqlReview.ts+++ b/frontend/src/types/sqlReview.ts@@ -1,6 +1,6 @@import { t, te } from "@/plugins/i18n";-import type { Engine } from "@/types/proto/v1/common";-import { engineFromJSON } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";+import { engineToString } from "@/utils/v1/common-conversions";import {SQLReviewRuleLevel,sQLReviewRuleLevelFromJSON,@@ -153,7 +153,7 @@ export const getRuleMapByEngine = (ruleList: RuleTemplateV2[]): Map<Engine, Map<string, RuleTemplateV2>> => {return ruleList.reduce((map, rule) => {- const engine = engineFromJSON(rule.engine);+ const engine = rule.engine; // Engine is already numeric enum, no conversion neededif (!map.has(engine)) {map.set(engine, new Map());}@@ -165,7 +165,7 @@ export const getRuleMapByEngine = (});return map;}, new Map<Engine, Map<string, RuleTemplateV2>>());-};+};;export const ruleTemplateMapV2 = getRuleMapByEngine(sqlReviewSchema as RuleTemplateV2[]@@ -195,7 +195,7 @@ export const TEMPLATE_LIST_V2: SQLReviewPolicyTemplateV2[] = (function () {for (const rule of template.ruleList) {const ruleTemplate = ruleTemplateMapV2- .get(engineFromJSON(rule.engine))+ .get(rule.engine) // Engine is already numeric?.get(rule.type);if (!ruleTemplate) {continue;@@ -751,7 +751,7 @@ export const getRuleLocalization = (let description = t(`sql-review.rule.${key}.description`);if (engine) {- const engineSpecificKey = `${key}.${engine.toLowerCase()}`;+ const engineSpecificKey = `${key}.${engineToString(engine).toLowerCase()}`;if (te(`sql-review.rule.${engineSpecificKey}.title`)) {title = t(`sql-review.rule.${engineSpecificKey}.title`);}diff --git a/frontend/src/types/v1/database.ts b/frontend/src/types/v1/database.tsindex 9e5154494f..80c15c3205 100644--- a/frontend/src/types/v1/database.ts+++ b/frontend/src/types/v1/database.ts@@ -1,6 +1,7 @@import { extractDatabaseResourceName, isNullOrUndefined } from "@/utils";import { EMPTY_ID, UNKNOWN_ID } from "../const";-import { State } from "../proto/v1/common";+import { State } from "../proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { Database } from "../proto/v1/database_service";import type { InstanceResource } from "../proto/v1/instance_service";import type { Environment } from "../v1/environment";@@ -30,7 +31,7 @@ export const unknownDatabase = (): ComposedDatabase => {const effectiveEnvironmentEntity = unknownEnvironment();const database = Database.fromPartial({name: `${instanceResource.name}/databases/${UNKNOWN_ID}`,- state: State.ACTIVE,+ state: convertStateToOld(State.ACTIVE),project: projectEntity.name,effectiveEnvironment: formatEnvironmentName(effectiveEnvironmentEntity.id),});diff --git a/frontend/src/types/v1/instance.ts b/frontend/src/types/v1/instance.tsindex 3129213ed6..2a02c449ab 100644--- a/frontend/src/types/v1/instance.ts+++ b/frontend/src/types/v1/instance.ts@@ -1,8 +1,9 @@import { environmentNamePrefix } from "@/store";import type { Environment } from "@/types/v1/environment";import { EMPTY_ID, UNKNOWN_ID } from "../const";-import { Engine, State } from "../proto/v1/common";+import { Engine, State } from "../proto-es/v1/common_pb";import { Instance, InstanceResource } from "../proto/v1/instance_service";+import { convertEngineToOld, convertStateToOld } from "@/utils/v1/common-conversions";import type { Instance as NewInstance } from "@/types/proto-es/v1/instance_service_pb";import { UNKNOWN_ENVIRONMENT_NAME, unknownEnvironment } from "./environment";@@ -25,9 +26,9 @@ export const unknownInstance = (): ComposedInstance => {const environmentEntity = unknownEnvironment();const instance = Instance.fromPartial({name: UNKNOWN_INSTANCE_NAME,- state: State.ACTIVE,+ state: convertStateToOld(State.ACTIVE),title: "<<Unknown instance>>",- engine: Engine.MYSQL,+ engine: convertEngineToOld(Engine.MYSQL),environment: `${environmentNamePrefix}${environmentEntity.id}`,});return {diff --git a/frontend/src/types/v1/project.ts b/frontend/src/types/v1/project.tsindex 9c1199ffc8..73d4d709c7 100644--- a/frontend/src/types/v1/project.ts+++ b/frontend/src/types/v1/project.ts@@ -1,5 +1,6 @@import { EMPTY_ID, UNKNOWN_ID } from "../const";-import { State } from "../proto/v1/common";+import { State } from "../proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { IamPolicy } from "../proto/v1/iam_policy";import { Project } from "../proto/v1/project_service";@@ -17,7 +18,7 @@ export const emptyProject = (): ComposedProject => {...Project.fromPartial({name: EMPTY_PROJECT_NAME,title: "",- state: State.ACTIVE,+ state: convertStateToOld(State.ACTIVE),}),iamPolicy: IamPolicy.fromPartial({}),};diff --git a/frontend/src/types/v1/user.ts b/frontend/src/types/v1/user.tsindex 602ddb7148..614a6e7288 100644--- a/frontend/src/types/v1/user.ts+++ b/frontend/src/types/v1/user.ts@@ -1,7 +1,8 @@import { t } from "@/plugins/i18n";import { SYSTEM_BOT_ID } from "../common";import { EMPTY_ID, UNKNOWN_ID } from "../const";-import { State } from "../proto/v1/common";+import { State } from "../proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { User, UserType } from "../proto/v1/user_service";export const UNKNOWN_USER_NAME = `users/${UNKNOWN_ID}`;@@ -10,7 +11,7 @@ export const SYSTEM_BOT_USER_NAME = `users/${SYSTEM_BOT_ID}`;export const emptyUser = (): User => {return User.fromPartial({name: `users/${EMPTY_ID}`,- state: State.ACTIVE,+ state: convertStateToOld(State.ACTIVE),email: "",title: "",userType: UserType.USER,diff --git a/frontend/src/utils/schemaEditor/index.ts b/frontend/src/utils/schemaEditor/index.tsindex f37896ed49..c3a603eab2 100644--- a/frontend/src/utils/schemaEditor/index.ts+++ b/frontend/src/utils/schemaEditor/index.ts@@ -1,5 +1,6 @@import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";export * from "./filter";@@ -17,7 +18,7 @@ export const allowUsingSchemaEditor = (databaseList: ComposedDatabase[]): boolean => {return databaseList.every((db) => {- return engineSupportsSchemaEditor(db.instanceResource.engine);+ return engineSupportsSchemaEditor(convertEngineToNew(db.instanceResource.engine));});};diff --git a/frontend/src/utils/v1/common-conversions.ts b/frontend/src/utils/v1/common-conversions.tsnew file mode 100644index 0000000000..c8c7bbe603--- /dev/null+++ b/frontend/src/utils/v1/common-conversions.ts@@ -0,0 +1,398 @@+/**+ * Common type conversions between old proto and proto-es for common types.+ *+ * This file provides conversion functions for types in common.proto that are shared+ * across multiple services during the migration from old proto to proto-es.+ */++// Old proto imports+import {+ Engine as OldEngine,+ State as OldState,+ ExportFormat as OldExportFormat,+ VCSType as OldVCSType,+ engineToJSON as oldEngineToJSON,+ engineFromJSON as oldEngineFromJSON,+} from "@/types/proto/v1/common";++// Proto-es imports+import {+ Engine as NewEngine,+ State as NewState,+ ExportFormat as NewExportFormat,+ VCSType as NewVCSType,+} from "@/types/proto-es/v1/common_pb";++/**+ * Convert proto-es Engine to old proto Engine+ */+export const convertEngineToOld = (engine: NewEngine): OldEngine => {+ switch (engine) {+ case NewEngine.ENGINE_UNSPECIFIED:+ return OldEngine.ENGINE_UNSPECIFIED;+ case NewEngine.CLICKHOUSE:+ return OldEngine.CLICKHOUSE;+ case NewEngine.MYSQL:+ return OldEngine.MYSQL;+ case NewEngine.POSTGRES:+ return OldEngine.POSTGRES;+ case NewEngine.SNOWFLAKE:+ return OldEngine.SNOWFLAKE;+ case NewEngine.SQLITE:+ return OldEngine.SQLITE;+ case NewEngine.TIDB:+ return OldEngine.TIDB;+ case NewEngine.MONGODB:+ return OldEngine.MONGODB;+ case NewEngine.REDIS:+ return OldEngine.REDIS;+ case NewEngine.ORACLE:+ return OldEngine.ORACLE;+ case NewEngine.MSSQL:+ return OldEngine.MSSQL;+ case NewEngine.REDSHIFT:+ return OldEngine.REDSHIFT;+ case NewEngine.MARIADB:+ return OldEngine.MARIADB;+ case NewEngine.OCEANBASE:+ return OldEngine.OCEANBASE;+ case NewEngine.DM:+ return OldEngine.DM;+ case NewEngine.RISINGWAVE:+ return OldEngine.RISINGWAVE;+ case NewEngine.OCEANBASE_ORACLE:+ return OldEngine.OCEANBASE_ORACLE;+ case NewEngine.STARROCKS:+ return OldEngine.STARROCKS;+ case NewEngine.DORIS:+ return OldEngine.DORIS;+ case NewEngine.HIVE:+ return OldEngine.HIVE;+ case NewEngine.ELASTICSEARCH:+ return OldEngine.ELASTICSEARCH;+ case NewEngine.BIGQUERY:+ return OldEngine.BIGQUERY;+ case NewEngine.DYNAMODB:+ return OldEngine.DYNAMODB;+ case NewEngine.SPANNER:+ return OldEngine.SPANNER;+ case NewEngine.COCKROACHDB:+ return OldEngine.COCKROACHDB;+ default:+ return OldEngine.ENGINE_UNSPECIFIED;+ }+};++/**+ * Convert old proto Engine to proto-es Engine+ */+export const convertEngineToNew = (engine: OldEngine): NewEngine => {+ switch (engine) {+ case OldEngine.ENGINE_UNSPECIFIED:+ return NewEngine.ENGINE_UNSPECIFIED;+ case OldEngine.CLICKHOUSE:+ return NewEngine.CLICKHOUSE;+ case OldEngine.MYSQL:+ return NewEngine.MYSQL;+ case OldEngine.POSTGRES:+ return NewEngine.POSTGRES;+ case OldEngine.SNOWFLAKE:+ return NewEngine.SNOWFLAKE;+ case OldEngine.SQLITE:+ return NewEngine.SQLITE;+ case OldEngine.TIDB:+ return NewEngine.TIDB;+ case OldEngine.MONGODB:+ return NewEngine.MONGODB;+ case OldEngine.REDIS:+ return NewEngine.REDIS;+ case OldEngine.ORACLE:+ return NewEngine.ORACLE;+ case OldEngine.MSSQL:+ return NewEngine.MSSQL;+ case OldEngine.REDSHIFT:+ return NewEngine.REDSHIFT;+ case OldEngine.MARIADB:+ return NewEngine.MARIADB;+ case OldEngine.OCEANBASE:+ return NewEngine.OCEANBASE;+ case OldEngine.DM:+ return NewEngine.DM;+ case OldEngine.RISINGWAVE:+ return NewEngine.RISINGWAVE;+ case OldEngine.OCEANBASE_ORACLE:+ return NewEngine.OCEANBASE_ORACLE;+ case OldEngine.STARROCKS:+ return NewEngine.STARROCKS;+ case OldEngine.DORIS:+ return NewEngine.DORIS;+ case OldEngine.HIVE:+ return NewEngine.HIVE;+ case OldEngine.ELASTICSEARCH:+ return NewEngine.ELASTICSEARCH;+ case OldEngine.BIGQUERY:+ return NewEngine.BIGQUERY;+ case OldEngine.DYNAMODB:+ return NewEngine.DYNAMODB;+ case OldEngine.SPANNER:+ return NewEngine.SPANNER;+ case OldEngine.COCKROACHDB:+ return NewEngine.COCKROACHDB;+ default:+ return NewEngine.ENGINE_UNSPECIFIED;+ }+};++/**+ * Convert proto-es State to old proto State+ */+export const convertStateToOld = (state: NewState): OldState => {+ switch (state) {+ case NewState.STATE_UNSPECIFIED:+ return OldState.STATE_UNSPECIFIED;+ case NewState.ACTIVE:+ return OldState.ACTIVE;+ case NewState.DELETED:+ return OldState.DELETED;+ default:+ return OldState.STATE_UNSPECIFIED;+ }+};++/**+ * Convert old proto State to proto-es State+ */+export const convertStateToNew = (state: OldState): NewState => {+ switch (state) {+ case OldState.STATE_UNSPECIFIED:+ return NewState.STATE_UNSPECIFIED;+ case OldState.ACTIVE:+ return NewState.ACTIVE;+ case OldState.DELETED:+ return NewState.DELETED;+ default:+ return NewState.STATE_UNSPECIFIED;+ }+};++/**+ * Convert proto-es ExportFormat to old proto ExportFormat+ */+export const convertExportFormatToOld = (format: NewExportFormat): OldExportFormat => {+ switch (format) {+ case NewExportFormat.FORMAT_UNSPECIFIED:+ return OldExportFormat.FORMAT_UNSPECIFIED;+ case NewExportFormat.CSV:+ return OldExportFormat.CSV;+ case NewExportFormat.JSON:+ return OldExportFormat.JSON;+ case NewExportFormat.SQL:+ return OldExportFormat.SQL;+ case NewExportFormat.XLSX:+ return OldExportFormat.XLSX;+ default:+ return OldExportFormat.FORMAT_UNSPECIFIED;+ }+};++/**+ * Convert old proto ExportFormat to proto-es ExportFormat+ */+export const convertExportFormatToNew = (format: OldExportFormat): NewExportFormat => {+ switch (format) {+ case OldExportFormat.FORMAT_UNSPECIFIED:+ return NewExportFormat.FORMAT_UNSPECIFIED;+ case OldExportFormat.CSV:+ return NewExportFormat.CSV;+ case OldExportFormat.JSON:+ return NewExportFormat.JSON;+ case OldExportFormat.SQL:+ return NewExportFormat.SQL;+ case OldExportFormat.XLSX:+ return NewExportFormat.XLSX;+ default:+ return NewExportFormat.FORMAT_UNSPECIFIED;+ }+};++/**+ * Convert proto-es VCSType to old proto VCSType+ */+export const convertVCSTypeToOld = (vcsType: NewVCSType): OldVCSType => {+ switch (vcsType) {+ case NewVCSType.VCS_TYPE_UNSPECIFIED:+ return OldVCSType.VCS_TYPE_UNSPECIFIED;+ case NewVCSType.GITHUB:+ return OldVCSType.GITHUB;+ case NewVCSType.GITLAB:+ return OldVCSType.GITLAB;+ case NewVCSType.BITBUCKET:+ return OldVCSType.BITBUCKET;+ case NewVCSType.AZURE_DEVOPS:+ return OldVCSType.AZURE_DEVOPS;+ default:+ return OldVCSType.VCS_TYPE_UNSPECIFIED;+ }+};++/**+ * Convert old proto VCSType to proto-es VCSType+ */+export const convertVCSTypeToNew = (vcsType: OldVCSType): NewVCSType => {+ switch (vcsType) {+ case OldVCSType.VCS_TYPE_UNSPECIFIED:+ return NewVCSType.VCS_TYPE_UNSPECIFIED;+ case OldVCSType.GITHUB:+ return NewVCSType.GITHUB;+ case OldVCSType.GITLAB:+ return NewVCSType.GITLAB;+ case OldVCSType.BITBUCKET:+ return NewVCSType.BITBUCKET;+ case OldVCSType.AZURE_DEVOPS:+ return NewVCSType.AZURE_DEVOPS;+ default:+ return NewVCSType.VCS_TYPE_UNSPECIFIED;+ }+};++/**+ * Convert old proto Engine to JSON string (backwards compatibility)+ */+export const engineToJSON = (engine: OldEngine): string => {+ return oldEngineToJSON(engine);+};++/**+ * Convert JSON string to old proto Engine (backwards compatibility)+ */+export const engineFromJSON = (json: string): OldEngine => {+ return oldEngineFromJSON(json);+};++/**+ * Convert proto-es Engine to string for display/logging+ */+export const engineToString = (engine: NewEngine): string => {+ return NewEngine[engine] || "ENGINE_UNSPECIFIED";+};++/**+ * Convert proto-es State to string for display/logging+ */+export const stateToString = (state: NewState): string => {+ return NewState[state] || "STATE_UNSPECIFIED";+};++/**+ * Convert proto-es ExportFormat to string for display/logging+ */+export const exportFormatToString = (format: NewExportFormat): string => {+ return NewExportFormat[format] || "FORMAT_UNSPECIFIED";+};++/**+ * Convert proto-es VCSType to string for display/logging+ */+export const vcsTypeToString = (vcsType: NewVCSType): string => {+ return NewVCSType[vcsType] || "VCS_TYPE_UNSPECIFIED";+}++/**+ * Convert scope value (string or number) to proto-es Engine+ * Handles both string names and numeric enum values from scope.value+ */+export const convertScopeValueToEngine = (value: string | number): NewEngine => {+ switch (value) {+ case 0:+ case "ENGINE_UNSPECIFIED":+ return NewEngine.ENGINE_UNSPECIFIED;+ case 1:+ case "CLICKHOUSE":+ return NewEngine.CLICKHOUSE;+ case 2:+ case "MYSQL":+ return NewEngine.MYSQL;+ case 3:+ case "POSTGRES":+ return NewEngine.POSTGRES;+ case 4:+ case "SNOWFLAKE":+ return NewEngine.SNOWFLAKE;+ case 5:+ case "SQLITE":+ return NewEngine.SQLITE;+ case 6:+ case "TIDB":+ return NewEngine.TIDB;+ case 7:+ case "MONGODB":+ return NewEngine.MONGODB;+ case 8:+ case "REDIS":+ return NewEngine.REDIS;+ case 9:+ case "ORACLE":+ return NewEngine.ORACLE;+ case 10:+ case "SPANNER":+ return NewEngine.SPANNER;+ case 11:+ case "MSSQL":+ return NewEngine.MSSQL;+ case 12:+ case "REDSHIFT":+ return NewEngine.REDSHIFT;+ case 13:+ case "MARIADB":+ return NewEngine.MARIADB;+ case 14:+ case "OCEANBASE":+ return NewEngine.OCEANBASE;+ case 15:+ case "DM":+ return NewEngine.DM;+ case 16:+ case "RISINGWAVE":+ return NewEngine.RISINGWAVE;+ case 17:+ case "OCEANBASE_ORACLE":+ return NewEngine.OCEANBASE_ORACLE;+ case 18:+ case "STARROCKS":+ return NewEngine.STARROCKS;+ case 19:+ case "DORIS":+ return NewEngine.DORIS;+ case 20:+ case "HIVE":+ return NewEngine.HIVE;+ case 21:+ case "ELASTICSEARCH":+ return NewEngine.ELASTICSEARCH;+ case 22:+ case "BIGQUERY":+ return NewEngine.BIGQUERY;+ case 23:+ case "DYNAMODB":+ return NewEngine.DYNAMODB;+ case 24:+ case "DATABRICKS":+ return NewEngine.DATABRICKS;+ case 25:+ case "COCKROACHDB":+ return NewEngine.COCKROACHDB;+ case 26:+ case "COSMOSDB":+ return NewEngine.COSMOSDB;+ case 27:+ case "TRINO":+ return NewEngine.TRINO;+ case 28:+ case "CASSANDRA":+ return NewEngine.CASSANDRA;+ case -1:+ case "UNRECOGNIZED":+ default:+ return NewEngine.ENGINE_UNSPECIFIED;+ }+};\ No newline at end of filediff --git a/frontend/src/utils/v1/instance.ts b/frontend/src/utils/v1/instance.tsindex 19588a9c19..43202a6a85 100644--- a/frontend/src/utils/v1/instance.ts+++ b/frontend/src/utils/v1/instance.ts@@ -7,7 +7,9 @@ import {languageOfEngineV1,unknownInstance,} from "@/types";-import { Engine, State } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld, convertEngineToNew } from "@/utils/v1/common-conversions";import type {Instance,InstanceResource,@@ -25,7 +27,7 @@ export function instanceV1Name(instance: Instance | InstanceResource) {if (instance.title === unknownInstance().title) {name = extractInstanceResourceName(instance.name);}- if ((instance as Instance).state === State.DELETED) {+ if ((instance as Instance).state === convertStateToOld(State.DELETED)) {name += ` (${t("common.archived")})`;} else if (isValidInstanceName(instance.name) &&@@ -324,16 +326,16 @@ export const instanceV1MaskingForNoSQL = (instanceOrEngine: Instance | InstanceResource | Engine) => {const engine = engineOfInstanceV1(instanceOrEngine);- return [Engine.MONGODB, Engine.COSMOSDB].includes(engine);+ return [Engine.MONGODB].includes(engine);};export const engineOfInstanceV1 = (instanceOrEngine: Instance | InstanceResource | Engine-) => {- if (typeof instanceOrEngine === "string") {+): Engine => {+ if (typeof instanceOrEngine === "number") {return instanceOrEngine;}- return instanceOrEngine.engine;+ return convertEngineToNew(instanceOrEngine.engine);};export const engineNameV1 = (type: Engine): string => {@@ -440,7 +442,7 @@ export const useInstanceV1EditorLanguage = (instance: MaybeRef<Instance | InstanceResource | undefined>) => {return computed(() => {- return languageOfEngineV1(unref(instance)?.engine);+ return languageOfEngineV1(unref(instance)?.engine ? convertEngineToNew(unref(instance)!.engine) : undefined);});};diff --git a/frontend/src/utils/v1/position.ts b/frontend/src/utils/v1/position.tsindex 9f6275b763..9f85c9abbc 100644--- a/frontend/src/utils/v1/position.ts+++ b/frontend/src/utils/v1/position.ts@@ -1,5 +1,5 @@import type * as monaco from "monaco-editor/esm/vs/editor/editor.api.js";-import type { Position } from "@/types/proto/v1/common";+import type { Position } from "@/types/proto-es/v1/common_pb";export function batchConvertPositionToMonacoPosition(positions: Position[],diff --git a/frontend/src/utils/v1/project.ts b/frontend/src/utils/v1/project.tsindex 6469edf232..5f780b17b0 100644--- a/frontend/src/utils/v1/project.ts+++ b/frontend/src/utils/v1/project.ts@@ -1,5 +1,6 @@import { DEFAULT_PROJECT_NAME } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import type { Project } from "@/types/proto/v1/project_service";export const extractProjectResourceName = (name: string) => {@@ -14,7 +15,7 @@ export function projectV1Name(project: Project) {}const parts = [project.title];- if (project.state === State.DELETED) {+ if (project.state === convertStateToOld(State.DELETED)) {parts.push("(Archived)");}return parts.join(" ");diff --git a/frontend/src/utils/v1/setting-conversions.ts b/frontend/src/utils/v1/setting-conversions.tsindex 06a72cde58..cbff9b1058 100644--- a/frontend/src/utils/v1/setting-conversions.ts+++ b/frontend/src/utils/v1/setting-conversions.ts@@ -1,10 +1,14 @@import { fromJson, toJson } from "@bufbuild/protobuf";-import type { Setting as OldSetting } from "@/types/proto/v1/setting_service";-import { Setting as OldSettingProto, Setting_SettingName as OldSettingName } from "@/types/proto/v1/setting_service";import type { Setting as NewSetting } from "@/types/proto-es/v1/setting_service_pb";-import { SettingSchema, Setting_SettingName as NewSettingName } from "@/types/proto-es/v1/setting_service_pb";-import { Engine as NewEngine } from "@/types/proto-es/v1/common_pb";-import { Engine as OldEngine } from "@/types/proto/v1/common";+import {+ SettingSchema,+ Setting_SettingName as NewSettingName,+} from "@/types/proto-es/v1/setting_service_pb";+import type { Setting as OldSetting } from "@/types/proto/v1/setting_service";+import {+ Setting as OldSettingProto,+ Setting_SettingName as OldSettingName,+} from "@/types/proto/v1/setting_service";// Convert old proto to proto-esexport const convertOldSettingToNew = (oldSetting: OldSetting): NewSetting => {@@ -24,13 +28,15 @@ export const convertNewSettingToOld = (newSetting: NewSetting): OldSetting => {export const convertOldSettingNameToNew = (oldName: OldSettingName): string => {// Map string enum to numeric enumconst mapping: Record<OldSettingName, NewSettingName> = {- [OldSettingName.SETTING_NAME_UNSPECIFIED]: NewSettingName.SETTING_NAME_UNSPECIFIED,+ [OldSettingName.SETTING_NAME_UNSPECIFIED]:+ NewSettingName.SETTING_NAME_UNSPECIFIED,[OldSettingName.AUTH_SECRET]: NewSettingName.AUTH_SECRET,[OldSettingName.BRANDING_LOGO]: NewSettingName.BRANDING_LOGO,[OldSettingName.WORKSPACE_ID]: NewSettingName.WORKSPACE_ID,[OldSettingName.WORKSPACE_PROFILE]: NewSettingName.WORKSPACE_PROFILE,[OldSettingName.WORKSPACE_APPROVAL]: NewSettingName.WORKSPACE_APPROVAL,- [OldSettingName.WORKSPACE_EXTERNAL_APPROVAL]: NewSettingName.WORKSPACE_EXTERNAL_APPROVAL,+ [OldSettingName.WORKSPACE_EXTERNAL_APPROVAL]:+ NewSettingName.WORKSPACE_EXTERNAL_APPROVAL,[OldSettingName.ENTERPRISE_LICENSE]: NewSettingName.ENTERPRISE_LICENSE,[OldSettingName.APP_IM]: NewSettingName.APP_IM,[OldSettingName.WATERMARK]: NewSettingName.WATERMARK,@@ -38,20 +44,26 @@ export const convertOldSettingNameToNew = (oldName: OldSettingName): string => {[OldSettingName.SCHEMA_TEMPLATE]: NewSettingName.SCHEMA_TEMPLATE,[OldSettingName.DATA_CLASSIFICATION]: NewSettingName.DATA_CLASSIFICATION,[OldSettingName.SEMANTIC_TYPES]: NewSettingName.SEMANTIC_TYPES,- [OldSettingName.SQL_RESULT_SIZE_LIMIT]: NewSettingName.SQL_RESULT_SIZE_LIMIT,+ [OldSettingName.SQL_RESULT_SIZE_LIMIT]:+ NewSettingName.SQL_RESULT_SIZE_LIMIT,[OldSettingName.SCIM]: NewSettingName.SCIM,[OldSettingName.PASSWORD_RESTRICTION]: NewSettingName.PASSWORD_RESTRICTION,[OldSettingName.ENVIRONMENT]: NewSettingName.ENVIRONMENT,[OldSettingName.UNRECOGNIZED]: NewSettingName.SETTING_NAME_UNSPECIFIED,};- const newEnumValue = mapping[oldName] ?? NewSettingName.SETTING_NAME_UNSPECIFIED;+ const newEnumValue =+ mapping[oldName] ?? NewSettingName.SETTING_NAME_UNSPECIFIED;return NewSettingName[newEnumValue];};// Convert new string format to old enum-export const convertNewSettingNameToOld = (newNameString: string): OldSettingName => {+export const convertNewSettingNameToOld = (+ newNameString: string+): OldSettingName => {// Find the numeric enum value from the string- const newEnumValue = Object.entries(NewSettingName).find(([key]) => key === newNameString)?.[1] as NewSettingName | undefined;+ const newEnumValue = Object.entries(NewSettingName).find(+ ([key]) => key === newNameString+ )?.[1] as NewSettingName | undefined;if (newEnumValue === undefined) {return OldSettingName.UNRECOGNIZED;}@@ -59,16 +71,20 @@ export const convertNewSettingNameToOld = (newNameString: string): OldSettingNam};// Convert new enum to old enum (internal helper)-const convertNewSettingNameEnumToOld = (newName: NewSettingName): OldSettingName => {+const convertNewSettingNameEnumToOld = (+ newName: NewSettingName+): OldSettingName => {// Map numeric enum to string enumconst mapping: Record<NewSettingName, OldSettingName> = {- [NewSettingName.SETTING_NAME_UNSPECIFIED]: OldSettingName.SETTING_NAME_UNSPECIFIED,+ [NewSettingName.SETTING_NAME_UNSPECIFIED]:+ OldSettingName.SETTING_NAME_UNSPECIFIED,[NewSettingName.AUTH_SECRET]: OldSettingName.AUTH_SECRET,[NewSettingName.BRANDING_LOGO]: OldSettingName.BRANDING_LOGO,[NewSettingName.WORKSPACE_ID]: OldSettingName.WORKSPACE_ID,[NewSettingName.WORKSPACE_PROFILE]: OldSettingName.WORKSPACE_PROFILE,[NewSettingName.WORKSPACE_APPROVAL]: OldSettingName.WORKSPACE_APPROVAL,- [NewSettingName.WORKSPACE_EXTERNAL_APPROVAL]: OldSettingName.WORKSPACE_EXTERNAL_APPROVAL,+ [NewSettingName.WORKSPACE_EXTERNAL_APPROVAL]:+ OldSettingName.WORKSPACE_EXTERNAL_APPROVAL,[NewSettingName.ENTERPRISE_LICENSE]: OldSettingName.ENTERPRISE_LICENSE,[NewSettingName.APP_IM]: OldSettingName.APP_IM,[NewSettingName.WATERMARK]: OldSettingName.WATERMARK,@@ -76,130 +92,11 @@ const convertNewSettingNameEnumToOld = (newName: NewSettingName): OldSettingName[NewSettingName.SCHEMA_TEMPLATE]: OldSettingName.SCHEMA_TEMPLATE,[NewSettingName.DATA_CLASSIFICATION]: OldSettingName.DATA_CLASSIFICATION,[NewSettingName.SEMANTIC_TYPES]: OldSettingName.SEMANTIC_TYPES,- [NewSettingName.SQL_RESULT_SIZE_LIMIT]: OldSettingName.SQL_RESULT_SIZE_LIMIT,+ [NewSettingName.SQL_RESULT_SIZE_LIMIT]:+ OldSettingName.SQL_RESULT_SIZE_LIMIT,[NewSettingName.SCIM]: OldSettingName.SCIM,[NewSettingName.PASSWORD_RESTRICTION]: OldSettingName.PASSWORD_RESTRICTION,[NewSettingName.ENVIRONMENT]: OldSettingName.ENVIRONMENT,};return mapping[newName] ?? OldSettingName.UNRECOGNIZED;};--// Convert proto-es Engine to old Engine for utility functions-export const convertEngineToOld = (engine: NewEngine): OldEngine => {- switch (engine) {- case NewEngine.MYSQL:- return OldEngine.MYSQL;- case NewEngine.POSTGRES:- return OldEngine.POSTGRES;- case NewEngine.TIDB:- return OldEngine.TIDB;- case NewEngine.SNOWFLAKE:- return OldEngine.SNOWFLAKE;- case NewEngine.CLICKHOUSE:- return OldEngine.CLICKHOUSE;- case NewEngine.MONGODB:- return OldEngine.MONGODB;- case NewEngine.REDIS:- return OldEngine.REDIS;- case NewEngine.ORACLE:- return OldEngine.ORACLE;- case NewEngine.SPANNER:- return OldEngine.SPANNER;- case NewEngine.MSSQL:- return OldEngine.MSSQL;- case NewEngine.REDSHIFT:- return OldEngine.REDSHIFT;- case NewEngine.MARIADB:- return OldEngine.MARIADB;- case NewEngine.OCEANBASE:- return OldEngine.OCEANBASE;- case NewEngine.DM:- return OldEngine.DM;- case NewEngine.RISINGWAVE:- return OldEngine.RISINGWAVE;- case NewEngine.OCEANBASE_ORACLE:- return OldEngine.OCEANBASE_ORACLE;- case NewEngine.STARROCKS:- return OldEngine.STARROCKS;- case NewEngine.DORIS:- return OldEngine.DORIS;- case NewEngine.HIVE:- return OldEngine.HIVE;- case NewEngine.ELASTICSEARCH:- return OldEngine.ELASTICSEARCH;- case NewEngine.BIGQUERY:- return OldEngine.BIGQUERY;- case NewEngine.DYNAMODB:- return OldEngine.DYNAMODB;- case NewEngine.COSMOSDB:- return OldEngine.COSMOSDB;- case NewEngine.CASSANDRA:- return OldEngine.CASSANDRA;- case NewEngine.DATABRICKS:- return OldEngine.DATABRICKS;- case NewEngine.TRINO:- return OldEngine.TRINO;- default:- return OldEngine.ENGINE_UNSPECIFIED;- }-};--// Convert old Engine to proto-es Engine (for completeness)-export const convertEngineToNew = (engine: OldEngine): NewEngine => {- switch (engine) {- case OldEngine.MYSQL:- return NewEngine.MYSQL;- case OldEngine.POSTGRES:- return NewEngine.POSTGRES;- case OldEngine.TIDB:- return NewEngine.TIDB;- case OldEngine.SNOWFLAKE:- return NewEngine.SNOWFLAKE;- case OldEngine.CLICKHOUSE:- return NewEngine.CLICKHOUSE;- case OldEngine.MONGODB:- return NewEngine.MONGODB;- case OldEngine.REDIS:- return NewEngine.REDIS;- case OldEngine.ORACLE:- return NewEngine.ORACLE;- case OldEngine.SPANNER:- return NewEngine.SPANNER;- case OldEngine.MSSQL:- return NewEngine.MSSQL;- case OldEngine.REDSHIFT:- return NewEngine.REDSHIFT;- case OldEngine.MARIADB:- return NewEngine.MARIADB;- case OldEngine.OCEANBASE:- return NewEngine.OCEANBASE;- case OldEngine.DM:- return NewEngine.DM;- case OldEngine.RISINGWAVE:- return NewEngine.RISINGWAVE;- case OldEngine.OCEANBASE_ORACLE:- return NewEngine.OCEANBASE_ORACLE;- case OldEngine.STARROCKS:- return NewEngine.STARROCKS;- case OldEngine.DORIS:- return NewEngine.DORIS;- case OldEngine.HIVE:- return NewEngine.HIVE;- case OldEngine.ELASTICSEARCH:- return NewEngine.ELASTICSEARCH;- case OldEngine.BIGQUERY:- return NewEngine.BIGQUERY;- case OldEngine.DYNAMODB:- return NewEngine.DYNAMODB;- case OldEngine.COSMOSDB:- return NewEngine.COSMOSDB;- case OldEngine.CASSANDRA:- return NewEngine.CASSANDRA;- case OldEngine.DATABRICKS:- return NewEngine.DATABRICKS;- case OldEngine.TRINO:- return NewEngine.TRINO;- default:- return NewEngine.ENGINE_UNSPECIFIED;- }-};\ No newline at end of filediff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.tsindex 8d0205837b..1a67ab0b86 100644--- a/frontend/src/utils/v1/sql.ts+++ b/frontend/src/utils/v1/sql.ts@@ -2,7 +2,7 @@ import dayjs from "dayjs";import Long from "long";import { getDateForPbTimestamp } from "@/types";import { NullValue } from "@/types/proto/google/protobuf/struct";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {RowValue,type RowValue_Timestamp,diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vueindex a31d0822fc..573dec3594 100644--- a/frontend/src/views/Archive.vue+++ b/frontend/src/views/Archive.vue@@ -47,7 +47,7 @@ import {PagedProjectTable,PagedInstanceTable,} from "@/components/v2";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { hasWorkspacePermissionV2 } from "@/utils";type LocalTabType = "PROJECT" | "INSTANCE";diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vueindex 06754c7f76..fbfdc8cd63 100644--- a/frontend/src/views/DatabaseDashboard.vue+++ b/frontend/src/views/DatabaseDashboard.vue@@ -72,7 +72,7 @@ import {} from "@/store/modules/v1/common";import type { ComposedDatabase } from "@/types";import { DEFAULT_PROJECT_NAME, isValidDatabaseName } from "@/types";-import { engineFromJSON } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";import type { SearchParams } from "@/utils";import {@@ -169,7 +169,12 @@ const selectedEnvironment = computed(() => {const selectedEngines = computed(() => {return state.params.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => {+ // Convert string scope value to Engine enum+ const engineKey = scope.value.toUpperCase();+ const engineValue = Engine[engineKey as keyof typeof Engine];+ return typeof engineValue === "number" ? engineValue : Engine.ENGINE_UNSPECIFIED;+ });});const filter = computed(() => ({diff --git a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail/DatabaseDetail.vueindex 438f9aea6f..6ef6140b39 100644--- a/frontend/src/views/DatabaseDetail/DatabaseDetail.vue+++ b/frontend/src/views/DatabaseDetail/DatabaseDetail.vue@@ -233,7 +233,7 @@ import {instanceNamePrefix,} from "@/store/modules/v1/common";import { UNKNOWN_PROJECT_NAME, unknownEnvironment } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";import {instanceV1HasAlterSchema,@@ -241,6 +241,7 @@ import {allowUsingSchemaEditor,extractProjectResourceName,} from "@/utils";+import { convertStateToNew } from "@/utils/v1/common-conversions";const databaseHashList = ["overview",@@ -338,7 +339,7 @@ const createMigration = async () => {if (type === "bb.issue.database.schema.update") {if (- database.value.state === State.ACTIVE &&+ convertStateToNew(database.value.state) === State.ACTIVE &&allowUsingSchemaEditor([database.value])) {state.showSchemaEditorModal = true;diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vueindex 5e9b5d8959..82b990e167 100644--- a/frontend/src/views/InstanceDashboard.vue+++ b/frontend/src/views/InstanceDashboard.vue@@ -93,7 +93,7 @@ import {} from "@/store";import { environmentNamePrefix } from "@/store/modules/v1/common";import { isValidInstanceName } from "@/types";-import { engineFromJSON } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { Instance } from "@/types/proto/v1/instance_service";import { type SearchParams, hasWorkspacePermissionV2 } from "@/utils";@@ -155,7 +155,13 @@ const selectedPort = computed(() => {const selectedEngines = computed(() => {return state.params.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => {+ // Convert string scope value to Engine enum+ const engineValue = Object.values(Engine).find(+ (engine) => engine === scope.value+ ) as Engine | undefined;+ return engineValue ?? Engine.MYSQL; // Default fallback+ });});const filter = computed(() => ({diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vueindex fc3da02260..e1bcfb7194 100644--- a/frontend/src/views/InstanceDetail.vue+++ b/frontend/src/views/InstanceDetail.vue@@ -1,10 +1,10 @@<template><div class="space-y-2 px-6" v-bind="$attrs">- <ArchiveBanner v-if="instance.state === State.DELETED" />+ <ArchiveBanner v-if="instance.state === convertStateToOld(State.DELETED)" /><div v-if="!embedded" class="flex items-center justify-between"><div class="flex items-center gap-x-2">- <EngineIcon :engine="instance.engine" custom-class="!h-6" />+ <EngineIcon :engine="convertEngineToNew(instance.engine)" custom-class="!h-6" /><span class="text-lg font-medium">{{ instanceV1Name(instance) }}</span></div></div>@@ -13,7 +13,7 @@<template #suffix><div class="flex items-center space-x-2"><InstanceSyncButton- v-if="instance.state === State.ACTIVE"+ v-if="instance.state === convertStateToOld(State.ACTIVE)"@sync-schema="syncSchema"/><NButton@@ -127,7 +127,9 @@ import {formatEnvironmentName,isValidDatabaseName,} from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";import {instanceV1HasCreateDatabase,@@ -270,7 +272,7 @@ const instanceRoleList = computed(() => {const allowCreateDatabase = computed(() => {return (databaseChangeMode.value === DatabaseChangeMode.PIPELINE &&- instance.value.state === State.ACTIVE &&+ instance.value.state === convertStateToOld(State.ACTIVE) &&instanceV1HasCreateDatabase(instance.value));});diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vueindex 37ea3ff98c..9d8cc877e6 100644--- a/frontend/src/views/ProfileDashboard.vue+++ b/frontend/src/views/ProfileDashboard.vue@@ -256,7 +256,8 @@ import {SYSTEM_BOT_USER_NAME,unknownUser,} from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import {UpdateUserRequest,@@ -359,7 +360,7 @@ const allowEdit = computed(() => {) {return false;}- if (user.value.state !== State.ACTIVE) {+ if (user.value.state !== convertStateToOld(State.ACTIVE)) {return false;}return isSelf.value || hasWorkspacePermissionV2("bb.policies.update");diff --git a/frontend/src/views/SchemaTemplate/ColumnTypes.vue b/frontend/src/views/SchemaTemplate/ColumnTypes.vueindex 34e9194cdf..8680fd1bac 100644--- a/frontend/src/views/SchemaTemplate/ColumnTypes.vue+++ b/frontend/src/views/SchemaTemplate/ColumnTypes.vue@@ -10,7 +10,7 @@<div class="w-full flex flex-col justify-start items-start gap-2"><div class="w-full flex flex-row justify-between items-center"><div class="flex flex-row justify-start items-center">- <EngineIcon :engine="OldEngine.MYSQL" :custom-class="'mr-1'" />+ <EngineIcon :engine="Engine.MYSQL" :custom-class="'mr-1'" />MySQL</div><NRadioGroup@@ -60,7 +60,7 @@<div class="w-full flex flex-col justify-start items-start gap-2"><div class="w-full flex flex-row justify-between items-center"><div class="flex flex-row justify-start items-center">- <EngineIcon :engine="OldEngine.POSTGRES" :custom-class="'mr-1'" />+ <EngineIcon :engine="Engine.POSTGRES" :custom-class="'mr-1'" />PostgreSQL</div><NRadioGroup@@ -122,8 +122,6 @@ import { computed, onMounted, ref } from "vue";import EngineIcon from "@/components/Icon/EngineIcon.vue";import { pushNotification, useSettingV1Store } from "@/store";import { Engine } from "@/types/proto-es/v1/common_pb";-import { Engine as OldEngine } from "@/types/proto/v1/common";-import { convertEngineToOld } from "@/utils/v1/setting-conversions";import type { SchemaTemplateSetting_FieldTemplate, SchemaTemplateSetting_ColumnType } from "@/types/proto-es/v1/setting_service_pb";import {SchemaTemplateSetting_ColumnTypeSchema,@@ -302,7 +300,7 @@ const handleMySQLEnabledChange = (event: InputEvent) => {columnTypeTemplateForMySQL.value.enabled = enabled;if (enabled) {if (columnTypeTemplateForMySQL.value.types.filter(Boolean).length === 0) {- columnTypesForMySQL.value = getDataTypeSuggestionList(convertEngineToOld(Engine.MYSQL)).join(+ columnTypesForMySQL.value = getDataTypeSuggestionList(Engine.MYSQL).join("\n");}@@ -373,7 +371,7 @@ const handlePostgreSQLEnabledChange = (event: InputEvent) => {) {columnTypesForPostgreSQL.value = getDataTypeSuggestionList(- convertEngineToOld(Engine.POSTGRES)+ Engine.POSTGRES).join("\n");}}diff --git a/frontend/src/views/SchemaTemplate/FieldTemplates.vue b/frontend/src/views/SchemaTemplate/FieldTemplates.vueindex 9da6244182..5be43aff05 100644--- a/frontend/src/views/SchemaTemplate/FieldTemplates.vue+++ b/frontend/src/views/SchemaTemplate/FieldTemplates.vue@@ -17,7 +17,7 @@@update:checked="toggleEngineCheck(item)"><div class="flex items-center gap-x-1 text-sm text-gray-600">- <EngineIcon :engine="convertEngineForIcon(item)" custom-class="ml-0 mr-1" />+ <EngineIcon :engine="item" custom-class="ml-0 mr-1" /><spanclass="items-center text-xs px-2 py-0.5 rounded-full bg-gray-200 text-gray-800">@@ -77,7 +77,6 @@ import { engineList } from "@/components/SchemaTemplate/utils";import { Drawer, SearchBox } from "@/components/v2";import { useSettingV1Store } from "@/store";import { Engine } from "@/types/proto-es/v1/common_pb";-import { Engine as LegacyEngine } from "@/types/proto/v1/common";import {ColumnMetadataSchema,} from "@/types/proto-es/v1/database_service_pb";@@ -131,57 +130,6 @@ const state = reactive<LocalState>({selectedEngine: new Set<Engine>(),});-// Conversion function for Engine type conflicts-const convertEngineForIcon = (engine: Engine): LegacyEngine => {- switch (engine) {- case Engine.MYSQL:- return "MYSQL" as LegacyEngine;- case Engine.POSTGRES:- return "POSTGRES" as LegacyEngine;- case Engine.ORACLE:- return "ORACLE" as LegacyEngine;- case Engine.TIDB:- return "TIDB" as LegacyEngine;- case Engine.SNOWFLAKE:- return "SNOWFLAKE" as LegacyEngine;- case Engine.CLICKHOUSE:- return "CLICKHOUSE" as LegacyEngine;- case Engine.MONGODB:- return "MONGODB" as LegacyEngine;- case Engine.REDIS:- return "REDIS" as LegacyEngine;- case Engine.SQLITE:- return "SQLITE" as LegacyEngine;- case Engine.MSSQL:- return "MSSQL" as LegacyEngine;- case Engine.MARIADB:- return "MARIADB" as LegacyEngine;- case Engine.BIGQUERY:- return "BIGQUERY" as LegacyEngine;- case Engine.SPANNER:- return "SPANNER" as LegacyEngine;- case Engine.DATABRICKS:- return "DATABRICKS" as LegacyEngine;- case Engine.RISINGWAVE:- return "RISINGWAVE" as LegacyEngine;- case Engine.OCEANBASE:- return "OCEANBASE" as LegacyEngine;- case Engine.DYNAMODB:- return "DYNAMODB" as LegacyEngine;- case Engine.HIVE:- return "HIVE" as LegacyEngine;- case Engine.ELASTICSEARCH:- return "ELASTICSEARCH" as LegacyEngine;- case Engine.STARROCKS:- return "STARROCKS" as LegacyEngine;- case Engine.DORIS:- return "DORIS" as LegacyEngine;- case Engine.CASSANDRA:- return "CASSANDRA" as LegacyEngine;- default:- return "ENGINE_UNSPECIFIED" as LegacyEngine;- }-};onMounted(() => {if (props.engine) {diff --git a/frontend/src/views/SchemaTemplate/TableTemplates.vue b/frontend/src/views/SchemaTemplate/TableTemplates.vueindex e62894cb5b..4aaa61171f 100644--- a/frontend/src/views/SchemaTemplate/TableTemplates.vue+++ b/frontend/src/views/SchemaTemplate/TableTemplates.vue@@ -17,7 +17,7 @@@update:checked="toggleEngineCheck(item)"><div class="flex items-center gap-x-1 text-sm text-gray-600">- <EngineIcon :engine="convertEngineToOld(item)" custom-class="ml-0 mr-1" />+ <EngineIcon :engine="item" custom-class="ml-0 mr-1" /><spanclass="items-center text-xs px-2 py-0.5 rounded-full bg-gray-200 text-gray-800">@@ -48,7 +48,7 @@</div></div><TableTemplateView- :engine="engine ? convertEngineToOld(engine) : undefined"+ :engine="engine":readonly="!!readonly":template-list="filteredTemplateList"@view="editSchemaTemplate"@@ -77,7 +77,6 @@ import { engineList } from "@/components/SchemaTemplate/utils";import { Drawer, SearchBox } from "@/components/v2";import { useSettingV1Store } from "@/store";import { Engine } from "@/types/proto-es/v1/common_pb";-import { convertEngineToOld } from "@/utils/v1/setting-conversions";import { TableMetadataSchema } from "@/types/proto-es/v1/database_service_pb";import { TableCatalogSchema } from "@/types/proto-es/v1/database_catalog_service_pb";import type { SchemaTemplateSetting_TableTemplate } from "@/types/proto-es/v1/setting_service_pb";diff --git a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vueindex 9df9d2b221..54ade3a997 100644--- a/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue+++ b/frontend/src/views/SettingWorkspaceSQLReviewDetail.vue@@ -170,7 +170,7 @@ import {unknown,UNKNOWN_ID,} from "@/types";-import type { Engine } from "@/types/proto/v1/common";+import type { Engine } from "@/types/proto-es/v1/common_pb";import { hasWorkspacePermissionV2, sqlReviewNameFromSlug } from "@/utils";import { useTitle } from "@vueuse/core";import { NButton } from "naive-ui";diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vueindex 5651bad93d..6bca2dd1e5 100644--- a/frontend/src/views/SettingWorkspaceUsers.vue+++ b/frontend/src/views/SettingWorkspaceUsers.vue@@ -206,7 +206,7 @@ import {useUserStore,} from "@/store";import { groupNamePrefix } from "@/store/modules/v1/common";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import type { Group } from "@/types/proto/v1/group_service";import { WorkspaceProfileSettingSchema } from "@/types/proto-es/v1/setting_service_pb";import { create } from "@bufbuild/protobuf";diff --git a/frontend/src/views/project/ProjectMemberDashboard.vue b/frontend/src/views/project/ProjectMemberDashboard.vueindex 62dc8ef84c..e3257ce144 100644--- a/frontend/src/views/project/ProjectMemberDashboard.vue+++ b/frontend/src/views/project/ProjectMemberDashboard.vue@@ -8,7 +8,8 @@ import ProjectMemberPanel from "@/components/ProjectMember/ProjectMemberPanel.vuimport { useProjectByName } from "@/store";import { projectNamePrefix } from "@/store/modules/v1/common";import { DEFAULT_PROJECT_NAME } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";+import { convertStateToOld } from "@/utils/v1/common-conversions";import { hasProjectPermissionV2 } from "@/utils";const props = defineProps<{@@ -24,7 +25,7 @@ const allowEdit = computed(() => {return false;}- if (project.value.state === State.DELETED) {+ if (project.value.state === convertStateToOld(State.DELETED)) {return false;}diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/ColumnInfo.vue b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/ColumnInfo.vueindex 8e4b94eb9d..5d297f65ab 100644--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/ColumnInfo.vue+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/ColumnInfo.vue@@ -32,8 +32,9 @@ import { CheckIcon, XIcon } from "lucide-vue-next";import { computed } from "vue";import { getColumnDefaultValuePlaceholder } from "@/components/SchemaEditorLite";import { useDBSchemaV1Store, useDatabaseV1Store } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { ColumnMetadata } from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import InfoItem from "./InfoItem.vue";const props = defineProps<{@@ -59,7 +60,7 @@ const columnMetadata = computed();const instanceEngine = computed(- () => databaseStore.getDatabaseByName(props.database).instanceResource.engine+ () => convertEngineToNew(databaseStore.getDatabaseByName(props.database).instanceResource.engine));const characterSet = computed(() => {diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/TableInfo.vue b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/TableInfo.vueindex 34690b388e..7288a281fc 100644--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/TableInfo.vue+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/HoverPanel/TableInfo.vue@@ -28,7 +28,8 @@import { computed } from "vue";import { RichEngineName } from "@/components/v2";import { useDBSchemaV1Store, useDatabaseV1Store } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { bytesToString } from "@/utils";import InfoItem from "./InfoItem.vue";@@ -42,7 +43,7 @@ const dbSchema = useDBSchemaV1Store();const databaseStore = useDatabaseV1Store();const instanceEngine = computed(- () => databaseStore.getDatabaseByName(props.database).instanceResource.engine+ () => convertEngineToNew(databaseStore.getDatabaseByName(props.database).instanceResource.engine));const tableMetadata = computed(() =>diff --git a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/actions.tsx b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/actions.tsxindex 4014b9f428..b91bec2e4f 100644--- a/frontend/src/views/sql-editor/AsidePanel/SchemaPane/actions.tsx+++ b/frontend/src/views/sql-editor/AsidePanel/SchemaPane/actions.tsx@@ -40,7 +40,7 @@ import {type EditorPanelViewState,typeToView,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {GetSchemaStringRequest_ObjectType,} from "@/types/proto/v1/database_service";@@ -60,6 +60,7 @@ import {defaultSQLEditorTab,isSimilarSQLEditorTab,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { keyWithPosition } from "../../EditorCommon";import {useCurrentTabViewStateContext,@@ -150,15 +151,16 @@ export const useActions = () => {const { database } = target;const db = databaseStore.getDatabaseByName(database);const { engine } = db.instanceResource;+ const protoEsEngine = convertEngineToNew(engine);const query = await formatCode(generateSimpleSelectAllStatement(- engine,+ protoEsEngine,schema,tableOrViewName,SELECT_ALL_LIMIT),- engine+ protoEsEngine);updateViewState({view: "CODE",@@ -328,7 +330,7 @@ export const useDropdown = () => {});if (type === 'view') {const { view } = target as NodeTarget<"view">;- if (supportGetStringSchema(db.instanceResource.engine)) {+ if (supportGetStringSchema(convertEngineToNew(db.instanceResource.engine))) {items.push({key: "view-schema-text",label: t("sql-editor.view-schema-text"),@@ -358,7 +360,7 @@ export const useDropdown = () => {},});- if (supportGetStringSchema(db.instanceResource.engine)) {+ if (supportGetStringSchema(convertEngineToNew(db.instanceResource.engine))) {items.push({key: "view-schema-text",label: t("sql-editor.view-schema-text"),@@ -573,7 +575,7 @@ export const useDropdown = () => {const engineForTarget = (target: NodeTarget) => {const { database } = target as NodeTarget<"database">- return useDatabaseV1Store().getDatabaseByName(database).instanceResource.engine;+ return convertEngineToNew(useDatabaseV1Store().getDatabaseByName(database).instanceResource.engine);};const targetSupportsGenerateSQL = (target: NodeTarget) => {@@ -652,7 +654,7 @@ const runQuery = async (statement,connection,explain: false,- engine: database.instanceResource.engine,+ engine: convertEngineToNew(database.instanceResource.engine),selection: tab.editorState.selection,});};diff --git a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/ConnectionPane.vue b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/ConnectionPane.vueindex 0397559d87..a700073c47 100644--- a/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/ConnectionPane.vue+++ b/frontend/src/views/sql-editor/ConnectionPanel/ConnectionPane/ConnectionPane.vue@@ -207,7 +207,7 @@ import {isValidProjectName,} from "@/types";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { engineFromJSON } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { DataSourceType } from "@/types/proto/v1/instance_service";import {findAncestor,@@ -552,7 +552,11 @@ const selectedInstance = computed(() => {const selectedEngines = computed(() => {return state.params.scopes.filter((scope) => scope.id === "engine")- .map((scope) => engineFromJSON(scope.value));+ .map((scope) => {+ // Convert from string engine name to proto-es enum value+ const engineName = scope.value.toUpperCase();+ return Engine[engineName as keyof typeof Engine] ?? Engine.ENGINE_UNSPECIFIED;+ });});const filter = computed(diff --git a/frontend/src/views/sql-editor/EditorCommon/ContainerChooser.vue b/frontend/src/views/sql-editor/EditorCommon/ContainerChooser.vueindex 88c2eab12f..a3deb381ed 100644--- a/frontend/src/views/sql-editor/EditorCommon/ContainerChooser.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ContainerChooser.vue@@ -19,7 +19,8 @@ import {useDBSchemaV1Store,useSQLEditorTabStore,} from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import ConnectChooser from "./ConnectChooser.vue";const OptionValueUnspecified = "-1";@@ -29,7 +30,7 @@ const route = useRoute();const { currentTab: tab } = storeToRefs(useSQLEditorTabStore());const { database, instance } = useConnectionOfCurrentSQLEditorTab();const show = computed(() => {- return instance.value.engine === Engine.COSMOSDB;+ return convertEngineToNew(instance.value.engine) === Engine.COSMOSDB;});const databaseMetadata = computed(() => {diff --git a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vueindex c8d57b8c39..8a44c0857e 100644--- a/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue+++ b/frontend/src/views/sql-editor/EditorCommon/EditorAction.vue@@ -165,8 +165,9 @@ import {DEFAULT_SQL_EDITOR_TAB_MODE,type SQLEditorQueryParams,} from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { isWorksheetWritableV1, keyboardShortcutStr } from "@/utils";import { useSQLEditorContext } from "../context";import AdminModeButton from "./AdminModeButton.vue";@@ -215,7 +216,7 @@ const showSheetsFeature = computed(() => {const queryTip = computed(() => {if (- instance.value.engine === Engine.COSMOSDB &&+ convertEngineToNew(instance.value.engine) === Engine.COSMOSDB &&!currentTab.value?.connection.table) {return t("database.table.select-tip");@@ -227,7 +228,7 @@ const allowQuery = computed(() => {if (isDisconnected.value) return false;if (isEmptyStatement.value) return false;- if (instance.value.engine === Engine.COSMOSDB) {+ if (convertEngineToNew(instance.value.engine) === Engine.COSMOSDB) {return !!currentTab.value?.connection.table;}return true;@@ -305,7 +306,7 @@ const handleRunQuery = () => {emit("execute", {statement,connection: { ...tab.connection },- engine: instance.value.engine,+ engine: convertEngineToNew(instance.value.engine),explain: false,selection: tab.editorState.selection,});diff --git a/frontend/src/views/sql-editor/EditorCommon/OpenAIButton/OpenAIButton.vue b/frontend/src/views/sql-editor/EditorCommon/OpenAIButton/OpenAIButton.vueindex 206fd691d0..fefcaf750e 100644--- a/frontend/src/views/sql-editor/EditorCommon/OpenAIButton/OpenAIButton.vue+++ b/frontend/src/views/sql-editor/EditorCommon/OpenAIButton/OpenAIButton.vue@@ -67,6 +67,7 @@ import {} from "@/store";import { DatabaseChangeMode, Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";import { hasWorkspacePermissionV2, nextAnimationFrame } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSQLEditorContext } from "../../context";import Button from "./Button.vue";@@ -137,13 +138,13 @@ const handleSelect = async (action: ChatAction) => {await nextAnimationFrame();if (action === "explain-code") {events.emit("send-chat", {- content: promptUtils.explainCode(statement, instance.value.engine),+ content: promptUtils.explainCode(statement, convertEngineToNew(instance.value.engine)),newChat,});}if (action === "find-problems") {events.emit("send-chat", {- content: promptUtils.findProblems(statement, instance.value.engine),+ content: promptUtils.findProblems(statement, convertEngineToNew(instance.value.engine)),newChat,});}diff --git a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vueindex e5664e3fcc..c1f954cc30 100644--- a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue@@ -120,7 +120,7 @@ import {useSQLEditorStore,} from "@/store";import { isValidDatabaseName } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import {DataSource,DataSourceType,@@ -131,6 +131,7 @@ import {PolicyType,} from "@/types/proto/v1/org_policy_service";import { QueryOption_RedisRunCommandsOn } from "@/types/proto/v1/sql_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { getValidDataSourceByPolicy, readableDataSourceType } from "@/utils";import { getAdminDataSourceRestrictionOfDatabase } from "@/utils";import ResultLimitSelect from "./ResultLimitSelect.vue";@@ -155,7 +156,7 @@ const showRedisConfig = computed(() => {return false;}const instance = database.value.instanceResource;- return instance.engine === Engine.REDIS;+ return convertEngineToNew(instance.engine) === Engine.REDIS;});const adminDataSourceRestriction = computed(() => {diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vueindex d0d5208501..f3e6a48949 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue@@ -55,8 +55,9 @@ import { NButton } from "naive-ui";import { twMerge } from "tailwind-merge";import { computed, ref, watchEffect } from "vue";import { useConnectionOfCurrentSQLEditorTab } from "@/store";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type { QueryRow, RowValue } from "@/types/proto/v1/sql_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { extractSQLRowValuePlain, getHighlightHTMLByRegExp } from "@/utils";import { useSQLResultViewContext } from "../context";import {@@ -140,7 +141,7 @@ useResizeObserver(wrapperRef, (entries) => {const clickable = computed(() => {if (truncated.value) return true;- if (database.value.instanceResource.engine === Engine.MONGODB) {+ if (convertEngineToNew(database.value.instanceResource.engine) === Engine.MONGODB) {// A cheap way to check JSON string without paying the parsing cost.const maybeJSON = String(props.value).trim();return (diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vueindex 4535d43e68..d30a4b9fda 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue@@ -234,8 +234,8 @@ import {isValidDatabaseName,isValidInstanceName,} from "@/types";-import { Engine, ExportFormat as ExportFormatOld } from "@/types/proto/v1/common";-import { ExportFormat } from "@/types/proto-es/v1/common_pb";+import { Engine, ExportFormat } from "@/types/proto-es/v1/common_pb";+import { convertExportFormatToOld, convertEngineToNew } from "@/utils/v1/common-conversions";import { PolicyType } from "@/types/proto/v1/org_policy_service";import { DatabaseChangeMode } from "@/types/proto-es/v1/setting_service_pb";import type {@@ -261,12 +261,7 @@ import ErrorView from "./ErrorView";import SelectionCopyTooltips from "./SelectionCopyTooltips.vue";import { useSQLResultViewContext } from "./context";-// Temporary conversion function until SQL store is migrated-const convertExportFormat = (format: ExportFormat): ExportFormatOld => {- // Convert proto-es enum to string, then back to old enum- const formatString = ExportFormat[format];- return ExportFormatOld[formatString as keyof typeof ExportFormatOld] ?? ExportFormatOld.FORMAT_UNSPECIFIED;-};+// Using conversion function from common-conversions.tstype LocalState = {search: string;@@ -487,7 +482,7 @@ const handleExportBtnClick = async ({const content = await useSQLStore().exportData({name: props.database.name,dataSourceId: props.params.connection.dataSourceId ?? "",- format: convertExportFormat(options.format),+ format: convertExportFormatToOld(options.format),statement,limit,admin,@@ -534,7 +529,7 @@ const handleRequestExport = async () => {const showVisualizeButton = computed((): boolean => {return (- connectedInstance.value.engine === Engine.POSTGRES && props.params.explain+ convertEngineToNew(connectedInstance.value.engine) === Engine.POSTGRES && props.params.explain);});diff --git a/frontend/src/views/sql-editor/EditorCommon/SchemaChooser.vue b/frontend/src/views/sql-editor/EditorCommon/SchemaChooser.vueindex e665bac9f0..ce7bbff11b 100644--- a/frontend/src/views/sql-editor/EditorCommon/SchemaChooser.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SchemaChooser.vue@@ -20,6 +20,7 @@ import {useSQLEditorTabStore,} from "@/store";import { instanceAllowsSchemaScopedQuery } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import ConnectChooser from "./ConnectChooser.vue";const SchemaOptionValueUnspecified = "-1";@@ -29,7 +30,7 @@ const route = useRoute();const { currentTab: tab } = storeToRefs(useSQLEditorTabStore());const { database, instance } = useConnectionOfCurrentSQLEditorTab();const show = computed(() => {- return instanceAllowsSchemaScopedQuery(instance.value.engine);+ return instanceAllowsSchemaScopedQuery(convertEngineToNew(instance.value.engine));});const databaseMetadata = computed(() => {diff --git a/frontend/src/views/sql-editor/EditorCommon/SheetConnectionIcon.vue b/frontend/src/views/sql-editor/EditorCommon/SheetConnectionIcon.vueindex bef1957b66..c447f42a32 100644--- a/frontend/src/views/sql-editor/EditorCommon/SheetConnectionIcon.vue+++ b/frontend/src/views/sql-editor/EditorCommon/SheetConnectionIcon.vue@@ -1,6 +1,6 @@<template><div class="inline-flex items-center justify-center">- <EngineIcon v-if="instance" :engine="instance.engine" />+ <EngineIcon v-if="instance" :engine="convertEngineToNew(instance.engine)" /><UnlinkIcon v-else class="w-3.5 h-3.5 text-control opacity-50" /></div></template>@@ -11,6 +11,7 @@ import { computed } from "vue";import { EngineIcon } from "@/components/Icon";import { type SQLEditorTab, isValidInstanceName } from "@/types";import { connectionForSQLEditorTab } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";const props = defineProps<{tab?: SQLEditorTab;diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/ExternalTablesPanel/ExternalTableColumnsTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/ExternalTablesPanel/ExternalTableColumnsTable.vueindex d6a18045d6..1f1c62518c 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/ExternalTablesPanel/ExternalTableColumnsTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/ExternalTablesPanel/ExternalTableColumnsTable.vue@@ -30,6 +30,7 @@ import type {SchemaMetadata,ExternalTableMetadata,} from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { getHighlightHTMLByRegExp, useAutoHeightDataTable } from "@/utils";import { EllipsisCell } from "../../common";import { useCurrentTabViewStateContext } from "../../context/viewState";@@ -59,7 +60,7 @@ const filteredColumns = computed(() => {});const columns = computed(() => {- const engine = props.db.instanceResource.engine;+ const engine = convertEngineToNew(props.db.instanceResource.engine);const downGrade = filteredColumns.value.length > 50;const columns: (DataTableColumn<ColumnMetadata> & { hide?: boolean })[] = [{diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vueindex 62f0d65a13..65b3ca24c3 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/Panels.vue@@ -69,6 +69,7 @@ import {nextAnimationFrame,type VueClass,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import DatabaseChooser from "@/views/sql-editor/EditorCommon/DatabaseChooser.vue";import { useCurrentTabViewStateContext } from "../context/viewState.tsx";import DiagramPanel from "./DiagramPanel";@@ -135,7 +136,7 @@ useEmitteryEventListener(AIEvents, "run-statement", async ({ statement }) => {execute({connection,statement,- engine: database.instanceResource.engine,+ engine: convertEngineToNew(database.instanceResource.engine),explain: false,selection: tab.value.editorState.selection,});diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ColumnsTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ColumnsTable.vueindex 00ea5c6f6c..836ad5dc97 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ColumnsTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ColumnsTable.vue@@ -27,13 +27,14 @@ import {ForeignKeyCell,} from "@/components/SchemaEditorLite/Panels/TableColumnEditor/components";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type {ColumnMetadata,DatabaseMetadata,SchemaMetadata,TableMetadata,} from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { getHighlightHTMLByRegExp, useAutoHeightDataTable } from "@/utils";import { EllipsisCell } from "../../common";import { useCurrentTabViewStateContext } from "../../context/viewState";@@ -67,7 +68,7 @@ const primaryKey = computed(() => {});const columns = computed(() => {- const engine = props.db.instanceResource.engine;+ const engine = convertEngineToNew(props.db.instanceResource.engine);const downGrade = filteredColumns.value.length > 50;const columns: (DataTableColumn<ColumnMetadata> & { hide?: boolean })[] = [{diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ForeignKeysTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ForeignKeysTable.vueindex 971a8216bf..dc04a1d27f 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ForeignKeysTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/ForeignKeysTable.vue@@ -23,13 +23,14 @@ import { NDataTable } from "naive-ui";import { computed, h, ref, watch } from "vue";import { useI18n } from "vue-i18n";import type { ComposedDatabase } from "@/types";-import { Engine } from "@/types/proto/v1/common";+import { Engine } from "@/types/proto-es/v1/common_pb";import type {DatabaseMetadata,ForeignKeyMetadata,SchemaMetadata,TableMetadata,} from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { getHighlightHTMLByRegExp, useAutoHeightDataTable } from "@/utils";import { useCurrentTabViewStateContext } from "../../context/viewState";@@ -133,7 +134,7 @@ const columns = computed(() => {title: "Match type",resizable: true,minWidth: 140,- hide: props.db.instanceResource.engine !== Engine.POSTGRES,+ hide: convertEngineToNew(props.db.instanceResource.engine) !== Engine.POSTGRES,},];return columns.filter((header) => !header.hide);diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TablesTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TablesTable.vueindex d064804101..db73178e8a 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TablesTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/TablesPanel/TablesTable.vue@@ -28,6 +28,7 @@ import type {SchemaMetadata,TableMetadata,} from "@/types/proto/v1/database_service";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import {bytesToString,getHighlightHTMLByRegExp,@@ -62,7 +63,7 @@ const emit = defineEmits<{const { viewState } = useCurrentTabViewStateContext();const { t } = useI18n();const instanceEngine = computed(() => {- return props.db.instanceResource.engine;+ return convertEngineToNew(props.db.instanceResource.engine);});const filteredTables = computed(() => {diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/ColumnsTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/ColumnsTable.vueindex acaa8b3b7f..620e56b4ad 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/ColumnsTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/ColumnsTable.vue@@ -31,6 +31,7 @@ import type {ViewMetadata,} from "@/types/proto/v1/database_service";import { getHighlightHTMLByRegExp, useAutoHeightDataTable } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { EllipsisCell } from "../../common";import { useCurrentTabViewStateContext } from "../../context/viewState";@@ -97,7 +98,7 @@ const columns = computed(() => {return h(DefaultValueCell, {column,disabled: true,- engine: engine,+ engine: convertEngineToNew(engine),});},},diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vueindex 6c0bc533cc..a7adf67579 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DefinitionViewer.vue@@ -48,6 +48,7 @@ import * as promptUtils from "@/plugins/ai/logic/prompt";import type { ComposedDatabase } from "@/types";import { dialectOfEngineV1 } from "@/types";import { nextAnimationFrame } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useSQLEditorContext } from "@/views/sql-editor/context";const props = defineProps<{@@ -72,7 +73,7 @@ const formatted = computedAsync(try {const result = await formatSQL(sql,- dialectOfEngineV1(instanceEngine.value)+ dialectOfEngineV1(convertEngineToNew(instanceEngine.value)));return result;} catch (err) {@@ -118,7 +119,7 @@ const handleEditorReady = (AIContext.events.emit("send-chat", {content: promptUtils.explainCode(statement,- props.db.instanceResource.engine+ convertEngineToNew(props.db.instanceResource.engine)),newChat,});diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DependencyColumnsTable.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DependencyColumnsTable.vueindex 2d1e14f7f0..dc5541f1df 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DependencyColumnsTable.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/ViewsPanel/DependencyColumnsTable.vue@@ -36,6 +36,7 @@ import {keyForDependencyColumn,useAutoHeightDataTable,} from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useCurrentTabViewStateContext } from "../../context/viewState";const props = defineProps<{@@ -78,7 +79,7 @@ const columns = computed(() => {resizable: true,minWidth: 140,className: "truncate",- hide: !hasSchemaProperty(engine),+ hide: !hasSchemaProperty(convertEngineToNew(engine)),render: (dep) => {return h("span", {innerHTML: getHighlightHTMLByRegExp(dep.schema, props.keyword ?? ""),diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vueindex f4cabf99f7..7f26920bca 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/common/CodeViewer.vue@@ -81,6 +81,7 @@ import { useAIContext } from "@/plugins/ai/logic";import * as promptUtils from "@/plugins/ai/logic/prompt";import type { ComposedDatabase } from "@/types";import { dialectOfEngineV1 } from "@/types";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { nextAnimationFrame, type VueClass } from "@/utils";import { OpenAIButton } from "@/views/sql-editor/EditorCommon";import { useSQLEditorContext } from "@/views/sql-editor/context";@@ -102,7 +103,7 @@ const format = useLocalStorage<boolean>("bb.sql-editor.editor-panel.code-viewer.format",false);-const instanceEngine = computed(() => props.db.instanceResource.engine);+const instanceEngine = computed(() => convertEngineToNew(props.db.instanceResource.engine));const selectedStatement = ref("");const formatted = computedAsync(@@ -157,7 +158,7 @@ const handleEditorReady = (AIContext.events.emit("send-chat", {content: promptUtils.explainCode(statement,- props.db.instanceResource.engine+ convertEngineToNew(props.db.instanceResource.engine)),newChat,});diff --git a/frontend/src/views/sql-editor/EditorPanel/Panels/common/SchemaSelectToolbar.vue b/frontend/src/views/sql-editor/EditorPanel/Panels/common/SchemaSelectToolbar.vueindex b7d741bd91..749629be77 100644--- a/frontend/src/views/sql-editor/EditorPanel/Panels/common/SchemaSelectToolbar.vue+++ b/frontend/src/views/sql-editor/EditorPanel/Panels/common/SchemaSelectToolbar.vue@@ -38,6 +38,7 @@ import {useDBSchemaV1Store,} from "@/store";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useCurrentTabViewStateContext } from "../../context/viewState";defineOptions({@@ -62,6 +63,6 @@ const schemaSelectOptions = computed(() => {});const showSchemaSelect = computed(() => {- return hasSchemaProperty(instance.value.engine);+ return hasSchemaProperty(convertEngineToNew(instance.value.engine));});</script>diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vueindex 1cd3a13ab0..d56cc33285 100644--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue@@ -124,16 +124,11 @@ import {useSQLStore,} from "@/store";import type { ComposedDatabase, SQLEditorDatabaseQueryContext } from "@/types";-import { ExportFormat as ExportFormatOld } from "@/types/proto/v1/common";import { ExportFormat } from "@/types/proto-es/v1/common_pb";import { hexToRgb } from "@/utils";+import { convertExportFormatToOld } from "@/utils/v1/common-conversions";+-// Temporary conversion function until SQL store is migrated-const convertExportFormat = (format: ExportFormat): ExportFormatOld => {- // Convert proto-es enum to string, then back to old enum- const formatString = ExportFormat[format];- return ExportFormatOld[formatString as keyof typeof ExportFormatOld] ?? ExportFormatOld.FORMAT_UNSPECIFIED;-};const MAX_EXPORT = 20;@@ -282,7 +277,7 @@ const handleExportBtnClick = async ({const content = await sqlStore.exportData({name: databaseName,dataSourceId: context.params.connection.dataSourceId ?? "",- format: convertExportFormat(options.format),+ format: convertExportFormatToOld(options.format),statement: context.params.statement,limit: options.limit,admin: tabStore.currentTab?.mode === "ADMIN",diff --git a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vueindex 8b4337dd87..6e163b466f 100644--- a/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue+++ b/frontend/src/views/sql-editor/EditorPanel/StandardPanel/SQLEditor.vue@@ -61,6 +61,7 @@ import {} from "@/store";import type { SQLDialect, SQLEditorQueryParams, SQLEditorTab } from "@/types";import { dialectOfEngineV1 } from "@/types";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { Advice_Status, type Advice } from "@/types/proto/v1/sql_service";import {nextAnimationFrame,@@ -106,7 +107,7 @@ const { instance, database } = useConnectionOfCurrentSQLEditorTab();const language = useInstanceV1EditorLanguage(instance);const dialect = computed((): SQLDialect => {const engine = instance.value.engine;- return dialectOfEngineV1(engine);+ return dialectOfEngineV1(convertEngineToNew(engine));});const readonly = computed(() => sheetAndTabStore.isReadOnly);@@ -183,7 +184,7 @@ const runQueryAction = ({const params: SQLEditorQueryParams = {connection: { ...tab.connection },statement,- engine: instance.value.engine,+ engine: convertEngineToNew(instance.value.engine),explain,selection: null,};@@ -241,13 +242,13 @@ const handleEditorReady = (await nextAnimationFrame();if (action === "explain-code") {AIContext.events.emit("send-chat", {- content: promptUtils.explainCode(statement, instance.value.engine),+ content: promptUtils.explainCode(statement, convertEngineToNew(instance.value.engine)),newChat,});}if (action === "find-problems") {AIContext.events.emit("send-chat", {- content: promptUtils.findProblems(statement, instance.value.engine),+ content: promptUtils.findProblems(statement, convertEngineToNew(instance.value.engine)),newChat,});}diff --git a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vueindex 5d2f6b50f3..0b64e241cf 100644--- a/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue+++ b/frontend/src/views/sql-editor/EditorPanel/TerminalPanel/CompactSQLEditor.vue@@ -48,6 +48,7 @@ import {} from "@/store";import type { SQLDialect, SQLEditorQueryParams } from "@/types";import { dialectOfEngineV1 } from "@/types";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useInstanceV1EditorLanguage, instanceV1AllowsExplain } from "@/utils";import { useSQLEditorContext } from "../../context";import {@@ -87,7 +88,7 @@ const { currentTab, isSwitchingTab } = storeToRefs(tabStore);const pendingFormatContentCommand = ref(false);const dialect = computed((): SQLDialect => {const engine = instance.value.engine;- return dialectOfEngineV1(engine);+ return dialectOfEngineV1(convertEngineToNew(engine));});const firstLinePrompt = computed(() => {@@ -124,7 +125,7 @@ const execute = (explain = false) => {emit("execute", {connection: { ...connection.value },statement: props.content,- engine: instance.value.engine,+ engine: convertEngineToNew(instance.value.engine),explain,selection: null,});diff --git a/frontend/src/views/sql-editor/EditorPanel/common/common.ts b/frontend/src/views/sql-editor/EditorPanel/common/common.tsindex 7b85ee8534..2b35b1e2a1 100644--- a/frontend/src/views/sql-editor/EditorPanel/common/common.ts+++ b/frontend/src/views/sql-editor/EditorPanel/common/common.ts@@ -6,6 +6,7 @@ import {useDBSchemaV1Store,} from "@/store";import { hasSchemaProperty } from "@/utils";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import { useCurrentTabViewStateContext } from "../context/viewState";export const useSelectSchema = () => {@@ -21,7 +22,7 @@ export const useSelectSchema = () => {}));});const showSchemaSelect = computed(() => {- return hasSchemaProperty(instance.value.engine);+ return hasSchemaProperty(convertEngineToNew(instance.value.engine));});watch(diff --git a/frontend/src/views/sql-editor/Setting/Instance/Instance.vue b/frontend/src/views/sql-editor/Setting/Instance/Instance.vueindex e168581fb4..fc5a18d4db 100644--- a/frontend/src/views/sql-editor/Setting/Instance/Instance.vue+++ b/frontend/src/views/sql-editor/Setting/Instance/Instance.vue@@ -17,7 +17,7 @@<template #header><div class="h-[50px] flex"><div class="flex items-center gap-x-2 h-[50px]">- <EngineIcon :engine="state.instance.engine" custom-class="!h-6" />+ <EngineIcon :engine="convertEngineToNew(state.instance.engine)" custom-class="!h-6" /><span class="font-medium">{{instanceV1Name(state.instance)}}</span>@@ -38,6 +38,7 @@import { reactive } from "vue";import { EngineIcon } from "@/components/Icon";import { Drawer, DrawerContent } from "@/components/v2";+import { convertEngineToNew } from "@/utils/v1/common-conversions";import type { Instance } from "@/types/proto/v1/instance_service";import { extractInstanceResourceName, instanceV1Name } from "@/utils";import InstanceDashboard from "@/views/InstanceDashboard.vue";diff --git a/frontend/src/views/sql-editor/Setting/Project/Detail.vue b/frontend/src/views/sql-editor/Setting/Project/Detail.vueindex da0937e7ce..80b87a33ba 100644--- a/frontend/src/views/sql-editor/Setting/Project/Detail.vue+++ b/frontend/src/views/sql-editor/Setting/Project/Detail.vue@@ -75,8 +75,9 @@ import { TransferDatabaseForm } from "@/components/TransferDatabaseForm";import { Drawer, DrawerContent } from "@/components/v2";import { PagedDatabaseTable } from "@/components/v2/Model/DatabaseV1Table";import { DEFAULT_PROJECT_NAME, type ComposedProject } from "@/types";-import { State } from "@/types/proto/v1/common";+import { State } from "@/types/proto-es/v1/common_pb";import { hasProjectPermissionV2 } from "@/utils";+import { convertStateToOld } from "@/utils/v1/common-conversions";type LocalState = {transfer: {@@ -106,7 +107,7 @@ const showSettingButton = computed(() => {});const allowEditSetting = computed(() => {if (props.project.name === DEFAULT_PROJECT_NAME) return false;- if (props.project.state === State.DELETED) {+ if (props.project.state === convertStateToOld(State.DELETED)) {return false;}return hasProjectPermissionV2(props.project, "bb.projects.update");@@ -121,7 +122,7 @@ const showMembersButton = computed(() => {});const allowEditMembers = computed(() => {if (props.project.name === DEFAULT_PROJECT_NAME) return false;- if (props.project.state === State.DELETED) {+ if (props.project.state === convertStateToOld(State.DELETED)) {return false;}