feat(Dashboard): option to refresh all charts and cards
This commit is contained in:
parent
ef5befadc9
commit
bb2f09b270
1 changed files with 13 additions and 6 deletions
|
|
@ -172,19 +172,26 @@ class Dashboard {
|
|||
set_dropdown() {
|
||||
this.page.clear_menu();
|
||||
|
||||
this.page.add_menu_item('Edit...', () => {
|
||||
this.page.add_menu_item(__('Edit'), () => {
|
||||
frappe.set_route('Form', 'Dashboard', frappe.dashboard.dashboard_name);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
this.page.add_menu_item('New...', () => {
|
||||
this.page.add_menu_item(__('New'), () => {
|
||||
frappe.new_doc('Dashboard');
|
||||
}, 1);
|
||||
});
|
||||
|
||||
frappe.db.get_list("Dashboard").then(dashboards => {
|
||||
this.page.add_menu_item(__('Refresh All'), () => {
|
||||
this.chart_group &&
|
||||
this.chart_group.widgets_list.forEach(chart => chart.refresh());
|
||||
this.number_card_group &&
|
||||
this.number_card_group.widgets_list.forEach(card => card.render_card());
|
||||
});
|
||||
|
||||
frappe.db.get_list('Dashboard').then(dashboards => {
|
||||
dashboards.map(dashboard => {
|
||||
let name = dashboard.name;
|
||||
if(name != this.dashboard_name){
|
||||
this.page.add_menu_item(name, () => frappe.set_route("dashboard", name));
|
||||
this.page.add_menu_item(name, () => frappe.set_route("dashboard", name), 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue