simple-module-dashboard 0.0.42__tar.gz → 0.0.44__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 (47) hide show
  1. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/.gitignore +3 -0
  2. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/PKG-INFO +4 -4
  3. simple_module_dashboard-0.0.44/dashboard/core/__init__.py +1 -0
  4. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/module.py +4 -4
  5. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/pages/Doctor.tsx +9 -9
  6. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/pages/Home.tsx +2 -2
  7. simple_module_dashboard-0.0.44/dashboard/web/__init__.py +1 -0
  8. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/web}/endpoints/api.py +2 -2
  9. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/web}/endpoints/views.py +3 -3
  10. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/web}/stats.py +5 -9
  11. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/package.json +1 -1
  12. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/pyproject.toml +4 -4
  13. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/core/module}/test_dashboard.py +2 -2
  14. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/doctor}/test_doctor_migration_chips.py +1 -1
  15. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/doctor}/test_doctor_props.py +2 -2
  16. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/endpoints}/test_dashboard_permission.py +2 -2
  17. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/stats}/test_dashboard_month_delta.py +1 -1
  18. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/stats}/test_dashboard_single_tenant.py +3 -3
  19. {simple_module_dashboard-0.0.42/tests → simple_module_dashboard-0.0.44/tests/web/stats}/test_dashboard_user_directory.py +2 -2
  20. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/tests-js/dashboard_Doctor.test.tsx +1 -1
  21. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/tests-js/doctor-stats.test.tsx +3 -3
  22. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/LICENSE +0 -0
  23. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/README.md +0 -0
  24. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/__init__.py +0 -0
  25. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/core}/constants.py +0 -0
  26. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/locales/de.json +0 -0
  27. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/locales/en.json +0 -0
  28. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/locales/es.json +0 -0
  29. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/py.typed +0 -0
  30. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/dashboard/styles.css +0 -0
  31. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/ModuleTile.tsx +0 -0
  32. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/ChecksCard.tsx +0 -0
  33. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/DevServerCard.tsx +0 -0
  34. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/MigrationsCard.tsx +0 -0
  35. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/StatsRow.tsx +0 -0
  36. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/TerminalPanel.tsx +0 -0
  37. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/check-copy.ts +0 -0
  38. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/copy.ts +0 -0
  39. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/report.ts +0 -0
  40. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/doctor/types.ts +0 -0
  41. {simple_module_dashboard-0.0.42/dashboard/pages → simple_module_dashboard-0.0.44/dashboard/ui}/components/module-target.ts +0 -0
  42. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/web}/doctor.py +0 -0
  43. {simple_module_dashboard-0.0.42/dashboard → simple_module_dashboard-0.0.44/dashboard/web}/endpoints/__init__.py +0 -0
  44. /simple_module_dashboard-0.0.42/tests/test_view_routes.py → /simple_module_dashboard-0.0.44/tests/web/endpoints/test_dashboard_view_routes.py +0 -0
  45. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/tests-js/dashboard_Doctor_errors.test.tsx +0 -0
  46. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/tests-js/dashboard_Home.test.tsx +0 -0
  47. {simple_module_dashboard-0.0.42 → simple_module_dashboard-0.0.44}/tsconfig.json +0 -0
@@ -22,6 +22,9 @@ node_modules/
22
22
 
23
23
  # Database
24
24
  *.db
25
+ *.db-wal
26
+ *.db-shm
27
+ *.db-journal
25
28
  *.sqlite3
26
29
 
27
30
  # Module-managed runtime state (e.g. uploaded dataset files,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: simple_module_dashboard
3
- Version: 0.0.42
3
+ Version: 0.0.44
4
4
  Summary: Admin landing page and sidebar menu host for authenticated users of a simple_module app
5
5
  Project-URL: Homepage, https://github.com/antosubash/simple_module_python
6
6
  Project-URL: Repository, https://github.com/antosubash/simple_module_python
@@ -21,9 +21,9 @@ Classifier: Topic :: Internet :: WWW/HTTP
21
21
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
22
  Classifier: Typing :: Typed
23
23
  Requires-Python: >=3.12
24
- Requires-Dist: simple-module-core==0.0.42
25
- Requires-Dist: simple-module-db==0.0.42
26
- Requires-Dist: simple-module-hosting==0.0.42
24
+ Requires-Dist: simple-module-core==0.0.44
25
+ Requires-Dist: simple-module-db==0.0.44
26
+ Requires-Dist: simple-module-hosting==0.0.44
27
27
  Description-Content-Type: text/markdown
28
28
 
29
29
  # simple_module_dashboard
@@ -0,0 +1 @@
1
+ """What the dashboard builds on: its constants."""
@@ -10,7 +10,7 @@ from simple_module_core.menu import MenuItem, MenuRegistry, MenuSection
10
10
  from simple_module_core.module import ModuleBase, ModuleMeta
11
11
  from simple_module_core.permissions import PermissionRegistry
12
12
 
13
- from dashboard.constants import PERM_GROUP, PERM_VIEW
13
+ from dashboard.core.constants import PERM_GROUP, PERM_VIEW
14
14
 
15
15
  _URL_DASHBOARD = "/dashboard/"
16
16
  _URL_DOCTOR = "/admin/doctor/"
@@ -29,14 +29,14 @@ class DashboardModule(ModuleBase):
29
29
  )
30
30
 
31
31
  def register_routes(self, api_router: APIRouter, view_router: APIRouter) -> None:
32
- from dashboard.endpoints.api import router as api
33
- from dashboard.endpoints.views import router as views
32
+ from dashboard.web.endpoints.api import router as api
33
+ from dashboard.web.endpoints.views import router as views
34
34
 
35
35
  api_router.include_router(api)
36
36
  view_router.include_router(views)
37
37
 
38
38
  def register_admin_routes(self, admin_router: APIRouter) -> None:
39
- from dashboard.endpoints.views import admin_router as doctor_views
39
+ from dashboard.web.endpoints.views import admin_router as doctor_views
40
40
 
41
41
  admin_router.include_router(doctor_views)
42
42
 
@@ -5,15 +5,15 @@ import { Button } from '@simple-module-py/ui/components/ui/button';
5
5
  import { AdminLayout } from '@simple-module-py/ui/layouts/AdminLayout';
6
6
  import { RefreshCw } from 'lucide-react';
7
7
  import { toast } from 'sonner';
8
- import { ChecksCard } from './components/doctor/ChecksCard';
9
- import { useCheckLabels } from './components/doctor/check-copy';
10
- import { copyToClipboard } from './components/doctor/copy';
11
- import { DevServerCard } from './components/doctor/DevServerCard';
12
- import { MigrationsCard } from './components/doctor/MigrationsCard';
13
- import { buildDoctorReport } from './components/doctor/report';
14
- import { StatsRow } from './components/doctor/StatsRow';
15
- import { TerminalPanel } from './components/doctor/TerminalPanel';
16
- import type { DoctorProps } from './components/doctor/types';
8
+ import { ChecksCard } from '../ui/components/doctor/ChecksCard';
9
+ import { useCheckLabels } from '../ui/components/doctor/check-copy';
10
+ import { copyToClipboard } from '../ui/components/doctor/copy';
11
+ import { DevServerCard } from '../ui/components/doctor/DevServerCard';
12
+ import { MigrationsCard } from '../ui/components/doctor/MigrationsCard';
13
+ import { buildDoctorReport } from '../ui/components/doctor/report';
14
+ import { StatsRow } from '../ui/components/doctor/StatsRow';
15
+ import { TerminalPanel } from '../ui/components/doctor/TerminalPanel';
16
+ import type { DoctorProps } from '../ui/components/doctor/types';
17
17
 
18
18
  const RERUN_URL = '/admin/doctor/rerun';
19
19
 
@@ -6,8 +6,8 @@ import { Card, CardContent } from '@simple-module-py/ui/components/ui/card';
6
6
  import { usePageProps } from '@simple-module-py/ui/hooks/usePageProps';
7
7
  import { AuthenticatedLayout } from '@simple-module-py/ui/layouts/AuthenticatedLayout';
8
8
  import { Activity, Box, Stethoscope, Users } from 'lucide-react';
9
- import { type ModuleHealth, ModuleTile } from './components/ModuleTile';
10
- import { moduleTargetResolver } from './components/module-target';
9
+ import { type ModuleHealth, ModuleTile } from '../ui/components/ModuleTile';
10
+ import { moduleTargetResolver } from '../ui/components/module-target';
11
11
 
12
12
  interface SystemModule {
13
13
  name: string;
@@ -0,0 +1 @@
1
+ """The HTTP side: the home and doctor endpoints and the stats and doctor reads they share."""
@@ -7,8 +7,8 @@ from simple_module_db.deps import get_db
7
7
  from simple_module_hosting.permissions import RequiresPermission
8
8
  from sqlalchemy.ext.asyncio import AsyncSession
9
9
 
10
- from dashboard.constants import PERM_VIEW
11
- from dashboard.stats import fetch_dashboard_stats
10
+ from dashboard.core.constants import PERM_VIEW
11
+ from dashboard.web.stats import fetch_dashboard_stats
12
12
 
13
13
  router = APIRouter()
14
14
 
@@ -18,8 +18,8 @@ from simple_module_inertia import InertiaResponse
18
18
  from sqlalchemy.ext.asyncio import AsyncSession
19
19
  from starlette.responses import RedirectResponse
20
20
 
21
- from dashboard.constants import PERM_VIEW
22
- from dashboard.stats import fetch_dashboard_stats
21
+ from dashboard.core.constants import PERM_VIEW
22
+ from dashboard.web.stats import fetch_dashboard_stats
23
23
 
24
24
  router = APIRouter()
25
25
 
@@ -66,7 +66,7 @@ async def dashboard(
66
66
  @admin_router.get("/", response_model=None)
67
67
  async def doctor(request: Request, inertia: InertiaDep) -> InertiaResponse:
68
68
  """`make doctor` mirror — checks, migrations, dev server, all live."""
69
- from dashboard.doctor import doctor_props
69
+ from dashboard.web.doctor import doctor_props
70
70
 
71
71
  # doctor_props walks the alembic script directory and every module's pages
72
72
  # dir, so it is blocking filesystem work: keep it off the event loop rather
@@ -11,6 +11,7 @@ from fastapi import FastAPI
11
11
  from simple_module_core.discovery import get_module_package_name
12
12
  from simple_module_core.health import HealthCheck, HealthStatus
13
13
  from simple_module_core.user_directory import get_user_directory
14
+ from simple_module_hosting.health import run_health_check
14
15
  from sqlalchemy.ext.asyncio import AsyncSession
15
16
 
16
17
  _CACHE_TTL_SECONDS = 30
@@ -132,14 +133,9 @@ async def _run_health_checks(app: FastAPI) -> list[dict[str, str]]:
132
133
  return []
133
134
 
134
135
  async def _run_one(check: HealthCheck) -> dict[str, str]:
135
- try:
136
- result = await check.check()
137
- return {"name": check.name, "status": result.status.value, "module": check.module}
138
- except Exception:
139
- return {
140
- "name": check.name,
141
- "status": HealthStatus.UNHEALTHY.value,
142
- "module": check.module,
143
- }
136
+ # The readiness probe's bounded runner: a hung check reports unhealthy
137
+ # after its deadline instead of stalling the dashboard.
138
+ result = await run_health_check(check.name, check.check)
139
+ return {"name": check.name, "status": result.status.value, "module": check.module}
144
140
 
145
141
  return list(await asyncio.gather(*[_run_one(c) for c in checks]))
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-module-py/dashboard",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "private": true,
5
5
  "description": "Frontend assets for the Dashboard module",
6
6
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "simple_module_dashboard"
3
- version = "0.0.42"
3
+ version = "0.0.44"
4
4
  description = "Admin landing page and sidebar menu host for authenticated users of a simple_module app"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -21,9 +21,9 @@ classifiers = [
21
21
  "Typing :: Typed",
22
22
  ]
23
23
  dependencies = [
24
- "simple_module_core==0.0.42",
25
- "simple_module_db==0.0.42",
26
- "simple_module_hosting==0.0.42",
24
+ "simple_module_core==0.0.44",
25
+ "simple_module_db==0.0.44",
26
+ "simple_module_hosting==0.0.44",
27
27
  ]
28
28
 
29
29
  [project.entry-points.simple_module]
@@ -5,7 +5,7 @@ from __future__ import annotations
5
5
  import httpx
6
6
  import pytest
7
7
  from dashboard.module import DashboardModule
8
- from dashboard.stats import invalidate_stats_cache
8
+ from dashboard.web.stats import invalidate_stats_cache
9
9
 
10
10
 
11
11
  @pytest.fixture(autouse=True)
@@ -35,7 +35,7 @@ class TestDashboardModuleRegistration:
35
35
  class TestFetchDashboardStats:
36
36
  @pytest.fixture
37
37
  async def stats(self, app):
38
- from dashboard.stats import fetch_dashboard_stats
38
+ from dashboard.web.stats import fetch_dashboard_stats
39
39
 
40
40
  async with app.state.sm.db.session_factory() as db:
41
41
  return await fetch_dashboard_stats(db, app)
@@ -10,7 +10,7 @@ in a list costs nothing.
10
10
 
11
11
  from __future__ import annotations
12
12
 
13
- from dashboard.doctor import HOST_MIGRATION_CHIP, _module_chip
13
+ from dashboard.web.doctor import HOST_MIGRATION_CHIP, _module_chip
14
14
 
15
15
 
16
16
  class TestMigrationChips:
@@ -13,8 +13,8 @@ from types import SimpleNamespace
13
13
 
14
14
  import httpx
15
15
  import pytest
16
- from dashboard.doctor import CHECKS, MIGRATION_CHECK_ID
17
- from dashboard.stats import invalidate_stats_cache
16
+ from dashboard.web.doctor import CHECKS, MIGRATION_CHECK_ID
17
+ from dashboard.web.stats import invalidate_stats_cache
18
18
  from simple_module_core.diagnostics import Diagnostic, DiagnosticLevel
19
19
  from simple_module_test.fixtures import forge_session_cookie
20
20
 
@@ -8,8 +8,8 @@ stats therefore need ``dashboard.view``, which only the platform ``admin``
8
8
  from __future__ import annotations
9
9
 
10
10
  import pytest
11
- from dashboard.constants import PERM_VIEW
12
- from dashboard.stats import invalidate_stats_cache
11
+ from dashboard.core.constants import PERM_VIEW
12
+ from dashboard.web.stats import invalidate_stats_cache
13
13
  from simple_module_core.tenancy import TenantRole, tenant_role
14
14
 
15
15
  _STATS = "/api/dashboard/stats"
@@ -12,7 +12,7 @@ from datetime import UTC, datetime, timedelta
12
12
 
13
13
  import httpx
14
14
  import pytest
15
- from dashboard.stats import fetch_dashboard_stats, invalidate_stats_cache
15
+ from dashboard.web.stats import fetch_dashboard_stats, invalidate_stats_cache
16
16
  from users.models import User
17
17
 
18
18
 
@@ -9,8 +9,8 @@ dashboard still renders for everyone as the post-login landing page.
9
9
  from __future__ import annotations
10
10
 
11
11
  import pytest
12
- from dashboard.constants import PERM_VIEW
13
- from dashboard.stats import invalidate_stats_cache
12
+ from dashboard.core.constants import PERM_VIEW
13
+ from dashboard.web.stats import invalidate_stats_cache
14
14
  from simple_module_hosting.settings import Settings
15
15
  from simple_module_test.tenant_client import session_client
16
16
 
@@ -35,7 +35,7 @@ def test_user_role_is_not_mapped_to_dashboard_view(app):
35
35
 
36
36
 
37
37
  async def _plain_user(app) -> str:
38
- from users.bootstrap import create_standard_user
38
+ from users.core.bootstrap import create_standard_user
39
39
 
40
40
  async with app.state.sm.db.session_factory() as session:
41
41
  result = await create_standard_user(session, email="plain@example.com", password="x" * 12)
@@ -15,7 +15,7 @@ from simple_module_core.user_directory import (
15
15
 
16
16
  @pytest.fixture(autouse=True)
17
17
  def _fresh_cache():
18
- from dashboard.stats import invalidate_stats_cache
18
+ from dashboard.web.stats import invalidate_stats_cache
19
19
 
20
20
  invalidate_stats_cache()
21
21
  yield
@@ -34,7 +34,7 @@ class _KeycloakLike(NullUserDirectory):
34
34
 
35
35
 
36
36
  async def _stats(app) -> dict:
37
- from dashboard.stats import fetch_dashboard_stats
37
+ from dashboard.web.stats import fetch_dashboard_stats
38
38
 
39
39
  async with app.state.sm.db.session_factory() as db:
40
40
  return await fetch_dashboard_stats(db, app)
@@ -10,8 +10,8 @@ vi.mock('@inertiajs/react', () => ({
10
10
  usePage: () => ({ props: {} }),
11
11
  }));
12
12
 
13
- import type { DoctorProps } from '../dashboard/pages/components/doctor/types';
14
13
  import Doctor from '../dashboard/pages/Doctor';
14
+ import type { DoctorProps } from '../dashboard/ui/components/doctor/types';
15
15
 
16
16
  const props: DoctorProps = {
17
17
  checks: [{ id: 'pages', status: 'pass', command: null, findings: [] }],
@@ -15,9 +15,9 @@ configureI18n({
15
15
  },
16
16
  });
17
17
 
18
- import { buildDoctorReport } from '../dashboard/pages/components/doctor/report';
19
- import { StatsRow } from '../dashboard/pages/components/doctor/StatsRow';
20
- import type { DoctorProps } from '../dashboard/pages/components/doctor/types';
18
+ import { buildDoctorReport } from '../dashboard/ui/components/doctor/report';
19
+ import { StatsRow } from '../dashboard/ui/components/doctor/StatsRow';
20
+ import type { DoctorProps } from '../dashboard/ui/components/doctor/types';
21
21
 
22
22
  const STATS = {
23
23
  checks_passing: 0,