mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Dashboard
Removed includes for old widgets. Reverted JobStatus widget back. Added new job status code to the new job status widget.
This commit is contained in:
parent
1e00529fac
commit
d46aa1c4de
@ -77,10 +77,6 @@ angular.module('Tower', [
|
||||
'DashboardCountsWidget',
|
||||
'DashboardChartsWidget',
|
||||
'DashboardJobsWidget',
|
||||
'JobStatusWidget',
|
||||
'InventorySyncStatusWidget',
|
||||
'SCMSyncStatusWidget',
|
||||
'ObjectCountWidget',
|
||||
'StreamWidget',
|
||||
'JobsHelper',
|
||||
'InventoryGroupsHelpDefinition',
|
||||
|
@ -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 += "<ul id=\"job_status_tabs\" class=\"nav nav-tabs\">\n";
|
||||
html += "<li class=\"active\"><a id=\"active_jobs_link\" ng-click=\"toggleTab($event, 'active_jobs_link', 'job_status_tabs')\"\n";
|
||||
html += " href=\"#active-jobs-tab\" data-toggle=\"tab\">Jobs</a></li>\n";
|
||||
html += "<li><a id=\"scheduled_jobs_link\" ng-click=\"toggleTab($event, 'scheduled_jobs_link', 'job_status_tabs')\"\n";
|
||||
html += "href=\"#scheduled-jobs-tab\" data-toggle=\"tab\">Schedule</a></li>\n";
|
||||
html += "</ul>\n";
|
||||
html += "<div class=\"tab-content\">\n";
|
||||
html += "<div class=\"tab-pane active\" id=\"active-jobs-tab\"></div>\n";
|
||||
html += "<div class=\"tab-pane\" id=\"scheduled-jobs-tab\"></div>\n";
|
||||
html += "</div>\n";
|
||||
|
||||
html = "<div class=\"panel panel-default\" style=\"border:none\">\n";
|
||||
html += "<div class=\"panel-body \">\n";
|
||||
e = angular.element(document.getElementById(target));
|
||||
e.html(html);
|
||||
$compile(e)(scope);
|
||||
scope.$emit('WidgetLoaded');
|
||||
|
||||
html += "<table class=\"table table-bordered\">\n";
|
||||
html += "<tr>\n";
|
||||
html += "<td class=\"h5 col-lg-6 text-center\">Active Jobs</td>\n";
|
||||
html += "</tr>\n";
|
||||
html += "<tr>\n";
|
||||
html += "<td class=\"col-lg-8\">\n";
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
//html code from Jobs page's partial:
|
||||
html += "<div class=\"col-md-6 right-side\">\n";
|
||||
html += "<div class=\"jobs-list-container\">\n";
|
||||
html += "<div class=\"row search-row\">\n";
|
||||
html += "<div class=\"col-md-6\"><div class=\"title\">Active</div></div>\n";
|
||||
html += "<div class=\"col-md-6\" id=\"active-jobs-search-container\"></div>\n";
|
||||
html += "</div>\n";
|
||||
html += "<div class=\"job-list\" id=\"active-jobs-container\">\n";
|
||||
html += "<div id=\"active-jobs\" class=\"job-list-target\"></div>\n";
|
||||
html += "</div>\n";
|
||||
html += "</div>\n";
|
||||
html += "</div>\n";
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
html += "</td>\n";
|
||||
html += "</tr>\n";
|
||||
html += "</table>\n";
|
||||
|
||||
html += "</div>\n";
|
||||
html += "</div>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
element = angular.element(document.getElementById(target));
|
||||
element.html(html);
|
||||
$compile(element)(scope);
|
||||
scope.$emit('WidgetLoaded');
|
||||
|
||||
};
|
||||
}
|
||||
]);
|
||||
};
|
||||
}]);
|
@ -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 += "<ul id=\"job_status_tabs\" class=\"nav nav-tabs\">\n";
|
||||
html += "<li class=\"active\"><a id=\"active_jobs_link\" ng-click=\"toggleTab($event, 'active_jobs_link', 'job_status_tabs')\"\n";
|
||||
html += " href=\"#active-jobs-tab\" data-toggle=\"tab\">Jobs</a></li>\n";
|
||||
html += "<li><a id=\"scheduled_jobs_link\" ng-click=\"toggleTab($event, 'scheduled_jobs_link', 'job_status_tabs')\"\n";
|
||||
html += "href=\"#scheduled-jobs-tab\" data-toggle=\"tab\">Schedule</a></li>\n";
|
||||
html += "</ul>\n";
|
||||
html += "<div class=\"tab-content\">\n";
|
||||
html += "<div class=\"tab-pane active\" id=\"active-jobs-tab\"></div>\n";
|
||||
html += "<div class=\"tab-pane\" id=\"scheduled-jobs-tab\"></div>\n";
|
||||
html += "<div class=\"tab-pane\" id=\"schedules-tab\"></div>\n";
|
||||
html += "</div>\n";
|
||||
var scope = params.scope,
|
||||
target = params.target,
|
||||
dashboard = params.dashboard,
|
||||
html = '', element;
|
||||
|
||||
html = "<div class=\"panel panel-default\">\n";
|
||||
html += "<div class=\"panel-heading\">Job Status</div>\n";
|
||||
html += "<div class=\"panel-body\">\n";
|
||||
html += "<table class=\"table table-condensed table-hover\">\n";
|
||||
html += "<thead>\n";
|
||||
html += "<tr>\n";
|
||||
html += "<th class=\"col-md-4 col-lg-3\"></th>\n";
|
||||
html += "<th class=\"col-md-2 col-lg-1 text-right\">Failed</th>\n";
|
||||
html += "<th class=\"col-md-2 col-lg-1 text-right\">Total</th>\n";
|
||||
html += "</tr>\n";
|
||||
html += "</thead>\n";
|
||||
html += "<tbody>\n";
|
||||
|
||||
};
|
||||
}]);
|
||||
function makeRow(params) {
|
||||
var html = '',
|
||||
label = params.label,
|
||||
link = params.link,
|
||||
fail_link = params.fail_link,
|
||||
count = params.count,
|
||||
fail = params.fail;
|
||||
html += "<tr>\n";
|
||||
html += "<td><a href=\"" + link + "\"";
|
||||
html += (label === 'Hosts' || label === 'Groups') ? " class=\"pad-left-sm\" " : "";
|
||||
html += ">" + label + "</a></td>\n";
|
||||
html += "<td class=\"";
|
||||
html += (fail > 0) ? 'failed-column' : 'zero-column';
|
||||
html += " text-right\">";
|
||||
html += "<a href=\"" + fail_link + "\">" + fail + "</a>";
|
||||
html += "</td>\n";
|
||||
html += "<td class=\"text-right\">";
|
||||
html += "<a href=\"" + link + "\" >" + count + "</a>";
|
||||
html += "</td></tr>\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 += "</tbody>\n";
|
||||
html += "</table>\n";
|
||||
html += "</div>\n";
|
||||
html += "</div>\n";
|
||||
html += "</div>\n";
|
||||
|
||||
element = angular.element(document.getElementById(target));
|
||||
element.html(html);
|
||||
$compile(element)(scope);
|
||||
scope.$emit('WidgetLoaded');
|
||||
|
||||
};
|
||||
}
|
||||
]);
|
@ -164,9 +164,6 @@
|
||||
<script src="{{ STATIC_URL }}js/widgets/DashboardCounts.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/DashboardCharts.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/DashboardJobs.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/InventorySyncStatus.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/SCMSyncStatus.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/ObjectCount.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/widgets/Stream.js"></script>
|
||||
<script src="{{ STATIC_URL }}js/help/InventoryGroups.js"></script>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user