Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependabot issues #926

Merged
merged 3 commits into from
May 27, 2022
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
1 change: 0 additions & 1 deletion dashboard/src/.env

This file was deleted.

16 changes: 8 additions & 8 deletions dashboard/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@
"dependencies": {
"@carbon/grid": "10.43.1",
"@carbon/icons-react": "10.49.0",
"apollo-boost": "0.4.9",
"axios": "^0.27.2",
"bootstrap": "^4.6.1",
"carbon-components": "^10.57.1",
"carbon-components-react": "^7.57.1",
"carbon-icons": "^7.0.7",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.6",
"graphql": "14.7.0",
"plotly.js": "^2.12.1",
"plotly.js-cartesian-dist-min": "^2.12.1",
"react": "16.14.0",
"react-apollo": "2.5.8",
"react-bootstrap": "^1.6.5",
"react-dom": "16.14.0",
"react-plotly.js": "^2.5.1",
"react-router-dom": "5.3.3",
"react-scripts": "4.0.3",
"react-scripts": "5.0.1",
"react-sizeme": "^2.6.12"
},
"devDependencies": {
"@commitlint/cli": "7.6.1",
"@commitlint/cli": "17.0.1",
"@commitlint/config-conventional": "7.6.0",
"@testing-library/dom": "^8.13.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^12.1.5",
"@testing-library/user-event": "^13.5.0",
"jest-canvas-mock": "^2.4.0",
"lint-staged": "8.2.1",
"lint-staged": "12.4.2",
"prettier": "1.19.1",
"sass": "1.52.1",
"wait-for-expect": "3.0.2"
},
"resolutions": {
"nth-check": "^2.0.1",
"autoprefixer": "10.4.5"
},
"eslintConfig": {
"extends": "react-app"
},
Expand Down
23 changes: 3 additions & 20 deletions dashboard/src/src/index.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
import 'core-js/modules/es7.array.includes';
import 'core-js/modules/es6.array.fill';
import 'core-js/modules/es6.string.includes';
import 'core-js/modules/es6.string.trim';
import 'core-js/modules/es7.object.values';

import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';
import './style.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import { HashRouter as Router } from 'react-router-dom';
import ApolloClient from 'apollo-boost';
import { ApolloProvider } from 'react-apollo';

const client = new ApolloClient({
uri: 'https://api.github.com/graphql',
headers: {
authorization: `Bearer ${process.env.REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN}`,
},
});

ReactDOM.render(
<ApolloProvider client={client}>
<Router>
<App />
</Router>
</ApolloProvider>,
<Router>
<App />
</Router>,
document.getElementById('root')
);

Expand Down
3 changes: 0 additions & 3 deletions dashboard/src/src/setupTests.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// Useful to test plotly (ref: https://stackoverflow.com/a/62768292)
import 'jest-canvas-mock';
// this adds jest-dom's custom assertions
import '@testing-library/jest-dom';
configure({ adapter: new Adapter() });
// Increase test timeout to support long tests
jest.setTimeout(300000);
// Add necessary mock to test plotly (ref: https://github.com/plotly/react-plotly.js/issues/115#issuecomment-448687417)
Expand Down
42 changes: 17 additions & 25 deletions dashboard/src/src/utils/queryServer.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,27 @@
import http from 'http';
import axios from 'axios';
// Use adapter to prevent "cross origin forbidden" error in tests
// Ref (2022/02/01): https://github.com/axios/axios/issues/1418
import adapter from 'axios/lib/adapters/http';

/**
* Make a REST call using GET method and NodeJS builtin `http` module.
* NB: A `https` module is also available for HTTPS addresses.
* Make a REST call using GET method and axios module.
* @param {string} path - address to load
* @param {Object} parameters - GET parameters
* @param resolve - function to call on success. Will receive JSON data.
* @param reject - function to call on error. Will receive raw error object.
*/
function makeRESTCall(path, parameters = {}, resolve, reject) {
let url = path;
const keys = Object.keys(parameters);
if (keys.length) {
url += '?';
for (let key of keys) {
url += `${key}=${encodeURI(parameters[key])}`;
}
}
http
.get(url, resp => {
let data = '';
resp.on('data', chunk => {
data += chunk;
});
resp.on('end', () => {
resolve(JSON.parse(data));
});
})
.on('error', err => {
reject(err);
});
function makeRESTCall(path, parameters, resolve, reject) {
const config = {
method: 'get',
url: path,
responseType: 'json',
responseEncoding: 'utf8',
adapter: adapter,
};
if (Object.keys(parameters).length) config.params = parameters;
axios(config)
.then(response => resolve(response.data))
.catch(reject);
}

/** Wrapper class to call Orion Web API. */
Expand Down
Loading