mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
Use hub.call for categories and favourites
This commit is contained in:
@@ -69,9 +69,9 @@ erpnext.hub.Marketplace = class Marketplace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_sidebar_categories() {
|
make_sidebar_categories() {
|
||||||
frappe.call('erpnext.hub_node.get_categories')
|
hub.call('erpnext.hub_node.get_categories')
|
||||||
.then(r => {
|
.then(categories => {
|
||||||
const categories = r.message.map(d => d.value).sort();
|
const categories = r.message.map(d => d.name);
|
||||||
const sidebar_items = [
|
const sidebar_items = [
|
||||||
`<li class="hub-sidebar-item bold is-title">
|
`<li class="hub-sidebar-item bold is-title">
|
||||||
${__('Category')}
|
${__('Category')}
|
||||||
@@ -258,13 +258,13 @@ erpnext.hub.Home = class Home extends SubPage {
|
|||||||
erpnext.hub.Favourites = class Favourites extends SubPage {
|
erpnext.hub.Favourites = class Favourites extends SubPage {
|
||||||
refresh() {
|
refresh() {
|
||||||
this.get_favourites()
|
this.get_favourites()
|
||||||
.then(r => {
|
.then(items => {
|
||||||
this.render(r.message);
|
this.render(items);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get_favourites() {
|
get_favourites() {
|
||||||
return frappe.call('erpnext.hub_node.get_item_favourites');
|
return hub.call('get_item_favourites');
|
||||||
}
|
}
|
||||||
|
|
||||||
render(items) {
|
render(items) {
|
||||||
@@ -1072,29 +1072,12 @@ erpnext.hub.Publish = class Publish extends SubPage {
|
|||||||
});
|
});
|
||||||
this.items_to_publish = items_to_publish;
|
this.items_to_publish = items_to_publish;
|
||||||
|
|
||||||
return this.set_sync(items_to_publish)
|
return frappe.call(
|
||||||
.then(frappe.call(
|
|
||||||
'erpnext.hub_node.publish_selected_items',
|
'erpnext.hub_node.publish_selected_items',
|
||||||
{
|
{
|
||||||
items_to_publish: item_codes_to_publish
|
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
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user