commit cockpit-d-installer for openSUSE:Factory
![](https://seccdn.libravatar.org/avatar/128a7b98d536a9cf9b4d4d5a90d63475.jpg?s=120&d=mm&r=g)
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cockpit-d-installer for openSUSE:Factory checked in at 2022-12-23 10:21:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cockpit-d-installer (Old) and /work/SRC/openSUSE:Factory/.cockpit-d-installer.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "cockpit-d-installer" Fri Dec 23 10:21:24 2022 rev:2 rq:1044289 version:0 Changes: -------- --- /work/SRC/openSUSE:Factory/cockpit-d-installer/cockpit-d-installer.changes 2022-12-07 17:37:19.245313066 +0100 +++ /work/SRC/openSUSE:Factory/.cockpit-d-installer.new.1563/cockpit-d-installer.changes 2022-12-23 10:21:25.539454303 +0100 @@ -1,0 +2,14 @@ +Thu Dec 15 10:14:22 UTC 2022 - Knut Anderssen <kanderssen@suse.com> + +- Do not show the link to configure wifi networks when wireless is + not enabled (gh#yast/d-installer#323). +- Version 0.6.2 + +------------------------------------------------------------------- +Thu Dec 15 08:55:02 UTC 2022 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com> + +- Display questions during the software installation (related to + gh#yast/d-installer#369). +- Update to version 0.6.1 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cockpit-d-installer.spec ++++++ --- /var/tmp/diff_new_pack.dPk0D6/_old 2022-12-23 10:21:37.803524392 +0100 +++ /var/tmp/diff_new_pack.dPk0D6/_new 2022-12-23 10:21:37.807524414 +0100 @@ -1,5 +1,5 @@ # -# spec file for package cockpit-machines +# spec file for package cockpit-d-installer # # Copyright (c) 2022 SUSE LLC # @@ -31,10 +31,10 @@ %include %_sourcedir/node_modules.spec.inc BuildArch: noarch Requires: cockpit +BuildRequires: appstream-glib BuildRequires: cockpit BuildRequires: cockpit-devel >= 243 BuildRequires: local-npm-registry -BuildRequires: appstream-glib %description Cockpit module for the experimental YaST D-Installer. ++++++ d-installer.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/package/_service new/d-installer/package/_service --- old/d-installer/package/_service 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/package/_service 2022-12-15 15:26:34.000000000 +0100 @@ -5,6 +5,7 @@ <param name="scm">git</param> <param name="revision">master</param> <param name="subdir">web</param> + <param name="without-version">enable</param> <param name="extract">package-lock.json</param> <param name="extract">package/cockpit-d-installer.changes</param> <param name="extract">package/cockpit-d-installer.spec</param> @@ -16,6 +17,7 @@ </service> <service mode="buildtime" name="tar"> <param name="obsinfo">d-installer.obsinfo</param> + <param name="filename">d-installer</param> </service> <service mode="buildtime" name="set_version"> <param name="basename">d-installer</param> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/package/cockpit-d-installer.changes new/d-installer/package/cockpit-d-installer.changes --- old/d-installer/package/cockpit-d-installer.changes 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/package/cockpit-d-installer.changes 2022-12-15 15:26:34.000000000 +0100 @@ -1,4 +1,18 @@ ------------------------------------------------------------------- +Thu Dec 15 10:14:22 UTC 2022 - Knut Anderssen <kanderssen@suse.com> + +- Do not show the link to configure wifi networks when wireless is + not enabled (gh#yast/d-installer#323). +- Version 0.6.2 + +------------------------------------------------------------------- +Thu Dec 15 08:55:02 UTC 2022 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com> + +- Display questions during the software installation (related to + gh#yast/d-installer#369). +- Update to version 0.6.1 + +------------------------------------------------------------------- Mon Dec 5 13:18:37 UTC 2022 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com> - Update to version 0.6.0 @@ -10,18 +24,18 @@ (related to gh#yast/d-installer#297) ------------------------------------------------------------------- -Fri Dec 2 10:48:14 UTC 2022 - Josef Reidinger <jreidinger@suse.cz> - -- Add support for adapting the configuration depending on the - architecture (gh#yast/d-installer#339) - -------------------------------------------------------------------- Fri Dec 2 13:41:41 UTC 2022 - Jos�� Iv��n L��pez Gonz��lez <jlopez@suse.com> - Add new UI for storage proposal offering LVM and encyption options (gh#yast/d-installer#321). ------------------------------------------------------------------- +Fri Dec 2 10:48:14 UTC 2022 - Josef Reidinger <jreidinger@suse.cz> + +- Add support for adapting the configuration depending on the + architecture (gh#yast/d-installer#339) + +------------------------------------------------------------------- Wed Nov 30 08:16:42 UTC 2022 - Knut Alejandro Anderssen Gonz��lez <kanderssen@suse.de> - Add validation for the first user creation (gh#yast/d-installer#337) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/package/cockpit-d-installer.spec new/d-installer/package/cockpit-d-installer.spec --- old/d-installer/package/cockpit-d-installer.spec 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/package/cockpit-d-installer.spec 2022-12-15 15:26:34.000000000 +0100 @@ -24,7 +24,7 @@ URL: https://github.com/yast/d-installer # source_validator insists that if obscpio has no version then # tarball must neither -Source0: d-installer-%{version}.tar +Source0: d-installer.tar Source10: package-lock.json Source11: node_modules.spec.inc Source12: node_modules.sums @@ -40,7 +40,7 @@ Cockpit module for the experimental YaST D-Installer. %prep -%autosetup -p1 -n d-installer-%{version} +%autosetup -p1 -n d-installer rm -f package-lock.json local-npm-registry %{_sourcedir} install --with=dev --legacy-peer-deps || ( find ~/.npm/_logs -name '*-debug.log' -print0 | xargs -0 cat; false) @@ -50,6 +50,8 @@ %install %make_install + +%check appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/* %files diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/network/index.js new/d-installer/src/client/network/index.js --- old/d-installer/src/client/network/index.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/network/index.js 2022-12-15 15:26:34.000000000 +0100 @@ -25,6 +25,7 @@ import { ConnectionTypes, ConnectionState } from "./model"; /** + * @typedef {import("./model").NetworkSettings} NetworkSettings * @typedef {import("./model").Connection} Connection * @typedef {import("./model").ActiveConnection} ActiveConnection * @typedef {import("./model").IPAddress} IPAddress @@ -37,7 +38,8 @@ ACTIVE_CONNECTION_REMOVED: "active_connection_removed", CONNECTION_ADDED: "connection_added", CONNECTION_UPDATED: "connection_updated", - CONNECTION_REMOVED: "connection_removed" + CONNECTION_REMOVED: "connection_removed", + SETTINGS_UPDATED: "settings_updated" }); /** @@ -52,7 +54,7 @@ * @property {(connection: Connection) => Promise<any>} addConnection * @property {(connection: Connection) => Promise<any>} updateConnection * @property {(connection: Connection) => void} deleteConnection - * @property {() => string} hostname + * @property {() => NetworkSettings} settings * @property {() => void} setUp */ @@ -210,13 +212,11 @@ return conns.flatMap(c => c.addresses); } - /** - * Returns the computer's hostname - * - * @return {string} - */ - hostname() { - return this.adapter.hostname(); + /* + * Returns network general settings + */ + settings() { + return this.adapter.settings(); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/network/model.js new/d-installer/src/client/network/model.js --- old/d-installer/src/client/network/model.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/network/model.js 2022-12-15 15:26:34.000000000 +0100 @@ -108,6 +108,11 @@ */ /** +* @typedef {object} NetworkSettings +* @property {boolean} wireless +* @property {string} hostname + +/** * Returns an IPv4 configuration object * * Defaults values can be overriden diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/network/network_manager.js new/d-installer/src/client/network/network_manager.js --- old/d-installer/src/client/network/network_manager.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/network/network_manager.js 2022-12-15 15:26:34.000000000 +0100 @@ -28,6 +28,7 @@ import { createAccessPoint, createConnection, SecurityProtocols } from "./model"; /** + * @typedef {import("./model").NetworkSettings} NetworkSettings * @typedef {import("./model").Connection} Connection * @typedef {import("./model").ActiveConnection} ActiveConnection * @typedef {import("./model").IPAddress} IPAddress @@ -177,6 +178,7 @@ accessPoints: {}, activeConnections: {}, ip4Configs: {}, + manager: null, settings: null, connections: {} }; @@ -196,6 +198,7 @@ ACTIVE_CONNECTION_IFACE, ACTIVE_CONNECTION_NAMESPACE ), ip4Configs: await this.client.proxies(IP4CONFIG_IFACE, IP4CONFIG_NAMESPACE), + manager: await this.client.proxy(IFACE), settings: await this.client.proxy(SETTINGS_IFACE), connections: await this.client.proxies(CONNECTION_IFACE, SETTINGS_NAMESPACE) }; @@ -372,6 +375,8 @@ async subscribeToEvents() { const activeConnectionProxies = this.proxies.activeConnections; const connectionProxies = this.proxies.connections; + const managerProxy = this.proxies.manager; + const settingsProxy = this.proxies.settings; /** @type {(eventType: string) => NetworkEventFn} */ const handleWrapperActiveConnection = (eventType) => (_event, proxy) => { @@ -392,6 +397,12 @@ this.eventsHandler({ type: eventType, payload: connection }); }; + const handleWrapperSettings = (eventType) => () => { + const settings = this.settingsFromProxies(managerProxy, settingsProxy); + + this.eventsHandler({ type: eventType, payload: settings }); + }; + // FIXME: do not build a map (eventTypesMap), just inject the type here connectionProxies.addEventListener("added", handleWrapperConnection(NetworkEventTypes.CONNECTION_ADDED)); connectionProxies.addEventListener("changed", handleWrapperConnection(NetworkEventTypes.CONNECTION_UPDATED)); @@ -401,6 +412,9 @@ activeConnectionProxies.addEventListener("added", handleWrapperActiveConnection(NetworkEventTypes.ACTIVE_CONNECTION_ADDED)); activeConnectionProxies.addEventListener("changed", handleWrapperActiveConnection(NetworkEventTypes.ACTIVE_CONNECTION_UPDATED)); activeConnectionProxies.addEventListener("removed", handleWrapperActiveConnection(NetworkEventTypes.ACTIVE_CONNECTION_REMOVED)); + + managerProxy.addEventListener("changed", handleWrapperSettings(NetworkEventTypes.SETTINGS_UPDATED)); + settingsProxy.addEventListener("changed", handleWrapperSettings(NetworkEventTypes.SETTINGS_UPDATED)); } /** @@ -486,17 +500,19 @@ return { address: data.address.v, prefix: parseInt(data.prefix.v) }; } - /** - * Returns the computer's hostname - * - * @return {string} - * - * https://developer-old.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.... - */ - hostname() { - if (!this.proxies.settings) return ""; + settingsFromProxies(manager, settings) { + return { + wireless: !!(manager?.WirelessEnabled && manager?.WirelessHardwareEnabled), + hostname: settings?.Hostname || "" + }; + } - return this.proxies.settings.Hostname; + /* + * Returns NetworkManager general settings + * @return {NetworkSettings} + */ + settings() { + return this.settingsFromProxies(this.proxies.manager, this.proxies.settings); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/network/network_manager.test.js new/d-installer/src/client/network/network_manager.test.js --- old/d-installer/src/client/network/network_manager.test.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/network/network_manager.test.js 2022-12-15 15:26:34.000000000 +0100 @@ -95,12 +95,15 @@ } }; +// Reminder: by default, properties added using Object.defineProperties() are not enumerable. +// We use #defineProperties here, so it doesn't show up as a "connection" in these objects. +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Obj... Object.defineProperties(activeConnections, { - addEventListener: { value: jest.fn(), enumerable: false } + addEventListener: { value: jest.fn() } }); Object.defineProperties(connections, { - addEventListener: { value: jest.fn(), enumerable: false } + addEventListener: { value: jest.fn() } }); const addressesData = { @@ -125,18 +128,26 @@ }; const ActivateConnectionFn = jest.fn(); -const networkProxy = () => ({ + +const networkProxy = { wait: jest.fn(), ActivateConnection: ActivateConnectionFn, ActiveConnections: Object.keys(activeConnections), -}); + WirelessEnabled: false, + WifiHardwareEnabled: true +}; const AddConnectionFn = jest.fn(); -const networkSettingsProxy = () => ({ +const networkSettingsProxy = { wait: jest.fn(), Hostname: "testing-machine", GetConnectionByUuid: () => "/org/freedesktop/NetworkManager/Settings/1", - AddConnection: AddConnectionFn + AddConnection: AddConnectionFn, + addEventListener: () => ({ value: jest.fn(), enumerable: false }) +}; + +Object.defineProperties(networkProxy, { + addEventListener: { value: jest.fn(), enumerable: false } }); const connectionSettingsMock = { @@ -172,8 +183,8 @@ describe("NetworkManagerAdapter", () => { beforeEach(() => { dbusClient.proxy = jest.fn().mockImplementation(iface => { - if (iface === NM_IFACE) return networkProxy(); - if (iface === NM_SETTINGS_IFACE) return networkSettingsProxy(); + if (iface === NM_IFACE) return networkProxy; + if (iface === NM_SETTINGS_IFACE) return networkSettingsProxy; if (iface === NM_CONNECTION_IFACE) return connectionSettingsProxy(); }); @@ -345,11 +356,12 @@ }); }); - describe("#hostname", () => { + describe("#settings", () => { it("returns the Network Manager settings hostname", async() => { const client = new NetworkManagerAdapter(dbusClient); await client.setUp(); - expect(client.hostname()).toEqual("testing-machine"); + expect(client.settings().hostname).toEqual("testing-machine"); + expect(client.settings().wireless).toEqual(false); }); }); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/network.test.js new/d-installer/src/client/network.test.js --- old/d-installer/src/client/network.test.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/network.test.js 2022-12-15 15:26:34.000000000 +0100 @@ -38,11 +38,15 @@ addresses: [{ address: "192.168.122.1", prefix: 24 }] }; +const settings = { + wireless: true, + hostname: "localhost.localdomain" +}; + const adapter = { setUp: jest.fn(), activeConnections: jest.fn().mockReturnValue([active_conn]), connections: jest.fn().mockReturnValue([conn]), - hostname: jest.fn().mockReturnValue("localhost.localdomain"), subscribe: jest.fn(), getConnection: jest.fn(), addConnection: jest.fn(), @@ -50,7 +54,8 @@ deleteConnection: jest.fn(), accessPoints: jest.fn(), connectTo: jest.fn(), - addAndConnectTo: jest.fn() + addAndConnectTo: jest.fn(), + settings: jest.fn().mockReturnValue(settings), }; describe("NetworkClient", () => { @@ -69,10 +74,11 @@ }); }); - describe("#hostname", () => { - it("returns the hostname from the adapter", () => { + describe("#settings", () => { + it("returns network general settings", () => { const client = new NetworkClient(adapter); - expect(client.hostname()).toEqual("localhost.localdomain"); + expect(client.settings().hostname).toEqual("localhost.localdomain"); + expect(client.settings().wireless).toEqual(true); }); }); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/storage.js new/d-installer/src/client/storage.js --- old/d-installer/src/client/storage.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/storage.js 2022-12-15 15:26:34.000000000 +0100 @@ -95,8 +95,6 @@ /** * Calculates a new proposal * - * @todo Do not send undefined values - * * @param {object} settings - proposal settings * @param {?string[]} [settings.candidateDevices] - Devices to use for the proposal * @param {?string} [settings.encryptionPassword] - Password for encrypting devices @@ -107,24 +105,47 @@ async calculateProposal({ candidateDevices, encryptionPassword, lvm, volumes }) { const proxy = await this.client.proxy(STORAGE_PROPOSAL_IFACE); - const dbusVolume = volume => { - return { - MountPoint: cockpit.variant("s", volume.mountPoint), - Encrypted: cockpit.variant("b", volume.encrypted), - FsType: cockpit.variant("s", volume.fsType), - MinSize: cockpit.variant("x", volume.minSize), - MaxSize: cockpit.variant("x", volume.maxSize), - FixedSizeLimits: cockpit.variant("b", volume.fixedSizeLimits), - Snapshots: cockpit.variant("b", volume.snapshots) - }; + // Builds a new object without undefined attributes + const cleanObject = (object) => { + const newObject = { ...object }; + + Object.keys(newObject).forEach(key => newObject[key] === undefined && delete newObject[key]); + return newObject; + }; + + // Builds the cockpit object or returns undefined if there is no value + const cockpitValue = (type, value) => { + if (value === undefined) return undefined; + + return cockpit.variant(type, value); }; - return proxy.Calculate({ - CandidateDevices: cockpit.variant("as", candidateDevices), - EncryptionPassword: cockpit.variant("s", encryptionPassword), - LVM: cockpit.variant("b", lvm), - Volumes: cockpit.variant("aa{sv}", volumes.map(dbusVolume)) + const dbusVolume = (volume) => { + return cleanObject({ + MountPoint: cockpitValue("s", volume.mountPoint), + Encrypted: cockpitValue("b", volume.encrypted), + FsType: cockpitValue("s", volume.fsType), + MinSize: cockpitValue("x", volume.minSize), + MaxSize: cockpitValue("x", volume.maxSize), + FixedSizeLimits: cockpitValue("b", volume.fixedSizeLimits), + Snapshots: cockpitValue("b", volume.snapshots) + }); + }; + + const dbusVolumes = (volumes) => { + if (!volumes) return undefined; + + return volumes.map(dbusVolume); + }; + + const settings = cleanObject({ + CandidateDevices: cockpitValue("as", candidateDevices), + EncryptionPassword: cockpitValue("s", encryptionPassword), + LVM: cockpitValue("b", lvm), + Volumes: cockpitValue("aa{sv}", dbusVolumes(volumes)) }); + + return proxy.Calculate(settings); } /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/client/storage.test.js new/d-installer/src/client/storage.test.js --- old/d-installer/src/client/storage.test.js 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/client/storage.test.js 2022-12-15 15:26:34.000000000 +0100 @@ -25,6 +25,8 @@ // NOTE: should we export them? const STORAGE_PROPOSAL_IFACE = "org.opensuse.DInstaller.Storage.Proposal1"; +const calculateFn = jest.fn(); + const dbusClient = new DBusClient(""); const storageProposalProxy = { wait: jest.fn(), @@ -35,8 +37,25 @@ CandidateDevices: ["/dev/sda"], LVM: true, Volumes: [ - { MountPoint: { t: "s", v: "/test1" } }, - { MountPoint: { t: "s", v: "/test2" } } + { + MountPoint: { t: "s", v: "/test1" }, + Optional: { t: "b", v: true }, + DeviceType: { t: "s", v: "partition" }, + Encrypted: { t: "b", v: false }, + FsTypes: { t: "as", v: [{ t: "s" , v: "Btrfs"} , { t: "s", v: "Ext3"}] }, + FsType: { t: "s", v: "Btrfs" }, + MinSize: { t: "x", v: 1024 }, + MaxSize: { t: "x", v: 2048 }, + FixedSizeLimits: { t: "b", v: false }, + AdaptiveSizes: { t: "b", v: false }, + Snapshots: { t: "b", v: true }, + SnapshotsConfigurable: { t: "b", v: true }, + SnapshotsAffectSizes: { t: "b", v: false }, + SizeRelevantVolumes: { t: "as", v: [] } + }, + { + MountPoint: { t: "s", v: "/test2" } + } ], Actions: [ { @@ -44,7 +63,8 @@ Subvol: { t: "b", v: false }, Delete: { t: "b", v: false } } - ] + ], + Calculate: calculateFn }; beforeEach(() => { @@ -67,7 +87,76 @@ { text: "Mount /dev/sdb1 as root", subvol: false, delete: false } ]); - expect(proposal.volumes[0].mountPoint).toEqual("/test1"); + expect(proposal.volumes[0]).toEqual({ + mountPoint: "/test1", + optional: true, + deviceType: "partition", + encrypted: false, + fsTypes: ["Btrfs", "Ext3"], + fsType: "Btrfs", + minSize: 1024, + maxSize:2048, + fixedSizeLimits: false, + adaptiveSizes: false, + snapshots: true, + snapshotsConfigurable: true, + snapshotsAffectSizes: false, + sizeRelevantVolumes: [] + }); expect(proposal.volumes[1].mountPoint).toEqual("/test2"); }); }); + +describe("#calculate", () => { + it("calculates a default proposal when no settings are given", async () => { + const client = new StorageClient(dbusClient); + await client.calculateProposal({}); + + expect(calculateFn).toHaveBeenCalledWith({}); + }); + + it("calculates a proposal with the given settings", async () => { + const client = new StorageClient(dbusClient); + await client.calculateProposal({ + candidateDevices: ["/dev/vda"], + encryptionPassword: "12345", + lvm: true, + volumes: [ + { + mountPoint: "/test1", + encrypted: false, + fsType: "Btrfs", + minSize: 1024, + maxSize:2048, + fixedSizeLimits: false, + snapshots: true + }, + { + mountPoint: "/test2", + minSize: 1024 + } + ] + }); + + expect(calculateFn).toHaveBeenCalledWith({ + CandidateDevices: { t: "as", v: ["/dev/vda"] }, + EncryptionPassword: { t: "s", v: "12345" }, + LVM: { t: "b", v: true }, + Volumes: { t: "aa{sv}", v: [ + { + MountPoint: { t: "s", v: "/test1" }, + Encrypted: { t: "b", v: false }, + FsType: { t: "s", v: "Btrfs" }, + MinSize: { t: "x", v: 1024 }, + MaxSize: { t: "x", v: 2048 }, + FixedSizeLimits: { t: "b", v: false }, + Snapshots: { t: "b", v: true } + }, + { + MountPoint: { t: "s", v: "/test2" }, + MinSize: { t: "x", v: 1024 } + } + ]} + }); + }); +}); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/core/InstallationProgress.jsx new/d-installer/src/components/core/InstallationProgress.jsx --- old/d-installer/src/components/core/InstallationProgress.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/core/InstallationProgress.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -23,6 +23,7 @@ import ProgressReport from "./ProgressReport"; import { Center, Title, PageIcon } from "@components/layout"; +import { Questions } from "@components/questions"; import { EOS_DOWNLOADING as Icon } from "eos-icons-react"; @@ -32,6 +33,7 @@ <Title>Installing</Title> <PageIcon><Icon /></PageIcon> <Center><ProgressReport /></Center> + <Questions /> </> ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/network/Network.jsx new/d-installer/src/components/network/Network.jsx --- old/d-installer/src/components/network/Network.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/network/Network.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -31,10 +31,12 @@ const [initialized, setInitialized] = useState(false); const [connections, setConnections] = useState([]); const [wifiSelectorOpen, setWifiSelectorOpen] = useState(false); + const [wireless, setWireless] = useState(false); useEffect(() => { if (!initialized) return; + setWireless(client.network.settings().wireless); setConnections(client.network.activeConnections()); }, [client.network, initialized]); @@ -59,6 +61,11 @@ case NetworkEventTypes.ACTIVE_CONNECTION_REMOVED: { setConnections(conns => conns.filter(c => c.id !== payload.id)); + break; + } + + case NetworkEventTypes.SETTINGS_UPDATED: { + setWireless(payload.wireless); } } }); @@ -81,10 +88,11 @@ <StackItem> <NetworkWifiStatus connections={activeWifiConnections} /> </StackItem> - <StackItem> - <Button variant="link" onClick={() => setWifiSelectorOpen(true)}>Connect to a Wi-Fi network</Button> - <WifiSelector isOpen={wifiSelectorOpen} onClose={() => setWifiSelectorOpen(false)} /> - </StackItem> + { wireless && + <StackItem> + <Button variant="link" onClick={() => setWifiSelectorOpen(true)}>Connect to a Wi-Fi network</Button> + <WifiSelector isOpen={wifiSelectorOpen} onClose={() => setWifiSelectorOpen(false)} /> + </StackItem> } </Stack> ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/network/Network.test.jsx new/d-installer/src/components/network/Network.test.jsx --- old/d-installer/src/components/network/Network.test.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/network/Network.test.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -20,7 +20,7 @@ */ import React from "react"; -import { screen, within } from "@testing-library/react"; +import { screen, within, waitFor } from "@testing-library/react"; import { installerRender } from "@/test-utils"; import Network from "@components/network/Network"; import { createClient } from "@client"; @@ -29,6 +29,9 @@ jest.mock("@components/network/NetworkWiredStatus", () => () => "Wired Connections"); jest.mock("@components/network/NetworkWifiStatus", () => () => "WiFi Connections"); +const networkSettings = { wireless: false, hostname: "test" }; +let settingsFn = jest.fn().mockReturnValue(networkSettings); + beforeEach(() => { createClient.mockImplementation(() => { return { @@ -37,32 +40,55 @@ activeConnections: () => [], connections: () => Promise.resolve([]), accessPoints: () => [], - onNetworkEvent: jest.fn() + onNetworkEvent: jest.fn(), + settings: settingsFn } }; }); }); describe("Network", () => { - it("shows a link to open the WiFi selector", async () => { - installerRender(<Network />); - await screen.findByRole("button", { name: "Connect to a Wi-Fi network" }); + describe("when it has not been initialized", () => { + it("renders nothing", async () => { + const { container } = installerRender(<Network />, { usingLayout: false }); + await waitFor(() => expect(container).toBeEmptyDOMElement()); + }); }); - it("renders a summary for wired and wifi connections", async () => { - installerRender(<Network />); + describe("when it has been initialized", () => { + it("renders a summary for wired and wifi connections", async () => { + installerRender(<Network />); - await screen.findByText("Wired Connections"); - await screen.findByText("WiFi Connections"); - }); + await screen.findByText("Wired Connections"); + await screen.findByText("WiFi Connections"); + }); + + describe("when Wireless is currently not enabled", () => { + it("does not show a link to open the WiFi selector", async () => { + installerRender(<Network />, { usingLayout: false }); + await waitFor(() => expect(screen.queryByRole("button", { name: "Connect to a Wi-Fi network" })).not.toBeInTheDocument()); + }); + }); - describe("when the user clicks on connect to a Wi-Fi", () => { - it("opens the WiFi selector dialog", async () => { - const { user } = installerRender(<Network />); - const link = await screen.findByRole("button", { name: "Connect to a Wi-Fi network" }); - await user.click(link); - const wifiDialog = await screen.findByRole("dialog"); - within(wifiDialog).getByText("Connect to a Wi-Fi network"); + describe("when Wireless is currently enabled", () => { + beforeEach(() => { + settingsFn = jest.fn().mockReturnValue({ ...networkSettings, wireless: true }); + }); + + it("shows a link to open the WiFi selector", async () => { + installerRender(<Network />); + await screen.findByRole("button", { name: "Connect to a Wi-Fi network" }); + }); + + describe("when the user clicks on connect to a Wi-Fi", () => { + it("opens the WiFi selector dialog", async () => { + const { user } = installerRender(<Network />); + const link = await screen.findByRole("button", { name: "Connect to a Wi-Fi network" }); + await user.click(link); + const wifiDialog = await screen.findByRole("dialog"); + within(wifiDialog).getByText("Connect to a Wi-Fi network"); + }); + }); }); }); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/network/TargetIpsPopup.jsx new/d-installer/src/components/network/TargetIpsPopup.jsx --- old/d-installer/src/components/network/TargetIpsPopup.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/network/TargetIpsPopup.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -45,7 +45,7 @@ const refreshState = () => { setAddresses(client.network.addresses()); - setHostname(client.network.hostname()); + setHostname(client.network.settings().hostname); }; refreshState(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/network/TargetIpsPopup.test.jsx new/d-installer/src/components/network/TargetIpsPopup.test.jsx --- old/d-installer/src/components/network/TargetIpsPopup.test.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/network/TargetIpsPopup.test.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -34,7 +34,8 @@ { address: "5.6.7.8", prefix: 16 }, ]; const addressFn = jest.fn().mockReturnValue(addresses); -const hostnameFn = jest.fn().mockReturnValue("example.net"); +const networkSettings = { wireless: false, hostname: "example.net" }; +const settingsFn = jest.fn().mockReturnValue(networkSettings); describe("TargetIpsPopup", () => { let callbacks; @@ -46,7 +47,7 @@ network: { onNetworkEvent: onNetworkEventFn, addresses: addressFn, - hostname: hostnameFn, + settings: settingsFn, setUp: jest.fn().mockResolvedValue() } }; @@ -77,7 +78,7 @@ await screen.findByRole("button", { name: /1.2.3.4\/24 \(example.net\)/i }); addressFn.mockReturnValue([{ address: "5.6.7.8", prefix: 24 }]); - hostnameFn.mockReturnValue("localhost.localdomain"); + settingsFn.mockReturnValue({ wireless: false, hostname: "localhost.localdomain" }); act(() => { callbacks.forEach(cb => cb()); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/network/WifiSelector.jsx new/d-installer/src/components/network/WifiSelector.jsx --- old/d-installer/src/components/network/WifiSelector.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/network/WifiSelector.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -84,7 +84,7 @@ setNetworks(data); setActiveNetwork(networksFromValues(data).find(d => d.connection)); }); - }, [client.network, connections, activeConnections]); + }, [client.network, connections, activeConnections, isOpen]); useEffect(() => { return client.network.onNetworkEvent(({ type, payload }) => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/d-installer/src/components/storage/ProposalSettingsSection.test.jsx new/d-installer/src/components/storage/ProposalSettingsSection.test.jsx --- old/d-installer/src/components/storage/ProposalSettingsSection.test.jsx 2022-12-05 16:55:34.000000000 +0100 +++ new/d-installer/src/components/storage/ProposalSettingsSection.test.jsx 2022-12-15 15:26:34.000000000 +0100 @@ -35,16 +35,11 @@ jest.mock("@components/storage/ProposalSettingsForm", () => FakeProposalSettingsForm); -let candidateDevices = ["/dev/sda"]; -let encryptionPassword = ""; -let lvm = false; -let volumes = [{ mountPoint: "/test1" }, { mountPoint: "/test2" }]; - -const proposal = { - candidateDevices, - encryptionPassword, - lvm, - volumes +let proposal = { + candidateDevices: ["/dev/sda"], + encryptionPassword: "", + lvm: false, + volumes: [{ mountPoint: "/test1" }, { mountPoint: "/test2" }] }; it("renders the list of the volumes to create", () => { @@ -111,16 +106,54 @@ expect(calculateFn).toHaveBeenCalled(); }); -describe("when lvm and encryption are not selected", () => { +describe("when neither lvm nor encryption are selected", () => { beforeEach(() => { - lvm = false; - encryptionPassword = ""; + proposal.lvm = false; + proposal.encryptionPassword = ""; }); - it("renders the proper description for the selected settings", () => { + it("renders the proper description for the current settings", () => { installerRender(<ProposalSettingsSection proposal={proposal} />); screen.getByText(/Create file systems over partitions/); }); }); +describe("when lvm is selected", () => { + beforeEach(() => { + proposal.lvm = true; + proposal.encryptionPassword = ""; + }); + + it("renders the proper description for the current settings", () => { + installerRender(<ProposalSettingsSection proposal={proposal} />); + + screen.getByText(/Create file systems over LVM volumes/); + }); +}); + +describe("when encryption is selected", () => { + beforeEach(() => { + proposal.lvm = false; + proposal.encryptionPassword = "12345" + }); + + it("renders the proper description for the current settings", () => { + installerRender(<ProposalSettingsSection proposal={proposal} />); + + screen.getByText(/Create file systems over encrypted partitions/); + }); +}); + +describe("when LVM and encryption are selected", () => { + beforeEach(() => { + proposal.lvm = true; + proposal.encryptionPassword = "12345" + }); + + it("renders the proper description for the current settings", () => { + installerRender(<ProposalSettingsSection proposal={proposal} />); + + screen.getByText(/Create file systems over encrypted LVM volumes/); + }); +}); ++++++ d-installer.obsinfo ++++++ --- /var/tmp/diff_new_pack.dPk0D6/_old 2022-12-23 10:21:38.075525946 +0100 +++ /var/tmp/diff_new_pack.dPk0D6/_new 2022-12-23 10:21:38.079525969 +0100 @@ -1,5 +1,5 @@ name: d-installer -version: 0.6.1a0b3e2 -mtime: 1670255734 -commit: 1a0b3e2b303537fee3a88f7a3d0e2dec610f481d +version: 0.6.2.09d561d +mtime: 1671114394 +commit: 09d561d396a67c71664c01ceb8204dcc56e24da0 ++++++ node_modules.obscpio ++++++ /work/SRC/openSUSE:Factory/cockpit-d-installer/node_modules.obscpio /work/SRC/openSUSE:Factory/.cockpit-d-installer.new.1563/node_modules.obscpio differ: char 50, line 1
participants (1)
-
Source-Sync