Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/components/widgets/AutocompleteWidget/AutocompleteWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import {
EuiHighlight,
EuiHealth,
EuiProvider,
EuiIcon
EuiIcon,
EuiPanel,
EuiFlexGroup
} from "@elastic/eui";
import { QueryClient, QueryClientProvider, useQuery } from "react-query";
import { AutocompleteWidgetProps } from "../../../app/types";
import { BreadcrumbPresentation } from "../MetadataWidget/BreadcrumbWidget/BreadcrumbPresentation";
import { MetadataWidget } from "../MetadataWidget";

/**
* A React component to provide Autosuggestion based on SemLookP.
Expand Down Expand Up @@ -211,6 +214,19 @@ function AutocompleteWidget(props: AutocompleteWidgetProps) {
}
);

const createToolTipContent = (iri) =>
<EuiFlexGroup style={{ color: "black" }}>
<EuiPanel>
<MetadataWidget
api={api}
iri={iri}
hierarchyTab={false}
crossRefTab={false}
terminologyInfoTab={false}
/>
</EuiPanel>
</EuiFlexGroup>

/**
* fetches new options when searchValue changes
*/
Expand Down Expand Up @@ -247,7 +263,13 @@ function AutocompleteWidget(props: AutocompleteWidgetProps) {
short_form: selection.getShortForm(),
description: selection.getDescription(),
source: selection.getApiSourceName(),
source_url: selection.getApiSourceEndpoint()
source_url: selection.getApiSourceEndpoint(),
},
toolTipContent: createToolTipContent(
selection.getIri()
),
toolTipProps: {
css: {maxWidth: "none", maxHeight: "none"},
}
})
));
Expand Down
4 changes: 4 additions & 0 deletions src/components/widgets/MetadataWidget/MetadataWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,20 @@ function MetadataWidget(props: MetadataWidgetProps) {
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{data.entity.getDescription() &&
<EuiFlexItem style={{ maxWidth: 600 }}>
<DescriptionPresentation
description={data.entity.getDescription()}
/>
</EuiFlexItem>
}

{data.ontoList && data.ontoList.length > 0 &&
<div style={{margin: "0 12px 0", maxWidth: 600 }}>
<EntityOntoListPresentation iri={props.iri} label={data.entity.getLabel() || ""} ontolist={data.ontoList} entityType={entityType || data.entity.getType() as EntityTypeName} onNavigateToOntology={onNavigateToOntology} />
<EntityDefinedByPresentation iri={props.iri} ontolist={data.definedBy} label={data.entity.getLabel() || ""} entityType={entityType || data.entity.getType() as EntityTypeName} onNavigateToOntology={onNavigateToOntology} />
</div>
}

<EuiFlexItem>
<TabPresentation
Expand Down