Skip to content

Commit

Permalink
refactor(ui); update input display for dashboards (#5841)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe-lyons authored Sep 6, 2022
1 parent 055dd27 commit 29a6f91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
9 changes: 6 additions & 3 deletions datahub-web-react/src/app/entity/chart/ChartSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -36,15 +37,17 @@ 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>
);
}
}

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;
};
19 changes: 7 additions & 12 deletions datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}
/>
}
/>
);
};
Expand Down

0 comments on commit 29a6f91

Please sign in to comment.