Commit 0c1caf7c by Johannes Stelzer

Added working error messages to logging and jmx view to prevent such confusion as in #72

parent cbafd81c
......@@ -15,17 +15,16 @@
*/
'use strict';
module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
module.exports = function ($scope, $modal, application, ApplicationJMX) {
$scope.error = null;
$scope.domains = [];
ApplicationJMX.list(application)
.then(function (domains) {
$scope.domains = domains;
})
.catch(function (response) {
$scope.error = response.error;
$log.error(response.stacktrace);
}, function (response) {
$scope.error = response;
$scope.errorWhileListing = true;
});
$scope.readAllAttr = function (bean) {
......@@ -39,10 +38,8 @@ module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
bean.attributes[name].jsonValue = JSON.stringify(response.value[
name], null, ' ');
}
})
.catch(function (response) {
}, function (response) {
bean.error = response.error;
$log.error(response.stacktrace);
});
};
......@@ -52,7 +49,6 @@ module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
.catch(
function (response) {
attr.error = response.error;
$log.error(response.stacktrace);
});
};
......@@ -65,8 +61,7 @@ module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
function (response) {
$scope.invocation.state = 'success';
$scope.invocation.result = response.value;
})
.catch(function (response) {
}, function (response) {
$scope.invocation.state = 'error';
$scope.invocation.error = response.error;
$scope.invocation.stacktrace = response.stacktrace;
......@@ -97,8 +92,7 @@ module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
})
.result.then(function (chosenOp) {
$scope.prepareInvoke(bean, name, chosenOp);
})
.catch(function () {
}, function () {
$scope.invocation = null;
});
} else {
......@@ -122,8 +116,7 @@ module.exports = function ($scope, $modal, $log, application, ApplicationJMX) {
})
.result.then(function () {
$scope.invoke();
})
.catch(function () {
}, function () {
$scope.invocation = null;
});
}
......
......@@ -15,27 +15,25 @@
*/
'use strict';
module.exports = function ($scope, application, ApplicationLogging, $log) {
module.exports = function ($scope, application, ApplicationLogging) {
$scope.loggers = [];
$scope.filteredLoggers = [];
$scope.limit = 10;
function findLogger(loggers, name) {
var findLogger = function (loggers, name) {
for (var i in loggers) {
if (loggers[i].name === name) {
return loggers[i];
}
}
}
};
$scope.setLogLevel = function (name, level) {
ApplicationLogging.setLoglevel(application, name, level)
.then(function () {
$scope.reload(name);
})
.catch(function (response) {
$scope.error = response.error;
$log.error(response.stacktrace);
}, function (response) {
$scope.error = response;
$scope.reload(name);
});
};
......@@ -72,12 +70,10 @@ module.exports = function ($scope, application, ApplicationLogging, $log) {
findLogger($scope.loggers, name)
.level = level;
}
})
.catch(function (responses) {
}, function (responses) {
for (var j in responses) {
if (responses[j].error != null) {
$scope.error = responses[j].error;
$log.error(responses[j].stacktrace);
$scope.error = responses[j];
break;
}
}
......@@ -101,9 +97,8 @@ module.exports = function ($scope, application, ApplicationLogging, $log) {
$scope.$watch('limit', function () {
$scope.refreshLevels();
});
})
.catch(function (response) {
$scope.error = response.error;
$log.error(response.stacktrace);
}, function (response) {
$scope.error = response;
$scope.errorWhileListing = true;
});
};
......@@ -28,14 +28,16 @@ module.exports = function ($resource, $http) {
var getCapabilities = function(application) {
application.capabilities = {};
$http.get('api/applications/' + application.id + '/configprops').success(function(configprops) {
application.capabilities.logfile = isEndpointPresent('logfileEndpoint', configprops);
application.capabilities.activiti = isEndpointPresent('processEngineEndpoint', configprops);
application.capabilities.restart = isEndpointPresent('restartEndpoint', configprops);
application.capabilities.refresh = isEndpointPresent('refreshEndpoint', configprops);
application.capabilities.pause = isEndpointPresent('pauseEndpoint', configprops);
application.capabilities.resume = isEndpointPresent('resumeEndpoint', configprops);
});
if (application.managementUrl) {
$http.get('api/applications/' + application.id + '/configprops').success(function(configprops) {
application.capabilities.logfile = isEndpointPresent('logfileEndpoint', configprops);
application.capabilities.activiti = isEndpointPresent('processEngineEndpoint', configprops);
application.capabilities.restart = isEndpointPresent('restartEndpoint', configprops);
application.capabilities.refresh = isEndpointPresent('refreshEndpoint', configprops);
application.capabilities.pause = isEndpointPresent('pauseEndpoint', configprops);
application.capabilities.resume = isEndpointPresent('resumeEndpoint', configprops);
});
}
};
var Application = $resource(
......
......@@ -15,7 +15,7 @@
*/
'use strict';
module.exports = function ($rootScope, Abbreviator, jolokia) {
module.exports = function ($rootScope, Abbreviator, jolokia, $q) {
this.list = function (app) {
return jolokia.list('api/applications/' + app.id + '/jolokia/')
.then(function (response) {
......@@ -76,7 +76,7 @@ module.exports = function ($rootScope, Abbreviator, jolokia) {
return domains;
}, function (response) {
return response;
return $q.reject(response);
});
};
......
......@@ -15,6 +15,7 @@
*/
'use strict';
var angular = require('angular');
module.exports = function ($q) {
var outer = this;
var j4p = new Jolokia();
......@@ -45,6 +46,13 @@ module.exports = function ($q) {
if (responses.length >= requests.length) {
deferred.reject(responses);
}
},
ajaxError: function (response) {
hasError = true;
responses.push(angular.fromJson(response.responseText));
if (responses.length >= requests.length) {
deferred.reject(responses, response.status);
}
}
});
......@@ -63,6 +71,9 @@ module.exports = function ($q) {
},
error: function (response) {
deferred.reject(response);
},
ajaxError: function (response) {
deferred.reject(angular.fromJson(response.responseText), response.status);
}
});
......
......@@ -17,10 +17,10 @@
<div class="navbar header--application-urls">
<div class="navbar-inner">
<div class="container-fluid">
<ul class="nav" style="width: 100%;">
<li style="width: 33%; text-align: center;"><a href="{{ application.serviceUrl }}" title="Service URL"><i class="icon-home" ></i> {{ application.serviceUrl }}</a></li>
<li style="width: 33%; text-align: center;"><a href="{{ application.healthUrl }}" title="Health URL"><i class="icon-heart" ></i> {{ application.healthUrl }}</a></li>
<li style="width: 33%; text-align: center;"><a href="{{ application.managementUrl }}" title="Management URL"><i class="icon-wrench"></i> {{ application.managementUrl }}</a></li>
<ul class="nav">
<li ng-if="application.healthUrl" style=" text-align: center;"><a href="{{ application.healthUrl }}" title="Health URL"><i class="icon-heart" ></i> {{ application.healthUrl }}</a></li>
<li ng-if="application.serviceUrl" style="text-align: center;"><a href="{{ application.serviceUrl }}" title="Service URL"><i class="icon-home" ></i> {{ application.serviceUrl }}</a></li>
<li ng-if="application.managementUrl" style="text-align: center;"><a href="{{ application.managementUrl }}" title="Management URL"><i class="icon-wrench"></i> {{ application.managementUrl }}</a></li>
</ul>
</div>
</div>
......
<div class="container content">
<div class="alert alert-error" ng-if="error">
<b>Error:</b> {{ error }}
<div ng-if="errorWhileListing">
<p>To make the JMX section work you need to make the /jolokia-endpoint accessible.<br/>
Include the jolokia-core.jar in your spring-boot-application:
<pre>&lt;dependency&gt;
&lt;groupId>org.jolokia&lt;/groupId&gt;
&lt;artifactId>jolokia-core&lt;/artifactId&gt;
&lt;/dependency&gt;</pre></p>
</div>
<accordion close-others="true">
<pre class="alert alert-error" ng-if="error"><b>Error:</b><br/>{{ error | json }}</pre>
<accordion ng-if="domains" close-others="true">
<accordion-group ng-repeat="domain in domains track by domain.name">
<accordion-heading>
<small class="muted">Domain</small> {{domain.name}}
......
<div class="container content">
<form ng-init="showPackageLoggers = false">
<div class="input-prepend input-append">
<button class="btn" title="Show package-level loggers" ng-class="{'btn-inverse': showPackageLoggers}" ng-model="showPackageLoggers" btn-checkbox ><i class="icon-folder-open" ng-class="{'icon-white': showPackageLoggers}"></i></button>
<input placeholder="Filter by name ..." class="span10" type="search" ng-model="filterLogger.name" />
<button class="btn" title="reload list" ng-click="reload()"><i class="icon-refresh"></i></button>
<span title="filtered / total" class="add-on">{{ filteredLoggers.length }}/{{ loggers.length }}</span>
</div>
</form>
<table class="table table-hover">
<tbody>
<tr ng-repeat="logger in (filteredLoggers = (loggers | classNameLoggerOnly:!showPackageLoggers | filter:filterLogger) ) | limitTo: limit track by logger.name">
<td>
{{ logger.name }}
<div class="btn-group pull-right">
<label class="btn btn-small" ng-class="{'active btn-danger': logger.level== 'TRACE'}" ng-click="setLogLevel(logger.name, 'TRACE')">TRACE</label>
<label class="btn btn-small" ng-class="{'active btn-warning': logger.level=='DEBUG'}" ng-click="setLogLevel(logger.name, 'DEBUG')">DEBUG</label>
<label class="btn btn-small" ng-class="{'active btn-info': logger.level=='INFO'}" ng-click="setLogLevel(logger.name, 'INFO')">INFO</label>
<label class="btn btn-small" ng-class="{'active btn-success': logger.level == 'WARN'}" ng-click="setLogLevel(logger.name, 'WARN')">WARN</label>
<label class="btn btn-small" ng-class="{'active btn-primary': logger.level == 'ERROR'}" ng-click="setLogLevel(logger.name, 'ERROR')">ERROR</label>
<label class="btn btn-small" ng-class="{'active btn-inverse': logger.level == 'OFF'}" ng-click="setLogLevel(logger.name, 'OFF')">OFF</label>
</div>
</td>
</tr>
<tr ng-show="limit < loggers.length" >
<td>
<button class="btn btn-link btn-block" ng-click="limit = limit + 10">show more</button>
</td>
</tr>
<tr ng-show="limit < loggers.length" >
<td>
<button class="btn btn-link btn-block" ng-click="limit = loggers.length">show all</button>
</td>
</tr>
</tbody>
</table>
<div ng-if="errorWhileListing">
<p>To make the logging section work you need to make the /jolokia-endpoint accessible.<br/>
Include the jolokia-core.jar in your spring-boot-application:
<pre>&lt;dependency&gt;
&lt;groupId>org.jolokia&lt;/groupId&gt;
&lt;artifactId>jolokia-core&lt;/artifactId&gt;
&lt;/dependency&gt;</pre></p>
<p>Please note that the logging section currently only works with Logback.<br/>
To make the section work with Logback please activate the JMXConfigurator in your <b>logback.xml</b>:
<pre>&lt;configuration&gt;
&lt;include resource="org/springframework/boot/logging/logback/base.xml"/&gt;
&lt;jmxConfigurator/&gt;
&lt;/configuration&gt;</pre></p>
</div>
<pre class="alert alert-error" ng-if="error"><b>Error:</b><br/>{{ error | json }}</pre>
<div ng-show="loggers">
<form ng-init="showPackageLoggers = false">
<div class="input-prepend input-append">
<button class="btn" title="Show package-level loggers" ng-class="{'btn-inverse': showPackageLoggers}" ng-model="showPackageLoggers" btn-checkbox ><i class="icon-folder-open" ng-class="{'icon-white': showPackageLoggers}"></i></button>
<input placeholder="Filter by name ..." class="span10" type="search" ng-model="filterLogger.name" />
<button class="btn" title="reload list" ng-click="reload()"><i class="icon-refresh"></i></button>
<span title="filtered / total" class="add-on">{{ filteredLoggers.length }}/{{ loggers.length }}</span>
</div>
</form>
<table class="table table-hover">
<tbody>
<tr ng-repeat="logger in (filteredLoggers = (loggers | classNameLoggerOnly:!showPackageLoggers | filter:filterLogger) ) | limitTo: limit track by logger.name">
<td>
{{ logger.name }}
<div class="btn-group pull-right">
<label class="btn btn-small" ng-class="{'active btn-danger': logger.level== 'TRACE'}" ng-click="setLogLevel(logger.name, 'TRACE')">TRACE</label>
<label class="btn btn-small" ng-class="{'active btn-warning': logger.level=='DEBUG'}" ng-click="setLogLevel(logger.name, 'DEBUG')">DEBUG</label>
<label class="btn btn-small" ng-class="{'active btn-info': logger.level=='INFO'}" ng-click="setLogLevel(logger.name, 'INFO')">INFO</label>
<label class="btn btn-small" ng-class="{'active btn-success': logger.level == 'WARN'}" ng-click="setLogLevel(logger.name, 'WARN')">WARN</label>
<label class="btn btn-small" ng-class="{'active btn-primary': logger.level == 'ERROR'}" ng-click="setLogLevel(logger.name, 'ERROR')">ERROR</label>
<label class="btn btn-small" ng-class="{'active btn-inverse': logger.level == 'OFF'}" ng-click="setLogLevel(logger.name, 'OFF')">OFF</label>
</div>
</td>
</tr>
<tr ng-show="limit < loggers.length" >
<td>
<button class="btn btn-link btn-block" ng-click="limit = limit + 10">show more</button>
</td>
</tr>
<tr ng-show="limit < loggers.length" >
<td>
<button class="btn btn-link btn-block" ng-click="limit = loggers.length">show all</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment