ARTEMIS-1350 Expose Client Objects in Console
This commit is contained in:
parent
bb3965b7f7
commit
06ea18d55c
|
@ -0,0 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.AddressesController">
|
||||
|
||||
<!-- TODO This should be templated and included -->
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,53 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.ConnectionsController">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.ConsumersController">
|
||||
|
||||
<!-- TODO This should be templated and included -->
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.ProducersController">
|
||||
|
||||
<!-- TODO This should be templated and included -->
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.QueuesController">
|
||||
|
||||
<!-- TODO This should be templated and included -->
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,53 @@
|
|||
<!--
|
||||
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.
|
||||
Architecture
|
||||
-->
|
||||
<div ng-controller="ARTEMIS.SessionsController">
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span24">
|
||||
<div class="control-group inline-block">
|
||||
<form class="form-inline no-bottom-margin">
|
||||
<span class="label label-default">Filter</span>
|
||||
|
||||
<select ng-model="filter.values.field" id="filter.values.field">
|
||||
<option ng-repeat="option in filter.fieldOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<select ng-model="filter.values.operation" id="filter.values.operation">
|
||||
<option ng-repeat="option in filter.operationOptions" value="{{option.id}}">{{option.name}}
|
||||
</option>
|
||||
</select>
|
||||
<input class="search-query" type="text" ng-model="filter.values.value" placeholder="Value">
|
||||
<button class="btn" ng-click="refresh()"
|
||||
title="Filter">
|
||||
<i class="icon-search"> </i>
|
||||
</button>
|
||||
|
||||
<button class="btn pull-right" ng-click="reset()"
|
||||
title="Reset">
|
||||
<i class="icon-refresh"> Reset</i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,196 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.AddressesController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisAddress) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "address";
|
||||
var method = 'listAddresses(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'manage',
|
||||
displayName: 'manage',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="navigateToAddressAtts(row)">attributes</a> <a ng-click="navigateToAddressOps(row)">operations</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
displayName: 'Name',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'routingTypes',
|
||||
displayName: 'Routing Types',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'queueCount',
|
||||
displayName: 'Queue Count',
|
||||
width: '*'
|
||||
}
|
||||
];
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'ID', name: 'ID'},
|
||||
{id: 'NAME', name: 'Name'},
|
||||
{id: 'ROUTING_TYPES', name: 'Routing Types'},
|
||||
{id: 'QUEUE_COUNT', name: 'Queue Count'},
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "ID"
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
|
||||
|
||||
if (artemisAddress.address) {
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[1].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisAddress.address.address;
|
||||
artemisAddress.address = null;
|
||||
}
|
||||
|
||||
$scope.navigateToAddressAtts = function (row) {
|
||||
$location.path("jmx/attributes").search({"tab": "artemis", "nid": ARTEMIS.getAddressNid(row.entity, $location)});
|
||||
};
|
||||
$scope.navigateToAddressOps = function (row) {
|
||||
$location.path("jmx/operations").search({"tab": "artemis", "nid": ARTEMIS.getAddressNid(row.entity, $location)});
|
||||
};
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
|
@ -123,4 +123,27 @@ var ARTEMIS;
|
|||
});
|
||||
}
|
||||
ARTEMIS.decorate = decorate;
|
||||
|
||||
function getAddressNid(address, $location) {
|
||||
var rootNID = getRootNid($location);
|
||||
var targetNID = rootNID + "-addresses-\"" + address.name + "\"";
|
||||
ARTEMIS.log.info("targetNID=" + targetNID);
|
||||
return targetNID;
|
||||
}
|
||||
ARTEMIS.getAddressNid = getAddressNid;
|
||||
|
||||
function getQueueNid(queue, $location) {
|
||||
var rootNID = getRootNid($location);
|
||||
var targetNID = rootNID + "-addresses-\"" + queue.address + "\"-queues-\"" + queue.routingType.toLowerCase() + "\"-\"" + queue.name + "\"";
|
||||
return targetNID;
|
||||
}
|
||||
ARTEMIS.getQueueNid = getQueueNid;
|
||||
|
||||
function getRootNid($location) {
|
||||
var currentNid = $location.search()['nid'];
|
||||
var firstQoute = currentNid.indexOf('"');
|
||||
var secondQuote = currentNid.indexOf('"', firstQoute + 1);
|
||||
var rootNID = currentNid.substring(0, secondQuote + 1);
|
||||
return rootNID;
|
||||
}
|
||||
})(ARTEMIS || (ARTEMIS = {}));
|
|
@ -110,12 +110,48 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
})
|
||||
.when('/artemis/sendMessage', {
|
||||
templateUrl: ARTEMIS.templatePath + 'sendMessage.html'
|
||||
});
|
||||
})
|
||||
.when('/artemis/connections', {
|
||||
templateUrl: ARTEMIS.templatePath + 'connections.html'
|
||||
})
|
||||
.when('/artemis/sessions', {
|
||||
templateUrl: ARTEMIS.templatePath + 'sessions.html'
|
||||
})
|
||||
.when('/artemis/consumers', {
|
||||
templateUrl: ARTEMIS.templatePath + 'consumers.html'
|
||||
})
|
||||
.when('/artemis/producers', {
|
||||
templateUrl: ARTEMIS.templatePath + 'producers.html'
|
||||
})
|
||||
.when('/artemis/addresses', {
|
||||
templateUrl: ARTEMIS.templatePath + 'addresses.html'
|
||||
})
|
||||
.when('/artemis/queues', {
|
||||
templateUrl: ARTEMIS.templatePath + 'queues.html'
|
||||
});
|
||||
});
|
||||
|
||||
ARTEMIS.module.factory('artemisMessage', function () {
|
||||
return { 'message': null };
|
||||
});
|
||||
});
|
||||
ARTEMIS.module.factory('artemisConnection', function () {
|
||||
return { 'connection': null };
|
||||
});
|
||||
ARTEMIS.module.factory('artemisSession', function () {
|
||||
return { 'session': null };
|
||||
});
|
||||
ARTEMIS.module.factory('artemisConsumer', function () {
|
||||
return { 'consumer': null };
|
||||
});
|
||||
ARTEMIS.module.factory('artemisProducer', function () {
|
||||
return { 'producer': null };
|
||||
});
|
||||
ARTEMIS.module.factory('artemisQueue', function () {
|
||||
return { 'queue': null };
|
||||
});
|
||||
ARTEMIS.module.factory('artemisAddress', function () {
|
||||
return { 'address': null };
|
||||
});
|
||||
|
||||
// one-time initialization happens in the run function
|
||||
// of our module
|
||||
|
@ -213,12 +249,54 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
href: function () { return "#/artemis/sendMessage"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.push({
|
||||
content: '<i class="icon-picture"></i> Diagram',
|
||||
title: "View a diagram of the producers, destinations and consumers",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/diagram"; }
|
||||
});
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-picture"></i> Diagram |',
|
||||
title: "View a diagram of the producers, destinations and consumers",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/diagram"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-th-list"></i> Queues',
|
||||
title: "Manage Queues",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/queues"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-book"></i> Addresses',
|
||||
title: "Manage Addresses",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/addresses"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-upload-alt"></i> Producers',
|
||||
title: "Manage Producers",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/producers"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-download-alt"></i> Consumers',
|
||||
title: "Manage Consumers",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/consumers"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-tasks"></i> Sessions',
|
||||
title: "Manage Sessions",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/sessions"; }
|
||||
});
|
||||
|
||||
workspace.subLevelTabs.unshift({
|
||||
content: '<i class="icon-signal"></i> Connections',
|
||||
title: "Manage Connections",
|
||||
isValid: function (workspace) { return workspace.isTopTabActive("artemis") || workspace.selectionHasDomain(artemisJmxDomain); },
|
||||
href: function () { return "#/artemis/connections"; }
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.ConnectionsController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisConnection, artemisSession) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "connection"
|
||||
var method = 'listConnections(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'connectionID',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'clientID',
|
||||
displayName: 'Client ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'users',
|
||||
displayName: 'Users',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'protocol',
|
||||
displayName: 'Protocol',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'sessionCount',
|
||||
displayName: 'Session Count',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectSessions(row)">{{row.entity.sessionCount}}</a></div>',
|
||||
},
|
||||
{
|
||||
field: 'remoteAddress',
|
||||
displayName: 'Remote Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'localAddress',
|
||||
displayName: 'Local Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'creationTime',
|
||||
displayName: 'Creation Time',
|
||||
width: '*'
|
||||
}
|
||||
];
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'CONNECTION_ID', name: 'Connection ID'},
|
||||
{id: 'CLIENT_ID', name: 'Client ID'},
|
||||
{id: 'USERS', name: 'Users'},
|
||||
{id: 'PROTOCOL', name: 'Protocol'},
|
||||
{id: 'SESSION_COUNT', name: 'Session Count'},
|
||||
{id: 'REMOTE_ADDRESS', name: 'Remote Address'},
|
||||
{id: 'LOCAL_ADDRESS', name: 'Local Address'},
|
||||
{id: 'SESSION_ID', name: 'Session ID'}
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "CONNECTION_ID"
|
||||
}
|
||||
};
|
||||
|
||||
// Configure Parent/Child click through relationships
|
||||
if (artemisSession.session) {
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[0].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisSession.session.connectionID;
|
||||
artemisSession.session = null;
|
||||
}
|
||||
|
||||
$scope.selectSessions = function (connection) {
|
||||
artemisConnection.connection = connection.entity;
|
||||
$location.path("artemis/sessions");
|
||||
};
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
|
@ -0,0 +1,239 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.ConsumersController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisConnection, artemisSession, artemisConsumer, artemisQueue, artemisAddress) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "consumer";
|
||||
var method = 'listConsumers(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'id',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'session',
|
||||
displayName: 'Session',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.session}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'clientID',
|
||||
displayName: 'Client ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'protocol',
|
||||
displayName: 'Protocol',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'queue',
|
||||
displayName: 'Queue',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectQueue(row)">{{row.entity.queue}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'queueType',
|
||||
displayName: 'Queue Type',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'address',
|
||||
displayName: 'Address',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.address}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'remoteAddress',
|
||||
displayName: 'Remote Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'localAddress',
|
||||
displayName: 'Local Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'creationTime',
|
||||
displayName: 'Creation Time',
|
||||
width: '*'
|
||||
}
|
||||
];
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'ID', name: 'ID'},
|
||||
{id: 'SESSION_ID', name: 'Session ID'},
|
||||
{id: 'CLIENT_ID', name: 'Client ID'},
|
||||
{id: 'USER', name: 'User'},
|
||||
{id: 'ADDRESS', name: 'Address'},
|
||||
{id: 'QUEUE', name: 'Queue'},
|
||||
{id: 'PROTOCOL', name: 'Protocol'},
|
||||
{id: 'REMOTE_ADDRESS', name: 'Remote Address'},
|
||||
{id: 'LOCAL_ADDRESS', name: 'Local Address'}
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "ID"
|
||||
}
|
||||
};
|
||||
|
||||
$scope.selectSession = function (row) {
|
||||
artemisConsumer.consumer = row.entity;
|
||||
$location.path("artemis/sessions");
|
||||
};
|
||||
|
||||
$scope.selectQueue = function (row) {
|
||||
artemisQueue.queue = row.entity;
|
||||
$location.path("artemis/queues");
|
||||
};
|
||||
|
||||
$scope.selectAddress = function (row) {
|
||||
artemisAddress.address = row.entity;
|
||||
$location.path("artemis/addresses");
|
||||
};
|
||||
|
||||
// Configure Parent/Child click through relationships
|
||||
if (artemisSession.session) {
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[1].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisSession.session.id;
|
||||
artemisSession.session = null;
|
||||
}
|
||||
|
||||
artemisSession.session = null;
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
|
@ -0,0 +1,220 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.ProducersController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisAddress, artemisSession, artemisProducer) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "producer";
|
||||
var method = 'listProducers(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'id',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'session',
|
||||
displayName: 'Session',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectSession(row)">{{row.entity.session}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'clientID',
|
||||
displayName: 'Client ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'protocol',
|
||||
displayName: 'Protocol',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'user',
|
||||
displayName: 'User',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'address',
|
||||
displayName: 'Address',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectAddress(row)">{{row.entity.address}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'remoteAddress',
|
||||
displayName: 'Remote Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'localAddress',
|
||||
displayName: 'Local Address',
|
||||
width: '*'
|
||||
}
|
||||
];
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'ID', name: 'ID'},
|
||||
{id: 'SESSION_ID', name: 'Session ID'},
|
||||
{id: 'CLIENT_ID', name: 'Client ID'},
|
||||
{id: 'USER', name: 'User'},
|
||||
{id: 'ADDRESS', name: 'Address'},
|
||||
{id: 'PROTOCOL', name: 'Protocol'},
|
||||
{id: 'REMOTE_ADDRESS', name: 'Remote Address'},
|
||||
{id: 'LOCAL_ADDRESS', name: 'Local Address'}
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "ID"
|
||||
}
|
||||
};
|
||||
|
||||
$scope.selectAddress = function (row) {
|
||||
artemisAddress.address = row.entity;
|
||||
$location.path("artemis/addresses");
|
||||
};
|
||||
|
||||
$scope.selectSession = function (row) {
|
||||
artemisProducer.producer = row.entity;
|
||||
$location.path("artemis/sessions");
|
||||
};
|
||||
|
||||
// Configure Parent/Child click through relationships
|
||||
if (artemisSession.session) {
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[1].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisSession.session.id;
|
||||
artemisSession.session = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
|
@ -0,0 +1,298 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.QueuesController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisConnection, artemisSession, artemisQueue) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "queue";
|
||||
var method = 'listQueues(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'manage',
|
||||
displayName: 'manage',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="navigateToQueueAtts(row)">attributes</a> <a ng-click="navigateToQueueOps(row)">operations</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
displayName: 'Name',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'address',
|
||||
displayName: 'Address',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'routingType',
|
||||
displayName: 'Routing Type',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'filter',
|
||||
displayName: 'Filter',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'durable',
|
||||
displayName: 'Durable',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'maxConsumers',
|
||||
displayName: 'Max Consumers',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'purgeOnNoConsumers',
|
||||
displayName: 'Purge On No Consumers',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'consumerCount',
|
||||
displayName: 'Consumer Count',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'rate',
|
||||
displayName: 'Rate',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'messageCount',
|
||||
displayName: 'Message Count',
|
||||
width: '*'
|
||||
},
|
||||
|
||||
// Hidden
|
||||
{
|
||||
field: 'paused',
|
||||
displayName: 'Paused',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'temporary',
|
||||
displayName: 'Temporary',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'autoCreated',
|
||||
displayName: 'Auto Created',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'user',
|
||||
displayName: 'User',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'messagesAdded',
|
||||
displayName: 'Total Messages Added',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'messagesAcked',
|
||||
displayName: 'Total Messages Acked',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'deliveringCount',
|
||||
displayName: 'Deliveing Count',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'messagesKilled',
|
||||
displayName: 'Messages Killed',
|
||||
width: '*',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'directDeliver',
|
||||
displayName: 'Deliveing Count',
|
||||
width: '*',
|
||||
visible: false
|
||||
}
|
||||
];
|
||||
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'ID', name: 'ID'},
|
||||
{id: 'NAME', name: 'Name'},
|
||||
{id: 'CONSUMER_ID', name: 'Consumer ID'},
|
||||
{id: 'ADDRESS', name: 'Address'},
|
||||
{id: 'FILTER', name: 'Filter'},
|
||||
{id: 'MAX_CONSUMERS', name: 'maxConsumers'},
|
||||
{id: 'ROUTING_TYPE', name: 'Routing Type'},
|
||||
{id: 'PURGE_ON_NO_CONSUMERS', name: 'Purge On No Consumers'},
|
||||
{id: 'USER', name: 'User'},
|
||||
{id: 'MESSAGE_COUNT', name: 'Message Count'},
|
||||
{id: 'DELIVERING_COUNT', name: 'Delivering Count'},
|
||||
{id: 'PAUSED', name: 'Paused'},
|
||||
{id: 'TEMPORARY', name: 'Temporary'},
|
||||
{id: 'AUTO_CREATED', name: 'Auto Created'},
|
||||
{id: 'RATE', name: 'Rate'},
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "ID"
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
if (artemisQueue.queue) {
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[1].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisQueue.queue.queue;
|
||||
artemisQueue.queue = null;
|
||||
}
|
||||
|
||||
artemisSession.session = null;
|
||||
$scope.navigateToQueueAtts = function (row) {
|
||||
$location.path("jmx/attributes").search({"tab": "artemis", "nid": ARTEMIS.getQueueNid(row.entity, $location)});
|
||||
};
|
||||
$scope.navigateToQueueOps = function (row) {
|
||||
$location.path("jmx/operations").search({"tab": "artemis", "nid": ARTEMIS.getQueueNid(row.entity, $location)});
|
||||
};
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
/**
|
||||
* @module ARTEMIS
|
||||
*/
|
||||
var ARTEMIS = (function(ARTEMIS) {
|
||||
|
||||
ARTEMIS.SessionsController = function ($scope, $location, workspace, ARTEMISService, jolokia, localStorage, artemisConnection, artemisSession, artemisConsumer, artemisProducer) {
|
||||
|
||||
var artemisJmxDomain = localStorage['artemisJmxDomain'] || "org.apache.activemq.artemis";
|
||||
|
||||
/**
|
||||
* Required For Each Object Type
|
||||
*/
|
||||
|
||||
var objectType = "sessions"
|
||||
var method = 'listSessions(java.lang.String, int, int)';
|
||||
var attributes = [
|
||||
{
|
||||
field: 'id',
|
||||
displayName: 'ID',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'connectionID',
|
||||
displayName: 'Connection',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectConnection(row)">{{row.entity.connectionID}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'user',
|
||||
displayName: 'User',
|
||||
width: '*'
|
||||
},
|
||||
{
|
||||
field: 'consumerCount',
|
||||
displayName: 'Consumer Count',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectConsumers(row)">{{row.entity.consumerCount}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'producerCount',
|
||||
displayName: 'Producer Count',
|
||||
width: '*',
|
||||
cellTemplate: '<div class="ngCellText"><a ng-click="selectProducers(row)">{{row.entity.producerCount}}</a></div>'
|
||||
},
|
||||
{
|
||||
field: 'creationTime',
|
||||
displayName: 'Creation Time',
|
||||
width: '*'
|
||||
},
|
||||
];
|
||||
$scope.filter = {
|
||||
fieldOptions: [
|
||||
{id: 'ID', name: 'ID'},
|
||||
{id: 'CONNECTION_ID', name: 'Connection ID'},
|
||||
{id: 'CONSUMER_COUNT', name: 'Consumer Count'},
|
||||
{id: 'USER', name: 'User'},
|
||||
{id: 'PROTOCOL', name: 'Protocol'},
|
||||
{id: 'CLIENT_ID', name: 'Client ID'},
|
||||
{id: 'LOCAL_ADDRESS', name: 'Local Address'},
|
||||
{id: 'REMOTE_ADDRESS', name: 'Remote Address'},
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
{id: 'CONTAINS', name: 'Contains'}
|
||||
],
|
||||
values: {
|
||||
field: "",
|
||||
operation: "",
|
||||
value: "",
|
||||
sortOrder: "asc",
|
||||
sortBy: "ID"
|
||||
}
|
||||
};
|
||||
// Configure Parent/Child click through relationships
|
||||
$scope.selectConnection = function (row) {
|
||||
artemisSession.session = row.entity;
|
||||
$location.path("artemis/connections");
|
||||
};
|
||||
|
||||
$scope.selectProducers = function (row) {
|
||||
artemisSession.session = row.entity;
|
||||
$location.path("artemis/producers");
|
||||
};
|
||||
|
||||
$scope.selectConsumers = function (row) {
|
||||
artemisSession.session = row.entity;
|
||||
$location.path("artemis/consumers");
|
||||
};
|
||||
|
||||
if (artemisConnection.connection) {
|
||||
ARTEMIS.log.info("navigating to connection = " + artemisConnection.connection.connectionID);
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[1].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisConnection.connection.connectionID;
|
||||
}
|
||||
|
||||
if (artemisConsumer.consumer) {
|
||||
ARTEMIS.log.info("navigating to connection = " + artemisConsumer.consumer.ID);
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[0].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisConsumer.consumer.session;
|
||||
}
|
||||
|
||||
if (artemisProducer.producer) {
|
||||
ARTEMIS.log.info("navigating to producer = " + artemisProducer.producer.ID);
|
||||
$scope.filter.values.field = $scope.filter.fieldOptions[0].id;
|
||||
$scope.filter.values.operation = $scope.filter.operationOptions[0].id;
|
||||
$scope.filter.values.value = artemisProducer.producer.session;
|
||||
}
|
||||
//refresh after use
|
||||
artemisSession.connection = null;
|
||||
artemisConsumer.consumer = null;
|
||||
artemisProducer.producer = null;
|
||||
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
* TODO Refactor into new separate files
|
||||
*/
|
||||
|
||||
$scope.workspace = workspace;
|
||||
$scope.objects = [];
|
||||
$scope.totalServerItems = 0;
|
||||
$scope.pagingOptions = {
|
||||
pageSizes: [50, 100, 200],
|
||||
pageSize: 100,
|
||||
currentPage: 1
|
||||
};
|
||||
$scope.sort = {
|
||||
fields: ["ID"],
|
||||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
showFooter: true,
|
||||
showFilter: true,
|
||||
showColumnMenu: true,
|
||||
enableCellSelection: false,
|
||||
enableHighlighting: true,
|
||||
enableColumnResize: true,
|
||||
enableColumnReordering: true,
|
||||
selectWithCheckboxOnly: false,
|
||||
showSelectionCheckbox: false,
|
||||
multiSelect: false,
|
||||
displaySelectionCheckbox: false,
|
||||
pagingOptions: $scope.pagingOptions,
|
||||
enablePaging: true,
|
||||
totalServerItems: 'totalServerItems',
|
||||
maintainColumnRatios: false,
|
||||
columnDefs: attributes,
|
||||
enableFiltering: true,
|
||||
useExternalFiltering: true,
|
||||
sortInfo: $scope.sortOptions,
|
||||
useExternalSorting: true,
|
||||
};
|
||||
$scope.refresh = function () {
|
||||
refreshed = true;
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.reset = function () {
|
||||
$scope.filter.values.field = "";
|
||||
$scope.filter.values.operation = "";
|
||||
$scope.filter.values.value = "";
|
||||
$scope.loadTable();
|
||||
};
|
||||
$scope.loadTable = function () {
|
||||
$scope.filter.values.sortColumn = $scope.sort.fields[0];
|
||||
$scope.filter.values.sortBy = $scope.sort.directions[0];
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
var filter = JSON.stringify($scope.filter.values);
|
||||
console.log("Filter string: " + filter);
|
||||
jolokia.request({ type: 'exec', mbean: mbean, operation: method, arguments: [filter, $scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable, { error: onError }));
|
||||
}
|
||||
};
|
||||
function onError() {
|
||||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
$scope.objects.push(value);
|
||||
});
|
||||
$scope.totalServerItems = data["count"];
|
||||
if (refreshed == true) {
|
||||
$scope.gridOptions.pagingOptions.currentPage = 1;
|
||||
refreshed = false;
|
||||
}
|
||||
Core.$apply($scope);
|
||||
}
|
||||
$scope.$watch('sortOptions', function (newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||
$scope.loadTable();
|
||||
}
|
||||
}, true);
|
||||
|
||||
function getBrokerMBean(jolokia) {
|
||||
var mbean = null;
|
||||
var selection = workspace.selection;
|
||||
var folderNames = selection.folderNames;
|
||||
mbean = "" + folderNames[0] + ":broker=" + folderNames[1];
|
||||
ARTEMIS.log.info("broker=" + mbean);
|
||||
return mbean;
|
||||
};
|
||||
$scope.refresh();
|
||||
};
|
||||
return ARTEMIS;
|
||||
} (ARTEMIS || {}));
|
Loading…
Reference in New Issue