From 492f95b0d789f98cc0d4fdd4494bc27ebc29eca4 Mon Sep 17 00:00:00 2001 From: Mirjam Aulbach Date: Wed, 22 Nov 2023 16:26:16 +0100 Subject: [PATCH] refactor(coral): Align info banner with links to old interface (#2010) * Add preview banner to users and teams page. Signed-off-by: Mirjam Aulbach * Add info banner with link to old interface in env page directly. Signed-off-by: Mirjam Aulbach * Add info banner with link to old interface in topic details page directly. Signed-off-by: Mirjam Aulbach * Add info banner with links to old interface in approvals index page instead of each tab component. Signed-off-by: Mirjam Aulbach * Add info banner with links to old interface in requests index page instead of each tab component. Signed-off-by: Mirjam Aulbach * Removed unused import Signed-off-by: Mirjam Aulbach * Add info banner with links to old interface in connector details index page instead of each tab component. Signed-off-by: Mirjam Aulbach * Update import path for within. Signed-off-by: Mirjam Aulbach * Update query for flaky ? test Signed-off-by: Mirjam Aulbach --------- Signed-off-by: Mirjam Aulbach --- .../DocumentationEditor.test.tsx | 3 +-- .../documentation/DocumentationView.test.tsx | 3 +-- .../components/EntityDetailsHeader.test.tsx | 3 +-- .../details/ConnectorDetails.test.tsx | 9 ++++---- .../ConnectorOverviewResourcesTabs.test.tsx | 12 ----------- .../ConnectorOverviewResourcesTabs.tsx | 10 +-------- .../overview/ConnectorOverview.test.tsx | 3 +-- .../topics/details/TopicDetails.test.tsx | 2 +- .../TopicDetailsResourceTabs.test.tsx | 12 ----------- .../components/TopicDetailsResourceTabs.tsx | 10 +-------- .../details/overview/TopicOverview.test.tsx | 3 +-- .../schema/TopicDetailsSchema.test.tsx | 3 +-- coral/src/app/pages/approvals/acls/index.tsx | 8 +------ .../app/pages/approvals/connectors/index.tsx | 8 +------ coral/src/app/pages/approvals/index.tsx | 4 ++++ .../src/app/pages/approvals/schemas/index.tsx | 8 +------ .../src/app/pages/approvals/topics/index.tsx | 8 +------ .../configuration/environments/index.tsx | 2 ++ .../environments/kafka-connect/index.tsx | 2 -- .../environments/kafka/index.tsx | 2 -- .../environments/schema-registry/index.tsx | 2 -- .../app/pages/configuration/teams/index.tsx | 2 ++ .../app/pages/configuration/users/index.tsx | 2 ++ .../app/pages/connectors/details/index.tsx | 10 ++++++++- .../app/pages/requests/acls/index.test.tsx | 21 +------------------ coral/src/app/pages/requests/acls/index.tsx | 8 +------ .../pages/requests/connectors/index.test.tsx | 21 +------------------ .../app/pages/requests/connectors/index.tsx | 8 +------ coral/src/app/pages/requests/index.tsx | 3 +++ .../app/pages/requests/schemas/index.test.tsx | 21 +------------------ .../src/app/pages/requests/schemas/index.tsx | 8 +------ .../app/pages/requests/topics/index.test.tsx | 21 +------------------ coral/src/app/pages/requests/topics/index.tsx | 8 +------ coral/src/app/pages/topics/details/index.tsx | 8 ++++++- coral/src/app/router_utils.ts | 16 ++++++++++++++ .../src/services/test-utils/custom-queries.ts | 3 +-- 36 files changed, 71 insertions(+), 206 deletions(-) diff --git a/coral/src/app/components/documentation/DocumentationEditor.test.tsx b/coral/src/app/components/documentation/DocumentationEditor.test.tsx index 7c2a86430d..07b835a23c 100644 --- a/coral/src/app/components/documentation/DocumentationEditor.test.tsx +++ b/coral/src/app/components/documentation/DocumentationEditor.test.tsx @@ -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"; diff --git a/coral/src/app/components/documentation/DocumentationView.test.tsx b/coral/src/app/components/documentation/DocumentationView.test.tsx index 891f4107db..515f6034e2 100644 --- a/coral/src/app/components/documentation/DocumentationView.test.tsx +++ b/coral/src/app/components/documentation/DocumentationView.test.tsx @@ -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`; diff --git a/coral/src/app/features/components/EntityDetailsHeader.test.tsx b/coral/src/app/features/components/EntityDetailsHeader.test.tsx index 5acb2c8893..fc55255da8 100644 --- a/coral/src/app/features/components/EntityDetailsHeader.test.tsx +++ b/coral/src/app/features/components/EntityDetailsHeader.test.tsx @@ -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"; diff --git a/coral/src/app/features/connectors/details/ConnectorDetails.test.tsx b/coral/src/app/features/connectors/details/ConnectorDetails.test.tsx index f345dbedf3..26ac184076 100644 --- a/coral/src/app/features/connectors/details/ConnectorDetails.test.tsx +++ b/coral/src/app/features/connectors/details/ConnectorDetails.test.tsx @@ -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, @@ -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" }) ); diff --git a/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.test.tsx b/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.test.tsx index b6b779ed48..7df7ef20ea 100644 --- a/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.test.tsx +++ b/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.test.tsx @@ -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"; @@ -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", () => { diff --git a/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.tsx b/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.tsx index 8387d4d0f7..d12ecdd0f2 100644 --- a/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.tsx +++ b/coral/src/app/features/connectors/details/components/ConnectorOverviewResourcesTabs.tsx @@ -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, @@ -128,14 +127,7 @@ function ConnectorOverviewResourcesTabs({ aria-label={tab.title} key={tab.title} > - {currentTab === tab.connectorOverviewTabEnum && ( -
- - {renderTabContent()} -
- )} + {currentTab === tab.connectorOverviewTabEnum && renderTabContent()} ); })} diff --git a/coral/src/app/features/connectors/details/overview/ConnectorOverview.test.tsx b/coral/src/app/features/connectors/details/overview/ConnectorOverview.test.tsx index a6322e28ac..407ab917de 100644 --- a/coral/src/app/features/connectors/details/overview/ConnectorOverview.test.tsx +++ b/coral/src/app/features/connectors/details/overview/ConnectorOverview.test.tsx @@ -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", () => ({ diff --git a/coral/src/app/features/topics/details/TopicDetails.test.tsx b/coral/src/app/features/topics/details/TopicDetails.test.tsx index 9ef9cb71c2..085ada7a6e 100644 --- a/coral/src/app/features/topics/details/TopicDetails.test.tsx +++ b/coral/src/app/features/topics/details/TopicDetails.test.tsx @@ -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"; diff --git a/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.test.tsx b/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.test.tsx index f9b643b323..9c1ea5abbc 100644 --- a/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.test.tsx +++ b/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.test.tsx @@ -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(); @@ -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", () => { diff --git a/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.tsx b/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.tsx index d5f0cff185..0e77d61d21 100644 --- a/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.tsx +++ b/coral/src/app/features/topics/details/components/TopicDetailsResourceTabs.tsx @@ -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, @@ -152,14 +151,7 @@ function TopicOverviewResourcesTabs({ aria-label={tab.title} key={tab.title} > - {currentTab === tab.topicOverviewTabEnum && ( -
- - {renderTabContent()} -
- )} + {currentTab === tab.topicOverviewTabEnum && renderTabContent()} ); })} diff --git a/coral/src/app/features/topics/details/overview/TopicOverview.test.tsx b/coral/src/app/features/topics/details/overview/TopicOverview.test.tsx index 06c1cf4f21..379bce6311 100644 --- a/coral/src/app/features/topics/details/overview/TopicOverview.test.tsx +++ b/coral/src/app/features/topics/details/overview/TopicOverview.test.tsx @@ -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", () => ({ diff --git a/coral/src/app/features/topics/details/schema/TopicDetailsSchema.test.tsx b/coral/src/app/features/topics/details/schema/TopicDetailsSchema.test.tsx index 5456c4fbfb..984c0dd3a0 100644 --- a/coral/src/app/features/topics/details/schema/TopicDetailsSchema.test.tsx +++ b/coral/src/app/features/topics/details/schema/TopicDetailsSchema.test.tsx @@ -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"; diff --git a/coral/src/app/pages/approvals/acls/index.tsx b/coral/src/app/pages/approvals/acls/index.tsx index ba28c71faa..01b7a033ec 100644 --- a/coral/src/app/pages/approvals/acls/index.tsx +++ b/coral/src/app/pages/approvals/acls/index.tsx @@ -1,13 +1,7 @@ -import PreviewBanner from "src/app/components/PreviewBanner"; import AclApprovals from "src/app/features/approvals/acls/AclApprovals"; const AclApprovalsPage = () => { - return ( - <> - - - - ); + return ; }; export default AclApprovalsPage; diff --git a/coral/src/app/pages/approvals/connectors/index.tsx b/coral/src/app/pages/approvals/connectors/index.tsx index a82a149858..0ae3b84244 100644 --- a/coral/src/app/pages/approvals/connectors/index.tsx +++ b/coral/src/app/pages/approvals/connectors/index.tsx @@ -1,13 +1,7 @@ -import PreviewBanner from "src/app/components/PreviewBanner"; import ConnectorApprovals from "src/app/features/approvals/connectors/ConnectorApprovals"; const ConnectorApprovalsPage = () => { - return ( - <> - - - - ); + return ; }; export default ConnectorApprovalsPage; diff --git a/coral/src/app/pages/approvals/index.tsx b/coral/src/app/pages/approvals/index.tsx index f5804db99e..4911172a61 100644 --- a/coral/src/app/pages/approvals/index.tsx +++ b/coral/src/app/pages/approvals/index.tsx @@ -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 @@ -14,8 +16,10 @@ const ApprovalsPage = () => { if (currentTab === undefined) { return ; } + return ( <> + diff --git a/coral/src/app/pages/approvals/schemas/index.tsx b/coral/src/app/pages/approvals/schemas/index.tsx index 2b65f9b974..5d5dbd01c4 100644 --- a/coral/src/app/pages/approvals/schemas/index.tsx +++ b/coral/src/app/pages/approvals/schemas/index.tsx @@ -1,13 +1,7 @@ -import PreviewBanner from "src/app/components/PreviewBanner"; import SchemaApprovals from "src/app/features/approvals/schemas/SchemaApprovals"; const SchemaApprovalsPage = () => { - return ( - <> - - - - ); + return ; }; export default SchemaApprovalsPage; diff --git a/coral/src/app/pages/approvals/topics/index.tsx b/coral/src/app/pages/approvals/topics/index.tsx index 0dee57f13f..ab6e1cf566 100644 --- a/coral/src/app/pages/approvals/topics/index.tsx +++ b/coral/src/app/pages/approvals/topics/index.tsx @@ -1,13 +1,7 @@ -import PreviewBanner from "src/app/components/PreviewBanner"; import TopicApprovals from "src/app/features/approvals/topics/TopicApprovals"; const TopicApprovalsPage = () => { - return ( - <> - - - - ); + return ; }; export default TopicApprovalsPage; diff --git a/coral/src/app/pages/configuration/environments/index.tsx b/coral/src/app/pages/configuration/environments/index.tsx index c4475e073a..065bc7b54c 100644 --- a/coral/src/app/pages/configuration/environments/index.tsx +++ b/coral/src/app/pages/configuration/environments/index.tsx @@ -6,6 +6,7 @@ import { EnvironmentsTabEnum, isEnvironmentsTabEnum, } from "src/app/router_utils"; +import PreviewBanner from "src/app/components/PreviewBanner"; function findMatchingTab( matches: ReturnType @@ -30,6 +31,7 @@ const EnvironmentsPage = () => { } return ( <> + diff --git a/coral/src/app/pages/configuration/environments/kafka-connect/index.tsx b/coral/src/app/pages/configuration/environments/kafka-connect/index.tsx index fd4996bb21..471c2a6330 100644 --- a/coral/src/app/pages/configuration/environments/kafka-connect/index.tsx +++ b/coral/src/app/pages/configuration/environments/kafka-connect/index.tsx @@ -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 ( <> - diff --git a/coral/src/app/pages/configuration/environments/kafka/index.tsx b/coral/src/app/pages/configuration/environments/kafka/index.tsx index 59072c0ca7..abadf91860 100644 --- a/coral/src/app/pages/configuration/environments/kafka/index.tsx +++ b/coral/src/app/pages/configuration/environments/kafka/index.tsx @@ -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 ( <> - diff --git a/coral/src/app/pages/configuration/environments/schema-registry/index.tsx b/coral/src/app/pages/configuration/environments/schema-registry/index.tsx index 7e38282b34..c3c4537b97 100644 --- a/coral/src/app/pages/configuration/environments/schema-registry/index.tsx +++ b/coral/src/app/pages/configuration/environments/schema-registry/index.tsx @@ -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 ( <> - diff --git a/coral/src/app/pages/configuration/teams/index.tsx b/coral/src/app/pages/configuration/teams/index.tsx index 749458e938..7288449822 100644 --- a/coral/src/app/pages/configuration/teams/index.tsx +++ b/coral/src/app/pages/configuration/teams/index.tsx @@ -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 ( <> + diff --git a/coral/src/app/pages/configuration/users/index.tsx b/coral/src/app/pages/configuration/users/index.tsx index f2e8084301..370229ac69 100644 --- a/coral/src/app/pages/configuration/users/index.tsx +++ b/coral/src/app/pages/configuration/users/index.tsx @@ -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 ( <> + diff --git a/coral/src/app/pages/connectors/details/index.tsx b/coral/src/app/pages/connectors/details/index.tsx index 6a02bd9b7e..c0ed3934b5 100644 --- a/coral/src/app/pages/connectors/details/index.tsx +++ b/coral/src/app/pages/connectors/details/index.tsx @@ -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(); @@ -10,7 +11,14 @@ function ConnectorDetailsPage() { return <>; } - return ; + return ( + <> + + + + ); } export { ConnectorDetailsPage }; diff --git a/coral/src/app/pages/requests/acls/index.test.tsx b/coral/src/app/pages/requests/acls/index.test.tsx index 70b76af1d3..79e12bc4a7 100644 --- a/coral/src/app/pages/requests/acls/index.test.tsx +++ b/coral/src/app/pages/requests/acls/index.test.tsx @@ -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"; @@ -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." diff --git a/coral/src/app/pages/requests/acls/index.tsx b/coral/src/app/pages/requests/acls/index.tsx index 73a41d90ea..1c51f9edb0 100644 --- a/coral/src/app/pages/requests/acls/index.tsx +++ b/coral/src/app/pages/requests/acls/index.tsx @@ -1,13 +1,7 @@ import AclRequests from "src/app/features/requests/acls/AclRequests"; -import PreviewBanner from "src/app/components/PreviewBanner"; const AclRequestsPage = () => { - return ( - <> - - - - ); + return ; }; export default AclRequestsPage; diff --git a/coral/src/app/pages/requests/connectors/index.test.tsx b/coral/src/app/pages/requests/connectors/index.test.tsx index 38d5793038..40e502bebb 100644 --- a/coral/src/app/pages/requests/connectors/index.test.tsx +++ b/coral/src/app/pages/requests/connectors/index.test.tsx @@ -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 { getAllEnvironmentsForConnector } from "src/domain/environment"; import { getConnectorRequests } from "src/domain/connector/connector-api"; @@ -38,25 +38,6 @@ describe("ConnectorRequestsPage", () => { 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", "/myConnectorRequests"); - }); - it("renders the Connector request view", () => { const emptyRequests = screen.getByText( "No Connector request matched your criteria." diff --git a/coral/src/app/pages/requests/connectors/index.tsx b/coral/src/app/pages/requests/connectors/index.tsx index 0d370f4316..2062989456 100644 --- a/coral/src/app/pages/requests/connectors/index.tsx +++ b/coral/src/app/pages/requests/connectors/index.tsx @@ -1,13 +1,7 @@ import ConnectorRequests from "src/app/features/requests/connectors/ConnectorRequests"; -import PreviewBanner from "src/app/components/PreviewBanner"; const ConnectorRequestsPage = () => { - return ( - <> - - - - ); + return ; }; export default ConnectorRequestsPage; diff --git a/coral/src/app/pages/requests/index.tsx b/coral/src/app/pages/requests/index.tsx index 655bfa68c4..dbd071beaf 100644 --- a/coral/src/app/pages/requests/index.tsx +++ b/coral/src/app/pages/requests/index.tsx @@ -3,9 +3,11 @@ import { Navigate, useMatches } from "react-router-dom"; import RequestsResourceTabs from "src/app/features/requests/RequestsResourceTabs"; import { REQUESTS_TAB_ID_INTO_PATH, + REQUESTS_TAB_PATH_LINK_MAP, RequestsTabEnum, isRequestsTabEnum, } from "src/app/router_utils"; +import PreviewBanner from "src/app/components/PreviewBanner"; const RequestsPage = () => { // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -16,6 +18,7 @@ const RequestsPage = () => { } return ( <> + diff --git a/coral/src/app/pages/requests/schemas/index.test.tsx b/coral/src/app/pages/requests/schemas/index.test.tsx index 8f3ce1da7d..3ed11b31d8 100644 --- a/coral/src/app/pages/requests/schemas/index.test.tsx +++ b/coral/src/app/pages/requests/schemas/index.test.tsx @@ -1,7 +1,7 @@ import { getSchemaRequests } from "src/domain/schema-request"; import { customRender } from "src/services/test-utils/render-with-wrappers"; import SchemaRequestsPage from "src/app/pages/requests/schemas/index"; -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"; @@ -34,25 +34,6 @@ describe("SchemaRequestPage", () => { 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", "/mySchemaRequests"); - }); - it("renders the schema request view", () => { const emptyRequests = screen.getByText( "No Schema request matched your criteria." diff --git a/coral/src/app/pages/requests/schemas/index.tsx b/coral/src/app/pages/requests/schemas/index.tsx index 02ecc38e10..bee4ff8f4b 100644 --- a/coral/src/app/pages/requests/schemas/index.tsx +++ b/coral/src/app/pages/requests/schemas/index.tsx @@ -1,13 +1,7 @@ import SchemaRequests from "src/app/features/requests/schemas/SchemaRequests"; -import PreviewBanner from "src/app/components/PreviewBanner"; const SchemaRequestsPage = () => { - return ( - <> - - - - ); + return ; }; export default SchemaRequestsPage; diff --git a/coral/src/app/pages/requests/topics/index.test.tsx b/coral/src/app/pages/requests/topics/index.test.tsx index 26df6ebf48..a54bc8eb9f 100644 --- a/coral/src/app/pages/requests/topics/index.test.tsx +++ b/coral/src/app/pages/requests/topics/index.test.tsx @@ -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 { getTopicRequests } from "src/domain/topic/topic-api"; @@ -34,25 +34,6 @@ describe("TopicRequestsPage", () => { 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", "/myTopicRequests"); - }); - it("renders the topic request view", () => { const emptyRequests = screen.getByText( "No Topic request matched your criteria." diff --git a/coral/src/app/pages/requests/topics/index.tsx b/coral/src/app/pages/requests/topics/index.tsx index 29a3dc94c8..95e54b1d41 100644 --- a/coral/src/app/pages/requests/topics/index.tsx +++ b/coral/src/app/pages/requests/topics/index.tsx @@ -1,13 +1,7 @@ import TopicRequests from "src/app/features/requests/topics/TopicRequests"; -import PreviewBanner from "src/app/components/PreviewBanner"; const TopicRequestsPage = () => { - return ( - <> - - - - ); + return ; }; export default TopicRequestsPage; diff --git a/coral/src/app/pages/topics/details/index.tsx b/coral/src/app/pages/topics/details/index.tsx index 6a8652bcbf..57ce0ae15c 100644 --- a/coral/src/app/pages/topics/details/index.tsx +++ b/coral/src/app/pages/topics/details/index.tsx @@ -1,5 +1,6 @@ import { useNavigate, useParams } from "react-router-dom"; import { TopicDetails } from "src/app/features/topics/details/TopicDetails"; +import PreviewBanner from "src/app/components/PreviewBanner"; function TopicDetailsPage() { const { topicName } = useParams(); @@ -10,7 +11,12 @@ function TopicDetailsPage() { return <>; } - return ; + return ( + <> + + + + ); } export { TopicDetailsPage }; diff --git a/coral/src/app/router_utils.ts b/coral/src/app/router_utils.ts index f5d5868d18..199655a5c2 100644 --- a/coral/src/app/router_utils.ts +++ b/coral/src/app/router_utils.ts @@ -90,6 +90,13 @@ const REQUESTS_TAB_ID_INTO_PATH = { [RequestsTabEnum.CONNECTORS]: "connectors", } as const; +const REQUESTS_TAB_PATH_LINK_MAP = { + [RequestsTabEnum.TOPICS]: "/myTopicRequests", + [RequestsTabEnum.ACLS]: "/myAclRequests", + [RequestsTabEnum.SCHEMAS]: "/mySchemaRequests", + [RequestsTabEnum.CONNECTORS]: "/myConnectorRequests", +} as const; + const APPROVALS_TAB_ID_INTO_PATH = { [ApprovalsTabEnum.TOPICS]: "topics", [ApprovalsTabEnum.ACLS]: "acls", @@ -97,6 +104,13 @@ const APPROVALS_TAB_ID_INTO_PATH = { [ApprovalsTabEnum.CONNECTORS]: "connectors", } as const; +const APPROVALS_TAB_PATH_LINK_MAP = { + [ApprovalsTabEnum.TOPICS]: "/execTopics", + [ApprovalsTabEnum.ACLS]: "/execAcls", + [ApprovalsTabEnum.SCHEMAS]: "/execSchemas", + [ApprovalsTabEnum.CONNECTORS]: "/execConnectors", +} as const; + function isEnvironmentsTabEnum(value: unknown): value is EnvironmentsTabEnum { if (isString(value)) { return Object.prototype.hasOwnProperty.call( @@ -162,6 +176,8 @@ export { APPROVALS_TAB_ID_INTO_PATH, TOPIC_OVERVIEW_TAB_ID_INTO_PATH, CONNECTOR_OVERVIEW_TAB_ID_INTO_PATH, + APPROVALS_TAB_PATH_LINK_MAP, + REQUESTS_TAB_PATH_LINK_MAP, isEnvironmentsTabEnum, isRequestsTabEnum, isApprovalsTabEnum, diff --git a/coral/src/services/test-utils/custom-queries.ts b/coral/src/services/test-utils/custom-queries.ts index c4caf9579a..4cdf502845 100644 --- a/coral/src/services/test-utils/custom-queries.ts +++ b/coral/src/services/test-utils/custom-queries.ts @@ -1,5 +1,4 @@ -import { RenderResult } from "@testing-library/react"; -import { within } from "@testing-library/react/pure"; +import { RenderResult, within } from "@testing-library/react"; /** Custom query to be able to check for a Definition List * that testing-library does not provide