File tree Expand file tree Collapse file tree 2 files changed +32
-3
lines changed
Expand file tree Collapse file tree 2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 646646 "recurringIntervalMessage" : " Run once every day | Run once every {0} days" ,
647647 "affectedMonitorsDescription" : " Select monitors that are affected by current maintenance" ,
648648 "affectedStatusPages" : " Show this maintenance message on selected status pages" ,
649- "atLeastOneMonitor " : " Select at least one affected monitor " ,
649+ "noMonitorsSelectedWarning " : " You are creating a maintenance without any affected monitors. Are you sure you want to continue? " ,
650650 "passwordNotMatchMsg" : " The repeat password does not match." ,
651651 "notificationDescription" : " Notifications must be assigned to a monitor to function." ,
652652 "keywordDescription" : " Search keyword in plain HTML or JSON response. The search is case-sensitive." ,
Original file line number Diff line number Diff line change 253253 </div >
254254 </div >
255255 </form >
256+
257+ <Confirm ref =" confirmNoMonitors" :yes-text =" $t('Yes')" :no-text =" $t('No')" @yes =" doSubmit" >
258+ {{ $t("noMonitorsSelectedWarning") }}
259+ </Confirm >
256260 </div >
257261 </transition >
258262</template >
@@ -262,11 +266,13 @@ import VueMultiselect from "vue-multiselect";
262266import Datepicker from " @vuepic/vue-datepicker" ;
263267import { timezoneList } from " ../util-frontend" ;
264268import cronstrue from " cronstrue/i18n" ;
269+ import Confirm from " ../components/Confirm.vue" ;
265270
266271export default {
267272 components: {
268273 VueMultiselect,
269- Datepicker
274+ Datepicker,
275+ Confirm
270276 },
271277
272278 data () {
@@ -539,11 +545,34 @@ export default {
539545 }
540546 },
541547
548+ /**
549+ * Check if maintenance has monitors or status pages assigned
550+ * @returns {boolean} True if maintenance has monitors or status pages
551+ */
552+ hasMonitorsOrStatusPages () {
553+ const hasMonitors = this .affectedMonitors .length > 0 ;
554+ const hasStatusPages = this .showOnAllPages || this .selectedStatusPages .length > 0 ;
555+ return hasMonitors || hasStatusPages;
556+ },
557+
558+ /**
559+ * Handle form submission - show confirmation if no monitors selected
560+ * @returns {void}
561+ */
562+ submit () {
563+ // If creating/cloning and no monitors selected, show confirmation
564+ if ((this .isAdd || this .isClone ) && this .affectedMonitors .length === 0 ) {
565+ this .$refs .confirmNoMonitors .show ();
566+ return ;
567+ }
568+ this .doSubmit ();
569+ },
570+
542571 /**
543572 * Create new maintenance
544573 * @returns {Promise<void>}
545574 */
546- async submit () {
575+ async doSubmit () {
547576 this .processing = true ;
548577
549578 if (this .isAdd || this .isClone ) {
You can’t perform that action at this time.
0 commit comments