All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Introduced a new PermissionSettings management component, including a list view and modal for creating new permission settings. - Implemented a permissions matrix for managing user permissions with checkboxes for allow, deny, and inherit states. - Added associated styles in App.css for the permissions matrix table and checkbox components. - Created new icons and integrated them into the sidebar and relevant components for better visual representation. - Updated routing and sidebar configuration to include the new Permission Settings section in the management dashboard.
78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import ObjectInfo from '../../common/ObjectInfo'
|
|
import NewObjectForm from '../../common/NewObjectForm'
|
|
import WizardView from '../../common/WizardView'
|
|
|
|
const NewPermissionSettings = ({ onOk, defaultValues }) => {
|
|
return (
|
|
<NewObjectForm
|
|
type={'permissionSettings'}
|
|
defaultValues={{ permissions: {}, ...defaultValues }}
|
|
>
|
|
{({ handleSubmit, submitLoading, objectData, formValid }) => {
|
|
const steps = [
|
|
{
|
|
title: 'Required',
|
|
key: 'required',
|
|
content: (
|
|
<ObjectInfo
|
|
type='permissionSettings'
|
|
column={1}
|
|
bordered={false}
|
|
isEditing={true}
|
|
required={true}
|
|
objectData={objectData}
|
|
labelWidth={100}
|
|
/>
|
|
)
|
|
},
|
|
{
|
|
title: 'Summary',
|
|
key: 'summary',
|
|
content: (
|
|
<ObjectInfo
|
|
type='permissionSettings'
|
|
column={1}
|
|
bordered={false}
|
|
visibleProperties={{
|
|
_id: false,
|
|
_reference: false,
|
|
createdAt: false,
|
|
updatedAt: false,
|
|
permissions: false
|
|
}}
|
|
objectPropertyProps={{ scrollHeight: '320px' }}
|
|
labelWidth={130}
|
|
isEditing={false}
|
|
objectData={objectData}
|
|
/>
|
|
)
|
|
}
|
|
]
|
|
return (
|
|
<WizardView
|
|
steps={steps}
|
|
loading={submitLoading}
|
|
formValid={formValid}
|
|
title='New Permission Settings'
|
|
onSubmit={async () => {
|
|
const result = await handleSubmit()
|
|
if (result) {
|
|
onOk()
|
|
}
|
|
}}
|
|
/>
|
|
)
|
|
}}
|
|
</NewObjectForm>
|
|
)
|
|
}
|
|
|
|
NewPermissionSettings.propTypes = {
|
|
onOk: PropTypes.func.isRequired,
|
|
reset: PropTypes.bool,
|
|
defaultValues: PropTypes.object
|
|
}
|
|
|
|
export default NewPermissionSettings
|