-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Annotation and Title detail #18762
base: dev
Are you sure you want to change the base?
Annotation and Title detail #18762
Changes from all commits
9858c9e
cb40238
d19c2b0
6c4ae65
7301278
e30bb91
6194f1a
99693ae
4c08baa
58e8b2d
2b5f1ac
dac0113
7b2c719
08b7f0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<script setup lang="ts"> | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { computed, ref } from "vue"; | ||
|
||
import WorkflowCard from "@/components/Workflow/List/WorkflowCard.vue"; | ||
|
||
library.add(faChevronDown, faChevronUp); | ||
|
||
const props = defineProps({ | ||
model: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}); | ||
|
||
const expandAnnotations = ref(true); | ||
|
||
const workflow = computed(() => { | ||
return { | ||
id: props.model.runData.id, | ||
name: props.model.runData.name, | ||
owner: props.model.runData.owner, | ||
tags: props.model.runData.annotation.tags.map((t: { user_tname: string }) => t.user_tname), | ||
annotations: [props.model.runData.annotation.annotation], | ||
update_time: props.model.runData.annotation.update_time, | ||
}; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="ui-portlet-section w-100"> | ||
<div | ||
class="portlet-header cursor-pointer" | ||
role="button" | ||
:tabindex="0" | ||
@keyup.enter="expandAnnotations = !expandAnnotations" | ||
@click="expandAnnotations = !expandAnnotations"> | ||
<b class="portlet-operations portlet-title-text"> | ||
<span v-localize class="font-weight-bold">About This Workflow</span> | ||
</b> | ||
<span v-b-tooltip.hover.bottom title="Collapse/Expand" variant="link" size="sm" class="float-right"> | ||
<FontAwesomeIcon :icon="expandAnnotations ? faChevronUp : faChevronDown" fixed-width /> | ||
</span> | ||
</div> | ||
<div class="portlet-content" :style="expandAnnotations ? 'display: none;' : ''"> | ||
<WorkflowCard | ||
:workflow="workflow" | ||
:published-view="true" | ||
:grid-view="true" | ||
:show-actions="false" | ||
:class="'grid-view'" /> | ||
</div> | ||
</div> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -907,6 +907,26 @@ def _workflow_from_raw_description( | |
|
||
return workflow, missing_tool_tups | ||
|
||
def convert_to_dict_from_many(self, obj, depth=0, max_depth=5): | ||
if depth > max_depth: | ||
return "<max depth reached>" | ||
|
||
if isinstance(obj, list): | ||
return [self.convert_to_dict_from_many(item, depth=depth + 1, max_depth=max_depth) for item in obj] | ||
elif isinstance(obj, dict) or hasattr(obj, "__dict__"): | ||
if isinstance(obj, dict): | ||
items = obj.items() # Dictionary case | ||
else: | ||
items = obj.__dict__.items() # Custom object case | ||
|
||
return { | ||
key: self.convert_to_dict_from_many(value, depth=depth + 1, max_depth=max_depth) | ||
for key, value in items | ||
if not key.startswith("_") | ||
} | ||
else: | ||
return obj | ||
|
||
def workflow_to_dict(self, trans, stored, style="export", version=None, history=None): | ||
"""Export the workflow contents to a dictionary ready for JSON-ification and to be | ||
sent out via API for instance. There are three styles of export allowed 'export', 'instance', and | ||
|
@@ -1070,13 +1090,19 @@ def _workflow_to_dict_run(self, trans, stored, workflow, history=None): | |
} | ||
for oc in step.output_connections | ||
] | ||
annotations_dict = { | ||
"annotation": self.get_item_annotation_str(trans.sa_session, trans.user, stored), | ||
"update_time": (stored.update_time).isoformat(), | ||
"tags": self.convert_to_dict_from_many(stored.tags), | ||
} | ||
if step.annotations: | ||
step_model["annotation"] = step.annotations[0].annotation | ||
if step.upgrade_messages: | ||
step_model["messages"] = step.upgrade_messages | ||
step_models.append(step_model) | ||
return { | ||
"id": trans.app.security.encode_id(stored.id), | ||
"annotation": annotations_dict, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mvdbeek Please let me know if it would be even better to serialize these SQLAlchemy objects in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're including properties here that are not part of the annotation model. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure - any insights & examples are appreciated too. |
||
"history_id": trans.app.security.encode_id(history.id) if history else None, | ||
"name": stored.name, | ||
"owner": stored.user.username, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itisAliRH for this line
annotations: [props.model.runData.annotation.annotation],
is ok to only use the first annotation record (ie.annotation[0]
)? Or are other annotation records need to be included/consolidated somehow?