From 08dc1bbcd4ba4923ee43360155d23b6645ce6a37 Mon Sep 17 00:00:00 2001 From: Vishesh Date: Mon, 26 Feb 2024 19:10:01 +0530 Subject: [PATCH] UI: cleanup arrangement of instance schedule modal dialog (#8620) * polish modal for instance schedule * fixup --- ui/public/locales/en.json | 1 + ui/src/views/compute/InstanceSchedules.vue | 247 ++++++++++++++------- 2 files changed, 162 insertions(+), 86 deletions(-) diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 39e12a9517e..05850327d6a 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -579,6 +579,7 @@ "label.creating.iprange": "Creating IP ranges", "label.credit": "Credit", "label.cron": "Cron expression", +"label.cron.mode": "Cron mode", "label.crosszones": "Cross zones", "label.currency": "Currency", "label.current": "Current", diff --git a/ui/src/views/compute/InstanceSchedules.vue b/ui/src/views/compute/InstanceSchedules.vue index 41694adce33..67e1f6ed749 100644 --- a/ui/src/views/compute/InstanceSchedules.vue +++ b/ui/src/views/compute/InstanceSchedules.vue @@ -22,8 +22,9 @@ style="width: 100%; margin-bottom: 10px" @click="showAddModal" :loading="loading" - :disabled="!('createVMSchedule' in $store.getters.apis)"> - {{ $t('label.schedule.add') }} + :disabled="!('createVMSchedule' in $store.getters.apis)" + > + {{ $t('label.schedule.add') }} + @refresh="this.fetchData" + /> + showQuickJumper + > @@ -60,66 +63,68 @@ :title="$t('label.schedule')" :maskClosable="false" :closable="true" - :footer="null" - @cancel="closeModal"> + @cancel="closeModal" + @ok="submitForm" + > - + v-ctrl-enter="submitForm" + > + + v-focus="true" + /> - + - + :disabled="isEdit" + > + {{ $t(action.label) }} - + - - - -
- - - - - -
-
- -
- - - + :loading="fetching" + > + {{ opt.name || opt.description }} - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + - + - + - - - - - -
- - {{ $t('label.cancel') }} - - - {{ $t('label.ok') }} - -
@@ -191,7 +261,12 @@ import { mixinForm } from '@/utils/mixin' import { timeZone } from '@/utils/timezone' import debounce from 'lodash/debounce' import cronstrue from 'cronstrue/i18n' -import moment from 'moment-timezone' +import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' +import timezone from 'dayjs/plugin/timezone' + +dayjs.extend(utc) +dayjs.extend(timezone) export default { name: 'InstanceSchedules', @@ -323,8 +398,8 @@ export default { this.isEdit = true Object.assign(this.form, schedule) // Some weird issue when we directly pass in the moment with tz object - this.form.startDate = moment(moment(schedule.startdate).tz(schedule.timezone).format(this.pattern)) - this.form.endDate = schedule.enddate ? moment(moment(schedule.enddate).tz(schedule.timezone).format(this.pattern)) : '' + this.form.startDate = dayjs(schedule.startdate).tz(schedule.timezone) + this.form.endDate = schedule.enddate ? dayjs(dayjs(schedule.enddate).tz(schedule.timezone)) : null this.showAddModal() }, showAddModal () { @@ -431,7 +506,7 @@ export default { this.updateColumns() }, generateHumanReadableSchedule (schedule) { - return cronstrue.toString(schedule, { locale: this.$i18n.locale, throwExceptionOnParseError: false }) + return cronstrue.toString(schedule, { locale: this.$i18n.locale, throwExceptionOnParseError: false, verbose: true }) }, updateColumns () { this.columns = []