diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 2dad7a416e..cd0c710470 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -77,10 +77,6 @@ angular.module('Tower', [ 'DashboardCountsWidget', 'DashboardChartsWidget', 'DashboardJobsWidget', - 'JobStatusWidget', - 'InventorySyncStatusWidget', - 'SCMSyncStatusWidget', - 'ObjectCountWidget', 'StreamWidget', 'JobsHelper', 'InventoryGroupsHelpDefinition', diff --git a/awx/ui/static/js/widgets/DashboardJobs.js b/awx/ui/static/js/widgets/DashboardJobs.js index 56b8b711d5..b6f938dacc 100644 --- a/awx/ui/static/js/widgets/DashboardJobs.js +++ b/awx/ui/static/js/widgets/DashboardJobs.js @@ -10,56 +10,28 @@ 'use strict'; angular.module('DashboardJobsWidget', ['RestServices', 'Utilities']) - .factory('DashboardJobs', ['$rootScope', '$compile', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', - function ($rootScope, $compile) { - return function (params) { +.factory('DashboardJobs', ['$rootScope', '$compile', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function ($rootScope, $compile) { + return function (params) { - var scope = params.scope, - target = params.target, - //dashboard = params.dashboard, + var scope = params.scope, + target = params.target, + html, e; - html, element; + html += "\n"; + html += "
\n"; + html += "
\n"; + html += "
\n"; + html += "
\n"; - html = "
\n"; - html += "
\n"; + e = angular.element(document.getElementById(target)); + e.html(html); + $compile(e)(scope); + scope.$emit('WidgetLoaded'); - html += "\n"; - html += "\n"; - html += "\n"; - html += "\n"; - html += "\n"; - html += "\n"; - html += "\n"; - html += "
Active Jobs
\n"; - -//--------------------------------------------------------------------------------------------------------- -//html code from Jobs page's partial: - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
Active
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; -//--------------------------------------------------------------------------------------------------------- - - html += "
\n"; - - html += "
\n"; - html += "
\n"; - - - - - element = angular.element(document.getElementById(target)); - element.html(html); - $compile(element)(scope); - scope.$emit('WidgetLoaded'); - - }; - } - ]); \ No newline at end of file + }; +}]); \ No newline at end of file diff --git a/awx/ui/static/js/widgets/JobStatus.js b/awx/ui/static/js/widgets/JobStatus.js index bbd14de919..ab5429d6f2 100644 --- a/awx/ui/static/js/widgets/JobStatus.js +++ b/awx/ui/static/js/widgets/JobStatus.js @@ -1,33 +1,99 @@ /********************************************* - * Copyright (c) 2014 AnsibleWorks, Inc. - * - * JobStatus.js - * - * Dashboard widget showing object counts and license availability. - * - */ +* Copyright (c) 2014 AnsibleWorks, Inc. +* +* JobStatus.js +* +* Dashboard widget showing object counts and license availability. +* +*/ 'use strict'; angular.module('JobStatusWidget', ['RestServices', 'Utilities']) - .factory('JobStatus', ['$rootScope', '$compile', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', function ($rootScope, $compile) { - return function (params) { - var scope = params.scope, - target = params.target, - html = '', element; + .factory('JobStatus', ['$rootScope', '$compile', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', + function ($rootScope, $compile) { + return function (params) { - html += "\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; - html += "
\n"; + var scope = params.scope, + target = params.target, + dashboard = params.dashboard, + html = '', element; + html = "
\n"; + html += "
Job Status
\n"; + html += "
\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; - }; - }]); \ No newline at end of file + function makeRow(params) { + var html = '', + label = params.label, + link = params.link, + fail_link = params.fail_link, + count = params.count, + fail = params.fail; + html += "\n"; + html += "\n"; + html += "\n"; + html += "\n"; + return html; + } + + html += makeRow({ + label: 'Jobs', + link: '/#/jobs', + count: (dashboard.jobs && dashboard.jobs.total) ? dashboard.jobs.total : 0, + fail: (dashboard.jobs && dashboard.jobs.failed) ? dashboard.jobs.failed : 0, + fail_link: '/#/jobs/?status=failed' + }); + html += makeRow({ + label: 'Inventories', + link: '/#/inventories', + count: (dashboard.inventories && dashboard.inventories.total) ? dashboard.inventories.total : 0, + fail: (dashboard.inventories && dashboard.inventories.job_failed) ? dashboard.inventories.job_failed : 0, + fail_link: '/#/inventories/?has_active_failures=true' + }); + html += makeRow({ + label: 'Groups', + link: '/#/home/groups', + count: (dashboard.groups && dashboard.groups.total) ? dashboard.groups.total : 0, + fail: (dashboard.groups && dashboard.groups.job_failed) ? dashboard.groups.job_failed : 0, + fail_link: '/#/home/groups/?has_active_failures=true' + }); + html += makeRow({ + label: 'Hosts', + link: '/#/home/hosts', + count: (dashboard.hosts && dashboard.hosts.total) ? dashboard.hosts.total : 0, + fail: (dashboard.hosts && dashboard.hosts.failed) ? dashboard.hosts.failed : 0, + fail_link: '/#/home/hosts/?has_active_failures=true' + }); + + html += "\n"; + html += "
FailedTotal
0) ? 'failed-column' : 'zero-column'; + html += " text-right\">"; + html += "" + fail + ""; + html += ""; + html += "" + count + ""; + html += "
\n"; + html += "
\n"; + html += "
\n"; + html += "\n"; + + element = angular.element(document.getElementById(target)); + element.html(html); + $compile(element)(scope); + scope.$emit('WidgetLoaded'); + + }; + } + ]); \ No newline at end of file diff --git a/awx/ui/templates/ui/index.html b/awx/ui/templates/ui/index.html index 6a539cfcc1..92af11bafe 100644 --- a/awx/ui/templates/ui/index.html +++ b/awx/ui/templates/ui/index.html @@ -164,9 +164,6 @@ - - - {% endif %}