diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetSidebarActivitySummary.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetSidebarActivitySummary.tsx index 03af02d9bd494..c189033f40116 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AssetSidebarActivitySummary.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AssetSidebarActivitySummary.tsx @@ -93,7 +93,7 @@ export const AssetSidebarActivitySummary = ({ flex={{direction: 'row', gap: 4, alignItems: 'center'}} > - View auto-materialize history + View automation history diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/AssetAutomaterializePolicyPage.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/AssetAutomaterializePolicyPage.tsx index 78c9576c6bacf..458afaa9101aa 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/AssetAutomaterializePolicyPage.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/AssetAutomaterializePolicyPage.tsx @@ -1,4 +1,4 @@ -import {Box, colorTextLight} from '@dagster-io/ui-components'; +import {Box, Spinner, colorTextLight} from '@dagster-io/ui-components'; import * as React from 'react'; import styled from 'styled-components'; @@ -60,6 +60,17 @@ export const AssetAutomaterializePolicyPage = ({ return evaluations.find((evaluation) => evaluation.evaluationId === selectedEvaluationId); }, [selectedEvaluationId, isFirstPage, evaluations]); + if (!queryResult.data && queryResult.loading) { + return ( + + + + ); + } + return ( { const now = Date.now(); return [ - buildAutoMaterializeAssetEvaluationRecord({ - id: 'g', - evaluationId: TEST_EVALUATION_ID, - timestamp: (now - ONE_MINUTE * 6) / 1000, + buildAssetConditionEvaluationRecord({ numRequested: 2, - numSkipped: 2, - numDiscarded: 2, - }), - buildAutoMaterializeAssetEvaluationRecord({ + evaluation: buildAssetConditionEvaluation({ + rootUniqueId: '1', + evaluationNodes: [ + buildUnpartitionedAssetConditionEvaluationNode({ + uniqueId: '1', + }), + ], + }), + }) as any, + buildAssetConditionEvaluationRecord({ id: 'f', evaluationId: 24, timestamp: (now - ONE_MINUTE * 5) / 1000, numRequested: 2, - numSkipped: 2, - numDiscarded: 0, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'e', evaluationId: 20, timestamp: (now - ONE_MINUTE * 4) / 1000, numRequested: 0, - numSkipped: 2410, - numDiscarded: 3560, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'd', evaluationId: 13, timestamp: (now - ONE_MINUTE * 3) / 1000, numRequested: 2, - numSkipped: 0, - numDiscarded: 2, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'c', timestamp: (now - ONE_MINUTE * 2) / 1000, evaluationId: 12, numRequested: 0, - numSkipped: 0, - numDiscarded: 2, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'b', evaluationId: 4, timestamp: (now - ONE_MINUTE) / 1000, numRequested: 0, - numSkipped: 2, - numDiscarded: 0, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'a', evaluationId: 0, timestamp: now / 1000, numRequested: 2, - numSkipped: 0, - numDiscarded: 0, }), ]; }; @@ -131,29 +124,23 @@ export const buildEvaluationRecordsWithPartitions = () => { export const buildEvaluationRecordsWithoutPartitions = () => { const now = Date.now(); return [ - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'g', evaluationId: TEST_EVALUATION_ID, timestamp: (now - ONE_MINUTE * 6) / 1000, numRequested: 1, - numSkipped: 0, - numDiscarded: 0, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'f', evaluationId: 24, timestamp: (now - ONE_MINUTE * 5) / 1000, numRequested: 0, - numSkipped: 1, - numDiscarded: 0, }), - buildAutoMaterializeAssetEvaluationRecord({ + buildAssetConditionEvaluationRecord({ id: 'e', evaluationId: 20, timestamp: (now - ONE_MINUTE * 4) / 1000, numRequested: 0, - numSkipped: 0, - numDiscarded: 1, }), ]; }; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts deleted file mode 100644 index bdb09ec9d1ef8..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts +++ /dev/null @@ -1,51 +0,0 @@ -import {MockedResponse} from '@apollo/client/testing'; -import faker from 'faker'; - -import {RunStatus, buildPipelineTag, buildRun, buildRuns} from '../../../graphql/types'; -import {DagsterTag} from '../../../runs/RunTag'; -import {RUN_STATUS_AND_PARTITION_KEY} from '../AutomaterializeRequestedPartitionsLink'; -import { - RunStatusAndPartitionKeyQuery, - RunStatusAndPartitionKeyQueryVariables, -} from '../types/AutomaterializeRequestedPartitionsLink.types'; - -const MOCKED_STATUSES = [ - RunStatus.CANCELED, - RunStatus.FAILURE, - RunStatus.STARTED, - RunStatus.SUCCESS, - RunStatus.QUEUED, -]; - -const pickStatus = () => { - const random = faker.datatype.number(MOCKED_STATUSES.length - 1); - return MOCKED_STATUSES[random]!; -}; - -export const buildRunStatusAndPartitionKeyQuery = ( - partitionKeys: string[], - runIds: string[], -): MockedResponse => { - return { - request: { - query: RUN_STATUS_AND_PARTITION_KEY, - variables: { - filter: {runIds}, - }, - }, - result: { - data: { - __typename: 'Query', - runsOrError: buildRuns({ - results: runIds.map((runId, ii) => { - return buildRun({ - id: runId, - status: pickStatus(), - tags: [buildPipelineTag({key: DagsterTag.Partition, value: partitionKeys[ii]!})], - }); - }), - }), - }, - }, - }; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/RunStatusOnlyQuery.fixtures.ts b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/RunStatusOnlyQuery.fixtures.ts deleted file mode 100644 index 2b62d5670f899..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__fixtures__/RunStatusOnlyQuery.fixtures.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {MockedResponse} from '@apollo/client/testing'; - -import {RunStatus, buildRun} from '../../../graphql/types'; -import {RUN_STATUS_ONLY} from '../AutomaterializeRunTag'; -import { - RunStatusOnlyQuery, - RunStatusOnlyQueryVariables, -} from '../types/AutomaterializeRunTag.types'; - -export const buildRunStatusOnlyQuery = ( - runId: string, - status: RunStatus, -): MockedResponse => { - return { - request: { - query: RUN_STATUS_ONLY, - variables: {runId}, - }, - result: { - data: { - __typename: 'Query', - runOrError: buildRun({ - id: runId, - status, - }), - }, - }, - }; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutoMaterializePolicyPage.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutoMaterializePolicyPage.stories.tsx index 7931a431f6dd4..38f3f031e9d3a 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutoMaterializePolicyPage.stories.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutoMaterializePolicyPage.stories.tsx @@ -4,7 +4,7 @@ import React from 'react'; import {AutoMaterializePolicyType} from '../../../graphql/types'; import {AssetAutomaterializePolicyPage} from '../AssetAutomaterializePolicyPage'; -import {Evaluations, Policies} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; +import {Evaluations} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; // eslint-disable-next-line import/no-default-export export default { @@ -16,24 +16,16 @@ const path = ['test']; export const EmptyState = () => { return ( - - + + ); }; export const Errors = () => { return ( - - + + ); }; @@ -42,23 +34,10 @@ export const Controlled = () => { const [policyType, setPolicyType] = React.useState(AutoMaterializePolicyType.EAGER); const [freshnessPolicy, setFreshnessPolicy] = React.useState(true); - const policyMock = React.useMemo(() => { - if (policyType === 'None') { - return freshnessPolicy - ? Policies.NoAutomaterializeYesFreshnessPolicy(path) - : Policies.NoAutomaterializeNoFreshnessPolicy(path); - } else { - return freshnessPolicy - ? Policies.YesAutomaterializeYesFreshnessPolicy(path, policyType) - : Policies.NoAutomaterializeYesFreshnessPolicy(path); - } - }, [freshnessPolicy, policyType]); - return ( -
+
{ /> - +
diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeLeftList.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeLeftList.stories.tsx index e519895d8a03e..9b3e3040fafc1 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeLeftList.stories.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeLeftList.stories.tsx @@ -5,7 +5,7 @@ import { buildEvaluationRecordsWithPartitions, buildEvaluationRecordsWithoutPartitions, } from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; -import {AutoMaterializeEvaluationRecordItemFragment} from '../types/GetEvaluationsQuery.types'; +import {AssetConditionEvaluationRecordFragment} from '../types/GetEvaluationsQuery.types'; // eslint-disable-next-line import/no-default-export export default { @@ -15,7 +15,7 @@ export default { export const WithPartitions = () => { const [selectedEvaluation, setSelectedEvaluation] = React.useState< - AutoMaterializeEvaluationRecordItemFragment | undefined + AssetConditionEvaluationRecordFragment | undefined >(); const evaluations = buildEvaluationRecordsWithPartitions(); @@ -23,9 +23,8 @@ export const WithPartitions = () => { return (
+ onSelectEvaluation={(evaluation: AssetConditionEvaluationRecordFragment) => setSelectedEvaluation(evaluation) } selectedEvaluation={selectedEvaluation} @@ -36,7 +35,7 @@ export const WithPartitions = () => { export const NoPartitions = () => { const [selectedEvaluation, setSelectedEvaluation] = React.useState< - AutoMaterializeEvaluationRecordItemFragment | undefined + AssetConditionEvaluationRecordFragment | undefined >(); const evaluations = buildEvaluationRecordsWithoutPartitions(); @@ -44,9 +43,8 @@ export const NoPartitions = () => { return (
+ onSelectEvaluation={(evaluation: AssetConditionEvaluationRecordFragment) => setSelectedEvaluation(evaluation) } selectedEvaluation={selectedEvaluation} diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeMiddlePanel.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeMiddlePanel.stories.tsx index af5176416c574..dadc54bb13d18 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeMiddlePanel.stories.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeMiddlePanel.stories.tsx @@ -1,13 +1,21 @@ import {MockedProvider} from '@apollo/client/testing'; import * as React from 'react'; -import {RunStatus, buildAssetNode, buildPartitionDefinition} from '../../../graphql/types'; +import { + buildAsset, + buildAssetConditionEvaluation, + buildAssetConditionEvaluationRecord, + buildAssetNode, + buildDimensionPartitionKeys, + buildPartitionDefinition, + buildPartitionedAssetConditionEvaluationNode, + buildUnpartitionedAssetConditionEvaluationNode, +} from '../../../graphql/types'; import { AutomaterializeMiddlePanel, AutomaterializeMiddlePanelWithData, } from '../AutomaterializeMiddlePanel'; import {Evaluations, TEST_EVALUATION_ID} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; -import {buildRunStatusOnlyQuery} from '../__fixtures__/RunStatusOnlyQuery.fixtures'; // eslint-disable-next-line import/no-default-export export default { @@ -19,9 +27,7 @@ const path = ['test']; export const Empty = () => { return ( - +
@@ -31,14 +37,33 @@ export const Empty = () => { export const WithoutPartitions = () => { return ( - +
- +
); @@ -46,16 +71,31 @@ export const WithoutPartitions = () => { export const WithPartitions = () => { return ( - +
diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx deleted file mode 100644 index e3bb8292a4916..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import {MockedProvider} from '@apollo/client/testing'; -import faker from 'faker'; -import * as React from 'react'; - -import {AutomaterializeRequestedPartitionsLink} from '../AutomaterializeRequestedPartitionsLink'; -import {buildRunStatusAndPartitionKeyQuery} from '../__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/AutomaterializeRequestedPartitionsLink', - component: AutomaterializeRequestedPartitionsLink, -}; - -export const ManyPartitionsAndRuns = () => { - const partitionKeys = new Array(40).fill(null).map((_) => faker.lorem.words(3)); - const runIds = new Array(40).fill(null).map((_) => faker.datatype.uuid()); - return ( - - - - ); -}; - -export const OnlyPartitions = () => { - const partitionKeys = new Array(40).fill(null).map((_) => faker.lorem.words(3)); - return ; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PartitionSegmentWithPopover.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PartitionSegmentWithPopover.stories.tsx index 030cb2e663ed6..fe45619a38a65 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PartitionSegmentWithPopover.stories.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PartitionSegmentWithPopover.stories.tsx @@ -34,8 +34,8 @@ export const TruePartitions = () => { {}} /> ); @@ -62,8 +62,8 @@ export const FalsePartitions = () => { {}} /> ); @@ -90,8 +90,8 @@ export const SkippedPartitions = () => { {}} /> ); @@ -118,8 +118,8 @@ export const FewPartitions = () => { {}} /> ); diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PolicyEvaluationTable.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PolicyEvaluationTable.stories.tsx index c985f902f0412..04abdc9343fdb 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PolicyEvaluationTable.stories.tsx +++ b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPage/__stories__/PolicyEvaluationTable.stories.tsx @@ -1,11 +1,7 @@ import * as React from 'react'; -import { - AssetConditionEvaluationStatus, - PartitionedAssetConditionEvaluation, - SpecificPartitionAssetConditionEvaluation, - UnpartitionedAssetConditionEvaluation, -} from '../types'; +import {buildAssetConditionEvaluationRecord} from '../../../graphql/types'; +import {PolicyEvaluationTable} from '../PolicyEvaluationTable'; // eslint-disable-next-line import/no-default-export export default { @@ -15,414 +11,27 @@ export default { export const NonPartitioned = () => { const evaluation = buildAssetConditionEvaluationRecord({ - description: 'All are true:', startTimestamp: 1, endTimestamp: 200, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - buildUnpartition{ - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Any are true:', - startTimestamp: 1, - endTimestamp: 4, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'is_missing', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.SKIPPED, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Not:', - startTimestamp: 6, - endTimestamp: 12, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 6, - endTimestamp: 12, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.FALSE, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'all_parents_up_to_date', - startTimestamp: 12, - endTimestamp: 14, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'not_any_parent_missing', - startTimestamp: 14, - endTimestamp: 28, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - ], }); - return ; + return {}} />; }; export const Partitioned = () => { - const evaluation: PartitionedAssetConditionEvaluation = { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'All are true:', + const evaluation = buildAssetConditionEvaluationRecord({ startTimestamp: 1, endTimestamp: 200, - numTrue: 0, - numFalse: 100, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(100).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'Any are true:', - startTimestamp: 1, - endTimestamp: 4, - numTrue: 30, - numFalse: 70, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(70).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - numTrue: 30, - numFalse: 20, - numSkipped: 50, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(20).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(50).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'is_missing', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - numTrue: 0, - numFalse: 30, - numSkipped: 70, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(30).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(70).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - ], - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'Not:', - startTimestamp: 6, - endTimestamp: 12, - numTrue: 30, - numFalse: 70, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(70).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 6, - endTimestamp: 12, - // metadataEntries: [MetadataEntry!]! - numTrue: 80, - numFalse: 20, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(80).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(20).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: null, - }, - ], - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'all_parents_up_to_date', - startTimestamp: 12, - endTimestamp: 14, - numTrue: 0, - numFalse: 100, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(100).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: null, - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'not_any_parent_missing', - startTimestamp: 14, - endTimestamp: 28, - numTrue: 0, - numFalse: 0, - numSkipped: 100, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(100).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - ], - }; + }); - return ; + return {}} />; }; export const SpecificPartition = () => { - const evaluation: SpecificPartitionAssetConditionEvaluation = { - __typename: 'SpecificPartitionAssetConditionEvaluation' as const, - description: 'All are true:', - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Any are true:', - startTimestamp: 1, - endTimestamp: 4, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'is_missing', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.SKIPPED, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Not:', - startTimestamp: 6, - endTimestamp: 12, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 6, - endTimestamp: 12, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.FALSE, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'all_parents_up_to_date', - startTimestamp: 12, - endTimestamp: 14, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'not_any_parent_missing', - startTimestamp: 14, - endTimestamp: 28, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - ], - }; + const evaluation = buildAssetConditionEvaluationRecord({ + startTimestamp: 1, + endTimestamp: 200, + }); - return ; + return {}} />; }; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutoMaterializePolicyPage.fixtures.ts b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutoMaterializePolicyPage.fixtures.ts deleted file mode 100644 index 66f8a0bc24fd6..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutoMaterializePolicyPage.fixtures.ts +++ /dev/null @@ -1,436 +0,0 @@ -import {MockedResponse} from '@apollo/client/testing'; -import {DocumentNode} from 'graphql'; - -import { - AutoMaterializeDecisionType, - AutoMaterializePolicyType, - buildAssetKey, - buildAssetNode, - buildAutoMaterializeAssetEvaluationNeedsMigrationError, - buildAutoMaterializeAssetEvaluationRecord, - buildAutoMaterializeAssetEvaluationRecords, - buildAutoMaterializePolicy, - buildAutoMaterializeRule, - buildAutoMaterializeRuleEvaluation, - buildAutoMaterializeRuleWithRuleEvaluations, - buildFreshnessPolicy, - buildParentMaterializedRuleEvaluationData, - buildPartitionKeys, -} from '../../../graphql/types'; -import {GET_POLICY_INFO_QUERY} from '../AutomaterializeRightPanel'; -import {GET_EVALUATIONS_QUERY} from '../GetEvaluationsQuery'; -import { - OldGetPolicyInfoQuery, - OldGetPolicyInfoQueryVariables, -} from '../types/AutomaterializeRightPanel.types'; -import { - OldGetEvaluationsQuery, - OldGetEvaluationsQueryVariables, -} from '../types/GetEvaluationsQuery.types'; -import {PAGE_SIZE} from '../useEvaluationsQueryResult'; - -export function buildQueryMock< - TQuery extends {__typename: 'Query'}, - TVariables extends Record, ->({ - query, - variables, - data, -}: { - query: DocumentNode; - variables: TVariables; - data: Omit; -}): MockedResponse { - return { - request: { - query, - variables, - }, - result: { - data: { - __typename: 'Query', - ...data, - } as TQuery, - }, - }; -} - -export const buildGetEvaluationsQuery = ({ - variables, - data, -}: { - variables: OldGetEvaluationsQueryVariables; - data: Omit; -}): MockedResponse => { - return buildQueryMock({ - query: GET_EVALUATIONS_QUERY, - variables, - data, - }); -}; - -export const buildGetPolicyInfoQuery = ({ - variables, - data, -}: { - variables: OldGetPolicyInfoQueryVariables; - data: Omit; -}): MockedResponse => { - return buildQueryMock({ - query: GET_POLICY_INFO_QUERY, - variables, - data, - }); -}; - -const ONE_MINUTE = 1000 * 60; - -export const TEST_EVALUATION_ID = 27; - -export const buildEvaluationRecordsWithPartitions = () => { - const now = Date.now(); - return [ - buildAutoMaterializeAssetEvaluationRecord({ - id: 'g', - evaluationId: TEST_EVALUATION_ID, - timestamp: (now - ONE_MINUTE * 6) / 1000, - numRequested: 2, - numSkipped: 2, - numDiscarded: 2, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'f', - evaluationId: 24, - timestamp: (now - ONE_MINUTE * 5) / 1000, - numRequested: 2, - numSkipped: 2, - numDiscarded: 0, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'e', - evaluationId: 20, - timestamp: (now - ONE_MINUTE * 4) / 1000, - numRequested: 0, - numSkipped: 2410, - numDiscarded: 3560, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'd', - evaluationId: 13, - timestamp: (now - ONE_MINUTE * 3) / 1000, - numRequested: 2, - numSkipped: 0, - numDiscarded: 2, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'c', - timestamp: (now - ONE_MINUTE * 2) / 1000, - evaluationId: 12, - numRequested: 0, - numSkipped: 0, - numDiscarded: 2, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'b', - evaluationId: 4, - timestamp: (now - ONE_MINUTE) / 1000, - numRequested: 0, - numSkipped: 2, - numDiscarded: 0, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'a', - evaluationId: 0, - timestamp: now / 1000, - numRequested: 2, - numSkipped: 0, - numDiscarded: 0, - }), - ]; -}; - -export const buildEvaluationRecordsWithoutPartitions = () => { - const now = Date.now(); - return [ - buildAutoMaterializeAssetEvaluationRecord({ - id: 'g', - evaluationId: TEST_EVALUATION_ID, - timestamp: (now - ONE_MINUTE * 6) / 1000, - numRequested: 1, - numSkipped: 0, - numDiscarded: 0, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'f', - evaluationId: 24, - timestamp: (now - ONE_MINUTE * 5) / 1000, - numRequested: 0, - numSkipped: 1, - numDiscarded: 0, - }), - buildAutoMaterializeAssetEvaluationRecord({ - id: 'e', - evaluationId: 20, - timestamp: (now - ONE_MINUTE * 4) / 1000, - numRequested: 0, - numSkipped: 0, - numDiscarded: 1, - }), - ]; -}; - -export const SINGLE_MATERIALIZE_RECORD_WITH_PARTITIONS = buildAutoMaterializeAssetEvaluationRecord({ - evaluationId: TEST_EVALUATION_ID, - runIds: ['abcdef12'], - rulesWithRuleEvaluations: [ - buildAutoMaterializeRuleWithRuleEvaluations({ - rule: buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.MATERIALIZE, - description: `Upstream data has changed since latest materialization`, - }), - ruleEvaluations: [ - buildAutoMaterializeRuleEvaluation({ - evaluationData: buildParentMaterializedRuleEvaluationData({ - updatedAssetKeys: [buildAssetKey({path: ['upstream_1']})], - }), - partitionKeysOrError: buildPartitionKeys({ - partitionKeys: ['bar'], - }), - }), - buildAutoMaterializeRuleEvaluation({ - evaluationData: buildParentMaterializedRuleEvaluationData({ - updatedAssetKeys: [ - buildAssetKey({path: ['upstream_1']}), - buildAssetKey({path: ['upstream_2']}), - ], - }), - partitionKeysOrError: buildPartitionKeys({ - partitionKeys: ['foo'], - }), - }), - ], - }), - buildAutoMaterializeRuleWithRuleEvaluations({ - rule: buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.SKIP, - description: `Waiting on upstream data`, - }), - ruleEvaluations: [ - buildAutoMaterializeRuleEvaluation({ - evaluationData: null, - partitionKeysOrError: buildPartitionKeys({ - partitionKeys: ['gomez'], - }), - }), - ], - }), - ], -}); - -export const SINGLE_MATERIALIZE_RECORD_NO_PARTITIONS = buildAutoMaterializeAssetEvaluationRecord({ - evaluationId: TEST_EVALUATION_ID, - runIds: ['abcdef12'], - rulesWithRuleEvaluations: [ - buildAutoMaterializeRuleWithRuleEvaluations({ - rule: buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.MATERIALIZE, - description: `Materialization is missing`, - }), - ruleEvaluations: [ - buildAutoMaterializeRuleEvaluation({ - evaluationData: null, - partitionKeysOrError: null, - }), - ], - }), - ], -}); - -export const BASE_AUTOMATERIALIZE_RULES = [ - buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.MATERIALIZE, - description: `Materialization is missing`, - }), - buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.MATERIALIZE, - description: `Upstream data has changed since latest materialization`, - }), - buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.MATERIALIZE, - description: `Required to meet this or downstream asset's freshness policy`, - }), - buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.SKIP, - description: `Waiting on upstream data`, - }), -]; - -export const DISCARD_RULE = buildAutoMaterializeRule({ - decisionType: AutoMaterializeDecisionType.DISCARD, - description: `Exceeds 5 materializations per minute`, -}); - -export const Evaluations = { - None: (assetKeyPath: string[], single?: boolean) => { - return buildGetEvaluationsQuery({ - variables: { - assetKey: {path: assetKeyPath}, - cursor: single ? '2' : undefined, - limit: (single ? 1 : PAGE_SIZE) + 1, - }, - data: { - assetNodeOrError: buildAssetNode({ - autoMaterializePolicy: buildAutoMaterializePolicy({ - rules: BASE_AUTOMATERIALIZE_RULES, - }), - currentAutoMaterializeEvaluationId: 1000, - }), - autoMaterializeAssetEvaluationsOrError: buildAutoMaterializeAssetEvaluationRecords({ - records: [], - }), - }, - }); - }, - Errors: (assetKeyPath: string[], single?: boolean) => { - return buildGetEvaluationsQuery({ - variables: { - assetKey: {path: assetKeyPath}, - cursor: single ? '2' : undefined, - limit: (single ? 1 : PAGE_SIZE) + 1, - }, - data: { - assetNodeOrError: buildAssetNode({ - autoMaterializePolicy: buildAutoMaterializePolicy({ - rules: BASE_AUTOMATERIALIZE_RULES, - }), - }), - autoMaterializeAssetEvaluationsOrError: - buildAutoMaterializeAssetEvaluationNeedsMigrationError({ - message: 'Test message', - }), - }, - }); - }, - Single: (assetKeyPath?: string[], cursor?: string) => { - return buildGetEvaluationsQuery({ - variables: { - assetKey: {path: assetKeyPath || ['test']}, - cursor, - limit: 2, - }, - data: { - assetNodeOrError: buildAssetNode({ - autoMaterializePolicy: buildAutoMaterializePolicy({ - rules: [...BASE_AUTOMATERIALIZE_RULES, DISCARD_RULE], - }), - }), - autoMaterializeAssetEvaluationsOrError: buildAutoMaterializeAssetEvaluationRecords({ - records: assetKeyPath ? [SINGLE_MATERIALIZE_RECORD_NO_PARTITIONS] : [], - }), - }, - }); - }, - SinglePartitioned: (assetKeyPath: string[], cursor?: string) => { - return buildGetEvaluationsQuery({ - variables: { - assetKey: {path: assetKeyPath}, - cursor, - limit: 2, - }, - data: { - assetNodeOrError: buildAssetNode({ - autoMaterializePolicy: buildAutoMaterializePolicy({ - rules: [...BASE_AUTOMATERIALIZE_RULES, DISCARD_RULE], - }), - }), - autoMaterializeAssetEvaluationsOrError: buildAutoMaterializeAssetEvaluationRecords({ - records: assetKeyPath ? [SINGLE_MATERIALIZE_RECORD_WITH_PARTITIONS] : [], - }), - }, - }); - }, - Some: (assetKeyPath: string[]) => { - return buildGetEvaluationsQuery({ - variables: { - assetKey: {path: assetKeyPath}, - cursor: undefined, - limit: PAGE_SIZE + 1, - }, - data: { - assetNodeOrError: buildAssetNode({ - autoMaterializePolicy: buildAutoMaterializePolicy({ - rules: [...BASE_AUTOMATERIALIZE_RULES, DISCARD_RULE], - }), - }), - autoMaterializeAssetEvaluationsOrError: buildAutoMaterializeAssetEvaluationRecords({ - records: buildEvaluationRecordsWithPartitions(), - }), - }, - }); - }, -}; - -export const Policies = { - YesAutomaterializeNoFreshnessPolicy: ( - assetKeyPath: string[], - policyType: AutoMaterializePolicyType = AutoMaterializePolicyType.EAGER, - ) => { - return buildGetPolicyInfoQuery({ - variables: { - assetKey: {path: assetKeyPath}, - }, - data: { - assetNodeOrError: buildAssetNode({ - freshnessPolicy: null, - autoMaterializePolicy: buildAutoMaterializePolicy({ - policyType, - }), - }), - }, - }); - }, - YesAutomaterializeYesFreshnessPolicy: ( - assetKeyPath: string[], - policyType: AutoMaterializePolicyType = AutoMaterializePolicyType.EAGER, - ) => { - return buildGetPolicyInfoQuery({ - variables: { - assetKey: {path: assetKeyPath}, - }, - data: { - assetNodeOrError: buildAssetNode({ - freshnessPolicy: buildFreshnessPolicy({}), - autoMaterializePolicy: buildAutoMaterializePolicy({ - policyType, - }), - }), - }, - }); - }, - NoAutomaterializeYesFreshnessPolicy: (assetKeyPath: string[]) => { - return buildGetPolicyInfoQuery({ - variables: { - assetKey: {path: assetKeyPath}, - }, - data: { - assetNodeOrError: buildAssetNode({ - freshnessPolicy: buildFreshnessPolicy(), - autoMaterializePolicy: null, - }), - }, - }); - }, - NoAutomaterializeNoFreshnessPolicy: (assetKeyPath: string[]) => { - return buildGetPolicyInfoQuery({ - variables: { - assetKey: {path: assetKeyPath}, - }, - data: { - assetNodeOrError: buildAssetNode({ - freshnessPolicy: null, - autoMaterializePolicy: null, - }), - }, - }); - }, -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts deleted file mode 100644 index 015230e788f74..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures.ts +++ /dev/null @@ -1,51 +0,0 @@ -import {MockedResponse} from '@apollo/client/testing'; -import faker from 'faker'; - -import {RunStatus, buildPipelineTag, buildRun, buildRuns} from '../../../graphql/types'; -import {DagsterTag} from '../../../runs/RunTag'; -import {RUN_STATUS_AND_PARTITION_KEY} from '../AutomaterializeRequestedPartitionsLink'; -import { - OldRunStatusAndPartitionKeyQuery, - OldRunStatusAndPartitionKeyQueryVariables, -} from '../types/AutomaterializeRequestedPartitionsLink.types'; - -const MOCKED_STATUSES = [ - RunStatus.CANCELED, - RunStatus.FAILURE, - RunStatus.STARTED, - RunStatus.SUCCESS, - RunStatus.QUEUED, -]; - -const pickStatus = () => { - const random = faker.datatype.number(MOCKED_STATUSES.length - 1); - return MOCKED_STATUSES[random]!; -}; - -export const buildRunStatusAndPartitionKeyQuery = ( - partitionKeys: string[], - runIds: string[], -): MockedResponse => { - return { - request: { - query: RUN_STATUS_AND_PARTITION_KEY, - variables: { - filter: {runIds}, - }, - }, - result: { - data: { - __typename: 'Query', - runsOrError: buildRuns({ - results: runIds.map((runId, ii) => { - return buildRun({ - id: runId, - status: pickStatus(), - tags: [buildPipelineTag({key: DagsterTag.Partition, value: partitionKeys[ii]!})], - }); - }), - }), - }, - }, - }; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/RunStatusOnlyQuery.fixtures.ts b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/RunStatusOnlyQuery.fixtures.ts deleted file mode 100644 index f14326ae7a81b..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__fixtures__/RunStatusOnlyQuery.fixtures.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {MockedResponse} from '@apollo/client/testing'; - -import {RunStatus, buildRun} from '../../../graphql/types'; -import {RUN_STATUS_ONLY} from '../AutomaterializeRunTag'; -import { - OldRunStatusOnlyQuery, - OldRunStatusOnlyQueryVariables, -} from '../types/AutomaterializeRunTag.types'; - -export const buildRunStatusOnlyQuery = ( - runId: string, - status: RunStatus, -): MockedResponse => { - return { - request: { - query: RUN_STATUS_ONLY, - variables: {runId}, - }, - result: { - data: { - __typename: 'Query', - runOrError: buildRun({ - id: runId, - status, - }), - }, - }, - }; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutoMaterializePolicyPage.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutoMaterializePolicyPage.stories.tsx deleted file mode 100644 index 7931a431f6dd4..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutoMaterializePolicyPage.stories.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import {MockedProvider} from '@apollo/client/testing'; -import {Box, ButtonGroup, Checkbox, JoinedButtons} from '@dagster-io/ui-components'; -import React from 'react'; - -import {AutoMaterializePolicyType} from '../../../graphql/types'; -import {AssetAutomaterializePolicyPage} from '../AssetAutomaterializePolicyPage'; -import {Evaluations, Policies} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize', - component: AssetAutomaterializePolicyPage, -}; - -const path = ['test']; - -export const EmptyState = () => { - return ( - - - - ); -}; - -export const Errors = () => { - return ( - - - - ); -}; - -export const Controlled = () => { - const [policyType, setPolicyType] = React.useState(AutoMaterializePolicyType.EAGER); - const [freshnessPolicy, setFreshnessPolicy] = React.useState(true); - - const policyMock = React.useMemo(() => { - if (policyType === 'None') { - return freshnessPolicy - ? Policies.NoAutomaterializeYesFreshnessPolicy(path) - : Policies.NoAutomaterializeNoFreshnessPolicy(path); - } else { - return freshnessPolicy - ? Policies.YesAutomaterializeYesFreshnessPolicy(path, policyType) - : Policies.NoAutomaterializeYesFreshnessPolicy(path); - } - }, [freshnessPolicy, policyType]); - - return ( -
- -
- - { - setFreshnessPolicy((policy) => !policy); - }} - /> - - { - setPolicyType(id as any); - }} - /> - - - -
-
-
- ); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeLeftList.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeLeftList.stories.tsx deleted file mode 100644 index e519895d8a03e..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeLeftList.stories.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import * as React from 'react'; - -import {AutomaterializeLeftList} from '../AutomaterializeLeftPanel'; -import { - buildEvaluationRecordsWithPartitions, - buildEvaluationRecordsWithoutPartitions, -} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; -import {AutoMaterializeEvaluationRecordItemFragment} from '../types/GetEvaluationsQuery.types'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/AutomaterializeLeftList', - component: AutomaterializeLeftList, -}; - -export const WithPartitions = () => { - const [selectedEvaluation, setSelectedEvaluation] = React.useState< - AutoMaterializeEvaluationRecordItemFragment | undefined - >(); - - const evaluations = buildEvaluationRecordsWithPartitions(); - - return ( -
- - setSelectedEvaluation(evaluation) - } - selectedEvaluation={selectedEvaluation} - /> -
- ); -}; - -export const NoPartitions = () => { - const [selectedEvaluation, setSelectedEvaluation] = React.useState< - AutoMaterializeEvaluationRecordItemFragment | undefined - >(); - - const evaluations = buildEvaluationRecordsWithoutPartitions(); - - return ( -
- - setSelectedEvaluation(evaluation) - } - selectedEvaluation={selectedEvaluation} - /> -
- ); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeMiddlePanel.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeMiddlePanel.stories.tsx deleted file mode 100644 index 806e531338f96..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeMiddlePanel.stories.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import {MockedProvider} from '@apollo/client/testing'; -import * as React from 'react'; - -import {RunStatus} from '../../../graphql/types'; -import { - AutomaterializeMiddlePanel, - AutomaterializeMiddlePanelWithData, -} from '../AutomaterializeMiddlePanel'; -import {Evaluations, TEST_EVALUATION_ID} from '../__fixtures__/AutoMaterializePolicyPage.fixtures'; -import {buildRunStatusOnlyQuery} from '../__fixtures__/RunStatusOnlyQuery.fixtures'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/AutomaterializeMiddlePanelWithData', - component: AutomaterializeMiddlePanelWithData, -}; - -const path = ['test']; - -export const Empty = () => { - return ( - -
- -
-
- ); -}; - -export const WithoutPartitions = () => { - return ( - -
- -
-
- ); -}; - -export const WithPartitions = () => { - return ( - -
- -
-
- ); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx deleted file mode 100644 index e3bb8292a4916..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/AutomaterializeRequestedPartitionsLink.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import {MockedProvider} from '@apollo/client/testing'; -import faker from 'faker'; -import * as React from 'react'; - -import {AutomaterializeRequestedPartitionsLink} from '../AutomaterializeRequestedPartitionsLink'; -import {buildRunStatusAndPartitionKeyQuery} from '../__fixtures__/AutomaterializeRequestedPartitionsLink.fixtures'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/AutomaterializeRequestedPartitionsLink', - component: AutomaterializeRequestedPartitionsLink, -}; - -export const ManyPartitionsAndRuns = () => { - const partitionKeys = new Array(40).fill(null).map((_) => faker.lorem.words(3)); - const runIds = new Array(40).fill(null).map((_) => faker.datatype.uuid()); - return ( - - - - ); -}; - -export const OnlyPartitions = () => { - const partitionKeys = new Array(40).fill(null).map((_) => faker.lorem.words(3)); - return ; -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PartitionSegmentWithPopover.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PartitionSegmentWithPopover.stories.tsx deleted file mode 100644 index eda22c37b78b3..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PartitionSegmentWithPopover.stories.tsx +++ /dev/null @@ -1,126 +0,0 @@ -import {Box} from '@dagster-io/ui-components'; -import faker from 'faker'; -import * as React from 'react'; - -import {PartitionSegmentWithPopover} from '../PartitionSegmentWithPopover'; -import {AssetConditionEvaluationStatus, AssetSubset} from '../types'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/PartitionSegmentWithPopover', - component: PartitionSegmentWithPopover, -}; - -const PARTITION_COUNT = 300; - -export const TruePartitions = () => { - const subset: AssetSubset = React.useMemo(() => { - const partitionKeys = new Array(PARTITION_COUNT) - .fill(null) - .map(() => faker.random.words(2).toLowerCase().replace(/ /g, '-')); - return { - assetKey: {path: ['foo', 'bar']}, - subsetValue: { - boolValue: true, - partitionKeys, - partitionKeyRanges: null, - isPartitioned: true, - }, - }; - }, []); - - return ( - - - - ); -}; - -export const FalsePartitions = () => { - const subset: AssetSubset = React.useMemo(() => { - const partitionKeys = new Array(PARTITION_COUNT) - .fill(null) - .map(() => faker.random.words(2).toLowerCase().replace(/ /g, '-')); - return { - assetKey: {path: ['foo', 'bar']}, - subsetValue: { - boolValue: false, - partitionKeys, - partitionKeyRanges: null, - isPartitioned: true, - }, - }; - }, []); - - return ( - - - - ); -}; - -export const SkippedPartitions = () => { - const subset: AssetSubset = React.useMemo(() => { - const partitionKeys = new Array(PARTITION_COUNT) - .fill(null) - .map(() => faker.random.words(2).toLowerCase().replace(/ /g, '-')); - return { - assetKey: {path: ['foo', 'bar']}, - subsetValue: { - boolValue: null, - partitionKeys, - partitionKeyRanges: null, - isPartitioned: true, - }, - }; - }, []); - - return ( - - - - ); -}; - -export const FewPartitions = () => { - const subset: AssetSubset = React.useMemo(() => { - const partitionKeys = new Array(2) - .fill(null) - .map(() => faker.random.words(2).toLowerCase().replace(/ /g, '-')); - return { - assetKey: {path: ['foo', 'bar']}, - subsetValue: { - boolValue: true, - partitionKeys, - partitionKeyRanges: null, - isPartitioned: true, - }, - }; - }, []); - - return ( - - - - ); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationCondition.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationCondition.stories.tsx deleted file mode 100644 index e9905d8c3f4c0..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationCondition.stories.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import {Table} from '@dagster-io/ui-components'; -import * as React from 'react'; - -import {PolicyEvaluationCondition} from '../PolicyEvaluationCondition'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/PolicyEvaluationCondition', - component: PolicyEvaluationCondition, -}; - -export const Default = () => { - return ( - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- -
- -
- -
- ); -}; diff --git a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationTable.stories.tsx b/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationTable.stories.tsx deleted file mode 100644 index 76d7aac770059..0000000000000 --- a/js_modules/dagster-ui/packages/ui-core/src/assets/AutoMaterializePolicyPageOld/__stories__/PolicyEvaluationTable.stories.tsx +++ /dev/null @@ -1,356 +0,0 @@ -import * as React from 'react'; - -import {PolicyEvaluationTable} from '../PolicyEvaluationTable'; -import { - AssetConditionEvaluationStatus, - PartitionedAssetConditionEvaluation, - UnpartitionedAssetConditionEvaluation, -} from '../types'; - -// eslint-disable-next-line import/no-default-export -export default { - title: 'Asset Details/Automaterialize/PolicyEvaluationTable', - component: PolicyEvaluationTable, -}; - -export const NonPartitioned = () => { - const evaluation: UnpartitionedAssetConditionEvaluation = { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'All are true:', - startTimestamp: 1, - endTimestamp: 200, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Any are true:', - startTimestamp: 1, - endTimestamp: 4, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'is_missing', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.SKIPPED, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'Not:', - startTimestamp: 6, - endTimestamp: 12, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: [ - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 6, - endTimestamp: 12, - // metadataEntries: [MetadataEntry!]! - status: AssetConditionEvaluationStatus.FALSE, - childEvaluations: null, - }, - ], - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'all_parents_up_to_date', - startTimestamp: 12, - endTimestamp: 14, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - { - __typename: 'UnpartitionedAssetConditionEvaluation' as const, - description: 'not_any_parent_missing', - startTimestamp: 14, - endTimestamp: 28, - status: AssetConditionEvaluationStatus.TRUE, - childEvaluations: null, - }, - ], - }; - - return ; -}; - -export const Partitioned = () => { - const evaluation: PartitionedAssetConditionEvaluation = { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'All are true:', - startTimestamp: 1, - endTimestamp: 200, - numTrue: 0, - numFalse: 100, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(100).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'Any are true:', - startTimestamp: 1, - endTimestamp: 4, - numTrue: 30, - numFalse: 70, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(70).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - numTrue: 30, - numFalse: 20, - numSkipped: 50, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(20).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(50).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'is_missing', - startTimestamp: 1, - endTimestamp: 2, - // metadataEntries: [MetadataEntry!]! - numTrue: 0, - numFalse: 30, - numSkipped: 70, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(30).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(70).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - ], - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'Not:', - startTimestamp: 6, - endTimestamp: 12, - numTrue: 30, - numFalse: 70, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(30).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(70).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: [ - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'parent_updated', - startTimestamp: 6, - endTimestamp: 12, - // metadataEntries: [MetadataEntry!]! - numTrue: 80, - numFalse: 20, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: new Array(80).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(20).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: null, - }, - ], - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'all_parents_up_to_date', - startTimestamp: 12, - endTimestamp: 14, - numTrue: 0, - numFalse: 100, - numSkipped: 0, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: new Array(100).fill(null).map((_, ii) => `false-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: null, - childEvaluations: null, - }, - { - __typename: 'PartitionedAssetConditionEvaluation' as const, - description: 'not_any_parent_missing', - startTimestamp: 14, - endTimestamp: 28, - numTrue: 0, - numFalse: 0, - numSkipped: 100, - trueSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: true, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - falseSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: false, - partitionKeys: [], - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - candidateSubset: { - assetKey: {path: ['foo']}, - subsetValue: { - boolValue: null, - partitionKeys: new Array(100).fill(null).map((_, ii) => `true-${ii}`), - partitionKeyRanges: null, - isPartitioned: true, - }, - }, - childEvaluations: null, - }, - ], - }; - - return ; -};