Update DNS Servers on "Save settings"
"Nameservers" is called "DNS Servers" on the GUI. Update the
property if it has changed when the user hits Save settings
and confirms.
Had difficulties getting the DNS input fields to update the
interface.Nameservers array. The
"ng-blur="interface.Nameservers[$index] = dns" solution is from:
https://stackoverflow.com/questions/13714884/difficulty-with-ng-model-ng-repeat-and-inputs
Tested: Changed some DNS Servers on a Witherspoon.
Change-Id: Ib9c4be044d0725ac50e57e2733c3dc2ef8e29053
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index d7e4e7f..05b7c0c 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -247,6 +247,23 @@
return response.data;
});
},
+ setNameservers: function(interfaceName, dnsServers) {
+ return $http({
+ method: 'PUT',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/network/' + interfaceName +
+ '/attr/Nameservers',
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ },
+ withCredentials: true,
+ data: JSON.stringify({'data': dnsServers})
+ })
+ .then(function(response) {
+ return response.data;
+ });
+ },
deleteIPV4: function(interfaceName, networkID) {
return $http({
method: 'POST',