@@ -4,12 +4,12 @@ import {
44 // Create/Edit
55 Create , DeleteButton , Edit , SaveButton , SimpleForm , Toolbar ,
66 // List
7- Datagrid , DatagridConfigurable , EditButton , List ,
8- // List actions
9- BulkDeleteButton , BulkExportButton , BulkUpdateButton , CreateButton , ExportButton ,
10- FilterButton , SelectColumnsButton , TopToolbar ,
7+ Datagrid , DatagridConfigurable , List ,
118 // Show
129 SimpleShowLayout , Show ,
10+ // Actions
11+ BulkDeleteButton , BulkExportButton , BulkUpdateButton , CreateButton , ExportButton ,
12+ FilterButton , SelectColumnsButton , TopToolbar ,
1313 // Fields
1414 BooleanField , DateField , NumberField , ReferenceField , ReferenceManyField , TextField ,
1515 // Inputs
@@ -18,7 +18,7 @@ import {
1818 // Filters
1919 email , maxLength , maxValue , minLength , minValue , regex , required ,
2020 // Misc
21- AutocompleteInput , HttpError , WithRecord
21+ AutocompleteInput , EditButton , HttpError , WithRecord
2222} from "react-admin" ;
2323import VisibilityOffIcon from "@mui/icons-material/VisibilityOff" ;
2424
@@ -234,13 +234,21 @@ const AiohttpList = (resource, name, permissions) => {
234234 ) ;
235235}
236236
237- const AiohttpShow = ( resource , name , permissions ) => (
238- < Show >
239- < SimpleShowLayout >
240- { createFields ( resource , name , permissions ) }
241- </ SimpleShowLayout >
242- </ Show >
243- ) ;
237+ const AiohttpShow = ( resource , name , permissions ) => {
238+ const ShowActions = ( ) => (
239+ < TopToolbar >
240+ < WithRecord render = { ( record ) => hasPermission ( `${ name } .edit` , permissions , record ) && < EditButton /> } />
241+ </ TopToolbar >
242+ ) ;
243+
244+ return (
245+ < Show actions = { < ShowActions /> } >
246+ < SimpleShowLayout >
247+ { createFields ( resource , name , permissions ) }
248+ </ SimpleShowLayout >
249+ </ Show >
250+ ) ;
251+ }
244252
245253const AiohttpEdit = ( resource , name , permissions ) => {
246254 const AiohttpEditToolbar = props => (
0 commit comments