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; break;
case 'id': case 'id':
case 'task': case 'task':
case 'play':
scope[fld] = data[fld]; scope[fld] = data[fld];
break; 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 'msg':
case 'stdout': case 'stdout':
case 'stderr': case 'stderr':
case 'start':
case 'end':
case 'delta': case 'delta':
case 'rc': case 'rc':
if (data['event_data'] && data['event_data']['res'] && data['event_data']['res'][fld] !== undefined) { 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, readonly: true,
section: 'Event' section: 'Event'
}, },
play: {
label: 'Play',
type: 'text',
readonly: true,
section: 'Event'
},
task: { task: {
label: 'Task', label: 'Task',
type: 'text', type: 'text',
@@ -119,22 +125,15 @@ angular.module('JobEventFormDefinition', [])
navigation: { navigation: {
back_top: { back_top: {
label: 'Back', label: 'Back',
position: 'top', position: ['top-left','top-right', 'bottom-left', 'bottom-right'],
'class': 'btn-small pull-right', 'class': 'btn-small',
icon: 'icon-arrow-left',
ngClick: 'navigateBack()'
},
back_bottom: {
label: 'Back',
position: 'bottom',
'class': 'btn-small pull-right',
icon: 'icon-arrow-left', icon: 'icon-arrow-left',
ngClick: 'navigateBack()' ngClick: 'navigateBack()'
}, },
raw_view: { raw_view: {
label: 'View raw JSON results', label: 'View raw JSON results',
icon: 'icon-zoom-in', icon: 'icon-zoom-in',
position: 'bottom', position: ['bottom-left'],
'class': 'btn-small', 'class': 'btn-small',
ngClick: 'rawView()' 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({ * SearchInit({
* scope: <scope>, * scope: <scope>,
* set: <model name (i.e. organizations), * set: <model name (i.e. organizations) used in ng-repeat>
* name was given in ng-repeat>
* url: <default api url used to load data> * url: <default api url used to load data>
* list: <list object used by ListGenerator> * list: <list object used by ListGenerator>
* }); * });

View File

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