mirror of
https://github.com/ansible/awx.git
synced 2026-02-14 01:34:45 -03:30
Removes unnecessary fragment elements. Fixes vertical alignment on notif row item. Bind notification list functions to constructor
This commit is contained in:
@@ -44,7 +44,7 @@ class NotificationListItem extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<I18n>
|
<I18n>
|
||||||
{({ i18n }) => (
|
{({ i18n }) => (
|
||||||
<li key={itemId} className="pf-c-data-list__item">
|
<li key={itemId} className="pf-c-data-list__item pf-u-flex-row pf-u-align-items-center">
|
||||||
<div className="pf-c-data-list__cell pf-u-flex-row">
|
<div className="pf-c-data-list__cell pf-u-flex-row">
|
||||||
<div className="pf-u-display-inline-flex">
|
<div className="pf-u-display-inline-flex">
|
||||||
<Link
|
<Link
|
||||||
|
|||||||
@@ -49,6 +49,19 @@ class Notifications extends Component {
|
|||||||
successTemplateIds: [],
|
successTemplateIds: [],
|
||||||
errorTemplateIds: []
|
errorTemplateIds: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.onSearch = this.onSearch.bind(this);
|
||||||
|
this.getQueryParams = this.getQueryParams.bind(this);
|
||||||
|
this.onSort = this.onSort.bind(this);
|
||||||
|
this.onSetPage = this.onSetPage.bind(this);
|
||||||
|
this.onSelectAll = this.onSelectAll.bind(this);
|
||||||
|
this.onSelect = this.onSelect.bind(this);
|
||||||
|
this.toggleError = this.toggleError.bind(this);
|
||||||
|
this.toggleSuccess = this.toggleSuccess.bind(this);
|
||||||
|
this.updateUrl = this.updateUrl.bind(this);
|
||||||
|
this.postToError = this.postToError.bind(this);
|
||||||
|
this.postToSuccess = this.postToSuccess.bind(this);
|
||||||
|
this.fetchNotifications = this.fetchNotifications.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
@@ -296,58 +309,56 @@ class Notifications extends Component {
|
|||||||
</EmptyStateBody>
|
</EmptyStateBody>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
)}
|
)}
|
||||||
<Fragment>
|
{(
|
||||||
{(
|
typeof noInitialResults !== 'undefined'
|
||||||
typeof noInitialResults !== 'undefined'
|
&& !noInitialResults
|
||||||
&& !noInitialResults
|
&& !loading
|
||||||
&& !loading
|
&& !error
|
||||||
&& !error
|
) && (
|
||||||
) && (
|
<Fragment>
|
||||||
<Fragment>
|
<DataListToolbar
|
||||||
<DataListToolbar
|
isAllSelected={selected.length === results.length}
|
||||||
isAllSelected={selected.length === results.length}
|
sortedColumnKey={sortedColumnKey}
|
||||||
sortedColumnKey={sortedColumnKey}
|
sortOrder={sortOrder}
|
||||||
sortOrder={sortOrder}
|
columns={this.columns}
|
||||||
columns={this.columns}
|
onSearch={this.onSearch}
|
||||||
onSearch={this.onSearch}
|
onSort={this.onSort}
|
||||||
onSort={this.onSort}
|
onSelectAll={this.onSelectAll}
|
||||||
onSelectAll={this.onSelectAll}
|
/>
|
||||||
/>
|
<I18n>
|
||||||
<I18n>
|
{({ i18n }) => (
|
||||||
{({ i18n }) => (
|
<ul className="pf-c-data-list" aria-label={i18n._(t`Organizations List`)}>
|
||||||
<ul className="pf-c-data-list" aria-label={i18n._(t`Organizations List`)}>
|
{results.map(o => (
|
||||||
{results.map(o => (
|
<NotificationListItem
|
||||||
<NotificationListItem
|
key={o.id}
|
||||||
key={o.id}
|
itemId={o.id}
|
||||||
itemId={o.id}
|
name={o.name}
|
||||||
name={o.name}
|
notificationType={o.notification_type}
|
||||||
notificationType={o.notification_type}
|
detailUrl={`notifications/${o.id}`}
|
||||||
detailUrl={`notifications/${o.id}`}
|
parentBreadcrumb={parentBreadcrumb}
|
||||||
parentBreadcrumb={parentBreadcrumb}
|
isSelected={selected.includes(o.id)}
|
||||||
isSelected={selected.includes(o.id)}
|
onSelect={() => this.onSelect(o.id)}
|
||||||
onSelect={() => this.onSelect(o.id)}
|
errorTurnedOn={errorTemplateIds.includes(o.id)}
|
||||||
errorTurnedOn={errorTemplateIds.includes(o.id)}
|
toggleError={this.toggleError}
|
||||||
toggleError={this.toggleError}
|
successTurnedOn={successTemplateIds.includes(o.id)}
|
||||||
successTurnedOn={successTemplateIds.includes(o.id)}
|
toggleSuccess={this.toggleSuccess}
|
||||||
toggleSuccess={this.toggleSuccess}
|
/>
|
||||||
/>
|
))}
|
||||||
))}
|
</ul>
|
||||||
</ul>
|
)}
|
||||||
)}
|
</I18n>
|
||||||
</I18n>
|
<Pagination
|
||||||
<Pagination
|
count={count}
|
||||||
count={count}
|
page={page}
|
||||||
page={page}
|
pageCount={pageCount}
|
||||||
pageCount={pageCount}
|
page_size={page_size}
|
||||||
page_size={page_size}
|
pageSizeOptions={this.pageSizeOptions}
|
||||||
pageSizeOptions={this.pageSizeOptions}
|
onSetPage={this.onSetPage}
|
||||||
onSetPage={this.onSetPage}
|
/>
|
||||||
/>
|
</Fragment>
|
||||||
</Fragment>
|
)}
|
||||||
)}
|
{loading ? <div>loading...</div> : ''}
|
||||||
{loading ? <div>loading...</div> : ''}
|
{error ? <div>error</div> : ''}
|
||||||
{error ? <div>error</div> : ''}
|
|
||||||
</Fragment>
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,18 +54,16 @@ const OrganizationDetail = ({
|
|||||||
switch (currentTab) {
|
switch (currentTab) {
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
relatedTemplate = (
|
relatedTemplate = (
|
||||||
<Fragment>
|
<NotificationsList
|
||||||
<NotificationsList
|
getNotifications={(id, reqParams) => api.getOrganizationNotifications(id, reqParams)}
|
||||||
getNotifications={(id, reqParams) => api.getOrganizationNotifications(id, reqParams)}
|
getSuccess={(id, reqParams) => api.getOrganizationNotificationSuccess(id, reqParams)}
|
||||||
getSuccess={(id, reqParams) => api.getOrganizationNotificationSuccess(id, reqParams)}
|
getError={(id, reqParams) => api.getOrganizationNotificationError(id, reqParams)}
|
||||||
getError={(id, reqParams) => api.getOrganizationNotificationError(id, reqParams)}
|
postSuccess={(id, data) => api.createOrganizationNotificationSuccess(id, data)}
|
||||||
postSuccess={(id, data) => api.createOrganizationNotificationSuccess(id, data)}
|
postError={(id, data) => api.createOrganizationNotificationError(id, data)}
|
||||||
postError={(id, data) => api.createOrganizationNotificationError(id, data)}
|
match={match}
|
||||||
match={match}
|
location={location}
|
||||||
location={location}
|
history={history}
|
||||||
history={history}
|
/>
|
||||||
/>
|
|
||||||
</Fragment>
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user