Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package cockpit-agama for openSUSE:Factory checked in at 2023-10-27 22:28:46 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cockpit-agama (Old) and /work/SRC/openSUSE:Factory/.cockpit-agama.new.17445 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cockpit-agama" Fri Oct 27 22:28:46 2023 rev:6 rq:1120793 version:0 Changes: -------- --- /work/SRC/openSUSE:Factory/cockpit-agama/cockpit-agama.changes 2023-10-26 17:15:51.815452208 +0200 +++ /work/SRC/openSUSE:Factory/.cockpit-agama.new.17445/cockpit-agama.changes 2023-10-27 22:29:32.102467290 +0200 @@ -1,0 +2,19 @@ +Fri Oct 27 10:25:46 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Display the "Congratulations" message at the end of the + installation again (gh#openSUSE/agama#825). + +------------------------------------------------------------------- +Thu Oct 26 16:07:02 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Properly track the status changes. It prevents of getting stuck + in the first page when there are multiple products + (gh#openSUSE/agama#821). + +------------------------------------------------------------------- +Thu Oct 26 05:58:15 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Make sure that the software context is ready before trying to + load any route (gh#openSUSE/agama#820). + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ agama.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/package/cockpit-agama.changes new/agama/package/cockpit-agama.changes --- old/agama/package/cockpit-agama.changes 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/package/cockpit-agama.changes 2023-10-27 12:47:50.000000000 +0200 @@ -1,4 +1,23 @@ ------------------------------------------------------------------- +Fri Oct 27 10:25:46 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Display the "Congratulations" message at the end of the + installation again (gh#openSUSE/agama#825). + +------------------------------------------------------------------- +Thu Oct 26 16:07:02 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Properly track the status changes. It prevents of getting stuck + in the first page when there are multiple products + (gh#openSUSE/agama#821). + +------------------------------------------------------------------- +Thu Oct 26 05:58:15 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> + +- Make sure that the software context is ready before trying to + load any route (gh#openSUSE/agama#820). + +------------------------------------------------------------------- Thu Oct 26 05:31:28 UTC 2023 - Imobach Gonzalez Sosa <igonzalezs...@suse.com> - Fix client initialization to avoid a useless reconnection diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/App.jsx new/agama/src/App.jsx --- old/agama/src/App.jsx 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/App.jsx 2023-10-27 12:47:50.000000000 +0200 @@ -24,6 +24,7 @@ import { _ } from "~/i18n"; import { useInstallerClient, useInstallerClientStatus } from "~/context/installer"; +import { useSoftware } from "./context/software"; import { STARTUP, INSTALL } from "~/client/phase"; import { BUSY } from "~/client/status"; @@ -33,7 +34,6 @@ Disclosure, Installation, IssuesLink, - LoadingEnvironment, LogsButton, ShowLogButton, ShowTerminalButton, @@ -57,11 +57,24 @@ function App() { const client = useInstallerClient(); const { attempt } = useInstallerClientStatus(); + const { products } = useSoftware(); const { language } = useL10n(); const [status, setStatus] = useState(undefined); const [phase, setPhase] = useState(undefined); useEffect(() => { + if (client) { + return client.manager.onPhaseChange(setPhase); + } + }, [client, setPhase]); + + useEffect(() => { + if (client) { + return client.manager.onStatusChange(setStatus); + } + }, [client, setStatus]); + + useEffect(() => { const loadPhase = async () => { const phase = await client.manager.getPhase(); const status = await client.manager.getStatus(); @@ -69,26 +82,22 @@ setStatus(status); }; - if (client) loadPhase().catch(console.error); - }, [client, setPhase, setStatus]); - - useEffect(() => { if (client) { - return client.manager.onPhaseChange(setPhase); + loadPhase().catch(console.error); } - }, [client, setPhase]); + }, [client, setPhase, setStatus]); const Content = () => { - if (!client) { + if (!client || !products) { return (attempt > ATTEMPTS) ? <DBusError /> : <Loading />; } if ((phase === STARTUP && status === BUSY) || phase === undefined || status === undefined) { - return <LoadingEnvironment onStatusChange={setStatus} />; + return <Loading />; } if (phase === INSTALL) { - return <Installation />; + return <Installation status={status} />; } return <Outlet />; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/App.test.jsx new/agama/src/App.test.jsx --- old/agama/src/App.test.jsx 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/App.test.jsx 2023-10-27 12:47:50.000000000 +0200 @@ -29,10 +29,21 @@ jest.mock("~/client"); +// list of available products +let mockProducts; +jest.mock("~/context/software", () => ({ + ...jest.requireActual("~/context/software"), + useSoftware: () => { + return { + products: mockProducts, + selectedProduct: null + }; + } +})); + // Mock some components, // See https://www.chakshunyu.com/blog/how-to-mock-a-react-component-in-jest/#default-export jest.mock("~/components/core/DBusError", () => <div>D-BusError Mock</div>); -jest.mock("~/components/core/LoadingEnvironment", () => () => <div>LoadingEnvironment Mock</div>); jest.mock("~/components/questions/Questions", () => () => <div>Questions Mock</div>); jest.mock("~/components/core/Installation", () => () => <div>Installation Mock</div>); jest.mock("~/components/core/Sidebar", () => () => <div>Sidebar Mock</div>); @@ -44,6 +55,7 @@ // capture the latest subscription to the manager#onPhaseChange for triggering it manually const onPhaseChangeFn = cb => { callbacks.onPhaseChange = cb }; +const onStatusChangeFn = cb => { callbacks.onStatusChange = cb }; const changePhaseTo = phase => act(() => callbacks.onPhaseChange(phase)); describe("App", () => { @@ -56,6 +68,7 @@ getStatus: getStatusFn, getPhase: getPhaseFn, onPhaseChange: onPhaseChangeFn, + onStatusChange: onStatusChangeFn, }, language: { getUILanguage: jest.fn().mockResolvedValue("en-us"), @@ -63,6 +76,11 @@ } }; }); + + mockProducts = [ + { id: "openSUSE", name: "openSUSE Tumbleweed" }, + { id: "Leap Micro", name: "openSUSE Micro" } + ]; }); afterEach(() => { @@ -70,15 +88,26 @@ document.cookie = "CockpitLang=; path=/; expires=" + new Date(0).toUTCString(); }); + describe("when the software context is not initialized", () => { + beforeEach(() => { + mockProducts = undefined; + }); + + it("renders the Loading screen", async () => { + installerRender(<App />, { withL10n: true }); + await screen.findByText(/Loading installation environment/); + }); + }); + describe("on the startup phase", () => { beforeEach(() => { getPhaseFn.mockResolvedValue(STARTUP); getStatusFn.mockResolvedValue(BUSY); }); - it("renders the LoadingEnvironment theme", async () => { + it("renders the Loading screen", async () => { installerRender(<App />, { withL10n: true }); - await screen.findByText("LoadingEnvironment Mock"); + await screen.findByText(/Loading installation environment/); }); }); @@ -88,10 +117,10 @@ getStatusFn.mockResolvedValue(BUSY); }); - it("renders the LoadingEnvironment component", async () => { + it("renders the Loading screen", async () => { installerRender(<App />, { withL10n: true }); - await screen.findByText("LoadingEnvironment Mock"); + await screen.findByText(/Loading installation environment/); }); }); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/components/core/Installation.jsx new/agama/src/components/core/Installation.jsx --- old/agama/src/components/core/Installation.jsx 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/components/core/Installation.jsx 2023-10-27 12:47:50.000000000 +0200 @@ -19,19 +19,11 @@ * find current contact information at www.suse.com. */ -import React, { useEffect, useState } from "react"; -import { useInstallerClient } from "~/context/installer"; +import React from "react"; import { InstallationProgress, InstallationFinished } from "~/components/core"; import { IDLE } from "~/client/status"; -function Installation() { - const client = useInstallerClient(); - const [status, setStatus] = useState(undefined); - - useEffect(() => - client.manager.onStatusChange(setStatus), [client.manager] - ); - +function Installation({ status }) { return (status === IDLE) ? <InstallationFinished /> : <InstallationProgress />; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/components/core/LoadingEnvironment.jsx new/agama/src/components/core/LoadingEnvironment.jsx --- old/agama/src/components/core/LoadingEnvironment.jsx 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/components/core/LoadingEnvironment.jsx 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -/* - * Copyright (c) [2023] SUSE LLC - * - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as published - * by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, contact SUSE LLC. - * - * To contact SUSE LLC about this file by physical or electronic mail, you may - * find current contact information at www.suse.com. - */ - -import React, { useEffect } from "react"; -import { Loading } from "~/components/layout"; -import { useInstallerClient } from "~/context/installer"; - -/** - * Loading indicator for a phase - * - * @component - * - * @param {function} onStatusChange callback triggered when the status changes - */ -function LoadingEnvironment({ onStatusChange }) { - const client = useInstallerClient(); - - useEffect(() => - client.manager.onStatusChange(onStatusChange), [client.manager, onStatusChange] - ); - - return <Loading />; -} - -export default LoadingEnvironment; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/components/core/index.js new/agama/src/components/core/index.js --- old/agama/src/components/core/index.js 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/components/core/index.js 2023-10-27 12:47:50.000000000 +0200 @@ -38,7 +38,6 @@ export { default as IssuesLink } from "./IssuesLink"; export { default as IssuesPage } from "./IssuesPage"; export { default as SectionSkeleton } from "./SectionSkeleton"; -export { default as LoadingEnvironment } from "./LoadingEnvironment"; export { default as LogsButton } from "./LogsButton"; export { default as FileViewer } from "./FileViewer"; export { default as RowActions } from "./RowActions"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/agama/src/context/software.jsx new/agama/src/context/software.jsx --- old/agama/src/context/software.jsx 2023-10-26 07:54:33.000000000 +0200 +++ new/agama/src/context/software.jsx 2023-10-27 12:47:50.000000000 +0200 @@ -64,8 +64,8 @@ const [products, selectedId] = context; let selectedProduct = selectedId; - if (selectedId) { - selectedProduct = products.find(p => p.id === selectedId); + if (selectedId && products) { + selectedProduct = products.find(p => p.id === selectedId) || null; } return { ++++++ agama.obsinfo ++++++ --- /var/tmp/diff_new_pack.bqtQe9/_old 2023-10-27 22:29:33.502518638 +0200 +++ /var/tmp/diff_new_pack.bqtQe9/_new 2023-10-27 22:29:33.502518638 +0200 @@ -1,5 +1,5 @@ name: agama -version: 5+13 -mtime: 1698299673 -commit: 320b5801b5c445167dacbc24b3451528b2ee8a90 +version: 5+28 +mtime: 1698403670 +commit: eec3080645ba699d88dd595b86659d59cdd01694