Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #226 from biocompute-objects/22.08
Browse files Browse the repository at this point in the history
22.08
  • Loading branch information
HadleyKing authored Aug 18, 2022
2 parents e8597e2 + d4ab072 commit 29cd2d6
Show file tree
Hide file tree
Showing 34 changed files with 884 additions and 802 deletions.
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

78 changes: 39 additions & 39 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"parser": "babel-eslint",
"env": {
"es6": true,
"browser": true
},
"extends": [
"airbnb",
"airbnb/hooks",
"eslint:recommended"
],
"settings": {
"import/resolver": {
"node": {
"paths": [
"src"
],
"extensions": [
".js",
".jsx"
]
"parser": "babel-eslint",
"env": {
"es6": true,
"browser": true
},
"extends": [
"airbnb",
"airbnb/hooks",
"eslint:recommended"
],
"settings": {
"import/resolver": {
"node": {
"paths": [
"src"
],
"extensions": [
".js",
".jsx"
]
}
}
},
"rules": {
"arrow-body-style": "off",
"comma-dangle": "off",
"import/no-unresolved": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/no-static-element-interactions": "off",
"no-console": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"react-hooks/exhaustive-deps": "off",
"react/forbid-prop-types": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off"
}
},
"rules": {
"arrow-body-style": "off",
"comma-dangle": "off",
"import/no-unresolved": "off",
"jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/control-has-associated-label": "off",
"jsx-a11y/no-static-element-interactions": "off",
"no-console": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"react-hooks/exhaustive-deps": "off",
"react/forbid-prop-types": "off",
"react/jsx-filename-extension": "off",
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off"
}
}
}
149 changes: 75 additions & 74 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
{
"name": "react-material-dashboard",
"author": "DeviasIO",
"licence": "MIT",
"version": "1.0.0",
"private": false,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"docs": "jsdoc -c jsdoc.conf.json --verbose"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/styles": "^4.10.0",
"@rjsf/core": "^3.2.1",
"ajv": "^6.12.6",
"clsx": "^1.1.1",
"crypto-js": "^4.1.1",
"depcheck": "^1.4.2",
"file-saver": "^2.0.5",
"formik": "^2.1.5",
"moment": "^2.27.0",
"object-hash": "^2.2.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-async": "^10.0.1",
"react-chartjs-2": "^2.10.0",
"react-datepicker": "^3.6.0",
"react-datetime": "^3.0.4",
"react-datetime-picker": "^3.1.0",
"react-dom": "^16.13.1",
"react-feather": "^2.0.8",
"react-helmet": "^6.1.0",
"react-html-parser": "^2.0.2",
"react-json-component": "^1.0.0",
"react-json-view": "^1.21.3",
"react-perfect-scrollbar": "^1.5.8",
"react-router-dom": "^6.0.0-beta.0",
"react-scripts": "^3.4.1",
"react-textfit": "^1.1.1",
"react-twitter-embed": "^3.0.3",
"uuid": "^8.3.0",
"yup": "^0.29.3"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^2.5.1",
"jsdoc": "^3.6.7",
"prettier": "^1.19.1"
}
"name": "react-material-dashboard",
"author": "DeviasIO",
"licence": "MIT",
"version": "1.0.0",
"private": false,
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"docs": "jsdoc -c jsdoc.conf.json --verbose"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.56",
"@material-ui/styles": "^4.10.0",
"@rjsf/core": "^4.2.2",
"@rjsf/material-ui": "^4.2.3",
"ajv": "^6.12.6",
"clsx": "^1.1.1",
"crypto-js": "^4.1.1",
"depcheck": "^1.4.2",
"file-saver": "^2.0.5",
"formik": "^2.1.5",
"moment": "^2.27.0",
"object-hash": "^2.2.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-async": "^10.0.1",
"react-chartjs-2": "^2.10.0",
"react-datepicker": "^3.6.0",
"react-datetime": "^3.0.4",
"react-datetime-picker": "^3.1.0",
"react-dom": "^16.13.1",
"react-feather": "^2.0.8",
"react-helmet": "^6.1.0",
"react-html-parser": "^2.0.2",
"react-json-component": "^1.0.0",
"react-json-view": "^1.21.3",
"react-perfect-scrollbar": "^1.5.8",
"react-router-dom": "^6.0.0-beta.0",
"react-scripts": "^3.4.1",
"react-textfit": "^1.1.1",
"react-twitter-embed": "^3.0.3",
"uuid": "^8.3.0",
"yup": "^0.29.3"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^2.5.1",
"jsdoc": "^3.6.7",
"prettier": "^1.19.1"
}
}
8 changes: 4 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ function App() {
}
};
const versions = {
portal: '22.07',
bcodb: '22.07',
userdb: '22.07'
portal: '22.08',
bcodb: '22.08',
userdb: '22.08'
};

/**
Expand All @@ -117,7 +117,7 @@ function App() {

return (
<ThemeProvider theme={theme}>
<FetchContext.Provider value={{ sending, versions, isLoggedIn }}>
<FetchContext.Provider value={{ sending, versions, isLoggedIn, setIsLoggedIn }}>
<GlobalStyles />
{routing}
</FetchContext.Provider>
Expand Down
6 changes: 3 additions & 3 deletions src/components/API/CreateDraftObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export default function CreateDraftObject(saveDraftTo, contents, prefix) {
const data = await response.json();
throw new Error(data[0].message);
}
if (response.status === 201) {
if (response.status === 200) {
const data = await response.json();
console.log('data', data);
const objectId = data.object_id;
console.log('data', data[0]);
const objectId = data[0].object_id;
alert(`Create Draft Success! Save the following object ID to access later ${objectId}`);
const processed = objectId.replace('://', '/');
window.location.href = `${window.location}/${processed}`;
Expand Down
9 changes: 7 additions & 2 deletions src/components/API/ModifyDraftObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ export default function ModifyDraftObject(objectInformation, contents) {
'Content-type': 'application/json; charset=UTF-8'
}
})
.then((response) => {
.then(async(response) => {
if (!response.ok) {
throw new Error(response.status);
} else {
}
if (response.status === 207) {
const data = await response.json();
throw new Error(data[0].message)
}
if (response.status === 200) {
return response.json()
.then((data) => {
console.log('POST_api_objects_drafts_modify: Success!', objectContents);
Expand Down
1 change: 0 additions & 1 deletion src/components/API/RetrieveDraftObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export default function RetrieveDraftObject(objectId, setObjectContents) {
if (response.status === 200) {
setObjectContents(response.data);
console.log('Server return contents33: ', objectContents);
localStorage.setItem('bco', JSON.stringify(objectContents));
}
}));
}
38 changes: 38 additions & 0 deletions src/components/API/UserdbRegisterPrefix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// /src/components/Api/RegisterPrefix.js

/* */

import PropTypes from 'prop-types';

export default function RegisterPrefix(username, prefix, ApiInfo) {
console.log('stuff', username, prefix, `${ApiInfo}`);
fetch(`${ApiInfo}register_prefix/${username}/${prefix}`, {
method: 'GET',
headers: {
Authorization: `JWT ${localStorage.getItem('token')}`,
'Content-type': 'application/json; charset=UTF-8'
}
})
.then((response) => {
if (response.ok) {
return response
.then((data) => {
console.log('data', data);
});
}
return response
.then((data) => {
console.log('data', data);
// alert(`${data}`);
});
}).catch((error) => {
console.log(`error: ${error}`);
alert(`Register prefix failed ${error}`);
});
}

RegisterPrefix.PropTypes = {
username: PropTypes.string,
prefix: PropTypes.string,
ApiInfo: PropTypes.object
};
16 changes: 13 additions & 3 deletions src/components/API/UserdbSearchPrefix.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ draft id */

import PropTypes from 'prop-types';

export default function SearchPrefix(action, search, ApiInfo, setRows) {
console.log('stuff', action, search, typeof setRows, `${ApiInfo}prefixes/`);
export default function SearchPrefix(action, search, ApiInfo, setRows, isLoggedIn) {
console.log('stuff', action, search, typeof setRows, isLoggedIn, `${ApiInfo}prefixes/`);
function getToken() {
if (isLoggedIn) {
return localStorage.getItem('token');
}
return 'dummytokentext';
}
const token = getToken();

fetch(`${ApiInfo}prefixes/`, {
method: 'POST',
body: JSON.stringify({
Expand All @@ -18,6 +26,7 @@ export default function SearchPrefix(action, search, ApiInfo, setRows) {
]
}),
headers: {
Authorization: `JWT ${token}`,
'Content-type': 'application/json; charset=UTF-8'
}
})
Expand All @@ -44,5 +53,6 @@ SearchPrefix.PropTypes = {
action: PropTypes.string.isRequired,
search: PropTypes.string,
ApiInfo: PropTypes.object,
setRows: PropTypes.func
setRows: PropTypes.func,
isLoggedIn: PropTypes.bool
};
Loading

0 comments on commit 29cd2d6

Please sign in to comment.