Skip to content

Commit

Permalink
[ui] add catalog pill for row count
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed May 15, 2024
1 parent 52cc1b8 commit 91e7efa
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ import status from '../icon-svgs/status.svg';
import sticky_note from '../icon-svgs/sticky_note.svg';
import sync_alt from '../icon-svgs/sync_alt.svg';
import sync_problem from '../icon-svgs/sync_problem.svg';
import table_rows from '../icon-svgs/table_rows.svg';
import table_view from '../icon-svgs/table_view.svg';
import tag from '../icon-svgs/tag.svg';
import timer from '../icon-svgs/timer.svg';
Expand Down Expand Up @@ -220,6 +221,7 @@ export const Icons = {
sensors,
schedule,
source_asset,
table_rows,
workspace: source,
gantt_flat,
gantt_waterfall,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ import {StatusDot} from '../asset-graph/sidebar/StatusDot';
import {AssetNodeForGraphQueryFragment} from '../asset-graph/types/useAssetGraphData.types';
import {DagsterTypeSummary} from '../dagstertype/DagsterType';
import {AssetComputeKindTag} from '../graph/OpTags';
import {IntMetadataEntry} from '../graphql/types';
import {useLaunchPadHooks} from '../launchpad/LaunchpadHooksContext';
import {isCanonicalRowCountMetadataEntry} from '../metadata/MetadataEntry';
import {TableSchema, TableSchemaAssetContext} from '../metadata/TableSchema';
import {RepositoryLink} from '../nav/RepositoryLink';
import {ScheduleOrSensorTag} from '../nav/ScheduleOrSensorTag';
Expand Down Expand Up @@ -117,10 +119,14 @@ export const AssetNodeOverview = ({
definitionLoadTimestamp: assetNodeLoadTimestamp,
});

const rowCountMeta: IntMetadataEntry | undefined = materialization?.metadataEntries.find(
(entry) => isCanonicalRowCountMetadataEntry(entry),
) as IntMetadataEntry | undefined;

const renderStatusSection = () => (
<Box flex={{direction: 'column', gap: 16}}>
<Box flex={{direction: 'row'}}>
<Box flex={{direction: 'column', gap: 6}} style={{width: '50%'}}>
<Box flex={{direction: 'column', gap: 6}} style={{width: '33.3%'}}>
<Subtitle2>Latest {assetNode?.isSource ? 'observation' : 'materialization'}</Subtitle2>
<Box flex={{gap: 8, alignItems: 'center'}}>
{liveData ? (
Expand All @@ -134,7 +140,7 @@ export const AssetNodeOverview = ({
</Box>
</Box>
{liveData?.assetChecks.length ? (
<Box flex={{direction: 'column', gap: 6}} style={{width: '50%'}}>
<Box flex={{direction: 'column', gap: 6}} style={{width: '33.3%'}}>
<Subtitle2>Check results</Subtitle2>
<AssetChecksStatusSummary
liveData={liveData}
Expand All @@ -143,6 +149,14 @@ export const AssetNodeOverview = ({
/>
</Box>
) : undefined}
{rowCountMeta ? (
<Box flex={{direction: 'column', gap: 6}} style={{width: '33.3%'}}>
<Subtitle2>Row count</Subtitle2>
<Box>
<Tag icon="table_rows">{rowCountMeta.intValue}</Tag>
</Box>
</Box>
) : undefined}
</Box>
{assetNode.isPartitioned ? null : (
<RecentUpdatesTimeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ import {copyValue} from '../app/DomUtils';
import {assertUnreachable} from '../app/Util';
import {displayNameForAssetKey} from '../asset-graph/Utils';
import {assetDetailsPathForKey} from '../assets/assetDetailsPathForKey';
import {TableMetadataEntry} from '../graphql/types';
import {IntMetadataEntry, MaterializationEvent, TableMetadataEntry} from '../graphql/types';
import {TimestampDisplay} from '../schedules/TimestampDisplay';
import {Markdown} from '../ui/Markdown';
import {NotebookButton} from '../ui/NotebookButton';
import {DUNDER_REPO_NAME, buildRepoAddress} from '../workspace/buildRepoAddress';
import {workspacePathFromAddress} from '../workspace/workspacePath';

const TIME_FORMAT = {showSeconds: true, showTimezone: true};
export const HIDDEN_METADATA_ENTRY_LABELS = new Set([
'dagster_dbt/select',
Expand All @@ -42,6 +41,16 @@ export const HIDDEN_METADATA_ENTRY_LABELS = new Set([
'dagster_embedded_elt/sling_replication_config',
]);

export type MetadataEntryLabelOnly = Pick<
MaterializationEvent['metadataEntries'][0],
'__typename' | 'label'
>;

export const isCanonicalRowCountMetadataEntry = (
m: MetadataEntryLabelOnly,
): m is IntMetadataEntry =>
m && m.__typename === 'IntMetadataEntry' && m.label === 'dagster/row_count';

export const LogRowStructuredContentTable = ({
rows,
styles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
import {Spacing} from '@dagster-io/ui-components/src/components/types';
import {createContext, useContext, useState} from 'react';

import {MetadataEntryLabelOnly} from './MetadataEntry';
import {TableSchemaFragment} from './types/TableSchemaFragment.types';
import {Timestamp} from '../app/time/Timestamp';
import {StyledTableWithHeader} from '../assets/AssetEventMetadataEntriesTable';
import {AssetFeatureContext} from '../assets/AssetFeatureContext';
import {
AssetKeyInput,
CodeReferencesMetadataEntry,
MaterializationEvent,
TableColumnLineageMetadataEntry,
TableSchemaMetadataEntry,
} from '../graphql/types';
Expand All @@ -35,11 +35,6 @@ interface ITableSchemaProps {
itemHorizontalPadding?: Spacing;
}

type MetadataEntryLabelOnly = Pick<
MaterializationEvent['metadataEntries'][0],
'__typename' | 'label'
>;

export const isCanonicalColumnSchemaEntry = (
m: MetadataEntryLabelOnly,
): m is TableSchemaMetadataEntry =>
Expand Down

0 comments on commit 91e7efa

Please sign in to comment.