fix: code formatting

This commit is contained in:
prssanna 2020-03-05 14:40:49 +05:30
parent 2786518280
commit 3fb2b6795c
5 changed files with 21 additions and 17 deletions

View file

@ -423,7 +423,7 @@ class DashboardChart {
timespan: args && args.timespan? args.timespan: null,
from_date: args && args.from_date? args.from_date: null,
to_date: args && args.to_date? args.to_date: null,
}
};
}
return frappe.xcall(
method,
@ -498,10 +498,11 @@ class DashboardChart {
return frappe.xcall('frappe.desk.doctype.dashboard_chart_source.dashboard_chart_source.get_config',
{
name: this.chart_doc.source
}).then(config => {
frappe.dom.eval(config);
this.settings = frappe.dashboards.chart_sources[this.chart_doc.source];
});
})
.then(config => {
frappe.dom.eval(config);
this.settings = frappe.dashboards.chart_sources[this.chart_doc.source];
});
}
} else if (this.chart_doc.chart_type == 'Report') {
this.settings = {

View file

@ -41,7 +41,7 @@ def generate_and_cache_results(args, function, cache_key):
timespan = args.timespan or None,
)
except TypeError as e:
if e.message == "'NoneType' object is not iterable":
if str(e) == "'NoneType' object is not iterable":
# Probably because of invalid link filter
#
# Note: Do not try to find the right way of doing this because

View file

@ -145,7 +145,7 @@ frappe.ui.form.on('Dashboard Chart', {
).then(data => {
frm.report_data = data;
if (!data.chart) {
frm.set_value('is_custom', 0)
frm.set_value('is_custom', 0);
frm.set_df_property('is_custom', 'hidden', 1);
} else {
frm.set_df_property('is_custom', 'hidden', 0);
@ -234,7 +234,7 @@ frappe.ui.form.on('Dashboard Chart', {
}
frm.trigger('render_filters_table');
})
});
});
},

View file

@ -46,10 +46,11 @@ frappe.dashboard_utils = {
return frappe.xcall('frappe.desk.doctype.dashboard_chart_source.dashboard_chart_source.get_config',
{
name: chart.source
}).then(config => {
frappe.dom.eval(config);
return frappe.dashboards.chart_sources[chart.source].filters;
});
})
.then(config => {
frappe.dom.eval(config);
return frappe.dashboards.chart_sources[chart.source].filters;
});
} else if (chart.chart_type === 'Report') {
return frappe.report_utils.get_report_filters(chart.report_name).then(filters => {
return filters;

View file

@ -201,7 +201,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
{
'chart_name': chart_name,
'x_field': chart_args.x_field,
'y_axis': chart_args.y_axis_fields.map(f => {return {'y_field': f.y_field, 'color': f.color}}),
'y_axis': chart_args.y_axis_fields.map(f => {
return {'y_field': f.y_field, 'color': f.color};
}),
'is_custom': 0
}
);
@ -222,9 +224,9 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
let message;
if (dashboard_name) {
let dashboard_route_html = `<a href = "#dashboard/${dashboard_name}">${dashboard_name}</a>`;
message = __(`New Dashboard Chart ${chart_name} add to Dashboard ` + dashboard_route_html);
message = __(`New Dashboard Chart ${chart_name} added to Dashboard ` + dashboard_route_html);
} else {
message = __(`New Dashboard Chart ${chart_name} created`);
message = __(`New chart ${chart_name} created`);
}
frappe.msgprint(message);
@ -692,7 +694,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
wrapper.find('.chart-container .title, .chart-container .sub-title').hide();
wrapper.show();
dialog.fields_dict['create_dashoard_chart'].df.hidden = 0
dialog.fields_dict['create_dashoard_chart'].df.hidden = 0;
dialog.refresh();
}
else {
@ -778,7 +780,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
],
primary_action_label: __('Create'),
primary_action: (values) => {
values = set_chart_values(values)
values = set_chart_values(values);
let options =
frappe.report_utils.make_chart_options(