From 6f4939d1b17ad276c47a5cd1cd39182070cc9ea6 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Tue, 23 Aug 2022 10:55:17 +0300 Subject: SILABMC-265|266|267|272: fx date&time logic --- src/views/_sila/Overview/DateTime/DateTime.vue | 32 +++++++++++--------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index a3714787..1b3d4ae4 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -272,7 +272,7 @@ export default { return { locale: this.$store.getters['global/languagePreference'], form: { - configurationSelected: 'manual', + configurationSelected: '', manual: { date: '', time: '', @@ -355,8 +355,8 @@ export default { }, created() { this.startLoader(); - this.setNtpValues(); this.$store.dispatch('dateTime/getNtpData').finally(() => { + this.setNtpValues(); this.endLoader(); this.isBusy = false; }); @@ -416,33 +416,27 @@ export default { const ntpArrayFiltered = ntpArray.filter((x) => x); dateTimeForm.ntpServersArray = [...ntpArrayFiltered]; - - [this.ntpServers[0], this.ntpServers[1], this.ntpServers[2]] = [ - ...dateTimeForm.ntpServersArray, - ]; - - this.setNtpValues(); } this.$store .dispatch('dateTime/updateDateTime', dateTimeForm) .then((success) => { - this.successToast(success); - if (!isNTPEnabled) return; - // Shift address up if second address is empty - // to avoid refreshing after delay when updating NTP - if (!this.form.ntp.secondAddress && this.form.ntp.thirdAddres) { - this.form.ntp.secondAddress = this.form.ntp.thirdAddres; - this.form.ntp.thirdAddress = ''; + if (isNTPEnabled) { + this.$store.dispatch('dateTime/getNtpData').finally(() => { + this.setNtpValues(); + this.endLoader(); + this.successToast(success); + }); + } else { + this.$store.dispatch('global/getBmcTime').finally(() => { + this.endLoader(); + this.successToast(success); + }); } }) - .then(() => { - this.$store.dispatch('global/getBmcTime'); - }) .catch(({ message }) => this.errorToast(message)) .finally(() => { this.$v.form.$reset(); - this.endLoader(); }); }, getUtcDate(date, time) { -- cgit v1.2.3