From 84ec88f92383119b35828f7f07d109b19560d671 Mon Sep 17 00:00:00 2001 From: Kenneth Date: Thu, 11 Nov 2021 14:41:04 -0600 Subject: 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 Change-Id: I0086086dec5f49f7cb4305813b3c5ce0348368b5 --- src/views/Settings/DateTime/DateTime.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3