From 323849a284abe7935a98ec52213876e94be66d1b Mon Sep 17 00:00:00 2001 From: JamieDeMaria Date: Mon, 19 Aug 2024 13:37:42 -0400 Subject: [PATCH] fix input types for filter --- .../packages/ui-core/src/graphql/schema.graphql | 2 +- .../dagster-ui/packages/ui-core/src/graphql/types.ts | 7 +++++-- .../dagster-graphql/dagster_graphql/schema/inputs.py | 10 ++-------- .../graphql/test_asset_backfill.py | 7 ++++++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql b/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql index 3db7c425849bc..7eb954b90c398 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql +++ b/js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql @@ -2372,7 +2372,7 @@ enum AssetEventType { } input BulkActionsFilter { - status: [BulkActionStatus!] + status: BulkActionStatus createdBefore: Float createdAfter: Float } diff --git a/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts b/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts index 8a0ef3549d47d..7a85103e320c7 100644 --- a/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts +++ b/js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts @@ -733,7 +733,7 @@ export enum BulkActionStatus { export type BulkActionsFilter = { createdAfter?: InputMaybe; createdBefore?: InputMaybe; - status?: InputMaybe>; + status?: InputMaybe; }; export type CancelBackfillResult = CancelBackfillSuccess | PythonError | UnauthorizedError; @@ -6948,7 +6948,10 @@ export const buildBulkActionsFilter = ( overrides && overrides.hasOwnProperty('createdAfter') ? overrides.createdAfter! : 6.09, createdBefore: overrides && overrides.hasOwnProperty('createdBefore') ? overrides.createdBefore! : 1.5, - status: overrides && overrides.hasOwnProperty('status') ? overrides.status! : [], + status: + overrides && overrides.hasOwnProperty('status') + ? overrides.status! + : BulkActionStatus.CANCELED, }; }; diff --git a/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py b/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py index 2c4947beecbc9..ebd31f858a073 100644 --- a/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py +++ b/python_modules/dagster-graphql/dagster_graphql/schema/inputs.py @@ -375,9 +375,7 @@ class Meta: class GrapheneBulkActionsFilter(graphene.InputObjectType): - status = graphene.List( - graphene.NonNull("dagster_graphql.schema.backfill.GrapheneBulkActionStatus") - ) + status = graphene.InputField("dagster_graphql.schema.backfill.GrapheneBulkActionStatus") createdBefore = graphene.InputField(graphene.Float) createdAfter = graphene.InputField(graphene.Float) @@ -386,11 +384,7 @@ class Meta: name = "BulkActionsFilter" def to_selector(self): - if self.status: - status = BulkActionStatus.from_graphql_input(self.status) - else: - status = None - + status = BulkActionStatus[self.status.value] if self.status else None created_before = datetime_from_timestamp(self.createdBefore) if self.createdBefore else None created_after = datetime_from_timestamp(self.createdAfter) if self.createdAfter else None diff --git a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py index aaf5014daf5ec..ad6591dc4361a 100644 --- a/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py +++ b/python_modules/dagster-graphql/dagster_graphql_tests/graphql/test_asset_backfill.py @@ -1176,7 +1176,6 @@ def test_get_backfills_with_filters(): backfill = instance.get_backfill(backfill_id) all_backfills.append(backfill) - # on PartitionBackfills get_backfills_result = execute_dagster_graphql( context, BACKFILLS_WITH_FILTERS_QUERY, @@ -1200,3 +1199,9 @@ def test_get_backfills_with_filters(): for result in backfill_results: assert result["timestamp"] > all_backfills[3].backfill_timestamp + + get_backfills_result = execute_dagster_graphql( + context, + BACKFILLS_WITH_FILTERS_QUERY, + variables={"filters": {"status": "REQUESTED"}}, + )