1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

feat: upgrade sso (#8813)

This commit is contained in:
Mateusz Kwasniewski 2024-11-20 16:42:34 +01:00 committed by GitHub
parent 01bd877a81
commit 4a769d14a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 95 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -0,0 +1,90 @@
import { Box, IconButton, Link, styled, Tooltip } from '@mui/material';
import upgradeSso from 'assets/img/upgradeSso.png';
import { formatAssetPath } from 'utils/formatPath';
import Close from '@mui/icons-material/Close';
import { useLocalStorageState } from 'hooks/useLocalStorageState';
const Wrapper = styled(Box)(({ theme }) => ({
marginTop: theme.spacing(10),
width: '100%',
backgroundColor: theme.palette.background.elevation1,
borderRadius: theme.shape.borderRadiusMedium,
padding: theme.spacing(2),
display: 'flex',
justifyContent: 'center',
position: 'relative',
}));
const StyledLink = styled(Link)(({ theme }) => ({
textDecoration: 'none',
fontWeight: theme.typography.fontWeightBold,
}));
const StyledImage = styled('img')(({ theme }) => ({
width: theme.spacing(14),
}));
const StyledCloseButton = styled(IconButton)(({ theme }) => ({
position: 'absolute',
top: theme.spacing(1.25),
right: theme.spacing(1.5),
}));
const MainContent = styled(Box)(({ theme }) => ({
display: 'flex',
gap: theme.spacing(3),
marginTop: theme.spacing(1),
marginBottom: theme.spacing(1),
}));
const MainText = styled(Box)(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
gap: theme.spacing(1),
maxWidth: theme.spacing(60),
}));
export const UpgradeSSO = () => {
const [ssoUpgrade, setSsoUpgrade] = useLocalStorageState<'open' | 'closed'>(
'upgrade-sso:v1',
'open',
);
if (ssoUpgrade === 'closed') return null;
return (
<Wrapper>
<MainContent>
<StyledImage
src={formatAssetPath(upgradeSso)}
alt='Single sign-on'
/>
<MainText>
<p>
Streamline access and account management, reduce setup
time and enhance security with <b>Single Sign-On</b> and{' '}
<b>Automatic User Provisioning via SCIM</b>.
</p>
<StyledLink
href='https://www.getunleash.io/upgrade-unleash?utm_source=sso'
target='_blank'
>
View our Enterprise offering
</StyledLink>
</MainText>
</MainContent>
<Tooltip title='Dismiss' arrow>
<StyledCloseButton
aria-label='dismiss'
onClick={() => {
setSsoUpgrade('closed');
}}
size='small'
>
<Close fontSize='inherit' />
</StyledCloseButton>
</Tooltip>
</Wrapper>
);
};

View File

@ -40,10 +40,11 @@ import { useUiFlag } from 'hooks/useUiFlag';
import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig';
import { useScimSettings } from 'hooks/api/getters/useScimSettings/useScimSettings';
import { UserSessionsCell } from './UserSessionsCell/UserSessionsCell';
import { UpgradeSSO } from './UpgradeSSO';
const UsersList = () => {
const navigate = useNavigate();
const { isEnterprise } = useUiConfig();
const { isEnterprise, isOss } = useUiConfig();
const { users, roles, refetch, loading } = useUsers();
const { setToastData, setToastApiError } = useToast();
const { removeUser, userLoading, userApiErrors } = useAdminUsersApi();
@ -59,6 +60,7 @@ const UsersList = () => {
});
const userAccessUIEnabled = useUiFlag('userAccessUIEnabled');
const showUserDeviceCount = useUiFlag('showUserDeviceCount');
const showSSOUpgrade = isOss() && users.length > 3;
const {
settings: { enabled: scimEnabled },
@ -426,6 +428,8 @@ const UsersList = () => {
/>
}
/>
{showSSOUpgrade ? <UpgradeSSO /> : null}
</PageContent>
);
};