mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Adds notification list to orgs
This commit is contained in:
@@ -12,21 +12,24 @@ import {
|
||||
Route
|
||||
} from 'react-router-dom';
|
||||
|
||||
import NotificationsList from '../../../../components/NotificationsList/Notifications.list';
|
||||
|
||||
import Tab from '../../../../components/Tabs/Tab';
|
||||
import Tabs from '../../../../components/Tabs/Tabs';
|
||||
import getTabName from '../../utils';
|
||||
|
||||
|
||||
const OrganizationDetail = ({
|
||||
location,
|
||||
match,
|
||||
parentBreadcrumbObj,
|
||||
organization,
|
||||
params,
|
||||
currentTab
|
||||
currentTab,
|
||||
api,
|
||||
history
|
||||
}) => {
|
||||
// TODO: set objectName by param or through grabbing org detail get from api
|
||||
const tabList=['details', 'access', 'teams', 'notifications'];
|
||||
const tabList = ['details', 'access', 'teams', 'notifications'];
|
||||
|
||||
const deleteResourceView = () => (
|
||||
<Fragment>
|
||||
@@ -46,19 +49,41 @@ const OrganizationDetail = ({
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
const resourceView = () => (
|
||||
<Fragment>
|
||||
<Trans>{`${currentTab} detail view `}</Trans>
|
||||
<Link to={{ pathname: `${match.url}/add-resource`, search: `?${params.toString()}`, state: { breadcrumb: parentBreadcrumbObj, organization } }}>
|
||||
<Trans>{`add ${currentTab}`}</Trans>
|
||||
</Link>
|
||||
{' '}
|
||||
<Link to={{ pathname: `${match.url}/delete-resources`, search: `?${params.toString()}`, state: { breadcrumb: parentBreadcrumbObj, organization } }}>
|
||||
<Trans>{`delete ${currentTab}`}</Trans>
|
||||
</Link>
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
const resourceView = () => {
|
||||
let relatedTemplate;
|
||||
switch (currentTab) {
|
||||
case 'notifications':
|
||||
relatedTemplate = (
|
||||
<Fragment>
|
||||
<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.postOrganizationNotificationSuccess(id, data)}
|
||||
postError={(id, data) => api.postOrganizationNotificationError(id, data)}
|
||||
match={match}
|
||||
location={location}
|
||||
history={history}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
relatedTemplate = (
|
||||
<Fragment>
|
||||
<Trans>{`${currentTab} detail view `}</Trans>
|
||||
<Link to={{ pathname: `${match.url}/add-resource`, search: `?${params.toString()}`, state: { breadcrumb: parentBreadcrumbObj, organization } }}>
|
||||
<Trans>{`add ${currentTab}`}</Trans>
|
||||
</Link>
|
||||
{' '}
|
||||
<Link to={{ pathname: `${match.url}/delete-resources`, search: `?${params.toString()}`, state: { breadcrumb: parentBreadcrumbObj, organization } }}>
|
||||
<Trans>{`delete ${currentTab}`}</Trans>
|
||||
</Link>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
return relatedTemplate;
|
||||
};
|
||||
|
||||
return (
|
||||
<Card className="at-c-orgPane">
|
||||
@@ -83,20 +108,11 @@ const OrganizationDetail = ({
|
||||
</I18n>
|
||||
</CardHeader>
|
||||
<CardBody>
|
||||
{(currentTab && currentTab !== 'details') ? (
|
||||
<Switch>
|
||||
<Route path={`${match.path}/delete-resources`} component={() => deleteResourceView()} />
|
||||
<Route path={`${match.path}/add-resource`} component={() => addResourceView()} />
|
||||
<Route path={`${match.path}`} component={() => resourceView()} />
|
||||
</Switch>
|
||||
) : (
|
||||
<Fragment>
|
||||
{'detail view '}
|
||||
<Link to={{ pathname: `${match.url}/edit`, state: { breadcrumb: parentBreadcrumbObj, organization } }}>
|
||||
{'edit'}
|
||||
</Link>
|
||||
</Fragment>
|
||||
)}
|
||||
<Switch>
|
||||
<Route path={`${match.path}/delete-resources`} component={() => deleteResourceView()} />
|
||||
<Route path={`${match.path}/add-resource`} component={() => addResourceView()} />
|
||||
<Route path={`${match.path}`} render={(props) => resourceView(props)} />
|
||||
</Switch>
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user