diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index a7e8843867..ffd83324f2 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3487,5 +3487,8 @@ "数量(台)": "数量(台)", "统计视图": "统计视图", "主机列表": "主机列表", + "库表只能由[0-9],[a-z],[A-Z],-,_ 组成,支持* % ?通配符,最大35字符": "库表只能由[0-9],[a-z],[A-Z],-,_ 组成,支持* % ?通配符,最大35字符", + "不允许填写系统库": "不允许填写系统库", + "不能以stage_truncate开头或dba_rollback结尾": "不能以 stage_truncate 开头或 dba_rollback 结尾", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/views/mysql/common/edit-field/DbName.vue b/dbm-ui/frontend/src/views/mysql/common/edit-field/DbName.vue index 762bb2e44b..b5d87fe010 100644 --- a/dbm-ui/frontend/src/views/mysql/common/edit-field/DbName.vue +++ b/dbm-ui/frontend/src/views/mysql/common/edit-field/DbName.vue @@ -79,6 +79,8 @@ return props.rules; } + const systemDbNames = ['mysql', 'db_infobase', 'information_schema', 'performance_schema', 'sys', 'infodba_schema']; + return [ { validator: (value: string[]) => { @@ -89,6 +91,18 @@ }, message: t('DB 名不能为空'), }, + { + validator: (value: string[]) => _.every(value, (item) => /^(?!stage_truncate)(?!.*dba_rollback$).*/.test(item)), + message: t('不能以stage_truncate开头或dba_rollback结尾'), + }, + { + validator: (value: string[]) => _.every(value, (item) => /^[-_a-zA-Z0-9*?%]{0,35}$/.test(item)), + message: t('库表只能由[0-9],[a-z],[A-Z],-,_ 组成,支持* % ?通配符,最大35字符'), + }, + { + validator: (value: string[]) => _.every(value, (item) => !systemDbNames.includes(item)), + message: t('不允许填写系统库'), + }, { validator: (value: string[]) => { if (props.allowAsterisk) { diff --git a/dbm-ui/frontend/src/views/mysql/common/edit-field/TableName.vue b/dbm-ui/frontend/src/views/mysql/common/edit-field/TableName.vue index 9d173c872c..fd22d3d20e 100644 --- a/dbm-ui/frontend/src/views/mysql/common/edit-field/TableName.vue +++ b/dbm-ui/frontend/src/views/mysql/common/edit-field/TableName.vue @@ -86,6 +86,10 @@ }, message: t('表名不能为空'), }, + { + validator: (value: string[]) => _.every(value, (item) => /^[-_a-zA-Z0-9*?%]{0,35}$/.test(item)), + message: t('库表只能由[0-9],[a-z],[A-Z],-,_ 组成,支持* % ?通配符,最大35字符'), + }, { validator: (value: string[]) => { if (props.allowAsterisk) { diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/Flashback.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/Flashback.vue index 23c3969fa9..8f1e56d665 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/Flashback.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/Flashback.vue @@ -57,48 +57,48 @@ field: 'databases', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.map(item => {item})} -
- ), +
+ {cell.map(item => {item})} +
+ ), }, { - label: t('目标表'), - field: 'tables', + label: t('忽略库'), + field: 'databases_ignore', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.map(item => {item})} -
- ), +
+ {cell.length > 0 ? cell.map(item => {item}) : '--'} +
+ ), }, { - label: t('忽略库'), - field: 'databases_ignore', + label: t('目标表'), + field: 'tables', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.length > 0 ? cell.map(item => {item}) : '--'} -
- ), +
+ {cell.map(item => {item})} +
+ ), }, { label: t('忽略表'), field: 'tables_ignore', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.length > 0 ? cell.map(item => {item}) : '--'} -
- ), +
+ {cell.length > 0 ? cell.map(item => {item}) : '--'} +
+ ), }, ]; diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/HATruncate.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/HATruncate.vue index 934fc74139..b214736846 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/HATruncate.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/HATruncate.vue @@ -103,48 +103,48 @@ field: 'db_patterns', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.map(item => {item})} -
- ), +
+ {cell.map(item => {item})} +
+ ), }, { - label: t('目标表名'), - field: 'table_patterns', + label: t('忽略DB名'), + field: 'ignore_dbs', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.map(item => {item})} -
- ), +
+ {cell.length > 0 ? cell.map(item => {item}) : '--'} +
+ ), }, { - label: t('忽略DB名'), - field: 'ignore_dbs', + label: t('目标表名'), + field: 'table_patterns', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.length > 0 ? cell.map(item => {item}) : '--'} -
- ), +
+ {cell.map(item => {item})} +
+ ), }, { label: t('忽略表名'), field: 'ignore_tables', showOverflowTooltip: false, render: ({ cell }: { cell: string[] }) => ( -
- {cell.length > 0 ? cell.map(item => {item}) : '--'} -
- ), +
+ {cell.length > 0 ? cell.map(item => {item}) : '--'} +
+ ), }, ]; diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/TableBackup.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/TableBackup.vue index 90c2e10ed5..851169a6e5 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/TableBackup.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/TableBackup.vue @@ -44,19 +44,17 @@ name: string, } - /** - * mysql 库表备份 - */ - - const columns: any = [{ - label: t('集群ID'), - field: 'cluster_id', - render: ({ cell }: { cell: number }) => {cell || '--'}, - }, { - label: t('集群名称'), - field: 'immute_domain', - showOverflowTooltip: false, - render: ({ data }: { data: any }) => ( + const columns = [ + { + label: t('集群ID'), + field: 'cluster_id', + render: ({ cell }: { cell: number }) => {cell || '--'}, + }, + { + label: t('集群名称'), + field: 'immute_domain', + showOverflowTooltip: false, + render: ({ data }: { data: backupItem }) => (
{data.name}
), - }, { - label: t('备份源'), - field: 'backup_on', - render: ({ cell }: { cell: string }) => {cell || '--'}, - }, { - label: t('备份DB名'), - field: 'db_patterns', - showOverflowTooltip: false, - render: ({ cell }: { cell: string[] }) => ( + }, + { + label: t('备份源'), + field: 'backup_on', + render: ({ cell }: { cell: string }) => {cell || '--'}, + }, + { + label: t('备份DB名'), + field: 'db_patterns', + showOverflowTooltip: false, + render: ({ cell }: { cell: string[] }) => (
{cell.map(item => {item})}
), - }, { - label: t('忽略DB名'), - field: 'ignore_dbs', - showOverflowTooltip: false, - render: ({ cell }: { cell: string[] }) => ( + }, + { + label: t('忽略DB名'), + field: 'ignore_dbs', + showOverflowTooltip: false, + render: ({ cell }: { cell: string[] }) => (
{cell.length > 0 ? cell.map(item => {item}) : '--'}
), - }, { - label: t('备份表名'), - field: 'table_patterns', - showOverflowTooltip: false, - render: ({ cell }: { cell: string[] }) => ( + }, + { + label: t('备份表名'), + field: 'table_patterns', + showOverflowTooltip: false, + render: ({ cell }: { cell: string[] }) => (
{cell.map(item => {item})}
), - }, { - label: t('忽略表名'), - field: 'ignore_tables', - showOverflowTooltip: false, - render: ({ cell }: { cell: string[] }) => ( + }, + { + label: t('忽略表名'), + field: 'ignore_tables', + showOverflowTooltip: false, + render: ({ cell }: { cell: string[] }) => (
{cell.length > 0 ? cell.map(item => {item}) : '--'}
), - }]; + } + ]; const dataList = computed(() => { const list: backupItem[] = []; diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/Flashback.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/Flashback.vue index 40ad4a3111..afdb49ed31 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/Flashback.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/Flashback.vue @@ -70,13 +70,13 @@ showOverflowTooltip: true, }, { - label: t('目标表'), - field: 'tableName', + label: t('忽略库'), + field: 'ignoreDbName', showOverflowTooltip: true, }, { - label: t('忽略库'), - field: 'ignoreDbName', + label: t('目标表'), + field: 'tableName', showOverflowTooltip: true, }, { diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/TableBackup.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/TableBackup.vue index 916ebe5351..702f4468a7 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/TableBackup.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/spider/TableBackup.vue @@ -63,13 +63,13 @@ showOverflowTooltip: true, }, { - label: t('备份表名'), - field: 'tableName', + label: t('忽略DB名'), + field: 'ignoreDbName', showOverflowTooltip: true, }, { - label: t('忽略DB名'), - field: 'ignoreDbName', + label: t('备份表名'), + field: 'tableName', showOverflowTooltip: true, }, {