Navigation Menu

Skip to content

Commit

Permalink
Bit more work on #334
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed May 9, 2013
1 parent c50fb3a commit 5e52f4a
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 1 deletion.
32 changes: 31 additions & 1 deletion hawtio-web/src/main/webapp/app/fabric/html/migrateVersions.html
@@ -1,11 +1,41 @@
<div>
<div ng-controller="Fabric.MigrateContainersController">

<div class="row-fluid">
<div class="pull-left">
<a class='btn' ng-href="#/fabric/containers"><i class='icon-remove'></i> Cancel</a>
</div>
<div class="pull-right">
<a ng-disabled="canApply()" class="btn btn-danger" href="" ng-click="showApply = true"><i class="icon-cogs"></i> Apply Changes</a>
</div>
</div>

<div class="row-fluid">
<div class="span4">
<p>Select the target version</p>
<input class="search-query column-filter" type="text" ng-model="versionGridOptions.filterOptions.filterText" placeholder="Filter...">
<div class="gridStyle" ng-grid="versionGridOptions"></div>
</div>
<div class="span4">
<p ng-show="selectedVersion.length == 0">Select the containers that should be migrated to the target version</p>
<p ng-show="selectedVersion.length > 0">Select the containers that should be migrated to version {{selectedVersion[0].id}}</p>
<input class="search-query column-filter" type="text" ng-model="containerGridOptions.filterOptions.filterText" placeholder="Filter...">
<div class="gridStyle" ng-grid="containerGridOptions"></div>
</div>

<div class="span4">
<ol>
<li ng-repeat="c in selectedContainers">{{c.id}}</li>
</ol>
</div>


</div>

<div hawtio-confirm-dialog="showApply" ok-button-text="Yes" cancel-button-text="No" on-ok="migrateContainers()" title="Migrate Containers?">
<div class="dialog-body">
<p>Are you sure you want to migrate {{selectedContainers.length}} containers to version {{selectedVersion[0].id}}?</p>
</div>
</div>


</div>
88 changes: 88 additions & 0 deletions hawtio-web/src/main/webapp/app/fabric/js/migrateContainers.ts
@@ -0,0 +1,88 @@
module Fabric {

export function MigrateContainersController($scope, jolokia) {

$scope.versions = [];
$scope.containers = [];
$scope.containersResponse = [];

$scope.selectedVersion = [];
$scope.selectedContainers = [];

$scope.showApply = false;

$scope.versionGridOptions = {
data: 'versions',
selectedItems: $scope.selectedVersion,
showSelectionCheckbox: true,
multiSelect: false,
keepLastSelected: true,
columnDefs: [{
field: 'id',
displayName: 'Version Name',
width: '94%'
}],
filterOptions: {
filterText: ''
}
};


$scope.containerGridOptions = {
data: 'containers',
selectedItems: $scope.selectedContainers,
showSelectionCheckbox: true,
multiSelect: true,
keepLastSelected: false,
columnDefs: [{
field: 'id',
displayName: 'Container Name',
width: '94%'
}],
filterOptions: {
filterText: ''
}
};

$scope.canApply = () => {
return !($scope.selectedVersion.length > 0 && $scope.selectedContainers.length > 0);
}

$scope.render = (response) => {
if (response.request.operation === 'versions()') {
if (!Object.equal($scope.versions, response.value)) {
$scope.versions = response.value;
$scope.$apply();
}
}

if (response.request.operation === 'containerIds()') {
if (!Object.equal($scope.containersResponse, response.value)) {
$scope.containersResponse = response.value;

$scope.containers = []

$scope.containersResponse.each(function(container) {
$scope.containers.push({
id: container
});
});
$scope.$apply();
}
}
};

$scope.migrateContainers = () => {




};


Core.register(jolokia, $scope, [
{type: 'exec', mbean: managerMBean, operation: 'versions()'},
{type: 'exec', mbean: managerMBean, operation: 'containerIds()'}
], onSuccess($scope.render));
}
}
5 changes: 5 additions & 0 deletions hawtio-web/src/main/webapp/css/site-base.css
Expand Up @@ -1186,3 +1186,8 @@ li.stacktrace {
.slideout.left.out {
left: 0%;
}

.column-filter {
width: 94%;
margin-bottom: 10px !important;
}

0 comments on commit 5e52f4a

Please sign in to comment.