Wizard: Basic Locale step
This adds Locale step basics and file structure.
This commit is contained in:
parent
c268267146
commit
6e97304327
20 changed files with 135 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ import FileSystemStep from './steps/FileSystem';
|
||||||
import { FileSystemContext } from './steps/FileSystem/FileSystemTable';
|
import { FileSystemContext } from './steps/FileSystem/FileSystemTable';
|
||||||
import FirstBootStep from './steps/FirstBoot';
|
import FirstBootStep from './steps/FirstBoot';
|
||||||
import ImageOutputStep from './steps/ImageOutput';
|
import ImageOutputStep from './steps/ImageOutput';
|
||||||
|
import LocaleStep from './steps/Locale';
|
||||||
import OscapStep from './steps/Oscap';
|
import OscapStep from './steps/Oscap';
|
||||||
import PackagesStep from './steps/Packages';
|
import PackagesStep from './steps/Packages';
|
||||||
import RegistrationStep from './steps/Registration';
|
import RegistrationStep from './steps/Registration';
|
||||||
|
|
@ -135,6 +136,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
|
|
||||||
const isUsersEnabled = useFlag('image-builder.users.enabled');
|
const isUsersEnabled = useFlag('image-builder.users.enabled');
|
||||||
const isTimezoneEnabled = useFlag('image-builder.timezone.enabled');
|
const isTimezoneEnabled = useFlag('image-builder.timezone.enabled');
|
||||||
|
const isLocaleEnabled = useFlag('image-builder.locale.enabled');
|
||||||
|
|
||||||
// Remove this and all fallthrough logic when snapshotting is enabled in Prod-stable
|
// Remove this and all fallthrough logic when snapshotting is enabled in Prod-stable
|
||||||
// =========================TO REMOVE=======================
|
// =========================TO REMOVE=======================
|
||||||
|
|
@ -219,7 +221,7 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
|
|
||||||
let startIndex = 1; // default index
|
let startIndex = 1; // default index
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
startIndex = 17;
|
startIndex = 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duplicating some of the logic from the Wizard component to allow for custom nav items status
|
// Duplicating some of the logic from the Wizard component to allow for custom nav items status
|
||||||
|
|
@ -465,6 +467,18 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
||||||
>
|
>
|
||||||
<TimezoneStep />
|
<TimezoneStep />
|
||||||
</WizardStep>,
|
</WizardStep>,
|
||||||
|
<WizardStep
|
||||||
|
name="Locale"
|
||||||
|
id="wizard-locale"
|
||||||
|
key="wizard-locale"
|
||||||
|
navItem={customStatusNavItem}
|
||||||
|
isHidden={!isLocaleEnabled}
|
||||||
|
footer={
|
||||||
|
<CustomWizardFooter disableNext={false} optional={true} />
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<LocaleStep />
|
||||||
|
</WizardStep>,
|
||||||
<WizardStep
|
<WizardStep
|
||||||
name="First boot script configuration"
|
name="First boot script configuration"
|
||||||
id="wizard-first-boot"
|
id="wizard-first-boot"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { FormGroup } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
const KeyboardInput = () => {
|
||||||
|
return <FormGroup isRequired={false} label="Keyboard"></FormGroup>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default KeyboardInput;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { FormGroup } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
const LanguagesDropDown = () => {
|
||||||
|
return <FormGroup isRequired={false} label="Languages"></FormGroup>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LanguagesDropDown;
|
||||||
21
src/Components/CreateImageWizard/steps/Locale/index.tsx
Normal file
21
src/Components/CreateImageWizard/steps/Locale/index.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { Text, Form, Title } from '@patternfly/react-core';
|
||||||
|
|
||||||
|
import KeyboardInput from './components/KeyboardInput';
|
||||||
|
import LanguagesDropDown from './components/LanguagesDropDown';
|
||||||
|
|
||||||
|
const LocaleStep = () => {
|
||||||
|
return (
|
||||||
|
<Form>
|
||||||
|
<Title headingLevel="h1" size="xl">
|
||||||
|
Locale
|
||||||
|
</Title>
|
||||||
|
<Text>Select locale for your image.</Text>
|
||||||
|
<LanguagesDropDown />
|
||||||
|
<KeyboardInput />
|
||||||
|
</Form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LocaleStep;
|
||||||
|
|
@ -27,6 +27,7 @@ const goToDetailsStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
const enterBlueprintDescription = async (
|
const enterBlueprintDescription = async (
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
await clickNext();
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ const goToFirstBootStep = async (): Promise<void> => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // Snapshot
|
await clickNext(); // Snapshot
|
||||||
await clickNext(); // First Boot
|
await clickNext(); // First Boot
|
||||||
};
|
};
|
||||||
|
|
@ -69,6 +70,7 @@ const goFromOscapToFirstBoot = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
const openCodeEditor = async (): Promise<void> => {
|
const openCodeEditor = async (): Promise<void> => {
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // First boot
|
await clickNext(); // First boot
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
import type { Router as RemixRouter } from '@remix-run/router';
|
||||||
|
import { screen, waitFor } from '@testing-library/react';
|
||||||
|
import { userEvent } from '@testing-library/user-event';
|
||||||
|
|
||||||
|
import {
|
||||||
|
clickBack,
|
||||||
|
clickNext,
|
||||||
|
verifyCancelButton,
|
||||||
|
} from '../../wizardTestUtils';
|
||||||
|
import { clickRegisterLater, renderCreateMode } from '../../wizardTestUtils';
|
||||||
|
|
||||||
|
let router: RemixRouter | undefined = undefined;
|
||||||
|
|
||||||
|
const goToLocaleStep = async () => {
|
||||||
|
const user = userEvent.setup();
|
||||||
|
const guestImageCheckBox = await screen.findByRole('checkbox', {
|
||||||
|
name: /virtualization guest image checkbox/i,
|
||||||
|
});
|
||||||
|
await waitFor(() => user.click(guestImageCheckBox));
|
||||||
|
await clickNext(); // Registration
|
||||||
|
await clickRegisterLater();
|
||||||
|
await clickNext(); // OpenSCAP
|
||||||
|
await clickNext(); // File system configuration
|
||||||
|
await clickNext(); // Snapshots
|
||||||
|
await clickNext(); // Custom repositories
|
||||||
|
await clickNext(); // Additional packages
|
||||||
|
await clickNext(); // Users
|
||||||
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Step Locale', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
router = undefined;
|
||||||
|
});
|
||||||
|
|
||||||
|
test('clicking Next loads First Boot', async () => {
|
||||||
|
await renderCreateMode();
|
||||||
|
await goToLocaleStep();
|
||||||
|
await clickNext();
|
||||||
|
await screen.findByRole('heading', {
|
||||||
|
name: 'First boot configuration',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test('clicking Back loads Timezone', async () => {
|
||||||
|
await renderCreateMode();
|
||||||
|
await goToLocaleStep();
|
||||||
|
await clickBack();
|
||||||
|
await screen.findByRole('heading', { name: 'Timezone' });
|
||||||
|
});
|
||||||
|
|
||||||
|
test('clicking Cancel loads landing page', async () => {
|
||||||
|
await renderCreateMode();
|
||||||
|
await goToLocaleStep();
|
||||||
|
await verifyCancelButton(router);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TO DO 'Step Locale' -> 'revisit step button on Review works'
|
||||||
|
// TO DO 'Locale request generated correctly'
|
||||||
|
// TO DO 'Locale edit mode'
|
||||||
|
|
@ -100,6 +100,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // FirstBoot
|
await clickNext(); // FirstBoot
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await enterBlueprintName('Oscap test');
|
await enterBlueprintName('Oscap test');
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ const goToPackagesStep = async () => {
|
||||||
const goToReviewStep = async () => {
|
const goToReviewStep = async () => {
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // First Boot
|
await clickNext(); // First Boot
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
await clickNext();
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // First Boot
|
await clickNext(); // First Boot
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
await clickNext(); // Review
|
await clickNext(); // Review
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Step Review', () => {
|
describe('Step Review', () => {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ const goToReviewStep = async () => {
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ const goToReview = async () => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await clickNext(); // FirstBoot
|
await clickNext(); // FirstBoot
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ const goToReview = async () => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // FirstBoot
|
await clickNext(); // FirstBoot
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ const goToReview = async () => {
|
||||||
await clickNext(); // Additional packages
|
await clickNext(); // Additional packages
|
||||||
await clickNext(); // Users
|
await clickNext(); // Users
|
||||||
await clickNext(); // Timezone
|
await clickNext(); // Timezone
|
||||||
|
await clickNext(); // Locale
|
||||||
await clickNext(); // Details
|
await clickNext(); // Details
|
||||||
await clickNext(); // FirstBoot
|
await clickNext(); // FirstBoot
|
||||||
await enterBlueprintName();
|
await enterBlueprintName();
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,12 @@ describe('Step Timezone', () => {
|
||||||
router = undefined;
|
router = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('clicking Next loads First Boot', async () => {
|
test('clicking Next loads Locale', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await goToTimezoneStep();
|
await goToTimezoneStep();
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await screen.findByRole('heading', {
|
await screen.findByRole('heading', {
|
||||||
name: 'First boot configuration',
|
name: 'Locale',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,8 @@ vi.mock('@unleash/proxy-client-react', () => ({
|
||||||
return true;
|
return true;
|
||||||
case 'image-builder.timezone.enabled':
|
case 'image-builder.timezone.enabled':
|
||||||
return true;
|
return true;
|
||||||
|
case 'image-builder.locale.enabled':
|
||||||
|
return true;
|
||||||
case 'edgeParity.image-list':
|
case 'edgeParity.image-list':
|
||||||
return true;
|
return true;
|
||||||
case 'image-builder.edge.local-image-table':
|
case 'image-builder.edge.local-image-table':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue