-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5528 from rvsia/workers-ddf
Convert workers configuration form to DDF
- Loading branch information
Showing
21 changed files
with
1,317 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { Col, Row } from 'patternfly-react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const Dualgroup = ({ name, fields, formOptions }) => { | ||
if (![0, 1, 2, 3, 4, 6, 12].includes(fields.length)) { | ||
throw Error(`Length of fields (DualGroup component: ${name}) has to be a divisor of 12: 1,2,3,4,6,12. You have: ${fields.length}`); | ||
} | ||
|
||
return ( | ||
<React.Fragment> | ||
<Row> | ||
{ | ||
fields.map(field => ( | ||
<Col key={field.name} md={(12 / fields.length)}>{formOptions.renderForm([field], formOptions)}</Col> | ||
)) | ||
} | ||
</Row> | ||
<hr style={{ margin: 0 }} /> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
Dualgroup.propTypes = { | ||
name: PropTypes.string.isRequired, | ||
fields: PropTypes.arrayOf(PropTypes.object).isRequired, | ||
formOptions: PropTypes.shape({ | ||
renderForm: PropTypes.func.isRequired, | ||
}).isRequired, | ||
}; | ||
|
||
export default Dualgroup; |
Oops, something went wrong.