Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UI] EVEREST-1781 Update message for empty state when user has no create permissions #1035

Merged
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
23 changes: 21 additions & 2 deletions ui/apps/everest/src/pages/common/empty-state/databases/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Divider, Typography } from '@mui/material';
import { Box, Divider, Link, Typography } from '@mui/material';
import { EmptyStateIcon } from '@percona/ui-lib';
import { Messages } from './messages';
import CreateDbButton from 'pages/databases/create-db-button/create-db-button';
Expand All @@ -7,8 +7,10 @@ import { ContactSupportLink } from '../ContactSupportLink';

export const EmptyStateDatabases = ({
showCreationButton,
hasCreatePermission,
}: {
showCreationButton: boolean;
hasCreatePermission: boolean;
}) => {
return (
<>
Expand All @@ -22,7 +24,24 @@ export const EmptyStateDatabases = ({
<EmptyStateIcon w="60px" h="60px" />
<Box sx={centeredContainerStyle}>
<Typography>{Messages.noDbClusters}</Typography>
<Typography> {Messages.createToStart}</Typography>
{hasCreatePermission ? (
<Typography> {Messages.createToStart} </Typography>
) : (
<>
<Typography>{Messages.noPermissions}</Typography>
<Typography>
dianabirs marked this conversation as resolved.
Show resolved Hide resolved
Click{' '}
<Link
target="_blank"
rel="noopener"
href="https://docs.percona.com/everest/administer/rbac.html"
>
here
</Link>{' '}
to learn how to get permissions.
</Typography>
</>
)}
</Box>
{showCreationButton && <CreateDbButton />}
<Divider sx={{ width: '30%', marginTop: '10px' }} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export const Messages = {
createToStart: 'Create one to get started.',
create: 'Create Database',
contactSupport: 'Contact Percona Support',
noPermissions: 'You lack permission to create a database cluster.',
};
5 changes: 4 additions & 1 deletion ui/apps/everest/src/pages/databases/DbClusterView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ export const DbClusterView = () => {
tableName="dbClusterView"
emptyState={
namespaces.length > 0 ? (
<EmptyStateDatabases showCreationButton={canAddCluster} />
<EmptyStateDatabases
showCreationButton={canAddCluster}
hasCreatePermission={canAddCluster}
/>
) : (
<EmptyStateNamespaces />
)
Expand Down
Loading