From 4cf66b515940c2d86db4343eefc5166e4d6f0991 Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Tue, 17 Oct 2023 16:39:53 +0200 Subject: [PATCH] Support bugrefs in all text results (not just softfailures) * Render the result of all text results (not just softfailures) on the server via the `rendered_refs_no_shortening` helper that is also already used in `viewtext.html`. * Remove the condition ` && title !== 'Soft Failed'` so softfailures are no longer a special case; this way the existing test for softfailures will cover these code changes without extending tests --- assets/javascripts/render.js | 8 ++------ lib/OpenQA/WebAPI/Controller/Test.pm | 7 ++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/javascripts/render.js b/assets/javascripts/render.js index 6db1d6e4aec0..7df654d5badd 100644 --- a/assets/javascripts/render.js +++ b/assets/javascripts/render.js @@ -181,16 +181,12 @@ function renderModuleRow(module, snippets) { const content = step.title || E('i', [], {class: 'fa fa fa-question'}); box.push(E('span', [content], {class: 'resborder ' + resborder})); } - if (step.text && title !== 'Soft Failed') { + if (step.text) { const stepActions = E('span', [], {class: 'step_actions', style: 'float: right'}); stepActions.innerHTML = renderTemplate(snippets.bug_actions, {MODULE: module.name, STEP: step.num}); - const textresult = E('pre', [textData]); - var html = stepActions.outerHTML; - html += textresult.outerHTML; - const txt = escape(html); const link = E('a', box, { class: 'no_hover' + (title === 'wait_serial' ? ' serial-result-preview' : ''), - 'data-text': txt, + 'data-text': escape(stepActions.outerHTML + '
' + textData + '
'), title: title, href: href }); diff --git a/lib/OpenQA/WebAPI/Controller/Test.pm b/lib/OpenQA/WebAPI/Controller/Test.pm index 6e00ec746fb7..ba6e37fa4743 100644 --- a/lib/OpenQA/WebAPI/Controller/Test.pm +++ b/lib/OpenQA/WebAPI/Controller/Test.pm @@ -326,7 +326,12 @@ sub details ($self) { my @ret; for my $module (@{$modules->{modules}}) { - delete $_->{needles} for @{$module->{details}}; + for my $detail (@{$module->{details}}) { + if (my $text_data = $detail->{text_data}) { + $detail->{text_data} = $self->rendered_refs_no_shortening($text_data); + } + delete $detail->{needles}; + } my $hash = { name => $module->{name}, category => $module->{category},