mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
Reset list radio selection when switching to a new tab
This commit is contained in:
parent
1656ab45f1
commit
ce5f95c206
@ -120,12 +120,29 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
return html;
|
||||
},
|
||||
// $scope encapsulated in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||
controller: ['$scope', 'JobTemplateList', 'JobTemplateDataset',
|
||||
function($scope, list, Dataset) {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
controller: ['$scope', 'JobTemplateList', 'JobTemplateDataset', '$log',
|
||||
function($scope, list, Dataset, $log) {
|
||||
// name of this tab
|
||||
let tab = 'jobs';
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
}
|
||||
|
||||
// resets any selected list items, if this tab is not active
|
||||
$scope.$on('resetWorkflowList', function(e, active) {
|
||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
||||
|
||||
// a reference to the currently-selected radio is stored in $scope.selection[list.iterator]
|
||||
// clear it out!
|
||||
if (active !== tab) {
|
||||
$scope.selection[list.iterator] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -143,10 +160,25 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||
controller: ['$scope', 'InventorySourcesList', 'InventorySourcesDataset',
|
||||
function($scope, list, Dataset) {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
let tab = 'inventory_sync';
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
|
||||
}
|
||||
|
||||
// resets any selected list items, if this tab is not active
|
||||
$scope.$on('resetWorkflowList', function(e, active) {
|
||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
||||
|
||||
if (active !== tab) {
|
||||
$scope.selection[list.iterator] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -167,9 +199,24 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
|
||||
// encapsulated $scope in this controller will be a initialized as child of 'modal' $scope, because of element hierarchy
|
||||
controller: ['$scope', 'ProjectList', 'ProjectDataset',
|
||||
function($scope, list, Dataset) {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
let tab = 'project_sync';
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
$scope.list = list;
|
||||
$scope[`${list.iterator}_dataset`] = Dataset.data;
|
||||
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;
|
||||
|
||||
}
|
||||
// resets any selected list items, if this tab is not active
|
||||
$scope.$on('resetWorkflowList', function(e, active) {
|
||||
// e.targetScope is a reference to the outer scope if you need to manipulate it!
|
||||
|
||||
if (active !== tab) {
|
||||
$scope.selection[list.iterator] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -540,6 +540,8 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
};
|
||||
|
||||
$scope.toggleFormTab = function(tab) {
|
||||
// a dictionary of settings required by each encapsulated tab
|
||||
$scope.$broadcast('resetWorkflowList', tab);
|
||||
if ($scope.workflowMakerFormConfig.activeTab !== tab) {
|
||||
$scope.workflowMakerFormConfig.activeTab = tab;
|
||||
}
|
||||
@ -547,13 +549,13 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
|
||||
$scope.toggle_job_template = function(id) {
|
||||
|
||||
$scope.workflow_projects.forEach(function(row, i) {
|
||||
$scope.workflow_projects[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_projects.forEach(function(row, i) {
|
||||
// $scope.workflow_projects[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
$scope.workflow_inventory_sources[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
// $scope.workflow_inventory_sources[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
||||
if (row.id === id) {
|
||||
@ -614,13 +616,13 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
|
||||
resetPromptFields();
|
||||
|
||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
||||
$scope.workflow_job_templates[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_job_templates.forEach(function(row, i) {
|
||||
// $scope.workflow_job_templates[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
$scope.workflow_inventory_sources[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
// $scope.workflow_inventory_sources[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_projects.forEach(function(row, i) {
|
||||
if (row.id === id) {
|
||||
@ -637,13 +639,13 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
|
||||
|
||||
resetPromptFields();
|
||||
|
||||
$scope.workflow_job_templates.forEach(function(row, i) {
|
||||
$scope.workflow_job_templates[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_job_templates.forEach(function(row, i) {
|
||||
// $scope.workflow_job_templates[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_projects.forEach(function(row, i) {
|
||||
$scope.workflow_projects[i].checked = 0;
|
||||
});
|
||||
// $scope.workflow_projects.forEach(function(row, i) {
|
||||
// $scope.workflow_projects[i].checked = 0;
|
||||
// });
|
||||
|
||||
$scope.workflow_inventory_sources.forEach(function(row, i) {
|
||||
if (row.id === id) {
|
||||
|
Loading…
Reference in New Issue
Block a user