[progress] dismiss on completion

This commit is contained in:
pratu16x7 2017-09-01 17:48:09 +05:30
parent 7d2c96b2d4
commit bf4eab3bc2
2 changed files with 5 additions and 29 deletions

View file

@ -155,6 +155,7 @@ frappe.setup.SetupWizard = class SetupWizard extends frappe.ui.Slides {
localStorage.setItem("session_last_route", frappe.setup.welcome_page);
}
window.location = "/desk";
window.location.reload();
setTimeout(function() {
// frappe.ui.toolbar.clear_cache();
window.location = "/desk";

View file

@ -121,7 +121,7 @@ frappe.setup.UserProgressDialog = class UserProgressDialog {
let percent = completed * 100 / total;
$('.user-progress .progress-bar').css({'width': percent + '%'});
if(percent === 100) {
$(document).trigger("user-initial-setup-complete");
this.dismiss_progress();
}
}
});
@ -130,7 +130,6 @@ frappe.setup.UserProgressDialog = class UserProgressDialog {
this.mark_as_done();
});
this.make_dismiss_button();
this.get_and_update_progress_state();
this.check_for_updates();
}
@ -194,39 +193,15 @@ frappe.setup.UserProgressDialog = class UserProgressDialog {
}
update_progress() {
this.update_progress_bars();
}
update_progress_bars() {
$('.user-progress .progress-bar').css({'width': this.progress_percent + '%'});
if(this.progress_percent === 100) {
$(document).trigger("user-initial-setup-complete");
this.dismiss_progress();
}
}
make_dismiss_button() {
this.dialog.set_primary_action(__('Dismiss'), () => {
$('.user-progress').addClass('hide');
this.dialog.hide();
});
this.$dismiss_button = this.dialog.header.find('.btn-primary').addClass('dismiss-btn');
// hidden by default
this.$dismiss_button.addClass('hide');
$(document).on("user-initial-setup-complete", () => {
this.add_finish_slide_and_make_dismissable();
});
}
add_finish_slide_and_make_dismissable() {
dismiss_progress() {
$('.user-progress').addClass('hide');
clearInterval(this.updater);
let slide_dict = this.slide_container.slide_dict;
Object.keys(slide_dict).map(id => {
slide_dict[id].dialog_dismissed = 1;
});
this.$dismiss_button.removeClass('hide');
}
show() {