summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth <kennyneedsmilky@gmail.com>2021-11-11 23:41:04 +0300
committerDixsie Wolmers <dixsiew@gmail.com>2021-12-23 06:41:08 +0300
commit84ec88f92383119b35828f7f07d109b19560d671 (patch)
tree2eb9a5206126405a2bbfda3da3cf3b792b59b909
parent799bcd3fb476c7a0c38a4779aa91f59a7c931c6a (diff)
downloadwebui-vue-84ec88f92383119b35828f7f07d109b19560d671.tar.xz
Fixed empty string in NTP server array
The UI should not patch an empty string to the NTP server array as this is not valid per redfish spec. Filtered out empty strings from the array. After that, re-render the ui and re-set ntp values. Signed-off-by: Kenneth Fullbright <kennyneedsmilky@gmail.com> Change-Id: I0086086dec5f49f7cb4305813b3c5ce0348368b5
-rw-r--r--src/views/Settings/DateTime/DateTime.vue14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/views/Settings/DateTime/DateTime.vue b/src/views/Settings/DateTime/DateTime.vue
index e62e3444..f5e063d1 100644
--- a/src/views/Settings/DateTime/DateTime.vue
+++ b/src/views/Settings/DateTime/DateTime.vue
@@ -356,11 +356,23 @@ export default {
} else {
dateTimeForm.ntpProtocolEnabled = true;
- dateTimeForm.ntpServersArray = [
+ const ntpArray = [
this.form.ntp.firstAddress,
this.form.ntp.secondAddress,
this.form.ntp.thirdAddress,
];
+
+ // Filter the ntpArray to remove empty strings,
+ // per Redfish spec there should be no empty strings or null on the ntp array.
+ const ntpArrayFiltered = ntpArray.filter((x) => x);
+
+ dateTimeForm.ntpServersArray = [...ntpArrayFiltered];
+
+ [this.ntpServers[0], this.ntpServers[1], this.ntpServers[2]] = [
+ ...dateTimeForm.ntpServersArray,
+ ];
+
+ this.setNtpValues();
}
this.$store