Skip to content

Commit

Permalink
Merge pull request #5374 from cfconrad/pr_JOB_DESCRIPTION_in_markdown
Browse files Browse the repository at this point in the history
infopanel: render scenario_description as markdown
  • Loading branch information
mergify[bot] authored Nov 28, 2023
2 parents 872b397 + d411e9c commit 9b4e6c6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/OpenQA/Schema/Result/Jobs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use OpenQA::Utils (
use OpenQA::App;
use OpenQA::Jobs::Constants;
use OpenQA::JobDependencies::Constants;
use OpenQA::Markdown 'markdown_to_html';
use OpenQA::Setup;
use OpenQA::ScreenshotDeletion;
use File::Basename qw(basename dirname);
Expand Down Expand Up @@ -315,6 +316,11 @@ sub scenario_description ($self) {
return $scenario->description;
}

sub rendered_scenario_description ($self) {
return undef unless my $desc = $self->scenario_description;
return Mojo::ByteStream->new(markdown_to_html($desc));
}

# return 0 if we have no worker
sub worker_id ($self) { $self->worker ? $self->worker->id : 0 }

Expand Down
2 changes: 1 addition & 1 deletion templates/webapi/test/infopanel.html.ep
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
</span>
</div>
% }
% if (my $scenario_description = $job->scenario_description) {
% if (my $scenario_description = $job->rendered_scenario_description) {
<div id="scenario-description">
%= $scenario_description
</div>
Expand Down

0 comments on commit 9b4e6c6

Please sign in to comment.