openadmin-dev 0.6.1__tar.gz → 0.6.3__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.6.1 → openadmin_dev-0.6.3}/PKG-INFO +1 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/authors.py +3 -2
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/admin_page.py +19 -19
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/form.py +1 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/__init__.py +3 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/form.py +1 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/stat.py +10 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/pyproject.toml +1 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/uv.lock +1 -1
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/ISSUE_TEMPLATE/bug.md +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/ISSUE_TEMPLATE/chore.md +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/ISSUE_TEMPLATE/feature.md +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/branch-name/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/dependency-cves/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/format/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/license/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/lint/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/security/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/spell-check/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/test/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/typecheck/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/actions/unused-code/action.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/workflows/ci.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.github/workflows/publish.yml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.gitignore +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/.python-version +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/LICENSE +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/LICENSES/AGPL-3.0-or-later.txt +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/Makefile +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/README.md +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/REUSE.toml +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/docs/assets/logo.png +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/__init__.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/__init__.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/analytics.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/books.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/genres.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/health.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/overview.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/publishers.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/reports.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/admin/tags.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/lib/__init__.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/lib/database.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/lib/lifespan.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/lib/models.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/lib/seed.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/examples/main.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/__init__.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/action.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/admin_panel.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/area_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/bar_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/component.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/counters.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/deps.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/line_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/markdown.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/page_protocol.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/pagination_params.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/pie_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/section.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/stat.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/table.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/fastapi/utils.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/action.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/area_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/bar_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/component.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/http_methods.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/icons.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/line_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/markdown.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/page.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/pie_chart.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/property.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/property_type.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/section.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/spec.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/openadmin/spec/table.py +0 -0
- {openadmin_dev-0.6.1 → openadmin_dev-0.6.3}/tests/test_hello.py +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
from pydantic import BaseModel
|
|
6
6
|
from sqlalchemy import func, select
|
|
7
7
|
|
|
8
|
+
from openadmin import spec
|
|
8
9
|
from openadmin.fastapi import AdminPage
|
|
9
10
|
from openadmin.fastapi.deps import PageDep, SearchQueryDep
|
|
10
11
|
|
|
@@ -19,9 +20,9 @@ page = AdminPage(
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
@page.stat("Total Authors")
|
|
22
|
-
async def get_total_authors(session: AsyncSessionDep) ->
|
|
23
|
+
async def get_total_authors(session: AsyncSessionDep) -> spec.StatResponse:
|
|
23
24
|
result = await session.execute(select(func.count(models.Author.id)))
|
|
24
|
-
return result.scalar_one()
|
|
25
|
+
return {"value": result.scalar_one(), "icon": "sun"}
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
@page.stat("Authors with Bio")
|
|
@@ -149,7 +149,7 @@ class AdminPage:
|
|
|
149
149
|
description=item.description,
|
|
150
150
|
method=item.method,
|
|
151
151
|
url=url,
|
|
152
|
-
|
|
152
|
+
is_hidden=item.is_hidden,
|
|
153
153
|
query=query,
|
|
154
154
|
body=body,
|
|
155
155
|
form=form,
|
|
@@ -272,7 +272,7 @@ class AdminPage:
|
|
|
272
272
|
name: str,
|
|
273
273
|
*,
|
|
274
274
|
description: str | None = None,
|
|
275
|
-
|
|
275
|
+
is_hidden: bool = False,
|
|
276
276
|
):
|
|
277
277
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
278
278
|
|
|
@@ -281,7 +281,7 @@ class AdminPage:
|
|
|
281
281
|
method="post",
|
|
282
282
|
name=name,
|
|
283
283
|
description=description,
|
|
284
|
-
is_hidden=
|
|
284
|
+
is_hidden=is_hidden,
|
|
285
285
|
id=kebab_name,
|
|
286
286
|
)
|
|
287
287
|
self.state.append(item)
|
|
@@ -297,7 +297,7 @@ class AdminPage:
|
|
|
297
297
|
name: str,
|
|
298
298
|
*,
|
|
299
299
|
description: str | None = None,
|
|
300
|
-
|
|
300
|
+
is_hidden: bool = False,
|
|
301
301
|
):
|
|
302
302
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
303
303
|
|
|
@@ -306,7 +306,7 @@ class AdminPage:
|
|
|
306
306
|
method="get",
|
|
307
307
|
name=name,
|
|
308
308
|
description=description,
|
|
309
|
-
is_hidden=
|
|
309
|
+
is_hidden=is_hidden,
|
|
310
310
|
id=kebab_name,
|
|
311
311
|
)
|
|
312
312
|
self.state.append(item)
|
|
@@ -322,7 +322,7 @@ class AdminPage:
|
|
|
322
322
|
name: str,
|
|
323
323
|
*,
|
|
324
324
|
description: str | None = None,
|
|
325
|
-
|
|
325
|
+
is_hidden: bool = False,
|
|
326
326
|
):
|
|
327
327
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
328
328
|
|
|
@@ -331,7 +331,7 @@ class AdminPage:
|
|
|
331
331
|
method="put",
|
|
332
332
|
name=name,
|
|
333
333
|
description=description,
|
|
334
|
-
is_hidden=
|
|
334
|
+
is_hidden=is_hidden,
|
|
335
335
|
id=kebab_name,
|
|
336
336
|
)
|
|
337
337
|
self.state.append(item)
|
|
@@ -347,7 +347,7 @@ class AdminPage:
|
|
|
347
347
|
name: str,
|
|
348
348
|
*,
|
|
349
349
|
description: str | None = None,
|
|
350
|
-
|
|
350
|
+
is_hidden: bool = False,
|
|
351
351
|
):
|
|
352
352
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
353
353
|
|
|
@@ -356,7 +356,7 @@ class AdminPage:
|
|
|
356
356
|
method="patch",
|
|
357
357
|
name=name,
|
|
358
358
|
description=description,
|
|
359
|
-
is_hidden=
|
|
359
|
+
is_hidden=is_hidden,
|
|
360
360
|
id=kebab_name,
|
|
361
361
|
)
|
|
362
362
|
self.state.append(item)
|
|
@@ -372,7 +372,7 @@ class AdminPage:
|
|
|
372
372
|
name: str,
|
|
373
373
|
*,
|
|
374
374
|
description: str | None = None,
|
|
375
|
-
|
|
375
|
+
is_hidden: bool = False,
|
|
376
376
|
):
|
|
377
377
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
378
378
|
|
|
@@ -381,7 +381,7 @@ class AdminPage:
|
|
|
381
381
|
method="delete",
|
|
382
382
|
name=name,
|
|
383
383
|
description=description,
|
|
384
|
-
is_hidden=
|
|
384
|
+
is_hidden=is_hidden,
|
|
385
385
|
id=kebab_name,
|
|
386
386
|
)
|
|
387
387
|
self.state.append(item)
|
|
@@ -397,7 +397,7 @@ class AdminPage:
|
|
|
397
397
|
name: str,
|
|
398
398
|
*,
|
|
399
399
|
description: str | None = None,
|
|
400
|
-
|
|
400
|
+
is_hidden: bool = False,
|
|
401
401
|
):
|
|
402
402
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
403
403
|
|
|
@@ -406,7 +406,7 @@ class AdminPage:
|
|
|
406
406
|
method="post",
|
|
407
407
|
name=name,
|
|
408
408
|
description=description,
|
|
409
|
-
|
|
409
|
+
is_hidden=is_hidden,
|
|
410
410
|
id=kebab_name,
|
|
411
411
|
)
|
|
412
412
|
self.state.append(item)
|
|
@@ -422,7 +422,7 @@ class AdminPage:
|
|
|
422
422
|
name: str,
|
|
423
423
|
*,
|
|
424
424
|
description: str | None = None,
|
|
425
|
-
|
|
425
|
+
is_hidden: bool = False,
|
|
426
426
|
):
|
|
427
427
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
428
428
|
|
|
@@ -431,7 +431,7 @@ class AdminPage:
|
|
|
431
431
|
method="put",
|
|
432
432
|
name=name,
|
|
433
433
|
description=description,
|
|
434
|
-
|
|
434
|
+
is_hidden=is_hidden,
|
|
435
435
|
id=kebab_name,
|
|
436
436
|
)
|
|
437
437
|
self.state.append(item)
|
|
@@ -447,7 +447,7 @@ class AdminPage:
|
|
|
447
447
|
name: str,
|
|
448
448
|
*,
|
|
449
449
|
description: str | None = None,
|
|
450
|
-
|
|
450
|
+
is_hidden: bool = False,
|
|
451
451
|
):
|
|
452
452
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
453
453
|
|
|
@@ -456,7 +456,7 @@ class AdminPage:
|
|
|
456
456
|
method="patch",
|
|
457
457
|
name=name,
|
|
458
458
|
description=description,
|
|
459
|
-
|
|
459
|
+
is_hidden=is_hidden,
|
|
460
460
|
id=kebab_name,
|
|
461
461
|
)
|
|
462
462
|
self.state.append(item)
|
|
@@ -472,7 +472,7 @@ class AdminPage:
|
|
|
472
472
|
name: str,
|
|
473
473
|
*,
|
|
474
474
|
description: str | None = None,
|
|
475
|
-
|
|
475
|
+
is_hidden: bool = False,
|
|
476
476
|
):
|
|
477
477
|
kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
|
|
478
478
|
|
|
@@ -481,7 +481,7 @@ class AdminPage:
|
|
|
481
481
|
method="delete",
|
|
482
482
|
name=name,
|
|
483
483
|
description=description,
|
|
484
|
-
|
|
484
|
+
is_hidden=is_hidden,
|
|
485
485
|
id=kebab_name,
|
|
486
486
|
)
|
|
487
487
|
self.state.append(item)
|
|
@@ -17,7 +17,7 @@ from .property import Property
|
|
|
17
17
|
from .property_type import PropertyType
|
|
18
18
|
from .section import Section
|
|
19
19
|
from .spec import Spec
|
|
20
|
-
from .stat import Stat
|
|
20
|
+
from .stat import Stat, StatResponse, StatValue
|
|
21
21
|
from .table import Table
|
|
22
22
|
|
|
23
23
|
__all__ = [
|
|
@@ -38,4 +38,6 @@ __all__ = [
|
|
|
38
38
|
"Table",
|
|
39
39
|
"Markdown",
|
|
40
40
|
"Icon",
|
|
41
|
+
"StatResponse",
|
|
42
|
+
"StatValue",
|
|
41
43
|
]
|
|
@@ -2,11 +2,12 @@
|
|
|
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
9
|
from .http_methods import HttpMethod
|
|
10
|
+
from .icons import Icon
|
|
10
11
|
from .property import Property
|
|
11
12
|
|
|
12
13
|
|
|
@@ -18,3 +19,11 @@ class Stat(BaseModel):
|
|
|
18
19
|
url: str
|
|
19
20
|
method: HttpMethod
|
|
20
21
|
query: list[Property] | None = Field(None)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
type StatValue = str | int | float | bool | None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class StatResponse(TypedDict):
|
|
28
|
+
value: StatValue
|
|
29
|
+
icon: NotRequired[Icon]
|
|
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
|
|
File without changes
|