More cleanup based on pr feedback. Adds org notif list page and tests

This commit is contained in:
mabashian
2019-01-23 16:52:14 -05:00
parent 6c19d6ae4e
commit 47719776f2
7 changed files with 151 additions and 64 deletions

View File

@@ -10,31 +10,15 @@ import {
} from '@patternfly/react-core';
class NotificationListItem extends React.Component {
constructor (props) {
super(props);
this.errorToggleClick = this.errorToggleClick.bind(this);
this.successToggleClick = this.successToggleClick.bind(this);
}
errorToggleClick (flag) {
const { itemId, toggleError } = this.props;
toggleError(itemId, flag);
}
successToggleClick (flag) {
const { itemId, toggleSuccess } = this.props;
toggleSuccess(itemId, flag);
}
render () {
const {
itemId,
name,
notificationType,
detailUrl,
parentBreadcrumb,
successTurnedOn,
errorTurnedOn
errorTurnedOn,
toggleNotification
} = this.props;
const capText = {
@@ -49,8 +33,7 @@ class NotificationListItem extends React.Component {
<div className="pf-u-display-inline-flex">
<Link
to={{
pathname: detailUrl,
state: { breadcrumb: [parentBreadcrumb, { name, url: detailUrl }] }
pathname: detailUrl
}}
>
<b>{name}</b>
@@ -69,13 +52,13 @@ class NotificationListItem extends React.Component {
<Switch
label={i18n._(t`Successful`)}
isChecked={successTurnedOn}
onChange={() => this.successToggleClick(successTurnedOn)}
onChange={() => toggleNotification(itemId, successTurnedOn, 'success')}
aria-label={i18n._(t`Notification success toggle`)}
/>
<Switch
label={i18n._(t`Failure`)}
isChecked={errorTurnedOn}
onChange={() => this.errorToggleClick(errorTurnedOn)}
onChange={() => toggleNotification(itemId, errorTurnedOn, 'error')}
aria-label={i18n._(t`Notification failure toggle`)}
/>
</div>