Skip to content

Commit

Permalink
Fix #514
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Oct 29, 2013
1 parent b377812 commit 1cb4f13
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
12 changes: 8 additions & 4 deletions hawtio-web/src/main/webapp/app/fabric/js/createContainer.ts
Expand Up @@ -133,8 +133,10 @@ module Fabric {

$scope.$watch('selectedVersion', (newValue, oldValue) => {
if (oldValue !== newValue) {
$scope.selectedVersionId = $scope.selectedVersion.id;
$location.search('versionId', $scope.selectedVersionId);
if (newValue && 'id' in newValue) {
$scope.selectedVersionId = newValue['id'];
$location.search('versionId', $scope.selectedVersionId);
}
}
}, true);

Expand All @@ -147,7 +149,7 @@ module Fabric {

$scope.$watch('selectedProfiles', (newValue, oldValue) => {
if (oldValue !== newValue) {
console.log("selectedProfiles: ", $scope.selectedProfiles);
log.debug("selectedProfiles: ", $scope.selectedProfiles);
$scope.selectedProfileIds = $scope.selectedProfiles.map((p) => { return p.id; }).join(',');
}
}, true);
Expand Down Expand Up @@ -211,7 +213,9 @@ module Fabric {

var versionId = $location.search()['versionId'];
if (versionId) {
$scope.selectedVersionId = versionId;
$scope.selectedVersion = {
id: versionId
};
}

var profileIds = $location.search()['profileIds'];
Expand Down
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/fabricView.ts
Expand Up @@ -13,6 +13,9 @@ module Fabric {
var activeVersionId = $location.search()['cv'];
if (activeVersionId) {
$scope.activeVersionId = activeVersionId;
$scope.activeVersion = {
id: $scope.activeVersionId
};
}

var profiles = $location.search()['sp'];
Expand Down
Expand Up @@ -15,17 +15,23 @@ module Fabric {
public controller = ($scope, $element, $attrs, jolokia) => {
$scope.versions = [];
$scope.responseJson = '';
$scope.selectedVersionId = '';

$scope.$watch('selectedVersion', (newValue, oldValue) => {
if (newValue !== oldValue) {
if (newValue && 'id' in newValue) {
$scope.selectedVersion = $scope.versions.find((version) => { return version.id === newValue['id']; } );
} else {
$scope.selectedVersion = $scope.versions.find((version) => { return version.defaultVersion; });
}
}
});

$scope.$watch('versions', (newValue, oldValue) => {
if (newValue !== oldValue) {
if (!$scope.selectedVersion || Object.equal($scope.selectedVersion, {})) {
if ($scope.selectedVersionId === '') {
$scope.selectedVersion = $scope.versions.find((version) => { return version.defaultVersion; });
} else {
$scope.selectedVersion = $scope.versions.find((version) => { return version.id === $scope.selectedVersion.id; } );
}
if ($scope.selectedVersion && 'id' in $scope.selectedVersion) {
$scope.selectedVersion = $scope.versions.find((version) => { return version.id === $scope.selectedVersion['id']; } );
} else {
$scope.selectedVersion = $scope.versions.find((version) => { return version.defaultVersion; });
}
}
}, true);
Expand Down

0 comments on commit 1cb4f13

Please sign in to comment.