Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infopanel: render scenario_description as markdown #5374

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading