Merge pull request #10353 from scmmishra/fix-desk-widgets

feat: hide dashboard widget if onboarding is present
This commit is contained in:
mergify[bot] 2020-05-14 10:48:02 +00:00 committed by GitHub
commit 74fa9d6ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -12,7 +12,7 @@ frappe.ui.form.on('Desk Page', {
frm.set_df_property("extends", "read_only", true);
}
if (frm.doc.for_user || frm.doc.is_standard) {
if (frm.doc.for_user || (frm.doc.is_standard && !frappe.boot.developer_mode)) {
frm.trigger('disable_form');
}
},

View file

@ -294,7 +294,7 @@ class DesktopPage {
make_charts() {
return frappe.dashboard_utils.get_dashboard_settings().then(settings => {
let chart_config = settings.chart_config? JSON.parse(settings.chart_config): {};
let chart_config = settings.chart_config ? JSON.parse(settings.chart_config): {};
if (this.data.charts.items) {
this.data.charts.items.map(chart => {
chart.chart_settings = chart_config[chart.chart_name] || {};
@ -306,6 +306,7 @@ class DesktopPage {
container: this.page,
type: "chart",
columns: 1,
hidden: Boolean(this.onboarding_widget),
options: {
allow_sorting: this.allow_customization,
allow_create: this.allow_customization,

View file

@ -52,6 +52,7 @@ export default class WidgetGroup {
</div>
</div>`);
this.widget_area = widget_area;
if (this.hidden) this.widget_area.hide();
this.title_area = widget_area.find(".widget-group-title");
this.control_area = widget_area.find(".widget-group-control");
this.body = widget_area.find(".widget-group-body");
@ -96,7 +97,7 @@ export default class WidgetGroup {
}
customize() {
this.widget_area.show();
if (!this.hidden) this.widget_area.show();
this.widgets_list.forEach((wid) => {
wid.customize(this.options);
});