Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
32 changes: 31 additions & 1 deletion
32
hawtio-web/src/main/webapp/app/fabric/html/migrateVersions.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 |
---|---|---|
@@ -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
88
hawtio-web/src/main/webapp/app/fabric/js/migrateContainers.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,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)); | ||
} | ||
} |
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