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
4 changes: 0 additions & 4 deletions web/src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import { L10nClient } from "./l10n";
import { ManagerClient } from "./manager";
import { StorageClient } from "./storage";
import { QuestionsClient } from "./questions";
import { NetworkClient } from "./network";
import { HTTPClient, WSClient } from "./http";

Expand All @@ -34,7 +33,6 @@ import { HTTPClient, WSClient } from "./http";
* @property {ManagerClient} manager - manager client.
* @property {NetworkClient} network - network client.
* @property {StorageClient} storage - storage client.
* @property {QuestionsClient} questions - questions client.
* @property {() => WSClient} ws - Agama WebSocket client.
* @property {() => boolean} isConnected - determines whether the client is connected
* @property {() => boolean} isRecoverable - determines whether the client is recoverable after disconnected
Expand All @@ -57,7 +55,6 @@ const createClient = (url) => {
const manager = new ManagerClient(client);
const network = new NetworkClient(client);
const storage = new StorageClient(client);
const questions = new QuestionsClient(client);

const isConnected = () => client.ws().isConnected() || false;
const isRecoverable = () => !!client.ws().isRecoverable();
Expand All @@ -67,7 +64,6 @@ const createClient = (url) => {
manager,
network,
storage,
questions,
isConnected,
isRecoverable,
onConnect: (handler) => client.ws().onOpen(handler),
Expand Down
153 changes: 0 additions & 153 deletions web/src/client/questions.js

This file was deleted.

124 changes: 0 additions & 124 deletions web/src/client/questions.test.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2022] SUSE LLC
* Copyright (c) [2022-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -21,10 +21,11 @@

import React from "react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { GenericQuestion } from "~/components/questions";
import { plainRender } from "~/test-utils";
import { Question } from "~/types/questions";
import GenericQuestion from "~/components/questions/GenericQuestion";

const question = {
const question: Question = {
id: 1,
text: "Do you write unit tests?",
options: ["always", "sometimes", "never"],
Expand All @@ -34,7 +35,7 @@ const question = {
const answerFn = jest.fn();

const renderQuestion = () =>
installerRender(<GenericQuestion question={question} answerCallback={answerFn} />);
plainRender(<GenericQuestion question={question} answerCallback={answerFn} />);

describe("GenericQuestion", () => {
it("renders the question text", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) [2022] SUSE LLC
* Copyright (c) [2022-2024] SUSE LLC
*
* All Rights Reserved.
*
Expand All @@ -22,11 +22,24 @@
import React from "react";
import { Text } from "@patternfly/react-core";
import { Popup } from "~/components/core";
import { QuestionActions } from "~/components/questions";
import { AnswerCallback, Question } from "~/types/questions";
import QuestionActions from "~/components/questions/QuestionActions";
import { _ } from "~/i18n";

export default function GenericQuestion({ question, answerCallback }) {
const actionCallback = (option) => {
/**
* Component for rendering generic questions
*
* @param question - the question to be answered
* @param answerCallback - the callback to be triggered on answer
*/
export default function GenericQuestion({
question,
answerCallback,
}: {
question: Question;
answerCallback: AnswerCallback;
}): React.ReactNode {
const actionCallback = (option: string) => {
question.answer = option;
answerCallback(question);
};
Expand Down
Loading