-
-
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/doc/help.md b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/doc/help.md
deleted file mode 100644
index e875acd8bcf..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/doc/help.md
+++ /dev/null
@@ -1,19 +0,0 @@
-### Artemis
-
-Click [Artemis](#/jmx/attributes?tab=artemis) in the top navigation bar to see the Artemis specific plugin. (The Artemis tab won't appear if there is no broker in this JVM). The Artemis plugin works very much the same as the JMX plugin however with a focus on interacting with an Artemis broker.
-
-The tree view on the left-hand side shows the top level JMX tree of each broker instance running in the JVM. Expanding the tree will show the various MBeans registered by Artemis that you can inspect via the **Attributes** tab.
-
-#### Creating a new Address
-
-To create a new address simply click on the broker or the address folder in the jmx tree and click on the create tab.
-
-Once you have created an address you should be able to **Send** to it by clicking on it in the jmx tree and clicking on the send tab.
-
-#### Creating a new Queue
-
-To create a new queue click on the address you want to bind the queue to and click on the create tab.
-
-Once you have created a queue you should be able to **Send** a message to it or **Browse** it or view the **Attributes** or **Charts**. Simply click on the queue in th ejmx tree and click on the appropriate tab.
-
-You can also see a graphical view of all brokers, addresses, queues and their consumers using the **Diagram** tab.
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/preferences.html b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/preferences.html
deleted file mode 100644
index 8227bba7c0a..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/preferences.html
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/tree/content.html b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/tree/content.html
deleted file mode 100644
index be06f47f052..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/html/tree/content.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/artemisPlugin.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/artemisPlugin.js
deleted file mode 100644
index f51f4ba1ed3..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/artemisPlugin.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-/**
- * The main entry point for the Simple module
- */
-var Artemis = (function (Artemis) {
-
- /**
- * The name of this plugin
- */
- Artemis.pluginName = 'artemis-plugin';
-
- /**
- * This plugin's logger instance
- */
- Artemis.log = Logger.get('artemis-plugin');
-
- /**
- * The top level path of this plugin on the server
- */
- Artemis.contextPath = "/artemis-plugin/";
-
- Artemis.log.info("loading artemis plugin")
- Artemis._module = angular.module(Artemis.pluginName, [
- 'angularResizable'
- ])
- .component('artemis', {
- template:
- `
-
-
-
-
-
-
-
-
-
-
- `
- })
- .run(configurePlugin);
-
- function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
- var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
- mainNavService.addItem({
- title: 'Artemis',
- basePath: '/artemis',
- template: '',
- isValid: function () { return workspace.treeContainsDomainAndProperties(artemisJmxDomain); }
- });
- }
- configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache'];
-
- return Artemis;
-
-})(Artemis || {});
-
-// tell the Hawtio plugin loader about our plugin so it can be
-// bootstrapped with the rest of AngularJS
-hawtioPluginLoader.addModule(Artemis.pluginName);
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addressSendMessage.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addressSendMessage.js
deleted file mode 100644
index 50283fe6ad8..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addressSendMessage.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
- ///
-var Artemis;
-(function (Artemis) {
- Artemis.log.debug("loading address send message");
- Artemis._module.component('artemisAddressSendMessage', {
- template:
- `
Send Message
-
-
-
-
-
-
-
-
-
-
-
Headers
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Body
-
-
-
-
-
-
-
-
-
-
- `,
- controller: AddressSendMessageController
- })
- .name;
- Artemis.log.debug("loaded queue " + Artemis.createQueueModule);
-
- function AddressSendMessageController($route, $scope, $element, $timeout, workspace, jolokia, localStorage, $location, artemisMessage, messageCreator) {
- Core.initPreferenceScope($scope, localStorage, {
- 'durable': {
- 'value': true,
- 'converter': Core.parseBooleanValue
- },
- 'messageID': {
- 'value': true,
- 'converter': Core.parseBooleanValue
- }
- });
- var ctrl = this;
- ctrl.messageCreator = messageCreator;
- ctrl.message = ctrl.messageCreator.createNewMessage($scope, $location, $route, localStorage, artemisMessage, workspace, $element, $timeout, jolokia);
-
- }
- AddressSendMessageController.$inject = ['$route', '$scope', '$element', '$timeout', 'workspace', 'jolokia', 'localStorage', '$location', 'artemisMessage', 'messageCreator'];
-
-})(Artemis || (Artemis = {}));
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addresses.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addresses.js
deleted file mode 100644
index c0fc8be326e..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/addresses.js
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-var Artemis;
-(function (Artemis) {
- //Artemis.log.debug("loading addresses");
- Artemis._module.component('artemisAddresses', {
- template:
- `
Browse Addresses
-
-
-
-
-
-
-
-
- `,
- controller: AddressesController
- })
- .name;
-
-
- function AddressesController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisAddress) {
- var ctrl = this;
- ctrl.pagination = pagination;
- ctrl.pagination.reset();
- var mbean = Artemis.getBrokerMBean(workspace, jolokia);
- ctrl.allAddresses = [];
- ctrl.addresses = [];
- ctrl.workspace = workspace;
- ctrl.refreshed = false;
- ctrl.dtOptions = {
- // turn of ordering as we do it ourselves
- ordering: false,
- columns: [
- {name: "ID", visible: true},
- {name: "Name", visible: true},
- {name: "Internal", visible: false},
- {name: "Routing Types", visible: true},
- {name: "Queue Count", visible: true}
- ]
- };
-
- Artemis.log.debug('sessionStorage: addressColumnDefs =', localStorage.getItem('addressColumnDefs'));
- if (localStorage.getItem('addressColumnDefs')) {
- loadedDefs = JSON.parse(localStorage.getItem('addressColumnDefs'));
- //sanity check to make sure columns havent been added
- if(loadedDefs.length === ctrl.dtOptions.columns.length) {
- ctrl.dtOptions.columns = loadedDefs;
- }
-
- }
-
- ctrl.updateColumns = function () {
- var attributes = [];
- ctrl.dtOptions.columns.forEach(function (column) {
- attributes.push({name: column.name, visible: column.visible});
- });
- Artemis.log.debug("saving columns " + JSON.stringify(attributes));
- localStorage.setItem('addressColumnDefs', JSON.stringify(attributes));
- }
-
- ctrl.filter = {
- fieldOptions: [
- {id: 'id', name: 'ID'},
- {id: 'name', name: 'Name'},
- {id: 'internal', name: 'Internal'},
- {id: 'routingTypes', name: 'Routing Types'},
- {id: 'queueCount', name: 'Queue Count'}
- ],
- operationOptions: [
- {id: 'EQUALS', name: 'Equals'},
- {id: 'CONTAINS', name: 'Contains'},
- {id: 'NOT_CONTAINS', name: 'Does Not Contain'},
- {id: 'GREATER_THAN', name: 'Greater Than'},
- {id: 'LESS_THAN', name: 'Less Than'}
- ],
- sortOptions: [
- {id: 'asc', name: 'ascending'},
- {id: 'desc', name: 'descending'}
- ],
- values: {
- field: "",
- operation: "",
- value: "",
- sortOrder: "asc",
- sortColumn: "id"
- },
- text: {
- fieldText: "Filter Field..",
- operationText: "Operation..",
- sortOrderText: "ascending",
- sortByText: "ID"
- }
- };
-
- ctrl.tableActionButtons = [
- {
- name: 'attributes',
- title: 'Navigate to attributes',
- actionFn: navigateToAddressAtts
- },
- {
- name: 'operations',
- title: 'navigate to operations',
- actionFn: navigateToAddressOps
- }
- ];
- ctrl.tableConfig = {
- selectionMatchProp: 'id',
- showCheckboxes: false
- };
- ctrl.tableColumns = [
- { header: 'ID', itemField: 'id' },
- { header: 'Name', itemField: 'name' },
- { header: 'Internal', itemField: 'internal' },
- { header: 'Routing Types', itemField: 'routingTypes' },
- { header: 'Queue Count', itemField: 'queueCount' , htmlTemplate: 'addresses-anchor-column-template', colActionFn: (item) => selectQueues(item.idx) }
- ];
-
- ctrl.refresh = function () {
- ctrl.refreshed = true;
- ctrl.pagination.load();
- };
- ctrl.reset = function () {
- ctrl.filter.values.field = "";
- ctrl.filter.values.operation = "";
- ctrl.filter.values.value = "";
- ctrl.filter.sortOrder = "asc";
- ctrl.filter.sortColumn = "id";
- ctrl.refreshed = true;
- artemisAddress.address = null;
- ctrl.pagination.load();
- };
-
- if (artemisAddress.address) {
- Artemis.log.debug("navigating to address = " + artemisAddress.address.address);
- ctrl.filter.values.field = ctrl.filter.fieldOptions[1].id;
- ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
- ctrl.filter.values.value = artemisAddress.address.address;
- artemisAddress.address = null;
- }
-
- selectQueues = function (idx) {
- var address = ctrl.addresses[idx].name;
- Artemis.log.debug("navigating to queues:" + address)
- artemisAddress.address = { address: address };
- $location.path("artemis/artemisQueues");
- };
-
- function navigateToAddressAtts(action, item) {
- $location.path("artemis/attributes").search({"tab": "artemis", "nid": getAddressNid(item.name, $location)});
- };
- function navigateToAddressOps(action, item) {
- $location.path("artemis/operations").search({"tab": "artemis", "nid": getAddressNid(item.name, $location)});
- };
- function getAddressNid(address, $location) {
- var rootNID = getRootNid($location);
- var targetNID = rootNID + "addresses-" + address;
- Artemis.log.debug("targetNID=" + targetNID);
- return targetNID;
- }
- function getRootNid($location) {
- var currentNid = $location.search()['nid'];
- Artemis.log.debug("current nid=" + currentNid);
- var firstDash = currentNid.indexOf('-');
- var secondDash = currentNid.indexOf('-', firstDash + 1);
- var thirdDash = currentNid.indexOf('-', secondDash + 1);
- if (thirdDash < 0) {
- return currentNid + "-";
- }
- var rootNID = currentNid.substring(0, thirdDash + 1);
- return rootNID;
- }
- ctrl.loadOperation = function () {
- if (mbean) {
- var method = 'listAddresses(java.lang.String, int, int)';
- var addressFilter = {
- field: ctrl.filter.values.field,
- operation: ctrl.filter.values.operation,
- value: ctrl.filter.values.value,
- sortOrder: ctrl.filter.values.sortOrder,
- sortColumn: ctrl.filter.values.sortColumn
- };
-
- if (ctrl.refreshed == true) {
- ctrl.pagination.reset();
- ctrl.refreshed = false;
- }
- jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(addressFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
- }
- };
-
- ctrl.pagination.setOperation(ctrl.loadOperation);
-
- function onError(response) {
- Core.notification("error", "could not invoke list sessions" + response.error);
- $scope.workspace.selectParentNode();
- };
-
- function populateTable(response) {
- var data = JSON.parse(response.value);
- ctrl.addresses = [];
- angular.forEach(data["data"], function (value, idx) {
- value.idx = idx;
- ctrl.addresses.push(value);
- });
- ctrl.pagination.page(data["count"]);
- allAddresses = ctrl.addresses;
- ctrl.addresses = allAddresses;
- Core.$apply($scope);
- }
-
- ctrl.pagination.load();
- }
- AddressesController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisAddress'];
-
-
-})(Artemis || (Artemis = {}));
\ No newline at end of file
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js
deleted file mode 100644
index 548e325f93d..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/browse.js
+++ /dev/null
@@ -1,1056 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-var Artemis;
-(function (Artemis) {
- Artemis._module.component('artemisBrowseQueue', {
- template:
- `
Browse Queue
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Message ID: {{$ctrl.currentMessage.messageID}}
-
-
Displaying body as
-
-
-
Headers
-
-
-
-
-
Properties
-
-
-
-
-
-
-
-
-
-
-
- This operation cannot be undone so please be careful.
-
-
{{$ctrl.actionText}}
-
-
-
-
-
-
-
- You cannot undo this operation.
- Though after the move you can always move them back again.
-
-
{{$ctrl.actionText}}
-
Move
-
- to:
-
-
-
-
-
-
-
-
- You cannot undo this operation.
- Though after the move you can always move them back again.
-
-
{{$ctrl.actionText}}
-
-
-
-
-
-
-
{{ col.name }}
-
-
-
-
-
-
- `,
- controller: BrowseQueueController
- })
- .name;
-
-
- function BrowseQueueController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination) {
- var ctrl = this;
- ctrl.dlq = false;
- ctrl.deleteDisabled = true;
- ctrl.moveDisabled = true;
- ctrl.retryDisabled = true;
- ctrl.pagination = pagination;
- ctrl.pagination.reset();
- ctrl.filter = '';
- ctrl.actionText = '';
-
- ctrl.allMessages = [];
- ctrl.messages = [];
-
- ctrl.objName = '';
- if (workspace.selection) {
- ctrl.objName = workspace.selection.objectName;
- } else {
- // in case of refresh
- var key = location.search()['nid'];
- var node = workspace.keyToNodeMap[key];
- ctrl.objName = node.objectName;
- }
- if (ctrl.objName) {
- ctrl.addressName = jolokia.getAttribute(ctrl.objName, "Address");
- Artemis.log.debug("addressName: " + ctrl.addressName);
- }
-
- ctrl.artemisDLQ = localStorage['artemisDLQ'] || "^DLQ$";
- Artemis.log.debug("artemisDLQ: " + ctrl.artemisDLQ);
- ctrl.artemisExpiryQueue = localStorage['artemisExpiryQueue'] || "^ExpiryQueue$";
- Artemis.log.debug("artemisExpiryQueue: " + ctrl.artemisExpiryQueue);
-
- ctrl.originalQueueColumn = { name: "Original Queue", visible: false };
-
- ctrl.dtOptions = {
- // turn of ordering as we do it ourselves
- ordering: false,
- columns: [
- {name: "Select", visible: true},
- {name: "Message ID", visible: true},
- {name: "Type", visible: true},
- {name: "Durable", visible: true},
- {name: "Priority", visible: true},
- {name: "Timestamp", visible: true},
- {name: "Expires", visible: true},
- {name: "Redelivered", visible: true},
- {name: "Large", visible: true},
- {name: "Persistent Size", visible: true},
- {name: "User ID", visible: true},
- {name: "Validated User", visible: false},
- ctrl.originalQueueColumn
- ]
- };
-
- Artemis.log.debug('sessionStorage: browseColumnDefs =', localStorage.getItem('browseColumnDefs'));
- if (localStorage.getItem('browseColumnDefs')) {
- loadedDefs = JSON.parse(localStorage.getItem('browseColumnDefs'));
- //sanity check to make sure columns havent been added
- if(loadedDefs.length === ctrl.dtOptions.columns.length) {
- ctrl.dtOptions.columns = loadedDefs;
- }
- }
-
- ctrl.updateColumns = function () {
- var attributes = [];
- ctrl.dtOptions.columns.forEach(function (column) {
- attributes.push({name: column.name, visible: column.visible});
- });
- Artemis.log.debug("saving columns " + JSON.stringify(attributes));
- localStorage.setItem('browseColumnDefs', JSON.stringify(attributes));
- }
-
- ctrl.tableConfig = {
- onCheckBoxChange: handleCheckBoxChange,
- selectionMatchProp: 'messageID',
- showCheckboxes: true
- };
- ctrl.tableColumns = [
- {
- itemField: 'messageID',
- header: 'Message ID'
- },
- {
- itemField: 'type',
- header: 'Type',
- templateFn: function(value) {
- return formatWithList(value, typeLabels);
- }
- },
- {
- itemField: 'durable',
- header: 'Durable'
- },
- {
- itemField: 'priority',
- header: 'Priority'
- },
- {
- itemField: 'timestamp',
- header: 'Timestamp',
- templateFn: function(value) {
- return formatTimestamp(value);
- }
- },
- {
- itemField: 'expiration',
- header: 'Expires',
- templateFn: function(value) {
- return formatExpires(value, false);
- }
- },
- {
- header: 'Redelivered',
- itemField: 'redelivered'
- },
- {
- itemField: 'largeMessage',
- header: 'Large'
- },
- {
- itemField: 'persistentSize',
- header: 'Persistent Size',
- templateFn: function(value) {
- return formatPersistentSize(value);
- }
- },
- {
- itemField: 'userID',
- header: 'User ID'
- },
- {
- itemField: 'validatedUser',
- header: 'Validated User',
- templateFn: function(value) {
- if (!value) return undefined;
- return value._AMQ_VALIDATED_USER;
- }
- },
- {
- itemField: 'StringProperties',
- header: 'Original Queue',
- templateFn: function(value) {
- if (!value) return undefined;
- return (value['_AMQ_ORIG_QUEUE'] ? value['_AMQ_ORIG_QUEUE'] : value['extraProperties._AMQ_ORIG_QUEUE']);
- }
- }
-
- ];
-
- var resendConfig = {
- name: 'Resend',
- title: 'Resend message',
- actionFn: resendMessage
- };
-
- var showConfig = {
- name: 'Show',
- title: 'Show message',
- actionFn: openMessageDialog
- };
-
- ctrl.messageTableConfig = { selectionMatchProp: 'key', itemsAvailable: true, showCheckboxes: false };
- ctrl.messagePTableConfig = { selectionMatchProp: 'key', itemsAvailable: true, showCheckboxes: false };
- ctrl.messageToolbarConfig = {
- isTableView: true
- };
- ctrl.messagePToolbarConfig = {
- isTableView: true
- };
-
- ctrl.messageTableColumns = [
- {
- itemField: 'key',
- header: 'key'
- },
- {
- itemField: 'value',
- header: 'value'
- }];
-
- ctrl.tableMenuActions = [ showConfig, resendConfig ];
-
- ctrl.sysprops = [];
-
- Artemis.log.debug("loaded browse 5" + Artemis.browseQueueModule);
- ctrl.currentMessage;
-
- ctrl.queueNames = [];
- ctrl.queueName = '';
- ctrl.resultSizeDialog = false;
- //success message
- ctrl.message = '';
- //error message
- ctrl.errorMessage = '';
- $scope.mode = 'text';
- ctrl.deleteDialog = false;
- ctrl.moveDialog = false;
- ctrl.retryDialog = false;
- ctrl.showMessageDetails = false;
-
- var ignoreColumns = ["PropertiesText", "bodyText", "BodyPreview", "text", "headers", "properties", "textMode", "idx", "selected"];
- var flattenColumns = ["BooleanProperties", "ByteProperties", "ShortProperties", "IntProperties", "LongProperties", "FloatProperties", "DoubleProperties", "StringProperties"];
-
- function openMessageDialog(action, item) {
- ctrl.currentMessage = item;
- ctrl.currentMessage.headers = createHeaders(ctrl.currentMessage)
- ctrl.currentMessage.properties = createProperties(ctrl.currentMessage);
- ctrl.currentMessage.bodyText = createBodyText(ctrl.currentMessage);
- ctrl.showMessageDetails = true;
- };
-
- ctrl.previousMessage = function() {
- ctrl.currentMessage.selected = false;
- nextIdx = ctrl.currentMessage.idx - 1;
- if (nextIdx < 0) {
- ctrl.pagination.previousPage();
- ctrl.loadPrevousPage = true;
- //we return here and let the next table load in and move to message idx 0
- return;
- }
- nextMessage = ctrl.messages.find(tree => tree.idx == nextIdx);
- ctrl.currentMessage = nextMessage;
- ctrl.currentMessage.headers = createHeaders(ctrl.currentMessage)
- ctrl.currentMessage.properties = createProperties(ctrl.currentMessage);
- ctrl.currentMessage.bodyText = createBodyText(ctrl.currentMessage);
- };
-
- ctrl.nextMessage = function() {
- ctrl.currentMessage.selected = false;
- nextIdx = ctrl.currentMessage.idx + 1;
- if (nextIdx == ctrl.pagination.pageSize) {
- ctrl.pagination.nextPage();
- //we return here and let the next table load in and move to messae idx 0
- return;
- }
- nextMessage = ctrl.messages.find(tree => tree.idx == nextIdx);
- ctrl.currentMessage = nextMessage;
- ctrl.currentMessage.headers = createHeaders(ctrl.currentMessage)
- ctrl.currentMessage.properties = createProperties(ctrl.currentMessage);
- ctrl.currentMessage.bodyText = createBodyText(ctrl.currentMessage);
- };
-
- ctrl.previousPage = function() {
- ctrl.pagination.previousPage();
- };
-
- ctrl.nextPage = function() {
- ctrl.pagination.nextPage();
- };
-
- ctrl.firstPage = function() {
- ctrl.pagination.firstPage();
- };
-
- ctrl.lastPage = function() {
- ctrl.pagination.lastPage();
- };
-
- var MS_PER_SEC = 1000;
- var MS_PER_MIN = 60 * MS_PER_SEC;
- var MS_PER_HOUR = 60 * MS_PER_MIN;
- var MS_PER_DAY = 24 * MS_PER_HOUR;
-
- function pad2(value) {
- return (value < 10 ? '0' : '') + value;
- }
-
- function formatExpires(timestamp, addTimestamp) {
- if (isNaN(timestamp) || typeof timestamp !== "number") {
- return timestamp;
- }
- if (timestamp == 0) {
- return "never";
- }
- var expiresIn = timestamp - Date.now();
- if (Math.abs(expiresIn) < MS_PER_DAY) {
- var duration = expiresIn < 0 ? -expiresIn : expiresIn;
- var hours = pad2(Math.floor((duration / MS_PER_HOUR) % 24));
- var mins = pad2(Math.floor((duration / MS_PER_MIN) % 60));
- var secs = pad2(Math.floor((duration / MS_PER_SEC) % 60));
- var ret;
- if (expiresIn < 0) {
- // "HH:mm:ss ago"
- ret = hours + ":" + mins + ":" + secs + " ago";
- } else {
- // "in HH:mm:ss"
- ret = "in " + hours + ":" + mins + ":" + secs;
- }
- if (addTimestamp) {
- ret += ", at " + formatTimestamp(timestamp);
- }
- return ret;
- }
- return formatTimestamp(timestamp);
- }
-
- function formatTimestamp(timestamp) {
- if (isNaN(timestamp) || typeof timestamp !== "number") {
- return timestamp;
- }
- if (timestamp === 0) {
- return "N/A";
- }
- var d = new Date(timestamp);
- // "yyyy-MM-dd HH:mm:ss"
- //add 1 to month as getmonth returns the position not the actual month
- return d.getFullYear() + "-" + pad2(d.getMonth() + 1) + "-" + pad2(d.getDate()) + " " + pad2(d.getHours()) + ":" + pad2(d.getMinutes()) + ":" + pad2(d.getSeconds());
- }
-
- function formatWithList(value, valueLabels) {
- if (isNaN(value) || typeof value !== "number") {
- return value;
- }
- return value > -1 && value < valueLabels.length ? valueLabels[value] : value
- }
-
- var typeLabels = ["default", "1", "object", "text", "bytes", "map", "stream", "embedded"];
-
- var jmsTypeLabels = ["message", "object", "map", "bytes", "stream", "text"];
-
- var bindingTypeLabels = ["local-queue", "remote-queue", "divert"];
-
- var destTypeLabels = ["queue", "topic", "temp-queue", "temp-topic"];
-
- var amqpEncodingLabels = [
- "amqp-unknown", "amqp-null", "amqp-data", "amqp-sequence", "amqp-value-null",
- "amqp-value-string", "amqp-value-binary", "amqp-value-map", "amqp-value-list"];
-
- var routingTypes = ["multicast", "anycast"];
-
- var mqttQosTypes = ["at most once", "at least once", "exactly once"];
-
- ctrl.refresh = function() {
- Artemis.log.debug(ctrl.filter)
- //if refreshing always return to the first page
- ctrl.pagination.firstPage();
- }
-
- ctrl.reset = function() {
- ctrl.filter = '';
- //if resetting always return to the first page
- ctrl.pagination.firstPage();
- }
-
- function formatPersistentSize(bytes) {
- if(isNaN(bytes) || typeof bytes !== "number" || bytes < 0) return "N/A";
- if(bytes < 10240) return bytes.toLocaleString() + " Bytes";
- if(bytes < 1048576) return (bytes / 1024).toFixed(2) + " KiB";
- if(bytes < 1073741824) return (bytes / 1048576).toFixed(2) + " MiB";
- return (bytes / 1073741824).toFixed(2) + " GiB";
- }
-
- ctrl.openMoveDialog = function () {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- if(!selectedItems) {
- return;
- }
- ctrl.actionText = "You are about to move " + Core.maybePlural(selectedItems.length, "message");
- Artemis.log.debug(ctrl.actionText);
- ctrl.moveDialog = true;
- };
-
- ctrl.moveMessages = function (action, item) {
- var selection = workspace.selection;
- var mbean = selection.objectName;
- if (mbean && selection) {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- if(!selectedItems) {
- selectedItems = [];
- return;
- }
- ctrl.message = "Moved " + Core.maybePlural(selectedItems.length, "message") + " to " + ctrl.queueName;
- ctrl.errorMessage = "failed to move message";
- angular.forEach(selectedItems, function(item, idx) {
- var id = item.messageID;
- if (id) {
- var callback = (idx + 1 < selectedItems.length) ? intermediateResult : moveSuccess;
- jolokia.execute(mbean, "moveMessage(long,java.lang.String)", id, ctrl.queueName, Core.onSuccess(callback, { error: onError }));
- }
- });
- }
- };
-
- function resendMessage(action, item) {
- // always assume a single message
- artemisMessage.message = item;
- $location.path('artemis/artemisSendMessage');
- };
-
- function onError(response) {
- Core.notification("error", ctrl.errorMessage + response.error);
- }
-
- function handleCheckBoxChange (item) {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- Artemis.log.debug("sel " + selectedItems.length);
- if (selectedItems.length == 0) {
- ctrl.deleteDisabled = true;
- ctrl.moveDisabled = true;
- ctrl.retryDisabled = true;
- return;
- }
- ctrl.deleteDisabled = false;
- ctrl.moveDisabled = false;
- ctrl.retryDisabled = false;
- }
-
- ctrl.openDeleteDialog = function () {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- if(!selectedItems) {
- selectedItems = [];
- return;
- }
- ctrl.actionText = "You are about to delete " + Core.maybePlural(selectedItems.length, "message");
- Artemis.log.debug(ctrl.actionText);
- ctrl.deleteDialog = true;
- }
-
- ctrl.deleteMessages = function () {
- var selection = workspace.selection;
- var mbean = selection.objectName;
- if (mbean && selection) {
- var selectedItems = $filter('filter')(ctrl.allMessages, {selected: true});
- if(!selectedItems) {
- selectedItems = [];
- return;
- }
- ctrl.message = "Deleted " + Core.maybePlural(selectedItems.length, "message");
- ctrl.errorMessage = "failed to delete message";
- angular.forEach(selectedItems, function(item, idx) {
- var id = item.messageID;
- if (id) {
- var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
- jolokia.execute(mbean, "removeMessage(long)", id, Core.onSuccess(callback, { error: onError }));
- }
- });
- }
- };
-
- ctrl.openRetryDialog = function () {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- if(!selectedItems) {
- return;
- }
- ctrl.actionText = "You are about to retry " + Core.maybePlural(selectedItems.length, "message");
- Artemis.log.debug(ctrl.actionText);
- ctrl.retryDialog = true;
- };
-
- ctrl.retryMessages = function() {
- var selection = workspace.selection;
- var mbean = selection.objectName;
- if (mbean && selection) {
- var selectedItems = $filter('filter')(ctrl.messages, {selected: true});
- ctrl.message = "Retry " + Core.maybePlural(selectedItems.length, "message");
- ctrl.errorMessage = "failed to retry message";
- angular.forEach(selectedItems, function(item, idx) {
- var id = item.messageID;
- if (id) {
- var callback = (idx + 1 < selectedItems.length) ? intermediateResult : operationSuccess;
- jolokia.execute(mbean, "retryMessage(long)", id, Core.onSuccess(callback, { error: onError }));
- }
- });
- }
- };
-
- function populateTable(response) {
- Artemis.log.debug("loading data:" + data);
- if (ctrl.queueNames.length === 0) {
- var queueNames = getSelectionQueuesFolder(workspace);
- var selectedQueue = workspace.selection.text;
- ctrl.queueNames = queueNames.filter(function (name) { return name !== selectedQueue; });
- }
- var data = response.value;
-
- if (!angular.isArray(data)) {
- ctrl.allMessages = [];
- angular.forEach(data, function(value, idx) {
- ctrl.allMessages.push(value);
- })
- } else {
- ctrl.allMessages = data;
- }
- idx = 0;
-
- ctrl.dlq = ctrl.addressName.match(ctrl.artemisDLQ) != null ||
- ctrl.addressName.match(ctrl.artemisExpiryQueue) != null;
-
- angular.forEach(ctrl.allMessages, function(message) {
- ctrl.dlq = ctrl.dlq || (message['StringProperties'] ? (message['StringProperties']['_AMQ_ORIG_QUEUE'] ? true : (message['StringProperties']['extraProperties._AMQ_ORIG_QUEUE'] ? true : false)) : false);
- message.bodyText = createBodyText(message);
- if (idx == 0 && !ctrl.loadPrevousPage) {
- //always load n the first message for pagination when viewing message details
- ctrl.currentMessage = message;
- ctrl.currentMessage.headers = createHeaders(ctrl.currentMessage)
- ctrl.currentMessage.properties = createProperties(ctrl.currentMessage);
- }
- else if (idx == (pagination.pageSize - 1) && ctrl.loadPrevousPage) {
- delete ctrl.loadPrevousPage;
- ctrl.currentMessage = message;
- ctrl.currentMessage.headers = createHeaders(ctrl.currentMessage)
- ctrl.currentMessage.properties = createProperties(ctrl.currentMessage);
- }
- message.idx = idx;
- idx++;
- });
- ctrl.originalQueueColumn.visible = ctrl.dlq;
- ctrl.messages = ctrl.allMessages;
- ctrl.isLoading = false;
- Core.$apply($scope);
- }
-
- function findFolder(node) {
- if (!node) {
- return null;
- }
- var answer = [];
-
- var addresses = node.children;
-
- angular.forEach(addresses, function (address) {
- var subQueues = address.children;
- angular.forEach(subQueues, function (subQueue) {
- var routingTypes = subQueue.children;
- angular.forEach(routingTypes, function (routingType) {
- var queues = routingType.children;
- angular.forEach(queues, function (queue) {
- answer.push(queue.title);
- });
- });
- });
- });
- return answer;
- }
-
- function findAddressesNode(node) {
- if (!node) {
- return null;
- }
- if (node.title === "addresses") {
- return node;
- }
- if (node.title == Artemis.jmxDomain) {
- return null;
- }
- return findAddressesNode(node.parent);
- }
-
- function getSelectionQueuesFolder(workspace) {
- var selection = workspace.selection;
- var addressesNode = findAddressesNode(selection);
- var queueFolder = selection ? findFolder(addressesNode) : null;
- return queueFolder;
- }
-
- /*
- * For some reason using ng-repeat in the modal dialog doesn't work so lets
- * just create the HTML in code :)
- */
- function createBodyText(message) {
- Artemis.log.debug("loading message:" + message);
- if (message.text !== undefined) {
- var body = message.text;
- var lenTxt = "" + body.length;
- message.textMode = "text (" + lenTxt + " chars)";
- return body;
- } else if (message.BodyPreview) {
- var code = Core.parseIntValue(localStorage["ArtemisBrowseBytesMessages"] || "1", "browse bytes messages");
- var body;
- message.textMode = "bytes (turned off)";
- if (code != 99) {
- var bytesArr = [];
- var textArr = [];
- message.BodyPreview.forEach(function(b) {
- if (code === 1 || code === 2 || code === 16) {
- // text
- textArr.push(String.fromCharCode(b));
- }
- if (code === 1 || code === 4) {
- var unsignedByte = b & 0xff;
-
- if (unsignedByte < 16) {
- // hex and must be 2 digit so they space out evenly
- bytesArr.push('0' + unsignedByte.toString(16));
- } else {
- bytesArr.push(unsignedByte.toString(16));
- }
- } else {
- // just show as is without spacing out, as that is usually more used for hex than decimal
- var s = b.toString(10);
- bytesArr.push(s);
- }
- });
- var bytesData = bytesArr.join(" ");
- var textData = textArr.join("");
- if (code === 1 || code === 2) {
- // bytes and text
- var len = message.BodyPreview.length;
- var lenTxt = "" + textArr.length;
- body = "bytes:\n" + bytesData + "\n\ntext:\n" + textData;
- message.textMode = "bytes (" + len + " bytes) and text (" + lenTxt + " chars)";
- } else if (code === 16) {
- // text only
- var len = message.BodyPreview.length;
- var lenTxt = "" + textArr.length;
- body = "text:\n" + textData;
- message.textMode = "text (" + lenTxt + " chars)";
- } else {
- // bytes only
- var len = message.BodyPreview.length;
- body = bytesData;
- message.textMode = "bytes (" + len + " bytes)";
- }
- }
- return body;
- } else {
- message.textMode = "unsupported";
- return "Unsupported message body type which cannot be displayed by hawtio";
- }
- }
-
- function createHeaders(message) {
- var headers = [];
- angular.forEach(message, function (value, key) {
- if (!_.some(ignoreColumns, function (k) { return k === key; }) && !_.some(flattenColumns, function (k) { return k === key; })) {
- if(key === "expiration") {
- value += " (" + formatExpires(value, true) + ")";
- } else if(key === "persistentSize") {
- value += " (" + formatPersistentSize(value) + ")";
- } else if(key === "timestamp") {
- value += " (" + formatTimestamp(value) + ")";
- } else if(key === "type") {
- value += " (" + formatWithList(value, typeLabels) + ")";
- }
- headers.push({key: key, value: value});
- }
- });
- return headers;
- }
-
-
- function createProperties(message) {
- var properties = [];
- angular.forEach(message, function (value, key) {
- if (!_.some(ignoreColumns, function (k) { return k === key; }) && _.some(flattenColumns, function (k) { return k === key; })) {
- Artemis.log.debug("key=" + key + " value=" + value);
- angular.forEach(value, function (v2, k2) {
- Artemis.log.debug("key=" + k2 + " value=" + v2);
- if(k2 === "_AMQ_Binding_Type") {
- v2 += " (" + formatWithList(v2, bindingTypeLabels) + ")";
- } else if(k2 === "JMS_AMQP_ORIGINAL_ENCODING") {
- v2 += " (" + formatWithList(v2, amqpEncodingLabels) + ")";
- } else if(k2 === "_AMQ_ACTUAL_EXPIRY") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "_AMQ_NotifTimestamp") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "_AMQ_ROUTING_TYPE") {
- v2 += " (" + formatWithList(v2, routingTypes) + ")";
- } else if(k2 === "_AMQ_ORIG_ROUTING_TYPE") {
- v2 += " (" + formatWithList(v2, routingTypes) + ")";
- } else if(k2 === "extraProperties._AMQ_ACTUAL_EXPIRY") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "extraProperties._AMQ_ORIG_ROUTING_TYPE") {
- v2 += " (" + formatWithList(v2, routingTypes) + ")";
- } else if(k2 === "messageAnnotations.x-opt-jms-dest") {
- v2 += " (" + formatWithList(v2, destTypeLabels) + ")";
- } else if(k2 === "messageAnnotations.x-opt-jms-reply-to") {
- v2 += " (" + formatWithList(v2, destTypeLabels) + ")";
- } else if(k2 === "messageAnnotations.x-opt-jms-msg-type") {
- v2 += " (" + formatWithList(v2, jmsTypeLabels) + ")";
- } else if(k2 === "messageAnnotations.x-opt-ACTUAL-EXPIRY") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "messageAnnotations.x-opt-ORIG-ROUTING-TYPE") {
- v2 += " (" + formatWithList(v2, routingTypes) + ")";
- } else if(k2 === "properties.absoluteExpiryTime") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "properties.creationTime") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "__HDR_BROKER_IN_TIME") {
- v2 += " (" + formatTimestamp(v2) + ")";
- } else if(k2 === "mqtt.qos.level") {
- v2 += " (" + formatWithList(v2, mqttQosTypes) + ")";
- }
- properties.push({key: k2, value: v2});
- });
- }
- });
- return properties;
- }
-
- ctrl.loadTable = function() {
- Artemis.log.debug("loading table")
- ctrl.dlq = false;
- ctrl.isLoading = true;
- if (ctrl.objName) {
- //make sure to count only filtered messages
- if (ctrl.filter) {
- jolokia.request({ type: 'exec', mbean: ctrl.objName, operation: 'countMessages(java.lang.String)', arguments: [ctrl.filter] }, Core.onSuccess(function(response) { ctrl.pagination.page(response.value); }, { error: onError }));
- } else {
- jolokia.request({ type: 'exec', mbean: ctrl.objName, operation: 'countMessages()'}, Core.onSuccess(function(response) { ctrl.pagination.page(response.value); }, { error: onError }));
- }
-
- jolokia.request({ type: 'exec', mbean: ctrl.objName, operation: 'browse(int, int, java.lang.String)', arguments: [ctrl.pagination.pageNumber, ctrl.pagination.pageSize, ctrl.filter] }, Core.onSuccess(populateTable, { error: onError }));
- }
- }
-
- function operationSuccess() {
- ctrl.messageDialog = false;
- Core.notification("success", ctrl.message);
- ctrl.pagination.load();
- }
-
- function intermediateResult() {
- }
-
-
- function moveSuccess() {
- operationSuccess();
- workspace.loadTree();
- }
-
- function filterMessages(filter) {
- var searchConditions = buildSearchConditions(filter);
- evalFilter(searchConditions);
- }
-
- function applyFilters(filters) {
- Artemis.log.debug("filters " + filters);
- ctrl.messages = [];
- if (filters && filters.length > 0) {
- ctrl.allMessages.forEach(function (message) {
- if (matchesFilters(message, filters)) {
- ctrl.messages.push(message);
- }
- });
- } else {
- ctrl.messages = ctrl.allMessages;
- }
- };
-
- var matchesFilter = function (message, filter) {
- var match = true;
-
- if (filter.id === 'messageID') {
- match = message.messageID.match(filter.value) !== null;
- } else if (filter.id === 'body') {
- match = message.bodyText.match(filter.value) !== null;
- } else if (filter.id === 'properties') {
- match = message.PropertiesText.match(filter.value) !== null;
- } else if (filter.id === 'priority') {
- match = message.priority == filter.value;
- } else if (filter.id === 'redelivered') {
- var filterTrue = filter.value == 'true';
- match = (message.redelivered == filterTrue);
- }
- return match;
- };
-
- var matchesFilters = function (message, filters) {
- var matches = true;
-
- filters.forEach(function(filter) {
-
- Artemis.log.debug("filter " + filter.id);
- if (!matchesFilter(message, filter)) {
- matches = false;
- return false;
- }
- });
- return matches;
- };
-
- function evalFilter(searchConditions) {
- if (!searchConditions || searchConditions.length === 0) {
- $scope.messages = ctrl.allMessages;
- } else {
- Artemis.log.debug("Filtering conditions:", searchConditions);
- $scope.messages = ctrl.allMessages.filter(function(message) {
- Artemis.log.debug("Message:", message);
- var matched = true;
- $.each(searchConditions, function(index, condition) {
- if (!condition.column) {
- matched = matched && evalMessage(message, condition.regex);
- } else {
- matched = matched && (message[condition.column] && condition.regex.test(message[condition.column])) || (message.StringProperties && message.StringProperties[condition.column] && condition.regex.test(message.StringProperties[condition.column]));
- }
- });
- return matched;
- });
- }
- }
-
- function evalMessage(message, regex) {
- var jmsHeaders = ['JMSDestination', 'JMSDeliveryMode', 'JMSExpiration', 'JMSPriority', 'JMSmessageID', 'JMSTimestamp', 'JMSCorrelationID', 'JMSReplyTo', 'JMSType', 'JMSRedelivered'];
- for (var i = 0; i < jmsHeaders.length; i++) {
- var header = jmsHeaders[i];
- if (message[header] && regex.test(message[header])) {
- return true;
- }
- }
- if (message.StringProperties) {
- for ( var property in message.StringProperties) {
- if (regex.test(message.StringProperties[property])) {
- return true;
- }
- }
- }
- if (message.bodyText && regex.test(message.bodyText)) {
- return true;
- }
- return false;
- }
-
- function getRegExp(str, modifiers) {
- try {
- return new RegExp(str, modifiers);
- } catch (err) {
- return new RegExp(str.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\\|\||\.|\*|\+|\?)/g, '\\$1'));
- }
- }
-
- function buildSearchConditions(filterText) {
- var searchConditions = [];
- var qStr;
- if (!(qStr = $.trim(filterText))) {
- return;
- }
- var columnFilters = qStr.split(";");
- for (var i = 0; i < columnFilters.length; i++) {
- var args = columnFilters[i].split(':');
- if (args.length > 1) {
- var columnName = $.trim(args[0]);
- var columnValue = $.trim(args[1]);
- if (columnName && columnValue) {
- searchConditions.push({
- column: columnName,
- columnDisplay: columnName.replace(/\s+/g, '').toLowerCase(),
- regex: getRegExp(columnValue, 'i')
- });
- }
- } else {
- var val = $.trim(args[0]);
- if (val) {
- searchConditions.push({
- column: '',
- regex: getRegExp(val, 'i')
- });
- }
- }
- }
- return searchConditions;
- }
- ctrl.pagination.setOperation(ctrl.loadTable);
- ctrl.pagination.load();
- }
- BrowseQueueController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination'];
-
-})(Artemis || (Artemis = {}));
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/connections.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/connections.js
deleted file mode 100644
index 649fface208..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/connections.js
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-var Artemis;
-(function (Artemis) {
- Artemis.log.debug("loading connections");
- Artemis._module.component('artemisConnections', {
- template:
- `
-
Browse Connections
-
-
-
-
-
-
-
-
-
-
- You are about to close the selected connection: {{$ctrl.connectionToDelete}}
-
Are you sure you want to continue.
-
-
-
-
-
- `,
- controller: ConnectionsController
- })
- .name;
-
-
- function ConnectionsController($scope, workspace, jolokia, localStorage, artemisMessage, $location, $timeout, $filter, pagination, artemisConnection, artemisSession) {
- var ctrl = this;
- ctrl.pagination = pagination;
- ctrl.pagination.reset();
- var mbean = Artemis.getBrokerMBean(workspace, jolokia);
- ctrl.allConnections = [];
- ctrl.connections = [];
- ctrl.pageNumber = 1;
- ctrl.workspace = workspace;
- ctrl.refreshed = false;
- ctrl.connectionToDelete = '';
- ctrl.closeDialog = false;
- ctrl.dtOptions = {
- // turn of ordering as we do it ourselves
- ordering: false,
- columns: [
- {name: "ID", visible: true},
- {name: "Client ID", visible: true},
- {name: "Users", visible: true},
- {name: "Protocol", visible: true},
- {name: "Session Count", visible: true},
- {name: "Remote Address", visible: true},
- {name: "Local Address", visible: true},
- {name: "Session ID", visible: true},
- {name: "Creation Time", visible: true}
- ]
- };
-
- Artemis.log.debug('localStorage: connectionsColumnDefs =', localStorage.getItem('connectionsColumnDefs'));
- if (localStorage.getItem('connectionsColumnDefs')) {
- loadedDefs = JSON.parse(localStorage.getItem('connectionsColumnDefs'));
- //sanity check to make sure columns havent been added
- if(loadedDefs.length === ctrl.dtOptions.columns.length) {
- ctrl.dtOptions.columns = loadedDefs;
- }
- Artemis.log.debug('loaded' + ctrl.dtOptions.columns);
- }
-
- ctrl.updateColumns = function () {
- var attributes = [];
- ctrl.dtOptions.columns.forEach(function (column) {
- attributes.push({name: column.name, visible: column.visible});
- });
- Artemis.log.debug("saving columns " + JSON.stringify(attributes));
- localStorage.setItem('connectionsColumnDefs', JSON.stringify(attributes));
- }
-
- ctrl.filter = {
- fieldOptions: [
- {id: 'connectionID', name: 'ID'},
- {id: 'clientID', name: 'Client ID'},
- {id: 'users', name: 'Users'},
- {id: 'protocol', name: 'Protocol'},
- {id: 'sessionCount', name: 'Session Count'},
- {id: 'remoteAddress', name: 'Remote Address'},
- {id: 'localAddress', name: 'Local Address'},
- {id: 'sessionID', name: 'Session ID'}
- ],
- operationOptions: [
- {id: 'EQUALS', name: 'Equals'},
- {id: 'CONTAINS', name: 'Contains'},
- {id: 'NOT_CONTAINS', name: 'Does Not Contain'},
- {id: 'GREATER_THAN', name: 'Greater Than'},
- {id: 'LESS_THAN', name: 'Less Than'}
- ],
- sortOptions: [
- {id: 'asc', name: 'ascending'},
- {id: 'desc', name: 'descending'}
- ],
- values: {
- field: "",
- operation: "",
- value: "",
- sortOrder: "asc",
- sortColumn: "connectionID"
- },
- text: {
- fieldText: "Filter Field..",
- operationText: "Operation..",
- sortOrderText: "ascending",
- sortByText: "ID"
- }
- };
-
- ctrl.tableActionButtons = [
- {
- name: 'Close',
- title: 'Close the Connection',
- actionFn: openCloseDialog
- }
- ];
-
- ctrl.tableConfig = {
- selectionMatchProp: 'connectionID',
- showCheckboxes: false
- };
- ctrl.tableColumns = [
- { header: 'ID', itemField: 'connectionID' },
- { header: 'Client ID', itemField: 'clientID' },
- { header: 'Users', itemField: 'users' },
- { header: 'protocol', itemField: 'protocol' },
- { header: 'Session Count', itemField: 'sessionCount', htmlTemplate: 'connections-anchor-column-template', colActionFn: (item) => selectSessions(item.idx) },
-
- { header: 'Remote Address', itemField: 'remoteAddress' },
- { header: 'Local Address', itemField: 'localAddress' },
- { header: 'Creation Time', itemField: 'creationTime' }
- ];
-
- selectSessions = function (idx) {
- var connection = ctrl.connections[idx].connectionID;
- Artemis.log.debug("navigating to connection:" + connection)
- artemisConnection.connection = { connectionID: connection };
- $location.path("artemis/artemisSessions");
- };
-
- if (artemisSession.session) {
- Artemis.log.debug("navigating to session = " + artemisSession.session.connectionID);
- ctrl.filter.values.field = ctrl.filter.fieldOptions[0].id;
- ctrl.filter.values.operation = ctrl.filter.operationOptions[0].id;
- ctrl.filter.values.value = artemisSession.session.connectionID;
- artemisSession.session = null;
- }
-
- ctrl.refresh = function () {
- ctrl.refreshed = true;
- ctrl.pagination.load();
- };
- ctrl.reset = function () {
- ctrl.filter.values.field = "";
- ctrl.filter.values.operation = "";
- ctrl.filter.values.value = "";
- ctrl.filter.sortOrder = "asc";
- ctrl.filter.sortColumn = "connectionID";
- ctrl.filter.text.fieldText = "Filter Field..";
- ctrl.filter.text.operationText = "Operation..";
- ctrl.filter.text.sortOrderText = "ascending";
- ctrl.filter.text.sortByText = "ID";
- ctrl.refreshed = true;
- artemisSession.session = null;
- ctrl.pagination.load();
- };
-
- ctrl.loadOperation = function () {
- if (mbean) {
- var method = 'listConnections(java.lang.String, int, int)';
- var connectionsFilter = {
- field: ctrl.filter.values.field,
- operation: ctrl.filter.values.operation,
- value: ctrl.filter.values.value,
- sortOrder: ctrl.filter.values.sortOrder,
- sortColumn: ctrl.filter.values.sortColumn
- };
-
- if (ctrl.refreshed == true) {
- ctrl.pagination.reset();
- ctrl.refreshed = false;
- }
- Artemis.log.info(JSON.stringify(connectionsFilter));
- jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [JSON.stringify(connectionsFilter), ctrl.pagination.pageNumber, ctrl.pagination.pageSize] }, Core.onSuccess(populateTable, { error: onError }));
- }
- };
-
- function openCloseDialog(action, item) {
- ctrl.connectionToDelete = item.connectionID;
- ctrl.closeDialog = true;
- }
-
- ctrl.closeConnection = function () {
- Artemis.log.debug("closing connection: " + ctrl.connectionToDelete);
- if (mbean) {
- jolokia.request({ type: 'exec',
- mbean: mbean,
- operation: 'closeConnectionWithID(java.lang.String)',
- arguments: [ctrl.connectionToDelete] },
- Core.onSuccess(ctrl.pagination.load(), { error: function (response) {
- Core.defaultJolokiaErrorHandler("Could not close connection: " + response);
- }}));
- }
- };
-
- pagination.setOperation(ctrl.loadOperation);
-
- function onError(response) {
- Core.notification("error", "could not invoke list connections" + response.error);
- $scope.workspace.selectParentNode();
- };
-
- function populateTable(response) {
- var data = JSON.parse(response.value);
- ctrl.connections = [];
- angular.forEach(data["data"], function (value, idx) {
- value.idx = idx;
- ctrl.connections.push(value);
- });
- ctrl.pagination.page(data["count"]);
- allConnections = ctrl.connections;
- ctrl.connections = allConnections;
- Core.$apply($scope);
- }
-
- ctrl.pagination.load();
- }
- ConnectionsController.$inject = ['$scope', 'workspace', 'jolokia', 'localStorage', 'artemisMessage', '$location', '$timeout', '$filter', 'pagination', 'artemisConnection', 'artemisSession'];
-
-
-})(Artemis || (Artemis = {}));
\ No newline at end of file
diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/consumers.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/consumers.js
deleted file mode 100644
index 6c7ed8bc1d1..00000000000
--- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/components/consumers.js
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
- */
-var Artemis;
-(function (Artemis) {
- Artemis._module.component('artemisConsumers', {
- template:
- `
Browse Consumers
-
-
-
-
-
-
-
-
-
-
- You are about to close the selected consumer: {{$ctrl.consumerToDelete}}
-