summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitalii Lysak <v.lysak@dunice.net>2022-08-23 10:55:17 +0300
committerVitalii Lysak <v.lysak@dunice.net>2022-08-23 10:55:17 +0300
commit6f4939d1b17ad276c47a5cd1cd39182070cc9ea6 (patch)
tree1f432f0c39ab12a63ee96d275d0d6274726573b4
parentcdead9a0bd1a3584c5637cbbbfa477c08d70e5fe (diff)
downloadwebui-vue-6f4939d1b17ad276c47a5cd1cd39182070cc9ea6.tar.xz
SILABMC-265|266|267|272: fx date&time logic
-rw-r--r--src/views/_sila/Overview/DateTime/DateTime.vue32
1 files 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) {