fix: Add workflow comments in form timeline

* Add Edit, Label along with Info timeline logs
* Added title field for timeline icon
This commit is contained in:
Gavin D'souza 2021-09-06 19:39:08 +05:30
parent 6f0a02aaa5
commit a233bf1061
2 changed files with 18 additions and 1 deletions

View file

@ -106,9 +106,10 @@ def get_docinfo(doc=None, doctype=None, name=None):
"assignment_logs": get_comments(doc.doctype, doc.name, 'assignment'),
"permissions": get_doc_permissions(doc),
"shared": frappe.share.get_users(doc.doctype, doc.name),
"info_logs": get_comments(doc.doctype, doc.name, 'Info'),
"info_logs": get_comments(doc.doctype, doc.name, comment_type=['Info', 'Edit', 'Label']),
"share_logs": get_comments(doc.doctype, doc.name, 'share'),
"like_logs": get_comments(doc.doctype, doc.name, 'Like'),
"workflow_logs": get_comments(doc.doctype, doc.name, comment_type="Workflow"),
"views": get_view_logs(doc.doctype, doc.name),
"energy_point_logs": get_point_logs(doc.doctype, doc.name),
"additional_timeline_content": get_additional_timeline_content(doc.doctype, doc.name),

View file

@ -136,6 +136,7 @@ class FormTimeline extends BaseTimeline {
this.timeline_items.push(...this.get_energy_point_timeline_contents());
this.timeline_items.push(...this.get_version_timeline_contents());
this.timeline_items.push(...this.get_share_timeline_contents());
this.timeline_items.push(...this.get_workflow_timeline_contents());
this.timeline_items.push(...this.get_like_timeline_contents());
this.timeline_items.push(...this.get_custom_timeline_contents());
this.timeline_items.push(...this.get_assignment_timeline_contents());
@ -339,11 +340,26 @@ class FormTimeline extends BaseTimeline {
icon_size: 'sm',
creation: like_log.creation,
content: __('{0} Liked', [this.get_user_link(like_log.owner)]),
title: "Like",
});
});
return like_timeline_contents;
}
get_workflow_timeline_contents() {
let workflow_timeline_contents = [];
(this.doc_info.workflow_logs || []).forEach(workflow_log => {
workflow_timeline_contents.push({
icon: 'branch',
icon_size: 'sm',
creation: workflow_log.creation,
content: __(workflow_log.content),
title: "Workflow",
});
});
return workflow_timeline_contents;
}
get_custom_timeline_contents() {
let custom_timeline_contents = [];
(this.doc_info.additional_timeline_content || []).forEach(custom_item => {