Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update query preserved field (#10843)

boojack06ad88acab98
diff --git a/frontend/naive-ui.config.ts b/frontend/naive-ui.config.ts
index 502838ed3b..41e5495cdb 100644
--- a/frontend/naive-ui.config.ts
+++ b/frontend/naive-ui.config.ts
@@ -7,7 +7,7 @@ import {
} from "naive-ui";
import { computed } from "vue";
import { callCssVariable } from "@/utils";
-import { curLocale } from "./src/plugins/i18n";
+import i18n from "./src/plugins/i18n";
export const themeOverrides = computed((): GlobalThemeOverrides => {
return {
@@ -67,7 +67,7 @@ export const darkThemeOverrides = computed((): GlobalThemeOverrides => {
});
const isZhCn = (): boolean => {
- return curLocale.value === "zh-CN";
+ return i18n.global.locale.value === "zh-CN";
};
export const dateLang = computed((): NDateLocale | null => {
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index 5ba2758df0..3ff61ef504 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -102,7 +102,7 @@ onErrorCaptured((error: any /* , _, info */) => {
// this event would be posted when an unknown state is returned by OAuth provider.
// Add it here so the notification is displayed on the main window. The OAuth callback window is short lived
// and would close before the notification has a chance to be displayed.
-window.addEventListener("bb.oauth.unknown", (event) => {
+window.addEventListener("bb.oauth.unknown", () => {
notificationStore.pushNotification({
module: "bytebase",
style: "CRITICAL",
@@ -113,7 +113,7 @@ window.addEventListener("bb.oauth.unknown", (event) => {
// Preserve specific query fields when navigating between pages.
watch(route, (current, prev) => {
// fields is the list of query fields that we want to preserve.
- const fields = ["mode", "project", "filter", "customTheme"];
+ const fields = ["mode", "customTheme", "lang", "project", "filter"];
const preservedQuery = cloneDeep(current.query);
for (const key of fields) {
if (preservedQuery[key] === undefined) {
diff --git a/frontend/src/plugins/i18n.ts b/frontend/src/plugins/i18n.ts
index 13552a9e67..27ddb12daf 100644
--- a/frontend/src/plugins/i18n.ts
+++ b/frontend/src/plugins/i18n.ts
@@ -1,5 +1,5 @@
import { useLocalStorage } from "@vueuse/core";
-import _ from "lodash-es";
+import { merge } from "lodash-es";
import { createI18n } from "vue-i18n";
const localPathPrefix = "../locales/";
@@ -53,14 +53,14 @@ const mergedLocalMessage = Object.entries(
const name = key.slice(localPathPrefix.length, -5);
const sections = name.split("/");
if (sections.length === 1) {
- map[name] = _.merge((value as any).default, map[name] || {});
+ map[name] = merge((value as any).default, map[name] || {});
} else {
const file = sections.slice(-1)[0];
const sectionsName = sections[0];
const existed = map[file] || {};
map[file] = {
...existed,
- [sectionsName]: _.merge(
+ [sectionsName]: merge(
(value as any).default,
existed[sectionsName] || {}
),
@@ -84,6 +84,4 @@ export const t = i18n.global.t;
export const te = i18n.global.te;
-export const curLocale = i18n.global.locale;
-
export default i18n;