mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 02:30:01 -03:30
More cleanup based on pr feedback. Adds org notif list page and tests
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
Route
|
||||
} from 'react-router-dom';
|
||||
|
||||
import NotificationsList from '../../../../components/NotificationsList/Notifications.list';
|
||||
import OrganizationNotifications from './OrganizationNotifications';
|
||||
|
||||
import Tab from '../../../../components/Tabs/Tab';
|
||||
import Tabs from '../../../../components/Tabs/Tabs';
|
||||
@@ -54,12 +54,8 @@ const OrganizationDetail = ({
|
||||
switch (currentTab) {
|
||||
case 'notifications':
|
||||
relatedTemplate = (
|
||||
<NotificationsList
|
||||
getNotifications={(id, reqParams) => api.getOrganizationNotifications(id, reqParams)}
|
||||
getSuccess={(id, reqParams) => api.getOrganizationNotificationSuccess(id, reqParams)}
|
||||
getError={(id, reqParams) => api.getOrganizationNotificationError(id, reqParams)}
|
||||
postSuccess={(id, data) => api.createOrganizationNotificationSuccess(id, data)}
|
||||
postError={(id, data) => api.createOrganizationNotificationError(id, data)}
|
||||
<OrganizationNotifications
|
||||
api={api}
|
||||
match={match}
|
||||
location={location}
|
||||
history={history}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import NotificationsList from '../../../../components/NotificationsList/Notifications.list';
|
||||
|
||||
class OrganizationNotifications extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
this.getOrgNotifications = this.getOrgNotifications.bind(this);
|
||||
this.getOrgNotificationSuccess = this.getOrgNotificationSuccess.bind(this);
|
||||
this.getOrgNotificationError = this.getOrgNotificationError.bind(this);
|
||||
this.createOrgNotificationSuccess = this.createOrgNotificationSuccess.bind(this);
|
||||
this.createOrgNotificationError = this.createOrgNotificationError.bind(this);
|
||||
}
|
||||
|
||||
getOrgNotifications (id, reqParams) {
|
||||
const { api } = this.props;
|
||||
return api.getOrganizationNotifications(id, reqParams);
|
||||
}
|
||||
|
||||
getOrgNotificationSuccess (id, reqParams) {
|
||||
const { api } = this.props;
|
||||
return api.getOrganizationNotificationSuccess(id, reqParams);
|
||||
}
|
||||
|
||||
getOrgNotificationError (id, reqParams) {
|
||||
const { api } = this.props;
|
||||
return api.getOrganizationNotificationError(id, reqParams);
|
||||
}
|
||||
|
||||
createOrgNotificationSuccess (id, data) {
|
||||
const { api } = this.props;
|
||||
return api.createOrganizationNotificationSuccess(id, data);
|
||||
}
|
||||
|
||||
createOrgNotificationError (id, data) {
|
||||
const { api } = this.props;
|
||||
return api.createOrganizationNotificationError(id, data);
|
||||
}
|
||||
|
||||
render () {
|
||||
const {
|
||||
location,
|
||||
match,
|
||||
history
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<NotificationsList
|
||||
getNotifications={this.getOrgNotifications}
|
||||
getSuccess={this.getOrgNotificationSuccess}
|
||||
getError={this.getOrgNotificationError}
|
||||
postSuccess={this.createOrgNotificationSuccess}
|
||||
postError={this.createOrgNotificationError}
|
||||
match={match}
|
||||
location={location}
|
||||
history={history}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default OrganizationNotifications;
|
||||
Reference in New Issue
Block a user