mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 14:36:00 -03:30
Changed post to create in api.js. Removed capitalize text component in favor of css solution. Updates to empty list contents. Fixes padding on notifications list
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import { mount } from 'enzyme';
|
|
||||||
import CapitalizeText from '../../src/components/CapitalizeText';
|
|
||||||
|
|
||||||
describe('<CapitalizeText />', () => {
|
|
||||||
let capitalizeTextWrapper;
|
|
||||||
|
|
||||||
test('initially renders without crashing', () => {
|
|
||||||
capitalizeTextWrapper = mount(
|
|
||||||
<CapitalizeText text="foo" />
|
|
||||||
);
|
|
||||||
expect(capitalizeTextWrapper.length).toBe(1);
|
|
||||||
expect(capitalizeTextWrapper.text()).toEqual('Foo');
|
|
||||||
capitalizeTextWrapper.unmount();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -88,18 +88,18 @@ class APIClient {
|
|||||||
return this.http.get(endpoint, { params });
|
return this.http.get(endpoint, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
postOrganizationNotificationSuccess (id, data) {
|
createOrganizationNotificationSuccess (id, data) {
|
||||||
const endpoint = `${API_ORGANIZATIONS}${id}/notification_templates_success/`;
|
const endpoint = `${API_ORGANIZATIONS}${id}/notification_templates_success/`;
|
||||||
|
|
||||||
return this.http.post(endpoint, data);
|
return this.http.post(endpoint, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
postOrganizationNotificationError (id, data) {
|
createOrganizationNotificationError (id, data) {
|
||||||
const endpoint = `${API_ORGANIZATIONS}${id}/notification_templates_error/`;
|
const endpoint = `${API_ORGANIZATIONS}${id}/notification_templates_error/`;
|
||||||
|
|
||||||
return this.http.post(endpoint, data);
|
return this.http.post(endpoint, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
getInstanceGroups () {
|
getInstanceGroups () {
|
||||||
return this.http.get(API_INSTANCE_GROUPS);
|
return this.http.get(API_INSTANCE_GROUPS);
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/app.scss
10
src/app.scss
@@ -158,6 +158,16 @@
|
|||||||
border-top: 1px solid #d7d7d7;
|
border-top: 1px solid #d7d7d7;
|
||||||
border-bottom: 1px solid #d7d7d7;
|
border-bottom: 1px solid #d7d7d7;
|
||||||
}
|
}
|
||||||
|
.at-c-listCardBody {
|
||||||
|
--pf-c-card__footer--PaddingX: 0;
|
||||||
|
--pf-c-card__footer--PaddingY: 0;
|
||||||
|
--pf-c-card__body--PaddingX: 0;
|
||||||
|
--pf-c-card__body--PaddingY: 0;
|
||||||
|
}
|
||||||
|
.pf-c-data-list__item {
|
||||||
|
--pf-c-data-list__item--PaddingLeft: 20px;
|
||||||
|
--pf-c-data-list__item--PaddingRight: 20px;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// pf modal overrides
|
// pf modal overrides
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
|
|
||||||
class CapitalizeText extends React.Component {
|
|
||||||
upperCaseFirstLetter = (string) => (typeof string === 'string' ? string.charAt(0).toUpperCase() + string.slice(1) : '');
|
|
||||||
|
|
||||||
render () {
|
|
||||||
const { text } = this.props;
|
|
||||||
return (
|
|
||||||
this.upperCaseFirstLetter(text)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default CapitalizeText;
|
|
||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
Badge,
|
Badge,
|
||||||
Switch
|
Switch
|
||||||
} from '@patternfly/react-core';
|
} from '@patternfly/react-core';
|
||||||
import CapitalizeText from '../CapitalizeText';
|
|
||||||
|
|
||||||
class NotificationListItem extends React.Component {
|
class NotificationListItem extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
@@ -38,6 +37,10 @@ class NotificationListItem extends React.Component {
|
|||||||
errorTurnedOn
|
errorTurnedOn
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const capText = {
|
||||||
|
textTransform: 'capitalize'
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<I18n>
|
<I18n>
|
||||||
{({ i18n }) => (
|
{({ i18n }) => (
|
||||||
@@ -54,12 +57,11 @@ class NotificationListItem extends React.Component {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Badge
|
<Badge
|
||||||
|
style={capText}
|
||||||
className="pf-u-display-inline-flex"
|
className="pf-u-display-inline-flex"
|
||||||
isRead
|
isRead
|
||||||
>
|
>
|
||||||
{' '}
|
{notificationType}
|
||||||
<CapitalizeText text={notificationType} />
|
|
||||||
{' '}
|
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
<div className="pf-c-data-list__cell" />
|
<div className="pf-c-data-list__cell" />
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, {
|
|||||||
Component,
|
Component,
|
||||||
Fragment
|
Fragment
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Title, EmptyState, EmptyStateIcon } from '@patternfly/react-core';
|
import { Title, EmptyState, EmptyStateIcon, EmptyStateBody } from '@patternfly/react-core';
|
||||||
import { CubesIcon } from '@patternfly/react-icons';
|
import { CubesIcon } from '@patternfly/react-icons';
|
||||||
import { I18n, i18nMark } from '@lingui/react';
|
import { I18n, i18nMark } from '@lingui/react';
|
||||||
import { Trans, t } from '@lingui/macro';
|
import { Trans, t } from '@lingui/macro';
|
||||||
@@ -289,8 +289,11 @@ class Notifications extends Component {
|
|||||||
<EmptyState>
|
<EmptyState>
|
||||||
<EmptyStateIcon icon={CubesIcon} />
|
<EmptyStateIcon icon={CubesIcon} />
|
||||||
<Title size="lg">
|
<Title size="lg">
|
||||||
<Trans>NO NOTIFICATIONS HAVE BEEN CREATED</Trans>
|
<Trans>No Notifictions Found</Trans>
|
||||||
</Title>
|
</Title>
|
||||||
|
<EmptyStateBody>
|
||||||
|
<Trans>Please add a notification template to populate this list</Trans>
|
||||||
|
</EmptyStateBody>
|
||||||
</EmptyState>
|
</EmptyState>
|
||||||
)}
|
)}
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const OrganizationDetail = ({
|
|||||||
)}
|
)}
|
||||||
</I18n>
|
</I18n>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody className="at-c-listCardBody">
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={`${match.path}/delete-resources`} component={() => deleteResourceView()} />
|
<Route path={`${match.path}/delete-resources`} component={() => deleteResourceView()} />
|
||||||
<Route path={`${match.path}/add-resource`} component={() => addResourceView()} />
|
<Route path={`${match.path}/add-resource`} component={() => addResourceView()} />
|
||||||
|
|||||||
Reference in New Issue
Block a user