diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 0e6a08978b..b3dd266a63 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -60,6 +60,7 @@ angular.module('Tower', [ 'CredentialFormDefinition', 'LookUpHelper', 'JobTemplatesListDefinition', + 'PortalJobTemplatesListDefinition', 'JobTemplateFormDefinition', 'JobTemplatesHelper', 'JobSubmissionHelper', @@ -86,7 +87,7 @@ angular.module('Tower', [ 'HostPieChartWidget', 'HostGraphWidget', 'DashboardJobsWidget', - 'PortalJobTemplateWidget', + 'PortalJobsWidget', 'StreamWidget', 'JobsHelper', 'InventoryGroupsHelpDefinition', @@ -117,7 +118,8 @@ angular.module('Tower', [ 'LoadConfigHelper', 'SocketHelper', 'AboutAnsibleHelpModal', - 'SurveyQuestionFormDefinition' + 'SurveyQuestionFormDefinition', + 'PortalJobsListDefinition' ]) .constant('AngularScheduler.partials', urlPrefix + 'lib/angular-scheduler/lib/') diff --git a/awx/ui/static/js/controllers/Portal.js b/awx/ui/static/js/controllers/Portal.js index 6698de9822..5931715da4 100644 --- a/awx/ui/static/js/controllers/Portal.js +++ b/awx/ui/static/js/controllers/Portal.js @@ -25,15 +25,15 @@ * */ function PortalController($scope, $compile, $routeParams, $rootScope, $location, $log, Wait, ClearScope, Stream, Rest, GetBasePath, ProcessErrors, - Button, PortalJobTemplate, GenerateList, JobTemplateList, SearchInit, PaginateInit, PlaybookRun){ + Button, PortalJobsWidget, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){ ClearScope('portal'); var html, e, - winHeight, - available_height, - list = JobTemplateList, + // winHeight, + // available_height, + list = PortalJobTemplateList, view= GenerateList, defaultUrl = GetBasePath('job_templates'), buttons = { @@ -71,9 +71,9 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location, $scope.removeLoadPortal(); } $scope.removeLoadPortal = $scope.$on('LoadPortal', function () { - winHeight = $(window).height(); - available_height = Math.floor(winHeight - $('#main-menu-container .navbar').outerHeight() - $('#refresh-row').outerHeight() - 30); - $('.portal-container').height(available_height); + // winHeight = $(window).height(); + // available_height = Math.floor(winHeight - $('#main-menu-container .navbar').outerHeight() - $('#refresh-row').outerHeight() - 30); + // $('.portal-container').height(available_height); view.inject( list, { id : 'portal-job-template', @@ -106,7 +106,7 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location, $scope.search(list.iterator); - PortalJobTemplate({ + PortalJobsWidget({ scope: $scope, target: 'portal-jobs', // dashboard: data @@ -136,5 +136,5 @@ function PortalController($scope, $compile, $routeParams, $rootScope, $location, } PortalController.$inject = ['$scope', '$compile', '$routeParams', '$rootScope', '$location', '$log','Wait', 'ClearScope', 'Stream', 'Rest', 'GetBasePath', 'ProcessErrors', - 'Button', 'PortalJobTemplate', 'GenerateList' , 'JobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun' + 'Button', 'PortalJobsWidget', 'GenerateList' , 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun' ]; diff --git a/awx/ui/static/js/lists/PortalJobTemplates.js b/awx/ui/static/js/lists/PortalJobTemplates.js new file mode 100644 index 0000000000..45a3395872 --- /dev/null +++ b/awx/ui/static/js/lists/PortalJobTemplates.js @@ -0,0 +1,47 @@ +/********************************************* + * Copyright (c) 2014 AnsibleWorks, Inc. + * + * PoralJobTemplates.js + * List view object for Job Templates data model. + * + * + */ + +'use strict'; + +angular.module('PortalJobTemplatesListDefinition', []) + .value('PortalJobTemplateList', { + + name: 'job_templates', + iterator: 'job_template', + selectTitle: 'Add Job Template', + editTitle: 'Job Templates', + selectInstructions: "Click on a row to select it, and click Finished when done. Use the " + + "button to create a new job template.", + index: false, + hover: true, + + fields: { + name: { + label: 'Name', + columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8' + }, + description: { + label: 'Description', + columnClass: 'col-lg-4 col-md-4 hidden-sm hidden-xs' + } + }, + + actions: { + }, + + fieldActions: { + submit: { + label: 'Launch', + mode: 'all', + ngClick: 'submitJob(job_template.id)', + awToolTip: 'Start a job using this template', + dataPlacement: 'top' + } + } + }); diff --git a/awx/ui/static/js/lists/PortalJobs.js b/awx/ui/static/js/lists/PortalJobs.js new file mode 100644 index 0000000000..5f05415861 --- /dev/null +++ b/awx/ui/static/js/lists/PortalJobs.js @@ -0,0 +1,81 @@ +/********************************************* + * Copyright (c) 2014 AnsibleWorks, Inc. + * + * PortalJobs.js + * List view object for portal job data model. + * + * Used on dashboard to provide a list of all jobs, regardless of + * status. + * + */ + +'use strict'; + +angular.module('PortalJobsListDefinition', []) + .value( 'PortalJobsList', { + + name: 'jobs', + iterator: 'job', + editTitle: 'Jobs', + // 'class': 'table-condensed', + index: false, + hover: true, + well: false, + + fields: { + id: { + label: 'ID', + //ngClick:"viewJobLog(job.id)", + key: true, + noLink: true, //undocumented: 'key' above will automatically made the fields a link, but 'noLink' will override this setting + desc: true, + searchType: 'int', + columnClass: 'col-lg-1 col-md-1 col-sm-2 col-xs-2', + // awToolTip: "{{ job.status_tip }}", + // awTipPlacement: "top", + }, + status: { + label: 'Status', + columnClass: 'col-lg-1 col-md-2 col-sm-2 col-xs-2', + // awToolTip: "{{ job.status_tip }}", + // awTipPlacement: "top", + dataTitle: "{{ job.status_popover_title }}", + icon: 'icon-job-{{ job.status }}', + iconOnly: true, + // ngClick:"viewJobLog(job.id)", + searchable: true, + nosort: true, + searchType: 'select', + searchOptions: [ + { name: "Success", value: "successful" }, + { name: "Error", value: "error" }, + { name: "Failed", value: "failed" }, + { name: "Canceled", value: "canceled" } + ] + }, + started: { + label: 'Started', + noLink: true, + searchable: false, + filter: "date:'MM/dd HH:mm:ss'", + columnClass: "col-lg-3 col-md-3 hidden-xs" + }, + name: { + label: 'Name', + columnClass: 'col-md-5 col-xs-5', + //ngClick: "viewJobLog(job.id, job.nameHref)", + defaultSearchField: true + } + }, + + actions: { }, + + fieldActions: { + job_details: { + mode: 'all', + ngClick: "viewJobLog(job.id)", + awToolTip: 'View job details', + dataPlacement: 'top' + } + } + }); diff --git a/awx/ui/static/js/widgets/PortalJobs.js b/awx/ui/static/js/widgets/PortalJobs.js new file mode 100644 index 0000000000..b337dc930d --- /dev/null +++ b/awx/ui/static/js/widgets/PortalJobs.js @@ -0,0 +1,178 @@ +/********************************************* + * Copyright (c) 2014 AnsibleWorks, Inc. + */ + /** + * @ngdoc function + * @name widgets.function:DashboardJobs + * @description + * + */ + +'use strict'; + +angular.module('PortalJobsWidget', ['RestServices', 'Utilities']) +.factory('PortalJobsWidget', ['$rootScope', '$compile', 'LoadSchedulesScope', 'LoadJobsScope', 'PortalJobsList', 'ScheduledJobsList', 'GetChoices', 'GetBasePath', + function ($rootScope, $compile, LoadSchedulesScope, LoadJobsScope, PortalJobsList, ScheduledJobsList, GetChoices, GetBasePath) { + return function (params) { + var scope = params.scope, + target = params.target, + choicesCount = 0, + listCount = 0, + jobs_scope = scope.$new(true), + scheduled_scope = scope.$new(true), + max_rows, + html, e; + + html = ''; + html += "