diff --git a/apps/web/src/services/alert-manager-v2/components/ServiceDetailDeleteModal.vue b/apps/web/src/services/alert-manager-v2/components/ServiceDetailDeleteModal.vue new file mode 100644 index 0000000000..d0508aeb66 --- /dev/null +++ b/apps/web/src/services/alert-manager-v2/components/ServiceDetailDeleteModal.vue @@ -0,0 +1,62 @@ + + + diff --git a/apps/web/src/services/alert-manager-v2/components/ServiceDetailEditModal.vue b/apps/web/src/services/alert-manager-v2/components/ServiceDetailEditModal.vue new file mode 100644 index 0000000000..db2e7d4a6d --- /dev/null +++ b/apps/web/src/services/alert-manager-v2/components/ServiceDetailEditModal.vue @@ -0,0 +1,106 @@ + + + diff --git a/apps/web/src/services/alert-manager-v2/components/ServiceDetailHeader.vue b/apps/web/src/services/alert-manager-v2/components/ServiceDetailHeader.vue index 5e383e0ae2..feace90ff9 100644 --- a/apps/web/src/services/alert-manager-v2/components/ServiceDetailHeader.vue +++ b/apps/web/src/services/alert-manager-v2/components/ServiceDetailHeader.vue @@ -1,23 +1,37 @@ @@ -42,8 +64,9 @@ const handleSelectDropdownMenu = () => {
@@ -116,10 +133,6 @@ const handleSelectDropdownMenu = () => { @apply flex items-center text-label-sm; padding-left: 2.5rem; gap: 0.5rem; - .info { - @apply flex items-center text-gray-700; - gap: 0.125rem; - } } } diff --git a/apps/web/src/services/alert-manager-v2/stores/service-detail-page-store.ts b/apps/web/src/services/alert-manager-v2/stores/service-detail-page-store.ts index 52430bc0c3..3809221f8a 100644 --- a/apps/web/src/services/alert-manager-v2/stores/service-detail-page-store.ts +++ b/apps/web/src/services/alert-manager-v2/stores/service-detail-page-store.ts @@ -4,7 +4,11 @@ import { defineStore } from 'pinia'; import { SpaceConnector } from '@cloudforet/core-lib/space-connector'; +import type { ListResponse } from '@/schema/_common/api-verbs/list'; +import type { ServiceDeleteParameters } from '@/schema/alert-manager/service/api-verbs/delete'; import type { ServiceGetParameters } from '@/schema/alert-manager/service/api-verbs/get'; +import type { ServiceListParameters } from '@/schema/alert-manager/service/api-verbs/list'; +import type { ServiceUpdateParameters } from '@/schema/alert-manager/service/api-verbs/update'; import { NOTIFICATION_URGENCY, RECOVERY_MODE } from '@/schema/alert-manager/service/constants'; import type { ServiceModel } from '@/schema/alert-manager/service/model'; @@ -17,6 +21,7 @@ interface ServiceFormStoreState { loading: boolean; currentTab: ServiceDetailTabsType; serviceInfo: ServiceModel; + serviceList: ServiceModel[]; } export const useServiceDetailPageStore = defineStore('page-service-detail', () => { @@ -24,6 +29,7 @@ export const useServiceDetailPageStore = defineStore('page-service-detail', () = loading: false, currentTab: SERVICE_DETAIL_TABS.OVERVIEW, serviceInfo: {} as ServiceModel, + serviceList: [] as ServiceModel[], }); const getters = reactive({ @@ -68,6 +74,35 @@ export const useServiceDetailPageStore = defineStore('page-service-detail', () = state.loading = false; } }, + async updateServiceDetailData(name: string) { + try { + state.serviceInfo = await SpaceConnector.clientV2.alertManager.service.update({ + service_id: getters.serviceInfo.service_id, + name, + }); + } catch (e) { + ErrorHandler.handleError(e, true); + state.serviceInfo = {} as ServiceModel; + } + }, + async deleteServiceDetailData() { + try { + await SpaceConnector.clientV2.alertManager.service.delete({ + service_id: getters.serviceInfo.service_id, + }); + } catch (e) { + ErrorHandler.handleError(e, true); + } + }, + async fetchServiceList() { + try { + const { results } = await SpaceConnector.clientV2.alertManager.service.list>(); + state.serviceList = results || []; + } catch (e) { + ErrorHandler.handleError(e); + state.serviceList = []; + } + }, }; return {