From d849cec243648e2336e501f19cf824c02940abb2 Mon Sep 17 00:00:00 2001 From: jaredevantabor Date: Thu, 17 Nov 2016 12:32:17 -0800 Subject: [PATCH] removing prettyfyLite function for a flag in prettyify --- .../host-event/host-event-timing.partial.html | 1 - .../host-event/host-event.controller.js | 2 +- .../src/job-results/parse-stdout.service.js | 81 +++++++++---------- 3 files changed, 37 insertions(+), 47 deletions(-) delete mode 100644 awx/ui/client/src/job-results/host-event/host-event-timing.partial.html diff --git a/awx/ui/client/src/job-results/host-event/host-event-timing.partial.html b/awx/ui/client/src/job-results/host-event/host-event-timing.partial.html deleted file mode 100644 index 06171bd1c5..0000000000 --- a/awx/ui/client/src/job-results/host-event/host-event-timing.partial.html +++ /dev/null @@ -1 +0,0 @@ -
timing
\ No newline at end of file diff --git a/awx/ui/client/src/job-results/host-event/host-event.controller.js b/awx/ui/client/src/job-results/host-event/host-event.controller.js index e7bbdc00e3..fcb0f62f73 100644 --- a/awx/ui/client/src/job-results/host-event/host-event.controller.js +++ b/awx/ui/client/src/job-results/host-event/host-event.controller.js @@ -51,7 +51,7 @@ // grab standard out & standard error if present, and remove from the results displayed in the details panel if (hostEvent.stdout){ - $scope.stdout = parseStdoutService.prettifyLite(hostEvent.stdout); + $scope.stdout = parseStdoutService.prettify(hostEvent.stdout, "unstyled"); delete $scope.event.stdout; } if (hostEvent.stderr){ diff --git a/awx/ui/client/src/job-results/parse-stdout.service.js b/awx/ui/client/src/job-results/parse-stdout.service.js index 09eb79f893..efba9f1854 100644 --- a/awx/ui/client/src/job-results/parse-stdout.service.js +++ b/awx/ui/client/src/job-results/parse-stdout.service.js @@ -8,65 +8,56 @@ export default ['$log', function($log){ var val = { // parses stdout string from api and formats various codes to the // correct dom structure - prettify: function(line){ + prettify: function(line, unstyled){ // TODO: remove once Chris's fixes to the [K lines comes in if (line.indexOf("[K") > -1) { $log.error(line); } + if(!unstyled){ + // add span tags with color styling + line = line.replace(/u001b/g, ''); - line = line.replace(/u001b/g, ''); + // ansi classes + line = line.replace(/\[1;31m/g, ''); + line = line.replace(/\[0;31m/g, ''); + line = line.replace(/\[0;32m/g, ''); + line = line.replace(/\[0;32m=/g, ''); + line = line.replace(/\[0;32m1/g, ''); + line = line.replace(/\[0;33m/g, ''); + line = line.replace(/\[0;34m/g, ''); + line = line.replace(/\[0;35m/g, ''); + line = line.replace(/\[0;36m/g, ''); + line = line.replace(/()\s/g, '$1'); - // ansi classes - line = line.replace(/\[1;31m/g, ''); - line = line.replace(/\[0;31m/g, ''); - line = line.replace(/\[0;32m/g, ''); - line = line.replace(/\[0;32m=/g, ''); - line = line.replace(/\[0;32m1/g, ''); - line = line.replace(/\[0;33m/g, ''); - line = line.replace(/\[0;34m/g, ''); - line = line.replace(/\[0;35m/g, ''); - line = line.replace(/\[0;36m/g, ''); - line = line.replace(/()\s/g, '$1'); - - //end span - line = line.replace(/\[0m/g, ''); - return line; - }, - prettifyLite: function(line){ - // this function will return a line of stdout without the - // tags styling the output. This isn't needed in the case - // of the host event modal where stdout is displayed in a CodeMirror - - - // TODO: remove once Chris's fixes to the [K lines comes in - if (line.indexOf("[K") > -1) { - $log.error(line); + //end span + line = line.replace(/\[0m/g, ''); } + else { + // For the host event modal in the standard out tab, + // the styling isn't necessary + line = line.replace(/u001b/g, ''); - line = line.replace(/u001b/g, ''); + // ansi classes + line = line.replace(/\[1;31m/g, ''); + line = line.replace(/\[0;31m/g, ''); + line = line.replace(/\[0;32m/g, ''); + line = line.replace(/\[0;32m=/g, ''); + line = line.replace(/\[0;32m1/g, ''); + line = line.replace(/\[0;33m/g, ''); + line = line.replace(/\[0;34m/g, ''); + line = line.replace(/\[0;35m/g, ''); + line = line.replace(/\[0;36m/g, ''); + line = line.replace(/()\s/g, '$1'); - // ansi classes - line = line.replace(/\[1;31m/g, ''); - line = line.replace(/\[0;31m/g, ''); - line = line.replace(/\[0;32m/g, ''); - line = line.replace(/\[0;32m=/g, ''); - line = line.replace(/\[0;32m1/g, ''); - line = line.replace(/\[0;33m/g, ''); - line = line.replace(/\[0;34m/g, ''); - line = line.replace(/\[0;35m/g, ''); - line = line.replace(/\[0;36m/g, ''); - line = line.replace(/()\s/g, '$1'); - - //end span - line = line.replace(/\[0m/g, ''); - //TODO: figure out how to get rid of the hidden characters that - // show up in the codmirror as red dots + //end span + line = line.replace(/\[0m/g, ''); + } return line; }, // adds anchor tags and tooltips to host status lines getAnchorTags: function(event, line){ - if(event.event.indexOf("runner_") === -1){ + if(event.event_name.indexOf("runner_") === -1){ return line; } else{