diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-08 11:15:03 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-08 11:15:03 +0300 |
commit | cba773f8572ae8d0f074d8be94fb6b83d2f1e602 (patch) | |
tree | 45af6ca588bd8aaefcb59d8682038443927ec9e8 | |
parent | a86422319aab83a18c19961c97a78c69238c5567 (diff) | |
download | webui-vue-cba773f8572ae8d0f074d8be94fb6b83d2f1e602.tar.xz |
SILABMC-304: fx time upd
-rw-r--r-- | src/views/_sila/Overview/DateTime/DateTime.vue | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/views/_sila/Overview/DateTime/DateTime.vue b/src/views/_sila/Overview/DateTime/DateTime.vue index e4bc89b7..ce2c3244 100644 --- a/src/views/_sila/Overview/DateTime/DateTime.vue +++ b/src/views/_sila/Overview/DateTime/DateTime.vue @@ -323,12 +323,6 @@ export default { }, }, watch: { - ntpServers() { - this.setNtpValues(); - }, - manualDate() { - this.emitChange(); - }, bmcTime() { this.form.manual.date = this.$options.filters.formatDate( this.$store.getters['global/bmcTime'] @@ -341,28 +335,29 @@ export default { created() { this.startLoader(); this.$store.dispatch('dateTime/getNtpData').finally(() => { - this.setNtpValues(); + this.getSettings(); this.endLoader(); this.isBusy = false; }); }, methods: { - 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() { + getSettings() { 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(); @@ -406,18 +401,13 @@ export default { this.$store .dispatch('dateTime/updateDateTime', dateTimeForm) .then((success) => { - if (isNTPEnabled) { - this.$store.dispatch('dateTime/getNtpData').finally(() => { - this.setNtpValues(); - this.endLoader(); - this.successToast(success); - }); - } else { + this.$store.dispatch('dateTime/getNtpData').finally(() => { this.$store.dispatch('global/getBmcTime').finally(() => { + this.getSettings(); this.endLoader(); this.successToast(success); }); - } + }); }) .catch(({ message }) => this.errorToast(message)) .finally(() => { |