Repository: louislam/uptime-kuma
File: src/pages/EditMaintenance.vue (Vue)

Code before:

        onMonitorSelect(selectedOption) {
            if (selectedOption.id === "select-all") {
                this.affectedMonitors = this.affectedMonitors.filter((m) => m.id !== "select-all");

                if (this.affectedMonitorsAllSelected) {
                    this.affectedMonitors = [];
                } else {
                    this.affectedMonitors = this.affectedMonitorsOptions.slice();
                }
            }
        },

        onMonitorRemove(removedOption) {
            if (removedOption.id === "select-all") {
                this.affectedMonitors = this.affectedMonitors.filter((m) => m.id !== "select-all");
            }
        },

        /**
         * Handle form submission - show confirmation if no monitors selected
         * @returns {void}
         */
        submit() {
            // If creating/cloning and no monitors selected, show confirmation
            if (!this.hasMonitors) {
                this.$refs.confirmNoMonitors.show();
                return;
            }
            this.doSubmit();
        },

        /**
         * Create new maintenance
         * @returns {Promise<void>}
         */
        async doSubmit() {
            this.processing = true;

            if (!this.hasMonitors && !this.hasStatusPages) {
                this.$root.toastError(this.$t("noMonitorsOrStatusPagesSelectedError"));
                this.processing = false;
                return;
            }

            if (this.isAdd || this.isClone) {
                this.$root.addMaintenance(this.maintenance, async (res) => {
                    if (res.ok) {
                        await this.addMonitorMaintenance(res.maintenanceID, async () => {
                            await this.addMaintenanceStatusPage(res.maintenanceID, () => {
                                this.$root.toastRes(res);

Review comment (suggestion):
```suggestion
            // While unusual, not requiring montiors can allow showing on status pages if a "currently unmonitored" service goes down
            if (!this.hasMonitors && this.hasStatusPages) {
```

Code after:

        onMonitorSelect(selectedOption) {
            if (selectedOption.id === "select-all") {
                this.affectedMonitors = this.affectedMonitors.filter((m) => m.id !== "select-all");

                if (this.affectedMonitorsAllSelected) {
                    this.affectedMonitors = [];
                } else {
                    this.affectedMonitors = this.affectedMonitorsOptions.slice();
                }
            }
        },

        onMonitorRemove(removedOption) {
            if (removedOption.id === "select-all") {
                this.affectedMonitors = this.affectedMonitors.filter((m) => m.id !== "select-all");
            }
        },

        /**
         * Handle form submission - show confirmation if no monitors selected
         * @returns {void}
         */
        submit() {
            // While unusual, not requiring montiors can allow showing on status pages if a "currently unmonitored" service goes down
            if (!this.hasMonitors && this.hasStatusPages) {
                this.$refs.confirmNoMonitors.show();
                return;
            }
            this.doSubmit();
        },

        /**
         * Create new maintenance
         * @returns {Promise<void>}
         */
        async doSubmit() {
            this.processing = true;

            if (!this.hasMonitors && !this.hasStatusPages) {
                this.$root.toastError(this.$t("noMonitorsOrStatusPagesSelectedError"));
                this.processing = false;
                return;
            }

            if (this.isAdd || this.isClone) {
                this.$root.addMaintenance(this.maintenance, async (res) => {
                    if (res.ok) {
                        await this.addMonitorMaintenance(res.maintenanceID, async () => {
                            await this.addMaintenanceStatusPage(res.maintenanceID, () => {
                                this.$root.toastRes(res);