@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
94 lines (93 loc) • 4.09 kB
TypeScript
import { Request, Response } from 'express';
import { DashboardParentChildData } from 'src/dpr/utils/TemplateBuilder/ParentChildDataBuilder/types';
import { components } from '../../types/api';
import { DashboardDataResponse } from '../../types/Metrics';
import { Services } from '../../types/Services';
import { LoadType, ReportType, RequestedReport } from '../../types/UserReports';
import { PartialDate } from '../_filters/types';
import { DashboardSection } from './dashboard-visualisation/types';
import DataPresentation from './DataPresentation';
type DashboardDefinition = components['schemas']['DashboardDefinition'];
export default class Dashboard extends DataPresentation {
sections: DashboardSection[];
dashboardData: DashboardDataResponse[];
parentChildData: DashboardParentChildData[];
partialDate: PartialDate | undefined;
dashboardFeatureFlags: Record<string, boolean>;
constructor(services: Services, res: Response, req: Request, definition: DashboardDefinition, loadType: LoadType, requestData?: RequestedReport | undefined);
build: () => Promise<{
expired: true;
dashboardData?: never;
} | {
dashboardData: {
executionId?: string | undefined;
requestedTimestamp?: string | undefined;
querySummary?: import("../_async/request-details/types").QuerySummaryItem[];
queryData?: NodeJS.Dict<string | string[]> | undefined;
requestUrl?: import("../../types/UserReports").AsyncReportUrlItemData | undefined;
defaultQuery?: string | undefined;
dataProductDefinitionsPath?: string | undefined;
actions: import("../_reports/report-heading/report-actions/types").ReportAction[];
downloadConfig: import("../_reports/report-heading/report-actions/types").DownloadActionParams | undefined;
bookmarkConfig: {
bookmarkActionEndpoint: string;
showBookmark: boolean;
linkText: string;
linkType: string;
};
subscriptionConfig: import("../../types/AsyncReportUtils").SubscriptionActionConfig | undefined;
feedbackFormHref: string | undefined;
hasDefaults: boolean | undefined;
saveDefaultsEnabled: boolean;
sections: DashboardSection[];
filters: import("../_filters/types").FilterValue[];
appliedFilters: import("../_filters/filters-applied/utils").AppliedFilterChip[];
reportName: string;
name: string;
description: string | undefined;
printable: boolean;
fields: components["schemas"]["FieldDefinition"][];
schedule?: string | undefined;
classification?: string | undefined;
template?: string;
specification?: components["schemas"]["Specification"];
loadType: LoadType;
csrfToken: string;
type: ReportType;
tableId?: string;
id: string;
reportId: string;
};
expired?: never;
}>;
/**
* Gets all the report data
*
*/
getData: () => Promise<void>;
/**
* Gets the dashboard data
*/
getDashboardData: () => Promise<void>;
private getAsyncData;
private getSyncData;
setParentChildData: () => Promise<void>;
/**
* Gets the parent and child data for a parent child dashboard, returns in a single array with the parent data first, followed by the child data
* NOTE: Only available for Async
*
*/
getParentChildData: (childVariants: DashboardDefinition[], services: Services, token: string, req: Request, res: Response, requestData?: RequestedReport) => Promise<DashboardParentChildData[]>;
/**
* Gets the relevant report details from the report definition
*
*/
buildDashboardDetails: () => Promise<void>;
buildSections: () => void;
buildPartialDate: () => void;
/**
* Builds the report query
*/
buildReportQuery: () => void;
}
export {};