major refactor of the dashboard and react-openapi integration #1

Merged
aetos merged 44 commits from period-selection into main 2026-05-07 11:00:54 +00:00
4 changed files with 12 additions and 2 deletions
Showing only changes of commit 3fd20f11ab - Show all commits

View File

@@ -24,6 +24,10 @@ export const ConfigContext = React.createContext<AppConfig | null>(null);
function Dashboard({ basePath }: { basePath: string }) {
const config = React.useContext(ConfigContext);
const navigate = useNavigate();
const resources = config?.resources || [];
const visibleResources = resources.filter((res) => !res.hidden);
return (
<Box>
<Typography variant="h4" gutterBottom>
@@ -41,7 +45,7 @@ function Dashboard({ basePath }: { basePath: string }) {
mt: 4,
}}
>
{config?.resources.map((res) => (
{visibleResources.map((res) => (
<Paper
key={res.name}
sx={{
@@ -69,6 +73,9 @@ function AdminApp({ basePath }: { basePath: string }) {
const config = React.useContext(ConfigContext);
const navigate = useNavigate();
const resources = config?.resources || [];
const visibleResources = resources.filter((res) => !res.hidden);
if (!currentUser) {
return (
<AuthPage
@@ -89,7 +96,7 @@ function AdminApp({ basePath }: { basePath: string }) {
username={currentUser.username}
onLogout={logout}
onSelectResource={(name) => navigate(`/admin/${name}`)}
resources={config?.resources || []}
resources={visibleResources}
>
<Routes>
<Route path="/" element={<Dashboard basePath={basePath} />} />

View File

@@ -30,6 +30,7 @@ export interface ResourceConfig {
primaryKey: string;
fields: Record<string, ResourceField>;
pagination?: boolean;
hidden?: boolean;
}
export interface AppConfig {

View File

@@ -12,4 +12,5 @@ export interface FieldOverride {
export interface ResourceOverride {
fields?: Record<string, FieldOverride>;
pagination?: boolean;
hidden?: boolean;
}

View File

@@ -162,6 +162,7 @@ export async function loadConfigFromOpenApi(baseUrl: string, configuration: Reco
primaryKey: "id", // Strict default, no heuristics
fields,
pagination: resourceOverride.pagination,
hidden: resourceOverride.hidden,
});
}