From 5576c673db5fe41289095006b1a1370391e6f563 Mon Sep 17 00:00:00 2001 From: Vitalii Lysak Date: Thu, 8 Sep 2022 11:25:40 +0300 Subject: Revert "SILABMC-304: fx time upd" This reverts commit cba773f8572ae8d0f074d8be94fb6b83d2f1e602. --- src/views/_sila/Overview/DateTime/DateTime.vue | 36 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'src/views') diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index ce2c3244..e4bc89b7 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -323,6 +323,12 @@ export default { }, }, watch: { + ntpServers() { + this.setNtpValues(); + }, + manualDate() { + this.emitChange(); + }, bmcTime() { this.form.manual.date = this.$options.filters.formatDate( this.$store.getters['global/bmcTime'] @@ -335,29 +341,28 @@ export default { created() { this.startLoader(); this.$store.dispatch('dateTime/getNtpData').finally(() => { - this.getSettings(); + this.setNtpValues(); this.endLoader(); this.isBusy = false; }); }, methods: { - getSettings() { + emitChange() { + if (this.$v.$invalid) return; + this.$v.$reset(); //reset to re-validate on blur + this.$emit('change', { + manualDate: this.manualDate ? new Date(this.manualDate) : null, + }); + }, + setNtpValues() { this.form.configurationSelected = this.isNtpProtocolEnabled ? 'ntp' : 'manual'; - [ this.form.ntp.firstAddress = '', this.form.ntp.secondAddress = '', this.form.ntp.thirdAddress = '', ] = [this.ntpServers[0], this.ntpServers[1], this.ntpServers[2]]; - - this.form.manual.date = this.$options.filters.formatDate( - this.$store.getters['global/bmcTime'] - ); - this.form.manual.time = this.$options.filters - .formatTime(this.$store.getters['global/bmcTime']) - .slice(0, 5); }, submitForm() { this.$v.$touch(); @@ -401,13 +406,18 @@ export default { this.$store .dispatch('dateTime/updateDateTime', dateTimeForm) .then((success) => { - this.$store.dispatch('dateTime/getNtpData').finally(() => { + if (isNTPEnabled) { + this.$store.dispatch('dateTime/getNtpData').finally(() => { + this.setNtpValues(); + this.endLoader(); + this.successToast(success); + }); + } else { this.$store.dispatch('global/getBmcTime').finally(() => { - this.getSettings(); this.endLoader(); this.successToast(success); }); - }); + } }) .catch(({ message }) => this.errorToast(message)) .finally(() => { -- cgit v1.2.3