Skip to content

Commit

Permalink
[dagit] asset Config (#8154)
Browse files Browse the repository at this point in the history
  • Loading branch information
smackesey committed Jun 2, 2022
1 parent 09fddd9 commit 5c35d39
Show file tree
Hide file tree
Showing 28 changed files with 6,949 additions and 1,549 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';

import {getJSONForKey, useStateWithStorage} from '../hooks/useStateWithStorage';
import {LaunchpadSessionContainerPartitionSetsFragment} from '../launchpad/types/LaunchpadSessionContainerPartitionSetsFragment';
import {LaunchpadSessionContainerPipelineFragment} from '../launchpad/types/LaunchpadSessionContainerPipelineFragment';
import {LaunchpadSessionPartitionSetsFragment} from '../launchpad/types/LaunchpadSessionPartitionSetsFragment';
import {LaunchpadSessionPipelineFragment} from '../launchpad/types/LaunchpadSessionPipelineFragment';
import {buildRepoAddress} from '../workspace/buildRepoAddress';
import {RepoAddress} from '../workspace/types';

Expand Down Expand Up @@ -223,8 +223,8 @@ export const useInvalidateConfigsForRepo = () => {
};

export const useInitialDataForMode = (
pipeline: LaunchpadSessionContainerPipelineFragment,
partitionSets: LaunchpadSessionContainerPartitionSetsFragment,
pipeline: LaunchpadSessionPipelineFragment,
partitionSets: LaunchpadSessionPartitionSetsFragment,
) => {
const {isJob, presets} = pipeline;
const partitionSetsForMode = partitionSets.results;
Expand Down
3 changes: 3 additions & 0 deletions js_modules/dagit/packages/core/src/asset-graph/AssetNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {withMiddleTruncation} from '../app/Util';
import {ASSET_NODE_CONFIG_FRAGMENT} from '../assets/AssetConfig';
import {NodeHighlightColors} from '../graph/OpNode';
import {OpTags} from '../graph/OpTags';
import {linkToRunEvent, titleForRun} from '../runs/RunUtils';
Expand Down Expand Up @@ -188,6 +189,7 @@ export const ASSET_NODE_LIVE_FRAGMENT = gql`
export const ASSET_NODE_FRAGMENT = gql`
fragment AssetNodeFragment on AssetNode {
id
...AssetNodeConfigFragment
graphName
opNames
description
Expand All @@ -205,6 +207,7 @@ export const ASSET_NODE_FRAGMENT = gql`
}
}
}
${ASSET_NODE_CONFIG_FRAGMENT}
`;

const BoxColors = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react';
import {Link} from 'react-router-dom';
import styled from 'styled-components/macro';

import {ASSET_NODE_CONFIG_FRAGMENT, configSchemaForAssetNode} from '../assets/AssetConfig';
import {AssetEvents} from '../assets/AssetEvents';
import {
AssetMetadataTable,
Expand All @@ -18,6 +19,7 @@ import {METADATA_ENTRY_FRAGMENT} from '../metadata/MetadataEntry';
import {Description} from '../pipelines/Description';
import {SidebarSection, SidebarTitle} from '../pipelines/SidebarComponents';
import {pluginForMetadata} from '../plugins';
import {ConfigTypeSchema} from '../typeexplorer/ConfigTypeSchema';
import {buildRepoAddress} from '../workspace/buildRepoAddress';

import {LiveDataForNode, displayNameForAssetKey} from './Utils';
Expand Down Expand Up @@ -49,6 +51,7 @@ export const SidebarAssetInfo: React.FC<{
const repoAddress = buildRepoAddress(asset.repository.name, asset.repository.location.name);
const {assetMetadata, assetType} = metadataForAssetNode(asset);
const hasAssetMetadata = assetType || assetMetadata.length > 0;
const assetConfigSchema = configSchemaForAssetNode(asset);

const OpMetadataPlugin = asset.op?.metadata && pluginForMetadata(asset.op.metadata);

Expand Down Expand Up @@ -80,6 +83,17 @@ export const SidebarAssetInfo: React.FC<{
</SidebarSection>
)}

{assetConfigSchema && (
<SidebarSection title="Config">
<Box padding={{vertical: 16, horizontal: 24}}>
<ConfigTypeSchema
type={assetConfigSchema}
typesInScope={assetConfigSchema.recursiveConfigTypes}
/>
</Box>
</SidebarSection>
)}

{assetMetadata.length > 0 && (
<SidebarSection title="Metadata">
<AssetMetadataTable assetMetadata={assetMetadata} />
Expand Down Expand Up @@ -151,6 +165,7 @@ export const SIDEBAR_ASSET_FRAGMENT = gql`
fragment SidebarAssetFragment on AssetNode {
id
description
...AssetNodeConfigFragment
metadataEntries {
...MetadataEntryFragment
}
Expand All @@ -177,6 +192,7 @@ export const SIDEBAR_ASSET_FRAGMENT = gql`
...AssetNodeOpMetadataFragment
}
${ASSET_NODE_CONFIG_FRAGMENT}
${ASSET_NODE_OP_METADATA_FRAGMENT}
${METADATA_ENTRY_FRAGMENT}
`;
Expand Down

0 comments on commit 5c35d39

Please sign in to comment.