Fixed <pre> block wrapping in tooltips for Firefox. Fixed missing output/error/returncode on events page- required use of angular sanitizer.

This commit is contained in:
Chris Houseknecht
2014-04-07 15:03:28 -04:00
parent 3876e06a8d
commit 1a7a4bad49
4 changed files with 27 additions and 9 deletions

View File

@@ -10,7 +10,7 @@
'use strict'; 'use strict';
function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobEventList, GenerateList, function JobEventsList($sce, $filter, $scope, $rootScope, $location, $log, $routeParams, Rest, Alert, JobEventList, GenerateList,
LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, LookUpInit, ToggleChildren, LoadBreadCrumbs, Prompt, SearchInit, PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath, LookUpInit, ToggleChildren,
FormatDate, EventView, Refresh, Wait) { FormatDate, EventView, Refresh, Wait) {
@@ -79,11 +79,11 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
rows = (n) ? n.length : 1; rows = (n) ? n.length : 1;
rows = (rows > 10) ? 10 : rows; rows = (rows > 10) ? 10 : rows;
html += "<textarea readonly class=\"form-control nowrap\" rows=\"" + rows + "\">" + eventData.res[fld] + "</textarea>\n"; html += "<textarea readonly class=\"form-control nowrap\" rows=\"" + rows + "\">" + eventData.res[fld] + "</textarea>\n";
//html += "<pre>" + eventData.res[fld] + "</pre>\n";
html += "</div>\n"; html += "</div>\n";
found = true; found = true;
} }
if (fld === "results" && Array.isArray(eventData.res[fld]) && eventData.res[fld].length > 0) { if (fld === "results" && Array.isArray(eventData.res[fld]) && eventData.res[fld].length > 0) {
//html += "<textarea readonly class="
txt = ''; txt = '';
for (i = 0; i < eventData.res[fld].length; i++) { for (i = 0; i < eventData.res[fld].length; i++) {
txt += eventData.res[fld][i]; txt += eventData.res[fld][i];
@@ -95,14 +95,16 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
html += "<div class=\"form-group\">\n"; html += "<div class=\"form-group\">\n";
html += "<label>Results:</label>\n"; html += "<label>Results:</label>\n";
html += "<textarea readonly class=\"form-control nowrap mono-space\" rows=\"" + rows + "\">" + txt + "</textarea>\n"; html += "<textarea readonly class=\"form-control nowrap mono-space\" rows=\"" + rows + "\">" + txt + "</textarea>\n";
//html += "<pre>" + txt + "</pre>\n";
html += "</div>\n"; html += "</div>\n";
found = true; found = true;
} }
} }
if (fld === "rc" && eventData.res[fld] !== '') { if (fld === "rc" && eventData.res[fld] !== '') {
html += "<div class=\"form-group\">\n"; html += "<div class=\"form-group\">\n";
html += "<label>Return Code:</label>\n"; html += "<label>Return Code:</label><div class=\"return-code\">" + eventData.res[fld] + "</div>\n";
html += "<input type=\"text\" class=\"form-control nowrap mono-space\" value=\"" + eventData.res[fld] + "\" readonly >\n"; //html += "<input type=\"text\" class=\"form-control nowrap mono-space\" value=\"" + eventData.res[fld] + "\" readonly >\n";
html += "</div>\n"; html += "</div>\n";
found = true; found = true;
} }
@@ -123,7 +125,9 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
} }
$scope.removePostRefresh = $scope.$on('PostRefresh', function () { $scope.removePostRefresh = $scope.$on('PostRefresh', function () {
// Initialize the parent levels // Initialize the parent levels
generator.inject(list, { mode: 'edit', scope: $scope }); generator.inject(list, { mode: 'edit', scope: $scope });
var set = $scope[list.name], i; var set = $scope[list.name], i;
for (i = 0; i < set.length; i++) { for (i = 0; i < set.length; i++) {
set[i].event_display = set[i].event_display.replace(/^\u00a0*/g, ''); set[i].event_display = set[i].event_display.replace(/^\u00a0*/g, '');
@@ -133,7 +137,7 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
} else { } else {
set[i].ngicon = 'fa fa-square-o node-no-toggle'; set[i].ngicon = 'fa fa-square-o node-no-toggle';
set[i]['class'] = 'childNode'; set[i]['class'] = 'childNode';
set[i].event_detail = formatJSON(set[i].event_data); set[i].event_detail = $sce.trustAsHtml(formatJSON(set[i].event_data));
} }
set[i].show = true; set[i].show = true;
set[i].spaces = set[i].event_level * 24; set[i].spaces = set[i].event_level * 24;
@@ -247,7 +251,7 @@ function JobEventsList($filter, $scope, $rootScope, $location, $log, $routeParam
}; };
} }
JobEventsList.$inject = ['$filter', '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList', JobEventsList.$inject = ['$sce', '$filter', '$scope', '$rootScope', '$location', '$log', '$routeParams', 'Rest', 'Alert', 'JobEventList',
'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors', 'GenerateList', 'LoadBreadCrumbs', 'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
'GetBasePath', 'LookUpInit', 'ToggleChildren', 'FormatDate', 'EventView', 'Refresh', 'Wait' 'GetBasePath', 'LookUpInit', 'ToggleChildren', 'FormatDate', 'EventView', 'Refresh', 'Wait'
]; ];

View File

@@ -70,7 +70,7 @@ angular.module('JobEventsFormDefinition', [])
rows: 10 rows: 10
}, },
stdout: { stdout: {
label: 'Std Out', label: 'Standard Out',
type: 'textarea', type: 'textarea',
readonly: true, readonly: true,
section: 'Results', section: 'Results',
@@ -79,7 +79,7 @@ angular.module('JobEventsFormDefinition', [])
rows: 10 rows: 10
}, },
stderr: { stderr: {
label: 'Std Err', label: 'Standard Err',
type: 'textarea', type: 'textarea',
readonly: true, readonly: true,
section: 'Results', section: 'Results',

View File

@@ -236,6 +236,9 @@ textarea.allowresize {
min-width: 200px; min-width: 200px;
max-width: 325px; max-width: 325px;
} }
.popover pre {
white-space: pre-wrap;
}
.popover-footer { .popover-footer {
font-size: 12px; font-size: 12px;
margin-top: 10px; margin-top: 10px;
@@ -1065,6 +1068,17 @@ input[type="checkbox"].checkbox-no-label {
font-size: 13px; font-size: 13px;
} }
#jobevents_table {
div.return-code {
display: inline-block;
margin-left: 10px;
}
textarea {
white-space: pre-wrap;
resize: vertical;
}
}
/* Inventory job status badge */ /* Inventory job status badge */
.failures-true { .failures-true {
background-color: @red; background-color: @red;

View File

@@ -630,7 +630,7 @@ angular.module('GeneratorHelpers', [])
// Specific to Job Events page -showing event detail/results // Specific to Job Events page -showing event detail/results
html += (field.appendHTML) ? "<div ng-show=\"" + field.appendHTML + " !== null\" " + html += (field.appendHTML) ? "<div ng-show=\"" + field.appendHTML + " !== null\" " +
"ng-bind-html-unsafe=\"" + field.appendHTML + "\" " + "ng-bind-html=\"" + field.appendHTML + "\" " +
"class=\"level-{{ " + list.iterator + ".event_level }}-detail\" " + "class=\"level-{{ " + list.iterator + ".event_level }}-detail\" " +
"></div>\n" : ""; "></div>\n" : "";