openadmin-dev 0.7.4__tar.gz → 0.7.6__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.6}/PKG-INFO +1 -1
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/genres.py +13 -2
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/weekdays.py +52 -8
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/admin_page.py +39 -3
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/bar_chart.py +7 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/markdown.py +2 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/table.py +3 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/__init__.py +19 -3
- openadmin_dev-0.7.6/openadmin/spec/bar_chart.py +52 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/component.py +6 -6
- openadmin_dev-0.7.6/openadmin/spec/markdown.py +36 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/table.py +21 -2
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/pyproject.toml +1 -1
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/uv.lock +1 -1
- openadmin_dev-0.7.4/openadmin/spec/bar_chart.py +0 -20
- openadmin_dev-0.7.4/openadmin/spec/markdown.py +0 -20
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/ISSUE_TEMPLATE/chore.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/ISSUE_TEMPLATE/feature.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/branch-name/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/dependency-cves/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/format/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/license/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/lint/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/security/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/spell-check/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/test/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/typecheck/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/actions/unused-code/action.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/workflows/ci.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.github/workflows/publish.yml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.gitignore +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/.python-version +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/LICENSE +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/LICENSES/AGPL-3.0-or-later.txt +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/Makefile +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/README.md +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/REUSE.toml +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/docs/assets/logo.png +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/analytics.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/authors.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/books.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/health.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/overview.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/publishers.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/reports.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/admin/tags.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/lib/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/lib/database.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/lib/lifespan.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/lib/models.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/lib/seed.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/examples/main.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/__init__.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/action.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/admin_panel.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/area_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/component.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/counters.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/deps.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/form.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/line_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/page_protocol.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/pagination_params.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/pie_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/section.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/stat.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/fastapi/utils.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/action.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/area_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/colors.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/form.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/http_methods.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/icons.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/line_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/page.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/pie_chart.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/property.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/property_type.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/section.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/spec.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/openadmin/spec/stat.py +0 -0
- {openadmin_dev-0.7.4 → openadmin_dev-0.7.6}/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):
|
|
@@ -167,10 +177,12 @@ class AdminPage:
|
|
|
167
177
|
)
|
|
168
178
|
elif isinstance(item, Markdown):
|
|
169
179
|
components.append(
|
|
170
|
-
spec.
|
|
180
|
+
spec.MarkdownComponent(
|
|
171
181
|
type="markdown",
|
|
172
182
|
id=item.id,
|
|
173
183
|
name=item.name,
|
|
184
|
+
icon=item.icon,
|
|
185
|
+
color=item.color,
|
|
174
186
|
description=item.description,
|
|
175
187
|
method=item.method,
|
|
176
188
|
url=url,
|
|
@@ -210,6 +222,9 @@ class AdminPage:
|
|
|
210
222
|
name: str,
|
|
211
223
|
*,
|
|
212
224
|
description: str | None = None,
|
|
225
|
+
is_hidden: bool = False,
|
|
226
|
+
icon: spec.Icon | None = None,
|
|
227
|
+
color: spec.Color | None = None,
|
|
213
228
|
):
|
|
214
229
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
215
230
|
|
|
@@ -219,6 +234,9 @@ class AdminPage:
|
|
|
219
234
|
name=name,
|
|
220
235
|
description=description,
|
|
221
236
|
id=kebab_name,
|
|
237
|
+
is_hidden=is_hidden,
|
|
238
|
+
icon=icon,
|
|
239
|
+
color=color,
|
|
222
240
|
)
|
|
223
241
|
self.state.append(item)
|
|
224
242
|
return self._wrap_user_handler(
|
|
@@ -260,6 +278,8 @@ class AdminPage:
|
|
|
260
278
|
name: str,
|
|
261
279
|
*,
|
|
262
280
|
description: str | None = None,
|
|
281
|
+
color: spec.Color | None = None,
|
|
282
|
+
icon: spec.Icon | None = None,
|
|
263
283
|
):
|
|
264
284
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
265
285
|
|
|
@@ -269,6 +289,8 @@ class AdminPage:
|
|
|
269
289
|
name=name,
|
|
270
290
|
description=description,
|
|
271
291
|
id=kebab_name,
|
|
292
|
+
icon=icon,
|
|
293
|
+
color=color,
|
|
272
294
|
)
|
|
273
295
|
self.state.append(item)
|
|
274
296
|
|
|
@@ -534,6 +556,13 @@ class AdminPage:
|
|
|
534
556
|
name: str,
|
|
535
557
|
*,
|
|
536
558
|
description: str | None = None,
|
|
559
|
+
icon: spec.Icon | None = None,
|
|
560
|
+
color: spec.Color | None = None,
|
|
561
|
+
caption: str | None = None,
|
|
562
|
+
caption_description: str | None = None,
|
|
563
|
+
caption_icon: spec.Icon | None = None,
|
|
564
|
+
config: dict[str, spec.BarChartConfigValue] | None = None,
|
|
565
|
+
data_key: str | None = None,
|
|
537
566
|
):
|
|
538
567
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
539
568
|
|
|
@@ -543,6 +572,13 @@ class AdminPage:
|
|
|
543
572
|
name=name,
|
|
544
573
|
description=description,
|
|
545
574
|
id=kebab_name,
|
|
575
|
+
icon=icon,
|
|
576
|
+
color=color,
|
|
577
|
+
caption_description=caption_description,
|
|
578
|
+
caption=caption,
|
|
579
|
+
caption_icon=caption_icon,
|
|
580
|
+
config=config,
|
|
581
|
+
data_key=data_key,
|
|
546
582
|
)
|
|
547
583
|
self.state.append(item)
|
|
548
584
|
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,14 +4,20 @@
|
|
|
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
|
|
11
17
|
from .http_methods import HttpMethod
|
|
12
18
|
from .icons import Icon
|
|
13
19
|
from .line_chart import LineChart
|
|
14
|
-
from .markdown import Markdown
|
|
20
|
+
from .markdown import Markdown, MarkdownComponent, MarkdownContent, MarkdownResponse
|
|
15
21
|
from .page import Page
|
|
16
22
|
from .pie_chart import (
|
|
17
23
|
PieChart,
|
|
@@ -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",
|
|
@@ -39,6 +49,9 @@ __all__ = [
|
|
|
39
49
|
"Icon",
|
|
40
50
|
"LineChart",
|
|
41
51
|
"Markdown",
|
|
52
|
+
"MarkdownComponent",
|
|
53
|
+
"MarkdownContent",
|
|
54
|
+
"MarkdownResponse",
|
|
42
55
|
"Page",
|
|
43
56
|
"PieChart",
|
|
44
57
|
"PieChartComponent",
|
|
@@ -54,4 +67,7 @@ __all__ = [
|
|
|
54
67
|
"StatResponse",
|
|
55
68
|
"StatValue",
|
|
56
69
|
"Table",
|
|
70
|
+
"TableComponent",
|
|
71
|
+
"TableData",
|
|
72
|
+
"TableResponse",
|
|
57
73
|
]
|
|
@@ -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,22 +5,22 @@
|
|
|
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
|
-
from .markdown import
|
|
11
|
+
from .markdown import MarkdownComponent
|
|
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
|
|
24
24
|
| Form
|
|
25
|
-
|
|
|
25
|
+
| MarkdownComponent
|
|
26
26
|
)
|
|
@@ -0,0 +1,36 @@
|
|
|
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 MarkdownComponent(BaseModel):
|
|
16
|
+
type: Literal["markdown"]
|
|
17
|
+
id: str
|
|
18
|
+
name: str
|
|
19
|
+
description: str | None
|
|
20
|
+
color: Color | None
|
|
21
|
+
icon: Icon | None
|
|
22
|
+
url: str
|
|
23
|
+
method: HttpMethod
|
|
24
|
+
query: list[Property] | None = Field(None)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
type MarkdownContent = str
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class MarkdownResponse(TypedDict):
|
|
31
|
+
icon: NotRequired[Icon]
|
|
32
|
+
color: NotRequired[Color]
|
|
33
|
+
content: MarkdownContent
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
type Markdown = MarkdownContent | MarkdownResponse
|
|
@@ -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)
|
|
@@ -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 Markdown(BaseModel):
|
|
14
|
-
type: Literal["markdown"]
|
|
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
|