From 300c07c3d9ff1b1290eda5113267b5250fb001af Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 31 Jul 2018 18:02:13 +0530 Subject: [PATCH] Use hub.call for categories and favourites --- erpnext/public/js/hub/marketplace.js | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js index 83c13a078d9..86ab60b5c0a 100644 --- a/erpnext/public/js/hub/marketplace.js +++ b/erpnext/public/js/hub/marketplace.js @@ -69,9 +69,9 @@ erpnext.hub.Marketplace = class Marketplace { } make_sidebar_categories() { - frappe.call('erpnext.hub_node.get_categories') - .then(r => { - const categories = r.message.map(d => d.value).sort(); + hub.call('erpnext.hub_node.get_categories') + .then(categories => { + const categories = r.message.map(d => d.name); const sidebar_items = [ `
  • ${__('Category')} @@ -258,13 +258,13 @@ erpnext.hub.Home = class Home extends SubPage { erpnext.hub.Favourites = class Favourites extends SubPage { refresh() { this.get_favourites() - .then(r => { - this.render(r.message); + .then(items => { + this.render(items); }); } get_favourites() { - return frappe.call('erpnext.hub_node.get_item_favourites'); + return hub.call('get_item_favourites'); } render(items) { @@ -1072,29 +1072,12 @@ erpnext.hub.Publish = class Publish extends SubPage { }); this.items_to_publish = items_to_publish; - return this.set_sync(items_to_publish) - .then(frappe.call( + return frappe.call( 'erpnext.hub_node.publish_selected_items', { items_to_publish: item_codes_to_publish } - )); - } - - set_sync(items_to_publish) { - hub.settings.sync_in_progress = 1; - return frappe.db.set_value("Hub Settings", "Hub Settings", { - custom_data: JSON.stringify(items_to_publish), - sync_in_progress: 1 - }) - } - - reset_sync() { - hub.settings.sync_in_progress = 0; - return frappe.db.set_value("Hub Settings", "Hub Settings", { - custom_data: '', - sync_in_progress: 0 - }) + ) } }