Skip to main content
Glama
SmartSearchPage.tsx1.48 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import type { FhirPathTableField } from '@medplum/react'; import { MemoizedFhirPathTable } from '@medplum/react'; import type { JSX } from 'react'; import { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router'; export function SmartSearchPage(): JSX.Element | null { const navigate = useNavigate(); const location = useLocation(); const [resourceType, setResourceType] = useState<string>(); const [query, setQuery] = useState<string>(); const [fields, setFields] = useState<FhirPathTableField[]>(); useEffect(() => { const queryParams = Object.fromEntries(new URLSearchParams(location.search).entries()) as Record<string, string>; setResourceType(queryParams.resourceType); setQuery(queryParams.query); setFields(JSON.parse(queryParams.fields)); }, [location]); if (!resourceType || !query || !fields) { return null; } return ( <MemoizedFhirPathTable resourceType={resourceType} checkboxesEnabled={true} query={query} fields={fields} onClick={(e) => navigate(`/${resourceType}/${e.resource.id}`)?.catch(console.error)} onAuxClick={(e) => window.open(`/${resourceType}/${e.resource.id}`, '_blank')} onBulk={(ids: string[]) => { navigate(`/bulk/${resourceType}?ids=${ids.join(',')}`)?.catch(console.error); }} /> ); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server