Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bit of work on the fabric feature browser
- Loading branch information
Showing
8 changed files
with
408 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
hawtio-web/src/main/webapp/app/fabric/html/editFeatures.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div ng-controller="Fabric.FeatureEditController"> | ||
|
||
<div class="row-fluid"> | ||
<div class="span12"> | ||
<h2 style="display: inline;">/ <a ng-href="#/fabric/view?cv={{versionId}}&sp={{profileId}}">{{versionId}}</a> / | ||
<a ng-href="#/fabric/profile/{{versionId}}/{{profileId}}">{{profileId}}</a> / Features</h2> | ||
</div> | ||
</div> | ||
<div class="row-fluid"> | ||
|
||
<div class="span6"> | ||
<p>Inherited Features</p> | ||
<ul> | ||
<li ng-repeat="feature in parentFeatures">{{feature.id}}</li> | ||
</ul> | ||
</div> | ||
|
||
<div class="span6"> | ||
<p>Features</p> | ||
<ul> | ||
<li ng-repeat="feature in profileFeatures">{{feature.id}}</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div class="row-fluid"> | ||
<div class="span12"> | ||
<select class="span10" ng-model="selectedRepoId" ng-options="repoId for repoId in repoIds"></select> | ||
<div class="row-fluid"> | ||
<div class="span10"> | ||
<p> | ||
<strong>Name: </strong>{{selectedRepoName}} | ||
</p> | ||
|
||
<p ng-show="selectedRepoRepos && selectedRepoRepos.length > 0"> | ||
<h6>Feature Repositories</h6> | ||
<ul> | ||
<li ng-repeat="repo in selectedRepoRepos">{{repo}}</li> | ||
</ul> | ||
|
||
</p> | ||
|
||
<p ng-show="selectedRepoFeatures && selectedRepoFeatures.length > 0"> | ||
<div class="features-toolbar"> | ||
<h6 style="display: inline">Features</h6> | ||
| ||
<input type="text" class="search-query" placeholder="Filter..." ng-model="featureGridOptions.filterOptions.filterText"> | ||
<i class="icon-remove clickable" title="Clear Filter" ng-click="featureGridOptions.filterOptions.filterText = ''"></i> | ||
| ||
<a href="" class="btn" ng-click="addSelectedFeatures(false)" ng-disabled="selectedRepoSelectedFeatures.length == 0"><i class="icon-plus"></i> Add</a> | ||
<a href="" class="btn" ng-click="addSelectedFeatures(true)" ng-disabled="selectedRepoSelectedFeatures.length == 0"><i class="icon-plus"></i> Add With Version</a> | ||
</div> | ||
|
||
<div class="gridStyle" ng-grid="featureGridOptions"></div> | ||
</p> | ||
|
||
|
||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 140 additions & 0 deletions
140
hawtio-web/src/main/webapp/app/fabric/js/editFeatures.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
module Fabric { | ||
|
||
export function FeatureEditController($scope, $routeParams, $location, jolokia, xml2json) { | ||
|
||
$scope.getProfileFeaturesOp = "getProfileFeatures(java.lang.String, java.lang.String)"; | ||
$scope.versionId = $routeParams.versionId; | ||
$scope.profileId = $routeParams.profileId; | ||
|
||
$scope.response = {}; | ||
|
||
$scope.features = []; | ||
$scope.repositories = []; | ||
$scope.repoIds = []; | ||
$scope.selectedRepoId = ''; | ||
$scope.selectedRepo = {}; | ||
|
||
$scope.selectedRepoXML = ''; | ||
$scope.selectedRepoJson = {}; | ||
$scope.selectedRepoError = ''; | ||
|
||
$scope.selectedRepoRepos = []; | ||
$scope.selectedRepoFeatures = []; | ||
|
||
$scope.selectedRepoSelectedFeatures = []; | ||
|
||
$scope.featureGridOptions = { | ||
data: 'selectedRepoFeatures', | ||
selectedItems: $scope.selectedRepoSelectedFeatures, | ||
displayFooter: false, | ||
showFilter: false, | ||
keepLastSelected: true, | ||
filterOptions: { | ||
filterText: '' | ||
}, | ||
columnDefs: [ | ||
{ | ||
field: 'name', | ||
displayName: 'Name' | ||
}, | ||
{ | ||
field: 'version', | ||
displayName: 'Version' | ||
} | ||
] | ||
} | ||
|
||
|
||
$scope.$watch('features', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
$scope.parentFeatures = $scope.features.filter((f) => { return f.isParentFeature }); | ||
$scope.profileFeatures = $scope.features.filter((f) => { return !f.isParentFeature }); | ||
} | ||
}, true); | ||
|
||
|
||
$scope.$watch('selectedRepoXML', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
$scope.selectedRepoJson = xml2json($scope.selectedRepoXML); | ||
} | ||
}); | ||
|
||
|
||
$scope.$watch('selectedRepoId', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
if ($scope.selectedRepoId !== '') { | ||
$scope.selectedRepo = $scope.repositories.find((repo) => { return $scope.selectedRepoId === repo.id; }); | ||
} else { | ||
$scope.selectedRepo = {}; | ||
} | ||
} | ||
}); | ||
|
||
|
||
$scope.$watch('selectedRepoJson', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
console.log("selectedRepoJson: ", $scope.selectedRepoJson); | ||
$scope.selectedRepoName = $scope.selectedRepoJson.name; | ||
$scope.selectedRepoRepos = $scope.selectedRepoJson.repository; | ||
$scope.selectedRepoFeatures = $scope.selectedRepoJson.feature; | ||
} | ||
}); | ||
|
||
|
||
$scope.$watch('selectedRepo', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
if (angular.isDefined($scope.selectedRepo.data)) { | ||
$scope.selectedRepoXML = $scope.selectedRepo.data; | ||
} else { | ||
$scope.selectedRepoXML = ''; | ||
} | ||
|
||
if (angular.isDefined($scope.selectedRepo.errorMessage)) { | ||
$scope.selectedRepoError = $scope.selectedRepo.errorMessage; | ||
} else { | ||
$scope.selectedRepoError = ''; | ||
} | ||
} | ||
}, true); | ||
|
||
|
||
$scope.$watch('repoIds', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
if ($scope.repoIds.length > 0) { | ||
if ($scope.selectedRepoId === '') { | ||
$scope.selectedRepoId = $scope.repoIds[0]; | ||
} | ||
} else { | ||
$scope.selectedRepoId = ''; | ||
} | ||
} | ||
}, true); | ||
|
||
|
||
$scope.$watch('repositories', (newValue, oldValue) => { | ||
if (newValue !== oldValue) { | ||
$scope.repoIds = $scope.repositories.map((repo) => { return repo.id; }); | ||
} | ||
}, true); | ||
|
||
|
||
$scope.dispatch = (response) => { | ||
if (!Object.equal(response.value, $scope.response)) { | ||
$scope.response = response.value; | ||
$scope.features = Object.clone($scope.response.featureDefinitions); | ||
$scope.repositories = Object.clone($scope.response.repositoryDefinitions); | ||
$scope.$apply(); | ||
} | ||
} | ||
|
||
|
||
Core.register(jolokia, $scope, [{ | ||
type: 'exec', mbean: managerMBean, operation: $scope.getProfileFeaturesOp, | ||
arguments: [$scope.versionId, $scope.profileId] | ||
}], onSuccess($scope.dispatch)); | ||
|
||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.