Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: apply qa issue #5569

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import ServiceDetailTabsSettingsEscalationPolicyFormModal
from '@/services/alert-manager/components/ServiceDetailTabsSettingsEscalationPolicyFormModal.vue';
import ServiceDetailTabsSettingsEscalationPolicyStateModal
from '@/services/alert-manager/components/ServiceDetailTabsSettingsEscalationPolicyStateModal.vue';
import { ALERT_STATUS_FILTERS } from '@/services/alert-manager/constants/alert-table-constant';
import {
ALERT_EXCEL_FIELDS,
ESCALATION_POLICY_MANAGEMENT_TABLE_FIELDS, ESCALATION_POLICY_MANAGEMENT_TABLE_KEY_ITEMS_SETS,
Expand Down Expand Up @@ -99,11 +100,10 @@ const { queryTags } = queryTagHelper;
const initSelectedEscalationPolicy = () => {
state.selectIndex = state.items.findIndex((item) => item.escalation_policy_id === storeState.selectedEscalationPolicyId);
};
const getConnectChannelCount = (rules: EscalationPolicyRulesType[]): number => {
const allChannels = rules.flatMap((item) => item.channels);
const uniqueChannels = new Set(allChannels);
return uniqueChannels.size;
};
const getConnectChannelCount = (rules: EscalationPolicyRulesType[]): { step: number; connectedChannelCnt: number; }[] => rules.map((rule, stepIdx) => ({
step: stepIdx + 1,
connectedChannelCnt: rule.channels.length,
}));
const handleActionModal = (type: EscalationPolicyModalType) => {
modalState.visible = true;
modalState.type = type;
Expand Down Expand Up @@ -251,8 +251,24 @@ onUnmounted(() => {
<template #col-repeat-format="{value}">
{{ value?.count || 0 }}
</template>
<template #col-finish_condition-format="{value}">
{{ ALERT_STATUS_FILTERS[value][0] + ALERT_STATUS_FILTERS[value].slice(1).toLowerCase() }}
</template>
<template #col-rules-format="{value}">
{{ getConnectChannelCount(value) }}
<div class="flex gap-3">
<div v-for="channelInfo in getConnectChannelCount(value)"
:key="channelInfo.step"
>
<p-badge badge-type="solid-outline"
style-type="gray500"
>
STEP {{ channelInfo.step }}
</p-badge>
<span>
{{ channelInfo.connectedChannelCnt }}
</span>
</div>
</div>
</template>
<template #col-created_at-format="{value}">
{{ iso8601Formatter(value, storeState.timezone) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const ESCALATION_POLICY_MANAGEMENT_TABLE_FIELDS: DataTableFieldType[] = [
{ name: 'name', label: 'Name' },
{ name: 'repeat', label: 'Repeat Time' },
{ name: 'rules', label: 'Connected Channel' },
{ name: 'finish_condition', label: 'Finish Condition' },
{ name: 'created_at', label: 'Created' },
];
export const ESCALATION_POLICY_MANAGEMENT_TABLE_KEY_ITEMS_SETS: KeyItemSet[] = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const fetchAssignToUserGroup = async (params: UserGroupAddUsersParameters) => {
/* Watcher */
watch([() => userPageGetters.selectedUsers, () => userPageState.users], ([nv_selected_users, nv_user_list]) => {
if (nv_selected_users.length === 1 && nv_user_list.length > 0) {
if (nv_selected_users.length === 1 && nv_user_list.length > 0 && Object.keys(nv_selected_users[0]).includes('userGroup')) {
state.excludedSelectedIds = nv_selected_users[0]?.user_group.map((userGroup) => userGroup.user_group_id);
}
}, { deep: true, immediate: true });
Expand Down
Loading