Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Aiven-Open/klaw into offset-message
Browse files Browse the repository at this point in the history
  • Loading branch information
muralibasani committed Nov 22, 2023
2 parents 6e053c4 + 492f95b commit 5dbacfc
Show file tree
Hide file tree
Showing 36 changed files with 71 additions and 206 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cleanup, render, screen } from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { cleanup, render, screen, within } from "@testing-library/react";
import { DocumentationEditor } from "src/app/components/documentation/DocumentationEditor";
import { userEvent } from "@testing-library/user-event";
import { tabThroughForward } from "src/services/test-utils/tabbing";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cleanup, render, screen } from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { cleanup, render, screen, within } from "@testing-library/react";
import { DocumentationView } from "src/app/components/documentation/DocumentationView";

const markdownInput = `# Hello world`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cleanup, screen } from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { cleanup, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { EntityDetailsHeader } from "src/app/features/components/EntityDetailsHeader";
import { EnvironmentInfo } from "src/domain/environment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { ConnectorDetails } from "src/app/features/connectors/details/ConnectorDetails";
import {
ConnectorOverview,
Expand Down Expand Up @@ -306,11 +306,10 @@ describe("ConnectorDetails", () => {

await waitForElementToBeRemoved(screen.getByPlaceholderText("Loading"));

const description = await waitFor(() =>
screen.getByText(
`This connector is currently owned by ${testConnectorOverview.connectorInfo.teamName}. Select "Claim connector" to request ownership.`
)
const description = await screen.findByText(
`This connector is currently owned by ${testConnectorOverview.connectorInfo.teamName}. Select "Claim connector" to request ownership.`
);

const button = await waitFor(() =>
screen.getByRole("button", { name: "Claim connector" })
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { cleanup, screen } from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { userEvent } from "@testing-library/user-event";
import { ConnectorOverviewResourcesTabs } from "src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs";
import { ConnectorOverviewTabEnum } from "src/app/router_utils";
Expand Down Expand Up @@ -254,17 +253,6 @@ describe("ConnectorOverviewResourceTabs", () => {

expect(tab).toHaveAccessibleName("Overview");
});

it("shows a preview banner to enables users to go back to original app", () => {
const banner = screen.getByRole("region", { name: "Preview disclaimer" });
const link = within(banner).getByRole("link", { name: "old interface" });

expect(banner).toBeVisible();
expect(link).toHaveAttribute(
"href",
`/connectorOverview?connectorName=${testConnectorName}`
);
});
});

describe("enables users to switch panels", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Alert, Box, Icon, Tabs } from "@aivenio/aquarium";
import loading from "@aivenio/aquarium/icons/loading";
import { NavigateFunction, Outlet, useNavigate } from "react-router-dom";
import PreviewBanner from "src/app/components/PreviewBanner";
import {
CONNECTOR_OVERVIEW_TAB_ID_INTO_PATH,
ConnectorOverviewTabEnum,
Expand Down Expand Up @@ -128,14 +127,7 @@ function ConnectorOverviewResourcesTabs({
aria-label={tab.title}
key={tab.title}
>
{currentTab === tab.connectorOverviewTabEnum && (
<div>
<PreviewBanner
linkTarget={`/connectorOverview?connectorName=${connectorName}`}
/>
{renderTabContent()}
</div>
)}
{currentTab === tab.connectorOverviewTabEnum && renderTabContent()}
</Tabs.Tab>
);
})}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { cleanup, screen } from "@testing-library/react";
import { cleanup, screen, within } from "@testing-library/react";
import { ConnectorOverview } from "src/app/features/connectors/details/overview/ConnectorOverview";
import { ConnectorOverview as ConnectorOverviewType } from "src/domain/connector";
import { customRender } from "src/services/test-utils/render-with-wrappers";
import { within } from "@testing-library/react/pure";

const mockedUseConnectorDetails = jest.fn();
jest.mock("src/app/features/connectors/details/ConnectorDetails", () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
screen,
waitFor,
waitForElementToBeRemoved,
within,
} from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { userEvent } from "@testing-library/user-event";
import { TopicDetails } from "src/app/features/topics/details/TopicDetails";
import { TopicOverview, TopicSchemaOverview } from "src/domain/topic";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { userEvent } from "@testing-library/user-event";
import { TopicOverviewTabEnum } from "src/app/router_utils";
import { customRender } from "src/services/test-utils/render-with-wrappers";
import { TopicOverviewResourcesTabs } from "src/app/features/topics/details/components/TopicDetailsResourceTabs";
import { within } from "@testing-library/react/pure";
import { TopicOverview } from "src/domain/topic";

const mockedNavigate = jest.fn();
Expand Down Expand Up @@ -310,17 +309,6 @@ describe("TopicDetailsResourceTabs", () => {

expect(tab).toHaveAccessibleName("Overview");
});

it("shows a preview banner to enables users to go back to original app", () => {
const banner = screen.getByRole("region", { name: "Preview disclaimer" });
const link = within(banner).getByRole("link", { name: "old interface" });

expect(banner).toBeVisible();
expect(link).toHaveAttribute(
"href",
`/topicOverview?topicname=${testTopicName}`
);
});
});

describe("enables users to switch panels", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Alert, Box, Icon, Tabs } from "@aivenio/aquarium";
import loading from "@aivenio/aquarium/icons/loading";
import { NavigateFunction, Outlet, useNavigate } from "react-router-dom";
import PreviewBanner from "src/app/components/PreviewBanner";
import {
TOPIC_OVERVIEW_TAB_ID_INTO_PATH,
TopicOverviewTabEnum,
Expand Down Expand Up @@ -152,14 +151,7 @@ function TopicOverviewResourcesTabs({
aria-label={tab.title}
key={tab.title}
>
{currentTab === tab.topicOverviewTabEnum && (
<div>
<PreviewBanner
linkTarget={`/topicOverview?topicname=${topicName}`}
/>
{renderTabContent()}
</div>
)}
{currentTab === tab.topicOverviewTabEnum && renderTabContent()}
</Tabs.Tab>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import {
ClusterDetails as ClusterDetailsType,
getClusterDetails,
} from "src/domain/cluster";
import { cleanup, RenderResult, screen } from "@testing-library/react";
import { cleanup, RenderResult, screen, within } from "@testing-library/react";
import { getDefinitionList } from "src/services/test-utils/custom-queries";
import { within } from "@testing-library/react/pure";

const mockedUseTopicDetails = jest.fn();
jest.mock("src/app/features/topics/details/TopicDetails", () => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Context as AquariumContext } from "@aivenio/aquarium";
import { cleanup, screen } from "@testing-library/react";
import { within } from "@testing-library/react/pure";
import { cleanup, screen, within } from "@testing-library/react";
import { TopicDetailsSchema } from "src/app/features/topics/details/schema/TopicDetailsSchema";
import { customRender } from "src/services/test-utils/render-with-wrappers";
import { TopicSchemaOverview } from "src/domain/topic";
Expand Down
8 changes: 1 addition & 7 deletions coral/src/app/pages/approvals/acls/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import PreviewBanner from "src/app/components/PreviewBanner";
import AclApprovals from "src/app/features/approvals/acls/AclApprovals";

const AclApprovalsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/execAcls"} />
<AclApprovals />
</>
);
return <AclApprovals />;
};

export default AclApprovalsPage;
8 changes: 1 addition & 7 deletions coral/src/app/pages/approvals/connectors/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import PreviewBanner from "src/app/components/PreviewBanner";
import ConnectorApprovals from "src/app/features/approvals/connectors/ConnectorApprovals";

const ConnectorApprovalsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/execConnectors"} />
<ConnectorApprovals />
</>
);
return <ConnectorApprovals />;
};

export default ConnectorApprovalsPage;
4 changes: 4 additions & 0 deletions coral/src/app/pages/approvals/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
APPROVALS_TAB_ID_INTO_PATH,
ApprovalsTabEnum,
isApprovalsTabEnum,
APPROVALS_TAB_PATH_LINK_MAP,
} from "src/app/router_utils";
import PreviewBanner from "src/app/components/PreviewBanner";

const ApprovalsPage = () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -14,8 +16,10 @@ const ApprovalsPage = () => {
if (currentTab === undefined) {
return <Navigate to={`/approvals/topics`} replace={true} />;
}

return (
<>
<PreviewBanner linkTarget={APPROVALS_TAB_PATH_LINK_MAP[currentTab]} />
<PageHeader title={"Approve requests"} />
<ApprovalResourceTabs currentTab={currentTab} />
</>
Expand Down
8 changes: 1 addition & 7 deletions coral/src/app/pages/approvals/schemas/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import PreviewBanner from "src/app/components/PreviewBanner";
import SchemaApprovals from "src/app/features/approvals/schemas/SchemaApprovals";

const SchemaApprovalsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/execSchemas"} />
<SchemaApprovals />
</>
);
return <SchemaApprovals />;
};

export default SchemaApprovalsPage;
8 changes: 1 addition & 7 deletions coral/src/app/pages/approvals/topics/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import PreviewBanner from "src/app/components/PreviewBanner";
import TopicApprovals from "src/app/features/approvals/topics/TopicApprovals";

const TopicApprovalsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/execTopics"} />
<TopicApprovals />
</>
);
return <TopicApprovals />;
};

export default TopicApprovalsPage;
2 changes: 2 additions & 0 deletions coral/src/app/pages/configuration/environments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
EnvironmentsTabEnum,
isEnvironmentsTabEnum,
} from "src/app/router_utils";
import PreviewBanner from "src/app/components/PreviewBanner";

function findMatchingTab(
matches: ReturnType<typeof useMatches>
Expand All @@ -30,6 +31,7 @@ const EnvironmentsPage = () => {
}
return (
<>
<PreviewBanner linkTarget={"/envs"} />
<PageHeader title={"Environments"} />
<EnvironmentsTabs currentTab={currentTab} />
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { PageHeader } from "@aivenio/aquarium";
import PreviewBanner from "src/app/components/PreviewBanner";
import KafkaConnectEnvironments from "src/app/features/configuration/environments/KafkaConnect/KafkaConnectEnvironments";

const KafkaConnectEnvironmentsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/envs"} />
<PageHeader title={"Kafka Connect Environments"} />
<KafkaConnectEnvironments />
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { PageHeader } from "@aivenio/aquarium";
import PreviewBanner from "src/app/components/PreviewBanner";
import KafkaEnvironments from "src/app/features/configuration/environments/Kafka/KafkaEnvironments";

const KafkaEnvironmentsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/envs"} />
<PageHeader title={"Kafka Environments"} />
<KafkaEnvironments />
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { PageHeader } from "@aivenio/aquarium";
import PreviewBanner from "src/app/components/PreviewBanner";
import SchemaRegistryEnvironments from "src/app/features/configuration/environments/SchemaRegistry/SchemaRegistryEnvironments";

const SchemaRegistryEnvironmentsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/envs"} />
<PageHeader title={"Schema Registry Environments"} />
<SchemaRegistryEnvironments />
</>
Expand Down
2 changes: 2 additions & 0 deletions coral/src/app/pages/configuration/teams/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { PageHeader } from "@aivenio/aquarium";
import { Teams } from "src/app/features/configuration/teams/Teams";
import PreviewBanner from "src/app/components/PreviewBanner";

const TeamsPage = () => {
return (
<>
<PreviewBanner linkTarget={"/teams"} />
<PageHeader title={"Teams"} />
<Teams />
</>
Expand Down
2 changes: 2 additions & 0 deletions coral/src/app/pages/configuration/users/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { PageHeader } from "@aivenio/aquarium";
import { Users } from "src/app/features/configuration/users/Users";
import PreviewBanner from "src/app/components/PreviewBanner";

const UsersPage = () => {
return (
<>
<PreviewBanner linkTarget={"/users"} />
<PageHeader title={"Users"} />
<Users />
</>
Expand Down
10 changes: 9 additions & 1 deletion coral/src/app/pages/connectors/details/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useNavigate, useParams } from "react-router-dom";
import { ConnectorDetails } from "src/app/features/connectors/details/ConnectorDetails";
import PreviewBanner from "src/app/components/PreviewBanner";

function ConnectorDetailsPage() {
const { connectorName } = useParams();
Expand All @@ -10,7 +11,14 @@ function ConnectorDetailsPage() {
return <></>;
}

return <ConnectorDetails connectorName={connectorName} />;
return (
<>
<PreviewBanner
linkTarget={`/connectorOverview?connectorName=${connectorName}`}
/>
<ConnectorDetails connectorName={connectorName} />
</>
);
}

export { ConnectorDetailsPage };
21 changes: 1 addition & 20 deletions coral/src/app/pages/requests/acls/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { customRender } from "src/services/test-utils/render-with-wrappers";
import { cleanup, screen, within } from "@testing-library/react";
import { cleanup, screen } from "@testing-library/react";
import { waitForElementToBeRemoved } from "@testing-library/react/pure";
import { getAllEnvironmentsForTopicAndAcl } from "src/domain/environment";
import AclRequestsPage from "src/app/pages/requests/acls/index";
Expand Down Expand Up @@ -34,25 +34,6 @@ describe("AclRequestsPage", () => {

afterAll(cleanup);

it("shows a preview banner to inform users about the early version of the view", () => {
const previewBanner = screen.getByLabelText("Preview disclaimer");

expect(previewBanner).toBeVisible();
expect(previewBanner).toHaveTextContent(
"You are viewing a preview of the redesigned user interface. You are one of our early reviewers, and your feedback will help us improve the product. You can always go back to the old interface."
);
});

it("shows link back back to the original Klaw app for this view in the preview banner", () => {
const previewBanner = screen.getByLabelText("Preview disclaimer");
const link = within(previewBanner).getByRole("link", {
name: "old interface",
});

expect(link).toBeVisible();
expect(link).toHaveAttribute("href", "/myAclRequests");
});

it("renders the Acl request view", () => {
const emptyRequests = screen.getByText(
"No ACL request matched your criteria."
Expand Down
Loading

0 comments on commit 5dbacfc

Please sign in to comment.