Wizard: change order of the systemd services

This commit is contained in:
Katarina Sieklova 2025-06-16 15:52:22 +02:00 committed by Klara Simickova
parent 235d853f42
commit 76320925a0
4 changed files with 63 additions and 63 deletions

View file

@ -22,19 +22,6 @@ const Services = () => {
return ( return (
<> <>
<FormGroup label="Disabled services">
<LabelInput
ariaLabel="Add disabled service"
placeholder="Add disabled service"
validator={isServiceValid}
list={disabledServices}
item="Disabled service"
addAction={addDisabledFirewallService}
removeAction={removeDisabledFirewallService}
stepValidation={stepValidation}
fieldName="disabledServices"
/>
</FormGroup>
<FormGroup label="Enabled services"> <FormGroup label="Enabled services">
<LabelInput <LabelInput
ariaLabel="Add enabled service" ariaLabel="Add enabled service"
@ -48,6 +35,19 @@ const Services = () => {
fieldName="enabledServices" fieldName="enabledServices"
/> />
</FormGroup> </FormGroup>
<FormGroup label="Disabled services">
<LabelInput
ariaLabel="Add disabled service"
placeholder="Add disabled service"
validator={isServiceValid}
list={disabledServices}
item="Disabled service"
addAction={addDisabledFirewallService}
removeAction={removeDisabledFirewallService}
stepValidation={stepValidation}
fieldName="disabledServices"
/>
</FormGroup>
</> </>
); );
}; };

View file

@ -899,20 +899,6 @@ export const FirewallList = () => {
'None' 'None'
)} )}
</Content> </Content>
<Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Disabled services
</Content>
<Content component={ContentVariants.dd}>
{firewall.services.disabled.length > 0 ? (
<CodeBlock>
<CodeBlockCode>
{firewall.services.disabled.join(' ')}
</CodeBlockCode>
</CodeBlock>
) : (
'None'
)}
</Content>
<Content component={ContentVariants.dt} className="pf-v6-u-min-width"> <Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Enabled services Enabled services
</Content> </Content>
@ -927,6 +913,20 @@ export const FirewallList = () => {
'None' 'None'
)} )}
</Content> </Content>
<Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Disabled services
</Content>
<Content component={ContentVariants.dd}>
{firewall.services.disabled.length > 0 ? (
<CodeBlock>
<CodeBlockCode>
{firewall.services.disabled.join(' ')}
</CodeBlockCode>
</CodeBlock>
) : (
'None'
)}
</Content>
</Content> </Content>
</Content> </Content>
); );
@ -938,6 +938,18 @@ export const ServicesList = () => {
return ( return (
<Content> <Content>
<Content component={ContentVariants.dl} className="review-step-dl"> <Content component={ContentVariants.dl} className="review-step-dl">
<Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Enabled
</Content>
<Content component={ContentVariants.dd}>
{services.enabled.length > 0 ? (
<CodeBlock>
<CodeBlockCode>{services.enabled.join(' ')}</CodeBlockCode>
</CodeBlock>
) : (
'None'
)}
</Content>
<Content component={ContentVariants.dt} className="pf-v6-u-min-width"> <Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Disabled Disabled
</Content> </Content>
@ -962,18 +974,6 @@ export const ServicesList = () => {
'None' 'None'
)} )}
</Content> </Content>
<Content component={ContentVariants.dt} className="pf-v6-u-min-width">
Enabled
</Content>
<Content component={ContentVariants.dd}>
{services.enabled.length > 0 ? (
<CodeBlock>
<CodeBlockCode>{services.enabled.join(' ')}</CodeBlockCode>
</CodeBlock>
) : (
'None'
)}
</Content>
</Content> </Content>
</Content> </Content>
); );

View file

@ -54,6 +54,23 @@ const ServicesInput = () => {
return ( return (
<> <>
<FormGroup isRequired={false} label="Enabled services">
<LabelInput
ariaLabel="Add enabled service"
placeholder="Add enabled service"
validator={isServiceValid}
list={enabledServices.filter(
(service) => !enabledRequiredByOpenSCAP.includes(service)
)}
requiredList={enabledRequiredByOpenSCAP}
requiredCategoryName="Required by OpenSCAP"
item="Enabled service"
addAction={addEnabledService}
removeAction={removeEnabledService}
stepValidation={stepValidation}
fieldName="enabledSystemdServices"
/>
</FormGroup>
<FormGroup isRequired={false} label="Disabled services"> <FormGroup isRequired={false} label="Disabled services">
<LabelInput <LabelInput
ariaLabel="Add disabled service" ariaLabel="Add disabled service"
@ -89,23 +106,6 @@ const ServicesInput = () => {
fieldName="maskedSystemdServices" fieldName="maskedSystemdServices"
/> />
</FormGroup> </FormGroup>
<FormGroup isRequired={false} label="Enabled services">
<LabelInput
ariaLabel="Add enabled service"
placeholder="Add enabled service"
validator={isServiceValid}
list={enabledServices.filter(
(service) => !enabledRequiredByOpenSCAP.includes(service)
)}
requiredList={enabledRequiredByOpenSCAP}
requiredCategoryName="Required by OpenSCAP"
item="Enabled service"
addAction={addEnabledService}
removeAction={removeEnabledService}
stepValidation={stepValidation}
fieldName="enabledSystemdServices"
/>
</FormGroup>
</> </>
); );
}; };

View file

@ -171,22 +171,22 @@ describe('Step Services', () => {
name: /clear input/i, name: /clear input/i,
}); });
// Enabled services input
expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument();
await addEnabledService('-------');
expect(await screen.findByText('Invalid format.')).toBeInTheDocument();
await waitFor(() => user.click(clearInputButtons[0]));
// Disabled services input // Disabled services input
expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument(); expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument();
await addDisabledService('-------'); await addDisabledService('-------');
expect(await screen.findByText('Invalid format.')).toBeInTheDocument(); expect(await screen.findByText('Invalid format.')).toBeInTheDocument();
await waitFor(() => user.click(clearInputButtons[0])); await waitFor(() => user.click(clearInputButtons[1]));
// Masked services input // Masked services input
expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument(); expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument();
await addMaskedService('-------'); await addMaskedService('-------');
expect(await screen.findByText('Invalid format.')).toBeInTheDocument(); expect(await screen.findByText('Invalid format.')).toBeInTheDocument();
await waitFor(() => user.click(clearInputButtons[1]));
// Enabled services input
expect(screen.queryByText('Invalid format.')).not.toBeInTheDocument();
await addEnabledService('-------');
expect(await screen.findByText('Invalid format.')).toBeInTheDocument();
await waitFor(() => user.click(clearInputButtons[2])); await waitFor(() => user.click(clearInputButtons[2]));
}); });