Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: optimize setting update button (#15285)
ecmadaoee9e2c97cc03
diff --git a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vueindex 57cdb4c4b8..269ef9272e 100644--- a/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue+++ b/frontend/src/components/GeneralSetting/AIAugmentationSetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.ai-assistant.self") }}+ {{ title }}</h1><FeatureBadge feature="bb.feature.ai-assistant" /></div>@@ -111,20 +111,6 @@{{ $t("settings.general.workspace.only-admin-can-edit") }}</span></NTooltip>-- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !allowSave"- @click.prevent="updateOpenAIKeyEndpoint"- >- <FeatureBadge- feature="bb.feature.ai-assistant"- custom-class="mr-1 text-white pointer-events-none"- />- {{ $t("common.update") }}- </NButton>- </div></div></div>@@ -137,12 +123,11 @@</template><script lang="ts" setup>-import { NButton, NInput, NTooltip } from "naive-ui";+import { NInput, NTooltip } from "naive-ui";import scrollIntoView from "scroll-into-view-if-needed";import { computed, onMounted, reactive, ref, watchEffect } from "vue";-import { useI18n } from "vue-i18n";import LearnMoreLink from "@/components/LearnMoreLink.vue";-import { hasFeature, pushNotification } from "@/store";+import { hasFeature } from "@/store";import { useSettingV1Store } from "@/store/modules/v1/setting";import { FeatureBadge, FeatureModal } from "../FeatureGuard";@@ -153,11 +138,11 @@ interface LocalState {showFeatureModal: boolean;}-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();-const { t } = useI18n();const settingV1Store = useSettingV1Store();const containerRef = ref<HTMLDivElement>();@@ -234,11 +219,6 @@ const updateOpenAIKeyEndpoint = async () => {},});}- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.config-updated"),- });};onMounted(() => {@@ -253,5 +233,7 @@ onMounted(() => {defineExpose({isDirty: allowSave,+ title: props.title,+ update: updateOpenAIKeyEndpoint,});</script>diff --git a/frontend/src/components/GeneralSetting/AccountSetting.vue b/frontend/src/components/GeneralSetting/AccountSetting.vueindex 0cad7443f0..a4809242d3 100644--- a/frontend/src/components/GeneralSetting/AccountSetting.vue+++ b/frontend/src/components/GeneralSetting/AccountSetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.account") }}+ {{ title }}</h1></div><span v-if="!allowEdit" class="text-sm text-gray-400">@@ -104,16 +104,6 @@ref="signInFrequencySettingRef":allow-edit="allowEdit"/>-- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !isDirty"- @click.prevent="onUpdate"- >- {{ $t("common.update") }}- </NButton>- </div></div></div>@@ -127,14 +117,12 @@<script lang="ts" setup>import { isEqual } from "lodash-es";import { TriangleAlertIcon } from "lucide-vue-next";-import { NDivider, NButton, NTooltip } from "naive-ui";+import { NDivider, NTooltip } from "naive-ui";import { storeToRefs } from "pinia";import { computed, reactive, ref, watchEffect } from "vue";-import { useI18n } from "vue-i18n";import { Switch } from "@/components/v2";import {featureToRef,- pushNotification,useActuatorV1Store,useIdentityProviderStore,} from "@/store";@@ -153,11 +141,11 @@ interface LocalState {disallowPasswordSignin: boolean;}-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();-const { t } = useI18n();const settingV1Store = useSettingV1Store();const actuatorStore = useActuatorV1Store();const idpStore = useIdentityProviderStore();@@ -244,15 +232,11 @@ const onUpdate = async () => {updateMask: updateMasks,});}-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.config-updated"),- });};defineExpose({isDirty,+ title: props.title,+ update: onUpdate,});</script>diff --git a/frontend/src/components/GeneralSetting/AnnouncementSetting.vue b/frontend/src/components/GeneralSetting/AnnouncementSetting.vueindex d3df90e0d5..210238ae0b 100644--- a/frontend/src/components/GeneralSetting/AnnouncementSetting.vue+++ b/frontend/src/components/GeneralSetting/AnnouncementSetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.announcement.self") }}+ {{ title }}</h1><FeatureBadge feature="bb.feature.announcement" /></div>@@ -93,16 +93,6 @@}}</span></NTooltip>-- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !allowSave"- @click.prevent="updateAnnouncementSetting"- >- {{ $t("common.update") }}- </NButton>- </div></div></div></div>@@ -110,11 +100,10 @@<script lang="ts" setup>import { cloneDeep, isEqual } from "lodash-es";-import { NButton, NInput, NTooltip } from "naive-ui";+import { NInput, NTooltip } from "naive-ui";import { computed, reactive } from "vue";-import { useI18n } from "vue-i18n";import { AnnouncementLevelSelect } from "@/components/v2";-import { pushNotification, featureToRef } from "@/store";+import { featureToRef } from "@/store";import { useSettingV1Store } from "@/store/modules/v1/setting";import { Announcement } from "@/types/proto/v1/setting_service";import { Announcement_AlertLevel } from "@/types/proto/v1/setting_service";@@ -124,11 +113,11 @@ interface LocalState {announcement: Announcement;}-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();-const { t } = useI18n();const settingV1Store = useSettingV1Store();const hasAnnouncementFeature = featureToRef("bb.feature.announcement");@@ -150,31 +139,18 @@ const allowSave = computed((): boolean => {});const updateAnnouncementSetting = async () => {- if (state.announcement.text === "" && state.announcement.link !== "") {- state.announcement.link = "";- }-- // remove announcement setting from store if both text and link are empty regardless of level.- let announcement: Announcement | undefined = cloneDeep(state.announcement);- if (announcement.text === "" && announcement.link === "") {- announcement = undefined;- }-await settingV1Store.updateWorkspaceProfile({payload: {- announcement: announcement,+ announcement: state.announcement,},updateMask: ["value.workspace_profile_setting_value.announcement"],});state.announcement = cloneDeep(rawAnnouncement.value);- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.announcement.update-success"),- });};defineExpose({isDirty: allowSave,+ title: props.title,+ update: updateAnnouncementSetting,});</script>diff --git a/frontend/src/components/GeneralSetting/BrandingSetting.vue b/frontend/src/components/GeneralSetting/BrandingSetting.vueindex c2e7664f57..02c0e3b3b2 100644--- a/frontend/src/components/GeneralSetting/BrandingSetting.vue+++ b/frontend/src/components/GeneralSetting/BrandingSetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.branding") }}+ {{ title }}</h1><FeatureBadge feature="bb.feature.branding" /></div>@@ -33,7 +33,7 @@:class="[state.logoUrl ? 'opacity-0 hover:opacity-90' : '']":max-file-size-in-mi-b="maxFileSizeInMiB":support-file-extensions="supportImageExtensions"- :disabled="!allowEdit"+ :disabled="!allowEdit || !hasBrandingFeature"@on-select="onLogoSelect"/></div>@@ -44,29 +44,11 @@</NTooltip></div><div class="flex justify-end gap-x-3">- <NPopconfirm- v-if="allowEdit && allowDelete"- @positive-click="deleteLogo"- >- <template #trigger>- <NButton :disabled="!allowEdit">- {{ $t("common.delete") }}- </NButton>- </template>- <template #default>- {{ t("settings.general.workspace.confirm-delete-custom-logo") }}- </template>- </NPopconfirm><NButton- type="primary"- :disabled="!allowEdit || !allowSave"- @click.prevent="uploadLogo"+ v-if="allowEdit && !!state.logoUrl"+ @click="() => (state.logoUrl = '')">- <FeatureBadge- feature="bb.feature.branding"- custom-class="mr-1 text-white pointer-events-none"- />- {{ $t("common.update") }}+ {{ $t("common.delete") }}</NButton></div></div>@@ -80,24 +62,22 @@</template><script lang="ts" setup>-import { NButton, NPopconfirm, NTooltip } from "naive-ui";-import { computed, reactive, watchEffect } from "vue";-import { useI18n } from "vue-i18n";-import { featureToRef, pushNotification } from "@/store";+import { NButton, NTooltip } from "naive-ui";+import { computed, reactive } from "vue";+import { featureToRef } from "@/store";import { useActuatorV1Store } from "@/store/modules/v1/actuator";import { useSettingV1Store } from "@/store/modules/v1/setting";import { FeatureBadge, FeatureModal } from "../FeatureGuard";import SingleFileSelector from "../SingleFileSelector.vue";interface LocalState {- displayName?: string;logoUrl?: string;- logoFile: File | null;loading: boolean;showFeatureModal: boolean;}-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();@@ -114,88 +94,49 @@ const convertFileToBase64 = (file: File) =>});const settingV1Store = useSettingV1Store();-const { t } = useI18n();const state = reactive<LocalState>({- displayName: "",- logoUrl: "",- logoFile: null,+ logoUrl: settingV1Store.brandingLogo,loading: false,showFeatureModal: false,});-watchEffect(() => {- state.logoUrl = settingV1Store.brandingLogo;-});--const valid = computed((): boolean => {- return !!state.displayName || !!state.logoFile;-});--const allowDelete = computed(() => {- return settingV1Store.brandingLogo !== "";-});-const allowSave = computed((): boolean => {- return state.logoFile !== null && valid.value && !state.loading;+ return state.logoUrl !== settingV1Store.brandingLogo;});const hasBrandingFeature = featureToRef("bb.feature.branding");-const doUpdate = async (content: string, message: string) => {+const doUpdate = async (content: string) => {+ if (state.loading) {+ return;+ }state.loading = true;try {- const setting = await settingV1Store.upsertSetting({+ await settingV1Store.upsertSetting({name: "bb.branding.logo",value: {stringValue: content,},});-useActuatorV1Store().setLogo(content);-- state.logoFile = null;- state.logoUrl = setting.value?.stringValue;-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: message,- });} finally {state.loading = false;}};-const deleteLogo = async () => {- state.loading = true;-- await doUpdate("", t("common.deleted"));-};const uploadLogo = async () => {- if (!hasBrandingFeature.value) {- state.showFeatureModal = true;- return;- }- if (!state.logoFile) {- return;- }-- state.loading = true;- const fileInBase64 = await convertFileToBase64(state.logoFile);-- await doUpdate(- fileInBase64,- t("settings.general.workspace.logo-upload-succeed")- );+ await doUpdate(state.logoUrl ?? "");};-const onLogoSelect = (file: File) => {- state.logoFile = file;- state.logoUrl = URL.createObjectURL(file);+const onLogoSelect = async (file: File) => {+ const fileInBase64 = await convertFileToBase64(file);+ state.logoUrl = fileInBase64;};defineExpose({+ title: props.title,isDirty: allowSave,+ update: uploadLogo,});</script>diff --git a/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue b/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vueindex 32a36d06fc..4f95b21f7e 100644--- a/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue+++ b/frontend/src/components/GeneralSetting/DatabaseChangeModeSetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.database-change-mode.self") }}+ {{ title }}</h1></div></div>@@ -61,17 +61,6 @@</NSpace></NRadioGroup></div>- <div class="mt-4">- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !allowSave"- @click.prevent="save"- >- {{ $t("common.update") }}- </NButton>- </div>- </div></div><BBModal@@ -106,13 +95,11 @@import { isEqual } from "lodash-es";import { NRadioGroup, NSpace, NRadio, NButton } from "naive-ui";import { computed, reactive, ref } from "vue";-import { useI18n } from "vue-i18n";import { BBModal } from "@/bbkit";import LearnMoreLink from "@/components/LearnMoreLink.vue";import { router } from "@/router";import { WORKSPACE_ROOT_MODULE } from "@/router/dashboard/workspaceRoutes";import { SQL_EDITOR_HOME_MODULE } from "@/router/sqlEditor";-import { pushNotification } from "@/store";import { useSettingV1Store } from "@/store/modules/v1/setting";import { DatabaseChangeMode } from "@/types/proto/v1/setting_service";import { isSQLEditorRoute } from "@/utils";@@ -138,11 +125,12 @@ const getInitialState = (): LocalState => {}return defaultState;};-defineProps<{++const props = defineProps<{+ title: string;allowEdit: boolean;}>();-const { t } = useI18n();const settingV1Store = useSettingV1Store();const containerRef = ref<HTMLDivElement>();@@ -152,18 +140,13 @@ const allowSave = computed((): boolean => {return !isEqual(state, getInitialState());});-const save = async () => {+const onUpdate = async () => {await settingV1Store.updateWorkspaceProfile({payload: {databaseChangeMode: state.databaseChangeMode,},updateMask: ["value.workspace_profile_setting_value.database_change_mode"],});- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.config-updated"),- });if (state.databaseChangeMode === DatabaseChangeMode.EDITOR &&!isSQLEditorRoute(router)@@ -186,5 +169,7 @@ const goToSQLEditor = () => {defineExpose({isDirty: allowSave,+ update: onUpdate,+ title: props.title,});</script>diff --git a/frontend/src/components/GeneralSetting/NetworkSetting.vue b/frontend/src/components/GeneralSetting/NetworkSetting.vueindex 42b168bab1..2c30c85f67 100644--- a/frontend/src/components/GeneralSetting/NetworkSetting.vue+++ b/frontend/src/components/GeneralSetting/NetworkSetting.vue@@ -2,7 +2,7 @@<div id="network" class="py-6 lg:flex"><div class="text-left lg:w-1/4"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.network") }}+ {{ title }}</h1><span v-if="!allowEdit" class="text-sm text-gray-400">{{ $t("settings.general.workspace.only-admin-can-edit") }}@@ -62,31 +62,21 @@{{ $t("settings.general.workspace.only-admin-can-edit") }}</span></NTooltip>-- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !allowSave"- @click.prevent="updateNetworkSetting"- >- {{ $t("common.update") }}- </NButton>- </div></div></div></div></template><script lang="ts" setup>-import { NButton, NInput, NTooltip } from "naive-ui";+import { NInput, NTooltip } from "naive-ui";import { storeToRefs } from "pinia";-import { computed, reactive, watchEffect } from "vue";+import { computed, reactive } from "vue";import { useI18n } from "vue-i18n";-import { pushNotification } from "@/store";import { useSettingV1Store, useActuatorV1Store } from "@/store";import LearnMoreLink from "../LearnMoreLink.vue";-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();@@ -100,18 +90,13 @@ const settingV1Store = useSettingV1Store();const actuatorV1Store = useActuatorV1Store();const state = reactive<LocalState>({- externalUrl: "",- gitopsWebhookUrl: "",+ externalUrl: settingV1Store.workspaceProfileSetting?.externalUrl ?? "",+ gitopsWebhookUrl:+ settingV1Store.workspaceProfileSetting?.gitopsWebhookUrl ?? "",});const { isSaaSMode } = storeToRefs(actuatorV1Store);-watchEffect(() => {- state.externalUrl = settingV1Store.workspaceProfileSetting?.externalUrl ?? "";- state.gitopsWebhookUrl =- settingV1Store.workspaceProfileSetting?.gitopsWebhookUrl ?? "";-});-const allowSave = computed((): boolean => {const externalUrlChanged =state.externalUrl !==@@ -126,6 +111,7 @@ const updateNetworkSetting = async () => {if (!allowSave.value) {return;}+await settingV1Store.updateWorkspaceProfile({payload: {externalUrl: state.externalUrl,@@ -136,11 +122,6 @@ const updateNetworkSetting = async () => {"value.workspace_profile_setting_value.gitops_webhook_url",],});- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.config-updated"),- });state.externalUrl = settingV1Store.workspaceProfileSetting?.externalUrl ?? "";state.gitopsWebhookUrl =@@ -148,6 +129,8 @@ const updateNetworkSetting = async () => {};defineExpose({+ title: props.title,isDirty: allowSave,+ update: updateNetworkSetting,});</script>diff --git a/frontend/src/components/GeneralSetting/SecuritySetting.vue b/frontend/src/components/GeneralSetting/SecuritySetting.vueindex fdb9f3afcc..4ceb02182c 100644--- a/frontend/src/components/GeneralSetting/SecuritySetting.vue+++ b/frontend/src/components/GeneralSetting/SecuritySetting.vue@@ -3,7 +3,7 @@<div class="text-left lg:w-1/4"><div class="flex items-center space-x-2"><h1 class="text-2xl font-bold">- {{ $t("settings.general.workspace.security") }}+ {{ title }}</h1></div><span v-if="!allowEdit" class="text-sm text-gray-400">@@ -61,16 +61,6 @@ref="domainRestrictionSettingRef":allow-edit="allowEdit"/>-- <div class="flex justify-end">- <NButton- type="primary"- :disabled="!allowEdit || !isDirty"- @click.prevent="onUpdate"- >- {{ $t("common.update") }}- </NButton>- </div></div></div>@@ -83,13 +73,10 @@<script lang="ts" setup>import { isEqual } from "lodash-es";-import { NButton } from "naive-ui";import { computed, reactive, ref } from "vue";-import { useI18n } from "vue-i18n";import { Switch } from "@/components/v2";import {featureToRef,- pushNotification,useSettingV1Store,usePolicyV1Store,usePolicyByParentAndType,@@ -111,11 +98,11 @@ interface LocalState {enableDataExport: boolean;}-defineProps<{+const props = defineProps<{+ title: string;allowEdit: boolean;}>();-const { t } = useI18n();const settingV1Store = useSettingV1Store();const policyV1Store = usePolicyV1Store();const hasWatermarkFeature = featureToRef("bb.feature.branding");@@ -203,15 +190,11 @@ const onUpdate = async () => {if (state.enableDataExport !== getInitialState().enableDataExport) {await handleDataExportToggle();}-- pushNotification({- module: "bytebase",- style: "SUCCESS",- title: t("settings.general.workspace.config-updated"),- });};defineExpose({isDirty,+ update: onUpdate,+ title: props.title,});</script>diff --git a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vueindex 26185f97ba..337ba1eb51 100644--- a/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue+++ b/frontend/src/components/SensitiveData/GlobalMaskingRulesView.vue@@ -23,8 +23,6 @@</div><div v-else class="flex items-center gap-x-2"><NButton- secondary- type="primary"class="capitalize":disabled="!hasPermission ||diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex d9a630529c..184a396138 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -489,7 +489,6 @@"select-logo": "Upload a file","drag-logo": "or drag here","logo-upload-tip": "{extension} up to {size} MiB",- "logo-upload-succeed": "Successfully updated the logo","security": "Security","account": "Account","watermark": {@@ -559,6 +558,8 @@"password-rotation": "Require users reset their password every {day} days"},"config-updated": "Configuration is updated.",+ "config-partly-updated": "Configuration partly updated.",+ "failed-to-update-setting": "Failed to update setting \"{title}\"","ai-assistant": {"self": "AI Assistant","description": "Use OpenAPI to assist the database development tasks.",@@ -579,7 +580,6 @@},"announcement": {"self": "Announcement",- "update-success": "Announcement setting updated.","admin-or-dba-can-edit": "Only workspace admin or DBA can update announcement setting."},"announcement-alert-level": {@@ -594,7 +594,6 @@"self": "Link","placeholder": "Input announcement link"},- "confirm-delete-custom-logo": "Delete custom branding logo?","restrict-issue-creation-for-sql-review": {"title": "Disallow issue creation for SQL review with errors","description": "Once enabled, users are only allowed to create issues if the SQL review does not contain any errors."diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 9cdd6b0b9b..9e85040ef0 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -489,7 +489,6 @@"select-logo": "Subir un archivo","drag-logo": "o arrastrar aquí","logo-upload-tip": "{extension} hasta {size} MiB",- "logo-upload-succeed": "Logo actualizado correctamente","security": "Seguridad","account": "Cuenta","watermark": {@@ -559,6 +558,8 @@"password-rotation": "Requerir que los usuarios restablezcan su contraseña cada {day} días"},"config-updated": "La configuración se ha actualizado.",+ "config-partly-updated": "Configuración parcialmente actualizada.",+ "failed-to-update-setting": "No se pudo actualizar la configuración \"{title}\"","ai-assistant": {"self": "Asistente de AI","description": "Utilice OpenAPI para ayudar en las tareas de desarrollo de bases de datos.",@@ -579,7 +580,6 @@},"announcement": {"self": "Anuncio",- "update-success": "Configuración de anuncios actualizada.","admin-or-dba-can-edit": "Solo el administrador del espacio de trabajo o el DBA pueden actualizar la configuración de anuncios."},"announcement-alert-level": {@@ -594,7 +594,6 @@"self": "Enlace","placeholder": "Enlace de anuncio de entrada"},- "confirm-delete-custom-logo": "¿Eliminar el logotipo de marca personalizado?","restrict-issue-creation-for-sql-review": {"title": "Prohibir la creación de problemas para la revisión de SQL con errores.","description": "Una vez habilitado, a los usuarios solo se les permite crear problemas si la revisión de SQL no contiene errores."diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 725715d74f..e8b682e1c6 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -489,7 +489,6 @@"select-logo": "選ぶ","drag-logo": "またはファイルをドラッグ アンド ドロップします","logo-upload-tip": "{extension} タイプのファイルをサポートします。{size} MiB より大きくすることはできません",- "logo-upload-succeed": "ロゴ更新完了","security": "セキュリティ","account": "アカウント","watermark": {@@ -559,6 +558,8 @@"password-rotation": "ユーザーに{day}日ごとにパスワードのリセットを要求する"},"config-updated": "設定が更新されました。",+ "config-partly-updated": "設定が部分的に更新されました。",+ "failed-to-update-setting": "設定「{title}」の更新に失敗しました","ai-assistant": {"self": "AI アシスタント","description": "OpenAPI を使用してデータベース開発タスクを支援します。",@@ -579,7 +580,6 @@},"announcement": {"self": "お知らせ",- "update-success": "お知らせの設定が更新されました。","admin-or-dba-can-edit": "管理者または DBA のみがお知らせの設定を更新できます。"},"announcement-alert-level": {@@ -594,7 +594,6 @@"self": "リンク","placeholder": "お知らせのリンクを入力してください"},- "confirm-delete-custom-logo": "カスタム ブランド ロゴを削除しますか?","restrict-issue-creation-for-sql-review": {"title": "エラーアラートを含むイシューの提出は禁止されています","description": "有効にすると、プレビュー段階で「エラー」レベルのアラームを含まないイシューのみを送信できます。"diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex b433f72c68..a21ff6e456 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -489,7 +489,6 @@"select-logo": "Tải lên một tệp","drag-logo": "hoặc kéo vào đây","logo-upload-tip": "{extension} tối đa {size} MiB",- "logo-upload-succeed": "Đã cập nhật logo thành công","security": "Bảo mật","account": "Tài khoản","watermark": {@@ -559,6 +558,8 @@"password-rotation": "Yêu cầu người dùng đặt lại mật khẩu của họ sau mỗi {day} ngày"},"config-updated": "Cấu hình được cập nhật.",+ "config-partly-updated": "Cấu hình đã được cập nhật một phần.",+ "failed-to-update-setting": "Không cập nhật được cài đặt \"{title}\"","ai-assistant": {"self": "Trợ lý AI","description": "Sử dụng OpenAPI để hỗ trợ các tác vụ phát triển cơ sở dữ liệu.",@@ -579,7 +580,6 @@},"announcement": {"self": "Thông báo",- "update-success": "Cài đặt thông báo được cập nhật thành công.","admin-or-dba-can-edit": "Chỉ quản trị viên không gian làm việc hoặc DBA mới có thể cập nhật cài đặt thông báo."},"announcement-alert-level": {@@ -594,7 +594,6 @@"self": "Liên kết","placeholder": "Nhập liên kết thông báo"},- "confirm-delete-custom-logo": "Xóa logo thương hiệu tùy chỉnh?","restrict-issue-creation-for-sql-review": {"title": "Không cho phép tạo vấn đề khi đánh giá SQL có lỗi","description": "Khi được bật, người dùng chỉ được phép tạo vấn đề nếu đánh giá SQL không chứa bất kỳ lỗi nào."diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 53895ef250..fe43b869ec 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -489,7 +489,6 @@"select-logo": "选择","drag-logo": "或拖拽文件","logo-upload-tip": "支持 {extension} 类型文件,不能大于 {size} MiB",- "logo-upload-succeed": "Logo 更新完成","security": "安全","account": "帐户","watermark": {@@ -559,6 +558,8 @@"password-rotation": "要求用户每 {day} 天重置一次密码"},"config-updated": "配置已更新。",+ "config-partly-updated": "配置部分更新。",+ "failed-to-update-setting": "无法更新设置“{title}”","ai-assistant": {"self": "AI 助手","description": "使用 OpenAPI 来辅助数据库开发任务。",@@ -579,7 +580,6 @@},"announcement": {"self": "公告",- "update-success": "公告设置已更新。","admin-or-dba-can-edit": "只有管理员或 DBA 可以更新公告设置。"},"announcement-alert-level": {@@ -594,7 +594,6 @@"self": "链接","placeholder": "输入公告链接"},- "confirm-delete-custom-logo": "删除自定义品牌 Logo?","restrict-issue-creation-for-sql-review": {"title": "禁止提交包含错误告警的工单","description": "启用后,只有在预览阶段不包含任何“错误”级别告警的工单才能被提交。"diff --git a/frontend/src/views/SettingWorkspaceGeneral.vue b/frontend/src/views/SettingWorkspaceGeneral.vueindex a3c724f5cf..aadddb9224 100644--- a/frontend/src/views/SettingWorkspaceGeneral.vue+++ b/frontend/src/views/SettingWorkspaceGeneral.vue@@ -2,26 +2,54 @@<div class="space-y-0 divide-y divide-block-border pt-2"><DatabaseChangeModeSettingref="databaseChangeModeSettingRef"+ :title="$t('settings.general.workspace.database-change-mode.self')":allow-edit="allowEdit"/><NetworkSetting- ref="networkSettingRef"v-if="!isSaaSMode"+ ref="networkSettingRef"+ :title="$t('settings.general.workspace.network')"+ :allow-edit="allowEdit"+ />+ <BrandingSetting+ ref="brandingSettingRef"+ :title="$t('settings.general.workspace.branding')"+ :allow-edit="allowEdit"+ />+ <AccountSetting+ ref="accountSettingRef"+ :title="$t('settings.general.workspace.account')"+ :allow-edit="allowEdit"+ />+ <SecuritySetting+ ref="securitySettingRef"+ :title="$t('settings.general.workspace.security')":allow-edit="allowEdit"/>- <BrandingSetting ref="brandingSettingRef" :allow-edit="allowEdit" />- <AccountSetting ref="accountSettingRef" :allow-edit="allowEdit" />- <SecuritySetting ref="securitySettingRef" :allow-edit="allowEdit" /><AIAugmentationSettingref="aiAugmentationSettingRef"+ :title="$t('settings.general.workspace.ai-assistant.self')":allow-edit="allowEdit"/>- <AnnouncementSetting ref="announcementSettingRef" :allow-edit="allowEdit" />+ <AnnouncementSetting+ ref="announcementSettingRef"+ :title="$t('settings.general.workspace.announcement.self')"+ :allow-edit="allowEdit"+ />++ <div v-if="allowEdit && isDirty" class="sticky -bottom-4 z-10">+ <div class="flex justify-end w-full py-4 border-block-border bg-white">+ <NButton type="primary" @click.prevent="onUpdate">+ {{ $t("common.confirm-and-update") }}+ </NButton>+ </div>+ </div></div></template><script lang="ts" setup>import { useEventListener } from "@vueuse/core";+import { NButton } from "naive-ui";import { storeToRefs } from "pinia";import { onMounted, ref, computed } from "vue";import { useI18n } from "vue-i18n";@@ -36,6 +64,7 @@ import {DatabaseChangeModeSetting,} from "@/components/GeneralSetting";import { useActuatorV1Store } from "@/store";+import { pushNotification } from "@/store";import { useSettingV1Store } from "@/store/modules/v1/setting";defineProps<{@@ -56,6 +85,18 @@ const aiAugmentationSettingRef =ref<InstanceType<typeof AIAugmentationSetting>>();const announcementSettingRef = ref<InstanceType<typeof AnnouncementSetting>>();+const settingRefList = computed(() => {+ return [+ accountSettingRef,+ databaseChangeModeSettingRef,+ networkSettingRef,+ brandingSettingRef,+ securitySettingRef,+ aiAugmentationSettingRef,+ announcementSettingRef,+ ];+});+onMounted(async () => {await useSettingV1Store().fetchSettingList();// If the route has a hash, try to scroll to the element with the value.@@ -66,16 +107,41 @@ onMounted(async () => {const { isSaaSMode } = storeToRefs(actuatorStore);const isDirty = computed(() => {- return (- accountSettingRef.value?.isDirty ||- databaseChangeModeSettingRef.value?.isDirty ||- networkSettingRef.value?.isDirty ||- brandingSettingRef.value?.isDirty ||- aiAugmentationSettingRef.value?.isDirty ||- announcementSettingRef.value?.isDirty- );+ return settingRefList.value.some((settingRef) => settingRef.value?.isDirty);});+const onUpdate = async () => {+ let failedCount = 0;+ let totalCount = 0;+ for (const settingRef of settingRefList.value) {+ if (settingRef.value?.isDirty) {+ totalCount++;+ try {+ await settingRef.value.update();+ } catch {+ failedCount++;+ pushNotification({+ module: "bytebase",+ style: "WARN",+ title: t("settings.general.workspace.failed-to-update-setting", {+ title: settingRef.value.title,+ }),+ });+ }+ }+ }+ if (totalCount > 0 && totalCount !== failedCount) {+ pushNotification({+ module: "bytebase",+ style: failedCount === 0 ? "SUCCESS" : "WARN",+ title:+ failedCount === 0+ ? t("settings.general.workspace.config-updated")+ : t("settings.general.workspace.config-partly-updated"),+ });+ }+};+useEventListener("beforeunload", (e) => {if (!isDirty.value) {return;