Skip to content

Commit

Permalink
webui: Changing of checkbox for switch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkankovsky committed Aug 4, 2023
1 parent e63febc commit be543e5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
40 changes: 22 additions & 18 deletions ui/webui/src/components/storage/MountPointMapping.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,18 @@ import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"
import {
Alert,
Button,
Checkbox,
Switch,
Flex,
FlexItem,
HelperText,
HelperTextItem,
Label,
Popover,
Select,
SelectOption,
SelectVariant,
TextInput,
TextInput, Tooltip,
} from "@patternfly/react-core";
import { HelpIcon, TrashIcon } from "@patternfly/react-icons";
import { TrashIcon } from "@patternfly/react-icons";

import { ListingTable } from "cockpit-components-table.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
Expand Down Expand Up @@ -207,19 +206,24 @@ const FormatColumn = ({ deviceData, handleRequestChange, idPrefix, request }) =>

return (
<Flex>
<Checkbox
id={idPrefix + "-checkbox"}
isChecked={request.reformat}
isDisabled={isRootMountPoint}
label={_("Reformat")}
onChange={checked => handleRequestChange(request["mount-point"], request["device-spec"], request["request-id"], checked)}
/>
{!isRootMountPoint &&
<Switch
id={idPrefix + "-switch"}
isChecked={request.reformat}
isDisabled={isRootMountPoint}
aria-label="Reformat"
onChange={checked => handleRequestChange(request["mount-point"], request["device-spec"], request["request-id"], checked)}
/>}
{isRootMountPoint &&
<Popover
bodyContent={_("The root partition is always re-formatted by the installer.")}
showClose={false}>
<HelpIcon />
</Popover>}
<Tooltip
content={_("The root partition is always re-formatted by the installer.")}>
<Switch
id={idPrefix + "-switch"}
isChecked={request.reformat}
aria-label="Reformat"
isDisabled
/>
</Tooltip>}
</Flex>
);
};
Expand Down Expand Up @@ -309,7 +313,7 @@ const RequestsTable = ({
aria-label={_("Mount point assignment")}
columns={[
{ title: _("Mount point"), props: { width: 30 } },
{ title: _("Device"), props: { width: 40 } },
{ title: _("Devices"), props: { width: 40 } },
{ title: _("Reformat"), props: { width: 20 } },
{ title: "", props: { width: 10 } },
]}
Expand Down Expand Up @@ -482,7 +486,7 @@ export const MountPointMapping = ({ deviceData, diskSelection, partitioningData,
}

return (
<AnacondaPage title={_("Manual disk configuration: Mount point mapping")}>
<AnacondaPage title={_("Mount point assignment")}>
{stepNotification && stepNotification.step === "mount-point-mapping" &&
<Alert
isInline
Expand Down
4 changes: 2 additions & 2 deletions ui/webui/test/check-storage
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):
self.browser.wait_not_present("#unlock-device-dialog")

def select_reformat(self, row):
self.browser.set_checked(f"{self.table_row(row)} td[data-label='Reformat'] input", True)
self.browser.click(f"{self.table_row(row)} td[data-label='Reformat'] input")

def check_reformat(self, row, checked):
checked_selector = "input:checked" if checked else "input:not(:checked)"
Expand Down Expand Up @@ -468,7 +468,7 @@ class TestStorageMountPoints(anacondalib.VirtInstallMachineCase):

self.add_mount()
self.select_row_device(3, f"{dev}4")
self.check_reformat(3, False)
self.check_reformat(3, True)
self.select_row_mountpoint(3, "/home")
self.check_format_type(3, "xfs")

Expand Down

0 comments on commit be543e5

Please sign in to comment.