diff --git a/web/package/cockpit-agama.changes b/web/package/cockpit-agama.changes index d6817fe86c..6db121f296 100644 --- a/web/package/cockpit-agama.changes +++ b/web/package/cockpit-agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 16 11:15:13 UTC 2024 - David Diaz + +- Use better icons in storage proposal page + (gh#openSUSE/agama#1152). + ------------------------------------------------------------------- Mon Apr 15 10:52:14 UTC 2024 - David Diaz diff --git a/web/src/components/core/Field.jsx b/web/src/components/core/Field.jsx index 74d955733a..7e63dc49ba 100644 --- a/web/src/components/core/Field.jsx +++ b/web/src/components/core/Field.jsx @@ -82,13 +82,6 @@ const Field = ({ ); }; -/** - * @param {Omit} props - */ -const SettingsField = ({ ...props }) => { - return ; -}; - /** * @param {Omit & {isChecked: boolean, highlightContent?: boolean}} props */ @@ -108,14 +101,15 @@ const SwitchField = ({ isChecked = false, highlightContent = false, ...props }) }; /** - * @param {Omit & {isExpanded: boolean}} props + * @param {FieldProps & {isExpanded: boolean}} props */ -const ExpandableField = ({ isExpanded, ...props }) => { +const ExpandableField = ({ label, isExpanded, ...props }) => { const iconName = isExpanded ? "collapse_all" : "expand_all"; const className = isExpanded ? "expanded" : "collapsed"; + const labelWithIcon = <>{label} ; - return ; + return ; }; export default Field; -export { ExpandableField, SettingsField, SwitchField }; +export { ExpandableField, SwitchField }; diff --git a/web/src/components/core/Field.test.jsx b/web/src/components/core/Field.test.jsx index 2a07467732..6485c230c9 100644 --- a/web/src/components/core/Field.test.jsx +++ b/web/src/components/core/Field.test.jsx @@ -22,7 +22,7 @@ import React from "react"; import { screen } from "@testing-library/react"; import { plainRender } from "~/test-utils"; -import { Field, ExpandableField, SettingsField, SwitchField } from "~/components/core"; +import { Field, ExpandableField, SwitchField } from "~/components/core"; const onClick = jest.fn(); @@ -64,17 +64,6 @@ describe("Field", () => { }); }); -describe("SettingsField", () => { - it("uses the 'shadow' icon", () => { - const { container } = plainRender( - // Trying to set other icon, although typechecking should catch it. - - ); - const icon = container.querySelector("button > svg"); - expect(icon).toHaveAttribute("data-icon-name", "shadow"); - }); -}); - describe("SwitchField", () => { it("sets button role to switch", () => { plainRender(); @@ -111,19 +100,15 @@ describe("SwitchField", () => { }); describe("ExpandableField", () => { - it("uses the 'collapse_all' icon when isExpanded", () => { - const { container } = plainRender( - - ); - const icon = container.querySelector("button > svg"); - expect(icon).toHaveAttribute("data-icon-name", "collapse_all"); + it("uses 'expanded' as className prop value when isExpanded", () => { + const { container } = plainRender(); + const field = container.querySelector("[data-type='agama/field']"); + expect(field.classList.contains("expanded")).toBe(true); }); - it("uses the 'expand_all' icon when not isExpanded", () => { - const { container } = plainRender( - - ); - const icon = container.querySelector("button > svg"); - expect(icon).toHaveAttribute("data-icon-name", "expand_all"); + it("uses 'collapsed' as className prop value when isExpanded", () => { + const { container } = plainRender(); + const field = container.querySelector("[data-type='agama/field']"); + expect(field.classList.contains("collapsed")).toBe(true); }); }); diff --git a/web/src/components/core/index.js b/web/src/components/core/index.js index c881137abb..7834183e6f 100644 --- a/web/src/components/core/index.js +++ b/web/src/components/core/index.js @@ -63,4 +63,4 @@ export { default as Tag } from "./Tag"; export { default as TreeTable } from "./TreeTable"; export { default as ControlledPanels } from "./ControlledPanels"; export { default as Field } from "./Field"; -export { ExpandableField, SettingsField, SwitchField } from "./Field"; +export { ExpandableField, SwitchField } from "./Field"; diff --git a/web/src/components/layout/Icon.jsx b/web/src/components/layout/Icon.jsx index 848d4859cc..813185a42f 100644 --- a/web/src/components/layout/Icon.jsx +++ b/web/src/components/layout/Icon.jsx @@ -41,6 +41,7 @@ import ExpandMore from "@icons/expand_more.svg?component"; import Feedback from "@icons/feedback.svg?component"; import Folder from "@icons/folder.svg?component"; import FolderOff from "@icons/folder_off.svg?component"; +import FrameInspect from "@icons/frame_inspect.svg?component"; import Globe from "@icons/globe.svg?component"; import HardDrive from "@icons/hard_drive.svg?component"; import Help from "@icons/help.svg?component"; @@ -63,6 +64,7 @@ import SettingsApplications from "@icons/settings_applications.svg?component"; import SettingsEthernet from "@icons/settings_ethernet.svg?component"; import SettingsFill from "@icons/settings-fill.svg?component"; import Shadow from "@icons/shadow.svg?component"; +import ShieldLock from "@icons/shield_lock.svg?component"; import SignalCellularAlt from "@icons/signal_cellular_alt.svg?component"; import Storage from "@icons/storage.svg?component"; import Sync from "@icons/sync.svg?component"; @@ -109,6 +111,7 @@ const icons = { feedback: Feedback, folder: Folder, folder_off: FolderOff, + frame_inspect: FrameInspect, globe: Globe, hard_drive: HardDrive, help: Help, @@ -132,6 +135,7 @@ const icons = { settings_applications: SettingsApplications, settings_ethernet: SettingsEthernet, shadow: Shadow, + shield_lock: ShieldLock, signal_cellular_alt: SignalCellularAlt, storage: Storage, sync: Sync, diff --git a/web/src/components/storage/BootConfigField.jsx b/web/src/components/storage/BootConfigField.jsx index da2d942b19..b62ccf14fb 100644 --- a/web/src/components/storage/BootConfigField.jsx +++ b/web/src/components/storage/BootConfigField.jsx @@ -47,7 +47,7 @@ const Button = ({ isBold = false, onClick }) => { return ( ); }; @@ -68,7 +68,7 @@ const Button = ({ isBold = false, onClick }) => { * @property {boolean} configureBoot * @property {StorageDevice} bootDevice */ -export default function BootConfigField ({ +export default function BootConfigField({ configureBoot, bootDevice, defaultBootDevice, @@ -104,7 +104,7 @@ export default function BootConfigField ({ return (
- { value }