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: confirm when changing db label (#838)
Liu Ji838844017111
diff --git a/frontend/package.json b/frontend/package.jsonindex 54e9f2cddf..1146ff0004 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -26,7 +26,7 @@"inter-ui": "^3.15.0","lodash-es": "^4.17.21","monaco-editor": "^0.32.1",- "naive-ui": "^2.25.1",+ "naive-ui": "^2.26.4","node-sql-parser": "^4.0.8","papaparse": "^5.3.1","postcss": "^8.4.6",diff --git a/frontend/src/components/DatabaseLabels/DatabaseLabelPropItem.vue b/frontend/src/components/DatabaseLabels/DatabaseLabelPropItem.vueindex 499d58049f..8229d1b640 100644--- a/frontend/src/components/DatabaseLabels/DatabaseLabelPropItem.vue+++ b/frontend/src/components/DatabaseLabels/DatabaseLabelPropItem.vue@@ -6,10 +6,10 @@<template v-else><selectclass="absolute inset-0 opacity-0 m-0 p-0"- :value="value"+ :value="state.value"@change="onChange">- <option :value="''" :selected="!!value">+ <option :value="''" :selected="!!state.value">{{ $t("label.empty-label-value") }}</option><option@@ -20,15 +20,19 @@{{ labelValue }}</option></select>- {{ value || $t("label.empty-label-value") }}+ {{ state.value || $t("label.empty-label-value") }}<heroicons-outline:chevron-down class="w-4 h-4 ml-0.5" /></template></span></template><script lang="ts" setup>-import { computed, defineProps, defineEmits } from "vue";+import { capitalize } from "lodash-es";+import { useDialog } from "naive-ui";+import { computed, defineProps, defineEmits, reactive, watch } from "vue";+import { useI18n } from "vue-i18n";import { Database, Label, LabelValueType } from "../../types";+import { hidePrefix } from "../../utils";const props = defineProps<{label: Label;@@ -43,6 +47,19 @@ const emit = defineEmits<{(e: "update:value", value: LabelValueType): void;}>();+const { t } = useI18n();++const state = reactive({+ value: props.value,+});++const dialog = useDialog();++watch(+ () => props.value,+ (value) => (state.value = value)+);+const editable = computed((): boolean => {if (!props.allowEdit) return false;@@ -56,7 +73,23 @@ const editable = computed((): boolean => {const onChange = (e: Event) => {const select = e.target as HTMLSelectElement;- const { value } = select;- emit("update:value", value);+ dialog.create({+ positiveText: t("common.confirm"),+ negativeText: t("common.cancel"),+ title: t("label.confirm-change", {+ label: capitalize(hidePrefix(props.label.key)),+ }),+ closable: false,+ maskClosable: false,+ closeOnEsc: false,+ onNegativeClick: () => {+ state.value = props.value;+ select.value = state.value || "";+ },+ onPositiveClick: () => {+ const { value } = select;+ emit("update:value", value);+ },+ });};</script>diff --git a/frontend/src/locales/en.yml b/frontend/src/locales/en.ymlindex 8f504b1c2b..27667f8f38 100644--- a/frontend/src/locales/en.yml+++ b/frontend/src/locales/en.yml@@ -1186,6 +1186,7 @@ label:db-name-template-tips: >-Allow you to group databases with the same {placeholder} from differenttenants. {link}.+ confirm-change: Are you sure to change '{label}' ?parsed-from-template: Parsed from {name} by template {template}.cannot-transfer-template-not-match: >-Database '{name}' cannot be transferred to this project. Since its namediff --git a/frontend/src/locales/zh-CN.yml b/frontend/src/locales/zh-CN.ymlindex 56eb54eff2..3ed2a226fc 100644--- a/frontend/src/locales/zh-CN.yml+++ b/frontend/src/locales/zh-CN.yml@@ -1041,6 +1041,7 @@ label:setting:description: 标签是一组可用于标识数据库租户的键值对。{link}。db-name-template-tips: 让您能够把属于不同租户但是有相同 {placeholder} 的数据库分成一组。{link}。+ confirm-change: 您确定要修改 '{label}' 吗?parsed-from-template: 从 {name} 中依据模板 {template} 解析得出cannot-transfer-template-not-match: 数据库 '{name}' 无法转移到这个项目,因为它的名称不符合模板 {template}。oauth:diff --git a/frontend/yarn.lock b/frontend/yarn.lockindex ebe5c0baf0..b24a7b0244 100644--- a/frontend/yarn.lock+++ b/frontend/yarn.lock@@ -1156,15 +1156,15 @@ csstype@~3.0.5:resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.10.tgz#2ad3a7bed70f35b965707c092e5f30b327c290e5"integrity sha512-2u44ZG2OcNUO9HDp/Jl8C07x6pU/eTR3ncV91SiK3dhG9TWvRVsCoJw14Ckx5DgWkzGA3waZWO3d7pgqpUI/XA==-date-fns-tz@^1.1.6:- version "1.2.0"- resolved "https://registry.yarnpkg.com/date-fns-tz/-/date-fns-tz-1.2.0.tgz#7bdeeea16b9191bf593e937b049878e2028433fc"- integrity sha512-ikznnuBSJcBu4HC4HEfZ8D3r8TvRKz52hlTQq6E+LBWcVsvAS1ADc+km9klcVZkk0CJwglBcNMMRY8mXOn+Wig==+date-fns-tz@^1.3.0:+ version "1.3.0"+ resolved "https://registry.npmmirror.com/date-fns-tz/-/date-fns-tz-1.3.0.tgz#6c83d4bdf20d54060cf176d96a3ca45043b36a84"+ integrity sha512-r6ye6PmGEvkF467/41qzU71oGwv9kHTnV3vtSZdyV6VThwPID47ZH7FtR7zQWrhgOUWkYySm2ems2w6ZfNUqoA==-date-fns@^2.27.0:- version "2.27.0"- resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.27.0.tgz#e1ff3c3ddbbab8a2eaadbb6106be2929a5a2d92b"- integrity sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q==+date-fns@^2.28.0:+ version "2.28.0"+ resolved "https://registry.npmmirror.com/date-fns/-/date-fns-2.28.0.tgz#9570d656f5fc13143e50c975a3b6bbeb46cd08b2"+ integrity sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==dayjs@^1.10.7:version "1.10.7"@@ -2318,10 +2318,10 @@ [email protected]:resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==-naive-ui@^2.25.1:- version "2.26.0"- resolved "https://registry.yarnpkg.com/naive-ui/-/naive-ui-2.26.0.tgz#a55d8c821f8f18f4a21b136f340a560a91bca655"- integrity sha512-4+78iqpQs1t8Xlq3Hrk1eSsm17d6ZScMNvnyo+KAiYdAWCfEsIdKb6ulkPGu7T0hpWL5A3TctJ5ioSbNlbN4LA==+naive-ui@^2.26.4:+ version "2.26.4"+ resolved "https://registry.npmmirror.com/naive-ui/-/naive-ui-2.26.4.tgz#96b91fd36919fd36d20641668c8636a02e144d65"+ integrity sha512-yJQl6y58pxQWKi8YAofiFk0+4WVN+dNYoyKiMfaVdvVQTh9VxjBrcs4z5NUT+d98xUXOtmMzpIlrW/4P1xty+w==dependencies:"@css-render/plugin-bem" "^0.15.8""@css-render/vue3-ssr" "^0.15.8"@@ -2329,8 +2329,8 @@ naive-ui@^2.25.1:"@types/lodash-es" "^4.17.4"async-validator "^4.0.1"css-render "^0.15.8"- date-fns "^2.27.0"- date-fns-tz "^1.1.6"+ date-fns "^2.28.0"+ date-fns-tz "^1.3.0"evtd "^0.2.3"highlight.js "^11.0.1"lodash "^4.17.21"