ENTAXY-248 release 1.8.1
This commit is contained in:
@ -0,0 +1,72 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-management-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2021 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.ui.hawtio.h2;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.hawt.web.plugin.HawtioPlugin;
|
||||
|
||||
public class PluginContextListener implements ServletContextListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PluginContextListener.class);
|
||||
|
||||
HawtioPlugin plugin = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
ServletContext context = sce.getServletContext();
|
||||
|
||||
plugin = new HawtioPlugin();
|
||||
plugin.setContext(context.getContextPath());
|
||||
plugin.setName(context.getInitParameter("plugin-name"));
|
||||
plugin.setScripts(context.getInitParameter("plugin-scripts"));
|
||||
plugin.setDomain(null);
|
||||
|
||||
try {
|
||||
plugin.init();
|
||||
} catch (Exception e) {
|
||||
throw createServletException(e);
|
||||
}
|
||||
|
||||
log.info("Initialized {} plugin", plugin.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
try {
|
||||
plugin.destroy();
|
||||
} catch (Exception e) {
|
||||
throw createServletException(e);
|
||||
}
|
||||
|
||||
log.info("Destroyed {} plugin", plugin.getName());
|
||||
}
|
||||
|
||||
protected RuntimeException createServletException(Exception e) {
|
||||
return new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2021 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
|
||||
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
|
||||
<description>Entaxy HawtIO management plugin</description>
|
||||
<display-name>entaxy hawt.io management plugin</display-name>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-context</param-name>
|
||||
<param-value>${plugin-context}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-name</param-name>
|
||||
<param-value>${plugin-name}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-domain</param-name>
|
||||
<param-value>${plugin-domain}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-scripts</param-name>
|
||||
<param-value>${plugin-scripts}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Disable listing of directories and files</description>
|
||||
<param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>ru.entaxy.ui.hawtio.h2.PluginContextListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
</web-app>
|
||||
|
31
ui/entaxy-hawtio/entaxy-h2-plugin/src/main/webapp/index.html
Normal file
31
ui/entaxy-hawtio/entaxy-h2-plugin/src/main/webapp/index.html
Normal file
@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2021 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Entaxy H2 plugin</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hawtio :: Entaxy H2 plugin</h1>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,76 @@
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2021 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
<form class="form-horizontal artemis-preferences-form" ng-controller="Artemis.PreferencesController">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" for="artemisUserName">
|
||||
Artemis user name
|
||||
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<input id="artemisUserName" type="text" class="form-control" ng-model="artemisUserName"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" for="artemisPassword">
|
||||
Artemis password
|
||||
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="The user name to be used when connecting to the broker"></span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<input id="artemisPassword" type="password" class="form-control" ng-model="artemisPassword"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" for="artemisDLQ">
|
||||
Dead-letter address regex
|
||||
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more dead-letter addresses"></span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" id="artemisDLQ" ng-model="artemisDLQ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" for="artemisExpiryQueue">
|
||||
Expiry address regex
|
||||
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="A regular expression to match one or more expiry addresses"></span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" id="artemisExpiryQueue" ng-model="artemisExpiryQueue">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-md-2 control-label" for="artemisBrowseBytesMessages">
|
||||
Display message body as
|
||||
<span class="pficon pficon-info" data-toggle="tooltip" data-placement="top" title="Browsing byte messages should display the message body as"></span>
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<select id="artemisBrowseBytesMessages"
|
||||
ng-model="artemisBrowseBytesMessages"
|
||||
ng-options="key for (key, value) in messageBodyDisplayOptions"
|
||||
ng-selected="artemisBrowseBytesMessages === value">
|
||||
</select>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
</form>
|
@ -0,0 +1,22 @@
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2021 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
<div class="tree-nav-sidebar-content">
|
||||
<div id="entaxyh2tree" class="treeview-pf-hover treeview-pf-select"></div>
|
||||
</div>
|
@ -0,0 +1,43 @@
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2021 EmDev LLC
|
||||
==========
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
<div class="tree-nav-sidebar-header">
|
||||
<form role="form" class="search-pf has-button">
|
||||
<div class="form-group has-clear">
|
||||
<div class="search-pf-input-group">
|
||||
<label for="input-search" class="sr-only">Search Tree:</label>
|
||||
<input id="input-search" type="search" class="form-control" placeholder="Search tree:"
|
||||
ng-model="$ctrl.filter">
|
||||
<button type="button" class="clear" aria-hidden="true"
|
||||
ng-hide="$ctrl.filter.length === 0"
|
||||
ng-click="$ctrl.filter = ''">
|
||||
<span class="pficon pficon-close"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group tree-nav-buttons">
|
||||
<span class="badge" ng-class="{positive: $ctrl.result.length > 0}"
|
||||
ng-show="$ctrl.filter.length > 0">
|
||||
{{$ctrl.result.length}}
|
||||
</span>
|
||||
<i class="fa fa-plus-square-o" title="Expand All" ng-click="$ctrl.expandAll()"></i>
|
||||
<i class="fa fa-minus-square-o" title="Collapse All" ng-click="$ctrl.contractAll()"></i>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
@ -0,0 +1,74 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-h2-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2021 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var EntaxyH2;
|
||||
(function (EntaxyH2) {
|
||||
EntaxyH2.log.debug("loading console");
|
||||
|
||||
EntaxyH2._module
|
||||
.component('entaxyH2Console', {
|
||||
template: `<iframe id="h2consoleFrame" src='/h2console/h2console/' style="width: 100%; height: 100%; overflow: scroll; border: none"></iframe>`,
|
||||
controller: EntaxyH2ConsoleController
|
||||
})
|
||||
.name;
|
||||
|
||||
function EntaxyH2ConsoleController($scope, $element, $location, workspace, localStorage, jolokia) {
|
||||
'ngInject';
|
||||
var ctrl = this;
|
||||
this.$location = $location;
|
||||
entaxyH2location = this.$location;
|
||||
entaxyH2ctrl = ctrl;
|
||||
entaxyH2scope = $scope;
|
||||
entaxyH2element = $element;
|
||||
|
||||
var iFrame = $element.context.childNodes[0];
|
||||
|
||||
this.prepareUrl = (function (){
|
||||
var path = workspace.selection.entries.path;
|
||||
var resultPath = path;
|
||||
if ((path.at(1)=="_") && (path.at(2)=="/")) {
|
||||
resultPath = path.substring(0,1) + ":" + path.substring(2);
|
||||
}
|
||||
return "jdbc:h2:" + resultPath;
|
||||
}).bind(this);
|
||||
|
||||
this.onLoad = (function() {
|
||||
if (iFrame.contentDocument.getElementById('login')){
|
||||
var form = iFrame.contentDocument.getElementById('login');
|
||||
|
||||
// set correct connection url
|
||||
form.getElementsByTagName('input')
|
||||
.namedItem("url").value = this.prepareUrl();
|
||||
|
||||
// add href for opening in new window
|
||||
var p = form.getElementsByTagName("p").item(0);
|
||||
var space = angular.element('<span> </span>');
|
||||
var link = angular.element('<a href="/h2console/h2console" target="_blank">[Open in new window]</a>');
|
||||
angular.element(p).append(space);
|
||||
angular.element(p).append(link);
|
||||
}
|
||||
}).bind(this);
|
||||
|
||||
|
||||
iFrame.onload = this.onLoad;
|
||||
|
||||
}
|
||||
EntaxyH2ConsoleController.$inject = ['$scope', '$element', '$location', 'workspace', 'localStorage', 'jolokia']
|
||||
|
||||
})(EntaxyH2 || (EntaxyH2 = {}));
|
@ -0,0 +1,113 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-management-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2021 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var EntaxyH2;
|
||||
(function (EntaxyH2) {
|
||||
EntaxyH2.log.debug("loading navigation");
|
||||
var TAB_CONFIG = {
|
||||
attributes: {
|
||||
title: 'Attributes',
|
||||
route: '/h2/attributes'
|
||||
},
|
||||
operations: {
|
||||
title: 'Operations',
|
||||
route: '/h2/operations'
|
||||
},
|
||||
chart: {
|
||||
title: 'Chart',
|
||||
route: '/h2/charts'
|
||||
},
|
||||
console: {
|
||||
title: 'H2 Console',
|
||||
route: '/h2/console'
|
||||
}
|
||||
};
|
||||
EntaxyH2._module
|
||||
.config(configureRoutes)
|
||||
.component('entaxyH2Navigation', {
|
||||
template: `<hawtio-tabs tabs="$ctrl.tabs" on-change="$ctrl.goto(tab)"></hawtio-tabs>`,
|
||||
controller: EntaxyH2NavigationController
|
||||
})
|
||||
.name;
|
||||
EntaxyH2.log.debug("loaded navigation " + EntaxyH2.navigationModule);
|
||||
|
||||
function EntaxyH2NavigationController($scope, $location, workspace, localStorage, jolokia) {
|
||||
'ngInject';
|
||||
var ctrl = this;
|
||||
this.$location = $location;
|
||||
entaxyH2JmxDomain = localStorage['entaxyH2JmxDomain'] || "org.h2";
|
||||
|
||||
entaxyH2workspace = workspace;
|
||||
|
||||
$scope.$on('jmxTreeClicked', function () {
|
||||
ctrl.tabs = getTabs();
|
||||
var tab = _.find(ctrl.tabs, { path: ctrl.$location.path() });
|
||||
if (!tab) {
|
||||
tab = ctrl.tabs[0];
|
||||
}
|
||||
ctrl.$location.path(tab.path);
|
||||
});
|
||||
|
||||
EntaxyH2NavigationController.prototype.$onInit = function () {
|
||||
this.tabs = getTabs();
|
||||
};
|
||||
|
||||
EntaxyH2NavigationController.prototype.goto = function (tab) {
|
||||
this.$location.path(tab.path);
|
||||
};
|
||||
|
||||
function getTabs() {
|
||||
|
||||
var tabs = [];
|
||||
var enabledRoutes = Object.keys(TAB_CONFIG)
|
||||
.map(function (config) { return TAB_CONFIG[config].route; })
|
||||
.filter(function (route) { return _.startsWith(route, '/h2'); });
|
||||
if (enabledRoutes.length > 0) {
|
||||
|
||||
if (shouldShowConsole(workspace)) {
|
||||
tabs.push(new Nav.HawtioTab(TAB_CONFIG.console.title, TAB_CONFIG.console.route));
|
||||
}
|
||||
|
||||
tabs.push(new Nav.HawtioTab(TAB_CONFIG.attributes.title, TAB_CONFIG.attributes.route));
|
||||
tabs.push(new Nav.HawtioTab(TAB_CONFIG.operations.title, TAB_CONFIG.operations.route));
|
||||
tabs.push(new Nav.HawtioTab(TAB_CONFIG.chart.title, TAB_CONFIG.chart.route));
|
||||
}
|
||||
return tabs;
|
||||
}
|
||||
|
||||
function shouldShowConsole(workspace) {
|
||||
return workspace.selectionHasDomain(entaxyH2JmxDomain)
|
||||
&& workspace.selection
|
||||
&& workspace.selection.entries.path;
|
||||
}
|
||||
|
||||
}
|
||||
EntaxyH2NavigationController.$inject = ['$scope', '$location', 'workspace', 'localStorage', 'jolokia']
|
||||
|
||||
function configureRoutes($routeProvider) {
|
||||
$routeProvider.
|
||||
when('/h2/attributes', { templateUrl: 'plugins/jmx/html/attributes/attributes.html' }).
|
||||
when('/h2/operations', { template: '<operations></operations>' }).
|
||||
when('/h2/charts', { templateUrl: 'plugins/jmx/html/charts.html' }).
|
||||
when('/h2/console', { template: '<entaxy-h2-console></entaxy-h2-console>' });
|
||||
}
|
||||
configureRoutes.$inject = ['$routeProvider'];
|
||||
|
||||
})(EntaxyH2 || (EntaxyH2 = {}));
|
||||
|
@ -0,0 +1,193 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-management-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2021 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var EntaxyH2;
|
||||
(function (EntaxyH2) {
|
||||
EntaxyH2._module.component('entaxyH2TreeHeader', {
|
||||
template:
|
||||
`<div class="tree-nav-sidebar-header">
|
||||
<form role="form" class="search-pf has-button">
|
||||
<div class="form-group has-clear">
|
||||
<div class="search-pf-input-group">
|
||||
<label for="input-search" class="sr-only">Search Tree:</label>
|
||||
<input id="input-search" type="search" class="form-control" placeholder="Search tree:"
|
||||
ng-model="$ctrl.filter">
|
||||
<button type="button" class="clear" aria-hidden="true"
|
||||
ng-hide="$ctrl.filter.length === 0"
|
||||
ng-click="$ctrl.filter = ''">
|
||||
<span class="pficon pficon-close"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group tree-nav-buttons">
|
||||
<span class="badge" ng-class="{positive: $ctrl.result.length > 0}"
|
||||
ng-show="$ctrl.filter.length > 0">
|
||||
{{$ctrl.result.length}}
|
||||
</span>
|
||||
<i class="fa fa-plus-square-o" title="Expand All" ng-click="$ctrl.expandAll()"></i>
|
||||
<i class="fa fa-minus-square-o" title="Collapse All" ng-click="$ctrl.contractAll()"></i>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
`,
|
||||
controller: EntaxyH2TreeHeaderController
|
||||
})
|
||||
.component('entaxyH2Tree', {
|
||||
template:
|
||||
`<div class="tree-nav-sidebar-content">
|
||||
<div id="entaxyh2tree" class="treeview-pf-hover treeview-pf-select"></div>
|
||||
</div>
|
||||
`,
|
||||
controller: EntaxyH2TreeController
|
||||
})
|
||||
.name;
|
||||
entaxyH2TreeElementId = '#entaxyh2tree';
|
||||
EntaxyH2.log.debug("loaded tree" + EntaxyH2.treeModule);
|
||||
|
||||
|
||||
function EntaxyH2TreeHeaderController($scope, $element) {
|
||||
'ngInject';
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController ");
|
||||
this.$scope = $scope;
|
||||
this.$element = $element;
|
||||
this.filter = '';
|
||||
this.result = [];
|
||||
// it's not possible to declare classes to the component host tag in AngularJS
|
||||
$element.addClass('tree-nav-sidebar-header');
|
||||
|
||||
EntaxyH2TreeHeaderController.prototype.$onInit = function () {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController init");
|
||||
var _this = this;
|
||||
this.$scope.$watch(angular.bind(this, function () { return _this.filter; }), function (filter, previous) {
|
||||
if (filter !== previous) {
|
||||
_this.search(filter);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
EntaxyH2TreeHeaderController.prototype.search = function (filter) {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController search");
|
||||
var _this = this;
|
||||
var doSearch = function (filter) {
|
||||
var result = _this.tree().search(filter, {
|
||||
ignoreCase: true,
|
||||
exactMatch: false,
|
||||
revealResults: true
|
||||
});
|
||||
_this.result.length = 0;
|
||||
(_a = _this.result).push.apply(_a, result);
|
||||
Core.$apply(_this.$scope);
|
||||
var _a;
|
||||
};
|
||||
_.debounce(doSearch, 300, { leading: false, trailing: true })(filter);
|
||||
};
|
||||
|
||||
EntaxyH2TreeHeaderController.prototype.tree = function () {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController tree");
|
||||
return $(entaxyH2TreeElementId).treeview(true);
|
||||
};
|
||||
|
||||
EntaxyH2TreeHeaderController.prototype.expandAll = function () {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController expand");
|
||||
return this.tree()
|
||||
.expandNode(this.tree().getNodes(), { levels: HawtioTree.getMaxTreeLevel(this.tree()), silent: true });
|
||||
};
|
||||
|
||||
EntaxyH2TreeHeaderController.prototype.contractAll = function () {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeHeaderController contract");
|
||||
return this.tree()
|
||||
.collapseNode(this.tree().getNodes(), { ignoreChildren: true, silent: true });
|
||||
};
|
||||
}
|
||||
EntaxyH2TreeHeaderController.$inject = ['$scope', '$element'];
|
||||
|
||||
function EntaxyH2TreeController($scope, $location, workspace, $element) {
|
||||
'ngInject';
|
||||
this.$scope = $scope;
|
||||
this.$location = $location;
|
||||
this.workspace = workspace;
|
||||
this.$element = $element;
|
||||
// it's not possible to declare classes to the component host tag in AngularJS
|
||||
$element.addClass('tree-nav-sidebar-content');
|
||||
EntaxyH2.log.debug("EntaxyH2TreeController ");
|
||||
var entaxyH2JmxDomain = localStorage['entaxyH2JmxDomain'] || "org.h2";
|
||||
EntaxyH2TreeController.prototype.$onInit = function () {
|
||||
EntaxyH2.log.debug("EntaxyH2TreeController onInit");
|
||||
var _this = this;
|
||||
this.$scope.$on('$destroy', function () { return _this.removeTree(); });
|
||||
this.$scope.$on('$routeChangeStart', function () { return Jmx.updateTreeSelectionFromURL(_this.$location, $(entaxyH2TreeElementId)); });
|
||||
this.$scope.$on('jmxTreeUpdated', function () { return _this.populateTree(); });
|
||||
this.populateTree();
|
||||
};
|
||||
EntaxyH2TreeController.prototype.updateSelectionFromURL = function () {
|
||||
Jmx.updateTreeSelectionFromURLAndAutoSelect(this.$location, $(entaxyH2TreeElementId), function (first) {
|
||||
if (first.children == null) {
|
||||
return null;
|
||||
}
|
||||
// use function to auto select the queue folder on the 1st broker
|
||||
var queues = first.children[0];
|
||||
if (queues && queues.text === 'Queue') {
|
||||
return queues;
|
||||
}
|
||||
return null;
|
||||
}, true);
|
||||
};
|
||||
EntaxyH2TreeController.prototype.populateTree = function () {
|
||||
var _this = this;
|
||||
var children = [];
|
||||
var tree = this.workspace.tree;
|
||||
EntaxyH2.log.debug("tree= "+tree);
|
||||
if (tree) {
|
||||
var domainName = entaxyH2JmxDomain;
|
||||
var folder = tree.get(domainName);
|
||||
|
||||
if (folder) {
|
||||
children = folder.children;
|
||||
}
|
||||
angular.forEach(children, function(child) {
|
||||
EntaxyH2.log.debug("child=" + child.text + " " + child.id);
|
||||
});
|
||||
var treeElement = $("#entaxyh2tree");
|
||||
this.removeTree();
|
||||
Jmx.enableTree(this.$scope, this.$location, this.workspace, $(entaxyH2TreeElementId), children);
|
||||
this.updateSelectionFromURL();
|
||||
}
|
||||
};
|
||||
EntaxyH2TreeController.prototype.removeTree = function () {
|
||||
var tree = $(entaxyH2TreeElementId).treeview(true);
|
||||
// There is no exposed API to check whether the tree has already been initialized,
|
||||
// so let's just check if the methods are presents
|
||||
if (tree.clearSearch) {
|
||||
tree.clearSearch();
|
||||
// Bootstrap tree view leaks the node elements into the data structure
|
||||
// so let's clean this up when the user leaves the view
|
||||
var cleanTreeFolder_1 = function (node) {
|
||||
delete node['$el'];
|
||||
if (node.nodes)
|
||||
node.nodes.forEach(cleanTreeFolder_1);
|
||||
};
|
||||
cleanTreeFolder_1(this.workspace.tree);
|
||||
// Then call the tree clean-up method
|
||||
tree.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
EntaxyH2TreeController.$inject = ['$scope', '$location', 'workspace', '$element'];
|
||||
|
||||
})(EntaxyH2 || (EntaxyH2 = {}));
|
@ -0,0 +1,84 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-management-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2021 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
/**
|
||||
* The main entry point for the Simple module
|
||||
*/
|
||||
var EntaxyH2 = (function (EntaxyH2) {
|
||||
|
||||
/**
|
||||
* The name of this plugin
|
||||
*/
|
||||
EntaxyH2.pluginName = 'entaxy-h2';
|
||||
|
||||
/**
|
||||
* This plugin's logger instance
|
||||
*/
|
||||
EntaxyH2.log = Logger.get('entaxy-h2');
|
||||
|
||||
/**
|
||||
* The top level path of this plugin on the server
|
||||
*/
|
||||
EntaxyH2.contextPath = "/entaxy-h2/";
|
||||
|
||||
EntaxyH2.log.info("loading entaxy h2 plugin")
|
||||
EntaxyH2._module = angular.module(EntaxyH2.pluginName, [
|
||||
'angularResizable'
|
||||
])
|
||||
.component('entaxyH2', {
|
||||
template:
|
||||
`<div class="tree-nav-layout">
|
||||
<div class="sidebar-pf sidebar-pf-left" resizable r-directions="['right']">
|
||||
<entaxy-h2-tree-header></entaxy-h2-tree-header>
|
||||
<entaxy-h2-tree></entaxy-h2-tree>
|
||||
</div>
|
||||
<div class="tree-nav-main">
|
||||
<jmx-header></jmx-header>
|
||||
<entaxy-h2-navigation></entaxy-h2-navigation>
|
||||
<div class="contents" ng-view></div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
.run(configurePlugin);
|
||||
|
||||
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
|
||||
var entaxyH2JmxDomain = localStorage['entaxyH2JmxDomain'] || "org.h2";
|
||||
mainNavService.addItem({
|
||||
title: 'H2',
|
||||
basePath: '/h2',
|
||||
template: '<entaxy-h2></entaxy-h2>',
|
||||
isValid: function () { return workspace.treeContainsDomainAndProperties(entaxyH2JmxDomain); }
|
||||
});
|
||||
// clean up local storage upon logout
|
||||
/* preLogoutTasks.addTask('CleanupArtemisCredentials', function () {
|
||||
Artemis.log.debug("Clean up Artemis credentials in local storage");
|
||||
localStorage.removeItem('artemisUserName');
|
||||
localStorage.removeItem('artemisPassword');
|
||||
}); */
|
||||
}
|
||||
configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache'];
|
||||
|
||||
return EntaxyH2;
|
||||
|
||||
})(EntaxyH2 || {});
|
||||
|
||||
// tell the Hawtio plugin loader about our plugin so it can be
|
||||
// bootstrapped with the rest of AngularJS
|
||||
hawtioPluginLoader.addModule(EntaxyH2.pluginName);
|
Reference in New Issue
Block a user