UNPKG

@ministryofjustice/hmpps-digital-prison-reporting-frontend

Version:

The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.

143 lines (142 loc) 5.47 kB
import { components } from 'src/dpr/types/api'; import { Request, Response } from 'express'; import { Services } from '../../types/Services'; import { AsyncSummary, LoadType, ReportType, RequestedReport } from '../../types/UserReports'; import { Columns } from './report-heading/report-columns/report-columns-form/types'; import { Pagination } from './report-page/report-template/report-pagination/types'; import { ReportTemplateData } from '../../utils/TemplateBuilder/SectionedDataHelper/types'; import { DataTable } from '../../utils/DataTableBuilder/types'; import { ChildData } from '../../utils/TemplateBuilder/ParentChildDataBuilder/types'; import DataPresentation from '../_dashboards/DataPresentation'; export default class Report extends DataPresentation { variant: components['schemas']['VariantDefinition']; specification: components['schemas']['Specification']; reportData: Record<string, string>[]; childData: ChildData[]; summariesData: AsyncSummary[]; columns: Columns; count: number; pagination: Pagination; totals: string; dataTable: DataTable | ReportTemplateData; constructor(services: Services, res: Response, req: Request, definition: components['schemas']['SingleVariantReportDefinition'], loadType: LoadType, requestData?: RequestedReport | undefined); setSpecification: () => void; build: () => Promise<{ expired: true; renderData?: never; } | { renderData: { totals: string; dataTable: DataTable | ReportTemplateData; fields: { name: string; display: string; wordWrap?: "none" | "normal" | "break-words" | null; filter?: components["schemas"]["FilterDefinition"] | null; sortable: boolean; defaultsort: boolean; sortDirection?: "asc" | "desc" | null; type: "boolean" | "date" | "double" | "HTML" | "long" | "string" | "time" | "timestamp"; mandatory: boolean; visible: boolean; calculated: boolean; header: boolean; fieldSource: "specfield" | "paramfield"; }[] | null | undefined; 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; pagination: Pagination; reportName: string; name: string; description: string | undefined; printable: boolean; schedule?: string | undefined; classification?: string | undefined; template?: string; specification?: components["schemas"]["Specification"]; actions: import("./report-heading/report-actions/types").ReportAction[]; downloadConfig: import("./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; loadType: LoadType; csrfToken: string; type: ReportType; tableId?: string; id: string; reportId: string; count: number; hasDefaults: boolean | undefined; saveDefaultsEnabled: boolean; columns: Columns; filterData: import("../_filters/types").FilterValue[]; appliedFilters: import("../_filters/filters-applied/utils").AppliedFilterChip[]; }; expired?: never; }>; /** * Gets all the report data * */ getData: () => Promise<void>; /** * Gets the report data */ getReportData: () => Promise<void>; private getAysncData; private getSyncData; /** * Gets the summaries data for summary tables * NOTE: Only available for Async * * @return {*} */ getSummariesData: () => Promise<void>; /** * Gets the child date for a parent child report * NOTE: Only available for Async * */ setChildData: () => Promise<void>; getChildData: (childVariants: components["schemas"]["ChildVariantDefinition"][], services: Services, token: string, req: Request, res: Response, requestData?: RequestedReport) => Promise<ChildData[]>; /** * Builds the report table * */ buildTable: () => void; /** * Gets the relevant report details from the report definition * */ buildReportDetails: () => void; /** * Build columns * */ buildColumns: () => void; /** * Builds the pagination config for a report */ buildPagination: () => void; /** * Gets the row count * * @return {*} */ getCount: () => Promise<void>; /** * Builds the report query * */ buildReportQuery: () => void; }