Skip to content

Commit

Permalink
implement filtering of the MQ fabric view
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Oct 5, 2013
1 parent 00e5f05 commit 2340f9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/fabric/html/brokers.html
Expand Up @@ -125,7 +125,7 @@
</div>


<div class="mq-group-rectangle" ng-repeat="group in groups" ng-show="groupMatchesFilter(profile)"
<div class="mq-group-rectangle" ng-repeat="group in groups" ng-show="groupMatchesFilter(group)"
title="A group of message brokers; used by messaging clients to connect to one of a cluster of message brokers">

<div class="mq-group-rectangle-label">
Expand Down Expand Up @@ -237,7 +237,7 @@
</a>
</div>
</div>
<div class="mq-group-list" ng-repeat="group in groups" ng-show="groupMatchesFilter(profile)">
<div class="mq-group-list" ng-repeat="group in groups" ng-show="groupMatchesFilter(group)">
<div class="expandable" model="group">
<div class="mq-group-row"
title="A group of message brokers; used by messaging clients to connect to one of a cluster of message brokers">
Expand Down
20 changes: 13 additions & 7 deletions hawtio-web/src/main/webapp/app/fabric/js/brokers.ts
Expand Up @@ -19,23 +19,27 @@ module Fabric {


$scope.groupMatchesFilter = (group) => {
return true;
// return group.id.has($scope.searchFilter) || !group.profiles.find((profile) => $scope.profileMatchesFilter(profile));
return !$scope.searchFilter || group.id.has($scope.searchFilter)
|| group.profiles.find((item) => $scope.profileMatchesFilter(item));
};

$scope.profileMatchesFilter = (profile) => {
return true;
//return profile.id.has($scope.searchFilter) || !profile.containers.filter((id) => { return id.has($scope.searchFilter); }).isEmpty();
return !$scope.searchFilter || profile.id.has($scope.searchFilter) || profile.group.has($scope.searchFilter)
|| profile.brokers.find((item) => $scope.brokerMatchesFilter(item));
};

$scope.brokerMatchesFilter = (broker) => {
return true;
//return container.id.has($scope.searchFilter) || !container.profileIds.filter((id) => {return id.has($scope.searchFilter);}).isEmpty();
return !$scope.searchFilter || broker.id.has($scope.searchFilter) || broker.group.has($scope.searchFilter)
|| broker.containers.find((item) => $scope.containerMatchesFilter(item));
};

$scope.containerMatchesFilter = (container) => {
var filter = $scope.searchFilter;
if (filter) {
var text = container.id + " " + container.profile + " " + container.version + " " + container.brokerName + " " + container.group;
return text.has(filter);
}
return true;
//return container.id.has($scope.searchFilter) || !container.profileIds.filter((id) => {return id.has($scope.searchFilter);}).isEmpty();
};

if (Fabric.hasMQManager) {
Expand Down Expand Up @@ -87,12 +91,14 @@ module Fabric {
});
var profile = findByIdOrCreate(group.profiles, profileId, maps.profile, () => {
return {
group: groupId,
version: versionId,
brokers: []
};
});
var broker = findByIdOrCreate(profile.brokers, brokerId, maps.broker, () => {
return {
group: groupId,
profile: profileId,
version: versionId,
containers: []
Expand Down

0 comments on commit 2340f9b

Please sign in to comment.