Skip to content

Commit

Permalink
feat(frontend): 告警通知优化 TencentBlueKing#8366
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves committed Dec 3, 2024
1 parent 6d77842 commit 98fa3a6
Show file tree
Hide file tree
Showing 10 changed files with 1,548 additions and 3 deletions.
12 changes: 12 additions & 0 deletions dbm-ui/frontend/src/layout/components/ConfigManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@
{{ t('告警组') }}
</span>
</BkMenuItem>
<BkMenuItem
key="PlatMonitorNotice"
v-db-console="'bizConfigManage.alarmGroup'">
<template #icon>
<DbIcon type="note" />
</template>
<span
v-overflow-tips.right
class="text-overflow">
{{ t('告警通知') }}
</span>
</BkMenuItem>
</BkMenuGroup>
<BkMenuGroup :name="t('单据配置')">
<BkMenuItem
Expand Down
12 changes: 12 additions & 0 deletions dbm-ui/frontend/src/layout/components/PlatformManage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
{{ t('全局策略') }}
</span>
</BkMenuItem>
<BkMenuItem
key="PlatMonitorNotice"
v-db-console="'bizConfigManage.alarmGroup'">
<template #icon>
<DbIcon type="note" />
</template>
<span
v-overflow-tips.right
class="text-overflow">
{{ t('告警通知') }}
</span>
</BkMenuItem>
</FunController>
<!-- <FunController
controller-id="notice_group"
Expand Down
7 changes: 6 additions & 1 deletion dbm-ui/frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1644,5 +1644,10 @@
"分片集群": "Sharded Cluster",
"主从管理": "HA Management",
"DB 重命名:database 重命名": "DB Rename:database rename",
"这行勿动!新增翻译请在上一行添加!": ""
"这行勿动!新增翻译请在上一行添加!": "",
"默认通知": "",
"告警阶段": "",
"种类型": "",
"平台配置为各业务的初始化配置,如在业务下做了修改,则全局设置失效": "",
"通知升级": ""
}
7 changes: 6 additions & 1 deletion dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3668,5 +3668,10 @@
"请选择Module": "请选择Module",
"安装 Module任务提交成功": "安装 Module任务提交成功",
"仅允许同一管控区域的集群一起安装module": "仅允许同一管控区域的集群一起安装module",
"这行勿动!新增翻译请在上一行添加!": ""
"这行勿动!新增翻译请在上一行添加!": "",
"默认通知": "默认通知",
"告警阶段": "告警阶段",
"种类型": "种类型",
"平台配置为各业务的初始化配置,如在业务下做了修改,则全局设置失效": "平台配置为各业务的初始化配置,如在业务下做了修改,则全局设置失效",
"通知升级": "通知升级"
}
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/types/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
import('vue')
}
120 changes: 120 additions & 0 deletions dbm-ui/frontend/src/views/monitor-alarm-plat/monitor-notice/Index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!--
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available.
*
* Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License athttps://opensource.org/licenses/MIT
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for
* the specific language governing permissions and limitations under the License.
-->

<template>
<SmartAction>
<BkLoading :loading="isLoading">
<DbTab
v-model:active="activeTab"
:exclude="[DBTypes.RIAK]" />
<BkAlert
class="ml-24 mr-24 mt-20"
closable
theme="info"
:title="t('平台配置为各业务的初始化配置,如在业务下做了修改,则全局设置失效')" />
<div class="password-policy-content">
<RenderContent :db-type="activeTab" />
<RenderContentTwo :db-type="activeTab" />
</div>
</BkLoading>
<template #action>
<AuthButton
action-id="password_policy_set"
class="mr-8"
:loading="isSubmitting"
theme="primary"
@click="handleSubmit">
{{ t('保存') }}
</AuthButton>
<DbPopconfirm
:confirm-handler="handleReset"
:content="t('重置将会恢复默认设置的内容')"
:title="t('确认重置')">
<BkButton>
{{ t('重置') }}
</BkButton>
</DbPopconfirm>
</template>
</SmartAction>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import { updatePolicy } from '@services/source/monitor';

import { DBTypes } from '@common/const';

import DbTab from '@components/db-tab/Index.vue';

import { messageSuccess } from '@utils';

import RenderContent from './components/Content.vue';
import RenderContentTwo from './components/Content2.vue';

const route = useRoute();
const { t } = useI18n();

const activeTab = ref<DBTypes>(route.query.db_type as DBTypes);

const isSubmitting = ref(false);

const { run: runUpdatePolicy, loading: isLoading } = useRequest(updatePolicy, {
manual: true,
onSuccess: (updateResult) => {
if (updateResult.bkm_id) {
messageSuccess(t('保存成功'));
// emits('success');
// isShow.value = false;
}
},
});

const handleSubmit = async () => {
// await formRef.value.validate();
// const testRules = [
// infoRule.value ? infoValueRef.value.getValue() : undefined,
// warnRule.value ? warnValueRef.value.getValue() : undefined,
// dangerRule.value ? dangerValueRef.value.getValue() : undefined,
// ];
// const reqParams = {
// targets: props.data.targets,
// custom_conditions: props.data.custom_conditions,
// test_rules: testRules.filter((item) => item && item.config.length !== 0),
// notify_rules: formModel.notifyRules,
// notify_groups: props.data.notify_groups,
// };
runUpdatePolicy();
};

const handleReset = () => {
// updatePasswordPolicyRunAsync({
// ...passwordPolicyData,
// rule: {
// ...formData,
// symbols_allowed: _.uniq(formData.symbols_allowed.split('')).join(''),
// },
// reset: true,
// }).then(() => {
// messageSuccess(t('重置成功'));
// fetchData();
// });
};
</script>

<style lang="less">
.password-policy-content {
padding: 16px 20px;
}
</style>
Loading

0 comments on commit 98fa3a6

Please sign in to comment.