Skip to content
This repository was archived by the owner on Jun 29, 2018. It is now read-only.

Commit 4805d54

Browse files
author
Johannes Stelzer
committed
Add support for /refresh endpoint
closes #69
1 parent 5b709a7 commit 4805d54

File tree

3 files changed

+42
-16
lines changed

3 files changed

+42
-16
lines changed

spring-boot-admin-server-ui/app/js/controller/apps/environmentCtrl.js

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
module.exports = function ($scope, application) {
1919
$scope.application = application;
20-
$scope.override = { values: [{key: '', value: '' }], error: null};
20+
$scope.overrides = { values: [{key: '', value: '' }], error: null};
2121

2222
var toArray = function(map) {
2323
var array = [];
@@ -71,37 +71,53 @@ module.exports = function ($scope, application) {
7171
$scope.onChangeOverrideItem = function(item) {
7272
getValue(item);
7373

74-
if ($scope.override.values[$scope.override.values.length - 1].key) {
75-
$scope.override.values.push({key: '', value: '' });
74+
if ($scope.overrides.values[$scope.overrides.values.length - 1].key) {
75+
$scope.overrides.values.push({key: '', value: '' });
7676
}
7777
};
7878

79-
$scope.overrideValue = function() {
79+
$scope.override = function() {
8080
var map = {};
81-
for (var i = 0; i < $scope.override.values.length; i++) {
82-
if ($scope.override.values[i].key) {
83-
map[$scope.override.values[i].key] = $scope.override.values[i].value;
81+
for (var i = 0; i < $scope.overrides.values.length; i++) {
82+
if ($scope.overrides.values[i].key) {
83+
map[$scope.overrides.values[i].key] = $scope.overrides.values[i].value;
8484
}
8585
}
8686

87-
$scope.override.error = null;
87+
$scope.overrides.error = null;
8888
application.setEnv(map).success(function () {
89-
$scope.override = { values: [{key: '', value: '' }], error: null};
89+
$scope.overrides = { values: [{key: '', value: '' }], error: null, changes: null};
9090
$scope.reload();
9191
})
9292
.error(function (error) {
93-
$scope.override.error = error;
93+
$scope.overrides.error = error;
94+
$scope.overrides.changes = null;
9495
$scope.reload();
9596
});
9697
};
9798

9899
$scope.reset = function() {
99-
$scope.override.error = null;
100+
$scope.overrides.error = null;
101+
$scope.overrides.changes = null;
100102
application.resetEnv().success(function () {
101103
$scope.reload();
102104
})
103105
.error(function (error) {
104-
$scope.override.error = error;
106+
$scope.overrides.error = error;
107+
$scope.reload();
108+
});
109+
110+
};
111+
112+
$scope.refresh = function() {
113+
$scope.overrides.error = null;
114+
$scope.overrides.changes = null;
115+
application.refresh().success(function (changes) {
116+
$scope.overrides.changes = changes;
117+
$scope.reload();
118+
})
119+
.error(function (error) {
120+
$scope.overrides.error = error;
105121
$scope.reload();
106122
});
107123

spring-boot-admin-server-ui/app/js/service/application.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ module.exports = function ($resource, $http) {
8484
return $http.post('api/applications/' + this.id + '/env/reset');
8585
};
8686

87+
Application.prototype.refresh = function () {
88+
return $http.post('api/applications/' + this.id + '/refresh');
89+
};
90+
8791
Application.prototype.getThreadDump = function () {
8892
return $http.get('api/applications/' + this.id + '/dump');
8993
};

spring-boot-admin-server-ui/app/views/apps/environment.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<td style="word-break: break-all;" >{{ key }}</td>
2626
<td style="word-break: break-all;" >{{ value }}</td>
2727
</tr>
28-
<tr ng-repeat="item in override.values">
28+
<tr ng-repeat="item in overrides.values">
2929
<td >
3030
<input type="text" class="input-xlarge" list="allkeys" placeholder="key" ng-model="item.key" ng-change="onChangeOverrideItem(item)"></input>
3131
<datalist id="allkeys">
@@ -41,11 +41,17 @@
4141
<tfoot>
4242
<tr>
4343
<td colspan="2">
44+
<div class="control-group pull-left">
45+
<button class="btn btn-info" ng-click="refresh()">Refresh beans</button>
46+
</div>
4447
<div class="control-group pull-right">
45-
<button class="btn btn-warning" ng-click="overrideValue()">Overrride Values!</button>
46-
<button class="btn" ng-click="reset()">Reset Values!</button>
48+
<button class="btn btn-warning" ng-click="override()">Overrride values!</button>
49+
<button class="btn" ng-click="reset()">Reset overrides</button>
50+
</div>
51+
<div class="alert alert-info" ng-if="overrides.changes">
52+
<pre>{{ override.changes }}</pre>
4753
</div>
48-
<div class="alert alert-error" ng-if="override.error">
54+
<div class="alert alert-error" ng-if="overrides.error">
4955
<b>Error:</b> {{ override.error }}
5056
</div>
5157
</td>

0 commit comments

Comments
 (0)