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: delete custom branding logo (#8840)
Liu Jia0ffe36ffc56
diff --git a/frontend/src/components/GeneralSetting/BrandingSetting.vue b/frontend/src/components/GeneralSetting/BrandingSetting.vueindex dab7f74722..f8d30a2a06 100644--- a/frontend/src/components/GeneralSetting/BrandingSetting.vue+++ b/frontend/src/components/GeneralSetting/BrandingSetting.vue@@ -66,10 +66,20 @@</SingleFileSelector></div></div>- <div class="flex">+ <div class="flex justify-end gap-x-3">+ <NPopconfirm v-if="allowDelete" @positive-click="deleteLogo">+ <template #trigger>+ <button type="button" class="btn-normal" :disabled="!allowEdit">+ {{ $t("common.delete") }}+ </button>+ </template>+ <template #default>+ {{ t("settings.general.workspace.confirm-delete-custom-logo") }}+ </template>+ </NPopconfirm><buttontype="button"- class="btn-primary ml-auto"+ class="btn-primary":disabled="!allowSave"@click.prevent="uploadLogo">@@ -91,6 +101,7 @@</template><script lang="ts" setup>+import { NPopconfirm } from "naive-ui";import { computed, reactive, watchEffect } from "vue";import { useI18n } from "vue-i18n";import { featureToRef, pushNotification, useCurrentUserV1 } from "@/store";@@ -145,6 +156,10 @@ const valid = computed((): boolean => {return !!state.displayName || !!state.logoFile;});+const allowDelete = computed(() => {+ if (!allowEdit.value) return false;+ return settingV1Store.brandingLogo !== "";+});const allowSave = computed((): boolean => {return (allowEdit.value && state.logoFile !== null && valid.value && !state.loading@@ -153,26 +168,13 @@ const allowSave = computed((): boolean => {const hasBrandingFeature = featureToRef("bb.feature.branding");-const uploadLogo = async () => {- if (!allowSave.value) {- return;- }- if (!hasBrandingFeature.value) {- state.showFeatureModal = true;- return;- }- if (!state.logoFile) {- return;- }-+const doUpdate = async (content: string, message: string) => {state.loading = true;-try {- const fileInBase64 = await convertFileToBase64(state.logoFile);const setting = await settingV1Store.upsertSetting({name: "bb.branding.logo",value: {- stringValue: fileInBase64,+ stringValue: content,},});@@ -182,12 +184,38 @@ const uploadLogo = async () => {pushNotification({module: "bytebase",style: "SUCCESS",- title: t("settings.general.workspace.logo-upload-succeed"),+ title: message,});} finally {state.loading = false;}};+const deleteLogo = async () => {+ state.loading = true;++ await doUpdate("", t("common.deleted"));+};++const uploadLogo = async () => {+ if (!allowSave.value) {+ return;+ }+ 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")+ );+};const onLogoSelect = (file: File) => {state.logoFile = file;diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 6baf66d7db..635e4c9280 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -628,7 +628,8 @@"extra-link": {"self": "Link","placeholder": "Input announcement link"- }+ },+ "confirm-delete-custom-logo": "Delete custom branding logo?"}},"sensitive-data": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex a369bce406..3bd21170e2 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -627,7 +627,8 @@"hours": "Horas","days": "Días","config-updated": "La configuración se ha actualizado. Necesita reiniciar Bytebase y volver a iniciar sesión para que surta efecto."- }+ },+ "confirm-delete-custom-logo": "¿Eliminar el logotipo de marca personalizado?"}},"sensitive-data": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex d4020cde95..f3c76f2668 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -626,7 +626,8 @@"extra-link": {"self": "链接","placeholder": "输入公告链接"- }+ },+ "confirm-delete-custom-logo": "删除自定义品牌 Logo?"}},"sensitive-data": {