diff --git a/ansibleworks/ui/static/js/app.js b/ansibleworks/ui/static/js/app.js
index ba2b58b1e7..23bee2af9a 100644
--- a/ansibleworks/ui/static/js/app.js
+++ b/ansibleworks/ui/static/js/app.js
@@ -49,7 +49,8 @@ angular.module('ansible', [
'JobsListDefinition',
'JobFormDefinition',
'JobEventsListDefinition',
- 'JobEventFormDefinition'
+ 'JobEventFormDefinition',
+ 'JobHostDefinition'
])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.
@@ -61,6 +62,9 @@ angular.module('ansible', [
when('/jobs/:id/job_events',
{ templateUrl: urlPrefix + 'partials/jobs.html', controller: JobEventsList }).
+
+ when('/jobs/:id/job_host_summaries',
+ { templateUrl: urlPrefix + 'partials/jobs.html', controller: JobHostSummaryList }).
when('/jobs/:job_id/job_events/:event_id',
{ templateUrl: urlPrefix + 'partials/jobs.html', controller: JobEventsEdit }).
diff --git a/ansibleworks/ui/static/js/controllers/Inventories.js b/ansibleworks/ui/static/js/controllers/Inventories.js
index 9fe68b2c7b..2d811aab6a 100644
--- a/ansibleworks/ui/static/js/controllers/Inventories.js
+++ b/ansibleworks/ui/static/js/controllers/Inventories.js
@@ -179,7 +179,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
}
Rest.post(data)
.success( function(data, status, headers, config) {
- ReturnToCaller();
+ $location.path('/inventories/' + data.id);
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
diff --git a/ansibleworks/ui/static/js/controllers/JobHosts.js b/ansibleworks/ui/static/js/controllers/JobHosts.js
new file mode 100644
index 0000000000..a4efa1cde3
--- /dev/null
+++ b/ansibleworks/ui/static/js/controllers/JobHosts.js
@@ -0,0 +1,59 @@
+/************************************
+ * Copyright (c) 2013 AnsibleWorks, Inc.
+ *
+ *
+ * JobHosts.js
+ *
+ * Controller functions for the Job Hosts Summary model.
+ *
+ */
+
+'use strict';
+
+function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobHostList,
+ GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller,
+ ClearScope, ProcessErrors, GetBasePath)
+{
+ ClearScope('htmlTemplate');
+ var list = JobHostList;
+ var defaultUrl = GetBasePath('jobs') + $routeParams.id + '/job_host_summaries/';
+ var view = GenerateList;
+ var base = $location.path().replace(/^\//,'').split('/')[0];
+ var scope = view.inject(list, { mode: 'edit' });
+ scope.selected = [];
+
+ // After a refresh, populate any needed summary field values on each row
+ if (scope.PostRefreshRemove) {
+ scope.PostRefreshRemove();
+ }
+ scope.PostRefershRemove = scope.$on('PostRefresh', function() {
+ for( var i=0; i < scope.jobhosts.length; i++) {
+ scope.jobhosts[i].host_name = scope.jobhosts[i].summary_fields.host.name;
+ }
+ });
+
+ SearchInit({ scope: scope, set: 'jobhosts', list: list, url: defaultUrl });
+ PaginateInit({ scope: scope, list: list, url: defaultUrl });
+ scope.search(list.iterator);
+
+ LoadBreadCrumbs();
+
+ scope.viewHost = function(id) {
+ Rest.setUrl(GetBasePath('jobs') + $routeParams.id + '/');
+ Rest.get()
+ .success( function(data, status, headers, config) {
+ LoadBreadCrumbs({ path: '/inventories/' + data.inventory, title: data.summary_fields.inventory.name });
+ $location.path('/inventories/' + data.inventory + /hosts/ + id);
+ })
+ .error( function(data, status, headers, config) {
+ ProcessErrors(scope, data, status, null,
+ { hdr: 'Error!', msg: 'Failed to lookup job record for job ' + $routeParams.id + ' GET returned status: ' + status });
+ });
+ };
+
+}
+
+JobHostSummaryList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobHostList',
+ 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
+ 'ProcessErrors','GetBasePath'
+ ];
diff --git a/ansibleworks/ui/static/js/controllers/JobTemplates.js b/ansibleworks/ui/static/js/controllers/JobTemplates.js
index 04c70290b0..5e7f18f95b 100644
--- a/ansibleworks/ui/static/js/controllers/JobTemplates.js
+++ b/ansibleworks/ui/static/js/controllers/JobTemplates.js
@@ -185,6 +185,7 @@ function JobTemplatesList ($scope, $rootScope, $location, $log, $routeParams, Re
Rest.get()
.success( function(data, status, headers, config) {
// Create a job record
+ scope.credential = '';
if (data.credential == '' || data.credential == null) {
// Template does not have credential, prompt for one
if (scope.credentialWatchRemove) {
diff --git a/ansibleworks/ui/static/js/controllers/Jobs.js b/ansibleworks/ui/static/js/controllers/Jobs.js
index 36f0f90d88..fd6e6475f3 100644
--- a/ansibleworks/ui/static/js/controllers/Jobs.js
+++ b/ansibleworks/ui/static/js/controllers/Jobs.js
@@ -41,6 +41,11 @@ function JobsListCtrl ($scope, $rootScope, $location, $log, $routeParams, Rest,
$location.path($location.path() + '/' + id + '/job_events');
}
+ scope.viewSummary = function(id, name) {
+ LoadBreadCrumbs({ path: '/jobs/' + id, title: name });
+ $location.path($location.path() + '/' + id + '/job_host_summaries');
+ }
+
scope.deleteJob = function(id, name) {
Rest.setUrl(defaultUrl + id + '/');
Rest.get()
diff --git a/ansibleworks/ui/static/js/controllers/Projects.js b/ansibleworks/ui/static/js/controllers/Projects.js
index 363f78b6c6..48df30e9cb 100644
--- a/ansibleworks/ui/static/js/controllers/Projects.js
+++ b/ansibleworks/ui/static/js/controllers/Projects.js
@@ -207,7 +207,7 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
var id = $routeParams.id;
var relatedSets = {};
- // After the Organization is loaded, retrieve each related set
+ // After the project is loaded, retrieve each related set
if (scope.projectLoadedRemove) {
scope.projectLoadedRemove();
}
@@ -257,8 +257,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
ReturnToCaller();
})
.error( function(data, status, headers, config) {
- ProcessErrors(scope, data, status, OrganizationForm,
- { hdr: 'Error!', msg: 'Failed to update project: ' + id + '. PUT status: ' + status });
+ ProcessErrors(scope, data, status, form,
+ { hdr: 'Error!', msg: 'Failed to update project: ' + id + '. PUT status: ' + status });
});
};
diff --git a/ansibleworks/ui/static/js/controllers/Teams.js b/ansibleworks/ui/static/js/controllers/Teams.js
index 363dbf3fa2..92e3d92245 100644
--- a/ansibleworks/ui/static/js/controllers/Teams.js
+++ b/ansibleworks/ui/static/js/controllers/Teams.js
@@ -34,7 +34,6 @@ function TeamsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Ale
}
});
-
//SetTeamListeners({ scope: scope, set: 'teams', iterator: list.iterator });
SearchInit({ scope: scope, set: 'teams', list: list, url: defaultUrl });
PaginateInit({ scope: scope, list: list, url: defaultUrl });
diff --git a/ansibleworks/ui/static/js/helpers/Lookup.js b/ansibleworks/ui/static/js/helpers/Lookup.js
index 7be0fb1c4d..b03e46900d 100644
--- a/ansibleworks/ui/static/js/helpers/Lookup.js
+++ b/ansibleworks/ui/static/js/helpers/Lookup.js
@@ -66,7 +66,6 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
'and then click the Select button.');
}
else {
- console.log('found!');
if (postAction) {
postAction();
}
diff --git a/ansibleworks/ui/static/js/helpers/paginate.js b/ansibleworks/ui/static/js/helpers/paginate.js
index 7534101b52..4c3ebfd356 100644
--- a/ansibleworks/ui/static/js/helpers/paginate.js
+++ b/ansibleworks/ui/static/js/helpers/paginate.js
@@ -53,9 +53,7 @@ angular.module('PaginateHelper', ['RefreshHelper'])
scope.changePageSize = function(set, iterator) {
// Called when a new page size is selected
scope[iterator + 'Page'] = 0;
- console.log(url);
url = url.replace(/\/\?.*$/,'/');
- console.log(url);
url += (scope[iterator + 'SearchParams']) ? scope[iterator + 'SearchParams'] + '&page_size=' + scope[iterator + 'PageSize' ] :
'?page_size=' + scope[iterator + 'PageSize' ];
Refresh({ scope: scope, set: set, iterator: iterator, url: url });
diff --git a/ansibleworks/ui/static/js/helpers/search.js b/ansibleworks/ui/static/js/helpers/search.js
index 45f5000547..ad8b754fdd 100644
--- a/ansibleworks/ui/static/js/helpers/search.js
+++ b/ansibleworks/ui/static/js/helpers/search.js
@@ -30,7 +30,13 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
// Set default values
for (fld in list.fields) {
if (list.fields[fld].key) {
- default_order = (list.fields[fld].desc) ? '-' + fld : fld;
+ if (list.fields[fld].sourceModel) {
+ var fka = list.fields[fld].sourceModel + '__' + list.fields[fld].sourceField;
+ default_order = (list.fields[fld].desc) ? '-' + fka : fka;
+ }
+ else {
+ default_order = (list.fields[fld].desc) ? '-' + fld : fld;
+ }
scope[iterator + 'SearchField'] = fld
scope[iterator + 'SearchFieldLabel'] = list.fields[fld].label;
break;
@@ -84,6 +90,7 @@ angular.module('SearchHelper', ['RestServices', 'Utilities', 'RefreshHelper'])
// need to be able to search by related set. Ex: /api/v1/inventories/?organization__name__icontains=
//
scope[iterator + 'SearchSpin'] = true;
+ scope[iterator + 'SearchParms'] = '';
var url = defaultUrl;
if ( (scope[iterator + 'SelectShow'] == false && scope[iterator + 'SearchValue'] != '' && scope[iterator + 'SearchValue'] != undefined) ||
(scope[iterator + 'SelectShow'] && scope[iterator + 'SearchSelectValue']) ) {
diff --git a/ansibleworks/ui/static/js/lists/Credentials.js b/ansibleworks/ui/static/js/lists/Credentials.js
index d74211a5b2..853fbd5423 100644
--- a/ansibleworks/ui/static/js/lists/Credentials.js
+++ b/ansibleworks/ui/static/js/lists/Credentials.js
@@ -15,7 +15,7 @@ angular.module('CredentialsListDefinition', [])
selectTitle: 'Add Credentials',
editTitle: 'Credentials',
selectInstructions: 'Check the Select checkbox next to each credential to be added, and click Finished when done. Use the green button to create a new user.',
- editInstructions: 'Add a new credential record from either the Teams tab or the Users tab. Teams and Users each have an associated set of Credentials.',
+ editInstructions: 'Create a new credential from either the Teams tab or the Users tab. Teams and Users each have an associated set of Credentials.',
index: true,
index: true,
diff --git a/ansibleworks/ui/static/js/lists/JobHosts.js b/ansibleworks/ui/static/js/lists/JobHosts.js
new file mode 100644
index 0000000000..d31482b535
--- /dev/null
+++ b/ansibleworks/ui/static/js/lists/JobHosts.js
@@ -0,0 +1,62 @@
+/*********************************************
+ * Copyright (c) 2013 AnsibleWorks, Inc.
+ *
+ * JobHosts.js
+ * List view object for Job Host Summary data model.
+ *
+ *
+ */
+angular.module('JobHostDefinition', [])
+ .value(
+ 'JobHostList', {
+
+ name: 'jobhosts',
+ iterator: 'jobhost',
+ editTitle: 'Job Host Summary',
+ index: true,
+ hover: true,
+
+ fields: {
+ host: {
+ label: 'Host',
+ key: true,
+ sourceModel: 'host',
+ sourceField: 'name',
+ ngBind: 'jobhost.host_name',
+ //linkTo: '/hosts/\{\{ jobhost.host \}\}'
+ ngClick:"viewHost(\{\{ jobhost.host \}\})"
+ },
+ changed: {
+ label: 'Changed',
+ searchType: 'math'
+ },
+ dark: {
+ label: 'Dark',
+ searchType: 'math'
+ },
+ failures: {
+ label: 'Failures',
+ searchType: 'math'
+ },
+ ok: {
+ label: 'OK',
+ searchType: 'math'
+ },
+ processed: {
+ label: 'Processed',
+ searchType: 'math'
+ },
+ skipped: {
+ label: 'Skipped',
+ searchType: 'math'
+ }
+ },
+
+ actions: {
+
+ },
+
+ fieldActions: {
+ }
+
+ });
diff --git a/ansibleworks/ui/static/js/lists/Jobs.js b/ansibleworks/ui/static/js/lists/Jobs.js
index bea9c7bd17..00738bb7c4 100644
--- a/ansibleworks/ui/static/js/lists/Jobs.js
+++ b/ansibleworks/ui/static/js/lists/Jobs.js
@@ -67,7 +67,7 @@ angular.module('JobsListDefinition', [])
summary: {
title: 'Summary',
icon: 'icon-filter',
- ngClick: 'viewSummary(\{{ job.id \}\})',
+ ngClick: "viewSummary(\{{ job.id \}\}, '\{\{ job.name \}\}')",
class: 'btn-success btn-mini',
awToolTip: 'View host summary',
ngDisabled: "job.status == 'new'"
@@ -88,7 +88,7 @@ angular.module('JobsListDefinition', [])
ngClick: 'deleteJob(\{\{ job.id \}\})',
class: 'btn-danger btn-mini',
awToolTip: 'Cancel job',
- ngDisabled: "job.status == 'error' || job.status == 'failed' || job.status == 'success'"
+ ngDisabled: "job.status != 'new' && job.status != 'pending'"
}
}
});
diff --git a/ansibleworks/ui/static/lib/ansible/list-generator.js b/ansibleworks/ui/static/lib/ansible/list-generator.js
index 21d348d799..adbeb4c407 100644
--- a/ansibleworks/ui/static/lib/ansible/list-generator.js
+++ b/ansibleworks/ui/static/lib/ansible/list-generator.js
@@ -200,8 +200,17 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
html += "\" ";
html += (list.fields[fld].ngClass) ? this.attr(list.fields[fld], 'ngClass') : "";
html += ">\n";
- if ((list.fields[fld].key || list.fields[fld].link) && options.mode != 'lookup' && options.mode != 'select') {
- html += "";
+ if ((list.fields[fld].key || list.fields[fld].link || list.fields[fld].linkTo || list.fields[fld].ngClick )
+ && options.mode != 'lookup' && options.mode != 'select') {
+ if (list.fields[fld].linkTo) {
+ html += "";
+ }
+ else if (list.fields[fld].ngClick) {
+ html += "";
+ }
+ else {
+ html += "";
+ }
}
html += (list.fields[fld].icon) ? this.icon(list.fields[fld].icon) : "";
if (list.fields[fld].ngBind) {
diff --git a/ansibleworks/ui/templates/ui/index.html b/ansibleworks/ui/templates/ui/index.html
index e38c06bdfb..10c47943e0 100644
--- a/ansibleworks/ui/templates/ui/index.html
+++ b/ansibleworks/ui/templates/ui/index.html
@@ -37,6 +37,7 @@
+
@@ -60,6 +61,7 @@
+
@@ -208,7 +210,6 @@
var loc = window.location.toString();
if (! regx.test(loc)) {
- console.log('change! ' + window.location.toString());
window.location = '#/' + url.toLowerCase().replace(/ /g,'_');
}
});