fix composite images report

This commit is contained in:
Oleg Zharkov
2021-02-09 15:10:11 +01:00
parent 5b96f15855
commit d9c66de52c
3 changed files with 14 additions and 10 deletions
@@ -46,10 +46,7 @@ export default {
pathDestination.filepath
);
} else if (this.path === undefined || this.path === "undefined") {
this.directoryContent = this.removeParentDirectory(
pathDestination.datasetContent,
pathDestination.datasetRootDir
);
this.directoryContent = pathDestination.datasetContent
} else {
this.errorMessage = `is not found!`;
}
@@ -6,15 +6,11 @@ export const getPathDestination = async (history_dataset_id, path) => {
const services = new Services({ root: getAppRoot() });
const computePathDestination = (pathDestination) => {
if (pathDestination.datasetContent[0].class === "Directory")
pathDestination.datasetRootDir = datasetContent[0].path;
else return;
if (path === undefined || path === "undefined") {
return pathDestination;
}
const filepath = `${pathDestination.datasetRootDir}/${path}`;
const filepath = path;
const datasetEntry = datasetContent.find((datasetEntry) => {
return filepath === datasetEntry.path;
+12 -1
View File
@@ -45,6 +45,7 @@ ARG_VAL_CAPTURED_REGEX = r'''(?:([\w_\-]+)|\"([^\"]+)\"|\'([^\']+)\')'''
OUTPUT_LABEL_PATTERN = re.compile(r'output=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX)
INPUT_LABEL_PATTERN = re.compile(r'input=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX)
STEP_LABEL_PATTERN = re.compile(r'step=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX)
PATH_LABEL_PATTERN = re.compile(r'path=\s*%s\s*' % ARG_VAL_CAPTURED_REGEX)
# STEP_OUTPUT_LABEL_PATTERN = re.compile(r'step_output=([\w_\-]+)/([\w_\-]+)')
UNENCODED_ID_PATTERN = re.compile(r'(workflow_id|history_dataset_id|history_dataset_collection_id|job_id|invocation_id)=([\d]+)')
ENCODED_ID_PATTERN = re.compile(r'(workflow_id|history_dataset_id|history_dataset_collection_id|job_id|invocation_id)=([a-z0-9]+)')
@@ -378,7 +379,17 @@ class ToBasicMarkdownDirectiveHandler(GalaxyInternalMarkdownDirectiveHandler):
def handle_dataset_as_image(self, line, hda):
dataset = hda.dataset
name = hda.name or ''
with open(dataset.file_name, "rb") as f:
filepath = re.search(PATH_LABEL_PATTERN, line).group(2)
if "path" in line:
file = os.path.join(hda.extra_files_path, filepath)
else:
file = dataset.file_name
with open(file, "rb") as f:
base64_image_data = base64.b64encode(f.read()).decode("utf-8")
rval = ("![{}](data:image/png;base64,{})".format(name, base64_image_data), True)
return rval