diff --git a/awx/ui/client/features/jobs/index.controller.js b/awx/ui/client/features/jobs/index.controller.js
index 3a2f0b34b1..f0ab4e2315 100644
--- a/awx/ui/client/features/jobs/index.controller.js
+++ b/awx/ui/client/features/jobs/index.controller.js
@@ -4,7 +4,7 @@ function IndexJobsController ($scope, strings, dataset) {
vm.count = dataset.data.count;
$scope.$on('updateCount', (e, count) => {
- if (count) {
+ if (typeof count === 'number') {
vm.count = count;
}
});
diff --git a/awx/ui/client/features/jobs/jobsList.controller.js b/awx/ui/client/features/jobs/jobsList.controller.js
index d8f9e4343c..4833fdda9a 100644
--- a/awx/ui/client/features/jobs/jobsList.controller.js
+++ b/awx/ui/client/features/jobs/jobsList.controller.js
@@ -16,7 +16,8 @@ function ListJobsController (
$filter,
ProcessErrors,
Wait,
- Rest
+ Rest,
+ SearchBasePath
) {
const vm = this || {};
const [unifiedJob] = resolvedModels;
@@ -26,21 +27,21 @@ function ListJobsController (
// smart-search
const name = 'jobs';
const iterator = 'job';
- const key = 'job_dataset';
let launchModalOpen = false;
let refreshAfterLaunchClose = false;
- $scope.list = { iterator, name };
- $scope.collection = { iterator, basePath: 'unified_jobs' };
- $scope[key] = Dataset.data;
- $scope[name] = Dataset.data.results;
- $scope.$emit('updateCount', Dataset.data.count, 'jobs');
- $scope.$on('updateDataset', (e, dataset) => {
- $scope[key] = dataset;
- $scope[name] = dataset.results;
- $scope.$emit('updateCount', dataset.count, 'jobs');
+ vm.searchBasePath = SearchBasePath;
+
+ vm.list = { iterator, name };
+ vm.job_dataset = Dataset.data;
+ vm.jobs = Dataset.data.results;
+ vm.querySet = $state.params.job_search;
+
+ $scope.$watch('vm.job_dataset.count', () => {
+ $scope.$emit('updateCount', vm.job_dataset.count, 'jobs');
});
+
$scope.$on('ws-jobs', () => {
if (!launchModalOpen) {
refreshJobs();
@@ -114,7 +115,7 @@ function ListJobsController (
.then(() => {
let reloadListStateParams = null;
- if ($scope.jobs.length === 1 && $state.params.job_search &&
+ if (vm.jobs.length === 1 && $state.params.job_search &&
_.has($state, 'params.job_search.page') &&
$state.params.job_search.page !== '1') {
reloadListStateParams = _.cloneDeep($state.params);
@@ -155,7 +156,7 @@ function ListJobsController (
.then(() => {
let reloadListStateParams = null;
- if ($scope.jobs.length === 1 && $state.params.job_search &&
+ if (vm.jobs.length === 1 && $state.params.job_search &&
!_.isEmpty($state.params.job_search.page) &&
$state.params.job_search.page !== '1') {
const page = `${(parseInt(reloadListStateParams
@@ -190,9 +191,10 @@ function ListJobsController (
};
function refreshJobs () {
- qs.search(unifiedJob.path, $state.params.job_search)
+ qs.search(SearchBasePath, $state.params.job_search)
.then(({ data }) => {
- $scope.$emit('updateDataset', data);
+ vm.jobs = data.results;
+ vm.job_dataset = data;
});
}
}
@@ -208,7 +210,8 @@ ListJobsController.$inject = [
'$filter',
'ProcessErrors',
'Wait',
- 'Rest'
+ 'Rest',
+ 'SearchBasePath'
];
export default ListJobsController;
diff --git a/awx/ui/client/features/jobs/jobsList.view.html b/awx/ui/client/features/jobs/jobsList.view.html
index 22c2e03ffa..d62e402b78 100644
--- a/awx/ui/client/features/jobs/jobsList.view.html
+++ b/awx/ui/client/features/jobs/jobsList.view.html
@@ -3,19 +3,19 @@
-
+
-
+
+ base-path="{{vm.searchBasePath}}"
+ query-set="vm.querySet">
diff --git a/awx/ui/client/features/jobs/routes/hostCompletedJobs.route.js b/awx/ui/client/features/jobs/routes/hostCompletedJobs.route.js
index 04d98996ea..20d1a504ba 100644
--- a/awx/ui/client/features/jobs/routes/hostCompletedJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/hostCompletedJobs.route.js
@@ -53,6 +53,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ 'GetBasePath',
+ (GetBasePath) => GetBasePath('unified_jobs')
]
}
};
diff --git a/awx/ui/client/features/jobs/routes/instanceGroupJobs.route.js b/awx/ui/client/features/jobs/routes/instanceGroupJobs.route.js
index fe86b78774..c52ad0cd67 100644
--- a/awx/ui/client/features/jobs/routes/instanceGroupJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/instanceGroupJobs.route.js
@@ -59,6 +59,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ '$stateParams',
+ ($stateParams) => `api/v2/instance_groups/${$stateParams.instance_group_id}/jobs`
]
}
};
diff --git a/awx/ui/client/features/jobs/routes/instanceJobs.route.js b/awx/ui/client/features/jobs/routes/instanceJobs.route.js
index c7ec885e96..b88bbb4cd8 100644
--- a/awx/ui/client/features/jobs/routes/instanceJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/instanceJobs.route.js
@@ -59,6 +59,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ '$stateParams',
+ ($stateParams) => `api/v2/instances/${$stateParams.instance_id}/jobs`
]
}
};
diff --git a/awx/ui/client/features/jobs/routes/inventoryCompletedJobs.route.js b/awx/ui/client/features/jobs/routes/inventoryCompletedJobs.route.js
index 333359c6f6..8d4de65623 100644
--- a/awx/ui/client/features/jobs/routes/inventoryCompletedJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/inventoryCompletedJobs.route.js
@@ -58,6 +58,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ 'GetBasePath',
+ (GetBasePath) => GetBasePath('unified_jobs')
]
}
};
diff --git a/awx/ui/client/features/jobs/routes/jobs.route.js b/awx/ui/client/features/jobs/routes/jobs.route.js
index 28ee828370..52e6456bd7 100644
--- a/awx/ui/client/features/jobs/routes/jobs.route.js
+++ b/awx/ui/client/features/jobs/routes/jobs.route.js
@@ -56,6 +56,10 @@ export default {
.finally(() => Wait('stop'));
}
],
+ SearchBasePath: [
+ 'GetBasePath',
+ (GetBasePath) => GetBasePath('unified_jobs')
+ ]
},
views: {
'@': {
diff --git a/awx/ui/client/features/jobs/routes/templateCompletedJobs.route.js b/awx/ui/client/features/jobs/routes/templateCompletedJobs.route.js
index 3fc69a5ffe..20a84507be 100644
--- a/awx/ui/client/features/jobs/routes/templateCompletedJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/templateCompletedJobs.route.js
@@ -55,6 +55,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ 'GetBasePath',
+ (GetBasePath) => GetBasePath('unified_jobs')
]
}
};
diff --git a/awx/ui/client/features/jobs/routes/workflowJobTemplateCompletedJobs.route.js b/awx/ui/client/features/jobs/routes/workflowJobTemplateCompletedJobs.route.js
index 8970ef8bc0..bd05b2b1eb 100644
--- a/awx/ui/client/features/jobs/routes/workflowJobTemplateCompletedJobs.route.js
+++ b/awx/ui/client/features/jobs/routes/workflowJobTemplateCompletedJobs.route.js
@@ -54,6 +54,10 @@ export default {
return qs.search(searchPath, searchParam)
.finally(() => Wait('stop'));
}
+ ],
+ SearchBasePath: [
+ 'GetBasePath',
+ (GetBasePath) => GetBasePath('unified_jobs')
]
}
};
diff --git a/awx/ui/client/features/templates/index.controller.js b/awx/ui/client/features/templates/index.controller.js
index 42eb2e8749..bfbfeb84fd 100644
--- a/awx/ui/client/features/templates/index.controller.js
+++ b/awx/ui/client/features/templates/index.controller.js
@@ -4,7 +4,7 @@ function IndexTemplatesController ($scope, strings, dataset) {
vm.count = dataset.data.count;
$scope.$on('updateCount', (e, count) => {
- if (count) {
+ if (typeof count === 'number') {
vm.count = count;
}
});
diff --git a/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.controller.js b/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.controller.js
index 62fb924efe..26a7c8f126 100644
--- a/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.controller.js
+++ b/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.controller.js
@@ -1,36 +1,39 @@
-function InstanceGroupJobsContainerController (strings, $state) {
+function InstanceGroupJobsContainerController ($scope, strings, $state) {
const vm = this || {};
- init();
- function init() {
- const instanceGroupId = $state.params.instance_group_id;
+ const instanceGroupId = $state.params.instance_group_id;
- vm.panelTitle = strings.get('jobs.PANEL_TITLE');
- vm.strings = strings;
+ vm.panelTitle = strings.get('jobs.PANEL_TITLE');
+ vm.strings = strings;
- vm.tab = {
- details: {
- _go: 'instanceGroups.edit',
- _params: { instance_group_id: instanceGroupId },
- _label: strings.get('tab.DETAILS')
- },
- instances: {
- _go: 'instanceGroups.instances',
- _params: { instance_group_id: instanceGroupId },
- _label: strings.get('tab.INSTANCES')
- },
- jobs: {
- _active: true,
- _params: { instance_group_id: instanceGroupId },
- _label: strings.get('tab.JOBS')
- }
- };
- }
+ vm.tab = {
+ details: {
+ _go: 'instanceGroups.edit',
+ _params: { instance_group_id: instanceGroupId },
+ _label: strings.get('tab.DETAILS')
+ },
+ instances: {
+ _go: 'instanceGroups.instances',
+ _params: { instance_group_id: instanceGroupId },
+ _label: strings.get('tab.INSTANCES')
+ },
+ jobs: {
+ _active: true,
+ _params: { instance_group_id: instanceGroupId },
+ _label: strings.get('tab.JOBS')
+ }
+ };
+ $scope.$on('updateCount', (e, count) => {
+ if (typeof count === 'number') {
+ vm.count = count;
+ }
+ });
}
InstanceGroupJobsContainerController.$inject = [
+ '$scope',
'InstanceGroupsStrings',
'$state'
];
diff --git a/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.partial.html b/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.partial.html
index 9794b87262..6583819549 100644
--- a/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.partial.html
+++ b/awx/ui/client/src/instance-groups/jobs/instanceGroupsJobsListContainer.partial.html
@@ -1,5 +1,5 @@
-
+
{{:: vm.strings.get('tab.DETAILS') }}
diff --git a/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.controller.js b/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.controller.js
index 306249f842..7e661ab41d 100644
--- a/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.controller.js
+++ b/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.controller.js
@@ -1,5 +1,5 @@
-function InstanceGroupJobsContainerController (strings) {
+function InstanceGroupJobsContainerController ($scope, strings) {
const vm = this || {};
init();
@@ -8,9 +8,15 @@ function InstanceGroupJobsContainerController (strings) {
vm.strings = strings;
}
+ $scope.$on('updateCount', (e, count) => {
+ if (typeof count === 'number') {
+ vm.count = count;
+ }
+ });
}
InstanceGroupJobsContainerController.$inject = [
+ '$scope',
'InstanceGroupsStrings'
];
diff --git a/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.partial.html b/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.partial.html
index 89a53e08d5..744b4af256 100644
--- a/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.partial.html
+++ b/awx/ui/client/src/instance-groups/jobs/instanceJobsListContainer.partial.html
@@ -1,5 +1,5 @@
-
+
diff --git a/awx/ui/test/spec/lookup/lookup-modal.directive-test.js b/awx/ui/test/spec/lookup/lookup-modal.directive-test.js
index cdd4d16cc9..7800d8d654 100644
--- a/awx/ui/test/spec/lookup/lookup-modal.directive-test.js
+++ b/awx/ui/test/spec/lookup/lookup-modal.directive-test.js
@@ -73,8 +73,6 @@ xdescribe('Directive: lookupModal', () => {
$parent.mock = 1; // resource id
$parent.mock_name = 'Mock Resource 1'; // resource name
- console.log($scope);
-
element = $compile(dom)($scope);
$scope.$digest();