Skip to content

Commit

Permalink
Merge branch 'master' into issues/697-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevan Holdaway committed Feb 21, 2018
2 parents f55b561 + 07736a5 commit a9bc68a
Show file tree
Hide file tree
Showing 66 changed files with 1,824 additions and 1,402 deletions.
9 changes: 7 additions & 2 deletions client/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"rules": {
"prettier/prettier": [
"error",
{ "singleQuote": true, "trailingComma": "none" }
]
{
"singleQuote": true,
"trailingComma": "none",
"printWidth": 120
}
],
"max-len": ["error", {"code": 240, "ignoreUrls": true}]
},
"extends": [
"standard",
Expand Down
9 changes: 6 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"support:create-react-app": "create-react-app",
"test": "run-s test:**",
"test:lint-js": "eslint --ext=js --ext=jsx src",
"test:unit": "react-scripts test --env=jsdom"
"test:unit": "sh -ac '. .env.development; react-scripts test --env=jsdom'"
},
"dependencies": {
"axios": "^0.17.1",
Expand Down Expand Up @@ -78,15 +78,18 @@
"eslint-plugin-react": "^7.5.1",
"eslint-plugin-standard": "^3.0.1",
"express": "^4.16.2",
"fetch-mock": "^6.0.0",
"jest": "^21.2.1",
"jest-cli": "^21.2.1",
"moxios": "^0.4.0",
"node-sass": "^4.7.2",
"npm-run-all": "^4.1.2",
"prettier": "^1.10.2",
"react-app-rewired": "^1.4.1",
"redux-mock-store": "^1.5.1",
"swagger-parser": "^4.0.2",
"swagger-ui-express": "^2.0.14",
"yamljs": "^0.3.0",
"write-file-webpack-plugin": "^4.2.0"
"write-file-webpack-plugin": "^4.2.0",
"yamljs": "^0.3.0"
}
}
17 changes: 4 additions & 13 deletions client/src/common/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,11 @@ const setStateProp = (prop, data, options) => {
let obj = { ...state };

if (!state[prop]) {
console.error(
`Error: Property ${prop} does not exist within the passed state.`,
state
);
console.error(`Error: Property ${prop} does not exist within the passed state.`, state);
}

if (reset && !initialState[prop]) {
console.warn(
`Warning: Property ${prop} does not exist within the passed initialState.`,
initialState
);
console.warn(`Warning: Property ${prop} does not exist within the passed initialState.`, initialState);
}

if (reset) {
Expand Down Expand Up @@ -137,15 +131,12 @@ const createViewQueryObject = (viewOptions, queryObj) => {

if (viewOptions) {
if (viewOptions.sortField) {
queryObject.ordering = viewOptions.sortAscending
? viewOptions.sortField
: `-${viewOptions.sortField}`;
queryObject.ordering = viewOptions.sortAscending ? viewOptions.sortField : `-${viewOptions.sortField}`;
}

if (viewOptions.activeFilters) {
viewOptions.activeFilters.forEach(filter => {
queryObject[filter.field.id] =
filter.field.filterType === 'select' ? filter.value.id : filter.value;
queryObject[filter.field.id] = filter.field.filterType === 'select' ? filter.value.id : filter.value;
});
}

Expand Down
13 changes: 3 additions & 10 deletions client/src/common/registerServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const isLocalhost = Boolean(
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)
);

export default function register() {
Expand Down Expand Up @@ -77,10 +75,7 @@ function checkValidServiceWorker(swUrl) {
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
if (
response.status === 404 ||
response.headers.get('content-type').indexOf('javascript') === -1
) {
if (response.status === 404 || response.headers.get('content-type').indexOf('javascript') === -1) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
Expand All @@ -93,9 +88,7 @@ function checkValidServiceWorker(swUrl) {
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
console.log('No internet connection found. App is running in offline mode.');
});
}

Expand Down
23 changes: 10 additions & 13 deletions client/src/components/about/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import logo from '../../styles/images/Red_Hat_logo.svg';
import productTitle from '../../styles/images/title.svg';

class About extends React.Component {

closeAbout() {
Store.dispatch({ type: aboutTypes.ABOUT_DIALOG_CLOSE });
}
Expand All @@ -24,21 +23,19 @@ class About extends React.Component {
key="aboutModal"
show={showAbout}
onHide={this.closeAbout}
productTitle={
<img src={productTitle} alt="Red Hat Entitlements Reporting"/>
}
productTitle={<img src={productTitle} alt="Red Hat Entitlements Reporting" />}
logo={logo}
altLogo="RH ER"
trademarkText="Copyright (c) 2018 Red Hat Inc."
>
<AboutModal.Versions>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version"/>
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
<AboutModal.VersionItem label="Label" versionText="Version" />
</AboutModal.Versions>
</AboutModal>
);
Expand All @@ -47,12 +44,12 @@ class About extends React.Component {

About.propTypes = {
showAbout: PropTypes.bool
}
};

function mapStateToProps(state, ownProps) {
return {
showAbout: state.about.show
};
};
}

export default connect(mapStateToProps)(About);
18 changes: 5 additions & 13 deletions client/src/components/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';

import {
Alert,
EmptyState,
Modal,
VerticalNav
} from 'patternfly-react';
import { Alert, EmptyState, Modal, VerticalNav } from 'patternfly-react';

import { routes } from '../routes';

Expand All @@ -30,6 +25,7 @@ class App extends React.Component {
}

componentDidMount() {
console.log('auth?');
this.props.authorizeUser();
}

Expand All @@ -41,9 +37,7 @@ class App extends React.Component {
renderMenuItems() {
const { location } = this.props;

let activeItem = this.menu.find(item =>
_.startsWith(location.pathname, item.to)
);
let activeItem = this.menu.find(item => _.startsWith(location.pathname, item.to));

return this.menu.map(item => {
return (
Expand Down Expand Up @@ -75,7 +69,7 @@ class App extends React.Component {
return (
<Modal bsSize="lg" backdrop={false} show animation={false}>
<Modal.Body>
<div className="spinner spinner-xl"/>
<div className="spinner spinner-xl" />
<div className="text-center">Logging in...</div>
</Modal.Body>
</Modal>
Expand Down Expand Up @@ -108,9 +102,7 @@ class App extends React.Component {
</VerticalNav.Masthead>
{this.renderMenuItems()}
</VerticalNav>
<div className="container-pf-nav-pf-vertical">
{this.renderContent()}
</div>
<div className="container-pf-nav-pf-vertical">{this.renderContent()}</div>
</div>
);
}
Expand Down
23 changes: 0 additions & 23 deletions client/src/components/app.test.js

This file was deleted.

18 changes: 3 additions & 15 deletions client/src/components/confirmationModal/confirmationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,14 @@ class ConfirmationModal extends React.Component {
return (
<Modal show={show} onHide={this.cancel}>
<Modal.Header>
<button
className="close"
onClick={this.cancel}
aria-hidden="true"
aria-label="Close"
>
<button className="close" onClick={this.cancel} aria-hidden="true" aria-label="Close">
<Icon type="pf" name="close" />
</button>
<Modal.Title>{confirmTitle}</Modal.Title>
</Modal.Header>
<Modal.Body>
<div className="confirm-modal-body">
{confirmIcon && (
<span className="confirm-modal-icon">{confirmIcon}</span>
)}
{confirmIcon && <span className="confirm-modal-icon">{confirmIcon}</span>}
<span className="confirm-modal-content">
<span className="spacer" />
<p>{confirmHeading}</p>
Expand All @@ -64,12 +57,7 @@ class ConfirmationModal extends React.Component {
</div>
</Modal.Body>
<Modal.Footer>
<Button
autoFocus
bsStyle="default"
className="btn-cancel"
onClick={this.cancel}
>
<Button autoFocus bsStyle="default" className="btn-cancel" onClick={this.cancel}>
{cancelButtonText}
</Button>
<Button bsStyle="primary" onClick={onConfirm}>
Expand Down

0 comments on commit a9bc68a

Please sign in to comment.