mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
First smart status commit with new files
the smart status folder and main, controller, and directive
This commit is contained in:
parent
36a596b68f
commit
43dcd84fa7
@ -23,14 +23,30 @@ 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",
|
||||
iconOnly: true,
|
||||
excludeModal: true,
|
||||
smartStatus: [{
|
||||
icon: "{{ 'icon-cloud-' + inventory.syncStatus }}",
|
||||
awToolTip: "{{ inventory.syncTip }}",
|
||||
awTipPlacement: "top",
|
||||
ngClick: "showGroupSummary($event, inventory.id)",
|
||||
ngClass: "inventory.launch_class"
|
||||
}]
|
||||
},
|
||||
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'
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -116,7 +116,6 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
||||
});
|
||||
self.socket.on('error', function(reason) {
|
||||
var r = reason || 'connection refused by host';
|
||||
console.error(reason)
|
||||
$log.debug('Socket error: ' + r);
|
||||
$log.error('Socket error: ' + r);
|
||||
self.scope.$apply(function() {
|
||||
|
@ -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,
|
||||
|
2
awx/ui/static/js/smart-status/conversions.service.js
Normal file
2
awx/ui/static/js/smart-status/conversions.service.js
Normal file
@ -0,0 +1,2 @@
|
||||
export default function() {
|
||||
}
|
4
awx/ui/static/js/smart-status/main.js
Normal file
4
awx/ui/static/js/smart-status/main.js
Normal file
@ -0,0 +1,4 @@
|
||||
import smartStatusDirective from 'tower/smart-status/smart-status.directive.js';
|
||||
export default
|
||||
angular.module('systemStatus', [])
|
||||
.directive('awSmartStatus', smartStatusDirective);
|
35
awx/ui/static/js/smart-status/smart-status.controller.js
Normal file
35
awx/ui/static/js/smart-status/smart-status.controller.js
Normal file
@ -0,0 +1,35 @@
|
||||
export default ['$scope', function ($scope) {
|
||||
|
||||
var str = $scope.job_template.id+'_spark',
|
||||
recentJobs = $scope.job_template.summary_fields.recent_jobs;
|
||||
$scope[str] = {
|
||||
id: $scope.job_template.id,
|
||||
sparkArray: []
|
||||
};
|
||||
for(var i=0; i<recentJobs.length; i++){
|
||||
if(recentJobs[i].status==='successful'){
|
||||
$scope[str].sparkArray[i] = 1;
|
||||
}
|
||||
if(recentJobs[i].status==='failed'){
|
||||
$scope[str].sparkArray[i] = -1;
|
||||
}
|
||||
if(recentJobs[i].status==='queued'){
|
||||
$scope[str].sparkArray[i] = 0;
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
//
|
||||
//
|
||||
// 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*****
|
||||
// ]
|
||||
//
|
31
awx/ui/static/js/smart-status/smart-status.directive.js
Normal file
31
awx/ui/static/js/smart-status/smart-status.directive.js
Normal file
@ -0,0 +1,31 @@
|
||||
import smartStatusController from 'tower/smart-status/smart-status.controller.js';
|
||||
export default [ function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link: function (scope){ //}, element ){ //}, attr) {
|
||||
var str = scope.job_template.id+'_spark';
|
||||
// formatter: function(sparklines, options, point, recentJobs){
|
||||
// if(point.x <= options.mergedOptions.CurrentTimeGroup)
|
||||
// return "<div class=\"\"><span style=\"color: " + point.color + "\">●</span>" + options.get("tooltipValueLookups").names[point.x] + " - " + point.y + options.get("tooltipSuffix") + "</div>";
|
||||
// else
|
||||
// return "<div class=\"\"><span style=\"color: " + point.color + "\">●</span>" + options.get("tooltipValueLookups").names[point.x] + "</div>";
|
||||
// };
|
||||
|
||||
$('aw-smart-status:eq('+scope.$index+')').sparkline(scope[str].sparkArray, {
|
||||
type: 'tristate',
|
||||
// tooltipFormatter: scope[str].formatter,
|
||||
tooltipFormat: '{{value:levels}}',
|
||||
tooltipValueLookups: {
|
||||
levels: $.range_map({
|
||||
'1': 'Success',
|
||||
'-1': 'Failed',
|
||||
'0' : 'Queued'
|
||||
// '7:': 'High'
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
// templateUrl: 'static/js/smart-status/smart-status.partial.html',
|
||||
controller: smartStatusController
|
||||
};
|
||||
}];
|
1
awx/ui/static/js/smart-status/smart-status.partial.html
Normal file
1
awx/ui/static/js/smart-status/smart-status.partial.html
Normal file
@ -0,0 +1 @@
|
||||
<div>{{id}}: {{sparkArray}}</div>
|
@ -1,9 +0,0 @@
|
||||
import conversionService from './conversions.service'
|
||||
import smartStatusGraph from './smart-status.directive'
|
||||
import controller from './smart-status.controller'
|
||||
|
||||
export default
|
||||
angular.module('systemStatus', [])
|
||||
.service('conversions', conversionService)
|
||||
.directive('smartStatusGraph', smartStatusGraph)
|
||||
.controller('smartStatusLoad', controller);
|
24
awx/ui/static/lib/kapusta-jquery.sparkline/.bower.json
Normal file
24
awx/ui/static/lib/kapusta-jquery.sparkline/.bower.json
Normal 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"
|
||||
}
|
28
awx/ui/static/lib/kapusta-jquery.sparkline/README.md
Normal file
28
awx/ui/static/lib/kapusta-jquery.sparkline/README.md
Normal 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
|
6
awx/ui/static/lib/kapusta-jquery.sparkline/bower.json
Normal file
6
awx/ui/static/lib/kapusta-jquery.sparkline/bower.json
Normal 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"]
|
||||
}
|
3080
awx/ui/static/lib/kapusta-jquery.sparkline/dist/jquery.sparkline.js
vendored
Normal file
3080
awx/ui/static/lib/kapusta-jquery.sparkline/dist/jquery.sparkline.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
awx/ui/static/lib/kapusta-jquery.sparkline/dist/jquery.sparkline.min.js
vendored
Normal file
4
awx/ui/static/lib/kapusta-jquery.sparkline/dist/jquery.sparkline.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user