From fd16c0827a961f459ca8d505a9ab96e3a5d0f800 Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Wed, 11 Sep 2013 11:49:52 -0400 Subject: [PATCH] Fixed zip code in footer. Changed job navigation to match inventory navigation (links at top of page rather than buttons). --- awx/ui/static/js/controllers/JobEvents.js | 17 ++-------- awx/ui/static/js/controllers/JobHosts.js | 11 ++----- awx/ui/static/js/controllers/Jobs.js | 3 +- awx/ui/static/js/forms/Jobs.js | 31 +++++++++-------- awx/ui/static/js/lists/JobEvents.js | 29 ++++++++-------- awx/ui/static/js/lists/JobHosts.js | 33 +++++++++---------- awx/ui/static/lib/ansible/form-generator.js | 27 ++++++++------- .../static/lib/ansible/generator-helpers.js | 17 ++++++++-- awx/ui/static/lib/ansible/list-generator.js | 12 +++++-- awx/ui/templates/ui/index.html | 2 +- 10 files changed, 88 insertions(+), 94 deletions(-) diff --git a/awx/ui/static/js/controllers/JobEvents.js b/awx/ui/static/js/controllers/JobEvents.js index 6115412162..24a1ef61dc 100644 --- a/awx/ui/static/js/controllers/JobEvents.js +++ b/awx/ui/static/js/controllers/JobEvents.js @@ -24,7 +24,8 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, var view = GenerateList; var base = $location.path().replace(/^\//,'').split('/')[0]; var scope = view.inject(list, { mode: 'edit' }); - + + scope.job_id = $routeParams.id; $rootScope.flashMessage = null; scope.selected = []; scope.expand = true; //on load, automatically expand all nodes @@ -168,11 +169,6 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, LoadBreadCrumbs(); scope.viewJobEvent = function(id) { - //var url = '/jobs/' + $routeParams.id + '/job_events/' + id; - //if (scope['jobeventPage']) { - // url += '?&page=' + (scope['jobeventPage'] + 1); - //} - //$location.url(url); EventView({ event_id: id }); } @@ -180,15 +176,6 @@ function JobEventsList ($scope, $rootScope, $location, $log, $routeParams, Rest, scope.expand = true; scope.search(list.iterator); } - - scope.jobDetails = function() { - $location.path('/jobs/' + $routeParams.id); - }; - - scope.jobSummary = function() { - $location.path('/jobs/' + $routeParams.id + '/job_host_summaries'); - }; - } JobEventsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList', diff --git a/awx/ui/static/js/controllers/JobHosts.js b/awx/ui/static/js/controllers/JobHosts.js index a6a77534ca..5d45561bcd 100644 --- a/awx/ui/static/js/controllers/JobHosts.js +++ b/awx/ui/static/js/controllers/JobHosts.js @@ -18,7 +18,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, var list = JobHostList; var base = $location.path().replace(/^\//,'').split('/')[0]; var defaultUrl = GetBasePath(base) + $routeParams.id + '/job_host_summaries/'; - + // When viewing all summaries for a particular host, show job ID, otherwise row ID. if (base == 'hosts') { list.index = false; @@ -29,6 +29,7 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, var view = GenerateList; var scope = view.inject(list, { mode: 'edit' }); + scope.selected = []; // control enable/disable/show of job specific view elements @@ -87,14 +88,6 @@ function JobHostSummaryList ($scope, $rootScope, $location, $log, $routeParams, scope.refresh = function() { scope.search(list.iterator); } - - scope.jobDetails = function() { - $location.path('/jobs/' + $routeParams.id); - }; - - scope.jobEvents = function() { - $location.path('/jobs/' + $routeParams.id + '/job_events'); - }; } diff --git a/awx/ui/static/js/controllers/Jobs.js b/awx/ui/static/js/controllers/Jobs.js index 588811221c..7901361b64 100644 --- a/awx/ui/static/js/controllers/Jobs.js +++ b/awx/ui/static/js/controllers/Jobs.js @@ -175,7 +175,8 @@ function JobsEdit ($scope, $rootScope, $compile, $location, $log, $routeParams, var master = {}; var id = $routeParams.id; var relatedSets = {}; - + + scope.job_id = id; scope.parseType = 'yaml'; scope.statusSearchSpin = false; diff --git a/awx/ui/static/js/forms/Jobs.js b/awx/ui/static/js/forms/Jobs.js index fcd2636df5..b0bf8bec23 100644 --- a/awx/ui/static/js/forms/Jobs.js +++ b/awx/ui/static/js/forms/Jobs.js @@ -16,6 +16,21 @@ angular.module('JobFormDefinition', []) well: true, twoColumns: true, + + navigationLinks: { + hosts: { + href: "/#/jobs/{{ job_id }}/job_host_summaries", + label: 'Hosts', + icon: 'icon-laptop' + }, + events: { + href: "/#/jobs/{{ job_id }}/job_events", + label: 'Events', + icon: 'icon-list-ul' + } + }, + + fields: { name: { label: 'Name', @@ -282,22 +297,6 @@ angular.module('JobFormDefinition', []) "class": 'btn-sm btn-primary', awToolTip: 'Refresh job status & output', mode: 'all' - }, - summary: { - label: 'Hosts', - icon: 'icon-laptop', - ngClick: "jobSummary()", - "class": 'btn btn-default btn-sm', - awToolTip: 'View host summary', - mode: 'all' - }, - events: { - label: 'Events', - icon: 'icon-list-ul', - ngClick: "jobEvents()", - "class": 'btn btn-default btn-sm', - awToolTip: 'Edit job events', - mode: 'all' } } diff --git a/awx/ui/static/js/lists/JobEvents.js b/awx/ui/static/js/lists/JobEvents.js index 1ab9e05d52..d5a65fad3b 100644 --- a/awx/ui/static/js/lists/JobEvents.js +++ b/awx/ui/static/js/lists/JobEvents.js @@ -17,6 +17,19 @@ angular.module('JobEventsListDefinition', []) hover: true, hasChildren: true, filterBy: '\{ show: true \}', + + navigationLinks: { + details: { + href: "/#/jobs/{{ job_id }}", + label: 'Details', + icon: 'icon-zoom-in' + }, + summary: { + href: "/#/jobs/{{ job_id }}/job_host_summaries", + label: 'Hosts', + icon: 'icon-laptop' + } + }, fields: { created: { @@ -65,22 +78,6 @@ angular.module('JobEventsListDefinition', []) awToolTip: 'Refresh the page', "class": 'btn-sm btn-primary', mode: 'all' - }, - edit: { - label: 'Details', - ngClick: "jobDetails()", - icon: 'icon-zoom-in', - "class": 'btn btn-default btn-sm', - awToolTip: 'Edit job details', - mode: 'all' - }, - summary: { - label: 'Hosts', - icon: 'icon-laptop', - ngClick: "jobSummary()", - "class": 'btn btn-default btn-sm', - awToolTip: 'View host summary', - mode: 'all' } }, diff --git a/awx/ui/static/js/lists/JobHosts.js b/awx/ui/static/js/lists/JobHosts.js index 3e98aaa400..c2181d65c7 100644 --- a/awx/ui/static/js/lists/JobHosts.js +++ b/awx/ui/static/js/lists/JobHosts.js @@ -16,6 +16,21 @@ angular.module('JobHostDefinition', []) index: true, hover: true, + navigationLinks: { + details: { + href: "/#/jobs/{{ job_id }}", + label: 'Details', + icon: 'icon-zoom-in', + ngShow: "job_id !== null" + }, + events: { + href: "/#/jobs/{{ job_id }}/job_events", + label: 'Events', + icon: 'icon-list-ul', + ngShow: "job_id !== null" + } + }, + fields: { id: { label: 'Job ID', @@ -71,24 +86,6 @@ angular.module('JobHostDefinition', []) awToolTip: 'Refresh the page', mode: 'all' }, - edit: { - label: 'Details', - icon: 'icon-edit', - ngClick: "jobDetails()", - ngShow: 'job_id !== null', - "class": 'btn btn-default btn-sm', - awToolTip: 'Edit job details', - mode: 'all' - }, - events: { - label: 'Events', - icon: 'icon-list-ul', - ngClick: "jobEvents()", - ngShow: 'job_id !== null', - "class": 'btn btn-default btn-sm', - awToolTip: 'View job events', - mode: 'all' - }, help: { awPopOver: "
\n
Success
Tasks successfully executed on the host.
\n" + "
Changed
Actions taken on the host.
\n" + diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index a8efc3eed1..efa9d50374 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -9,8 +9,9 @@ */ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) - .factory('GenerateForm', [ '$location', '$cookieStore', '$compile', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', 'Column', - function($location, $cookieStore, $compile, SearchWidget, PaginateWidget, Attr, Icon, Column) { + .factory('GenerateForm', [ '$location', '$cookieStore', '$compile', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', 'Column', + 'NavigationLink', + function($location, $cookieStore, $compile, SearchWidget, PaginateWidget, Attr, Icon, Column, NavigationLink) { return { setForm: function(form) { @@ -288,9 +289,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) return html; }, - navigationLink: function(link) { - return "" + this.attr(link, 'icon') + ' ' + link.label + "\n"; - }, + navigationLink: NavigationLink, buildField: function(fld, field, options, form) { @@ -770,6 +769,14 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) if (!this.modal) { html += this.breadCrumbs(options); } + + if (!this.modal && this.form.navigationLinks) { + html += "\n"; + } if ((!this.modal && this.form.statusFields)) { // Add status fields section (used in Jobs form) @@ -811,7 +818,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies']) html += "\n"; } else { - + if ( this.form.collapse && this.form.collapseMode == options.mode) { html += "
\n"; - for (var link in this.form.navigationLinks) { - html += this.navigationLink(this.form.navigationLinks[link]); - } - html += "
\n"; - } // Start the well if ( this.has('well') ) { diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index b62f96938b..e8ca8a6ec6 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -90,10 +90,23 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers']) .factory('Icon', function() { return function(icon) { - return " "; + return " "; } }) - + + .factory('NavigationLink', ['Attr', 'Icon', function(Attr, Icon) { + return function(link) { + var html = "\n"; + for (var link in list.navigationLinks) { + html += NavigationLink(list.navigationLinks[link]); + } + html += "\n"; + } + if (options.mode != 'lookup' && (list.well == undefined || list.well == 'true')) { html += "
\n"; } diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index b8de52419f..96085537e1 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -343,7 +343,7 @@