mirror of
https://github.com/ansible/awx.git
synced 2026-02-15 18:20:00 -03:30
Integrate proptypes for our shared components.
- Fix unit tests. - Fix linter errors.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { I18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import {
|
||||
@@ -20,7 +21,6 @@ class NotificationListItem extends React.Component {
|
||||
errorTurnedOn,
|
||||
toggleNotification
|
||||
} = this.props;
|
||||
|
||||
const capText = {
|
||||
textTransform: 'capitalize'
|
||||
};
|
||||
@@ -69,5 +69,21 @@ class NotificationListItem extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
NotificationListItem.propTypes = {
|
||||
detailUrl: PropTypes.string.isRequired,
|
||||
errorTurnedOn: PropTypes.bool,
|
||||
itemId: PropTypes.number.isRequired,
|
||||
name: PropTypes.string,
|
||||
notificationType: PropTypes.string.isRequired,
|
||||
successTurnedOn: PropTypes.bool,
|
||||
toggleNotification: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
NotificationListItem.defaultProps = {
|
||||
errorTurnedOn: false,
|
||||
name: null,
|
||||
successTurnedOn: false,
|
||||
};
|
||||
|
||||
export default NotificationListItem;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, {
|
||||
Component,
|
||||
Fragment
|
||||
} from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Title, EmptyState, EmptyStateIcon, EmptyStateBody } from '@patternfly/react-core';
|
||||
import { CubesIcon } from '@patternfly/react-icons';
|
||||
import { I18n, i18nMark } from '@lingui/react';
|
||||
@@ -29,8 +30,6 @@ class Notifications extends Component {
|
||||
order_by: 'name',
|
||||
};
|
||||
|
||||
pageSizeOptions = [5, 10, 25, 50];
|
||||
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
@@ -286,7 +285,6 @@ class Notifications extends Component {
|
||||
successTemplateIds,
|
||||
errorTemplateIds
|
||||
} = this.state;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
{noInitialResults && (
|
||||
@@ -326,8 +324,6 @@ class Notifications extends Component {
|
||||
name={o.name}
|
||||
notificationType={o.notification_type}
|
||||
detailUrl={`/notifications/${o.id}`}
|
||||
isSelected={selected.includes(o.id)}
|
||||
onSelect={() => this.onSelect(o.id)}
|
||||
toggleNotification={this.toggleNotification}
|
||||
errorTurnedOn={errorTemplateIds.includes(o.id)}
|
||||
successTurnedOn={successTemplateIds.includes(o.id)}
|
||||
@@ -341,7 +337,6 @@ class Notifications extends Component {
|
||||
page={page}
|
||||
pageCount={pageCount}
|
||||
page_size={page_size}
|
||||
pageSizeOptions={this.pageSizeOptions}
|
||||
onSetPage={this.onSetPage}
|
||||
/>
|
||||
</Fragment>
|
||||
@@ -353,4 +348,12 @@ class Notifications extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
Notifications.propType = {
|
||||
getError: PropTypes.func.isRequired,
|
||||
getNotifications: PropTypes.func.isRequired,
|
||||
getSuccess: PropTypes.func.isRequired,
|
||||
postError: PropTypes.func.isRequired,
|
||||
postSuccess: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default Notifications;
|
||||
|
||||
Reference in New Issue
Block a user