mirror of
https://github.com/SARL-PACIFIC-ERP/odoo-sh-test.git
synced 2025-06-25 09:32:22 +00:00
ch2.8 lazy loading
This commit is contained in:
parent
a9713b4667
commit
7aa696f174
|
@ -24,6 +24,10 @@
|
||||||
'assets': {
|
'assets': {
|
||||||
'web.assets_backend': [
|
'web.assets_backend': [
|
||||||
'awesome_dashboard/static/src/**/*',
|
'awesome_dashboard/static/src/**/*',
|
||||||
|
('remove', 'awesome_dashboard/static/src/dashboard/**/*'),
|
||||||
|
],
|
||||||
|
'awesome_dashboard.dashboard': [
|
||||||
|
'awesome_dashboard/static/src/dashboard/**/*'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'license': 'AGPL-3'
|
'license': 'AGPL-3'
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
import { Component, onWillStart, useState } from "@odoo/owl";
|
import { Component, useState } from "@odoo/owl";
|
||||||
import { registry } from "@web/core/registry";
|
import { registry } from "@web/core/registry";
|
||||||
import { Layout } from "@web/search/layout";
|
import { Layout } from "@web/search/layout";
|
||||||
import { useService } from "@web/core/utils/hooks"
|
import { useService } from "@web/core/utils/hooks"
|
||||||
import { DashboardItem } from "./dashboard_item";
|
import { DashboardItem } from "./dashboard_item/dashboard_item";
|
||||||
import { Piechart } from "./piechart/piechart";
|
import { Piechart } from "./piechart/piechart";
|
||||||
|
|
||||||
class AwesomeDashboard extends Component {
|
class AwesomeDashboard extends Component {
|
||||||
|
@ -35,4 +35,4 @@ class AwesomeDashboard extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboard);
|
registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard);
|
15
awesome_dashboard/static/src/dashboard_loader.js
Normal file
15
awesome_dashboard/static/src/dashboard_loader.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/** @odoo-module */
|
||||||
|
|
||||||
|
import { registry } from "@web/core/registry";
|
||||||
|
import { LazyComponent } from "@web/core/assets";
|
||||||
|
import { Component, xml } from "@odoo/owl";
|
||||||
|
|
||||||
|
class AwesomeDashboardLoader extends Component {
|
||||||
|
|
||||||
|
static components = { LazyComponent };
|
||||||
|
static template = xml`
|
||||||
|
<LazyComponent bundle="'awesome_dashboard.dashboard'" Component="'AwesomeDashboard'" props="props"/>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboardLoader);
|
Loading…
Reference in a new issue