From 6531ba89a3e3f81d55997efbc1b6e033c25f9d71 Mon Sep 17 00:00:00 2001 From: Ilya Beda Date: Wed, 4 Dec 2024 18:39:45 +1100 Subject: [PATCH] Add defaultLaunchContext props to ResourceListPage --- src/uberComponents/ResourceListPage/actions.tsx | 11 +++++++++-- src/uberComponents/ResourceListPage/index.tsx | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/uberComponents/ResourceListPage/actions.tsx b/src/uberComponents/ResourceListPage/actions.tsx index 190e9099..53ec3262 100644 --- a/src/uberComponents/ResourceListPage/actions.tsx +++ b/src/uberComponents/ResourceListPage/actions.tsx @@ -1,6 +1,6 @@ import { t } from '@lingui/macro'; import { Button, notification } from 'antd'; -import { Bundle, Resource } from 'fhir/r4b'; +import { Bundle, ParametersParameter, Resource } from 'fhir/r4b'; import { useNavigate } from 'react-router-dom'; import { ModalTrigger } from 'src/components/ModalTrigger'; @@ -87,7 +87,13 @@ export function RecordQuestionnaireAction({ ); } -export function HeaderQuestionnaireAction({ action, reload }: { action: QuestionnaireActionType; reload: () => void }) { +interface HeaderQuestionnaireActionProps { + action: QuestionnaireActionType; + reload: () => void; + defaultLaunchContext: ParametersParameter[]; +} + +export function HeaderQuestionnaireAction({ action, reload, defaultLaunchContext }: HeaderQuestionnaireActionProps) { return ( )} diff --git a/src/uberComponents/ResourceListPage/index.tsx b/src/uberComponents/ResourceListPage/index.tsx index bf59a73e..7ddf23d2 100644 --- a/src/uberComponents/ResourceListPage/index.tsx +++ b/src/uberComponents/ResourceListPage/index.tsx @@ -1,7 +1,7 @@ import { plural, Trans } from '@lingui/macro'; import { Empty, Row, Col, Button } from 'antd'; import { ColumnsType } from 'antd/lib/table'; -import { Bundle, Resource } from 'fhir/r4b'; +import { Bundle, ParametersParameter, Resource } from 'fhir/r4b'; import { formatError, SearchParams } from '@beda.software/fhir-react'; import { isFailure, isLoading, isSuccess } from '@beda.software/remote-data'; @@ -76,6 +76,12 @@ interface ResourceListPageProps { * NOTE: Theoretically getHeaderActions can accept selected resources Bundle */ getBatchActions?: () => Array; + + /** + * Default launch context that will be added to al questionnaires + * TODO now it is used for header actions only + */ + defaultLaunchContext?: ParametersParameter[]; } export function ResourceListPage({ @@ -88,6 +94,7 @@ export function ResourceListPage({ getBatchActions, searchBarColumns, tableColumns, + defaultLaunchContext, }: ResourceListPageProps) { const { columnsFilterValues, onChangeColumnFilter, onResetFilters } = useSearchBar({ columns: searchBarColumns ?? [], @@ -115,7 +122,11 @@ export function ResourceListPage({ {headerActions.map((action, index) => ( - + ))}