mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-24 08:28:12 +00:00
refactor(ui); update input display for dashboards (#5841)
This commit is contained in:
parent
055dd27015
commit
29a6f91b61
@ -9,12 +9,13 @@ import { getMatchPrioritizingPrimary } from '../shared/utils';
|
||||
type Props = {
|
||||
matchedFields: MatchedField[];
|
||||
inputFields: Maybe<InputFields> | undefined;
|
||||
isMatchingDashboard?: boolean;
|
||||
};
|
||||
|
||||
const LABEL_INDEX_NAME = 'fieldLabels';
|
||||
const TYPE_PROPERTY_KEY_NAME = 'type';
|
||||
|
||||
export const ChartSnippet = ({ matchedFields, inputFields }: Props) => {
|
||||
export const ChartSnippet = ({ matchedFields, inputFields, isMatchingDashboard = false }: Props) => {
|
||||
const matchedField = getMatchPrioritizingPrimary(matchedFields, 'fieldLabels');
|
||||
|
||||
if (matchedField?.name === LABEL_INDEX_NAME) {
|
||||
@ -36,7 +37,8 @@ export const ChartSnippet = ({ matchedFields, inputFields }: Props) => {
|
||||
|
||||
return (
|
||||
<Typography.Text>
|
||||
Matches {termType} <TagTermGroup uneditableGlossaryTerms={{ terms: [matchedGlossaryTerm] }} />
|
||||
Matches {termType} <TagTermGroup uneditableGlossaryTerms={{ terms: [matchedGlossaryTerm] }} />{' '}
|
||||
{isMatchingDashboard && 'on a contained Chart'}
|
||||
</Typography.Text>
|
||||
);
|
||||
}
|
||||
@ -44,7 +46,8 @@ export const ChartSnippet = ({ matchedFields, inputFields }: Props) => {
|
||||
|
||||
return matchedField ? (
|
||||
<Typography.Text>
|
||||
Matches {FIELDS_TO_HIGHLIGHT.get(matchedField.name)} <b>{matchedField.value}</b>
|
||||
Matches {FIELDS_TO_HIGHLIGHT.get(matchedField.name)} <b>{matchedField.value}</b>{' '}
|
||||
{isMatchingDashboard && 'on a contained Chart'}
|
||||
</Typography.Text>
|
||||
) : null;
|
||||
};
|
||||
|
||||
@ -23,7 +23,6 @@ import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domai
|
||||
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';
|
||||
import { LineageTab } from '../shared/tabs/Lineage/LineageTab';
|
||||
import { DashboardStatsSummarySubHeader } from './profile/DashboardStatsSummarySubHeader';
|
||||
import { InputFieldsTab } from '../shared/tabs/Entity/InputFieldsTab';
|
||||
import { ChartSnippet } from '../chart/ChartSnippet';
|
||||
|
||||
/**
|
||||
@ -87,16 +86,6 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
name: 'Documentation',
|
||||
component: DocumentationTab,
|
||||
},
|
||||
{
|
||||
name: 'Fields',
|
||||
component: InputFieldsTab,
|
||||
display: {
|
||||
visible: (_, dashboard: GetDashboardQuery) =>
|
||||
(dashboard?.dashboard?.inputFields?.fields?.length || 0) > 0,
|
||||
enabled: (_, dashboard: GetDashboardQuery) =>
|
||||
(dashboard?.dashboard?.inputFields?.fields?.length || 0) > 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Properties',
|
||||
component: PropertiesTab,
|
||||
@ -215,7 +204,13 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
statsSummary={data.statsSummary}
|
||||
lastUpdatedMs={data.properties?.lastModified?.time}
|
||||
createdMs={data.properties?.created?.time}
|
||||
snippet={<ChartSnippet matchedFields={result.matchedFields} inputFields={data.inputFields} />}
|
||||
snippet={
|
||||
<ChartSnippet
|
||||
isMatchingDashboard
|
||||
matchedFields={result.matchedFields}
|
||||
inputFields={data.inputFields}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user