Skip to content

Commit

Permalink
Merge 54073b5 into 94d73f3
Browse files Browse the repository at this point in the history
  • Loading branch information
campos20 committed Sep 12, 2020
2 parents 94d73f3 + 54073b5 commit c8b6f74
Show file tree
Hide file tree
Showing 61 changed files with 974 additions and 108 deletions.
24 changes: 17 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
language: java
jdk: openjdk8
sudo: true
jobs:
include:
- language: java
jdk: openjdk8
sudo: true
script:
- ./gradlew assemble
- ./gradlew check
- ./gradlew buildOfficial

script:
- ./gradlew assemble
- ./gradlew check
- ./gradlew buildOfficial
- language: node_js
node_js: 10
script:
- cd tnoodle-ui
- npm install
- npm test -- --coverage
after_script:
- COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

TNoodle is a software suite that contains the official WCA scramble program. It consists of the core scrambling code (primarily written in Java) as well as a UI and server to generate a fully autonomous JAR file

[![Build Status](https://travis-ci.org/thewca/tnoodle.svg?branch=master)](https://travis-ci.org/thewca/tnoodle)
[![Build Status](https://travis-ci.org/thewca/tnoodle.svg?branch=master)](https://travis-ci.org/thewca/tnoodle) [![Coverage Status](https://coveralls.io/repos/github/thewca/tnoodle/badge.svg?branch=master)](https://coveralls.io/github/thewca/tnoodle?branch=master)

## WCA Scramble Program

Expand Down
90 changes: 46 additions & 44 deletions tnoodle-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
{
"name": "tnoodle-ui",
"version": "0.1.0",
"private": true,
"homepage": "http://localhost:2014/scramble",
"proxy": "http://localhost:2014",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"bootstrap": "^4.4.1",
"fetch-intercept": "^2.3.1",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-icons": "^3.10.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.3",
"redux": "^4.0.5"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll --watchAll=false",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
"name": "tnoodle-ui",
"version": "0.1.0",
"private": true,
"homepage": "http://localhost:2014/scramble",
"proxy": "http://localhost:2014",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"bootstrap": "^4.4.1",
"fetch-intercept": "^2.3.1",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-bootstrap": "^1.0.0-beta.16",
"react-dom": "^16.12.0",
"react-icons": "^3.10.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.3",
"redux": "^4.0.5"
},
"eslintConfig": {
"extends": "react-app"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll --watchAll=false",
"eject": "react-scripts eject",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"coveralls": "^3.1.0"
}
}
4 changes: 2 additions & 2 deletions tnoodle-ui/src/App.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { Component } from "react";
import SideBar from "./components/SideBar";
import "bootstrap/dist/css/bootstrap.css";
import "./App.css";
import Main from "./components/Main";
import SideBar from "./main/components/SideBar";
import Main from "./main/components/Main";

class App extends Component {
render() {
Expand Down
11 changes: 0 additions & 11 deletions tnoodle-ui/src/App.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion tnoodle-ui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from "./App";
import * as serviceWorker from "./serviceWorker";

import { Provider } from "react-redux";
import store from "./redux/Store";
import store from "./main/redux/Store";

ReactDOM.render(
<Provider store={store}>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BASE_PATH } from "../App";
import { BASE_PATH } from "../../App";

// Members of the Software Team can configure this here: https://www.worldcubeassociation.org/oauth/applications/123.

Expand Down Expand Up @@ -83,16 +83,16 @@ export function gotoPreLoginPath() {

export function fetchMe() {
return wcaApiFetch("/me")
.then(response => response.json())
.then(json => json.me);
.then((response) => response.json())
.then((json) => json.me);
}

export function fetchVersionInfo() {
return wcaApiFetch("/scramble-program").then(response => response.json());
return wcaApiFetch("/scramble-program").then((response) => response.json());
}

export function getCompetitionJson(competitionId) {
return wcaApiFetch(`/competitions/${competitionId}/wcif`).then(response =>
return wcaApiFetch(`/competitions/${competitionId}/wcif`).then((response) =>
response.json()
);
}
Expand All @@ -101,7 +101,7 @@ export function getUpcomingManageableCompetitions() {
let oneWeekAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000);
return wcaApiFetch(
`/competitions?managed_by_me=true&start=${oneWeekAgo.toISOString()}`
).then(response => response.json());
).then((response) => response.json());
}

function getHashParameter(name) {
Expand Down Expand Up @@ -141,11 +141,11 @@ function wcaApiFetch(path, fetchOptions) {
fetchOptions = Object.assign({}, fetchOptions, {
headers: new Headers({
Authorization: `Bearer ${wcaAccessToken}`,
"Content-Type": "application/json"
})
"Content-Type": "application/json",
}),
});

return fetch(`${baseApiUrl}${path}`, fetchOptions).then(response => {
return fetch(`${baseApiUrl}${path}`, fetchOptions).then((response) => {
if (!response.ok) {
throw new Error(`${response.status}: ${response.statusText}`);
}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ const EventPickerTable = connect(
mapDispatchToProps
)(
class extends Component {
componentDidMount = function () {
componentDidMount() {
this.getFormats();
this.getWcaEvents();
this.getFmcTranslations();
};
}

getFormats = () => {
fetchFormats()
Expand All @@ -49,8 +49,8 @@ const EventPickerTable = connect(
return response.json();
}
})
.then((formats) => {
this.props.setWcaFormats(formats);
.then((response) => {
this.props.setWcaFormats(response);
});
};

Expand All @@ -61,8 +61,8 @@ const EventPickerTable = connect(
return response.json();
}
})
.then((wcaEvents) => {
this.props.setWcaEvents(wcaEvents);
.then((response) => {
this.props.setWcaEvents(response);
});
};

Expand Down Expand Up @@ -162,7 +162,6 @@ const EventPickerTable = connect(
item.id === event.id
)}
disabled={editingDisabled}
setBlobNull={this.setBlobNull}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,23 @@ const FmcTranslationsDetail = connect(
checked={
translation.status
}
onChange={(e) =>
onChange={(
e
) =>
this.handleTranslation(
translation.id, e.target.checked
translation.id,
e
.target
.checked
)
}
/>
</th>
{j <
TRANSLATIONS_PER_LINE -
1 && (
<th />
)}
1 && (
<th />
)}
</React.Fragment>
);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@ const VersionInfo = connect(

componentDidMount() {
// Fetch from WCA API.
fetchVersionInfo()
.then((response) => {
this.setState({
...this.state,
currentTnoodle: response.current,
allowedTnoodleVersions: response.allowed,
});
})
.catch((e) => console.error(e));
fetchVersionInfo().then((response) => {
this.setState({
...this.state,
currentTnoodle: response.current,
allowedTnoodleVersions: response.allowed,
});
});

fetchRunningVersion()
.then((response) => response.json())
.then((version) => {
let { runningVersion, officialBuild } = version;
let { projectName, projectVersion, signedBuild } = version;
this.setState({
...this.state,
runningVersion,
officialBuild,
// Running version is based on projectName and projectVersion
runningVersion:
projectVersion != null && projectVersion != null
? `${projectName}-${projectVersion}`
: "",
officialBuild: signedBuild,
});
})
.catch((e) => console.error(e));
});
}

render() {
Expand All @@ -59,11 +60,6 @@ const VersionInfo = connect(
return null;
}

// Best case scenario
if (runningVersion === currentTnoodle.name) {
return null;
}

// Generated version is not an official jar
if (!officialBuild) {
this.props.updateOfficialZipStatus(false);
Expand All @@ -78,6 +74,12 @@ const VersionInfo = connect(
);
}

// Best case scenario. We place this after the officialBuild
// so we can avoid not official build from being accidentally used.
if (runningVersion === currentTnoodle.name) {
return null;
}

// Running version is not allowed anymore.
if (!allowedVersions.includes(runningVersion)) {
this.props.updateOfficialZipStatus(false);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions tnoodle-ui/src/test/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import { render } from "@testing-library/react";
import App from "../App";
import { Provider } from "react-redux";
import store from "../main/redux/Store";

test("renders login link", () => {
const { getByText } = render(
<Provider store={store}>
<App />
</Provider>
);
const linkElement = getByText(/Log in/i);
expect(linkElement).toBeInTheDocument();
});

0 comments on commit c8b6f74

Please sign in to comment.