mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Added row/list being edited logic to home/hosts
This commit is contained in:
parent
34523d59a2
commit
d40d7c90f5
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
export default
|
export default
|
||||||
['$scope', '$state', '$stateParams', 'PageRangeSetup', 'GetBasePath', 'DashboardHostsList',
|
['$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){
|
function($scope, $state, $stateParams, PageRangeSetup, GetBasePath, DashboardHostsList, GenerateList, PaginateInit, SetStatus, DashboardHostService, hosts, $rootScope){
|
||||||
var setJobStatus = function(){
|
var setJobStatus = function(){
|
||||||
_.forEach($scope.hosts, function(value){
|
_.forEach($scope.hosts, function(value){
|
||||||
SetStatus({
|
SetStatus({
|
||||||
@ -38,6 +38,20 @@ export default
|
|||||||
});
|
});
|
||||||
setJobStatus();
|
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(){
|
var init = function(){
|
||||||
$scope.list = list;
|
$scope.list = list;
|
||||||
$scope.host_active_search = false;
|
$scope.host_active_search = false;
|
||||||
@ -59,6 +73,10 @@ export default
|
|||||||
iterator: list.iterator
|
iterator: list.iterator
|
||||||
});
|
});
|
||||||
$scope.hostLoading = false;
|
$scope.hostLoading = false;
|
||||||
|
if($state.current.name === "dashboardHosts.edit") {
|
||||||
|
$scope.rowBeingEdited = $state.params.id;
|
||||||
|
$scope.listBeingEdited = "hosts";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
init();
|
init();
|
||||||
}];
|
}];
|
||||||
|
Loading…
Reference in New Issue
Block a user