openadmin-dev 0.7.4__tar.gz → 0.7.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/PKG-INFO +1 -1
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/genres.py +13 -2
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/weekdays.py +52 -8
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/admin_page.py +32 -2
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/bar_chart.py +7 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/table.py +3 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/__init__.py +15 -2
- openadmin_dev-0.7.5/openadmin/spec/bar_chart.py +52 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/component.py +4 -4
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/table.py +21 -2
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/pyproject.toml +1 -1
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/uv.lock +1 -1
- openadmin_dev-0.7.4/openadmin/spec/bar_chart.py +0 -20
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/ISSUE_TEMPLATE/chore.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/ISSUE_TEMPLATE/feature.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/branch-name/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/dependency-cves/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/format/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/license/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/lint/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/security/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/spell-check/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/test/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/typecheck/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/actions/unused-code/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/workflows/ci.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.github/workflows/publish.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.gitignore +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/.python-version +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/LICENSE +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/LICENSES/AGPL-3.0-or-later.txt +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/Makefile +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/README.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/REUSE.toml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/docs/assets/logo.png +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/analytics.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/authors.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/books.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/health.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/overview.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/publishers.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/reports.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/admin/tags.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/lib/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/lib/database.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/lib/lifespan.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/lib/models.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/lib/seed.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/examples/main.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/action.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/admin_panel.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/area_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/component.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/counters.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/deps.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/form.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/line_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/markdown.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/page_protocol.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/pagination_params.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/pie_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/section.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/stat.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/fastapi/utils.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/action.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/area_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/colors.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/form.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/http_methods.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/icons.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/line_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/markdown.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/page.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/pie_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/property.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/property_type.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/section.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/spec.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/openadmin/spec/stat.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.5}/tests/test_hello.py +0 -0
|
@@ -44,7 +44,12 @@ async def get_books_without_genre(session: AsyncSessionDep) -> int:
|
|
|
44
44
|
return result.scalar_one()
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
@page.table(
|
|
47
|
+
@page.table(
|
|
48
|
+
"All Genres",
|
|
49
|
+
description="All genres sorted by book count",
|
|
50
|
+
icon="flower",
|
|
51
|
+
color="green",
|
|
52
|
+
)
|
|
48
53
|
async def get_all_genres(session: AsyncSessionDep, pagination: PageDep):
|
|
49
54
|
stmt = (
|
|
50
55
|
select(models.Genre, func.count(models.BookToGenre.book_id).label("book_count"))
|
|
@@ -56,7 +61,13 @@ async def get_all_genres(session: AsyncSessionDep, pagination: PageDep):
|
|
|
56
61
|
)
|
|
57
62
|
result = await session.execute(stmt)
|
|
58
63
|
return [
|
|
59
|
-
{
|
|
64
|
+
{
|
|
65
|
+
"id": g.id,
|
|
66
|
+
"name": g.name,
|
|
67
|
+
"book_count": count,
|
|
68
|
+
"__veiw__": f"{g.id} | {g.name}",
|
|
69
|
+
}
|
|
70
|
+
for g, count in result.all()
|
|
60
71
|
]
|
|
61
72
|
|
|
62
73
|
|
|
@@ -8,11 +8,11 @@ from typing import Any
|
|
|
8
8
|
from openadmin import fastapi, spec
|
|
9
9
|
|
|
10
10
|
WEEKDAYS: list[dict[str, Any]] = [
|
|
11
|
-
{"day": "Monday", "books": 5},
|
|
12
|
-
{"day": "Tuesday", "books": 3},
|
|
13
|
-
{"day": "Wednesday", "books": 7},
|
|
14
|
-
{"day": "Thursday", "books": 9},
|
|
15
|
-
{"day": "Friday", "books": 10},
|
|
11
|
+
{"day": "Monday", "books": 5, "coffe": 5},
|
|
12
|
+
{"day": "Tuesday", "books": 3, "coffe": 6},
|
|
13
|
+
{"day": "Wednesday", "books": 7, "coffe": 7},
|
|
14
|
+
{"day": "Thursday", "books": 9, "coffe": 8},
|
|
15
|
+
{"day": "Friday", "books": 10, "coffe": 9},
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
page = fastapi.AdminPage(
|
|
@@ -29,7 +29,7 @@ page = fastapi.AdminPage(
|
|
|
29
29
|
config={
|
|
30
30
|
item["day"]: {
|
|
31
31
|
"name": item["day"],
|
|
32
|
-
"color": spec.COLORS[num % len(spec.COLORS)],
|
|
32
|
+
"color": spec.COLORS[num + 10 % len(spec.COLORS)],
|
|
33
33
|
}
|
|
34
34
|
for num, item in enumerate(WEEKDAYS)
|
|
35
35
|
},
|
|
@@ -60,7 +60,7 @@ def get_books_2() -> spec.PieChart:
|
|
|
60
60
|
"config": {
|
|
61
61
|
item["day"]: {
|
|
62
62
|
"name": item["day"],
|
|
63
|
-
"color": spec.COLORS[num % len(spec.COLORS)],
|
|
63
|
+
"color": spec.COLORS[num + 10 % len(spec.COLORS)],
|
|
64
64
|
}
|
|
65
65
|
for num, item in enumerate(WEEKDAYS)
|
|
66
66
|
},
|
|
@@ -78,10 +78,54 @@ def get_books_2() -> spec.PieChart:
|
|
|
78
78
|
config={
|
|
79
79
|
item["day"]: {
|
|
80
80
|
"name": item["day"],
|
|
81
|
-
"color": spec.COLORS[num % len(spec.COLORS)],
|
|
81
|
+
"color": spec.COLORS[num + 10 % len(spec.COLORS)],
|
|
82
82
|
}
|
|
83
83
|
for num, item in enumerate(WEEKDAYS)
|
|
84
84
|
},
|
|
85
85
|
)
|
|
86
86
|
def get_books_3() -> spec.PieChart:
|
|
87
87
|
return [{"name": day["day"], "value": day["value"]} for day in WEEKDAYS]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@page.bar_chart(
|
|
91
|
+
"Books & Coffee 1",
|
|
92
|
+
description="Books read and coffee cups per weekday, week 1",
|
|
93
|
+
data_key="day",
|
|
94
|
+
config={
|
|
95
|
+
"books": {"name": "Books", "color": "violet", "icon": "book-open"},
|
|
96
|
+
"coffe": {"name": "Coffee", "color": "amber", "icon": "coffee"},
|
|
97
|
+
},
|
|
98
|
+
color="violet",
|
|
99
|
+
icon="book-open",
|
|
100
|
+
caption="5 day streak",
|
|
101
|
+
caption_description="Reading every day this work week",
|
|
102
|
+
caption_icon="flame",
|
|
103
|
+
)
|
|
104
|
+
def get_books_and_coffe_1() -> spec.BarChart:
|
|
105
|
+
return WEEKDAYS
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@page.bar_chart(
|
|
109
|
+
"Books & Coffee 2",
|
|
110
|
+
description="Books read and coffee cups per weekday, week 2",
|
|
111
|
+
data_key="day",
|
|
112
|
+
config={
|
|
113
|
+
"books": {"name": "Books", "color": "violet", "icon": "book-open"},
|
|
114
|
+
"coffe": {"name": "Coffee", "color": "amber", "icon": "coffee"},
|
|
115
|
+
},
|
|
116
|
+
color="amber",
|
|
117
|
+
icon="a-arrow-up",
|
|
118
|
+
caption="3 day streak",
|
|
119
|
+
caption_description="Reading every day this work week",
|
|
120
|
+
caption_icon="flame",
|
|
121
|
+
)
|
|
122
|
+
def get_books_and_coffe_2() -> spec.BarChart:
|
|
123
|
+
return {
|
|
124
|
+
"data": WEEKDAYS,
|
|
125
|
+
"color": "amber",
|
|
126
|
+
"icon": "a-arrow-up",
|
|
127
|
+
"config": {
|
|
128
|
+
"books": {"name": "Books", "color": "violet", "icon": "book-open"},
|
|
129
|
+
"coffe": {"name": "Coffee", "color": "amber", "icon": "coffee"},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
@@ -67,7 +67,7 @@ class AdminPage:
|
|
|
67
67
|
)
|
|
68
68
|
elif isinstance(item, Table):
|
|
69
69
|
components.append(
|
|
70
|
-
spec.
|
|
70
|
+
spec.TableComponent(
|
|
71
71
|
type="table",
|
|
72
72
|
id=item.id,
|
|
73
73
|
name=item.name,
|
|
@@ -77,6 +77,9 @@ class AdminPage:
|
|
|
77
77
|
query=query,
|
|
78
78
|
body=body,
|
|
79
79
|
form=form,
|
|
80
|
+
is_hidden=item.is_hidden,
|
|
81
|
+
icon=item.icon,
|
|
82
|
+
color=item.color,
|
|
80
83
|
)
|
|
81
84
|
)
|
|
82
85
|
elif isinstance(item, AreaChart):
|
|
@@ -93,7 +96,7 @@ class AdminPage:
|
|
|
93
96
|
)
|
|
94
97
|
elif isinstance(item, BarChart):
|
|
95
98
|
components.append(
|
|
96
|
-
spec.
|
|
99
|
+
spec.BarChartComponent(
|
|
97
100
|
type="bar-chart",
|
|
98
101
|
id=item.id,
|
|
99
102
|
name=item.name,
|
|
@@ -101,6 +104,13 @@ class AdminPage:
|
|
|
101
104
|
method=item.method,
|
|
102
105
|
url=url,
|
|
103
106
|
query=query,
|
|
107
|
+
icon=item.icon,
|
|
108
|
+
caption=item.caption,
|
|
109
|
+
caption_icon=item.caption_icon,
|
|
110
|
+
caption_description=item.caption_description,
|
|
111
|
+
color=item.color,
|
|
112
|
+
config=item.config,
|
|
113
|
+
data_key=item.data_key,
|
|
104
114
|
)
|
|
105
115
|
)
|
|
106
116
|
elif isinstance(item, LineChart):
|
|
@@ -210,6 +220,9 @@ class AdminPage:
|
|
|
210
220
|
name: str,
|
|
211
221
|
*,
|
|
212
222
|
description: str | None = None,
|
|
223
|
+
is_hidden: bool = False,
|
|
224
|
+
icon: spec.Icon | None = None,
|
|
225
|
+
color: spec.Color | None = None,
|
|
213
226
|
):
|
|
214
227
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
215
228
|
|
|
@@ -219,6 +232,9 @@ class AdminPage:
|
|
|
219
232
|
name=name,
|
|
220
233
|
description=description,
|
|
221
234
|
id=kebab_name,
|
|
235
|
+
is_hidden=is_hidden,
|
|
236
|
+
icon=icon,
|
|
237
|
+
color=color,
|
|
222
238
|
)
|
|
223
239
|
self.state.append(item)
|
|
224
240
|
return self._wrap_user_handler(
|
|
@@ -534,6 +550,13 @@ class AdminPage:
|
|
|
534
550
|
name: str,
|
|
535
551
|
*,
|
|
536
552
|
description: str | None = None,
|
|
553
|
+
icon: spec.Icon | None = None,
|
|
554
|
+
color: spec.Color | None = None,
|
|
555
|
+
caption: str | None = None,
|
|
556
|
+
caption_description: str | None = None,
|
|
557
|
+
caption_icon: spec.Icon | None = None,
|
|
558
|
+
config: dict[str, spec.BarChartConfigValue] | None = None,
|
|
559
|
+
data_key: str | None = None,
|
|
537
560
|
):
|
|
538
561
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
539
562
|
|
|
@@ -543,6 +566,13 @@ class AdminPage:
|
|
|
543
566
|
name=name,
|
|
544
567
|
description=description,
|
|
545
568
|
id=kebab_name,
|
|
569
|
+
icon=icon,
|
|
570
|
+
color=color,
|
|
571
|
+
caption_description=caption_description,
|
|
572
|
+
caption=caption,
|
|
573
|
+
caption_icon=caption_icon,
|
|
574
|
+
config=config,
|
|
575
|
+
data_key=data_key,
|
|
546
576
|
)
|
|
547
577
|
self.state.append(item)
|
|
548
578
|
return self._wrap_user_handler(
|
|
@@ -14,5 +14,12 @@ class BarChart:
|
|
|
14
14
|
id: str
|
|
15
15
|
name: str
|
|
16
16
|
description: str | None
|
|
17
|
+
config: dict[str, spec.BarChartConfigValue] | None
|
|
18
|
+
data_key: str | None
|
|
19
|
+
icon: spec.Icon | None
|
|
20
|
+
color: spec.Color | None
|
|
21
|
+
caption: str | None
|
|
22
|
+
caption_description: str | None
|
|
23
|
+
caption_icon: spec.Icon | None
|
|
17
24
|
method: spec.HttpMethod
|
|
18
25
|
func: Callable | None = field(default=None)
|
|
@@ -4,7 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
from .action import Action
|
|
6
6
|
from .area_chart import AreaChart
|
|
7
|
-
from .bar_chart import
|
|
7
|
+
from .bar_chart import (
|
|
8
|
+
BarChart,
|
|
9
|
+
BarChartComponent,
|
|
10
|
+
BarChartConfigValue,
|
|
11
|
+
BarChartData,
|
|
12
|
+
BarChartResponce,
|
|
13
|
+
)
|
|
8
14
|
from .colors import COLORS, Color
|
|
9
15
|
from .component import Component
|
|
10
16
|
from .form import Form
|
|
@@ -25,13 +31,17 @@ from .property_type import PropertyType
|
|
|
25
31
|
from .section import Section
|
|
26
32
|
from .spec import Spec
|
|
27
33
|
from .stat import Stat, StatComponent, StatResponse, StatValue
|
|
28
|
-
from .table import Table
|
|
34
|
+
from .table import Table, TableComponent, TableData, TableResponse
|
|
29
35
|
|
|
30
36
|
__all__ = [
|
|
31
37
|
"COLORS",
|
|
32
38
|
"Action",
|
|
33
39
|
"AreaChart",
|
|
34
40
|
"BarChart",
|
|
41
|
+
"BarChartComponent",
|
|
42
|
+
"BarChartConfigValue",
|
|
43
|
+
"BarChartData",
|
|
44
|
+
"BarChartResponce",
|
|
35
45
|
"Color",
|
|
36
46
|
"Component",
|
|
37
47
|
"Form",
|
|
@@ -54,4 +64,7 @@ __all__ = [
|
|
|
54
64
|
"StatResponse",
|
|
55
65
|
"StatValue",
|
|
56
66
|
"Table",
|
|
67
|
+
"TableComponent",
|
|
68
|
+
"TableData",
|
|
69
|
+
"TableResponse",
|
|
57
70
|
]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 OpenAdmin
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
from typing import Literal, NotRequired, TypedDict
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field
|
|
8
|
+
|
|
9
|
+
from .colors import Color
|
|
10
|
+
from .http_methods import HttpMethod
|
|
11
|
+
from .icons import Icon
|
|
12
|
+
from .property import Property
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BarChartConfigValue(TypedDict):
|
|
16
|
+
name: NotRequired[str]
|
|
17
|
+
color: NotRequired[Color]
|
|
18
|
+
icon: NotRequired[Icon]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class BarChartComponent(BaseModel):
|
|
22
|
+
type: Literal["bar-chart"]
|
|
23
|
+
id: str
|
|
24
|
+
name: str
|
|
25
|
+
description: str | None
|
|
26
|
+
config: dict[str, BarChartConfigValue] | None
|
|
27
|
+
data_key: str | None
|
|
28
|
+
icon: Icon | None
|
|
29
|
+
color: Color | None
|
|
30
|
+
caption: str | None
|
|
31
|
+
caption_description: str | None
|
|
32
|
+
caption_icon: Icon | None
|
|
33
|
+
url: str
|
|
34
|
+
method: HttpMethod
|
|
35
|
+
query: list[Property] | None = Field(None)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
type BarChartData = (
|
|
39
|
+
list[dict[str, int | float | str]]
|
|
40
|
+
| list[dict[Literal["data", "value"], int | float | str]]
|
|
41
|
+
| object
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class BarChartResponce(TypedDict):
|
|
46
|
+
config: NotRequired[dict[str, BarChartConfigValue]]
|
|
47
|
+
icon: NotRequired[Icon]
|
|
48
|
+
color: NotRequired[Color]
|
|
49
|
+
data: BarChartData
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
type BarChart = BarChartData | BarChartResponce
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
|
|
6
6
|
from .action import Action
|
|
7
7
|
from .area_chart import AreaChart
|
|
8
|
-
from .bar_chart import
|
|
8
|
+
from .bar_chart import BarChartComponent
|
|
9
9
|
from .form import Form
|
|
10
10
|
from .line_chart import LineChart
|
|
11
11
|
from .markdown import Markdown
|
|
12
12
|
from .pie_chart import PieChartComponent
|
|
13
13
|
from .stat import StatComponent
|
|
14
|
-
from .table import
|
|
14
|
+
from .table import TableComponent
|
|
15
15
|
|
|
16
16
|
type Component = (
|
|
17
17
|
StatComponent
|
|
18
|
-
|
|
|
18
|
+
| TableComponent
|
|
19
19
|
| AreaChart
|
|
20
|
-
|
|
|
20
|
+
| BarChartComponent
|
|
21
21
|
| LineChart
|
|
22
22
|
| PieChartComponent
|
|
23
23
|
| Action
|
|
@@ -2,21 +2,40 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
from typing import Literal
|
|
5
|
+
from typing import Literal, NotRequired, TypedDict
|
|
6
6
|
|
|
7
7
|
from pydantic import BaseModel, Field
|
|
8
8
|
|
|
9
|
+
from .colors import Color
|
|
9
10
|
from .http_methods import HttpMethod
|
|
11
|
+
from .icons import Icon
|
|
10
12
|
from .property import Property
|
|
11
13
|
|
|
12
14
|
|
|
13
|
-
class
|
|
15
|
+
class TableComponent(BaseModel):
|
|
14
16
|
type: Literal["table"]
|
|
15
17
|
id: str
|
|
16
18
|
name: str
|
|
17
19
|
description: str | None
|
|
18
20
|
url: str
|
|
21
|
+
icon: Icon | None
|
|
22
|
+
color: Color | None
|
|
19
23
|
method: HttpMethod
|
|
24
|
+
is_hidden: bool
|
|
20
25
|
form: list[Property] | None = Field(None)
|
|
21
26
|
body: list[Property] | None = Field(None)
|
|
22
27
|
query: list[Property] | None = Field(None)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
type TableData = (
|
|
31
|
+
list[dict[str | Literal["__view__"], str | int | float | bool]] | object
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class TableResponse(TypedDict):
|
|
36
|
+
data: TableData
|
|
37
|
+
icon: NotRequired[Icon]
|
|
38
|
+
color: NotRequired[Color]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
type Table = TableData | TableResponse
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: 2026 OpenAdmin
|
|
2
|
-
#
|
|
3
|
-
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
-
|
|
5
|
-
from typing import Literal
|
|
6
|
-
|
|
7
|
-
from pydantic import BaseModel, Field
|
|
8
|
-
|
|
9
|
-
from .http_methods import HttpMethod
|
|
10
|
-
from .property import Property
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class BarChart(BaseModel):
|
|
14
|
-
type: Literal["bar-chart"]
|
|
15
|
-
id: str
|
|
16
|
-
name: str
|
|
17
|
-
description: str | None
|
|
18
|
-
url: str
|
|
19
|
-
method: HttpMethod
|
|
20
|
-
query: list[Property] | None = Field(None)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|