1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

Merge pull request #2898 from mabashian/edit-indictor-host-edit

Added row/list being edited logic to home/hosts
This commit is contained in:
Michael Abashian 2016-07-11 13:37:33 -04:00 committed by GitHub
commit edc120fe58

View File

@ -6,8 +6,8 @@
export default
['$scope', '$state', '$stateParams', 'PageRangeSetup', 'GetBasePath', 'DashboardHostsList',
'generateList', 'PaginateInit', 'SetStatus', 'DashboardHostService', 'hosts',
function($scope, $state, $stateParams, PageRangeSetup, GetBasePath, DashboardHostsList, GenerateList, PaginateInit, SetStatus, DashboardHostService, hosts){
'generateList', 'PaginateInit', 'SetStatus', 'DashboardHostService', 'hosts', '$rootScope',
function($scope, $state, $stateParams, PageRangeSetup, GetBasePath, DashboardHostsList, GenerateList, PaginateInit, SetStatus, DashboardHostService, hosts, $rootScope){
var setJobStatus = function(){
_.forEach($scope.hosts, function(value){
SetStatus({
@ -37,6 +37,20 @@ export default
return value;
});
setJobStatus();
});
var cleanUpStateChangeListener = $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
if (toState.name === "dashboardHosts.edit") {
$scope.rowBeingEdited = toParams.id;
$scope.listBeingEdited = "hosts";
}
else {
delete $scope.rowBeingEdited;
delete $scope.listBeingEdited;
}
});
// Remove the listener when the scope is destroyed to avoid a memory leak
$scope.$on('$destroy', function() {
cleanUpStateChangeListener();
});
var init = function(){
$scope.list = list;
@ -59,6 +73,10 @@ export default
iterator: list.iterator
});
$scope.hostLoading = false;
if($state.current.name === "dashboardHosts.edit") {
$scope.rowBeingEdited = $state.params.id;
$scope.listBeingEdited = "hosts";
}
};
init();
}];