openadmin-dev 0.6.0__tar.gz → 0.6.2__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.
Files changed (82) hide show
  1. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/PKG-INFO +1 -1
  2. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/analytics.py +3 -1
  3. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/authors.py +3 -1
  4. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/books.py +1 -1
  5. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/genres.py +3 -1
  6. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/health.py +3 -1
  7. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/overview.py +5 -1
  8. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/publishers.py +5 -1
  9. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/reports.py +3 -1
  10. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/tags.py +1 -1
  11. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/main.py +9 -3
  12. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/action.py +1 -0
  13. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/admin_page.py +106 -53
  14. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/admin_panel.py +3 -3
  15. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/area_chart.py +1 -0
  16. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/bar_chart.py +1 -0
  17. openadmin_dev-0.6.0/openadmin/fastapi/types/__init__.py → openadmin_dev-0.6.2/openadmin/fastapi/component.py +0 -19
  18. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/deps.py +1 -1
  19. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/form.py +2 -1
  20. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/line_chart.py +1 -0
  21. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/markdown.py +1 -0
  22. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/pie_chart.py +1 -0
  23. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/stat.py +1 -0
  24. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/table.py +1 -0
  25. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/__init__.py +14 -10
  26. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/action.py +1 -0
  27. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/area_chart.py +1 -0
  28. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/bar_chart.py +1 -0
  29. openadmin_dev-0.6.2/openadmin/spec/component.py +19 -0
  30. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/form.py +2 -1
  31. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/line_chart.py +1 -0
  32. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/markdown.py +1 -0
  33. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/spec/page.py +2 -1
  34. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/pie_chart.py +1 -0
  35. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/spec/section.py +1 -1
  36. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/stat.py +1 -0
  37. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/table.py +1 -0
  38. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/pyproject.toml +1 -1
  39. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/uv.lock +1 -1
  40. openadmin_dev-0.6.0/openadmin/spec/__init__.py +0 -43
  41. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/ISSUE_TEMPLATE/bug.md +0 -0
  42. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/ISSUE_TEMPLATE/chore.md +0 -0
  43. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/ISSUE_TEMPLATE/feature.md +0 -0
  44. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/branch-name/action.yml +0 -0
  45. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/dependency-cves/action.yml +0 -0
  46. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/format/action.yml +0 -0
  47. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/license/action.yml +0 -0
  48. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/lint/action.yml +0 -0
  49. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/security/action.yml +0 -0
  50. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/spell-check/action.yml +0 -0
  51. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/test/action.yml +0 -0
  52. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/typecheck/action.yml +0 -0
  53. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/actions/unused-code/action.yml +0 -0
  54. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/workflows/ci.yml +0 -0
  55. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.github/workflows/publish.yml +0 -0
  56. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.gitignore +0 -0
  57. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/.python-version +0 -0
  58. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/LICENSE +0 -0
  59. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/LICENSES/AGPL-3.0-or-later.txt +0 -0
  60. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/Makefile +0 -0
  61. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/README.md +0 -0
  62. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/REUSE.toml +0 -0
  63. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/docs/assets/logo.png +0 -0
  64. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/__init__.py +0 -0
  65. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/admin/__init__.py +0 -0
  66. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/lib/__init__.py +0 -0
  67. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/lib/database.py +0 -0
  68. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/lib/lifespan.py +0 -0
  69. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/lib/models.py +0 -0
  70. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/examples/lib/seed.py +0 -0
  71. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/__init__.py +0 -0
  72. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/counters.py +0 -0
  73. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/page_protocol.py +0 -0
  74. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/pagination_params.py +0 -0
  75. {openadmin_dev-0.6.0/openadmin/fastapi/types → openadmin_dev-0.6.2/openadmin/fastapi}/section.py +0 -0
  76. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/fastapi/utils.py +0 -0
  77. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/http_methods.py +0 -0
  78. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/icons.py +0 -0
  79. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/property.py +0 -0
  80. {openadmin_dev-0.6.0/openadmin/spec/components → openadmin_dev-0.6.2/openadmin/spec}/property_type.py +0 -0
  81. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/openadmin/spec/spec.py +0 -0
  82. {openadmin_dev-0.6.0 → openadmin_dev-0.6.2}/tests/test_hello.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openadmin-dev
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Add your description here
5
5
  Project-URL: Homepage, https://github.com/openadmin-team/openadmin-py
6
6
  Project-URL: Issues, https://github.com/openadmin-team/openadmin-py/issues
@@ -10,7 +10,9 @@ from ..lib import models
10
10
  from ..lib.database import AsyncSessionDep
11
11
 
12
12
  page = AdminPage(
13
- "Analytics", description="Library-wide publication trends and insights"
13
+ "Analytics",
14
+ icon="bar-chart",
15
+ description="Library-wide publication trends and insights",
14
16
  )
15
17
 
16
18
 
@@ -12,7 +12,9 @@ from ..lib import models
12
12
  from ..lib.database import AsyncSessionDep
13
13
 
14
14
  page = AdminPage(
15
- "Authors", description="Manage book authors and view productivity stats"
15
+ "Authors",
16
+ icon="users",
17
+ description="Manage book authors and view productivity stats",
16
18
  )
17
19
 
18
20
 
@@ -12,7 +12,7 @@ from openadmin.fastapi.deps import PageDep, SearchQueryDep
12
12
  from ..lib import models
13
13
  from ..lib.database import AsyncSessionDep
14
14
 
15
- page = AdminPage("Books", description="Browse and manage the book catalog")
15
+ page = AdminPage("Books", icon="book", description="Browse and manage the book catalog")
16
16
 
17
17
 
18
18
  @page.stat("Total Books")
@@ -10,7 +10,9 @@ from openadmin.fastapi.deps import PageDep
10
10
  from ..lib import models
11
11
  from ..lib.database import AsyncSessionDep
12
12
 
13
- page = AdminPage("Genres", description="Browse and analyze the genre taxonomy")
13
+ page = AdminPage(
14
+ "Genres", icon="drama", description="Browse and analyze the genre taxonomy"
15
+ )
14
16
 
15
17
 
16
18
  @page.stat("Total Genres")
@@ -4,7 +4,9 @@
4
4
 
5
5
  from openadmin.fastapi import AdminPage
6
6
 
7
- page = AdminPage("Health", description="System health and infrastructure metrics")
7
+ page = AdminPage(
8
+ "Health", icon="heart-pulse", description="System health and infrastructure metrics"
9
+ )
8
10
 
9
11
 
10
12
  @page.stat("API Uptime (%)")
@@ -9,7 +9,11 @@ from openadmin.fastapi import AdminPage
9
9
  from ..lib import models
10
10
  from ..lib.database import AsyncSessionDep
11
11
 
12
- page = AdminPage("Overview", description="High-level database and catalog statistics")
12
+ page = AdminPage(
13
+ "Overview",
14
+ icon="layout-dashboard",
15
+ description="High-level database and catalog statistics",
16
+ )
13
17
 
14
18
 
15
19
  @page.stat("Total Records")
@@ -11,7 +11,11 @@ from openadmin.fastapi.deps import PageDep, SearchQueryDep
11
11
  from ..lib import models
12
12
  from ..lib.database import AsyncSessionDep
13
13
 
14
- page = AdminPage("Publishers", description="Manage publishers and their catalog share")
14
+ page = AdminPage(
15
+ "Publishers",
16
+ icon="building-2",
17
+ description="Manage publishers and their catalog share",
18
+ )
15
19
 
16
20
 
17
21
  @page.stat("Total Publishers")
@@ -11,7 +11,9 @@ from ..lib import models
11
11
  from ..lib.database import AsyncSessionDep
12
12
 
13
13
  page = AdminPage(
14
- "Reports", description="Tag assignment activity and catalog coverage reports"
14
+ "Reports",
15
+ icon="file-text",
16
+ description="Tag assignment activity and catalog coverage reports",
15
17
  )
16
18
 
17
19
 
@@ -11,7 +11,7 @@ from openadmin.fastapi.deps import PageDep
11
11
  from ..lib import models
12
12
  from ..lib.database import AsyncSessionDep
13
13
 
14
- page = AdminPage("Tags", description="Manage and analyze book tags")
14
+ page = AdminPage("Tags", icon="tag", description="Manage and analyze book tags")
15
15
 
16
16
 
17
17
  @page.stat("Total Tags")
@@ -34,8 +34,14 @@ admin_panel = AdminPanel(
34
34
  "Book Library Admin", description="Manage and explore the book catalog"
35
35
  )
36
36
 
37
- admin_panel.section("Library", pages=[books.page, authors.page, publishers.page])
38
- admin_panel.section("Catalog", pages=[genres.page, tags.page, analytics.page])
39
- admin_panel.section("System", pages=[health.page, reports.page, overview.page])
37
+ admin_panel.section(
38
+ "Library", icon="library", pages=[books.page, authors.page, publishers.page]
39
+ )
40
+ admin_panel.section(
41
+ "Catalog", icon="library-big", pages=[genres.page, tags.page, analytics.page]
42
+ )
43
+ admin_panel.section(
44
+ "System", icon="server", pages=[health.page, reports.page, overview.page]
45
+ )
40
46
 
41
47
  admin_panel.mount_to(app)
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class Action:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -9,7 +9,17 @@ from collections.abc import Callable
9
9
  from fastapi import APIRouter, FastAPI
10
10
  from openadmin import spec
11
11
 
12
- from . import counters, types
12
+ from . import counters
13
+ from .action import Action
14
+ from .area_chart import AreaChart
15
+ from .bar_chart import BarChart
16
+ from .component import Component
17
+ from .form import Form
18
+ from .line_chart import LineChart
19
+ from .markdown import Markdown
20
+ from .pie_chart import PieChart
21
+ from .stat import Stat
22
+ from .table import Table
13
23
  from .utils import extract_params
14
24
 
15
25
  _SPECIAL_CHARS_RE = re.compile(r"[^a-zA-Z0-9\s]")
@@ -26,7 +36,7 @@ class AdminPage:
26
36
  self.name = name
27
37
  self.description = description
28
38
  self.icon: spec.Icon | None = icon
29
- self.state: list[types.Component] = []
39
+ self.state: list[Component] = []
30
40
  self.router = APIRouter(prefix=f"/{name.lower().replace(' ', '-')}")
31
41
  self.key_repeat_count: dict[str, int] = {}
32
42
  self.page_count = counters.get_next("page")
@@ -41,10 +51,11 @@ class AdminPage:
41
51
  extract_params(item.func) if item.func else (None, None, None)
42
52
  )
43
53
 
44
- if isinstance(item, types.Stat):
54
+ if isinstance(item, Stat):
45
55
  components.append(
46
56
  spec.Stat(
47
57
  type="stat",
58
+ id=item.id,
48
59
  name=item.name,
49
60
  description=item.description,
50
61
  method=item.method,
@@ -52,10 +63,11 @@ class AdminPage:
52
63
  query=query,
53
64
  )
54
65
  )
55
- elif isinstance(item, types.Table):
66
+ elif isinstance(item, Table):
56
67
  components.append(
57
68
  spec.Table(
58
69
  type="table",
70
+ id=item.id,
59
71
  name=item.name,
60
72
  description=item.description,
61
73
  method=item.method,
@@ -65,10 +77,11 @@ class AdminPage:
65
77
  form=form,
66
78
  )
67
79
  )
68
- elif isinstance(item, types.AreaChart):
80
+ elif isinstance(item, AreaChart):
69
81
  components.append(
70
82
  spec.AreaChart(
71
83
  type="area-chart",
84
+ id=item.id,
72
85
  name=item.name,
73
86
  description=item.description,
74
87
  method=item.method,
@@ -76,10 +89,11 @@ class AdminPage:
76
89
  query=query,
77
90
  )
78
91
  )
79
- elif isinstance(item, types.BarChart):
92
+ elif isinstance(item, BarChart):
80
93
  components.append(
81
94
  spec.BarChart(
82
95
  type="bar-chart",
96
+ id=item.id,
83
97
  name=item.name,
84
98
  description=item.description,
85
99
  method=item.method,
@@ -87,10 +101,11 @@ class AdminPage:
87
101
  query=query,
88
102
  )
89
103
  )
90
- elif isinstance(item, types.LineChart):
104
+ elif isinstance(item, LineChart):
91
105
  components.append(
92
106
  spec.LineChart(
93
107
  type="line-chart",
108
+ id=item.id,
94
109
  name=item.name,
95
110
  description=item.description,
96
111
  method=item.method,
@@ -98,10 +113,11 @@ class AdminPage:
98
113
  query=query,
99
114
  )
100
115
  )
101
- elif isinstance(item, types.PieChart):
116
+ elif isinstance(item, PieChart):
102
117
  components.append(
103
118
  spec.PieChart(
104
119
  type="pie-chart",
120
+ id=item.id,
105
121
  name=item.name,
106
122
  description=item.description,
107
123
  method=item.method,
@@ -109,10 +125,11 @@ class AdminPage:
109
125
  query=query,
110
126
  )
111
127
  )
112
- elif isinstance(item, types.Action):
128
+ elif isinstance(item, Action):
113
129
  components.append(
114
130
  spec.Action(
115
131
  type="action",
132
+ id=item.id,
116
133
  name=item.name,
117
134
  description=item.description,
118
135
  method=item.method,
@@ -123,24 +140,26 @@ class AdminPage:
123
140
  form=form,
124
141
  )
125
142
  )
126
- elif isinstance(item, types.Form):
143
+ elif isinstance(item, Form):
127
144
  components.append(
128
145
  spec.Form(
129
146
  type="form",
147
+ id=item.id,
130
148
  name=item.name,
131
149
  description=item.description,
132
150
  method=item.method,
133
151
  url=url,
134
- is_hiden=item.is_hiden,
152
+ is_hidden=item.is_hidden,
135
153
  query=query,
136
154
  body=body,
137
155
  form=form,
138
156
  )
139
157
  )
140
- elif isinstance(item, types.Markdown):
158
+ elif isinstance(item, Markdown):
141
159
  components.append(
142
160
  spec.Markdown(
143
161
  type="markdown",
162
+ id=item.id,
144
163
  name=item.name,
145
164
  description=item.description,
146
165
  method=item.method,
@@ -157,7 +176,7 @@ class AdminPage:
157
176
  components=components,
158
177
  )
159
178
 
160
- def _wrap_user_handler(self, item: types.Component, fastapi_decorator) -> Callable:
179
+ def _wrap_user_handler(self, item: Component, fastapi_decorator) -> Callable:
161
180
  def decorator(func: Callable) -> Callable:
162
181
  item.func = func
163
182
  return fastapi_decorator(func)
@@ -184,8 +203,12 @@ class AdminPage:
184
203
  ):
185
204
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
186
205
 
187
- item = types.Table(
188
- function_name=unique_name, method="get", name=name, description=description
206
+ item = Table(
207
+ function_name=unique_name,
208
+ method="get",
209
+ name=name,
210
+ description=description,
211
+ id=kebab_name,
189
212
  )
190
213
  self.state.append(item)
191
214
  return self._wrap_user_handler(
@@ -203,8 +226,12 @@ class AdminPage:
203
226
  ):
204
227
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
205
228
 
206
- item = types.Stat(
207
- function_name=unique_name, method="get", name=name, description=description
229
+ item = Stat(
230
+ function_name=unique_name,
231
+ method="get",
232
+ name=name,
233
+ description=description,
234
+ id=kebab_name,
208
235
  )
209
236
  self.state.append(item)
210
237
  return self._wrap_user_handler(
@@ -222,11 +249,12 @@ class AdminPage:
222
249
  ):
223
250
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
224
251
 
225
- item = types.Markdown(
252
+ item = Markdown(
226
253
  function_name=unique_name,
227
254
  method="get",
228
255
  name=name,
229
256
  description=description,
257
+ id=kebab_name,
230
258
  )
231
259
  self.state.append(item)
232
260
 
@@ -244,16 +272,17 @@ class AdminPage:
244
272
  name: str,
245
273
  *,
246
274
  description: str | None = None,
247
- is_hiden: bool = False,
275
+ is_hidden: bool = False,
248
276
  ):
249
277
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
250
278
 
251
- item = types.Action(
279
+ item = Action(
252
280
  function_name=unique_name,
253
281
  method="post",
254
282
  name=name,
255
283
  description=description,
256
- is_hidden=is_hiden,
284
+ is_hidden=is_hidden,
285
+ id=kebab_name,
257
286
  )
258
287
  self.state.append(item)
259
288
  return self._wrap_user_handler(
@@ -268,16 +297,17 @@ class AdminPage:
268
297
  name: str,
269
298
  *,
270
299
  description: str | None = None,
271
- is_hiden: bool = False,
300
+ is_hidden: bool = False,
272
301
  ):
273
302
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
274
303
 
275
- item = types.Action(
304
+ item = Action(
276
305
  function_name=unique_name,
277
306
  method="get",
278
307
  name=name,
279
308
  description=description,
280
- is_hidden=is_hiden,
309
+ is_hidden=is_hidden,
310
+ id=kebab_name,
281
311
  )
282
312
  self.state.append(item)
283
313
  return self._wrap_user_handler(
@@ -292,16 +322,17 @@ class AdminPage:
292
322
  name: str,
293
323
  *,
294
324
  description: str | None = None,
295
- is_hiden: bool = False,
325
+ is_hidden: bool = False,
296
326
  ):
297
327
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
298
328
 
299
- item = types.Action(
329
+ item = Action(
300
330
  function_name=unique_name,
301
331
  method="put",
302
332
  name=name,
303
333
  description=description,
304
- is_hidden=is_hiden,
334
+ is_hidden=is_hidden,
335
+ id=kebab_name,
305
336
  )
306
337
  self.state.append(item)
307
338
  return self._wrap_user_handler(
@@ -316,16 +347,17 @@ class AdminPage:
316
347
  name: str,
317
348
  *,
318
349
  description: str | None = None,
319
- is_hiden: bool = False,
350
+ is_hidden: bool = False,
320
351
  ):
321
352
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
322
353
 
323
- item = types.Action(
354
+ item = Action(
324
355
  function_name=unique_name,
325
356
  method="patch",
326
357
  name=name,
327
358
  description=description,
328
- is_hidden=is_hiden,
359
+ is_hidden=is_hidden,
360
+ id=kebab_name,
329
361
  )
330
362
  self.state.append(item)
331
363
  return self._wrap_user_handler(
@@ -340,16 +372,17 @@ class AdminPage:
340
372
  name: str,
341
373
  *,
342
374
  description: str | None = None,
343
- is_hiden: bool = False,
375
+ is_hidden: bool = False,
344
376
  ):
345
377
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
346
378
 
347
- item = types.Action(
379
+ item = Action(
348
380
  function_name=unique_name,
349
381
  method="delete",
350
382
  name=name,
351
383
  description=description,
352
- is_hidden=is_hiden,
384
+ is_hidden=is_hidden,
385
+ id=kebab_name,
353
386
  )
354
387
  self.state.append(item)
355
388
  return self._wrap_user_handler(
@@ -364,16 +397,17 @@ class AdminPage:
364
397
  name: str,
365
398
  *,
366
399
  description: str | None = None,
367
- is_hiden: bool = False,
400
+ is_hidden: bool = False,
368
401
  ):
369
402
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
370
403
 
371
- item = types.Form(
404
+ item = Form(
372
405
  function_name=unique_name,
373
406
  method="post",
374
407
  name=name,
375
408
  description=description,
376
- is_hiden=is_hiden,
409
+ is_hidden=is_hidden,
410
+ id=kebab_name,
377
411
  )
378
412
  self.state.append(item)
379
413
  return self._wrap_user_handler(
@@ -388,16 +422,17 @@ class AdminPage:
388
422
  name: str,
389
423
  *,
390
424
  description: str | None = None,
391
- is_hiden: bool = False,
425
+ is_hidden: bool = False,
392
426
  ):
393
427
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
394
428
 
395
- item = types.Form(
429
+ item = Form(
396
430
  function_name=unique_name,
397
431
  method="put",
398
432
  name=name,
399
433
  description=description,
400
- is_hiden=is_hiden,
434
+ is_hidden=is_hidden,
435
+ id=kebab_name,
401
436
  )
402
437
  self.state.append(item)
403
438
  return self._wrap_user_handler(
@@ -412,16 +447,17 @@ class AdminPage:
412
447
  name: str,
413
448
  *,
414
449
  description: str | None = None,
415
- is_hiden: bool = False,
450
+ is_hidden: bool = False,
416
451
  ):
417
452
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
418
453
 
419
- item = types.Form(
454
+ item = Form(
420
455
  function_name=unique_name,
421
456
  method="patch",
422
457
  name=name,
423
458
  description=description,
424
- is_hiden=is_hiden,
459
+ is_hidden=is_hidden,
460
+ id=kebab_name,
425
461
  )
426
462
  self.state.append(item)
427
463
  return self._wrap_user_handler(
@@ -436,16 +472,17 @@ class AdminPage:
436
472
  name: str,
437
473
  *,
438
474
  description: str | None = None,
439
- is_hiden: bool = False,
475
+ is_hidden: bool = False,
440
476
  ):
441
477
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
442
478
 
443
- item = types.Form(
479
+ item = Form(
444
480
  function_name=unique_name,
445
481
  method="delete",
446
482
  name=name,
447
483
  description=description,
448
- is_hiden=is_hiden,
484
+ is_hidden=is_hidden,
485
+ id=kebab_name,
449
486
  )
450
487
  self.state.append(item)
451
488
  return self._wrap_user_handler(
@@ -463,8 +500,12 @@ class AdminPage:
463
500
  ):
464
501
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
465
502
 
466
- item = types.AreaChart(
467
- function_name=unique_name, method="get", name=name, description=description
503
+ item = AreaChart(
504
+ function_name=unique_name,
505
+ method="get",
506
+ name=name,
507
+ description=description,
508
+ id=kebab_name,
468
509
  )
469
510
  self.state.append(item)
470
511
  return self._wrap_user_handler(
@@ -482,8 +523,12 @@ class AdminPage:
482
523
  ):
483
524
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
484
525
 
485
- item = types.BarChart(
486
- function_name=unique_name, method="get", name=name, description=description
526
+ item = BarChart(
527
+ function_name=unique_name,
528
+ method="get",
529
+ name=name,
530
+ description=description,
531
+ id=kebab_name,
487
532
  )
488
533
  self.state.append(item)
489
534
  return self._wrap_user_handler(
@@ -501,8 +546,12 @@ class AdminPage:
501
546
  ):
502
547
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
503
548
 
504
- item = types.LineChart(
505
- function_name=unique_name, method="get", name=name, description=description
549
+ item = LineChart(
550
+ function_name=unique_name,
551
+ method="get",
552
+ name=name,
553
+ description=description,
554
+ id=kebab_name,
506
555
  )
507
556
  self.state.append(item)
508
557
  return self._wrap_user_handler(
@@ -520,8 +569,12 @@ class AdminPage:
520
569
  ):
521
570
  kebab_name, unique_name = self.__get_kebab_and_unique_name(name)
522
571
 
523
- item = types.PieChart(
524
- function_name=unique_name, method="get", name=name, description=description
572
+ item = PieChart(
573
+ function_name=unique_name,
574
+ method="get",
575
+ name=name,
576
+ description=description,
577
+ id=kebab_name,
525
578
  )
526
579
  self.state.append(item)
527
580
  return self._wrap_user_handler(
@@ -7,8 +7,8 @@ from typing import Dict, List
7
7
  from fastapi import FastAPI, HTTPException, status
8
8
  from openadmin import spec
9
9
 
10
- from . import types
11
10
  from .admin_page import AdminPage
11
+ from .section import Section
12
12
 
13
13
 
14
14
  class AdminPanel:
@@ -16,7 +16,7 @@ class AdminPanel:
16
16
  self.version = "1.0.0"
17
17
  self.name = name
18
18
  self.description = description
19
- self.state: List[types.Section] = []
19
+ self.state: List[Section] = []
20
20
  self.app = FastAPI()
21
21
  self.key_repeat_count: Dict[str, int] = {}
22
22
  self.__init_spec_route(self.app)
@@ -61,7 +61,7 @@ class AdminPanel:
61
61
  self.key_repeat_count[kebab_name] = 1
62
62
 
63
63
  self.state.append(
64
- types.Section(
64
+ Section(
65
65
  id=kebab_name,
66
66
  name=name,
67
67
  description=description,
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class AreaChart:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class BarChart:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -10,29 +10,10 @@ from .bar_chart import BarChart
10
10
  from .form import Form
11
11
  from .line_chart import LineChart
12
12
  from .markdown import Markdown
13
- from .page_protocol import PageProtocol
14
- from .pagination_params import PaginationParams
15
13
  from .pie_chart import PieChart
16
- from .section import Section
17
14
  from .stat import Stat
18
15
  from .table import Table
19
16
 
20
17
  type Component = Union[
21
18
  Stat, Table, AreaChart, BarChart, LineChart, PieChart, Action, Form, Markdown
22
19
  ]
23
-
24
- __all__ = [
25
- "PageProtocol",
26
- "Section",
27
- "Stat",
28
- "Table",
29
- "Action",
30
- "AreaChart",
31
- "BarChart",
32
- "Form",
33
- "LineChart",
34
- "PieChart",
35
- "Component",
36
- "Markdown",
37
- "PaginationParams",
38
- ]
@@ -6,7 +6,7 @@ from typing import Annotated
6
6
 
7
7
  from fastapi import Depends, Query
8
8
 
9
- from .types import PaginationParams
9
+ from .pagination_params import PaginationParams
10
10
 
11
11
 
12
12
  def pagination_params(
@@ -11,8 +11,9 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class Form:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
17
- is_hiden: bool
18
+ is_hidden: bool
18
19
  func: Callable | None = field(default=None)
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class LineChart:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class Markdown:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -11,6 +11,7 @@ from openadmin import spec
11
11
  @dataclass
12
12
  class PieChart:
13
13
  function_name: str
14
+ id: str
14
15
  name: str
15
16
  description: str | None
16
17
  method: spec.HttpMethod
@@ -12,6 +12,7 @@ from openadmin import spec
12
12
  class Stat:
13
13
  function_name: str
14
14
  method: spec.HttpMethod
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  func: Callable | None = field(default=None)
@@ -12,6 +12,7 @@ from openadmin import spec
12
12
  class Table:
13
13
  function_name: str
14
14
  method: spec.HttpMethod
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  func: Callable | None = field(default=None)
@@ -2,36 +2,40 @@
2
2
  #
3
3
  # SPDX-License-Identifier: AGPL-3.0-or-later
4
4
 
5
- from typing import Union
6
-
7
5
  from .action import Action
8
6
  from .area_chart import AreaChart
9
7
  from .bar_chart import BarChart
8
+ from .component import Component
10
9
  from .form import Form
10
+ from .http_methods import HttpMethod
11
11
  from .icons import Icon
12
12
  from .line_chart import LineChart
13
13
  from .markdown import Markdown
14
+ from .page import Page
14
15
  from .pie_chart import PieChart
15
16
  from .property import Property
16
17
  from .property_type import PropertyType
18
+ from .section import Section
19
+ from .spec import Spec
17
20
  from .stat import Stat
18
21
  from .table import Table
19
22
 
20
- type Component = Union[
21
- Stat, Table, AreaChart, BarChart, LineChart, PieChart, Action, Form, Markdown
22
- ]
23
-
24
23
  __all__ = [
24
+ "Action",
25
25
  "AreaChart",
26
26
  "BarChart",
27
27
  "Component",
28
+ "Form",
29
+ "HttpMethod",
28
30
  "LineChart",
31
+ "Page",
29
32
  "PieChart",
30
- "Stat",
31
- "Action",
32
- "Table",
33
- "Form",
34
33
  "Property",
35
34
  "PropertyType",
35
+ "Section",
36
+ "Spec",
37
+ "Stat",
38
+ "Table",
39
+ "Markdown",
36
40
  "Icon",
37
41
  ]
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class Action(BaseModel):
14
14
  type: Literal["action"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class AreaChart(BaseModel):
14
14
  type: Literal["area-chart"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class BarChart(BaseModel):
14
14
  type: Literal["bar-chart"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -0,0 +1,19 @@
1
+ # SPDX-FileCopyrightText: 2026 OpenAdmin
2
+ #
3
+ # SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ from typing import Union
6
+
7
+ from .action import Action
8
+ from .area_chart import AreaChart
9
+ from .bar_chart import BarChart
10
+ from .form import Form
11
+ from .line_chart import LineChart
12
+ from .markdown import Markdown
13
+ from .pie_chart import PieChart
14
+ from .stat import Stat
15
+ from .table import Table
16
+
17
+ type Component = Union[
18
+ Stat, Table, AreaChart, BarChart, LineChart, PieChart, Action, Form, Markdown
19
+ ]
@@ -12,11 +12,12 @@ from .property import Property
12
12
 
13
13
  class Form(BaseModel):
14
14
  type: Literal["form"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
18
19
  method: HttpMethod
19
- is_hiden: bool
20
+ is_hidden: bool
20
21
  form: List[Property] | None = Field(None)
21
22
  body: List[Property] | None = Field(None)
22
23
  query: List[Property] | None = Field(None)
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class LineChart(BaseModel):
14
14
  type: Literal["line-chart"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class Markdown(BaseModel):
14
14
  type: Literal["markdown"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -6,7 +6,8 @@ from typing import List
6
6
 
7
7
  from pydantic import BaseModel
8
8
 
9
- from .components import Component, Icon
9
+ from .component import Component
10
+ from .icons import Icon
10
11
 
11
12
 
12
13
  class Page(BaseModel):
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class PieChart(BaseModel):
14
14
  type: Literal["pie-chart"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -6,7 +6,7 @@ from typing import List
6
6
 
7
7
  from pydantic import BaseModel
8
8
 
9
- from .components import Icon
9
+ from .icons import Icon
10
10
  from .page import Page
11
11
 
12
12
 
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class Stat(BaseModel):
14
14
  type: Literal["stat"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -12,6 +12,7 @@ from .property import Property
12
12
 
13
13
  class Table(BaseModel):
14
14
  type: Literal["table"]
15
+ id: str
15
16
  name: str
16
17
  description: str | None
17
18
  url: str
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "openadmin-dev"
3
- version = "0.6.0"
3
+ version = "0.6.2"
4
4
  description = "Add your description here"
5
5
  authors = [
6
6
  { name="Mykyta Kasianenko", email="mykytakasianenko@gmail.com" },
@@ -403,7 +403,7 @@ wheels = [
403
403
 
404
404
  [[package]]
405
405
  name = "openadmin"
406
- version = "0.4.0"
406
+ version = "0.6.1"
407
407
  source = { editable = "." }
408
408
  dependencies = [
409
409
  { name = "fastapi", extra = ["standard"] },
@@ -1,43 +0,0 @@
1
- # SPDX-FileCopyrightText: 2026 OpenAdmin
2
- #
3
- # SPDX-License-Identifier: AGPL-3.0-or-later
4
-
5
- from .components import (
6
- Action,
7
- AreaChart,
8
- BarChart,
9
- Component,
10
- Form,
11
- Icon,
12
- LineChart,
13
- Markdown,
14
- PieChart,
15
- Property,
16
- PropertyType,
17
- Stat,
18
- Table,
19
- )
20
- from .components.http_methods import HttpMethod
21
- from .page import Page
22
- from .section import Section
23
- from .spec import Spec
24
-
25
- __all__ = [
26
- "Action",
27
- "AreaChart",
28
- "BarChart",
29
- "Component",
30
- "Form",
31
- "HttpMethod",
32
- "LineChart",
33
- "Page",
34
- "PieChart",
35
- "Property",
36
- "PropertyType",
37
- "Section",
38
- "Spec",
39
- "Stat",
40
- "Table",
41
- "Markdown",
42
- "Icon",
43
- ]
File without changes
File without changes
File without changes
File without changes
File without changes