From cddceb0e060e6b5b3ea29e2ba8fb3503bef84e1e Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Wed, 29 Aug 2018 13:20:28 -0400 Subject: [PATCH] add basic colormap for output lines --- awx/ui/client/features/output/constants.js | 18 ++++++++++++++++++ .../client/features/output/render.service.js | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/features/output/constants.js b/awx/ui/client/features/output/constants.js index 4e80e1d7bb..e8880587b1 100644 --- a/awx/ui/client/features/output/constants.js +++ b/awx/ui/client/features/output/constants.js @@ -13,6 +13,24 @@ export const JOB_STATUS_INCOMPLETE = ['canceled', 'error']; export const JOB_STATUS_UNSUCCESSFUL = ['failed'].concat(JOB_STATUS_INCOMPLETE); export const JOB_STATUS_FINISHED = JOB_STATUS_COMPLETE.concat(JOB_STATUS_INCOMPLETE); +export const OUTPUT_ANSI_COLORMAP = { + 0: '#000', + 1: '#A00', + 2: '#0A0', + 3: '#F0AD4E', + 4: '#00A', + 5: '#A0A', + 6: '#0AA', + 7: '#AAA', + 8: '#555', + 9: '#F55', + 10: '#5F5', + 11: '#FF5', + 12: '#55F', + 13: '#F5F', + 14: '#5FF', + 15: '#FFF' +}; export const OUTPUT_ELEMENT_CONTAINER = '.at-Stdout-container'; export const OUTPUT_ELEMENT_TBODY = '#atStdoutResultTable'; export const OUTPUT_ELEMENT_LAST = '#atStdoutMenuLast'; diff --git a/awx/ui/client/features/output/render.service.js b/awx/ui/client/features/output/render.service.js index 7f297955fc..275704b781 100644 --- a/awx/ui/client/features/output/render.service.js +++ b/awx/ui/client/features/output/render.service.js @@ -5,6 +5,7 @@ import { EVENT_START_PLAY, EVENT_STATS_PLAY, EVENT_START_TASK, + OUTPUT_ANSI_COLORMAP, OUTPUT_ELEMENT_TBODY, OUTPUT_EVENT_LIMIT, } from './constants'; @@ -20,7 +21,7 @@ const TIME_EVENTS = [ EVENT_STATS_PLAY, ]; -const ansi = new Ansi(); +const ansi = new Ansi({ stream: true, colors: OUTPUT_ANSI_COLORMAP }); const entities = new Entities.AllHtmlEntities(); // https://github.com/chalk/ansi-regex