1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Remove updateDataset from templates list

This commit is contained in:
mabashian 2018-07-13 15:59:31 -04:00
parent 9a44f6d13d
commit f7dda124b1
2 changed files with 18 additions and 27 deletions

View File

@ -51,17 +51,16 @@ function ListTemplatesController(
$scope.canAdd = ($scope.canAddJobTemplate || $scope.canAddWorkflowJobTemplate);
// smart-search
$scope.list = {
vm.list = {
iterator: 'template',
name: 'templates'
};
$scope.collection = {
iterator: 'template',
basePath: 'unified_job_templates'
};
$scope.template_dataset = Dataset.data;
$scope.templates = Dataset.data.results;
$scope.$emit('updateCount', Dataset.data.count, 'templates');
vm.dataset = Dataset.data;
vm.templates = Dataset.data.results;
$scope.$watch('vm.dataset.count', () => {
$scope.$emit('updateCount', vm.dataset.count, 'templates');
});
$scope.$watch('$state.params', function(newValue, oldValue) {
const job_template_id = _.get($state.params, 'job_template_id');
@ -72,12 +71,6 @@ function ListTemplatesController(
}
}, true);
$scope.$on('updateDataset', (e, dataset) => {
$scope.template_dataset = dataset;
$scope.templates = dataset.results;
$scope.$emit('updateCount', dataset.count, 'templates');
});
$scope.$on(`ws-jobs`, () => {
if (!launchModalOpen) {
refreshTemplates();
@ -188,8 +181,8 @@ function ListTemplatesController(
let path = GetBasePath('unified_job_templates');
qs.search(path, $state.params.template_search)
.then(function(searchResponse) {
$scope.template_dataset = searchResponse.data;
$scope.templates = $scope.template_dataset.results;
vm.dataset = searchResponse.data;
vm.templates = vm.dataset.results;
});
}
@ -254,7 +247,7 @@ function ListTemplatesController(
const { page } = _.get($state.params, 'template_search');
let reloadListStateParams = null;
if ($scope.templates.length === 1 && page && page !== '1') {
if (vm.templates.length === 1 && page && page !== '1') {
reloadListStateParams = _.cloneDeep($state.params);
const pageNumber = (parseInt(reloadListStateParams.template_search.page, 0) - 1);
reloadListStateParams.template_search.page = pageNumber.toString();

View File

@ -5,11 +5,10 @@
django-model="templates"
base-path="unified_job_templates"
iterator="template"
list="list"
dataset="template_dataset"
collection="collection"
search-tags="searchTags"
query-set="querySet"
list="vm.list"
collection="vm.templates"
dataset="vm.dataset"
search-tags="vm.searchTags"
search-bar-full-width="vm.isPortalMode">
</smart-search>
<div class="at-List-toolbarAction" ng-show="!vm.isPortalMode && canAdd">
@ -37,7 +36,7 @@
</div>
</div>
<at-list results="templates" id="templates_list">
<at-row ng-repeat="template in templates"
<at-row ng-repeat="template in vm.templates"
ng-class="{'at-Row--active': (template.id === vm.activeId)}"
template-id="{{ template.id }}"
invalid="vm.isInvalid(template)"
@ -100,10 +99,9 @@
</at-row>
</at-list>
<paginate
collection="collection"
dataset="template_dataset"
collection="vm.templates"
dataset="vm.dataset"
iterator="template"
base-path="unified_job_templates"
query-set="querySet">
base-path="unified_job_templates">
</paginate>
</at-panel-body>