Skip to content

Commit

Permalink
Merge branch 'develop' into fix-import-tests-new-build
Browse files Browse the repository at this point in the history
  • Loading branch information
alflennik committed Aug 12, 2021
2 parents 8f4bb04 + 6369bf3 commit 537dd5d
Show file tree
Hide file tree
Showing 166 changed files with 6,845 additions and 3,337 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"semi": ["error", "always"],
"eol-last": ["error", "always"],
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-use-before-define": ["error"],
"no-use-before-define": ["off"],
"react/display-name": ["off"]
},
"settings": {
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/runtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
sudo apt-get -y install postgresql-client-12
- name: before_install
run: |
npm install -g @lhci/cli@0.3.x
sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/12/main/postgresql.conf
sudo pg_ctlcluster 12 main restart
- name: before_script
Expand All @@ -36,5 +35,9 @@ jobs:
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_1}
yarn workspace server db-import-tests:test -c ${IMPORT_ARIA_AT_TESTS_COMMIT_2}
yarn workspace server db-populate-sample-data:test
- name: script
- name: test
run: yarn test
- name: lighthouseci
run: |
npm install -g @lhci/cli@0.8.x
yarn workspace client lighthouse
23 changes: 8 additions & 15 deletions client/components/ATAlert/index.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import React, { Component } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import './ATAlert.css';

class ATAlert extends Component {
constructor(props) {
super(props);
}

render() {
const { message } = this.props;
return (
<div className="at-alert" role="status" aria-live="polite">
{message}
</div>
);
}
}
const ATAlert = ({ message }) => {
return (
<div className="at-alert" role="status" aria-live="polite">
{message}
</div>
);
};

ATAlert.propTypes = {
message: PropTypes.string
Expand Down
2 changes: 1 addition & 1 deletion client/components/App/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ ul li {

.status-label.not-started {
background: #e7ecef;
color: #748193;
color: #63697E;
}

.status-label.complete {
Expand Down
155 changes: 155 additions & 0 deletions client/components/App/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
signIn as signInAction,
signOut as signOutAction
} from '../../redux/actions/auth';
import { useQuery } from '@apollo/client';
import { renderRoutes } from 'react-router-config';
import { Link, useLocation } from 'react-router-dom';
import { Container, Navbar, Nav } from 'react-bootstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faUserCircle } from '@fortawesome/free-solid-svg-icons';
import { ME_QUERY } from '../TestQueue/queries';
import routes from '../../routes';
import useSigninUrl from './useSigninUrl';
import './App.css';

const App = ({ auth, dispatch }) => {
const { client, error, loading, data } = useQuery(ME_QUERY);
const signinUrl = useSigninUrl();
const location = useLocation();

const { isSignedIn, isSignOutCalled, isTester, isAdmin, username } = auth;

const signOut = async () => {
dispatch(signOutAction());
await fetch('/api/auth/signout', { method: 'POST' });
await client.resetStore();
};

if (loading) return null;

// cache still being used to prevent redux refresh unless browser refreshed
// for some instances. `isSignOutCalled` boolean helps prevent this
if (!isSignOutCalled && !username && data && data.me)
dispatch(signInAction(data.me));

if (error) {
// TODO: Display error message / page for failed user auth attempt
// dispatch(signInFailAction());
}

return (
<Fragment>
<Container fluid>
<Navbar bg="light" expand="lg" aria-label="Main Menu">
<Navbar.Brand
className="logo"
as={Link}
to="/"
aria-current={location.pathname === '/'}
>
ARIA-AT
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse
id="basic-navbar-nav"
className="justify-content-end"
>
{(!isSignedIn && (
<Fragment>
<Nav.Link
as={Link}
to="/reports"
aria-current={
location.pathname === '/reports'
}
>
Test Reports
</Nav.Link>
<Nav.Link
as={Link}
to="/"
onClick={() =>
(window.location.href = signinUrl)
}
>
Sign in with GitHub
</Nav.Link>
</Fragment>
)) || (
<Fragment>
<Nav.Link
as={Link}
to="/reports"
aria-current={
location.pathname === '/reports'
}
>
Test Reports
</Nav.Link>
{isTester && (
<Nav.Link
as={Link}
to="/test-queue"
aria-current={
location.pathname === '/test-queue'
}
>
Test Queue
</Nav.Link>
)}
{isAdmin && (
<Nav.Link
as={Link}
to="/admin/configure-runs"
aria-current={
location.pathname ===
'/admin/configure-runs'
}
>
Test Configuration
</Nav.Link>
)}
<Nav.Link
as={Link}
to="/account/settings"
aria-current={
location.pathname ===
'/account/settings'
}
>
Settings
</Nav.Link>
<Nav.Link as={Link} to="/" onClick={signOut}>
Sign out
</Nav.Link>
<div className="signed-in">
<FontAwesomeIcon icon={faUserCircle} />
Signed in as <b>{username}</b>
</div>
</Fragment>
)}
</Navbar.Collapse>
</Navbar>
</Container>
<Container fluid>
<div>{renderRoutes(routes)}</div>
</Container>
</Fragment>
);
};

App.propTypes = {
auth: PropTypes.object,
dispatch: PropTypes.func
};

const mapStateToProps = state => {
const { auth } = state;
return { auth };
};

export default connect(mapStateToProps)(App);
3 changes: 3 additions & 0 deletions client/components/App/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import App from './App';

export default App;
Loading

0 comments on commit 537dd5d

Please sign in to comment.