diff --git a/erpnext/hub_node/__init__.py b/erpnext/hub_node/__init__.py index 471f039ba2..6ac0aba626 100644 --- a/erpnext/hub_node/__init__.py +++ b/erpnext/hub_node/__init__.py @@ -93,22 +93,23 @@ def item_sync_preprocess(): }) if response: - # frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 1) + frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 1) return response else: return '' def item_sync_postprocess(obj): response = call_hub_method('update_activity_for_seller', { - 'hub_seller': frappe.db.get_value("Hub Settings", "Hub Settings", "company_email"), - 'name': obj["remote_id"], - 'status': obj["status"] + 'hub_seller': frappe.db.get_value('Hub Settings', 'Hub Settings', 'company_email'), + 'name': obj['remote_id'], + 'status': obj['status'], + 'stats': obj['stats'] }) if response: - frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 0) + frappe.db.set_value('Hub Settings', 'Hub Settings', 'sync_in_progress', 0) else: - frappe.throw("Unable to update remote activity") + frappe.throw('Unable to update remote activity') @frappe.whitelist() def get_item_favourites(start=0, limit=20, fields=["*"], order_by=None): diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js index 5261c3f554..22149562cf 100644 --- a/erpnext/public/js/hub/marketplace.js +++ b/erpnext/public/js/hub/marketplace.js @@ -724,9 +724,36 @@ erpnext.hub.Register = class Register extends SubPage { erpnext.hub.Profile = class Profile extends SubPage { make_wrapper() { super.make_wrapper(); + } - // Shorthand for profile data; - const p = hub.settings; + refresh() { + this.get_hub_seller_profile(this.keyword) + .then(profile => this.render(profile)); + } + + get_hub_seller_profile() { + return hub.call('get_hub_seller_profile', { hub_seller: hub.settings.company_email }); + } + + render(profile) { + const p = profile; + const content_by_log_type = this.get_content_by_log_type(); + + let activity_logs = (p.hub_seller_activity || []).sort((a, b) => { + return new Date(b.creation) - new Date(a.creation); + }); + + const timeline_items_html = activity_logs + .map(log => { + const stats = JSON.parse(log.stats); + const no_of_items = stats && stats.push_update || ''; + + const content = content_by_log_type[log.type]; + const message = content.get_message(no_of_items); + const icon = content.icon; + return this.get_timeline_log_item(log.pretty_date, message, icon); + }) + .join(''); const profile_html = `
${'where'}${'dot_spacer'}${'when'}
-${'rating_html'}${'rating_count'}
+${p.country}
+${p.site_name}
${'description'}
- ` : __('No description') + ${'description' + ? `${p.company_description}
` + : `__('No description')