From 567aef5d1e15ae5909ee92b93766608e84735bef Mon Sep 17 00:00:00 2001 From: chouseknecht Date: Thu, 5 Sep 2013 07:17:34 -0400 Subject: [PATCH] AC-351 last bits of SCM Integration. Refresh button, and status and last_updated fields added. --- awx/ui/static/js/controllers/Projects.js | 21 ++++++++++++--- awx/ui/static/js/helpers/JobSubmission.js | 1 + awx/ui/static/js/lists/JobEvents.js | 2 +- awx/ui/static/js/lists/JobHosts.js | 2 +- awx/ui/static/js/lists/Jobs.js | 2 +- awx/ui/static/js/lists/Projects.js | 33 +++++++++++++++++++++++ 6 files changed, 55 insertions(+), 6 deletions(-) diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index de0b282e55..b2c17745c4 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -12,7 +12,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, Alert, ProjectList, GenerateList, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, - ClearScope, ProcessErrors, GetBasePath, SelectionInit, SCMUpdate, ProjectStatus) + ClearScope, ProcessErrors, GetBasePath, SelectionInit, SCMUpdate, ProjectStatus, + FormatDate) { ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior //scope. @@ -38,6 +39,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, // will contain status of last update, which is not what we want. scope.projects[i].last_update_failed = false; } + scope.projects[i].last_updated = FormatDate(new Date(scope.projects[i].last_updated)); } }); @@ -100,13 +102,26 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, action: action }); } - + + scope.refresh = function() { + scope.search(list.iterator); + } + + if (scope.removeUpdateSubmitted) { + scope.removeUpdateSubmitted(); + } + scope.removeUpdateSubmitted = scope.$on('UpdateSubmitted', function() { + scope.search(list.iterator); + }); scope.SCMUpdate = function(project_id) { for (var i=0; i < scope.projects.length; i++) { if (scope.projects[i].id == project_id) { if (scope.projects[i].scm_type == "") { Alert('Missing SCM Setup', 'Before running an SCM update, edit the project and provide the SCM access information.', 'alert-info'); } + else if (scope.projects[i].status == 'updating') { + Alert('Update in Progress', 'The SCM update process is running. Use the Refresh button to monitor the status.', 'alert-info'); + } else { SCMUpdate({ scope: scope, project_id: project_id }); } @@ -118,7 +133,7 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest, ProjectsList.$inject = [ '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'ProjectList', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', - 'GetBasePath', 'SelectionInit', 'SCMUpdate', 'ProjectStatus']; + 'GetBasePath', 'SelectionInit', 'SCMUpdate', 'ProjectStatus', 'FormatDate']; function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParams, ProjectsForm, diff --git a/awx/ui/static/js/helpers/JobSubmission.js b/awx/ui/static/js/helpers/JobSubmission.js index a41e2ee702..a8022cc593 100644 --- a/awx/ui/static/js/helpers/JobSubmission.js +++ b/awx/ui/static/js/helpers/JobSubmission.js @@ -72,6 +72,7 @@ angular.module('JobSubmissionHelper', [ 'RestServices', 'Utilities', 'Credential Rest.setUrl(start_url); Rest.post(pswd) .success( function(data, status, headers, config) { + scope.$emit('UpdateSubmitted'); if (form.name == 'credential') { navigate(false); } diff --git a/awx/ui/static/js/lists/JobEvents.js b/awx/ui/static/js/lists/JobEvents.js index b09dc7f339..1ab9e05d52 100644 --- a/awx/ui/static/js/lists/JobEvents.js +++ b/awx/ui/static/js/lists/JobEvents.js @@ -63,7 +63,7 @@ angular.module('JobEventsListDefinition', []) icon: 'icon-refresh', label: 'Refresh', awToolTip: 'Refresh the page', - "class": 'btn-sm btn-success', + "class": 'btn-sm btn-primary', mode: 'all' }, edit: { diff --git a/awx/ui/static/js/lists/JobHosts.js b/awx/ui/static/js/lists/JobHosts.js index f203f52c01..99426aba5a 100644 --- a/awx/ui/static/js/lists/JobHosts.js +++ b/awx/ui/static/js/lists/JobHosts.js @@ -67,7 +67,7 @@ angular.module('JobHostDefinition', []) label: 'Refresh', icon: 'icon-refresh', ngClick: "refresh()", - "class": 'btn-success btn-sm', + "class": 'btn-primary btn-sm', awToolTip: 'Refresh the page', mode: 'all' }, diff --git a/awx/ui/static/js/lists/Jobs.js b/awx/ui/static/js/lists/Jobs.js index 24c584b5cf..06073f70f9 100644 --- a/awx/ui/static/js/lists/Jobs.js +++ b/awx/ui/static/js/lists/Jobs.js @@ -57,7 +57,7 @@ angular.module('JobsListDefinition', []) actions: { refresh: { label: 'Refresh', - "class": 'btn-success btn-sm', + "class": 'btn-primary btn-sm', ngClick: "refreshJob(\{\{ job.id \}\})", icon: 'icon-refresh', awToolTip: 'Refresh the page', diff --git a/awx/ui/static/js/lists/Projects.js b/awx/ui/static/js/lists/Projects.js index bc6f69d701..899ec9ba05 100644 --- a/awx/ui/static/js/lists/Projects.js +++ b/awx/ui/static/js/lists/Projects.js @@ -28,6 +28,13 @@ angular.module('ProjectsListDefinition', []) }, description: { label: 'Description' + }, + last_updated: { + label: 'Last Updated', + type: 'date' + }, + status: { + label: 'Status' } }, @@ -39,6 +46,32 @@ angular.module('ProjectsListDefinition', []) ngClick: 'addProject()', "class": 'btn-success btn-sm', awToolTip: 'Create a new project' + }, + refresh: { + label: 'Refresh', + "class": 'btn-primary btn-sm', + ngClick: "refresh(\{\{ job.id \}\})", + icon: 'icon-refresh', + awToolTip: 'Refresh the page', + mode: 'all' + }, + help: { + awPopOver: "
\n
Updating
An SCM update is in progress.
\n" + + "
Never Updated
No SCM update has ever run for the project.
\n" + + "
Failed
An error occurred during the most recent SCM update.
\n" + + "
Successful
The latest SCM update ran to completion without incident.
\n" + + "
Missing
The local project directory is missing.
\n" + + "
OK
The project does not use SCM, and the directory is present.
\n" + + "
\n", + dataPlacement: 'left', + dataContainer: 'body', + icon: "icon-question-sign", + mode: 'all', + 'class': 'btn-xs btn-info btn-help', + awToolTip: 'Click for help', + dataTitle: 'Project Status', + iconSize: 'large', + id: 'project-help-button' } },