Skip to content

Commit aa6286c

Browse files
committed
[IMP] awesome_dashboard: add item list and pie chart in dashboard
add dashboard item which is number card and pie chart card add lazy loading functionality for dashboard making our dashboard generic added functionality add and remove dashboard items
1 parent 3aa257c commit aa6286c

31 files changed

+480
-127
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,10 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
.eslintignore
132+
.eslintrc.json
133+
jsconfig.json
134+
package.json
135+
package-lock.json
136+
node_modules

awesome_dashboard/__manifest__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
'author': "Odoo",
1414
'website': "https://www.odoo.com/",
15-
'category': 'Tutorials',
15+
'category': 'Tutorials/AwesomeDashboard',
1616
'version': '0.1',
1717
'application': True,
1818
'installable': True,
@@ -25,6 +25,9 @@
2525
'web.assets_backend': [
2626
'awesome_dashboard/static/src/**/*',
2727
],
28+
'awesome_dashboard.dashboard': [
29+
'awesome_dashboard/static/src/dashboard/**/*',
30+
],
2831
},
2932
'license': 'AGPL-3'
3033
}

awesome_dashboard/controllers/controllers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ def get_statistics(self):
2727
'nb_cancelled_orders': random.randint(0, 50),
2828
'nb_new_orders': random.randint(10, 200),
2929
'orders_by_size': {
30-
'm': random.randint(0, 150),
30+
'xs': random.randint(0, 150),
3131
's': random.randint(0, 150),
32+
'm': random.randint(0, 150),
33+
'l': random.randint(0, 150),
3234
'xl': random.randint(0, 150),
3335
},
3436
'total_amount': random.randint(100, 1000)
3537
}
36-
29.9 KB
Loading

awesome_dashboard/static/src/dashboard.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

awesome_dashboard/static/src/dashboard.xml

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Component } from "@odoo/owl";
2+
3+
export class DashboardItem extends Component {
4+
static template = "awesome_dashboard.DashboardItem";
5+
static props = {
6+
title: {
7+
type: String,
8+
optional: true
9+
},
10+
slots: {
11+
type: Object,
12+
shape: {
13+
default: Object,
14+
},
15+
},
16+
size: {
17+
type: Number,
18+
optional: true,
19+
},
20+
};
21+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
<t t-name="awesome_dashboard.DashboardItem">
4+
<div class="card m-2" t-attf-style="width: {{ 18 * props.size || 18 }}rem;">
5+
<div class="card-body">
6+
<t t-slot="default"/>
7+
</div>
8+
</div>
9+
</t>
10+
</templates>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component } from "@odoo/owl";
2+
3+
export class NumberCard extends Component {
4+
static template = "awesome_dashboard.NumberCard";
5+
static props = {
6+
title: {
7+
type: String,
8+
optional: true
9+
},
10+
value: Number,
11+
};
12+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
<t t-name="awesome_dashboard.NumberCard">
4+
<h5 class="mb-0" t-esc="props.title"/>
5+
<p class='fs-1 fw-bold text-success mb-0' t-esc="props.value"/>
6+
</t>
7+
</templates>

0 commit comments

Comments
 (0)