src: Remove snapshots fallthrough logic

Snapshotting is available in prod-stable now. We can probably remove the fallthrough logic now.
This commit is contained in:
regexowl 2025-02-05 11:59:04 +01:00 committed by Klara Simickova
parent 87d6c57174
commit 34720c799e
6 changed files with 60 additions and 100 deletions

View file

@ -61,7 +61,7 @@ import {
} from '../../../../store/wizardSlice';
import { useFlag } from '../../../../Utilities/useGetEnvironment';
const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
const Review = () => {
const { goToStepById } = useWizardContext();
const blueprintName = useAppSelector(selectBlueprintName);
@ -349,8 +349,7 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
isIndented
data-testid="content-expandable"
>
{/* Intentional prop drilling for simplicity - To be removed */}
<ContentList snapshottingEnabled={snapshottingEnabled} />
<ContentList />
</ExpandableSection>
{isUsersEnabled && users.length > 0 && (
<ExpandableSection

View file

@ -433,11 +433,7 @@ export const TargetEnvOtherList = () => {
);
};
export const ContentList = ({
snapshottingEnabled,
}: {
snapshottingEnabled: boolean;
}) => {
export const ContentList = () => {
const customRepositories = useAppSelector(selectCustomRepositories);
const packages = useAppSelector(selectPackages);
const groups = useAppSelector(selectGroups);
@ -497,61 +493,54 @@ export const ContentList = ({
<>
<TextContent>
<TextList component={TextListVariants.dl}>
{snapshottingEnabled ? (
<>
<TextListItem
component={TextListItemVariants.dt}
className="pf-v5-u-min-width"
<>
<TextListItem
component={TextListItemVariants.dt}
className="pf-v5-u-min-width"
>
Repository snapshot
</TextListItem>
<TextListItem
component={TextListItemVariants.dd}
data-testid="snapshot-method"
>
<Popover
position="bottom"
headerContent={
useLatest
? 'Repositories as of today'
: `Repositories as of ${yyyyMMddFormat(
new Date(snapshotDate)
)}`
}
hasAutoWidth
minWidth="60rem"
bodyContent={
<SnapshotTable snapshotForDate={data?.data || []} />
}
>
Repository snapshot
</TextListItem>
<TextListItem
component={TextListItemVariants.dd}
data-testid="snapshot-method"
>
<Popover
position="bottom"
headerContent={
useLatest
? 'Repositories as of today'
: `Repositories as of ${yyyyMMddFormat(
new Date(snapshotDate)
)}`
}
hasAutoWidth
minWidth="60rem"
bodyContent={
<SnapshotTable snapshotForDate={data?.data || []} />
}
<Button
variant="link"
aria-label="Snapshot method"
className="pf-v5-u-p-0"
isDisabled={noRepositoriesSelected || isLoading || isError}
isLoading={isLoading}
>
<Button
variant="link"
aria-label="Snapshot method"
className="pf-v5-u-p-0"
isDisabled={noRepositoriesSelected || isLoading || isError}
isLoading={isLoading}
>
{snapshottingText}
</Button>
</Popover>
{!useLatest &&
!isLoading &&
isSuccess &&
hasSnapshotDateAfter ? (
<Alert
variant="warning"
isInline
isPlain
title="A snapshot for this date is not available for some repositories."
/>
) : (
''
)}
</TextListItem>
</>
) : (
''
)}
{snapshottingText}
</Button>
</Popover>
{!useLatest && !isLoading && isSuccess && hasSnapshotDateAfter ? (
<Alert
variant="warning"
isInline
isPlain
title="A snapshot for this date is not available for some repositories."
/>
) : (
''
)}
</TextListItem>
</>
<TextListItem component={TextListItemVariants.dt}>
Custom repositories
</TextListItem>

View file

@ -11,11 +11,7 @@ import {
} from '../../../../store/wizardSlice';
import { useGenerateDefaultName } from '../../utilities/useGenerateDefaultName';
const ReviewStep = ({
snapshottingEnabled,
}: {
snapshottingEnabled: boolean;
}) => {
const ReviewStep = () => {
const blueprintName = useAppSelector(selectBlueprintName);
const blueprintDescription = useAppSelector(selectBlueprintDescription);
@ -27,8 +23,7 @@ const ReviewStep = ({
Review {blueprintName} blueprint
</Title>
{blueprintDescription && <Text>{blueprintDescription}</Text>}
{/* Intentional prop drilling for simplicity - To be removed */}
<Review snapshottingEnabled={snapshottingEnabled} />
<Review />
</Form>
);
};