def generate_report_json(self, trans, invocation, runtime_report_config_json=None): """ """ workflow_manager = workflows.WorkflowsManager(trans.app) workflow_encoded_id = trans.app.security.encode_id( invocation.workflow_id) workflow = workflow_manager.get_stored_accessible_workflow( trans, workflow_encoded_id, by_stored_id=False) internal_markdown = self._generate_internal_markdown( trans, invocation, runtime_report_config_json=runtime_report_config_json) export_markdown, extra_rendering_data = ready_galaxy_markdown_for_export( trans, internal_markdown) rval = { "render_format": "markdown", # Presumably the frontend could render things other ways. "markdown": export_markdown, "invocation_markdown": export_markdown, "model_class": "Report", "id": trans.app.security.encode_id(invocation.workflow_id), "username": trans.user.username, "title": workflow.name, } rval.update(extra_rendering_data) return rval
def rewrite_content_for_export(self, trans, as_dict): content = as_dict["content"] content_format = as_dict.get("content_format", PageContentFormat.html.value) if content_format == PageContentFormat.html.value: processor = PageContentProcessor(trans, placeholderRenderForEdit) processor.feed(content) content = unicodify(processor.output(), 'utf-8') as_dict["content"] = content elif content_format == PageContentFormat.markdown.value: content, extra_attributes = ready_galaxy_markdown_for_export(trans, content) as_dict["content"] = content as_dict.update(extra_attributes) else: raise exceptions.RequestParameterInvalidException(f"content_format [{content_format}] must be either html or markdown") return as_dict
def generate_report_json(self, trans, invocation, runtime_report_config_json=None): """ """ internal_markdown = self._generate_internal_markdown( trans, invocation, runtime_report_config_json=runtime_report_config_json) export_markdown, extra_rendering_data = ready_galaxy_markdown_for_export( trans, internal_markdown) rval = { "render_format": "markdown", # Presumably the frontend could render things other ways. "markdown": export_markdown, "invocation_markdown": export_markdown, } rval.update(extra_rendering_data) return rval
def _ready_export(self, example): return ready_galaxy_markdown_for_export(self.trans, example)