Customize dashbaord

Hi,
I need to write a client script to auto-refresh the dashboard page every 5 seconds.

How I can do it.

@Omar_Mohammed 5 seconds might overload your database .

Ok, what is the altern. solution because we give this screen to customer care team

1 Like

Manually click “Refresh All” :sweat_smile:

@bahaou is correct. 5 seconds might overload your database, but developing the 5-minute scenario is possible.

You have to customize the dashboard_view.js

	refresh() {
		frappe.run_serially([() => this.render_cards(), () => this.render_charts()]);
		this.start_auto_refresh(); //add this line
	}

	start_auto_refresh() {
		if (this.refreshInterval) {
			clearInterval(this.refreshInterval);
		}

		this.refreshInterval = setInterval(() => {
			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());
		}, 300000); // 5 minutes
	}

Remember to reload the dashboard once, and then it will automatically reload every 5 minutes.

1 Like

I know the manual refresh bro :joy:

thanks for your effort.

but in my case, our customer care team needs to have a screen to monitor the orders, and you know the status of the order is changed per second.

I’m not suggesting with 5 sec but you can try with the above code and set with 5 sec :wink:

1 Like