From a799b9167b1fb2ca8561b02d7e4d1010d9af858d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=89=E1=85=B3=E1=86=BC=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Wed, 8 Jan 2025 21:56:14 +0900 Subject: [PATCH 1/2] fix: update double check modal tableItems logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 이승연 --- .../components/UserGroupDeleteDoubleCheckModal.vue | 14 +++++++++----- .../iam/components/UserManagementStatusModal.vue | 11 ++++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/web/src/services/iam/components/UserGroupDeleteDoubleCheckModal.vue b/apps/web/src/services/iam/components/UserGroupDeleteDoubleCheckModal.vue index 5c69a0951b..6c2b39456e 100644 --- a/apps/web/src/services/iam/components/UserGroupDeleteDoubleCheckModal.vue +++ b/apps/web/src/services/iam/components/UserGroupDeleteDoubleCheckModal.vue @@ -90,9 +90,9 @@ const fetchDeleteUserGroup = async (params: UserGroupDeleteUserGroupParameters) watch([() => storeState.serviceList, () => storeState.selectedUserGroupList], ([nv_service_list, nv_user_group_list]) => { if (nv_service_list) { const list: any = []; - Object.values(nv_service_list).forEach((service) => { - if (service && service.data && service.data.members) { - nv_user_group_list.forEach((userGroup) => { + nv_user_group_list.forEach((userGroup) => { + Object.values(nv_service_list).forEach((service) => { + if (service && service.data && service.data.members) { if (Object.keys(service.data.members).includes('USER_GROUP')) { if (service.data.members.USER_GROUP.includes(userGroup.user_group_id)) { list.push({ @@ -107,8 +107,12 @@ watch([() => storeState.serviceList, () => storeState.selectedUserGroupList], ([ description: userGroup.description, }); } - }); - } + } + }); + list.push({ + user_group: userGroup.name, + description: userGroup.description, + }); }); if (list.length > 0) { tableState.filteredItems = Object.values( diff --git a/apps/web/src/services/iam/components/UserManagementStatusModal.vue b/apps/web/src/services/iam/components/UserManagementStatusModal.vue index 7f16e69bcb..7709d3845c 100644 --- a/apps/web/src/services/iam/components/UserManagementStatusModal.vue +++ b/apps/web/src/services/iam/components/UserManagementStatusModal.vue @@ -165,9 +165,9 @@ const disableUser = async (userId?: string): Promise => { watch([() => storeState.serviceList, () => storeState.selectedUsers], ([nv_service_list, nv_selected_users]) => { if (nv_service_list) { const list: UserListItemType[] | (UserListItemType & { service: string; })[] = []; - Object.values(nv_service_list).forEach((service) => { - if (service && service.data && service.data.members) { - nv_selected_users.forEach((selectedUser) => { + nv_selected_users.forEach((selectedUser) => { + Object.values(nv_service_list).forEach((service) => { + if (service && service.data && service.data.members) { if (Object.keys(service.data.members).includes('USER')) { if (selectedUser.user_id && service.data.members.USER.includes(selectedUser.user_id)) { list.push({ @@ -178,8 +178,9 @@ watch([() => storeState.serviceList, () => storeState.selectedUsers], ([nv_servi } else { list.push(selectedUser); } - }); - } + } + }); + list.push(selectedUser); }); if (list.length > 0) { state.filteredUniqueItems = Object.values(list.reduce((acc, cur) => { From 752c391bd1bf5623211b8455ff1d16f6abfd49a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=89=E1=85=B3=E1=86=BC=E1=84=8B?= =?UTF-8?q?=E1=85=A7=E1=86=AB?= Date: Wed, 8 Jan 2025 22:30:59 +0900 Subject: [PATCH 2/2] feat: update api-connection with alertManagerV2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 이승연 --- .../escalation-policy-reference-store.ts | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/apps/web/src/store/reference/escalation-policy-reference-store.ts b/apps/web/src/store/reference/escalation-policy-reference-store.ts index dedbb4d28b..51c54cc316 100644 --- a/apps/web/src/store/reference/escalation-policy-reference-store.ts +++ b/apps/web/src/store/reference/escalation-policy-reference-store.ts @@ -6,14 +6,19 @@ import { defineStore } from 'pinia'; import { SpaceConnector } from '@cloudforet/core-lib/space-connector'; import type { ListResponse } from '@/schema/_common/api-verbs/list'; -import type { EscalationPolicyListParameters } from '@/schema/monitoring/escalation-policy/api-verbs/list'; -import type { EscalationPolicyModel } from '@/schema/monitoring/escalation-policy/model'; +import type { EscalationPolicyListParameters } from '@/schema/alert-manager/escalation-policy/api-verbs/list'; +import type { EscalationPolicyModel } from '@/schema/alert-manager/escalation-policy/model'; +import type { EscalationPolicyListParameters as EscalationPolicyListParametersV1 } from '@/schema/monitoring/escalation-policy/api-verbs/list'; +import type { EscalationPolicyModel as EscalationPolicyModelV1 } from '@/schema/monitoring/escalation-policy/model'; +import { useDomainStore } from '@/store/domain/domain-store'; import type { ReferenceLoadOptions, ReferenceItem, ReferenceMap, ReferenceTypeInfo, } from '@/store/reference/type'; import { useUserStore } from '@/store/user/user-store'; +import config from '@/lib/config'; + import ErrorHandler from '@/common/composables/error/errorHandler'; @@ -25,6 +30,7 @@ let lastLoadedTime = 0; export const useEscalationPolicyReferenceStore = defineStore('reference-escalation-policy', () => { const userStore = useUserStore(); + const domainStore = useDomainStore(); const state = reactive({ items: null as EscalationPolicyReferenceMap | null, }); @@ -54,13 +60,22 @@ export const useEscalationPolicyReferenceStore = defineStore('reference-escalati const referenceMap: EscalationPolicyReferenceMap = {}; try { - const response = await SpaceConnector.clientV2.monitoring.escalationPolicy.list>({ - query: { - only: ['escalation_policy_id', 'name', 'resource_group', 'project_id'], - }, - }, { timeout: 3000 }); - - response.results?.forEach((escalationPolicyInfo: EscalationPolicyModel): void => { + const isAlertManagerVersionV2 = (config.get('ADVANCED_SERVICE')?.alert_manager_v2 ?? []).includes(domainStore.state.domainId); + const fetcher = isAlertManagerVersionV2 + ? SpaceConnector.clientV2.alertManager.escalationPolicy.list>({ + query: { + only: ['escalation_policy_id', 'name', 'service_id'], + }, + }) + : SpaceConnector.clientV2.monitoring.escalationPolicy.list>({ + query: { + only: ['escalation_policy_id', 'name', 'resource_group', 'project_id'], + }, + }); + + const response = await fetcher; + + response.results?.forEach((escalationPolicyInfo: EscalationPolicyModel|EscalationPolicyModelV1): void => { referenceMap[escalationPolicyInfo.escalation_policy_id] = { key: escalationPolicyInfo.escalation_policy_id, label: escalationPolicyInfo.name,