From 74b3806c5666b2aaf9cf509069e194e8e24e7d24 Mon Sep 17 00:00:00 2001 From: hlinx <327159425@qq.com> Date: Thu, 28 Mar 2024 17:41:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E6=9D=83=E9=99=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D=20#3682?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/auth-component/component.tsx | 1 + .../src/components/auth-component/use-base.ts | 2 + .../services/model/db-resource/Operation.ts | 5 + .../model/db-resource/dirtyMachines.ts | 6 + .../model/influxdb/influxdbInstance.ts | 53 ++-- .../services/model/monitor/monitor-policy.ts | 1 + .../src/services/model/mysql/tendbha.ts | 1 + .../TicketFlowDescribe.ts | 11 +- dbm-ui/frontend/src/services/monitor.ts | 3 +- dbm-ui/frontend/src/services/permission.ts | 4 +- dbm-ui/frontend/src/services/report.ts | 20 +- .../frontend/src/services/source/configs.ts | 1 + .../frontend/src/services/source/dbdirty.ts | 9 +- .../src/services/source/monitorNoticeGroup.ts | 13 + .../frontend/src/services/source/ticket.tsx | 8 +- .../components/render-list/Index.vue | 17 +- .../components/content/Index.vue | 112 ++++---- .../components/edit-strategy/Index.vue | 2 +- .../components/content/Index.vue | 33 ++- .../components/instance-list/Index.vue | 2 +- .../mysql/ha-cluster-list/components/List.vue | 17 +- .../permission/components/CreateRule.vue | 2 +- .../views/password-manage/policy/Index.vue | 5 +- .../password-manage/randomization/Index.vue | 5 +- .../redis/list/components/list/Index.vue | 5 +- .../resource-manage/dirty-machine/Index.vue | 25 +- .../views/resource-manage/record/Index.vue | 16 +- .../service-apply/create-db-module/Index.vue | 241 ++++++++---------- .../permission/components/CreateRule.vue | 2 +- .../ticket-flow-setting/components/List.vue | 111 ++++---- .../src/views/tickets/my-tickets/Index.vue | 4 +- 31 files changed, 405 insertions(+), 332 deletions(-) diff --git a/dbm-ui/frontend/src/components/auth-component/component.tsx b/dbm-ui/frontend/src/components/auth-component/component.tsx index fd320b0f28..1143f73595 100644 --- a/dbm-ui/frontend/src/components/auth-component/component.tsx +++ b/dbm-ui/frontend/src/components/auth-component/component.tsx @@ -23,6 +23,7 @@ export default defineComponent({ }, bizId: { type: [String, Number], + default: undefined, }, }, setup(props) { diff --git a/dbm-ui/frontend/src/components/auth-component/use-base.ts b/dbm-ui/frontend/src/components/auth-component/use-base.ts index b6a091bc27..e4ac52c95c 100644 --- a/dbm-ui/frontend/src/components/auth-component/use-base.ts +++ b/dbm-ui/frontend/src/components/auth-component/use-base.ts @@ -23,11 +23,13 @@ const withBizActionList = [ 'mysql_partition_update', 'mysql_partition_create', 'mysql_partition_enable_disable', + 'mysql_openarea_config_create', 'tendbcluster_apply', 'tendbcluster_account_create', 'tendbcluster_account_delete', 'tendbcluster_add_account_rule', 'tendb_excel_authorize_rules', + 'tendb_openarea_config_create', 'tendbcluster_cluster_clone_rules', 'tendbcluster_temporary_destroy', 'tendbcluster_partition_create', diff --git a/dbm-ui/frontend/src/services/model/db-resource/Operation.ts b/dbm-ui/frontend/src/services/model/db-resource/Operation.ts index 73df01a900..fea7858cc1 100644 --- a/dbm-ui/frontend/src/services/model/db-resource/Operation.ts +++ b/dbm-ui/frontend/src/services/model/db-resource/Operation.ts @@ -38,6 +38,10 @@ export default class Operation { create_time: string; operation_type: string; operator: string; + permission: { + flow_detail: boolean; + ticket_view: boolean; + }; request_id: string; status: string; task_id: string; @@ -52,6 +56,7 @@ export default class Operation { this.create_time = payload.create_time; this.operation_type = payload.operation_type; this.operator = payload.operator; + this.permission = payload.permission; this.request_id = payload.request_id; this.status = payload.status; this.task_id = payload.task_id; diff --git a/dbm-ui/frontend/src/services/model/db-resource/dirtyMachines.ts b/dbm-ui/frontend/src/services/model/db-resource/dirtyMachines.ts index f7fef266d4..eea9232566 100644 --- a/dbm-ui/frontend/src/services/model/db-resource/dirtyMachines.ts +++ b/dbm-ui/frontend/src/services/model/db-resource/dirtyMachines.ts @@ -10,6 +10,11 @@ export default class DirtyMachines { ticket_type: string; ticket_type_display: string; operator: string; + permission: { + dirty_pool_manage: boolean; + flow_detail: boolean; + ticket_view: boolean; + }; constructor(payload = {} as DirtyMachines) { this.bk_biz_id = payload.bk_biz_id; @@ -23,5 +28,6 @@ export default class DirtyMachines { this.ticket_type = payload.ticket_type; this.ticket_type_display = payload.ticket_type_display; this.operator = payload.operator; + this.permission = payload.permission; } } diff --git a/dbm-ui/frontend/src/services/model/influxdb/influxdbInstance.ts b/dbm-ui/frontend/src/services/model/influxdb/influxdbInstance.ts index 95f4b47e85..5a7b1166ed 100644 --- a/dbm-ui/frontend/src/services/model/influxdb/influxdbInstance.ts +++ b/dbm-ui/frontend/src/services/model/influxdb/influxdbInstance.ts @@ -35,13 +35,16 @@ export default class InfluxDBInstance { bk_cloud_id: number; bk_cloud_name: string; bk_host_id: number; + cpu: number; create_at: string; - restart_at: string; - update_at: string; - domain: string; + creator: string; + disk: number; + group_id: null | number; + group_name: null | string; id: number; instance_address: string; instance_name: string; + mem: number; operations: Array<{ flow_id: number; instance_id: number; @@ -51,41 +54,41 @@ export default class InfluxDBInstance { ticket_type: string; title: string; }>; + permission: { + influxdb_destroy: boolean; + influxdb_enable_disable: boolean; + influxdb_reboot: boolean; + influxdb_replace: boolean; + influxdb_view: boolean; + }; + phase: string; + restart_at: string; role: string; status: string; - group_id: null | number; - group_name: null | string; - creator: string; - phase: string; - disk: number; - cpu: number; - mem: number; - permission: Record< - 'influxdb_view' | 'influxdb_enable_disable' | 'influxdb_destroy' | 'influxdb_replace' | 'influxdb_reboot', - boolean - >; + update_at: string; + version: string; constructor(payload = {} as InfluxDBInstance) { this.bk_cloud_id = payload.bk_cloud_id; this.bk_cloud_name = payload.bk_cloud_name; this.bk_host_id = payload.bk_host_id; + this.cpu = payload.cpu; this.create_at = payload.create_at; - this.restart_at = payload.restart_at; - this.update_at = payload.update_at; - this.domain = payload.domain; + this.creator = payload.creator; + this.disk = payload.disk; + this.group_id = payload.group_id; + this.group_name = payload.group_name; this.id = payload.id; this.instance_address = payload.instance_address; this.instance_name = payload.instance_name; + this.mem = payload.mem; + this.permission = payload.permission; + this.phase = payload.phase; + this.restart_at = payload.restart_at; this.role = payload.role; this.status = payload.status; - this.group_id = payload.group_id; - this.group_name = payload.group_name; - this.creator = payload.creator; - this.phase = payload.phase; - this.disk = payload.disk; - this.mem = payload.mem; - this.cpu = payload.cpu; - this.permission = payload.permission || {}; + this.update_at = payload.update_at; + this.version = payload.version; this.operations = this.initOperations(payload.operations); } diff --git a/dbm-ui/frontend/src/services/model/monitor/monitor-policy.ts b/dbm-ui/frontend/src/services/model/monitor/monitor-policy.ts index 02b164cea3..da855ad252 100644 --- a/dbm-ui/frontend/src/services/model/monitor/monitor-policy.ts +++ b/dbm-ui/frontend/src/services/model/monitor/monitor-policy.ts @@ -41,6 +41,7 @@ export default class MonitorPolicy { policy_status: string; // 策略状态:valid(正常)|invalid(异常) parent_id: number; permission: { + global_monitor_policy_clone: boolean; global_monitor_policy_edit: boolean; global_monitor_policy_start_stop: boolean; monitor_policy_alarm_view: boolean; diff --git a/dbm-ui/frontend/src/services/model/mysql/tendbha.ts b/dbm-ui/frontend/src/services/model/mysql/tendbha.ts index bf82779f13..4a76298ef1 100644 --- a/dbm-ui/frontend/src/services/model/mysql/tendbha.ts +++ b/dbm-ui/frontend/src/services/model/mysql/tendbha.ts @@ -82,6 +82,7 @@ export default class Tendbha { mysql_enable_disable: boolean; mysql_view: boolean; access_entry_edit: boolean; + tbinlogdumper_install: boolean; }; phase: string; phase_name: string; diff --git a/dbm-ui/frontend/src/services/model/ticket-flow-describe/TicketFlowDescribe.ts b/dbm-ui/frontend/src/services/model/ticket-flow-describe/TicketFlowDescribe.ts index e1deb3fd37..0ce45bf5b1 100644 --- a/dbm-ui/frontend/src/services/model/ticket-flow-describe/TicketFlowDescribe.ts +++ b/dbm-ui/frontend/src/services/model/ticket-flow-describe/TicketFlowDescribe.ts @@ -4,7 +4,7 @@ export default class TicketFlowDescribe { configs: { need_itsm: boolean; need_manual_confirm: boolean; - } + }; creator: string; editable: boolean; flow_desc: string[]; @@ -17,15 +17,13 @@ export default class TicketFlowDescribe { update_at: string; updater: string; - constructor(payload = {} as TicketFlowDescribe){ + constructor(payload = {} as TicketFlowDescribe) { this.configs = payload.configs; this.creator = payload.creator; this.editable = payload.editable; this.flow_desc = payload.flow_desc || []; this.group = payload.group; - this.permission = { - ticket_config_set: false - }; + this.permission = payload.permission; this.ticket_type = payload.ticket_type; this.ticket_type_display = payload.ticket_type_display; this.update_at = payload.update_at; @@ -35,5 +33,4 @@ export default class TicketFlowDescribe { get updateAtDisplay() { return utcDisplayTime(this.update_at); } - -} \ No newline at end of file +} diff --git a/dbm-ui/frontend/src/services/monitor.ts b/dbm-ui/frontend/src/services/monitor.ts index acb7a7bb1a..bc7e9ad6b8 100644 --- a/dbm-ui/frontend/src/services/monitor.ts +++ b/dbm-ui/frontend/src/services/monitor.ts @@ -195,7 +195,8 @@ export const getAlarmGroupList = (params: { bk_biz_id: number; db_type?: string; // 查询轮值规则列表 export const queryDutyRuleList = ( params: { db_type: string; limit: number; offset: number }, - payload = {} as IRequestPayload,) => + payload = {} as IRequestPayload, +) => http.get>('/apis/monitor/duty_rule/', params, payload).then((data) => ({ ...data, results: data.results.map((item) => new DutyRuleModel(item)), diff --git a/dbm-ui/frontend/src/services/permission.ts b/dbm-ui/frontend/src/services/permission.ts index 67e1e19207..a5aadf8b11 100644 --- a/dbm-ui/frontend/src/services/permission.ts +++ b/dbm-ui/frontend/src/services/permission.ts @@ -185,8 +185,8 @@ export const deleteAccount = (params: { bizId: number; account_id: number; accou /** * 添加账号规则 */ -export const createAccountRule = (params: AccountRule & { bizId: number }) => - http.post(`/apis/mysql/bizs/${params.bizId}/permission/account/add_account_rule/`, params); +export const createAccountRule = (params: AccountRule & { bk_biz_id: number }) => + http.post(`/apis/mysql/bizs/${params.bk_biz_id}/permission/account/add_account_rule/`, params); /** * 授权规则前置检查 diff --git a/dbm-ui/frontend/src/services/report.ts b/dbm-ui/frontend/src/services/report.ts index e1dc7fe9d2..c3e3e907ff 100644 --- a/dbm-ui/frontend/src/services/report.ts +++ b/dbm-ui/frontend/src/services/report.ts @@ -48,26 +48,26 @@ export const getmysqlCheckFullBackup = function (params: Record, pa }; // dbmon心跳超时检查报告 -export const getDbmonHeartbeat = function (params: Record) { - return http.get('/db_report/dbmon/heartbeat', params); +export const getDbmonHeartbeat = function (params: Record, payload = {} as IRequestPayload) { + return http.get('/db_report/dbmon/heartbeat', params, payload); }; // redis binlog检查报告 -export const getRedisCheckBinlogBackup = function (params: Record) { - return http.get('/db_report/redis_check/binlog_backup', params); +export const getRedisCheckBinlogBackup = function (params: Record, payload = {} as IRequestPayload) { + return http.get('/db_report/redis_check/binlog_backup', params, payload); }; // redis 全备检查报告 -export const getRedisCheckFullBackup = function (params: Record) { - return http.get('/db_report/redis_check/full_backup', params); +export const getRedisCheckFullBackup = function (params: Record, payload = {} as IRequestPayload) { + return http.get('/db_report/redis_check/full_backup', params, payload); }; // redis 孤立节点检查报告 -export const getRedisMetaCheckAloneInstance = function (params: Record) { - return http.get('/db_report/redis_meta_check/alone_instance', params); +export const getRedisMetaCheckAloneInstance = function (params: Record, payload = {} as IRequestPayload) { + return http.get('/db_report/redis_meta_check/alone_instance', params, payload); }; // 实例状态异常检查 -export const getRedisMetaCheckStatusAbnormal = function (params: Record) { - return http.get('/db_report/redis_meta_check/status_abnormal', params); +export const getRedisMetaCheckStatusAbnormal = function (params: Record, payload = {} as IRequestPayload) { + return http.get('/db_report/redis_meta_check/status_abnormal', params, payload); }; diff --git a/dbm-ui/frontend/src/services/source/configs.ts b/dbm-ui/frontend/src/services/source/configs.ts index f5eab27ad7..03c9f0612a 100644 --- a/dbm-ui/frontend/src/services/source/configs.ts +++ b/dbm-ui/frontend/src/services/source/configs.ts @@ -252,6 +252,7 @@ export function saveModulesDeployInfo(params: CreateModuleDeployInfo) { * 修改业务配置信息 */ interface BizConfDetailsUpdateParams { + name: string; meta_cluster_type: string; conf_type: string; bk_biz_id: number; diff --git a/dbm-ui/frontend/src/services/source/dbdirty.ts b/dbm-ui/frontend/src/services/source/dbdirty.ts index 8053dba86b..67e9913db8 100644 --- a/dbm-ui/frontend/src/services/source/dbdirty.ts +++ b/dbm-ui/frontend/src/services/source/dbdirty.ts @@ -28,7 +28,14 @@ export function getDirtyMachines(params: { limit: number; offset: number }) { }) .then((res) => ({ ...res, - results: res.results.map((item) => new DirtyMachinesModel(item)), + results: res.results.map( + (item) => + new DirtyMachinesModel( + Object.assign(item, { + permission: Object.assign(item.permission, res.permission), + }), + ), + ), })); } diff --git a/dbm-ui/frontend/src/services/source/monitorNoticeGroup.ts b/dbm-ui/frontend/src/services/source/monitorNoticeGroup.ts index f9b5dfe603..0b2392d1ba 100644 --- a/dbm-ui/frontend/src/services/source/monitorNoticeGroup.ts +++ b/dbm-ui/frontend/src/services/source/monitorNoticeGroup.ts @@ -88,3 +88,16 @@ export function getAlarmGroupNotifyList(params: { bk_biz_id: number; name?: stri }[] >(`${path}/get_msg_type/`, params); } + +export function getSimpleList(params: { bk_biz_id: number; db_type: string }) { + return http.get< + { + id: string; + name: string; + receivers: { + id: string; + type: string; + }[]; + }[] + >(`${path}/list_group_name/`, params); +} diff --git a/dbm-ui/frontend/src/services/source/ticket.tsx b/dbm-ui/frontend/src/services/source/ticket.tsx index 44e07ef673..f93b3cb73c 100644 --- a/dbm-ui/frontend/src/services/source/ticket.tsx +++ b/dbm-ui/frontend/src/services/source/ticket.tsx @@ -255,13 +255,13 @@ export function queryTicketFlowDescribe(params: { limit?: number, offset?: number, }) { - return http.get>(`${path}/query_ticket_flow_describe/`, params).then((data) => ({ - ...data, - results: data.results.map( + return http.get>(`${path}/query_ticket_flow_describe/`, params).then((result) => ({ + ...result, + results: result.results.map( (item) => new TicketFlowDescribeModel( Object.assign(item, { - permission: Object.assign({}, item.permission, data.permission), + permission: Object.assign({}, item.permission, result.permission), }), ), ), diff --git a/dbm-ui/frontend/src/views/influxdb-manage/instance-list/components/render-list/Index.vue b/dbm-ui/frontend/src/views/influxdb-manage/instance-list/components/render-list/Index.vue index 2cd21c72bd..58a1d8bbc3 100644 --- a/dbm-ui/frontend/src/views/influxdb-manage/instance-list/components/render-list/Index.vue +++ b/dbm-ui/frontend/src/views/influxdb-manage/instance-list/components/render-list/Index.vue @@ -34,22 +34,20 @@ - {{ $t('重启') }} - + - {{ $t('替换') }} - + {{ default: () => ( - {data.instance_address} - + ), append: () => ( <> diff --git a/dbm-ui/frontend/src/views/monitor-alarm-db/monitor-strategy/components/content/Index.vue b/dbm-ui/frontend/src/views/monitor-alarm-db/monitor-strategy/components/content/Index.vue index 90eaa87a40..56780d6236 100644 --- a/dbm-ui/frontend/src/views/monitor-alarm-db/monitor-strategy/components/content/Index.vue +++ b/dbm-ui/frontend/src/views/monitor-alarm-db/monitor-strategy/components/content/Index.vue @@ -12,38 +12,39 @@ -->