diff --git a/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue b/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue index 28f96c6a55..ee3961cf0d 100644 --- a/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue +++ b/apps/web/src/common/components/schedule-setting-form/ScheduleSettingForm.vue @@ -9,18 +9,25 @@ import { PFieldGroup, PRadioGroup, PRadio, PI, PSelectButton, PSelectDropdown, } from '@cloudforet/mirinae'; +import type { ServiceChannelScheduleType } from '@/schema/alert-manager/service-channel/type'; import { i18n } from '@/translations'; import type { ScheduleDayButtonType, ScheduleRadioType, - ScheduleType, ScheduleDayType, ScheduleForm, } from '@/common/components/schedule-setting-form/schedule-setting-form'; import { blue } from '@/styles/colors'; +interface Props { + scheduleForm?: ScheduleForm; +} + +const props = withDefaults(defineProps(), { + scheduleForm: undefined, +}); const emit = defineEmits<{(e: 'schedule-form', form: ScheduleForm): void; }>(); @@ -50,7 +57,7 @@ const generateHourlyTimeArray = () => range(0, 25).map((h) => ({ name: h, })); -const handleSelectScheduleType = (type: ScheduleType) => { +const handleSelectScheduleType = (type: ServiceChannelScheduleType) => { if (type === 'WEEK_DAY') { state.selectedDayButton = state.days.slice(0, 5).map((day) => day.name); } else if (type === 'ALL_DAY') { @@ -71,6 +78,14 @@ const handleSelectDropdown = (type: 'start' | 'end', value: number) => { } }; +watch(() => props.scheduleForm, (scheduleForm) => { + if (scheduleForm) { + state.selectedRadioIdx = state.scheduleTypeList.findIndex((item) => item.name === props.scheduleForm?.type); + state.selectedDayButton = props.scheduleForm?.days || []; + state.start = props.scheduleForm?.start || 9; + state.end = props.scheduleForm?.end || 18; + } +}, { immediate: true }); watch([() => state.selectedRadioIdx, () => state.selectedDayButton, () => state.start, () => state.end], ([selectedRadioIdx, selectedDayButton, start, end]) => { emit('schedule-form', { type: state.scheduleTypeList[selectedRadioIdx].name, diff --git a/apps/web/src/common/components/schedule-setting-form/schedule-setting-form.ts b/apps/web/src/common/components/schedule-setting-form/schedule-setting-form.ts index f462230330..85a541c2f7 100644 --- a/apps/web/src/common/components/schedule-setting-form/schedule-setting-form.ts +++ b/apps/web/src/common/components/schedule-setting-form/schedule-setting-form.ts @@ -1,10 +1,11 @@ import type { TranslateResult } from 'vue-i18n'; -export type ScheduleType = 'ALL_DAY' | 'WEEK_DAY' | 'CUSTOM'; +import type { ServiceChannelScheduleType } from '@/schema/alert-manager/service-channel/type'; + export type ScheduleDayType = 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT' | 'SUN'; export type ScheduleRadioType = { - name: ScheduleType; + name: ServiceChannelScheduleType; label: TranslateResult; }; export type ScheduleDayButtonType = { @@ -13,7 +14,7 @@ export type ScheduleDayButtonType = { }; export type ScheduleForm = { - type: ScheduleType; + type: ServiceChannelScheduleType; days: ScheduleDayType[]; start: number; end: number; diff --git a/apps/web/src/services/alert-manager-v2/components/NotificationsCreateForm.vue b/apps/web/src/services/alert-manager-v2/components/NotificationsCreateForm.vue index 1c03a23712..c772760758 100644 --- a/apps/web/src/services/alert-manager-v2/components/NotificationsCreateForm.vue +++ b/apps/web/src/services/alert-manager-v2/components/NotificationsCreateForm.vue @@ -1,24 +1,22 @@ diff --git a/apps/web/src/services/alert-manager-v2/components/ServiceDetailTabsWebhook.vue b/apps/web/src/services/alert-manager-v2/components/ServiceDetailTabsWebhook.vue index 05d733cb82..4ee6fc80bd 100644 --- a/apps/web/src/services/alert-manager-v2/components/ServiceDetailTabsWebhook.vue +++ b/apps/web/src/services/alert-manager-v2/components/ServiceDetailTabsWebhook.vue @@ -134,7 +134,7 @@ const handleClickCreateButton = () => { name: ALERT_MANAGER_ROUTE_V2.SERVICE.DETAIL.WEBHOOK.CREATE._NAME, })); }; -const handleSelectDropdownItem = (name) => { +const handleSelectDropdownItem = (name: WebhookModalType) => { modalState.visible = true; modalState.type = name; }; @@ -279,7 +279,7 @@ onUnmounted(() => { :selected-item="state.selectedItem" @close="handleCloseModal" /> - => { + const allDays: ScheduleDayType[] = ['MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT', 'SUN']; + const { days, start, end } = scheduleForm; + + const refinedDays = allDays.map((day) => ({ + is_scheduled: days.includes(day), + start, + end, + })); + + return zipObject(allDays, refinedDays) as Record; +}; diff --git a/apps/web/src/services/alert-manager-v2/types/alert-manager-type.ts b/apps/web/src/services/alert-manager-v2/types/alert-manager-type.ts index 91601d037e..bec0bd0b54 100644 --- a/apps/web/src/services/alert-manager-v2/types/alert-manager-type.ts +++ b/apps/web/src/services/alert-manager-v2/types/alert-manager-type.ts @@ -54,6 +54,7 @@ export type ProtocolInfo = { name: string; icon: string; }; +export type NotificationsModalType = 'UPDATE' | 'ENABLE' | 'DISABLE' | 'DELETE'; export type EscalationPolicyRadioType = { label: TranslateResult, diff --git a/packages/language-pack/console-translation-2.8.babel b/packages/language-pack/console-translation-2.8.babel index 7b72edaee4..ab75af0102 100644 --- a/packages/language-pack/console-translation-2.8.babel +++ b/packages/language-pack/console-translation-2.8.babel @@ -2053,6 +2053,27 @@ + + BASE_INFO_TITLE + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + CHANNEL_NAME false @@ -2179,6 +2200,111 @@ + + MODAL_DELETE_BUTTON + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + + + MODAL_DELETE_TITLE + false + + + + + + en-US + true + + + ja-JP + true + + + ko-KR + true + + + + + MODAL_DISABLE_TITLE + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + + + MODAL_ENABLE_TITLE + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + + + MODAL_UPDATE_TITLE + false + + + + + + en-US + false + + + ja-JP + false + + + ko-KR + false + + + MONDAY false diff --git a/packages/language-pack/en.json b/packages/language-pack/en.json index 80a6bd613c..789a2b6ea7 100644 --- a/packages/language-pack/en.json +++ b/packages/language-pack/en.json @@ -103,12 +103,18 @@ "ALL_MEMBER": "All Members in Service", "ALL_NOTIFICATIONS": "All Notifications", "ALL_TIME": "All Time", + "BASE_INFO_TITLE": "Base Information", "CHANNEL_NAME": "Channel Name", "CREATE_TITLE": "Create Notifications", "CUSTOM": "Custom", "DAY": "Day", "FRIDAY": "Friday", "HIGH_NOTIFICATIONS_ONLY": "High Urgency Notifications Only", + "MODAL_DELETE_BUTTON": "Delete this Notification", + "MODAL_DELETE_TITLE": "Are you sure you want to Delete Notifications Channel?", + "MODAL_DISABLE_TITLE": "Are you sure you want to disable selected Notification below?", + "MODAL_ENABLE_TITLE": "Are you sure you want to enable selected Notification below?", + "MODAL_UPDATE_TITLE": "Update Notification", "MONDAY": "Monday", "NOTIFICATIONS_CHANNEL": "Notifications Channel", "NOTIFICATION_POLICY": "Notification Policy", diff --git a/packages/language-pack/ja.json b/packages/language-pack/ja.json index 64a5491b53..d2155546a1 100644 --- a/packages/language-pack/ja.json +++ b/packages/language-pack/ja.json @@ -103,12 +103,18 @@ "ALL_MEMBER": "", "ALL_NOTIFICATIONS": "全ての通知", "ALL_TIME": "すべての時間", + "BASE_INFO_TITLE": "基本情報", "CHANNEL_NAME": "チャンネル名", "CREATE_TITLE": "", "CUSTOM": "カスタム", "DAY": "日", "FRIDAY": "", "HIGH_NOTIFICATIONS_ONLY": "", + "MODAL_DELETE_BUTTON": "", + "MODAL_DELETE_TITLE": "この通知チャネルを削除しますか?", + "MODAL_DISABLE_TITLE": "", + "MODAL_ENABLE_TITLE": "", + "MODAL_UPDATE_TITLE": "", "MONDAY": "", "NOTIFICATIONS_CHANNEL": "通知チャネル", "NOTIFICATION_POLICY": "通知ポリシー", diff --git a/packages/language-pack/ko.json b/packages/language-pack/ko.json index 30f080de6c..ae614254df 100644 --- a/packages/language-pack/ko.json +++ b/packages/language-pack/ko.json @@ -103,12 +103,18 @@ "ALL_MEMBER": "", "ALL_NOTIFICATIONS": "모든 알림 받기", "ALL_TIME": "모든 시간", + "BASE_INFO_TITLE": "기본 정보", "CHANNEL_NAME": "채널명", "CREATE_TITLE": "", "CUSTOM": "기간 선택", "DAY": "일", "FRIDAY": "", "HIGH_NOTIFICATIONS_ONLY": "", + "MODAL_DELETE_BUTTON": "", + "MODAL_DELETE_TITLE": "이 알림 채널을 삭제하시겠습니까?", + "MODAL_DISABLE_TITLE": "", + "MODAL_ENABLE_TITLE": "", + "MODAL_UPDATE_TITLE": "", "MONDAY": "", "NOTIFICATIONS_CHANNEL": "알림 채널", "NOTIFICATION_POLICY": "알림 정책",