Files
Nawaz Dhandala 87e34b0abf feat: Add Public Dashboard FeatureSet with core components and pages
- Implemented DashboardCanvas component for rendering dashboard.
- Created Index.tsx for application entry point with routing setup.
- Developed AllPages.tsx to export main pages: DashboardView, MasterPassword, NotFound, and Forbidden.
- Added DashboardVariableSelector for managing dashboard variables.
- Built DashboardViewPage to display the dashboard with variable selection and auto-refresh functionality.
- Created Forbidden and NotFound pages for access control and error handling.
- Implemented MasterPassword page for secure access to dashboards.
- Added server-side utility for fetching public dashboard data.
- Established API utility for handling requests specific to the public dashboard.
- Configured routing and page mapping for public dashboard navigation.
- Set up TypeScript configuration for the PublicDashboard FeatureSet.
- Created index.ejs for rendering the public dashboard application.
2026-03-26 14:48:45 +00:00

66 lines
1.6 KiB
TypeScript

import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import Express, {
ExpressApplication,
ExpressRequest,
ExpressResponse,
} from "Common/Server/Utils/Express";
import logger from "Common/Server/Utils/Logger";
import App from "Common/Server/Utils/StartServer";
import "ejs";
import {
getPublicDashboardData,
PublicDashboardData,
} from "./src/Server/Utils/PublicDashboard";
export const APP_NAME: string = "public-dashboard";
const app: ExpressApplication = Express.getExpressApp();
const init: PromiseVoidFunction = async (): Promise<void> => {
try {
// init the app
await App.init({
appName: APP_NAME,
port: undefined,
isFrontendApp: true,
statusOptions: {
liveCheck: async () => {},
readyCheck: async () => {},
},
getVariablesToRenderIndexPage: async (
req: ExpressRequest,
_res: ExpressResponse,
) => {
const dashboardData: PublicDashboardData | null =
await getPublicDashboardData(req);
if (dashboardData) {
return {
title: dashboardData.title,
description: dashboardData.description,
};
}
return {
title: "Dashboard",
description: "View dashboard metrics and insights.",
};
},
});
// add default routes
await App.addDefaultRoutes();
} catch (err) {
logger.error("App Init Failed:");
logger.error(err);
throw err;
}
};
init().catch((err: Error) => {
logger.error(err);
logger.error("Exiting node process");
process.exit(1);
});
export default app;