Skip to content

Commit

Permalink
Fix up fabric plugin to work with ng-grid 2.x, also fix #230 and fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Apr 26, 2013
1 parent 4a61178 commit f636d71
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
9 changes: 1 addition & 8 deletions hawtio-web/src/main/webapp/app/core/js/corePlugin.ts
Expand Up @@ -242,17 +242,10 @@ angular.module('hawtioCore', ['bootstrap', 'ngResource', 'ui', 'ui.bootstrap.dia
var gridTop = grid.position().top;

var windowHeight = $(window).height();
var height = windowHeight - gridTop - 10;
var height = windowHeight - gridTop - 30;

var heightStr = height + 'px';

/*
if (grid.parent().css('height')) {
console.log("Parent element height: " + grid.parent().css('height'));
heightStr = grid.parent().css('height');
}
*/

grid.css({
'min-height': heightStr,
'height': heightStr
Expand Down
9 changes: 3 additions & 6 deletions hawtio-web/src/main/webapp/app/fabric/html/containers.html
Expand Up @@ -10,6 +10,7 @@
<button ng-disabled="selectedContainers.length == 0 || !everySelectionAlive(false)" class="btn" ng-click="delete()"><i class="icon-remove"></i> Delete</button>
</div>
</div>
<!--
&nbsp;
<div class="control-group inline-block">
<label for="versions">Versions: </label>
Expand All @@ -20,21 +21,17 @@
<label for="profiles">Profiles: </label>
<select id="profiles" ng-model="profile" ng-options="p.id for p in profiles"></select>
</div>
-->
</fieldset>
</form>
</div>

<div class="pull-right">
<!--
<form class="form-inline">
<fieldset>
<label for="search" title="Filter Table">Search: </label>
<input id="search" type="text" ng-model="search">
<input class="search-query" id="search" type="text" ng-model="containerOptions.filterOptions.filterText" placeholder="Filter...">
</fieldset>
</form>
-->
</div>
</div>

Expand Down
6 changes: 2 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/html/profiles.html
Expand Up @@ -9,8 +9,7 @@
</div>
&nbsp;
<div class="control-group inline-block">
<label for="activeOnly" title="Only show profiles that have been applied to a container">Active
only: </label>
<label for="activeOnly" title="Only show profiles that have been applied to a container">Active only: </label>
<input type="checkbox" id="activeOnly" name="activeOnly" ng-model="activeOnly">
</div>
</fieldset>
Expand All @@ -20,8 +19,7 @@
<form class="form-inline no-bottom-margin">
<fieldset>
<div class="control-group inline-block">
<label>Filter: </label>
<input class="search-query" type="text">
<input class="search-query" type="text" ng-model="gridOptions.filterOptions.filterText" placeholder="Filter...">
</div>
</fieldset>
</form>
Expand Down
5 changes: 3 additions & 2 deletions hawtio-web/src/main/webapp/app/fabric/js/containers.ts
Expand Up @@ -109,6 +109,7 @@ module Fabric {
return "icon-refresh icon-spin";
};

/*
var SearchProvider = function(scope, location) {
var self = this;
self.scope = scope;
Expand Down Expand Up @@ -161,14 +162,14 @@ module Fabric {
};
var searchProvider = new SearchProvider($scope, $location);
*/

$scope.containerOptions = {
plugins: [searchProvider],
data: 'containers',
showFilter: false,
showColumnMenu: false,
filterOptions: {
useExternalFilter: true
filterText: ''
},
selectedItems: $scope.selectedContainers,
rowHeight: 32,
Expand Down
17 changes: 14 additions & 3 deletions hawtio-web/src/main/webapp/app/fabric/js/profiles.ts
Expand Up @@ -50,7 +50,7 @@ module Fabric {
showFilter: false,
showColumnMenu: false,
filterOptions: {
useExternalFilter: true
filterText: ''
},
selectWithCheckboxOnly: true,
columnDefs: [
Expand Down Expand Up @@ -89,7 +89,16 @@ module Fabric {

]
};


function filterActive(data) {
var rc = data;
if ($scope.activeOnly) {
rc = data.filter(function(item) {
return item.containerCount > 0;
});
}
return rc;
}

function render(response) {

Expand Down Expand Up @@ -120,9 +129,11 @@ module Fabric {
abstract: profile.abstractProfile
})
});

$scope.profiles = filterActive($scope.profiles);
$scope.$apply();
}
}
}
}
}
}

0 comments on commit f636d71

Please sign in to comment.