-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ui] Use location-based feature flag on partitions dialog (#17017)
## Summary & Motivation Add a feature flag utility to read flags from location entries, use it to gate the `SHOW_SINGLE_RUN_BACKFILL_TOGGLE` UI in the materialization partition dialog. <img width="758" alt="Screenshot 2023-10-04 at 5 41 44 PM" src="https://github.com/dagster-io/dagster/assets/2823852/4f51346d-ff95-4af4-be10-95d07a4918d9"> ## How I Tested These Changes Jest to verify flag checking. View http://localhost:3000/locations/partitioned_assets_repository@dagster_test.toys.repo/asset-groups/default/lineage/hourly_asset1, materialize. Verify that the radio container is not rendered. Force the flag utility hook to return true, verify that the radio container is rendered.
- Loading branch information
Showing
5 changed files
with
201 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...agster-ui/packages/ui-core/src/workspace/__tests__/getFeatureFlagForCodeLocation.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {buildFeatureFlag, buildWorkspaceLocationEntry} from '../../graphql/types'; | ||
import {getFeatureFlagForCodeLocation} from '../WorkspaceContext'; | ||
import {WorkspaceLocationNodeFragment} from '../types/WorkspaceContext.types'; | ||
|
||
describe('getFeatureFlagForCodeLocation', () => { | ||
const locationEntries: WorkspaceLocationNodeFragment[] = [ | ||
buildWorkspaceLocationEntry({ | ||
id: 'foo', | ||
featureFlags: [ | ||
buildFeatureFlag({ | ||
name: 'LOREM', | ||
enabled: false, | ||
}), | ||
buildFeatureFlag({ | ||
name: 'IPSUM', | ||
enabled: true, | ||
}), | ||
], | ||
}), | ||
]; | ||
|
||
it('returns true for an enabled flag in a matching code location', () => { | ||
expect(getFeatureFlagForCodeLocation(locationEntries, 'foo', 'IPSUM')).toBe(true); | ||
}); | ||
|
||
it('returns false for a disabled flag in a matching code location', () => { | ||
expect(getFeatureFlagForCodeLocation(locationEntries, 'foo', 'LOREM')).toBe(false); | ||
}); | ||
|
||
it('returns false for a flag that cannot be found in a matching code location', () => { | ||
expect(getFeatureFlagForCodeLocation(locationEntries, 'foo', 'FAKE_FLAG')).toBe(false); | ||
}); | ||
|
||
it('returns false for an existing flag that cannot be found in an unknown code location', () => { | ||
expect(getFeatureFlagForCodeLocation(locationEntries, 'FAKE_LOCATION', 'IPSUM')).toBe(false); | ||
}); | ||
|
||
it('returns false for an unknown flag in an unknown code location', () => { | ||
expect(getFeatureFlagForCodeLocation(locationEntries, 'FAKE_LOCATION', 'FAKE_FLAG')).toBe( | ||
false, | ||
); | ||
}); | ||
}); |
2 changes: 2 additions & 0 deletions
2
js_modules/dagster-ui/packages/ui-core/src/workspace/types/WorkspaceContext.types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.