-
Notifications
You must be signed in to change notification settings - Fork 13
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
Feature/view data card schemas #1345
Conversation
ARADDCC012
commented
Jun 25, 2024
frontend/src/schemas/SchemaList.tsx
Outdated
schemas.map((schema, index) => ( | ||
<ListItem divider={index < schemas.length - 1} key={schema.id}> | ||
<ListItemText>{schema.name}</ListItemText> | ||
<Stack spacing={1} direction={{ xs: 'column', md: 'row' }}> | ||
<Button size='small' variant='outlined' onClick={() => handleSetSchemaActive(schema)}> | ||
{schema.active ? 'Mark as inactive' : 'Mark as active'} | ||
</Button> | ||
<Button size='small' variant='contained' onClick={() => handleDeleteSchemaButtonOnClick(schema.id)}> | ||
Delete | ||
</Button> | ||
</Stack> | ||
))} | ||
</Stack> | ||
) | ||
}, [ | ||
schemas, | ||
errorMessage, | ||
open, | ||
schemaToBeDeleted, | ||
handleDeleteConfirm, | ||
handleDeleteSchemaButtonOnClick, | ||
handleSetSchemaActive, | ||
]) | ||
<MessageAlert message={errorMessage} severity='error' /> | ||
<ConfirmationDialogue | ||
open={open} | ||
title='Delete schema' | ||
onConfirm={() => handleDeleteConfirm(schemaToBeDeleted)} | ||
onCancel={() => setOpen(false)} | ||
errorMessage={errorMessage} | ||
dialogMessage={ | ||
'Deleting this schema will break any existing models that are using it. Are you sure you want to do this?' | ||
} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we render the ConfirmationDialog
outside of this mapping. Because you're mapping over many schemas when you go to delete one, it will render a ConfirmationDialog
for all of them. Cause this has translucent styling it mean's it renders the whole UI opaque black for multiple schemas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good catch and sloppy work on my part. There's no reason for either the ConfirmationDialog
nor MessageAlert
to be in here.