diff options
author | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-08 11:25:40 +0300 |
---|---|---|
committer | Vitalii Lysak <v.lysak@dunice.net> | 2022-09-08 11:25:40 +0300 |
commit | 5576c673db5fe41289095006b1a1370391e6f563 (patch) | |
tree | 5a74674f2ee470f12afa9142678830f4adfb097c | |
parent | cba773f8572ae8d0f074d8be94fb6b83d2f1e602 (diff) | |
download | webui-vue-5576c673db5fe41289095006b1a1370391e6f563.tar.xz |
Revert "SILABMC-304: fx time upd"
This reverts commit cba773f8572ae8d0f074d8be94fb6b83d2f1e602.
-rw-r--r-- | src/views/_sila/Overview/DateTime/DateTime.vue | 36 |
1 files changed, 23 insertions, 13 deletions
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(() => { |