Skip to content

Commit

Permalink
fix(frontend): 修复告警组编辑失败问题 #8446
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves authored and hLinx committed Dec 9, 2024
1 parent 23fe718 commit 6059373
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 14 additions & 1 deletion dbm-ui/frontend/src/services/source/monitorNoticeGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,30 @@ export function insertAlarmGroup(params: {
}

/**
* 编辑告警组
* 编辑告警组(全量)
*/
export function updateAlarmGroup(params: {
name: string;
bk_biz_id: number;
receivers: NoticGroupModel['receivers'][];
details: NoticGroupModel['details'];
id: number;
}) {
return http.put(`${path}/${params.id}/`, params);
}

/**
* 编辑告警组(部分)
*/
export function patchAlarmGroup(params: {
name: string;
receivers: NoticGroupModel['receivers'][];
details: NoticGroupModel['details'];
id: number;
}) {
return http.patch(`${path}/${params.id}/`, params);
}

/**
* 删除告警组
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
import { useI18n } from 'vue-i18n';
import { useRequest } from 'vue-request';

import { getAlarmGroupList, insertAlarmGroup, updateAlarmGroup } from '@services/source/monitorNoticeGroup';
import { getAlarmGroupList, insertAlarmGroup, patchAlarmGroup } from '@services/source/monitorNoticeGroup';

import { useBeforeClose } from '@hooks';

Expand Down Expand Up @@ -145,7 +145,7 @@
receivers: [] as string[],
});

const loading = computed(() => insertLoading.value || updateLoading.value);
const loading = computed(() => insertLoading.value || patchLoading.value);
const editDisabled = computed(() => props.type === 'edit' && props.detailData.is_built_in);

const sidesliderTitle = computed(() => `${titleMap[props.type]}`);
Expand All @@ -157,7 +157,7 @@
},
});

const { loading: updateLoading, run: updateAlarmGroupRun } = useRequest(updateAlarmGroup, {
const { loading: patchLoading, run: patchAlarmGroupRun } = useRequest(patchAlarmGroup, {
manual: true,
onSuccess() {
runSuccess(t('编辑成功'));
Expand Down Expand Up @@ -190,7 +190,7 @@
};

if (props.type === 'edit') {
updateAlarmGroupRun({
patchAlarmGroupRun({
...params,
id: props.detailData.id,
});
Expand Down

0 comments on commit 6059373

Please sign in to comment.