ENTAXY-248 release 1.8.1
This commit is contained in:
@ -0,0 +1,94 @@
|
||||
/*-
|
||||
* ~~~~~~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 Entaxy;
|
||||
(function (Entaxy) {
|
||||
Entaxy.log.debug("loading navigation");
|
||||
var TAB_CONFIG = {
|
||||
attributes: {
|
||||
title: 'Attributes',
|
||||
route: '/entaxy/attributes'
|
||||
},
|
||||
operations: {
|
||||
title: 'Operations',
|
||||
route: '/entaxy/operations'
|
||||
},
|
||||
chart: {
|
||||
title: 'Chart',
|
||||
route: '/entaxy/charts'
|
||||
}
|
||||
};
|
||||
Entaxy._module
|
||||
.config(configureRoutes)
|
||||
.component('entaxyNavigation', {
|
||||
template: `<hawtio-tabs tabs="$ctrl.tabs" on-change="$ctrl.goto(tab)"></hawtio-tabs>`,
|
||||
controller: EntaxyNavigationController
|
||||
})
|
||||
.name;
|
||||
Entaxy.log.debug("loaded navigation " + Entaxy.navigationModule);
|
||||
|
||||
function EntaxyNavigationController($scope, $location, workspace, localStorage, jolokia) {
|
||||
'ngInject';
|
||||
var ctrl = this;
|
||||
this.$location = $location;
|
||||
entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
|
||||
|
||||
$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);
|
||||
});
|
||||
|
||||
EntaxyNavigationController.prototype.$onInit = function () {
|
||||
this.tabs = getTabs();
|
||||
};
|
||||
|
||||
EntaxyNavigationController.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, '/entaxy'); });
|
||||
if (enabledRoutes.length > 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
EntaxyNavigationController.$inject = ['$scope', '$location', 'workspace', 'localStorage', 'jolokia']
|
||||
|
||||
function configureRoutes($routeProvider) {
|
||||
$routeProvider.
|
||||
when('/entaxy/attributes', { templateUrl: 'plugins/jmx/html/attributes/attributes.html' }).
|
||||
when('/entaxy/operations', { template: '<operations></operations>' }).
|
||||
when('/entaxy/charts', { templateUrl: 'plugins/jmx/html/charts.html' });
|
||||
}
|
||||
configureRoutes.$inject = ['$routeProvider'];
|
||||
|
||||
})(Entaxy || (Entaxy = {}));
|
@ -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 Entaxy;
|
||||
(function (Entaxy) {
|
||||
Entaxy._module.component('entaxyTreeHeader', {
|
||||
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: EntaxyTreeHeaderController
|
||||
})
|
||||
.component('entaxyTree', {
|
||||
template:
|
||||
`<div class="tree-nav-sidebar-content">
|
||||
<div id="entaxytree" class="treeview-pf-hover treeview-pf-select"></div>
|
||||
</div>
|
||||
`,
|
||||
controller: EntaxyTreeController
|
||||
})
|
||||
.name;
|
||||
entaxyTreeElementId = '#entaxytree';
|
||||
Entaxy.log.debug("loaded tree" + Entaxy.treeModule);
|
||||
|
||||
|
||||
function EntaxyTreeHeaderController($scope, $element) {
|
||||
'ngInject';
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController ");
|
||||
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');
|
||||
|
||||
EntaxyTreeHeaderController.prototype.$onInit = function () {
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController init");
|
||||
var _this = this;
|
||||
this.$scope.$watch(angular.bind(this, function () { return _this.filter; }), function (filter, previous) {
|
||||
if (filter !== previous) {
|
||||
_this.search(filter);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
EntaxyTreeHeaderController.prototype.search = function (filter) {
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController 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);
|
||||
};
|
||||
|
||||
EntaxyTreeHeaderController.prototype.tree = function () {
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController tree");
|
||||
return $(entaxyTreeElementId).treeview(true);
|
||||
};
|
||||
|
||||
EntaxyTreeHeaderController.prototype.expandAll = function () {
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController expand");
|
||||
return this.tree()
|
||||
.expandNode(this.tree().getNodes(), { levels: HawtioTree.getMaxTreeLevel(this.tree()), silent: true });
|
||||
};
|
||||
|
||||
EntaxyTreeHeaderController.prototype.contractAll = function () {
|
||||
Entaxy.log.debug("EntaxyTreeHeaderController contract");
|
||||
return this.tree()
|
||||
.collapseNode(this.tree().getNodes(), { ignoreChildren: true, silent: true });
|
||||
};
|
||||
}
|
||||
EntaxyTreeHeaderController.$inject = ['$scope', '$element'];
|
||||
|
||||
function EntaxyTreeController($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');
|
||||
Entaxy.log.debug("EntaxyTreeController ");
|
||||
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
|
||||
EntaxyTreeController.prototype.$onInit = function () {
|
||||
Entaxy.log.debug("EntaxyTreeController onInit");
|
||||
var _this = this;
|
||||
this.$scope.$on('$destroy', function () { return _this.removeTree(); });
|
||||
this.$scope.$on('$routeChangeStart', function () { return Jmx.updateTreeSelectionFromURL(_this.$location, $(entaxyTreeElementId)); });
|
||||
this.$scope.$on('jmxTreeUpdated', function () { return _this.populateTree(); });
|
||||
this.populateTree();
|
||||
};
|
||||
EntaxyTreeController.prototype.updateSelectionFromURL = function () {
|
||||
Jmx.updateTreeSelectionFromURLAndAutoSelect(this.$location, $(entaxyTreeElementId), 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);
|
||||
};
|
||||
EntaxyTreeController.prototype.populateTree = function () {
|
||||
var _this = this;
|
||||
var children = [];
|
||||
var tree = this.workspace.tree;
|
||||
Entaxy.log.debug("tree= "+tree);
|
||||
if (tree) {
|
||||
var domainName = entaxyJmxDomain;
|
||||
var folder = tree.get(domainName);
|
||||
|
||||
if (folder) {
|
||||
children = folder.children;
|
||||
}
|
||||
angular.forEach(children, function(child) {
|
||||
Entaxy.log.debug("child=" + child.text + " " + child.id);
|
||||
});
|
||||
var treeElement = $("#entaxytree");
|
||||
this.removeTree();
|
||||
Jmx.enableTree(this.$scope, this.$location, this.workspace, $(entaxyTreeElementId), children);
|
||||
this.updateSelectionFromURL();
|
||||
}
|
||||
};
|
||||
EntaxyTreeController.prototype.removeTree = function () {
|
||||
var tree = $(entaxyTreeElementId).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();
|
||||
}
|
||||
}
|
||||
}
|
||||
EntaxyTreeController.$inject = ['$scope', '$location', 'workspace', '$element'];
|
||||
|
||||
})(Entaxy || (Entaxy = {}));
|
@ -0,0 +1,85 @@
|
||||
/*-
|
||||
* ~~~~~~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 Entaxy = (function (Entaxy) {
|
||||
|
||||
/**
|
||||
* The name of this plugin
|
||||
*/
|
||||
Entaxy.pluginName = 'entaxy-plugin';
|
||||
|
||||
/**
|
||||
* This plugin's logger instance
|
||||
*/
|
||||
Entaxy.log = Logger.get('entaxy-plugin');
|
||||
|
||||
/**
|
||||
* The top level path of this plugin on the server
|
||||
*/
|
||||
Entaxy.contextPath = "/entaxy-plugin/";
|
||||
|
||||
Entaxy.log.info("loading entaxy plugin")
|
||||
Entaxy._module = angular.module(Entaxy.pluginName, [
|
||||
'angularResizable'
|
||||
])
|
||||
.component('entaxy', {
|
||||
template:
|
||||
`<div class="tree-nav-layout">
|
||||
<div class="sidebar-pf sidebar-pf-left" resizable r-directions="['right']">
|
||||
<entaxy-tree-header></entaxy-tree-header>
|
||||
<entaxy-tree></entaxy-tree>
|
||||
</div>
|
||||
<div class="tree-nav-main">
|
||||
<jmx-header></jmx-header>
|
||||
<entaxy-navigation></entaxy-navigation>
|
||||
<div class="contents" ng-view></div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
.run(configurePlugin);
|
||||
|
||||
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
|
||||
var entaxyJmxDomain = localStorage['entaxyJmxDomain'] || "ru.entaxy.esb";
|
||||
mainNavService.addItem({
|
||||
title: 'Entaxy',
|
||||
basePath: '/entaxy',
|
||||
template: '<entaxy></entaxy>',
|
||||
isValid: function () { return workspace.treeContainsDomainAndProperties(entaxyJmxDomain); }
|
||||
});
|
||||
|
||||
// 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 Entaxy;
|
||||
|
||||
})(Entaxy || {});
|
||||
|
||||
// tell the Hawtio plugin loader about our plugin so it can be
|
||||
// bootstrapped with the rest of AngularJS
|
||||
hawtioPluginLoader.addModule(Entaxy.pluginName);
|
Reference in New Issue
Block a user