Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/cockpit-d-installer.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jan 19 07:58:00 UTC 2023 - David Diaz <dgonzalez@suse.com>

- Update aliases for using "~/" instead of "@"
(gh#yast/d-installer#400).

-------------------------------------------------------------------
Wed Jan 18 08:06:05 UTC 2023 - Josef Reidinger <jreidinger@suse.com>

Expand Down
10 changes: 5 additions & 5 deletions web/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import React, { useEffect, useState } from "react";
import { Outlet } from "react-router-dom";

import { useInstallerClient } from "@context/installer";
import { STARTUP, INSTALL } from "@client/phase";
import { BUSY } from "@client/status";
import { useInstallerClient } from "~/context/installer";
import { STARTUP, INSTALL } from "~/client/phase";
import { BUSY } from "~/client/status";

import { Layout, Title, LoadingEnvironment, DBusError } from "@components/layout";
import { InstallationProgress, InstallationFinished } from "@components/core";
import { Layout, Title, LoadingEnvironment, DBusError } from "~/components/layout";
import { InstallationProgress, InstallationFinished } from "~/components/core";

function App() {
const client = useInstallerClient();
Expand Down
22 changes: 11 additions & 11 deletions web/src/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@

import React from "react";
import { act, screen } from "@testing-library/react";
import { installerRender, mockComponent, mockLayout } from "@/test-utils";
import { installerRender, mockComponent, mockLayout } from "~/test-utils";
import App from "./App";
import { createClient } from "@client";
import { STARTUP, CONFIG, INSTALL } from "@client/phase";
import { IDLE, BUSY } from "@client/status";
import { createClient } from "~/client";
import { STARTUP, CONFIG, INSTALL } from "~/client/phase";
import { IDLE, BUSY } from "~/client/status";

jest.mock("@client");
jest.mock("~/client");

jest.mock('react-router-dom', () => ({
Outlet: mockComponent("Content"),
}));

jest.mock("@components/layout/Layout", () => mockLayout());
jest.mock("~/components/layout/Layout", () => mockLayout());

// Mock some components,
// See https://www.chakshunyu.com/blog/how-to-mock-a-react-component-in-jest/#default-export
jest.mock("@components/layout/DBusError", () => mockComponent("D-BusError Mock"));
jest.mock("@components/layout/LoadingEnvironment", () => mockComponent("LoadingEnvironment Mock"));
jest.mock("@components/questions/Questions", () => mockComponent("Questions Mock"));
jest.mock("@components/core/InstallationProgress", () => mockComponent("InstallationProgress Mock"));
jest.mock("@components/core/InstallationFinished", () => mockComponent("InstallationFinished Mock"));
jest.mock("~/components/layout/DBusError", () => mockComponent("D-BusError Mock"));
jest.mock("~/components/layout/LoadingEnvironment", () => mockComponent("LoadingEnvironment Mock"));
jest.mock("~/components/questions/Questions", () => mockComponent("Questions Mock"));
jest.mock("~/components/core/InstallationProgress", () => mockComponent("InstallationProgress Mock"));
jest.mock("~/components/core/InstallationFinished", () => mockComponent("InstallationFinished Mock"));

const callbacks = {};
const getStatusFn = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion web/src/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { Outlet } from "react-router-dom";
import { Questions } from "@components/questions";
import { Questions } from "~/components/questions";

function Main() {
return (
Expand Down
6 changes: 3 additions & 3 deletions web/src/Main.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import React from "react";
import { screen } from "@testing-library/react";
import { installerRender, mockComponent } from "@/test-utils";
import { installerRender, mockComponent } from "~/test-utils";

import Main from "@/Main";
import Main from "~/Main";

jest.mock("@components/questions/Questions", () => mockComponent("Questions Mock"));
jest.mock("~/components/questions/Questions", () => mockComponent("Questions Mock"));
jest.mock('react-router-dom', () => ({
Outlet: mockComponent("Content"),
}));
Expand Down
16 changes: 8 additions & 8 deletions web/src/assets/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@use "@assets/styles/variables.scss";
@use "~/assets/styles/variables.scss";
// TODO: merge app and global
@use "@assets/styles/global.scss";
@use "@assets/styles/app.scss";
@use "@assets/styles/layout.scss";
@use "@assets/styles/utilities.scss";
@use "@assets/styles/composition.scss";
@use "@assets/styles/blocks.scss";
@use "~/assets/styles/global.scss";
@use "~/assets/styles/app.scss";
@use "~/assets/styles/layout.scss";
@use "~/assets/styles/utilities.scss";
@use "~/assets/styles/composition.scss";
@use "~/assets/styles/blocks.scss";

// PatternFly overrides
@use "@assets/styles/patternfly-overrides.scss";
@use "~/assets/styles/patternfly-overrides.scss";
6 changes: 3 additions & 3 deletions web/src/components/core/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
*/

import React, { useState } from "react";
import { noop } from "@/utils";
import { noop } from "~/utils";
import { Button, Text } from "@patternfly/react-core";
import { Icon } from "@components/layout";
import { Popup } from "@components/core";
import { Icon } from "~/components/layout";
import { Popup } from "~/components/core";

export default function About({ onClickCallback = noop }) {
const [isOpen, setIsOpen] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/About.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import React from "react";

import { screen, waitFor, within } from "@testing-library/react";
import { plainRender } from "@/test-utils";
import { plainRender } from "~/test-utils";

import About from "./About";

Expand Down
6 changes: 3 additions & 3 deletions web/src/components/core/ChangeProductButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import React from "react";
import { Button } from "@patternfly/react-core";
import { useNavigate } from "react-router-dom";
import { useSoftware } from "@context/software";
import { Icon } from "@components/layout";
import { noop } from "@/utils";
import { useSoftware } from "~/context/software";
import { Icon } from "~/components/layout";
import { noop } from "~/utils";

export default function ChangeProductButton({ onClickCallback = noop }) {
const { products } = useSoftware();
Expand Down
12 changes: 6 additions & 6 deletions web/src/components/core/ChangeProductButton.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@

import React from "react";
import { screen, waitFor } from "@testing-library/react";
import { plainRender } from "@/test-utils";
import { createClient } from "@client";
import { ChangeProductButton } from "@components/core";
import { plainRender } from "~/test-utils";
import { createClient } from "~/client";
import { ChangeProductButton } from "~/components/core";

let mockProducts;
const mockNavigateFn = jest.fn();

jest.mock("@client");
jest.mock("@context/software", () => ({
...jest.requireActual("@context/software"),
jest.mock("~/client");
jest.mock("~/context/software", () => ({
...jest.requireActual("~/context/software"),
useSoftware: () => {
return {
products: mockProducts,
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/Fieldset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// @ts-check

import React from "react";
import { classNames } from "@/utils";
import { classNames } from "~/utils";

import "./fieldset.scss";

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/Fieldset.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import React from "react";
import { screen, within } from "@testing-library/react";
import { installerRender } from "@/test-utils";
import { Fieldset } from "@components/core";
import { installerRender } from "~/test-utils";
import { Fieldset } from "~/components/core";

const ComplexLegend = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/InstallButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
*/

import React, { useState } from "react";
import { useInstallerClient } from "@context/installer";
import { useInstallerClient } from "~/context/installer";

import { Button, Text } from "@patternfly/react-core";
import { Popup } from "@components/core";
import { Popup } from "~/components/core";

const InstallConfirmationPopup = ({ onAccept, onClose }) => (
<Popup
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/core/InstallButton.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import React from "react";
import { screen, waitFor } from "@testing-library/react";
import { installerRender } from "@/test-utils";
import { createClient } from "@client";
import { InstallButton } from "@components/core";
import { installerRender } from "~/test-utils";
import { createClient } from "~/client";
import { InstallButton } from "~/components/core";

const startInstallationFn = jest.fn().mockName("startInstallation");

jest.mock("@client", () => ({
jest.mock("~/client", () => ({
createClient: jest.fn()
}));

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/InstallationFinished.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import {
EmptyStateBody
} from "@patternfly/react-core";

import { Center, Icon, Title as SectionTitle, PageIcon, MainActions } from "@components/layout";
import { useInstallerClient } from "@context/installer";
import { Center, Icon, Title as SectionTitle, PageIcon, MainActions } from "~/components/layout";
import { useInstallerClient } from "~/context/installer";

function InstallationFinished() {
const client = useInstallerClient();
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/core/InstallationFinished.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
import React from "react";

import { screen } from "@testing-library/react";
import { installerRender, mockLayout } from "@/test-utils";
import { createClient } from "@client";
import { installerRender, mockLayout } from "~/test-utils";
import { createClient } from "~/client";

import InstallationFinished from "./InstallationFinished";

jest.mock("@client");
jest.mock("@components/layout/Layout", () => mockLayout());
jest.mock("~/client");
jest.mock("~/components/layout/Layout", () => mockLayout());

const rebootSystemFn = jest.fn();

Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/InstallationProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import React from "react";

import ProgressReport from "./ProgressReport";
import { Center, Icon, Title, PageIcon } from "@components/layout";
import { Questions } from "@components/questions";
import { Center, Icon, Title, PageIcon } from "~/components/layout";
import { Questions } from "~/components/questions";

function InstallationProgress() {
return (
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/core/InstallationProgress.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import React from "react";

import { screen } from "@testing-library/react";
import { installerRender, mockComponent, mockLayout } from "@/test-utils";
import { installerRender, mockComponent, mockLayout } from "~/test-utils";

import InstallationProgress from "./InstallationProgress";

jest.mock("@components/layout/Layout", () => mockLayout());
jest.mock("@components/core/ProgressReport", () => mockComponent("ProgressReport Mock"));
jest.mock("~/components/layout/Layout", () => mockLayout());
jest.mock("~/components/core/ProgressReport", () => mockComponent("ProgressReport Mock"));

describe("InstallationProgress", () => {
it("uses 'Installing' as title", async () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/KebabMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React, { useState } from "react";
import { Dropdown, DropdownToggle } from "@patternfly/react-core";
import { Icon } from "@components/layout";
import { Icon } from "~/components/layout";

export default function KebabMenu({ items, position = "right", id = Date.now(), ...props }) {
const [isOpen, setIsOpen] = useState(false);
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/core/LogsButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
*/

import React, { useState } from "react";
import { useInstallerClient } from "@context/installer";
import { useCancellablePromise } from "@/utils";
import { useInstallerClient } from "~/context/installer";
import { useCancellablePromise } from "~/utils";

import { Alert, Button } from "@patternfly/react-core";
import { Icon } from "@components/layout";
import { Icon } from "~/components/layout";

const FILENAME = "y2logs.tar.xz";
const FILETYPE = "application/x-xz";
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/core/LogsButton.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@

import React from "react";
import { screen } from "@testing-library/react";
import { installerRender } from "@/test-utils";
import { createClient } from "@client";
import { LogsButton } from "@components/core";
import { installerRender } from "~/test-utils";
import { createClient } from "~/client";
import { LogsButton } from "~/components/core";

jest.mock("@client");
jest.mock("~/client");

const originalCreateElement = document.createElement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { screen } from "@testing-library/react";
import { plainRender } from "@/test-utils";
import { plainRender } from "~/test-utils";
import PasswordAndConfirmationInput from "./PasswordAndConfirmationInput";

describe("when the passwords do not match", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/Popup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import React from "react";
import { Button, Modal } from "@patternfly/react-core";
import { partition } from "@/utils";
import { partition } from "~/utils";

/**
* Wrapper component for holding Popup actions
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/Popup.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import React from "react";

import { screen, within } from "@testing-library/react";
import { installerRender } from "@/test-utils";
import { installerRender } from "~/test-utils";

import { Popup } from "@components/core";
import { Popup } from "~/components/core";

let isOpen;
const confirmFn = jest.fn();
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/ProgressReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/

import React, { useState, useEffect } from "react";
import { useCancellablePromise } from "@/utils";
import { useInstallerClient } from "@context/installer";
import { useCancellablePromise } from "~/utils";
import { useInstallerClient } from "~/context/installer";

import { Progress, Text } from "@patternfly/react-core";

Expand Down
8 changes: 4 additions & 4 deletions web/src/components/core/ProgressReport.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
import React from "react";

import { act, screen } from "@testing-library/react";
import { installerRender, createCallbackMock } from "@/test-utils";
import { createClient } from "@client";
import { installerRender, createCallbackMock } from "~/test-utils";
import { createClient } from "~/client";

import { ProgressReport } from "@components/core";
import { ProgressReport } from "~/components/core";

jest.mock("@client");
jest.mock("~/client");

let callbacks;
let onManagerProgressChange = jest.fn();
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/core/Section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import {
Tooltip
} from "@patternfly/react-core";

import { Icon } from '@components/layout';
import { ValidationErrors } from "@components/core";
import { Icon } from '~/components/layout';
import { ValidationErrors } from "~/components/core";

/**
* Helper method for rendering section icon
Expand Down Expand Up @@ -91,7 +91,7 @@ const renderIcon = (name, size = 32) => {
* @param {string} [props.actionIconName="settings"] - name for the icon for linking to section settings, when needed
* @param {React.ReactNode} [props.actionTooltip] - text to be shown as a tooltip when user hovers action icon, if present
* @param {React.MouseEventHandler} [props.onActionClick] - callback to be triggered when user clicks on action icon, if present
* @param {import("@client/mixins").ValidationError[]} [props.errors] - Validation errors to be shown before the title
* @param {import("~/client/mixins").ValidationError[]} [props.errors] - Validation errors to be shown before the title
* @param {JSX.Element} [props.children] - the section content
*/
export default function Section({
Expand Down
Loading