Button to remove NTP server
Change-Id: I58a3a894c192fafb551e07302b107bcd776e4901
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/app/configuration/controllers/date-time-controller.html b/app/configuration/controllers/date-time-controller.html
index 491ab56..31c62ab 100644
--- a/app/configuration/controllers/date-time-controller.html
+++ b/app/configuration/controllers/date-time-controller.html
@@ -16,11 +16,16 @@
</label>
</div>
<div class="row column date-time__ntp-servers-wrap">
- <fieldset class="date-time__ntp-servers" ng-repeat="server in ntp.servers track by $index">
- <label for="ntp-server{{$index+1}}">NTP Server Address {{$index+1}}</label>
+ <fieldset class="date-time__ntp-servers" ng-repeat="server in ntp.servers track by $index">
+ <label for="ntp-server{{$index+1}}">NTP Server Address {{$index+1}}</label>
+ <div class="inline">
<input id="ntp-server{{$index+1}}" type="text" ng-readonly="time_mode != 'NTP'" ng-model="server" ng-blur="ntp.servers[$index] = server" set-focus-on-new-input/>
- </fieldset>
- <button type="button" class="btn-primary inline" ng-click="addNTPField()">Add new NTP server</button>
+ </div>
+ <button class="date-time__dns-remove inline" ng-click="removeNTPField($index)">Remove</button>
+ </fieldset>
+ </div>
+ <div class="row column date-time__ntp-servers-wrap">
+ <button type="button" class="btn-primary block" ng-click="addNTPField()">Add new NTP server</button>
</div>
<div class="row column">
<label class="control-radio" for="manual-time">Manually set date and time
diff --git a/app/configuration/controllers/date-time-controller.js b/app/configuration/controllers/date-time-controller.js
index 02752fe..5a1f8d2 100644
--- a/app/configuration/controllers/date-time-controller.js
+++ b/app/configuration/controllers/date-time-controller.js
@@ -133,6 +133,10 @@
$scope.ntp.servers.push('');
};
+ $scope.removeNTPField = function(index) {
+ $scope.ntp.servers.splice(index, 1);
+ };
+
function setNTPServers() {
// Remove any empty strings from the array. Important because we add an
// empty string to the end so the user can add a new NTP server, if the
diff --git a/app/configuration/styles/date-time.scss b/app/configuration/styles/date-time.scss
index d5d9b40..cba0515 100644
--- a/app/configuration/styles/date-time.scss
+++ b/app/configuration/styles/date-time.scss
@@ -21,10 +21,8 @@
}
}
.date-time__ntp-servers{
- padding-bottom: .6em;
padding-top: .6em;
padding-left: 0em;
- width: 300px;
}
.date-time__ntp-servers-wrap{
padding-bottom: 1em;
@@ -55,4 +53,13 @@
margin: .5em;
}
}
+ .date-time__dns-remove {
+ color: $medblue;
+ height: 2.1em;
+ opacity: 1;
+ margin-left: 1em;
+ &:hover {
+ cursor: pointer;
+ }
+ }
}