Skip to content

Commit 868a1fa

Browse files
committed
[IMP] awesome_dashboard: Lazy load dashboard
1 parent e4bf1fb commit 868a1fa

File tree

10 files changed

+18
-3
lines changed

10 files changed

+18
-3
lines changed

awesome_dashboard/__manifest__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
'views/views.xml',
2323
],
2424
'assets': {
25+
'awesome_dashboard.dashboard': [
26+
'awesome_dashboard/static/src/dashboard/**/*',
27+
],
2528
'web.assets_backend': [
2629
'awesome_dashboard/static/src/**/*',
2730
],

awesome_dashboard/static/src/dashboard.js renamed to awesome_dashboard/static/src/dashboard/dashboard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { registry } from "@web/core/registry";
33
import { useService } from "@web/core/utils/hooks";
44
import { Layout } from "@web/search/layout";
55
import { DashboardItem } from "./dashboard_item/dashboard_item";
6-
import { PieChart } from './pie_chart/pie_chart';
6+
import { PieChart } from "./pie_chart/pie_chart";
77

88
class AwesomeDashboard extends Component {
99
static template = "awesome_dashboard.AwesomeDashboard";
10-
static components = { Layout, DashboardItem, PieChart };
10+
static components = { DashboardItem, Layout, PieChart };
1111

1212
setup() {
1313
this.action = useService("action");
@@ -32,4 +32,4 @@ class AwesomeDashboard extends Component {
3232
}
3333
}
3434

35-
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
35+
registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard);
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component, xml } from "@odoo/owl";
2+
import { registry } from "@web/core/registry";
3+
import { LazyComponent } from "@web/core/assets";
4+
5+
export class DashboardLoader extends Component {
6+
static components = { LazyComponent };
7+
static template = xml`
8+
<LazyComponent bundle="'awesome_dashboard.dashboard'" Component="'AwesomeDashboard'" />
9+
`;
10+
}
11+
12+
registry.category("actions").add("awesome_dashboard.dashboard", DashboardLoader);

0 commit comments

Comments
 (0)