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(frontend): preview table schema text in schema editor (#13441)
Liu Ji975c62da5e87
diff --git a/frontend/package.json b/frontend/package.jsonindex 188e400da0..cf467c3fa5 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -24,6 +24,7 @@"@joe-re/sql-parser": "^1.7.0","@markdoc/markdoc": "0.4.0","@soerenmartius/vue3-clipboard": "0.1.2",+ "@tanstack/vue-query": "^5.51.21","@tanstack/vue-table": "8.19.3","@vueuse/core": "10.11.0","axios": "1.7.4",diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yamlindex dca8631b13..1a57a57746 100644--- a/frontend/pnpm-lock.yaml+++ b/frontend/pnpm-lock.yaml@@ -20,6 +20,9 @@ importers:'@soerenmartius/vue3-clipboard':specifier: 0.1.2version: 0.1.2+ '@tanstack/vue-query':+ specifier: ^5.51.21+ version: 5.51.21([email protected]([email protected]))'@tanstack/vue-table':specifier: 8.19.3version: 8.19.3([email protected]([email protected]))@@ -1098,10 +1101,26 @@ packages:peerDependencies:tailwindcss: '>=3.0.0 || insiders'+ '@tanstack/[email protected]':+ resolution: {integrity: sha512-Wo1iKt2b9OT7d+YGhvEPD3DXvPv2etTusIMhMUoG7fbhmxcXCtIjJDEygy91Y2JFlwGyjqiBPRozme7UD8hoqg==}+ engines: {node: '>=12'}++ '@tanstack/[email protected]':+ resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==}+'@tanstack/[email protected]':resolution: {integrity: sha512-IqREj9ADoml9zCAouIG/5kCGoyIxPFdqdyoxis9FisXFi5vT+iYfEfLosq4xkU/iDbMcEuAj+X8dWRLvKYDNoQ==}engines: {node: '>=12'}+ '@tanstack/[email protected]':+ resolution: {integrity: sha512-gXAMq90TTepqmBCuVqRxEO/vsuhEkvllCTrlsvZRuPROyV7IroJHmDfuz87KRSACCFTuiy65Mbtk/pg++NIkVg==}+ peerDependencies:+ '@vue/composition-api': ^1.1.2+ vue: ^2.6.0 || ^3.3.0+ peerDependenciesMeta:+ '@vue/composition-api':+ optional: true+'@tanstack/[email protected]':resolution: {integrity: sha512-vSgrV1HikfenUDyCWbsA8Mw6+Zr3OhTFi6D6Ictj4hrPLc/UeixjaEU6ccNw59zomyNIT+qBSP+/5iCE10oC6A==}engines: {node: '>=12'}@@ -3851,6 +3870,17 @@ packages:resolution: {integrity: sha512-cN3f1aTxxKo4lzNeQAkVopswuImUrb5Iurll9Gaw5cqpnbTAxtEMM1mgi6ou4X79OCyqYv1U1mzBHJkzmiK82w==}+ resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==}+ engines: {node: '>=12'}+ hasBin: true+ peerDependencies:+ '@vue/composition-api': ^1.0.0-rc.1+ vue: ^3.0.0-0 || ^2.6.0+ peerDependenciesMeta:+ '@vue/composition-api':+ optional: true+resolution: {integrity: sha512-Uuqnk9YE9SsWeReYqK2alDI5YzciATE0r2SkA6iMAtuXvNTMNACJLJEXNXaEy94ECuBe4Sk6RzRU80kjdbIo1Q==}engines: {node: '>=12'}@@ -4764,8 +4794,22 @@ snapshots:postcss-selector-parser: 6.0.10+ '@tanstack/[email protected]':+ dependencies:+ remove-accents: 0.5.0++ '@tanstack/[email protected]': {}+'@tanstack/[email protected]': {}+ dependencies:+ '@tanstack/match-sorter-utils': 8.19.4+ '@tanstack/query-core': 5.51.21+ '@vue/devtools-api': 6.6.3+ vue: 3.4.31([email protected])+ vue-demi: 0.14.10([email protected]([email protected]))+dependencies:'@tanstack/table-core': 8.19.3@@ -7729,6 +7773,10 @@ snapshots:+ dependencies:+ vue: 3.4.31([email protected])+dependencies:vue: 3.4.31([email protected])diff --git a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vueindex 5ab3f987d2..d0a1b9064b 100644--- a/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue+++ b/frontend/src/components/AlterSchemaPrepForm/SchemaEditorModal.vue@@ -39,6 +39,7 @@:loading="state.isPreparingMetadata":diff-when-ready="false":show-last-updater="false"+ :show-table-preview="true"/></NTabPane><NTabPanediff --git a/frontend/src/components/Branch/BranchCreateView.vue b/frontend/src/components/Branch/BranchCreateView.vueindex 500c05fa6c..3f52710e29 100644--- a/frontend/src/components/Branch/BranchCreateView.vue+++ b/frontend/src/components/Branch/BranchCreateView.vue@@ -76,6 +76,7 @@:branch="branchData?.branch ?? EMPTY_BRANCH":readonly="true":diff-when-ready="!!branchData?.parent"+ :show-table-preview="true"/><!-- turn on diff-when-ready is useful when the branch is created from a parent branch --></div>diff --git a/frontend/src/components/Branch/BranchDetailView.vue b/frontend/src/components/Branch/BranchDetailView.vueindex aab4ea0f1a..259089f4ec 100644--- a/frontend/src/components/Branch/BranchDetailView.vue+++ b/frontend/src/components/Branch/BranchDetailView.vue@@ -90,6 +90,7 @@:readonly="!state.isEditing":branch="dirtyBranch":disable-diff-coloring="!state.isEditing && !state.showDiff"+ :show-table-preview="true"@update-is-editing="updateIsEditing"/></div>diff --git a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue b/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vueindex 282d506bb0..48fe24de84 100644--- a/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue+++ b/frontend/src/components/Branch/BranchRebaseView/RebaseBranchStep.vue@@ -29,6 +29,7 @@:readonly="true":branch="validationState.branch":show-last-updater="true"+ :show-table-preview="true"/></div><divdiff --git a/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue b/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vueindex 1c511821fc..61e15e10d1 100644--- a/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue+++ b/frontend/src/components/Branch/BranchRebaseView/SelectBranchStep.vue@@ -96,6 +96,7 @@:loading="isLoadingHeadBranch":branch="headBranch ?? Branch.fromPartial({})":show-last-updater="true"+ :show-table-preview="true"/><MaskSpinner v-if="isLoadingHeadBranch" /></div>diff --git a/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue b/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vueindex 2c7b0b5ce8..ed93203873 100644--- a/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue+++ b/frontend/src/components/Branch/BranchRolloutView/BranchRolloutView.vue@@ -77,6 +77,7 @@:branch="virtualBranch":loading="isLoadingVirtualBranch":show-last-updater="true"+ :show-table-preview="true"/><!-- used as a placeholder -->diff --git a/frontend/src/components/Branch/SchemaDesignEditorLite.vue b/frontend/src/components/Branch/SchemaDesignEditorLite.vueindex 069fdfacd4..fbb7588ad8 100644--- a/frontend/src/components/Branch/SchemaDesignEditorLite.vue+++ b/frontend/src/components/Branch/SchemaDesignEditorLite.vue@@ -47,6 +47,7 @@:diff-when-ready="true":show-last-updater="true":disable-diff-coloring="disableDiffColoring"+ :show-table-preview="showTablePreview"@update-is-editing="$emit('update-is-editing', $event)"/></div>@@ -95,6 +96,7 @@ const props = defineProps<{readonly?: boolean;hideSQLCheckButton?: boolean;disableDiffColoring?: boolean;+ showTablePreview?: boolean;}>();const { t } = useI18n();diff --git a/frontend/src/components/Branch/common/BranchComparison.vue b/frontend/src/components/Branch/common/BranchComparison.vueindex bb4c6d973f..9ba6d821f6 100644--- a/frontend/src/components/Branch/common/BranchComparison.vue+++ b/frontend/src/components/Branch/common/BranchComparison.vue@@ -50,6 +50,7 @@:branch="virtualBranch ?? Branch.fromPartial({})":loading="combinedLoading":show-last-updater="true"+ :show-table-preview="true"/></div><MaskSpinner v-if="combinedLoading" />diff --git a/frontend/src/components/Branch/common/BranchDetailViewer.vue b/frontend/src/components/Branch/common/BranchDetailViewer.vueindex d0e5966e1c..f4aec6978a 100644--- a/frontend/src/components/Branch/common/BranchDetailViewer.vue+++ b/frontend/src/components/Branch/common/BranchDetailViewer.vue@@ -26,6 +26,7 @@:branch="branch ?? Branch.fromPartial({})":loading="loading":show-last-updater="true"+ :show-table-preview="true"/></div><divdiff --git a/frontend/src/components/SchemaEditorLite/Editor.vue b/frontend/src/components/SchemaEditorLite/Editor.vueindex 5da5d85c9f..167d1548f2 100644--- a/frontend/src/components/SchemaEditorLite/Editor.vue+++ b/frontend/src/components/SchemaEditorLite/Editor.vue@@ -1,14 +1,12 @@<template>- <main class="px-2 py-2 w-full h-full flex flex-col overflow-y-hidden">+ <main class="w-full h-full flex flex-col overflow-y-hidden"><template v-if="currentTab"><TabsContainer+ class="px-2 pt-2"@update:table-search-pattern="handleTableSearchPattern"@update:column-search-pattern="handleColumnSearchPattern"/>- <div- class="w-full flex-1 relative overflow-hidden"- :data-key="currentTab.id"- >+ <div class="w-full flex-1 relative overflow-y-hidden" :data-key="currentTab.id"><DatabaseEditorv-if="currentTab.type === 'database'":key="currentTab.id"@@ -16,6 +14,7 @@:db="currentTab.database":database="currentTab.metadata.database":search-pattern="state.tableSearchPattern"+ class="px-2 pb-2"/><TableEditorv-if="currentTab.type === 'table'"@@ -33,6 +32,7 @@:database="currentTab.metadata.database":schema="currentTab.metadata.schema":procedure="currentTab.metadata.procedure"+ class="px-2 pb-2"/><FunctionEditorv-if="currentTab.type === 'function'"@@ -41,6 +41,7 @@:database="currentTab.metadata.database":schema="currentTab.metadata.schema":func="currentTab.metadata.function"+ class="px-2 pb-2"/><ViewEditorv-if="currentTab.type === 'view'"@@ -49,6 +50,7 @@:database="currentTab.metadata.database":schema="currentTab.metadata.schema":view="currentTab.metadata.view"+ class="px-2 pb-2"/></div></template>diff --git a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vueindex 17c14495ca..21fe1b74c9 100644--- a/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/DatabaseEditor.vue@@ -1,5 +1,5 @@<template>- <div class="flex flex-col w-full h-full overflow-y-hidden">+ <div class="flex flex-col w-full h-full overflow-y-hidden" v-bind="$attrs"><div class="py-2 w-full flex flex-row justify-between items-center"><div><div@@ -172,6 +172,10 @@ import { useSchemaEditorContext } from "../context";import TableList from "./TableList";import TableSelectionSummary from "./TableSelectionSummary.vue";+defineOptions({+ inheritAttrs: false,+});+const props = withDefaults(defineProps<{db: ComposedDatabase;diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vueindex a9f637d5ac..79d9a3c3c2 100644--- a/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue+++ b/frontend/src/components/SchemaEditorLite/Panels/TableEditor.vue@@ -3,7 +3,7 @@class="flex flex-col pt-2 gap-y-2 w-full h-full overflow-y-hidden"v-bind="$attrs">- <div class="w-full flex flex-row justify-between items-center">+ <div class="w-full flex flex-row justify-between items-center px-2"><div class="w-full flex justify-start items-center gap-x-2"><slot v-if="state.mode === 'COLUMNS'" name="toolbar-prefix" />@@ -100,7 +100,7 @@</div></div>- <div class="flex-1 overflow-y-hidden">+ <div class="flex-1 overflow-y-hidden px-2"><TableColumnEditor:show="state.mode === 'COLUMNS'":readonly="readonly"@@ -146,6 +146,14 @@@update="markTableStatus('updated')"/></div>++ <TableSchemaPreview+ v-if="showTablePreview"+ :db="db"+ :database="database"+ :schema="schema"+ :table="table"+ /></div><EditColumnForeignKeyModal@@ -226,6 +234,7 @@ import ColumnSelectionSummary from "./ColumnSelectionSummary.vue";import IndexesEditor from "./IndexesEditor";import PartitionsEditor from "./PartitionsEditor";import TableColumnEditor from "./TableColumnEditor";+import TableSchemaPreview from "./TableSchemaPreview.vue";type EditMode = "COLUMNS" | "INDEXES" | "PARTITIONS";@@ -254,6 +263,7 @@ const {project,readonly,events,+ showTablePreview,options,addTab,markEditStatus,diff --git a/frontend/src/components/SchemaEditorLite/Panels/TableSchemaPreview.vue b/frontend/src/components/SchemaEditorLite/Panels/TableSchemaPreview.vuenew file mode 100644index 0000000000..cf3bc18bd0--- /dev/null+++ b/frontend/src/components/SchemaEditorLite/Panels/TableSchemaPreview.vue@@ -0,0 +1,145 @@+<template>+ <div+ v-show="layoutReady"+ class="overflow-hidden flex flex-col items-stretch shrink-0 transition-all"+ :style="{+ height: expanded ? `${panelHeight}px` : '1rem',+ }"+ :data-parent-height="parentHeight"+ >+ <div+ class="cursor-pointer flex items-center justify-start px-2 gap-1 overflow-y-visible bg-control-bg hover:bg-control-bg-hover"+ :style="{+ height: '1rem',+ }"+ @click="expanded = !expanded"+ >+ <ChevronDownIcon+ class="w-4 h-4 transition-transform"+ :class="expanded ? '' : 'rotate-180'"+ />+ <span v-if="true || expanded" class="text-xs origin-left">+ {{ $t("schema-editor.preview-schema-text") }}+ </span>+ </div>+ <div class="relative flex-1 overflow-hidden">+ <MonacoEditor+ v-if="status === 'pending' || status === 'success'"+ :readonly="true"+ :content="data?.trim() ?? ''"+ :options="{+ fontSize: '12px',+ lineHeight: '18px',+ }"+ class="w-full h-full"+ />+ <pre v-if="expanded && status === 'error'" class="text-sm text-error">{{+ error?.message ?? "Unknown error"+ }}</pre>+ <MaskSpinner v-if="status === 'pending'" />+ </div>+ </div>+</template>++<script setup lang="ts">+import { useQuery } from "@tanstack/vue-query";+import {+ useElementSize,+ useLocalStorage,+ useParentElement,+} from "@vueuse/core";+import { cloneDeep } from "lodash-es";+import { ChevronDownIcon } from "lucide-vue-next";+import { computed } from "vue";+import { MonacoEditor } from "@/components/MonacoEditor";+import MaskSpinner from "@/components/misc/MaskSpinner.vue";+import { sqlServiceClient } from "@/grpcweb";+import type { ComposedDatabase } from "@/types";+import {+ DatabaseMetadata,+ SchemaConfig,+ SchemaMetadata,+ type TableMetadata,+} from "@/types/proto/v1/database_service";+import { minmax } from "@/utils";+import { extractGrpcErrorMessage } from "@/utils/grpcweb";+import { useSchemaEditorContext } from "../context";++const props = defineProps<{+ db: ComposedDatabase;+ database: DatabaseMetadata;+ schema: SchemaMetadata;+ table: TableMetadata;+}>();++const expanded = useLocalStorage(+ "bb.schema-editor.table-schema-preview.expanded",+ true+);+const { getColumnStatus } = useSchemaEditorContext();+const parentElement = useParentElement();+const { height: parentHeight } = useElementSize(parentElement);+const layoutReady = computed(() => parentHeight.value > 0);+const panelHeight = computed(() => {+ const min = 8 * 16; // 8rem ~= 6 lines+ const max = 16 * 16; // 16rem ~= 13 lines+ const flexible = parentHeight.value * 0.4;+ return minmax(flexible, min, max);+});++const engine = computed(() => props.db.instanceResource.engine);+const mockedSchemaMetadata = computed(() => {+ if (!expanded.value) return undefined;+ const { db, database, schema, table } = props;++ const mockedTable = cloneDeep(table);+ mockedTable.columns = mockedTable.columns.filter((column) => {+ const status = getColumnStatus(db, { database, schema, table, column });+ return status !== "dropped";+ });+ const mockedDatabase = DatabaseMetadata.fromJSON({+ name: database.name,+ characterSet: database.characterSet,+ collation: database.collation,+ schemas: [+ {+ name: schema.name,+ tables: [mockedTable],+ },+ ],+ });+ const schemaConfig = database.schemaConfigs.find(+ (sc) => sc.name === schema.name+ );+ const tableConfig = schemaConfig?.tableConfigs.find(+ (tc) => tc.name === table.name+ );+ if (schemaConfig && tableConfig) {+ mockedDatabase.schemaConfigs = [+ SchemaConfig.fromJSON({+ name: schemaConfig.name,+ tableConfigs: [cloneDeep(tableConfig)],+ }),+ ];+ }+ return mockedDatabase;+});++const { status, data, error } = useQuery({+ queryKey: [engine, mockedSchemaMetadata],+ queryFn: async () => {+ if (!expanded.value) return "";+ const metadata = mockedSchemaMetadata.value;+ if (!metadata) return "";+ try {+ const response = await sqlServiceClient.stringifyMetadata({+ engine: engine.value,+ metadata,+ });+ return response.schema;+ } catch (err) {+ return Promise.reject(new Error(extractGrpcErrorMessage(err)));+ }+ },+});+</script>diff --git a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vueindex 252122c5a4..194289aba6 100644--- a/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue+++ b/frontend/src/components/SchemaEditorLite/SchemaEditorLite.vue@@ -48,6 +48,7 @@ const props = defineProps<{diffWhenReady?: boolean;showLastUpdater?: boolean;disableDiffColoring?: boolean;+ showTablePreview?: boolean;}>();const emit = defineEmits<{(event: "update:selected-rollout-objects", objects: RolloutObject[]): void;@@ -105,6 +106,7 @@ const context = provideSchemaEditorContext({selectedRolloutObjects: toRef(props, "selectedRolloutObjects"),showLastUpdater: toRef(props, "showLastUpdater"),disableDiffColoring: toRef(props, "disableDiffColoring"),+ showTablePreview: toRef(props, "showTablePreview"),});const { rebuildMetadataEdit, applyMetadataEdit, applySelectedMetadataEdit } =useAlgorithm(context);diff --git a/frontend/src/components/SchemaEditorLite/context/index.ts b/frontend/src/components/SchemaEditorLite/context/index.tsindex 54849b8e6b..8b74cb6368 100644--- a/frontend/src/components/SchemaEditorLite/context/index.ts+++ b/frontend/src/components/SchemaEditorLite/context/index.ts@@ -37,6 +37,7 @@ export const provideSchemaEditorContext = (params: {selectedRolloutObjects: Ref<RolloutObject[] | undefined>;showLastUpdater: Ref<boolean>;disableDiffColoring: Ref<boolean>;+ showTablePreview: Ref<boolean>;options?: Ref<SchemaEditorOptions>;}) => {const events = new Emittery() as SchemaEditorEvents;diff --git a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue b/frontend/src/components/SchemaTemplate/TableTemplateForm.vueindex 52facfa1a4..6a0290afef 100644--- a/frontend/src/components/SchemaTemplate/TableTemplateForm.vue+++ b/frontend/src/components/SchemaTemplate/TableTemplateForm.vue@@ -261,6 +261,7 @@ const context = provideSchemaEditorContext({selectedRolloutObjects: ref(undefined),showLastUpdater: ref(false),disableDiffColoring: ref(true),+ showTablePreview: ref(true),});const state = reactive<LocalState>({diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 8c729dc5b4..b3d72f2139 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -2575,7 +2575,8 @@},"views": "Views","procedures": "Procedures",- "functions": "Functions"+ "functions": "Functions",+ "preview-schema-text": "Preview schema text"},"label": {"empty-label-value": "Empty",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 9e11946585..89de6bbd31 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -2575,7 +2575,8 @@},"views": "Puntos de vista","procedures": "Trámites",- "functions": "Funciones"+ "functions": "Funciones",+ "preview-schema-text": "Vista previa del texto del esquema"},"label": {"empty-label-value": "Valor",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex c9ead63892..8bb8dfdbee 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -2575,7 +2575,8 @@},"views": "ビュー","procedures": "手順",- "functions": "関数"+ "functions": "関数",+ "preview-schema-text": "スキーマテキストのプレビュー"},"label": {"empty-label-value": "ヌル",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex de98401de0..622de4e358 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -2575,7 +2575,8 @@},"views": "视图","procedures": "存储过程",- "functions": "函数"+ "functions": "函数",+ "preview-schema-text": "预览文本 schema"},"label": {"empty-label-value": "空",diff --git a/frontend/src/main.ts b/frontend/src/main.tsindex 2c97ac5e06..56d79d4642 100644--- a/frontend/src/main.ts+++ b/frontend/src/main.ts@@ -1,3 +1,4 @@+import { VueQueryPlugin } from "@tanstack/vue-query";import axios from "axios";import isEmpty from "lodash-es/isEmpty";import Long from "long";@@ -133,6 +134,7 @@ app.config.globalProperties.sizeToFit = sizeToFit;app.config.globalProperties.urlfy = urlfy;app.config.globalProperties.isEmpty = isEmpty;+app.use(VueQueryPlugin);app.use(pinia);const overrideLang = () => {