mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- 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.
66 lines
1.6 KiB
TypeScript
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;
|