Merge branch 'smart-status' of https://github.com/jaredevantabor/ansible-tower into jaredevantabor-smart-status

Conflicts:
	awx/ui/static/js/controllers/Jobs.js
	awx/ui/static/js/shared/Socket.js
	awx/ui/static/less/ansible-ui.less
This commit is contained in:
John Mitchell 2015-03-10 13:59:08 -04:00
commit 3037bcb96a
13 changed files with 3263 additions and 5 deletions

View File

@ -234,7 +234,7 @@ export function JobsListController ($rootScope, $log, $scope, $compile, $routePa
page_row = Math.max($('.page-row:eq(0)').outerHeight(), 33);
header = Math.max($('#completed_jobs_table thead').height(), 24);
height = Math.floor(available_height / 2) - header - page_row - search_row - 30;
row_height = (docw < 1350) ? 47 : 44;
row_height = (docw < 1350) ? 47 : 44;
max_rows = Math.floor(height / row_height);
max_rows = (max_rows < 5) ? 5 : max_rows;
}

View File

@ -23,14 +23,22 @@ export default
hover: true,
fields: {
smart_status: {
label: 'Status',
columnClass: 'col-md-2 col-sm-2 col-xs-2',
searchable: false,
nosort: true,
ngClick: "null",
smartStatus: true
},
name: {
key: true,
label: 'Name',
columnClass: 'col-lg-5 col-md-5 col-sm-9 col-xs-8'
// 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'
// columnClass: 'col-lg-4 col-md-3 hidden-sm hidden-xs'
}
},

View File

@ -124,7 +124,6 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
});
self.socket.on('error', function(reason) {
var r = reason || 'connection refused by host';
$log.debug('Socket error: ' + r);
$log.error('Socket error: ' + r);
self.scope.$apply(function() {

View File

@ -10,10 +10,11 @@
* Functions shared between FormGenerator and ListGenerator
*
*/
import systemStatus from 'tower/smart-status/main';
export default
angular.module('GeneratorHelpers', [])
angular.module('GeneratorHelpers', [systemStatus.name])
.factory('Attr', function () {
return function (obj, key, fld) {
@ -630,6 +631,9 @@ angular.module('GeneratorHelpers', [])
}) + ' ';
});
}
else if(field.smartStatus){
html += '<aw-smart-status></aw-smart-status>';
}
else {
html += BuildLink({
list: list,

View File

@ -0,0 +1,4 @@
import smartStatusDirective from 'tower/smart-status/smart-status.directive.js';
export default
angular.module('systemStatus', [])
.directive('awSmartStatus', smartStatusDirective);

View File

@ -0,0 +1,39 @@
export default ['$scope', function ($scope) {
var str = $scope.job_template.id+'_smart',
recentJobs = $scope.job_template.summary_fields.recent_jobs;
$scope[str] = {
id: $scope.job_template.id,
sparkArray: [],
jobIds: {},
smartStatus: []
};
for(var i=0; i<recentJobs.length; i++){
if(recentJobs[i].status==='successful'){
$scope[str].sparkArray[i] = 1;
}
if(recentJobs[i].status==='failed' || recentJobs[i].status==='error' || recentJobs[i].status==='canceled'){
$scope[str].sparkArray[i] = -1;
}
if(recentJobs[i].status==='queued' || recentJobs[i].status==='new' || recentJobs[i].status==='pending' || recentJobs[i].status==='waiting' || recentJobs[i].status==='running'){
$scope[str].sparkArray[i] = 0;
}
$scope[str].jobIds[i] = recentJobs[i].id;
$scope[str].smartStatus[i] = recentJobs[i].status;
}
}];
//
//
// JOB_STATUS_CHOICES = [
// ('new', _('New')), # Job has been created, but not started.
// ('pending', _('Pending')), # Job has been queued, but is not yet running.
// ('waiting', _('Waiting')), # Job is waiting on an update/dependency.
// ('running', _('Running')), # Job is currently running.
// ('successful', _('Successful')), # Job completed successfully.
// ('failed', _('Failed')), # Job completed, but with failures.
// ('error', _('Error')), # The job was unable to run.
// ('canceled', _('Canceled')), # The job was canceled before completion.
// final states only*****
// ]
//

View File

@ -0,0 +1,45 @@
import smartStatusController from 'tower/smart-status/smart-status.controller.js';
export default [ function() {
return {
restrict: 'E',
link: function (scope){
var str = scope.job_template.id+'_smart';
scope[str].formatter = function(sparklines, options, point){
var status = options.userOptions.tooltipValueLookups.status[point.offset];
//capitalize first letter
status = status.charAt(0).toUpperCase() + status.slice(1);
return "<div class=\"smart-status-tooltip\">Job ID: " +
options.userOptions.tooltipValueLookups.jobs[point.offset] +
"<br>Status: <span style=\"color: " + point.color + "\">&#9679;</span>"+status+"</div>" ;
};
$('aw-smart-status:eq('+scope.$index+')').sparkline(scope[str].sparkArray, {
type: 'tristate',
width: '4em',
height: '2em',
barWidth: 7,
barSpacing: 2,
zeroBarColor: 'grey',
posBarColor: '#00aa00',
negBarColor: '#aa0000',
tooltipFormatter: scope[str].formatter,
tooltipFormat: '{{value:jobs}}',
tooltipValueLookups: {
jobs: scope[str].jobIds,
status: scope[str].smartStatus
}
});
$('aw-smart-status:eq('+scope.$index+')').bind('sparklineClick', function(ev) {
var sparkline = ev.sparklines[0],
job = sparkline.getCurrentRegionFields(),
id;
id = sparkline.options.userOptions.tooltipValueLookups.jobs[job.offset];
location.href = '/#/jobs/' + id;
});
},
controller: smartStatusController
};
}];

View File

@ -185,6 +185,22 @@ a:focus {
}
}
.jqstooltip{
background-color: black !important;
border-radius:4px;
border: 1px solid black;
}
.smart-status-tooltip{
font-size: 12px;
font-family: 'Open Sans';
background-color: black;
border-radius:4px;
span {
padding: 3px;
}
}
#configure-schedules-tab {
position: relative;
top: 0;
@ -1872,6 +1888,7 @@ tr td button i {
}
/* Landscape phone to portrait tablet */
@media (max-width: 767px) {

View File

@ -0,0 +1,24 @@
{
"name": "kapusta-jquery.sparkline",
"version": "2.1.3",
"main": "dist/jquery.sparkline.min.js",
"ignore": [
"Changelog.txt",
"Gruntfile.js",
"package.json",
".gitignore",
"bower.json",
"package.json",
"src"
],
"homepage": "https://github.com/kapusta/jquery.sparkline",
"_release": "2.1.3",
"_resolution": {
"type": "version",
"tag": "2.1.3",
"commit": "1d1d6a7db64b36e342141a4a5db73390fc8baf2f"
},
"_source": "git://github.com/kapusta/jquery.sparkline.git",
"_target": "^2.1.3",
"_originalSource": "kapusta-jquery.sparkline"
}

View File

@ -0,0 +1,28 @@
jQuery Sparklines
=================
This jQuery plugin makes it easy to generate a number of different types
of sparklines directly in the browser, using online a line of two of HTML
and Javascript.
The plugin has no dependencies other than jQuery and works with all modern
browsers and also Internet Explorer 6 and later (excanvas is not required
for IE support).
See the [jQuery Sparkline project page](http://omnipotent.net/jquery.sparkline/)
for live examples and documentation.
## License
Released under the New BSD License
(c) Splunk, Inc 2012
## About this fork
* The intent of this fork is to build the Javascript files with Grunt 0.4 and to check the built files into the repo.
* The min file is minified using [UglifyJS](https://github.com/mishoo/UglifyJS) with default settings.
* Checking in built files is [not what the original author wants](https://github.com/gwatts/jquery.sparkline/pull/77) in his repo.
* So why does this fork do that? Well, the built files will then be available to developers who use jquery.sparkline and use Bower for dependency management and Grunt to pluck the files they need in their project. This lets the developer avoid having to run Grunt in dependency directories (eg, node_modules) before running their own builds.
* In order to allow for tag level targeting via Bower, new tags will be made, starting at 2.1.3

View File

@ -0,0 +1,6 @@
{
"name": "kapusta-jquery.sparkline",
"version": "2.1.3",
"main": "dist/jquery.sparkline.min.js",
"ignore": ["Changelog.txt", "Gruntfile.js", "package.json", ".gitignore", "bower.json", "package.json", "src"]
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long