webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js in foreman_ansible-6.1.1 vs webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.js in foreman_ansible-6.2.0

- old
+ new

@@ -15,11 +15,11 @@ initialAssignedRoles, availableRolesUrl, inheritedRoleIds, resourceId, resourceName, - } = this.props.data; + } = this.props; this.props.getAnsibleRoles( availableRolesUrl, initialAssignedRoles, inheritedRoleIds, @@ -50,11 +50,11 @@ const { availableRolesUrl, inheritedRoleIds, resourceId, resourceName, - } = this.props.data; + } = this.props; const onListingChange = paginationArgs => getAnsibleRoles( availableRolesUrl, allAssignedRoles, @@ -102,17 +102,15 @@ ); } } AnsibleRolesSwitcher.propTypes = { - data: PropTypes.shape({ - initialAssignedRoles: PropTypes.arrayOf(PropTypes.object), - availableRolesUrl: PropTypes.string, - inheritedRoleIds: PropTypes.arrayOf(PropTypes.number), - resourceId: PropTypes.number, - resourceName: PropTypes.string, - }).isRequired, + initialAssignedRoles: PropTypes.arrayOf(PropTypes.object), + availableRolesUrl: PropTypes.string.isRequired, + inheritedRoleIds: PropTypes.arrayOf(PropTypes.number), + resourceId: PropTypes.number, + resourceName: PropTypes.string, getAnsibleRoles: PropTypes.func.isRequired, loading: PropTypes.bool.isRequired, pagination: PropTypes.shape({ page: PropTypes.number, perPage: PropTypes.number, @@ -135,8 +133,12 @@ }), }; AnsibleRolesSwitcher.defaultProps = { error: {}, + resourceId: null, + resourceName: '', + initialAssignedRoles: [], + inheritedRoleIds: [], }; export default AnsibleRolesSwitcher;