Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
515 changes: 515 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/react": "^10.4.7",
"@testing-library/user-event": "^12.0.11",
"husky": "^4.2.5",
"konva": "^7.0.3",
"lint-staged": "^10.2.11",
"material-ui-popup-state": "^1.6.1",
"notistack": "^0.9.17",
"prettier": "^2.0.5",
"qs": "^6.9.4",
"react": "^16.13.1",
"react-debounce-input": "^3.2.2",
Expand Down Expand Up @@ -43,6 +46,16 @@
"last 1 safari version"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write"
]
},
"devDependencies": {
"@types/jest": "^26.0.5",
"@types/node": "^13.13.0",
Expand Down
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { SnackbarProvider } from 'notistack';
import { SnackbarProvider } from "notistack";
import "./App.css";
import Header from "./components/Header";
import {
Expand Down
8 changes: 4 additions & 4 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { render } from '@testing-library/react';
import App from './App';
import React from "react";
import { render } from "@testing-library/react";
import App from "./App";

test('renders learn react link', () => {
test("renders learn react link", () => {
const { getByText } = render(<App />);
const linkElement = getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion src/_config/api.config.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const API_URL = process.env.REACT_APP_API_URL
export const API_URL = process.env.REACT_APP_API_URL;
48 changes: 24 additions & 24 deletions src/_helpers/service.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
import { usersService } from '../services'
import { User } from '../types';
import { usersService } from "../services";
import { User } from "../types";

export function authHeader() {
// return authorization header with jwt token
const userString = localStorage.getItem('user')
if (userString) {
const user: User = JSON.parse(userString);
if (user && user.token) {
return { 'Authorization': 'Bearer ' + user.token };
}
// return authorization header with jwt token
const userString = localStorage.getItem("user");
if (userString) {
const user: User = JSON.parse(userString);
if (user && user.token) {
return { Authorization: "Bearer " + user.token };
}
return [];
}
return [];
}

export function handleResponse(response: Response) {
return response.text().then((text: string) => {
const data = text && JSON.parse(text);
if (!response.ok) {
if (response.status === 401) {
// auto logout if 401 response returned from api
usersService.logout();
window.location.reload();
}
return response.text().then((text: string) => {
const data = text && JSON.parse(text);
if (!response.ok) {
if (response.status === 401) {
// auto logout if 401 response returned from api
usersService.logout();
window.location.reload();
}

const error = (data && data.message) || response.statusText;
return Promise.reject(error);
}
const error = (data && data.message) || response.statusText;
return Promise.reject(error);
}

return data;
});
}
return data;
});
}
32 changes: 0 additions & 32 deletions src/components/DateFormated.tsx

This file was deleted.

6 changes: 5 additions & 1 deletion src/components/DrawArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ export const DrawArea: FunctionComponent<IDrawArea> = ({
<React.Fragment>
<Grid container direction="column">
<Grid item>
<ImageDetails type={type} branchName={branchName} imageName={imageName} />
<ImageDetails
type={type}
branchName={branchName}
imageName={imageName}
/>
</Grid>
{imageStatus === "loading" && (
<Grid
Expand Down
40 changes: 20 additions & 20 deletions src/components/PrivateRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import { useAuthState } from "../contexts";
import { routes } from "../constants";

const PrivateRoute: React.SFC<RouteProps> = ({
component: Component,
...rest
component: Component,
...rest
}) => {
const { loggedIn } = useAuthState();
if (!Component) {
return null;
}
return (
<Route
{...rest}
render={(props) =>
loggedIn ? (
<Component {...props} />
) : (
<Redirect
to={{ pathname: routes.LOGIN, state: { from: props.location } }}
/>
)
}
/>
);
const { loggedIn } = useAuthState();
if (!Component) {
return null;
}
return (
<Route
{...rest}
render={(props) =>
loggedIn ? (
<Component {...props} />
) : (
<Redirect
to={{ pathname: routes.LOGIN, state: { from: props.location } }}
/>
)
}
/>
);
};

export default PrivateRoute;
2 changes: 1 addition & 1 deletion src/components/TestRunDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const TestRunDetails: React.FunctionComponent<IProps> = ({
<Typography>OS: {testRun.os}</Typography>
</Grid>
)}
{testRun.device && (
{testRun.device && (
<Grid item>
<Typography>Device: {testRun.device}</Typography>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TestStatusChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TestStatusChip: React.FunctionComponent<{ status: TestStatus }> = ({
default:
color = undefined;
}
return <Chip variant="outlined" color={color} label={status} size="small"/>;
return <Chip variant="outlined" color={color} label={status} size="small" />;
};

export default TestStatusChip;
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './routes'
export * from "./routes";
4 changes: 2 additions & 2 deletions src/constants/routes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const routes = {
// open
LOGIN: '/login',
REGISTER: '/register',
LOGIN: "/login",
REGISTER: "/register",

// secured
HOME: "/",
Expand Down
8 changes: 4 additions & 4 deletions src/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './auth.context'
export * from './build.context'
export * from './project.context'
export * from './testRun.context'
export * from "./auth.context";
export * from "./build.context";
export * from "./project.context";
export * from "./testRun.context";
7 changes: 6 additions & 1 deletion src/contexts/socket.context.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import * as React from "react";
import socketIOClient from "socket.io-client";
import { useBuildState, useBuildDispatch, addBuild, updateBuild } from "./build.context";
import {
useBuildState,
useBuildDispatch,
addBuild,
updateBuild,
} from "./build.context";
import { Build, TestRun } from "../types";
import { useTestRunDispatch, addTestRun } from "./testRun.context";

Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProjectListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const ProjectsListPage = () => {
<Grid item xs={4} key={project.id}>
<Card>
<CardContent>
<Typography>Key: {project.id}</Typography>
<Typography>Id: {project.id}</Typography>
<Typography>Name: {project.name}</Typography>
<Typography>Main branch: {project.mainBranchName}</Typography>
<Typography>
Expand Down
5 changes: 1 addition & 4 deletions src/pages/ProjectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ const ProjectPage = () => {
const { enqueueSnackbar } = useSnackbar();
const { buildList, selectedBuildId } = useBuildState();
const buildDispatch = useBuildDispatch();
const {
testRuns,
selectedTestRunIndex,
} = useTestRunState();
const { testRuns, selectedTestRunIndex } = useTestRunState();
const testRunDispatch = useTestRunDispatch();

// filter
Expand Down
Loading