Wizard: Add Locale to Review step
This adds Locale expandable to the Review step.
This commit is contained in:
parent
3dcafd5672
commit
8d84b5eef2
3 changed files with 74 additions and 2 deletions
|
|
@ -29,6 +29,7 @@ import {
|
||||||
TargetEnvOciList,
|
TargetEnvOciList,
|
||||||
TargetEnvOtherList,
|
TargetEnvOtherList,
|
||||||
TimezoneList,
|
TimezoneList,
|
||||||
|
LocaleList,
|
||||||
} from './ReviewStepTextLists';
|
} from './ReviewStepTextLists';
|
||||||
|
|
||||||
import isRhel from '../../../../../src/Utilities/isRhel';
|
import isRhel from '../../../../../src/Utilities/isRhel';
|
||||||
|
|
@ -68,9 +69,11 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
||||||
const [isExpandedComplianceDetail, setIsExpandedComplianceDetail] =
|
const [isExpandedComplianceDetail, setIsExpandedComplianceDetail] =
|
||||||
useState(true);
|
useState(true);
|
||||||
const [isExpandedTimezone, setIsExpandedTimezone] = useState(true);
|
const [isExpandedTimezone, setIsExpandedTimezone] = useState(true);
|
||||||
|
const [isExpandedLocale, setIsExpandedLocale] = useState(true);
|
||||||
const [isExpandableFirstBoot, setIsExpandedFirstBoot] = useState(true);
|
const [isExpandableFirstBoot, setIsExpandedFirstBoot] = useState(true);
|
||||||
|
|
||||||
const isTimezoneEnabled = useFlag('image-builder.timezone.enabled');
|
const isTimezoneEnabled = useFlag('image-builder.timezone.enabled');
|
||||||
|
const isLocaleEnabled = useFlag('image-builder.locale.enabled');
|
||||||
|
|
||||||
const onToggleImageOutput = (isExpandedImageOutput: boolean) =>
|
const onToggleImageOutput = (isExpandedImageOutput: boolean) =>
|
||||||
setIsExpandedImageOutput(isExpandedImageOutput);
|
setIsExpandedImageOutput(isExpandedImageOutput);
|
||||||
|
|
@ -90,6 +93,8 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
||||||
setIsExpandedComplianceDetail(isExpandedComplianceDetail);
|
setIsExpandedComplianceDetail(isExpandedComplianceDetail);
|
||||||
const onToggleTimezone = (isExpandedTimezone: boolean) =>
|
const onToggleTimezone = (isExpandedTimezone: boolean) =>
|
||||||
setIsExpandedTimezone(isExpandedTimezone);
|
setIsExpandedTimezone(isExpandedTimezone);
|
||||||
|
const onToggleLocale = (isExpandedLocale: boolean) =>
|
||||||
|
setIsExpandedLocale(isExpandedLocale);
|
||||||
const onToggleFirstBoot = (isExpandableFirstBoot: boolean) =>
|
const onToggleFirstBoot = (isExpandableFirstBoot: boolean) =>
|
||||||
setIsExpandedFirstBoot(isExpandableFirstBoot);
|
setIsExpandedFirstBoot(isExpandableFirstBoot);
|
||||||
|
|
||||||
|
|
@ -321,6 +326,23 @@ const Review = ({ snapshottingEnabled }: { snapshottingEnabled: boolean }) => {
|
||||||
<TimezoneList />
|
<TimezoneList />
|
||||||
</ExpandableSection>
|
</ExpandableSection>
|
||||||
)}
|
)}
|
||||||
|
{isLocaleEnabled && (
|
||||||
|
<ExpandableSection
|
||||||
|
toggleContent={composeExpandable(
|
||||||
|
'Locale',
|
||||||
|
'revisit-locale',
|
||||||
|
'wizard-locale'
|
||||||
|
)}
|
||||||
|
onToggle={(_event, isExpandedLocale) =>
|
||||||
|
onToggleLocale(isExpandedLocale)
|
||||||
|
}
|
||||||
|
isExpanded={isExpandedLocale}
|
||||||
|
isIndented
|
||||||
|
data-testid="locale-expandable"
|
||||||
|
>
|
||||||
|
<LocaleList />
|
||||||
|
</ExpandableSection>
|
||||||
|
)}
|
||||||
{isFirstBootEnabled && (
|
{isFirstBootEnabled && (
|
||||||
<ExpandableSection
|
<ExpandableSection
|
||||||
toggleContent={composeExpandable(
|
toggleContent={composeExpandable(
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ import {
|
||||||
selectFirstBootScript,
|
selectFirstBootScript,
|
||||||
selectTimezone,
|
selectTimezone,
|
||||||
selectNtpServers,
|
selectNtpServers,
|
||||||
|
selectLanguages,
|
||||||
|
selectKeyboard,
|
||||||
} from '../../../../store/wizardSlice';
|
} from '../../../../store/wizardSlice';
|
||||||
import { toMonthAndYear, yyyyMMddFormat } from '../../../../Utilities/time';
|
import { toMonthAndYear, yyyyMMddFormat } from '../../../../Utilities/time';
|
||||||
import {
|
import {
|
||||||
|
|
@ -771,6 +773,36 @@ export const TimezoneList = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const LocaleList = () => {
|
||||||
|
const languages = useAppSelector(selectLanguages);
|
||||||
|
const keyboard = useAppSelector(selectKeyboard);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<TextContent>
|
||||||
|
<TextList component={TextListVariants.dl}>
|
||||||
|
<TextListItem
|
||||||
|
component={TextListItemVariants.dt}
|
||||||
|
className="pf-v5-u-min-width"
|
||||||
|
>
|
||||||
|
Languages
|
||||||
|
</TextListItem>
|
||||||
|
<TextListItem component={TextListItemVariants.dd}>
|
||||||
|
{languages && languages.length > 0 ? languages.join(', ') : 'None'}
|
||||||
|
</TextListItem>
|
||||||
|
<TextListItem
|
||||||
|
component={TextListItemVariants.dt}
|
||||||
|
className="pf-v5-u-min-width"
|
||||||
|
>
|
||||||
|
Keyboard
|
||||||
|
</TextListItem>
|
||||||
|
<TextListItem component={TextListItemVariants.dd}>
|
||||||
|
{keyboard ? keyboard : 'None'}
|
||||||
|
</TextListItem>
|
||||||
|
</TextList>
|
||||||
|
</TextContent>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const FirstBootList = () => {
|
export const FirstBootList = () => {
|
||||||
const isFirstbootEnabled = !!useAppSelector(selectFirstBootScript);
|
const isFirstbootEnabled = !!useAppSelector(selectFirstBootScript);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Router as RemixRouter } from '@remix-run/router';
|
import type { Router as RemixRouter } from '@remix-run/router';
|
||||||
import { screen, waitFor } from '@testing-library/react';
|
import { screen, waitFor, within } from '@testing-library/react';
|
||||||
import { userEvent } from '@testing-library/user-event';
|
import { userEvent } from '@testing-library/user-event';
|
||||||
|
|
||||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||||
|
|
@ -86,6 +86,13 @@ const selectKeyboard = async () => {
|
||||||
await waitFor(() => user.click(usKeyboard));
|
await waitFor(() => user.click(usKeyboard));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const clickRevisitButton = async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
|
const expandable = await screen.findByTestId('locale-expandable');
|
||||||
|
const revisitButton = await within(expandable).findByTestId('revisit-locale');
|
||||||
|
await waitFor(() => user.click(revisitButton));
|
||||||
|
};
|
||||||
|
|
||||||
describe('Step Locale', () => {
|
describe('Step Locale', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
|
|
@ -140,6 +147,16 @@ describe('Step Locale', () => {
|
||||||
expect(options[1]).toHaveTextContent('us-acentos');
|
expect(options[1]).toHaveTextContent('us-acentos');
|
||||||
expect(options[2]).toHaveTextContent('us-alt-intl');
|
expect(options[2]).toHaveTextContent('us-alt-intl');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('revisit step button on Review works', async () => {
|
||||||
|
await renderCreateMode();
|
||||||
|
await goToLocaleStep();
|
||||||
|
await searchForKeyboard();
|
||||||
|
await selectKeyboard();
|
||||||
|
await goToReviewStep();
|
||||||
|
await clickRevisitButton();
|
||||||
|
await screen.findByRole('heading', { name: /Locale/ });
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Locale request generated correctly', () => {
|
describe('Locale request generated correctly', () => {
|
||||||
|
|
@ -232,4 +249,5 @@ describe('Locale edit mode', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// TO DO 'Step Locale' -> 'revisit step button on Review works'
|
// TO DO 'with languages selected'
|
||||||
|
// TO DO 'with languages and keyboard selected'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue