1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

AC-216 Added 'back' navigation button to each corner of page.

This commit is contained in:
chouseknecht 2013-07-16 23:25:25 -04:00
parent 79657fc80b
commit 4923fd84c1
5 changed files with 38 additions and 127 deletions

View File

@ -227,13 +227,19 @@ function JobEventsEdit ($scope, $rootScope, $compile, $location, $log, $routePar
break;
case 'id':
case 'task':
case 'play':
scope[fld] = data[fld];
break;
case 'start':
case 'end':
if (data['event_data'] && data['event_data']['res'] && data['event_data']['res'][fld] !== undefined) {
var cDate = new Date(data['event_data']['res'][fld]);
scope[fld] = FormatDate(cDate);
}
break;
case 'msg':
case 'stdout':
case 'stderr':
case 'start':
case 'end':
case 'delta':
case 'rc':
if (data['event_data'] && data['event_data']['res'] && data['event_data']['res'][fld] !== undefined) {

View File

@ -41,6 +41,12 @@ angular.module('JobEventFormDefinition', [])
readonly: true,
section: 'Event'
},
play: {
label: 'Play',
type: 'text',
readonly: true,
section: 'Event'
},
task: {
label: 'Task',
type: 'text',
@ -119,22 +125,15 @@ angular.module('JobEventFormDefinition', [])
navigation: {
back_top: {
label: 'Back',
position: 'top',
'class': 'btn-small pull-right',
icon: 'icon-arrow-left',
ngClick: 'navigateBack()'
},
back_bottom: {
label: 'Back',
position: 'bottom',
'class': 'btn-small pull-right',
position: ['top-left','top-right', 'bottom-left', 'bottom-right'],
'class': 'btn-small',
icon: 'icon-arrow-left',
ngClick: 'navigateBack()'
},
raw_view: {
label: 'View raw JSON results',
icon: 'icon-zoom-in',
position: 'bottom',
position: ['bottom-left'],
'class': 'btn-small',
ngClick: 'rawView()'
}

View File

@ -1,100 +0,0 @@
/*********************************************
* Copyright (c) 2013 AnsibleWorks, Inc.
*
* JobEvents.js
* Form definition for Job Events model
*
* @dict
*/
angular.module('JobEventFormDefinition', [])
.value(
'JobEventForm', {
editTitle: '{{ name }} Events', //Legend in edit mode
name: 'job_events',
well: true,
fieldsAsHeader: true,
fields: {
job: {
label: 'Job',
type: 'text',
class: 'span1',
readonly: true
},
job_name: {
type: 'text',
sourceModel: 'job',
sourceField: 'name',
class: 'span5',
readonly: true
},
job_description: {
type: 'text',
sourceModel: 'job',
sourceField: 'description',
class: 'span5',
readonly: true
}
},
buttons: {
},
items: {
event: {
set: 'job_events',
iterator: 'job_event',
label: 'Event',
fields: {
id: {
label: 'Event ID',
type: 'text',
readonly: true,
class: 'span2',
key: true,
searchType: 'int'
},
created: {
label: 'Event Timestamp',
type: 'text',
readonly: true,
class: 'span4'
},
event: {
label: 'Event',
type: 'text',
readonly: true
},
host: {
label: 'Host',
type: 'text',
readonly: true
},
event_status: {
label: 'Event Status',
type: 'text',
class: 'job-\{\{ event_status \}\}',
readonly: true,
searchField: 'failed',
searchType: 'boolean',
searchOptions: [{ name: "success", value: 0 }, { name: "failed", value: 1 }],
},
event_data: {
label: 'Event Data',
type: 'textarea',
class: 'span12',
rows: 10,
readonly: true
}
}
}
},
related: { //related colletions (and maybe items?)
}
}); //Form

View File

@ -8,8 +8,7 @@
*
* SearchInit({
* scope: <scope>,
* set: <model name (i.e. organizations),
* name was given in ng-repeat>
* set: <model name (i.e. organizations) used in ng-repeat>
* url: <default api url used to load data>
* list: <list object used by ListGenerator>
* });

View File

@ -181,18 +181,25 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
return html;
},
button: function(btn) {
button: function(btn, topOrBottom) {
// pass in a button object and get back an html string containing
// a <button> element.
var html = '';
html += "<button ";
html += "class=\"btn";
html += (btn['class']) ? " " + btn['class'] : "";
html += "\" ";
html += (btn.ngClick) ? this.attr(btn, 'ngClick') : "";
html += ">" + this.attr(btn, 'icon');
html += " " + btn.label;
html += "</button>\n";
for (var i=0; i < btn.position.length; i++) {
if (btn.position[i].indexOf(topOrBottom) >= 0) {
html += "<button ";
html += "class=\"btn";
html += (btn['class']) ? " " + btn['class'] : "";
if (btn.position[i] == 'top-right' || btn.position[i] == 'bottom-right') {
html += " " + "pull-right";
}
html += "\" ";
html += (btn.ngClick) ? this.attr(btn, 'ngClick') : "";
html += ">" + this.attr(btn, 'icon');
html += " " + btn.label;
html += "</button>\n";
}
}
return html;
},
@ -608,8 +615,8 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
html += "<div class=\"navigation-buttons navigation-buttons-top\">\n";
for (btn in this.form.navigation) {
var btn = this.form.navigation[btn];
if (btn.position == 'top') {
html += this.button(btn);
if ( btn.position.indexOf('top-left') >= 0 || btn.position.indexOf('top-right') >= 0 ) {
html += this.button(btn, 'top');
}
}
html += "</div>\n";
@ -722,8 +729,8 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
html += "<div class=\"navigation-buttons navigation-buttons-bottom\">\n";
for (btn in this.form.navigation) {
var btn = this.form.navigation[btn];
if (btn.position == 'bottom') {
html += this.button(btn);
if ( btn.position.indexOf('bottom-left') >= 0 || btn.position.indexOf('bottom-right') >= 0 ) {
html += this.button(btn, 'bottom');
}
}
html += "</div>\n";