Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Render bundles up-front and fetch start levels async, helps address #650
 a little bit.
  • Loading branch information
gashcrumb committed Nov 8, 2013
1 parent e4723a3 commit 8bc291a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
45 changes: 27 additions & 18 deletions hawtio-web/src/main/webapp/app/osgi/js/bundle-list.ts
Expand Up @@ -118,10 +118,15 @@ module Osgi {
};

function processResponse(response) {
if (!Object.equal($scope.result, response.value)) {
$scope.result = response.value;

var value = response['value'];

var responseJson = angular.toJson(value);

if ($scope.responseJson !== responseJson) {
$scope.responseJson = responseJson;
$scope.bundles = [];
angular.forEach($scope.result, function (value, key) {
angular.forEach(value, function (value, key) {
var obj = {
Identifier: value.Identifier,
Name: "",
Expand All @@ -139,22 +144,26 @@ module Osgi {
$scope.bundles.push(obj);
});

// Obtain start level information for all the bundles
for (var i = 0; i < $scope.bundles.length; i++) {
var b = $scope.bundles[i];
jolokia.request({
type: 'exec', mbean: getSelectionBundleMBean(workspace),
operation: 'getStartLevel(long)',
arguments: [$scope.bundles[i].Identifier]
}, onSuccess(function (bundle, last) {
return function (response) {
bundle.StartLevel = response.value;
if (last) {
Core.$apply($scope);
Core.$apply($scope);

// Obtain start level information for all the bundles, let's do this async though
setTimeout(() => {
for (var i = 0; i < $scope.bundles.length; i++) {
var b = $scope.bundles[i];
jolokia.request({
type: 'exec', mbean: getSelectionBundleMBean(workspace),
operation: 'getStartLevel(long)',
arguments: [$scope.bundles[i].Identifier]
}, onSuccess(function (bundle, last) {
return function (response) {
bundle.StartLevel = response.value;
if (last) {
Core.$apply($scope);
}
}
}
}(b, i === ($scope.bundles.length - 1))));
}
}(b, i === ($scope.bundles.length - 1))));
}
}, 500);
}
}

Expand Down
2 changes: 2 additions & 0 deletions hawtio-web/src/main/webapp/app/osgi/js/helpers.ts
@@ -1,5 +1,7 @@
module Osgi {

export var log:Logging.Logger = Logger.get("OSGi");

export function defaultBundleValues(workspace:Workspace, $scope, values) {
var allValues = values;
angular.forEach(values, (row) => {
Expand Down

0 comments on commit 8bc291a

Please sign in to comment.