[hub][publish] in_progress/empty state

This commit is contained in:
Prateeksha Singh 2018-07-26 17:24:33 +05:30
parent b750425288
commit d450c0ac08
4 changed files with 27 additions and 18 deletions

View File

@ -55,13 +55,15 @@ def get_valid_items(search_value=''):
@frappe.whitelist() @frappe.whitelist()
def publish_selected_items(items_to_publish): def publish_selected_items(items_to_publish):
# for item_code in json.loads(items_to_publish): for item_code in json.loads(items_to_publish):
# frappe.db.set_value('Item', item_code, 'publish_in_hub', 1) frappe.db.set_value('Item', item_code, 'publish_in_hub', 1)
time.sleep(3) # frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 1)
# time.sleep(10)
# frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 0)
# hub_settings = frappe.get_doc('Hub Settings') hub_settings = frappe.get_doc('Hub Settings')
# hub_settings.sync() hub_settings.sync()
return return

View File

@ -46,10 +46,12 @@ class HubSettings(Document):
doc = frappe.get_doc({ doc = frappe.get_doc({
'doctype': 'Data Migration Run', 'doctype': 'Data Migration Run',
'data_migration_plan': 'Hub Sync', 'data_migration_plan': 'Hub Sync',
'data_migration_connector': 'Hub Connector' 'data_migration_connector': 'Hub Connector',
}).insert() }).insert()
self.sync_in_progress = 1
doc.run() doc.run()
self.sync_in_progress = 0
def pre_reg(self): def pre_reg(self):
site_name = frappe.local.site + ':' + str(frappe.conf.webserver_port) site_name = frappe.local.site + ':' + str(frappe.conf.webserver_port)

View File

@ -670,9 +670,9 @@ erpnext.hub.Publish = class Publish extends SubPage {
setup_events() { setup_events() {
this.$wrapper.find('.publish-items').on('click', () => { this.$wrapper.find('.publish-items').on('click', () => {
this.load_publishing_state();
this.publish_selected_items() this.publish_selected_items()
.then(r => { .then(r => {
this.load_publishing_state();
frappe.msgprint('check'); frappe.msgprint('check');
}); });
}); });
@ -716,12 +716,6 @@ erpnext.hub.Publish = class Publish extends SubPage {
const more_than_one = total_items > 1; const more_than_one = total_items > 1;
this.$wrapper.find('.publish-items') this.$wrapper.find('.publish-items')
.html(__('Publish ' + total_items + ' item' + (more_than_one ? 's' : ''))); .html(__('Publish ' + total_items + ' item' + (more_than_one ? 's' : '')));
// if($target.hasClass('active')) {
// $target.addClass('active');
// } else {
// $target.removeClass('active');
// }
}); });
this.$wrapper.append(items_container); this.$wrapper.append(items_container);
@ -737,9 +731,9 @@ erpnext.hub.Publish = class Publish extends SubPage {
} }
load_publishing_state() { load_publishing_state() {
this.$wrapper.html(`<div> this.$wrapper.html(get_empty_state(
<b>Publishing</b> 'Publishing items ... You will be notified once published.'
</div>`); ));
} }
publish_selected_items() { publish_selected_items() {
@ -757,6 +751,12 @@ erpnext.hub.Publish = class Publish extends SubPage {
} }
} }
function get_empty_state(message) {
return `<div class="empty-state flex">
<p class="text-muted">${message}</p>
</div>`
}
function get_item_card_container_html(items, title='') { function get_item_card_container_html(items, title='') {
const items_html = (items || []).map(item => get_item_card_html(item)).join(''); const items_html = (items || []).map(item => get_item_card_html(item)).join('');

View File

@ -156,6 +156,11 @@ body[data-route^="marketplace/"] {
padding: 15px 25px; padding: 15px 25px;
} }
.empty-state {
justify-content: center;
padding-top: 159px;
}
.form-container { .form-container {
.frappe-control { .frappe-control {
max-width: 100% !important; max-width: 100% !important;