diff --git a/package-lock.json b/package-lock.json index 58f00706e..feac0c94b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,25 +8,25 @@ "name": "duos-ui", "version": "1.0.0", "dependencies": { - "@databiosphere/bard-client": "^0.1.0", - "@emotion/react": "^11.11.1", + "@databiosphere/bard-client": "0.1.0", + "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mui/icons-material": "5.14.15", "@mui/material": "5.14.15", "@mui/utils": "5.14.15", "ajv": "8.12.0", "ajv-formats": "2.1.1", - "axios": "^1.6.0", + "axios": "1.6.0", "bootstrap": "3.4.1", "dompurify": "3.0.6", - "http-proxy-middleware": "^2.0.6", + "http-proxy-middleware": "2.0.6", "jquery": "3.7.1", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", "moment": "2.29.4", "noty": "3.2.0-beta", - "query-string": "^7.1.3", + "query-string": "7.1.3", "react": "18.2.0", "react-dom": "18.2.0", "react-dropzone": "14.2.3", @@ -54,7 +54,6 @@ "@babel/plugin-proposal-class-properties": "7.18.6", "@babel/preset-react": "7.22.15", "@types/react": "18.2.33", - "ajv-cli": "5.0.0", "cypress": "13.3.3", "eslint": "7.32.0", "eslint-plugin-flowtype": "7.0.0", @@ -5280,32 +5279,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/ajv-cli": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ajv-cli/-/ajv-cli-5.0.0.tgz", - "integrity": "sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ==", - "dev": true, - "dependencies": { - "ajv": "^8.0.0", - "fast-json-patch": "^2.0.0", - "glob": "^7.1.0", - "js-yaml": "^3.14.0", - "json-schema-migrate": "^2.0.0", - "json5": "^2.1.3", - "minimist": "^1.2.0" - }, - "bin": { - "ajv": "dist/index.js" - }, - "peerDependencies": { - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "ts-node": { - "optional": true - } - } - }, "node_modules/ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", @@ -9481,12 +9454,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -14098,15 +14065,6 @@ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, - "node_modules/json-schema-migrate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz", - "integrity": "sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==", - "dev": true, - "dependencies": { - "ajv": "^8.0.0" - } - }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -26147,21 +26105,6 @@ "uri-js": "^4.2.2" } }, - "ajv-cli": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ajv-cli/-/ajv-cli-5.0.0.tgz", - "integrity": "sha512-LY4m6dUv44HTyhV+u2z5uX4EhPYTM38Iv1jdgDJJJCyOOuqB8KtZEGjPZ2T+sh5ZIJrXUfgErYx/j3gLd3+PlQ==", - "dev": true, - "requires": { - "ajv": "^8.0.0", - "fast-json-patch": "^3.1.1", - "glob": "^7.1.0", - "js-yaml": "^3.14.0", - "json-schema-migrate": "^2.0.0", - "json5": "^2.1.3", - "minimist": "^1.2.0" - } - }, "ajv-formats": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", @@ -29273,12 +29216,6 @@ "micromatch": "^4.0.4" } }, - "fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -32692,15 +32629,6 @@ "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, - "json-schema-migrate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/json-schema-migrate/-/json-schema-migrate-2.0.0.tgz", - "integrity": "sha512-r38SVTtojDRp4eD6WsCqiE0eNDt4v1WalBXb9cyZYw9ai5cGtBwzRNWjHzJl38w6TxFkXAIA7h+fyX3tnrAFhQ==", - "dev": true, - "requires": { - "ajv": "^8.0.0" - } - }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", diff --git a/package.json b/package.json index 8f5b7f512..78421039d 100644 --- a/package.json +++ b/package.json @@ -3,25 +3,25 @@ "version": "1.0.0", "private": true, "dependencies": { - "@databiosphere/bard-client": "^0.1.0", - "@emotion/react": "^11.11.1", + "@databiosphere/bard-client": "0.1.0", + "@emotion/react": "11.11.1", "@emotion/styled": "11.11.0", "@mui/icons-material": "5.14.15", "@mui/material": "5.14.15", "@mui/utils": "5.14.15", "ajv": "8.12.0", "ajv-formats": "2.1.1", - "axios": "^1.6.0", + "axios": "1.6.0", "bootstrap": "3.4.1", "dompurify": "3.0.6", - "http-proxy-middleware": "^2.0.6", + "http-proxy-middleware": "2.0.6", "jquery": "3.7.1", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", "moment": "2.29.4", "noty": "3.2.0-beta", - "query-string": "^7.1.3", + "query-string": "7.1.3", "react": "18.2.0", "react-dom": "18.2.0", "react-dropzone": "14.2.3", @@ -61,7 +61,6 @@ "@babel/plugin-proposal-class-properties": "7.18.6", "@babel/preset-react": "7.22.15", "@types/react": "18.2.33", - "ajv-cli": "5.0.0", "cypress": "13.3.3", "eslint": "7.32.0", "eslint-plugin-flowtype": "7.0.0", @@ -80,10 +79,5 @@ "not dead", "not ie <= 11", "not op_mini all" - ], - "overrides": { - "ajv-cli": { - "fast-json-patch": "^3.1.1" - } - } + ] } diff --git a/src/libs/ajax.js b/src/libs/ajax.js index 5116559c8..e76c79992 100644 --- a/src/libs/ajax.js +++ b/src/libs/ajax.js @@ -47,50 +47,6 @@ export const getOntologyUrl = async(baseUrl = '') => { return env === 'local' ? baseUrl : await Config.getOntologyApiUrl(); }; -const dataTemplate = { - accessTotal: [ - ['Results', 'Votes'], - ['Reviewed cases', 0], - ['Pending cases', 0] - ], - accessReviewed: [ - ['Results', 'Votes'], - ['Yes', 0], - ['No', 0] - ], - dulTotal: [ - ['Results', 'Votes'], - ['Reviewed cases', 0], - ['Pending cases', 0] - ], - dulReviewed: [ - ['Results', 'Votes'], - ['Yes', 0], - ['No', 0] - ], - RPTotal: [ - ['Results', 'Votes'], - ['Reviewed cases', 0], - ['Pending cases', 0] - ], - RPReviewed: [ - ['Results', 'Votes'], - ['Yes', 0], - ['No', 0] - ], - VaultReviewed: [ - ['Results', 'Votes'], - ['Yes', 0], - ['No', 0] - ], - Agreement: [ - ['Results', 'Votes'], - ['Agreement', 0], - ['Disagreement', 0] - ] -}; - - export const DAC = { list: async (withUsers) => { @@ -814,13 +770,6 @@ const fetchAny = async (...args) => { return res; }; -const getFile = async (URI, fileName) => { - const res = await fetchOk(URI, Config.fileBody()); - fileName = fileName === null ? getFileNameFromHttpResponse(res) : fileName; - let blob = await res.blob(); - fileDownload(blob, fileName); -}; - const getFileNameFromHttpResponse = (response) => { const respHeaders = response.headers; return respHeaders.get('Content-Disposition').split(';')[1].trim().split('=')[1]; diff --git a/src/libs/utils.js b/src/libs/utils.js index 95e2a6922..6c137966d 100644 --- a/src/libs/utils.js +++ b/src/libs/utils.js @@ -281,9 +281,9 @@ export const Notifications = { */ export const PromiseSerial = funcs => funcs.reduce((promise, func) => - promise.then(result => - func().then(Array.prototype.concat.bind(result))), - Promise.resolve([])); + promise.then(result => + func().then(Array.prototype.concat.bind(result))), + Promise.resolve([])); ////////////////////////////////// //DAR CONSOLES UTILITY FUNCTIONS// diff --git a/src/pages/DACDatasets.js b/src/pages/DACDatasets.js index 97224e56b..350318ad8 100644 --- a/src/pages/DACDatasets.js +++ b/src/pages/DACDatasets.js @@ -8,7 +8,6 @@ import {consoleTypes} from '../components/dac_dataset_table/DACDatasetTableCellD import style from './DACDatasets.module.css'; import {Button} from '@mui/material'; import {DatasetService} from '../utils/DatasetService'; -import {isDevEnv} from '../utils/EnvironmentUtils'; export default function DACDatasets(props) { diff --git a/src/pages/DatasetCatalog.js b/src/pages/DatasetCatalog.js index 7898ce549..2e3ab73cd 100644 --- a/src/pages/DatasetCatalog.js +++ b/src/pages/DatasetCatalog.js @@ -15,7 +15,6 @@ import {getBooleanFromEventHtmlDataValue, USER_ROLES} from '../libs/utils'; import {DataUseTranslation} from '../libs/dataUseTranslation'; import {spinnerService} from '../libs/spinner-service'; import { ArrowDropUp, ArrowDropDown } from '@mui/icons-material'; -import {isDevEnv} from '../utils/EnvironmentUtils'; import DuosLogo from '../images/duos-network-logo.svg'; import style from './DatasetCatalog.module.css'; diff --git a/src/pages/DatasetSearch.js b/src/pages/DatasetSearch.js index 9056cc321..71e0538da 100644 --- a/src/pages/DatasetSearch.js +++ b/src/pages/DatasetSearch.js @@ -18,7 +18,7 @@ const signingOfficialQuery = (user) => { 'submitter.institution.id': user.institution.id } }; -} +}; // query to return approved DAC studies from the user's institution const myInstitutionQuery = (user) => { @@ -38,7 +38,7 @@ const myInstitutionQuery = (user) => { ] } }; -} +}; export const DatasetSearch = (props) => { const { match: { params: { query } } } = props; @@ -135,7 +135,7 @@ export const DatasetSearch = (props) => { icon: homeIcon, title: query + ' Data Library', } - } + }; const key = query === undefined ? '/datalibrary' : query; const version = versions[key] === undefined ? versions['/custom'] : versions[key]; @@ -173,7 +173,7 @@ export const DatasetSearch = (props) => { } }; init(); - }, []); + }); return ( loading ? diff --git a/src/pages/DatasetStatistics.js b/src/pages/DatasetStatistics.js index 55303ee35..d5b5cab2d 100644 --- a/src/pages/DatasetStatistics.js +++ b/src/pages/DatasetStatistics.js @@ -1,10 +1,9 @@ import {useState, useEffect} from 'react'; import {Metrics} from '../libs/ajax'; import {Notifications} from '../libs/utils'; -import {div, a} from 'react-hyperscript-helpers'; +import {div} from 'react-hyperscript-helpers'; import {Styles, Theme} from '../libs/theme'; -import {filter, map} from 'lodash/fp'; -import {difference, get, find} from 'lodash'; +import {get} from 'lodash'; import {ReadMore} from '../components/ReadMore'; import {formatDate} from '../libs/utils'; @@ -14,11 +13,6 @@ export default function DatasetStatistics(props) { const datasetId = props.match.params.datasetId; const [dataset, setDataset] = useState(); const [dars, setDars] = useState(); - const [darsApproved, setDarsApproved] = useState(); - const [darsDenied, setDarsDenied] = useState(); - const [darsOpen, setDarsOpen] = useState(); - const [darsCanceled, setDarsCanceled] = useState(); - const [darsUnreviewed, setDarsUnreviewed] = useState(); const [isLoading, setIsLoading] = useState(true); useEffect(() => { @@ -31,23 +25,6 @@ export default function DatasetStatistics(props) { const metrics = await Metrics.getDatasetStats(datasetId); setDataset(metrics.dataset); setDars(metrics.dars); - - const approved = filter((election) => election.finalAccessVote === true && election.status !== 'Open' && election.status !== 'Canceled')(metrics.elections); - setDarsApproved(map((election) => election.referenceId)(approved)); - - const denied = filter((election) => election.finalAccessVote === false && election.status !== 'Open' && election.status !== 'Canceled')(metrics.elections); - setDarsDenied(map((election) => election.referenceId)(denied)); - - const open = filter((election) => election.status === 'Open')(metrics.elections); - setDarsOpen(map((election) => election.referenceId)(open)); - - const canceled = filter((election) => election.status === 'Canceled')(metrics.elections); - setDarsCanceled(map((election) => election.referenceId)(canceled)); - - const allDarReferenceIds = map((dar) => dar.referenceId)(metrics.dars); - const allElectionReferenceIds = map((election) => election.referenceId)(metrics.elections); - setDarsUnreviewed(difference(allDarReferenceIds, allElectionReferenceIds)); - setIsLoading(false); } catch(error) { Notifications.showError({text: 'Error: Unable to retrieve dataset statistics from server'}); @@ -55,21 +32,6 @@ export default function DatasetStatistics(props) { } }; - const getDisplayStatusForDar = (referenceId) => { - if (darsApproved.includes(referenceId)) { - return 'APPROVED'; - } else if (darsDenied.includes(referenceId)) { - return 'DENIED'; - } else if (darsOpen.includes(referenceId)) { - return 'OPEN'; - } else if (darsCanceled.includes(referenceId)) { - return 'CANCELED'; - } else if (darsUnreviewed.includes(referenceId)) { - return 'UNREVIEWED'; - } - return ''; - }; - if (!isLoading) { return ( div({style: {...Styles.PAGE, color: Theme.palette.primary}}, [ diff --git a/src/setupProxy.js b/src/setupProxy.js index f6b66538d..df56a83dd 100644 --- a/src/setupProxy.js +++ b/src/setupProxy.js @@ -30,7 +30,7 @@ const configUrls = require('../public/config.json'); module.exports = function (app) { app.use( - ['/api', '/schemas'], + ['/api', '/schemas', '/metrics'], createProxyMiddleware({ target: configUrls.apiUrl, secure: false,