1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

feat: clickable banner modal links (#6552)

This commit is contained in:
Mateusz Kwasniewski 2024-03-14 13:19:27 +01:00 committed by GitHub
parent 56c3dc438f
commit 2b2089f7b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 12 deletions

View File

@ -79,7 +79,7 @@ const ApplicationOverview = () => {
<ApplicationContainer> <ApplicationContainer>
<ApplicationHeader> <ApplicationHeader>
<ProjectContainer> <ProjectContainer>
Projects using this application Application is connected to these projects:
{data.projects.map((project) => ( {data.projects.map((project) => (
<Badge <Badge
sx={{ cursor: 'pointer' }} sx={{ cursor: 'pointer' }}

View File

@ -1,4 +1,4 @@
import { styled } from '@mui/material'; import { Box, styled } from '@mui/material';
import { Dialogue } from 'component/common/Dialogue/Dialogue'; import { Dialogue } from 'component/common/Dialogue/Dialogue';
import { Markdown } from 'component/common/Markdown/Markdown'; import { Markdown } from 'component/common/Markdown/Markdown';
import { ReactNode } from 'react'; import { ReactNode } from 'react';
@ -22,20 +22,31 @@ export const BannerDialog = ({
title, title,
children, children,
}: IBannerDialogProps) => { }: IBannerDialogProps) => {
const handleClose = () => {
setOpen(false);
};
return ( return (
<Dialogue <Dialogue
title={title} title={title}
open={open} open={open}
secondaryButtonText='Close' secondaryButtonText='Close'
onClose={() => { onClose={handleClose}
setOpen(false);
}}
> >
{typeof children === 'string' ? ( <Box
<StyledMarkdown>{children}</StyledMarkdown> onClick={(e) => {
) : ( const target = e.target as HTMLElement;
children if (target.nodeName === 'A') {
)} handleClose();
}
}}
>
{typeof children === 'string' ? (
<StyledMarkdown>{children}</StyledMarkdown>
) : (
children
)}
</Box>
</Dialogue> </Dialogue>
); );
}; };

View File

@ -1,4 +1,4 @@
import { screen } from '@testing-library/react'; import { screen, waitFor } from '@testing-library/react';
import { render } from 'utils/testRenderer'; import { render } from 'utils/testRenderer';
import { testServerRoute, testServerSetup } from 'utils/testServer'; import { testServerRoute, testServerSetup } from 'utils/testServer';
import { OutdatedSdksSchema } from 'openapi'; import { OutdatedSdksSchema } from 'openapi';
@ -30,7 +30,14 @@ test('Show outdated SDKs and apps using them', async () => {
link.click(); link.click();
await screen.findByText('Outdated SDKs');
await screen.findByText('unleash-node-client:3.2.1'); await screen.findByText('unleash-node-client:3.2.1');
await screen.findByText('application1'); const application = await screen.findByText('application1');
await screen.findByText('application2'); await screen.findByText('application2');
application.click(); // clicking on an application link should close the modal
await waitFor(() => {
expect(screen.queryByText('Outdated SDKs')).not.toBeInTheDocument();
});
}); });

View File

@ -50,6 +50,7 @@ process.nextTick(async () => {
executiveDashboard: true, executiveDashboard: true,
userAccessUIEnabled: true, userAccessUIEnabled: true,
sdkReporting: true, sdkReporting: true,
outdatedSdksBanner: true,
globalFrontendApiCache: true, globalFrontendApiCache: true,
returnGlobalFrontendApiCache: true, returnGlobalFrontendApiCache: true,
}, },