Render batch execution description as markdown

This commit is contained in:
Lance Edgar 2021-02-09 14:21:07 -06:00
parent cc2308c399
commit 5969515f25
2 changed files with 16 additions and 4 deletions

View file

@ -69,6 +69,10 @@
white-space: nowrap;
}
.markdown p {
margin-bottom: 1.5rem;
}
</style>
% else:
<style type="text/css">
@ -203,6 +207,7 @@
${execute_title}
</b-button>
% if execute_enabled:
<b-modal has-modal-card
:active.sync="showExecutionDialog">
<div class="modal-card">
@ -215,10 +220,11 @@
<p class="block has-text-weight-bold">
What will happen when this batch is executed?
</p>
<p class="block">
${handler.describe_execution(batch) or "TODO: handler does not provide a description for this batch"}
</p>
<${execute_form.component} ref="executeBatchForm"></${execute_form.component}>
<div class="markdown">
${execution_described|n}
</div>
<${execute_form.component} ref="executeBatchForm">
</${execute_form.component}>
</section>
<footer class="modal-card-foot">
@ -234,6 +240,7 @@
</div>
</b-modal>
% endif
% else:
## no buefy, do legacy thing

View file

@ -38,6 +38,7 @@ from six import StringIO
import json
import six
import markdown
import sqlalchemy as sa
from sqlalchemy import orm
@ -175,6 +176,10 @@ class BatchMasterView(MasterView):
if kwargs['execute_enabled']:
url = self.get_action_url('execute', batch)
kwargs['execute_form'] = self.make_execute_form(batch, action_url=url)
description = (self.handler.describe_execution(batch)
or "TODO: handler does not provide a description for this batch")
kwargs['execution_described'] = markdown.markdown(
description, extensions=['fenced_code', 'codehilite'])
else:
kwargs['why_not_execute'] = self.handler.why_not_execute(batch)