Commit e93935bb by Johannes Edmeier

Add option to download heapdump

parent 567daf41
......@@ -18,7 +18,6 @@
module.exports = function ($rootScope, $scope, $state, ApplicationViews, NotificationFilters) {
'ngInject';
$scope.applications = $rootScope.applications;
$scope.notificationFilters = null;
$scope.notificationFiltersSupported = false;
......
......@@ -59,13 +59,30 @@ module.config(function ($stateProvider) {
});
});
module.run(function ($rootScope, $state, $filter, Notification, Application, MainViews) {
module.run(function ($rootScope, $state, $filter, $sce, $http, Notification, Application, MainViews, ApplicationViews) {
MainViews.register({
title: 'Applications',
state: 'applications-list',
order: -100
});
ApplicationViews.register({
order: 110,
title: $sce.trustAsHtml('<i class="fa fa-cubes fa-fw"></i>Heapdump'),
href: '/api/applications/{id}/heapdump',
target: '_blank',
show: function (application) {
if (!application.managementUrl || !application.statusInfo.status || application.statusInfo.status === 'OFFLINE') {
return false;
}
return $http.head('api/applications/' + application.id + '/heapdump').then(function () {
return true;
}).catch(function () {
return false;
});
}
});
$rootScope.applications = [];
$rootScope.indexOfApplication = function (id) {
......
......@@ -31,9 +31,14 @@ module.exports = function ($state, $q) {
$q.when(!view.show || view.show(application)).then(function (result) {
if (result) {
var appView = angular.copy(view);
appView.href = $state.href(view.state, {
id: application.id
});
if (view.state) {
appView.href = $state.href(view.state, {
id: application.id
});
} else {
appView.href = view.href.replace('{id}', application.id);
appView.target = '_blank';
}
applicationViews.push(appView);
applicationViews.sort(function (v1, v2) {
......
......@@ -13,7 +13,7 @@
</div>
<div class="container-fluid">
<ul class="nav nav-tabs">
<li ng-repeat="view in views" ng-class="{active: $state.includes(view.state)}"><a ng-href="{{view.href}}"><span ng-bind-html="view.title"></span></a></li>
<li ng-repeat="view in views" ng-class="{active: $state.includes(view.state)}"><a ng-href="{{view.href}}" target="{{view.target}}"><span ng-bind-html="view.title"></span></a></li>
</ul>
</div>
</div>
......
......@@ -30,14 +30,14 @@
<td>
<div class="pull-right">
<div class="btn-group">
<a ng-if="application.capabilities.logfile && application.managementUrl && application.statusInfo.status != null && application.statusInfo.status != 'OFFLINE'" target="_blank" class="btn btn-success" ng-href="{{application.capabilities.logfile ? 'api/applications/' + application.id + '/logfile' :''}}"><i class="fa fa-file-text-o"></i> Log</a>
<a ng-if="views.length > 0" ng-href="{{views[0].href}}" class="btn btn-success" ng-bind-html="views[0].title"></a>
<a ng-if="application.capabilities.logfile && application.statusInfo.status != null && application.statusInfo.status != 'OFFLINE'" target="_blank" class="btn btn-success" ng-href="{{application.capabilities.logfile ? 'api/applications/' + application.id + '/logfile' :''}}"><i class="fa fa-file-text-o"></i> Log</a>
<a ng-if="views.length > 0" ng-href="{{views[0].href}}" target="{{views[0].target}}" class="btn btn-success" ng-bind-html="views[0].title"></a>
<a class="btn btn-success dropdown-toggle" data-toggle="dropdown" ng-if="views.length > 1">
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu">
<li ng-repeat="view in views.slice(1)">
<a ng-href="{{view.href}}" ng-bind-html="view.title"></a>
<a ng-href="{{view.href}}" target="{{view.target}}" ng-bind-html="view.title"></a>
</li>
</ul>
</div>
......
......@@ -53,7 +53,8 @@ public class ApplicationRouteLocator implements RefreshableRouteLocator {
* Endpoints to be proxified by spring boot admin.
*/
private String[] endpoints = { "env", "metrics", "trace", "dump", "jolokia", "info",
"configprops", "trace", "activiti", "logfile", "refresh", "flyway", "liquibase" };
"configprops", "trace", "activiti", "logfile", "refresh", "flyway", "liquibase",
"heapdump" };
public ApplicationRouteLocator(String servletPath, ApplicationRegistry registry,
String prefix) {
......@@ -65,7 +66,7 @@ public class ApplicationRouteLocator implements RefreshableRouteLocator {
protected List<Route> locateRoutes() {
Collection<Application> applications = registry.getApplications();
List<Route> locateRoutes = new ArrayList<Route>(
List<Route> locateRoutes = new ArrayList<>(
applications.size() * (endpoints.length + 1));
for (Application application : applications) {
......
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