Rename Container into Page and apply prettier
Change-Id: Ib1b132a7a9f09dfcfb94f8e5af22546571a686ac
This commit is contained in:
parent
15edc82340
commit
ce1e66dc2e
|
@ -11233,6 +11233,12 @@
|
|||
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
|
||||
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
|
||||
},
|
||||
"prettier": {
|
||||
"version": "1.17.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.17.1.tgz",
|
||||
"integrity": "sha512-TzGRNvuUSmPgwivDqkZ9tM/qTGW9hqDKWOE9YHiyQdixlKbv7kvEqsmDPrcHJTKwthU774TQwZXVtaQ/mMsvjg==",
|
||||
"dev": true
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.2.0.tgz",
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
"build": "react-scripts build",
|
||||
"test": "CI=true react-scripts test --env=jsdom",
|
||||
"test:watch": "react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
"eject": "react-scripts eject",
|
||||
"prettier": "prettier --write \"src/**/*.js\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios-mock-adapter": "^1.15.0",
|
||||
"prettier": "^1.17.1",
|
||||
"redux-mock-store": "^1.5.3"
|
||||
},
|
||||
"browserslist": [
|
||||
|
|
10
src/App.js
10
src/App.js
|
@ -7,7 +7,7 @@ import "@patternfly/patternfly/patternfly-addons.css";
|
|||
import store from "./store";
|
||||
import { getConfig } from "./config/configActions";
|
||||
import { checkAuthentification } from "./auth/authActions";
|
||||
import * as Containers from "./containers";
|
||||
import * as Pages from "./pages";
|
||||
import Header from "./layout/Header";
|
||||
import PrivateRoute from "./auth/PrivateRoute";
|
||||
import Page from "./layout/Page";
|
||||
|
@ -52,14 +52,14 @@ class App extends Component {
|
|||
<PrivateRoute
|
||||
path="/playbooks"
|
||||
exact
|
||||
component={Containers.PlaybooksContainer}
|
||||
component={Pages.PlaybooksPage}
|
||||
/>
|
||||
<PrivateRoute
|
||||
path="/playbooks/:id"
|
||||
component={Containers.PlaybookContainer}
|
||||
component={Pages.PlaybookPage}
|
||||
/>
|
||||
<Route path="/login" component={Containers.LoginContainer} />
|
||||
<Route component={Containers.Container404} />
|
||||
<Route path="/login" component={Pages.LoginPage} />
|
||||
<Route component={Pages.Page404} />
|
||||
</Switch>
|
||||
</Page>
|
||||
</BrowserRouter>
|
||||
|
|
|
@ -10,12 +10,12 @@ export default function(state = initialState, action) {
|
|||
return {
|
||||
...state,
|
||||
isAuthenticated: true
|
||||
}
|
||||
};
|
||||
case types.LOGOUT:
|
||||
return {
|
||||
...state,
|
||||
isAuthenticated: false
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
isAuthenticated: false
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
setCredentials,
|
||||
getCredentials,
|
||||
removeCredentials,
|
||||
removeCredentials
|
||||
} from "./localStorage";
|
||||
|
||||
it("localStorage getCredentials", () => {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
export { default as Container404 } from "./layout/Container404";
|
||||
export { default as LoadingContainer } from "./layout/LoadingContainer";
|
||||
export { default as LoginContainer } from "./login/LoginContainer";
|
||||
export { default as PlaybooksContainer } from "./playbooks/PlaybooksContainer";
|
||||
export { default as PlaybookContainer } from "./playbooks/PlaybookContainer";
|
|
@ -4,7 +4,7 @@ import { getCredentials } from "./auth/localStorage";
|
|||
axios.interceptors.request.use(config => {
|
||||
const credentials = getCredentials();
|
||||
if (credentials) {
|
||||
config.auth = credentials
|
||||
config.auth = credentials;
|
||||
}
|
||||
return config;
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
PageSectionVariants
|
||||
} from "@patternfly/react-core";
|
||||
|
||||
export default class LoadingContainer extends Component {
|
||||
export default class LoadingPage extends Component {
|
||||
state = {
|
||||
seconds: 0
|
||||
};
|
|
@ -6,7 +6,7 @@ import {
|
|||
PageSectionVariants
|
||||
} from "@patternfly/react-core";
|
||||
|
||||
export default class Container404 extends Component {
|
||||
export default class Page404 extends Component {
|
||||
render() {
|
||||
return (
|
||||
<PageSection variant={PageSectionVariants.light}>
|
||||
|
@ -14,7 +14,12 @@ export default class Container404 extends Component {
|
|||
<p className="pf-u-text-align-center">
|
||||
We are looking for your page...but we can't find it
|
||||
<br />
|
||||
<Button variant="secondary" component="a" href="/" className="pf-u-mt-xl">
|
||||
<Button
|
||||
variant="secondary"
|
||||
component="a"
|
||||
href="/"
|
||||
className="pf-u-mt-xl"
|
||||
>
|
||||
Go to index
|
||||
</Button>
|
||||
</p>
|
|
@ -10,7 +10,7 @@ import { Redirect } from "react-router-dom";
|
|||
import logo from "../images/logo.svg";
|
||||
import { login } from "../auth/authActions";
|
||||
|
||||
export class LoginContainer extends Component {
|
||||
export class AraLoginPage extends Component {
|
||||
state = {
|
||||
showHelperText: false,
|
||||
helperText: "",
|
||||
|
@ -113,4 +113,4 @@ function mapDispatchToProps(dispatch) {
|
|||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(LoginContainer);
|
||||
)(AraLoginPage);
|
|
@ -0,0 +1,5 @@
|
|||
export { default as Page404 } from "./layout/Page404";
|
||||
export { default as LoadingPage } from "./layout/LoadingPage";
|
||||
export { default as LoginPage } from "./login/LoginPage";
|
||||
export { default as PlaybooksPage } from "./playbooks/PlaybooksPage";
|
||||
export { default as PlaybookPage } from "./playbooks/PlaybookPage";
|
|
@ -8,13 +8,13 @@ import {
|
|||
} from "@patternfly/react-core";
|
||||
import { connect } from "react-redux";
|
||||
import { isEmpty } from "lodash";
|
||||
import { LoadingContainer, Container404 } from "../containers";
|
||||
import { LoadingPage, Page404 } from "../pages";
|
||||
import { getPlaybook } from "./playbooksActions";
|
||||
import PlaybookSummary from "./PlaybookSummary";
|
||||
import Tasks from "../tasks/Tasks";
|
||||
import { extractTasksFromPlays } from "../tasks/task";
|
||||
|
||||
export class PlaybookContainer extends Component {
|
||||
export class PlaybookPage extends Component {
|
||||
state = {
|
||||
isLoading: true,
|
||||
playbook: null
|
||||
|
@ -32,14 +32,18 @@ export class PlaybookContainer extends Component {
|
|||
const { isLoading, playbook } = this.state;
|
||||
const { history } = this.props;
|
||||
if (isLoading) {
|
||||
return <LoadingContainer />;
|
||||
return <LoadingPage />;
|
||||
}
|
||||
if (!isLoading && isEmpty(playbook)) {
|
||||
return <Container404 />;
|
||||
return <Page404 />;
|
||||
}
|
||||
return (
|
||||
<PageSection variant={PageSectionVariants.light}>
|
||||
<PlaybookSummary key={playbook.id} playbook={playbook} history={history}/>
|
||||
<PlaybookSummary
|
||||
key={playbook.id}
|
||||
playbook={playbook}
|
||||
history={history}
|
||||
/>
|
||||
<Card>
|
||||
<CardHeader>Hosts</CardHeader>
|
||||
<CardBody>
|
||||
|
@ -87,4 +91,4 @@ function mapDispatchToProps(dispatch) {
|
|||
export default connect(
|
||||
null,
|
||||
mapDispatchToProps
|
||||
)(PlaybookContainer);
|
||||
)(PlaybookPage);
|
|
@ -15,11 +15,11 @@ import {
|
|||
Title
|
||||
} from "@patternfly/react-core";
|
||||
import { CubesIcon, ErrorCircleOIcon } from "@patternfly/react-icons";
|
||||
import { LoadingContainer } from "../containers";
|
||||
import { LoadingPage } from "../pages";
|
||||
import { getPlaybooks } from "./playbooksActions";
|
||||
import PlaybookSummary from "./PlaybookSummary";
|
||||
|
||||
export class PlaybooksContainer extends Component {
|
||||
export class PlaybooksPage extends Component {
|
||||
state = {
|
||||
isLoading: true,
|
||||
hasError: false,
|
||||
|
@ -48,7 +48,7 @@ export class PlaybooksContainer extends Component {
|
|||
const { isLoading, hasError, errorMessage } = this.state;
|
||||
|
||||
if (isLoading) {
|
||||
return <LoadingContainer />;
|
||||
return <LoadingPage />;
|
||||
}
|
||||
|
||||
if (!isLoading && hasError) {
|
||||
|
@ -133,4 +133,4 @@ function mapDispatchToProps(dispatch) {
|
|||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(PlaybooksContainer);
|
||||
)(PlaybooksPage);
|
Loading…
Reference in New Issue