diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml new file mode 100644 index 000000000..8ed936c15 --- /dev/null +++ b/.github/workflows/checkstyle.yml @@ -0,0 +1,19 @@ +name: Checkstyle Action +on: pull_request + +jobs: + checkstyle_job: + runs-on: ubuntu-latest + name: Checkstyle Job + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Run check style + uses: dbelyaev/action-checkstyle@master + with: + level: 'error' + fail_on_error: 'true' + github_token: ${{ secrets.GH_DEVOPS_PAT }} + reporter: github-pr-review + checkstyle_config: checkstyle.xml + checkstyle_version: "10.17.0" diff --git a/.github/workflows/github-actions-PR-validation.yml b/.github/workflows/github-actions-PR-validation.yml index 39c3ad9b0..143758fb4 100644 --- a/.github/workflows/github-actions-PR-validation.yml +++ b/.github/workflows/github-actions-PR-validation.yml @@ -8,6 +8,7 @@ on: - production jobs: check-branching-rules: + name: Check Branching Rules runs-on: ubuntu-20.04 steps: - name: Check out repository code @@ -17,7 +18,40 @@ jobs: - name: Check branching rules run: | bash ci-scripts/check-branching.sh ${{ github.base_ref }} ${{ github.head_ref }} - verify-test-api: + + checkstyle-api: + name: Checkstyle API + runs-on: ubuntu-20.04 + steps: + - name: Report workflow details + run: | + echo "Repository ${{ github.repository }}." + echo "Trigger ref ${{ github.ref }}, base-ref ${{ github.base_ref }}, head_ref ${{ github.head_ref }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: cp src/main/resources/application.properties.defaults src/main/resources/application.properties + - name: Report files updated in PR + run: | + git fetch -q origin ${{ github.base_ref }} ${{ github.head_ref }} + git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Report runtime details + run: | + echo "Github runner OS: ${{ runner.os }}" + - name: Report Maven version + run: | + mvn --version + - name: Run Check Styles + run: | + mvn -ntp checkstyle:check + + + verify-api: + name: Verify API runs-on: ubuntu-20.04 steps: - name: Report workflow details @@ -36,11 +70,42 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Report runtime details + run: | + echo "Github runner OS: ${{ runner.os }}" - id: install-secret-key name: Install gpg secret key run: | cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG + - name: Report Maven version + run: | + mvn --version + - name: Run Maven verify + run: | + mvn -ntp --batch-mode --update-snapshots verify + + + test-api: + name: Test API + runs-on: ubuntu-20.04 + steps: + - name: Report workflow details + run: | + echo "Repository ${{ github.repository }}." + echo "Trigger ref ${{ github.ref }}, base-ref ${{ github.base_ref }}, head_ref ${{ github.head_ref }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: cp src/main/resources/application.properties.defaults src/main/resources/application.properties + - name: Report files updated in PR + run: | + git fetch -q origin ${{ github.base_ref }} ${{ github.head_ref }} + git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' - name: Report runtime details run: | echo "Github runner OS: ${{ runner.os }}" @@ -49,13 +114,65 @@ jobs: mvn --version - name: Run Maven test run: | - mvn --no-transfer-progress test - - name: Run Maven verify + mvn -ntp test + + package-api: + name: Package API + runs-on: ubuntu-20.04 + steps: + - name: Report workflow details + run: | + echo "Repository ${{ github.repository }}." + echo "Trigger ref ${{ github.ref }}, base-ref ${{ github.base_ref }}, head_ref ${{ github.head_ref }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: cp src/main/resources/application.properties.defaults src/main/resources/application.properties + - name: Report files updated in PR run: | - mvn --no-transfer-progress --batch-mode --update-snapshots verify + git fetch -q origin ${{ github.base_ref }} ${{ github.head_ref }} + git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Report runtime details + run: | + echo "Github runner OS: ${{ runner.os }}" + - name: Report Maven version + run: | + mvn --version - name: Package API run: | - mvn clean package -Dquarkus.package.type=uber-jar -ntp + mvn -ntp clean package -Dquarkus.package.type=uber-jar -ntp + + + integration-test-api: + name: Integration Test API + runs-on: ubuntu-20.04 + steps: + - name: Report workflow details + run: | + echo "Repository ${{ github.repository }}." + echo "Trigger ref ${{ github.ref }}, base-ref ${{ github.base_ref }}, head_ref ${{ github.head_ref }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: cp src/main/resources/application.properties.defaults src/main/resources/application.properties + - name: Report files updated in PR + run: | + git fetch -q origin ${{ github.base_ref }} ${{ github.head_ref }} + git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Report runtime details + run: | + echo "Github runner OS: ${{ runner.os }}" + - name: Report Maven version + run: | + mvn --version - name: Create test containers properties file run: | touch ~/.testcontainers.properties @@ -64,6 +181,7 @@ jobs: make integration-test verify-test-ui: + name: Verify Test UI runs-on: ubuntu-20.04 steps: - name: Report workflow details @@ -87,9 +205,11 @@ jobs: working-directory: src/main/cliapp run: | npm ci + npx prettier --check . npm test -- --watchAll=false npm run build test-build-docker-image: + name: Test Build Docker Image runs-on: ubuntu-20.04 steps: - name: Check out repository code diff --git a/Makefile b/Makefile index 42b4d77b6..4bccc226d 100644 --- a/Makefile +++ b/Makefile @@ -58,13 +58,22 @@ docker-run: debug: java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5045 -jar target/agr_curation_api-bootable.jar +checkstyle: + mvn checkstyle:check + +prettier-check: + npx prettier 'src/main/cliapp/**/*.js' --check + +prettier-write: + npx prettier 'src/main/cliapp/**/*.js' --write + test: mvn test integration-test: - mvn clean package + mvn -ntp clean package mvn -ntp failsafe:integration-test -Dokta.authentication=false - mvn failsafe:verify + mvn -ntp failsafe:verify verify: mvn verify diff --git a/README.md b/README.md index 670ac4483..b825ef545 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ These instructions will get you a copy of the project and the API up and running * [Postgres](#postgres) * [OpenSearch](#opensearch-elastic-search-alternative) * [Cerebro](#cerebro) +- [Code Style](#codestyle) + * [Running Checkstyle](#running-checkstyle) + * [Checkstyle Links](#checkstyle-links) - [Building](#building) * [Building Docker Image](#building-docker-image) - [Running](#running) @@ -239,6 +242,100 @@ CONTAINER ID IMAGE COMMAND 7de3cf028e9c postgres:13 "docker-entrypoint.s…" 3 days ago Up 3 days 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp postgres ``` +## Code Style + +This repository uses checkstyle to validate formatting of code to a coding standard. [Checkstyle](https://checkstyle.sourceforge.io/) is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard. + +This repository also uses [Prettier](https://prettier.io/) to validate and update the formatting of code in the frontend codebase. + +### Running Checkstyle + +To run checkstyle locally in order to check your code before committing run the following: + +```bash +> mvn checkstyle:check +``` + +Or the make target: + +```bash +> make checkstyle +``` + +This will check all the style of the code and report any issues that it finds with the code. Here is an example output: + +```bash +> make checkstyle +[INFO] Scanning for projects... +[INFO] Inspecting build with total of 1 modules... +[INFO] Installing Nexus Staging features: +[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin +[INFO] +[INFO] ----------------< org.alliancegenome:agr_curation_api >----------------- +[INFO] Building AGR Curation :: API 0.0.0 +[INFO] from pom.xml +[INFO] --------------------------------[ jar ]--------------------------------- +[INFO] +[INFO] --- checkstyle:3.3.1:check (default-cli) @ agr_curation_api --- +[INFO] There is 1 error reported by Checkstyle 10.17.0 with checkstyle.xml ruleset. +[ERROR] src/main/java/org/alliancegenome/curation_api/main/Main.java:[9] (regexp) RegexpSinglelineJava: Indent must use tab characters +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD FAILURE +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 6.107 s +[INFO] Finished at: 2024-05-29T05:23:33-04:00 +[INFO] ------------------------------------------------------------------------ +[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.3.1:check (default-cli) on project agr_curation_api: You have 1 Checkstyle violation. -> [Help 1] +[ERROR] +[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. +[ERROR] Re-run Maven using the -X switch to enable full debug logging. +[ERROR] +[ERROR] For more information about the errors and possible solutions, please read the following articles: +[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException +make: *** [checkstyle] Error 1 +``` + +Checkstyle can be configured via the checkstyle.xml file in the root of the project, this file can also be used by IDE's to keep code in line with the ruleset. + +### Running Prettier + +To validate formatting on JavaScript files locally with Prettier: + +```bash +> npx prettier --check **/*.js +``` + +Or the make target: + +```bash +> make prettier-check +``` + +To update formatting on JavaScript files locally with Prettier: + +```bash +> npx prettier --write **/*.js +``` + +Or the make target: + +```bash +> make prettier-write +``` + +Prettier can be configured via the .prettierrc.yaml file in the src/main/cliapp director of this project, this file can also be used by IDE's to keep code in line with the ruleset. + +### Checkstyle Links + +* Checkstyle for vscode: [https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-checkstyle](https://marketplace.visualstudio.com/items?itemName=shengchen.vscode-checkstyle) +* Checkstyle for Intellij: [https://stackoverflow.com/questions/26955766/intellij-idea-checkstyle](https://stackoverflow.com/questions/26955766/intellij-idea-checkstyle) +* Checkstyle for Eclipse: [https://www.youtube.com/watch?v=H90QoBp2NSQ](https://www.youtube.com/watch?v=H90QoBp2NSQ) or [https://checkstyle.org/eclipse-cs/#!/](https://checkstyle.org/eclipse-cs/#!/) + +### Prettier Links + +* Prettier for vscode: [https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) +* Prettier for Intellij: [https://www.jetbrains.com/help/idea/prettier.html](https://www.jetbrains.com/help/idea/prettier.html) + ## Building Before building locally, make sure and create a copy of the application.properties file diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index af3942020..673f39311 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -2,6 +2,26 @@ https://agr-jira.atlassian.net/wiki/spaces/ATEAM/overview +## v0.34.0 +* New features + * Paralogy annotations loaded into persistent store (SCRUM-4086, SCRUM-4088, SCRUM-4089, SCRUM-4090) + * Expression annotations loaded into persistent store (SCRUM-3708) + * HTPTags loaded into persistent store (SCRUM-4221) + * Data load file history sorted by Load Started timestamp (SCRUM-4204) + * Data loads stopped if error rate exceeds cutoff threshold (SCRUM-3871) + * SGD strain background added to defining fields of disease/phenotype annotations (SCRUM-4137) + * Turned off cleanup of associated annotations/associations (SCRUM-4107) +* Fixes and maintenance + * Fixed reporting of out-of-date errors in data loads tooltip (SCRUM-4210) + * Fixed loading of genes with duplicate cross-references (SCRUM-4160) + * Fixed lading of interactions via NCBI_Gene cross-references (SCRUM-4159) + * Fixed orthology load cleanup (SCRUM-4146) + * Fixed duplicate references on interactions (SCRUM-4114) + * Fixed subject filter on disease annotations table (SCRUM-4113) + * Fixed association of secondary phenotype annotations with primary annotations that have condition relations (SCRUM-4062) + * Fixed downloads of large exception lists (SCRUM-3871) + * Fixed missing exception messages in downloads (SCRUM-4162) + ## v0.33.0 * New features * Importing gene interactions into the persistent store (phase 2) (SCRUM-3809) diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 000000000..4881979be --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index e88791f72..0600e13b4 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,8 @@ 0.5.1 3.5.0 3.0.0-M7 + 3.3.1 + 10.17.0 @@ -248,7 +250,7 @@ org.projectlombok lombok - 1.18.22 + 1.18.32 com.amazonaws @@ -486,7 +488,48 @@ v@{project.version} + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle.version} + + + + + validate + validate + + UTF-8 + + + check + + + + + config_loc=${basedir} + checkstyle.xml + true + true + true + true + true + + + + + diff --git a/src/main/cliapp/.prettierignore b/src/main/cliapp/.prettierignore new file mode 100644 index 000000000..ebe4d0455 --- /dev/null +++ b/src/main/cliapp/.prettierignore @@ -0,0 +1,6 @@ +node_modules +*.html +*.css +*.scss +*.json +*.yaml \ No newline at end of file diff --git a/src/main/cliapp/.prettierrc.yaml b/src/main/cliapp/.prettierrc.yaml new file mode 100644 index 000000000..639dd7bc7 --- /dev/null +++ b/src/main/cliapp/.prettierrc.yaml @@ -0,0 +1,6 @@ +# see more options at https://prettier.io/docs/en/options +trailingComma: "es5" +tabWidth: 2 +semi: true +singleQuote: true +printWidth: 120 \ No newline at end of file diff --git a/src/main/cliapp/gulpfile.js b/src/main/cliapp/gulpfile.js index b06e384dd..e7bdc28a3 100644 --- a/src/main/cliapp/gulpfile.js +++ b/src/main/cliapp/gulpfile.js @@ -1,17 +1,17 @@ -const gulp = require("gulp"); -const inlinesource = require("gulp-inline-source"); -const replace = require("gulp-replace"); +const gulp = require('gulp'); +const inlinesource = require('gulp-inline-source'); +const replace = require('gulp-replace'); -gulp.task("default", () => { +gulp.task('default', () => { return gulp - .src("./build/*.html") + .src('./build/*.html') .pipe(replace('.js">', '.js" inline>')) .pipe(replace('rel="stylesheet">', 'rel="stylesheet" inline>')) .pipe( inlinesource({ compress: false, - ignore: ["png"], + ignore: ['png'], }) ) - .pipe(gulp.dest("./build")); -}); + .pipe(gulp.dest('./build')); +}); diff --git a/src/main/cliapp/package-lock.json b/src/main/cliapp/package-lock.json index c273ba6ba..c6d039af3 100644 --- a/src/main/cliapp/package-lock.json +++ b/src/main/cliapp/package-lock.json @@ -49,7 +49,9 @@ }, "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", - "msw": "^0.48.1" + "eslint-config-prettier": "^9.1.0", + "msw": "^0.48.1", + "prettier": "3.2.5" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -8498,6 +8500,18 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/eslint-config-react-app": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", @@ -17551,6 +17565,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-bytes": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", diff --git a/src/main/cliapp/package.json b/src/main/cliapp/package.json index d3b23e8a6..d934280f3 100644 --- a/src/main/cliapp/package.json +++ b/src/main/cliapp/package.json @@ -55,7 +55,8 @@ }, "eslintConfig": { "extends": [ - "react-app" + "react-app", + "prettier" ] }, "browserslist": [ @@ -66,6 +67,8 @@ ], "devDependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", - "msw": "^0.48.1" + "eslint-config-prettier": "^9.1.0", + "msw": "^0.48.1", + "prettier": "3.2.5" } } diff --git a/src/main/cliapp/src/App.js b/src/main/cliapp/src/App.js index efa757945..14069187a 100644 --- a/src/main/cliapp/src/App.js +++ b/src/main/cliapp/src/App.js @@ -10,7 +10,6 @@ import routes from './routes'; import './App.scss'; const App = () => { - const oktaAuth = new OktaAuth(oktaAuthConfig); const history = useHistory(); @@ -27,9 +26,7 @@ const App = () => { return ( - - {routes} - + {routes} ); }; diff --git a/src/main/cliapp/src/AppConfig.js b/src/main/cliapp/src/AppConfig.js index af0e013ef..75b93428a 100644 --- a/src/main/cliapp/src/AppConfig.js +++ b/src/main/cliapp/src/AppConfig.js @@ -2,382 +2,427 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; import { RadioButton } from 'primereact/radiobutton'; import { InputSwitch } from 'primereact/inputswitch'; import classNames from 'classnames'; -import { Button } from "primereact/button"; - -export const AppConfig = ({ rippleEffect, onRippleEffect, inputStyle, onInputStyleChange, layoutMode, onLayoutModeChange, themeState, setThemeState }) => { - - const [active, setActive] = useState(false); - const [scales] = useState([12, 13, 14, 15, 16]); - const config = useRef(null); - let outsideClickListener = useRef(null); - - const setScale = (value) => { - let _themeState = { - ...themeState, - scale: value +import { Button } from 'primereact/button'; + +export const AppConfig = ({ + rippleEffect, + onRippleEffect, + inputStyle, + onInputStyleChange, + layoutMode, + onLayoutModeChange, + themeState, + setThemeState, +}) => { + const [active, setActive] = useState(false); + const [scales] = useState([12, 13, 14, 15, 16]); + const config = useRef(null); + let outsideClickListener = useRef(null); + + const setScale = (value) => { + let _themeState = { + ...themeState, + scale: value, + }; + + setThemeState(_themeState); + }; + + const setTheme = (value, value2) => { + let _themeState = { + ...themeState, + theme: value, + layoutColorMode: value2, + }; + + setThemeState(_themeState); + }; + + const unbindOutsideClickListener = useCallback(() => { + if (outsideClickListener.current) { + document.removeEventListener('click', outsideClickListener.current); + outsideClickListener.current = null; + } + }, []); + + const hideConfigurator = useCallback( + (event) => { + setActive(false); + unbindOutsideClickListener(); + event.preventDefault(); + }, + [unbindOutsideClickListener] + ); + + const bindOutsideClickListener = useCallback(() => { + if (!outsideClickListener.current) { + outsideClickListener.current = (event) => { + if (active && isOutsideClicked(event)) { + hideConfigurator(event); + } }; + document.addEventListener('click', outsideClickListener.current); + } + }, [active, hideConfigurator]); - setThemeState(_themeState); + useEffect(() => { + if (active) { + bindOutsideClickListener(); + } else { + unbindOutsideClickListener(); } + }, [active, bindOutsideClickListener, unbindOutsideClickListener]); - const setTheme = (value, value2) => { - let _themeState = { - ...themeState, - theme: value, - layoutColorMode: value2 - }; + const isOutsideClicked = (event) => { + return !(config.current.isSameNode(event.target) || config.current.contains(event.target)); + }; - setThemeState(_themeState); - } + const decrementScale = () => { + const _scale = themeState.scale - 1; + setScale(_scale); + }; - const unbindOutsideClickListener = useCallback(() => { - if (outsideClickListener.current) { - document.removeEventListener('click', outsideClickListener.current); - outsideClickListener.current = null; - } - }, []); - - const hideConfigurator = useCallback((event) => { - setActive(false); - unbindOutsideClickListener(); - event.preventDefault(); - }, [unbindOutsideClickListener]); - - const bindOutsideClickListener = useCallback(() => { - if (!outsideClickListener.current) { - outsideClickListener.current = (event) => { - if (active && isOutsideClicked(event)) { - hideConfigurator(event); - } - }; - document.addEventListener('click', outsideClickListener.current); - } - }, [active, hideConfigurator]); + const incrementScale = () => { + const _scale = themeState.scale + 1; + setScale(_scale); + }; - useEffect(() => { - if (active) { - bindOutsideClickListener() - } - else { - unbindOutsideClickListener() - } - }, [active, bindOutsideClickListener, unbindOutsideClickListener]); + useEffect(() => { + document.documentElement.style.fontSize = themeState?.scale + 'px'; + }, [themeState]); - const isOutsideClicked = (event) => { - return !(config.current.isSameNode(event.target) || config.current.contains(event.target)); - } + const toggleConfigurator = (event) => { + setActive((prevState) => !prevState); + }; - const decrementScale = () => { - const _scale = themeState.scale - 1; - setScale(_scale); - } + const configClassName = classNames('layout-config', { + 'layout-config-active': active, + }); - const incrementScale = () => { - const _scale = themeState.scale + 1; - setScale(_scale); - } + const replaceLink = useCallback((linkElement, href, callback) => { + if (isIE()) { + linkElement.setAttribute('href', href); - useEffect(() => { - document.documentElement.style.fontSize = themeState?.scale + 'px'; - }, [themeState]) + if (callback) { + callback(); + } + } else { + const id = linkElement.getAttribute('id'); + const cloneLinkElement = linkElement.cloneNode(true); - const toggleConfigurator = (event) => { - setActive(prevState => !prevState); - } + cloneLinkElement.setAttribute('href', href); + cloneLinkElement.setAttribute('id', id + '-clone'); - const configClassName = classNames('layout-config', { - 'layout-config-active': active - }) + linkElement.parentNode.insertBefore(cloneLinkElement, linkElement.nextSibling); - const replaceLink = useCallback((linkElement, href, callback) => { - if (isIE()) { - linkElement.setAttribute('href', href); + cloneLinkElement.addEventListener('load', () => { + linkElement.remove(); + cloneLinkElement.setAttribute('id', id); - if (callback) { - callback(); - } + if (callback) { + callback(); } - else { - const id = linkElement.getAttribute('id'); - const cloneLinkElement = linkElement.cloneNode(true); + }); + } + }, []); + + useEffect(() => { + let themeElement = document.getElementById('theme-link'); + const themeHref = 'assets/themes/' + themeState?.theme + '/theme.css'; + replaceLink(themeElement, themeHref); + }, [themeState, replaceLink]); + + const isIE = () => { + return /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent); + }; + + const changeTheme = (e, theme, scheme) => { + setTheme(theme, scheme); + }; + + return ( +
+ +
- cloneLinkElement.setAttribute('href', href); - cloneLinkElement.setAttribute('id', id + '-clone'); +
Input Style
+
+
+ onInputStyleChange(e.value)} + checked={inputStyle === 'outlined'} + /> + +
+
+ onInputStyleChange(e.value)} + checked={inputStyle === 'filled'} + /> + +
+
- linkElement.parentNode.insertBefore(cloneLinkElement, linkElement.nextSibling); +
Ripple Effect
+ + +
Menu Type
+
+
+ onLayoutModeChange(e.value)} + checked={layoutMode === 'static'} + /> + +
+
+ onLayoutModeChange(e.value)} + checked={layoutMode === 'overlay'} + /> + +
+
- cloneLinkElement.addEventListener('load', () => { - linkElement.remove(); - cloneLinkElement.setAttribute('id', id); +
Themes
+
Bootstrap
+
+
+ +
+
+ +
+
+ +
+
+ +
+
- if (callback) { - callback(); - } - }); - } - }, []) +
Material Design
+
+
+ +
+
+ +
+
+ +
+
+ +
+
- useEffect(() => { - let themeElement = document.getElementById('theme-link'); - const themeHref = 'assets/themes/' + themeState?.theme + '/theme.css'; - replaceLink(themeElement, themeHref); +
Material Design Compact
+
+
+ +
+
+ +
+
+ +
+
+ +
+
- }, [themeState, replaceLink]) +
Tailwind
+
+
+ +
+
- const isIE = () => { - return /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent) - } +
Fluent UI
+
+
+ +
+
- const changeTheme = (e, theme, scheme) => { - setTheme(theme, scheme); - } +
PrimeOne Design - 2022
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
- return ( -
- -
- -
Input Style
-
-
- onInputStyleChange(e.value)} checked={inputStyle === 'outlined'} /> - -
-
- onInputStyleChange(e.value)} checked={inputStyle === 'filled'} /> - -
-
- -
Ripple Effect
- - -
Menu Type
-
-
- onLayoutModeChange(e.value)} checked={layoutMode === 'static'} /> - -
-
- onLayoutModeChange(e.value)} checked={layoutMode === 'overlay'} /> - -
-
- -
Themes
-
Bootstrap
-
-
- -
-
- -
-
- -
-
- -
-
- -
Material Design
-
-
- -
-
- -
-
- -
-
- -
-
- -
Material Design Compact
-
-
- -
-
- -
-
- -
-
- -
-
- -
Tailwind
-
-
- -
-
- -
Fluent UI
-
-
- -
-
- -
PrimeOne Design - 2022
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
PrimeOne Design - 2021
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- - +
PrimeOne Design - 2021
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
- ); -} + + + ); +}; diff --git a/src/main/cliapp/src/AppFooter.js b/src/main/cliapp/src/AppFooter.js index 46f9f5b94..23b41613b 100644 --- a/src/main/cliapp/src/AppFooter.js +++ b/src/main/cliapp/src/AppFooter.js @@ -1,10 +1,5 @@ import React from 'react'; export const AppFooter = () => { - - return ( -
- -
- ); -} + return
; +}; diff --git a/src/main/cliapp/src/AppMenu.js b/src/main/cliapp/src/AppMenu.js index 852838db1..3eb2ca7f1 100644 --- a/src/main/cliapp/src/AppMenu.js +++ b/src/main/cliapp/src/AppMenu.js @@ -2,113 +2,150 @@ import React, { useState } from 'react'; import { NavLink } from 'react-router-dom'; import { CSSTransition } from 'react-transition-group'; import classNames from 'classnames'; -import { Ripple } from "primereact/ripple"; +import { Ripple } from 'primereact/ripple'; import { Badge } from 'primereact/badge'; const AppSubmenu = (props) => { + const [activeIndex, setActiveIndex] = useState(null); - const [activeIndex, setActiveIndex] = useState(null) - - const onMenuItemClick = (event, item, index) => { - //avoid processing disabled items - if (item.disabled) { - event.preventDefault(); - return true; - } - - //execute command - if (item.command) { - item.command({ originalEvent: event, item: item }); - } - - if (index === activeIndex) - setActiveIndex(null); - else - setActiveIndex(index); - - if (props.onMenuItemClick) { - props.onMenuItemClick({ - originalEvent: event, - item: item - }); - } + const onMenuItemClick = (event, item, index) => { + //avoid processing disabled items + if (item.disabled) { + event.preventDefault(); + return true; } - const onKeyDown = (event) => { - if (event.code === 'Enter' || event.code === 'Space') { - event.preventDefault(); - event.target.click(); - } + //execute command + if (item.command) { + item.command({ originalEvent: event, item: item }); } - const renderLinkContent = (item) => { - let submenuIcon = item.items && ; - let badge = item.badge && + if (index === activeIndex) setActiveIndex(null); + else setActiveIndex(index); - return ( - - - {item.label} - {submenuIcon} - {badge} - - - ); + if (props.onMenuItemClick) { + props.onMenuItemClick({ + originalEvent: event, + item: item, + }); } + }; - const renderLink = (item, i) => { - let content = renderLinkContent(item); - - if (item.to) { - return ( - onMenuItemClick(e, item, i)} exact target={item.target}> - {content} - - ) - } - else { - return ( - onMenuItemClick(e, item, i)} target={item.target}> - {content} - - ); - } + const onKeyDown = (event) => { + if (event.code === 'Enter' || event.code === 'Space') { + event.preventDefault(); + event.target.click(); } + }; - let items = props.items && props.items.map((item, i) => { - let active = activeIndex === i; - let styleClass = classNames(item.badgeStyleClass, { 'layout-menuitem-category': props.root, 'active-menuitem': active && !item.to }); + const renderLinkContent = (item) => { + let submenuIcon = item.items && ; + let badge = item.badge && ; - if (props.root) { - return ( -
  • - {props.root === true && -
    {item.label}
    - -
    } -
  • - ); - } - else { - return ( -
  • - {renderLink(item, i)} - - - -
  • - ); - } + return ( + + + {item.label} + {submenuIcon} + {badge} + + + ); + }; + + const renderLink = (item, i) => { + let content = renderLinkContent(item); + + if (item.to) { + return ( + onMenuItemClick(e, item, i)} + exact + target={item.target} + > + {content} + + ); + } else { + return ( + onMenuItemClick(e, item, i)} + target={item.target} + > + {content} + + ); + } + }; + + let items = + props.items && + props.items.map((item, i) => { + let active = activeIndex === i; + let styleClass = classNames(item.badgeStyleClass, { + 'layout-menuitem-category': props.root, + 'active-menuitem': active && !item.to, + }); + + if (props.root) { + return ( +
  • + {props.root === true && ( + +
    + {item.label} +
    + +
    + )} +
  • + ); + } else { + return ( +
  • + {renderLink(item, i)} + + + +
  • + ); + } }); - return items ?
      {items}
    : null; -} + return items ? ( +
      + {items} +
    + ) : null; +}; export const AppMenu = (props) => { - - return ( -
    - -
    - ); -} + return ( +
    + +
    + ); +}; diff --git a/src/main/cliapp/src/AppTopbar.js b/src/main/cliapp/src/AppTopbar.js index 94f04ec19..50aec0935 100644 --- a/src/main/cliapp/src/AppTopbar.js +++ b/src/main/cliapp/src/AppTopbar.js @@ -13,19 +13,20 @@ export const AppTopbar = (props) => { const { apiVersion } = useContext(SiteContext); - var loc = window.location, new_uri; - if (loc.protocol === "https:") { - new_uri = "wss:"; + var loc = window.location, + new_uri; + if (loc.protocol === 'https:') { + new_uri = 'wss:'; } else { - new_uri = "ws:"; + new_uri = 'ws:'; } - if(process.env.NODE_ENV === 'production') { - new_uri += "//" + loc.host; + if (process.env.NODE_ENV === 'production') { + new_uri += '//' + loc.host; } else { - new_uri += "//localhost:8080"; + new_uri += '//localhost:8080'; } - new_uri += loc.pathname + "index_processing_events"; + new_uri += loc.pathname + 'index_processing_events'; useWebSocket(new_uri, { onOpen: () => { //console.log("WS Connection Open"); @@ -33,47 +34,53 @@ export const AppTopbar = (props) => { onMessage: (event) => { let localEvent = JSON.parse(event.data); setProcessingEvent(localEvent); - } + }, }); const processingMessageTemplate = () => { - if(processingEvent) { + if (processingEvent) { return (
    - { processingEvent.message }
    - Started: { new Date(processingEvent.startTime).toLocaleString() }
    - Update: { new Date(processingEvent.lastTime).toLocaleString() }
    - { ProgressIndicator(processingEvent) } + {processingEvent.message} +
    + Started: {new Date(processingEvent.startTime).toLocaleString()} +
    + Update: {new Date(processingEvent.lastTime).toLocaleString()} +
    + {ProgressIndicator(processingEvent)}
    ); } - } + }; const processingMessageStyle = () => { - if(!processingEvent || "duration" in processingEvent) { - return( { display: "none" } ); + if (!processingEvent || 'duration' in processingEvent) { + return { display: 'none' }; } else { //return( { display: "block" } ); } - } + }; const ProgressIndicator = (pe) => { - - if(pe.currentCount && pe.totalSize) { - return - } else if(pe.currentCount && pe.lastCount && pe.lastTime && pe.nowTime) { + if (pe.currentCount && pe.totalSize) { + return ; + } else if (pe.currentCount && pe.lastCount && pe.lastTime && pe.nowTime) { let rate = Math.ceil(((pe.currentCount - pe.lastCount) / (pe.nowTime - pe.lastTime)) * 1000); return ( { - return <>{rate}r/s -- {pe.currentCount} + return ( + <> + {rate}r/s -- {pe.currentCount} + + ); }} /> ); } else { - return + return ; } - } + }; const menuItems = [ { @@ -81,46 +88,61 @@ export const AppTopbar = (props) => { { label: 'Profile', icon: 'pi pi-profile', - command:(e) => { - window.location.hash = "/profile" - } + command: (e) => { + window.location.hash = '/profile'; + }, }, { label: 'Logout', icon: 'pi pi-sign-out', - command: props.logout - } - ] - } + command: props.logout, + }, + ], + }, ]; return ( -
    - { - props.authState?.isAuthenticated && - <> - - AGR Curation: {apiVersion?.version} - - - - } - - - { - props.authState?.isAuthenticated && -
      -
    • - - menu.current.toggle(event)} aria-controls="popup_menu" aria-haspopup /> -
    • -
    - } -
    +
    + {props.authState?.isAuthenticated && ( + <> + + AGR Curation: {apiVersion?.version} + + + + )} + + + {props.authState?.isAuthenticated && ( +
      +
    • + + menu.current.toggle(event)} + aria-controls="popup_menu" + aria-haspopup + /> +
    • +
    + )} +
    ); - -} +}; diff --git a/src/main/cliapp/src/Login.js b/src/main/cliapp/src/Login.js index 39fd12334..410d4e67d 100644 --- a/src/main/cliapp/src/Login.js +++ b/src/main/cliapp/src/Login.js @@ -6,7 +6,6 @@ import { oktaSignInConfig } from './oktaAuthConfig'; export const Login = ({ children }) => { const { oktaAuth, authState } = useOktaAuth(); - const onSuccess = (tokens) => { oktaAuth.handleLoginRedirect(tokens); }; @@ -15,5 +14,9 @@ export const Login = ({ children }) => { console.log('error logging in', err); }; - return authState?.isAuthenticated ? children : ; + return authState?.isAuthenticated ? ( + children + ) : ( + + ); }; diff --git a/src/main/cliapp/src/OktaSignInWidget.js b/src/main/cliapp/src/OktaSignInWidget.js index 5ae54284a..11ceb20f6 100644 --- a/src/main/cliapp/src/OktaSignInWidget.js +++ b/src/main/cliapp/src/OktaSignInWidget.js @@ -5,18 +5,20 @@ import '@okta/okta-signin-widget/dist/css/okta-sign-in.min.css'; const OktaSignInWidget = ({ config, onSuccess, onError }) => { const widgetRef = useRef(); useEffect(() => { - if (!widgetRef.current) - return false; - + if (!widgetRef.current) return false; + const widget = new OktaSignIn(config); - widget.showSignInToGetTokens({ - el: widgetRef.current, - }).then(onSuccess).catch(onError); + widget + .showSignInToGetTokens({ + el: widgetRef.current, + }) + .then(onSuccess) + .catch(onError); return () => widget.remove(); }, [config, onSuccess, onError]); - return (
    ); + return
    ; }; export default OktaSignInWidget; diff --git a/src/main/cliapp/src/ScrollToTop.js b/src/main/cliapp/src/ScrollToTop.js index 79bbb4163..9476d8078 100644 --- a/src/main/cliapp/src/ScrollToTop.js +++ b/src/main/cliapp/src/ScrollToTop.js @@ -2,14 +2,13 @@ import { useEffect } from 'react'; import { useLocation, withRouter } from 'react-router-dom'; const ScrollToTop = (props) => { + let location = useLocation(); - let location = useLocation(); + useEffect(() => { + window.scrollTo(0, 0); + }, [location]); - useEffect(() => { - window.scrollTo(0, 0) - }, [location]); - - return props.children; -} + return props.children; +}; export default withRouter(ScrollToTop); diff --git a/src/main/cliapp/src/components/Actions/DeletionAction.js b/src/main/cliapp/src/components/Actions/DeletionAction.js index a03ff1e1e..bb2f72536 100644 --- a/src/main/cliapp/src/components/Actions/DeletionAction.js +++ b/src/main/cliapp/src/components/Actions/DeletionAction.js @@ -1,8 +1,7 @@ -import { Button } from "primereact/button"; +import { Button } from 'primereact/button'; export const DeleteAction = ({ disabled, deletionHandler, id }) => { - return ( -
    ); - } + }; const handleDeleteConditionRelation = (event, props) => { let _localConditionRelations = global.structuredClone(localConditionRelations); - if(props.dataKey){ + if (props.dataKey) { _localConditionRelations.splice(props.dataKey, 1); - }else { + } else { _localConditionRelations.splice(props.rowIndex, 1); } setLocalConditionRelations(_localConditionRelations); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); diff --git a/src/main/cliapp/src/components/Dashboard.js b/src/main/cliapp/src/components/Dashboard.js index 51b7bbeae..48867306a 100644 --- a/src/main/cliapp/src/components/Dashboard.js +++ b/src/main/cliapp/src/components/Dashboard.js @@ -4,325 +4,382 @@ import { Button } from 'primereact/button'; import { Chart } from 'primereact/chart'; const lineData = { - labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], - datasets: [ - { - label: 'First Dataset', - data: [65, 59, 80, 81, 56, 55, 40], - fill: false, - backgroundColor: '#2f4860', - borderColor: '#2f4860', - tension: .4 - }, - { - label: 'Second Dataset', - data: [28, 48, 40, 19, 86, 27, 90], - fill: false, - backgroundColor: '#00bb7e', - borderColor: '#00bb7e', - tension: .4 - } - ] + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], + datasets: [ + { + label: 'First Dataset', + data: [65, 59, 80, 81, 56, 55, 40], + fill: false, + backgroundColor: '#2f4860', + borderColor: '#2f4860', + tension: 0.4, + }, + { + label: 'Second Dataset', + data: [28, 48, 40, 19, 86, 27, 90], + fill: false, + backgroundColor: '#00bb7e', + borderColor: '#00bb7e', + tension: 0.4, + }, + ], }; const Dashboard = (props) => { - const menu1 = useRef(null); - const menu2 = useRef(null); - const [lineOptions, setLineOptions] = useState(null) + const menu1 = useRef(null); + const menu2 = useRef(null); + const [lineOptions, setLineOptions] = useState(null); - const applyLightTheme = () => { - const lineOptions = { - plugins: { - legend: { - labels: { - color: '#495057' - } - } - }, - scales: { - x: { - ticks: { - color: '#495057' - }, - grid: { - color: '#ebedef', - } - }, - y: { - ticks: { - color: '#495057' - }, - grid: { - color: '#ebedef', - } - }, - } - }; + const applyLightTheme = () => { + const lineOptions = { + plugins: { + legend: { + labels: { + color: '#495057', + }, + }, + }, + scales: { + x: { + ticks: { + color: '#495057', + }, + grid: { + color: '#ebedef', + }, + }, + y: { + ticks: { + color: '#495057', + }, + grid: { + color: '#ebedef', + }, + }, + }, + }; - setLineOptions(lineOptions) - } + setLineOptions(lineOptions); + }; - const applyDarkTheme = () => { - const lineOptions = { - plugins: { - legend: { - labels: { - color: '#ebedef' - } - } - }, - scales: { - x: { - ticks: { - color: '#ebedef' - }, - grid: { - color: 'rgba(160, 167, 181, .3)', - } - }, - y: { - ticks: { - color: '#ebedef' - }, - grid: { - color: 'rgba(160, 167, 181, .3)', - } - }, - } - }; + const applyDarkTheme = () => { + const lineOptions = { + plugins: { + legend: { + labels: { + color: '#ebedef', + }, + }, + }, + scales: { + x: { + ticks: { + color: '#ebedef', + }, + grid: { + color: 'rgba(160, 167, 181, .3)', + }, + }, + y: { + ticks: { + color: '#ebedef', + }, + grid: { + color: 'rgba(160, 167, 181, .3)', + }, + }, + }, + }; - setLineOptions(lineOptions) - } + setLineOptions(lineOptions); + }; - useEffect(() => { - if (props.colorMode === 'light') { - applyLightTheme(); - } else { - applyDarkTheme(); - } - }, [props.colorMode]); + useEffect(() => { + if (props.colorMode === 'light') { + applyLightTheme(); + } else { + applyDarkTheme(); + } + }, [props.colorMode]); - return ( -
    -
    -
    -
    -
    - Orders -
    152
    -
    -
    - -
    -
    - 24 new - since last visit -
    + return ( +
    +
    +
    +
    +
    + Orders +
    152
    -
    -
    -
    -
    - Revenue -
    $2.100
    -
    -
    - -
    -
    - %52+ - since last week -
    +
    +
    -
    -
    -
    -
    - Customers -
    28441
    -
    -
    - -
    -
    - 520 - newly registered -
    +
    + 24 new + since last visit +
    +
    +
    +
    +
    +
    + Revenue +
    $2.100
    -
    -
    -
    -
    - Comments -
    152 Unread
    -
    -
    - -
    -
    - 85 - responded -
    +
    +
    - -
    -
    -
    -
    Best Selling Products
    -
    -
    -
    -
      -
    • -
      - Space T-Shirt -
      Clothing
      -
      -
      -
      -
      -
      - %50 -
      -
    • -
    • -
      - Portal Sticker -
      Accessories
      -
      -
      -
      -
      -
      - %16 -
      -
    • -
    • -
      - Supernova Sticker -
      Accessories
      -
      -
      -
      -
      -
      - %67 -
      -
    • -
    • -
      - Wonders Notebook -
      Office
      -
      -
      -
      -
      -
      - %35 -
      -
    • -
    • -
      - Mat Black Case -
      Accessories
      -
      -
      -
      -
      -
      - %75 -
      -
    • -
    • -
      - Robots T-Shirt -
      Clothing
      -
      -
      -
      -
      -
      - %40 -
      -
    • -
    -
    +
    + %52+ + since last week +
    +
    +
    +
    +
    +
    + Customers +
    28441
    +
    +
    +
    +
    + 520 + newly registered +
    +
    +
    +
    +
    +
    + Comments +
    152 Unread
    +
    +
    + +
    +
    + 85 + responded +
    +
    -
    -
    -
    Sales Overview
    - +
    +
    +
    +
    Best Selling Products
    +
    +
    +
    +
      +
    • +
      + Space T-Shirt +
      Clothing
      +
      +
      +
      +
      - -
      -
      -
      Notifications
      -
      -
      -
      - - TODAY -
        -
      • -
        - -
        - Richard Jones - has purchased a blue t-shirt for 79$ - -
      • -
      • -
        - -
        - Your request for withdrawal of 2500$ has been initiated. -
      • -
      - - YESTERDAY -
        -
      • -
        - -
        - Keyser Wick - has purchased a black jacket for 59$ - -
      • -
      • -
        - -
        - Jane Davis - has posted a new questions about your product. - -
      • -
      + %50 +
      +
    • +
    • +
      + Portal Sticker +
      Accessories
      +
      +
      +
      +
      +
      + %16 +
      +
    • +
    • +
      + Supernova Sticker +
      Accessories
      +
      +
      +
      +
      +
      + %67 +
      +
    • +
    • +
      + Wonders Notebook +
      Office
      +
      +
      +
      +
      -
      -
      -
      TAKE THE NEXT STEP
      -
      Try PrimeBlocks
      -
      - + %35 +
      +
    • +
    • +
      + Mat Black Case +
      Accessories
      +
      +
      +
      +
      + %75 +
      +
    • +
    • +
      + Robots T-Shirt +
      Clothing
      +
      +
      +
      +
      +
      + %40 +
      +
    • +
    +
    +
    + +
    +
    +
    Sales Overview
    + +
    + +
    +
    +
    Notifications
    +
    +
    +
    + + TODAY +
      +
    • +
      + +
      + + Richard Jones + + {' '} + has purchased a blue t-shirt for 79$ + + +
    • +
    • +
      + +
      + + Your request for withdrawal of 2500$ has been + initiated. + +
    • +
    + + YESTERDAY +
      +
    • +
      + +
      + + Keyser Wick + + {' '} + has purchased a black jacket for 59$ + + +
    • +
    • +
      + +
      + + Jane Davis + has posted a new questions about your product. + +
    • +
    - ); -} +
    +
    +
    TAKE THE NEXT STEP
    +
    Try PrimeBlocks
    +
    + +
    +
    +
    + ); +}; const comparisonFn = function (prevProps, nextProps) { - return (prevProps.location.pathname === nextProps.location.pathname) && (prevProps.colorMode === nextProps.colorMode); + return prevProps.location.pathname === nextProps.location.pathname && prevProps.colorMode === nextProps.colorMode; }; export default React.memo(Dashboard, comparisonFn); diff --git a/src/main/cliapp/src/components/DataTableHeaderFooterTemplate.js b/src/main/cliapp/src/components/DataTableHeaderFooterTemplate.js index 3881af213..3a477ba04 100644 --- a/src/main/cliapp/src/components/DataTableHeaderFooterTemplate.js +++ b/src/main/cliapp/src/components/DataTableHeaderFooterTemplate.js @@ -1,39 +1,46 @@ -import React from "react"; +import React from 'react'; import { Card } from 'primereact/card'; -import { Splitter, SplitterPanel } from "primereact/splitter"; -import { ConfirmButton } from "./ConfirmButton"; +import { Splitter, SplitterPanel } from 'primereact/splitter'; +import { ConfirmButton } from './ConfirmButton'; -export function DataTableHeaderFooterTemplate({title, multiselectComponent, buttons, resetTableState, isInEditMode, modReset, setToModDefault}){ - - return ( - - - -

    {title}

    -
    - - {multiselectComponent}  - {buttons} - - {modReset && - - } - -
    -
    - ) +export function DataTableHeaderFooterTemplate({ + title, + multiselectComponent, + buttons, + resetTableState, + isInEditMode, + modReset, + setToModDefault, +}) { + return ( + + + +

    {title}

    +
    + + {multiselectComponent}  + {buttons} + + {modReset && ( + + )} + +
    +
    + ); } diff --git a/src/main/cliapp/src/components/DetailMessage.js b/src/main/cliapp/src/components/DetailMessage.js index 714083523..bd456036f 100644 --- a/src/main/cliapp/src/components/DetailMessage.js +++ b/src/main/cliapp/src/components/DetailMessage.js @@ -1,8 +1,16 @@ -import { Message } from "primereact/message"; -import { Link } from "react-router-dom/cjs/react-router-dom.min"; +import { Message } from 'primereact/message'; +import { Link } from 'react-router-dom/cjs/react-router-dom.min'; export const DetailMessage = ({ identifier, text, display }) => { - if (!display || !identifier || !text) return null; - return ( - {text}} /> - ); -}; \ No newline at end of file + if (!display || !identifier || !text) return null; + return ( + + {text} + + } + /> + ); +}; diff --git a/src/main/cliapp/src/components/EditMessageTooltip.js b/src/main/cliapp/src/components/EditMessageTooltip.js index 843a25bd3..7d836727e 100644 --- a/src/main/cliapp/src/components/EditMessageTooltip.js +++ b/src/main/cliapp/src/components/EditMessageTooltip.js @@ -1,13 +1,16 @@ -import React from "react"; -import {Tooltip} from "primereact/tooltip"; +import React from 'react'; +import { Tooltip } from 'primereact/tooltip'; -export const EditMessageTooltip = ({object = "annotation"}) => { +export const EditMessageTooltip = ({ object = 'annotation' }) => { return ( <> - - - + + + - ) + ); }; diff --git a/src/main/cliapp/src/components/Editors/ControlledVocabularyEditor.js b/src/main/cliapp/src/components/Editors/ControlledVocabularyEditor.js index 1596dc6c6..e08f15709 100644 --- a/src/main/cliapp/src/components/Editors/ControlledVocabularyEditor.js +++ b/src/main/cliapp/src/components/Editors/ControlledVocabularyEditor.js @@ -1,31 +1,31 @@ -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { useControlledVocabularyService } from "../../service/useControlledVocabularyService"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { ControlledVocabularyDropdown } from '../ControlledVocabularySelector'; export const ControlledVocabularyEditor = ({ - props, - onChangeHandler, - errorMessages, - dataKey, - vocabType, - field, - showClear, - optionLabel="name" + props, + onChangeHandler, + errorMessages, + dataKey, + vocabType, + field, + showClear, + optionLabel = 'name', }) => { - const vocabTerms = useControlledVocabularyService(vocabType); + const vocabTerms = useControlledVocabularyService(vocabType); - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/EvidenceCodeEditor.js b/src/main/cliapp/src/components/Editors/EvidenceCodeEditor.js index 4fe971f9a..a44ac3d32 100644 --- a/src/main/cliapp/src/components/Editors/EvidenceCodeEditor.js +++ b/src/main/cliapp/src/components/Editors/EvidenceCodeEditor.js @@ -1,48 +1,51 @@ -import { AutocompleteEditor } from "../Autocomplete/AutocompleteEditor"; -import { buildAutocompleteFilter, autocompleteSearch } from "../../utils/utils"; -import { SearchService } from "../../service/SearchService"; -import { EvidenceAutocompleteTemplate } from "../Autocomplete/EvidenceAutocompleteTemplate"; -import { ErrorMessageComponent } from "../Error/ErrorMessageComponent"; +import { AutocompleteEditor } from '../Autocomplete/AutocompleteEditor'; +import { buildAutocompleteFilter, autocompleteSearch } from '../../utils/utils'; +import { SearchService } from '../../service/SearchService'; +import { EvidenceAutocompleteTemplate } from '../Autocomplete/EvidenceAutocompleteTemplate'; +import { ErrorMessageComponent } from '../Error/ErrorMessageComponent'; const evidenceSearch = (event, setFiltered, setInputValue) => { - const searchService = new SearchService(); - const autocompleteFields = ["curie", "name", "abbreviation"]; - const endpoint = "ecoterm"; - const filterName = "evidenceFilter"; - const filter = buildAutocompleteFilter(event, autocompleteFields); - const otherFilters = { - obsoleteFilter: { - "obsolete": { - queryString: false - } - }, - subsetFilter: { - "subsets": { - queryString: "agr_eco_terms" - } - } - }; + const searchService = new SearchService(); + const autocompleteFields = ['curie', 'name', 'abbreviation']; + const endpoint = 'ecoterm'; + const filterName = 'evidenceFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); + const otherFilters = { + obsoleteFilter: { + obsolete: { + queryString: false, + }, + }, + subsetFilter: { + subsets: { + queryString: 'agr_eco_terms', + }, + }, + }; - setInputValue(event.query); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); + setInputValue(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); }; export const EvidenceCodeEditor = ({ props, errorMessages, onChangeHandler, dataKey }) => { - return ( - <> - - } - onValueChangeHandler={onChangeHandler} - /> - - - ); + return ( + <> + ( + + )} + onValueChangeHandler={onChangeHandler} + /> + + + ); }; diff --git a/src/main/cliapp/src/components/Editors/EvidenceEditor.js b/src/main/cliapp/src/components/Editors/EvidenceEditor.js index 6bd934415..cc788d0cf 100644 --- a/src/main/cliapp/src/components/Editors/EvidenceEditor.js +++ b/src/main/cliapp/src/components/Editors/EvidenceEditor.js @@ -1,19 +1,19 @@ -import { AutocompleteMultiEditor } from "../Autocomplete/AutocompleteMultiEditor"; +import { AutocompleteMultiEditor } from '../Autocomplete/AutocompleteMultiEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; import { LiteratureAutocompleteTemplate } from '../Autocomplete/LiteratureAutocompleteTemplate'; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; const evidenceSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "evidenceFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'evidenceFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} +}; export const EvidenceEditor = ({ props, errorMessages, onChange, dataKey }) => { return ( <> @@ -21,16 +21,19 @@ export const EvidenceEditor = ({ props, errorMessages, onChange, dataKey }) => { search={evidenceSearch} initialValue={props?.rowData?.evidence} rowProps={props} - fieldName='evidence' - subField='curie' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="evidence" + subField="curie" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onChange} /> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/FunctionalImpactsEditor.js b/src/main/cliapp/src/components/Editors/FunctionalImpactsEditor.js index dea1d5497..47be862dc 100644 --- a/src/main/cliapp/src/components/Editors/FunctionalImpactsEditor.js +++ b/src/main/cliapp/src/components/Editors/FunctionalImpactsEditor.js @@ -1,20 +1,20 @@ -import { AutocompleteMultiEditor } from "../Autocomplete/AutocompleteMultiEditor"; +import { AutocompleteMultiEditor } from '../Autocomplete/AutocompleteMultiEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; -import { VocabTermAutocompleteTemplate } from "../Autocomplete/VocabTermAutocompleteTemplate"; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; +import { VocabTermAutocompleteTemplate } from '../Autocomplete/VocabTermAutocompleteTemplate'; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; const functionalImpactSearch = (event, setFiltered, setQuery) => { const searchService = new SearchService(); - const autocompleteFields = ["name"]; - const endpoint = "vocabularyterm"; - const filterName = "functionalImpactFilter"; + const autocompleteFields = ['name']; + const endpoint = 'vocabularyterm'; + const filterName = 'functionalImpactFilter'; const otherFilters = { vocabularyFilter: { - "vocabulary.vocabularyLabel": { - queryString: "allele_functional_impact" - } - } + 'vocabulary.vocabularyLabel': { + queryString: 'allele_functional_impact', + }, + }, }; setQuery(event.query); const filter = buildAutocompleteFilter(event, autocompleteFields); @@ -27,16 +27,19 @@ export const FunctionalImpactsEditor = ({ props, errorMessages, onChange, dataKe search={functionalImpactSearch} initialValue={props?.rowData?.functionalImpacts} rowProps={props} - fieldName='functionalImpacts' - subField='name' - valueDisplay={(item, setAutocompleteSelectedItem, op, query) => - } + fieldName="functionalImpacts" + subField="name" + valueDisplay={(item, setAutocompleteSelectedItem, op, query) => ( + + )} onValueChangeHandler={onChange} /> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/GeneEditor.js b/src/main/cliapp/src/components/Editors/GeneEditor.js index 1b0b9ae5b..78f855864 100644 --- a/src/main/cliapp/src/components/Editors/GeneEditor.js +++ b/src/main/cliapp/src/components/Editors/GeneEditor.js @@ -1,19 +1,28 @@ import { AutocompleteEditor } from '../Autocomplete/AutocompleteEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; -import { SubjectAutocompleteTemplate } from '../Autocomplete/SubjectAutocompleteTemplate'; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { getIdentifier } from "../../utils/utils"; +import { SubjectAutocompleteTemplate } from '../Autocomplete/SubjectAutocompleteTemplate'; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { getIdentifier } from '../../utils/utils'; const geneSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); const autocompleteFields = [ - "curie", "modEntityId", "crossReferences.referencedCurie", "geneFullName.formatText", "geneFullName.displayText", - "geneSymbol.formatText", "geneSymbol.displayText", "geneSynonyms.formatText", "geneSynonyms.displayText", - "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSecondaryIds.secondaryId" + 'curie', + 'modEntityId', + 'crossReferences.referencedCurie', + 'geneFullName.formatText', + 'geneFullName.displayText', + 'geneSymbol.formatText', + 'geneSymbol.displayText', + 'geneSynonyms.formatText', + 'geneSynonyms.displayText', + 'geneSystematicName.formatText', + 'geneSystematicName.displayText', + 'geneSecondaryIds.secondaryId', ]; - const endpoint = "gene"; - const filterName = "objectFilter"; + const endpoint = 'gene'; + const filterName = 'objectFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); @@ -29,14 +38,17 @@ export const GeneEditor = ({ props, errorMessages, onChange, dataKey, fieldName rowProps={props} fieldName={fieldName} subField="modEntityId" - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } - onValueChangeHandler={onChange} - /> - ( + + )} + onValueChangeHandler={onChange} /> + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/InternalEditor.js b/src/main/cliapp/src/components/Editors/InternalEditor.js index 334915666..a2bc826b9 100644 --- a/src/main/cliapp/src/components/Editors/InternalEditor.js +++ b/src/main/cliapp/src/components/Editors/InternalEditor.js @@ -1,20 +1,20 @@ -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { useControlledVocabularyService } from "../../service/useControlledVocabularyService"; -import { TrueFalseDropdown } from "../TrueFalseDropDownSelector"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; +import { TrueFalseDropdown } from '../TrueFalseDropDownSelector'; export const InternalEditor = ({ props, internalOnChangeHandler, errorMessages, dataKey }) => { - const booleanTerms = useControlledVocabularyService("generic_boolean_terms"); + const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/MutationTypesEditor.js b/src/main/cliapp/src/components/Editors/MutationTypesEditor.js index 0d5054be3..190a3e4ed 100644 --- a/src/main/cliapp/src/components/Editors/MutationTypesEditor.js +++ b/src/main/cliapp/src/components/Editors/MutationTypesEditor.js @@ -1,14 +1,14 @@ -import { AutocompleteMultiEditor } from "../Autocomplete/AutocompleteMultiEditor"; +import { AutocompleteMultiEditor } from '../Autocomplete/AutocompleteMultiEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; -import { SubjectAutocompleteTemplate } from "../Autocomplete/SubjectAutocompleteTemplate"; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; +import { SubjectAutocompleteTemplate } from '../Autocomplete/SubjectAutocompleteTemplate'; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; const mutationTypeSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); - const autocompleteFields = ["name", "curie"]; - const endpoint = "soterm"; - const filterName = "mutationTypeFilter"; + const autocompleteFields = ['name', 'curie']; + const endpoint = 'soterm'; + const filterName = 'mutationTypeFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); @@ -21,16 +21,19 @@ export const MutationTypesEditor = ({ props, errorMessages, onChange, dataKey }) search={mutationTypeSearch} initialValue={props?.rowData?.mutationTypes} rowProps={props} - fieldName='mutationTypes' - subField='curie' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="mutationTypes" + subField="curie" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onChange} /> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/NotEditor.js b/src/main/cliapp/src/components/Editors/NotEditor.js index 75e8a6264..6fbeee219 100644 --- a/src/main/cliapp/src/components/Editors/NotEditor.js +++ b/src/main/cliapp/src/components/Editors/NotEditor.js @@ -1,33 +1,31 @@ import React, { useState } from 'react'; -import { Dropdown } from "primereact/dropdown"; +import { Dropdown } from 'primereact/dropdown'; export function NotEditor({ props, value, editorChange }) { const [selectedValue, setSelectedValue] = useState(value); - const textString = selectedValue ? "NOT" : ""; - const options = [ - { label: "NOT", value: true }, - ]; + const textString = selectedValue ? 'NOT' : ''; + const options = [{ label: 'NOT', value: true }]; const onChange = (e) => { let event; - if(e.value === undefined){ + if (e.value === undefined) { event = { target: { value: false, - name: e.target.name - } - } + name: e.target.name, + }, + }; } else { event = e; } setSelectedValue(event.target.value); editorChange(event, props); - } + }; return ( <> { - const booleanTerms = useControlledVocabularyService("generic_boolean_terms"); + const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/PhenotypeTermEditor.js b/src/main/cliapp/src/components/Editors/PhenotypeTermEditor.js index 11736fb3f..08e3e282e 100644 --- a/src/main/cliapp/src/components/Editors/PhenotypeTermEditor.js +++ b/src/main/cliapp/src/components/Editors/PhenotypeTermEditor.js @@ -1,13 +1,13 @@ import { AutocompleteEditor } from '../Autocomplete/AutocompleteEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; const phenotypeTermSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); - const autocompleteFields = ["name", "curie"]; - const endpoint = "phenotypeterm"; - const filterName = "phenotypeTermFilter"; + const autocompleteFields = ['name', 'curie']; + const endpoint = 'phenotypeterm'; + const filterName = 'phenotypeTermFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); @@ -20,13 +20,10 @@ export const PhenotypeTermEditor = ({ props, errorMessages, onChange, dataKey }) search={phenotypeTermSearch} initialValue={props.rowData.phenotypeTerm?.curie} rowProps={props} - fieldName='phenotypeTerm' + fieldName="phenotypeTerm" onValueChangeHandler={onChange} /> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/ReferencesEditor.js b/src/main/cliapp/src/components/Editors/ReferencesEditor.js index d7e059921..dfe3c89c6 100644 --- a/src/main/cliapp/src/components/Editors/ReferencesEditor.js +++ b/src/main/cliapp/src/components/Editors/ReferencesEditor.js @@ -1,19 +1,19 @@ -import { AutocompleteMultiEditor } from "../Autocomplete/AutocompleteMultiEditor"; +import { AutocompleteMultiEditor } from '../Autocomplete/AutocompleteMultiEditor'; import { SearchService } from '../../service/SearchService'; import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { LiteratureAutocompleteTemplate } from "../Autocomplete/LiteratureAutocompleteTemplate"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { LiteratureAutocompleteTemplate } from '../Autocomplete/LiteratureAutocompleteTemplate'; const referenceSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "referencesFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'referencesFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} +}; export const ReferencesEditor = ({ props, errorMessages, onChange, dataKey }) => { return ( @@ -22,16 +22,19 @@ export const ReferencesEditor = ({ props, errorMessages, onChange, dataKey }) => search={referenceSearch} initialValue={props?.rowData?.references} rowProps={props} - fieldName='references' - subField='curie' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="references" + subField="curie" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onChange} /> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/RelatedNoteEditor.js b/src/main/cliapp/src/components/Editors/RelatedNoteEditor.js index f931f0fdc..7bc3a9dd9 100644 --- a/src/main/cliapp/src/components/Editors/RelatedNoteEditor.js +++ b/src/main/cliapp/src/components/Editors/RelatedNoteEditor.js @@ -4,59 +4,68 @@ import { Button } from 'primereact/button'; import { EditMessageTooltip } from '../EditMessageTooltip'; export const RelatedNoteEditor = ({ rowProps, relatedNote, errorMessages, setRelatedNotesData, dataKey }) => { + const handleRelatedNotesOpenInEdit = (event, rows, rowIndex) => { + event.preventDefault(); + let _relatedNotesData = {}; + _relatedNotesData['originalRelatedNotes'] = relatedNote ? [relatedNote] : undefined; + _relatedNotesData['dialogIsVisible'] = true; + _relatedNotesData['dataKey'] = dataKey; + _relatedNotesData['errorMessages'] = errorMessages; + _relatedNotesData['rowProps'] = rowProps; + setRelatedNotesData(() => ({ + ..._relatedNotesData, + })); + }; - const handleRelatedNotesOpenInEdit = (event, rows, rowIndex) => { - event.preventDefault(); - let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = relatedNote ? [relatedNote] : undefined; - _relatedNotesData["dialogIsVisible"] = true; - _relatedNotesData["dataKey"] = dataKey; - _relatedNotesData["errorMessages"] = errorMessages; - _relatedNotesData["rowProps"] = rowProps; - setRelatedNotesData(() => ({ - ..._relatedNotesData - })); - }; - - if (relatedNote) { - return ( - <> -
    - -
    - - - ); - } else { - return ( - <> -
    - -
    - - - ); - } -}; \ No newline at end of file + if (relatedNote) { + return ( + <> +
    + +
    + + + ); + } else { + return ( + <> +
    + +
    + + + ); + } +}; diff --git a/src/main/cliapp/src/components/Editors/TableInputTextAreaEditor.js b/src/main/cliapp/src/components/Editors/TableInputTextAreaEditor.js index 82ea7708f..6df9fea97 100644 --- a/src/main/cliapp/src/components/Editors/TableInputTextAreaEditor.js +++ b/src/main/cliapp/src/components/Editors/TableInputTextAreaEditor.js @@ -1,14 +1,23 @@ -import { InputTextarea } from "primereact/inputtextarea"; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { useState } from "react"; +import { InputTextarea } from 'primereact/inputtextarea'; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { useState } from 'react'; -export const TableInputTextAreaEditor = ({ value, errorMessages, textOnChangeHandler, rowIndex, dataKey, field, rows, columns }) => { +export const TableInputTextAreaEditor = ({ + value, + errorMessages, + textOnChangeHandler, + rowIndex, + dataKey, + field, + rows, + columns, +}) => { const [localValue, setLocalValue] = useState(value); const onChange = (e) => { setLocalValue(e.target.value); - textOnChangeHandler(rowIndex, e, field) - } + textOnChangeHandler(rowIndex, e, field); + }; return ( <> @@ -23,4 +32,4 @@ export const TableInputTextAreaEditor = ({ value, errorMessages, textOnChangeHan ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/TableInputTextEditor.js b/src/main/cliapp/src/components/Editors/TableInputTextEditor.js index 6bf6f51e3..b5febb0a2 100644 --- a/src/main/cliapp/src/components/Editors/TableInputTextEditor.js +++ b/src/main/cliapp/src/components/Editors/TableInputTextEditor.js @@ -1,23 +1,19 @@ -import { InputText } from "primereact/inputtext"; -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; -import { useState } from "react"; +import { InputText } from 'primereact/inputtext'; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; +import { useState } from 'react'; export const TableInputTextEditor = ({ value, errorMessages, dataKey, textOnChangeHandler, rowIndex, field }) => { const [localValue, setLocalValue] = useState(value); const onChange = (e) => { setLocalValue(e.target.value); - textOnChangeHandler(rowIndex, e, field) - } + textOnChangeHandler(rowIndex, e, field); + }; return ( <> - + ); -}; \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/Editors/VocabularyTermSetEditor.js b/src/main/cliapp/src/components/Editors/VocabularyTermSetEditor.js index b6fa8d308..d51c041df 100644 --- a/src/main/cliapp/src/components/Editors/VocabularyTermSetEditor.js +++ b/src/main/cliapp/src/components/Editors/VocabularyTermSetEditor.js @@ -1,33 +1,33 @@ -import { DialogErrorMessageComponent } from "../Error/DialogErrorMessageComponent"; +import { DialogErrorMessageComponent } from '../Error/DialogErrorMessageComponent'; import { ControlledVocabularyDropdown } from '../ControlledVocabularySelector'; -import { useVocabularyTermSetService } from "../../service/useVocabularyTermSetService"; +import { useVocabularyTermSetService } from '../../service/useVocabularyTermSetService'; export const VocabularyTermSetEditor = ({ - props, - onChangeHandler, - errorMessages, - dataKey, - vocabType, - field, - showClear, - optionLabel="name", - placeholder + props, + onChangeHandler, + errorMessages, + dataKey, + vocabType, + field, + showClear, + optionLabel = 'name', + placeholder, }) => { - const vocabTerms = useVocabularyTermSetService(vocabType); + const vocabTerms = useVocabularyTermSetService(vocabType); - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/__tests__/NotEditor.test.js b/src/main/cliapp/src/components/Editors/__tests__/NotEditor.test.js index bb1c66886..a6f2a83a7 100644 --- a/src/main/cliapp/src/components/Editors/__tests__/NotEditor.test.js +++ b/src/main/cliapp/src/components/Editors/__tests__/NotEditor.test.js @@ -3,62 +3,57 @@ import { NotEditor } from '../NotEditor'; import '../../../tools/jest/setupTests'; describe('NotEditor', () => { - it('should display "NOT" as the placeholder text when the initial value is true', () => { - const props = {}; - const value = true; - const editorChange = jest.fn(); - - const result = render(); - - expect(result.getAllByText("NOT")).toHaveLength(2); - }); - - it('should render a Dropdown component with no options when value prop is undefined', () => { - const props = {}; - const value = undefined; - const editorChange = jest.fn(); - - const result = render(); - - - expect(result.getByText("empty")).toBeInTheDocument(); - }); - - it('should update the selected value when an option is selected', () => { - const props = {}; - const value = false; - const editorChange = jest.fn(); - - - const result = render(); - const span = result.container.getElementsByTagName('span')[0]; - - expect(within(span).getByText('empty')).toBeInTheDocument(); - - fireEvent.click(span); - - const option = result.getAllByText('NOT'); - fireEvent.click(option[0]); - const updatedSpan = result.container.getElementsByTagName('span')[0]; - - - expect(within(updatedSpan).getByText('NOT')).toBeInTheDocument(); - }); - - it('should call editorChange when an option is selected', () => { - const props = {}; - const value = false; - const editorChange = jest.fn(); - const result = render(); - const span = result.container.getElementsByTagName('span')[0]; - - fireEvent.click(span); - - - const option = result.getAllByText('NOT'); - fireEvent.click(option[0]); - - expect(editorChange).toHaveBeenCalledTimes(1); - }); - -}); \ No newline at end of file + it('should display "NOT" as the placeholder text when the initial value is true', () => { + const props = {}; + const value = true; + const editorChange = jest.fn(); + + const result = render(); + + expect(result.getAllByText('NOT')).toHaveLength(2); + }); + + it('should render a Dropdown component with no options when value prop is undefined', () => { + const props = {}; + const value = undefined; + const editorChange = jest.fn(); + + const result = render(); + + expect(result.getByText('empty')).toBeInTheDocument(); + }); + + it('should update the selected value when an option is selected', () => { + const props = {}; + const value = false; + const editorChange = jest.fn(); + + const result = render(); + const span = result.container.getElementsByTagName('span')[0]; + + expect(within(span).getByText('empty')).toBeInTheDocument(); + + fireEvent.click(span); + + const option = result.getAllByText('NOT'); + fireEvent.click(option[0]); + const updatedSpan = result.container.getElementsByTagName('span')[0]; + + expect(within(updatedSpan).getByText('NOT')).toBeInTheDocument(); + }); + + it('should call editorChange when an option is selected', () => { + const props = {}; + const value = false; + const editorChange = jest.fn(); + const result = render(); + const span = result.container.getElementsByTagName('span')[0]; + + fireEvent.click(span); + + const option = result.getAllByText('NOT'); + fireEvent.click(option[0]); + + expect(editorChange).toHaveBeenCalledTimes(1); + }); +}); diff --git a/src/main/cliapp/src/components/Editors/boolean/BooleanFormEditor.js b/src/main/cliapp/src/components/Editors/boolean/BooleanFormEditor.js index 174f20613..d48f25046 100644 --- a/src/main/cliapp/src/components/Editors/boolean/BooleanFormEditor.js +++ b/src/main/cliapp/src/components/Editors/boolean/BooleanFormEditor.js @@ -2,43 +2,42 @@ import { FormErrorMessageComponent } from '../../Error/FormErrorMessageComponent import { Dropdown } from 'primereact/dropdown'; import { BooleanAdditionalFieldData } from '../../FieldData/BooleanAdditionalFieldData'; import { FormFieldWrapper } from '../../FormFieldWrapper'; -import { useControlledVocabularyService } from "../../../service/useControlledVocabularyService"; +import { useControlledVocabularyService } from '../../../service/useControlledVocabularyService'; export const BooleanFormEditor = ({ - value, - name, - label, - onValueChange, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, - errorMessages, - showClear=false + value, + name, + label, + onValueChange, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, + errorMessages, + showClear = false, }) => { + const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); - const booleanTerms = useControlledVocabularyService("generic_boolean_terms"); - - return ( - <> - - } - errorField={} - additionalDataField={} - /> - - ); -}; \ No newline at end of file + return ( + <> + + } + errorField={} + additionalDataField={} + /> + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/boolean/BooleanTableEditor.js b/src/main/cliapp/src/components/Editors/boolean/BooleanTableEditor.js index 9ead9fda8..d15ee655a 100644 --- a/src/main/cliapp/src/components/Editors/boolean/BooleanTableEditor.js +++ b/src/main/cliapp/src/components/Editors/boolean/BooleanTableEditor.js @@ -1,32 +1,31 @@ -import React from "react"; -import { TrueFalseDropdown } from "../../TrueFalseDropDownSelector"; -import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; -import { useControlledVocabularyService } from "../../../service/useControlledVocabularyService"; +import React from 'react'; +import { TrueFalseDropdown } from '../../TrueFalseDropDownSelector'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; +import { useControlledVocabularyService } from '../../../service/useControlledVocabularyService'; -export const BooleanTableEditor = ({ rowProps, errorMessagesRef, field, showClear=true }) => { +export const BooleanTableEditor = ({ rowProps, errorMessagesRef, field, showClear = true }) => { + const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); - const booleanTerms = useControlledVocabularyService("generic_boolean_terms"); + const editorChange = (props, event) => { + let updatedEntities = [...props.props.value]; - const editorChange = (props, event) => { - let updatedEntities = [...props.props.value]; + if (event.value && event.value !== '') { + updatedEntities[props.rowIndex][field] = JSON.parse(event.value.name); + } else { + updatedEntities[props.rowIndex][field] = null; + } + }; - if (event.value && event.value !== '') { - updatedEntities[props.rowIndex][field]= JSON.parse(event.value.name); - } else { - updatedEntities[props.rowIndex][field] = null; - } - }; - - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/inCollection/InCollectionFormEditor.js b/src/main/cliapp/src/components/Editors/inCollection/InCollectionFormEditor.js index b2a6c6811..d04b33b13 100644 --- a/src/main/cliapp/src/components/Editors/inCollection/InCollectionFormEditor.js +++ b/src/main/cliapp/src/components/Editors/inCollection/InCollectionFormEditor.js @@ -7,36 +7,41 @@ import { VocabTermAutocompleteTemplate } from '../../Autocomplete/VocabTermAutoc import { FormFieldWrapper } from '../../FormFieldWrapper'; export const InCollectionFormEditor = ({ - inCollection, - onInCollectionValueChange, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, - errorMessages + inCollection, + onInCollectionValueChange, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, + errorMessages, }) => { - - return ( - <> - - } - /> - } - errorField={} - additionalDataField={} - /> - - ); -}; \ No newline at end of file + return ( + <> + ( + + )} + /> + } + errorField={} + additionalDataField={} + /> + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/inCollection/InCollectionTableEditor.js b/src/main/cliapp/src/components/Editors/inCollection/InCollectionTableEditor.js index 73c9715ee..aa6841a55 100644 --- a/src/main/cliapp/src/components/Editors/inCollection/InCollectionTableEditor.js +++ b/src/main/cliapp/src/components/Editors/inCollection/InCollectionTableEditor.js @@ -1,30 +1,33 @@ -import React from "react"; -import { defaultAutocompleteOnChange } from "../../../utils/utils"; -import { AutocompleteEditor } from "../../Autocomplete/AutocompleteEditor"; -import { inCollectionSearch } from "./utils"; -import { VocabTermAutocompleteTemplate } from "../../Autocomplete/VocabTermAutocompleteTemplate"; -import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; +import React from 'react'; +import { defaultAutocompleteOnChange } from '../../../utils/utils'; +import { AutocompleteEditor } from '../../Autocomplete/AutocompleteEditor'; +import { inCollectionSearch } from './utils'; +import { VocabTermAutocompleteTemplate } from '../../Autocomplete/VocabTermAutocompleteTemplate'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; const onInCollectionValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "inCollection", setFieldValue, "name"); + defaultAutocompleteOnChange(props, event, 'inCollection', setFieldValue, 'name'); }; -export const InCollectionTableEditor = ({ rowProps, errorMessagesRef } ) => { - return ( - <> - - } - /> - - - ); -}; \ No newline at end of file +export const InCollectionTableEditor = ({ rowProps, errorMessagesRef }) => { + return ( + <> + ( + + )} + /> + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/inCollection/utils.js b/src/main/cliapp/src/components/Editors/inCollection/utils.js index 7d8adafbe..5de6d4fed 100644 --- a/src/main/cliapp/src/components/Editors/inCollection/utils.js +++ b/src/main/cliapp/src/components/Editors/inCollection/utils.js @@ -1,19 +1,19 @@ -import { buildAutocompleteFilter, autocompleteSearch } from "../../../utils/utils"; -import { SearchService } from "../../../service/SearchService"; +import { buildAutocompleteFilter, autocompleteSearch } from '../../../utils/utils'; +import { SearchService } from '../../../service/SearchService'; export const inCollectionSearch = (event, setFiltered, setQuery) => { - const searchService = new SearchService(); - const autocompleteFields = ["name"]; - const endpoint = "vocabularyterm"; - const filterName = "taxonFilter"; - const otherFilters = { - vocabularyFilter: { - "vocabulary.vocabularyLabel": { - queryString: "allele_collection" - } - } - } - setQuery(event.query); - const filter = buildAutocompleteFilter(event, autocompleteFields); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); -} \ No newline at end of file + const searchService = new SearchService(); + const autocompleteFields = ['name']; + const endpoint = 'vocabularyterm'; + const filterName = 'taxonFilter'; + const otherFilters = { + vocabularyFilter: { + 'vocabulary.vocabularyLabel': { + queryString: 'allele_collection', + }, + }, + }; + setQuery(event.query); + const filter = buildAutocompleteFilter(event, autocompleteFields); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); +}; diff --git a/src/main/cliapp/src/components/Editors/references/ReferencesFormEditor.js b/src/main/cliapp/src/components/Editors/references/ReferencesFormEditor.js index b433f5b72..565f6188e 100644 --- a/src/main/cliapp/src/components/Editors/references/ReferencesFormEditor.js +++ b/src/main/cliapp/src/components/Editors/references/ReferencesFormEditor.js @@ -1,38 +1,44 @@ -import React from "react"; +import React from 'react'; import { AutocompleteFormMultiEditor } from '../../Autocomplete/AutocompleteFormMultiEditor'; -import { LiteratureAutocompleteTemplate } from "../../Autocomplete/LiteratureAutocompleteTemplate"; -import { FormErrorMessageComponent } from "../../Error/FormErrorMessageComponent"; -import { FormFieldWrapper } from "../../FormFieldWrapper"; -import { referenceSearch } from "./utils"; +import { LiteratureAutocompleteTemplate } from '../../Autocomplete/LiteratureAutocompleteTemplate'; +import { FormErrorMessageComponent } from '../../Error/FormErrorMessageComponent'; +import { FormFieldWrapper } from '../../FormFieldWrapper'; +import { referenceSearch } from './utils'; export const ReferencesFormEditor = ({ - references, - onReferencesValueChange, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, - errorMessages + references, + onReferencesValueChange, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, + errorMessages, }) => { - return ( - <> - - } - onValueChangeHandler={onReferencesValueChange} - /> - } - errorField={} - additionalDataField={null} - /> - - ); -}; \ No newline at end of file + return ( + <> + ( + + )} + onValueChangeHandler={onReferencesValueChange} + /> + } + errorField={} + additionalDataField={null} + /> + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/references/ReferencesTableEditor.js b/src/main/cliapp/src/components/Editors/references/ReferencesTableEditor.js index afe90c184..358b19c67 100644 --- a/src/main/cliapp/src/components/Editors/references/ReferencesTableEditor.js +++ b/src/main/cliapp/src/components/Editors/references/ReferencesTableEditor.js @@ -1,31 +1,33 @@ -import React from "react"; -import { AutocompleteMultiEditor } from "../../Autocomplete/AutocompleteMultiEditor"; -import { LiteratureAutocompleteTemplate } from "../../Autocomplete/LiteratureAutocompleteTemplate"; -import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; -import { referenceSearch } from "./utils"; -import { multipleAutocompleteOnChange } from "../../../utils/utils"; +import React from 'react'; +import { AutocompleteMultiEditor } from '../../Autocomplete/AutocompleteMultiEditor'; +import { LiteratureAutocompleteTemplate } from '../../Autocomplete/LiteratureAutocompleteTemplate'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; +import { referenceSearch } from './utils'; +import { multipleAutocompleteOnChange } from '../../../utils/utils'; const onReferenceValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "references", setFieldValue); + multipleAutocompleteOnChange(props, event, 'references', setFieldValue); }; - export const ReferencesTableEditor = ({ rowProps, errorMessagesRef }) => { - return ( - <> - - } - onValueChangeHandler={onReferenceValueChange} - /> - - - ); -}; \ No newline at end of file + return ( + <> + ( + + )} + onValueChangeHandler={onReferenceValueChange} + /> + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/references/SingleReferenceFormEditor.js b/src/main/cliapp/src/components/Editors/references/SingleReferenceFormEditor.js index 564a68c00..94f3e9385 100644 --- a/src/main/cliapp/src/components/Editors/references/SingleReferenceFormEditor.js +++ b/src/main/cliapp/src/components/Editors/references/SingleReferenceFormEditor.js @@ -1,27 +1,29 @@ -import React from "react"; -import { LiteratureAutocompleteTemplate } from "../../Autocomplete/LiteratureAutocompleteTemplate"; -import { FormErrorMessageComponent } from "../../Error/FormErrorMessageComponent"; -import { referenceSearch } from "./utils"; -import { AutocompleteFormEditor } from "../../Autocomplete/AutocompleteFormEditor"; +import React from 'react'; +import { LiteratureAutocompleteTemplate } from '../../Autocomplete/LiteratureAutocompleteTemplate'; +import { FormErrorMessageComponent } from '../../Error/FormErrorMessageComponent'; +import { referenceSearch } from './utils'; +import { AutocompleteFormEditor } from '../../Autocomplete/AutocompleteFormEditor'; -export const SingleReferenceFormEditor = ({ - reference, - onReferenceValueChange, - errorMessages -}) => { - return ( - <> - - } - /> - - - ); -}; \ No newline at end of file +export const SingleReferenceFormEditor = ({ reference, onReferenceValueChange, errorMessages }) => { + return ( + <> + ( + + )} + /> + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/references/SingleReferenceTableEditor.js b/src/main/cliapp/src/components/Editors/references/SingleReferenceTableEditor.js index 379a7fcb1..ceadae553 100644 --- a/src/main/cliapp/src/components/Editors/references/SingleReferenceTableEditor.js +++ b/src/main/cliapp/src/components/Editors/references/SingleReferenceTableEditor.js @@ -1,25 +1,28 @@ -import React from "react"; -import { AutocompleteEditor } from "../../Autocomplete/AutocompleteEditor"; -import { LiteratureAutocompleteTemplate } from "../../Autocomplete/LiteratureAutocompleteTemplate"; -import { referenceSearch } from "./utils"; -import { DialogErrorMessageComponent } from "../../Error/DialogErrorMessageComponent"; +import React from 'react'; +import { AutocompleteEditor } from '../../Autocomplete/AutocompleteEditor'; +import { LiteratureAutocompleteTemplate } from '../../Autocomplete/LiteratureAutocompleteTemplate'; +import { referenceSearch } from './utils'; +import { DialogErrorMessageComponent } from '../../Error/DialogErrorMessageComponent'; export const SingleReferenceTableEditor = ({ props, errorMessages, onChange }) => { - return ( - <> - - } - onValueChangeHandler={onChange} - /> - + ( + + )} + onValueChangeHandler={onChange} /> - - ); -}; \ No newline at end of file + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/references/utils.js b/src/main/cliapp/src/components/Editors/references/utils.js index 43181ca13..3ac917188 100644 --- a/src/main/cliapp/src/components/Editors/references/utils.js +++ b/src/main/cliapp/src/components/Editors/references/utils.js @@ -1,13 +1,13 @@ -import { buildAutocompleteFilter, autocompleteSearch } from "../../../utils/utils"; -import { SearchService } from "../../../service/SearchService"; +import { buildAutocompleteFilter, autocompleteSearch } from '../../../utils/utils'; +import { SearchService } from '../../../service/SearchService'; export const referenceSearch = (event, setFiltered, setInputValue) => { - const searchService = new SearchService(); - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "curieFilter"; - const filter = buildAutocompleteFilter(event, autocompleteFields); + const searchService = new SearchService(); + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'curieFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); - setInputValue(event.query); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } \ No newline at end of file + setInputValue(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); +}; diff --git a/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/SourceGeneralConsequenceTableEditor.js b/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/SourceGeneralConsequenceTableEditor.js index ee51d47ca..ddf0ee928 100644 --- a/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/SourceGeneralConsequenceTableEditor.js +++ b/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/SourceGeneralConsequenceTableEditor.js @@ -1,28 +1,27 @@ - import React from "react"; - import { AutocompleteEditor } from "../../Autocomplete/AutocompleteEditor"; - import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; - import { sourceGeneralConsequenceSearch } from "./utils"; - import { defaultAutocompleteOnChange } from "../../../utils/utils"; +import React from 'react'; +import { AutocompleteEditor } from '../../Autocomplete/AutocompleteEditor'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; +import { sourceGeneralConsequenceSearch } from './utils'; +import { defaultAutocompleteOnChange } from '../../../utils/utils'; -export const SourceGeneralConsequenceTableEditor = ({ rowProps, errorMessagesRef}) => { +export const SourceGeneralConsequenceTableEditor = ({ rowProps, errorMessagesRef }) => { + const onSourceGeneralConsequenceValueChange = (event, setFieldValue, props) => { + defaultAutocompleteOnChange(props, event, 'sourceGeneralConsequence', setFieldValue); + }; - const onSourceGeneralConsequenceValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "sourceGeneralConsequence", setFieldValue); - }; - - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/utils.js b/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/utils.js index 2a71364f9..d214c2839 100644 --- a/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/utils.js +++ b/src/main/cliapp/src/components/Editors/sourceGeneralConsequence/utils.js @@ -1,13 +1,12 @@ -import { buildAutocompleteFilter, autocompleteSearch } from "../../../utils/utils"; -import { SearchService } from "../../../service/SearchService"; - +import { buildAutocompleteFilter, autocompleteSearch } from '../../../utils/utils'; +import { SearchService } from '../../../service/SearchService'; export const sourceGeneralConsequenceSearch = (event, setFiltered, setQuery) => { - const searchService = new SearchService(); - const autocompleteFields = ["curie", "name", "secondaryIdentifiers", "synonyms.name"]; - const endpoint = "soterm"; - const filterName = "sourceGeneralConsequenceFilter"; - setQuery(event.query); - const filter = buildAutocompleteFilter(event, autocompleteFields); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} \ No newline at end of file + const searchService = new SearchService(); + const autocompleteFields = ['curie', 'name', 'secondaryIdentifiers', 'synonyms.name']; + const endpoint = 'soterm'; + const filterName = 'sourceGeneralConsequenceFilter'; + setQuery(event.query); + const filter = buildAutocompleteFilter(event, autocompleteFields); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); +}; diff --git a/src/main/cliapp/src/components/Editors/taxon/TaxonFormEditor.js b/src/main/cliapp/src/components/Editors/taxon/TaxonFormEditor.js index d408e7183..735e34d91 100644 --- a/src/main/cliapp/src/components/Editors/taxon/TaxonFormEditor.js +++ b/src/main/cliapp/src/components/Editors/taxon/TaxonFormEditor.js @@ -6,32 +6,32 @@ import { TaxonAdditionalFieldData } from '../../FieldData/TaxonAdditionalFieldDa import { FormFieldWrapper } from '../../FormFieldWrapper'; export const TaxonFormEditor = ({ - taxon, - onTaxonValueChange, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, - errorMessages + taxon, + onTaxonValueChange, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, + errorMessages, }) => { - return ( - <> - - } - errorField={} - additionalDataField={} - /> - - ); + return ( + <> + + } + errorField={} + additionalDataField={} + /> + + ); }; diff --git a/src/main/cliapp/src/components/Editors/taxon/TaxonTableEditor.js b/src/main/cliapp/src/components/Editors/taxon/TaxonTableEditor.js index 61beb288a..26cb6645c 100644 --- a/src/main/cliapp/src/components/Editors/taxon/TaxonTableEditor.js +++ b/src/main/cliapp/src/components/Editors/taxon/TaxonTableEditor.js @@ -1,28 +1,24 @@ - import React from "react"; - import { AutocompleteEditor } from "../../Autocomplete/AutocompleteEditor"; - import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; - import { taxonSearch } from "./utils"; - import { defaultAutocompleteOnChange } from "../../../utils/utils"; +import React from 'react'; +import { AutocompleteEditor } from '../../Autocomplete/AutocompleteEditor'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; +import { taxonSearch } from './utils'; +import { defaultAutocompleteOnChange } from '../../../utils/utils'; -export const TaxonTableEditor = ({ rowProps, errorMessagesRef}) => { +export const TaxonTableEditor = ({ rowProps, errorMessagesRef }) => { + const onTaxonValueChange = (event, setFieldValue, props) => { + defaultAutocompleteOnChange(props, event, 'taxon', setFieldValue); + }; - const onTaxonValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "taxon", setFieldValue); - }; - - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/taxon/utils.js b/src/main/cliapp/src/components/Editors/taxon/utils.js index b763eb0fd..431c315f6 100644 --- a/src/main/cliapp/src/components/Editors/taxon/utils.js +++ b/src/main/cliapp/src/components/Editors/taxon/utils.js @@ -1,13 +1,18 @@ -import { buildAutocompleteFilter, autocompleteSearch } from "../../../utils/utils"; -import { SearchService } from "../../../service/SearchService"; - +import { buildAutocompleteFilter, autocompleteSearch } from '../../../utils/utils'; +import { SearchService } from '../../../service/SearchService'; export const taxonSearch = (event, setFiltered, setQuery) => { - const searchService = new SearchService(); - const autocompleteFields = ["curie", "name", "crossReferences.referencedCurie", "secondaryIdentifiers", "synonyms.name"]; - const endpoint = "ncbitaxonterm"; - const filterName = "taxonFilter"; - setQuery(event.query); - const filter = buildAutocompleteFilter(event, autocompleteFields); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} \ No newline at end of file + const searchService = new SearchService(); + const autocompleteFields = [ + 'curie', + 'name', + 'crossReferences.referencedCurie', + 'secondaryIdentifiers', + 'synonyms.name', + ]; + const endpoint = 'ncbitaxonterm'; + const filterName = 'taxonFilter'; + setQuery(event.query); + const filter = buildAutocompleteFilter(event, autocompleteFields); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); +}; diff --git a/src/main/cliapp/src/components/Editors/variantType/VariantTypeTableEditor.js b/src/main/cliapp/src/components/Editors/variantType/VariantTypeTableEditor.js index 8efca7fc6..a7d2f9807 100644 --- a/src/main/cliapp/src/components/Editors/variantType/VariantTypeTableEditor.js +++ b/src/main/cliapp/src/components/Editors/variantType/VariantTypeTableEditor.js @@ -1,28 +1,24 @@ - import React from "react"; - import { AutocompleteEditor } from "../../Autocomplete/AutocompleteEditor"; - import { ErrorMessageComponent } from "../../Error/ErrorMessageComponent"; - import { variantTypeSearch } from "./utils"; - import { defaultAutocompleteOnChange } from "../../../utils/utils"; +import React from 'react'; +import { AutocompleteEditor } from '../../Autocomplete/AutocompleteEditor'; +import { ErrorMessageComponent } from '../../Error/ErrorMessageComponent'; +import { variantTypeSearch } from './utils'; +import { defaultAutocompleteOnChange } from '../../../utils/utils'; -export const VariantTypeTableEditor = ({ rowProps, errorMessagesRef}) => { +export const VariantTypeTableEditor = ({ rowProps, errorMessagesRef }) => { + const onVariantTypeValueChange = (event, setFieldValue, props) => { + defaultAutocompleteOnChange(props, event, 'variantType', setFieldValue); + }; - const onVariantTypeValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "variantType", setFieldValue); - }; - - return ( - <> - - - - ); -}; \ No newline at end of file + return ( + <> + + + + ); +}; diff --git a/src/main/cliapp/src/components/Editors/variantType/utils.js b/src/main/cliapp/src/components/Editors/variantType/utils.js index 7249129b0..b40b3cb97 100644 --- a/src/main/cliapp/src/components/Editors/variantType/utils.js +++ b/src/main/cliapp/src/components/Editors/variantType/utils.js @@ -1,13 +1,12 @@ -import { buildAutocompleteFilter, autocompleteSearch } from "../../../utils/utils"; -import { SearchService } from "../../../service/SearchService"; - +import { buildAutocompleteFilter, autocompleteSearch } from '../../../utils/utils'; +import { SearchService } from '../../../service/SearchService'; export const variantTypeSearch = (event, setFiltered, setQuery) => { - const searchService = new SearchService(); - const autocompleteFields = ["curie", "name", "secondaryIdentifiers", "synonyms.name"]; - const endpoint = "soterm"; - const filterName = "sourceGeneralConsequenceFilter"; - setQuery(event.query); - const filter = buildAutocompleteFilter(event, autocompleteFields); - autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} \ No newline at end of file + const searchService = new SearchService(); + const autocompleteFields = ['curie', 'name', 'secondaryIdentifiers', 'synonyms.name']; + const endpoint = 'soterm'; + const filterName = 'sourceGeneralConsequenceFilter'; + setQuery(event.query); + const filter = buildAutocompleteFilter(event, autocompleteFields); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); +}; diff --git a/src/main/cliapp/src/components/EllipsisTableCell.js b/src/main/cliapp/src/components/EllipsisTableCell.js index 7cf144c92..5258d440d 100644 --- a/src/main/cliapp/src/components/EllipsisTableCell.js +++ b/src/main/cliapp/src/components/EllipsisTableCell.js @@ -1,9 +1,5 @@ import React from 'react'; export const EllipsisTableCell = ({ children, otherClasses = '' }) => { - return ( -
    - {children} -
    - ); -} + return
    {children}
    ; +}; diff --git a/src/main/cliapp/src/components/EntityCountsComponent.js b/src/main/cliapp/src/components/EntityCountsComponent.js index 08d568e0a..998b1cabe 100644 --- a/src/main/cliapp/src/components/EntityCountsComponent.js +++ b/src/main/cliapp/src/components/EntityCountsComponent.js @@ -5,7 +5,6 @@ import { SystemService } from '../service/SystemService'; import { CLASSES } from '../constants/Classes'; export const EntityCountsComponent = () => { - const [tableData, setTableData] = useState({}); useEffect(() => { @@ -16,40 +15,41 @@ export const EntityCountsComponent = () => { systemService.getSiteSummary().then((res) => { if (isMounted) { - for (const key in res.entity){ - - if(!CLASSES[key]) continue; + for (const key in res.entity) { + if (!CLASSES[key]) continue; const { type } = CLASSES[key]; - if(!_tableData[type]){ + if (!_tableData[type]) { _tableData[type] = []; } _tableData[type].push({ name: CLASSES[key].name, link: CLASSES[key].link, - dbCount: res.entity[key]["dbCount"], - esCount: res.entity[key]["esCount"] + dbCount: res.entity[key]['dbCount'], + esCount: res.entity[key]['esCount'], }); } setTableData(_tableData); } }); - return () => { isMounted = false }; + return () => { + isMounted = false; + }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const nameHyperlinkTemplate = (rowData) => { - return {rowData.name} - } + return {rowData.name}; + }; return ( <>
    - + diff --git a/src/main/cliapp/src/components/Error/DialogErrorMessageComponent.js b/src/main/cliapp/src/components/Error/DialogErrorMessageComponent.js index c0e8fde69..968ef329a 100644 --- a/src/main/cliapp/src/components/Error/DialogErrorMessageComponent.js +++ b/src/main/cliapp/src/components/Error/DialogErrorMessageComponent.js @@ -1,19 +1,18 @@ import React from 'react'; -import { Message } from "primereact/message"; - +import { Message } from 'primereact/message'; export function DialogErrorMessageComponent({ errorField, errorMessages: errorMessagesRow }) { - if(errorMessagesRow){ - return ( -
    - -
    - ); - } else { - return null; - } + if (errorMessagesRow) { + return ( +
    + +
    + ); + } else { + return null; + } } diff --git a/src/main/cliapp/src/components/Error/ErrorBoundary.js b/src/main/cliapp/src/components/Error/ErrorBoundary.js index 6c1b9c3e5..9fab5919b 100644 --- a/src/main/cliapp/src/components/Error/ErrorBoundary.js +++ b/src/main/cliapp/src/components/Error/ErrorBoundary.js @@ -4,29 +4,28 @@ import { ErrorComponent } from './ErrorComponent'; //this is a class component because there is no way to use getDerivedStateFromError in a functional component //https://reactjs.org/docs/hooks-faq.html#do-hooks-cover-all-use-cases-for-classes export default class ErrorBoundary extends React.Component { - constructor(props) { - super(props); - this.state = { - hasError: false, - errorMessage: false, - }; - } + constructor(props) { + super(props); + this.state = { + hasError: false, + errorMessage: false, + }; + } - componentDidCatch(error, info) { - console.error(error, info); - } + componentDidCatch(error, info) { + console.error(error, info); + } - static getDerivedStateFromError(error) { - return { - hasError: true, - errorMessage: error && error.message, - }; - } + static getDerivedStateFromError(error) { + return { + hasError: true, + errorMessage: error && error.message, + }; + } - - render() { - const { hasError, errorMessage } = this.state; - if (hasError) return ; - return this.props.children; - } + render() { + const { hasError, errorMessage } = this.state; + if (hasError) return ; + return this.props.children; + } } diff --git a/src/main/cliapp/src/components/Error/ErrorComponent.js b/src/main/cliapp/src/components/Error/ErrorComponent.js index da8b2c638..12f5b715c 100644 --- a/src/main/cliapp/src/components/Error/ErrorComponent.js +++ b/src/main/cliapp/src/components/Error/ErrorComponent.js @@ -2,31 +2,39 @@ import React from 'react'; import { Message } from 'primereact/message'; import 'primeflex/primeflex.css'; - export function ErrorComponent({ errorMessage }) { + const contentTemplate = () => { + return ( +
    +

    +
    + A problem displaying this page{errorMessage ? ':' : null} +
    +
    {errorMessage}
    +
    +
    +

    + Please reach out to the A-Team or add a ticket to + + {' '} + this board + +

    +
    +

    +
    + ); + }; - const contentTemplate = () => { - - return ( -
    -

    -
    A problem displaying this page{errorMessage ? ':' : null}
    -
    {errorMessage}
    -
    -
    -

    - Please reach out to the A-Team or add a ticket to - this board -

    -
    -

    -
    - ); - - }; - - return ; -} \ No newline at end of file + return ( + + ); +} diff --git a/src/main/cliapp/src/components/Error/ErrorMessageComponent.js b/src/main/cliapp/src/components/Error/ErrorMessageComponent.js index 939df2171..3c9ef8047 100644 --- a/src/main/cliapp/src/components/Error/ErrorMessageComponent.js +++ b/src/main/cliapp/src/components/Error/ErrorMessageComponent.js @@ -1,19 +1,18 @@ import React from 'react'; -import { Message } from "primereact/message"; - +import { Message } from 'primereact/message'; export function ErrorMessageComponent({ errorField, errorMessages: errorMessagesRow }) { - if(errorMessagesRow){ - return ( -
    - -
    - ); - } else { - return null; - } + if (errorMessagesRow) { + return ( +
    + +
    + ); + } else { + return null; + } } diff --git a/src/main/cliapp/src/components/Error/FormErrorMessageComponent.js b/src/main/cliapp/src/components/Error/FormErrorMessageComponent.js index 6c9f1f255..e8d202f81 100644 --- a/src/main/cliapp/src/components/Error/FormErrorMessageComponent.js +++ b/src/main/cliapp/src/components/Error/FormErrorMessageComponent.js @@ -1,10 +1,9 @@ import React from 'react'; - -export function FormErrorMessageComponent({ errorField, errorMessages }){ - if(errorMessages){ - return {errorMessages[errorField]}; - } else { - return null; - } +export function FormErrorMessageComponent({ errorField, errorMessages }) { + if (errorMessages) { + return {errorMessages[errorField]}; + } else { + return null; + } } diff --git a/src/main/cliapp/src/components/EvidenceComponent.js b/src/main/cliapp/src/components/EvidenceComponent.js index 59216f162..c64789b81 100644 --- a/src/main/cliapp/src/components/EvidenceComponent.js +++ b/src/main/cliapp/src/components/EvidenceComponent.js @@ -1,24 +1,24 @@ -import React from 'react' +import React from 'react'; import { EllipsisTableCell } from './EllipsisTableCell'; import { ListTableCell } from './ListTableCell'; import { AutocompleteMultiEditor } from './Autocomplete/AutocompleteMultiEditor'; import { DialogErrorMessageComponent } from './Error/DialogErrorMessageComponent'; import { SearchService } from '../service/SearchService'; -import { autocompleteSearch, buildAutocompleteFilter, multipleAutocompleteOnChange, getRefStrings } from '../utils/utils'; +import { + autocompleteSearch, + buildAutocompleteFilter, + multipleAutocompleteOnChange, + getRefStrings, +} from '../utils/utils'; import { LiteratureAutocompleteTemplate } from './Autocomplete/LiteratureAutocompleteTemplate'; - export const evidenceTemplate = (rowData) => { if (rowData && rowData.evidence) { const refStrings = getRefStrings(rowData.evidence); const listTemplate = (item) => { - return ( - - {item} - - ); + return {item}; }; - return + return ; } }; @@ -29,32 +29,34 @@ export const evidenceEditorTemplate = (props, errorMessages) => { search={evidenceSearch} initialValue={props.rowData.evidence} rowProps={props} - fieldName='evidence' - subField='curie' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="evidence" + subField="curie" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onEvidenceValueChange} /> - + ); }; export const onEvidenceValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "evidence", setFieldValue); + multipleAutocompleteOnChange(props, event, 'evidence', setFieldValue); }; export const evidenceSearch = (event, setFiltered, setInputValue) => { const searchService = new SearchService(); - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "evidenceFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'evidenceFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); -} - +}; diff --git a/src/main/cliapp/src/components/FMSComponent.js b/src/main/cliapp/src/components/FMSComponent.js index c4b4de0e3..2f7798ad0 100644 --- a/src/main/cliapp/src/components/FMSComponent.js +++ b/src/main/cliapp/src/components/FMSComponent.js @@ -5,37 +5,38 @@ import { Dropdown } from 'primereact/dropdown'; import { FMSService } from '../service/FMSService'; export const FMSComponent = () => { - const [dataFiles, setDataFiles] = useState(null); const [snapShotDate, setSnapShotDate] = useState(0); const [first, setFirst] = useState(0); const [rows, setRows] = useState(20); const [releases, setReleases] = useState(null); - const [selectedRelease, setSelectedRelease] = useState({releaseVersion: '0'}); + const [selectedRelease, setSelectedRelease] = useState({ releaseVersion: '0' }); useEffect(() => { const fmsService = new FMSService(); - + if (selectedRelease.releaseVersion !== '0') { - fmsService.getReleases().then(results => { - setReleases(results.sort(function(a,b){ - return new Date(b.releaseDate) - new Date(a.releaseDate); - })); - for(let idx of results) { - if(idx.releaseVersion === selectedRelease.releaseVersion) { + fmsService.getReleases().then((results) => { + setReleases( + results.sort(function (a, b) { + return new Date(b.releaseDate) - new Date(a.releaseDate); + }) + ); + for (let idx of results) { + if (idx.releaseVersion === selectedRelease.releaseVersion) { setSelectedRelease(idx); break; } } }); } else { - fmsService.getNextRelease().then(result => { + fmsService.getNextRelease().then((result) => { setSelectedRelease(result); }); } if (selectedRelease.releaseVersion !== '0') { - fmsService.getSnapshot(selectedRelease.releaseVersion).then(snapShot => { + fmsService.getSnapshot(selectedRelease.releaseVersion).then((snapShot) => { if (typeof snapShot !== 'undefined') { setDataFiles(snapShot.dataFiles); setSnapShotDate(snapShot.snapShotDate); @@ -45,17 +46,14 @@ export const FMSComponent = () => { } }); } - }, [selectedRelease.releaseVersion]); - - const symbolTemplate = (rowData) => { - return Download + return Download; }; const uploadTemplate = (rowData) => { - return
    {new Date(rowData.uploadDate).toGMTString()}
    + return
    {new Date(rowData.uploadDate).toGMTString()}
    ; }; const customPage = (event) => { @@ -71,23 +69,44 @@ export const FMSComponent = () => {

    FMS Data Files

    - Release Version: -
    Snapshot Date: {snapShotDate === '' ? 'No snapshot available' : new Date(snapShotDate).toGMTString()} - +
    + Snapshot Date: {snapShotDate === '' ? 'No snapshot available' : new Date(snapShotDate).toGMTString()} + - - +
    - ) -} + ); +}; diff --git a/src/main/cliapp/src/components/FMSDataFilesComponent.js b/src/main/cliapp/src/components/FMSDataFilesComponent.js index 2a4ee4767..1a210744c 100644 --- a/src/main/cliapp/src/components/FMSDataFilesComponent.js +++ b/src/main/cliapp/src/components/FMSDataFilesComponent.js @@ -2,18 +2,19 @@ import React, { useState } from 'react'; import { DataTable } from 'primereact/datatable'; import { Column } from 'primereact/column'; -export const FMSDataFilesComponent = ({dataFiles}) => { - +export const FMSDataFilesComponent = ({ dataFiles }) => { const [expandedRows, setExpandedRows] = useState(null); const downloadTemplate = (row) => { - return Download - } + return Download; + }; const dataFileTable = (row) => { console.log(row); return ( - { ); - } + }; return ( - setExpandedRows(e.data)} rowExpansionTemplate={dataFileTable} - sortOrder={-1} - paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" - > - - - - - + setExpandedRows(e.data)} + rowExpansionTemplate={dataFileTable} + sortOrder={-1} + paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" + > + + + + ); - -} +}; diff --git a/src/main/cliapp/src/components/FMSDataTypesComponent.js b/src/main/cliapp/src/components/FMSDataTypesComponent.js index ffa5e7b84..a451dfef0 100644 --- a/src/main/cliapp/src/components/FMSDataTypesComponent.js +++ b/src/main/cliapp/src/components/FMSDataTypesComponent.js @@ -10,7 +10,6 @@ import { FMSDataFilesComponent } from '../components/FMSDataFilesComponent'; import { Splitter, SplitterPanel } from 'primereact/splitter'; export const FMSDataTypesComponent = (props) => { - const { dataType } = useParams(); const [dataTypes, setDataTypes] = useState([]); const [dataFiles, setDataFiles] = useState([]); @@ -20,27 +19,27 @@ export const FMSDataTypesComponent = (props) => { useEffect(() => { const fmsService = new FMSService(); - fmsService.getDataTypes().then(results => { + fmsService.getDataTypes().then((results) => { setDataTypes(results); }); }, []); useEffect(() => { - if(dataType) { + if (dataType) { const fmsService = new FMSService(); - fmsService.getDataFiles(dataType, latest).then(results => { + fmsService.getDataFiles(dataType, latest).then((results) => { var _releases = []; var lookup = {}; - for(var dataFile of results) { - for(var releaseVersion of dataFile.releaseVersions) { - if(!(releaseVersion.releaseVersion in lookup)) { + for (var dataFile of results) { + for (var releaseVersion of dataFile.releaseVersions) { + if (!(releaseVersion.releaseVersion in lookup)) { lookup[releaseVersion.releaseVersion] = { ...releaseVersion, dataFiles: [] }; } lookup[releaseVersion.releaseVersion].dataFiles.push(dataFile); } } - for(var release in lookup) { + for (var release in lookup) { _releases.push(lookup[release]); } setDataFiles(_releases); @@ -55,7 +54,9 @@ export const FMSDataTypesComponent = (props) => { const nameTemplate = (data) => { return ( - {data.name} + + {data.name} + ); }; @@ -63,33 +64,66 @@ export const FMSDataTypesComponent = (props) => {

    FMS Data Types:

    - Latest: setLatest(e.value)} /> - + Latest:{' '} + setLatest(e.value)} + /> + - - + - - + + - + -
    - ) -} + ); +}; diff --git a/src/main/cliapp/src/components/FieldData/AssertedAlleleAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/AssertedAlleleAdditionalFieldData.js index 654530618..c6d50a465 100644 --- a/src/main/cliapp/src/components/FieldData/AssertedAlleleAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/AssertedAlleleAdditionalFieldData.js @@ -3,8 +3,10 @@ import { getIdentifier } from '../../utils/utils'; export function AssertedAlleleAdditionalFieldData({ fieldData }) { if (fieldData) { - if (getIdentifier(fieldData) !== '' && fieldData["type"] === "Allele") - return
    ; + if (getIdentifier(fieldData) !== '' && fieldData['type'] === 'Allele') + return ( +
    + ); } return null; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/AssertedGenesAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/AssertedGenesAdditionalFieldData.js index 0fc3f2eb8..e3ee01664 100644 --- a/src/main/cliapp/src/components/FieldData/AssertedGenesAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/AssertedGenesAdditionalFieldData.js @@ -3,11 +3,17 @@ import { getIdentifier } from '../../utils/utils'; export function AssertedGenesAdditionalFieldData({ fieldData }) { let ret = []; - if (fieldData && fieldData.length >0) { - for(let i=0; i< fieldData.length; i++){ - if (getIdentifier(fieldData[i]) !== '' && fieldData[i]["type"] === "Gene") - ret.push(
    ); + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + if (getIdentifier(fieldData[i]) !== '' && fieldData[i]['type'] === 'Gene') + ret.push( +
    + ); } } return ret; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/BooleanAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/BooleanAdditionalFieldData.js index bd4a000bd..95bc1dfd5 100644 --- a/src/main/cliapp/src/components/FieldData/BooleanAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/BooleanAdditionalFieldData.js @@ -1,6 +1,6 @@ import React from 'react'; export const BooleanAdditionalFieldData = ({ value }) => { - if(!value) return null; + if (!value) return null; return
    {value}
    ; }; diff --git a/src/main/cliapp/src/components/FieldData/DiseaseAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/DiseaseAdditionalFieldData.js index 0eadaee56..3b0f7fd8d 100644 --- a/src/main/cliapp/src/components/FieldData/DiseaseAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/DiseaseAdditionalFieldData.js @@ -2,8 +2,7 @@ import React from 'react'; export function DiseaseAdditionalFieldData({ fieldData }) { if (fieldData) { - if (fieldData["curie"] !== '' && fieldData["name"] !== '') - return
    {fieldData["name"]}
    ; + if (fieldData['curie'] !== '' && fieldData['name'] !== '') return
    {fieldData['name']}
    ; } return null; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/EvidenceCodesAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/EvidenceCodesAdditionalFieldData.js index 42bf99cf4..6f1691013 100644 --- a/src/main/cliapp/src/components/FieldData/EvidenceCodesAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/EvidenceCodesAdditionalFieldData.js @@ -2,10 +2,15 @@ import React from 'react'; export function EvidenceCodesAdditionalFieldData({ fieldData }) { let ret = []; - if (fieldData && fieldData.length >0) { - for(let i=0; i< fieldData.length; i++){ - ret.push(
    {fieldData[i]["abbreviation"] + " " + fieldData[i]["name"]}
    ); + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + ret.push( +
    + {' '} + {fieldData[i]['abbreviation'] + ' ' + fieldData[i]['name']}{' '} +
    + ); } } return ret; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js index d4b56c7d0..fd0d27684 100644 --- a/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js @@ -4,16 +4,30 @@ import { getIdentifier } from '../../utils/utils'; export function GeneticModifiersAdditionalFieldData({ fieldData }) { let ret = []; if (fieldData && fieldData.length > 0) { - for(let i=0; i < fieldData.length; i++) { + for (let i = 0; i < fieldData.length; i++) { if (getIdentifier(fieldData[i]) !== '') { - if (fieldData[i]["type"] === "Gene") - ret.push(
    ); - else if (fieldData[i]["type"] === "Allele") - ret.push(
    ); - else if (fieldData[i]["type"] === "AffectedGenomicModel") - ret.push(
    ); + if (fieldData[i]['type'] === 'Gene') + ret.push( +
    + ); + else if (fieldData[i]['type'] === 'Allele') + ret.push( +
    + ); + else if (fieldData[i]['type'] === 'AffectedGenomicModel') + ret.push( +
    + ); } } } return ret; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/InCollectionAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/InCollectionAdditionalFieldData.js index c7617db38..e22f17213 100644 --- a/src/main/cliapp/src/components/FieldData/InCollectionAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/InCollectionAdditionalFieldData.js @@ -1,6 +1,6 @@ import React from 'react'; export const InCollectionAdditionalFieldData = ({ name }) => { - if(!name) return null; + if (!name) return null; return
    {name}
    ; }; diff --git a/src/main/cliapp/src/components/FieldData/InternalAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/InternalAdditionalFieldData.js index 4388b1930..7ae4e3672 100644 --- a/src/main/cliapp/src/components/FieldData/InternalAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/InternalAdditionalFieldData.js @@ -1,6 +1,6 @@ import React from 'react'; export const InternalAdditionalFieldData = ({ internal }) => { - if(!internal) return null; + if (!internal) return null; return
    {internal}
    ; }; diff --git a/src/main/cliapp/src/components/FieldData/IsExtinctAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/IsExtinctAdditionalFieldData.js index 5c90cdbbe..f0494279e 100644 --- a/src/main/cliapp/src/components/FieldData/IsExtinctAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/IsExtinctAdditionalFieldData.js @@ -1,6 +1,6 @@ import React from 'react'; export const IsExtinctAdditionalFieldData = ({ isExtinct }) => { - if(!isExtinct) return null; + if (!isExtinct) return null; return
    {isExtinct}
    ; }; diff --git a/src/main/cliapp/src/components/FieldData/ObsoleteAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/ObsoleteAdditionalFieldData.js index 7afddc998..a4358857b 100644 --- a/src/main/cliapp/src/components/FieldData/ObsoleteAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/ObsoleteAdditionalFieldData.js @@ -1,6 +1,6 @@ import React from 'react'; export const ObsoleteAdditionalFieldData = ({ obsolete }) => { - if(!obsolete) return null; + if (!obsolete) return null; return
    {obsolete}
    ; }; diff --git a/src/main/cliapp/src/components/FieldData/ReferencesAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/ReferencesAdditionalFieldData.js index 3eb0110f3..828d98373 100644 --- a/src/main/cliapp/src/components/FieldData/ReferencesAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/ReferencesAdditionalFieldData.js @@ -1,15 +1,14 @@ import React from 'react'; -import { SingleReferenceAdditionalFieldData } from "./SingleReferenceAdditionalFieldData"; +import { SingleReferenceAdditionalFieldData } from './SingleReferenceAdditionalFieldData'; export const ReferencesAdditionalFieldData = ({ references }) => { - const referencesDivs = references?.map((reference) => { return (
    - ) - }) + ); + }); return referencesDivs || null; }; diff --git a/src/main/cliapp/src/components/FieldData/SGDStrainBackgroundAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/SGDStrainBackgroundAdditionalFieldData.js index 1aabf0f64..533c7f5fe 100644 --- a/src/main/cliapp/src/components/FieldData/SGDStrainBackgroundAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/SGDStrainBackgroundAdditionalFieldData.js @@ -1,10 +1,10 @@ import React from 'react'; import { getIdentifier } from '../../utils/utils'; -export function SGDStrainBackgroundAdditionalFieldData({ fieldData }){ +export function SGDStrainBackgroundAdditionalFieldData({ fieldData }) { if (fieldData) { - if (getIdentifier(fieldData) !== '' && fieldData["name"] !== '') - return
    {fieldData["name"]}
    ; + if (getIdentifier(fieldData) !== '' && fieldData['name'] !== '') + return
    {fieldData['name']}
    ; } return null; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/SingleReferenceAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/SingleReferenceAdditionalFieldData.js index f097d3933..d4897c3b6 100644 --- a/src/main/cliapp/src/components/FieldData/SingleReferenceAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/SingleReferenceAdditionalFieldData.js @@ -2,22 +2,32 @@ import React from 'react'; export function SingleReferenceAdditionalFieldData({ fieldData }) { let ret = []; - if(!fieldData || fieldData.curie === '') return ret; - if (fieldData['cross_references'] && fieldData['cross_references'].length > 0 ){ + if (!fieldData || fieldData.curie === '') return ret; + if (fieldData['cross_references'] && fieldData['cross_references'].length > 0) { createCrossReferenceDivs(ret, fieldData['cross_references'], 'curie', fieldData['short_citation']); - } else if(fieldData['crossReferences'] && fieldData['crossReferences'].length > 0 ){//if the crossReference is coming from rowData + } else if (fieldData['crossReferences'] && fieldData['crossReferences'].length > 0) { + //if the crossReference is coming from rowData createCrossReferenceDivs(ret, fieldData['crossReferences'], 'displayName', fieldData['short_citation']); } return ret; -}; +} const createCrossReferenceDivs = (resultList, crossReferences, field, shortCitation) => { - let modList = ["PMID", "FB", "MGI", "RGD", "SGD", "WB", "ZFIN", "XB"]; - for(let i = 0; i < crossReferences.length; i++){ - let prefix = crossReferences[i][field]?.split(":")[0]; - if(modList.includes(prefix)){ - resultList.push(
    {crossReferences[i][field]}
    ); + let modList = ['PMID', 'FB', 'MGI', 'RGD', 'SGD', 'WB', 'ZFIN', 'XB']; + for (let i = 0; i < crossReferences.length; i++) { + let prefix = crossReferences[i][field]?.split(':')[0]; + if (modList.includes(prefix)) { + resultList.push( +
    + {crossReferences[i][field]} +
    + ); } } - if(shortCitation) resultList.push(
    {shortCitation}
    ); -} + if (shortCitation) + resultList.push( +
    + {shortCitation} +
    + ); +}; diff --git a/src/main/cliapp/src/components/FieldData/SubjectAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/SubjectAdditionalFieldData.js index 22f15a35c..fb8e704a1 100644 --- a/src/main/cliapp/src/components/FieldData/SubjectAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/SubjectAdditionalFieldData.js @@ -3,12 +3,22 @@ import { getIdentifier } from '../../utils/utils'; export function SubjectAdditionalFieldData({ fieldData }) { if (fieldData && getIdentifier(fieldData) !== '') { - if (fieldData["type"] === "Gene") - return
    ; - else if (fieldData["type"] === "Allele") - return
    ; - else if (fieldData["type"] === "AffectedGenomicModel") - return
    ; + if (fieldData['type'] === 'Gene') + return ( +
    + ); + else if (fieldData['type'] === 'Allele') + return ( +
    + ); + else if (fieldData['type'] === 'AffectedGenomicModel') + return
    ; } return null; -}; +} diff --git a/src/main/cliapp/src/components/FieldData/TaxonAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/TaxonAdditionalFieldData.js index 9dd3650af..19480af41 100644 --- a/src/main/cliapp/src/components/FieldData/TaxonAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/TaxonAdditionalFieldData.js @@ -1,6 +1,6 @@ -import React from "react"; +import React from 'react'; export const TaxonAdditionalFieldData = ({ curie, name }) => { - if(!curie) return null; + if (!curie) return null; return
    {`${name} (${curie})`}
    ; -} \ No newline at end of file +}; diff --git a/src/main/cliapp/src/components/FieldData/WithAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/WithAdditionalFieldData.js index c7b9d9d85..f82c562dd 100644 --- a/src/main/cliapp/src/components/FieldData/WithAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/WithAdditionalFieldData.js @@ -3,11 +3,16 @@ import { getIdentifier } from '../../utils/utils'; export function WithAdditionalFieldData({ fieldData }) { let ret = []; - if (fieldData && fieldData.length >0) { - for(let i=0; i< fieldData.length; i++){ - if (getIdentifier(fieldData[i]) !== '' && fieldData[i]["type"] === "Gene") - ret.push(
    {fieldData[i]["geneSymbol"]["displayText"]}
    ); + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + if (getIdentifier(fieldData[i]) !== '' && fieldData[i]['type'] === 'Gene') + ret.push( +
    + {' '} + {fieldData[i]['geneSymbol']['displayText']}{' '} +
    + ); } } return ret; -}; +} diff --git a/src/main/cliapp/src/components/Filters/FilterComponent.js b/src/main/cliapp/src/components/Filters/FilterComponent.js index 56f1c5fbc..1dc97d730 100644 --- a/src/main/cliapp/src/components/Filters/FilterComponent.js +++ b/src/main/cliapp/src/components/Filters/FilterComponent.js @@ -4,19 +4,12 @@ import { FilterComponentBinaryDropDown } from './FilterComponentBinaryDropDown'; import { FilterComponentMultiSelect } from './FilterComponentMultiSelect'; import { Splitter, SplitterPanel } from 'primereact/splitter'; -export const FilterComponent = ({ - filterConfig, - isInEditMode, - onFilter, - aggregationFields, - tableState, - endpoint, -}) => { +export const FilterComponent = ({ filterConfig, isInEditMode, onFilter, aggregationFields, tableState, endpoint }) => { if (filterConfig && filterConfig.filterComponentType) { switch (filterConfig.filterComponentType) { - case "input": + case 'input': return ( - + - + ); - case "dropdown": + case 'dropdown': return ( - + - + - + ); - case "multiselect": + case 'multiselect': return ( - + - + - + ); default: return null; - }; + } } else { return null; } diff --git a/src/main/cliapp/src/components/Filters/FilterComponentBinaryDropDown.js b/src/main/cliapp/src/components/Filters/FilterComponentBinaryDropDown.js index fb80666fd..61161cedd 100644 --- a/src/main/cliapp/src/components/Filters/FilterComponentBinaryDropDown.js +++ b/src/main/cliapp/src/components/Filters/FilterComponentBinaryDropDown.js @@ -1,8 +1,8 @@ -import React, { useRef } from "react"; -import { Dropdown } from "primereact/dropdown"; +import React, { useRef } from 'react'; +import { Dropdown } from 'primereact/dropdown'; export function FilterComponentBinaryDropDown({ isInEditMode, filterConfig, currentFilters, onFilter }) { - const options = useRef(filterConfig.options || ["true", "false"]); + const options = useRef(filterConfig.options || ['true', 'false']); const fieldSet = filterConfig.fieldSets[0]; @@ -15,17 +15,16 @@ export function FilterComponentBinaryDropDown({ isInEditMode, filterConfig, curr placeholder="Select" onChange={(e) => { let filter = {}; - if(e.target.value && e.target.value.length !== 0) { + if (e.target.value && e.target.value.length !== 0) { filter[fieldSet.fields[0]] = { - queryString : e.target.value, - tokenOperator : "OR" + queryString: e.target.value, }; } else { filter = null; } - //undefined check needs to be in place. Otherwise, the else block below will throw an error - const filtersCopy = currentFilters ? currentFilters : {}; + //undefined check needs to be in place. Otherwise, the else block below will throw an error + const filtersCopy = currentFilters ? currentFilters : {}; if (filter === null) { delete filtersCopy[fieldSet.filterName]; } else { @@ -34,6 +33,5 @@ export function FilterComponentBinaryDropDown({ isInEditMode, filterConfig, curr onFilter(filtersCopy); }} /> - ) + ); } - diff --git a/src/main/cliapp/src/components/Filters/FilterComponentInputText.js b/src/main/cliapp/src/components/Filters/FilterComponentInputText.js index 0a94a1786..39bd2276f 100644 --- a/src/main/cliapp/src/components/Filters/FilterComponentInputText.js +++ b/src/main/cliapp/src/components/Filters/FilterComponentInputText.js @@ -1,14 +1,21 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState } from 'react'; import { InputText } from 'primereact/inputtext'; export function FilterComponentInputText({ isInEditMode, filterConfig, currentFilters, onFilter }) { - const fieldSet = filterConfig.fieldSets[0]; - const [filterValue, setFilterValue] = useState(currentFilters && currentFilters[fieldSet.filterName] ? currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString : ''); + const [filterValue, setFilterValue] = useState( + currentFilters && currentFilters[fieldSet.filterName] + ? currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString + : '' + ); useEffect(() => { - setFilterValue(currentFilters && currentFilters[fieldSet.filterName] ? currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString : ''); + setFilterValue( + currentFilters && currentFilters[fieldSet.filterName] + ? currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString + : '' + ); }, [filterValue, currentFilters, fieldSet]); return ( @@ -21,15 +28,15 @@ export function FilterComponentInputText({ isInEditMode, filterConfig, currentFi if (e.target.value.length !== 0) { fieldSet.fields.forEach((key) => { filter[key] = { - queryString : e.target.value, - tokenOperator : "AND", + queryString: e.target.value, + tokenOperator: 'AND', // add filterConfig.useKeywords - } + }; }); - if(filterConfig.nonNullFields) { + if (filterConfig.nonNullFields) { filter['nonNullFields'] = filterConfig.nonNullFields.fields; } - if(filterConfig.nullFields) { + if (filterConfig.nullFields) { filter['nullFields'] = filterConfig.nullFields.fields; } } else { @@ -45,6 +52,5 @@ export function FilterComponentInputText({ isInEditMode, filterConfig, currentFi onFilter(filtersCopy); }} /> - ) + ); } - diff --git a/src/main/cliapp/src/components/Filters/FilterComponentMultiSelect.js b/src/main/cliapp/src/components/Filters/FilterComponentMultiSelect.js index 5b837248c..80f54e0da 100644 --- a/src/main/cliapp/src/components/Filters/FilterComponentMultiSelect.js +++ b/src/main/cliapp/src/components/Filters/FilterComponentMultiSelect.js @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useState } from 'react'; import { MultiSelect } from 'primereact/multiselect'; import { useQuery } from '@tanstack/react-query'; import { SearchService } from '../../service/SearchService'; @@ -11,38 +11,41 @@ export function FilterComponentMultiSelect({ isInEditMode, filterConfig, current const searchService = new SearchService(); - useQuery([filterConfig.aggregationFieldSet, currentFilters], - () => searchService.search(endpoint, 0, 0, null,{},{}, filterConfig.aggregationFieldSet.fields), { - onSuccess: (data) => { - let tmp = []; - if(data.aggregations){ - for (let key in data.aggregations[fieldSet.fields[0]]) { - tmp.push({ - optionLabel: key, - optionValue: data.aggregations[fieldSet.fields[0]][key] - }); - } - }; - tmp.sort((a, b) => a.optionLabel > b.optionLabel ? 1 : -1); - setSelectableOptions(tmp); - if(currentFilters && currentFilters[fieldSet.filterName]) { - let newSelectedOptions = []; - let queryStrings = currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString.split(" "); - for (let i in tmp) { - for(let j in queryStrings) { - if (tmp[i].optionLabel === queryStrings[j].toLowerCase()) { - newSelectedOptions.push(tmp[i]); - } - } + useQuery( + [filterConfig.aggregationFieldSet, currentFilters], + () => searchService.search(endpoint, 0, 0, null, {}, {}, filterConfig.aggregationFieldSet.fields), + { + onSuccess: (data) => { + let tmp = []; + if (data.aggregations) { + for (let key in data.aggregations[fieldSet.fields[0]]) { + tmp.push({ + optionLabel: key, + optionValue: data.aggregations[fieldSet.fields[0]][key], + }); + } + } + tmp.sort((a, b) => (a.optionLabel > b.optionLabel ? 1 : -1)); + setSelectableOptions(tmp); + if (currentFilters && currentFilters[fieldSet.filterName]) { + let newSelectedOptions = []; + let queryStrings = currentFilters[fieldSet.filterName][fieldSet.fields[0]].queryString.split(' '); + for (let i in tmp) { + for (let j in queryStrings) { + if (tmp[i].optionLabel === queryStrings[j].toLowerCase()) { + newSelectedOptions.push(tmp[i]); } - if(newSelectedOptions.length>0) setSelectedOptions(newSelectedOptions); - } else { - setSelectedOptions([]); - } - }, - keepPreviousData: true, - refetchOnWindowFocus: false - }); + } + } + if (newSelectedOptions.length > 0) setSelectedOptions(newSelectedOptions); + } else { + setSelectedOptions([]); + } + }, + keepPreviousData: true, + refetchOnWindowFocus: false, + } + ); const panelFooterTemplate = () => { const length = selectedOptions ? selectedOptions.length : 0; @@ -54,20 +57,24 @@ export function FilterComponentMultiSelect({ isInEditMode, filterConfig, current }; const itemTemplate = (option) => { - return (
    {option.optionLabel}
    ); + return
    {option.optionLabel}
    ; }; const upperCaseItemTemplate = (option) => { - return (
    {option.optionLabel.toUpperCase()}
    ); + return
    {option.optionLabel.toUpperCase()}
    ; }; const templateSelector = (option) => { - if(fieldSet.filterName === "dataProviderFilter" || fieldSet.filterName === "secondaryDataProviderFilter" || fieldSet.filterName === "evidenceCodesFilter") { + if ( + fieldSet.filterName === 'dataProviderFilter' || + fieldSet.filterName === 'secondaryDataProviderFilter' || + fieldSet.filterName === 'evidenceCodesFilter' + ) { return upperCaseItemTemplate(option); } else { return itemTemplate(option); } - } + }; return ( { - setSelectedOptions(e.target.value); - let filter = {}; - let queryString = ''; - let delim = ""; - if (e.target.value && e.target.value.length !== 0) { - for(let i in e.target.value) { - queryString += delim + e.target.value[i].optionLabel; - delim = " "; - } - filter[fieldSet.fields[0]] = { - useKeywordFields: fieldSet.useKeywordFields, - queryString: queryString, - tokenOperator: "OR" - }; - } else { - filter = null; - } - const filtersCopy = currentFilters ? currentFilters : {}; - if (filter === null) { - delete filtersCopy[fieldSet.filterName]; - } else { - filtersCopy[fieldSet.filterName] = filter; + setSelectedOptions(e.target.value); + let filter = {}; + let queryString = ''; + let delim = ''; + if (e.target.value && e.target.value.length !== 0) { + for (let i in e.target.value) { + queryString += delim + e.target.value[i].optionLabel; + delim = ' '; } - onFilter(filtersCopy); + filter[fieldSet.fields[0]] = { + useKeywordFields: fieldSet.useKeywordFields, + tokenOperator: 'OR', + queryString: queryString, + }; + } else { + filter = null; + } + const filtersCopy = currentFilters ? currentFilters : {}; + if (filter === null) { + delete filtersCopy[fieldSet.filterName]; + } else { + filtersCopy[fieldSet.filterName] = filter; + } + onFilter(filtersCopy); }} /> - ) + ); } - diff --git a/src/main/cliapp/src/components/FormFieldWrapper.js b/src/main/cliapp/src/components/FormFieldWrapper.js index c078a02c8..576b54c72 100644 --- a/src/main/cliapp/src/components/FormFieldWrapper.js +++ b/src/main/cliapp/src/components/FormFieldWrapper.js @@ -1,25 +1,22 @@ export const FormFieldWrapper = ({ - formField, - errorField, - additionalDataField, - labelColumnSize, - widgetColumnSize, - fieldDetailsColumnSize, - fieldName + formField, + errorField, + additionalDataField, + labelColumnSize, + widgetColumnSize, + fieldDetailsColumnSize, + fieldName, }) => { - return ( -
    -
    -

    {fieldName}

    -
    -
    - {formField} - {errorField} -
    -
    - {additionalDataField} -
    -
    - ); - -}; \ No newline at end of file + return ( +
    +
    +

    {fieldName}

    +
    +
    + {formField} + {errorField} +
    +
    {additionalDataField}
    +
    + ); +}; diff --git a/src/main/cliapp/src/components/FormTableWrapper.js b/src/main/cliapp/src/components/FormTableWrapper.js index 4e1bf806c..9b8bdac87 100644 --- a/src/main/cliapp/src/components/FormTableWrapper.js +++ b/src/main/cliapp/src/components/FormTableWrapper.js @@ -1,21 +1,17 @@ -export const FormTableWrapper = ({ - table, - tableName, - showTable, - button, - includeField=false, -}) => { - return ( -
    -
    -
    -

    {tableName}

    -
    - {button} -
    -
    - {showTable && table} -
    -
    - ); -}; \ No newline at end of file +export const FormTableWrapper = ({ table, tableName, showTable, button, includeField = false }) => { + return ( +
    +
    +
    +
    +

    {tableName}

    +
    +
    + {button} +
    +
    + {showTable && table} +
    +
    + ); +}; diff --git a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js index 9212d3e40..d93c1b4db 100644 --- a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js @@ -8,17 +8,15 @@ import { Toast } from 'primereact/toast'; import { MultiSelect } from 'primereact/multiselect'; import { Checkbox } from 'primereact/checkbox'; -import { FilterComponent } from '../Filters/FilterComponent' -import { DataTableHeaderFooterTemplate } from "../DataTableHeaderFooterTemplate"; -import { DuplicationAction } from "../Actions/DuplicationAction"; -import { EntityDetailsAction } from "../Actions/EntityDetailsAction"; - +import { FilterComponent } from '../Filters/FilterComponent'; +import { DataTableHeaderFooterTemplate } from '../DataTableHeaderFooterTemplate'; +import { DuplicationAction } from '../Actions/DuplicationAction'; +import { EntityDetailsAction } from '../Actions/EntityDetailsAction'; import { filterColumns, orderColumns, getIdentifier } from '../../utils/utils'; -import { useGenericDataTable } from "./useGenericDataTable"; +import { useGenericDataTable } from './useGenericDataTable'; export const GenericDataTable = (props) => { - const { tableName, isInEditMode, @@ -29,13 +27,13 @@ export const GenericDataTable = (props) => { deletionEnabled, handleDuplication, duplicationEnabled, - hasDetails=false, + hasDetails = false, dataKey = 'id', deprecateOption = false, modReset = false, highlightObsolete = true, fetching, - isEditable + isEditable, } = props; const { @@ -77,37 +75,38 @@ export const GenericDataTable = (props) => { const [allowDelete, setAllowDelete] = useState(false); const createMultiselectComponent = () => { - return ( { + onChange={(e) => { let orderedSelectedColumnNames = tableState.orderedColumnNames.filter((columnName) => { - return e.value.some(selectedColumn => selectedColumn === columnName); + return e.value.some((selectedColumn) => selectedColumn === columnName); }); - setSelectedColumnNames(orderedSelectedColumnNames) - } - } - className='w-20rem text-center' + setSelectedColumnNames(orderedSelectedColumnNames); + }} + className="w-20rem text-center" disabled={isInEditMode} maxSelectedLabels={4} - />); + /> + ); }; const header = ( ); @@ -129,33 +128,43 @@ export const GenericDataTable = (props) => { const filteredColumns = filterColumns(orderedColumns, tableState.selectedColumnNames); setColumnList(() => { return filteredColumns.map((col) => { - if(col){ - return filterComponentTemplate(col.filterConfig)} - headerStyle={{ padding: '1rem' }} - />; + if (col) { + return ( + filterComponentTemplate(col.filterConfig)} + headerStyle={{ padding: '1rem' }} + /> + ); } else { return null; } - }) + }); }); // eslint-disable-next-line react-hooks/exhaustive-deps }, [tableState, isInEditMode]); const rowEditorFilterNameHeader = (options) => { - return
    Filters
    - } + return ( +
    + Filters +
    + ); + }; const showDeleteOrDeprecateDialog = (props) => { let _idToDelete = props.rowData ? props.rowData[dataKey] : props[dataKey]; @@ -167,7 +176,7 @@ export const GenericDataTable = (props) => { } else { setDeleteDialog(true); } - } + }; const deleteOrDeprecateRow = async (idToDelete, entityToDelete, deprecateOnly) => { setDeleteDialog(false); @@ -182,19 +191,23 @@ export const GenericDataTable = (props) => { } } setAllowDelete(false); - } + }; const deleteAction = (props, disabled) => { return ( -
    + ); +}; diff --git a/src/main/cliapp/src/components/GenericDataTable/useGenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/useGenericDataTable.js index 8836b3736..8c9f19c2b 100644 --- a/src/main/cliapp/src/components/GenericDataTable/useGenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/useGenericDataTable.js @@ -10,7 +10,7 @@ export const useGenericDataTable = ({ tableState, setTableState, tableName, - curieFields, + curieFields, idFields, mutation, setIsInEditMode, @@ -21,13 +21,12 @@ export const useGenericDataTable = ({ totalRecords, columns, defaultColumnWidth, - isEditable, - deletionEnabled, - duplicationEnabled, + isEditable, + deletionEnabled, + duplicationEnabled, hasDetails, - defaultFilters + defaultFilters, }) => { - const [originalRows, setOriginalRows] = useState([]); const [columnList, setColumnList] = useState([]); const [editingRows, setEditingRows] = useState({}); @@ -40,7 +39,7 @@ export const useGenericDataTable = ({ const { toast_topleft, toast_topright } = toasts; const [exceptionDialog, setExceptionDialog] = useState(false); - const [exceptionMessage,setExceptionMessage] = useState(""); + const [exceptionMessage, setExceptionMessage] = useState(''); const onLazyLoad = (event) => { let _tableState = { @@ -48,33 +47,32 @@ export const useGenericDataTable = ({ rows: event.rows, page: event.page, - first: event.first + first: event.first, }; setTableState(_tableState); - } + }; const onFilter = (filtersCopy) => { let _tableState = { ...tableState, - filters: { ...filtersCopy } - } + filters: { ...filtersCopy }, + }; setTableState(_tableState); }; const onSort = (event) => { let _tableState = { ...tableState, - multiSortMeta: returnSorted(event, tableState.multiSortMeta || []) - } + multiSortMeta: returnSorted(event, tableState.multiSortMeta || []), + }; setTableState(_tableState); }; const setSelectedColumnNames = (newValue) => { - let _tableState = { ...tableState, - selectedColumnNames: newValue + selectedColumnNames: newValue, }; setTableState(_tableState); }; @@ -82,21 +80,19 @@ export const useGenericDataTable = ({ const setOrderedColumnNames = (newValue) => { let _tableState = { ...tableState, - orderedColumnNames: newValue + orderedColumnNames: newValue, }; setTableState(_tableState); }; - const setColumnWidths= (newValue) => { + const setColumnWidths = (newValue) => { let _tableState = { ...tableState, - columnWidths: newValue + columnWidths: newValue, }; setTableState(_tableState); }; - - const onRowEditInit = (event) => { setIsInEditMode(true); const index = event.index % tableState.rows; @@ -124,13 +120,13 @@ export const useGenericDataTable = ({ errorMessagesCopy[index] = {}; setErrorMessages({ ...errorMessagesCopy }); - if (uiErrorMessages){ + if (uiErrorMessages) { const uiErrorMessagesCopy = uiErrorMessages; uiErrorMessagesCopy[index] = {}; setUiErrorMessages({ ...uiErrorMessagesCopy }); } }; - + //Todo: at some point it may make sense to refactor this function into a set of smaller utility functions and pass them down from the calling components const onRowEditSave = (event) => { const index = event.index % tableState.rows; @@ -141,9 +137,9 @@ export const useGenericDataTable = ({ setIsInEditMode(false); } - let updatedRow = global.structuredClone(event.data);//deep copy - - if(tableName === "Disease Annotations"){ + let updatedRow = global.structuredClone(event.data); //deep copy + + if (tableName === 'Disease Annotations') { validateBioEntityFields(updatedRow, setUiErrorMessages, event, setIsInEditMode, closeRowRef, areUiErrors); } @@ -152,7 +148,7 @@ export const useGenericDataTable = ({ return; } - if(curieFields){ + if (curieFields) { curieFields.forEach((field) => { if (event.data[field] && Object.keys(event.data[field]).length >= 1) { const curie = trimWhitespace(event.data[field].curie); @@ -162,14 +158,14 @@ export const useGenericDataTable = ({ }); } - if(idFields){ + if (idFields) { idFields.forEach((field) => { if (event.data[field] && Object.keys(event.data[field]).length >= 1) { const id = event.data[field].id; updatedRow[field] = {}; updatedRow[field].id = id; } - }) + }); } mutation.mutate(updatedRow, { @@ -185,24 +181,23 @@ export const useGenericDataTable = ({ }, onError: (error, variables, context) => { setIsInEditMode(true); - let errorMessage = ""; - if(error.response.data.errorMessage !== undefined) { + let errorMessage = ''; + if (error.response.data.errorMessage !== undefined) { errorMessage = error.response.data.errorMessage; toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', detail: errorMessage, sticky: false } + { life: 7000, severity: 'error', summary: 'Update error: ', detail: errorMessage, sticky: false }, ]); if (error.response.data.errorMessages && Object.keys(error.response.data.errorMessages).length > 0) { let messages = []; for (let errorField in error.response.data.errorMessages) { - messages.push(errorField + ": " + error.response.data.errorMessages[errorField]); + messages.push(errorField + ': ' + error.response.data.errorMessages[errorField]); } - let messageSummary = messages.join(" / "); + let messageSummary = messages.join(' / '); toast_topleft.current.show([ - { life: 7000, severity: 'error', summary: 'Errors found: ', detail: messageSummary, sticky: false } + { life: 7000, severity: 'error', summary: 'Errors found: ', detail: messageSummary, sticky: false }, ]); } - } - else if(error.response.data !== undefined) { + } else if (error.response.data !== undefined) { setExceptionMessage(error.response.data); setExceptionDialog(true); } @@ -211,15 +206,15 @@ export const useGenericDataTable = ({ const errorMessagesCopy = global.structuredClone(errorMessages); errorMessagesCopy[index] = {}; - if(error.response.data.errorMessages !== undefined) { + if (error.response.data.errorMessages !== undefined) { Object.keys(error.response.data.errorMessages).forEach((field) => { let messageObject = { - severity: "error", - message: error.response.data.errorMessages[field] + severity: 'error', + message: error.response.data.errorMessages[field], }; errorMessagesCopy[index][field] = messageObject; }); - setErrorMessages({...errorMessagesCopy}); + setErrorMessages({ ...errorMessagesCopy }); } setEntities(_entities); @@ -234,45 +229,58 @@ export const useGenericDataTable = ({ let result = await deletionMethod(entityToDelete); if (result.isError) { toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Could not delete ' + endpoint + - ' [' + idToDelete + ']', sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Could not delete ' + endpoint + ' [' + idToDelete + ']', + sticky: false, + }, ]); let deletionErrorMessage = result?.message ? result.message : null; return deletionErrorMessage; } else { toast_topright.current.show([ - { life: 7000, severity: 'success', summary: 'Deletion successful: ', - detail: 'Deletion of ' + endpoint + ' [' + idToDelete + '] was successful', sticky: false } + { + life: 7000, + severity: 'success', + summary: 'Deletion successful: ', + detail: 'Deletion of ' + endpoint + ' [' + idToDelete + '] was successful', + sticky: false, + }, ]); let _entities = global.structuredClone(entities); if (editingRows[idToDelete]) { - let _editingRows = { ...editingRows}; + let _editingRows = { ...editingRows }; delete _editingRows[idToDelete]; setEditingRows(_editingRows); const rowsInEdit = Object.keys(editingRows).length; if (rowsInEdit === 0) { setIsInEditMode(false); - }; + } } setEntities(_entities); let _tableState = { ...tableState, - rows: tableState.rows - 1 - } + rows: tableState.rows - 1, + }; setTableState(_tableState); setTotalRecords(totalRecords - 1); return null; } - } + }; const handleDeprecation = (entityToDeprecate) => { areUiErrors.current = false; - let updatedRow = global.structuredClone(entityToDeprecate);//deep copy + let updatedRow = global.structuredClone(entityToDeprecate); //deep copy updatedRow.obsolete = true; - - let deprecatedIndex = entities.map(function(e) {return e.id;}).indexOf(updatedRow.id); + + let deprecatedIndex = entities + .map(function (e) { + return e.id; + }) + .indexOf(updatedRow.id); mutation.mutate(updatedRow, { onSuccess: (response, variables, context) => { @@ -287,91 +295,96 @@ export const useGenericDataTable = ({ }, onError: (error, variables, context) => { setIsInEditMode(true); - let errorMessage = ""; - if(error.response.data.errorMessage !== undefined) { + let errorMessage = ''; + if (error.response.data.errorMessage !== undefined) { errorMessage = error.response.data.errorMessage; toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', detail: errorMessage, sticky: false } + { life: 7000, severity: 'error', summary: 'Update error: ', detail: errorMessage, sticky: false }, ]); - } - else if(error.response.data !== undefined) { + } else if (error.response.data !== undefined) { setExceptionMessage(error.response.data); setExceptionDialog(true); } let _entities = global.structuredClone(entities); - + const errorMessagesCopy = global.structuredClone(errorMessages); errorMessagesCopy[deprecatedIndex] = {}; - if(error.response.data.errorMessages !== undefined) { + if (error.response.data.errorMessages !== undefined) { Object.keys(error.response.data.errorMessages).forEach((field) => { let messageObject = { - severity: "error", - message: error.response.data.errorMessages[field] + severity: 'error', + message: error.response.data.errorMessages[field], }; errorMessagesCopy[deprecatedIndex][field] = messageObject; }); - setErrorMessages({...errorMessagesCopy}); + setErrorMessages({ ...errorMessagesCopy }); } setEntities(_entities); }, }); }; - const onRowEditChange = (event) => { const index = event.index % tableState.rows; //keep the row in edit mode if there are UI validation errors - if(closeRowRef.current[index] === false){ + if (closeRowRef.current[index] === false) { return; } setEditingRows(event.data); }; const setToModDefault = () => { - const modTableState = getModTableState(tableState.tableKeyName, tableState.defaultColumnWidths, tableState.defaultColumnNames); + const modTableState = getModTableState( + tableState.tableKeyName, + tableState.defaultColumnWidths, + tableState.defaultColumnNames + ); restoreTableState( - columns, - dataTable, - modTableState.orderedColumnNames, - isEditable, - deletionEnabled, - duplicationEnabled, - hasDetails, + columns, + dataTable, + modTableState.orderedColumnNames, + isEditable, + deletionEnabled, + duplicationEnabled, + hasDetails, modTableState ); dataTable.current.resetScroll(); setTableState(modTableState); - } - + }; + const resetTableState = () => { let defaultTableState = getDefaultTableState(tableState.tableKeyName, columns, defaultColumnWidth, defaultFilters); restoreTableState( - columns, - dataTable, - defaultTableState.orderedColumnNames, - isEditable, - deletionEnabled, - duplicationEnabled, - hasDetails, + columns, + dataTable, + defaultTableState.orderedColumnNames, + isEditable, + deletionEnabled, + duplicationEnabled, + hasDetails, defaultTableState ); dataTable.current.resetScroll(); setTableState(defaultTableState); - } + }; const colReorderHandler = (event) => { - const columnNames = event.columns.filter((column) => { - return column.props.field !== 'rowEditor' - && column.props.field !== 'delete' - && column.props.field !== 'duplicate' - && column.props.field !== 'details'; - }) - .map(column => column.props.header); - - for(let i = 0; i < tableState.orderedColumnNames.length; i++) { - if(!columnNames.includes(tableState.orderedColumnNames[i])) { + const columnNames = event.columns + .filter((column) => { + return ( + column.props.field !== 'rowEditor' && + column.props.field !== 'delete' && + column.props.field !== 'duplicate' && + column.props.field !== 'details' + ); + }) + .map((column) => column.props.header); + + for (let i = 0; i < tableState.orderedColumnNames.length; i++) { + if (!columnNames.includes(tableState.orderedColumnNames[i])) { columnNames.splice(i, 0, tableState.orderedColumnNames[i]); } } @@ -384,7 +397,7 @@ export const useGenericDataTable = ({ const newWidth = Math.floor(((currentWidth + delta) / window.innerWidth) * 100); const field = event.column.props.field; - const _columnWidths = {...tableState.columnWidths}; + const _columnWidths = { ...tableState.columnWidths }; _columnWidths[field] = newWidth; setColumnWidths(_columnWidths); diff --git a/src/main/cliapp/src/components/GenericDataTree.js b/src/main/cliapp/src/components/GenericDataTree.js index f6da0bc1f..27d461bb2 100644 --- a/src/main/cliapp/src/components/GenericDataTree.js +++ b/src/main/cliapp/src/components/GenericDataTree.js @@ -6,27 +6,25 @@ import { Card } from 'primereact/card'; import { OntologyService } from '../service/OntologyService'; export const GenericDataTree = (props) => { - const [nodes, setNodes] = useState(null); const [loading, setLoading] = useState(true); const [selectedTerm, setSelectedTerm] = useState(); const findNodeToModify = (nodes, id) => { - for(var node of nodes) { - if(node.children) { + for (var node of nodes) { + if (node.children) { var found = findNodeToModify(node.children, id); - if(found !== null) return found; + if (found !== null) return found; } else { - if(node.curie === id) { + if (node.curie === id) { return node; } } } return null; - } + }; const loadOnExpand = (event) => { - if (!event.node.children) { setLoading(true); @@ -36,20 +34,19 @@ export const GenericDataTree = (props) => { var modifyNode = findNodeToModify(_nodes, event.node.curie); ontologyService.getChildren(event.node.curie).then((res) => { - if(res.data.entities) { + if (res.data.entities) { modifyNode.children = []; - for(var node of res.data.entities) { + for (var node of res.data.entities) { node.key = node.curie; - node.label = node.name + " (" + node.curie + ")"; - if(node?.childCount && node.childCount > 0) { + node.label = node.name + ' (' + node.curie + ')'; + if (node?.childCount && node.childCount > 0) { node.leaf = false; - } - else{ + } else { node.leaf = true; } modifyNode.children.push(node); } - modifyNode.children.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase()) ? 1 : -1); + modifyNode.children.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1)); } else { modifyNode.leaf = true; } @@ -57,46 +54,45 @@ export const GenericDataTree = (props) => { setLoading(false); }); } - } + }; const onNodeSelect = (event) => { - //console.log(event.node); + //console.log(event.node); - const ontologyService = new OntologyService(props.endpoint); - ontologyService.getTerm(event.node.curie).then((res) => { + const ontologyService = new OntologyService(props.endpoint); + ontologyService.getTerm(event.node.curie).then((res) => { console.log(res.data.entity); setSelectedTerm(res.data.entity); }); - } + }; useEffect(() => { const ontologyService = new OntologyService(props.endpoint); ontologyService.getRootNodes().then((res) => { var _nodes = []; var count = 0; - for(var node of res.data.entities) { - if(node.obsolete === true) { + for (var node of res.data.entities) { + if (node.obsolete === true) { continue; } node.key = node.curie; - node.label = node.name + " (" + node.curie + ")"; - if(node?.childCount && node.childCount > 0) { + node.label = node.name + ' (' + node.curie + ')'; + if (node?.childCount && node.childCount > 0) { node.leaf = false; - } - else{ + } else { node.leaf = true; } _nodes.push(node); count = count + 1; } - _nodes.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase()) ? 1 : -1); + _nodes.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1)); setNodes(_nodes); setLoading(false); }); }, []); // eslint-disable-line react-hooks/exhaustive-deps return ( - +
    @@ -112,11 +108,12 @@ export const GenericDataTree = (props) => {
    -
    {JSON.stringify(selectedTerm, null, 2) }
    +
    +
    {JSON.stringify(selectedTerm, null, 2)}
    +
    - ) - -} + ); +}; diff --git a/src/main/cliapp/src/components/HealthComponent.js b/src/main/cliapp/src/components/HealthComponent.js index a8d72b5e9..c10c74686 100644 --- a/src/main/cliapp/src/components/HealthComponent.js +++ b/src/main/cliapp/src/components/HealthComponent.js @@ -4,25 +4,22 @@ import { Button } from 'primereact/button'; import { HealthService } from '../service/HealthService'; export const HealthComponent = () => { - const [health, setHealth] = useState(null); const [refresh, setRefresh] = useState(false); - + const healthService = new HealthService(); - useQuery(['getHealth', refresh], - () => healthService.getHealth(), { - onSuccess: (results) => { - // console.log(results); - setHealth(results); - }, - onError: (error) => { - console.log(error); - }, - keepPreviousData: true, - refetchOnWindowFocus: false - } - ); + useQuery(['getHealth', refresh], () => healthService.getHealth(), { + onSuccess: (results) => { + // console.log(results); + setHealth(results); + }, + onError: (error) => { + console.log(error); + }, + keepPreviousData: true, + refetchOnWindowFocus: false, + }); return (
    @@ -30,7 +27,9 @@ export const HealthComponent = () => {

    Health Status

    -
    {JSON.stringify(health, null, 2) }
    +
    +
    {JSON.stringify(health, null, 2)}
    +
    - ) -} + ); +}; diff --git a/src/main/cliapp/src/components/InputTextAreaEditor.js b/src/main/cliapp/src/components/InputTextAreaEditor.js index 20ad01840..1621d4d71 100644 --- a/src/main/cliapp/src/components/InputTextAreaEditor.js +++ b/src/main/cliapp/src/components/InputTextAreaEditor.js @@ -1,13 +1,13 @@ import React, { useState } from 'react'; -import { InputTextarea } from "primereact/inputtextarea"; +import { InputTextarea } from 'primereact/inputtextarea'; -export const InputTextAreaEditor = ({ initalValue, editorChange, rows, columns}) => { +export const InputTextAreaEditor = ({ initalValue, editorChange, rows, columns }) => { const [fieldValue, setFieldValue] = useState(initalValue ? initalValue : ''); const onChange = (event) => { setFieldValue(event.value); editorChange(event); - } + }; return ( <> @@ -19,5 +19,5 @@ export const InputTextAreaEditor = ({ initalValue, editorChange, rows, columns}) cols={columns} /> - ) -} + ); +}; diff --git a/src/main/cliapp/src/components/InputTextEditor.js b/src/main/cliapp/src/components/InputTextEditor.js index 68965e573..ea53aced1 100644 --- a/src/main/cliapp/src/components/InputTextEditor.js +++ b/src/main/cliapp/src/components/InputTextEditor.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { InputText } from "primereact/inputtext" +import { InputText } from 'primereact/inputtext'; export function InputTextEditor({ rowProps, fieldName }) { const [fieldValue, setFieldValue] = useState(rowProps.rowData[fieldName] ? rowProps.rowData[fieldName] : ''); @@ -10,20 +10,15 @@ export function InputTextEditor({ rowProps, fieldName }) { updatedConditions[rowProps.rowIndex][fieldName] = event.target.value; setFieldValue(updatedConditions[rowProps.rowIndex][fieldName]); } - } + }; const onChange = (e) => { // setSelectedValue(e.value) - editorChange(e) - } + editorChange(e); + }; return ( <> - onChange(e)} - style={{ width: '100%' }} - /> + onChange(e)} style={{ width: '100%' }} /> - ) + ); } diff --git a/src/main/cliapp/src/components/ListTableCell.js b/src/main/cliapp/src/components/ListTableCell.js index a08aaee14..8be3d1867 100644 --- a/src/main/cliapp/src/components/ListTableCell.js +++ b/src/main/cliapp/src/components/ListTableCell.js @@ -1,16 +1,13 @@ import React from 'react'; export const ListTableCell = ({ template, listData, showBullets }) => { - let suppress = 'list-none' - if(showBullets) - suppress = '' + let suppress = 'list-none'; + if (showBullets) suppress = ''; return (
      - {listData?.map((item, index) => -
    • - {template(item)} -
    • - )} + {listData?.map((item, index) => ( +
    • {template(item)}
    • + ))}
    ); -} +}; diff --git a/src/main/cliapp/src/components/LoadingOverlay.js b/src/main/cliapp/src/components/LoadingOverlay.js index 7ca657f97..4be4e1be5 100644 --- a/src/main/cliapp/src/components/LoadingOverlay.js +++ b/src/main/cliapp/src/components/LoadingOverlay.js @@ -1,10 +1,10 @@ export const LoadingOverlay = ({ isLoading }) => { - if (!isLoading) return null; - return ( -
    -
    -

    Saving in progress...

    -
    -
    - ); -}; \ No newline at end of file + if (!isLoading) return null; + return ( +
    +
    +

    Saving in progress...

    +
    +
    + ); +}; diff --git a/src/main/cliapp/src/components/MetricsComponent.js b/src/main/cliapp/src/components/MetricsComponent.js index 389beb589..b65ebd9db 100644 --- a/src/main/cliapp/src/components/MetricsComponent.js +++ b/src/main/cliapp/src/components/MetricsComponent.js @@ -6,25 +6,22 @@ import { Button } from 'primereact/button'; import { MetricService } from '../service/MetricService'; export const MetricsComponent = () => { - const [metrics, setMetrics] = useState(null); const [refresh, setRefresh] = useState(false); - + const metricService = new MetricService(); - useQuery(['getMetrics', refresh], - () => metricService.getMetrics(), { - onSuccess: (results) => { - //console.log(data); - setMetrics(results); - }, - onError: (error) => { - console.log(error); - }, - keepPreviousData: true, - refetchOnWindowFocus: false - } - ); + useQuery(['getMetrics', refresh], () => metricService.getMetrics(), { + onSuccess: (results) => { + //console.log(data); + setMetrics(results); + }, + onError: (error) => { + console.log(error); + }, + keepPreviousData: true, + refetchOnWindowFocus: false, + }); return (
    @@ -41,9 +38,9 @@ export const MetricsComponent = () => { - +
    - ) -} + ); +}; diff --git a/src/main/cliapp/src/components/NameSlotAnnotationComponent.js b/src/main/cliapp/src/components/NameSlotAnnotationComponent.js index de4f84f63..735f56022 100644 --- a/src/main/cliapp/src/components/NameSlotAnnotationComponent.js +++ b/src/main/cliapp/src/components/NameSlotAnnotationComponent.js @@ -1,4 +1,4 @@ -import React from 'react' +import React from 'react'; import { EllipsisTableCell } from './EllipsisTableCell'; import { DialogErrorMessageComponent } from './Error/DialogErrorMessageComponent'; import { InputTextEditor } from './InputTextEditor'; @@ -18,11 +18,8 @@ export const synonymUrlTemplate = (rowData) => { export const synonymUrlEditorTemplate = (props, errorMessages) => { return ( <> - - + + ); }; @@ -34,11 +31,8 @@ export const displayTextTemplate = (rowData) => { export const displayTextEditorTemplate = (props, errorMessages) => { return ( <> - - + + ); }; @@ -50,11 +44,8 @@ export const formatTextTemplate = (rowData) => { export const formatTextEditorTemplate = (props, errorMessages) => { return ( <> - - + + ); }; diff --git a/src/main/cliapp/src/components/RelatedNotesDialog.js b/src/main/cliapp/src/components/RelatedNotesDialog.js index e93cb3a24..7bb15d01a 100644 --- a/src/main/cliapp/src/components/RelatedNotesDialog.js +++ b/src/main/cliapp/src/components/RelatedNotesDialog.js @@ -14,22 +14,27 @@ import { useControlledVocabularyService } from '../service/useControlledVocabula import { useVocabularyTermSetService } from '../service/useVocabularyTermSetService'; import { ValidationService } from '../service/ValidationService'; import { ControlledVocabularyDropdown } from './ControlledVocabularySelector'; -import { autocompleteSearch, buildAutocompleteFilter, multipleAutocompleteOnChange, getRefStrings } from '../utils/utils'; +import { + autocompleteSearch, + buildAutocompleteFilter, + multipleAutocompleteOnChange, + getRefStrings, +} from '../utils/utils'; import { LiteratureAutocompleteTemplate } from './Autocomplete/LiteratureAutocompleteTemplate'; import { ListTableCell } from './ListTableCell'; import { AutocompleteMultiEditor } from './Autocomplete/AutocompleteMultiEditor'; import { SearchService } from '../service/SearchService'; export const RelatedNotesDialog = ({ - originalRelatedNotesData, - setOriginalRelatedNotesData, - errorMessagesMainRow, - setErrorMessagesMainRow, - noteTypeVocabularyTermSet, - showReferences=true - }) => { + originalRelatedNotesData, + setOriginalRelatedNotesData, + errorMessagesMainRow, + setErrorMessagesMainRow, + noteTypeVocabularyTermSet, + showReferences = true, +}) => { const { originalRelatedNotes, isInEdit, dialog, rowIndex, mainRowProps } = originalRelatedNotesData; - const [localRelatedNotes, setLocalRelatedNotes] = useState(null) ; + const [localRelatedNotes, setLocalRelatedNotes] = useState(null); const [editingRows, setEditingRows] = useState({}); const [errorMessages, setErrorMessages] = useState([]); const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); @@ -44,15 +49,15 @@ export const RelatedNotesDialog = ({ let _localRelatedNotes = cloneNotes(originalRelatedNotes); setLocalRelatedNotes(_localRelatedNotes); - if(isInEdit){ + if (isInEdit) { let rowsObject = {}; - if(_localRelatedNotes) { + if (_localRelatedNotes) { _localRelatedNotes.forEach((note) => { rowsObject[`${note.dataKey}`] = true; }); } setEditingRows(rowsObject); - }else{ + } else { setEditingRows({}); } rowsEdited.current = 0; @@ -60,14 +65,14 @@ export const RelatedNotesDialog = ({ const onRowEditChange = (e) => { setEditingRows(e.data); - } + }; const onRowEditCancel = (event) => { let _editingRows = { ...editingRows }; delete _editingRows[event.index]; setEditingRows(_editingRows); - let _localRelatedNotes = [...localRelatedNotes];//add new note support - if(originalRelatedNotes && originalRelatedNotes[event.index]){ + let _localRelatedNotes = [...localRelatedNotes]; //add new note support + if (originalRelatedNotes && originalRelatedNotes[event.index]) { let dataKey = _localRelatedNotes[event.index].dataKey; _localRelatedNotes[event.index] = global.structuredClone(originalRelatedNotes[event.index]); _localRelatedNotes[event.index].dataKey = dataKey; @@ -76,15 +81,16 @@ export const RelatedNotesDialog = ({ const errorMessagesCopy = errorMessages; errorMessagesCopy[event.index] = {}; setErrorMessages(errorMessagesCopy); - compareChangesInNotes(event.data,event.index); + compareChangesInNotes(event.data, event.index); }; - const compareChangesInNotes = (data,index) => { - if(originalRelatedNotes && originalRelatedNotes[index]) { - if ((originalRelatedNotes[index].references && !data.references) || - (!originalRelatedNotes[index].references && data.references) || - (data.references && (data.references.length !== originalRelatedNotes[index].references.length)) - ) { + const compareChangesInNotes = (data, index) => { + if (originalRelatedNotes && originalRelatedNotes[index]) { + if ( + (originalRelatedNotes[index].references && !data.references) || + (!originalRelatedNotes[index].references && data.references) || + (data.references && data.references.length !== originalRelatedNotes[index].references.length) + ) { rowsEdited.current++; } else { if (data.references) { @@ -105,13 +111,13 @@ export const RelatedNotesDialog = ({ rowsEdited.current++; } } - - if((localRelatedNotes.length > originalRelatedNotes?.length) || !originalRelatedNotes){ + + if (localRelatedNotes.length > originalRelatedNotes?.length || !originalRelatedNotes) { rowsEdited.current++; } }; - const onRowEditSave = async(event) => { + const onRowEditSave = async (event) => { const result = await validateNote(localRelatedNotes[event.index]); const errorMessagesCopy = [...errorMessages]; errorMessagesCopy[event.index] = {}; @@ -120,21 +126,26 @@ export const RelatedNotesDialog = ({ let reported = false; Object.keys(result.data).forEach((field) => { let messageObject = { - severity: "error", - message: result.data[field] + severity: 'error', + message: result.data[field], }; errorMessagesCopy[event.index][field] = messageObject; - if(!reported) { + if (!reported) { toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', - detail: 'Could not update note [' + localRelatedNotes[event.index].id + ']', sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Update error: ', + detail: 'Could not update note [' + localRelatedNotes[event.index].id + ']', + sticky: false, + }, ]); reported = true; } }); } else { delete _editingRows[event.index]; - compareChangesInNotes(event.data,event.index); + compareChangesInNotes(event.data, event.index); } setErrorMessages(errorMessagesCopy); let _localRelatedNotes = [...localRelatedNotes]; @@ -164,25 +175,25 @@ export const RelatedNotesDialog = ({ const cloneNotes = (clonableNotes) => { let _clonableNotes = global.structuredClone(clonableNotes); - if(_clonableNotes) { - let counter = 0 ; + if (_clonableNotes) { + let counter = 0; _clonableNotes.forEach((note) => { note.dataKey = counter++; }); } else { _clonableNotes = []; - }; + } return _clonableNotes; }; const createNewNoteHandler = (event) => { let cnt = localRelatedNotes ? localRelatedNotes.length : 0; localRelatedNotes.push({ - dataKey : cnt, + dataKey: cnt, noteType: { - name : "" + name: '', }, - internal : false + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -199,20 +210,19 @@ export const RelatedNotesDialog = ({ const errorMessagesCopy = global.structuredClone(errorMessagesMainRow); let messageObject = { - severity: "warn", - message: "Pending Edits!" + severity: 'warn', + message: 'Pending Edits!', }; errorMessagesCopy[rowIndex] = {}; - errorMessagesCopy[rowIndex]["relatedNotes"] = messageObject; - setErrorMessagesMainRow({...errorMessagesCopy}); - + errorMessagesCopy[rowIndex]['relatedNotes'] = messageObject; + setErrorMessagesMainRow({ ...errorMessagesCopy }); + setOriginalRelatedNotesData((originalRelatedNotesData) => { - return { - ...originalRelatedNotesData, - dialog: false, - } - } - ); + return { + ...originalRelatedNotesData, + dialog: false, + }; + }); }; const noteTypeTemplate = (rowData) => { @@ -230,7 +240,7 @@ export const RelatedNotesDialog = ({ const onInternalEditorValueChange = (props, event) => { let _localRelatedNotes = [...localRelatedNotes]; _localRelatedNotes[props.rowIndex].internal = event.value.name; - } + }; const internalEditor = (props) => { return ( @@ -239,9 +249,9 @@ export const RelatedNotesDialog = ({ options={booleanTerms} editorChange={onInternalEditorValueChange} props={props} - field={"internal"} + field={'internal'} /> - + ); }; @@ -256,13 +266,13 @@ export const RelatedNotesDialog = ({ <> (a.name > b.name) ? 1 : -1)} + options={noteTypeTerms.sort((a, b) => (a.name > b.name ? 1 : -1))} editorChange={onNoteTypeEditorValueChange} props={props} showClear={false} - dataKey='id' + dataKey="id" /> - + ); }; @@ -274,7 +284,7 @@ export const RelatedNotesDialog = ({ const freeTextEditor = (props, fieldName, errorMessages) => { if (errorMessages) { - errorMessages.severity = "error"; + errorMessages.severity = 'error'; } return ( <> @@ -293,16 +303,12 @@ export const RelatedNotesDialog = ({ if (rowData && rowData.references) { const refStrings = getRefStrings(rowData.references); const listTemplate = (item) => { - return ( - - {item} - - ); + return {item}; }; - return + return ; } }; - + const evidenceEditorTemplate = (props, errorMessages) => { return ( <> @@ -310,103 +316,160 @@ export const RelatedNotesDialog = ({ search={evidenceSearch} initialValue={props.rowData.references} rowProps={props} - fieldName='references' - subField='curie' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="references" + subField="curie" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onEvidenceValueChange} /> - + ); }; - + const onEvidenceValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "references", setFieldValue); + multipleAutocompleteOnChange(props, event, 'references', setFieldValue); }; - + const evidenceSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "evidenceFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'evidenceFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); - + setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const footerTemplate = () => { if (!isInEdit) { return null; - }; + } return (
    ); - } + }; const handleDeleteRelatedNote = (event, props) => { - let _localRelatedNotes = global.structuredClone(localRelatedNotes); - if(props.dataKey){ + let _localRelatedNotes = global.structuredClone(localRelatedNotes); + if (props.dataKey) { _localRelatedNotes.splice(props.dataKey, 1); - }else { + } else { _localRelatedNotes.splice(props.rowIndex, 1); } setLocalRelatedNotes(_localRelatedNotes); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    - ); - }; + const footerTemplate = () => { + return ( +
    +
    + ); + }; - let headerGroup = - - - - - - - ; + let headerGroup = ( + + + + + + + + + ); - const onRowEditChange = (e) => { - return null; - }; - - - return ( -
    - -

    Related Notes

    - - } - className='max-w-4rem' bodyClassName="text-center" headerClassName='surface-0' frozen /> - - freeTextEditor(props, "freeText", errorMessages)} - field="freeText" - header="Text" - headerClassName='surface-0' - className='wrap-word max-w-35rem' - /> - { - return ; - }} - field="internal" header="Internal" headerClassName='surface-0' /> - -
    -
    - ); + const onRowEditChange = (e) => { + return null; + }; + return ( +
    + +

    Related Notes

    + + } + className="max-w-4rem" + bodyClassName="text-center" + headerClassName="surface-0" + frozen + /> + + freeTextEditor(props, 'freeText', errorMessages)} + field="freeText" + header="Text" + headerClassName="surface-0" + className="wrap-word max-w-35rem" + /> + { + return ( + + ); + }} + field="internal" + header="Internal" + headerClassName="surface-0" + /> + +
    +
    + ); }; diff --git a/src/main/cliapp/src/components/StickyHeader.js b/src/main/cliapp/src/components/StickyHeader.js index ecf693110..1f67d296a 100644 --- a/src/main/cliapp/src/components/StickyHeader.js +++ b/src/main/cliapp/src/components/StickyHeader.js @@ -1,7 +1,3 @@ export const StickyHeader = ({ children }) => { - return ( -
    - {children} -
    - ); -}; \ No newline at end of file + return
    {children}
    ; +}; diff --git a/src/main/cliapp/src/components/Templates/BooleanTemplate.js b/src/main/cliapp/src/components/Templates/BooleanTemplate.js index e29dc4fd3..c22ef1c10 100644 --- a/src/main/cliapp/src/components/Templates/BooleanTemplate.js +++ b/src/main/cliapp/src/components/Templates/BooleanTemplate.js @@ -1,7 +1,7 @@ -import React from 'react' +import React from 'react'; import { EllipsisTableCell } from '../EllipsisTableCell'; export const BooleanTemplate = ({ value }) => { if (value === null || value === undefined || typeof value !== 'boolean') return null; return {JSON.stringify(value)}; -} +}; diff --git a/src/main/cliapp/src/components/Templates/CommaSeparatedArrayTemplate.js b/src/main/cliapp/src/components/Templates/CommaSeparatedArrayTemplate.js index 2c468c9de..c84af9d98 100644 --- a/src/main/cliapp/src/components/Templates/CommaSeparatedArrayTemplate.js +++ b/src/main/cliapp/src/components/Templates/CommaSeparatedArrayTemplate.js @@ -1,6 +1,6 @@ export const CommaSeparatedArrayTemplate = ({ array }) => { - if (Array.isArray(array) && array.length > 0) { - return array.join(', '); - } - return null; -}; \ No newline at end of file + if (Array.isArray(array) && array.length > 0) { + return array.join(', '); + } + return null; +}; diff --git a/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js b/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js index d3ddb6a4e..92ae9b616 100644 --- a/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js +++ b/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js @@ -1,30 +1,28 @@ -import { EllipsisTableCell } from "../EllipsisTableCell"; -import { ListTableCell } from "../ListTableCell"; -import { Tooltip } from "primereact/tooltip"; +import { EllipsisTableCell } from '../EllipsisTableCell'; +import { ListTableCell } from '../ListTableCell'; +import { Tooltip } from 'primereact/tooltip'; export const CrossReferencesTemplate = ({ xrefs }) => { - if (!xrefs || xrefs.length === 0) return null; + if (!xrefs || xrefs.length === 0) return null; - const targetClass = `a${global.crypto.randomUUID()}`; + const targetClass = `a${global.crypto.randomUUID()}`; - const sortedXrefs = xrefs.sort((a, b) => (a.displayName > b.displayName) ? 1 : (a.resourceDescriptorPage.name === b.resourceDescriptorPage.name) ? 1 : -1); + const sortedXrefs = xrefs.sort((a, b) => + a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 + ); - const listTemplate = (item) => { - return ( - - {item.displayName + ' (' + item.resourceDescriptorPage.name + ')'} - - ); - }; + const listTemplate = (item) => { + return {item.displayName + ' (' + item.resourceDescriptorPage.name + ')'}; + }; - return ( - <> -
    - -
    - - - - - ); -}; \ No newline at end of file + return ( + <> +
    + +
    + + + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/DataProviderFormTemplate.js b/src/main/cliapp/src/components/Templates/DataProviderFormTemplate.js index 13c00304f..c7f281dbf 100644 --- a/src/main/cliapp/src/components/Templates/DataProviderFormTemplate.js +++ b/src/main/cliapp/src/components/Templates/DataProviderFormTemplate.js @@ -1,24 +1,23 @@ -import { FormFieldWrapper } from "../FormFieldWrapper"; +import { FormFieldWrapper } from '../FormFieldWrapper'; export const DataProviderFormTemplate = ({ - dataProvider, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, + dataProvider, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, }) => { + if (!dataProvider) return null; - if (!dataProvider) return null; - - return ( - <> - - - ); -}; \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/DateFormTemplate.js b/src/main/cliapp/src/components/Templates/DateFormTemplate.js index 4ce8b8013..56928b74c 100644 --- a/src/main/cliapp/src/components/Templates/DateFormTemplate.js +++ b/src/main/cliapp/src/components/Templates/DateFormTemplate.js @@ -1,25 +1,18 @@ -import { FormFieldWrapper } from "../FormFieldWrapper"; +import { FormFieldWrapper } from '../FormFieldWrapper'; -export const DateFormTemplate = ({ - date, - fieldName, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, -}) => { +export const DateFormTemplate = ({ date, fieldName, widgetColumnSize, labelColumnSize, fieldDetailsColumnSize }) => { + if (!date) date = No data; - if (!date) date = No data; - - return ( - <> - - - ); -}; \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js b/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js index a6c48a786..2d78a8a4c 100644 --- a/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js +++ b/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js @@ -1,15 +1,15 @@ -import { ListTableCell } from "../ListTableCell"; +import { ListTableCell } from '../ListTableCell'; export const DiseaseQualifiersTemplate = ({ diseaseQualifiers }) => { - if (!diseaseQualifiers || diseaseQualifiers.length === 0) return null; + if (!diseaseQualifiers || diseaseQualifiers.length === 0) return null; - const sortedDiseaseQualifiers = diseaseQualifiers.sort((a, b) => (a.name > b.name) ? 1 : -1); + const sortedDiseaseQualifiers = diseaseQualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); - const listTemplate = (item) => item.name; + const listTemplate = (item) => item.name; - return ( -
    - -
    - ); -}; \ No newline at end of file + return ( +
    + +
    + ); +}; diff --git a/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js b/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js index 1db0b029c..b765f7786 100644 --- a/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js +++ b/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js @@ -1,30 +1,28 @@ -import { EllipsisTableCell } from "../EllipsisTableCell"; -import { ListTableCell } from "../ListTableCell"; -import { Tooltip } from "primereact/tooltip"; +import { EllipsisTableCell } from '../EllipsisTableCell'; +import { ListTableCell } from '../ListTableCell'; +import { Tooltip } from 'primereact/tooltip'; export const EvidenceCodesTemplate = ({ evidenceCodes }) => { - if (!evidenceCodes || evidenceCodes.length === 0) return null; + if (!evidenceCodes || evidenceCodes.length === 0) return null; - const targetClass = `a${global.crypto.randomUUID()}`; + const targetClass = `a${global.crypto.randomUUID()}`; - const sortedEvidenceCodes = evidenceCodes.sort((a, b) => (a.abbreviation > b.abbreviation) ? 1 : (a.curie === b.curie) ? 1 : -1); + const sortedEvidenceCodes = evidenceCodes.sort((a, b) => + a.abbreviation > b.abbreviation ? 1 : a.curie === b.curie ? 1 : -1 + ); - const listTemplate = (item) => { - return ( - - {item.abbreviation + ' - ' + item.name + ' (' + item.curie + ')'} - - ); - }; + const listTemplate = (item) => { + return {item.abbreviation + ' - ' + item.name + ' (' + item.curie + ')'}; + }; - return ( - <> -
    - -
    - - - - - ); -}; \ No newline at end of file + return ( + <> +
    + +
    + + + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/IdTemplate.js b/src/main/cliapp/src/components/Templates/IdTemplate.js index 66b3e4056..7827776fe 100644 --- a/src/main/cliapp/src/components/Templates/IdTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdTemplate.js @@ -1,18 +1,16 @@ -import { EllipsisTableCell } from "../EllipsisTableCell"; -import { Tooltip } from "primereact/tooltip"; +import { EllipsisTableCell } from '../EllipsisTableCell'; +import { Tooltip } from 'primereact/tooltip'; export const IdTemplate = ({ id }) => { - if(!id) return null; + if (!id) return null; - //the 'a' at the start is a hack since css selectors can't start with a number - const targetClass = `a${global.crypto.randomUUID()}`; + //the 'a' at the start is a hack since css selectors can't start with a number + const targetClass = `a${global.crypto.randomUUID()}`; - return ( - <> - - {id} - - - - ); -}; \ No newline at end of file + return ( + <> + {id} + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/IdentifierFormTemplate.js b/src/main/cliapp/src/components/Templates/IdentifierFormTemplate.js index ef15973c7..83d36a971 100644 --- a/src/main/cliapp/src/components/Templates/IdentifierFormTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdentifierFormTemplate.js @@ -1,22 +1,22 @@ -import { FormFieldWrapper } from "../FormFieldWrapper"; +import { FormFieldWrapper } from '../FormFieldWrapper'; export const IdentifierFormTemplate = ({ - identifier, - label, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, + identifier, + label, + widgetColumnSize, + labelColumnSize, + fieldDetailsColumnSize, }) => { - return ( - <> - - - ); -}; \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/NameTemplate.js b/src/main/cliapp/src/components/Templates/NameTemplate.js index 824fbaf0a..5511a6b65 100644 --- a/src/main/cliapp/src/components/Templates/NameTemplate.js +++ b/src/main/cliapp/src/components/Templates/NameTemplate.js @@ -1,15 +1,18 @@ -import React from 'react' +import React from 'react'; import { Tooltip } from 'primereact/tooltip'; -export const NameTemplate = ({name}) => { - const targetClass = `a${global.crypto.randomUUID()}`; - if(!name) return null; - return ( - <> -
    - -
    - - - ) -} \ No newline at end of file +export const NameTemplate = ({ name }) => { + const targetClass = `a${global.crypto.randomUUID()}`; + if (!name) return null; + return ( + <> +
    + +
    + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/NotTemplate.js b/src/main/cliapp/src/components/Templates/NotTemplate.js index 5538a06fa..995783b7f 100644 --- a/src/main/cliapp/src/components/Templates/NotTemplate.js +++ b/src/main/cliapp/src/components/Templates/NotTemplate.js @@ -1,8 +1,8 @@ -import React from 'react' +import React from 'react'; import { EllipsisTableCell } from '../EllipsisTableCell'; export const NotTemplate = ({ value }) => { if (value === null || value === undefined || typeof value !== 'boolean') return null; - const textString = value ? "NOT" : ""; + const textString = value ? 'NOT' : ''; return {textString}; -} +}; diff --git a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js index 8b3a23d20..51368c50b 100644 --- a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js +++ b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js @@ -1,23 +1,23 @@ -import { Tooltip } from "primereact/tooltip"; -import { EllipsisTableCell } from "../EllipsisTableCell"; +import { Tooltip } from 'primereact/tooltip'; +import { EllipsisTableCell } from '../EllipsisTableCell'; export const OntologyTermTemplate = ({ object }) => { - if (!object) return null; + if (!object) return null; - const targetClass = `a${global.crypto.randomUUID()}`; - const textString = getTextString(object); + const targetClass = `a${global.crypto.randomUUID()}`; + const textString = getTextString(object); - return ( - <> - {textString} - - - ); + return ( + <> + {textString} + + + ); }; const getTextString = (object) => { - if(!object.name) return object.curie; - if(!object.curie) return object.name; - if(!object.curie && !object.name) return ""; - return `${object.name} (${object.curie})`; -} \ No newline at end of file + if (!object.name) return object.curie; + if (!object.curie) return object.name; + if (!object.curie && !object.name) return ''; + return `${object.name} (${object.curie})`; +}; diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index fa036c6fe..2b9ae3ecc 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -1,30 +1,26 @@ -import { EllipsisTableCell } from "../EllipsisTableCell"; -import { ListTableCell } from "../ListTableCell"; -import { Tooltip } from "primereact/tooltip"; +import { EllipsisTableCell } from '../EllipsisTableCell'; +import { ListTableCell } from '../ListTableCell'; +import { Tooltip } from 'primereact/tooltip'; export const StringListTemplate = ({ list }) => { - if (!list || list.length === 0) return null; + if (!list || list.length === 0) return null; - const targetClass = `a${global.crypto.randomUUID()}`; + const targetClass = `a${global.crypto.randomUUID()}`; - const sortedList = list.sort(); + const sortedList = list.sort(); - const listTemplate = (item) => { - return ( - - {item} - - ); - }; + const listTemplate = (item) => { + return {item}; + }; - return ( - <> -
    - -
    - - - - - ); -}; \ No newline at end of file + return ( + <> +
    + +
    + + + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/TaxonTemplate.js b/src/main/cliapp/src/components/Templates/TaxonTemplate.js index 91b8b89fd..1f0eb7645 100644 --- a/src/main/cliapp/src/components/Templates/TaxonTemplate.js +++ b/src/main/cliapp/src/components/Templates/TaxonTemplate.js @@ -1,23 +1,23 @@ import React from 'react'; import { Tooltip } from 'primereact/tooltip'; -import { EllipsisTableCell } from "../EllipsisTableCell"; +import { EllipsisTableCell } from '../EllipsisTableCell'; export const TaxonTemplate = ({ taxon }) => { - if (!taxon) return null; - const targetClass = `a${global.crypto.randomUUID()}`; - const textString = getTextString(taxon); + if (!taxon) return null; + const targetClass = `a${global.crypto.randomUUID()}`; + const textString = getTextString(taxon); - return ( - <> - {textString} - - - ); + return ( + <> + {textString} + + + ); }; const getTextString = (taxon) => { - if (!taxon.name) return taxon.curie; - if (!taxon.curie) return taxon.name; - if (!taxon.curie && !taxon.name) return ""; - return `${taxon.name} (${taxon.curie})`; -}; \ No newline at end of file + if (!taxon.name) return taxon.curie; + if (!taxon.curie) return taxon.name; + if (!taxon.curie && !taxon.name) return ''; + return `${taxon.name} (${taxon.curie})`; +}; diff --git a/src/main/cliapp/src/components/Templates/UserFormTemplate.js b/src/main/cliapp/src/components/Templates/UserFormTemplate.js index 266bf08cf..08ed2a7b0 100644 --- a/src/main/cliapp/src/components/Templates/UserFormTemplate.js +++ b/src/main/cliapp/src/components/Templates/UserFormTemplate.js @@ -1,25 +1,18 @@ -import { FormFieldWrapper } from "../FormFieldWrapper"; +import { FormFieldWrapper } from '../FormFieldWrapper'; -export const UserFormTemplate = ({ - user, - fieldName, - widgetColumnSize, - labelColumnSize, - fieldDetailsColumnSize, -}) => { +export const UserFormTemplate = ({ user, fieldName, widgetColumnSize, labelColumnSize, fieldDetailsColumnSize }) => { + if (!user) user = No data; - if (!user) user = No data; - - return ( - <> - - - ); -}; \ No newline at end of file + return ( + <> + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/__tests__/BooleanTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/BooleanTemplate.test.js index 0079d4320..da09c60e8 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/BooleanTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/BooleanTemplate.test.js @@ -3,19 +3,18 @@ import { BooleanTemplate } from '../BooleanTemplate'; import '../../../tools/jest/setupTests'; describe('BooleanTemplate', () => { + it('should return null when value is null', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - it('should return null when value is null', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should render the JSON stringified value inside the div', () => { + const result = render(); + expect(result.getByText('false')).toBeInTheDocument(); + }); - it('should render the JSON stringified value inside the div', () => { - const result = render(); - expect(result.getByText("false")).toBeInTheDocument(); - }); - - it('should return null when value is not a boolean', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); -}); \ No newline at end of file + it('should return null when value is not a boolean', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/CommaSeparatedArrayTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/CommaSeparatedArrayTemplate.test.js index 0a34cd077..1a3561e93 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/CommaSeparatedArrayTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/CommaSeparatedArrayTemplate.test.js @@ -3,28 +3,27 @@ import { CommaSeparatedArrayTemplate } from '../CommaSeparatedArrayTemplate'; import '../../../tools/jest/setupTests'; describe('CommaSeparatedArrayTemplate', () => { + it('should return null when array is empty', () => { + const emptyArray = []; + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - it('should return null when array is empty', () => { - const emptyArray = []; - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should render the resultant comma separated array when passed an array of multiple elements', () => { - const testArray = ["Element1", "Element2", "Element3"]; - const { container } = render(); - expect(container.textContent).toBe('Element1, Element2, Element3'); - }); - - it('should return null when an array is not passed', () => { - const notArray = 'not an array'; - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should render the resultant comma separated array when passed an array of multiple elements', () => { + const testArray = ['Element1', 'Element2', 'Element3']; + const { container } = render(); + expect(container.textContent).toBe('Element1, Element2, Element3'); + }); - it('should return single element when array has one element', () => { - const singleElementArray = ['Element1']; - const { container } = render(); - expect(container.textContent).toBe('Element1'); - }); - }); \ No newline at end of file + it('should return null when an array is not passed', () => { + const notArray = 'not an array'; + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should return single element when array has one element', () => { + const singleElementArray = ['Element1']; + const { container } = render(); + expect(container.textContent).toBe('Element1'); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/CountDialogTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/CountDialogTemplate.test.js index d07898119..73f6136be 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/CountDialogTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/CountDialogTemplate.test.js @@ -3,57 +3,56 @@ import { CountDialogTemplate } from '../dialog/CountDialogTemplate'; import '../../../tools/jest/setupTests'; describe('CountDialogTemplate', () => { + it('should return a non-null JSX element with the correct text and length of entities', () => { + const entities = [1, 2, 3]; + const handleOpen = jest.fn(); + const text = 'Count'; - it('should return a non-null JSX element with the correct text and length of entities', () => { - const entities = [1, 2, 3]; - const handleOpen = jest.fn(); - const text = 'Count'; + const result = render(); - const result = render(); + const element = result.getByText('Count (3)'); - const element = result.getByText('Count (3)'); + expect(result).not.toBeNull(); + expect(element).toBeInTheDocument(); + }); - expect(result).not.toBeNull(); - expect(element).toBeInTheDocument(); - }); + it('should return null when entities prop is undefined', () => { + const entities = undefined; + const handleOpen = jest.fn(); + const text = 'Count'; - it('should return null when entities prop is undefined', () => { - const entities = undefined; - const handleOpen = jest.fn(); - const text = 'Count'; + const { container } = render(); - const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - expect(container.firstChild).toBeNull(); - }); + it('should return null when handleOpen prop is undefined', () => { + const entities = [1, 2, 3]; + const handleOpen = undefined; + const text = 'Count'; - it('should return null when handleOpen prop is undefined', () => { - const entities = [1, 2, 3]; - const handleOpen = undefined; - const text = 'Count'; + const { container } = render(); - const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - expect(container.firstChild).toBeNull(); - }); + it('should return null when text prop is undefined', () => { + const entities = [1, 2, 3]; + const handleOpen = jest.fn(); + const text = undefined; - it('should return null when text prop is undefined', () => { - const entities = [1, 2, 3]; - const handleOpen = jest.fn(); - const text = undefined; + const { container } = render(); - const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - expect(container.firstChild).toBeNull(); - }); + it('should return null when entities prop is an empty array', () => { + const entities = []; + const handleOpen = jest.fn(); + const text = 'Count'; - it('should return null when entities prop is an empty array', () => { - const entities = []; - const handleOpen = jest.fn(); - const text = 'Count'; + const { container } = render(); - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); -}); \ No newline at end of file + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/CrossReferenceTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/CrossReferenceTemplate.test.js index c7348f5d4..ff590230d 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/CrossReferenceTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/CrossReferenceTemplate.test.js @@ -3,70 +3,54 @@ import { CrossReferenceTemplate } from '../reference/CrossReferenceTemplate'; import '../../../tools/jest/setupTests'; import 'core-js/features/structured-clone'; -describe("CrossReferenceTemplate", () => { - - it('should render a sorted list of cross references by curie field', () => { - const reference = { - crossReferences: [ - { referencedCurie: 'def' }, - { referencedCurie: 'abc' }, - { referencedCurie: 'ghi' } - ] - }; - - const result = render(); - - const listItems = result.getAllByRole('listitem'); - expect(listItems).toHaveLength(3); - expect(listItems[0]).toHaveTextContent('abc'); - expect(listItems[1]).toHaveTextContent('def'); - expect(listItems[2]).toHaveTextContent('ghi'); - }); - - it('should handle references with cross_references field', () => { - const reference = { - cross_references: [ - { curie: 'abc' }, - { curie: 'def' }, - { curie: 'ghi' } - ] - }; - - const result = render(); - - const listItems = result.getAllByRole('listitem'); - expect(listItems).toHaveLength(3); - expect(listItems[0]).toHaveTextContent('abc'); - expect(listItems[1]).toHaveTextContent('def'); - expect(listItems[2]).toHaveTextContent('ghi'); - }); - - it('should display an empty list when cross references are null or empty', () => { - const reference = { - cross_references: null - }; - - const result = render(); - - const listItems = result.queryAllByRole('listitem'); - expect(listItems).toHaveLength(0); - }); - - - it('should handle cross references with undefined curie fields', () => { - const reference = { - cross_references: [ - {}, - {}, - {}, - ] - }; - - const result = render(); - - const listItems = result.getAllByRole('listitem'); - expect(listItems).toHaveLength(3); - }); - +describe('CrossReferenceTemplate', () => { + it('should render a sorted list of cross references by curie field', () => { + const reference = { + crossReferences: [{ referencedCurie: 'def' }, { referencedCurie: 'abc' }, { referencedCurie: 'ghi' }], + }; + + const result = render(); + + const listItems = result.getAllByRole('listitem'); + expect(listItems).toHaveLength(3); + expect(listItems[0]).toHaveTextContent('abc'); + expect(listItems[1]).toHaveTextContent('def'); + expect(listItems[2]).toHaveTextContent('ghi'); + }); + + it('should handle references with cross_references field', () => { + const reference = { + cross_references: [{ curie: 'abc' }, { curie: 'def' }, { curie: 'ghi' }], + }; + + const result = render(); + + const listItems = result.getAllByRole('listitem'); + expect(listItems).toHaveLength(3); + expect(listItems[0]).toHaveTextContent('abc'); + expect(listItems[1]).toHaveTextContent('def'); + expect(listItems[2]).toHaveTextContent('ghi'); + }); + + it('should display an empty list when cross references are null or empty', () => { + const reference = { + cross_references: null, + }; + + const result = render(); + + const listItems = result.queryAllByRole('listitem'); + expect(listItems).toHaveLength(0); + }); + + it('should handle cross references with undefined curie fields', () => { + const reference = { + cross_references: [{}, {}, {}], + }; + + const result = render(); + + const listItems = result.getAllByRole('listitem'); + expect(listItems).toHaveLength(3); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js index 984adb7cf..a376a9b1c 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js @@ -3,53 +3,50 @@ import { CrossReferencesTemplate } from '../CrossReferencesTemplate'; import '../../../tools/jest/setupTests'; describe('CrossReferencesTemplate', () => { + it('should render a sorted list of cross-references with their page name in parenthesis', () => { + const xrefs = [ + { displayName: 'xref B', resourceDescriptorPage: { name: 'page B' } }, + { displayName: 'xref C', resourceDescriptorPage: { name: 'page C' } }, + { displayName: 'xref A', resourceDescriptorPage: { name: 'page A' } }, + ]; - it('should render a sorted list of cross-references with their page name in parenthesis', () => { - const xrefs = [ - { displayName: 'xref B', resourceDescriptorPage: { name: 'page B'} }, - { displayName: 'xref C', resourceDescriptorPage: { name: 'page C'} }, - { displayName: 'xref A', resourceDescriptorPage: { name: 'page A'} }, - ]; + const { container } = render(); + const listItems = container.querySelectorAll('li'); - const { container } = render(); - const listItems = container.querySelectorAll('li'); + expect(listItems[0]).toHaveTextContent('xref A (page A)'); + expect(listItems[1]).toHaveTextContent('xref B (page B)'); + expect(listItems[2]).toHaveTextContent('xref C (page C)'); + }); - expect(listItems[0]).toHaveTextContent('xref A (page A)'); - expect(listItems[1]).toHaveTextContent('xref B (page B)'); - expect(listItems[2]).toHaveTextContent('xref C (page C)'); - }); + it('should return null when xrefs is undefined', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - it('should return null when xrefs is undefined', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should return null when xrefs is an empty array', () => { + const xrefs = []; - it('should return null when xrefs is an empty array', () => { - const xrefs = []; + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should display tooltip when hovering over the cross references list', async () => { + const xrefs = [ + { displayName: 'xref ABC', resourceDescriptorPage: { name: 'page ABC' } }, + { displayName: 'xref DEF', resourceDescriptorPage: { name: 'page DEF' } }, + { displayName: 'xref GHI', resourceDescriptorPage: { name: 'page GHI' } }, + ]; - it('should display tooltip when hovering over the cross references list', async () => { - const xrefs = [ - { displayName: 'xref ABC', resourceDescriptorPage: { name: 'page ABC'} }, - { displayName: 'xref DEF', resourceDescriptorPage: { name: 'page DEF'} }, - { displayName: 'xref GHI', resourceDescriptorPage: { name: 'page GHI'} }, - ]; + const result = render(); - const result = render(); + let listContentArray = result.getAllByText('xref ABC (page ABC)'); + expect(listContentArray).toHaveLength(1); - let listContentArray = result.getAllByText('xref ABC (page ABC)'); - expect(listContentArray).toHaveLength(1); + fireEvent.mouseEnter(result.container.firstChild); - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - listContentArray = await result.findAllByText('xref ABC (page ABC)'); - - expect(listContentArray).toHaveLength(2); - }); + //using find... here because it's async and the tooltip is dynamically added + listContentArray = await result.findAllByText('xref ABC (page ABC)'); + expect(listContentArray).toHaveLength(2); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js index 46fd3488b..f65298a1f 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js @@ -2,50 +2,40 @@ import { render, within } from '@testing-library/react'; import { DiseaseQualifiersTemplate } from '../DiseaseQualifiersTemplate'; import '../../../tools/jest/setupTests'; - describe('DiseaseQualifiersTemplate', () => { + it('should return null when diseaseQualifiers is falsy', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should sort diseaseQualifiers by name', () => { + const diseaseQualifiers = [{ name: 'Qualifier C' }, { name: 'Qualifier A' }, { name: 'Qualifier B' }]; + + const result = render(); + + const qualifiersList = result.getByRole('list'); + const listItems = within(qualifiersList).getAllByRole('listitem'); + + expect(listItems[0]).toHaveTextContent('Qualifier A'); + expect(listItems[1]).toHaveTextContent('Qualifier B'); + expect(listItems[2]).toHaveTextContent('Qualifier C'); + }); + + it('should return null when diseaseQualifiers is an empty array', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should render diseaseQualifiers without a name property', () => { + const diseaseQualifiers = [{ id: 1 }, { id: 2 }, { id: 3 }]; + + const result = render(); + + const qualifiersList = result.getByRole('list'); + const listItems = within(qualifiersList).getAllByRole('listitem'); - it('should return null when diseaseQualifiers is falsy', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should sort diseaseQualifiers by name', () => { - const diseaseQualifiers = [ - { name: 'Qualifier C' }, - { name: 'Qualifier A' }, - { name: 'Qualifier B' }, - ]; - - const result = render(); - - const qualifiersList = result.getByRole('list'); - const listItems = within(qualifiersList).getAllByRole('listitem'); - - expect(listItems[0]).toHaveTextContent('Qualifier A'); - expect(listItems[1]).toHaveTextContent('Qualifier B'); - expect(listItems[2]).toHaveTextContent('Qualifier C'); - }); - - it('should return null when diseaseQualifiers is an empty array', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should render diseaseQualifiers without a name property', () => { - const diseaseQualifiers = [ - { id: 1 }, - { id: 2 }, - { id: 3 }, - ]; - - const result = render(); - - const qualifiersList = result.getByRole('list'); - const listItems = within(qualifiersList).getAllByRole('listitem'); - - expect(listItems[0]).toHaveTextContent(''); - expect(listItems[1]).toHaveTextContent(''); - expect(listItems[2]).toHaveTextContent(''); - }); -}); \ No newline at end of file + expect(listItems[0]).toHaveTextContent(''); + expect(listItems[1]).toHaveTextContent(''); + expect(listItems[2]).toHaveTextContent(''); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js index 1f25b2882..811b1454e 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js @@ -3,69 +3,67 @@ import { OntologyTermTemplate } from '../OntologyTermTemplate'; import '../../../tools/jest/setupTests'; describe('OntologyTermTemplate', () => { + it('should render the name and curie of the disease object in an EllipsisTableCell component', () => { + const object = { + name: 'Disease Name', + curie: 'Disease Curie', + }; - it('should render the name and curie of the disease object in an EllipsisTableCell component', () => { - const object = { - name: 'Disease Name', - curie: 'Disease Curie' - }; + const result = render(); - const result = render(); + const content = result.getByText('Disease Name (Disease Curie)'); + expect(content).toBeInTheDocument(); + }); - const content = result.getByText('Disease Name (Disease Curie)'); - expect(content).toBeInTheDocument(); - }); + it('should display a tooltip with the name and curie of the disease object when hovering over the EllipsisTableCell component', async () => { + const object = { + name: 'Disease Name', + curie: 'Disease Curie', + }; - it('should display a tooltip with the name and curie of the disease object when hovering over the EllipsisTableCell component', async () => { - const object = { - name: 'Disease Name', - curie: 'Disease Curie' - }; + const result = render(); - const result = render(); + const divContentArray = result.getAllByText('Disease Name (Disease Curie)'); + expect(divContentArray).toHaveLength(1); + fireEvent.mouseEnter(divContentArray[0]); - const divContentArray = result.getAllByText('Disease Name (Disease Curie)'); - expect(divContentArray).toHaveLength(1); - fireEvent.mouseEnter(divContentArray[0]); + expect(await result.findAllByText('Disease Name (Disease Curie)')).toHaveLength(2); + }); - expect(await result.findAllByText('Disease Name (Disease Curie)')).toHaveLength(2); - }); + it('should return null if the object is falsy', () => { + const result = render(); - it('should return null if the object is falsy', () => { - const result = render(); + expect(result.container.firstChild).toBeNull(); + }); - expect(result.container.firstChild).toBeNull(); - }); + it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { + const object = {}; - it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { - const object = {}; + const result = render(); - const result = render(); + const ellipsisTableCell = result.container.firstChild; + expect(ellipsisTableCell).toHaveTextContent(''); + }); - const ellipsisTableCell = result.container.firstChild; - expect(ellipsisTableCell).toHaveTextContent(''); - }); + it('should render an EllipsisTableCell component with only the name if the object has no curie', () => { + const object = { + name: 'Disease Name', + }; - it('should render an EllipsisTableCell component with only the name if the object has no curie', () => { - const object = { - name: 'Disease Name' - }; + const result = render(); - const result = render(); + const ellipsisTableCell = result.getByText('Disease Name'); + expect(ellipsisTableCell).toBeInTheDocument(); + }); - const ellipsisTableCell = result.getByText('Disease Name'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); + it('should render an EllipsisTableCell component with only the curie if the object has no name', () => { + const object = { + curie: 'Disease Curie', + }; - it('should render an EllipsisTableCell component with only the curie if the object has no name', () => { - const object = { - curie: 'Disease Curie' - }; + const result = render(); - const result = render(); - - const ellipsisTableCell = result.getByText('Disease Curie'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); + const ellipsisTableCell = result.getByText('Disease Curie'); + expect(ellipsisTableCell).toBeInTheDocument(); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js index a6c424a42..6d1b97094 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js @@ -3,53 +3,50 @@ import { EvidenceCodesTemplate } from '../EvidenceCodesTemplate'; import '../../../tools/jest/setupTests'; describe('EvidenceCodesTemplate', () => { + it('should render a sorted list of evidence codes', () => { + const evidenceCodes = [ + { abbreviation: 'Code B', name: 'Code B Name', curie: 'Code B Curie' }, + { abbreviation: 'Code A', name: 'Code A Name', curie: 'Code A Curie' }, + { abbreviation: 'Code C', name: 'Code C Name', curie: 'Code C Curie' }, + ]; - it('should render a sorted list of evidence codes', () => { - const evidenceCodes = [ - { abbreviation: 'Code B', name: 'Code B Name', curie: 'Code B Curie' }, - { abbreviation: 'Code A', name: 'Code A Name', curie: 'Code A Curie' }, - { abbreviation: 'Code C', name: 'Code C Name', curie: 'Code C Curie' }, - ]; + const { container } = render(); + const listItems = container.querySelectorAll('li'); - const { container } = render(); - const listItems = container.querySelectorAll('li'); + expect(listItems[0]).toHaveTextContent('Code A - Code A Name (Code A Curie)'); + expect(listItems[1]).toHaveTextContent('Code B - Code B Name (Code B Curie)'); + expect(listItems[2]).toHaveTextContent('Code C - Code C Name (Code C Curie)'); + }); - expect(listItems[0]).toHaveTextContent('Code A - Code A Name (Code A Curie)'); - expect(listItems[1]).toHaveTextContent('Code B - Code B Name (Code B Curie)'); - expect(listItems[2]).toHaveTextContent('Code C - Code C Name (Code C Curie)'); - }); + it('should return null when evidenceCodes is undefined', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - it('should return null when evidenceCodes is undefined', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should return null when evidenceCodes is an empty array', () => { + const evidenceCodes = []; - it('should return null when evidenceCodes is an empty array', () => { - const evidenceCodes = []; + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should display tooltip when hovering over the evidence codes list', async () => { + const evidenceCodes = [ + { abbreviation: 'ABC', name: 'Code ABC', curie: 'ABC123' }, + { abbreviation: 'DEF', name: 'Code DEF', curie: 'DEF456' }, + { abbreviation: 'GHI', name: 'Code GHI', curie: 'GHI789' }, + ]; - it('should display tooltip when hovering over the evidence codes list', async () => { - const evidenceCodes = [ - { abbreviation: 'ABC', name: 'Code ABC', curie: 'ABC123' }, - { abbreviation: 'DEF', name: 'Code DEF', curie: 'DEF456' }, - { abbreviation: 'GHI', name: 'Code GHI', curie: 'GHI789' } - ]; + const result = render(); - const result = render(); + let listContentArray = result.getAllByText('ABC - Code ABC (ABC123)'); + expect(listContentArray).toHaveLength(1); - let listContentArray = result.getAllByText('ABC - Code ABC (ABC123)'); - expect(listContentArray).toHaveLength(1); + fireEvent.mouseEnter(result.container.firstChild); - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - listContentArray = await result.findAllByText('ABC - Code ABC (ABC123)'); - - expect(listContentArray).toHaveLength(2); - }); + //using find... here because it's async and the tooltip is dynamically added + listContentArray = await result.findAllByText('ABC - Code ABC (ABC123)'); + expect(listContentArray).toHaveLength(2); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js index dea0cb8d3..3e1e92436 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js @@ -3,194 +3,189 @@ import { GenomicEntityListTemplate } from '../genomicEntity/GenomicEntityListTem import '../../../tools/jest/setupTests'; describe('GenomicEntityListTemplate', () => { - - it('should render a list of genomic entities with their corresponding curie', () => { - const genomicEntities = [ - { alleleFullName: { displayText: 'Allele Full Name 1' }, curie: 'CURIE1' }, - { alleleFullName: { displayText: 'Allele Full Name 2' }, curie: 'CURIE2' }, - { alleleFullName: { displayText: 'Allele Full Name 3' }, curie: 'CURIE3' }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('Allele Full Name 1 (CURIE1)'); - const genomicEntity2 = result.getByText('Allele Full Name 2 (CURIE2)'); - const genomicEntity3 = result.getByText('Allele Full Name 3 (CURIE3)'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - - it('should sort the genomic entities alphabetically by their display text', () => { - const genomicEntities = [ - { alleleSymbol: { displayText: 'Allele Symbol C' }, curie: 'CURIE1' }, - { alleleSymbol: { displayText: 'Allele Symbol A' }, curie: 'CURIE2' }, - { alleleSymbol: { displayText: 'Allele Symbol B' }, curie: 'CURIE3' }, - ]; - - const result = render(); - - const genomicEntityList = result.getByRole('list'); - const genomicEntityItems = within(genomicEntityList).getAllByRole('listitem'); - - expect(genomicEntityItems[0]).toHaveTextContent('Allele Symbol A (CURIE2)'); - expect(genomicEntityItems[1]).toHaveTextContent('Allele Symbol B (CURIE3)'); - expect(genomicEntityItems[2]).toHaveTextContent('Allele Symbol C (CURIE1)'); - }); - - it('should return null if genomic entities array is empty', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should return null if genomic entities array is undefined', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should return the genomic entity curie if no display text is available', () => { - const genomicEntities = [ - { curie: 'CURIE1' }, - { curie: 'CURIE2' }, - { curie: 'CURIE3' }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('CURIE1'); - const genomicEntity2 = result.getByText('CURIE2'); - const genomicEntity3 = result.getByText('CURIE3'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - - it('should handle genomic entities with missing or null properties', () => { - const genomicEntities = [ - { geneSymbol: null, curie: 'CURIE1' }, - { geneSymbol: { displayText: 'Gene Symbol 2' }, curie: 'CURIE2' }, - { geneSymbol: { displayText: 'Gene Symbol 3' }, curie: null }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('CURIE1'); - const genomicEntity2 = result.getByText('Gene Symbol 2 (CURIE2)'); - const genomicEntity3 = result.getByText('Gene Symbol 3'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - - it('should handle genomic entities with missing or null properties', () => { - const genomicEntities = [ - { alleleFullName: null, curie: 'CURIE1' }, - { alleleFullName: { displayText: 'Allele Full Name 2' }, curie: null }, - { alleleFullName: null, curie: null }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('CURIE1'); - const genomicEntity2 = result.getByText('Allele Full Name 2'); - const genomicEntity3 = result.queryByText('Allele Full Name 3'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeNull(); - }); - - it('should handle genomic entities with missing or null display text', () => { - const genomicEntities = [ - { alleleFullName: { displayText: null }, curie: 'CURIE1' }, - { alleleFullName: { displayText: null }, curie: 'CURIE2' }, - { alleleFullName: { displayText: null }, curie: 'CURIE3' }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('CURIE1'); - const genomicEntity2 = result.getByText('CURIE2'); - const genomicEntity3 = result.getByText('CURIE3'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - - it('should handle genomic entities with missing or null alleleFullName', () => { - const genomicEntities = [ - { alleleFullName: null, curie: 'CURIE1' }, - { alleleFullName: null, curie: 'CURIE2' }, - { alleleFullName: null, curie: 'CURIE3' }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('CURIE1'); - const genomicEntity2 = result.getByText('CURIE2'); - const genomicEntity3 = result.getByText('CURIE3'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - - it('should display symbol before full name', () => { - const genomicEntities = [ - { - geneSymbol: { - displayText: "Gene Symbol 1", - }, - geneFullName: { - displayText: "Gene Full Name 1", - }, - curie: 'ID1' - }, - { - geneSymbol: null, - geneFullName: { - displayText: "Gene Full Name 2", - }, - modEntityId: 'ID2' - }, - { - geneSymbol: { - displayText: "Gene Symbol 3", - }, - geneFullName: null, - modInternalId: 'ID3' - }, - ]; - - const result = render(); - - const genomicEntity1 = result.getByText('Gene Symbol 1 (ID1)'); - const genomicEntity2 = result.getByText('Gene Full Name 2 (ID2)'); - const genomicEntity3 = result.getByText('Gene Symbol 3 (ID3)'); - - expect(genomicEntity1).toBeInTheDocument(); - expect(genomicEntity2).toBeInTheDocument(); - expect(genomicEntity3).toBeInTheDocument(); - }); - it('should render genomicEntities and curie in a tooltip when genomicEntity has alleleSymbol', async () => { - const genomicEntities = [ - { alleleSymbol: { displayText: 'Allele Symbol C' }, curie: 'ID1' }, - { alleleSymbol: { displayText: 'Allele Symbol A' }, modEntityId: 'ID2' }, - { alleleSymbol: { displayText: 'Allele Symbol B' }, modInternalId: 'ID3' }, - ]; - - const result = render(); - - let listContentArray = result.getAllByText('Allele Symbol A (ID2)'); - expect(listContentArray).toHaveLength(1); - - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - expect(await result.findAllByText('Allele Symbol A (ID2)')).toHaveLength(2); - }); + it('should render a list of genomic entities with their corresponding curie', () => { + const genomicEntities = [ + { alleleFullName: { displayText: 'Allele Full Name 1' }, curie: 'CURIE1' }, + { alleleFullName: { displayText: 'Allele Full Name 2' }, curie: 'CURIE2' }, + { alleleFullName: { displayText: 'Allele Full Name 3' }, curie: 'CURIE3' }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('Allele Full Name 1 (CURIE1)'); + const genomicEntity2 = result.getByText('Allele Full Name 2 (CURIE2)'); + const genomicEntity3 = result.getByText('Allele Full Name 3 (CURIE3)'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + + it('should sort the genomic entities alphabetically by their display text', () => { + const genomicEntities = [ + { alleleSymbol: { displayText: 'Allele Symbol C' }, curie: 'CURIE1' }, + { alleleSymbol: { displayText: 'Allele Symbol A' }, curie: 'CURIE2' }, + { alleleSymbol: { displayText: 'Allele Symbol B' }, curie: 'CURIE3' }, + ]; + + const result = render(); + + const genomicEntityList = result.getByRole('list'); + const genomicEntityItems = within(genomicEntityList).getAllByRole('listitem'); + + expect(genomicEntityItems[0]).toHaveTextContent('Allele Symbol A (CURIE2)'); + expect(genomicEntityItems[1]).toHaveTextContent('Allele Symbol B (CURIE3)'); + expect(genomicEntityItems[2]).toHaveTextContent('Allele Symbol C (CURIE1)'); + }); + + it('should return null if genomic entities array is empty', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should return null if genomic entities array is undefined', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should return the genomic entity curie if no display text is available', () => { + const genomicEntities = [{ curie: 'CURIE1' }, { curie: 'CURIE2' }, { curie: 'CURIE3' }]; + + const result = render(); + + const genomicEntity1 = result.getByText('CURIE1'); + const genomicEntity2 = result.getByText('CURIE2'); + const genomicEntity3 = result.getByText('CURIE3'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + + it('should handle genomic entities with missing or null properties', () => { + const genomicEntities = [ + { geneSymbol: null, curie: 'CURIE1' }, + { geneSymbol: { displayText: 'Gene Symbol 2' }, curie: 'CURIE2' }, + { geneSymbol: { displayText: 'Gene Symbol 3' }, curie: null }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('CURIE1'); + const genomicEntity2 = result.getByText('Gene Symbol 2 (CURIE2)'); + const genomicEntity3 = result.getByText('Gene Symbol 3'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + + it('should handle genomic entities with missing or null properties', () => { + const genomicEntities = [ + { alleleFullName: null, curie: 'CURIE1' }, + { alleleFullName: { displayText: 'Allele Full Name 2' }, curie: null }, + { alleleFullName: null, curie: null }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('CURIE1'); + const genomicEntity2 = result.getByText('Allele Full Name 2'); + const genomicEntity3 = result.queryByText('Allele Full Name 3'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeNull(); + }); + + it('should handle genomic entities with missing or null display text', () => { + const genomicEntities = [ + { alleleFullName: { displayText: null }, curie: 'CURIE1' }, + { alleleFullName: { displayText: null }, curie: 'CURIE2' }, + { alleleFullName: { displayText: null }, curie: 'CURIE3' }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('CURIE1'); + const genomicEntity2 = result.getByText('CURIE2'); + const genomicEntity3 = result.getByText('CURIE3'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + + it('should handle genomic entities with missing or null alleleFullName', () => { + const genomicEntities = [ + { alleleFullName: null, curie: 'CURIE1' }, + { alleleFullName: null, curie: 'CURIE2' }, + { alleleFullName: null, curie: 'CURIE3' }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('CURIE1'); + const genomicEntity2 = result.getByText('CURIE2'); + const genomicEntity3 = result.getByText('CURIE3'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + + it('should display symbol before full name', () => { + const genomicEntities = [ + { + geneSymbol: { + displayText: 'Gene Symbol 1', + }, + geneFullName: { + displayText: 'Gene Full Name 1', + }, + curie: 'ID1', + }, + { + geneSymbol: null, + geneFullName: { + displayText: 'Gene Full Name 2', + }, + modEntityId: 'ID2', + }, + { + geneSymbol: { + displayText: 'Gene Symbol 3', + }, + geneFullName: null, + modInternalId: 'ID3', + }, + ]; + + const result = render(); + + const genomicEntity1 = result.getByText('Gene Symbol 1 (ID1)'); + const genomicEntity2 = result.getByText('Gene Full Name 2 (ID2)'); + const genomicEntity3 = result.getByText('Gene Symbol 3 (ID3)'); + + expect(genomicEntity1).toBeInTheDocument(); + expect(genomicEntity2).toBeInTheDocument(); + expect(genomicEntity3).toBeInTheDocument(); + }); + it('should render genomicEntities and curie in a tooltip when genomicEntity has alleleSymbol', async () => { + const genomicEntities = [ + { alleleSymbol: { displayText: 'Allele Symbol C' }, curie: 'ID1' }, + { alleleSymbol: { displayText: 'Allele Symbol A' }, modEntityId: 'ID2' }, + { alleleSymbol: { displayText: 'Allele Symbol B' }, modInternalId: 'ID3' }, + ]; + + const result = render(); + + let listContentArray = result.getAllByText('Allele Symbol A (ID2)'); + expect(listContentArray).toHaveLength(1); + + fireEvent.mouseEnter(result.container.firstChild); + + //using find... here because it's async and the tooltip is dynamically added + expect(await result.findAllByText('Allele Symbol A (ID2)')).toHaveLength(2); + }); }); diff --git a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js index 14d0d569d..6f4c7045c 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js @@ -3,122 +3,121 @@ import { GenomicEntityTemplate } from '../genomicEntity/GenomicEntityTemplate'; import '../../../tools/jest/setupTests'; describe('GenomicEntityTemplate', () => { - - it('should render genomicEntity text and id when genomicEntity has geneSymbol', () => { - const genomicEntity = { - geneSymbol: { - displayText: 'Gene Symbol' - }, - curie: 'CURIE' - }; - - const result = render(); - - const content = result.getByText('Gene Symbol (CURIE)'); - expect(content).toBeInTheDocument(); - }); - - it('should render genomicEntity text and id when genomicEntity has alleleSymbol', () => { - const genomicEntity = { - alleleSymbol: { - displayText: 'Allele Symbol' - }, - curie: 'CURIE' - }; - - const result = render(); - - const content = result.getByText('Allele Symbol (CURIE)'); - expect(content).toBeInTheDocument(); - }); - - it('should render genomicEntity text and id when genomicEntity has geneFullName', () => { - const genomicEntity = { - geneFullName: { - displayText: 'Gene Full Name' - }, - curie: 'CURIE' - }; - - const result = render(); - - const content = result.getByText('Gene Full Name (CURIE)'); - expect(content).toBeInTheDocument(); - }); - - it('should render genomicEntity text and id when genomicEntity has alleleFullName', () => { - const genomicEntity = { - alleleFullName: { - displayText: 'Allele Full Name' - }, - curie: 'CURIE' - }; - - const result = render(); - - const content = result.getByText('Allele Full Name (CURIE)'); - expect(content).toBeInTheDocument(); - }); - it('should render genomicEntity name and id when genomicEntity has name', () => { - const genomicEntity = { - name: 'genomicEntity Name', - modEntityId: 'ID' - }; - - const result = render(); - - const content = result.getByText('genomicEntity Name (ID)'); - expect(content).toBeInTheDocument(); - }); - - it('should render genomicEntity id in a div when genomicEntity has no displayable text', () => { - const genomicEntity = { - curie: 'CURIE' - }; - - const result = render(); - - const divContent = result.getByText('CURIE'); - expect(divContent).toBeInTheDocument(); - }); - - it('should render null when genomicEntity is null', () => { - const genomicEntity = null; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should render genomicEntity text and id in a tooltip when genomicEntity has geneSymbol', async () => { - const genomicEntity = { - geneSymbol: { - displayText: 'Gene Symbol' - }, - modInternalId: 'ID' - }; - - const result = render(); - - let divContentArray = result.getAllByText('Gene Symbol (ID)'); - expect(divContentArray).toHaveLength(1); - - fireEvent.mouseEnter(divContentArray[0]); - //using find... here because it's async and the tooltip is dynamically added - expect(await result.findAllByText('Gene Symbol (ID)')).toHaveLength(2); - }); - - it('should render tags in the HTML', async () => { - const genomicEntity = { - geneSymbol: { - displayText: 'Gene Symbol' - }, - modEntityId: 'ID' - }; - - const { container } = render(); - - let superScript = container.querySelector('sup'); - expect(superScript).toBeInTheDocument(); - }); -}); \ No newline at end of file + it('should render genomicEntity text and id when genomicEntity has geneSymbol', () => { + const genomicEntity = { + geneSymbol: { + displayText: 'Gene Symbol', + }, + curie: 'CURIE', + }; + + const result = render(); + + const content = result.getByText('Gene Symbol (CURIE)'); + expect(content).toBeInTheDocument(); + }); + + it('should render genomicEntity text and id when genomicEntity has alleleSymbol', () => { + const genomicEntity = { + alleleSymbol: { + displayText: 'Allele Symbol', + }, + curie: 'CURIE', + }; + + const result = render(); + + const content = result.getByText('Allele Symbol (CURIE)'); + expect(content).toBeInTheDocument(); + }); + + it('should render genomicEntity text and id when genomicEntity has geneFullName', () => { + const genomicEntity = { + geneFullName: { + displayText: 'Gene Full Name', + }, + curie: 'CURIE', + }; + + const result = render(); + + const content = result.getByText('Gene Full Name (CURIE)'); + expect(content).toBeInTheDocument(); + }); + + it('should render genomicEntity text and id when genomicEntity has alleleFullName', () => { + const genomicEntity = { + alleleFullName: { + displayText: 'Allele Full Name', + }, + curie: 'CURIE', + }; + + const result = render(); + + const content = result.getByText('Allele Full Name (CURIE)'); + expect(content).toBeInTheDocument(); + }); + it('should render genomicEntity name and id when genomicEntity has name', () => { + const genomicEntity = { + name: 'genomicEntity Name', + modEntityId: 'ID', + }; + + const result = render(); + + const content = result.getByText('genomicEntity Name (ID)'); + expect(content).toBeInTheDocument(); + }); + + it('should render genomicEntity id in a div when genomicEntity has no displayable text', () => { + const genomicEntity = { + curie: 'CURIE', + }; + + const result = render(); + + const divContent = result.getByText('CURIE'); + expect(divContent).toBeInTheDocument(); + }); + + it('should render null when genomicEntity is null', () => { + const genomicEntity = null; + + const { container } = render(); + + expect(container.firstChild).toBeNull(); + }); + + it('should render genomicEntity text and id in a tooltip when genomicEntity has geneSymbol', async () => { + const genomicEntity = { + geneSymbol: { + displayText: 'Gene Symbol', + }, + modInternalId: 'ID', + }; + + const result = render(); + + let divContentArray = result.getAllByText('Gene Symbol (ID)'); + expect(divContentArray).toHaveLength(1); + + fireEvent.mouseEnter(divContentArray[0]); + //using find... here because it's async and the tooltip is dynamically added + expect(await result.findAllByText('Gene Symbol (ID)')).toHaveLength(2); + }); + + it('should render tags in the HTML', async () => { + const genomicEntity = { + geneSymbol: { + displayText: 'Gene Symbol', + }, + modEntityId: 'ID', + }; + + const { container } = render(); + + let superScript = container.querySelector('sup'); + expect(superScript).toBeInTheDocument(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js index 2b705f51a..c375f74df 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js @@ -2,32 +2,27 @@ import { render, fireEvent } from '@testing-library/react'; import { IdTemplate } from '../IdTemplate'; import '../../../tools/jest/setupTests'; -describe("IdTemplate", () => { - - it("should return null when id is falsy", () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - - it("should render Tooltip component with EllipsisTableCell as target and id as content", async () => { - const result = render(); - const divArray = result.getAllByText('123'); - expect(divArray).toHaveLength(1); - fireEvent.mouseEnter(divArray[0]); - expect(await result.findAllByText('123')).toHaveLength(2); - }); - - it("should handle id as number", () => { - const { getByText } = render(); - expect(getByText('123')).toBeInTheDocument(); - }); - - it("should handle id as string", () => { - const { getByText } = render(); - expect(getByText('abc')).toBeInTheDocument(); - }); - +describe('IdTemplate', () => { + it('should return null when id is falsy', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should render Tooltip component with EllipsisTableCell as target and id as content', async () => { + const result = render(); + const divArray = result.getAllByText('123'); + expect(divArray).toHaveLength(1); + fireEvent.mouseEnter(divArray[0]); + expect(await result.findAllByText('123')).toHaveLength(2); + }); + + it('should handle id as number', () => { + const { getByText } = render(); + expect(getByText('123')).toBeInTheDocument(); + }); + + it('should handle id as string', () => { + const { getByText } = render(); + expect(getByText('abc')).toBeInTheDocument(); + }); }); - - diff --git a/src/main/cliapp/src/components/Templates/__tests__/ListDialogTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/ListDialogTemplate.test.js index cda1db4c9..5c6abd150 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/ListDialogTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/ListDialogTemplate.test.js @@ -3,53 +3,73 @@ import { ListDialogTemplate } from '../dialog/ListDialogTemplate'; import '../../../tools/jest/setupTests'; describe('ListDialogTemplate', () => { - it('should render a list of strings with a button that can be clicked to open a dialog', () => { - const entities = [{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }, { id: 3, name: 'Item 3' }]; - const handleOpen = jest.fn(); - const getTextField = (entity) => entity.name; - - const result = render(); - - expect(result.getByRole('button')).toBeInTheDocument(); - expect(result.getByText('Item 1')).toBeInTheDocument(); - expect(result.getByText('Item 2')).toBeInTheDocument(); - expect(result.getByText('Item 3')).toBeInTheDocument(); - }); - - it('should return null when the entities prop is falsy', () => { - const entities = null; - const handleOpen = jest.fn(); - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should return null when the handleOpen prop is falsy', () => { - const entities = [{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }, { id: 3, name: 'Item 3' }]; - const handleOpen = undefined; - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when the getTextField prop is falsy', () => { - const entities = [{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }, { id: 3, name: 'Item 3' }]; - const handleOpen = jest.fn(); - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when the entities prop is an empty array', () => { - const entities = []; - const handleOpen = undefined; - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); -}); \ No newline at end of file + it('should render a list of strings with a button that can be clicked to open a dialog', () => { + const entities = [ + { id: 1, name: 'Item 1' }, + { id: 2, name: 'Item 2' }, + { id: 3, name: 'Item 3' }, + ]; + const handleOpen = jest.fn(); + const getTextField = (entity) => entity.name; + + const result = render( + + ); + + expect(result.getByRole('button')).toBeInTheDocument(); + expect(result.getByText('Item 1')).toBeInTheDocument(); + expect(result.getByText('Item 2')).toBeInTheDocument(); + expect(result.getByText('Item 3')).toBeInTheDocument(); + }); + + it('should return null when the entities prop is falsy', () => { + const entities = null; + const handleOpen = jest.fn(); + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + + it('should return null when the handleOpen prop is falsy', () => { + const entities = [ + { id: 1, name: 'Item 1' }, + { id: 2, name: 'Item 2' }, + { id: 3, name: 'Item 3' }, + ]; + const handleOpen = undefined; + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when the getTextField prop is falsy', () => { + const entities = [ + { id: 1, name: 'Item 1' }, + { id: 2, name: 'Item 2' }, + { id: 3, name: 'Item 3' }, + ]; + const handleOpen = jest.fn(); + + const { container } = render(); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when the entities prop is an empty array', () => { + const entities = []; + const handleOpen = undefined; + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js index a7c600a55..ff88d911a 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js @@ -3,15 +3,13 @@ import { NameTemplate } from '../NameTemplate'; import '../../../tools/jest/setupTests'; describe('NameTemplate', () => { - - it('should return null when value is null', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should render the name inside the div', () => { - const result = render(); - expect(result.getByText("test")).toBeInTheDocument(); - }); - -}); \ No newline at end of file + it('should return null when value is null', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should render the name inside the div', () => { + const result = render(); + expect(result.getByText('test')).toBeInTheDocument(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/NestedListDialogTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/NestedListDialogTemplate.test.js index 3d5e10488..ade456405 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/NestedListDialogTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/NestedListDialogTemplate.test.js @@ -3,105 +3,96 @@ import { NestedListDialogTemplate } from '../dialog/NestedListDialogTemplate'; import '../../../tools/jest/setupTests'; describe('NestedListDialogTemplate', () => { - - it('should return null when the entities prop is falsy', () => { - const entities = null; - const handleOpen = jest.fn(); - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should return null when the handleOpen prop is falsy', () => { - const entities = [ - { id: 1, name: 'Item 1', subType: [{ name: "name 1" }, { name: "name 2" }] }, - { id: 2, name: 'Item 2', subType: [{ name: "name 3" }, { name: "name 4" }] }, - { id: 3, name: 'Item 3', subType: [{ name: "name 5" }] } - ]; - const handleOpen = undefined; - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when the getTextField prop is falsy', () => { - const entities = [ - { id: 1, name: 'Item 1', subType: [{ name: "name 1" }, { name: "name 2" }] }, - { id: 2, name: 'Item 2', subType: [{ name: "name 3" }, { name: "name 4" }] }, - { id: 3, name: 'Item 3', subType: [{ name: "name 5" }] } - ]; - const handleOpen = jest.fn(); - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when the entities prop is an empty array', () => { - const entities = []; - const handleOpen = undefined; - const getTextField = (entity) => entity.name; - const subType = "subType"; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when the subType prop is falsy', () => { - const entities = [ - { id: 1, name: 'Item 1', subType: [{ name: "name 1" }, { name: "name 2" }] }, - { id: 2, name: 'Item 2', subType: [{ name: "name 3" }, { name: "name 4" }] }, - { id: 3, name: 'Item 3', subType: [{ name: "name 5" }] } - ]; - - const handleOpen = undefined; - const getTextField = (entity) => entity.name; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should render a list of strings from subtype array', () => { - const entities = [ - { id: 1, name: 'Item 1', subType: [{ name: "name 1" }, { name: "name 2" }] }, - { id: 2, name: 'Item 2', subType: [{ name: "name 3" }, { name: "name 4" }] }, - { id: 3, name: 'Item 3', subType: [{ name: "name 5" }] } - ]; - - const handleOpen = jest.fn(); - const subType = 'subType'; - const getTextString = jest.fn((item) => item.name); - - const result = render(NestedListDialogTemplate({ entities, handleOpen, subType, getTextString })); - - expect(result.getByText('name 1')).toBeInTheDocument(); - expect(result.getByText('name 2')).toBeInTheDocument(); - expect(result.getByText('name 3')).toBeInTheDocument(); - expect(result.getByText('name 4')).toBeInTheDocument(); - expect(result.getByText('name 5')).toBeInTheDocument(); - }); - -}); \ No newline at end of file + it('should return null when the entities prop is falsy', () => { + const entities = null; + const handleOpen = jest.fn(); + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + + it('should return null when the handleOpen prop is falsy', () => { + const entities = [ + { id: 1, name: 'Item 1', subType: [{ name: 'name 1' }, { name: 'name 2' }] }, + { id: 2, name: 'Item 2', subType: [{ name: 'name 3' }, { name: 'name 4' }] }, + { id: 3, name: 'Item 3', subType: [{ name: 'name 5' }] }, + ]; + const handleOpen = undefined; + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when the getTextField prop is falsy', () => { + const entities = [ + { id: 1, name: 'Item 1', subType: [{ name: 'name 1' }, { name: 'name 2' }] }, + { id: 2, name: 'Item 2', subType: [{ name: 'name 3' }, { name: 'name 4' }] }, + { id: 3, name: 'Item 3', subType: [{ name: 'name 5' }] }, + ]; + const handleOpen = jest.fn(); + + const { container } = render(); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when the entities prop is an empty array', () => { + const entities = []; + const handleOpen = undefined; + const getTextField = (entity) => entity.name; + const subType = 'subType'; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when the subType prop is falsy', () => { + const entities = [ + { id: 1, name: 'Item 1', subType: [{ name: 'name 1' }, { name: 'name 2' }] }, + { id: 2, name: 'Item 2', subType: [{ name: 'name 3' }, { name: 'name 4' }] }, + { id: 3, name: 'Item 3', subType: [{ name: 'name 5' }] }, + ]; + + const handleOpen = undefined; + const getTextField = (entity) => entity.name; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + + it('should render a list of strings from subtype array', () => { + const entities = [ + { id: 1, name: 'Item 1', subType: [{ name: 'name 1' }, { name: 'name 2' }] }, + { id: 2, name: 'Item 2', subType: [{ name: 'name 3' }, { name: 'name 4' }] }, + { id: 3, name: 'Item 3', subType: [{ name: 'name 5' }] }, + ]; + + const handleOpen = jest.fn(); + const subType = 'subType'; + const getTextString = jest.fn((item) => item.name); + + const result = render(NestedListDialogTemplate({ entities, handleOpen, subType, getTextString })); + + expect(result.getByText('name 1')).toBeInTheDocument(); + expect(result.getByText('name 2')).toBeInTheDocument(); + expect(result.getByText('name 3')).toBeInTheDocument(); + expect(result.getByText('name 4')).toBeInTheDocument(); + expect(result.getByText('name 5')).toBeInTheDocument(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/NotTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/NotTemplate.test.js index 0118a4c0e..2b5d1ce61 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/NotTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/NotTemplate.test.js @@ -3,23 +3,22 @@ import { NotTemplate } from '../NotTemplate'; import '../../../tools/jest/setupTests'; describe('NotTemplate', () => { + it('should return null when value is null', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); - it('should return null when value is null', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); + it('should return a component with the text "NOT" when the value is true', () => { + const { getByText } = render(); + expect(getByText('NOT')).toBeInTheDocument(); + }); + it('should return a component with an empty string when the value is false', () => { + const { container } = render(); + expect(container.textContent).toBe(''); + }); - it('should return a component with the text "NOT" when the value is true', () => { - const { getByText } = render(); - expect(getByText("NOT")).toBeInTheDocument(); - }); - it('should return a component with an empty string when the value is false', () => { - const { container } = render(); - expect(container.textContent).toBe(''); - }); - - it('should return null when value is not a boolean', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); -}); \ No newline at end of file + it('should return null when value is not a boolean', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/ShortCitationTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/ShortCitationTemplate.test.js index 579e5286f..ff0d3b095 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/ShortCitationTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/ShortCitationTemplate.test.js @@ -2,42 +2,40 @@ import { render } from '@testing-library/react'; import { ShortCitationTemplate } from '../reference/ShortCitationTemplate'; import '../../../tools/jest/setupTests'; -describe("ShortCitationTemplate", () => { - it('should should display the short citation of a reference with the field "short_citation"', () => { - const reference = { - short_citation: 'Short Citation' - }; - - const result = render(); - - const divElement = result.getByText('Short Citation'); - expect(divElement).toBeInTheDocument(); - }); - it('should should display the short citation of a reference with the field "shortCitation"', () => { - const reference = { - shortCitation: 'Short Citation' - }; - - const result = render(); - - const divElement = result.getByText('Short Citation'); - expect(divElement).toBeInTheDocument(); - }); - it('should return an empty div when reference is provided but it does not have a short_citation or shortCitation property', () => { - const reference = {}; - - const { container } = render(); - - const div = container.getElementsByTagName('div')[0]; - - expect(div).toBeInTheDocument(); - expect(div.firstChild).toBeNull(); - }); - - it('should return null when reference is not provided', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); +describe('ShortCitationTemplate', () => { + it('should should display the short citation of a reference with the field "short_citation"', () => { + const reference = { + short_citation: 'Short Citation', + }; -}); + const result = render(); + + const divElement = result.getByText('Short Citation'); + expect(divElement).toBeInTheDocument(); + }); + it('should should display the short citation of a reference with the field "shortCitation"', () => { + const reference = { + shortCitation: 'Short Citation', + }; + + const result = render(); + + const divElement = result.getByText('Short Citation'); + expect(divElement).toBeInTheDocument(); + }); + it('should return an empty div when reference is provided but it does not have a short_citation or shortCitation property', () => { + const reference = {}; + const { container } = render(); + + const div = container.getElementsByTagName('div')[0]; + + expect(div).toBeInTheDocument(); + expect(div.firstChild).toBeNull(); + }); + + it('should return null when reference is not provided', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/SingleReferenceTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/SingleReferenceTemplate.test.js index 7b891cef1..f6250e8c0 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/SingleReferenceTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/SingleReferenceTemplate.test.js @@ -2,14 +2,11 @@ import { render } from '@testing-library/react'; import { SingleReferenceTemplate } from '../reference/SingleReferenceTemplate'; import '../../../tools/jest/setupTests'; -describe("SingleReferenceTemplate", () => { - - it("should return null when singleReference is falsy", () => { - const singleReference = null; - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); +describe('SingleReferenceTemplate', () => { + it('should return null when singleReference is falsy', () => { + const singleReference = null; + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js index c53ef9118..b7eb35d47 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js @@ -3,69 +3,66 @@ import { TaxonTemplate } from '../TaxonTemplate'; import '../../../tools/jest/setupTests'; describe('TaxonTemplate', () => { + it('should return null when object is null/falsy', () => { + const result = render(); + expect(result.container.firstChild).toBeNull(); + }); - it('should return null when object is null/falsy', () => { - const result = render(); - expect(result.container.firstChild).toBeNull(); - }); + it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { + const object = {}; - it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { - const object = {}; + const result = render(); - const result = render(); + const ellipsisTableCell = result.container.firstChild; + expect(ellipsisTableCell).toHaveTextContent(''); + }); - const ellipsisTableCell = result.container.firstChild; - expect(ellipsisTableCell).toHaveTextContent(''); - }); + it('should render an EllipsisTableCell component with only the name if the object has no curie', () => { + const object = { + name: 'Taxon Name', + }; - it('should render an EllipsisTableCell component with only the name if the object has no curie', () => { - const object = { - name: 'Taxon Name' - }; + const result = render(); - const result = render(); + const ellipsisTableCell = result.getByText('Taxon Name'); + expect(ellipsisTableCell).toBeInTheDocument(); + }); - const ellipsisTableCell = result.getByText('Taxon Name'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); + it('should render an EllipsisTableCell component with only the curie if the object has no name', () => { + const object = { + curie: 'Taxon Curie', + }; - it('should render an EllipsisTableCell component with only the curie if the object has no name', () => { - const object = { - curie: 'Taxon Curie' - }; + const result = render(); - const result = render(); + const ellipsisTableCell = result.getByText('Taxon Curie'); + expect(ellipsisTableCell).toBeInTheDocument(); + }); - const ellipsisTableCell = result.getByText('Taxon Curie'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); + it('should render the name and curie of the Taxon object in an EllipsisTableCell component', () => { + const object = { + name: 'Taxon Name', + curie: 'Taxon Curie', + }; + const result = render(); - it('should render the name and curie of the Taxon object in an EllipsisTableCell component', () => { - const object = { - name: 'Taxon Name', - curie: 'Taxon Curie' - }; + const content = result.getByText('Taxon Name (Taxon Curie)'); + expect(content).toBeInTheDocument(); + }); - const result = render(); + it('should display a tooltip with the name and curie of the Taxon object when hovering over the EllipsisTableCell component', async () => { + const object = { + name: 'Taxon Name', + curie: 'Taxon Curie', + }; - const content = result.getByText('Taxon Name (Taxon Curie)'); - expect(content).toBeInTheDocument(); - }); + const result = render(); - it('should display a tooltip with the name and curie of the Taxon object when hovering over the EllipsisTableCell component', async () => { - const object = { - name: 'Taxon Name', - curie: 'Taxon Curie' - }; + const divContentArray = result.getAllByText('Taxon Name (Taxon Curie)'); + expect(divContentArray).toHaveLength(1); + fireEvent.mouseEnter(divContentArray[0]); - const result = render(); - - const divContentArray = result.getAllByText('Taxon Name (Taxon Curie)'); - expect(divContentArray).toHaveLength(1); - fireEvent.mouseEnter(divContentArray[0]); - - expect(await result.findAllByText('Taxon Name (Taxon Curie)')).toHaveLength(2); - }); - -}); \ No newline at end of file + expect(await result.findAllByText('Taxon Name (Taxon Curie)')).toHaveLength(2); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/TextDialogTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/TextDialogTemplate.test.js index 1367bd572..cebd5b4fb 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/TextDialogTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/TextDialogTemplate.test.js @@ -3,93 +3,100 @@ import { TextDialogTemplate } from '../dialog/TextDialogTemplate'; import '../../../tools/jest/setupTests'; describe('TextDialogTemplate', () => { - - it('should render a Button component when entity, handleOpen, and text are truthy', () => { - const entity = { displayText: "text" }; - const handleOpen = jest.fn(); - - const result = render(); - - const button = result.getByRole('button'); - expect(button).toBeInTheDocument(); - }); - it('should return null when entity is falsy', () => { - const entity = null; - const handleOpen = jest.fn(); - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should return null when handleOpen is falsy', () => { - const entity = { displayText: "text" }; - const handleOpen = null; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - it('should return null when text is falsy', () => { - const entity = { displayText: "text" }; - const handleOpen = null; - - const { container } = render(); - - expect(container.firstChild).toBeNull(); - }); - - it('should call handleOpen function with correct parameter when Button is clicked', () => { - const entity = { displayText: "text" }; - const handleOpen = jest.fn(); - - const result = render(); - fireEvent.click(result.getByRole('button')); - - expect(handleOpen).toHaveBeenCalledWith(entity); - }); - it('should accept any entity type', () => { - const entity1 = { displayText: "text 1" }; - const entity2 = { - subEntity: - { - name: "text 2" - } - }; - const entity3 = { - subEntity: - { - subSubEntity: { - display: "text 3" - } - } - }; - const handleOpen = jest.fn(); - - const result1 = render(); - const result2 = render(); - const result3 = render(); - - const element1 = result1.getByText('text 1'); - const element2 = result2.getByText('text 2'); - const element3 = result3.getByText('text 3'); - - expect(element1).toBeInTheDocument(); - expect(element2).toBeInTheDocument(); - expect(element3).toBeInTheDocument(); - }); - - it('should render tags in the HTML', async () => { - const entity = { - subEntity: { - displayText: 'Text with superscript' - }, - }; - const handleOpen = jest.fn(); - - const { container } = render(); - - let superScript = container.querySelector('sup'); - expect(superScript).toBeInTheDocument(); - }); -}); \ No newline at end of file + it('should render a Button component when entity, handleOpen, and text are truthy', () => { + const entity = { displayText: 'text' }; + const handleOpen = jest.fn(); + + const result = render(); + + const button = result.getByRole('button'); + expect(button).toBeInTheDocument(); + }); + it('should return null when entity is falsy', () => { + const entity = null; + const handleOpen = jest.fn(); + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + + it('should return null when handleOpen is falsy', () => { + const entity = { displayText: 'text' }; + const handleOpen = null; + + const { container } = render( + + ); + + expect(container.firstChild).toBeNull(); + }); + it('should return null when text is falsy', () => { + const entity = { displayText: 'text' }; + const handleOpen = null; + + const { container } = render(); + + expect(container.firstChild).toBeNull(); + }); + + it('should call handleOpen function with correct parameter when Button is clicked', () => { + const entity = { displayText: 'text' }; + const handleOpen = jest.fn(); + + const result = render(); + fireEvent.click(result.getByRole('button')); + + expect(handleOpen).toHaveBeenCalledWith(entity); + }); + it('should accept any entity type', () => { + const entity1 = { displayText: 'text 1' }; + const entity2 = { + subEntity: { + name: 'text 2', + }, + }; + const entity3 = { + subEntity: { + subSubEntity: { + display: 'text 3', + }, + }, + }; + const handleOpen = jest.fn(); + + const result1 = render(); + const result2 = render( + + ); + const result3 = render( + + ); + + const element1 = result1.getByText('text 1'); + const element2 = result2.getByText('text 2'); + const element3 = result3.getByText('text 3'); + + expect(element1).toBeInTheDocument(); + expect(element2).toBeInTheDocument(); + expect(element3).toBeInTheDocument(); + }); + + it('should render tags in the HTML', async () => { + const entity = { + subEntity: { + displayText: 'Text with superscript', + }, + }; + const handleOpen = jest.fn(); + + const { container } = render( + + ); + + let superScript = container.querySelector('sup'); + expect(superScript).toBeInTheDocument(); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/TruncatedReferencesTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/TruncatedReferencesTemplate.test.js index ec66f5ccd..fd4cd2b28 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/TruncatedReferencesTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/TruncatedReferencesTemplate.test.js @@ -3,183 +3,152 @@ import { TruncatedReferencesTemplate } from '../reference/TruncatedReferencesTem import '../../../tools/jest/setupTests'; import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min'; -describe("TruncatedReferencesTemplate", () => { - - it('should render a list of references when references prop is not null and has length greater than 0', () => { - const references = [ - { - curie: "MainCurie:111", - crossReferences: [ - { referencedCurie: "PMID:000001" }, - { referencedCurie: "FB:FBgn0000001" }, - { referencedCurie: "MGI:MGI:0000001" }, - { referencedCurie: "RGD:2000001" }, - { referencedCurie: "SGD:S000001" }, - { referencedCurie: "WB:WBGene00000001" }, - { referencedCurie: "ZFIN:ZDB-GENE-000000-1" }, - { referencedCurie: "ExtraCurie:111" } - ] - }, - { - curie: "MainCurie:222", - crossReferences: [ - { referencedCurie: "PMID:000002" }, - { referencedCurie: "FB:FBgn0000002" }, - { referencedCurie: "MGI:MGI:0000002" }, - { referencedCurie: "RGD:2000002" }, - { referencedCurie: "SGD:S000002" }, - { referencedCurie: "WB:WBGene00000002" }, - { referencedCurie: "ZFIN:ZDB-GENE-000000-2" }, - { referencedCurie: "ExtraCurie:222" } - ] - } - ]; - - const identifier = '123'; - - const result = render(); - - const reference1 = result.getByText('PMID:000001 (FB:FBgn0000001|MGI:MGI:0000001|RGD:2000001|SGD:S000001|WB:WBGene00000001|ZFIN:ZDB-GENE-000000-1|ExtraCurie:111|MainCurie:111)'); - const reference2 = result.getByText('PMID:000002 (FB:FBgn0000002|MGI:MGI:0000002|RGD:2000002|SGD:S000002|WB:WBGene00000002|ZFIN:ZDB-GENE-000000-2|ExtraCurie:222|MainCurie:222)'); - expect(reference1).toBeInTheDocument(); - expect(reference2).toBeInTheDocument(); - }); - - it('should not render anything when references prop is null', () => { - const references = null; - const identifier = '123'; - - const result = render(); - - expect(result.container.firstChild).toBeNull(); - }); - - it('should render a truncated list of references when references prop has length greater than 5', () => { - const references = [ - { - curie: "MainCurie:111", - crossReferences: [ - { referencedCurie: "PMID:000001" }, - { referencedCurie: "FB:FBgn0000001" }, - ] - }, - { - curie: "MainCurie:222", - crossReferences: [ - { referencedCurie: "PMID:000002" }, - { referencedCurie: "MGI:MGI:0000002" }, - ] - }, - { - curie: "MainCurie:333", - crossReferences: [ - { referencedCurie: "PMID:000003" }, - { referencedCurie: "RGD:2000003" }, - ] - }, - { - curie: "MainCurie:444", - crossReferences: [ - { referencedCurie: "PMID:000004" }, - { referencedCurie: "SGD:S000004" }, - ] - }, - { - curie: "MainCurie:555", - crossReferences: [ - { referencedCurie: "PMID:000005" }, - { referencedCurie: "WB:WBGene00000005" }, - ] - }, - { - curie: "MainCurie:666", - crossReferences: [ - { referencedCurie: "PMID:000006" }, - { referencedCurie: "ZFIN:ZDB-GENE-000000-6" }, - ] - } - ]; - - const identifier = '123'; - - const result = render( - - - - ); - //using queryBy here because getBy will return an error if not found and the point is to test that reference6 isn't shown - const reference1 = result.queryByText('PMID:000001 (FB:FBgn0000001|MainCurie:111)'); - const reference2 = result.queryByText('PMID:000002 (MGI:MGI:0000002|MainCurie:222)'); - const reference3 = result.queryByText('PMID:000003 (RGD:2000003|MainCurie:333)'); - const reference4 = result.queryByText('PMID:000004 (SGD:S000004|MainCurie:444)'); - const reference5 = result.queryByText('PMID:000005 (WB:WBGene00000005|MainCurie:555)'); - const reference6 = result.queryByText('PMID:000006 (ZFIN:ZDB-GENE-000000-6|MainCurie:666)'); - expect(reference1).toBeInTheDocument(); - expect(reference2).toBeInTheDocument(); - expect(reference3).toBeInTheDocument(); - expect(reference4).toBeInTheDocument(); - expect(reference5).toBeInTheDocument(); - expect(reference6).not.toBeInTheDocument(); - }); - - it('should display detail message link when references prop has length greater than 5', () => { - const references = [ - { - curie: "MainCurie:111", - crossReferences: [ - { referencedCurie: "PMID:000001" }, - { referencedCurie: "FB:FBgn0000001" }, - ] - }, - { - curie: "MainCurie:222", - crossReferences: [ - { referencedCurie: "PMID:000002" }, - { referencedCurie: "MGI:MGI:0000002" }, - ] - }, - { - curie: "MainCurie:333", - crossReferences: [ - { referencedCurie: "PMID:000003" }, - { referencedCurie: "RGD:2000003" }, - ] - }, - { - curie: "MainCurie:444", - crossReferences: [ - { referencedCurie: "PMID:000004" }, - { referencedCurie: "SGD:S000004" }, - ] - }, - { - curie: "MainCurie:555", - crossReferences: [ - { referencedCurie: "PMID:000005" }, - { referencedCurie: "WB:WBGene00000005" }, - ] - }, - { - curie: "MainCurie:666", - crossReferences: [ - { referencedCurie: "PMID:000006" }, - { referencedCurie: "ZFIN:ZDB-GENE-000000-6" }, - ] - } - ]; - - const identifier = '123'; - - const result = render( - - - - ); - - let detailMessage = result.getByRole('alert', { name: 'detailMessage' }); - - expect(detailMessage).toBeInTheDocument(); - }); - +describe('TruncatedReferencesTemplate', () => { + it('should render a list of references when references prop is not null and has length greater than 0', () => { + const references = [ + { + curie: 'MainCurie:111', + crossReferences: [ + { referencedCurie: 'PMID:000001' }, + { referencedCurie: 'FB:FBgn0000001' }, + { referencedCurie: 'MGI:MGI:0000001' }, + { referencedCurie: 'RGD:2000001' }, + { referencedCurie: 'SGD:S000001' }, + { referencedCurie: 'WB:WBGene00000001' }, + { referencedCurie: 'ZFIN:ZDB-GENE-000000-1' }, + { referencedCurie: 'ExtraCurie:111' }, + ], + }, + { + curie: 'MainCurie:222', + crossReferences: [ + { referencedCurie: 'PMID:000002' }, + { referencedCurie: 'FB:FBgn0000002' }, + { referencedCurie: 'MGI:MGI:0000002' }, + { referencedCurie: 'RGD:2000002' }, + { referencedCurie: 'SGD:S000002' }, + { referencedCurie: 'WB:WBGene00000002' }, + { referencedCurie: 'ZFIN:ZDB-GENE-000000-2' }, + { referencedCurie: 'ExtraCurie:222' }, + ], + }, + ]; + + const identifier = '123'; + + const result = render( + + ); + + const reference1 = result.getByText( + 'PMID:000001 (FB:FBgn0000001|MGI:MGI:0000001|RGD:2000001|SGD:S000001|WB:WBGene00000001|ZFIN:ZDB-GENE-000000-1|ExtraCurie:111|MainCurie:111)' + ); + const reference2 = result.getByText( + 'PMID:000002 (FB:FBgn0000002|MGI:MGI:0000002|RGD:2000002|SGD:S000002|WB:WBGene00000002|ZFIN:ZDB-GENE-000000-2|ExtraCurie:222|MainCurie:222)' + ); + expect(reference1).toBeInTheDocument(); + expect(reference2).toBeInTheDocument(); + }); + + it('should not render anything when references prop is null', () => { + const references = null; + const identifier = '123'; + + const result = render( + + ); + + expect(result.container.firstChild).toBeNull(); + }); + + it('should render a truncated list of references when references prop has length greater than 5', () => { + const references = [ + { + curie: 'MainCurie:111', + crossReferences: [{ referencedCurie: 'PMID:000001' }, { referencedCurie: 'FB:FBgn0000001' }], + }, + { + curie: 'MainCurie:222', + crossReferences: [{ referencedCurie: 'PMID:000002' }, { referencedCurie: 'MGI:MGI:0000002' }], + }, + { + curie: 'MainCurie:333', + crossReferences: [{ referencedCurie: 'PMID:000003' }, { referencedCurie: 'RGD:2000003' }], + }, + { + curie: 'MainCurie:444', + crossReferences: [{ referencedCurie: 'PMID:000004' }, { referencedCurie: 'SGD:S000004' }], + }, + { + curie: 'MainCurie:555', + crossReferences: [{ referencedCurie: 'PMID:000005' }, { referencedCurie: 'WB:WBGene00000005' }], + }, + { + curie: 'MainCurie:666', + crossReferences: [{ referencedCurie: 'PMID:000006' }, { referencedCurie: 'ZFIN:ZDB-GENE-000000-6' }], + }, + ]; + + const identifier = '123'; + + const result = render( + + + + ); + //using queryBy here because getBy will return an error if not found and the point is to test that reference6 isn't shown + const reference1 = result.queryByText('PMID:000001 (FB:FBgn0000001|MainCurie:111)'); + const reference2 = result.queryByText('PMID:000002 (MGI:MGI:0000002|MainCurie:222)'); + const reference3 = result.queryByText('PMID:000003 (RGD:2000003|MainCurie:333)'); + const reference4 = result.queryByText('PMID:000004 (SGD:S000004|MainCurie:444)'); + const reference5 = result.queryByText('PMID:000005 (WB:WBGene00000005|MainCurie:555)'); + const reference6 = result.queryByText('PMID:000006 (ZFIN:ZDB-GENE-000000-6|MainCurie:666)'); + expect(reference1).toBeInTheDocument(); + expect(reference2).toBeInTheDocument(); + expect(reference3).toBeInTheDocument(); + expect(reference4).toBeInTheDocument(); + expect(reference5).toBeInTheDocument(); + expect(reference6).not.toBeInTheDocument(); + }); + + it('should display detail message link when references prop has length greater than 5', () => { + const references = [ + { + curie: 'MainCurie:111', + crossReferences: [{ referencedCurie: 'PMID:000001' }, { referencedCurie: 'FB:FBgn0000001' }], + }, + { + curie: 'MainCurie:222', + crossReferences: [{ referencedCurie: 'PMID:000002' }, { referencedCurie: 'MGI:MGI:0000002' }], + }, + { + curie: 'MainCurie:333', + crossReferences: [{ referencedCurie: 'PMID:000003' }, { referencedCurie: 'RGD:2000003' }], + }, + { + curie: 'MainCurie:444', + crossReferences: [{ referencedCurie: 'PMID:000004' }, { referencedCurie: 'SGD:S000004' }], + }, + { + curie: 'MainCurie:555', + crossReferences: [{ referencedCurie: 'PMID:000005' }, { referencedCurie: 'WB:WBGene00000005' }], + }, + { + curie: 'MainCurie:666', + crossReferences: [{ referencedCurie: 'PMID:000006' }, { referencedCurie: 'ZFIN:ZDB-GENE-000000-6' }], + }, + ]; + + const identifier = '123'; + + const result = render( + + + + ); + + let detailMessage = result.getByRole('alert', { name: 'detailMessage' }); + + expect(detailMessage).toBeInTheDocument(); + }); }); - diff --git a/src/main/cliapp/src/components/Templates/dialog/CountDialogTemplate.js b/src/main/cliapp/src/components/Templates/dialog/CountDialogTemplate.js index 61dedcdec..47acd6ca2 100644 --- a/src/main/cliapp/src/components/Templates/dialog/CountDialogTemplate.js +++ b/src/main/cliapp/src/components/Templates/dialog/CountDialogTemplate.js @@ -1,14 +1,11 @@ -import { Button } from "primereact/button"; +import { Button } from 'primereact/button'; export const CountDialogTemplate = ({ entities, handleOpen, text }) => { - if (!entities || entities.length === 0 || !handleOpen || !text) return null; + if (!entities || entities.length === 0 || !handleOpen || !text) return null; - return ( - - ); - -}; \ No newline at end of file + return ( + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/dialog/ListDialogTemplate.js b/src/main/cliapp/src/components/Templates/dialog/ListDialogTemplate.js index 7b63ba5cb..13da123e8 100644 --- a/src/main/cliapp/src/components/Templates/dialog/ListDialogTemplate.js +++ b/src/main/cliapp/src/components/Templates/dialog/ListDialogTemplate.js @@ -1,26 +1,26 @@ -import { Button } from "primereact/button"; -import { ListTableCell } from "../../ListTableCell"; +import { Button } from 'primereact/button'; +import { ListTableCell } from '../../ListTableCell'; export const ListDialogTemplate = ({ entities, handleOpen, getTextField, underline = true }) => { - if (!entities || entities.length === 0 || !handleOpen || !getTextField) return null; + if (!entities || entities.length === 0 || !handleOpen || !getTextField) return null; - const uniqueItemsSet = new Set(entities.map(entity => getTextField(entity))); - const sortedItems = Array.from(uniqueItemsSet).sort(); + const uniqueItemsSet = new Set(entities.map((entity) => getTextField(entity))); + const sortedItems = Array.from(uniqueItemsSet).sort(); - const listTemplate = (item) => ( -
    - ); + const listTemplate = (item) => ( +
    + ); - return ( - <> -
    - -
    - - ); -}; \ No newline at end of file + return ( + <> +
    + +
    + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/dialog/NestedListDialogTemplate.js b/src/main/cliapp/src/components/Templates/dialog/NestedListDialogTemplate.js index 4aedd5ae6..52c9ce3cb 100644 --- a/src/main/cliapp/src/components/Templates/dialog/NestedListDialogTemplate.js +++ b/src/main/cliapp/src/components/Templates/dialog/NestedListDialogTemplate.js @@ -1,28 +1,24 @@ -import { Button } from "primereact/button"; -import { ListTableCell } from "../../ListTableCell"; +import { Button } from 'primereact/button'; +import { ListTableCell } from '../../ListTableCell'; export const NestedListDialogTemplate = ({ entities, subType, handleOpen, getTextString, underline = true }) => { - if (!entities || entities.length === 0 || !handleOpen || !subType || !getTextString) return null; + if (!entities || entities.length === 0 || !handleOpen || !subType || !getTextString) return null; - const strings = entities.flatMap((entity) => entity[subType]?.map(item => getTextString(item)) || []); - const uniqueStrings = new Set(strings); - const sortedStrings = Array.from(uniqueStrings).sort(); + const strings = entities.flatMap((entity) => entity[subType]?.map((item) => getTextString(item)) || []); + const uniqueStrings = new Set(strings); + const sortedStrings = Array.from(uniqueStrings).sort(); - const listTemplate = (item) => { - return ( - - {item && item} - - ); - }; + const listTemplate = (item) => { + return {item && item}; + }; - return ( - <> -
    - -
    - - ); -}; \ No newline at end of file + return ( + <> +
    + +
    + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/dialog/TextDialogTemplate.js b/src/main/cliapp/src/components/Templates/dialog/TextDialogTemplate.js index ebf3ac578..25f57f3f1 100644 --- a/src/main/cliapp/src/components/Templates/dialog/TextDialogTemplate.js +++ b/src/main/cliapp/src/components/Templates/dialog/TextDialogTemplate.js @@ -1,16 +1,20 @@ -import { Button } from "primereact/button"; +import { Button } from 'primereact/button'; -export const TextDialogTemplate = ({ entity, handleOpen, text, underline=true }) => { - if (!entity || !handleOpen || !text) return null; - return ( - <> - - - ); -}; \ No newline at end of file +export const TextDialogTemplate = ({ entity, handleOpen, text, underline = true }) => { + if (!entity || !handleOpen || !text) return null; + return ( + <> + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js index 32d544a7d..d63982e03 100644 --- a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js +++ b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js @@ -1,36 +1,40 @@ -import { ListTableCell } from "../../ListTableCell"; -import { getGenomicEntityText, getIdentifier } from "../../../utils/utils"; -import { Tooltip } from "primereact/tooltip"; +import { ListTableCell } from '../../ListTableCell'; +import { getGenomicEntityText, getIdentifier } from '../../../utils/utils'; +import { Tooltip } from 'primereact/tooltip'; export const GenomicEntityListTemplate = ({ genomicEntities }) => { - - if (!genomicEntities || genomicEntities.length === 0) return null; - - const targetClass = `a${global.crypto.randomUUID()}`; - - const genomicEntityStrings = genomicEntities.map((genomicEntity) => { - const text = getGenomicEntityText(genomicEntity); - const indentifier = getIdentifier(genomicEntity); - - if(!text) return indentifier; - if(!indentifier) return text; - return `${text} (${indentifier})`; - }); - - const sortedGenomicEntityStrings = genomicEntityStrings.sort(); - - const listTemplate = (genomicEntityString) => { - return
    ; - }; - - return ( - <> -
    - -
    - - - - - ); -}; \ No newline at end of file + if (!genomicEntities || genomicEntities.length === 0) return null; + + const targetClass = `a${global.crypto.randomUUID()}`; + + const genomicEntityStrings = genomicEntities.map((genomicEntity) => { + const text = getGenomicEntityText(genomicEntity); + const indentifier = getIdentifier(genomicEntity); + + if (!text) return indentifier; + if (!indentifier) return text; + return `${text} (${indentifier})`; + }); + + const sortedGenomicEntityStrings = genomicEntityStrings.sort(); + + const listTemplate = (genomicEntityString) => { + return ( +
    + ); + }; + + return ( + <> +
    + +
    + + + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js index 091e64895..3d84a7faa 100644 --- a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js +++ b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js @@ -1,29 +1,30 @@ -import { Tooltip } from "primereact/tooltip"; -import { getGenomicEntityText, getIdentifier } from "../../../utils/utils"; +import { Tooltip } from 'primereact/tooltip'; +import { getGenomicEntityText, getIdentifier } from '../../../utils/utils'; export const GenomicEntityTemplate = ({ genomicEntity }) => { - if (!genomicEntity) return null; + if (!genomicEntity) return null; - const targetClass = `a${global.crypto.randomUUID()}`; - const subjectText = getGenomicEntityText(genomicEntity); - const indentifier = getIdentifier(genomicEntity); + const targetClass = `a${global.crypto.randomUUID()}`; + const subjectText = getGenomicEntityText(genomicEntity); + const indentifier = getIdentifier(genomicEntity); - if(!subjectText) return
    {indentifier}
    ; + if (!subjectText) return
    {indentifier}
    ; - return ( - <> -
    - -
    - - - ); + return ( + <> +
    + +
    + + + ); }; - diff --git a/src/main/cliapp/src/components/Templates/reference/CrossReferenceTemplate.js b/src/main/cliapp/src/components/Templates/reference/CrossReferenceTemplate.js index bc010fde7..3c38ebc2d 100644 --- a/src/main/cliapp/src/components/Templates/reference/CrossReferenceTemplate.js +++ b/src/main/cliapp/src/components/Templates/reference/CrossReferenceTemplate.js @@ -2,17 +2,17 @@ import { ListTableCell } from '../../ListTableCell'; import { getCrossReferences } from '../../../containers/allelesPage/utils'; export const CrossReferenceTemplate = ({ reference }) => { - if (!reference) return null; + if (!reference) return null; - const { crossReferences, curieField } = getCrossReferences(reference); + const { crossReferences, curieField } = getCrossReferences(reference); - const sortedCrossReferences = crossReferences?.sort((a, b) => (a[curieField] > b[curieField]) ? 1 : -1); + const sortedCrossReferences = crossReferences?.sort((a, b) => (a[curieField] > b[curieField] ? 1 : -1)); - const listTemplate = (item) => item[curieField]; + const listTemplate = (item) => item[curieField]; - return ( -
    - -
    - ); + return ( +
    + +
    + ); }; diff --git a/src/main/cliapp/src/components/Templates/reference/ShortCitationTemplate.js b/src/main/cliapp/src/components/Templates/reference/ShortCitationTemplate.js index d9fbbacd7..ea1754112 100644 --- a/src/main/cliapp/src/components/Templates/reference/ShortCitationTemplate.js +++ b/src/main/cliapp/src/components/Templates/reference/ShortCitationTemplate.js @@ -1,13 +1,8 @@ -import { getShortCitation } from "../../../containers/allelesPage/utils"; +import { getShortCitation } from '../../../containers/allelesPage/utils'; export const ShortCitationTemplate = ({ reference }) => { - if (!reference) return null; + if (!reference) return null; - const shortCitation = getShortCitation(reference); + const shortCitation = getShortCitation(reference); - return ( -
    - {shortCitation} -
    - ); + return
    {shortCitation}
    ; }; - diff --git a/src/main/cliapp/src/components/Templates/reference/SingleReferenceTemplate.js b/src/main/cliapp/src/components/Templates/reference/SingleReferenceTemplate.js index 1b9b5c996..2e7100850 100644 --- a/src/main/cliapp/src/components/Templates/reference/SingleReferenceTemplate.js +++ b/src/main/cliapp/src/components/Templates/reference/SingleReferenceTemplate.js @@ -1,27 +1,28 @@ -import { getRefString } from "../../../utils/utils"; -import { Tooltip } from "primereact/tooltip"; +import { getRefString } from '../../../utils/utils'; +import { Tooltip } from 'primereact/tooltip'; export const SingleReferenceTemplate = ({ singleReference }) => { - if (!singleReference) return null; + if (!singleReference) return null; - const targetClass = `a${global.crypto.randomUUID()}`; + const targetClass = `a${global.crypto.randomUUID()}`; - let refString = getRefString(singleReference); + let refString = getRefString(singleReference); - return ( - <> -
    - -
    - - - ); - -}; \ No newline at end of file + return ( + <> +
    + +
    + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/reference/TruncatedReferencesTemplate.js b/src/main/cliapp/src/components/Templates/reference/TruncatedReferencesTemplate.js index 7505c413e..de4ba4e1a 100644 --- a/src/main/cliapp/src/components/Templates/reference/TruncatedReferencesTemplate.js +++ b/src/main/cliapp/src/components/Templates/reference/TruncatedReferencesTemplate.js @@ -1,30 +1,33 @@ -import { ListTableCell } from "../../ListTableCell"; -import { DetailMessage } from "../../DetailMessage"; -import { SingleReferenceTemplate } from "./SingleReferenceTemplate"; +import { ListTableCell } from '../../ListTableCell'; +import { DetailMessage } from '../../DetailMessage'; +import { SingleReferenceTemplate } from './SingleReferenceTemplate'; export const TruncatedReferencesTemplate = ({ references, identifier, detailPage }) => { - if (!references || references.length === 0) return null; - let truncatedReferences = references; - let displayDetailMessage = false; + if (!references || references.length === 0) return null; + let truncatedReferences = references; + let displayDetailMessage = false; - const targetClass = `a${global.crypto.randomUUID()}`; + const targetClass = `a${global.crypto.randomUUID()}`; - if (truncatedReferences.length > 5 && detailPage) { - truncatedReferences = references.slice(0, 5); - displayDetailMessage = true; - } + if (truncatedReferences.length > 5 && detailPage) { + truncatedReferences = references.slice(0, 5); + displayDetailMessage = true; + } - const listTemplate = (singleReference) => ; + const listTemplate = (singleReference) => ; - return ( - <> -
    - -
    -
    - -
    - - ); - -}; \ No newline at end of file + return ( + <> +
    + +
    +
    + +
    + + ); +}; diff --git a/src/main/cliapp/src/components/TrueFalseDropDownSelector.js b/src/main/cliapp/src/components/TrueFalseDropDownSelector.js index 1cc8bcfeb..250e1b22e 100644 --- a/src/main/cliapp/src/components/TrueFalseDropDownSelector.js +++ b/src/main/cliapp/src/components/TrueFalseDropDownSelector.js @@ -1,30 +1,30 @@ import React, { useState } from 'react'; -import { Dropdown } from "primereact/dropdown" +import { Dropdown } from 'primereact/dropdown'; export function TrueFalseDropdown({ field, options, showClear = false, editorChange, props }) { - const [selectedValue, setSelectedValue] = useState(props.rowData[field]); + const [selectedValue, setSelectedValue] = useState(props.rowData[field]); - const onShow = () => { - setSelectedValue(props.rowData[field]); - } + const onShow = () => { + setSelectedValue(props.rowData[field]); + }; - const onChange = (e) => { - setSelectedValue(e.value) - editorChange(props, e) - } + const onChange = (e) => { + setSelectedValue(e.value); + editorChange(props, e); + }; - return ( - <> - onChange(e)} - optionLabel="text" - showClear={showClear} - placeholder={selectedValue === null ? '' : JSON.stringify(selectedValue)} - style={{ width: '100%' }} - /> - - ) + return ( + <> + onChange(e)} + optionLabel="text" + showClear={showClear} + placeholder={selectedValue === null ? '' : JSON.stringify(selectedValue)} + style={{ width: '100%' }} + /> + + ); } diff --git a/src/main/cliapp/src/components/__tests__/DetailMessage.test.js b/src/main/cliapp/src/components/__tests__/DetailMessage.test.js index 830eed206..777a9af83 100644 --- a/src/main/cliapp/src/components/__tests__/DetailMessage.test.js +++ b/src/main/cliapp/src/components/__tests__/DetailMessage.test.js @@ -1,48 +1,47 @@ import { render } from '@testing-library/react'; import '../../tools/jest/setupTests'; import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min'; -import { DetailMessage } from "../DetailMessage"; -describe("DetailMessage", () => { - - it('should return null when display is false', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should return null when identifier is undefined', () => { - const { container } = render( - - - - ); - expect(container.firstChild).toBeNull(); - }); - - it('should return null when text is undefined', () => { - const identifier = '123'; - const display = true; - - const { container } = render( - - - - ); - - expect(container.firstChild).toBeNull(); - }); - - it('should render a Message component when display is true', () => { - const identifier = '123'; - const text = 'Example Text'; - const display = true; - - const result = render( - - - - ); - - const messageComponent = result.getByText(text); - expect(messageComponent).toBeInTheDocument(); - }); -}); \ No newline at end of file +import { DetailMessage } from '../DetailMessage'; +describe('DetailMessage', () => { + it('should return null when display is false', () => { + const { container } = render(); + expect(container.firstChild).toBeNull(); + }); + + it('should return null when identifier is undefined', () => { + const { container } = render( + + + + ); + expect(container.firstChild).toBeNull(); + }); + + it('should return null when text is undefined', () => { + const identifier = '123'; + const display = true; + + const { container } = render( + + + + ); + + expect(container.firstChild).toBeNull(); + }); + + it('should render a Message component when display is true', () => { + const identifier = '123'; + const text = 'Example Text'; + const display = true; + + const result = render( + + + + ); + + const messageComponent = result.getByText(text); + expect(messageComponent).toBeInTheDocument(); + }); +}); diff --git a/src/main/cliapp/src/constants/Classes.js b/src/main/cliapp/src/constants/Classes.js index 39ef67ed6..af5b2a903 100644 --- a/src/main/cliapp/src/constants/Classes.js +++ b/src/main/cliapp/src/constants/Classes.js @@ -1,71 +1,73 @@ - export const CLASSES = Object.freeze({ - Gene: { name: "Genes", link: "/#/genes", type: 'entity', }, - Allele: { name: "Alleles", link: "/#/alleles", type: 'entity', }, - AffectedGenomicModel: { name: "Affected Genomic Models", link: "/#/agms", type: 'entity', }, - Variant: { name: "Variants", link: "/#/variants", type: "entity", }, - DiseaseAnnotation: { name: "Disease Annotations", link: "/#/diseaseAnnotations", type: 'entity', }, - AGMDiseaseAnnotation: { name: "AGM Disease Annotations", link: "/#/diseaseAnnotations", type: 'entity', }, - AlleleDiseaseAnnotation: { name: "Allele Disease Annotations", link: "/#/diseaseAnnotations", type: 'entity', }, - GeneDiseaseAnnotation: { name: "Gene Disease Annotations", link: "/#/diseaseAnnotations", type: 'entity', }, - PhenotypeAnnotation: { name: "Phenotype Annotations", link: "/#/phenotypeAnnotations", type: 'entity', }, - AGMPhenotypeAnnotation: { name: "AGM Phenotype Annotations", link: "/#/phenotypeAnnotations", type: 'entity', }, - AllelePhenotypeAnnotation: { name: "Allele Phenotype Annotations", link: "/#/phenotypeAnnotations", type: 'entity', }, - GeneGeneticInteraction: { name: "Gene Genetic Interactions", link: "/#/geneGeneticInteractions", type: 'entity', }, - GeneMolecularInteraction: { name: "Gene Molecular Interactions", link: "/#/geneMolecularInteractions", type: 'entity', }, - GenePhenotypeAnnotation: { name: "Gene Phenotype Annotations", link: "/#/phenotypeAnnotations", type: 'entity', }, - ExperimentalCondition: { name: "Experimental Conditions", link: "/#/experimentalConditions", type: 'entity', }, - ConditionRelation: { name: "Condition Relations", link: "/#/conditionRelations", type: 'entity', }, - Construct: { name: "Constructs", link: "/#/constructs", type: 'entity' }, - Molecule: { name: "Molecules", link: "/#/molecules", type: 'entity', }, - Reference: { name: "Literature References", link: "/#/references", type: 'entity', }, - Specie: { name: "Species", link: "/#/species", type: 'entity'}, + Gene: { name: 'Genes', link: '/#/genes', type: 'entity' }, + Allele: { name: 'Alleles', link: '/#/alleles', type: 'entity' }, + AffectedGenomicModel: { name: 'Affected Genomic Models', link: '/#/agms', type: 'entity' }, + Variant: { name: 'Variants', link: '/#/variants', type: 'entity' }, + DiseaseAnnotation: { name: 'Disease Annotations', link: '/#/diseaseAnnotations', type: 'entity' }, + AGMDiseaseAnnotation: { name: 'AGM Disease Annotations', link: '/#/diseaseAnnotations', type: 'entity' }, + AlleleDiseaseAnnotation: { name: 'Allele Disease Annotations', link: '/#/diseaseAnnotations', type: 'entity' }, + GeneDiseaseAnnotation: { name: 'Gene Disease Annotations', link: '/#/diseaseAnnotations', type: 'entity' }, + PhenotypeAnnotation: { name: 'Phenotype Annotations', link: '/#/phenotypeAnnotations', type: 'entity' }, + AGMPhenotypeAnnotation: { name: 'AGM Phenotype Annotations', link: '/#/phenotypeAnnotations', type: 'entity' }, + AllelePhenotypeAnnotation: { name: 'Allele Phenotype Annotations', link: '/#/phenotypeAnnotations', type: 'entity' }, + GeneGeneticInteraction: { name: 'Gene Genetic Interactions', link: '/#/geneGeneticInteractions', type: 'entity' }, + GeneMolecularInteraction: { + name: 'Gene Molecular Interactions', + link: '/#/geneMolecularInteractions', + type: 'entity', + }, + GenePhenotypeAnnotation: { name: 'Gene Phenotype Annotations', link: '/#/phenotypeAnnotations', type: 'entity' }, + ExperimentalCondition: { name: 'Experimental Conditions', link: '/#/experimentalConditions', type: 'entity' }, + ConditionRelation: { name: 'Condition Relations', link: '/#/conditionRelations', type: 'entity' }, + Construct: { name: 'Constructs', link: '/#/constructs', type: 'entity' }, + Molecule: { name: 'Molecules', link: '/#/molecules', type: 'entity' }, + Reference: { name: 'Literature References', link: '/#/references', type: 'entity' }, + Specie: { name: 'Species', link: '/#/species', type: 'entity' }, - DOTerm: { name: "DO", link: "/#/ontology/do", type: 'ontology', }, - CHEBITerm: { name: "CHEBI", link: "/#/ontology/chebi", type: 'ontology', }, - XSMOTerm: { name: "XSMO", link: "/#/ontology/xsmo", type: 'ontology', }, - ECOTerm: { name: "ECO", link: "/#/ontology/eco", type: 'ontology', }, - SOTerm: { name: "SO", link: "/#/ontology/so", type: 'ontology', }, - GOTerm: { name: "GO", link: "/#/ontology/go", type: 'ontology', }, - MATerm: { name: "MA", link: "/#/ontology/ma", type: 'ontology', }, - ZFATerm: { name: "ZFA", link: "/#/ontology/zfa", type: 'ontology', }, - MPTerm: { name: "MP", link: "/#/ontology/mp", type: 'ontology', }, - DAOTerm: { name: "DAO", link: "/#/ontology/dao", type: 'ontology', }, - EMAPATerm: { name: "EMAPA", link: "/#/ontology/emapa", type: 'ontology', }, - WBBTTerm: { name: "WBBT", link: "/#/ontology/wbbt", type: 'ontology', }, - XBATerm: { name: "XBA", link: "/#/ontology/xba", type: 'ontology', }, - XBSTerm: { name: "XBS", link: "/#/ontology/xbs", type: 'ontology', }, - XCOTerm: { name: "XCO", link: "/#/ontology/xco", type: 'ontology', }, - ROTerm: { name: "RO", link: "/#/ontology/ro", type: 'ontology', }, - ZECOTerm: { name: "ZECO", link: "/#/ontology/zeco", type: 'ontology', }, - NCBITaxonTerm: { name: "NCBITaxon", link: "/#/ontology/ncbitaxon", type: 'ontology', }, - WBLSTerm: { name: "WBLS", link: "/#/ontology/wbls", type: 'ontology', }, - FBDVTerm: { name: "FBDV", link: "/#/ontology/fbdv", type: 'ontology', }, - MMUSDVTerm: { name: "MMUSDV", link: "/#/ontology/mmusdv", type: 'ontology', }, - ZFSTerm: { name: "ZFS", link: "/#/ontology/zfs", type: 'ontology', }, - XPOTerm: { name: "XPO", link: "/#/ontology/xpo", type: 'ontology', }, - ATPTerm: { name: "ATP", link: "/#/ontology/atp", type: 'ontology', }, - VTTerm: { name: "VT", link: "/#/ontology/vt", type: 'ontology', }, - XBEDTerm: { name: "XBED", link: "/#/ontology/xbed", type: 'ontology', }, - OBITerm: { name: "OBI", link: "/#/ontology/obi", type: 'ontology', }, - WBPhenotypeTerm: { name: "WBPheno", link: "/#/ontology/wbpheno", type: 'ontology', }, - PATOTerm: { name: "PATO", link: "/#/ontology/pato", type: 'ontology', }, - HPTerm: { name: "HP", link: "/#/ontology/hp", type: 'ontology', }, - DPOTerm: { name: "DPO", link: "/#/ontology/dpo", type: 'ontology', }, - MMOTerm: { name: "MMO", link: "/#/ontology/mmo", type: 'ontology' }, - APOTerm: { name: "APO", link: "/#/ontology/apo", type: 'ontology', }, - MITerm: { name: "MI", link: "/#/ontology/mi", type: 'ontology', }, - MPATHTerm: { name: "MPATH", link: "/#/ontology/mpath", type: 'ontology', }, - MODTerm: { name: "MOD", link: "/#/ontology/mod", type: 'ontology', }, - UBERONTerm: { name: "UBERON", link: "/#/ontology/uberon", type: 'ontology', }, - RSTerm: { name: "RS", link: "/#/ontology/rs", type: 'ontology', }, - PWTerm: { name: "PW", link: "/#/ontology/pw", type: 'ontology', }, - CLTerm: { name: "CL", link: "/#/ontology/cl", type: 'ontology', }, - CMOTerm: { name: "CMO", link: "/#/ontology/cmo", type: 'ontology', }, - BSPOTerm: { name: "BSPO", link: "/#/ontology/bspo", type: 'ontology', }, - GENOTerm: { name: "GENO", link: "/#/ontology/geno", type: 'ontology', }, + DOTerm: { name: 'DO', link: '/#/ontology/do', type: 'ontology' }, + CHEBITerm: { name: 'CHEBI', link: '/#/ontology/chebi', type: 'ontology' }, + XSMOTerm: { name: 'XSMO', link: '/#/ontology/xsmo', type: 'ontology' }, + ECOTerm: { name: 'ECO', link: '/#/ontology/eco', type: 'ontology' }, + SOTerm: { name: 'SO', link: '/#/ontology/so', type: 'ontology' }, + GOTerm: { name: 'GO', link: '/#/ontology/go', type: 'ontology' }, + MATerm: { name: 'MA', link: '/#/ontology/ma', type: 'ontology' }, + ZFATerm: { name: 'ZFA', link: '/#/ontology/zfa', type: 'ontology' }, + MPTerm: { name: 'MP', link: '/#/ontology/mp', type: 'ontology' }, + DAOTerm: { name: 'DAO', link: '/#/ontology/dao', type: 'ontology' }, + EMAPATerm: { name: 'EMAPA', link: '/#/ontology/emapa', type: 'ontology' }, + WBBTTerm: { name: 'WBBT', link: '/#/ontology/wbbt', type: 'ontology' }, + XBATerm: { name: 'XBA', link: '/#/ontology/xba', type: 'ontology' }, + XBSTerm: { name: 'XBS', link: '/#/ontology/xbs', type: 'ontology' }, + XCOTerm: { name: 'XCO', link: '/#/ontology/xco', type: 'ontology' }, + ROTerm: { name: 'RO', link: '/#/ontology/ro', type: 'ontology' }, + ZECOTerm: { name: 'ZECO', link: '/#/ontology/zeco', type: 'ontology' }, + NCBITaxonTerm: { name: 'NCBITaxon', link: '/#/ontology/ncbitaxon', type: 'ontology' }, + WBLSTerm: { name: 'WBLS', link: '/#/ontology/wbls', type: 'ontology' }, + FBDVTerm: { name: 'FBDV', link: '/#/ontology/fbdv', type: 'ontology' }, + MMUSDVTerm: { name: 'MMUSDV', link: '/#/ontology/mmusdv', type: 'ontology' }, + ZFSTerm: { name: 'ZFS', link: '/#/ontology/zfs', type: 'ontology' }, + XPOTerm: { name: 'XPO', link: '/#/ontology/xpo', type: 'ontology' }, + ATPTerm: { name: 'ATP', link: '/#/ontology/atp', type: 'ontology' }, + VTTerm: { name: 'VT', link: '/#/ontology/vt', type: 'ontology' }, + XBEDTerm: { name: 'XBED', link: '/#/ontology/xbed', type: 'ontology' }, + OBITerm: { name: 'OBI', link: '/#/ontology/obi', type: 'ontology' }, + WBPhenotypeTerm: { name: 'WBPheno', link: '/#/ontology/wbpheno', type: 'ontology' }, + PATOTerm: { name: 'PATO', link: '/#/ontology/pato', type: 'ontology' }, + HPTerm: { name: 'HP', link: '/#/ontology/hp', type: 'ontology' }, + DPOTerm: { name: 'DPO', link: '/#/ontology/dpo', type: 'ontology' }, + MMOTerm: { name: 'MMO', link: '/#/ontology/mmo', type: 'ontology' }, + APOTerm: { name: 'APO', link: '/#/ontology/apo', type: 'ontology' }, + MITerm: { name: 'MI', link: '/#/ontology/mi', type: 'ontology' }, + MPATHTerm: { name: 'MPATH', link: '/#/ontology/mpath', type: 'ontology' }, + MODTerm: { name: 'MOD', link: '/#/ontology/mod', type: 'ontology' }, + UBERONTerm: { name: 'UBERON', link: '/#/ontology/uberon', type: 'ontology' }, + RSTerm: { name: 'RS', link: '/#/ontology/rs', type: 'ontology' }, + PWTerm: { name: 'PW', link: '/#/ontology/pw', type: 'ontology' }, + CLTerm: { name: 'CL', link: '/#/ontology/cl', type: 'ontology' }, + CMOTerm: { name: 'CMO', link: '/#/ontology/cmo', type: 'ontology' }, + BSPOTerm: { name: 'BSPO', link: '/#/ontology/bspo', type: 'ontology' }, + GENOTerm: { name: 'GENO', link: '/#/ontology/geno', type: 'ontology' }, - CurationReport: { name: "Curation Reports", link: "/#/reports", type: 'system', }, - BulkLoad: { name: "Bulk Loads / Failed Loads", link: "/#/dataloads", type: 'system', }, + CurationReport: { name: 'Curation Reports', link: '/#/reports', type: 'system' }, + BulkLoad: { name: 'Bulk Loads / Failed Loads', link: '/#/dataloads', type: 'system' }, }); - diff --git a/src/main/cliapp/src/constants/FilterFields.js b/src/main/cliapp/src/constants/FilterFields.js index e743c2021..43f2021f1 100644 --- a/src/main/cliapp/src/constants/FilterFields.js +++ b/src/main/cliapp/src/constants/FilterFields.js @@ -1,713 +1,1030 @@ - export const FIELD_SETS = Object.freeze({ - abbreviationFieldSet: { - filterName: "abbreviationFilter", - fields: ["abbreviation"], - }, - abstractFieldSet: { - filterName: "abstractFilter", - fields: ["abstract"], - }, - aggregationDatabaseFieldSet: { - filterName: "aggregationDatabaseFilter", - fields: ["aggregationDatabase.curie", "aggregationDatabase.name"] - }, - agmAggregationFieldSet: { - filterName: "alleleAggregationFilter", - fields: ['dataProvider.sourceOrganization.abbreviation'], - }, - alleleAggregationFieldSet: { - filterName: "alleleAggregationFilter", - fields: ['dataProvider.sourceOrganization.abbreviation'], - }, - alleleFunctionalImpactsFieldSet: { - filterName: "alleleFunctionalImpactsFilter", - fields: ["alleleFunctionalImpacts.functionalImpacts.name", "alleleFunctionalImpacts.phenotypeTerm.curie", "alleleFunctionalImpacts.phenotypeTerm.name", "alleleFunctionalImpacts.phenotypeStatement", "alleleFunctionalImpacts.evidence.curie"], - }, - alleleNameFieldSet: { - filterName: "alleleNameFilter", - fields: ["alleleFullName.displayText", "alleleFullName.formatText"], - }, - alleleSecondaryIdsFieldSet: { - filterName: "alleleSecondaryIdsFilter", - fields: ["alleleSecondaryIds.secondaryId", "alleleSecondaryIds.evidence.curie"], - }, - alleleSymbolFieldSet: { - filterName: "alleleSymbolFilter", - fields: ["alleleSymbol.displayText", "alleleSymbol.formatText"], - }, - alleleSynonymsFieldSet: { - filterName: "alleleSynonymsFilter", - fields: ["alleleSynonyms.displayText", "alleleSynonyms.formatText"], - }, - alleleGermlineTransmissionStatusFieldSet: { - filterName: "alleleGermlineTransmissionStatusFilter", - fields: ["alleleGermlineTransmissionStatus.germlineTransmissionStatus.name", "alleleGermlineTransmissionStatus.evidence.curie"] - }, - alleleDatabaseStatusFieldSet: { - filterName: "alleleDatabaseStatusFilter", - fields: ["alleleDatabaseStatus.databaseStatus.name", "alleleDatabaseStatus.evidence.curie"] - }, - alleleInheritanceModesFieldSet: { - filterName: "alleleInheritanceModesFilter", - fields: ["alleleInheritanceModes.inheritanceMode.name", "alleleInheritanceModes.phenotypeTerm.curie", "alleleInheritanceModes.phenotypeTerm.name", "alleleInheritanceModes.phenotypeStatement", "alleleInheritanceModes.evidence.curie"], - }, - alleleMutationFieldSet: { - filterName: "alleleMutationFilter", - fields: ["alleleMutationTypes.mutationTypes.curie", "alleleMutationTypes.mutationTypes.name", "alleleMutationTypes.evidence.curie"], - }, - alleleNomenclatureEventsFieldSet: { - filterName: "alleleNomenclatureEventsFilter", - fields: ["alleleNomenclatureEvents.nomenclatureEvent.name", "alleleNomenclatureEvents.evidence.curie"] - }, - annotationTypeFieldSet: { - filterName: "annotationTypeFilter", - fields: ["annotationType.name"], - }, - assertedAlleleFieldSet: { - filterName: "assertedAlleleFilter", - fields: ["assertedAllele.alleleSymbol.displayText", "assertedAllele.alleleSymbol.formatText", "assertedAllele.curie", "assertedAllele.modEntityId", "assertedAllele.modInternalId"], - }, - assertedGenesFieldSet: { - filterName: "assertedGenesFilter", - fields: ["assertedGenes.geneSymbol.displayText", "assertedGenes.geneSymbol.formatText", "assertedGenes.curie", "assertedGenes.modEntityId", "assertedGenes.modInternalId"], - }, - citationFieldSet: { - filterName: "citationFilter", - fields: ["citation"], - }, - literatureShortCitationFieldSet: { - filterName: "literatureShortCitationFilter", - fields: ["short_citation"], - }, - conditionAnatomyFieldSet: { - filterName: "conditionAnatomyFilter", - fields: ["conditionAnatomy.curie", "conditionAnatomy.name"], - }, - conditionChemicalFieldSet: { - filterName: "conditionChemicalFilter", - fields: ["conditionChemical.curie", "conditionChemical.name"], - }, - conditionClassFieldSet: { - filterName: "conditionClassFilter", - fields: ["conditionClass.name", "conditionClass.curie"], - }, - conditionFreeTextFieldSet: { - filterName: "conditionFreeTextFilter", - fields: ["conditionFreeText"], - }, - conditionGeneOntologyFieldSet: { - filterName: "conditionGeneOntologyFilter", - fields: ["conditionGeneOntology.curie", "conditionGeneOntology.name"], - }, - conditionIdFieldSet: { - filterName: "conditionIdFieldSet", - fields: ["conditionId.curie", "conditionId.name"], - }, - conditionQuantityFieldSet: { - filterName: "conditionQuantityFilter", - fields: ["conditionQuantity"], - }, - conditionRelationTypeFieldSet: { - filterName: "conditionRelationFilter", - fields: ["conditionRelationType.name"], - }, - conditionRelationSummaryFieldSet: { - filterName: "conditionSummaryFilter", - fields: ["conditionSummary"], - }, - conditionRelationsHandleFieldSet: { - filterName: "conditionRelationHandleFilter", - fields: ["conditionRelations.handle"], - }, - conditionTaxonFieldSet: { - filterName: "conditionTaxonFilter", - fields: ["conditionTaxon.curie", "conditionTaxon.name"], - }, - confidenceFieldSet: { - filterName: "confidenceFilter", - fields: ["confidence.name"], - }, - constructNameFieldSet: { - filterName: "constructNameFilter", - fields: ["constructFullName.displayText", "constructFullName.formatText"], - }, - constructSymbolFieldSet: { - filterName: "constructSymbolFilter", - fields: ["constructSymbol.displayText", "constructSymbol.formatText"], - }, - constructSynonymsFieldSet: { - filterName: "constructSynonymsFilter", - fields: ["constructSynonyms.displayText", "constructSynonyms.formatText"], - }, - constructAggregationFieldSet: { - filterName: "constructAggregationFilter", - fields: ['dataProvider.sourceOrganization.abbreviation'], - }, - constructComponentsFieldSet: { - filterName: "constructComponentsFilter", - fields: ["constructComponents.componentSymbol", "constructComponents.relation.name"], - }, - constructGenomicComponentsFieldSet: { - filterName: "constructGenomicComponentsFilter", - fields: ["constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol", "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.name", "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.curie", "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.modEntityId", "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.modInternalId", "constructGenomicEntityAssociations.relation.name"], - }, - crossReferenceFieldSet: { - filterName: "crossReferenceFilter", - fields: ["crossReference.displayName"] - }, - crossReferencesFieldSet: { - filterName: "crossReferencesFilter", - fields: ["crossReferences.displayName", "crossReferences.resourceDescriptorPage.name"] - }, - daConditionRelationsHandleFieldSet: { - filterName: "daConditionRelationHandleFilter", - fields: ["conditionRelations.handle", "conditionRelations.conditions.conditionSummary"], - }, - daConditionRelationsSummaryFieldSet: { - filterName: "conditionRelationsFilter", - fields: ["conditionRelations.conditions.conditionSummary", "conditionRelations.conditionRelationType.name"], - }, - createdByFieldSet: { - filterName: "createdByFilter", - fields: ["createdBy.uniqueId"], - }, - literatureCrossReferenceFieldSet: { - filterName: "literatureCrossReferenceFilter", - fields: ["cross_references.curie", "cross_references.name"], - }, - curieFieldSet: { - filterName: "curieFilter", - fields: ["curie"], - }, - dataProviderFieldSet: { - filterName: "dataProviderFilter", - fields: [ "dataProvider.sourceOrganization.abbreviation", "dataProvider.sourceOrganization.fullName", "dataProvider.sourceOrganization.shortName" ], - }, - dataCreatedFieldSet: { - filterName: "dateCreatedFilter", - fields: ["dateCreated"], - }, - dataUpdatedFieldSet: { - filterName: "dateUpdatedFilter", - fields: ["dateUpdated"], - }, - daAggregationFieldSet: { - filterName: "daAggregationFilter", - fields: ['relation.name', 'geneticSex.name', 'annotationType.name', 'diseaseGeneticModifierRelation.name', 'diseaseQualifiers.name', 'dataProvider.sourceOrganization.abbreviation', 'secondaryDataProvider.sourceOrganization.abbreviation', 'evidenceCodes.abbreviation'], - }, - defaultUrlTemplateFieldSet: { - filterName: "defaultUrlTemplateFilter", - fields: ["defaultUrlTemplate"], - }, - definitionFieldSet: { - filterName: "definitionFilter", - fields: ["definition"], - }, - detectionMethodFieldSet: { - filterName: "detectionMethodFilter", - fields: ["detectionMethod.curie", "detectionMethod.name"] - }, - diseaseAnnotationSubjectFieldSet: { - filterName: "diseaseAnnotationSubjectFilter", - fields: ["diseaseAnnotationSubject.symbol", "diseaseAnnotationSubject.name", "diseaseAnnotationSubject.curie", "diseaseAnnotationSubject.modEntityId", "diseaseAnnotationSubject.modInternalId"], - }, - diseaseQualifiersFieldSet: { - filterName: "diseaseQualifiersFilter", - fields: ["diseaseQualifiers.name"], - }, - evidenceFieldSet: { - filterName: "evidenceFilter", - fields: ["evidence.curie"], - }, - evidenceCodesFieldSet: { - filterName: "evidenceCodesFilter", - fields: ["evidenceCodes.abbreviation", "evidenceCodes.name", "evidenceCodes.curie"], - }, - experimentalConditionFieldSet: { - filterName: "experimentalConditionFilter", - fields: ["conditions.conditionSummary"], - }, - formulaFieldSet: { - filterName: "formulaFilter", - fields: ["formula"], - }, - geneAggregationFieldSet: { - filterName: "geneAggregationFilter", - fields: ['dataProvider.sourceOrganization.abbreviation'], - }, - geneAssociationSubjectFieldSet: { - filterName: "geneAssociationSubjectFilter", - fields: ["geneAssociationSubject.geneSymbol.displayText", "geneAssociationSubject.geneSymbol.formatText", "geneAssociationSubject.curie", "geneAssociationSubject.modEntityId", "geneAssociationSubject.modInternalId"], - }, - geneGeneAssociationObjectFieldSet: { - filterName: "geneGeneAssociationObjectFilter", - fields: ["geneGeneAssociationObject.geneSymbol.displayText", "geneGeneAssociationObject.geneSymbol.formatText", "geneGeneAssociationObject.curie", "geneGeneAssociationObject.modEntityId", "geneGeneAssociationObject.modInternalId"], - }, - geneNameFieldSet: { - filterName: "geneNameFilter", - fields: ["geneFullName.displayText", "geneFullName.formatText"], - }, - geneSecondaryIdsFieldSet: { - filterName: "geneSecondaryIdsFilter", - fields: ["geneSecondaryIds.secondaryId", "geneSecondaryIds.evidence.curie"], - }, - geneSymbolFieldSet: { - filterName: "geneSymbolFilter", - fields: ["geneSymbol.displayText", "geneSymbol.formatText"], - }, - geneSynonymsFieldSet: { - filterName: "geneSynonymsFilter", - fields: ["geneSynonyms.displayText", "geneSynonyms.formatText"], - }, - geneSystematicNameFieldSet: { - filterName: "geneSystematicNameFilter", - fields: ["geneSystematicName.displayText", "geneSystematicName.formatText"], - }, - geneticModifiersFieldSet: { - filterName: "geneticModifiersFilter", - fields: ["diseaseGeneticModifiers.symbol", "diseaseGeneticModifiers.name", "diseaseGeneticModifiers.curie", "diseaseGeneticModifiers.modEntityId", "diseaseGeneticModifiers.modInternalId"], - }, - geneticModifierRelationFieldSet: { - filterName: "geneticModifierRelationFilter", - fields: ["diseaseGeneticModifierRelation.name"], - }, - geneticSexFieldSet: { - filterName: "geneticSexFilter", - fields: ["geneticSex.name"], - }, - gmiAggregationFieldSet: { - filterName: "gmiAggregationFilter", - fields: ['relation.name'], - }, - handleFieldSet: { - filterName: "handleFilter", - fields: ["handle"], - }, - idExampleFieldSet: { - filterName: "idExampleFilter", - fields: ["idExample"], - }, - idPatternFieldSet: { - filterName: "idPatternFilter", - fields: ["idPattern"], - }, - inchiFieldSet: { - filterName: "inchiFilter", - fields: ["inchi"], - }, - inchiKeyFieldSet: { - filterName: "inchiKeyFilter", - fields: ["inchiKey"], - }, - inCollectionFieldSet: { - filterName: "inCollectionFilter", - fields: ["inCollection.name"], - }, - inferredAlleleFieldSet: { - filterName: "inferredAlleleFilter", - fields: ["inferredAllele.alleleSymbol.displayText", "inferredAllele.alleleSymbol.formatText", "inferredAllele.curie", "inferredAllele.modEntityId", "inferredAllele.modInternalId"], - }, - inferredGeneFieldSet: { - filterName: "inferredGeneFilter", - fields: ["inferredGene.geneSymbol.displayText", "inferredGene.geneSymbol.formatText", "inferredGene.curie", "inferredGene.modEntityId", "inferredGene.modInternalId"] - }, - interactorAGeneticPerturbationFieldSet: { - filterName: "interactorAGeneticPerturbationFilter", - fields: ["interactorAGeneticPerturbation.alleleSymbol.displayText", "interactorAGeneticPerturbation.alleleSymbol.formatText", "interactorAGeneticPerturbation.curie", "interactorAGeneticPerturbation.modEntityId", "interactorAGeneticPerturbation.modInternalId"], - }, - interactorBGeneticPerturbationFieldSet: { - filterName: "interactorBGeneticPerturbationFilter", - fields: ["interactorBGeneticPerturbation.alleleSymbol.displayText", "interactorBGeneticPerturbation.alleleSymbol.formatText", "interactorBGeneticPerturbation.curie", "interactorBGeneticPerturbation.modEntityId", "interactorBGeneticPerturbation.modInternalId"], - }, - interactorARoleFieldSet: { - filterName: "interactorARoleFilter", - fields: ["interactorARole.curie", "interactorARole.name"] - }, - interactorBRoleFieldSet: { - filterName: "interactorBRoleFilter", - fields: ["interactorBRole.curie", "interactorBRole.name"] - }, - interactorATypeFieldSet: { - filterName: "interactorATypeFilter", - fields: ["interactorAType.curie", "interactorAType.name"] - }, - interactorBTypeFieldSet: { - filterName: "interactorBTypeFilter", - fields: ["interactorBType.curie", "interactorBType.name"] - }, - interactionIdFieldSet: { - filterName: "interactionIdFilter", - fields: ["interactionId"] - }, - interactionSourceFieldSet: { - filterName: "interactionSourceFilter", - fields: ["interactionSource.curie", "interactionSource.name"] - }, - interactionTypeFieldSet: { - filterName: "interactionTypeFilter", - fields: ["interactionType.curie", "interactionType.name"] - }, - internalFieldSet: { - filterName: "internalFilter", - fields: ["internal"], - }, - isExtinctFieldSet: { - filterName: "isExtinctFilter", - fields: ["isExtinct"], - }, - iupacFieldSet: { - filterName: "iupacFilter", - fields: ["iupac"], - }, - memberTermsFieldSet: { - filterName: "memberTermsFilter", - fields: ["memberTerms.name"], - }, - modentityidFieldSet: { - filterName: "modentityidFilter", - fields: ["modEntityId"], - }, - modinternalidFieldSet: { - filterName: "modinternalidFilter", - fields: ["modInternalId"], - }, - nameFieldSet: { - filterName: "nameFilter", - fields: ["name"], - }, - namespaceFieldSet: { - filterName: "namespaceFilter", - fields: ["namespace"], - }, - negatedFieldSet: { - filterName: "negatedFilter", - fields: ["negated"], - }, - diseaseAnnotationObjectFieldSet: { - filterName: "objectFilter", - fields: ["diseaseAnnotationObject.curie", "diseaseAnnotationObject.name"], - }, - obsoleteFieldSet: { - filterName: "obsoleteFilter", - fields: ["obsolete"], - }, - ontologySynonymsFieldSet: { - filterName: "ontologySynonymsFilter", - fields: ["synonyms.name"], - }, - orthologyAggregationFieldSet: { - filterName: "orthologyAggregationFilter", - fields: ["predictionMethodsMatched.name", "predictionMethodsNotMatched.name", "predictionMethodsNotCalled.name", "confidence.name", "isBestScore.name", "isBestScoreReverse.name"] - }, - pageDescriptionFieldSet: { - filterName: "pageDescriptionFilter", - fields: ["pageDescription"], - }, - paAggregationFieldSet: { - filterName: "paAggregationFilter", - fields: ['relation.name', 'dataProvider.sourceOrganization.abbreviation'], - }, - paConditionRelationsSummaryFieldSet: { - filterName: "paConditionRelationsFilter", - fields: ["conditionRelations.conditions.conditionSummary", "conditionRelations.conditionRelationType.name"], - }, - phenotypeAnnotationObjectFieldSet: { - filterName: "phenotypeAnnotationObjectFilter", - fields: ["phenotypeAnnotationObject"], - }, - phenotypeAnnotationSubjectFieldSet: { - filterName: "phenotypeAnnotationSubjectFilter", - fields: ["phenotypeAnnotationSubject.symbol", "phenotypeAnnotationSubject.name", "phenotypeAnnotationSubject.curie", "phenotypeAnnotationSubject.modEntityId", "phenotypeAnnotationSubject.modInternalId"], - }, - phenotypesOrTraitsFieldSet: { - filterName: "phenotypesOrTraitsFilter", - fields: ["phenotypesOrTraits"], - }, - prefixFieldSet: { - filterName: "prefixFilter", - fields: ["prefix"], - }, - referencesFieldSet: { - filterName: "referencesFilter", - fields: ["references.curie", "references.crossReferences.referencedCurie"], - }, - relatedNotesFieldSet: { - filterName: "relatedNotesFilter", - fields: ["relatedNotes.freeText"], - }, - relationFieldSet: { - filterName: "relationFilter", - fields: ["relation.name"], - }, - resourceDescriptorFieldSet: { - filterName: "resourceDescriptorFilter", - fields: ["resourceDescriptor.prefix", "resourceDescriptor.name"], - }, - secondaryDataProviderFieldSet: { - filterName: "secondaryDataProviderFilter", - fields: [ "secondaryDataProvider.sourceOrganization.abbreviation", "secondaryDataProvider.sourceOrganization.fullName", "secondaryDataProvider.sourceOrganization.shortName" ], - }, - secondaryIdsFieldSet: { - filterName: "secondaryIdsFilter", - fields: ["secondaryIdentifiers"], - }, - sgdStrainBackgroundFieldSet: { - filterName: "sgdStrainBackgroundFilter", - fields: ["sgdStrainBackground.name", "sgdStrainBackground.curie", "sgdStrainBackground.modEntityId", "sgdStrainBackground.modInternalId"], - }, - singleReferenceFieldSet: { - filterName: "singleReferenceFilter", - fields: ["singleReference.curie", "singleReference.crossReferences.referencedCurie"], - }, - smilesFieldSet: { - filterName: "smilesFilter", - fields: ["smiles"], - }, - sourceGeneralConsequenceFieldSet: { - filterName: "sourceGeneralConsequenceFilter", - fields: ["sourceGeneralConsequence.name", "sourceGeneralConsequence.curie"], - }, - speciesTaxonCurieFieldSet: { - filterName: "speciesTaxonCurieFilter", - fields: ["taxon.curie"] - }, - speciesFullNameFieldSet: { - filterName: "speciesFullNameFilter", - fields: ["fullName"] - }, - speciesDisplayNameFieldSet: { - filterName: "speciesDisplayNameFilter", - fields: ["displayName"] - }, - speciesAbbreviationFieldSet: { - filterName: "speciesAbbreviationFilter", - fields: ["abbreviation"] - }, - speciesCommonNameFieldSet: { - filterName: "speciesCommonNameFilter", - fields: ["commonNames"] - }, - speciesAggregationFieldSet: { - filterName: "speciesAggregationFilter", - fields: ['dataProvider.sourceOrganization.abbreviation'], - }, - speciesAssemblyFieldSet: { - filterName: "speciesAssemblyFilter", - fields: ["assembly_curie"] - }, - subtypeFieldSet: { - filterName: "subtypeFilter", - fields: ["subtype.name"], - }, - synonymsFieldSet: { - filterName: "synonymsFilter", - fields: ["synonyms"], - }, - taxonFieldSet: { - filterName: "taxonFilter", - fields: ["taxon.curie", "taxon.name"], - }, - titleFieldSet: { - filterName: "titleFilter", - fields: ["title"], - }, - uniqueidFieldSet: { - filterName: "uniqueidFilter", - fields: ["uniqueId"], - }, - updatedByFieldSet: { - filterName: "updatedByFilter", - fields: ["updatedBy.uniqueId"], - }, - urlTemplateFieldSet: { - filterName: "urlTemplateFilter", - fields: ["urlTemplate"], - }, - variantAggregationFieldSet: { - filterName: "variantAggregationFilter", - fields: ['variantStatus.name', 'dataProvider.sourceOrganization.abbreviation'], - }, - variantStatusFieldSet: { - filterName: "variantStatusFilter", - fields: ["variantStatus.name"], - }, - variantTypeFieldSet: { - filterName: "variantTypeFilter", - fields: ["variantType.name", "variantType.curie"], - }, - vocabularyDescriptionFieldSet: { - filterName: "vocabularyDescriptionFilter", - fields: ["vocabularyDescription"], - }, - vocabularyFieldSet: { - filterName: "vocabularyFilter", - fields: ["vocabularyTermSetVocabulary.name"], - }, - vocabularyLabelFieldSet: { - filterName: "vocabularyLabelFilter", - fields: ["vocabularyLabel"] - }, - vocabularyNameFieldSet: { - filterName: "vocabularyNameFilter", - fields: ["vocabulary.name"], - }, - vocabularyTermSetDescriptionFieldSet: { - filterName: "vocabularyTermSetDescriptionFilter", - fields: ["vocabularyTermSetDescription"], - }, - withFieldSet: { - filterName: "withFilter", - fields: ["with.geneSymbol.displayText", "with.geneSymbol.formatText", "with.curie", "with.modEntityId", "with.modInternalId"], - } + abbreviationFieldSet: { + filterName: 'abbreviationFilter', + fields: ['abbreviation'], + }, + abstractFieldSet: { + filterName: 'abstractFilter', + fields: ['abstract'], + }, + aggregationDatabaseFieldSet: { + filterName: 'aggregationDatabaseFilter', + fields: ['aggregationDatabase.curie', 'aggregationDatabase.name'], + }, + agmAggregationFieldSet: { + filterName: 'alleleAggregationFilter', + fields: ['dataProvider.sourceOrganization.abbreviation'], + }, + alleleAggregationFieldSet: { + filterName: 'alleleAggregationFilter', + fields: ['dataProvider.sourceOrganization.abbreviation'], + }, + alleleFunctionalImpactsFieldSet: { + filterName: 'alleleFunctionalImpactsFilter', + fields: [ + 'alleleFunctionalImpacts.functionalImpacts.name', + 'alleleFunctionalImpacts.phenotypeTerm.curie', + 'alleleFunctionalImpacts.phenotypeTerm.name', + 'alleleFunctionalImpacts.phenotypeStatement', + 'alleleFunctionalImpacts.evidence.curie', + ], + }, + alleleNameFieldSet: { + filterName: 'alleleNameFilter', + fields: ['alleleFullName.displayText', 'alleleFullName.formatText'], + }, + alleleSecondaryIdsFieldSet: { + filterName: 'alleleSecondaryIdsFilter', + fields: ['alleleSecondaryIds.secondaryId', 'alleleSecondaryIds.evidence.curie'], + }, + alleleSymbolFieldSet: { + filterName: 'alleleSymbolFilter', + fields: ['alleleSymbol.displayText', 'alleleSymbol.formatText'], + }, + alleleSynonymsFieldSet: { + filterName: 'alleleSynonymsFilter', + fields: ['alleleSynonyms.displayText', 'alleleSynonyms.formatText'], + }, + alleleGermlineTransmissionStatusFieldSet: { + filterName: 'alleleGermlineTransmissionStatusFilter', + fields: [ + 'alleleGermlineTransmissionStatus.germlineTransmissionStatus.name', + 'alleleGermlineTransmissionStatus.evidence.curie', + ], + }, + alleleDatabaseStatusFieldSet: { + filterName: 'alleleDatabaseStatusFilter', + fields: ['alleleDatabaseStatus.databaseStatus.name', 'alleleDatabaseStatus.evidence.curie'], + }, + alleleInheritanceModesFieldSet: { + filterName: 'alleleInheritanceModesFilter', + fields: [ + 'alleleInheritanceModes.inheritanceMode.name', + 'alleleInheritanceModes.phenotypeTerm.curie', + 'alleleInheritanceModes.phenotypeTerm.name', + 'alleleInheritanceModes.phenotypeStatement', + 'alleleInheritanceModes.evidence.curie', + ], + }, + alleleMutationFieldSet: { + filterName: 'alleleMutationFilter', + fields: [ + 'alleleMutationTypes.mutationTypes.curie', + 'alleleMutationTypes.mutationTypes.name', + 'alleleMutationTypes.evidence.curie', + ], + }, + alleleNomenclatureEventsFieldSet: { + filterName: 'alleleNomenclatureEventsFilter', + fields: ['alleleNomenclatureEvents.nomenclatureEvent.name', 'alleleNomenclatureEvents.evidence.curie'], + }, + annotationTypeFieldSet: { + filterName: 'annotationTypeFilter', + fields: ['annotationType.name'], + }, + assertedAlleleFieldSet: { + filterName: 'assertedAlleleFilter', + fields: [ + 'assertedAllele.alleleSymbol.displayText', + 'assertedAllele.alleleSymbol.formatText', + 'assertedAllele.curie', + 'assertedAllele.modEntityId', + 'assertedAllele.modInternalId', + ], + }, + assertedGenesFieldSet: { + filterName: 'assertedGenesFilter', + fields: [ + 'assertedGenes.geneSymbol.displayText', + 'assertedGenes.geneSymbol.formatText', + 'assertedGenes.curie', + 'assertedGenes.modEntityId', + 'assertedGenes.modInternalId', + ], + }, + citationFieldSet: { + filterName: 'citationFilter', + fields: ['citation'], + }, + literatureShortCitationFieldSet: { + filterName: 'literatureShortCitationFilter', + fields: ['short_citation'], + }, + conditionAnatomyFieldSet: { + filterName: 'conditionAnatomyFilter', + fields: ['conditionAnatomy.curie', 'conditionAnatomy.name'], + }, + conditionChemicalFieldSet: { + filterName: 'conditionChemicalFilter', + fields: ['conditionChemical.curie', 'conditionChemical.name'], + }, + conditionClassFieldSet: { + filterName: 'conditionClassFilter', + fields: ['conditionClass.name', 'conditionClass.curie'], + }, + conditionFreeTextFieldSet: { + filterName: 'conditionFreeTextFilter', + fields: ['conditionFreeText'], + }, + conditionGeneOntologyFieldSet: { + filterName: 'conditionGeneOntologyFilter', + fields: ['conditionGeneOntology.curie', 'conditionGeneOntology.name'], + }, + conditionIdFieldSet: { + filterName: 'conditionIdFieldSet', + fields: ['conditionId.curie', 'conditionId.name'], + }, + conditionQuantityFieldSet: { + filterName: 'conditionQuantityFilter', + fields: ['conditionQuantity'], + }, + conditionRelationTypeFieldSet: { + filterName: 'conditionRelationFilter', + fields: ['conditionRelationType.name'], + }, + conditionRelationSummaryFieldSet: { + filterName: 'conditionSummaryFilter', + fields: ['conditionSummary'], + }, + conditionRelationsHandleFieldSet: { + filterName: 'conditionRelationHandleFilter', + fields: ['conditionRelations.handle'], + }, + conditionTaxonFieldSet: { + filterName: 'conditionTaxonFilter', + fields: ['conditionTaxon.curie', 'conditionTaxon.name'], + }, + confidenceFieldSet: { + filterName: 'confidenceFilter', + fields: ['confidence.name'], + }, + constructNameFieldSet: { + filterName: 'constructNameFilter', + fields: ['constructFullName.displayText', 'constructFullName.formatText'], + }, + constructSymbolFieldSet: { + filterName: 'constructSymbolFilter', + fields: ['constructSymbol.displayText', 'constructSymbol.formatText'], + }, + constructSynonymsFieldSet: { + filterName: 'constructSynonymsFilter', + fields: ['constructSynonyms.displayText', 'constructSynonyms.formatText'], + }, + constructAggregationFieldSet: { + filterName: 'constructAggregationFilter', + fields: ['dataProvider.sourceOrganization.abbreviation'], + }, + constructComponentsFieldSet: { + filterName: 'constructComponentsFilter', + fields: ['constructComponents.componentSymbol', 'constructComponents.relation.name'], + }, + constructGenomicComponentsFieldSet: { + filterName: 'constructGenomicComponentsFilter', + fields: [ + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol', + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.name', + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.curie', + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.modEntityId', + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.modInternalId', + 'constructGenomicEntityAssociations.relation.name', + ], + }, + crossReferenceFieldSet: { + filterName: 'crossReferenceFilter', + fields: ['crossReference.displayName'], + }, + crossReferencesFieldSet: { + filterName: 'crossReferencesFilter', + fields: ['crossReferences.displayName', 'crossReferences.resourceDescriptorPage.name'], + }, + daConditionRelationsHandleFieldSet: { + filterName: 'daConditionRelationHandleFilter', + fields: ['conditionRelations.handle', 'conditionRelations.conditions.conditionSummary'], + }, + daConditionRelationsSummaryFieldSet: { + filterName: 'conditionRelationsFilter', + fields: ['conditionRelations.conditions.conditionSummary', 'conditionRelations.conditionRelationType.name'], + }, + createdByFieldSet: { + filterName: 'createdByFilter', + fields: ['createdBy.uniqueId'], + }, + literatureCrossReferenceFieldSet: { + filterName: 'literatureCrossReferenceFilter', + fields: ['cross_references.curie', 'cross_references.name'], + }, + curieFieldSet: { + filterName: 'curieFilter', + fields: ['curie'], + }, + dataProviderFieldSet: { + filterName: 'dataProviderFilter', + fields: [ + 'dataProvider.sourceOrganization.abbreviation', + 'dataProvider.sourceOrganization.fullName', + 'dataProvider.sourceOrganization.shortName', + ], + }, + dataCreatedFieldSet: { + filterName: 'dateCreatedFilter', + fields: ['dateCreated'], + }, + dataUpdatedFieldSet: { + filterName: 'dateUpdatedFilter', + fields: ['dateUpdated'], + }, + daAggregationFieldSet: { + filterName: 'daAggregationFilter', + fields: [ + 'relation.name', + 'geneticSex.name', + 'annotationType.name', + 'diseaseGeneticModifierRelation.name', + 'diseaseQualifiers.name', + 'dataProvider.sourceOrganization.abbreviation', + 'secondaryDataProvider.sourceOrganization.abbreviation', + 'evidenceCodes.abbreviation', + ], + }, + defaultUrlTemplateFieldSet: { + filterName: 'defaultUrlTemplateFilter', + fields: ['defaultUrlTemplate'], + }, + definitionFieldSet: { + filterName: 'definitionFilter', + fields: ['definition'], + }, + detectionMethodFieldSet: { + filterName: 'detectionMethodFilter', + fields: ['detectionMethod.curie', 'detectionMethod.name'], + }, + diseaseAnnotationSubjectFieldSet: { + filterName: 'diseaseAnnotationSubjectFilter', + fields: ['diseaseAnnotationSubject.symbol', 'diseaseAnnotationSubject.modEntityId'], + }, + diseaseQualifiersFieldSet: { + filterName: 'diseaseQualifiersFilter', + fields: ['diseaseQualifiers.name'], + }, + evidenceFieldSet: { + filterName: 'evidenceFilter', + fields: ['evidence.curie'], + }, + evidenceCodesFieldSet: { + filterName: 'evidenceCodesFilter', + fields: ['evidenceCodes.abbreviation', 'evidenceCodes.name', 'evidenceCodes.curie'], + }, + experimentalConditionFieldSet: { + filterName: 'experimentalConditionFilter', + fields: ['conditions.conditionSummary'], + }, + formulaFieldSet: { + filterName: 'formulaFilter', + fields: ['formula'], + }, + geneAggregationFieldSet: { + filterName: 'geneAggregationFilter', + fields: ['dataProvider.sourceOrganization.abbreviation'], + }, + geneAssociationSubjectFieldSet: { + filterName: 'geneAssociationSubjectFilter', + fields: [ + 'geneAssociationSubject.geneSymbol.displayText', + 'geneAssociationSubject.geneSymbol.formatText', + 'geneAssociationSubject.curie', + 'geneAssociationSubject.modEntityId', + 'geneAssociationSubject.modInternalId', + ], + }, + geneGeneAssociationObjectFieldSet: { + filterName: 'geneGeneAssociationObjectFilter', + fields: [ + 'geneGeneAssociationObject.geneSymbol.displayText', + 'geneGeneAssociationObject.geneSymbol.formatText', + 'geneGeneAssociationObject.curie', + 'geneGeneAssociationObject.modEntityId', + 'geneGeneAssociationObject.modInternalId', + ], + }, + geneNameFieldSet: { + filterName: 'geneNameFilter', + fields: ['geneFullName.displayText', 'geneFullName.formatText'], + }, + geneSecondaryIdsFieldSet: { + filterName: 'geneSecondaryIdsFilter', + fields: ['geneSecondaryIds.secondaryId', 'geneSecondaryIds.evidence.curie'], + }, + geneSymbolFieldSet: { + filterName: 'geneSymbolFilter', + fields: ['geneSymbol.displayText', 'geneSymbol.formatText'], + }, + geneSynonymsFieldSet: { + filterName: 'geneSynonymsFilter', + fields: ['geneSynonyms.displayText', 'geneSynonyms.formatText'], + }, + geneSystematicNameFieldSet: { + filterName: 'geneSystematicNameFilter', + fields: ['geneSystematicName.displayText', 'geneSystematicName.formatText'], + }, + geneticModifiersFieldSet: { + filterName: 'geneticModifiersFilter', + fields: [ + 'diseaseGeneticModifiers.symbol', + 'diseaseGeneticModifiers.name', + 'diseaseGeneticModifiers.curie', + 'diseaseGeneticModifiers.modEntityId', + 'diseaseGeneticModifiers.modInternalId', + ], + }, + geneticModifierRelationFieldSet: { + filterName: 'geneticModifierRelationFilter', + fields: ['diseaseGeneticModifierRelation.name'], + }, + geneticSexFieldSet: { + filterName: 'geneticSexFilter', + fields: ['geneticSex.name'], + }, + gmiAggregationFieldSet: { + filterName: 'gmiAggregationFilter', + fields: ['relation.name'], + }, + handleFieldSet: { + filterName: 'handleFilter', + fields: ['handle'], + }, + idExampleFieldSet: { + filterName: 'idExampleFilter', + fields: ['idExample'], + }, + idPatternFieldSet: { + filterName: 'idPatternFilter', + fields: ['idPattern'], + }, + inchiFieldSet: { + filterName: 'inchiFilter', + fields: ['inchi'], + }, + inchiKeyFieldSet: { + filterName: 'inchiKeyFilter', + fields: ['inchiKey'], + }, + inCollectionFieldSet: { + filterName: 'inCollectionFilter', + fields: ['inCollection.name'], + }, + inferredAlleleFieldSet: { + filterName: 'inferredAlleleFilter', + fields: [ + 'inferredAllele.alleleSymbol.displayText', + 'inferredAllele.alleleSymbol.formatText', + 'inferredAllele.curie', + 'inferredAllele.modEntityId', + 'inferredAllele.modInternalId', + ], + }, + inferredGeneFieldSet: { + filterName: 'inferredGeneFilter', + fields: [ + 'inferredGene.geneSymbol.displayText', + 'inferredGene.geneSymbol.formatText', + 'inferredGene.curie', + 'inferredGene.modEntityId', + 'inferredGene.modInternalId', + ], + }, + interactorAGeneticPerturbationFieldSet: { + filterName: 'interactorAGeneticPerturbationFilter', + fields: [ + 'interactorAGeneticPerturbation.alleleSymbol.displayText', + 'interactorAGeneticPerturbation.alleleSymbol.formatText', + 'interactorAGeneticPerturbation.curie', + 'interactorAGeneticPerturbation.modEntityId', + 'interactorAGeneticPerturbation.modInternalId', + ], + }, + interactorBGeneticPerturbationFieldSet: { + filterName: 'interactorBGeneticPerturbationFilter', + fields: [ + 'interactorBGeneticPerturbation.alleleSymbol.displayText', + 'interactorBGeneticPerturbation.alleleSymbol.formatText', + 'interactorBGeneticPerturbation.curie', + 'interactorBGeneticPerturbation.modEntityId', + 'interactorBGeneticPerturbation.modInternalId', + ], + }, + interactorARoleFieldSet: { + filterName: 'interactorARoleFilter', + fields: ['interactorARole.curie', 'interactorARole.name'], + }, + interactorBRoleFieldSet: { + filterName: 'interactorBRoleFilter', + fields: ['interactorBRole.curie', 'interactorBRole.name'], + }, + interactorATypeFieldSet: { + filterName: 'interactorATypeFilter', + fields: ['interactorAType.curie', 'interactorAType.name'], + }, + interactorBTypeFieldSet: { + filterName: 'interactorBTypeFilter', + fields: ['interactorBType.curie', 'interactorBType.name'], + }, + interactionIdFieldSet: { + filterName: 'interactionIdFilter', + fields: ['interactionId'], + }, + interactionSourceFieldSet: { + filterName: 'interactionSourceFilter', + fields: ['interactionSource.curie', 'interactionSource.name'], + }, + interactionTypeFieldSet: { + filterName: 'interactionTypeFilter', + fields: ['interactionType.curie', 'interactionType.name'], + }, + internalFieldSet: { + filterName: 'internalFilter', + fields: ['internal'], + }, + isExtinctFieldSet: { + filterName: 'isExtinctFilter', + fields: ['isExtinct'], + }, + iupacFieldSet: { + filterName: 'iupacFilter', + fields: ['iupac'], + }, + memberTermsFieldSet: { + filterName: 'memberTermsFilter', + fields: ['memberTerms.name'], + }, + modentityidFieldSet: { + filterName: 'modentityidFilter', + fields: ['modEntityId'], + }, + modinternalidFieldSet: { + filterName: 'modinternalidFilter', + fields: ['modInternalId'], + }, + nameFieldSet: { + filterName: 'nameFilter', + fields: ['name'], + }, + namespaceFieldSet: { + filterName: 'namespaceFilter', + fields: ['namespace'], + }, + negatedFieldSet: { + filterName: 'negatedFilter', + fields: ['negated'], + }, + diseaseAnnotationObjectFieldSet: { + filterName: 'objectFilter', + fields: ['diseaseAnnotationObject.curie', 'diseaseAnnotationObject.name'], + }, + obsoleteFieldSet: { + filterName: 'obsoleteFilter', + fields: ['obsolete'], + }, + ontologySynonymsFieldSet: { + filterName: 'ontologySynonymsFilter', + fields: ['synonyms.name'], + }, + orthologyAggregationFieldSet: { + filterName: 'orthologyAggregationFilter', + fields: [ + 'predictionMethodsMatched.name', + 'predictionMethodsNotMatched.name', + 'predictionMethodsNotCalled.name', + 'confidence.name', + 'isBestScore.name', + 'isBestScoreReverse.name', + ], + }, + pageDescriptionFieldSet: { + filterName: 'pageDescriptionFilter', + fields: ['pageDescription'], + }, + paAggregationFieldSet: { + filterName: 'paAggregationFilter', + fields: ['relation.name', 'dataProvider.sourceOrganization.abbreviation'], + }, + paConditionRelationsSummaryFieldSet: { + filterName: 'paConditionRelationsFilter', + fields: ['conditionRelations.conditions.conditionSummary', 'conditionRelations.conditionRelationType.name'], + }, + phenotypeAnnotationObjectFieldSet: { + filterName: 'phenotypeAnnotationObjectFilter', + fields: ['phenotypeAnnotationObject'], + }, + phenotypeAnnotationSubjectFieldSet: { + filterName: 'phenotypeAnnotationSubjectFilter', + fields: [ + 'phenotypeAnnotationSubject.symbol', + 'phenotypeAnnotationSubject.name', + 'phenotypeAnnotationSubject.curie', + 'phenotypeAnnotationSubject.modEntityId', + 'phenotypeAnnotationSubject.modInternalId', + ], + }, + phenotypesOrTraitsFieldSet: { + filterName: 'phenotypesOrTraitsFilter', + fields: ['phenotypesOrTraits'], + }, + prefixFieldSet: { + filterName: 'prefixFilter', + fields: ['prefix'], + }, + referencesFieldSet: { + filterName: 'referencesFilter', + fields: ['references.curie', 'references.crossReferences.referencedCurie'], + }, + relatedNotesFieldSet: { + filterName: 'relatedNotesFilter', + fields: ['relatedNotes.freeText'], + }, + relationFieldSet: { + filterName: 'relationFilter', + fields: ['relation.name'], + }, + resourceDescriptorFieldSet: { + filterName: 'resourceDescriptorFilter', + fields: ['resourceDescriptor.prefix', 'resourceDescriptor.name'], + }, + secondaryDataProviderFieldSet: { + filterName: 'secondaryDataProviderFilter', + fields: [ + 'secondaryDataProvider.sourceOrganization.abbreviation', + 'secondaryDataProvider.sourceOrganization.fullName', + 'secondaryDataProvider.sourceOrganization.shortName', + ], + }, + secondaryIdsFieldSet: { + filterName: 'secondaryIdsFilter', + fields: ['secondaryIdentifiers'], + }, + sgdStrainBackgroundFieldSet: { + filterName: 'sgdStrainBackgroundFilter', + fields: [ + 'sgdStrainBackground.name', + 'sgdStrainBackground.curie', + 'sgdStrainBackground.modEntityId', + 'sgdStrainBackground.modInternalId', + ], + }, + singleReferenceFieldSet: { + filterName: 'singleReferenceFilter', + fields: ['singleReference.curie', 'singleReference.crossReferences.referencedCurie'], + }, + smilesFieldSet: { + filterName: 'smilesFilter', + fields: ['smiles'], + }, + sourceGeneralConsequenceFieldSet: { + filterName: 'sourceGeneralConsequenceFilter', + fields: ['sourceGeneralConsequence.name', 'sourceGeneralConsequence.curie'], + }, + speciesTaxonCurieFieldSet: { + filterName: 'speciesTaxonCurieFilter', + fields: ['taxon.curie'], + }, + speciesFullNameFieldSet: { + filterName: 'speciesFullNameFilter', + fields: ['fullName'], + }, + speciesDisplayNameFieldSet: { + filterName: 'speciesDisplayNameFilter', + fields: ['displayName'], + }, + speciesAbbreviationFieldSet: { + filterName: 'speciesAbbreviationFilter', + fields: ['abbreviation'], + }, + speciesCommonNameFieldSet: { + filterName: 'speciesCommonNameFilter', + fields: ['commonNames'], + }, + speciesAggregationFieldSet: { + filterName: 'speciesAggregationFilter', + fields: ['dataProvider.sourceOrganization.abbreviation'], + }, + speciesAssemblyFieldSet: { + filterName: 'speciesAssemblyFilter', + fields: ['assembly_curie'], + }, + subtypeFieldSet: { + filterName: 'subtypeFilter', + fields: ['subtype.name'], + }, + synonymsFieldSet: { + filterName: 'synonymsFilter', + fields: ['synonyms'], + }, + taxonFieldSet: { + filterName: 'taxonFilter', + fields: ['taxon.curie', 'taxon.name'], + }, + titleFieldSet: { + filterName: 'titleFilter', + fields: ['title'], + }, + uniqueidFieldSet: { + filterName: 'uniqueidFilter', + fields: ['uniqueId'], + }, + updatedByFieldSet: { + filterName: 'updatedByFilter', + fields: ['updatedBy.uniqueId'], + }, + urlTemplateFieldSet: { + filterName: 'urlTemplateFilter', + fields: ['urlTemplate'], + }, + variantAggregationFieldSet: { + filterName: 'variantAggregationFilter', + fields: ['variantStatus.name', 'dataProvider.sourceOrganization.abbreviation'], + }, + variantStatusFieldSet: { + filterName: 'variantStatusFilter', + fields: ['variantStatus.name'], + }, + variantTypeFieldSet: { + filterName: 'variantTypeFilter', + fields: ['variantType.name', 'variantType.curie'], + }, + vocabularyDescriptionFieldSet: { + filterName: 'vocabularyDescriptionFilter', + fields: ['vocabularyDescription'], + }, + vocabularyFieldSet: { + filterName: 'vocabularyFilter', + fields: ['vocabularyTermSetVocabulary.name'], + }, + vocabularyLabelFieldSet: { + filterName: 'vocabularyLabelFilter', + fields: ['vocabularyLabel'], + }, + vocabularyNameFieldSet: { + filterName: 'vocabularyNameFilter', + fields: ['vocabulary.name'], + }, + vocabularyTermSetDescriptionFieldSet: { + filterName: 'vocabularyTermSetDescriptionFilter', + fields: ['vocabularyTermSetDescription'], + }, + withFieldSet: { + filterName: 'withFilter', + fields: [ + 'with.geneSymbol.displayText', + 'with.geneSymbol.formatText', + 'with.curie', + 'with.modEntityId', + 'with.modInternalId', + ], + }, }); export const FILTER_CONFIGS = Object.freeze({ - abbreviationFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.abbreviationFieldSet] }, - abstractFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.abstractFieldSet]}, - aggregationDatabaseFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.aggregationDatabaseFieldSet]}, - alleleFunctionalImpactsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleFunctionalImpactsFieldSet] }, - alleleGermlineTransmissionStatusFilterConfig: {filterComponentType: "input", fieldSets: [FIELD_SETS.alleleGermlineTransmissionStatusFieldSet]}, - alleleDatabaseStatusFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleDatabaseStatusFieldSet]}, - alleleInheritanceModesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleInheritanceModesFieldSet] }, - alleleMutationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleMutationFieldSet] }, - alleleNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleNameFieldSet] }, - alleleNomenclatureEventsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleNomenclatureEventsFieldSet] }, - alleleSecondaryIdsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleSecondaryIdsFieldSet] }, - alleleSymbolFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleSymbolFieldSet] }, - alleleSynonymsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.alleleSynonymsFieldSet] }, - assertedAlleleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.assertedAlleleFieldSet] }, - assertedGenesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.assertedGenesFieldSet] }, - citationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.citationFieldSet]}, - literatureShortCitationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.literatureShortCitationFieldSet]}, - conditionAnatomyFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionAnatomyFieldSet] }, - conditionChemicalFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionChemicalFieldSet] }, - conditionClassFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionClassFieldSet] }, - conditionFreeTextFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionFreeTextFieldSet] }, - conditionGeneOntologyFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionGeneOntologyFieldSet] }, - conditionIdFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionIdFieldSet] }, - conditionRelationHandleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.handleFieldSet] }, - conditionRelationSummaryFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionRelationSummaryFieldSet] }, - conditionQuantityFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionQuantityFieldSet] }, - conditionTaxonFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.conditionTaxonFieldSet] }, - constructNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.constructNameFieldSet] }, - constructSymbolFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.constructSymbolFieldSet] }, - constructSynonymsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.constructSynonymsFieldSet] }, - constructComponentsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.constructComponentsFieldSet]}, - constructGenomicComponentsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.constructGenomicComponentsFieldSet]}, - createdByFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.createdByFieldSet] }, - crossReferenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.crossReferenceFieldSet] }, - crossReferencesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.crossReferencesFieldSet] }, - curieFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.curieFieldSet] }, + abbreviationFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.abbreviationFieldSet] }, + abstractFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.abstractFieldSet] }, + aggregationDatabaseFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.aggregationDatabaseFieldSet], + }, + alleleFunctionalImpactsFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.alleleFunctionalImpactsFieldSet], + }, + alleleGermlineTransmissionStatusFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.alleleGermlineTransmissionStatusFieldSet], + }, + alleleDatabaseStatusFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.alleleDatabaseStatusFieldSet], + }, + alleleInheritanceModesFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.alleleInheritanceModesFieldSet], + }, + alleleMutationFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.alleleMutationFieldSet] }, + alleleNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.alleleNameFieldSet] }, + alleleNomenclatureEventsFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.alleleNomenclatureEventsFieldSet], + }, + alleleSecondaryIdsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.alleleSecondaryIdsFieldSet] }, + alleleSymbolFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.alleleSymbolFieldSet] }, + alleleSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.alleleSynonymsFieldSet] }, + assertedAlleleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.assertedAlleleFieldSet] }, + assertedGenesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.assertedGenesFieldSet] }, + citationFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.citationFieldSet] }, + literatureShortCitationFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.literatureShortCitationFieldSet], + }, + conditionAnatomyFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionAnatomyFieldSet] }, + conditionChemicalFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionChemicalFieldSet] }, + conditionClassFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionClassFieldSet] }, + conditionFreeTextFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionFreeTextFieldSet] }, + conditionGeneOntologyFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.conditionGeneOntologyFieldSet], + }, + conditionIdFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionIdFieldSet] }, + conditionRelationHandleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.handleFieldSet] }, + conditionRelationSummaryFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.conditionRelationSummaryFieldSet], + }, + conditionQuantityFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionQuantityFieldSet] }, + conditionTaxonFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.conditionTaxonFieldSet] }, + constructNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.constructNameFieldSet] }, + constructSymbolFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.constructSymbolFieldSet] }, + constructSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.constructSynonymsFieldSet] }, + constructComponentsFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.constructComponentsFieldSet], + }, + constructGenomicComponentsFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.constructGenomicComponentsFieldSet], + }, + createdByFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.createdByFieldSet] }, + crossReferenceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.crossReferenceFieldSet] }, + crossReferencesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.crossReferencesFieldSet] }, + curieFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.curieFieldSet] }, - daConditionRelationsHandleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.daConditionRelationsHandleFieldSet], nonNullFields: FIELD_SETS.conditionRelationsHandleFieldSet }, - daConditionRelationsSummaryFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.daConditionRelationsSummaryFieldSet], nullFields: FIELD_SETS.conditionRelationsHandleFieldSet }, + daConditionRelationsHandleFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.daConditionRelationsHandleFieldSet], + nonNullFields: FIELD_SETS.conditionRelationsHandleFieldSet, + }, + daConditionRelationsSummaryFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.daConditionRelationsSummaryFieldSet], + nullFields: FIELD_SETS.conditionRelationsHandleFieldSet, + }, - dataCreatedFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.dataCreatedFieldSet] }, - dateUpdatedFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.dataUpdatedFieldSet] }, - defaultUrlTemplateFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.defaultUrlTemplateFieldSet] }, - definitionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.definitionFieldSet] }, - detectionMethodFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.detectionMethodFieldSet] }, - experimentalConditionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.experimentalConditionFieldSet] }, - evidenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.evidenceFieldSet] }, - formulaFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.formulaFieldSet] }, - geneAssociationSubjectFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneAssociationSubjectFieldSet] }, - geneGeneAssociationObjectFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneGeneAssociationObjectFieldSet] }, - geneNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneNameFieldSet] }, - geneSecondaryIdsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneSecondaryIdsFieldSet] }, - geneSymbolFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneSymbolFieldSet] }, - geneSynonymsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneSynonymsFieldSet] }, - geneSystematicNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneSystematicNameFieldSet] }, - geneticModifiersFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.geneticModifiersFieldSet] }, - idExampleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.idExampleFieldSet] }, - idPatternFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.idPatternFieldSet] }, - inchiFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.inchiFieldSet] }, - inchiKeyFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.inchiKeyFieldSet] }, - inCollectionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.inCollectionFieldSet], useKeywordFields: true }, - inferredAlleleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.inferredAlleleFieldSet] }, - inferredGeneFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.inferredGeneFieldSet] }, - interactorAGeneticPerturbationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorAGeneticPerturbationFieldSet] }, - interactorBGeneticPerturbationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorBGeneticPerturbationFieldSet] }, - interactorARoleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorARoleFieldSet] }, - interactorBRoleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorBRoleFieldSet] }, - interactorATypeFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorATypeFieldSet] }, - interactorBTypeFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactorBTypeFieldSet] }, - interactionIdFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactionIdFieldSet] }, - interactionSourceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactionSourceFieldSet] }, - interactionTypeFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.interactionTypeFieldSet] }, - iupacFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.iupacFieldSet] }, - literatureCrossReferenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.literatureCrossReferenceFieldSet] }, - modentityidFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.modentityidFieldSet] }, - modinternalidFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.modinternalidFieldSet] }, - nameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.nameFieldSet] }, - namespaceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.namespaceFieldSet] }, - phenotypeAnnotationSubjectFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.phenotypeAnnotationSubjectFieldSet] }, - phenotypeAnnotationObjectFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.phenotypeAnnotationObjectFieldSet] }, - phenotypesOrTraitsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.phenotypesOrTraitsFieldSet] }, - diseaseAnnotationSubjectFieldConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.diseaseAnnotationSubjectFieldSet] }, - diseaseAnnotationObjectFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.diseaseAnnotationObjectFieldSet] }, - ontologySynonymsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.ontologySynonymsFieldSet] }, - paConditionRelationsSummaryFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.paConditionRelationsSummaryFieldSet] }, - pageDescriptionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.pageDescriptionFieldSet] }, - prefixFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.prefixFieldSet]}, - referencesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.referencesFieldSet] }, - relatedNotesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.relatedNotesFieldSet] }, - resourceDescriptorFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.resourceDescriptorFieldSet] }, - secondaryIdsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.secondaryIdsFieldSet] }, - sgdStrainBackgroundFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.sgdStrainBackgroundFieldSet], }, - singleReferenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.singleReferenceFieldSet] }, - smilesFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.smilesFieldSet] }, - sourceGeneralConsequenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.sourceGeneralConsequenceFieldSet] }, - speciesTaxonCurieFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesTaxonCurieFieldSet]}, - speciesFullNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesFullNameFieldSet]}, - speciesDisplayNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesDisplayNameFieldSet]}, - speciesCommonNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesCommonNameFieldSet]}, - speciesAbbreviationFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesAbbreviationFieldSet]}, - speciesAssemblyFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.speciesAssemblyFieldSet]}, - subtypeFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.subtypeFieldSet] }, - synonymsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.synonymsFieldSet] }, - taxonFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.taxonFieldSet] }, - titleFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.titleFieldSet] }, - uniqueidFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.uniqueidFieldSet] }, - updatedByFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.updatedByFieldSet] }, - urlTemplateFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.urlTemplateFieldSet] }, - variantTypeFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.variantTypeFieldSet] }, - vocabularyDescriptionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.vocabularyDescriptionFieldSet] }, - vocabularyFieldSetFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.vocabularyFieldSet] }, - vocabularyMemberTermsFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.memberTermsFieldSet] }, - vocabularyLabelFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.vocabularyLabelFieldSet] }, - vocabularyNameFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.vocabularyNameFieldSet] }, - vocabularyTermSetDescriptionFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.vocabularyTermSetDescriptionFieldSet] }, - withFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.withFieldSet] }, + dataCreatedFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.dataCreatedFieldSet] }, + dateUpdatedFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.dataUpdatedFieldSet] }, + defaultUrlTemplateFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.defaultUrlTemplateFieldSet] }, + definitionFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.definitionFieldSet] }, + detectionMethodFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.detectionMethodFieldSet] }, + experimentalConditionFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.experimentalConditionFieldSet], + }, + evidenceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.evidenceFieldSet] }, + formulaFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.formulaFieldSet] }, + geneAssociationSubjectFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.geneAssociationSubjectFieldSet], + }, + geneGeneAssociationObjectFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.geneGeneAssociationObjectFieldSet], + }, + geneNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneNameFieldSet] }, + geneSecondaryIdsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSecondaryIdsFieldSet] }, + geneSymbolFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSymbolFieldSet] }, + geneSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSynonymsFieldSet] }, + geneSystematicNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSystematicNameFieldSet] }, + geneticModifiersFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifiersFieldSet] }, + idExampleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idExampleFieldSet] }, + idPatternFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idPatternFieldSet] }, + inchiFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inchiFieldSet] }, + inchiKeyFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inchiKeyFieldSet] }, + inCollectionFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.inCollectionFieldSet], + useKeywordFields: true, + }, + inferredAlleleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inferredAlleleFieldSet] }, + inferredGeneFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inferredGeneFieldSet] }, + interactorAGeneticPerturbationFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.interactorAGeneticPerturbationFieldSet], + }, + interactorBGeneticPerturbationFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.interactorBGeneticPerturbationFieldSet], + }, + interactorARoleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactorARoleFieldSet] }, + interactorBRoleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactorBRoleFieldSet] }, + interactorATypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactorATypeFieldSet] }, + interactorBTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactorBTypeFieldSet] }, + interactionIdFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactionIdFieldSet] }, + interactionSourceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactionSourceFieldSet] }, + interactionTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.interactionTypeFieldSet] }, + iupacFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.iupacFieldSet] }, + literatureCrossReferenceFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.literatureCrossReferenceFieldSet], + }, + modentityidFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.modentityidFieldSet] }, + modinternalidFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.modinternalidFieldSet] }, + nameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.nameFieldSet] }, + namespaceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.namespaceFieldSet] }, + phenotypeAnnotationSubjectFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.phenotypeAnnotationSubjectFieldSet], + }, + phenotypeAnnotationObjectFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.phenotypeAnnotationObjectFieldSet], + }, + phenotypesOrTraitsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.phenotypesOrTraitsFieldSet] }, + diseaseAnnotationSubjectFieldConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.diseaseAnnotationSubjectFieldSet], + }, + diseaseAnnotationObjectFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.diseaseAnnotationObjectFieldSet], + }, + ontologySynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.ontologySynonymsFieldSet] }, + paConditionRelationsSummaryFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.paConditionRelationsSummaryFieldSet], + }, + pageDescriptionFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.pageDescriptionFieldSet] }, + prefixFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.prefixFieldSet] }, + referencesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.referencesFieldSet] }, + relatedNotesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.relatedNotesFieldSet] }, + resourceDescriptorFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.resourceDescriptorFieldSet] }, + secondaryIdsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.secondaryIdsFieldSet] }, + sgdStrainBackgroundFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.sgdStrainBackgroundFieldSet], + }, + singleReferenceFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.singleReferenceFieldSet] }, + smilesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.smilesFieldSet] }, + sourceGeneralConsequenceFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.sourceGeneralConsequenceFieldSet], + }, + speciesTaxonCurieFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.speciesTaxonCurieFieldSet] }, + speciesFullNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.speciesFullNameFieldSet] }, + speciesDisplayNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.speciesDisplayNameFieldSet] }, + speciesCommonNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.speciesCommonNameFieldSet] }, + speciesAbbreviationFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.speciesAbbreviationFieldSet], + }, + speciesAssemblyFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.speciesAssemblyFieldSet] }, + subtypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.subtypeFieldSet] }, + synonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.synonymsFieldSet] }, + taxonFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.taxonFieldSet] }, + titleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.titleFieldSet] }, + uniqueidFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.uniqueidFieldSet] }, + updatedByFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.updatedByFieldSet] }, + urlTemplateFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.urlTemplateFieldSet] }, + variantTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.variantTypeFieldSet] }, + vocabularyDescriptionFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.vocabularyDescriptionFieldSet], + }, + vocabularyFieldSetFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.vocabularyFieldSet] }, + vocabularyMemberTermsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.memberTermsFieldSet] }, + vocabularyLabelFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.vocabularyLabelFieldSet] }, + vocabularyNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.vocabularyNameFieldSet] }, + vocabularyTermSetDescriptionFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.vocabularyTermSetDescriptionFieldSet], + }, + withFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.withFieldSet] }, - isExtinctFilterConfig: { filterComponentType: "dropdown", fieldSets: [FIELD_SETS.isExtinctFieldSet] }, - obsoleteFilterConfig: { filterComponentType: "dropdown", fieldSets: [FIELD_SETS.obsoleteFieldSet] }, - internalFilterConfig: { filterComponentType: "dropdown", fieldSets: [FIELD_SETS.internalFieldSet] }, - negatedFilterConfig: { filterComponentType: "dropdown", fieldSets: [FIELD_SETS.negatedFieldSet], options: [ { label: "NOT", value: "true" }, { label: "null", value: "false" } ] }, + isExtinctFilterConfig: { filterComponentType: 'dropdown', fieldSets: [FIELD_SETS.isExtinctFieldSet] }, + obsoleteFilterConfig: { filterComponentType: 'dropdown', fieldSets: [FIELD_SETS.obsoleteFieldSet] }, + internalFilterConfig: { filterComponentType: 'dropdown', fieldSets: [FIELD_SETS.internalFieldSet] }, + negatedFilterConfig: { + filterComponentType: 'dropdown', + fieldSets: [FIELD_SETS.negatedFieldSet], + options: [ + { label: 'NOT', value: 'true' }, + { label: 'null', value: 'false' }, + ], + }, - annotationTypeFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.annotationTypeFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - diseaseDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - phenotypeDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.paAggregationFieldSet, useKeywordFields: true }, - alleleDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.alleleAggregationFieldSet, useKeywordFields: true }, - constructDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.constructAggregationFieldSet, useKeywordFields: true }, - geneDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.geneAggregationFieldSet, useKeywordFields: true }, - agmDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.agmAggregationFieldSet, useKeywordFields: true }, - diseaseQualifiersFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.diseaseQualifiersFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - relationFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.relationFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - paRelationFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.relationFieldSet], aggregationFieldSet: FIELD_SETS.paAggregationFieldSet, useKeywordFields: true }, - gmiRelationFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.relationFieldSet], aggregationFieldSet: FIELD_SETS.gmiAggregationFieldSet, useKeywordFields: true }, - geneticModifierRelationFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.geneticModifierRelationFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - geneticSexFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.geneticSexFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - secondaryDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.secondaryDataProviderFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - speciesDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.speciesAggregationFieldSet, useKeywordFields: true }, - evidenceCodesFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.evidenceCodesFieldSet], aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, useKeywordFields: true }, - variantDataProviderFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.dataProviderFieldSet], aggregationFieldSet: FIELD_SETS.variantAggregationFieldSet, useKeywordFields: true }, - variantStatusFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.variantStatusFieldSet], aggregationFieldSet: FIELD_SETS.variantAggregationFieldSet,useKeywordFields: true }, + annotationTypeFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.annotationTypeFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + diseaseDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + phenotypeDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.paAggregationFieldSet, + useKeywordFields: true, + }, + alleleDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.alleleAggregationFieldSet, + useKeywordFields: true, + }, + constructDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.constructAggregationFieldSet, + useKeywordFields: true, + }, + geneDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.geneAggregationFieldSet, + useKeywordFields: true, + }, + agmDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.agmAggregationFieldSet, + useKeywordFields: true, + }, + diseaseQualifiersFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.diseaseQualifiersFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + relationFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.relationFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + paRelationFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.relationFieldSet], + aggregationFieldSet: FIELD_SETS.paAggregationFieldSet, + useKeywordFields: true, + }, + gmiRelationFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.relationFieldSet], + aggregationFieldSet: FIELD_SETS.gmiAggregationFieldSet, + useKeywordFields: true, + }, + geneticModifierRelationFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.geneticModifierRelationFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + geneticSexFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.geneticSexFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + secondaryDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.secondaryDataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + speciesDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.speciesAggregationFieldSet, + useKeywordFields: true, + }, + evidenceCodesFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.evidenceCodesFieldSet], + aggregationFieldSet: FIELD_SETS.daAggregationFieldSet, + useKeywordFields: true, + }, + variantDataProviderFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.dataProviderFieldSet], + aggregationFieldSet: FIELD_SETS.variantAggregationFieldSet, + useKeywordFields: true, + }, + variantStatusFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.variantStatusFieldSet], + aggregationFieldSet: FIELD_SETS.variantAggregationFieldSet, + useKeywordFields: true, + }, - conditionRelationTypeFilterConfig: { filterComponentType: "multiselect", fieldSets: [FIELD_SETS.conditionRelationTypeFieldSet], aggregationFieldSet: FIELD_SETS.conditionRelationTypeFieldSet }, + conditionRelationTypeFilterConfig: { + filterComponentType: 'multiselect', + fieldSets: [FIELD_SETS.conditionRelationTypeFieldSet], + aggregationFieldSet: FIELD_SETS.conditionRelationTypeFieldSet, + }, - // ALL Auto Complete Filters need to have useKeywordFields: true in order that exact matches come to the top of the list - acLiteratureCrossReferenceFilterConfig: { filterComponentType: "input", fieldSets: [FIELD_SETS.curieFieldSet, FIELD_SETS.literatureCrossReferenceFieldSet], useKeywordFields: true }, + // ALL Auto Complete Filters need to have useKeywordFields: true in order that exact matches come to the top of the list + acLiteratureCrossReferenceFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.curieFieldSet, FIELD_SETS.literatureCrossReferenceFieldSet], + useKeywordFields: true, + }, // nameAutoCompleteFilterConfig: { filterType: "autocomplete", fieldSets: [FIELD_SETS.curieFieldSet, FIELD_SETS.geneNameFieldSet, FIELD_SETS.alleleNameFieldSet] } }); - diff --git a/src/main/cliapp/src/constants/SortFields.js b/src/main/cliapp/src/constants/SortFields.js index 433d2e3dd..487b4f062 100644 --- a/src/main/cliapp/src/constants/SortFields.js +++ b/src/main/cliapp/src/constants/SortFields.js @@ -1,124 +1,121 @@ export const SORT_FIELDS = Object.freeze([ - "uniqueId", - "modEntityId", - "modInternalId", - "diseaseAnnotationSubject.symbol", - "phenotypeAnnotationSubject.symbol", - "phenotypeAnnotationObject", - "relation.name", - "negated", - "diseaseAnnotationObject.name", - "singleReference.primaryCrossReferenceCurie", - "evidenceCodes.abbreviation", - "with.geneSymbol.displayText", - "relatedNotes.freeText", - "conditionRelations.handle", - "conditionRelations.uniqueId", - "geneticSex.name", - "diseaseQualifiers.name", - "sgdStrainBackground.name", - "annotationType.name", - "diseaseGeneticModifierRelation.name", - "diseaseGeneticModifiers.symbol", - "inferredGene.geneSymbol.displayText", - "assertedGenes.geneSymbol.displayText", - "inferredAllele.alleleSymbol.displayText", - "assertedAllele.alleleSymbol.displayText", - "dataProvider.sourceOrganization.abbreviation", - "secondaryDataProvider.sourceOrganization.abbreviation", - "updatedBy.uniqueId", - "dateUpdated", - "createdBy.uniqueId", - "dataCreated", - "internal", - "obsolete", - "curie", - "name", - "subtype.name", - "taxon.name", - "parental_population", - "alleleFullName.displayText", - "alleleSymbol.displayText", - "alleleSynonyms.displayText", - "alleleSecondaryIds.secondaryId", - "alleleMutationTypes.mutationTypes.name", - "alleleFunctionalImpacts.functionalImpacts.name", - "alleleGermlineTransmissionStatus.germlineTransmissionStatus.name", - "alleleDatabaseStatus.databaseStatus.name", - "alleleInheritanceModes.inheritanceMode.name", - "alleleNomenclatureEvents.nomenclatureEvent.name", - "references.primaryCrossReferenceCurie", - "inCollection.name", - "isExtinct", - "handle", - "conditionRelationType.name", - "conditions.conditionSummary", - "id", - "abbreviation", - "vocabulary.name", - "definition", - "conditionSummary", - "conditionClass.name", - "conditionId.name", - "conditionGeneOntology.name", - "conditionChemical.name", - "conditionAnatomy.name", - "conditionTaxon.name", - "conditionQuantity", - "conditionFreeText", - "constructFullName.displayText", - "constructSymbol.displayText", - "constructSynonyms.displayText", - "geneFullName.displayText", - "geneSymbol.displayText", - "geneSecondaryIds.secondaryId", - "geneSystematicName.displayText", - "inchi", - "inchiKey", - "iupac", - "formula", - "smiles", - "namespace", - "cross_references.curie", - "title", - "abstract", - "citation", - "short_citation", - "prefix", - "idPattern", - "idExample", - "defaultUrlTemplate", - "resourceDescriptor.prefix", - "urlTemplate", - "pageDescription", - "vocabularyDescription", - "vocabularyTermSetVocabulary.name", - "memberTerms.name", - "vocabularyLabel", - "vocabularyTermSetDescription", - "synonyms.name", - "secondaryIdentifiers", - "taxonText", - "constructComponents.componentSymbol", - "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol", - "variantStatus.name", - "variantType.name", - "sourceGeneralConsequence.name", - "interactionId", - "interactionSource.name", - "interactionType.name", - "interactorARole.name", - "interactorBRole.name", - "interactorAType.name", - "interactorBType.name", - "detectionMethod.name", - "aggregationDatabase.name", - "interactorAGeneticPerturbation.alleleSymbol.displayText", - "interactorBGeneticPerturbation.alleleSymbol.displayText", - "phenotypesOrTraits", - "crossReference.displayName", - "crossReferences.displayName" + 'uniqueId', + 'modEntityId', + 'modInternalId', + 'diseaseAnnotationSubject.symbol', + 'phenotypeAnnotationSubject.symbol', + 'phenotypeAnnotationObject', + 'relation.name', + 'negated', + 'diseaseAnnotationObject.name', + 'singleReference.primaryCrossReferenceCurie', + 'evidenceCodes.abbreviation', + 'with.geneSymbol.displayText', + 'relatedNotes.freeText', + 'conditionRelations.handle', + 'conditionRelations.uniqueId', + 'geneticSex.name', + 'diseaseQualifiers.name', + 'sgdStrainBackground.name', + 'annotationType.name', + 'diseaseGeneticModifierRelation.name', + 'diseaseGeneticModifiers.symbol', + 'inferredGene.geneSymbol.displayText', + 'assertedGenes.geneSymbol.displayText', + 'inferredAllele.alleleSymbol.displayText', + 'assertedAllele.alleleSymbol.displayText', + 'dataProvider.sourceOrganization.abbreviation', + 'secondaryDataProvider.sourceOrganization.abbreviation', + 'updatedBy.uniqueId', + 'dateUpdated', + 'createdBy.uniqueId', + 'dataCreated', + 'internal', + 'obsolete', + 'curie', + 'name', + 'subtype.name', + 'taxon.name', + 'parental_population', + 'alleleFullName.displayText', + 'alleleSymbol.displayText', + 'alleleSynonyms.displayText', + 'alleleSecondaryIds.secondaryId', + 'alleleMutationTypes.mutationTypes.name', + 'alleleFunctionalImpacts.functionalImpacts.name', + 'alleleGermlineTransmissionStatus.germlineTransmissionStatus.name', + 'alleleDatabaseStatus.databaseStatus.name', + 'alleleInheritanceModes.inheritanceMode.name', + 'alleleNomenclatureEvents.nomenclatureEvent.name', + 'references.primaryCrossReferenceCurie', + 'inCollection.name', + 'isExtinct', + 'handle', + 'conditionRelationType.name', + 'conditions.conditionSummary', + 'id', + 'abbreviation', + 'vocabulary.name', + 'definition', + 'conditionSummary', + 'conditionClass.name', + 'conditionId.name', + 'conditionGeneOntology.name', + 'conditionChemical.name', + 'conditionAnatomy.name', + 'conditionTaxon.name', + 'conditionQuantity', + 'conditionFreeText', + 'constructFullName.displayText', + 'constructSymbol.displayText', + 'constructSynonyms.displayText', + 'geneFullName.displayText', + 'geneSymbol.displayText', + 'geneSecondaryIds.secondaryId', + 'geneSystematicName.displayText', + 'inchi', + 'inchiKey', + 'iupac', + 'formula', + 'smiles', + 'namespace', + 'cross_references.curie', + 'title', + 'abstract', + 'citation', + 'short_citation', + 'prefix', + 'idPattern', + 'idExample', + 'defaultUrlTemplate', + 'resourceDescriptor.prefix', + 'urlTemplate', + 'pageDescription', + 'vocabularyDescription', + 'vocabularyTermSetVocabulary.name', + 'memberTerms.name', + 'vocabularyLabel', + 'vocabularyTermSetDescription', + 'synonyms.name', + 'secondaryIdentifiers', + 'taxonText', + 'constructComponents.componentSymbol', + 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol', + 'variantStatus.name', + 'variantType.name', + 'sourceGeneralConsequence.name', + 'interactionId', + 'interactionSource.name', + 'interactionType.name', + 'interactorARole.name', + 'interactorBRole.name', + 'interactorAType.name', + 'interactorBType.name', + 'detectionMethod.name', + 'aggregationDatabase.name', + 'interactorAGeneticPerturbation.alleleSymbol.displayText', + 'interactorBGeneticPerturbation.alleleSymbol.displayText', + 'phenotypesOrTraits', + 'crossReference.displayName', + 'crossReferences.displayName', ]); - - - diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelPage.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelPage.js index a280c22d7..53d77f0fa 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelPage.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelPage.js @@ -2,7 +2,5 @@ import React from 'react'; import { AffectedGenomicModelTable } from './AffectedGenomicModelTable'; export function AffectedGenomicModelPage() { - return ( - - ); -} \ No newline at end of file + return ; +} diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index f9f6062c1..0052e4816 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -14,7 +14,6 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; export const AffectedGenomicModelTable = () => { - const [isInEditMode, setIsInEditMode] = useState(false); const [errorMessages, setErrorMessages] = useState({}); const [totalRecords, setTotalRecords] = useState(0); @@ -27,109 +26,112 @@ export const AffectedGenomicModelTable = () => { const columns = [ { - field: "curie", - header: "Curie", + field: 'curie', + header: 'Curie', sortable: true, - filterConfig: FILTER_CONFIGS.curieFilterConfig + filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { - field: "modEntityId", - header: "MOD Entity ID", - body: (rowData) => , - sortable: true, + field: 'modEntityId', + header: 'MOD Entity ID', + body: (rowData) => , + sortable: true, filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { - field: "modInternalId", - header: "MOD Internal ID", - body: (rowData) => , - sortable: true, + field: 'modInternalId', + header: 'MOD Internal ID', + body: (rowData) => , + sortable: true, filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { - field: "name", - header: "Name", - body: (rowData) => , + field: 'name', + header: 'Name', + body: (rowData) => , sortable: true, - filterConfig: FILTER_CONFIGS.nameFilterConfig + filterConfig: FILTER_CONFIGS.nameFilterConfig, }, - { - field: "subtype.name", - header: "Sub Type", + { + field: 'subtype.name', + header: 'Sub Type', sortable: true, - filterConfig: FILTER_CONFIGS.subtypeFilterConfig + filterConfig: FILTER_CONFIGS.subtypeFilterConfig, }, { - field: "taxon.name", - header: "Taxon", + field: 'taxon.name', + header: 'Taxon', sortable: true, - body: (rowData) => , - filterConfig: FILTER_CONFIGS.taxonFilterConfig + body: (rowData) => , + filterConfig: FILTER_CONFIGS.taxonFilterConfig, }, { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', sortable: true, filterConfig: FILTER_CONFIGS.agmDataProviderFilterConfig, }, { - field: "crossReferences.displayName", - header: "Cross References", + field: 'crossReferences.displayName', + header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => + body: (rowData) => , }, { - field: "updatedBy.uniqueId", - header: "Updated By", + field: 'updatedBy.uniqueId', + header: 'Updated By', sortable: true, filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { - field: "dateUpdated", - header: "Date Updated", + field: 'dateUpdated', + header: 'Date Updated', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig + filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { - field: "createdBy.uniqueId", - header: "Created By", + field: 'createdBy.uniqueId', + header: 'Created By', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.createdByFilterConfig + filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { - field: "dateCreated", - header: "Date Created", + field: 'dateCreated', + header: 'Date Created', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { - field: "internal", - header: "Internal", - body: (rowData) => , + field: 'internal', + header: 'Internal', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.internalFilterConfig, - sortable: true + sortable: true, }, { - field: "obsolete", - header: "Obsolete", - body: (rowData) => , + field: 'obsolete', + header: 'Obsolete', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, - sortable: true - } - ]; + sortable: true, + }, + ]; const DEFAULT_COLUMN_WIDTH = 100 / columns.length; - const SEARCH_ENDPOINT = "agm"; + const SEARCH_ENDPOINT = 'agm'; - const initialTableState = getDefaultTableState("AffectedGenomicModels", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('AffectedGenomicModels', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isFetching, isLoading } = useGetTableData({ tableState, @@ -138,32 +140,31 @@ export const AffectedGenomicModelTable = () => { setEntities: setAgms, setTotalRecords, toast_topleft, - searchService + searchService, }); - return ( -
    - - - -
    - ) -} +
    + + + +
    + ); +}; diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/__tests__/AffectedGenomicModelTable.test.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/__tests__/AffectedGenomicModelTable.test.js index 85dbf0640..2c1370822 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/__tests__/AffectedGenomicModelTable.test.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/__tests__/AffectedGenomicModelTable.test.js @@ -1,13 +1,18 @@ -import React from "react"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { AffectedGenomicModelTable } from "../AffectedGenomicModelTable"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData.js"; +import { AffectedGenomicModelTable } from '../AffectedGenomicModelTable'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData.js'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -15,24 +20,23 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); - + await waitFor(() => { expect(result); }); - }); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Affected Genomic Models Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("Contains Correct Table Data", async () => { + it('Contains Correct Table Data', async () => { let result = await renderWithClient(); const modEntityId = await result.findByText(/WB:WBStrain00051221/i); expect(modEntityId).toBeInTheDocument(); }); -}); \ No newline at end of file +}); diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/index.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/index.js index 620f366bf..28375aa29 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/index.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/index.js @@ -1,3 +1,3 @@ -import { AffectedGenomicModelPage } from "./AffectedGenomicModelPage"; +import { AffectedGenomicModelPage } from './AffectedGenomicModelPage'; -export { AffectedGenomicModelPage }; \ No newline at end of file +export { AffectedGenomicModelPage }; diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/mockData/mockData.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/mockData/mockData.js index 59bc02b07..cdc512ea9 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/mockData/mockData.js @@ -1,19 +1,41 @@ - export const data = { - "results": [ - { - "type": "AffectedGenomicModel", - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-02T22:19:23.387435Z", - "dbDateUpdated": "2022-12-22T15:16:30.834738Z", "modEntityId": "WB:WBStrain00051221", "taxon": { "internal": false, "obsolete": false, "curie": "NCBITaxon:6239", "name": "Caenorhabditis elegans" }, "name": "VC4532", "subtype": { "internal": false, "obsolete": false, "id": 25575353, "name": "strain" } - }, - { - "type": "AffectedGenomicModel", "dateCreated": "2006-10-13T14:12:37Z", "dateUpdated": "2006-10-13T14:12:37Z", "internal": false, "obsolete": false, "dbDateUpdated": "2022-12-22T15:10:00.706858Z", "modEntityId": "RGD:1581633", "taxon": { "internal": false, "obsolete": false, "curie": "NCBITaxon:10116", "name": "Rattus norvegicus" }, "name": "DA.ACI-(D15Rat6-D15Rat71)/Kini", "subtype": { "internal": false, "obsolete": false, "id": 25575353, "name": "strain" } - }, - { - "type": "AffectedGenomicModel", "dateCreated": "2021-09-02T22:25:17Z", "dateUpdated": "2021-09-02T22:25:17Z", "internal": false, "obsolete": false, "dbDateUpdated": "2022-12-22T15:10:21.254879Z", "modEntityId": "RGD:150404267", "taxon": { "internal": false, "obsolete": false, "curie": "NCBITaxon:10116", "name": "Rattus norvegicus" }, "name": "LEW-Myo15aci2/Ztm", "subtype": { "internal": false, "obsolete": false, "id": 25575353, "name": "strain" } - } - ], - "totalResults": 196858, "returnedRecords": 50 -} \ No newline at end of file + results: [ + { + type: 'AffectedGenomicModel', + internal: false, + obsolete: false, + dbDateCreated: '2022-11-02T22:19:23.387435Z', + dbDateUpdated: '2022-12-22T15:16:30.834738Z', + modEntityId: 'WB:WBStrain00051221', + taxon: { internal: false, obsolete: false, curie: 'NCBITaxon:6239', name: 'Caenorhabditis elegans' }, + name: 'VC4532', + subtype: { internal: false, obsolete: false, id: 25575353, name: 'strain' }, + }, + { + type: 'AffectedGenomicModel', + dateCreated: '2006-10-13T14:12:37Z', + dateUpdated: '2006-10-13T14:12:37Z', + internal: false, + obsolete: false, + dbDateUpdated: '2022-12-22T15:10:00.706858Z', + modEntityId: 'RGD:1581633', + taxon: { internal: false, obsolete: false, curie: 'NCBITaxon:10116', name: 'Rattus norvegicus' }, + name: 'DA.ACI-(D15Rat6-D15Rat71)/Kini', + subtype: { internal: false, obsolete: false, id: 25575353, name: 'strain' }, + }, + { + type: 'AffectedGenomicModel', + dateCreated: '2021-09-02T22:25:17Z', + dateUpdated: '2021-09-02T22:25:17Z', + internal: false, + obsolete: false, + dbDateUpdated: '2022-12-22T15:10:21.254879Z', + modEntityId: 'RGD:150404267', + taxon: { internal: false, obsolete: false, curie: 'NCBITaxon:10116', name: 'Rattus norvegicus' }, + name: 'LEW-Myo15aci2/Ztm', + subtype: { internal: false, obsolete: false, id: 25575353, name: 'strain' }, + }, + ], + totalResults: 196858, + returnedRecords: 50, +}; diff --git a/src/main/cliapp/src/containers/allelesPage/AlleleDetailPage.js b/src/main/cliapp/src/containers/allelesPage/AlleleDetailPage.js index 9f27e912d..2ec0d8394 100644 --- a/src/main/cliapp/src/containers/allelesPage/AlleleDetailPage.js +++ b/src/main/cliapp/src/containers/allelesPage/AlleleDetailPage.js @@ -40,45 +40,40 @@ export default function AlleleDetailPage() { const toastSuccess = useRef(null); const toastError = useRef(null); - const labelColumnSize = "col-3"; - const widgetColumnSize = "col-4"; - const fieldDetailsColumnSize = "col-5"; - - const { isLoading: getRequestIsLoading } = useQuery([identifier], - () => alleleService.getAllele(identifier), - { - onSuccess: (result) => { - alleleDispatch({ type: 'SET', value: result?.data?.entity }); - }, - onError: (error) => { - console.warn(error); - }, - keepPreviousData: true, - refetchOnWindowFocus: false, - } - ); + const labelColumnSize = 'col-3'; + const widgetColumnSize = 'col-4'; + const fieldDetailsColumnSize = 'col-5'; + + const { isLoading: getRequestIsLoading } = useQuery([identifier], () => alleleService.getAllele(identifier), { + onSuccess: (result) => { + alleleDispatch({ type: 'SET', value: result?.data?.entity }); + }, + onError: (error) => { + console.warn(error); + }, + keepPreviousData: true, + refetchOnWindowFocus: false, + }); - const { isLoading: allelePutRequestIsLoading, mutate: alleleMutate } = useMutation(allele => { + const { isLoading: allelePutRequestIsLoading, mutate: alleleMutate } = useMutation((allele) => { return alleleService.saveAlleleDetail(allele); }); const handleSubmit = async (event) => { event.preventDefault(); alleleDispatch({ - type: "SUBMIT" + type: 'SUBMIT', }); - const areUiErrors = validateRequiredAutosuggestField( alleleState.allele.alleleGeneAssociations, alleleState.entityStates.alleleGeneAssociations.errorMessages, alleleDispatch, - "alleleGeneAssociations", - "alleleGeneAssociationObject", + 'alleleGeneAssociations', + 'alleleGeneAssociationObject' ); - - if(areUiErrors) return; + if (areUiErrors) return; alleleMutate(alleleState.allele, { onSuccess: (result) => { @@ -96,21 +91,21 @@ export default function AlleleDetailPage() { message = `${error.response.status} ${error.response.statusText}`; } toastError.current.show([ - { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false } + { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false }, ]); - try{ + try { processErrors(data, alleleDispatch, alleleState.allele); - } catch(e){ + } catch (e) { console.error(e); } - } + }, }); }; const onTaxonValueChange = (event) => { let value = {}; - if (typeof event.value === "object") { + if (typeof event.value === 'object') { value = event.value; } else { value.curie = event.value; @@ -124,9 +119,9 @@ export default function AlleleDetailPage() { const onInCollectionValueChange = (event) => { let value = {}; - if (typeof event.value === "object") { + if (typeof event.value === 'object') { value = event.value; - } else if (event.value === "") { + } else if (event.value === '') { value = undefined; } else { value.name = event.value; @@ -162,28 +157,29 @@ export default function AlleleDetailPage() { }); }; - if (getRequestIsLoading) return ( -
    - -
    - ); + if (getRequestIsLoading) + return ( +
    + +
    + ); const headerText = () => { - let prefix = "Allele: "; + let prefix = 'Allele: '; if (alleleState.allele?.alleleSymbol?.displayText && alleleState.allele?.modEntityId) { return `${prefix} ${alleleState.allele.alleleSymbol.displayText} (${alleleState.allele.modEntityId})`; } if (alleleState.allele?.modEntityId) { return `${prefix} ${alleleState.allele.modEntityId}`; } - return "Allele Detail Page"; + return 'Allele Detail Page'; }; return ( <> - + @@ -191,11 +187,11 @@ export default function AlleleDetailPage() {

    - -

    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; - const symbolEditor = (props) => { return ( <> -
    - -
    - +
    + +
    + - ) + ); }; const handleSymbolOpen = (alleleSymbol) => { let _symbolData = {}; - _symbolData["originalSymbols"] = [alleleSymbol]; - _symbolData["dialog"] = true; - _symbolData["isInEdit"] = false; + _symbolData['originalSymbols'] = [alleleSymbol]; + _symbolData['dialog'] = true; + _symbolData['isInEdit'] = false; setSymbolData(() => ({ - ..._symbolData + ..._symbolData, })); }; @@ -240,60 +270,83 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _symbolData = {}; - _symbolData["originalSymbols"] = [rowProps.rowData.alleleSymbol]; - _symbolData["dialog"] = true; - _symbolData["isInEdit"] = isInEdit; - _symbolData["rowIndex"] = index; - _symbolData["mainRowProps"] = rowProps; + _symbolData['originalSymbols'] = [rowProps.rowData.alleleSymbol]; + _symbolData['dialog'] = true; + _symbolData['isInEdit'] = isInEdit; + _symbolData['rowIndex'] = index; + _symbolData['mainRowProps'] = rowProps; setSymbolData(() => ({ - ..._symbolData + ..._symbolData, })); }; - + const fullNameEditor = (props) => { if (props?.rowData?.alleleFullName) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleFullNameOpen = (alleleFullName) => { let _fullNameData = {}; - _fullNameData["originalFullNames"] = [alleleFullName]; - _fullNameData["dialog"] = true; - _fullNameData["isInEdit"] = false; + _fullNameData['originalFullNames'] = [alleleFullName]; + _fullNameData['dialog'] = true; + _fullNameData['isInEdit'] = false; setFullNameData(() => ({ - ..._fullNameData + ..._fullNameData, })); }; @@ -302,13 +355,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _fullNameData = {}; - _fullNameData["originalFullNames"] = [rowProps.rowData.alleleFullName]; - _fullNameData["dialog"] = true; - _fullNameData["isInEdit"] = isInEdit; - _fullNameData["rowIndex"] = index; - _fullNameData["mainRowProps"] = rowProps; + _fullNameData['originalFullNames'] = [rowProps.rowData.alleleFullName]; + _fullNameData['dialog'] = true; + _fullNameData['isInEdit'] = isInEdit; + _fullNameData['rowIndex'] = index; + _fullNameData['mainRowProps'] = rowProps; setFullNameData(() => ({ - ..._fullNameData + ..._fullNameData, })); }; @@ -316,46 +369,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleSynonyms) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleSynonymsOpen = (alleleSynonyms) => { let _synonymsData = {}; - _synonymsData["originalSynonyms"] = alleleSynonyms; - _synonymsData["dialog"] = true; - _synonymsData["isInEdit"] = false; + _synonymsData['originalSynonyms'] = alleleSynonyms; + _synonymsData['dialog'] = true; + _synonymsData['isInEdit'] = false; setSynonymsData(() => ({ - ..._synonymsData + ..._synonymsData, })); }; @@ -364,13 +435,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _synonymsData = {}; - _synonymsData["originalSynonyms"] = rowProps.rowData.alleleSynonyms; - _synonymsData["dialog"] = true; - _synonymsData["isInEdit"] = isInEdit; - _synonymsData["rowIndex"] = index; - _synonymsData["mainRowProps"] = rowProps; + _synonymsData['originalSynonyms'] = rowProps.rowData.alleleSynonyms; + _synonymsData['dialog'] = true; + _synonymsData['isInEdit'] = isInEdit; + _synonymsData['rowIndex'] = index; + _synonymsData['mainRowProps'] = rowProps; setSynonymsData(() => ({ - ..._synonymsData + ..._synonymsData, })); }; @@ -378,46 +449,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleInheritanceModes) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleInheritanceModesOpen = (alleleInheritanceModes) => { let _inheritanceModesData = {}; - _inheritanceModesData["originalInheritanceModes"] = alleleInheritanceModes; - _inheritanceModesData["dialog"] = true; - _inheritanceModesData["isInEdit"] = false; + _inheritanceModesData['originalInheritanceModes'] = alleleInheritanceModes; + _inheritanceModesData['dialog'] = true; + _inheritanceModesData['isInEdit'] = false; setInheritanceModesData(() => ({ - ..._inheritanceModesData + ..._inheritanceModesData, })); }; @@ -426,13 +515,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _inheritanceModesData = {}; - _inheritanceModesData["originalInheritanceModes"] = rowProps.rowData.alleleInheritanceModes; - _inheritanceModesData["dialog"] = true; - _inheritanceModesData["isInEdit"] = isInEdit; - _inheritanceModesData["rowIndex"] = index; - _inheritanceModesData["mainRowProps"] = rowProps; + _inheritanceModesData['originalInheritanceModes'] = rowProps.rowData.alleleInheritanceModes; + _inheritanceModesData['dialog'] = true; + _inheritanceModesData['isInEdit'] = isInEdit; + _inheritanceModesData['rowIndex'] = index; + _inheritanceModesData['mainRowProps'] = rowProps; setInheritanceModesData(() => ({ - ..._inheritanceModesData + ..._inheritanceModesData, })); }; @@ -440,46 +529,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleGermlineTransmissionStatus) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleGermlineTransmissionStatusOpen = (alleleGermlineTransmissionStatus) => { let _germlineTransmissionStatusData = {}; - _germlineTransmissionStatusData["originalGermlineTransmissionStatuses"] = [alleleGermlineTransmissionStatus]; - _germlineTransmissionStatusData["dialog"] = true; - _germlineTransmissionStatusData["isInEdit"] = false; + _germlineTransmissionStatusData['originalGermlineTransmissionStatuses'] = [alleleGermlineTransmissionStatus]; + _germlineTransmissionStatusData['dialog'] = true; + _germlineTransmissionStatusData['isInEdit'] = false; setGermlineTransmissionStatusData(() => ({ - ..._germlineTransmissionStatusData + ..._germlineTransmissionStatusData, })); }; @@ -488,13 +595,15 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _germlineTransmissionStatusData = {}; - _germlineTransmissionStatusData["originalGermlineTransmissionStatuses"] = [rowProps.rowData.alleleGermlineTransmissionStatus]; - _germlineTransmissionStatusData["dialog"] = true; - _germlineTransmissionStatusData["isInEdit"] = isInEdit; - _germlineTransmissionStatusData["rowIndex"] = index; - _germlineTransmissionStatusData["mainRowProps"] = rowProps; + _germlineTransmissionStatusData['originalGermlineTransmissionStatuses'] = [ + rowProps.rowData.alleleGermlineTransmissionStatus, + ]; + _germlineTransmissionStatusData['dialog'] = true; + _germlineTransmissionStatusData['isInEdit'] = isInEdit; + _germlineTransmissionStatusData['rowIndex'] = index; + _germlineTransmissionStatusData['mainRowProps'] = rowProps; setGermlineTransmissionStatusData(() => ({ - ..._germlineTransmissionStatusData + ..._germlineTransmissionStatusData, })); }; @@ -502,46 +611,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleNomenclatureEvents) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleNomenclatureEventsOpen = (alleleNomenclatureEvents) => { let _nomenclatureEventsData = {}; - _nomenclatureEventsData["originalNomenclatureEvents"] = alleleNomenclatureEvents; - _nomenclatureEventsData["dialog"] = true; - _nomenclatureEventsData["isInEdit"] = false; + _nomenclatureEventsData['originalNomenclatureEvents'] = alleleNomenclatureEvents; + _nomenclatureEventsData['dialog'] = true; + _nomenclatureEventsData['isInEdit'] = false; setNomenclatureEventsData(() => ({ - ..._nomenclatureEventsData + ..._nomenclatureEventsData, })); }; @@ -550,13 +677,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _nomenclatureEventsData = {}; - _nomenclatureEventsData["originalNomenclatureEvents"] = rowProps.rowData.alleleNomenclatureEvents; - _nomenclatureEventsData["dialog"] = true; - _nomenclatureEventsData["isInEdit"] = isInEdit; - _nomenclatureEventsData["rowIndex"] = index; - _nomenclatureEventsData["mainRowProps"] = rowProps; + _nomenclatureEventsData['originalNomenclatureEvents'] = rowProps.rowData.alleleNomenclatureEvents; + _nomenclatureEventsData['dialog'] = true; + _nomenclatureEventsData['isInEdit'] = isInEdit; + _nomenclatureEventsData['rowIndex'] = index; + _nomenclatureEventsData['mainRowProps'] = rowProps; setNomenclatureEventsData(() => ({ - ..._nomenclatureEventsData + ..._nomenclatureEventsData, })); }; @@ -564,46 +691,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleDatabaseStatus?.databaseStatus) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleDatabaseStatusOpen = (alleleDatabaseStatus) => { let _databaseStatusData = {}; - _databaseStatusData["originalDatabaseStatuses"] = [alleleDatabaseStatus]; - _databaseStatusData["dialog"] = true; - _databaseStatusData["isInEdit"] = false; + _databaseStatusData['originalDatabaseStatuses'] = [alleleDatabaseStatus]; + _databaseStatusData['dialog'] = true; + _databaseStatusData['isInEdit'] = false; setDatabaseStatusData(() => ({ - ..._databaseStatusData + ..._databaseStatusData, })); }; @@ -612,13 +757,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _databaseStatusData = {}; - _databaseStatusData["originalDatabaseStatuses"] = [rowProps.rowData.alleleDatabaseStatus]; - _databaseStatusData["dialog"] = true; - _databaseStatusData["isInEdit"] = isInEdit; - _databaseStatusData["rowIndex"] = index; - _databaseStatusData["mainRowProps"] = rowProps; + _databaseStatusData['originalDatabaseStatuses'] = [rowProps.rowData.alleleDatabaseStatus]; + _databaseStatusData['dialog'] = true; + _databaseStatusData['isInEdit'] = isInEdit; + _databaseStatusData['rowIndex'] = index; + _databaseStatusData['mainRowProps'] = rowProps; setDatabaseStatusData(() => ({ - ..._databaseStatusData + ..._databaseStatusData, })); }; @@ -626,46 +771,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleMutationTypes) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleMutationTypesOpen = (alleleMutationTypes) => { let _mutationTypesData = {}; - _mutationTypesData["originalMutationTypes"] = alleleMutationTypes; - _mutationTypesData["dialog"] = true; - _mutationTypesData["isInEdit"] = false; + _mutationTypesData['originalMutationTypes'] = alleleMutationTypes; + _mutationTypesData['dialog'] = true; + _mutationTypesData['isInEdit'] = false; setMutationTypesData(() => ({ - ..._mutationTypesData + ..._mutationTypesData, })); }; @@ -674,13 +837,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _mutationTypesData = {}; - _mutationTypesData["originalMutationTypes"] = rowProps.rowData.alleleMutationTypes; - _mutationTypesData["dialog"] = true; - _mutationTypesData["isInEdit"] = isInEdit; - _mutationTypesData["rowIndex"] = index; - _mutationTypesData["mainRowProps"] = rowProps; + _mutationTypesData['originalMutationTypes'] = rowProps.rowData.alleleMutationTypes; + _mutationTypesData['dialog'] = true; + _mutationTypesData['isInEdit'] = isInEdit; + _mutationTypesData['rowIndex'] = index; + _mutationTypesData['mainRowProps'] = rowProps; setMutationTypesData(() => ({ - ..._mutationTypesData + ..._mutationTypesData, })); }; @@ -688,46 +851,64 @@ export const AllelesTable = () => { if (props?.rowData?.alleleFunctionalImpacts) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const handleFunctionalImpactsOpen = (alleleFunctionalImpacts) => { let _functionalImpactsData = {}; - _functionalImpactsData["originalFunctionalImpacts"] = alleleFunctionalImpacts; - _functionalImpactsData["dialog"] = true; - _functionalImpactsData["isInEdit"] = false; + _functionalImpactsData['originalFunctionalImpacts'] = alleleFunctionalImpacts; + _functionalImpactsData['dialog'] = true; + _functionalImpactsData['isInEdit'] = false; setFunctionalImpactsData(() => ({ - ..._functionalImpactsData + ..._functionalImpactsData, })); }; @@ -736,13 +917,13 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _functionalImpactsData = {}; - _functionalImpactsData["originalFunctionalImpacts"] = rowProps.rowData.alleleFunctionalImpacts; - _functionalImpactsData["dialog"] = true; - _functionalImpactsData["isInEdit"] = isInEdit; - _functionalImpactsData["rowIndex"] = index; - _functionalImpactsData["mainRowProps"] = rowProps; + _functionalImpactsData['originalFunctionalImpacts'] = rowProps.rowData.alleleFunctionalImpacts; + _functionalImpactsData['dialog'] = true; + _functionalImpactsData['isInEdit'] = isInEdit; + _functionalImpactsData['rowIndex'] = index; + _functionalImpactsData['mainRowProps'] = rowProps; setFunctionalImpactsData(() => ({ - ..._functionalImpactsData + ..._functionalImpactsData, })); }; @@ -750,47 +931,63 @@ export const AllelesTable = () => { if (props?.rowData?.alleleSecondaryIds) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; - - const handleSecondaryIdsOpen = (alleleSecondaryIds) => { let _secondaryIdsData = {}; - _secondaryIdsData["originalSecondaryIds"] = alleleSecondaryIds; - _secondaryIdsData["dialog"] = true; - _secondaryIdsData["isInEdit"] = false; + _secondaryIdsData['originalSecondaryIds'] = alleleSecondaryIds; + _secondaryIdsData['dialog'] = true; + _secondaryIdsData['isInEdit'] = false; setSecondaryIdsData(() => ({ - ..._secondaryIdsData + ..._secondaryIdsData, })); }; @@ -799,283 +996,302 @@ export const AllelesTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _secondaryIdsData = {}; - _secondaryIdsData["originalSecondaryIds"] = rowProps.rowData.alleleSecondaryIds; - _secondaryIdsData["dialog"] = true; - _secondaryIdsData["isInEdit"] = isInEdit; - _secondaryIdsData["rowIndex"] = index; - _secondaryIdsData["mainRowProps"] = rowProps; + _secondaryIdsData['originalSecondaryIds'] = rowProps.rowData.alleleSecondaryIds; + _secondaryIdsData['dialog'] = true; + _secondaryIdsData['isInEdit'] = isInEdit; + _secondaryIdsData['rowIndex'] = index; + _secondaryIdsData['mainRowProps'] = rowProps; setSecondaryIdsData(() => ({ - ..._secondaryIdsData + ..._secondaryIdsData, })); }; const columns = [ { - field: "curie", - header: "Curie", - body: (rowData) => , - sortable: true, + field: 'curie', + header: 'Curie', + body: (rowData) => , + sortable: true, filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { - field: "modEntityId", - header: "MOD Entity ID", - body: (rowData) => , - sortable: true, + field: 'modEntityId', + header: 'MOD Entity ID', + body: (rowData) => , + sortable: true, filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { - field: "modInternalId", - header: "MOD Internal ID", - body: (rowData) => , - sortable: true, + field: 'modInternalId', + header: 'MOD Internal ID', + body: (rowData) => , + sortable: true, filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { - field: "alleleFullName.displayText", - header: "Name", - body: (rowData) => , + field: 'alleleFullName.displayText', + header: 'Name', + body: (rowData) => ( + + ), editor: (props) => fullNameEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleNameFilterConfig, }, { - field: "alleleSymbol.displayText", - header: "Symbol", - body: (rowData) => , + field: 'alleleSymbol.displayText', + header: 'Symbol', + body: (rowData) => ( + + ), editor: (props) => symbolEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleSymbolFilterConfig, }, { - field: "alleleSynonyms.displayText", - header: "Synonyms", - body: (rowData) => entity?.displayText} - underline={false} - />, + field: 'alleleSynonyms.displayText', + header: 'Synonyms', + body: (rowData) => ( + entity?.displayText} + underline={false} + /> + ), editor: (props) => synonymsEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleSynonymsFilterConfig, }, { - field: "alleleSecondaryIds.secondaryId", - header: "Secondary IDs", + field: 'alleleSecondaryIds.secondaryId', + header: 'Secondary IDs', //todo - body: (rowData) => entity?.secondaryId} - />, + body: (rowData) => ( + entity?.secondaryId} + /> + ), editor: (props) => secondaryIdsEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleSecondaryIdsFilterConfig, }, { - field: "alleleNomenclatureEvents.nomenclatureEvent.name", - header: "Nomenclature Events", - body: (rowData) => entity?.nomenclatureEvent?.name} - />, + field: 'alleleNomenclatureEvents.nomenclatureEvent.name', + header: 'Nomenclature Events', + body: (rowData) => ( + entity?.nomenclatureEvent?.name} + /> + ), sortable: true, filterConfig: FILTER_CONFIGS.alleleNomenclatureEventsFilterConfig, editor: (props) => nomenclatureEventsEditor(props), }, { - field: "taxon.name", - header: "Taxon", - body: (rowData) => , + field: 'taxon.name', + header: 'Taxon', + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.taxonFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "alleleMutationTypes.mutationTypes.name", - header: "Mutation Types", - body: (rowData) => `${item.name} (${item.curie})`} - />, + field: 'alleleMutationTypes.mutationTypes.name', + header: 'Mutation Types', + body: (rowData) => ( + `${item.name} (${item.curie})`} + /> + ), editor: (props) => mutationTypesEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleMutationFilterConfig, }, { - field: "alleleFunctionalImpacts.functionalImpacts.name", - header: "Functional Impacts", - body: (rowData) => item.name} - />, + field: 'alleleFunctionalImpacts.functionalImpacts.name', + header: 'Functional Impacts', + body: (rowData) => ( + item.name} + /> + ), editor: (props) => functionalImpactsEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleFunctionalImpactsFilterConfig, }, { - field: "alleleGermlineTransmissionStatus.germlineTransmissionStatus.name", - header: "Germline Transmission Status", - body: (rowData) => , + field: 'alleleGermlineTransmissionStatus.germlineTransmissionStatus.name', + header: 'Germline Transmission Status', + body: (rowData) => ( + + ), editor: (props) => germlineTransmissionStatusEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleGermlineTransmissionStatusFilterConfig, }, { - field: "alleleDatabaseStatus.databaseStatus.name", - header: "Database Status", - body: (rowData) => , + field: 'alleleDatabaseStatus.databaseStatus.name', + header: 'Database Status', + body: (rowData) => ( + + ), editor: (props) => databaseStatusEditor(props), sortable: true, filterConfig: FILTER_CONFIGS.alleleDatabaseStatusFilterConfig, }, { - field: "references.primaryCrossReferenceCurie", - header: "References", - body: (rowData) => , + field: 'references.primaryCrossReferenceCurie', + header: 'References', + body: (rowData) => ( + + ), sortable: true, filterConfig: FILTER_CONFIGS.referencesFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "alleleInheritanceModes.inheritanceMode.name", - header: "Inheritance Modes", - body: (rowData) => entity?.inheritanceMode?.name} - />, + field: 'alleleInheritanceModes.inheritanceMode.name', + header: 'Inheritance Modes', + body: (rowData) => ( + entity?.inheritanceMode?.name} + /> + ), sortable: true, filterConfig: FILTER_CONFIGS.alleleInheritanceModesFilterConfig, editor: (props) => inheritanceModesEditor(props), }, { - field: "inCollection.name", - header: "In Collection", + field: 'inCollection.name', + header: 'In Collection', sortable: true, filterConfig: FILTER_CONFIGS.inCollectionFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "isExtinct", - header: "Is Extinct", - body: (rowData) => , + field: 'isExtinct', + header: 'Is Extinct', + body: (rowData) => , filterConfig: FILTER_CONFIGS.isExtinctFilterConfig, sortable: true, editor: (props) => ( - - ) + + ), }, { - field: "relatedNotes.freeText", - header: "Related Notes", - body: (rowData) => , + field: 'relatedNotes.freeText', + header: 'Related Notes', + body: (rowData) => ( + + ), sortable: true, filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, - editor: relatedNotesEditor + editor: relatedNotesEditor, }, { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', sortable: true, filterConfig: FILTER_CONFIGS.alleleDataProviderFilterConfig, }, { - field: "crossReferences.displayName", - header: "Cross References", + field: 'crossReferences.displayName', + header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => + body: (rowData) => , }, { - field: "updatedBy.uniqueId", - header: "Updated By", + field: 'updatedBy.uniqueId', + header: 'Updated By', sortable: true, filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { - field: "dateUpdated", - header: "Date Updated", + field: 'dateUpdated', + header: 'Date Updated', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig + filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { - field: "createdBy.uniqueId", - header: "Created By", + field: 'createdBy.uniqueId', + header: 'Created By', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.createdByFilterConfig + filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { - field: "dateCreated", - header: "Date Created", + field: 'dateCreated', + header: 'Date Created', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { - field: "internal", - header: "Internal", - body: (rowData) => , + field: 'internal', + header: 'Internal', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.internalFilterConfig, sortable: true, - editor: (props) => ( - - ) + editor: (props) => , }, { - field: "obsolete", - header: "Obsolete", - body: (rowData) => , + field: 'obsolete', + header: 'Obsolete', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, sortable: true, - editor: (props) => ( - - ) - } + editor: (props) => , + }, ]; const DEFAULT_COLUMN_WIDTH = 10; - const SEARCH_ENDPOINT = "allele"; + const SEARCH_ENDPOINT = 'allele'; - const initialTableState = getDefaultTableState("Alleles", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('Alleles', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isFetching, isLoading } = useGetTableData({ tableState, @@ -1084,7 +1300,7 @@ export const AllelesTable = () => { setEntities: setAlleles, setTotalRecords, toast_topleft, - searchService + searchService, }); return ( @@ -1107,8 +1323,8 @@ export const AllelesTable = () => { mutation={mutation} isInEditMode={isInEditMode} setIsInEditMode={setIsInEditMode} - toasts={{toast_topleft, toast_topright }} - errorObject = {{errorMessages, setErrorMessages}} + toasts={{ toast_topleft, toast_topright }} + errorObject={{ errorMessages, setErrorMessages }} defaultColumnWidth={DEFAULT_COLUMN_WIDTH} fetching={isFetching || isLoading} /> @@ -1187,7 +1403,7 @@ export const AllelesTable = () => { setOriginalRelatedNotesData={setRelatedNotesData} errorMessagesMainRow={errorMessages} setErrorMessagesMainRow={setErrorMessages} - noteTypeVocabularyTermSet='allele_note_type' + noteTypeVocabularyTermSet="allele_note_type" /> ); diff --git a/src/main/cliapp/src/containers/allelesPage/PageFooter.js b/src/main/cliapp/src/containers/allelesPage/PageFooter.js index 56ac10d56..f31ad8920 100644 --- a/src/main/cliapp/src/containers/allelesPage/PageFooter.js +++ b/src/main/cliapp/src/containers/allelesPage/PageFooter.js @@ -1,11 +1,16 @@ -import { Button } from "primereact/button"; +import { Button } from 'primereact/button'; export const PageFooter = ({ handleSubmit }) => { - return ( - <> -
    -
    - ) -} \ No newline at end of file + ); +}; diff --git a/src/main/cliapp/src/containers/allelesPage/__tests__/AlleleDetailPage.test.js b/src/main/cliapp/src/containers/allelesPage/__tests__/AlleleDetailPage.test.js index 30923065f..81bc130a7 100644 --- a/src/main/cliapp/src/containers/allelesPage/__tests__/AlleleDetailPage.test.js +++ b/src/main/cliapp/src/containers/allelesPage/__tests__/AlleleDetailPage.test.js @@ -1,29 +1,31 @@ -import React from "react"; -import { BrowserRouter } from "react-router-dom/cjs/react-router-dom"; -import { within, screen, waitFor } from "@testing-library/react"; +import React from 'react'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom'; +import { within, screen, waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; import AlleleDetailPage from '../AlleleDetailPage'; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupGetEntityHandler } from "../../../tools/jest/commonMswhandlers"; -import { alleleDetailData } from "../mockData/mockData.js"; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { setupGetEntityHandler } from '../../../tools/jest/commonMswhandlers'; +import { alleleDetailData } from '../mockData/mockData.js'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupGetEntityHandler(alleleDetailData); }); - it("Renders without crashing", async () => { - let result = await renderWithClient(); - + it('Renders without crashing', async () => { + let result = await renderWithClient( + + + + ); + await waitFor(() => { expect(result); }); - }); //Todo: Implement tests //expect the page to still render if there is no allele (probably should have a message) //expect the field to be blank if there is an allele but no taxon - -}); \ No newline at end of file +}); diff --git a/src/main/cliapp/src/containers/allelesPage/__tests__/AllelesTable.test.js b/src/main/cliapp/src/containers/allelesPage/__tests__/AllelesTable.test.js index 61d0da668..001eb8376 100644 --- a/src/main/cliapp/src/containers/allelesPage/__tests__/AllelesTable.test.js +++ b/src/main/cliapp/src/containers/allelesPage/__tests__/AllelesTable.test.js @@ -1,14 +1,19 @@ -import React from "react"; -import { BrowserRouter } from "react-router-dom/cjs/react-router-dom"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { AllelesTable } from "../AllelesTable"; -import "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData.js"; +import { AllelesTable } from '../AllelesTable'; +import '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData.js'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -16,24 +21,35 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { - let result = await renderWithClient(); - + it('Renders without crashing', async () => { + let result = await renderWithClient( + + + + ); + await waitFor(() => { expect(result); }); - }); - it("Contains Correct Table Name", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Name', async () => { + let result = await renderWithClient( + + + + ); const tableTitle = await result.findByText(/Alleles Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("Contains Correct Table Data", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Data', async () => { + let result = await renderWithClient( + + + + ); const modEntityIdTd = await result.findByText(/FB:FBal0196303/i); const nameTd = await result.findByText(/Saccharomyces cerevisiae UAS construct a of Stefancsik/i); @@ -41,7 +57,7 @@ describe("", () => { const secondaryIdsTd = await result.findByText(/FB:FBal0123136/i); const taxonTd = await result.findByText(/Drosophila melanogaster/i); const referencesTd = await result.findByText(/AGRKB:101000000033001/i); - const updatedByCreatedByArray = await result.findAllByText("FB:FB_curator"); + const updatedByCreatedByArray = await result.findAllByText('FB:FB_curator'); const dateUpdatedTd = await result.findByText(/date updated text/i); const dateCreatedTd = await result.findByText(/date created text/i); const alleleDatabaseStatusTd = await result.findByText(/approved/i); @@ -59,4 +75,4 @@ describe("", () => { expect(alleleDatabaseStatusTd).toBeInTheDocument(); }); }); -}); \ No newline at end of file +}); diff --git a/src/main/cliapp/src/containers/allelesPage/alleleGeneAssociations/AlleleGeneAssociationsForm.js b/src/main/cliapp/src/containers/allelesPage/alleleGeneAssociations/AlleleGeneAssociationsForm.js index e91e58a6b..32021c261 100644 --- a/src/main/cliapp/src/containers/allelesPage/alleleGeneAssociations/AlleleGeneAssociationsForm.js +++ b/src/main/cliapp/src/containers/allelesPage/alleleGeneAssociations/AlleleGeneAssociationsForm.js @@ -1,143 +1,143 @@ -import { useRef } from "react"; -import { Button } from "primereact/button"; -import { FormTableWrapper } from "../../../components/FormTableWrapper"; -import { AlleleGeneAssociationsFormTable } from "./AlleleGeneAssociationsFormTable"; -import { addDataKey, generateCurieSearchField } from "../utils"; -import { processOptionalField } from "../../../utils/utils"; +import { useRef } from 'react'; +import { Button } from 'primereact/button'; +import { FormTableWrapper } from '../../../components/FormTableWrapper'; +import { AlleleGeneAssociationsFormTable } from './AlleleGeneAssociationsFormTable'; +import { addDataKey, generateCurieSearchField } from '../utils'; +import { processOptionalField } from '../../../utils/utils'; export const AlleleGeneAssociationsForm = ({ labelColumnSize, state, dispatch }) => { - const tableRef = useRef(null); - const entityType = "alleleGeneAssociations"; - const alleleGeneAssociations = global.structuredClone(state.allele?.[entityType]); - - const createNewGeneAssociationHandler = (e) => { - e.preventDefault(); - const updatedErrorMessages = global.structuredClone(state.entityStates[entityType].errorMessages); - const newAlleleGeneAssociation = { - alleleAssociationSubject: state.allele, - }; - - addDataKey(newAlleleGeneAssociation); - updatedErrorMessages[newAlleleGeneAssociation.dataKey] = {}; - - dispatch({ - type: "ADD_ROW", - row: newAlleleGeneAssociation, - entityType: entityType, - }); - - dispatch({ - type: "UPDATE_TABLE_ERROR_MESSAGES", - entityType: entityType, - errorMessages: updatedErrorMessages - }); - }; - - const onRowEditChange = (e) => { - return null; - }; - - const alleleGeneRelationOnChangeHandler = (props, event) => { - props.editorCallback(event.target.value); - dispatch({ - type: 'EDIT_FILTERABLE_ROW', - entityType: entityType, - dataKey: props.rowData?.dataKey, - field: "relation", - value: event.target.value - }); - }; - - const relatedNoteOnChangeHandler = (value, props) => { - props.editorCallback(value[0]); - dispatch({ - type: 'EDIT_FILTERABLE_ROW', - entityType: entityType, - dataKey: props.rowData?.dataKey, - field: "relatedNote", - value: value[0] - }); - }; - - const geneOnChangeHandler = (event, setFieldValue, props) => { - //updates value in table input box - setFieldValue(event.target.value); - dispatch({ - type: 'EDIT_FILTERABLE_ROW', - entityType: entityType, - dataKey: props.rowData?.dataKey, - field: "alleleGeneAssociationObject", - value: event.target.value - }); - }; - - const evidenceCodeOnChangeHandler = (event, setFieldValue, props) => { - const value = processOptionalField(event.target.value); - setFieldValue(value); - dispatch({ - type: 'EDIT_FILTERABLE_ROW', - entityType: entityType, - dataKey: props.rowData?.dataKey, - field: "evidenceCode", - value: value - }); - }; - - - const evidenceOnChangeHandler = (event, setFieldValue, props) => { - const newEvidence = event.target.value; - const dataKey = props.rowData?.dataKey; - const aga = alleleGeneAssociations.find((aga) => aga.dataKey === dataKey ); - const newAssociation = { - ...aga, - evidence: newEvidence, - evidenceCurieSearchFilter: generateCurieSearchField(newEvidence), - }; - - //updates value in table input box - setFieldValue(newEvidence); - - dispatch({ - type: 'REPLACE_ROW', - entityType: entityType, - dataKey: dataKey, - field: "evidence", - newRow: newAssociation, - }); - }; - - const deletionHandler = (e, dataKey) => { - e.preventDefault(); - const aga = alleleGeneAssociations.find((aga) => aga.dataKey === dataKey ); - const updatedErrorMessages = global.structuredClone(state.entityStates[entityType].errorMessages); - delete updatedErrorMessages[dataKey]; - dispatch({ type: "DELETE_ROW", entityType: entityType, dataKey, id: aga.id }); - dispatch({ type: "UPDATE_TABLE_ERROR_MESSAGES", entityType: entityType, errorMessages: updatedErrorMessages }); - }; - - return ( - - } - tableName="Allele Gene Associations" - showTable={state.entityStates[entityType].show} - button={
    ); - } + }; const createNewDatabaseStatusHandler = (event) => { let cnt = localDatabaseStatuses ? localDatabaseStatuses.length : 0; const _localDatabaseStatuses = global.structuredClone(localDatabaseStatuses); _localDatabaseStatuses.push({ - dataKey : cnt, - internal : false + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -270,45 +282,100 @@ export const DatabaseStatusDialog = ({ const handleDeleteDatabaseStatus = (event, props) => { let _localDatabaseStatuses = global.structuredClone(localDatabaseStatuses); - if(props.dataKey){ + if (props.dataKey) { _localDatabaseStatuses.splice(props.dataKey, 1); - }else { + } else { _localDatabaseStatuses.splice(props.rowIndex, 1); } setLocalDatabaseStatuses(_localDatabaseStatuses); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewFunctionalImpactHandler = (event) => { let cnt = localFunctionalImpacts ? localFunctionalImpacts.length : 0; const _localFunctionalImpacts = global.structuredClone(localFunctionalImpacts); _localFunctionalImpacts.push({ - dataKey : cnt, - internal : false, + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -382,54 +402,116 @@ export const FunctionalImpactsDialog = ({ const handleDeleteFunctionalImpact = (event, props) => { let _localFunctionalImpacts = global.structuredClone(localFunctionalImpacts); - if(props.dataKey){ + if (props.dataKey) { _localFunctionalImpacts.splice(props.dataKey, 1); - }else { + } else { _localFunctionalImpacts.splice(props.rowIndex, 1); } setLocalFunctionalImpacts(_localFunctionalImpacts); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewGermlineTransmissionStatusHandler = (event) => { let cnt = localGermlineTransmissionStatuses ? localGermlineTransmissionStatuses.length : 0; const _localGermlineTransmissionStatuses = global.structuredClone(localGermlineTransmissionStatuses); _localGermlineTransmissionStatuses.push({ - dataKey : cnt, - internal : false + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -270,45 +299,100 @@ export const GermlineTransmissionStatusDialog = ({ const handleDeleteGermlineTransmissionStatus = (event, props) => { let _localGermlineTransmissionStatuses = global.structuredClone(localGermlineTransmissionStatuses); - if(props.dataKey){ + if (props.dataKey) { _localGermlineTransmissionStatuses.splice(props.dataKey, 1); - }else { + } else { _localGermlineTransmissionStatuses.splice(props.rowIndex, 1); } setLocalGermlineTransmissionStatuses(_localGermlineTransmissionStatuses); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewInheritanceModeHandler = (event) => { let cnt = localInheritanceModes ? localInheritanceModes.length : 0; const _localInheritanceModes = global.structuredClone(localInheritanceModes); _localInheritanceModes.push({ - dataKey : cnt, - internal : false, + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -352,54 +364,116 @@ export const InheritanceModesDialog = ({ const handleDeleteInheritanceMode = (event, props) => { let _localInheritanceModes = global.structuredClone(localInheritanceModes); - if(props.dataKey){ + if (props.dataKey) { _localInheritanceModes.splice(props.dataKey, 1); - }else { + } else { _localInheritanceModes.splice(props.rowIndex, 1); } setLocalInheritanceModes(_localInheritanceModes); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewMutationTypeHandler = (event) => { let cnt = localMutationTypes ? localMutationTypes.length : 0; const _localMutationTypes = global.structuredClone(localMutationTypes); _localMutationTypes.push({ - dataKey : cnt, - internal : false, + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -298,44 +303,100 @@ export const MutationTypesDialog = ({ const handleDeleteMutationType = (event, props) => { let _localMutationTypes = global.structuredClone(localMutationTypes); - if(props.dataKey){ + if (props.dataKey) { _localMutationTypes.splice(props.dataKey, 1); - }else { + } else { _localMutationTypes.splice(props.rowIndex, 1); } setLocalMutationTypes(_localMutationTypes); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewNomenclatureEventHandler = (event) => { let cnt = localNomenclatureEvents ? localNomenclatureEvents.length : 0; const _localNomenclatureEvents = global.structuredClone(localNomenclatureEvents); _localNomenclatureEvents.push({ - dataKey : cnt, - internal : false, - obsolete: false + dataKey: cnt, + internal: false, + obsolete: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -289,54 +295,116 @@ export const NomenclatureEventsDialog = ({ const handleDeleteNomenclatureEvent = (event, props) => { let _localNomenclatureEvents = global.structuredClone(localNomenclatureEvents); - if(props.dataKey){ + if (props.dataKey) { _localNomenclatureEvents.splice(props.dataKey, 1); - }else { + } else { _localNomenclatureEvents.splice(props.rowIndex, 1); } setLocalNomenclatureEvents(_localNomenclatureEvents); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; const createNewSecondaryIdHandler = (event) => { let cnt = localSecondaryIds ? localSecondaryIds.length : 0; const _localSecondaryIds = global.structuredClone(localSecondaryIds); _localSecondaryIds.push({ - dataKey : cnt, - internal : false, + dataKey: cnt, + internal: false, }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -254,45 +257,100 @@ export const SecondaryIdsDialog = ({ const handleDeleteSecondaryId = (event, props) => { let _localSecondaryIds = global.structuredClone(localSecondaryIds); - if(props.dataKey){ + if (props.dataKey) { _localSecondaryIds.splice(props.dataKey, 1); - }else { + } else { _localSecondaryIds.splice(props.rowIndex, 1); } setLocalSecondaryIds(_localSecondaryIds); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); diff --git a/src/main/cliapp/src/containers/conditionRelationPage/NewRelationForm.js b/src/main/cliapp/src/containers/conditionRelationPage/NewRelationForm.js index 6283511e9..e95ee5bfe 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/NewRelationForm.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/NewRelationForm.js @@ -1,20 +1,19 @@ -import React, { useRef } from "react"; -import { ConditionRelationService } from "../../service/ConditionRelationService"; -import { Dialog } from "primereact/dialog"; -import { Button } from "primereact/button"; -import { InputText } from "primereact/inputtext"; -import { Dropdown } from "primereact/dropdown"; -import { Toast } from "primereact/toast"; +import React, { useRef } from 'react'; +import { ConditionRelationService } from '../../service/ConditionRelationService'; +import { Dialog } from 'primereact/dialog'; +import { Button } from 'primereact/button'; +import { InputText } from 'primereact/inputtext'; +import { Dropdown } from 'primereact/dropdown'; +import { Toast } from 'primereact/toast'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { AutocompleteEditor } from "../../components/Autocomplete/AutocompleteEditor"; -import { LiteratureAutocompleteTemplate } from "../../components/Autocomplete/LiteratureAutocompleteTemplate"; +import { AutocompleteEditor } from '../../components/Autocomplete/AutocompleteEditor'; +import { LiteratureAutocompleteTemplate } from '../../components/Autocomplete/LiteratureAutocompleteTemplate'; import { ExConAutocompleteTemplate } from '../../components/Autocomplete/ExConAutocompleteTemplate'; -import { FormErrorMessageComponent } from "../../components/Error/FormErrorMessageComponent"; -import { classNames } from "primereact/utils"; -import { autocompleteSearch, buildAutocompleteFilter } from "../../utils/utils"; -import { AutocompleteMultiEditor } from "../../components/Autocomplete/AutocompleteMultiEditor"; -import ErrorBoundary from "../../components/Error/ErrorBoundary"; - +import { FormErrorMessageComponent } from '../../components/Error/FormErrorMessageComponent'; +import { classNames } from 'primereact/utils'; +import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; +import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; +import ErrorBoundary from '../../components/Error/ErrorBoundary'; export const NewRelationForm = ({ newRelationState, @@ -29,12 +28,11 @@ export const NewRelationForm = ({ const toast_error = useRef(null); const { newRelation, errorMessages, submitted, newRelationDialog } = newRelationState; - const hideDialog = () => { - newRelationDispatch({ type: "RESET" }); + newRelationDispatch({ type: 'RESET' }); }; - const mutation = useMutation(newRelation => { + const mutation = useMutation((newRelation) => { if (!conditionRelationService) { conditionRelationService = new ConditionRelationService(); } @@ -43,40 +41,38 @@ export const NewRelationForm = ({ const handleSubmit = (event) => { event.preventDefault(); - newRelationDispatch({ type: "SUBMIT" }); + newRelationDispatch({ type: 'SUBMIT' }); mutation.mutate(newRelation, { onSuccess: (data) => { setNewConditionRelation(data.data.entity, queryClient); toast_success.current.show({ severity: 'success', summary: 'Successful', detail: 'New Relation Added' }); - newRelationDispatch({ type: "RESET" }); + newRelationDispatch({ type: 'RESET' }); }, onError: (error) => { - - const message = - error.response.data.errorMessages.uniqueId ? - "Page Error: New relation is a duplicate of an existing relation" : - error.response.data.errorMessage; + const message = error.response.data.errorMessages.uniqueId + ? 'Page Error: New relation is a duplicate of an existing relation' + : error.response.data.errorMessage; toast_error.current.show([ - { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false } + { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false }, ]); - newRelationDispatch({ type: "UPDATE_ERROR_MESSAGES", errorMessages: error.response.data.errorMessages }); - } + newRelationDispatch({ type: 'UPDATE_ERROR_MESSAGES', errorMessages: error.response.data.errorMessages }); + }, }); }; const onHandleChange = (event) => { newRelationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onRelationChange = (event) => { const name = event.value; newRelationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, value: { name }, }); @@ -85,16 +81,16 @@ export const NewRelationForm = ({ const onReferenceChange = (event, setFieldValue) => { setFieldValue(event.target.value); newRelationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const referenceSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "curieFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'curieFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -103,16 +99,16 @@ export const NewRelationForm = ({ const onConditionsChange = (event, setFieldValue) => { setFieldValue(event.target.value); newRelationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const conditionSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["conditionSummary"]; - const endpoint = "experimental-condition"; - const filterName = "experimentalConditionFilter"; + const autocompleteFields = ['conditionSummary']; + const endpoint = 'experimental-condition'; + const filterName = 'experimentalConditionFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -129,9 +125,17 @@ export const NewRelationForm = ({
    - + -
    +
    @@ -142,51 +146,65 @@ export const NewRelationForm = ({ onChange={onHandleChange} className={classNames({ 'p-invalid': submitted && errorMessages.handle })} /> - +
    - + - } + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} /> - +
    - +
    - } + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onConditionsChange} /> - +
    diff --git a/src/main/cliapp/src/containers/conditionRelationPage/__tests__/ConditionRelationTable.test.js b/src/main/cliapp/src/containers/conditionRelationPage/__tests__/ConditionRelationTable.test.js index 29f458191..b09304c36 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/__tests__/ConditionRelationTable.test.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/__tests__/ConditionRelationTable.test.js @@ -1,15 +1,20 @@ -import React from "react"; -import { act } from "react-dom/test-utils"; -import { within, screen, waitFor } from "@testing-library/react"; -import userEvent from "@testing-library/user-event"; +import React from 'react'; +import { act } from 'react-dom/test-utils'; +import { within, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { renderWithClient } from '../../../tools/jest/utils'; -import { ConditionRelationPage } from "../index"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data, mockSettingsData } from "../mockData/mockData"; +import { ConditionRelationPage } from '../index'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data, mockSettingsData } from '../mockData/mockData'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setLocalStorage('ExperimentsTableSettings', mockSettingsData); setupFindHandler(); @@ -18,26 +23,25 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); - + await waitFor(() => { expect(result); }); }); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Experiments Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("The table contains correct data", async () => { + it('The table contains correct data', async () => { let result = await renderWithClient(); - - const handleTd = await result.findByText("Standard"); + const handleTd = await result.findByText('Standard'); const referenceTd = await result.findByText(/PMID:28806732/i); const relationTd = await result.findByText(/has_condition/i); const exConTd = await result.findByText(/standard conditions/i); @@ -50,8 +54,7 @@ describe("", () => { }); }); - it("Has the same text in edit mode", async () => { - + it('Has the same text in edit mode', async () => { act(() => { renderWithClient(); }); @@ -72,41 +75,44 @@ describe("", () => { let referenceAutocomplete = screen.getByRole('combobox', { name: /singleReference/i }); let relationDropdown = screen.getByRole('button', { name: /has_condition/i }); let experimentalConditionsAutocomplete = screen.getByRole('combobox', { name: /conditions/i }); - + expect(handleInput.value).toEqual('Standard'); - expect(referenceAutocomplete.value).toEqual("PMID:28806732 (ZFIN:ZDB-PUB-170815-1|DOI:10.1371/journal.pgen.1006959|PMCID:PMC5570503|AGRKB:101000000675992)"); - expect(relationDropdown.previousSibling.firstChild.nodeValue).toEqual("has_condition"); - expect(experimentalConditionsAutocomplete.parentElement.previousSibling.firstChild.firstChild.nodeValue).toEqual("standard conditions"); + expect(referenceAutocomplete.value).toEqual( + 'PMID:28806732 (ZFIN:ZDB-PUB-170815-1|DOI:10.1371/journal.pgen.1006959|PMCID:PMC5570503|AGRKB:101000000675992)' + ); + expect(relationDropdown.previousSibling.firstChild.nodeValue).toEqual('has_condition'); + expect(experimentalConditionsAutocomplete.parentElement.previousSibling.firstChild.firstChild.nodeValue).toEqual( + 'standard conditions' + ); }); - - it("Removes columns when corresponding box is checked", async () => { + it('Removes columns when corresponding box is checked', async () => { const user = userEvent.setup(); jest.setTimeout(10000); - + // scrollIntoView needs to be mocked because it's not implemented in jsdom window.HTMLElement.prototype.scrollIntoView = jest.fn(() => {}); - + act(() => { renderWithClient(); }); - - let columnSelect = screen.getByRole('listbox', {name: 'columnToggle'}) - let handleColumn = screen.getByRole('columnheader', {name: /Handle/i}) + + let columnSelect = screen.getByRole('listbox', { name: 'columnToggle' }); + let handleColumn = screen.getByRole('columnheader', { name: /Handle/i }); await waitFor(() => { expect(handleColumn).toBeInTheDocument(); - }) + }); await user.click(columnSelect); let columnToggleOptions = await screen.getAllByText(/Handle/i); let handleOption = columnToggleOptions[2].parentElement.querySelector('.p-checkbox'); - + await act(async () => { await user.click(handleOption); }); - + expect(handleColumn).not.toBeInTheDocument(); }); }); diff --git a/src/main/cliapp/src/containers/conditionRelationPage/index.js b/src/main/cliapp/src/containers/conditionRelationPage/index.js index d4ac9f07d..f510269c7 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/index.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/index.js @@ -1,3 +1,3 @@ -import ConditionRelationPage from "./ConditionRelationPage"; +import ConditionRelationPage from './ConditionRelationPage'; export { ConditionRelationPage }; diff --git a/src/main/cliapp/src/containers/conditionRelationPage/mockData/mockData.js b/src/main/cliapp/src/containers/conditionRelationPage/mockData/mockData.js index aec57db4f..26dbf7729 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/mockData/mockData.js @@ -1,89 +1,88 @@ export const data = { - "results" :[ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-10-28T11:27:34.775467Z", - "dbDateUpdated": "2022-10-28T11:27:34.77547Z", - "id": 16281236, - "uniqueId": "has_condition|Standard|AGRKB:101000000675992|ZECO:0000103", - "conditionRelationType": { - "internal": false, - "obsolete": false, - "id": 7662730, - "name": "has_condition" - }, - "handle": "Standard", - "singleReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-10-24T21:15:21.62045Z", - "dbDateUpdated": "2022-10-24T21:15:21.620452Z", - "curie": "AGRKB:101000000675992", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-08-04T19:32:13.6516Z", - "dbDateUpdated": "2022-08-04T19:32:13.651602Z", - "referencedCurie": "DOI:10.1371/journal.pgen.1006959" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-08-04T19:32:13.652068Z", - "dbDateUpdated": "2022-08-04T19:32:13.652069Z", - "referencedCurie": "PMCID:PMC5570503" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-08-04T19:32:13.652335Z", - "dbDateUpdated": "2022-08-04T19:32:13.652336Z", - "referencedCurie": "PMID:28806732" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-08-04T19:32:13.652721Z", - "dbDateUpdated": "2022-08-04T19:32:13.652722Z", - "referencedCurie": "ZFIN:ZDB-PUB-170815-1" - } - ] - }, - "conditions": [ + results: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2022-10-28T11:27:34.775467Z', + dbDateUpdated: '2022-10-28T11:27:34.77547Z', + id: 16281236, + uniqueId: 'has_condition|Standard|AGRKB:101000000675992|ZECO:0000103', + conditionRelationType: { + internal: false, + obsolete: false, + id: 7662730, + name: 'has_condition', + }, + handle: 'Standard', + singleReference: { + internal: false, + obsolete: false, + dbDateCreated: '2022-10-24T21:15:21.62045Z', + dbDateUpdated: '2022-10-24T21:15:21.620452Z', + curie: 'AGRKB:101000000675992', + crossReferences: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2022-08-04T19:32:13.6516Z', + dbDateUpdated: '2022-08-04T19:32:13.651602Z', + referencedCurie: 'DOI:10.1371/journal.pgen.1006959', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2022-08-04T19:32:13.652068Z', + dbDateUpdated: '2022-08-04T19:32:13.652069Z', + referencedCurie: 'PMCID:PMC5570503', + }, { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-26T16:41:30.923346Z", - "dbDateUpdated": "2022-09-26T16:41:30.923348Z", - "id": 12883083, - "uniqueId": "ZECO:0000103", - "conditionClass": { - "internal": false, - "obsolete": false, - "curie": "ZECO:0000103", - "name": "standard conditions", - "definition": "Experimental condition that is the standard environment for zebrafish husbandry, as described in ‘The Zebrafish Book’. In general the standard environment utilizes contaminant free tank water, heated to 28.5 degrees C, with the fish fed a normal contaminant free diet, with standard osmolarity, pH, and normal light cycle of 14hr light/10hr dark.", - "subsets": [ - "ZECO_0000267" - ] - }, - "conditionSummary": "standard conditions" - } - ] - } - ], - returnedRecords : 1, - totalResults: 1736 - } + internal: false, + obsolete: false, + dbDateCreated: '2022-08-04T19:32:13.652335Z', + dbDateUpdated: '2022-08-04T19:32:13.652336Z', + referencedCurie: 'PMID:28806732', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2022-08-04T19:32:13.652721Z', + dbDateUpdated: '2022-08-04T19:32:13.652722Z', + referencedCurie: 'ZFIN:ZDB-PUB-170815-1', + }, + ], + }, + conditions: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-26T16:41:30.923346Z', + dbDateUpdated: '2022-09-26T16:41:30.923348Z', + id: 12883083, + uniqueId: 'ZECO:0000103', + conditionClass: { + internal: false, + obsolete: false, + curie: 'ZECO:0000103', + name: 'standard conditions', + definition: + 'Experimental condition that is the standard environment for zebrafish husbandry, as described in ‘The Zebrafish Book’. In general the standard environment utilizes contaminant free tank water, heated to 28.5 degrees C, with the fish fed a normal contaminant free diet, with standard osmolarity, pH, and normal light cycle of 14hr light/10hr dark.', + subsets: ['ZECO_0000267'], + }, + conditionSummary: 'standard conditions', + }, + ], + }, + ], + returnedRecords: 1, + totalResults: 1736, +}; export const mockSettingsData = { - "page": 0, - "first": 0, - "rows": 50, - "multiSortMeta": [], - "selectedColumnNames": ["Handle", "Reference", "Relation", "Experimental Conditions"], - "filters": {}, - "tableKeyName": "Experiments", - "tableSettingsKeyName": "ExperimentsTableSettings" + page: 0, + first: 0, + rows: 50, + multiSortMeta: [], + selectedColumnNames: ['Handle', 'Reference', 'Relation', 'Experimental Conditions'], + filters: {}, + tableKeyName: 'Experiments', + tableSettingsKeyName: 'ExperimentsTableSettings', }; diff --git a/src/main/cliapp/src/containers/conditionRelationPage/useNewRelationReducer.js b/src/main/cliapp/src/containers/conditionRelationPage/useNewRelationReducer.js index ff436f7ce..e36cfb53e 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/useNewRelationReducer.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/useNewRelationReducer.js @@ -1,12 +1,12 @@ -import { useImmerReducer } from "use-immer"; +import { useImmerReducer } from 'use-immer'; const initialNewRelationState = { newRelation: { - handle: "", + handle: '', singleReference: { - curie: "", + curie: '', }, - conditionRelationType: {name: ""}, + conditionRelationType: { name: '' }, conditions: [], }, errorMessages: {}, @@ -35,11 +35,11 @@ const newRelationReducer = (draft, action) => { draft.newRelationDialog = true; break; default: - throw Error('Unknown action: ' + action.type); + throw Error('Unknown action: ' + action.type); } }; export const useNewRelationReducer = () => { const [newRelationState, newRelationDispatch] = useImmerReducer(newRelationReducer, initialNewRelationState); - return {newRelationState, newRelationDispatch}; -} + return { newRelationState, newRelationDispatch }; +}; diff --git a/src/main/cliapp/src/containers/constructsPage/ComponentsDialog.js b/src/main/cliapp/src/containers/constructsPage/ComponentsDialog.js index cc3e3d8be..8a0daae4f 100644 --- a/src/main/cliapp/src/containers/constructsPage/ComponentsDialog.js +++ b/src/main/cliapp/src/containers/constructsPage/ComponentsDialog.js @@ -14,10 +14,10 @@ export const ComponentsDialog = ({ originalComponentsData, setOriginalComponentsData, errorMessagesMainRow, - setErrorMessagesMainRow + setErrorMessagesMainRow, }) => { const { originalComponents, dialog } = originalComponentsData; - const [localComponents, setLocalComponents] = useState(null) ; + const [localComponents, setLocalComponents] = useState(null); const tableRef = useRef(null); const [relatedNotesData, setRelatedNotesData] = useState({ @@ -46,14 +46,14 @@ export const ComponentsDialog = ({ const cloneComponents = (clonableComponents) => { let _clonableComponents = global.structuredClone(clonableComponents); - if(_clonableComponents) { - let counter = 0 ; + if (_clonableComponents) { + let counter = 0; _clonableComponents.forEach((note) => { note.dataKey = counter++; }); } else { _clonableComponents = []; - }; + } return _clonableComponents; }; @@ -63,88 +63,123 @@ export const ComponentsDialog = ({ const handleRelatedNotesOpen = (event, rowData, isInEdit) => { let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = rowData.relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = isInEdit; + _relatedNotesData['originalRelatedNotes'] = rowData.relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = isInEdit; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; const relatedNotesTemplate = (rowData) => { if (rowData?.relatedNotes) { return ( - - ) + ); } }; const componentSymbolTemplate = (rowData) => { return ( <> -
    +
    - ) - } + ); + }; const taxonTextTemplate = (rowData) => { return ( <> -
    +
    - ) - } + ); + }; const taxonTemplate = (rowData) => { if (rowData?.taxon) { return ( <> - + {rowData.taxon.name} ({rowData.taxon.curie}) - + ); } - } + }; - let headerGroup = - - - - - - - - - - ; + let headerGroup = ( + + + + + + + + + + + + ); return ( <>
    - +

    Components

    - - - - - - - evidenceTemplate(rowData)}/> - + + + + + + + evidenceTemplate(rowData)} + /> +
    @@ -153,7 +188,7 @@ export const ComponentsDialog = ({ setOriginalRelatedNotesData={setRelatedNotesData} errorMessagesMainRow={errorMessagesMainRow} setErrorMessagesMainRow={setErrorMessagesMainRow} - noteTypeVocabularyTermSet='construct_component_note_type' + noteTypeVocabularyTermSet="construct_component_note_type" /> ); diff --git a/src/main/cliapp/src/containers/constructsPage/ConstructsPage.js b/src/main/cliapp/src/containers/constructsPage/ConstructsPage.js index c4943520e..d7c283667 100644 --- a/src/main/cliapp/src/containers/constructsPage/ConstructsPage.js +++ b/src/main/cliapp/src/containers/constructsPage/ConstructsPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { ConstructsTable } from './ConstructsTable'; function ConstructsPage() { - return ( - - ); + return ; } -export default ConstructsPage; \ No newline at end of file +export default ConstructsPage; diff --git a/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js b/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js index a6bccefd2..5bfc45f21 100644 --- a/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js +++ b/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js @@ -20,20 +20,19 @@ import { TruncatedReferencesTemplate } from '../../components/Templates/referenc import { SearchService } from '../../service/SearchService'; export const ConstructsTable = () => { - const toast_topleft = useRef(null); const toast_topright = useRef(null); const [synonymsData, setSynonymsData] = useState({ - dialog: false + dialog: false, }); const [symbolData, setSymbolData] = useState({ - dialog: false + dialog: false, }); const [fullNameData, setFullNameData] = useState({ - dialog: false + dialog: false, }); const [isInEditMode, setIsInEditMode] = useState(false); @@ -42,10 +41,10 @@ export const ConstructsTable = () => { const [constructs, setConstructs] = useState([]); const searchService = new SearchService(); - + const errorMessagesRef = useRef(); errorMessagesRef.current = errorMessages; - + const [componentsData, setComponentsData] = useState({ isInEdit: false, dialog: false, @@ -62,238 +61,252 @@ export const ConstructsTable = () => { const handleFullNameOpen = (constructFullName) => { let _fullNameData = {}; - _fullNameData["originalFullNames"] = [constructFullName]; - _fullNameData["dialog"] = true; + _fullNameData['originalFullNames'] = [constructFullName]; + _fullNameData['dialog'] = true; setFullNameData(() => ({ - ..._fullNameData + ..._fullNameData, })); }; const handleSynonymsOpen = (constructSynonyms) => { let _synonymsData = {}; - _synonymsData["originalSynonyms"] = constructSynonyms; - _synonymsData["dialog"] = true; + _synonymsData['originalSynonyms'] = constructSynonyms; + _synonymsData['dialog'] = true; setSynonymsData(() => ({ - ..._synonymsData + ..._synonymsData, })); }; const handleSymbolOpen = (constructSymbol) => { let _symbolData = {}; - _symbolData["originalSymbols"] = [constructSymbol]; - _symbolData["dialog"] = true; + _symbolData['originalSymbols'] = [constructSymbol]; + _symbolData['dialog'] = true; setSymbolData(() => ({ - ..._symbolData + ..._symbolData, })); }; - + const handleComponentsOpen = (constructComponents) => { let _componentsData = {}; - _componentsData["originalComponents"] = constructComponents; - _componentsData["dialog"] = true; + _componentsData['originalComponents'] = constructComponents; + _componentsData['dialog'] = true; setComponentsData(() => ({ - ..._componentsData + ..._componentsData, })); }; - + const handleGenomicComponentsOpen = (constructGenomicEntityAssociations) => { let _componentsData = {}; - _componentsData["originalComponents"] = constructGenomicEntityAssociations; - _componentsData["dialog"] = true; + _componentsData['originalComponents'] = constructGenomicEntityAssociations; + _componentsData['dialog'] = true; setGenomicComponentsData(() => ({ - ..._componentsData + ..._componentsData, })); }; const getComponentsTextString = (item) => { - let relationName = ""; + let relationName = ''; if (item?.relation?.name) { relationName = item.relation.name; if (relationName.indexOf(' (RO:') !== -1) { - relationName = relationName.substring(0, relationName.indexOf(' (RO:')) + relationName = relationName.substring(0, relationName.indexOf(' (RO:')); } - } + } return relationName + ': ' + item.componentSymbol; }; const getComponentsAssociationTextString = (item) => { - let symbolValue = ""; - if (item?.constructGenomicEntityAssociationObject?.geneSymbol || item?.constructGenomicEntityAssociationObject?.alleleSymbol) { - symbolValue = item.constructGenomicEntityAssociationObject.geneSymbol ? item.constructGenomicEntityAssociationObject.geneSymbol.displayText : item.constructGenomicEntityAssociationObject.alleleSymbol.displayText; + let symbolValue = ''; + if ( + item?.constructGenomicEntityAssociationObject?.geneSymbol || + item?.constructGenomicEntityAssociationObject?.alleleSymbol + ) { + symbolValue = item.constructGenomicEntityAssociationObject.geneSymbol + ? item.constructGenomicEntityAssociationObject.geneSymbol.displayText + : item.constructGenomicEntityAssociationObject.alleleSymbol.displayText; } else if (item?.constructGenomicEntityAssociationObject?.name) { symbolValue = item.constructGenomicEntityAssociationObject.name; } else { symbolValue = item.constructGenomicEntityAssociationObject.curie; } - let relationName = ""; + let relationName = ''; if (item?.relation?.name) { relationName = item.relation.name; if (relationName.indexOf(' (RO:') !== -1) { - relationName = relationName.substring(0, relationName.indexOf(' (RO:')) + relationName = relationName.substring(0, relationName.indexOf(' (RO:')); } } return relationName + ': ' + symbolValue; - } + }; const columns = [ { - field: "uniqueId", - header: "Unique ID", + field: 'uniqueId', + header: 'Unique ID', sortable: { isInEditMode }, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, }, { - field: "modEntityId", - header: "MOD Entity ID", + field: 'modEntityId', + header: 'MOD Entity ID', sortable: { isInEditMode }, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { - field: "modInternalId", - header: "MOD Internal ID", + field: 'modInternalId', + header: 'MOD Internal ID', sortable: { isInEditMode }, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { - field: "constructSymbol.displayText", - header: "Symbol", + field: 'constructSymbol.displayText', + header: 'Symbol', sortable: true, - body: (rowData) => , + body: (rowData) => ( + + ), filter: true, - filterConfig: FILTER_CONFIGS.constructSymbolFilterConfig + filterConfig: FILTER_CONFIGS.constructSymbolFilterConfig, }, { - field: "constructFullName.displayText", - header: "Name", + field: 'constructFullName.displayText', + header: 'Name', sortable: true, filter: true, - body: (rowData) => , - filterConfig: FILTER_CONFIGS.constructNameFilterConfig + body: (rowData) => ( + + ), + filterConfig: FILTER_CONFIGS.constructNameFilterConfig, }, { - field: "constructSynonyms.displayText", - header: "Synonyms", - body: (rowData) => entity?.displayText} - underline={false} - />, + field: 'constructSynonyms.displayText', + header: 'Synonyms', + body: (rowData) => ( + entity?.displayText} + underline={false} + /> + ), sortable: true, - filterConfig: FILTER_CONFIGS.constructSynonymsFilterConfig + filterConfig: FILTER_CONFIGS.constructSynonymsFilterConfig, }, { - field: "secondaryIdentifiers", - header: "Secondary IDs", + field: 'secondaryIdentifiers', + header: 'Secondary IDs', sortable: true, filterConfig: FILTER_CONFIGS.secondaryIdsFilterConfig, - body: (rowData) => + body: (rowData) => , }, { - field: "constructComponents.componentSymbol", - header: "Free Text Components", - body: (rowData) => , + field: 'constructComponents.componentSymbol', + header: 'Free Text Components', + body: (rowData) => ( + + ), sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.constructComponentsFilterConfig, }, { - field: "constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol", - header: "Component Associations", - body: (rowData) => , + field: 'constructGenomicEntityAssociations.constructGenomicEntityAssociationObject.symbol', + header: 'Component Associations', + body: (rowData) => ( + + ), sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.constructGenomicComponentsFilterConfig, }, { - field: "references.primaryCrossReferenceCurie", - header: "References", - body: (rowData) => , + field: 'references.primaryCrossReferenceCurie', + header: 'References', + body: (rowData) => , sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.referencesFilterConfig, }, { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.constructDataProviderFilterConfig, }, { - field: "updatedBy.uniqueId", - header: "Updated By", + field: 'updatedBy.uniqueId', + header: 'Updated By', sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { - field: "dateUpdated", - header: "Date Updated", + field: 'dateUpdated', + header: 'Date Updated', sortable: { isInEditMode }, filter: true, - filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig + filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { - field: "createdBy.uniqueId", - header: "Created By", + field: 'createdBy.uniqueId', + header: 'Created By', sortable: { isInEditMode }, filter: true, - filterConfig: FILTER_CONFIGS.createdByFilterConfig + filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { - field: "dateCreated", - header: "Date Created", + field: 'dateCreated', + header: 'Date Created', sortable: { isInEditMode }, filter: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { - field: "internal", - header: "Internal", - body: (rowData) => , + field: 'internal', + header: 'Internal', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.internalFilterConfig, - sortable: { isInEditMode } + sortable: { isInEditMode }, }, { - field: "obsolete", - header: "Obsolete", - body: (rowData) => , + field: 'obsolete', + header: 'Obsolete', + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, - sortable: { isInEditMode } - } + sortable: { isInEditMode }, + }, ]; const DEFAULT_COLUMN_WIDTH = 10; - const SEARCH_ENDPOINT = "construct"; + const SEARCH_ENDPOINT = 'construct'; - const initialTableState = getDefaultTableState("Constructs", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('Constructs', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isFetching, isLoading } = useGetTableData({ tableState, @@ -302,7 +315,7 @@ export const ConstructsTable = () => { setEntities: setConstructs, setTotalRecords, toast_topleft, - searchService + searchService, }); return ( @@ -325,8 +338,8 @@ export const ConstructsTable = () => { hasDetails={false} isInEditMode={isInEditMode} setIsInEditMode={setIsInEditMode} - toasts={{toast_topleft, toast_topright }} - errorObject = {{errorMessages, setErrorMessages}} + toasts={{ toast_topleft, toast_topright }} + errorObject={{ errorMessages, setErrorMessages }} defaultColumnWidth={DEFAULT_COLUMN_WIDTH} fetching={isFetching || isLoading} /> diff --git a/src/main/cliapp/src/containers/constructsPage/GenomicComponentsDialog.js b/src/main/cliapp/src/containers/constructsPage/GenomicComponentsDialog.js index 5704e62aa..3d329acd6 100644 --- a/src/main/cliapp/src/containers/constructsPage/GenomicComponentsDialog.js +++ b/src/main/cliapp/src/containers/constructsPage/GenomicComponentsDialog.js @@ -15,10 +15,10 @@ export const GenomicComponentsDialog = ({ originalComponentsData, setOriginalComponentsData, errorMessagesMainRow, - setErrorMessagesMainRow + setErrorMessagesMainRow, }) => { const { originalComponents, dialog } = originalComponentsData; - const [localComponents, setLocalComponents] = useState(null) ; + const [localComponents, setLocalComponents] = useState(null); const tableRef = useRef(null); const [relatedNotesData, setRelatedNotesData] = useState({ @@ -47,14 +47,14 @@ export const GenomicComponentsDialog = ({ const cloneComponents = (clonableComponents) => { let _clonableComponents = global.structuredClone(clonableComponents); - if(_clonableComponents) { - let counter = 0 ; + if (_clonableComponents) { + let counter = 0; _clonableComponents.forEach((note) => { note.dataKey = counter++; }); } else { _clonableComponents = []; - }; + } return _clonableComponents; }; @@ -68,79 +68,116 @@ export const GenomicComponentsDialog = ({ const handleRelatedNotesOpen = (event, rowData, isInEdit) => { let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = rowData.relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = isInEdit; + _relatedNotesData['originalRelatedNotes'] = rowData.relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = isInEdit; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; const relatedNotesTemplate = (rowData) => { if (rowData?.relatedNotes) { return ( - - ) + ); } }; const componentTemplate = (rowData) => { - let componentDisplayValue = ""; - if (rowData.constructGenomicEntityAssociationObject.geneSymbol || rowData.constructGenomicEntityAssociationObject.alleleSymbol) { - let symbolValue = rowData.constructGenomicEntityAssociationObject.geneSymbol ? rowData.constructGenomicEntityAssociationObject.geneSymbol.displayText : rowData.constructGenomicEntityAssociationObject.alleleSymbol.displayText; + let componentDisplayValue = ''; + if ( + rowData.constructGenomicEntityAssociationObject.geneSymbol || + rowData.constructGenomicEntityAssociationObject.alleleSymbol + ) { + let symbolValue = rowData.constructGenomicEntityAssociationObject.geneSymbol + ? rowData.constructGenomicEntityAssociationObject.geneSymbol.displayText + : rowData.constructGenomicEntityAssociationObject.alleleSymbol.displayText; componentDisplayValue = symbolValue + ' (' + getIdentifier(rowData.constructGenomicEntityAssociationObject) + ')'; } else if (rowData.constructGenomicEntityAssociationObject.name) { - componentDisplayValue = rowData.constructGenomicEntityAssociationObject.name + ' (' + getIdentifier(rowData.constructGenomicEntityAssociationObject) + ')'; + componentDisplayValue = + rowData.constructGenomicEntityAssociationObject.name + + ' (' + + getIdentifier(rowData.constructGenomicEntityAssociationObject) + + ')'; } else { componentDisplayValue = getIdentifier(rowData.constructGenomicEntityAssociationObject); } return ( <> -
    +
    - ) - } + ); + }; - let headerGroup = - - - - - - - - - - - - - ; + let headerGroup = ( + + + + + + + + + + + + + + + ); return ( <>
    - +

    Component Associations

    - - - - - evidenceTemplate(rowData)}/> - - - - - - + + + + + evidenceTemplate(rowData)} + /> + + + + + +
    @@ -149,7 +186,7 @@ export const GenomicComponentsDialog = ({ setOriginalRelatedNotesData={setRelatedNotesData} errorMessagesMainRow={errorMessagesMainRow} setErrorMessagesMainRow={setErrorMessagesMainRow} - noteTypeVocabularyTermSet='construct_component_note_type' + noteTypeVocabularyTermSet="construct_component_note_type" /> ); diff --git a/src/main/cliapp/src/containers/constructsPage/__tests__/ConstructsTable.test.js b/src/main/cliapp/src/containers/constructsPage/__tests__/ConstructsTable.test.js index 36c781d92..226042644 100644 --- a/src/main/cliapp/src/containers/constructsPage/__tests__/ConstructsTable.test.js +++ b/src/main/cliapp/src/containers/constructsPage/__tests__/ConstructsTable.test.js @@ -1,14 +1,19 @@ -import React from "react"; -import { BrowserRouter } from "react-router-dom/cjs/react-router-dom"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { ConstructsTable } from "../ConstructsTable"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData.js"; +import { ConstructsTable } from '../ConstructsTable'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData.js'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -16,28 +21,39 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { - let result = await renderWithClient(); - + it('Renders without crashing', async () => { + let result = await renderWithClient( + + + + ); + await waitFor(() => { expect(result); }); - }); - it("Contains Correct Table Name", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Name', async () => { + let result = await renderWithClient( + + + + ); const tableTitle = await result.findByText(/Constructs Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("Contains Correct Table Data", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Data', async () => { + let result = await renderWithClient( + + + + ); const modEntityTd = await result.findByText(/WB:WBCnstr00000001/i); const referencesTd = await result.findByText(/PMID:17486083/i); - const updatedByCreatedByArray = await result.findAllByText("WB:curator"); + const updatedByCreatedByArray = await result.findAllByText('WB:curator'); const dateCreatedTd = await result.findByText(/2010-01-02T00:00:00Z/i); const dateUpdatedTd = await result.findByText(/2012-08-03T01:00:00\+01:00/i); const constructComponentTd = await result.findByText(/egl19/i); @@ -59,4 +75,4 @@ describe("", () => { expect(constructGenomicComponentTd).toBeInTheDocument(); }); }); -}); \ No newline at end of file +}); diff --git a/src/main/cliapp/src/containers/constructsPage/index.js b/src/main/cliapp/src/containers/constructsPage/index.js index 5160c1986..43aca220a 100644 --- a/src/main/cliapp/src/containers/constructsPage/index.js +++ b/src/main/cliapp/src/containers/constructsPage/index.js @@ -1,3 +1,3 @@ -import ConstructsPage from "./ConstructsPage"; +import ConstructsPage from './ConstructsPage'; -export { ConstructsPage }; \ No newline at end of file +export { ConstructsPage }; diff --git a/src/main/cliapp/src/containers/constructsPage/mockData/mockData.js b/src/main/cliapp/src/containers/constructsPage/mockData/mockData.js index 58773db58..d59d1b9f7 100644 --- a/src/main/cliapp/src/containers/constructsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/constructsPage/mockData/mockData.js @@ -1,833 +1,839 @@ export const data = { - "results" :[ - { - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" + results: [ + { + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + dateCreated: '2010-01-02T00:00:00Z', + dateUpdated: '2012-08-03T01:00:00+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.459381+01:00', + dbDateUpdated: '2023-09-21T22:32:31.311836+01:00', + id: 133503943, + uniqueId: 'WBCnstr00000001', + modEntityId: 'WB:WBCnstr00000001', + dataProvider: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.404006+01:00', + dbDateUpdated: '2023-09-21T22:32:31.318449+01:00', + id: 133503942, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, + }, + crossReference: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.385011+01:00', + dbDateUpdated: '2023-09-21T22:32:31.316107+01:00', + id: 133503941, + referencedCurie: 'WB:WBCnstr00000001', + displayName: 'WBCnstr00000001', + resourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.612125Z', + dbDateUpdated: '2023-08-27T22:00:03.835967+01:00', + id: 41750793, + name: 'construct', + urlTemplate: 'https://www.wormbase.org/db/get?name=[%s];class=Construct', + }, + }, + }, + references: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2022-11-16T19:20:52.352997Z', + dbDateUpdated: '2022-11-16T19:20:52.352997Z', + curie: 'AGRKB:101000000622406', + crossReferences: [ + { + internal: false, + obsolete: false, + id: 74148673, + referencedCurie: 'DOI:10.1038/nbt1305', + displayName: 'DOI:10.1038/nbt1305', + }, + { + internal: false, + obsolete: false, + id: 73235497, + referencedCurie: 'WB:WBPaper00029359', + displayName: 'WB:WBPaper00029359', + }, + { + internal: false, + obsolete: false, + id: 74148674, + referencedCurie: 'PMID:17486083', + displayName: 'PMID:17486083', + }, + ], + }, + ], + constructComponents: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T22:32:31.43525+01:00', + dbDateUpdated: '2023-09-21T22:32:31.435267+01:00', + id: 133891213, + evidence: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.347804+01:00', + dbDateUpdated: '2023-09-21T17:58:44.347819+01:00', + curie: 'AGRKB:101000000628628', + crossReferences: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.327516+01:00', + dbDateUpdated: '2023-09-21T17:58:44.327526+01:00', + id: 133530293, + referencedCurie: 'DOI:10.1093/glycob/cwt051', + displayName: 'DOI:10.1093/glycob/cwt051', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.334878+01:00', + dbDateUpdated: '2023-09-21T17:58:44.334886+01:00', + id: 133530294, + referencedCurie: 'PMCID:PMC3766279', + displayName: 'PMCID:PMC3766279', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.341117+01:00', + dbDateUpdated: '2023-09-21T17:58:44.341125+01:00', + id: 133530295, + referencedCurie: 'PMID:23836288', + displayName: 'PMID:23836288', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.346638+01:00', + dbDateUpdated: '2023-09-21T17:58:44.346645+01:00', + id: 133530296, + referencedCurie: 'WB:WBPaper00042571', + displayName: 'WB:WBPaper00042571', + }, + ], + shortCitation: ' (2013) Glycobiology 23(10):1142-51', + }, + ], + componentSymbol: 'egl19', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:6239', + name: 'Caenorhabditis elegans', + }, + taxonText: 'Caenorhabditis elegans', + relatedNotes: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T22:32:31.413938+01:00', + dbDateUpdated: '2023-09-21T22:32:31.41395+01:00', + id: 133891212, + freeText: 'egl-19 test note', + noteType: { + internal: false, + obsolete: false, + id: 133503921, + name: 'construct_component_note', + }, + }, + ], + relation: { + createdBy: { + dateCreated: '2022-05-03T18:33:16.445309Z', + dateUpdated: '2022-05-03T18:33:16.445322Z', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817Z', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, + }, + }, + updatedBy: { + dateCreated: '2022-05-03T18:33:16.445309Z', + dateUpdated: '2022-05-03T18:33:16.445322Z', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817Z', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, + }, + }, + dateCreated: '2023-07-30T10:53:52.886357Z', + dateUpdated: '2023-07-30T10:53:52.904425Z', + internal: false, + obsolete: false, + dbDateCreated: '2023-07-30T10:53:52.916444Z', + dbDateUpdated: '2023-07-30T10:53:52.916445Z', + id: 105723958, + name: 'is_regulated_by (RO:0002334)', + definition: 'Indicates that the construct is regulated by the indicated GenomicEntity', + }, + }, + ], + constructSymbol: { + internal: false, + obsolete: false, + id: 134095430, + nameType: { + internal: false, + obsolete: false, + id: 20308690, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" + formatText: 'KP273', + displayText: 'KP273', + }, + constructFullName: { + internal: false, + obsolete: false, + id: 13423325252, + nameType: { + internal: false, + obsolete: false, + id: 20308691, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', }, - "dateCreated": "2010-01-02T00:00:00Z", - "dateUpdated": "2012-08-03T01:00:00+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.459381+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.311836+01:00", - "id": 133503943, - "uniqueId": "WBCnstr00000001", - "modEntityId": "WB:WBCnstr00000001", - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.404006+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.318449+01:00", - "id": 133503942, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } + formatText: 'King Potato 273', + displayText: 'King Potato 273', + }, + constructSynonyms: [ + { + internal: false, + obsolete: false, + id: 134024230, + nameType: { + internal: false, + obsolete: false, + id: 20308692, + name: 'systematic_name', + definition: 'A systematic name: e.g., CG48891.', }, - "crossReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.385011+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.316107+01:00", - "id": 133503941, - "referencedCurie": "WB:WBCnstr00000001", - "displayName": "WBCnstr00000001", - "resourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.612125Z", - "dbDateUpdated": "2023-08-27T22:00:03.835967+01:00", - "id": 41750793, - "name": "construct", - "urlTemplate": "https://www.wormbase.org/db/get?name=[%s];class=Construct" - } - } + formatText: 'KPot273', + displayText: 'KPot273', }, - "references": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-16T19:20:52.352997Z", - "dbDateUpdated": "2022-11-16T19:20:52.352997Z", - "curie": "AGRKB:101000000622406", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "id": 74148673, - "referencedCurie": "DOI:10.1038/nbt1305", - "displayName": "DOI:10.1038/nbt1305" + ], + constructGenomicEntityAssociations: [ + { + internal: false, + obsolete: false, + id: 135641224, + constructAssociationSubject: { + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + dateCreated: '2010-01-02T00:00:00Z', + dateUpdated: '2012-08-03T01:00:00+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.459381+01:00', + dbDateUpdated: '2023-09-21T22:32:31.311836+01:00', + id: 133503943, + uniqueId: 'WBCnstr00000001', + modEntityId: 'WB:WBCnstr00000001', + dataProvider: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.404006+01:00', + dbDateUpdated: '2023-09-21T22:32:31.318449+01:00', + id: 133503942, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, - { - "internal": false, - "obsolete": false, - "id": 73235497, - "referencedCurie": "WB:WBPaper00029359", - "displayName": "WB:WBPaper00029359" + crossReference: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:51:29.385011+01:00', + dbDateUpdated: '2023-09-21T22:32:31.316107+01:00', + id: 133503941, + referencedCurie: 'WB:WBCnstr00000001', + displayName: 'WBCnstr00000001', + resourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.612125Z', + dbDateUpdated: '2023-08-27T22:00:03.835967+01:00', + id: 41750793, + name: 'construct', + urlTemplate: 'https://www.wormbase.org/db/get?name=[%s];class=Construct', + }, }, + }, + references: [ { - "internal": false, - "obsolete": false, - "id": 74148674, - "referencedCurie": "PMID:17486083", - "displayName": "PMID:17486083" - } - ] - } - ], - "constructComponents": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T22:32:31.43525+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.435267+01:00", - "id": 133891213, - "evidence": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.347804+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.347819+01:00", - "curie": "AGRKB:101000000628628", - "crossReferences": [ + internal: false, + obsolete: false, + dbDateCreated: '2022-11-16T19:20:52.352997Z', + dbDateUpdated: '2022-11-16T19:20:52.352997Z', + curie: 'AGRKB:101000000622406', + crossReferences: [ { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.327516+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.327526+01:00", - "id": 133530293, - "referencedCurie": "DOI:10.1093/glycob/cwt051", - "displayName": "DOI:10.1093/glycob/cwt051" + internal: false, + obsolete: false, + id: 74148673, + referencedCurie: 'DOI:10.1038/nbt1305', + displayName: 'DOI:10.1038/nbt1305', }, { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.334878+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.334886+01:00", - "id": 133530294, - "referencedCurie": "PMCID:PMC3766279", - "displayName": "PMCID:PMC3766279" + internal: false, + obsolete: false, + id: 73235497, + referencedCurie: 'WB:WBPaper00029359', + displayName: 'WB:WBPaper00029359', }, { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.341117+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.341125+01:00", - "id": 133530295, - "referencedCurie": "PMID:23836288", - "displayName": "PMID:23836288" + internal: false, + obsolete: false, + id: 74148674, + referencedCurie: 'PMID:17486083', + displayName: 'PMID:17486083', }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.346638+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.346645+01:00", - "id": 133530296, - "referencedCurie": "WB:WBPaper00042571", - "displayName": "WB:WBPaper00042571" - } ], - "shortCitation": " (2013) Glycobiology 23(10):1142-51" - } + }, ], - "componentSymbol": "egl19", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:6239", - "name": "Caenorhabditis elegans" - }, - "taxonText": "Caenorhabditis elegans", - "relatedNotes": [ + constructComponents: [ { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T22:32:31.413938+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.41395+01:00", - "id": 133891212, - "freeText": "egl-19 test note", - "noteType": { - "internal": false, - "obsolete": false, - "id": 133503921, - "name": "construct_component_note" - } - } - ], - "relation": { - "createdBy": { - "dateCreated": "2022-05-03T18:33:16.445309Z", - "dateUpdated": "2022-05-03T18:33:16.445322Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817Z", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } - }, - "updatedBy": { - "dateCreated": "2022-05-03T18:33:16.445309Z", - "dateUpdated": "2022-05-03T18:33:16.445322Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817Z", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } - }, - "dateCreated": "2023-07-30T10:53:52.886357Z", - "dateUpdated": "2023-07-30T10:53:52.904425Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-07-30T10:53:52.916444Z", - "dbDateUpdated": "2023-07-30T10:53:52.916445Z", - "id": 105723958, - "name": "is_regulated_by (RO:0002334)", - "definition": "Indicates that the construct is regulated by the indicated GenomicEntity" - } - } - ], - "constructSymbol": { - "internal": false, - "obsolete": false, - "id": 134095430, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308690, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." - }, - "formatText": "KP273", - "displayText": "KP273" - }, - "constructFullName": { - "internal": false, - "obsolete": false, - "id": 13423325252, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308691, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." - }, - "formatText": "King Potato 273", - "displayText": "King Potato 273" - }, - "constructSynonyms": [ - { - "internal": false, - "obsolete": false, - "id": 134024230, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308692, - "name": "systematic_name", - "definition": "A systematic name: e.g., CG48891." - }, - "formatText": "KPot273", - "displayText": "KPot273" - } - ], - "constructGenomicEntityAssociations": [ - { - "internal": false, - "obsolete": false, - "id": 135641224, - "constructAssociationSubject": { - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" - }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" - }, - "dateCreated": "2010-01-02T00:00:00Z", - "dateUpdated": "2012-08-03T01:00:00+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.459381+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.311836+01:00", - "id": 133503943, - "uniqueId": "WBCnstr00000001", - "modEntityId": "WB:WBCnstr00000001", - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.404006+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.318449+01:00", - "id": 133503942, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T22:32:31.43525+01:00', + dbDateUpdated: '2023-09-21T22:32:31.435267+01:00', + id: 133891213, + evidence: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.347804+01:00', + dbDateUpdated: '2023-09-21T17:58:44.347819+01:00', + curie: 'AGRKB:101000000628628', + crossReferences: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.327516+01:00', + dbDateUpdated: '2023-09-21T17:58:44.327526+01:00', + id: 133530293, + referencedCurie: 'DOI:10.1093/glycob/cwt051', + displayName: 'DOI:10.1093/glycob/cwt051', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.334878+01:00', + dbDateUpdated: '2023-09-21T17:58:44.334886+01:00', + id: 133530294, + referencedCurie: 'PMCID:PMC3766279', + displayName: 'PMCID:PMC3766279', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.341117+01:00', + dbDateUpdated: '2023-09-21T17:58:44.341125+01:00', + id: 133530295, + referencedCurie: 'PMID:23836288', + displayName: 'PMID:23836288', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T17:58:44.346638+01:00', + dbDateUpdated: '2023-09-21T17:58:44.346645+01:00', + id: 133530296, + referencedCurie: 'WB:WBPaper00042571', + displayName: 'WB:WBPaper00042571', + }, + ], + shortCitation: ' (2013) Glycobiology 23(10):1142-51', + }, + ], + componentSymbol: 'egl19', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:6239', + name: 'Caenorhabditis elegans', }, - "crossReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:51:29.385011+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.316107+01:00", - "id": 133503941, - "referencedCurie": "WB:WBCnstr00000001", - "displayName": "WBCnstr00000001", - "resourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.612125Z", - "dbDateUpdated": "2023-08-27T22:00:03.835967+01:00", - "id": 41750793, - "name": "construct", - "urlTemplate": "https://www.wormbase.org/db/get?name=[%s];class=Construct" - } - } - }, - "references": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-16T19:20:52.352997Z", - "dbDateUpdated": "2022-11-16T19:20:52.352997Z", - "curie": "AGRKB:101000000622406", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "id": 74148673, - "referencedCurie": "DOI:10.1038/nbt1305", - "displayName": "DOI:10.1038/nbt1305" - }, - { - "internal": false, - "obsolete": false, - "id": 73235497, - "referencedCurie": "WB:WBPaper00029359", - "displayName": "WB:WBPaper00029359" + taxonText: 'Caenorhabditis elegans', + relatedNotes: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-21T22:32:31.413938+01:00', + dbDateUpdated: '2023-09-21T22:32:31.41395+01:00', + id: 133891212, + freeText: 'egl-19 test note', + noteType: { + internal: false, + obsolete: false, + id: 133503921, + name: 'construct_component_note', }, - { - "internal": false, - "obsolete": false, - "id": 74148674, - "referencedCurie": "PMID:17486083", - "displayName": "PMID:17486083" - } - ] - } - ], - "constructComponents": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T22:32:31.43525+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.435267+01:00", - "id": 133891213, - "evidence": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.347804+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.347819+01:00", - "curie": "AGRKB:101000000628628", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.327516+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.327526+01:00", - "id": 133530293, - "referencedCurie": "DOI:10.1093/glycob/cwt051", - "displayName": "DOI:10.1093/glycob/cwt051" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.334878+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.334886+01:00", - "id": 133530294, - "referencedCurie": "PMCID:PMC3766279", - "displayName": "PMCID:PMC3766279" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.341117+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.341125+01:00", - "id": 133530295, - "referencedCurie": "PMID:23836288", - "displayName": "PMID:23836288" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T17:58:44.346638+01:00", - "dbDateUpdated": "2023-09-21T17:58:44.346645+01:00", - "id": 133530296, - "referencedCurie": "WB:WBPaper00042571", - "displayName": "WB:WBPaper00042571" - } - ], - "shortCitation": " (2013) Glycobiology 23(10):1142-51" - } - ], - "componentSymbol": "egl19", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:6239", - "name": "Caenorhabditis elegans" }, - "taxonText": "Caenorhabditis elegans", - "relatedNotes": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-21T22:32:31.413938+01:00", - "dbDateUpdated": "2023-09-21T22:32:31.41395+01:00", - "id": 133891212, - "freeText": "egl-19 test note", - "noteType": { - "internal": false, - "obsolete": false, - "id": 133503921, - "name": "construct_component_note" - } - } - ], - "relation": { - "createdBy": { - "dateCreated": "2022-05-03T18:33:16.445309Z", - "dateUpdated": "2022-05-03T18:33:16.445322Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817Z", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } + ], + relation: { + createdBy: { + dateCreated: '2022-05-03T18:33:16.445309Z', + dateUpdated: '2022-05-03T18:33:16.445322Z', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817Z', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, - "updatedBy": { - "dateCreated": "2022-05-03T18:33:16.445309Z", - "dateUpdated": "2022-05-03T18:33:16.445322Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817Z", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } + }, + updatedBy: { + dateCreated: '2022-05-03T18:33:16.445309Z', + dateUpdated: '2022-05-03T18:33:16.445322Z', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817Z', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, - "dateCreated": "2023-07-30T10:53:52.886357Z", - "dateUpdated": "2023-07-30T10:53:52.904425Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-07-30T10:53:52.916444Z", - "dbDateUpdated": "2023-07-30T10:53:52.916445Z", - "id": 105723958, - "name": "is_regulated_by (RO:0002334)", - "definition": "Indicates that the construct is regulated by the indicated GenomicEntity" - } - } - ], - "constructSymbol": { - "internal": false, - "obsolete": false, - "id": 134095430, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308690, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." + }, + dateCreated: '2023-07-30T10:53:52.886357Z', + dateUpdated: '2023-07-30T10:53:52.904425Z', + internal: false, + obsolete: false, + dbDateCreated: '2023-07-30T10:53:52.916444Z', + dbDateUpdated: '2023-07-30T10:53:52.916445Z', + id: 105723958, + name: 'is_regulated_by (RO:0002334)', + definition: 'Indicates that the construct is regulated by the indicated GenomicEntity', }, - "formatText": "KP273", - "displayText": "KP273" }, - "constructFullName": { - "internal": false, - "obsolete": false, - "id": 13423325252, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308691, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." - }, - "formatText": "King Potato 273", - "displayText": "King Potato 273" + ], + constructSymbol: { + internal: false, + obsolete: false, + id: 134095430, + nameType: { + internal: false, + obsolete: false, + id: 20308690, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "constructSynonyms": [ - { - "internal": false, - "obsolete": false, - "id": 134024230, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308692, - "name": "systematic_name", - "definition": "A systematic name: e.g., CG48891." - }, - "formatText": "KPot273", - "displayText": "KPot273" - } - ] + formatText: 'KP273', + displayText: 'KP273', }, - "relation": { - "createdBy": { - "dateCreated": "2022-05-03T18:33:16.445309+01:00", - "dateUpdated": "2022-05-03T18:33:16.445322+01:00", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817+01:00", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } - }, - "updatedBy": { - "dateCreated": "2022-05-03T18:33:16.445309+01:00", - "dateUpdated": "2022-05-03T18:33:16.445322+01:00", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:55:33.687817+01:00", - "id": 7685810, - "uniqueId": "Chris|Grove|chris@wormbase.org", - "firstName": "Chris", - "lastName": "Grove", - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } + constructFullName: { + internal: false, + obsolete: false, + id: 13423325252, + nameType: { + internal: false, + obsolete: false, + id: 20308691, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', }, - "dateCreated": "2023-07-30T10:53:26.803825+01:00", - "dateUpdated": "2023-07-30T10:53:26.811841+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-07-30T10:53:26.819368+01:00", - "dbDateUpdated": "2023-07-30T10:53:26.819369+01:00", - "id": 105723956, - "name": "expresses (RO:0002292)", - "definition": "Indicates that the construct expresses the indicated GenomicEntity" + formatText: 'King Potato 273', + displayText: 'King Potato 273', }, - "constructGenomicEntityAssociationObject": { - "type": "Gene", - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" - }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-09-08T13:13:22.467843+01:00", - "dbDateUpdated": "2022-09-08T13:13:22.467853+01:00", - "id": 10975049, - "uniqueId": "WB:curator" + constructSynonyms: [ + { + internal: false, + obsolete: false, + id: 134024230, + nameType: { + internal: false, + obsolete: false, + id: 20308692, + name: 'systematic_name', + definition: 'A systematic name: e.g., CG48891.', + }, + formatText: 'KPot273', + displayText: 'KPot273', }, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-10-12T22:30:58.367879+01:00", - "curie": "WB:WBGene00003006", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:6239", - "name": "Caenorhabditis elegans" + ], + }, + relation: { + createdBy: { + dateCreated: '2022-05-03T18:33:16.445309+01:00', + dateUpdated: '2022-05-03T18:33:16.445322+01:00', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817+01:00', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-10-12T22:30:58.367101+01:00", - "id": 75346028, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } + }, + updatedBy: { + dateCreated: '2022-05-03T18:33:16.445309+01:00', + dateUpdated: '2022-05-03T18:33:16.445322+01:00', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:55:33.687817+01:00', + id: 7685810, + uniqueId: 'Chris|Grove|chris@wormbase.org', + firstName: 'Chris', + lastName: 'Grove', + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', }, - "crossReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-06-06T19:44:24.155299+01:00", - "dbDateUpdated": "2023-06-06T19:44:24.1553+01:00", - "id": 86350879, - "referencedCurie": "WB:WBGene00003006", - "displayName": "WBGene00003006", - "resourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.602562Z", - "dbDateUpdated": "2023-08-27T22:00:03.827167+01:00", - "id": 41750773, - "name": "gene", - "urlTemplate": "https://www.wormbase.org/db/get?name=[%s];class=Gene" - } - } }, - "geneType": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-02-19T22:00:41.015903Z", - "curie": "SO:0001217", - "name": "protein_coding_gene", - "namespace": "sequence", - "definition": "A gene that codes for an RNA that can be translated into a protein.", - "subsets": [ - "Alliance_of_Genome_Resources" - ], - "synonyms": [ - { - "internal": false, - "obsolete": false, - "id": 12304001, - "name": "protein coding gene" - } - ] + }, + dateCreated: '2023-07-30T10:53:26.803825+01:00', + dateUpdated: '2023-07-30T10:53:26.811841+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-07-30T10:53:26.819368+01:00', + dbDateUpdated: '2023-07-30T10:53:26.819369+01:00', + id: 105723956, + name: 'expresses (RO:0002292)', + definition: 'Indicates that the construct expresses the indicated GenomicEntity', + }, + constructGenomicEntityAssociationObject: { + type: 'Gene', + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2022-09-08T13:13:22.467843+01:00', + dbDateUpdated: '2022-09-08T13:13:22.467853+01:00', + id: 10975049, + uniqueId: 'WB:curator', + }, + internal: false, + obsolete: false, + dbDateUpdated: '2023-10-12T22:30:58.367879+01:00', + curie: 'WB:WBGene00003006', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:6239', + name: 'Caenorhabditis elegans', + }, + dataProvider: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-10-12T22:30:58.367101+01:00', + id: 75346028, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, - "geneSymbol": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-01-31T00:25:55.907119Z", - "dbDateUpdated": "2023-10-12T22:30:58.36953+01:00", - "id": 27221468, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308690, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." + crossReference: { + internal: false, + obsolete: false, + dbDateCreated: '2023-06-06T19:44:24.155299+01:00', + dbDateUpdated: '2023-06-06T19:44:24.1553+01:00', + id: 86350879, + referencedCurie: 'WB:WBGene00003006', + displayName: 'WBGene00003006', + resourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.602562Z', + dbDateUpdated: '2023-08-27T22:00:03.827167+01:00', + id: 41750773, + name: 'gene', + urlTemplate: 'https://www.wormbase.org/db/get?name=[%s];class=Gene', }, - "formatText": "lin-17", - "displayText": "lin-17" }, - "geneFullName": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-01-31T00:25:55.907825Z", - "dbDateUpdated": "2023-10-12T22:30:58.368456+01:00", - "id": 27221469, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308691, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." + }, + geneType: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-02-19T22:00:41.015903Z', + curie: 'SO:0001217', + name: 'protein_coding_gene', + namespace: 'sequence', + definition: 'A gene that codes for an RNA that can be translated into a protein.', + subsets: ['Alliance_of_Genome_Resources'], + synonyms: [ + { + internal: false, + obsolete: false, + id: 12304001, + name: 'protein coding gene', }, - "formatText": "abnormal cell LINeage 17", - "displayText": "abnormal cell LINeage 17" + ], + }, + geneSymbol: { + internal: false, + obsolete: false, + dbDateCreated: '2023-01-31T00:25:55.907119Z', + dbDateUpdated: '2023-10-12T22:30:58.36953+01:00', + id: 27221468, + nameType: { + internal: false, + obsolete: false, + id: 20308690, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "geneSystematicName": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-01-31T00:25:55.9083Z", - "dbDateUpdated": "2023-10-12T22:30:58.371706+01:00", - "id": 27221470, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308692, - "name": "systematic_name", - "definition": "A systematic name: e.g., CG48891." + formatText: 'lin-17', + displayText: 'lin-17', + }, + geneFullName: { + internal: false, + obsolete: false, + dbDateCreated: '2023-01-31T00:25:55.907825Z', + dbDateUpdated: '2023-10-12T22:30:58.368456+01:00', + id: 27221469, + nameType: { + internal: false, + obsolete: false, + id: 20308691, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', + }, + formatText: 'abnormal cell LINeage 17', + displayText: 'abnormal cell LINeage 17', + }, + geneSystematicName: { + internal: false, + obsolete: false, + dbDateCreated: '2023-01-31T00:25:55.9083Z', + dbDateUpdated: '2023-10-12T22:30:58.371706+01:00', + id: 27221470, + nameType: { + internal: false, + obsolete: false, + id: 20308692, + name: 'systematic_name', + definition: 'A systematic name: e.g., CG48891.', + }, + formatText: 'Y71F9B.5', + displayText: 'Y71F9B.5', + }, + geneSynonyms: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-01-31T00:25:55.908787Z', + dbDateUpdated: '2023-10-12T22:30:58.37056+01:00', + id: 27221471, + nameType: { + internal: false, + obsolete: false, + id: 20308697, + name: 'unspecified', + definition: 'Unclassified name', }, - "formatText": "Y71F9B.5", - "displayText": "Y71F9B.5" + formatText: 'CELE_Y71F9B.5', + displayText: 'CELE_Y71F9B.5', }, - "geneSynonyms": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-01-31T00:25:55.908787Z", - "dbDateUpdated": "2023-10-12T22:30:58.37056+01:00", - "id": 27221471, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308697, - "name": "unspecified", - "definition": "Unclassified name" - }, - "formatText": "CELE_Y71F9B.5", - "displayText": "CELE_Y71F9B.5" - } - ] - } - - } - ] - } - ], - returnedRecords : 1, - totalResults: 19736 - } + ], + }, + }, + ], + }, + ], + returnedRecords: 1, + totalResults: 19736, +}; export const mockSettingsData = { - "page": 0, - "first": 0, - "rows": 50, - "multiSortMeta": [], - "selectedColumnNames": ["Unique ID", "MOD Entity ID", "MOD Internal ID", "Name", "Taxon", "Components", "References", "Data Provider"], - "filters": {}, - "tableKeyName": "Constructs", - "tableSettingsKeyName": "ConstructsTableSettings" + page: 0, + first: 0, + rows: 50, + multiSortMeta: [], + selectedColumnNames: [ + 'Unique ID', + 'MOD Entity ID', + 'MOD Internal ID', + 'Name', + 'Taxon', + 'Components', + 'References', + 'Data Provider', + ], + filters: {}, + tableKeyName: 'Constructs', + tableSettingsKeyName: 'ConstructsTableSettings', }; diff --git a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyPage.js b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyPage.js index 0b77eceb7..13e4f66d8 100644 --- a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyPage.js +++ b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { ControlledVocabularyTable } from './ControlledVocabularyTable'; function ControlledVocabularyPage() { - return ( - - ); + return ; } export default ControlledVocabularyPage; diff --git a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js index 63e0cf40a..4a8cbb65f 100644 --- a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js +++ b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js @@ -1,20 +1,20 @@ -import React, {useRef, useState, useReducer} from 'react'; +import React, { useRef, useState, useReducer } from 'react'; import { GenericDataTable } from '../../components/GenericDataTable/GenericDataTable'; -import { useMutation, useQuery} from '@tanstack/react-query'; +import { useMutation, useQuery } from '@tanstack/react-query'; import { Toast } from 'primereact/toast'; import { Tooltip } from 'primereact/tooltip'; import { EllipsisTableCell } from '../../components/EllipsisTableCell'; import { ListTableCell } from '../../components/ListTableCell'; -import { useControlledVocabularyService } from "../../service/useControlledVocabularyService"; -import { VocabularyService } from "../../service/VocabularyService"; -import { TrueFalseDropdown } from "../../components/TrueFalseDropDownSelector"; -import { ErrorMessageComponent } from "../../components/Error/ErrorMessageComponent"; -import { InputTextEditor } from "../../components/InputTextEditor"; -import { ControlledVocabularyDropdown } from "../../components/ControlledVocabularySelector"; -import { NewTermForm } from "../../containers/controlledVocabularyPage/NewTermForm"; -import { NewVocabularyForm } from "../../containers/controlledVocabularyPage/NewVocabularyForm"; -import { Button } from "primereact/button"; +import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; +import { VocabularyService } from '../../service/VocabularyService'; +import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; +import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; +import { InputTextEditor } from '../../components/InputTextEditor'; +import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; +import { NewTermForm } from '../../containers/controlledVocabularyPage/NewTermForm'; +import { NewVocabularyForm } from '../../containers/controlledVocabularyPage/NewVocabularyForm'; +import { Button } from 'primereact/button'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; @@ -23,14 +23,14 @@ import { SearchService } from '../../service/SearchService'; import { setNewEntity } from '../../utils/utils'; export const ControlledVocabularyTable = () => { - const newTermReducer = (state, action) => { - switch (action.type) { - case 'RESET': - return { name: "", obsolete: false }; - default: - return { ...state, [action.field]: action.value }; - } - }; + const newTermReducer = (state, action) => { + switch (action.type) { + case 'RESET': + return { name: '', obsolete: false }; + default: + return { ...state, [action.field]: action.value }; + } + }; const toast_topleft = useRef(null); const toast_topright = useRef(null); @@ -53,27 +53,29 @@ export const ControlledVocabularyTable = () => { let vocabularyService = new VocabularyService(); useQuery(['vocabularies'], () => vocabularyService.getVocabularies(), { - onSuccess: (data) => { - setVocabularies(data.data.results.sort(function (a, b) { - return a.name.localeCompare(b.name, 'en', {'sensitivity' : 'base'}); - })); - }, - onError: (error) => { - toast_topleft.current.show([ - { life: 7000, severity: 'error', summary: 'Page error: ', detail: error.message, sticky: false } - ]); - } + onSuccess: (data) => { + setVocabularies( + data.data.results.sort(function (a, b) { + return a.name.localeCompare(b.name, 'en', { sensitivity: 'base' }); + }) + ); + }, + onError: (error) => { + toast_topleft.current.show([ + { life: 7000, severity: 'error', summary: 'Page error: ', detail: error.message, sticky: false }, + ]); + }, }); - const mutation = useMutation(updatedTerm => { - if (!vocabularyService) { - vocabularyService = new VocabularyService(); - } - return vocabularyService.saveTerm(updatedTerm); + const mutation = useMutation((updatedTerm) => { + if (!vocabularyService) { + vocabularyService = new VocabularyService(); + } + return vocabularyService.saveTerm(updatedTerm); }); const handleNewTerm = () => { - newTermDispatch({ type: "RESET" }); + newTermDispatch({ type: 'RESET' }); setNewTermDialog(true); }; @@ -81,101 +83,93 @@ export const ControlledVocabularyTable = () => { setNewVocabularyDialog(true); }; - const createButtons = (disabled=false) => { - return ( - <> - - } + {rowData.failedRecords > 0 && ( + + )} - ) - } + ); + }; const downloadFileExceptions = (id) => { dataLoadService.downloadExceptions(id, setIsLoading); - } + }; const showUploadConfirmDialog = (rowData) => { setUploadLoadType(rowData.backendBulkLoadType); setUploadSubType(rowData.dataProvider); setUploadConfirmDialog(true); //setUploadFile(event.files[0]); - } + }; const hideUploadConfirmDialog = () => { setUploadLoadType(null); setUploadSubType(null); setUploadConfirmDialog(false); - } + }; const uploadLoadFile = (event) => { - let type = uploadLoadType + "_" + uploadSubType; + let type = uploadLoadType + '_' + uploadSubType; let formData = new FormData(); - if(event.files.length > 0) { + if (event.files.length > 0) { formData.append(type, event.files[0]); } dataSubmissionService.sendFile(formData); - toast.current.show({severity: 'info', summary: 'Success', detail: 'File Uploaded'}); + toast.current.show({ severity: 'info', summary: 'Success', detail: 'File Uploaded' }); setUploadLoadType(null); setUploadSubType(null); setUploadConfirmDialog(false); - } + }; const loadFileActionBodyTemplate = (rowData) => { let ret = []; - if(!rowData.bulkloadStatus || rowData.bulkloadStatus === "FINISHED" || rowData.bulkloadStatus === "FAILED" || rowData.bulkloadStatus === "STOPPED") { + if ( + !rowData.bulkloadStatus || + rowData.bulkloadStatus === 'FINISHED' || + rowData.bulkloadStatus === 'FAILED' || + rowData.bulkloadStatus === 'STOPPED' + ) { if (fileWithinSchemaRange(rowData.linkMLSchemaVersion, rowData.loadType)) { - ret.push(
    ); - } + }; const ProgressIndicator = ({ load }) => { - if(load.currentCount && load.totalSize) { - return - } else if(load.currentCount && load.lastCount && load.lastTime && load.nowTime) { - let rate = Math.ceil(((load.currentCount - load.lastCount) / (load.nowTime - load.lastTime)) * 1000); + if (load.currentCount && load.totalSize) { + return ; + } else if (load.currentCount && load.lastCount && load.lastTime && load.nowTime) { + let rate = Math.ceil(((load.currentCount - load.lastCount) / (load.nowTime - load.lastTime)) * 1000); return ( - { - return <>{value}r/s -- {load.currentCount} - }} - /> - ); - } else { - return - } - } + { + return ( + <> + {value}r/s -- {load.currentCount} + + ); + }} + /> + ); + } else { + return ; + } + }; const processingLoadsComponents = () => { - let ret = []; //console.log(runningLoads); - for(let key in runningLoads) { + for (let key in runningLoads) { //console.log(key); - if(runningLoads[key]) { + if (runningLoads[key]) { ret.push(
    -

    { key }

    +

    {key}

    @@ -629,40 +764,65 @@ export const DataLoadsComponent = () => { } } return ret; - } + }; return ( <>
    -

    Schema Version Table

    - +

    Data Processing Info Table

    -
    { processingLoadsComponents() }
    +
    {processingLoadsComponents()}
    ); diff --git a/src/main/cliapp/src/containers/dataLoadsPage/FMSForm.js b/src/main/cliapp/src/containers/dataLoadsPage/FMSForm.js index da775ed92..bcbd925d2 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/FMSForm.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/FMSForm.js @@ -3,36 +3,33 @@ import React from 'react'; import { CronFields } from '../../components/CronFields'; export const FMSForm = ({ hideFMS, newBulkLoad, onChange, disableFormFields }) => { - return ( + return ( + <> + {!hideFMS.current && ( <> - {!hideFMS.current && - <> - -
    - - -
    -
    - - -
    - - } + +
    + + +
    +
    + + +
    - ); -} + )} + + ); +}; diff --git a/src/main/cliapp/src/containers/dataLoadsPage/HistoryDialog.js b/src/main/cliapp/src/containers/dataLoadsPage/HistoryDialog.js index 413c07f1d..ea589a1e9 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/HistoryDialog.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/HistoryDialog.js @@ -1,4 +1,4 @@ -import React, {useState} from 'react'; +import React, { useState } from 'react'; import { useQuery } from '@tanstack/react-query'; import Moment from 'react-moment'; import moment from 'moment'; @@ -6,10 +6,9 @@ import { Dialog } from 'primereact/dialog'; import { DataTable } from 'primereact/datatable'; import { Column } from 'primereact/column'; import { ScrollPanel } from 'primereact/scrollpanel'; -import {useGetUserSettings} from "../../service/useGetUserSettings"; +import { useGetUserSettings } from '../../service/useGetUserSettings'; export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLoadService }) => { - const [expandedRows, setExpandedRows] = useState(null); const [fullHistory, setFullHistory] = useState({}); const [historyExceptions, setHistoryExceptions] = useState([]); @@ -20,30 +19,33 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo first: 0, rows: 10, isFirst: false, - tableKeyName: "FileHistoryException".replace(/\s+/g, ''), //remove whitespace from tableName - tableSettingsKeyName: "FileHistoryException".replace(/\s+/g,'') + "TableSettings" - } - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); - - useQuery(['bulkLoadFullHistory', history], - () => dataLoadService.getFileHistoryFile(history.id), { - onSuccess: (res) => { - if(res.data.entity) { - setFullHistory(res.data.entity); - } - }, - onError: (error) => { - console.log(error); - }, - keepPreviousData: true, - refetchOnWindowFocus: false, - } + tableKeyName: 'FileHistoryException'.replace(/\s+/g, ''), //remove whitespace from tableName + tableSettingsKeyName: 'FileHistoryException'.replace(/\s+/g, '') + 'TableSettings', + }; + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState ); - useQuery(['bulkLoadHistoryExceptions', [history, tableState]], - () => dataLoadService.getHistoryExceptions(history.id, tableState.rows, tableState.page), { + useQuery(['bulkLoadFullHistory', history], () => dataLoadService.getFileHistoryFile(history.id), { + onSuccess: (res) => { + if (res.data.entity) { + setFullHistory(res.data.entity); + } + }, + onError: (error) => { + console.log(error); + }, + keepPreviousData: true, + refetchOnWindowFocus: false, + }); + + useQuery( + ['bulkLoadHistoryExceptions', [history, tableState]], + () => dataLoadService.getHistoryExceptions(history.id, tableState.rows, tableState.page), + { onSuccess: (res) => { - if(res.data.results) { + if (res.data.results) { setHistoryExceptions(res.data.results); } else { setHistoryExceptions([]); @@ -54,10 +56,33 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo console.log(error); }, keepPreviousData: true, - refetchOnWindowFocus: false + refetchOnWindowFocus: false, } ); + const messageTemplate = (row) => { + let messages; + if (row.exception.messages) { + messages = ( +
    + {row.exception.messages.map((line) => ( +
    {line}
    + ))} +
    + ); + } + let message; + if (row.exception.message) { + message =
    {row.exception.message}
    ; + } + return ( +
    + {message} + {messages} +
    + ); + }; + const hideDialog = () => { setHistoryDialog(false); }; @@ -67,8 +92,8 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo return (

    JSON Object

    - -
    {JSON.stringify(JSON.parse(rowData.exception.jsonObject), null, 2) }
    + +
    {JSON.stringify(JSON.parse(rowData.exception.jsonObject), null, 2)}
    ); @@ -81,22 +106,30 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo rows: event.rows, page: event.page, - first: event.first + first: event.first, }; setTableState(_tableState); - } + }; return (
    - +
    -
    Duration -
    +
    + +
    How long the load took
    @@ -105,7 +138,14 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo
    Rate -
    {Math.round(fullHistory.completedRecords / (moment(fullHistory.loadFinished) - moment(fullHistory.loadStarted)) * 10000) / 10} r/s
    +
    + {Math.round( + (fullHistory.completedRecords / + (moment(fullHistory.loadFinished) - moment(fullHistory.loadStarted))) * + 10000 + ) / 10}{' '} + r/s +
    How many records per second to the database
    @@ -114,27 +154,41 @@ export const HistoryDialog = ({ historyDialog, setHistoryDialog, history, dataLo
    Completed -
    {fullHistory.completedRecords} of {fullHistory.totalRecords} = {Math.round(fullHistory.completedRecords / fullHistory.totalRecords * 1000) / 10}%
    +
    + {fullHistory.completedRecords} of {fullHistory.totalRecords} ={' '} + {Math.round((fullHistory.completedRecords / fullHistory.totalRecords) * 1000) / 10}% +
    How much of the load was successful
    - setExpandedRows(e.data)} rowExpansionTemplate={jsonObjectTemplate} dataKey="id" - paginator= {true} paginatorPosition="top" totalRecords={totalRecords} onPage={onLazyLoad} lazy= {true} first={tableState.first} + setExpandedRows(e.data)} + rowExpansionTemplate={jsonObjectTemplate} + dataKey="id" + paginator={true} + paginatorPosition="top" + totalRecords={totalRecords} + onPage={onLazyLoad} + lazy={true} + first={tableState.first} paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" currentPageReportTemplate="Showing {first} to {last} of {totalRecords}" - rows={tableState.rows} rowsPerPageOptions={[10, 20, 50, 100, 250, 1000]}> + rows={tableState.rows} + rowsPerPageOptions={[10, 20, 50, 100, 250, 1000]} + > - +
    -
    ); }; - diff --git a/src/main/cliapp/src/containers/dataLoadsPage/ManualForm.js b/src/main/cliapp/src/containers/dataLoadsPage/ManualForm.js index 51af6f268..4b62a698a 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/ManualForm.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/ManualForm.js @@ -1,6 +1,6 @@ -import React from "react"; +import React from 'react'; import { DataLoadService } from '../../service/DataLoadService'; -import { Dropdown } from "primereact/dropdown"; +import { Dropdown } from 'primereact/dropdown'; export const ManualForm = ({ hideManual, newBulkLoad, onChange }) => { const dataLoadService = new DataLoadService(); @@ -16,9 +16,9 @@ export const ManualForm = ({ hideManual, newBulkLoad, onChange }) => { value={newBulkLoad.dataProvider} options={dataProviders} onChange={onChange} - placeholder={"Select Data Provider"} - className='p-col-12' - name='dataProvider' + placeholder={'Select Data Provider'} + className="p-col-12" + name="dataProvider" />
    )} diff --git a/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadForm.js b/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadForm.js index 5a7468dc4..dd6e0edb3 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadForm.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadForm.js @@ -1,5 +1,5 @@ import React, { useRef, useState, useEffect } from 'react'; -import { Dropdown } from "primereact/dropdown"; +import { Dropdown } from 'primereact/dropdown'; import { Dialog } from 'primereact/dialog'; import { Button } from 'primereact/button'; import { useMutation, useQueryClient } from '@tanstack/react-query'; @@ -11,8 +11,16 @@ import { ManualForm } from './ManualForm'; import { useOktaAuth } from '@okta/okta-react'; import ErrorBoundary from '../../components/Error/ErrorBoundary'; -export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, newBulkLoad, bulkLoadDispatch, disableFormFields, setDisableFormFields, dataLoadService }) => { - +export const NewBulkLoadForm = ({ + bulkLoadDialog, + setBulkLoadDialog, + groups, + newBulkLoad, + bulkLoadDispatch, + disableFormFields, + setDisableFormFields, + dataLoadService, +}) => { const { authState } = useOktaAuth(); const queryClient = useQueryClient(); @@ -23,7 +31,7 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new const [backendBulkLoadTypes, setBackendLoadTypes] = useState(); - const mutation = useMutation(bulkLoad => { + const mutation = useMutation((bulkLoad) => { if (bulkLoad.id) { return getService().updateLoad(bulkLoad); } else { @@ -60,30 +68,29 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new } }; - const onChange = (e) => { - if (e.target.name === "scheduleActive" || e.target.name === "group") { + if (e.target.name === 'scheduleActive' || e.target.name === 'group') { bulkLoadDispatch({ field: e.target.name, - value: e.value + value: e.value, }); } else { bulkLoadDispatch({ field: e.target.name, - value: e.target.value + value: e.target.value, }); } }; const getService = () => { - if(!dataLoadService) { + if (!dataLoadService) { dataLoadService = new DataLoadService(authState); } return dataLoadService; - } + }; const hideDialog = () => { - bulkLoadDispatch({ type: "RESET" }); + bulkLoadDispatch({ type: 'RESET' }); setBulkLoadDialog(false); hideFMS.current = true; hideURL.current = true; @@ -97,7 +104,7 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new mutation.mutate(newBulkLoad, { onSuccess: () => { queryClient.invalidateQueries(['bulkloadtable']); - bulkLoadDispatch({ type: "RESET" }); + bulkLoadDispatch({ type: 'RESET' }); hideFMS.current = true; hideURL.current = true; hideManual.current = true; @@ -105,8 +112,8 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new setDisableFormFields(false); }, onError: () => { - // lookup group and set - } + // lookup group and set + }, }); }; @@ -117,22 +124,22 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new ); - return ( - + -
    +
    -
    - +
    @@ -142,11 +149,11 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new options={groups} value={newBulkLoad.group} onChange={onChange} - placeholder={"Select Group"} - className='p-col-12' - name='group' - optionLabel='name' - optionValue='id' + placeholder={'Select Group'} + className="p-col-12" + name="group" + optionLabel="name" + optionValue="id" />
    @@ -157,9 +164,9 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new value={newBulkLoad.type} options={getService().getLoadTypes()} onChange={onChange} - placeholder={"Select Load Type"} - className='p-col-12' - name='type' + placeholder={'Select Load Type'} + className="p-col-12" + name="type" disabled={disableFormFields} />
    @@ -171,13 +178,13 @@ export const NewBulkLoadForm = ({ bulkLoadDialog, setBulkLoadDialog, groups, new value={newBulkLoad.backendBulkLoadType} options={backendBulkLoadTypes} onChange={onChange} - placeholder={"Select Backend Bulk Load Type"} - className='p-col-12' - name='backendBulkLoadType' + placeholder={'Select Backend Bulk Load Type'} + className="p-col-12" + name="backendBulkLoadType" disabled={disableFormFields} />
    - + - -
    diff --git a/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadGroupForm.js b/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadGroupForm.js index 4121a737a..e72d8cc36 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadGroupForm.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/NewBulkLoadGroupForm.js @@ -10,7 +10,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import ErrorBoundary from '../../components/Error/ErrorBoundary'; export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDialog }) => { - const { authState } = useOktaAuth(); const [group, setGroup] = useState({}); @@ -18,7 +17,7 @@ export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDial const [submitted, setSubmitted] = useState(false); let dataLoadService = null; - const mutation = useMutation(newGroupName => { + const mutation = useMutation((newGroupName) => { return getService().createGroup(newGroupName); }); @@ -34,11 +33,11 @@ export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDial }; const getService = () => { - if(!dataLoadService) { + if (!dataLoadService) { dataLoadService = new DataLoadService(authState); } return dataLoadService; - } + }; const hideDialog = () => { setBulkLoadGroupDialog(false); @@ -59,10 +58,9 @@ export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDial setSubmitted(false); setBulkLoadGroupDialog(false); setGroup(emptyGroup); - } + }, }); } - }; const groupDialogFooter = ( @@ -72,15 +70,29 @@ export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDial ); - return (
    - +
    - onChange(e, 'name')} required autoFocus className={classNames({ 'p-invalid': submitted && !group.name })} /> + onChange(e, 'name')} + required + autoFocus + className={classNames({ 'p-invalid': submitted && !group.name })} + /> {submitted && !group.name && Name is required.}
    @@ -88,4 +100,3 @@ export const NewBulkLoadGroupForm = ({ bulkLoadGroupDialog, setBulkLoadGroupDial
    ); }; - diff --git a/src/main/cliapp/src/containers/dataLoadsPage/URLForm.js b/src/main/cliapp/src/containers/dataLoadsPage/URLForm.js index 5e240d8bf..5fbd605e5 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/URLForm.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/URLForm.js @@ -1,49 +1,39 @@ import React from 'react'; import { InputText } from 'primereact/inputtext'; import { CronFields } from '../../components/CronFields'; -import { Dropdown } from "primereact/dropdown"; +import { Dropdown } from 'primereact/dropdown'; import { DataLoadService } from '../../service/DataLoadService'; - export const URLForm = ({ hideURL, hideOntology, newBulkLoad, onChange, disableFormFields }) => { - const dataLoadService = new DataLoadService(); + const dataLoadService = new DataLoadService(); - const ontologyTypes = dataLoadService.getOntologyTypes(); - return ( + const ontologyTypes = dataLoadService.getOntologyTypes(); + return ( + <> + {!hideURL.current && ( <> - {!hideURL.current && - <> - {!hideOntology.current && -
    - - -
    - } - -
    - - -
    - - - } + {!hideOntology.current && ( +
    + + +
    + )} + +
    + + +
    - ); + )} + + ); }; diff --git a/src/main/cliapp/src/containers/dataLoadsPage/index.js b/src/main/cliapp/src/containers/dataLoadsPage/index.js index 2f8a95592..b3cdef980 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/index.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/index.js @@ -1,3 +1,3 @@ -import { DataLoadsComponent as DataLoadsPage } from "./DataLoadsComponent"; +import { DataLoadsComponent as DataLoadsPage } from './DataLoadsComponent'; -export { DataLoadsPage }; \ No newline at end of file +export { DataLoadsPage }; diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/ConditionRelationsForm.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/ConditionRelationsForm.js index a88d08bd2..556036c9a 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/ConditionRelationsForm.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/ConditionRelationsForm.js @@ -7,12 +7,20 @@ import { DialogErrorMessageComponent } from '../../components/Error/DialogErrorM import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; -import { FormErrorMessageComponent } from "../../components/Error/FormErrorMessageComponent"; -import {ExConAutocompleteTemplate} from "../../components/Autocomplete/ExConAutocompleteTemplate"; -import {AutocompleteMultiEditor} from "../../components/Autocomplete/AutocompleteMultiEditor"; -import {autocompleteSearch, buildAutocompleteFilter} from "../../utils/utils"; - -export const ConditionRelationsForm = ({ dispatch, conditionRelations, showConditionRelations, errorMessages, searchService, buttonIsDisabled, editingRows }) => { +import { FormErrorMessageComponent } from '../../components/Error/FormErrorMessageComponent'; +import { ExConAutocompleteTemplate } from '../../components/Autocomplete/ExConAutocompleteTemplate'; +import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; +import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; + +export const ConditionRelationsForm = ({ + dispatch, + conditionRelations, + showConditionRelations, + errorMessages, + searchService, + buttonIsDisabled, + editingRows, +}) => { const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); const conditionRelationTypeTerms = useControlledVocabularyService('condition_relation'); const tableRef = useRef(null); @@ -20,24 +28,23 @@ export const ConditionRelationsForm = ({ dispatch, conditionRelations, showCondi const onRowEditChange = (e) => { console.log(e); - } + }; const createNewRelationHandler = (event) => { event.preventDefault(); let count = conditionRelations ? conditionRelations.length : 0; - dispatch({type: "ADD_NEW_RELATION", count}) + dispatch({ type: 'ADD_NEW_RELATION', count }); }; - const onConditionRelationTypeEditorValueChange = (props, event) => { dispatch({ - type: "EDIT_ROW", - tableType: "conditionRelations", - field: "conditionRelationType", + type: 'EDIT_ROW', + tableType: 'conditionRelations', + field: 'conditionRelationType', index: props.rowIndex, - value: event.target.value - }) + value: event.target.value, + }); }; const conditionRelationTypeEditor = (props) => { @@ -49,9 +56,12 @@ export const ConditionRelationsForm = ({ dispatch, conditionRelations, showCondi editorChange={onConditionRelationTypeEditorValueChange} props={props} showClear={false} - dataKey='id' + dataKey="id" + /> + - ); }; @@ -59,54 +69,57 @@ export const ConditionRelationsForm = ({ dispatch, conditionRelations, showCondi const onConditionsEditorValueChange = (event, setValue, props) => { setValue(event.target.value); dispatch({ - type: "EDIT_ROW", - tableType: "conditionRelations", - field: "conditions", + type: 'EDIT_ROW', + tableType: 'conditionRelations', + field: 'conditions', index: props.rowIndex, - value: event.target.value - }) - } + value: event.target.value, + }); + }; const conditionSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["conditionSummary"]; - const endpoint = "experimental-condition"; - const filterName = "conditionSummaryFilter"; + const autocompleteFields = ['conditionSummary']; + const endpoint = 'experimental-condition'; + const filterName = 'conditionSummaryFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const conditionsEditorTemplate = (props) => { - return ( - <> - - } - onValueChangeHandler={onConditionsEditorValueChange} - /> - - - ); + return ( + <> + ( + + )} + onValueChangeHandler={onConditionsEditorValueChange} + /> + + + ); }; const onInternalEditorValueChange = (props, event) => { dispatch({ - type: "EDIT_ROW", - tableType: "conditionRelations", - field: "internal", + type: 'EDIT_ROW', + tableType: 'conditionRelations', + field: 'internal', index: props.rowIndex, - value: event.value.name - }) - } + value: event.value.name, + }); + }; const internalEditor = (props) => { return ( @@ -115,39 +128,80 @@ export const ConditionRelationsForm = ({ dispatch, conditionRelations, showCondi options={booleanTerms} editorChange={onInternalEditorValueChange} props={props} - field={"internal"} + field={'internal'} /> - + ); }; const handleDeleteRelation = (event, props) => { event.preventDefault(); - dispatch({type: "DELETE_ROW", tableType: "conditionRelations", showType: "showConditionRelations", index: props.rowIndex}) - } + dispatch({ + type: 'DELETE_ROW', + tableType: 'conditionRelations', + showType: 'showConditionRelations', + index: props.rowIndex, + }); + }; const deleteAction = (props) => { return ( -
    ); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsPage.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsPage.js index bcdd89a5f..0fa3e13bb 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsPage.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsPage.js @@ -2,7 +2,5 @@ import React from 'react'; import { DiseaseAnnotationsTable } from './DiseaseAnnotationsTable'; export function DiseaseAnnotationsPage() { - return ( - - ); + return ; } diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index 393576c61..a561bdecf 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -14,12 +14,12 @@ import { DiseaseAnnotationService } from '../../service/DiseaseAnnotationService import { RelatedNotesDialog } from '../../components/RelatedNotesDialog'; import { ConditionRelationsDialog } from '../../components/ConditionRelationsDialog'; -import { EvidenceCodesTemplate } from '../../components/Templates/EvidenceCodesTemplate'; -import { SingleReferenceTemplate } from '../../components/Templates/reference/SingleReferenceTemplate'; -import { DiseaseQualifiersTemplate } from '../../components/Templates/DiseaseQualifiersTemplate'; -import { IdTemplate } from '../../components/Templates/IdTemplate'; +import { EvidenceCodesTemplate } from '../../components/Templates/EvidenceCodesTemplate'; +import { SingleReferenceTemplate } from '../../components/Templates/reference/SingleReferenceTemplate'; +import { DiseaseQualifiersTemplate } from '../../components/Templates/DiseaseQualifiersTemplate'; +import { IdTemplate } from '../../components/Templates/IdTemplate'; import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; -import { GenomicEntityTemplate } from '../../components/Templates/genomicEntity/GenomicEntityTemplate'; +import { GenomicEntityTemplate } from '../../components/Templates/genomicEntity/GenomicEntityTemplate'; import { GenomicEntityListTemplate } from '../../components/Templates/genomicEntity/GenomicEntityListTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { NotTemplate } from '../../components/Templates/NotTemplate'; @@ -35,17 +35,24 @@ import { useControlledVocabularyService } from '../../service/useControlledVocab import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; import { Button } from 'primereact/button'; -import { getRefString, autocompleteSearch, buildAutocompleteFilter, defaultAutocompleteOnChange, multipleAutocompleteOnChange, getIdentifier, setNewEntity } from '../../utils/utils'; -import { useNewAnnotationReducer } from "./useNewAnnotationReducer"; -import { NewAnnotationForm } from "./NewAnnotationForm"; -import { AutocompleteMultiEditor } from "../../components/Autocomplete/AutocompleteMultiEditor"; +import { + getRefString, + autocompleteSearch, + buildAutocompleteFilter, + defaultAutocompleteOnChange, + multipleAutocompleteOnChange, + getIdentifier, + setNewEntity, +} from '../../utils/utils'; +import { useNewAnnotationReducer } from './useNewAnnotationReducer'; +import { NewAnnotationForm } from './NewAnnotationForm'; +import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; export const DiseaseAnnotationsTable = () => { - const [isInEditMode, setIsInEditMode] = useState(false); //needs better name const [totalRecords, setTotalRecords] = useState(0); const [conditionRelationsData, setConditionRelationsData] = useState({ @@ -66,75 +73,77 @@ export const DiseaseAnnotationsTable = () => { const relationsTerms = useControlledVocabularyService('disease_relation'); const geneticSexTerms = useControlledVocabularyService('genetic_sex'); - const annotationTypeTerms = useControlledVocabularyService('annotation_type') + const annotationTypeTerms = useControlledVocabularyService('annotation_type'); const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); const geneticModifierRelationTerms = useControlledVocabularyService('disease_genetic_modifier_relation'); const diseaseQualifiersTerms = useControlledVocabularyService('disease_qualifier'); - const [errorMessages, setErrorMessages] = useState({}); const errorMessagesRef = useRef(); errorMessagesRef.current = errorMessages; - + const [uiErrorMessages, setUiErrorMessages] = useState([]); const uiErrorMessagesRef = useRef(); uiErrorMessagesRef.current = uiErrorMessages; - + const searchService = new SearchService(); - + const toast_topleft = useRef(null); const toast_topright = useRef(null); - + const [diseaseAnnotations, setDiseaseAnnotations] = useState([]); - + let diseaseAnnotationService = new DiseaseAnnotationService(); - + const sortMapping = { 'diseaseAnnotationObject.name': ['diseaseAnnotationObject.curie', 'diseaseAnnotationObject.namespace'], 'diseaseAnnotationSubject.symbol': ['diseaseAnnotationSubject.name', 'diseaseAnnotationSubject.modEntityId'], 'with.geneSymbol.displayText': ['with.geneFullName.displayText', 'with.modEntityId'], 'sgdStrainBackground.name': ['sgdStrainBackground.modEntityId'], - 'diseaseGeneticModifier.symbol': ['diseaseGeneticModifier.name', 'diseaseGeneticModifier.modEntityId'] + 'diseaseGeneticModifier.symbol': ['diseaseGeneticModifier.name', 'diseaseGeneticModifier.modEntityId'], }; - - const mutation = useMutation(updatedAnnotation => { + + const mutation = useMutation((updatedAnnotation) => { return diseaseAnnotationService.saveDiseaseAnnotation(updatedAnnotation); }); - + const handleNewAnnotationOpen = () => { - newAnnotationDispatch({type: "OPEN_DIALOG"}) + newAnnotationDispatch({ type: 'OPEN_DIALOG' }); }; const handleDuplication = (rowData) => { - newAnnotationDispatch({type: "DUPLICATE_ROW", rowData}); - newAnnotationDispatch({type: "SET_IS_ENABLED", value: true}); - if(rowData.type === "AGMDiseaseAnnotation") { - newAnnotationDispatch({type: "SET_IS_ASSERTED_GENE_ENABLED", value: true}); - newAnnotationDispatch({type: "SET_IS_ASSERTED_ALLELE_ENABLED", value: true}); + newAnnotationDispatch({ type: 'DUPLICATE_ROW', rowData }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: true }); + if (rowData.type === 'AGMDiseaseAnnotation') { + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: true }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_ALLELE_ENABLED', value: true }); } - if(rowData.type === "AlleleDiseaseAnnotation") { - newAnnotationDispatch({type: "SET_IS_ASSERTED_GENE_ENABLED", value: true}); + if (rowData.type === 'AlleleDiseaseAnnotation') { + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: true }); } - if(rowData.relatedNotes && rowData.relatedNotes.length > 0){ - newAnnotationDispatch({type: "SET_RELATED_NOTES_EDITING_ROWS", relatedNotes: rowData.relatedNotes}) + if (rowData.relatedNotes && rowData.relatedNotes.length > 0) { + newAnnotationDispatch({ type: 'SET_RELATED_NOTES_EDITING_ROWS', relatedNotes: rowData.relatedNotes }); } - if(rowData.conditionRelations && rowData.conditionRelations.length > 0){ - newAnnotationDispatch({type: "SET_CONDITION_RELATIONS_EDITING_ROWS", conditionRelations: rowData.conditionRelations}) + if (rowData.conditionRelations && rowData.conditionRelations.length > 0) { + newAnnotationDispatch({ + type: 'SET_CONDITION_RELATIONS_EDITING_ROWS', + conditionRelations: rowData.conditionRelations, + }); } handleNewAnnotationOpen(); - } + }; const handleRelatedNotesOpen = (relatedNotes) => { let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = false; + _relatedNotesData['originalRelatedNotes'] = relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = false; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; @@ -143,23 +152,23 @@ export const DiseaseAnnotationsTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = rowProps.rowData.relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = isInEdit; - _relatedNotesData["rowIndex"] = index; - _relatedNotesData["mainRowProps"] = rowProps; + _relatedNotesData['originalRelatedNotes'] = rowProps.rowData.relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = isInEdit; + _relatedNotesData['rowIndex'] = index; + _relatedNotesData['mainRowProps'] = rowProps; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; const handleConditionRelationsOpen = (conditionRelations) => { let _conditionRelationsData = {}; - _conditionRelationsData["originalConditionRelations"] = conditionRelations; - _conditionRelationsData["dialog"] = true; - _conditionRelationsData["isInEdit"] = false; + _conditionRelationsData['originalConditionRelations'] = conditionRelations; + _conditionRelationsData['dialog'] = true; + _conditionRelationsData['isInEdit'] = false; setConditionRelationsData(() => ({ - ..._conditionRelationsData + ..._conditionRelationsData, })); }; @@ -168,13 +177,13 @@ export const DiseaseAnnotationsTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _conditionRelationsData = {}; - _conditionRelationsData["originalConditionRelations"] = rowProps.rowData.conditionRelations; - _conditionRelationsData["dialog"] = true; - _conditionRelationsData["isInEdit"] = isInEdit; - _conditionRelationsData["rowIndex"] = index; - _conditionRelationsData["mainRowProps"] = rowProps; + _conditionRelationsData['originalConditionRelations'] = rowProps.rowData.conditionRelations; + _conditionRelationsData['dialog'] = true; + _conditionRelationsData['isInEdit'] = isInEdit; + _conditionRelationsData['rowIndex'] = index; + _conditionRelationsData['mainRowProps'] = rowProps; setConditionRelationsData(() => ({ - ..._conditionRelationsData + ..._conditionRelationsData, })); }; @@ -182,40 +191,57 @@ export const DiseaseAnnotationsTable = () => { if (props?.rowData?.relatedNotes) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; const conditionRelationsEditor = (props) => { - if (props.rowData?.conditionRelations) { const handle = props.rowData.conditionRelations[0]?.handle; @@ -223,66 +249,81 @@ export const DiseaseAnnotationsTable = () => { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - ) - + ); } }; const conditionRelationHandleEditor = (props) => { if (props.rowData?.conditionRelations && props.rowData.conditionRelations[0]?.handle) { return ( - <> - - - - ); + <> + + + + ); } }; const onConditionRelationHandleEditorValueChange = (props, event) => { let updatedAnnotations = [...props.props.value]; - if (typeof event.value === "object") { + if (typeof event.value === 'object') { updatedAnnotations[props.rowIndex].conditionRelations[0] = event.value; } else { updatedAnnotations[props.rowIndex].conditionRelations[0].handle = event.value; } }; - const onRelationEditorValueChange = (props, event) => { let updatedAnnotations = [...props.props.value]; if (event.value || event.value === '') { @@ -301,7 +342,7 @@ export const DiseaseAnnotationsTable = () => { showClear={false} placeholderText={props.rowData.relation.name} /> - + ); }; @@ -321,7 +362,7 @@ export const DiseaseAnnotationsTable = () => { props={props} showClear={true} /> - + ); }; @@ -341,7 +382,7 @@ export const DiseaseAnnotationsTable = () => { props={props} showClear={true} /> - + ); }; @@ -361,7 +402,10 @@ export const DiseaseAnnotationsTable = () => { props={props} showClear={true} /> - + ); }; @@ -377,10 +421,8 @@ export const DiseaseAnnotationsTable = () => { let placeholderText = ''; if (props.rowData.diseaseQualifiers) { let placeholderTextElements = []; - props.rowData.diseaseQualifiers.forEach((x, i) => - placeholderTextElements.push(x.name)); + props.rowData.diseaseQualifiers.forEach((x, i) => placeholderTextElements.push(x.name)); placeholderText = placeholderTextElements.join(); - } return ( <> @@ -390,21 +432,24 @@ export const DiseaseAnnotationsTable = () => { props={props} placeholderText={placeholderText} /> - + ); }; const onNegatedEditorValueChange = (event, props) => { - if(event.target.value === undefined || event.target.value === null) return; + if (event.target.value === undefined || event.target.value === null) return; props.editorCallback(event.target.value); setDiseaseAnnotations((prevDiseaseAnnotations) => { prevDiseaseAnnotations[props.rowIndex].negated = event.target.value; return prevDiseaseAnnotations; - }) - } + }); + }; const onInternalEditorValueChange = (props, event) => { let updatedAnnotations = [...props.props.value]; @@ -420,9 +465,9 @@ export const DiseaseAnnotationsTable = () => { options={booleanTerms} editorChange={onInternalEditorValueChange} props={props} - field={"internal"} + field={'internal'} /> - + ); }; @@ -441,25 +486,25 @@ export const DiseaseAnnotationsTable = () => { options={booleanTerms} editorChange={onObsoleteEditorValueChange} props={props} - field={"obsolete"} + field={'obsolete'} /> - + ); }; const onSubjectValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "diseaseAnnotationSubject", setFieldValue, "modEntityId"); + defaultAutocompleteOnChange(props, event, 'diseaseAnnotationSubject', setFieldValue, 'modEntityId'); }; const subjectSearch = (event, setFiltered, setQuery, props) => { const autocompleteFields = getSubjectAutocompleteFields(props); const endpoint = getSubjectEndpoint(props); - const filterName = "diseaseAnnotationSubjectFilter"; + const filterName = 'diseaseAnnotationSubjectFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const subjectEditorTemplate = (props) => { return ( @@ -469,61 +514,85 @@ export const DiseaseAnnotationsTable = () => { search={subjectSearch} rowProps={props} searchService={searchService} - subField='modEntityId' - fieldName='diseaseAnnotationSubject' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + subField="modEntityId" + fieldName="diseaseAnnotationSubject" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onSubjectValueChange} /> ); }; const getSubjectEndpoint = (props) => { - if (props.rowData?.type === "GeneDiseaseAnnotation") return 'gene'; - if (props.rowData?.type === "AlleleDiseaseAnnotation") return 'allele'; - if (props.rowData?.type === "AGMDiseaseAnnotation") return 'agm'; + if (props.rowData?.type === 'GeneDiseaseAnnotation') return 'gene'; + if (props.rowData?.type === 'AlleleDiseaseAnnotation') return 'allele'; + if (props.rowData?.type === 'AGMDiseaseAnnotation') return 'agm'; return 'biologicalentity'; }; const getSubjectAutocompleteFields = (props) => { - let subjectFields = ["curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie"]; - if (props.rowData.type === "AGMDiseaseAnnotation") { - subjectFields.push("name"); - } else if (props.rowData.type === "AlleleDiseaseAnnotation") { - subjectFields.push("alleleFullName.formatText", "alleleFullName.displayText", "alleleSymbol.formatText", "alleleSymbol.displayText", "alleleSynonyms.formatText", "alleleSynonyms.displayText", "alleleSecondaryIds.secondaryId"); - } else if (props.rowData.type === "GeneDiseaseAnnotation") { - subjectFields.push("geneFullName.formatText", "geneFullName.displayText", "geneSymbol.formatText", "geneSymbol.displayText", "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSecondaryIds.secondaryId"); + let subjectFields = ['curie', 'modEntityId', 'modInternalId', 'crossReferences.referencedCurie']; + if (props.rowData.type === 'AGMDiseaseAnnotation') { + subjectFields.push('name'); + } else if (props.rowData.type === 'AlleleDiseaseAnnotation') { + subjectFields.push( + 'alleleFullName.formatText', + 'alleleFullName.displayText', + 'alleleSymbol.formatText', + 'alleleSymbol.displayText', + 'alleleSynonyms.formatText', + 'alleleSynonyms.displayText', + 'alleleSecondaryIds.secondaryId' + ); + } else if (props.rowData.type === 'GeneDiseaseAnnotation') { + subjectFields.push( + 'geneFullName.formatText', + 'geneFullName.displayText', + 'geneSymbol.formatText', + 'geneSymbol.displayText', + 'geneSynonyms.formatText', + 'geneSynonyms.displayText', + 'geneSystematicName.formatText', + 'geneSystematicName.displayText', + 'geneSecondaryIds.secondaryId' + ); } return subjectFields; }; const onSgdStrainBackgroundValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "sgdStrainBackground", setFieldValue, "modEntityId"); + defaultAutocompleteOnChange(props, event, 'sgdStrainBackground', setFieldValue, 'modEntityId'); }; const sgdStrainBackgroundSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["name", "curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie"]; - const endpoint = "agm"; - const filterName = "sgdStrainBackgroundFilter"; + const autocompleteFields = ['name', 'curie', 'modEntityId', 'modInternalId', 'crossReferences.referencedCurie']; + const endpoint = 'agm'; + const filterName = 'sgdStrainBackgroundFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { taxonFilter: { - "taxon.name": { - queryString: "Saccharomyces cerevisiae" - } + 'taxon.name': { + queryString: 'Saccharomyces cerevisiae', + }, }, - } + }; setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); - } + }; const sgdStrainBackgroundEditorTemplate = (props) => { return ( @@ -533,36 +602,63 @@ export const DiseaseAnnotationsTable = () => { initialValue={getIdentifier(props.rowData.sgdStrainBackground)} search={sgdStrainBackgroundSearch} searchService={searchService} - fieldName='sgdStrainBackground' - subField='modEntityId' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="sgdStrainBackground" + subField="modEntityId" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onSgdStrainBackgroundValueChange} /> ); }; const onGeneticModifiersValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "diseaseGeneticModifiers", setFieldValue); + multipleAutocompleteOnChange(props, event, 'diseaseGeneticModifiers', setFieldValue); }; const geneticModifiersSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["geneSymbol.formatText", "geneSymbol.displayText", "geneFullName.formatText", "geneFullName.displayText", "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSecondaryIds.secondaryId", "alleleSymbol.formatText", "alleleFullName.formatText", "alleleFullName.displayText", "alleleSynonyms.formatText", "alleleSynonyms.displayText", "name", "curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie", "alleleSecondaryIds.secondaryId"]; - const endpoint = "biologicalentity"; - const filterName = "geneticModifiersFilter"; + const autocompleteFields = [ + 'geneSymbol.formatText', + 'geneSymbol.displayText', + 'geneFullName.formatText', + 'geneFullName.displayText', + 'geneSynonyms.formatText', + 'geneSynonyms.displayText', + 'geneSystematicName.formatText', + 'geneSystematicName.displayText', + 'geneSecondaryIds.secondaryId', + 'alleleSymbol.formatText', + 'alleleFullName.formatText', + 'alleleFullName.displayText', + 'alleleSynonyms.formatText', + 'alleleSynonyms.displayText', + 'name', + 'curie', + 'modEntityId', + 'modInternalId', + 'crossReferences.referencedCurie', + 'alleleSecondaryIds.secondaryId', + ]; + const endpoint = 'biologicalentity'; + const filterName = 'geneticModifiersFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const geneticModifiersEditorTemplate = (props) => { return ( @@ -571,58 +667,82 @@ export const DiseaseAnnotationsTable = () => { search={geneticModifiersSearch} initialValue={props.rowData.diseaseGeneticModifiers} rowProps={props} - fieldName='diseaseGeneticModifiers' - subField='modEntityId' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="diseaseGeneticModifiers" + subField="modEntityId" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onGeneticModifiersValueChange} /> ); }; const onAssertedAlleleValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "assertedAllele", setFieldValue, "modEntityId"); + defaultAutocompleteOnChange(props, event, 'assertedAllele', setFieldValue, 'modEntityId'); }; const assertedAlleleSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["alleleSymbol.formatText", "alleleSymbol.displayText", "alleleFullName.formatText", "alleleFullName.displayText", "curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie", "alleleSecondaryIds.secondaryId", "alleleSynonyms.formatText", "alleleSynonyms.displayText"]; - const endpoint = "allele"; - const filterName = "assertedAlleleFilter"; + const autocompleteFields = [ + 'alleleSymbol.formatText', + 'alleleSymbol.displayText', + 'alleleFullName.formatText', + 'alleleFullName.displayText', + 'curie', + 'modEntityId', + 'modInternalId', + 'crossReferences.referencedCurie', + 'alleleSecondaryIds.secondaryId', + 'alleleSynonyms.formatText', + 'alleleSynonyms.displayText', + ]; + const endpoint = 'allele'; + const filterName = 'assertedAlleleFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const assertedAlleleEditorTemplate = (props) => { - if (props.rowData.type === "AGMDiseaseAnnotation") { + if (props.rowData.type === 'AGMDiseaseAnnotation') { return ( <> - } + fieldName="assertedAllele" + subField="modEntityId" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onAssertedAlleleValueChange} /> ); @@ -632,24 +752,30 @@ export const DiseaseAnnotationsTable = () => { }; const onDiseaseValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "diseaseAnnotationObject", setFieldValue); + defaultAutocompleteOnChange(props, event, 'diseaseAnnotationObject', setFieldValue); }; - + const diseaseSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["curie", "name", "crossReferences.referencedCurie", "secondaryIdentifiers", "synonyms.name"]; - const endpoint = "doterm"; - const filterName = "diseaseFilter"; + const autocompleteFields = [ + 'curie', + 'name', + 'crossReferences.referencedCurie', + 'secondaryIdentifiers', + 'synonyms.name', + ]; + const endpoint = 'doterm'; + const filterName = 'diseaseFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { obsoleteFilter: { - "obsolete": { - queryString: false - } - } - } + obsolete: { + queryString: false, + }, + }, + }; setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); - } + }; const diseaseEditorTemplate = (props) => { return ( @@ -658,33 +784,46 @@ export const DiseaseAnnotationsTable = () => { search={diseaseSearch} initialValue={props.rowData.diseaseAnnotationObject?.curie} rowProps={props} - fieldName='diseaseAnnotationObject' + fieldName="diseaseAnnotationObject" onValueChangeHandler={onDiseaseValueChange} /> ); }; const onAssertedGeneValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "assertedGenes", setFieldValue); + multipleAutocompleteOnChange(props, event, 'assertedGenes', setFieldValue); }; const assertedGenesSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["geneSymbol.formatText", "geneSymbol.displayText", "geneFullName.formatText", "geneFullName.displayText", "curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie", "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSystematicName.formatText", "geneSystematicName.displayText"]; - const endpoint = "gene"; - const filterName = "assertedGenesFilter"; + const autocompleteFields = [ + 'geneSymbol.formatText', + 'geneSymbol.displayText', + 'geneFullName.formatText', + 'geneFullName.displayText', + 'curie', + 'modEntityId', + 'modInternalId', + 'crossReferences.referencedCurie', + 'geneSynonyms.formatText', + 'geneSynonyms.displayText', + 'geneSystematicName.formatText', + 'geneSystematicName.displayText', + ]; + const endpoint = 'gene'; + const filterName = 'assertedGenesFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const assertedGenesEditorTemplate = (props) => { - if (props.rowData.type === "GeneDiseaseAnnotation") { + if (props.rowData.type === 'GeneDiseaseAnnotation') { return null; } else { return ( @@ -693,15 +832,21 @@ export const DiseaseAnnotationsTable = () => { search={assertedGenesSearch} initialValue={props.rowData.assertedGenes} rowProps={props} - fieldName='assertedGenes' - subField='modEntityId' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="assertedGenes" + subField="modEntityId" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onAssertedGeneValueChange} /> ); @@ -709,25 +854,39 @@ export const DiseaseAnnotationsTable = () => { }; const onWithValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "with", setFieldValue); + multipleAutocompleteOnChange(props, event, 'with', setFieldValue); }; const withSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["geneSymbol.formatText", "geneSymbol.displayText", "geneFullName.formatText", "geneFullName.displayText", "modEntityId", "modInternalId", "curie", "crossReferences.referencedCurie", "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSecondaryIds.secondaryId"]; - const endpoint = "gene"; - const filterName = "withFilter"; + const autocompleteFields = [ + 'geneSymbol.formatText', + 'geneSymbol.displayText', + 'geneFullName.formatText', + 'geneFullName.displayText', + 'modEntityId', + 'modInternalId', + 'curie', + 'crossReferences.referencedCurie', + 'geneSynonyms.formatText', + 'geneSynonyms.displayText', + 'geneSystematicName.formatText', + 'geneSystematicName.displayText', + 'geneSecondaryIds.secondaryId', + ]; + const endpoint = 'gene'; + const filterName = 'withFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { taxonFilter: { - "taxon.curie": { - queryString: "NCBITaxon:9606" - } + 'taxon.curie': { + queryString: 'NCBITaxon:9606', + }, }, - } + }; setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); - } + }; const withEditorTemplate = (props) => { return ( <> @@ -735,45 +894,48 @@ export const DiseaseAnnotationsTable = () => { search={withSearch} initialValue={props.rowData.with} rowProps={props} - fieldName='with' - subField='modEntityId' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="with" + subField="modEntityId" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onWithValueChange} /> - + ); }; const onEvidenceValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "evidenceCodes", setFieldValue); + multipleAutocompleteOnChange(props, event, 'evidenceCodes', setFieldValue); }; const evidenceSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["curie", "name", "abbreviation"]; - const endpoint = "ecoterm"; - const filterName = "evidenceFilter"; + const autocompleteFields = ['curie', 'name', 'abbreviation']; + const endpoint = 'ecoterm'; + const filterName = 'evidenceFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { obsoleteFilter: { - "obsolete": { - queryString: false - } + obsolete: { + queryString: false, + }, }, subsetFilter: { - "subsets": { - queryString: "agr_eco_terms" - } - } - } + subsets: { + queryString: 'agr_eco_terms', + }, + }, + }; setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); - } + }; const evidenceEditorTemplate = (props) => { return ( @@ -782,31 +944,34 @@ export const DiseaseAnnotationsTable = () => { search={evidenceSearch} initialValue={props.rowData.evidenceCodes} rowProps={props} - fieldName='evidenceCodes' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="evidenceCodes" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onEvidenceValueChange} /> - + ); }; const onReferenceValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "singleReference", setFieldValue); + defaultAutocompleteOnChange(props, event, 'singleReference', setFieldValue); }; const referenceSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "curieFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'curieFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const referenceEditorTemplate = (props) => { return ( @@ -815,306 +980,306 @@ export const DiseaseAnnotationsTable = () => { search={referenceSearch} initialValue={() => getRefString(props.rowData.singleReference)} rowProps={props} - fieldName='singleReference' - valueDisplay={(item, setAutocompleteHoverItem, op, query) => - } + fieldName="singleReference" + valueDisplay={(item, setAutocompleteHoverItem, op, query) => ( + + )} onValueChangeHandler={onReferenceValueChange} /> ); }; - const uniqueIdEditorTemplate = (props) => { return ( <> - - {props.rowData.uniqueId} - - + {props.rowData.uniqueId} + ); }; const sgdStrainBackgroundEditorSelector = (props) => { - if (props.rowData.type === "GeneDiseaseAnnotation") { + if (props.rowData.type === 'GeneDiseaseAnnotation') { return sgdStrainBackgroundEditorTemplate(props); - } - else { + } else { return null; } - } - - const columns = [{ - field: "uniqueId", - header: "Unique ID", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, - editor: (props) => uniqueIdEditorTemplate(props) - }, - { - field: "modEntityId", - header: "MOD Annotation ID", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.modentityidFilterConfig, - }, - { - field: "modInternalId", - header: "MOD Internal ID", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, - }, - { - field: "diseaseAnnotationSubject.symbol", - header: "Subject", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.diseaseAnnotationSubjectFieldConfig, - editor: (props) => subjectEditorTemplate(props), - }, - { - field: "relation.name", - header: "Disease Relation", - sortable: true, - filterConfig: FILTER_CONFIGS.relationFilterConfig, - editor: (props) => relationEditor(props) - }, - { - field: "negated", - header: "NOT", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.negatedFilterConfig, - editor: (props) => - }, - { - field: "diseaseAnnotationObject.name", - header: "Disease", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.diseaseAnnotationObjectFilterConfig, - editor: (props) => diseaseEditorTemplate(props), - }, - { - field: "singleReference.primaryCrossReferenceCurie", - header: "Reference", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig, - editor: (props) => referenceEditorTemplate(props), - - }, - { - field: "evidenceCodes.abbreviation", - header: "Evidence Code", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.evidenceCodesFilterConfig, - editor: (props) => evidenceEditorTemplate(props) - }, - { - field: "with.geneSymbol.displayText", - header: "With", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.withFilterConfig, - editor: (props) => withEditorTemplate(props) - }, - { - field: "relatedNotes.freeText", - header: "Related Notes", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, - editor: relatedNotesEditor - }, - { - field: "conditionRelations.handle", - header: "Experiments", - body: (rowData) => { - if (!rowData.conditionRelations?.[0]?.handle) return null; - return ( - - ); + }; + + const columns = [ + { + field: 'uniqueId', + header: 'Unique ID', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, + editor: (props) => uniqueIdEditorTemplate(props), }, - sortable: true, - filterConfig: FILTER_CONFIGS.daConditionRelationsHandleFilterConfig, - editor: (props) => conditionRelationHandleEditor(props) - }, - { - field: "conditionRelations.uniqueId", - header: "Experimental Conditions", - body: (rowData) => { - if (rowData.conditionRelations?.[0]?.handle) return null; - return ( - - ); + { + field: 'modEntityId', + header: 'MOD Annotation ID', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.modentityidFilterConfig, + }, + { + field: 'modInternalId', + header: 'MOD Internal ID', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, + }, + { + field: 'diseaseAnnotationSubject.symbol', + header: 'Subject', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.diseaseAnnotationSubjectFieldConfig, + editor: (props) => subjectEditorTemplate(props), + }, + { + field: 'relation.name', + header: 'Disease Relation', + sortable: true, + filterConfig: FILTER_CONFIGS.relationFilterConfig, + editor: (props) => relationEditor(props), + }, + { + field: 'negated', + header: 'NOT', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.negatedFilterConfig, + editor: (props) => , + }, + { + field: 'diseaseAnnotationObject.name', + header: 'Disease', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.diseaseAnnotationObjectFilterConfig, + editor: (props) => diseaseEditorTemplate(props), + }, + { + field: 'singleReference.primaryCrossReferenceCurie', + header: 'Reference', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig, + editor: (props) => referenceEditorTemplate(props), }, - sortable: true, - filterConfig: FILTER_CONFIGS.daConditionRelationsSummaryFilterConfig, - editor: (props) => conditionRelationsEditor(props) - }, - { - field: "geneticSex.name", - header: "Genetic Sex", - sortable: true, - filterConfig: FILTER_CONFIGS.geneticSexFilterConfig, - editor: (props) => geneticSexEditor(props) - }, - { - field: "diseaseQualifiers.name", - header: "Disease Qualifiers", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.diseaseQualifiersFilterConfig, - editor: (props) => diseaseQualifiersEditor(props) - }, - { - field: "sgdStrainBackground.name", - header: "SGD Strain Background", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.sgdStrainBackgroundFilterConfig, - editor: (props) => sgdStrainBackgroundEditorSelector(props) - }, - { - field: "annotationType.name", - header: "Annotation Type", - sortable: true, - filterConfig: FILTER_CONFIGS.annotationTypeFilterConfig, - editor: (props) => annotationTypeEditor(props) - }, - { - field: "diseaseGeneticModifierRelation.name", - header: "Genetic Modifier Relation", - sortable: true, - filterConfig: FILTER_CONFIGS.geneticModifierRelationFilterConfig, - editor: (props) => geneticModifierRelationEditor(props) - }, - { - field: "diseaseGeneticModifiers.symbol", - header: "Genetic Modifiers", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.geneticModifiersFilterConfig, - editor: (props) => geneticModifiersEditorTemplate(props), - }, - { - field: "inferredGene.geneSymbol.displayText", - header: "Inferred Gene", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.inferredGeneFilterConfig, - }, - { - field: "assertedGenes.geneSymbol.displayText", - header: "Asserted Genes", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.assertedGenesFilterConfig, - editor: (props) => assertedGenesEditorTemplate(props), - }, - { - field: "inferredAllele.alleleSymbol.displayText", - header: "Inferred Allele", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.inferredAlleleFilterConfig, - }, - { - field: "assertedAllele.alleleSymbol.displayText", - header: "Asserted Allele", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.assertedAlleleFilterConfig, - editor: (props) => assertedAlleleEditorTemplate(props), - }, - { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", - sortable: true, - filterConfig: FILTER_CONFIGS.diseaseDataProviderFilterConfig, - }, - { - field: "secondaryDataProvider.sourceOrganization.abbreviation", - header: "Secondary Data Provider", - sortable: true, - filterConfig: FILTER_CONFIGS.secondaryDataProviderFilterConfig, - }, - { - field: "updatedBy.uniqueId", - header: "Updated By", - sortable: true, - filterConfig: FILTER_CONFIGS.updatedByFilterConfig, - }, - { - field: "dateUpdated", - header: "Date Updated", - sortable: true, - filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, - }, - { - field: "createdBy.uniqueId", - header: "Created By", - sortable: true, - filterConfig: FILTER_CONFIGS.createdByFilterConfig, - }, - { - field: "dateCreated", - header: "Date Created", - sortable: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, - }, - { - field: "internal", - header: "Internal", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.internalFilterConfig, - editor: (props) => internalEditor(props) - }, - { - field: "obsolete", - header: "Obsolete", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, - editor: (props) => obsoleteEditor(props) - } -]; - -const DEFAULT_COLUMN_WIDTH = 10; -const SEARCH_ENDPOINT = "disease-annotation"; -const defaultFilters = {obsoleteFilter: {obsolete: {queryString: "false", tokenOperator: "OR"}}}; - -const initialTableState = getDefaultTableState("DiseaseAnnotations", columns, DEFAULT_COLUMN_WIDTH, defaultFilters); - -const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); - -const { isLoading, isFetching } = useGetTableData({ + { + field: 'evidenceCodes.abbreviation', + header: 'Evidence Code', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.evidenceCodesFilterConfig, + editor: (props) => evidenceEditorTemplate(props), + }, + { + field: 'with.geneSymbol.displayText', + header: 'With', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.withFilterConfig, + editor: (props) => withEditorTemplate(props), + }, + { + field: 'relatedNotes.freeText', + header: 'Related Notes', + body: (rowData) => ( + + ), + sortable: true, + filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, + editor: relatedNotesEditor, + }, + { + field: 'conditionRelations.handle', + header: 'Experiments', + body: (rowData) => { + if (!rowData.conditionRelations?.[0]?.handle) return null; + return ( + + ); + }, + sortable: true, + filterConfig: FILTER_CONFIGS.daConditionRelationsHandleFilterConfig, + editor: (props) => conditionRelationHandleEditor(props), + }, + { + field: 'conditionRelations.uniqueId', + header: 'Experimental Conditions', + body: (rowData) => { + if (rowData.conditionRelations?.[0]?.handle) return null; + return ( + + ); + }, + sortable: true, + filterConfig: FILTER_CONFIGS.daConditionRelationsSummaryFilterConfig, + editor: (props) => conditionRelationsEditor(props), + }, + { + field: 'geneticSex.name', + header: 'Genetic Sex', + sortable: true, + filterConfig: FILTER_CONFIGS.geneticSexFilterConfig, + editor: (props) => geneticSexEditor(props), + }, + { + field: 'diseaseQualifiers.name', + header: 'Disease Qualifiers', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.diseaseQualifiersFilterConfig, + editor: (props) => diseaseQualifiersEditor(props), + }, + { + field: 'sgdStrainBackground.name', + header: 'SGD Strain Background', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.sgdStrainBackgroundFilterConfig, + editor: (props) => sgdStrainBackgroundEditorSelector(props), + }, + { + field: 'annotationType.name', + header: 'Annotation Type', + sortable: true, + filterConfig: FILTER_CONFIGS.annotationTypeFilterConfig, + editor: (props) => annotationTypeEditor(props), + }, + { + field: 'diseaseGeneticModifierRelation.name', + header: 'Genetic Modifier Relation', + sortable: true, + filterConfig: FILTER_CONFIGS.geneticModifierRelationFilterConfig, + editor: (props) => geneticModifierRelationEditor(props), + }, + { + field: 'diseaseGeneticModifiers.symbol', + header: 'Genetic Modifiers', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.geneticModifiersFilterConfig, + editor: (props) => geneticModifiersEditorTemplate(props), + }, + { + field: 'inferredGene.geneSymbol.displayText', + header: 'Inferred Gene', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.inferredGeneFilterConfig, + }, + { + field: 'assertedGenes.geneSymbol.displayText', + header: 'Asserted Genes', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.assertedGenesFilterConfig, + editor: (props) => assertedGenesEditorTemplate(props), + }, + { + field: 'inferredAllele.alleleSymbol.displayText', + header: 'Inferred Allele', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.inferredAlleleFilterConfig, + }, + { + field: 'assertedAllele.alleleSymbol.displayText', + header: 'Asserted Allele', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.assertedAlleleFilterConfig, + editor: (props) => assertedAlleleEditorTemplate(props), + }, + { + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', + sortable: true, + filterConfig: FILTER_CONFIGS.diseaseDataProviderFilterConfig, + }, + { + field: 'secondaryDataProvider.sourceOrganization.abbreviation', + header: 'Secondary Data Provider', + sortable: true, + filterConfig: FILTER_CONFIGS.secondaryDataProviderFilterConfig, + }, + { + field: 'updatedBy.uniqueId', + header: 'Updated By', + sortable: true, + filterConfig: FILTER_CONFIGS.updatedByFilterConfig, + }, + { + field: 'dateUpdated', + header: 'Date Updated', + sortable: true, + filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, + }, + { + field: 'createdBy.uniqueId', + header: 'Created By', + sortable: true, + filterConfig: FILTER_CONFIGS.createdByFilterConfig, + }, + { + field: 'dateCreated', + header: 'Date Created', + sortable: true, + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, + }, + { + field: 'internal', + header: 'Internal', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.internalFilterConfig, + editor: (props) => internalEditor(props), + }, + { + field: 'obsolete', + header: 'Obsolete', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, + editor: (props) => obsoleteEditor(props), + }, + ]; + + const DEFAULT_COLUMN_WIDTH = 10; + const SEARCH_ENDPOINT = 'disease-annotation'; + const defaultFilters = { obsoleteFilter: { obsolete: { queryString: 'false' } } }; + + const initialTableState = getDefaultTableState('DiseaseAnnotations', columns, DEFAULT_COLUMN_WIDTH, defaultFilters); + + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); + + const { isLoading, isFetching } = useGetTableData({ tableState, endpoint: SEARCH_ENDPOINT, sortMapping, @@ -1122,13 +1287,14 @@ const { isLoading, isFetching } = useGetTableData({ setEntities: setDiseaseAnnotations, setTotalRecords, toast_topleft, - searchService + searchService, }); - const headerButtons = (disabled=false) => { + const headerButtons = (disabled = false) => { return ( <> -
    setNewEntity(tableState, setDiseaseAnnotations, newAnnotation, queryClient)} + setNewDiseaseAnnotation={(newAnnotation, queryClient) => + setNewEntity(tableState, setDiseaseAnnotations, newAnnotation, queryClient) + } /> ); }; - diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js index 3389ba273..8f54d5921 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js @@ -1,40 +1,46 @@ -import React, { useRef, useState } from "react"; -import { Dialog } from "primereact/dialog"; -import { Button } from "primereact/button"; -import { Dropdown } from "primereact/dropdown"; -import { Toast } from "primereact/toast"; +import React, { useRef, useState } from 'react'; +import { Dialog } from 'primereact/dialog'; +import { Button } from 'primereact/button'; +import { Dropdown } from 'primereact/dropdown'; +import { Toast } from 'primereact/toast'; import { MultiSelect } from 'primereact/multiselect'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { FormErrorMessageComponent } from "../../components/Error/FormErrorMessageComponent"; -import { NotEditor } from "../../components/Editors/NotEditor"; -import { classNames } from "primereact/utils"; -import { DiseaseAnnotationService } from "../../service/DiseaseAnnotationService"; -import { Splitter, SplitterPanel } from "primereact/splitter"; +import { FormErrorMessageComponent } from '../../components/Error/FormErrorMessageComponent'; +import { NotEditor } from '../../components/Editors/NotEditor'; +import { classNames } from 'primereact/utils'; +import { DiseaseAnnotationService } from '../../service/DiseaseAnnotationService'; +import { Splitter, SplitterPanel } from 'primereact/splitter'; import { LiteratureAutocompleteTemplate } from '../../components/Autocomplete/LiteratureAutocompleteTemplate'; import { SubjectAutocompleteTemplate } from '../../components/Autocomplete/SubjectAutocompleteTemplate'; import { EvidenceAutocompleteTemplate } from '../../components/Autocomplete/EvidenceAutocompleteTemplate'; -import { RelatedNotesForm } from "./RelatedNotesForm"; -import { ConditionRelationsForm } from "./ConditionRelationsForm"; -import { ConditionRelationHandleFormDropdown } from "../../components/ConditionRelationHandleFormSelector"; +import { RelatedNotesForm } from './RelatedNotesForm'; +import { ConditionRelationsForm } from './ConditionRelationsForm'; +import { ConditionRelationHandleFormDropdown } from '../../components/ConditionRelationHandleFormSelector'; import { ControlledVocabularyFormDropdown } from '../../components/ControlledVocabularyFormSelector'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { ControlledVocabularyFormMultiSelectDropdown } from '../../components/ControlledVocabularyFormMultiSelector'; -import { AutocompleteFormEditor } from "../../components/Autocomplete/AutocompleteFormEditor"; -import { autocompleteSearch, buildAutocompleteFilter, validateRequiredFields, validateFormBioEntityFields, validateTable } from "../../utils/utils"; -import { AutocompleteFormMultiEditor } from "../../components/Autocomplete/AutocompleteFormMultiEditor"; -import { SubjectAdditionalFieldData } from "../../components/FieldData/SubjectAdditionalFieldData"; -import { AssertedAlleleAdditionalFieldData } from "../../components/FieldData/AssertedAlleleAdditionalFieldData"; -import { DiseaseAdditionalFieldData } from "../../components/FieldData/DiseaseAdditionalFieldData"; -import { SingleReferenceAdditionalFieldData } from "../../components/FieldData/SingleReferenceAdditionalFieldData"; -import { SGDStrainBackgroundAdditionalFieldData } from "../../components/FieldData/SGDStrainBackgroundAdditionalFieldData"; -import { AssertedGenesAdditionalFieldData } from "../../components/FieldData/AssertedGenesAdditionalFieldData"; -import { EvidenceCodesAdditionalFieldData } from "../../components/FieldData/EvidenceCodesAdditionalFieldData"; -import { WithAdditionalFieldData } from "../../components/FieldData/WithAdditionalFieldData"; -import { GeneticModifiersAdditionalFieldData } from "../../components/FieldData/GeneticModifiersAdditionalFieldData"; -import ErrorBoundary from "../../components/Error/ErrorBoundary"; -import { ConfirmButton } from "../../components/ConfirmButton"; -import { getDefaultFormState, getModFormFields } from "../../service/TableStateService"; -import { useGetUserSettings } from "../../service/useGetUserSettings"; +import { AutocompleteFormEditor } from '../../components/Autocomplete/AutocompleteFormEditor'; +import { + autocompleteSearch, + buildAutocompleteFilter, + validateRequiredFields, + validateFormBioEntityFields, + validateTable, +} from '../../utils/utils'; +import { AutocompleteFormMultiEditor } from '../../components/Autocomplete/AutocompleteFormMultiEditor'; +import { SubjectAdditionalFieldData } from '../../components/FieldData/SubjectAdditionalFieldData'; +import { AssertedAlleleAdditionalFieldData } from '../../components/FieldData/AssertedAlleleAdditionalFieldData'; +import { DiseaseAdditionalFieldData } from '../../components/FieldData/DiseaseAdditionalFieldData'; +import { SingleReferenceAdditionalFieldData } from '../../components/FieldData/SingleReferenceAdditionalFieldData'; +import { SGDStrainBackgroundAdditionalFieldData } from '../../components/FieldData/SGDStrainBackgroundAdditionalFieldData'; +import { AssertedGenesAdditionalFieldData } from '../../components/FieldData/AssertedGenesAdditionalFieldData'; +import { EvidenceCodesAdditionalFieldData } from '../../components/FieldData/EvidenceCodesAdditionalFieldData'; +import { WithAdditionalFieldData } from '../../components/FieldData/WithAdditionalFieldData'; +import { GeneticModifiersAdditionalFieldData } from '../../components/FieldData/GeneticModifiersAdditionalFieldData'; +import ErrorBoundary from '../../components/Error/ErrorBoundary'; +import { ConfirmButton } from '../../components/ConfirmButton'; +import { getDefaultFormState, getModFormFields } from '../../service/TableStateService'; +import { useGetUserSettings } from '../../service/useGetUserSettings'; export const NewAnnotationForm = ({ newAnnotationState, @@ -43,7 +49,7 @@ export const NewAnnotationForm = ({ diseaseAnnotationService, relationsTerms, negatedTerms, - setNewDiseaseAnnotation + setNewDiseaseAnnotation, }) => { const queryClient = useQueryClient(); const toast_success = useRef(null); @@ -75,14 +81,32 @@ export const NewAnnotationForm = ({ const geneticModifierRelationTerms = useControlledVocabularyService('disease_genetic_modifier_relation'); const [uiErrorMessages, setUiErrorMessages] = useState({}); const areUiErrors = useRef(false); - let newAnnotationOptionalFields = ["Asserted Genes", "Asserted Allele", "NOT", "With", "Related Notes", "Experimental Conditions", "Experiments", "Genetic Sex", - "Disease Qualifiers", "SGD Strain Background", "Annotation Type", "Genetic Modifier Relation", "Genetic Modifiers", "Internal"]; + let newAnnotationOptionalFields = [ + 'Asserted Genes', + 'Asserted Allele', + 'NOT', + 'With', + 'Related Notes', + 'Experimental Conditions', + 'Experiments', + 'Genetic Sex', + 'Disease Qualifiers', + 'SGD Strain Background', + 'Annotation Type', + 'Genetic Modifier Relation', + 'Genetic Modifiers', + 'Internal', + ]; const oktaToken = JSON.parse(localStorage.getItem('okta-token-storage')); - const mod = oktaToken?.accessToken?.claims?.Groups?.filter(group => group.includes("Staff")); - let defaultUserSettings = getDefaultFormState("DiseaseAnnotations", newAnnotationOptionalFields, undefined); - const { settings: settingsKey, mutate: setSettingsKey } = useGetUserSettings('DiseaseAnnotationsFormSettings', defaultUserSettings, false); + const mod = oktaToken?.accessToken?.claims?.Groups?.filter((group) => group.includes('Staff')); + let defaultUserSettings = getDefaultFormState('DiseaseAnnotations', newAnnotationOptionalFields, undefined); + const { settings: settingsKey, mutate: setSettingsKey } = useGetUserSettings( + 'DiseaseAnnotationsFormSettings', + defaultUserSettings, + false + ); const { selectedFormFields } = settingsKey; - const mutation = useMutation(newAnnotation => { + const mutation = useMutation((newAnnotation) => { if (!diseaseAnnotationService) { diseaseAnnotationService = new DiseaseAnnotationService(); } @@ -90,25 +114,25 @@ export const NewAnnotationForm = ({ }); const hideDialog = () => { - newAnnotationDispatch({ type: "RESET" }); - newAnnotationDispatch({ type: "SET_IS_ENABLED", value: false }); - newAnnotationDispatch({ type: "SET_IS_ASSERTED_ALLELE_ENABLED", value: false }); - newAnnotationDispatch({ type: "SET_IS_ASSERTED_GENE_ENABLED", value: false }); + newAnnotationDispatch({ type: 'RESET' }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_ALLELE_ENABLED', value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: false }); setUiErrorMessages({}); }; const handleSubmit = async (event, closeAfterSubmit = true) => { event.preventDefault(); - newAnnotationDispatch({ type: "SUBMIT" }); + newAnnotationDispatch({ type: 'SUBMIT' }); const isRelatedNotesErrors = await validateTable( - "note", - "relatedNotesErrorMessages", + 'note', + 'relatedNotesErrorMessages', newAnnotation.relatedNotes, newAnnotationDispatch ); const isExConErrors = await validateTable( - "condition-relation", - "exConErrorMessages", + 'condition-relation', + 'exConErrorMessages', newAnnotation.conditionRelations, newAnnotationDispatch ); @@ -117,7 +141,7 @@ export const NewAnnotationForm = ({ validateRequiredFields(newAnnotation, uiErrorMessages, setUiErrorMessages, areUiErrors, mod); validateFormBioEntityFields(newAnnotation, uiErrorMessages, setUiErrorMessages, areUiErrors); if (areUiErrors.current) { - newAnnotationDispatch({ type: "SET_IS_ENABLED", value: true }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: true }); return; } @@ -128,9 +152,8 @@ export const NewAnnotationForm = ({ queryClient.invalidateQueries(['DiseaseAnnotationsHandles']); toast_success.current.show({ severity: 'success', summary: 'Successful', detail: 'New Annotation Added' }); if (closeAfterSubmit) { - newAnnotationDispatch({ type: "RESET" }); - } - else { + newAnnotationDispatch({ type: 'RESET' }); + } else { setUiErrorMessages({}); } @@ -138,10 +161,9 @@ export const NewAnnotationForm = ({ } }, onError: (error) => { - let message; if (error?.response?.data?.errorMessages?.uniqueId) { - message = "Page Error: New annotation is a duplicate of an existing annotation"; + message = 'Page Error: New annotation is a duplicate of an existing annotation'; } else if (error?.response?.data?.errorMessage) { message = error.response.data.errorMessage; } else { @@ -151,25 +173,23 @@ export const NewAnnotationForm = ({ toast_error.current.show({ severity: 'error', summary: 'Page error: ', detail: message }); - newAnnotationDispatch( - { - type: "UPDATE_ERROR_MESSAGES", - errorType: "errorMessages", - errorMessages: error.response?.data?.errorMessages || {} - } - ); - } + newAnnotationDispatch({ + type: 'UPDATE_ERROR_MESSAGES', + errorType: 'errorMessages', + errorMessages: error.response?.data?.errorMessages || {}, + }); + }, }); }; const handleClear = () => { //this manually resets the value of the input text in autocomplete fields with multiple values and the experiments dropdown - if (withRef.current?.getInput()) withRef.current.getInput().value = ""; - if (evidenceCodesRef.current?.getInput().value) evidenceCodesRef.current.getInput().value = ""; - newAnnotationDispatch({ type: "CLEAR" }); - newAnnotationDispatch({ type: "SET_IS_ENABLED", value: false }); - newAnnotationDispatch({ type: "SET_IS_ASSERTED_GENE_ENABLED", value: false }); - newAnnotationDispatch({ type: "SET_IS_ASSERTED_ALLELE_ENABLED", value: false }); + if (withRef.current?.getInput()) withRef.current.getInput().value = ''; + if (evidenceCodesRef.current?.getInput().value) evidenceCodesRef.current.getInput().value = ''; + newAnnotationDispatch({ type: 'CLEAR' }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_ALLELE_ENABLED', value: false }); setUiErrorMessages({}); }; @@ -181,31 +201,31 @@ export const NewAnnotationForm = ({ const onSingleReferenceChange = (event) => { setUiErrorMessages({}); newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const referenceSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["curie", "cross_references.curie"]; - const endpoint = "literature-reference"; - const filterName = "curieFilter"; + const autocompleteFields = ['curie', 'cross_references.curie']; + const endpoint = 'literature-reference'; + const filterName = 'curieFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; const sgdStrainBackgroundSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["name", "curie", "modEntityId", "modInternalId", "crossReferences.referencedCurie"]; - const endpoint = "agm"; - const filterName = "sgdStrainBackgroundFilter"; + const autocompleteFields = ['name', 'curie', 'modEntityId', 'modInternalId', 'crossReferences.referencedCurie']; + const endpoint = 'agm'; + const filterName = 'sgdStrainBackgroundFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { taxonFilter: { - "taxon.name": { - queryString: "Saccharomyces cerevisiae" - } + 'taxon.name': { + queryString: 'Saccharomyces cerevisiae', + }, }, }; setQuery(event.query); @@ -213,9 +233,22 @@ export const NewAnnotationForm = ({ }; const geneticModifiersSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["geneSymbol.displayText", "geneFullName.displayText", "alleleSymbol.displayText", "alleleFullName.displayText", "modEntityId", "modInternalId", "name", "curie", "crossReferences.referencedCurie", "alleleSecondaryIds.secondaryId", "geneSynonyms.displayText", "alleleSynonyms.displayText"]; - const endpoint = "biologicalentity"; - const filterName = "geneticModifiersFilter"; + const autocompleteFields = [ + 'geneSymbol.displayText', + 'geneFullName.displayText', + 'alleleSymbol.displayText', + 'alleleFullName.displayText', + 'modEntityId', + 'modInternalId', + 'name', + 'curie', + 'crossReferences.referencedCurie', + 'alleleSecondaryIds.secondaryId', + 'geneSynonyms.displayText', + 'alleleSynonyms.displayText', + ]; + const endpoint = 'biologicalentity'; + const filterName = 'geneticModifiersFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -224,45 +257,49 @@ export const NewAnnotationForm = ({ const onSubjectChange = (event) => { setUiErrorMessages({}); if (event.target && event.target.value !== '' && event.target.value != null) { - newAnnotationDispatch({ type: "SET_IS_ENABLED", value: true }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: true }); } else { - newAnnotationDispatch({ type: "SET_IS_ENABLED", value: false }); + newAnnotationDispatch({ type: 'SET_IS_ENABLED', value: false }); } - if (event.target.value && event.target.value.type && (event.target.value.type === "Allele" || event.target.value.type === "AffectedGenomicModel")) { - newAnnotationDispatch({ type: "SET_IS_ASSERTED_GENE_ENABLED", value: true }); + if ( + event.target.value && + event.target.value.type && + (event.target.value.type === 'Allele' || event.target.value.type === 'AffectedGenomicModel') + ) { + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: true }); } else { - newAnnotationDispatch({ type: "SET_IS_ASSERTED_GENE_ENABLED", value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_GENE_ENABLED', value: false }); } - if (event.target.value && event.target.value.type && (event.target.value.type === "AffectedGenomicModel")) { - newAnnotationDispatch({ type: "SET_IS_ASSERTED_ALLELE_ENABLED", value: true }); + if (event.target.value && event.target.value.type && event.target.value.type === 'AffectedGenomicModel') { + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_ALLELE_ENABLED', value: true }); } else { - newAnnotationDispatch({ type: "SET_IS_ASSERTED_ALLELE_ENABLED", value: false }); + newAnnotationDispatch({ type: 'SET_IS_ASSERTED_ALLELE_ENABLED', value: false }); } newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const subjectSearch = (event, setFiltered, setQuery) => { //The order of the below fields are as per the Autocomplete search result const autocompleteFields = [ - "geneSymbol.displayText", - "alleleSymbol.displayText", - "name", - "geneFullName.displayText", - "alleleFullName.displayText", - "alleleSynonyms.displayText", - "geneSynonyms.displayText", - "modEntityId", - "modInternalId", - "curie", - "crossReferences.referencedCurie", - "alleleSecondaryIds.secondaryId", + 'geneSymbol.displayText', + 'alleleSymbol.displayText', + 'name', + 'geneFullName.displayText', + 'alleleFullName.displayText', + 'alleleSynonyms.displayText', + 'geneSynonyms.displayText', + 'modEntityId', + 'modInternalId', + 'curie', + 'crossReferences.referencedCurie', + 'alleleSecondaryIds.secondaryId', ]; - const endpoint = "biologicalentity"; - const filterName = "diseaseAnnotationSubjectFilter"; + const endpoint = 'biologicalentity'; + const filterName = 'diseaseAnnotationSubjectFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -274,16 +311,22 @@ export const NewAnnotationForm = ({ const value = typeof event.value === "string" ? {curie: stringValue} : {curie};*/ newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.value + value: event.value, }); }; const diseaseSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["curie", "name", "crossReferences.referencedCurie", "secondaryIdentifiers", "synonyms.name"]; - const endpoint = "doterm"; - const filterName = "diseaseFilter"; + const autocompleteFields = [ + 'curie', + 'name', + 'crossReferences.referencedCurie', + 'secondaryIdentifiers', + 'synonyms.name', + ]; + const endpoint = 'doterm'; + const filterName = 'diseaseFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -291,61 +334,58 @@ export const NewAnnotationForm = ({ const onDropdownFieldChange = (event) => { newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onDropdownExperimentsFieldChange = (event) => { newAnnotationDispatch({ - type: "EDIT_EXPERIMENT", + type: 'EDIT_EXPERIMENT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onArrayFieldChange = (event) => { newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onControlledVocabChange = (event) => { newAnnotationDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const isExperimentEnabled = () => { return ( //only enabled if a reference is selected from suggestions and condition relation table isn't visible - typeof newAnnotation.singleReference === "object" - && newAnnotation.singleReference.curie !== "" - && !showConditionRelations + typeof newAnnotation.singleReference === 'object' && + newAnnotation.singleReference.curie !== '' && + !showConditionRelations ); }; const isConditionRelationButtonEnabled = () => { - return ( - newAnnotation.conditionRelations?.[0] - && newAnnotation.conditionRelations?.[0].handle - ); + return newAnnotation.conditionRelations?.[0] && newAnnotation.conditionRelations?.[0].handle; }; const evidenceSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["curie", "name", "abbreviation"]; - const endpoint = "ecoterm"; - const filterName = "evidenceFilter"; + const autocompleteFields = ['curie', 'name', 'abbreviation']; + const endpoint = 'ecoterm'; + const filterName = 'evidenceFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { subsetFilter: { - "subsets": { - queryString: "agr_eco_terms" - } - } + subsets: { + queryString: 'agr_eco_terms', + }, + }, }; setInputValue(event.query); @@ -353,15 +393,23 @@ export const NewAnnotationForm = ({ }; const withSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = ["geneSymbol.displayText", "geneFullName.displayText", "modEntityId", "modInternalId", "curie", "crossReferences.referencedCurie", "geneSynonyms.displayText"]; - const endpoint = "gene"; - const filterName = "withFilter"; + const autocompleteFields = [ + 'geneSymbol.displayText', + 'geneFullName.displayText', + 'modEntityId', + 'modInternalId', + 'curie', + 'crossReferences.referencedCurie', + 'geneSynonyms.displayText', + ]; + const endpoint = 'gene'; + const filterName = 'withFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { taxonFilter: { - "taxon.curie": { - queryString: "NCBITaxon:9606" - } + 'taxon.curie': { + queryString: 'NCBITaxon:9606', + }, }, }; @@ -376,29 +424,57 @@ export const NewAnnotationForm = ({
    ); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js index d964e5d9d..7d332cfd8 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js @@ -1,13 +1,18 @@ -import React from "react"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { DiseaseAnnotationsPage } from "../index"; +import { DiseaseAnnotationsPage } from '../index'; import '../../../tools/jest/setupTests'; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData"; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -15,49 +20,49 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); - + await waitFor(() => { expect(result); }); }, 10000); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Disease Annotations Table/i); expect(tableTitle).toBeInTheDocument(); }, 10000); - it("The table contains correct data", async () => { + it('The table contains correct data', async () => { let result = await renderWithClient(); - const uniqueIdTd = await result.findByText("MGI:5560505|DOID:0050545|AGRKB:101000000827851"); - const modInternalIdTd = await result.findByText("mockModInternalId"); + const uniqueIdTd = await result.findByText('MGI:5560505|DOID:0050545|AGRKB:101000000827851'); + const modInternalIdTd = await result.findByText('mockModInternalId'); const subjectTd = await result.findByText(/C57BL\/6J-Rfx3/i); - const relationTd = await result.findByText("is_model_of"); - const internalObsoleteArray = await result.findAllByText("false"); - const NOTArray = await result.findAllByText("NOT"); + const relationTd = await result.findByText('is_model_of'); + const internalObsoleteArray = await result.findAllByText('false'); + const NOTArray = await result.findAllByText('NOT'); const diseaseTd = await result.findByText(/visceral heterotaxy/i); const referenceTd = await result.findByText(/MGI:5284969/i); const evidenceCodeTd = await result.findByText(/TAS/i); - const withTd = await result.findByText("with_test_symbol (with_test_curie)"); + const withTd = await result.findByText('with_test_symbol (with_test_curie)'); const annotationTypeTd = await result.findByText(/manually_curated/i); - const inferredGeneTd = await result.findByText("Rfx3 (MGI:106582)"); + const inferredGeneTd = await result.findByText('Rfx3 (MGI:106582)'); const inferredAlleleTd = await result.findByText(/MGI:5560494/i); - const dataProviderTd = await result.findByText("MGI"); - const relatedNotesTd = await result.findByText("Notes (1)"); - const conditionRelationHandleTd = await result.findByText("condition relations handle test"); - const diseaseQualifiersTd = await result.findByText("disease qualifiers test"); - const geneticSexTd = await result.findByText("genetic sex test"); - const sgdStrainBackgroundTd = await result.findByText("SGD Strain Background test (sgd test curie)"); - const diseaseGeneticModifierRelationTd = await result.findByText("disease genetic modifier relation test"); - const secondaryDataProviderTd = await result.findByText("test provider"); - - const updatedByCreatedByArray = await result.findAllByText("MGI:curation_staff"); - const dateUpdatedDateCreatedArray = await result.findAllByText("2017-06-08T14:15:35Z"); + const dataProviderTd = await result.findByText('MGI'); + const relatedNotesTd = await result.findByText('Notes (1)'); + const conditionRelationHandleTd = await result.findByText('condition relations handle test'); + const diseaseQualifiersTd = await result.findByText('disease qualifiers test'); + const geneticSexTd = await result.findByText('genetic sex test'); + const sgdStrainBackgroundTd = await result.findByText('SGD Strain Background test (sgd test curie)'); + const diseaseGeneticModifierRelationTd = await result.findByText('disease genetic modifier relation test'); + const secondaryDataProviderTd = await result.findByText('test provider'); + + const updatedByCreatedByArray = await result.findAllByText('MGI:curation_staff'); + const dateUpdatedDateCreatedArray = await result.findAllByText('2017-06-08T14:15:35Z'); await waitFor(() => { expect(uniqueIdTd).toBeInTheDocument(); @@ -85,5 +90,4 @@ describe("", () => { expect(dateUpdatedDateCreatedArray.length).toEqual(2); }); }, 10000); - }); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/index.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/index.js index e29282695..09c10ca0e 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/index.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/index.js @@ -1,3 +1,3 @@ -import { DiseaseAnnotationsPage } from "./DiseaseAnnotationsPage"; +import { DiseaseAnnotationsPage } from './DiseaseAnnotationsPage'; -export { DiseaseAnnotationsPage }; \ No newline at end of file +export { DiseaseAnnotationsPage }; diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js index 5e423d5f2..7cc7b0344 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js @@ -1,547 +1,540 @@ export const data = { - "results": [ + results: [ { - "type": "AGMDiseaseAnnotation", - "modInternalId": "mockModInternalId", - "createdBy": { - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "id": 10740932, - "uniqueId": "MGI:curation_staff" + type: 'AGMDiseaseAnnotation', + modInternalId: 'mockModInternalId', + createdBy: { + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + id: 10740932, + uniqueId: 'MGI:curation_staff', }, - "relatedNotes": [ + relatedNotes: [ { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-22T21:20:00.253489Z", - "dbDateUpdated": "2023-05-22T21:20:00.25349Z", - "id": 82884270, - "freeText": "Yeast GRS1 is homologous to human GARS1, and has been used to study Charcot-Marie-Tooth disease type 2D and severe infantile-onset spinal muscular atrophy", - "noteType": { - "internal": false, - "obsolete": false, - "id": 7662728, - "name": "disease_summary" - } - } + internal: false, + obsolete: false, + dbDateCreated: '2023-05-22T21:20:00.253489Z', + dbDateUpdated: '2023-05-22T21:20:00.25349Z', + id: 82884270, + freeText: + 'Yeast GRS1 is homologous to human GARS1, and has been used to study Charcot-Marie-Tooth disease type 2D and severe infantile-onset spinal muscular atrophy', + noteType: { + internal: false, + obsolete: false, + id: 7662728, + name: 'disease_summary', + }, + }, ], - "conditionRelations": [{ "handle": "condition relations handle test" }], - "with": [ + conditionRelations: [{ handle: 'condition relations handle test' }], + with: [ { - "curie": "with_test_curie", - "geneSymbol": { - "displayText": "with_test_symbol" - } - } + curie: 'with_test_curie', + geneSymbol: { + displayText: 'with_test_symbol', + }, + }, ], - "secondaryDataProvider": { - "sourceOrganization": { - "abbreviation": "test provider" - } + secondaryDataProvider: { + sourceOrganization: { + abbreviation: 'test provider', + }, }, - "geneticSex": { - "name": "genetic sex test" + geneticSex: { + name: 'genetic sex test', }, - "updatedBy": { - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "id": 10740932, - "uniqueId": "MGI:curation_staff" + updatedBy: { + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + id: 10740932, + uniqueId: 'MGI:curation_staff', }, - "diseaseGeneticModifierRelation": {"name": "disease genetic modifier relation test"}, - "sgdStrainBackground": { - "curie": "sgd test curie", - "name": "SGD Strain Background test" - }, - "diseaseGeneticModifiers": [{"symbol": "disease genetic modifier test"}], - "diseaseQualifiers": [{"name": "disease qualifiers test"}], - "dateCreated": "2017-06-08T14:15:35Z", - "dateUpdated": "2017-06-08T14:15:35Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-18T16:33:33.683726Z", - "dbDateUpdated": "2023-03-16T15:24:38.954678Z", - "id": 18394375, - "uniqueId": "MGI:5560505|DOID:0050545|AGRKB:101000000827851", - "diseaseAnnotationObject": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-04-02T22:02:52.730635Z", - "curie": "DOID:0050545", - "name": "visceral heterotaxy", - "namespace": "disease_ontology", - "definition": "A physical disorder characterized by the abnormal distribution of the major visceral organs within the chest and abdomen.", - "definitionUrls": [ - "url:http://en.wikipedia.org/wiki/Situs_ambiguus" - ], - "subsets": [ - "DO_rare_slim" - ], - "synonyms": [ + diseaseGeneticModifierRelation: { name: 'disease genetic modifier relation test' }, + sgdStrainBackground: { + curie: 'sgd test curie', + name: 'SGD Strain Background test', + }, + diseaseGeneticModifiers: [{ symbol: 'disease genetic modifier test' }], + diseaseQualifiers: [{ name: 'disease qualifiers test' }], + dateCreated: '2017-06-08T14:15:35Z', + dateUpdated: '2017-06-08T14:15:35Z', + internal: false, + obsolete: false, + dbDateCreated: '2022-11-18T16:33:33.683726Z', + dbDateUpdated: '2023-03-16T15:24:38.954678Z', + id: 18394375, + uniqueId: 'MGI:5560505|DOID:0050545|AGRKB:101000000827851', + diseaseAnnotationObject: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-04-02T22:02:52.730635Z', + curie: 'DOID:0050545', + name: 'visceral heterotaxy', + namespace: 'disease_ontology', + definition: + 'A physical disorder characterized by the abnormal distribution of the major visceral organs within the chest and abdomen.', + definitionUrls: ['url:http://en.wikipedia.org/wiki/Situs_ambiguus'], + subsets: ['DO_rare_slim'], + synonyms: [ { - "internal": false, - "obsolete": false, - "id": 12282324, - "name": "heterotaxia" + internal: false, + obsolete: false, + id: 12282324, + name: 'heterotaxia', }, { - "internal": false, - "obsolete": false, - "id": 12282325, - "name": "situs ambiguus" - } - ] + internal: false, + obsolete: false, + id: 12282325, + name: 'situs ambiguus', + }, + ], }, - "negated": true, - "relation": { - "dateCreated": "2022-01-26T09:40:54.020724Z", - "dateUpdated": "2022-01-26T09:40:54.020726Z", - "internal": false, - "obsolete": false, - "id": 6363603, - "name": "is_model_of", - "definition": "is_model_of" + negated: true, + relation: { + dateCreated: '2022-01-26T09:40:54.020724Z', + dateUpdated: '2022-01-26T09:40:54.020726Z', + internal: false, + obsolete: false, + id: 6363603, + name: 'is_model_of', + definition: 'is_model_of', }, - "evidenceCodes": [ + evidenceCodes: [ { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-04-09T22:01:36.100471Z", - "curie": "ECO:0000033", - "name": "author statement supported by traceable reference", - "namespace": "eco", - "definition": "A type of author statement in which the author makes a statement that is not supported by information in that particular publication, but rather can be traced to a reference cited by that publication.", - "definitionUrls": [ - "GO:TAS", - "ECO:RCT" - ], - "subsets": [ - "agr_eco_terms" - ], - "synonyms": [ + internal: false, + obsolete: false, + dbDateUpdated: '2023-04-09T22:01:36.100471Z', + curie: 'ECO:0000033', + name: 'author statement supported by traceable reference', + namespace: 'eco', + definition: + 'A type of author statement in which the author makes a statement that is not supported by information in that particular publication, but rather can be traced to a reference cited by that publication.', + definitionUrls: ['GO:TAS', 'ECO:RCT'], + subsets: ['agr_eco_terms'], + synonyms: [ { - "internal": false, - "obsolete": false, - "id": 12272565, - "name": "traceable author statement" - } + internal: false, + obsolete: false, + id: 12272565, + name: 'traceable author statement', + }, ], - "abbreviation": "TAS" - } + abbreviation: 'TAS', + }, ], - "singleReference": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2022-11-18T16:33:21.46375Z", - "curie": "AGRKB:101000000827851", - "crossReferences": [ + singleReference: { + internal: false, + obsolete: false, + dbDateUpdated: '2022-11-18T16:33:21.46375Z', + curie: 'AGRKB:101000000827851', + crossReferences: [ { - "internal": false, - "obsolete": false, - "id": 74063345, - "referencedCurie": "MGI:5284969", - "displayName": "MGI:5284969" - } - ] + internal: false, + obsolete: false, + id: 74063345, + referencedCurie: 'MGI:5284969', + displayName: 'MGI:5284969', + }, + ], }, - "annotationType": { - "internal": false, - "obsolete": false, - "id": 7662755, - "name": "manually_curated" + annotationType: { + internal: false, + obsolete: false, + id: 7662755, + name: 'manually_curated', }, - "dataProvider": { - "internal": false, - "obsolete": false, - "id": 75083698, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308680, - "uniqueId": "MGI", - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-05-11T22:00:03.831263Z", - "id": 41750686, - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } - } + dataProvider: { + internal: false, + obsolete: false, + id: 75083698, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308680, + uniqueId: 'MGI', + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-05-11T22:00:03.831263Z', + id: 41750686, + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, }, - "diseaseAnnotationSubject": { - "type": "AffectedGenomicModel", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:33:39.453344Z", - "curie": "MGI:5560505", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" + diseaseAnnotationSubject: { + type: 'AffectedGenomicModel', + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:33:39.453344Z', + curie: 'MGI:5560505', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', }, - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T12:33:39.451734Z", - "id": 75611693, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308680, - "uniqueId": "MGI", - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-05-11T22:00:03.831263Z", - "id": 41750686, - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } + dataProvider: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T12:33:39.451734Z', + id: 75611693, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308680, + uniqueId: 'MGI', + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-05-11T22:00:03.831263Z', + id: 41750686, + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, }, - "crossReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T12:33:39.450658Z", - "dbDateUpdated": "2023-05-17T12:33:39.450659Z", - "id": 80324218, - "referencedCurie": "MGI:5560505", - "displayName": "MGI:5560505", - "resourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.239734Z", - "dbDateUpdated": "2023-05-11T22:00:03.830784Z", - "id": 41750685, - "name": "genotype", - "urlTemplate": "http://www.informatics.jax.org/allele/genoview/MGI:[%s]" - } - } + crossReference: { + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T12:33:39.450658Z', + dbDateUpdated: '2023-05-17T12:33:39.450659Z', + id: 80324218, + referencedCurie: 'MGI:5560505', + displayName: 'MGI:5560505', + resourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.239734Z', + dbDateUpdated: '2023-05-11T22:00:03.830784Z', + id: 41750685, + name: 'genotype', + urlTemplate: 'http://www.informatics.jax.org/allele/genoview/MGI:[%s]', + }, + }, + }, + name: 'Rfx3b2b1213Clo/Rfx3b2b1213Clo [background:] C57BL/6J-Rfx3b2b1213Clo', + subtype: { + internal: false, + obsolete: false, + id: 40545169, + name: 'genotype', }, - "name": "Rfx3b2b1213Clo/Rfx3b2b1213Clo [background:] C57BL/6J-Rfx3b2b1213Clo", - "subtype": { - "internal": false, - "obsolete": false, - "id": 40545169, - "name": "genotype" - } }, - "inferredGene": { - "type": "Gene", - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T10:04:44.939207Z", - "dbDateUpdated": "2023-05-17T10:04:44.939209Z", - "id": 80081033, - "uniqueId": "MGI" + inferredGene: { + type: 'Gene', + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T10:04:44.939207Z', + dbDateUpdated: '2023-05-17T10:04:44.939209Z', + id: 80081033, + uniqueId: 'MGI', }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T10:04:44.939207Z", - "dbDateUpdated": "2023-05-17T10:04:44.939209Z", - "id": 80081033, - "uniqueId": "MGI" + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T10:04:44.939207Z', + dbDateUpdated: '2023-05-17T10:04:44.939209Z', + id: 80081033, + uniqueId: 'MGI', }, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T10:05:06.055796Z", - "curie": "MGI:106582", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T10:05:06.055796Z', + curie: 'MGI:106582', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', }, - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-05-17T10:05:06.055328Z", - "id": 75132764, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308680, - "uniqueId": "MGI", - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-05-11T22:00:03.831263Z", - "id": 41750686, - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } + dataProvider: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-05-17T10:05:06.055328Z', + id: 75132764, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308680, + uniqueId: 'MGI', + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-05-11T22:00:03.831263Z', + id: 41750686, + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, + crossReference: { + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T10:05:06.054841Z', + dbDateUpdated: '2023-05-17T10:05:06.054842Z', + id: 80081812, + referencedCurie: 'MGI:106582', + displayName: 'MGI:106582', + resourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.235386Z', + dbDateUpdated: '2023-05-11T22:00:03.81929Z', + id: 41750677, + name: 'gene', + urlTemplate: 'http://www.informatics.jax.org/marker/MGI:[%s]', + }, }, - "crossReference": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T10:05:06.054841Z", - "dbDateUpdated": "2023-05-17T10:05:06.054842Z", - "id": 80081812, - "referencedCurie": "MGI:106582", - "displayName": "MGI:106582", - "resourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.235386Z", - "dbDateUpdated": "2023-05-11T22:00:03.81929Z", - "id": 41750677, - "name": "gene", - "urlTemplate": "http://www.informatics.jax.org/marker/MGI:[%s]" - } - } }, - "geneType": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-02-19T22:00:41.015903Z", - "curie": "SO:0001217", - "name": "protein_coding_gene", - "namespace": "sequence", - "definition": "A gene that codes for an RNA that can be translated into a protein.", - "subsets": [ - "Alliance_of_Genome_Resources" - ], - "synonyms": [ + geneType: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-02-19T22:00:41.015903Z', + curie: 'SO:0001217', + name: 'protein_coding_gene', + namespace: 'sequence', + definition: 'A gene that codes for an RNA that can be translated into a protein.', + subsets: ['Alliance_of_Genome_Resources'], + synonyms: [ { - "internal": false, - "obsolete": false, - "id": 12304001, - "name": "protein coding gene" - } - ] + internal: false, + obsolete: false, + id: 12304001, + name: 'protein coding gene', + }, + ], }, - "geneSymbol": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:23:28.769215Z", - "dbDateUpdated": "2023-05-17T10:05:06.06461Z", - "id": 51339916, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308690, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." + geneSymbol: { + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:23:28.769215Z', + dbDateUpdated: '2023-05-17T10:05:06.06461Z', + id: 51339916, + nameType: { + internal: false, + obsolete: false, + id: 20308690, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "formatText": "Rfx3", - "displayText": "Rfx3" + formatText: 'Rfx3', + displayText: 'Rfx3', }, - "geneFullName": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:23:28.77077Z", - "dbDateUpdated": "2023-05-17T10:05:06.063304Z", - "id": 51339917, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308691, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." + geneFullName: { + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:23:28.77077Z', + dbDateUpdated: '2023-05-17T10:05:06.063304Z', + id: 51339917, + nameType: { + internal: false, + obsolete: false, + id: 20308691, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', }, - "formatText": "regulatory factor X, 3 (influences HLA class II expression)", - "displayText": "regulatory factor X, 3 (influences HLA class II expression)" - } + formatText: 'regulatory factor X, 3 (influences HLA class II expression)', + displayText: 'regulatory factor X, 3 (influences HLA class II expression)', + }, }, - "inferredAllele": { - "type": "Allele", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-04-14T21:55:23.136544Z", - "curie": "MGI:5560494", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" + inferredAllele: { + type: 'Allele', + internal: false, + obsolete: false, + dbDateUpdated: '2023-04-14T21:55:23.136544Z', + curie: 'MGI:5560494', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', }, - "dataProvider": { - "internal": false, - "obsolete": false, - "id": 75738124, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308680, - "uniqueId": "MGI", - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-05-11T22:00:03.831263Z", - "id": 41750686, - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } - } + dataProvider: { + internal: false, + obsolete: false, + id: 75738124, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308680, + uniqueId: 'MGI', + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-05-11T22:00:03.831263Z', + id: 41750686, + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, }, - "references": [ + references: [ { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2022-11-18T16:33:21.46375Z", - "curie": "AGRKB:101000000827851", - "crossReferences": [ + internal: false, + obsolete: false, + dbDateUpdated: '2022-11-18T16:33:21.46375Z', + curie: 'AGRKB:101000000827851', + crossReferences: [ { - "internal": false, - "obsolete": false, - "id": 74063345, - "referencedCurie": "MGI:5284969", - "displayName": "MGI:5284969" - } - ] + internal: false, + obsolete: false, + id: 74063345, + referencedCurie: 'MGI:5284969', + displayName: 'MGI:5284969', + }, + ], }, { - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-28T18:50:49.104161Z", - "dbDateUpdated": "2022-11-28T18:50:49.104162Z", - "curie": "AGRKB:101000000284070", - "crossReferences": [ + internal: false, + obsolete: false, + dbDateCreated: '2022-11-28T18:50:49.104161Z', + dbDateUpdated: '2022-11-28T18:50:49.104162Z', + curie: 'AGRKB:101000000284070', + crossReferences: [ { - "internal": false, - "obsolete": false, - "id": 74907086, - "referencedCurie": "PMID:25807483", - "displayName": "PMID:25807483" + internal: false, + obsolete: false, + id: 74907086, + referencedCurie: 'PMID:25807483', + displayName: 'PMID:25807483', }, { - "internal": false, - "obsolete": false, - "id": 74907085, - "referencedCurie": "PMCID:PMC4617540", - "displayName": "PMCID:PMC4617540" + internal: false, + obsolete: false, + id: 74907085, + referencedCurie: 'PMCID:PMC4617540', + displayName: 'PMCID:PMC4617540', }, { - "internal": false, - "obsolete": false, - "id": 74907083, - "referencedCurie": "DOI:10.1038/nature14269", - "displayName": "DOI:10.1038/nature14269" + internal: false, + obsolete: false, + id: 74907083, + referencedCurie: 'DOI:10.1038/nature14269', + displayName: 'DOI:10.1038/nature14269', }, { - "internal": false, - "obsolete": false, - "id": 74907084, - "referencedCurie": "MGI:5644076", - "displayName": "MGI:5644076" - } - ] - } + internal: false, + obsolete: false, + id: 74907084, + referencedCurie: 'MGI:5644076', + displayName: 'MGI:5644076', + }, + ], + }, ], - "inCollection": { - "createdBy": { - "dateCreated": "2022-05-06T12:26:36.696662Z", - "dateUpdated": "2022-05-06T12:26:36.696665Z", - "internal": false, - "obsolete": false, - "id": 7825552, - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-05-11T22:00:04.659745Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } + inCollection: { + createdBy: { + dateCreated: '2022-05-06T12:26:36.696662Z', + dateUpdated: '2022-05-06T12:26:36.696665Z', + internal: false, + obsolete: false, + id: 7825552, + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-05-11T22:00:04.659745Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, }, - "updatedBy": { - "dateCreated": "2022-05-06T12:26:36.696662Z", - "dateUpdated": "2022-05-06T12:26:36.696665Z", - "internal": false, - "obsolete": false, - "id": 7825552, - "allianceMember": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-05-11T22:00:04.659745Z", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } + updatedBy: { + dateCreated: '2022-05-06T12:26:36.696662Z', + dateUpdated: '2022-05-06T12:26:36.696665Z', + internal: false, + obsolete: false, + id: 7825552, + allianceMember: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-05-11T22:00:04.659745Z', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, }, }, - "dateCreated": "2022-11-15T22:01:18.89272Z", - "dateUpdated": "2022-11-15T22:01:18.895014Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-15T22:01:18.905486Z", - "dbDateUpdated": "2022-11-15T22:01:18.905488Z", - "id": 15414972, - "name": "B2B/CvDC", - "definition": "The National Heart, Lung, and Blood Institute (NHLBI) Bench to Bassinet (B2B) Program of translational research in pediatric cardiovascular disease" + dateCreated: '2022-11-15T22:01:18.89272Z', + dateUpdated: '2022-11-15T22:01:18.895014Z', + internal: false, + obsolete: false, + dbDateCreated: '2022-11-15T22:01:18.905486Z', + dbDateUpdated: '2022-11-15T22:01:18.905488Z', + id: 15414972, + name: 'B2B/CvDC', + definition: + 'The National Heart, Lung, and Blood Institute (NHLBI) Bench to Bassinet (B2B) Program of translational research in pediatric cardiovascular disease', }, - "isExtinct": false, - "alleleSymbol": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-04-14T21:55:23.146643Z", - "dbDateUpdated": "2023-04-14T21:55:23.146645Z", - "id": 70002674, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308690, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." + isExtinct: false, + alleleSymbol: { + internal: false, + obsolete: false, + dbDateCreated: '2023-04-14T21:55:23.146643Z', + dbDateUpdated: '2023-04-14T21:55:23.146645Z', + id: 70002674, + nameType: { + internal: false, + obsolete: false, + id: 20308690, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "formatText": "Rfx3b2b1213Clo", - "displayText": "Rfx3b2b1213Clo" + formatText: 'Rfx3b2b1213Clo', + displayText: 'Rfx3b2b1213Clo', }, - "alleleFullName": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-04-14T21:55:23.147861Z", - "dbDateUpdated": "2023-04-14T21:55:23.147862Z", - "id": 70002675, - "nameType": { - "internal": false, - "obsolete": false, - "id": 20308691, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." + alleleFullName: { + internal: false, + obsolete: false, + dbDateCreated: '2023-04-14T21:55:23.147861Z', + dbDateUpdated: '2023-04-14T21:55:23.147862Z', + id: 70002675, + nameType: { + internal: false, + obsolete: false, + id: 20308691, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', }, - "formatText": "Bench to Bassinet Program (B2B/CVDC), mutation 1213 Cecilia Lo", - "displayText": "Bench to Bassinet Program (B2B/CVDC), mutation 1213 Cecilia Lo" - } - } - } + formatText: 'Bench to Bassinet Program (B2B/CVDC), mutation 1213 Cecilia Lo', + displayText: 'Bench to Bassinet Program (B2B/CVDC), mutation 1213 Cecilia Lo', + }, + }, + }, ], - "totalResults": 1, - "returnedRecords": 1 + totalResults: 1, + returnedRecords: 1, }; diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js index 42f7855bb..78bc721e9 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js @@ -1,21 +1,21 @@ -import { useImmerReducer } from "use-immer"; +import { useImmerReducer } from 'use-immer'; import 'core-js/features/structured-clone'; const DEFAULT_ANNOTATION = { diseaseAnnotationSubject: { - modEntityId: "", + modEntityId: '', }, - assertedGenes : [], - assertedAllele : null, + assertedGenes: [], + assertedAllele: null, relation: { - name: "", + name: '', }, negated: false, diseaseAnnotationObject: { - curie: "", + curie: '', }, singleReference: { - curie: "", + curie: '', }, evidenceCodes: [], with: [], @@ -27,7 +27,7 @@ const DEFAULT_ANNOTATION = { annotationType: null, diseaseGeneticModifierRelation: null, diseaseGeneticModifiers: [], - internal: false + internal: false, }; const initialNewAnnotationState = { newAnnotation: global.structuredClone(DEFAULT_ANNOTATION), @@ -47,39 +47,44 @@ const initialNewAnnotationState = { const buildAnnotation = (rowData) => { return { - diseaseAnnotationSubject: global.structuredClone(rowData.diseaseAnnotationSubject) || DEFAULT_ANNOTATION.diseaseAnnotationSubject, - assertedGenes : global.structuredClone(rowData.assertedGenes) || DEFAULT_ANNOTATION.assertedGenes, - assertedAllele : global.structuredClone(rowData.assertedAllele) || DEFAULT_ANNOTATION.assertedAllele, + diseaseAnnotationSubject: + global.structuredClone(rowData.diseaseAnnotationSubject) || DEFAULT_ANNOTATION.diseaseAnnotationSubject, + assertedGenes: global.structuredClone(rowData.assertedGenes) || DEFAULT_ANNOTATION.assertedGenes, + assertedAllele: global.structuredClone(rowData.assertedAllele) || DEFAULT_ANNOTATION.assertedAllele, relation: global.structuredClone(rowData.relation) || DEFAULT_ANNOTATION.relation, negated: rowData.negated || DEFAULT_ANNOTATION.negated, - diseaseAnnotationObject: global.structuredClone(rowData.diseaseAnnotationObject) || DEFAULT_ANNOTATION.diseaseAnnotationObject, + diseaseAnnotationObject: + global.structuredClone(rowData.diseaseAnnotationObject) || DEFAULT_ANNOTATION.diseaseAnnotationObject, singleReference: global.structuredClone(rowData.singleReference) || DEFAULT_ANNOTATION.singleReference, evidenceCodes: global.structuredClone(rowData.evidenceCodes) || DEFAULT_ANNOTATION.subject, with: global.structuredClone(rowData.with) || DEFAULT_ANNOTATION.with, - relatedNotes: processDupRelatedNotes(global.structuredClone(rowData.relatedNotes)) || DEFAULT_ANNOTATION.relatedNotes, + relatedNotes: + processDupRelatedNotes(global.structuredClone(rowData.relatedNotes)) || DEFAULT_ANNOTATION.relatedNotes, conditionRelations: global.structuredClone(rowData.conditionRelations) || DEFAULT_ANNOTATION.conditionRelations, geneticSex: global.structuredClone(rowData.geneticSex) || DEFAULT_ANNOTATION.geneticSex, diseaseQualifiers: global.structuredClone(rowData.diseaseQualifiers) || DEFAULT_ANNOTATION.diseaseQualifiers, - sgdStrainBackground: global.structuredClone(rowData.sgdStrainBackground)|| DEFAULT_ANNOTATION.sgdStrainBackground, + sgdStrainBackground: global.structuredClone(rowData.sgdStrainBackground) || DEFAULT_ANNOTATION.sgdStrainBackground, annotationType: global.structuredClone(rowData.annotationType) || DEFAULT_ANNOTATION.annotationType, - diseaseGeneticModifierRelation: global.structuredClone(rowData.diseaseGeneticModifierRelation) || DEFAULT_ANNOTATION.diseaseGeneticModifierRelation, - diseaseGeneticModifiers: global.structuredClone(rowData.diseaseGeneticModifiers) || DEFAULT_ANNOTATION.diseaseGeneticModifiers, - internal: rowData.internal || DEFAULT_ANNOTATION.internal - } -} + diseaseGeneticModifierRelation: + global.structuredClone(rowData.diseaseGeneticModifierRelation) || + DEFAULT_ANNOTATION.diseaseGeneticModifierRelation, + diseaseGeneticModifiers: + global.structuredClone(rowData.diseaseGeneticModifiers) || DEFAULT_ANNOTATION.diseaseGeneticModifiers, + internal: rowData.internal || DEFAULT_ANNOTATION.internal, + }; +}; const processDupRelatedNotes = (notes) => { - if(!notes) return; - notes.forEach(note => { - if(note.id){ + if (!notes) return; + notes.forEach((note) => { + if (note.id) { delete note.id; } - }) + }); return notes; -} +}; const newAnnotationReducer = (draft, action) => { - switch (action.type) { case 'RESET': return initialNewAnnotationState; @@ -87,15 +92,15 @@ const newAnnotationReducer = (draft, action) => { draft.newAnnotation[action.field] = action.value; break; case 'EDIT_EXPERIMENT': - if (typeof action.value === "object") { + if (typeof action.value === 'object') { draft.newAnnotation.conditionRelations[0] = action.value; } else { - if(draft.newAnnotation.conditionRelations && draft.newAnnotation.conditionRelations[0]) + if (draft.newAnnotation.conditionRelations && draft.newAnnotation.conditionRelations[0]) draft.newAnnotation.conditionRelations[0].handle = action.value; } break; case 'UPDATE_ERROR_MESSAGES': - draft[action.errorType]= action.errorMessages; + draft[action.errorType] = action.errorMessages; draft.isValid = false; break; case 'SUBMIT': @@ -111,33 +116,29 @@ const newAnnotationReducer = (draft, action) => { draft.newAnnotation = buildAnnotation(action.rowData); break; case 'CLEAR': - return {...initialNewAnnotationState, newAnnotationDialog: true} + return { ...initialNewAnnotationState, newAnnotationDialog: true }; case 'ADD_NEW_NOTE': - draft.newAnnotation.relatedNotes.push( - { - dataKey: action.count, - noteType: { - name : "" - }, - freeText: "", - } - ) + draft.newAnnotation.relatedNotes.push({ + dataKey: action.count, + noteType: { + name: '', + }, + freeText: '', + }); draft.relatedNotesEditingRows[`${action.count}`] = true; draft.showRelatedNotes = true; break; case 'ADD_NEW_RELATION': - draft.newAnnotation.conditionRelations.push( - { - dataKey: action.count, - conditions: [], - } - ) + draft.newAnnotation.conditionRelations.push({ + dataKey: action.count, + conditions: [], + }); draft.conditionRelationsEditingRows[`${action.count}`] = true; draft.showConditionRelations = true; break; case 'DELETE_ROW': draft.newAnnotation[action.tableType].splice(action.index, 1); - if(draft.newAnnotation[action.tableType].length === 0){ + if (draft.newAnnotation[action.tableType].length === 0) { draft[action.showType] = false; } break; @@ -172,5 +173,5 @@ const newAnnotationReducer = (draft, action) => { export const useNewAnnotationReducer = () => { const [newAnnotationState, newAnnotationDispatch] = useImmerReducer(newAnnotationReducer, initialNewAnnotationState); - return {newAnnotationState, newAnnotationDispatch}; -} + return { newAnnotationState, newAnnotationDispatch }; +}; diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsPage.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsPage.js index 98b0f21ca..6f8d3cefc 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsPage.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { ExperimentalConditionsTable } from './ExperimentalConditionsTable'; export function ExperimentalConditionsPage() { - return ( - - ); + return ; } -export default ExperimentalConditionsPage; \ No newline at end of file +export default ExperimentalConditionsPage; diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index 14e56c53c..30f6be110 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -14,14 +14,18 @@ import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; import { NewConditionForm } from './NewConditionForm'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { useNewConditionReducer } from './useNewConditionReducer'; -import { defaultAutocompleteOnChange, autocompleteSearch, buildAutocompleteFilter, setNewEntity } from "../../utils/utils"; +import { + defaultAutocompleteOnChange, + autocompleteSearch, + buildAutocompleteFilter, + setNewEntity, +} from '../../utils/utils'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; export const ExperimentalConditionsTable = () => { - const [errorMessages, setErrorMessages] = useState({}); const [isInEditMode, setIsInEditMode] = useState(false); const [totalRecords, setTotalRecords] = useState(0); @@ -37,13 +41,19 @@ export const ExperimentalConditionsTable = () => { let experimentalConditionService = new ExperimentalConditionService(); - const curieAutocompleteFields = ["curie", "name", "crossReferences.referencedCurie", "secondaryIdentifiers", "synonyms.name"]; + const curieAutocompleteFields = [ + 'curie', + 'name', + 'crossReferences.referencedCurie', + 'secondaryIdentifiers', + 'synonyms.name', + ]; const sortMapping = { - 'conditionGeneOntology.name': ['conditionGeneOntology.curie', 'conditionGeneOntology.namespace'] + 'conditionGeneOntology.name': ['conditionGeneOntology.curie', 'conditionGeneOntology.namespace'], }; - const mutation = useMutation(updatedCondition => { + const mutation = useMutation((updatedCondition) => { if (!experimentalConditionService) { experimentalConditionService = new ExperimentalConditionService(); } @@ -51,16 +61,13 @@ export const ExperimentalConditionsTable = () => { }); const handleNewConditionOpen = () => { - newConditionDispatch({ type: "OPEN_DIALOG" }); + newConditionDispatch({ type: 'OPEN_DIALOG' }); }; const freeTextEditor = (props, fieldname) => { return ( <> - + ); @@ -92,8 +99,13 @@ export const ExperimentalConditionsTable = () => { if (rowData?.conditionClass) { return ( <> - {rowData.conditionClass.name} ({rowData.conditionClass.curie}) - + + {rowData.conditionClass.name} ({rowData.conditionClass.curie}) + + ); } @@ -103,8 +115,13 @@ export const ExperimentalConditionsTable = () => { if (rowData?.conditionId) { return ( <> - {rowData.conditionId.name} ({rowData.conditionId.curie}) - + + {rowData.conditionId.name} ({rowData.conditionId.curie}) + + ); } @@ -112,19 +129,31 @@ export const ExperimentalConditionsTable = () => { const conditionGeneOntologyBodyTemplate = (rowData) => { if (rowData?.conditionGeneOntology) { - return {rowData.conditionGeneOntology.name} ({rowData.conditionGeneOntology.curie}); + return ( + + {rowData.conditionGeneOntology.name} ({rowData.conditionGeneOntology.curie}) + + ); } }; const conditionChemicalBodyTemplate = (rowData) => { if (rowData?.conditionChemical) { - return {rowData.conditionChemical.name} ({rowData.conditionChemical.curie}); + return ( + + {rowData.conditionChemical.name} ({rowData.conditionChemical.curie}) + + ); } }; const conditionAnatomyBodyTemplate = (rowData) => { if (rowData?.conditionAnatomy) { - return {rowData.conditionAnatomy.name} ({rowData.conditionAnatomy.curie}); + return ( + + {rowData.conditionAnatomy.name} ({rowData.conditionAnatomy.curie}) + + ); } }; @@ -132,10 +161,16 @@ export const ExperimentalConditionsTable = () => { if (rowData?.conditionTaxon) { return ( <> - + {rowData.conditionTaxon.name} ({rowData.conditionTaxon.curie}) - + ); } @@ -161,27 +196,27 @@ export const ExperimentalConditionsTable = () => { options={booleanTerms} editorChange={onInternalEditorValueChange} props={props} - field={"internal"} + field={'internal'} /> - + ); }; const onConditionClassValueChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "conditionClass", setFieldValue); + defaultAutocompleteOnChange(props, event, 'conditionClass', setFieldValue); }; const conditionClassSearch = (event, setFiltered, setQuery) => { - const endpoint = "zecoterm"; - const filterName = "conditionClassEditorFilter"; + const endpoint = 'zecoterm'; + const filterName = 'conditionClassEditorFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); const otherFilters = { - "subsetFilter": { - "subsets": { - queryString: 'ZECO_0000267' - } - } + subsetFilter: { + subsets: { + queryString: 'ZECO_0000267', + }, + }, }; setQuery(event.query); @@ -198,10 +233,7 @@ export const ExperimentalConditionsTable = () => { fieldName="conditionClass" onValueChangeHandler={onConditionClassValueChange} /> - + ); }; @@ -211,7 +243,7 @@ export const ExperimentalConditionsTable = () => { }; const singleOntologySearch = (event, setFiltered, endpoint, autocomplete, setQuery) => { - const filterName = "singleOntologyFilter"; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, autocomplete); setQuery(event.query); @@ -222,116 +254,126 @@ export const ExperimentalConditionsTable = () => { return ( <> singleOntologySearch(event, setFiltered, endpoint, autocomplete, setQuery)} + search={(event, setFiltered, setQuery) => + singleOntologySearch(event, setFiltered, endpoint, autocomplete, setQuery) + } initialValue={props.rowData[fieldname]?.curie} rowProps={props} - filterName='singleOntologyFilter' + filterName="singleOntologyFilter" fieldName={fieldname} onValueChangeHandler={onSingleOntologyValueChange} /> - + ); }; - const columns = [ { - field: "uniqueId", - header: "Unique ID", + field: 'uniqueId', + header: 'Unique ID', sortable: true, body: uniqueIdBodyTemplate, filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, }, { - field: "conditionSummary", - header: "Summary", + field: 'conditionSummary', + header: 'Summary', sortable: true, body: summaryBodyTemplate, filterConfig: FILTER_CONFIGS.conditionRelationSummaryFilterConfig, }, { - field: "conditionClass.name", - header: "Class", + field: 'conditionClass.name', + header: 'Class', sortable: true, body: conditionClassBodyTemplate, filterConfig: FILTER_CONFIGS.conditionClassFilterConfig, - editor: (props) => conditionClassEditorTemplate(props, curieAutocompleteFields) + editor: (props) => conditionClassEditorTemplate(props, curieAutocompleteFields), }, { - field: "conditionId.name", - header: "Condition Term", + field: 'conditionId.name', + header: 'Condition Term', sortable: true, body: conditionIdBodyTemplate, filterConfig: FILTER_CONFIGS.conditionIdFilterConfig, - editor: (props) => singleOntologyEditorTemplate(props, "conditionId", "experimentalconditionontologyterm", curieAutocompleteFields) + editor: (props) => + singleOntologyEditorTemplate( + props, + 'conditionId', + 'experimentalconditionontologyterm', + curieAutocompleteFields + ), }, { - field: "conditionGeneOntology.name", - header: "Gene Ontology", + field: 'conditionGeneOntology.name', + header: 'Gene Ontology', sortable: true, filterConfig: FILTER_CONFIGS.conditionGeneOntologyFilterConfig, - editor: (props) => singleOntologyEditorTemplate(props, "conditionGeneOntology", "goterm", curieAutocompleteFields), - body: conditionGeneOntologyBodyTemplate + editor: (props) => + singleOntologyEditorTemplate(props, 'conditionGeneOntology', 'goterm', curieAutocompleteFields), + body: conditionGeneOntologyBodyTemplate, }, { - field: "conditionChemical.name", - header: "Chemical", + field: 'conditionChemical.name', + header: 'Chemical', sortable: true, body: conditionChemicalBodyTemplate, filterConfig: FILTER_CONFIGS.conditionChemicalFilterConfig, - editor: (props) => singleOntologyEditorTemplate(props, "conditionChemical", "chemicalterm", curieAutocompleteFields) + editor: (props) => + singleOntologyEditorTemplate(props, 'conditionChemical', 'chemicalterm', curieAutocompleteFields), }, { - field: "conditionAnatomy.name", - header: "Anatomy", + field: 'conditionAnatomy.name', + header: 'Anatomy', sortable: true, body: conditionAnatomyBodyTemplate, filterConfig: FILTER_CONFIGS.conditionAnatomyFilterConfig, - editor: (props) => singleOntologyEditorTemplate(props, "conditionAnatomy", "anatomicalterm", curieAutocompleteFields) + editor: (props) => + singleOntologyEditorTemplate(props, 'conditionAnatomy', 'anatomicalterm', curieAutocompleteFields), }, { - field: "conditionTaxon.name", - header: "Condition Taxon", + field: 'conditionTaxon.name', + header: 'Condition Taxon', sortable: true, body: conditionTaxonBodyTemplate, filterConfig: FILTER_CONFIGS.conditionTaxonFilterConfig, - editor: (props) => singleOntologyEditorTemplate(props, "conditionTaxon", "ncbitaxonterm", curieAutocompleteFields) + editor: (props) => + singleOntologyEditorTemplate(props, 'conditionTaxon', 'ncbitaxonterm', curieAutocompleteFields), }, { - field: "conditionQuantity", - header: "Quantity", + field: 'conditionQuantity', + header: 'Quantity', sortable: true, filterConfig: FILTER_CONFIGS.conditionQuantityFilterConfig, - editor: (props) => freeTextEditor(props, "conditionQuantity") - } - , + editor: (props) => freeTextEditor(props, 'conditionQuantity'), + }, { - field: "conditionFreeText", - header: "Free Text", + field: 'conditionFreeText', + header: 'Free Text', sortable: true, filterConfig: FILTER_CONFIGS.conditionFreeTextFilterConfig, - editor: (props) => freeTextEditor(props, "conditionFreeText") + editor: (props) => freeTextEditor(props, 'conditionFreeText'), }, { - field: "internal", - header: "Internal", + field: 'internal', + header: 'Internal', body: internalBodyTemplate, filterConfig: FILTER_CONFIGS.internalFilterConfig, sortable: true, - editor: (props) => internalEditor(props) + editor: (props) => internalEditor(props), }, ]; const DEFAULT_COLUMN_WIDTH = 10; - const SEARCH_ENDPOINT = "experimental-condition"; + const SEARCH_ENDPOINT = 'experimental-condition'; - const initialTableState = getDefaultTableState("ExperimentalConditions", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('ExperimentalConditions', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isLoading, isFetching } = useGetTableData({ tableState, @@ -341,13 +383,14 @@ export const ExperimentalConditionsTable = () => { setEntities: setExperimentalConditions, setTotalRecords, toast_topleft, - searchService + searchService, }); const headerButtons = (disabled = false) => { return ( <> -
    diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/NewConditionForm.js b/src/main/cliapp/src/containers/experimentalConditionsPage/NewConditionForm.js index 6d6c48567..03c55553f 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/NewConditionForm.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/NewConditionForm.js @@ -1,18 +1,17 @@ -import React, { useRef } from "react"; -import { ExperimentalConditionService } from "../../service/ExperimentalConditionService"; -import { Dialog } from "primereact/dialog"; -import { Button } from "primereact/button"; -import { InputText } from "primereact/inputtext"; -import { Dropdown } from "primereact/dropdown"; -import { Toast } from "primereact/toast"; -import { InputTextarea } from "primereact/inputtextarea"; +import React, { useRef } from 'react'; +import { ExperimentalConditionService } from '../../service/ExperimentalConditionService'; +import { Dialog } from 'primereact/dialog'; +import { Button } from 'primereact/button'; +import { InputText } from 'primereact/inputtext'; +import { Dropdown } from 'primereact/dropdown'; +import { Toast } from 'primereact/toast'; +import { InputTextarea } from 'primereact/inputtextarea'; import { useMutation, useQueryClient } from '@tanstack/react-query'; -import { AutocompleteEditor } from "../../components/Autocomplete/AutocompleteEditor"; -import { FormErrorMessageComponent } from "../../components/Error/FormErrorMessageComponent"; -import { classNames } from "primereact/utils"; -import { autocompleteSearch, buildAutocompleteFilter } from "../../utils/utils"; -import ErrorBoundary from "../../components/Error/ErrorBoundary"; - +import { AutocompleteEditor } from '../../components/Autocomplete/AutocompleteEditor'; +import { FormErrorMessageComponent } from '../../components/Error/FormErrorMessageComponent'; +import { classNames } from 'primereact/utils'; +import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; +import ErrorBoundary from '../../components/Error/ErrorBoundary'; export const NewConditionForm = ({ newConditionState, @@ -27,80 +26,77 @@ export const NewConditionForm = ({ const { newCondition, errorMessages, submitted, newConditionDialog } = newConditionState; const queryClient = useQueryClient(); - const mutation = useMutation(newCondition => { + const mutation = useMutation((newCondition) => { if (!experimentalConditionService) { experimentalConditionService = new ExperimentalConditionService(); } return experimentalConditionService.createExperimentalCondition(newCondition); }); - const hideDialog = () => { - newConditionDispatch({ type: "RESET" }); + newConditionDispatch({ type: 'RESET' }); }; const handleSubmit = (event) => { event.preventDefault(); - newConditionDispatch({ type: "SUBMIT" }); + newConditionDispatch({ type: 'SUBMIT' }); mutation.mutate(newCondition, { onSuccess: (data) => { setNewExperimentalCondition(data.data.entity, queryClient); toast_success.current.show({ severity: 'success', summary: 'Successful', detail: 'New Relation Added' }); - newConditionDispatch({ type: "RESET" }); + newConditionDispatch({ type: 'RESET' }); }, onError: (error) => { - - const message = - error.response.data.errorMessages.uniqueId ? - "Page Error: New experimental condition is a duplicate of an existing experimental condition" : - error.response.data.errorMessage; + const message = error.response.data.errorMessages.uniqueId + ? 'Page Error: New experimental condition is a duplicate of an existing experimental condition' + : error.response.data.errorMessage; toast_error.current.show([ - { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false } + { life: 7000, severity: 'error', summary: 'Page error: ', detail: message, sticky: false }, ]); - newConditionDispatch({ type: "UPDATE_ERROR_MESSAGES", errorMessages: error.response.data.errorMessages }); - } + newConditionDispatch({ type: 'UPDATE_ERROR_MESSAGES', errorMessages: error.response.data.errorMessages }); + }, }); }; const onCurieFieldChange = (event, setFieldValue) => { const curie = event.value.curie; const stringValue = event.value; - const value = typeof event.value === "string" ? { curie: stringValue } : { curie }; + const value = typeof event.value === 'string' ? { curie: stringValue } : { curie }; setFieldValue(event.target.value); newConditionDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, value, }); }; const conditionClassSearch = (event, setFiltered, setQuery) => { - const endpoint = "zecoterm"; - const filterName = "conditionClassEditorFilter"; + const endpoint = 'zecoterm'; + const filterName = 'conditionClassEditorFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); const otherFilters = { - "subsetFilter": { - "subsets": { - queryString: 'ZECO_0000267' - } - } + subsetFilter: { + subsets: { + queryString: 'ZECO_0000267', + }, + }, }; setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); }; const conditionIdSearch = (event, setFiltered, setQuery) => { - const endpoint = "experimentalconditionontologyterm"; - const filterName = "singleOntologyFilter"; + const endpoint = 'experimentalconditionontologyterm'; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; const conditionGeneOntologySearch = (event, setFiltered, setQuery) => { - const endpoint = "goterm"; - const filterName = "singleOntologyFilter"; + const endpoint = 'goterm'; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); setQuery(event.query); @@ -108,24 +104,24 @@ export const NewConditionForm = ({ }; const conditionChemicalSearch = (event, setFiltered, setQuery) => { - const endpoint = "chemicalterm"; - const filterName = "singleOntologyFilter"; + const endpoint = 'chemicalterm'; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; const conditionAnatomySearch = (event, setFiltered, setQuery) => { - const endpoint = "anatomicalterm"; - const filterName = "singleOntologyFilter"; + const endpoint = 'anatomicalterm'; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; const conditionTaxonSearch = (event, setFiltered, setQuery) => { - const endpoint = "ncbitaxonterm"; - const filterName = "singleOntologyFilter"; + const endpoint = 'ncbitaxonterm'; + const filterName = 'singleOntologyFilter'; const filter = buildAutocompleteFilter(event, curieAutocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -133,7 +129,7 @@ export const NewConditionForm = ({ const onInternalChange = (event) => { newConditionDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, value: event.value, }); @@ -141,13 +137,12 @@ export const NewConditionForm = ({ const onTextChange = (event) => { newConditionDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; - const dialogFooter = ( <>
    ); - } + }; const createNewFullNameHandler = (event) => { let cnt = localFullNames ? localFullNames.length : 0; const _localFullNames = global.structuredClone(localFullNames); _localFullNames.push({ - dataKey : cnt, - internal : false, - nameType : fullNameTypeTerms[0] + dataKey: cnt, + internal: false, + nameType: fullNameTypeTerms[0], }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -310,55 +330,134 @@ export const FullNameDialog = ({ name, const handleDeleteFullName = (event, props) => { let _localFullNames = global.structuredClone(localFullNames); - if(props.dataKey){ + if (props.dataKey) { _localFullNames.splice(props.dataKey, 1); - }else { + } else { _localFullNames.splice(props.rowIndex, 1); } setLocalFullNames(_localFullNames); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( -
    ); - } + }; - let headerGroup = - - - - - - - - - - - - - - ; + let headerGroup = ( + + + + + + + + + + + + + + + ); return (
    - +

    Symbol

    - onRowEditSave(props)}> - - displayTextEditorTemplate(props, errorMessages)} field="displayText" header="Display Text" headerClassName='surface-0' body={displayTextTemplate}/> - formatTextEditorTemplate(props, errorMessages)} field="formatText" header="Format Text" headerClassName='surface-0' body={formatTextTemplate}/> - - - synonymUrlEditorTemplate(props, errorMessages)} field="synonymUrl" header="Synonym URL" headerClassName='surface-0' body={synonymUrlTemplate}/> - - evidenceEditorTemplate(props, errorMessages)} field="evidence.curie" header="Evidence" headerClassName='surface-0' body={(rowData) => evidenceTemplate(rowData)}/> + onRowEditSave(props)} + > + + displayTextEditorTemplate(props, errorMessages)} + field="displayText" + header="Display Text" + headerClassName="surface-0" + body={displayTextTemplate} + /> + formatTextEditorTemplate(props, errorMessages)} + field="formatText" + header="Format Text" + headerClassName="surface-0" + body={formatTextTemplate} + /> + + + synonymUrlEditorTemplate(props, errorMessages)} + field="synonymUrl" + header="Synonym URL" + headerClassName="surface-0" + body={synonymUrlTemplate} + /> + + evidenceEditorTemplate(props, errorMessages)} + field="evidence.curie" + header="Evidence" + headerClassName="surface-0" + body={(rowData) => evidenceTemplate(rowData)} + /> diff --git a/src/main/cliapp/src/containers/nameSlotAnnotations/dialogs/SynonymsDialog.js b/src/main/cliapp/src/containers/nameSlotAnnotations/dialogs/SynonymsDialog.js index 686e06751..bd8b12544 100644 --- a/src/main/cliapp/src/containers/nameSlotAnnotations/dialogs/SynonymsDialog.js +++ b/src/main/cliapp/src/containers/nameSlotAnnotations/dialogs/SynonymsDialog.js @@ -13,19 +13,28 @@ import { ControlledVocabularyDropdown } from '../../../components/ControlledVoca import { useControlledVocabularyService } from '../../../service/useControlledVocabularyService'; import { ValidationService } from '../../../service/ValidationService'; import { evidenceTemplate, evidenceEditorTemplate } from '../../../components/EvidenceComponent'; -import { synonymScopeTemplate, nameTypeTemplate, synonymUrlTemplate, synonymUrlEditorTemplate, displayTextTemplate, displayTextEditorTemplate, formatTextTemplate, formatTextEditorTemplate } from '../../../components/NameSlotAnnotationComponent'; +import { + synonymScopeTemplate, + nameTypeTemplate, + synonymUrlTemplate, + synonymUrlEditorTemplate, + displayTextTemplate, + displayTextEditorTemplate, + formatTextTemplate, + formatTextEditorTemplate, +} from '../../../components/NameSlotAnnotationComponent'; export const SynonymsDialog = ({ - name, - field, - endpoint, - originalSynonymsData, - setOriginalSynonymsData, - errorMessagesMainRow, - setErrorMessagesMainRow - }) => { + name, + field, + endpoint, + originalSynonymsData, + setOriginalSynonymsData, + errorMessagesMainRow, + setErrorMessagesMainRow, +}) => { const { originalSynonyms, isInEdit, dialog, rowIndex, mainRowProps } = originalSynonymsData; - const [localSynonyms, setLocalSynonyms] = useState(null) ; + const [localSynonyms, setLocalSynonyms] = useState(null); const [editingRows, setEditingRows] = useState({}); const [errorMessages, setErrorMessages] = useState([]); const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); @@ -41,15 +50,15 @@ export const SynonymsDialog = ({ let _localSynonyms = cloneSynonyms(originalSynonyms); setLocalSynonyms(_localSynonyms); - if(isInEdit){ + if (isInEdit) { let rowsObject = {}; - if(_localSynonyms) { + if (_localSynonyms) { _localSynonyms.forEach((fn) => { rowsObject[`${fn.dataKey}`] = true; }); } setEditingRows(rowsObject); - }else{ + } else { setEditingRows({}); } rowsEdited.current = 0; @@ -57,14 +66,14 @@ export const SynonymsDialog = ({ const onRowEditChange = (e) => { setEditingRows(e.data); - } + }; const onRowEditCancel = (event) => { let _editingRows = { ...editingRows }; delete _editingRows[event.index]; setEditingRows(_editingRows); - let _localSynonyms = [...localSynonyms];//add new note support - if(originalSynonyms && originalSynonyms[event.index]){ + let _localSynonyms = [...localSynonyms]; //add new note support + if (originalSynonyms && originalSynonyms[event.index]) { let dataKey = _localSynonyms[event.index].dataKey; _localSynonyms[event.index] = global.structuredClone(originalSynonyms[event.index]); _localSynonyms[event.index].dataKey = dataKey; @@ -73,11 +82,11 @@ export const SynonymsDialog = ({ const errorMessagesCopy = errorMessages; errorMessagesCopy[event.index] = {}; setErrorMessages(errorMessagesCopy); - compareChangesInSynonyms(event.data,event.index); + compareChangesInSynonyms(event.data, event.index); }; const compareChangesInSynonyms = (data, index) => { - if(originalSynonyms && originalSynonyms[index]) { + if (originalSynonyms && originalSynonyms[index]) { if (data.internal !== originalSynonyms[index].internal) { rowsEdited.current++; } @@ -90,10 +99,11 @@ export const SynonymsDialog = ({ if (data.synonymUrl !== originalSynonyms[index].synonymUrl) { rowsEdited.current++; } - if ((originalSynonyms[index].evidence && !data.evidence) || - (!originalSynonyms[index].evidence && data.evidence) || - (data.evidence && (data.evidence.length !== originalSynonyms[index].evidence.length)) - ) { + if ( + (originalSynonyms[index].evidence && !data.evidence) || + (!originalSynonyms[index].evidence && data.evidence) || + (data.evidence && data.evidence.length !== originalSynonyms[index].evidence.length) + ) { rowsEdited.current++; } else { if (data.evidence) { @@ -104,26 +114,28 @@ export const SynonymsDialog = ({ } } } - if ((originalSynonyms[index].synonymScope && !data.synonymScope) || - (!originalSynonyms[index].synonymScope && data.synonymScope) || - (originalSynonyms[index].synonymScope && (originalSynonyms[index].synonymScope.name !== data.synonymScope.name)) - ) { + if ( + (originalSynonyms[index].synonymScope && !data.synonymScope) || + (!originalSynonyms[index].synonymScope && data.synonymScope) || + (originalSynonyms[index].synonymScope && originalSynonyms[index].synonymScope.name !== data.synonymScope.name) + ) { rowsEdited.current++; } - if ((originalSynonyms[index].nameType && !data.nameType) || - (!originalSynonyms[index].nameType && data.nameType) || - (originalSynonyms[index].nameType && (originalSynonyms[index].nameType.name !== data.nameType.name)) - ) { + if ( + (originalSynonyms[index].nameType && !data.nameType) || + (!originalSynonyms[index].nameType && data.nameType) || + (originalSynonyms[index].nameType && originalSynonyms[index].nameType.name !== data.nameType.name) + ) { rowsEdited.current++; } } - + if (localSynonyms.length > originalSynonyms?.length || !originalSynonyms) { rowsEdited.current++; } }; - const onRowEditSave = async(event) => { + const onRowEditSave = async (event) => { const result = await validateSynonym(localSynonyms[event.index]); const errorMessagesCopy = [...errorMessages]; errorMessagesCopy[event.index] = {}; @@ -132,14 +144,19 @@ export const SynonymsDialog = ({ let reported = false; Object.keys(result.data).forEach((field) => { let messageObject = { - severity: "error", - message: result.data[field] + severity: 'error', + message: result.data[field], }; errorMessagesCopy[event.index][field] = messageObject; - if(!reported) { + if (!reported) { toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', - detail: 'Could not update ' + name + ' [' + localSynonyms[event.index].id + ']', sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Update error: ', + detail: 'Could not update ' + name + ' [' + localSynonyms[event.index].id + ']', + sticky: false, + }, ]); reported = true; } @@ -178,13 +195,13 @@ export const SynonymsDialog = ({ let _clonableSynonyms = []; if (clonableSynonyms?.length > 0 && clonableSynonyms[0]) { _clonableSynonyms = global.structuredClone(clonableSynonyms); - if(_clonableSynonyms) { - let counter = 0 ; + if (_clonableSynonyms) { + let counter = 0; _clonableSynonyms.forEach((name) => { name.dataKey = counter++; }); } - } + } return _clonableSynonyms; }; @@ -199,20 +216,19 @@ export const SynonymsDialog = ({ const errorMessagesCopy = global.structuredClone(errorMessagesMainRow); let messageObject = { - severity: "warn", - message: "Pending Edits!" + severity: 'warn', + message: 'Pending Edits!', }; errorMessagesCopy[rowIndex] = {}; errorMessagesCopy[rowIndex][field] = messageObject; - setErrorMessagesMainRow({...errorMessagesCopy}); + setErrorMessagesMainRow({ ...errorMessagesCopy }); setOriginalSynonymsData((originalSynonymsData) => { - return { - ...originalSynonymsData, - dialog: false, - } - } - ); + return { + ...originalSynonymsData, + dialog: false, + }; + }); }; const internalTemplate = (rowData) => { @@ -222,7 +238,7 @@ export const SynonymsDialog = ({ const onInternalEditorValueChange = (props, event) => { let _localSynonyms = [...localSynonyms]; _localSynonyms[props.rowIndex].internal = event.value.name; - } + }; const internalEditor = (props) => { return ( @@ -231,15 +247,13 @@ export const SynonymsDialog = ({ options={booleanTerms} editorChange={onInternalEditorValueChange} props={props} - field={"internal"} + field={'internal'} /> - + ); }; - - const onSynonymScopeEditorValueChange = (props, event) => { let _localSynonyms = [...localSynonyms]; _localSynonyms[props.rowIndex].synonymScope = event.value; @@ -254,9 +268,9 @@ export const SynonymsDialog = ({ editorChange={onSynonymScopeEditorValueChange} props={props} showClear={true} - dataKey='id' + dataKey="id" /> - + ); }; @@ -275,9 +289,9 @@ export const SynonymsDialog = ({ editorChange={onNameTypeEditorValueChange} props={props} showClear={false} - dataKey='id' + dataKey="id" /> - + ); }; @@ -285,23 +299,23 @@ export const SynonymsDialog = ({ const footerTemplate = () => { if (!isInEdit) { return null; - }; + } return (
    ); - } + }; const createNewSynonymHandler = (event) => { let cnt = localSynonyms ? localSynonyms.length : 0; const _localSynonyms = global.structuredClone(localSynonyms); _localSynonyms.push({ - dataKey : cnt, - internal : false, - nameType : synonymTypeTerms[0] + dataKey: cnt, + internal: false, + nameType: synonymTypeTerms[0], }); let _editingRows = { ...editingRows, ...{ [`${cnt}`]: true } }; setEditingRows(_editingRows); @@ -310,55 +324,134 @@ export const SynonymsDialog = ({ const handleDeleteSynonym = (event, props) => { let _localSynonyms = global.structuredClone(localSynonyms); - if(props.dataKey){ + if (props.dataKey) { _localSynonyms.splice(props.dataKey, 1); - }else { + } else { _localSynonyms.splice(props.rowIndex, 1); } setLocalSynonyms(_localSynonyms); rowsEdited.current++; - } + }; const deleteAction = (props) => { return ( - - ) + ); } }; - - const columns = [{ - field: "uniqueId", - header: "Unique ID", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.uniqueidFilterConfig - }, - { - field: "phenotypeAnnotationSubject.symbol", - header: "Subject", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.phenotypeAnnotationSubjectFilterConfig - }, - { - field: "relation.name", - header: "Phenotype Relation", - sortable: true, - filterConfig: FILTER_CONFIGS.paRelationFilterConfig - }, - { - field: "phenotypeAnnotationObject", - header: "Phenotype", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.phenotypeAnnotationObjectFilterConfig - }, - { - field: "singleReference.primaryCrossReferenceCurie", - header: "Reference", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig - }, - { - field: "crossReference.displayName", - header: "Cross Reference", - sortable: true, - filterConfig: FILTER_CONFIGS.crossReferenceFilterConfig - }, - { - field: "conditionRelations.uniqueId", - header: "Experimental Conditions", - body: conditionRelationsTemplate, - sortable: true, - filterConfig: FILTER_CONFIGS.paConditionRelationsSummaryFilterConfig - }, - { - field: "sgdStrainBackground.name", - header: "SGD Strain Background", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.sgdStrainBackgroundFilterConfig - }, - { - field: "inferredGene.geneSymbol.displayText", - header: "Inferred Gene", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.inferredGeneFilterConfig, - }, - { - field: "assertedGenes.geneSymbol.displayText", - header: "Asserted Genes", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.assertedGenesFilterConfig - }, - { - field: "inferredAllele.alleleSymbol.displayText", - header: "Inferred Allele", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.inferredAlleleFilterConfig, - }, - { - field: "assertedAllele.alleleSymbol.displayText", - header: "Asserted Allele", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.assertedAlleleFilterConfig - }, - { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", - sortable: true, - filterConfig: FILTER_CONFIGS.phenotypeDataProviderFilterConfig, - }, - { - field: "dateCreated", - header: "Date Created", - sortable: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, - }, - { - field: "internal", - header: "Internal", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.internalFilterConfig - }, - { - field: "obsolete", - header: "Obsolete", - body: (rowData) => , - sortable: true, - filterConfig: FILTER_CONFIGS.obsoleteFilterConfig - } + const columns = [ + { + field: 'uniqueId', + header: 'Unique ID', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, + }, + { + field: 'phenotypeAnnotationSubject.symbol', + header: 'Subject', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.phenotypeAnnotationSubjectFilterConfig, + }, + { + field: 'relation.name', + header: 'Phenotype Relation', + sortable: true, + filterConfig: FILTER_CONFIGS.paRelationFilterConfig, + }, + { + field: 'phenotypeAnnotationObject', + header: 'Phenotype', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.phenotypeAnnotationObjectFilterConfig, + }, + { + field: 'singleReference.primaryCrossReferenceCurie', + header: 'Reference', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig, + }, + { + field: 'crossReference.displayName', + header: 'Cross Reference', + sortable: true, + filterConfig: FILTER_CONFIGS.crossReferenceFilterConfig, + }, + { + field: 'conditionRelations.uniqueId', + header: 'Experimental Conditions', + body: conditionRelationsTemplate, + sortable: true, + filterConfig: FILTER_CONFIGS.paConditionRelationsSummaryFilterConfig, + }, + { + field: 'sgdStrainBackground.name', + header: 'SGD Strain Background', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.sgdStrainBackgroundFilterConfig, + }, + { + field: 'inferredGene.geneSymbol.displayText', + header: 'Inferred Gene', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.inferredGeneFilterConfig, + }, + { + field: 'assertedGenes.geneSymbol.displayText', + header: 'Asserted Genes', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.assertedGenesFilterConfig, + }, + { + field: 'inferredAllele.alleleSymbol.displayText', + header: 'Inferred Allele', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.inferredAlleleFilterConfig, + }, + { + field: 'assertedAllele.alleleSymbol.displayText', + header: 'Asserted Allele', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.assertedAlleleFilterConfig, + }, + { + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', + sortable: true, + filterConfig: FILTER_CONFIGS.phenotypeDataProviderFilterConfig, + }, + { + field: 'dateCreated', + header: 'Date Created', + sortable: true, + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, + }, + { + field: 'internal', + header: 'Internal', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.internalFilterConfig, + }, + { + field: 'obsolete', + header: 'Obsolete', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, + }, ]; const DEFAULT_COLUMN_WIDTH = 10; - const SEARCH_ENDPOINT = "phenotype-annotation"; - const defaultFilters = {obsoleteFilter: {obsolete: {queryString: "false", tokenOperator: "OR"}}}; + const SEARCH_ENDPOINT = 'phenotype-annotation'; + const defaultFilters = { obsoleteFilter: { obsolete: { queryString: 'false' } } }; - const initialTableState = getDefaultTableState("PhenotypeAnnotations", columns, DEFAULT_COLUMN_WIDTH, defaultFilters); + const initialTableState = getDefaultTableState('PhenotypeAnnotations', columns, DEFAULT_COLUMN_WIDTH, defaultFilters); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isFetching, isLoading } = useGetTableData({ tableState, @@ -195,7 +199,7 @@ export const PhenotypeAnnotationsTable = () => { setEntities: setPhenotypeAnnotations, setTotalRecords, toast_topleft, - searchService + searchService, }); return ( @@ -211,19 +215,19 @@ export const PhenotypeAnnotationsTable = () => { tableState={tableState} setTableState={setTableState} columns={columns} - toasts={{toast_topleft, toast_topright }} + toasts={{ toast_topleft, toast_topright }} isEditable={false} isInEditMode={isInEditMode} setIsInEditMode={setIsInEditMode} sortMapping={sortMapping} - errorObject={{errorMessages, setErrorMessages, uiErrorMessages, setUiErrorMessages}} + errorObject={{ errorMessages, setErrorMessages, uiErrorMessages, setUiErrorMessages }} deletionEnabled={false} deprecateOption={false} modReset={false} duplicationEnabled={false} defaultColumnWidth={DEFAULT_COLUMN_WIDTH} fetching={isFetching || isLoading} - defaultFilters = {defaultFilters} + defaultFilters={defaultFilters} />
    { ); }; - diff --git a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/__tests__/PhenotypeAnnotationsTable.test.js b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/__tests__/PhenotypeAnnotationsTable.test.js index e631b8f4f..9fa682b57 100644 --- a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/__tests__/PhenotypeAnnotationsTable.test.js +++ b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/__tests__/PhenotypeAnnotationsTable.test.js @@ -1,13 +1,18 @@ -import React from "react"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { PhenotypeAnnotationsPage } from "../index"; +import { PhenotypeAnnotationsPage } from '../index'; import '../../../tools/jest/setupTests'; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData"; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -15,36 +20,38 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); - + await waitFor(() => { expect(result); }); }, 10000); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Phenotype Annotations Table/i); expect(tableTitle).toBeInTheDocument(); }, 10000); - it("The table contains correct data", async () => { + it('The table contains correct data', async () => { let result = await renderWithClient(); - const uniqueIdTd = await result.findByText("ZFIN:ZDB-FISH-150901-427|has_phenotype|head decreased size, abnormal|PATO:0000587|ZFA:0001114|AGRKB:101000000388372|has_condition|ZECO:0000103|standard conditions"); + const uniqueIdTd = await result.findByText( + 'ZFIN:ZDB-FISH-150901-427|has_phenotype|head decreased size, abnormal|PATO:0000587|ZFA:0001114|AGRKB:101000000388372|has_condition|ZECO:0000103|standard conditions' + ); const subjectTd = await result.findByText(/slc35d1ahi3378Tg\/hi3378Tg/i); - const relationTd = await result.findByText("has_phenotype"); - const objectTd = await result.findByText("head decreased size, abnormal"); + const relationTd = await result.findByText('has_phenotype'); + const objectTd = await result.findByText('head decreased size, abnormal'); const referenceTd = await result.findByText(/PMID:15256591/i); - const inferredGeneTd = await result.findByText("Acd (MGI:87873)"); - const inferredAlleleTd = await result.findByText("Ccdt (MGI:1856658)"); - const assertedGeneTd = await result.findByText("Acox1 (MGI:1330812)"); - const assertedAlleleTd = await result.findByText("Acox1tm1Jkr (MGI:1857811)"); - const dataProviderTd = await result.findByText("ZFIN"); - const dateCreatedTd = await result.findByText("2024-01-17T15:26:57Z"); - + const inferredGeneTd = await result.findByText('Acd (MGI:87873)'); + const inferredAlleleTd = await result.findByText('Ccdt (MGI:1856658)'); + const assertedGeneTd = await result.findByText('Acox1 (MGI:1330812)'); + const assertedAlleleTd = await result.findByText('Acox1tm1Jkr (MGI:1857811)'); + const dataProviderTd = await result.findByText('ZFIN'); + const dateCreatedTd = await result.findByText('2024-01-17T15:26:57Z'); + await waitFor(() => { expect(uniqueIdTd).toBeInTheDocument(); expect(subjectTd).toBeInTheDocument(); @@ -56,8 +63,7 @@ describe("", () => { expect(assertedGeneTd).toBeInTheDocument(); expect(assertedAlleleTd).toBeInTheDocument(); expect(dataProviderTd).toBeInTheDocument(); - expect(dateCreatedTd).toBeInTheDocument(); + expect(dateCreatedTd).toBeInTheDocument(); }); }, 10000); - }); diff --git a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/index.js b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/index.js index f5a591806..2178cc601 100644 --- a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/index.js +++ b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/index.js @@ -1,3 +1,3 @@ -import { PhenotypeAnnotationsPage } from "./PhenotypeAnnotationsPage"; +import { PhenotypeAnnotationsPage } from './PhenotypeAnnotationsPage'; -export { PhenotypeAnnotationsPage }; \ No newline at end of file +export { PhenotypeAnnotationsPage }; diff --git a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/mockData/mockData.js b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/mockData/mockData.js index 5e506a7c9..56d3b7188 100644 --- a/src/main/cliapp/src/containers/phenotypeAnnotationsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/phenotypeAnnotationsPage/mockData/mockData.js @@ -1,691 +1,694 @@ export const data = { - "results": [ + results: [ { - "type": "AGMPhenotypeAnnotation", - "id": 200386977, - "dateCreated": "2024-01-17T15:26:57Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2024-03-05T10:31:10.220795Z", - "dbDateUpdated": "2024-03-05T10:31:10.22081Z", - "singleReference": { - "id": 268175, - "internal": false, - "obsolete": false, - "dbDateCreated": "2022-11-18T19:41:54.20215Z", - "dbDateUpdated": "2023-09-11T18:13:34.464961Z", - "curie": "AGRKB:101000000388372", - "crossReferences": [ - { - "id": 74254507, - "internal": false, - "obsolete": false, - "referencedCurie": "DOI:10.1073/pnas.0403929101", - "displayName": "DOI:10.1073/pnas.0403929101" - }, - { - "id": 74254508, - "internal": false, - "obsolete": false, - "referencedCurie": "PMCID:PMC516474", - "displayName": "PMCID:PMC516474" - }, - { - "id": 74254509, - "internal": false, - "obsolete": false, - "referencedCurie": "PMID:15256591", - "displayName": "PMID:15256591" - }, - { - "id": 74254510, - "internal": false, - "obsolete": false, - "referencedCurie": "SGD:S000115492", - "displayName": "SGD:S000115492" - }, - { - "id": 74254511, - "internal": false, - "obsolete": false, - "referencedCurie": "ZFIN:ZDB-PUB-040708-1", - "displayName": "ZFIN:ZDB-PUB-040708-1" - } - ], - "shortCitation": "Amsterdam A (2004) Proc Natl Acad Sci U S A 101(35):12792-7" - }, - "uniqueId": "ZFIN:ZDB-FISH-150901-427|has_phenotype|head decreased size, abnormal|PATO:0000587|ZFA:0001114|AGRKB:101000000388372|has_condition|ZECO:0000103|standard conditions", - "conditionRelations": [ - { - "id": 200000250, - "internal": false, - "obsolete": false, - "dbDateCreated": "2024-03-03T12:52:16.68015Z", - "dbDateUpdated": "2024-03-05T10:41:05.999755Z", - "uniqueId": "has_condition|ZECO:0000103|standard conditions", - "conditionRelationType": { - "id": 7662730, - "internal": false, - "obsolete": false, - "name": "has_condition" - }, - "conditions": [ - { - "id": 200000200, - "internal": false, - "obsolete": false, - "dbDateCreated": "2024-03-03T12:52:16.657856Z", - "dbDateUpdated": "2024-03-03T12:52:16.657879Z", - "uniqueId": "ZECO:0000103|standard conditions", - "conditionClass": { - "id": 5550, - "internal": false, - "obsolete": false, - "curie": "ZECO:0000103", - "name": "standard conditions", - "definition": "Experimental condition that is the standard environment for zebrafish husbandry, as described in ‘The Zebrafish Book’. In general the standard environment utilizes contaminant free tank water, heated to 28.5 degrees C, with the fish fed a normal contaminant free diet, with standard osmolarity, pH, and normal light cycle of 14hr light/10hr dark." - }, - "conditionSummary": "standard conditions", - "conditionFreeText": "standard conditions" - } - ] - } - ], - "dataProvider": { - "id": 201422341, - "internal": false, - "obsolete": false, - "dbDateCreated": "2024-03-05T10:31:10.219143Z", - "dbDateUpdated": "2024-03-05T10:31:10.21916Z", - "sourceOrganization": { - "id": 20308685, - "internal": false, - "obsolete": false, - "abbreviation": "ZFIN", - "fullName": "Zebrafish Information Network", - "homepageResourceDescriptorPage": { - "id": 41750742, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.466873Z", - "dbDateUpdated": "2023-08-27T22:00:03.542259Z", - "name": "homepage", - "urlTemplate": "https://zfin.org/" - } - }, - "crossReference": { - "id": 201551741, - "internal": false, - "obsolete": false, - "dbDateCreated": "2024-03-05T10:31:10.217464Z", - "dbDateUpdated": "2024-03-05T10:31:10.217477Z", - "referencedCurie": "ZFIN", - "displayName": "ZFIN", - "resourceDescriptorPage": { - "id": 41750742, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.466873Z", - "dbDateUpdated": "2023-08-27T22:00:03.542259Z", - "name": "homepage", - "urlTemplate": "https://zfin.org/" - } - } - }, - "phenotypeAnnotationObject": "head decreased size, abnormal", - "relation": { - "id": 200000000, - "internal": false, - "obsolete": false, - "name": "has_phenotype" - }, - "phenotypeAnnotationSubject": { - "type": "AffectedGenomicModel", - "id": 309354, - "createdBy": { - "id": 8019288, - "dateCreated": "2022-06-14T14:54:31.390724Z", - "dateUpdated": "2022-06-14T14:54:31.390724Z", - "internal": false, - "obsolete": false, - "uniqueId": "ZFIN:CURATOR" - }, - "dateCreated": "2015-09-01T07:00:00Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-06-09T13:47:14.458121Z", - "dbDateUpdated": "2024-01-17T17:52:00.624187Z", - "modEntityId": "ZFIN:ZDB-FISH-150901-427", - "dataProvider": { - "id": 86992863, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-06-09T13:47:14.455058Z", - "dbDateUpdated": "2024-01-17T17:52:00.625242Z", - "sourceOrganization": { - "id": 20308685, - "internal": false, - "obsolete": false, - "abbreviation": "ZFIN", - "fullName": "Zebrafish Information Network", - "homepageResourceDescriptorPage": { - "id": 41750742, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.466873Z", - "dbDateUpdated": "2023-08-27T22:00:03.542259Z", - "name": "homepage", - "urlTemplate": "https://zfin.org/" - } - } - }, - "taxon": { - "id": 242039, - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:7955", - "name": "Danio rerio" - }, - "name": "slc35d1ahi3378Tg/hi3378Tg", - "subtype": { - "id": 40545168, - "internal": false, - "obsolete": false, - "name": "fish" - } - }, - "inferredGene": { - "type": "Gene", - "id": 702094, - "createdBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "updatedBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "dateCreated": "1996-03-26T15:51:46Z", - "dateUpdated": "2005-03-07T15:16:06Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T11:36:48.627505Z", - "modEntityId": "MGI:87873", - "dataProvider": { - "id": 75609905, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T11:36:48.627101Z", - "sourceOrganization": { - "id": 20308680, - "internal": false, - "obsolete": false, - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "id": 41750686, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-08-27T22:00:02.941675Z", - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } - }, - "crossReference": { - "id": 80163197, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T10:39:10.026894Z", - "dbDateUpdated": "2023-08-01T16:03:04.292374Z", - "referencedCurie": "MGI:87873", - "displayName": "MGI:87873", - "resourceDescriptorPage": { - "id": 41750677, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.235386Z", - "dbDateUpdated": "2023-08-27T22:00:02.93439Z", - "name": "gene", - "urlTemplate": "http://www.informatics.jax.org/marker/MGI:[%s]" - } - } - }, - "taxon": { - "id": 241901, - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" - }, - "geneType": { - "id": 392916, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-29T17:13:50.391207Z", - "curie": "SO:0001217", - "name": "protein_coding_gene", - "namespace": "sequence", - "definition": "A gene that codes for an RNA that can be translated into a protein.", - "childCount": 5, - "descendantCount": 9 - }, - "geneSymbol": { - "id": 51417904, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:46:17.577808Z", - "dbDateUpdated": "2024-02-06T11:36:48.628607Z", - "nameType": { - "id": 20308690, - "internal": false, - "obsolete": false, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." - }, - "formatText": "Acd", - "displayText": "Acd" - }, - "geneFullName": { - "id": 51417905, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:46:17.579571Z", - "dbDateUpdated": "2024-02-06T11:36:48.627902Z", - "nameType": { - "id": 20308691, - "internal": false, - "obsolete": false, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." - }, - "formatText": "adrenocortical dysplasia", - "displayText": "adrenocortical dysplasia" - } - }, - "inferredAllele": { - "type": "Allele", - "id": 761847, - "createdBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "updatedBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "dateCreated": "1998-02-04T22:00:54Z", - "dateUpdated": "2020-04-17T21:41:36Z", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.853926Z", - "dbDateUpdated": "2024-02-07T09:13:21.51779Z", - "modEntityId": "MGI:1856658", - "dataProvider": { - "id": 115684900, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.793969Z", - "dbDateUpdated": "2024-02-07T09:13:21.518281Z", - "sourceOrganization": { - "id": 20308680, - "internal": false, - "obsolete": false, - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "id": 41750686, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-08-27T22:00:02.941675Z", - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } - }, - "crossReference": { - "id": 115684899, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.793166Z", - "dbDateUpdated": "2023-08-12T09:58:57.561821Z", - "referencedCurie": "MGI:1856658", - "displayName": "MGI:1856658", - "resourceDescriptorPage": { - "id": 41750683, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.238774Z", - "dbDateUpdated": "2023-08-27T22:00:02.93942Z", - "name": "allele", - "urlTemplate": "http://www.informatics.jax.org/allele/MGI:[%s]" - } - } - }, - "taxon": { - "id": 241901, - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" - }, - "isExtinct": false, - "alleleSymbol": { - "id": 115684904, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.860978Z", - "dbDateUpdated": "2024-02-07T09:13:21.561098Z", - "nameType": { - "id": 20308690, - "internal": false, - "obsolete": false, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." - }, - "formatText": "Ccdt", - "displayText": "Ccdt" - }, - "alleleFullName": { - "id": 115684905, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.863258Z", - "dbDateUpdated": "2024-02-07T09:13:21.559681Z", - "nameType": { - "id": 20308691, - "internal": false, - "obsolete": false, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." - }, - "formatText": "adrenocortical dysplasia", - "displayText": "adrenocortical dysplasia" - }, - "alleleDatabaseStatus": { - "id": 115684903, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-08-08T03:48:07.859418Z", - "dbDateUpdated": "2024-02-07T09:13:21.558892Z", - "databaseStatus": { - "id": 97840955, - "internal": false, - "obsolete": false, - "name": "approved" - } - } - }, - "assertedGenes": [ + type: 'AGMPhenotypeAnnotation', + id: 200386977, + dateCreated: '2024-01-17T15:26:57Z', + internal: false, + obsolete: false, + dbDateCreated: '2024-03-05T10:31:10.220795Z', + dbDateUpdated: '2024-03-05T10:31:10.22081Z', + singleReference: { + id: 268175, + internal: false, + obsolete: false, + dbDateCreated: '2022-11-18T19:41:54.20215Z', + dbDateUpdated: '2023-09-11T18:13:34.464961Z', + curie: 'AGRKB:101000000388372', + crossReferences: [ + { + id: 74254507, + internal: false, + obsolete: false, + referencedCurie: 'DOI:10.1073/pnas.0403929101', + displayName: 'DOI:10.1073/pnas.0403929101', + }, + { + id: 74254508, + internal: false, + obsolete: false, + referencedCurie: 'PMCID:PMC516474', + displayName: 'PMCID:PMC516474', + }, + { + id: 74254509, + internal: false, + obsolete: false, + referencedCurie: 'PMID:15256591', + displayName: 'PMID:15256591', + }, + { + id: 74254510, + internal: false, + obsolete: false, + referencedCurie: 'SGD:S000115492', + displayName: 'SGD:S000115492', + }, + { + id: 74254511, + internal: false, + obsolete: false, + referencedCurie: 'ZFIN:ZDB-PUB-040708-1', + displayName: 'ZFIN:ZDB-PUB-040708-1', + }, + ], + shortCitation: 'Amsterdam A (2004) Proc Natl Acad Sci U S A 101(35):12792-7', + }, + uniqueId: + 'ZFIN:ZDB-FISH-150901-427|has_phenotype|head decreased size, abnormal|PATO:0000587|ZFA:0001114|AGRKB:101000000388372|has_condition|ZECO:0000103|standard conditions', + conditionRelations: [ + { + id: 200000250, + internal: false, + obsolete: false, + dbDateCreated: '2024-03-03T12:52:16.68015Z', + dbDateUpdated: '2024-03-05T10:41:05.999755Z', + uniqueId: 'has_condition|ZECO:0000103|standard conditions', + conditionRelationType: { + id: 7662730, + internal: false, + obsolete: false, + name: 'has_condition', + }, + conditions: [ + { + id: 200000200, + internal: false, + obsolete: false, + dbDateCreated: '2024-03-03T12:52:16.657856Z', + dbDateUpdated: '2024-03-03T12:52:16.657879Z', + uniqueId: 'ZECO:0000103|standard conditions', + conditionClass: { + id: 5550, + internal: false, + obsolete: false, + curie: 'ZECO:0000103', + name: 'standard conditions', + definition: + 'Experimental condition that is the standard environment for zebrafish husbandry, as described in ‘The Zebrafish Book’. In general the standard environment utilizes contaminant free tank water, heated to 28.5 degrees C, with the fish fed a normal contaminant free diet, with standard osmolarity, pH, and normal light cycle of 14hr light/10hr dark.', + }, + conditionSummary: 'standard conditions', + conditionFreeText: 'standard conditions', + }, + ], + }, + ], + dataProvider: { + id: 201422341, + internal: false, + obsolete: false, + dbDateCreated: '2024-03-05T10:31:10.219143Z', + dbDateUpdated: '2024-03-05T10:31:10.21916Z', + sourceOrganization: { + id: 20308685, + internal: false, + obsolete: false, + abbreviation: 'ZFIN', + fullName: 'Zebrafish Information Network', + homepageResourceDescriptorPage: { + id: 41750742, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.466873Z', + dbDateUpdated: '2023-08-27T22:00:03.542259Z', + name: 'homepage', + urlTemplate: 'https://zfin.org/', + }, + }, + crossReference: { + id: 201551741, + internal: false, + obsolete: false, + dbDateCreated: '2024-03-05T10:31:10.217464Z', + dbDateUpdated: '2024-03-05T10:31:10.217477Z', + referencedCurie: 'ZFIN', + displayName: 'ZFIN', + resourceDescriptorPage: { + id: 41750742, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.466873Z', + dbDateUpdated: '2023-08-27T22:00:03.542259Z', + name: 'homepage', + urlTemplate: 'https://zfin.org/', + }, + }, + }, + phenotypeAnnotationObject: 'head decreased size, abnormal', + relation: { + id: 200000000, + internal: false, + obsolete: false, + name: 'has_phenotype', + }, + phenotypeAnnotationSubject: { + type: 'AffectedGenomicModel', + id: 309354, + createdBy: { + id: 8019288, + dateCreated: '2022-06-14T14:54:31.390724Z', + dateUpdated: '2022-06-14T14:54:31.390724Z', + internal: false, + obsolete: false, + uniqueId: 'ZFIN:CURATOR', + }, + dateCreated: '2015-09-01T07:00:00Z', + internal: false, + obsolete: false, + dbDateCreated: '2023-06-09T13:47:14.458121Z', + dbDateUpdated: '2024-01-17T17:52:00.624187Z', + modEntityId: 'ZFIN:ZDB-FISH-150901-427', + dataProvider: { + id: 86992863, + internal: false, + obsolete: false, + dbDateCreated: '2023-06-09T13:47:14.455058Z', + dbDateUpdated: '2024-01-17T17:52:00.625242Z', + sourceOrganization: { + id: 20308685, + internal: false, + obsolete: false, + abbreviation: 'ZFIN', + fullName: 'Zebrafish Information Network', + homepageResourceDescriptorPage: { + id: 41750742, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.466873Z', + dbDateUpdated: '2023-08-27T22:00:03.542259Z', + name: 'homepage', + urlTemplate: 'https://zfin.org/', + }, + }, + }, + taxon: { + id: 242039, + internal: false, + obsolete: false, + curie: 'NCBITaxon:7955', + name: 'Danio rerio', + }, + name: 'slc35d1ahi3378Tg/hi3378Tg', + subtype: { + id: 40545168, + internal: false, + obsolete: false, + name: 'fish', + }, + }, + inferredGene: { + type: 'Gene', + id: 702094, + createdBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + updatedBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + dateCreated: '1996-03-26T15:51:46Z', + dateUpdated: '2005-03-07T15:16:06Z', + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T11:36:48.627505Z', + modEntityId: 'MGI:87873', + dataProvider: { + id: 75609905, + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T11:36:48.627101Z', + sourceOrganization: { + id: 20308680, + internal: false, + obsolete: false, + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + id: 41750686, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-08-27T22:00:02.941675Z', + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, + crossReference: { + id: 80163197, + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T10:39:10.026894Z', + dbDateUpdated: '2023-08-01T16:03:04.292374Z', + referencedCurie: 'MGI:87873', + displayName: 'MGI:87873', + resourceDescriptorPage: { + id: 41750677, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.235386Z', + dbDateUpdated: '2023-08-27T22:00:02.93439Z', + name: 'gene', + urlTemplate: 'http://www.informatics.jax.org/marker/MGI:[%s]', + }, + }, + }, + taxon: { + id: 241901, + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', + }, + geneType: { + id: 392916, + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-29T17:13:50.391207Z', + curie: 'SO:0001217', + name: 'protein_coding_gene', + namespace: 'sequence', + definition: 'A gene that codes for an RNA that can be translated into a protein.', + childCount: 5, + descendantCount: 9, + }, + geneSymbol: { + id: 51417904, + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:46:17.577808Z', + dbDateUpdated: '2024-02-06T11:36:48.628607Z', + nameType: { + id: 20308690, + internal: false, + obsolete: false, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', + }, + formatText: 'Acd', + displayText: 'Acd', + }, + geneFullName: { + id: 51417905, + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:46:17.579571Z', + dbDateUpdated: '2024-02-06T11:36:48.627902Z', + nameType: { + id: 20308691, + internal: false, + obsolete: false, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', + }, + formatText: 'adrenocortical dysplasia', + displayText: 'adrenocortical dysplasia', + }, + }, + inferredAllele: { + type: 'Allele', + id: 761847, + createdBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + updatedBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + dateCreated: '1998-02-04T22:00:54Z', + dateUpdated: '2020-04-17T21:41:36Z', + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.853926Z', + dbDateUpdated: '2024-02-07T09:13:21.51779Z', + modEntityId: 'MGI:1856658', + dataProvider: { + id: 115684900, + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.793969Z', + dbDateUpdated: '2024-02-07T09:13:21.518281Z', + sourceOrganization: { + id: 20308680, + internal: false, + obsolete: false, + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + id: 41750686, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-08-27T22:00:02.941675Z', + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, + crossReference: { + id: 115684899, + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.793166Z', + dbDateUpdated: '2023-08-12T09:58:57.561821Z', + referencedCurie: 'MGI:1856658', + displayName: 'MGI:1856658', + resourceDescriptorPage: { + id: 41750683, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.238774Z', + dbDateUpdated: '2023-08-27T22:00:02.93942Z', + name: 'allele', + urlTemplate: 'http://www.informatics.jax.org/allele/MGI:[%s]', + }, + }, + }, + taxon: { + id: 241901, + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', + }, + isExtinct: false, + alleleSymbol: { + id: 115684904, + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.860978Z', + dbDateUpdated: '2024-02-07T09:13:21.561098Z', + nameType: { + id: 20308690, + internal: false, + obsolete: false, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', + }, + formatText: 'Ccdt', + displayText: 'Ccdt', + }, + alleleFullName: { + id: 115684905, + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.863258Z', + dbDateUpdated: '2024-02-07T09:13:21.559681Z', + nameType: { + id: 20308691, + internal: false, + obsolete: false, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', + }, + formatText: 'adrenocortical dysplasia', + displayText: 'adrenocortical dysplasia', + }, + alleleDatabaseStatus: { + id: 115684903, + internal: false, + obsolete: false, + dbDateCreated: '2023-08-08T03:48:07.859418Z', + dbDateUpdated: '2024-02-07T09:13:21.558892Z', + databaseStatus: { + id: 97840955, + internal: false, + obsolete: false, + name: 'approved', + }, + }, + }, + assertedGenes: [ { - "type": "Gene", - "id": 702387, - "createdBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" + type: 'Gene', + id: 702387, + createdBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', }, - "updatedBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" + updatedBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', }, - "dateCreated": "1999-02-26T19:37:14Z", - "dateUpdated": "2013-03-15T18:38:59Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T11:34:46.000823Z", - "modEntityId": "MGI:1330812", - "dataProvider": { - "id": 75135599, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T11:34:46.000415Z", - "sourceOrganization": { - "id": 20308680, - "internal": false, - "obsolete": false, - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "id": 41750686, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-08-27T22:00:02.941675Z", - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } + dateCreated: '1999-02-26T19:37:14Z', + dateUpdated: '2013-03-15T18:38:59Z', + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T11:34:46.000823Z', + modEntityId: 'MGI:1330812', + dataProvider: { + id: 75135599, + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T11:34:46.000415Z', + sourceOrganization: { + id: 20308680, + internal: false, + obsolete: false, + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + id: 41750686, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-08-27T22:00:02.941675Z', + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, + crossReference: { + id: 80099344, + internal: false, + obsolete: false, + dbDateCreated: '2023-05-17T10:12:22.303899Z', + dbDateUpdated: '2023-08-01T16:06:31.61257Z', + referencedCurie: 'MGI:1330812', + displayName: 'MGI:1330812', + resourceDescriptorPage: { + id: 41750677, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.235386Z', + dbDateUpdated: '2023-08-27T22:00:02.93439Z', + name: 'gene', + urlTemplate: 'http://www.informatics.jax.org/marker/MGI:[%s]', + }, }, - "crossReference": { - "id": 80099344, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-17T10:12:22.303899Z", - "dbDateUpdated": "2023-08-01T16:06:31.61257Z", - "referencedCurie": "MGI:1330812", - "displayName": "MGI:1330812", - "resourceDescriptorPage": { - "id": 41750677, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.235386Z", - "dbDateUpdated": "2023-08-27T22:00:02.93439Z", - "name": "gene", - "urlTemplate": "http://www.informatics.jax.org/marker/MGI:[%s]" - } - } }, - "taxon": { - "id": 241901, - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" + taxon: { + id: 241901, + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', }, - "geneType": { - "id": 392916, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-29T17:13:50.391207Z", - "curie": "SO:0001217", - "name": "protein_coding_gene", - "namespace": "sequence", - "definition": "A gene that codes for an RNA that can be translated into a protein.", - "childCount": 5, - "descendantCount": 9 + geneType: { + id: 392916, + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-29T17:13:50.391207Z', + curie: 'SO:0001217', + name: 'protein_coding_gene', + namespace: 'sequence', + definition: 'A gene that codes for an RNA that can be translated into a protein.', + childCount: 5, + descendantCount: 9, }, - "geneSymbol": { - "id": 51421453, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:47:21.935972Z", - "dbDateUpdated": "2024-02-06T11:34:46.002042Z", - "nameType": { - "id": 20308690, - "internal": false, - "obsolete": false, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." + geneSymbol: { + id: 51421453, + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:47:21.935972Z', + dbDateUpdated: '2024-02-06T11:34:46.002042Z', + nameType: { + id: 20308690, + internal: false, + obsolete: false, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', }, - "formatText": "Acox1", - "displayText": "Acox1" + formatText: 'Acox1', + displayText: 'Acox1', }, - "geneFullName": { - "id": 51421454, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-03-03T20:47:21.937814Z", - "dbDateUpdated": "2024-02-06T11:34:46.001262Z", - "nameType": { - "id": 20308691, - "internal": false, - "obsolete": false, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." + geneFullName: { + id: 51421454, + internal: false, + obsolete: false, + dbDateCreated: '2023-03-03T20:47:21.937814Z', + dbDateUpdated: '2024-02-06T11:34:46.001262Z', + nameType: { + id: 20308691, + internal: false, + obsolete: false, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', }, - "formatText": "acyl-Coenzyme A oxidase 1, palmitoyl", - "displayText": "acyl-Coenzyme A oxidase 1, palmitoyl" - } - } + formatText: 'acyl-Coenzyme A oxidase 1, palmitoyl', + displayText: 'acyl-Coenzyme A oxidase 1, palmitoyl', + }, + }, ], - "assertedAllele": { - "type": "Allele", - "id": 4234652, - "createdBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "updatedBy": { - "id": 10740932, - "dateCreated": "2022-07-25T21:18:13.558556Z", - "dateUpdated": "2022-07-25T21:18:13.558556Z", - "internal": false, - "obsolete": false, - "uniqueId": "MGI:curation_staff" - }, - "dateCreated": "1999-09-10T15:22:24Z", - "dateUpdated": "2014-05-20T21:17:21Z", - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T23:17:33.99865Z", - "modEntityId": "MGI:1857811", - "dataProvider": { - "id": 75138053, - "internal": false, - "obsolete": false, - "dbDateUpdated": "2024-02-06T23:17:33.999278Z", - "sourceOrganization": { - "id": 20308680, - "internal": false, - "obsolete": false, - "abbreviation": "MGI", - "fullName": "Mouse Genome Informatics", - "homepageResourceDescriptorPage": { - "id": 41750686, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.240245Z", - "dbDateUpdated": "2023-08-27T22:00:02.941675Z", - "name": "homepage", - "urlTemplate": "http://www.informatics.jax.org/" - } - }, - "crossReference": { - "id": 80439565, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-05-18T20:53:23.514149Z", - "dbDateUpdated": "2023-08-11T14:50:04.487447Z", - "referencedCurie": "MGI:1857811", - "displayName": "MGI:1857811", - "resourceDescriptorPage": { - "id": 41750683, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.238774Z", - "dbDateUpdated": "2023-08-27T22:00:02.93942Z", - "name": "allele", - "urlTemplate": "http://www.informatics.jax.org/allele/MGI:[%s]" - } - } - }, - "taxon": { - "id": 241901, - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:10090", - "name": "Mus musculus" - }, - "isExtinct": false, - "alleleSymbol": { - "id": 69512560, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-04-14T18:48:42.076077Z", - "dbDateUpdated": "2024-02-06T23:17:34.074274Z", - "nameType": { - "id": 20308690, - "internal": false, - "obsolete": false, - "name": "nomenclature_symbol", - "definition": "A symbol for an object: e.g., pax6Leca2." - }, - "formatText": "Acox1tm1Jkr", - "displayText": "Acox1tm1Jkr" - }, - "alleleFullName": { - "id": 69512561, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-04-14T18:48:42.07758Z", - "dbDateUpdated": "2024-02-06T23:17:34.072558Z", - "nameType": { - "id": 20308691, - "internal": false, - "obsolete": false, - "name": "full_name", - "definition": "The full length name of an entity: e.g., broad angular dumpy." - }, - "formatText": "targeted mutation 1, Janardan K Reddy", - "displayText": "targeted mutation 1, Janardan K Reddy" - }, - "alleleGermlineTransmissionStatus": { - "id": 97253061, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-07-11T23:36:09.092707Z", - "dbDateUpdated": "2024-02-06T23:17:34.073421Z", - "germlineTransmissionStatus": { - "id": 88139190, - "internal": false, - "obsolete": false, - "name": "germline", - "definition": "Allele was created in a stem cell line and a report of transmission through the germline has been annotated" - } - }, - "alleleDatabaseStatus": { - "id": 97936951, - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-07-17T22:17:29.075406Z", - "dbDateUpdated": "2024-02-06T23:17:34.071521Z", - "databaseStatus": { - "id": 97840955, - "internal": false, - "obsolete": false, - "name": "approved" - } - } - } - } + assertedAllele: { + type: 'Allele', + id: 4234652, + createdBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + updatedBy: { + id: 10740932, + dateCreated: '2022-07-25T21:18:13.558556Z', + dateUpdated: '2022-07-25T21:18:13.558556Z', + internal: false, + obsolete: false, + uniqueId: 'MGI:curation_staff', + }, + dateCreated: '1999-09-10T15:22:24Z', + dateUpdated: '2014-05-20T21:17:21Z', + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T23:17:33.99865Z', + modEntityId: 'MGI:1857811', + dataProvider: { + id: 75138053, + internal: false, + obsolete: false, + dbDateUpdated: '2024-02-06T23:17:33.999278Z', + sourceOrganization: { + id: 20308680, + internal: false, + obsolete: false, + abbreviation: 'MGI', + fullName: 'Mouse Genome Informatics', + homepageResourceDescriptorPage: { + id: 41750686, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.240245Z', + dbDateUpdated: '2023-08-27T22:00:02.941675Z', + name: 'homepage', + urlTemplate: 'http://www.informatics.jax.org/', + }, + }, + crossReference: { + id: 80439565, + internal: false, + obsolete: false, + dbDateCreated: '2023-05-18T20:53:23.514149Z', + dbDateUpdated: '2023-08-11T14:50:04.487447Z', + referencedCurie: 'MGI:1857811', + displayName: 'MGI:1857811', + resourceDescriptorPage: { + id: 41750683, + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.238774Z', + dbDateUpdated: '2023-08-27T22:00:02.93942Z', + name: 'allele', + urlTemplate: 'http://www.informatics.jax.org/allele/MGI:[%s]', + }, + }, + }, + taxon: { + id: 241901, + internal: false, + obsolete: false, + curie: 'NCBITaxon:10090', + name: 'Mus musculus', + }, + isExtinct: false, + alleleSymbol: { + id: 69512560, + internal: false, + obsolete: false, + dbDateCreated: '2023-04-14T18:48:42.076077Z', + dbDateUpdated: '2024-02-06T23:17:34.074274Z', + nameType: { + id: 20308690, + internal: false, + obsolete: false, + name: 'nomenclature_symbol', + definition: 'A symbol for an object: e.g., pax6Leca2.', + }, + formatText: 'Acox1tm1Jkr', + displayText: 'Acox1tm1Jkr', + }, + alleleFullName: { + id: 69512561, + internal: false, + obsolete: false, + dbDateCreated: '2023-04-14T18:48:42.07758Z', + dbDateUpdated: '2024-02-06T23:17:34.072558Z', + nameType: { + id: 20308691, + internal: false, + obsolete: false, + name: 'full_name', + definition: 'The full length name of an entity: e.g., broad angular dumpy.', + }, + formatText: 'targeted mutation 1, Janardan K Reddy', + displayText: 'targeted mutation 1, Janardan K Reddy', + }, + alleleGermlineTransmissionStatus: { + id: 97253061, + internal: false, + obsolete: false, + dbDateCreated: '2023-07-11T23:36:09.092707Z', + dbDateUpdated: '2024-02-06T23:17:34.073421Z', + germlineTransmissionStatus: { + id: 88139190, + internal: false, + obsolete: false, + name: 'germline', + definition: + 'Allele was created in a stem cell line and a report of transmission through the germline has been annotated', + }, + }, + alleleDatabaseStatus: { + id: 97936951, + internal: false, + obsolete: false, + dbDateCreated: '2023-07-17T22:17:29.075406Z', + dbDateUpdated: '2024-02-06T23:17:34.071521Z', + databaseStatus: { + id: 97840955, + internal: false, + obsolete: false, + name: 'approved', + }, + }, + }, + }, ], - "totalResults": 1, - "returnedRecords": 1 + totalResults: 1, + returnedRecords: 1, }; diff --git a/src/main/cliapp/src/containers/profilePage/ProfileComponent.js b/src/main/cliapp/src/containers/profilePage/ProfileComponent.js index 58edcdb0c..cb97d7f63 100644 --- a/src/main/cliapp/src/containers/profilePage/ProfileComponent.js +++ b/src/main/cliapp/src/containers/profilePage/ProfileComponent.js @@ -1,104 +1,136 @@ import React, { useState, useRef } from 'react'; import { Card } from 'primereact/card'; import { DataTable } from 'primereact/datatable'; +import { Dropdown } from 'primereact/dropdown'; import { Column } from 'primereact/column'; import { PersonService } from '../../service/PersonService'; import { useOktaAuth } from '@okta/okta-react'; import { Panel } from 'primereact/panel'; import { Ripple } from 'primereact/ripple'; -import * as jose from 'jose' +import * as jose from 'jose'; import { ConfirmButton } from '../../components/ConfirmButton'; -import {useGetUserSettings} from "../../service/useGetUserSettings"; -import JsonView from 'react18-json-view' -import 'react18-json-view/src/style.css' -import 'react18-json-view/src/dark.css' -import { PersonSettingsService } from "../../service/PersonSettingsService"; +import { useGetUserSettings } from '../../service/useGetUserSettings'; +import JsonView from 'react18-json-view'; +import 'react18-json-view/src/style.css'; +import 'react18-json-view/src/dark.css'; +import { PersonSettingsService } from '../../service/PersonSettingsService'; +import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { Toast } from 'primereact/toast'; import { useQueryClient, useQuery } from '@tanstack/react-query'; const initialThemeState = { - layoutMode: "static", - layoutColorMode: "dark", - inputStyle: "outlined", + layoutMode: 'static', + layoutColorMode: 'dark', + inputStyle: 'outlined', ripple: true, scale: 14, - theme: "vela-blue", + theme: 'vela-blue', }; -export const ProfileComponent = () => { +const initialSiteState = { + debug: 'false', +}; - const { settings: themeState, mutate: setThemeState } = useGetUserSettings("themeSettings", initialThemeState, false); +export const ProfileComponent = () => { + const { settings: themeState, mutate: setThemeState } = useGetUserSettings('themeSettings', initialThemeState, false); + const { settings: siteState, mutate: setSiteState } = useGetUserSettings('siteSettings', initialSiteState, false); const queryClient = useQueryClient(); const [localUserInfo, setLocalUserInfo] = useState({}); const [oktaToken] = useState(JSON.parse(localStorage.getItem('okta-token-storage'))); - const { authState, } = useOktaAuth(); + const { authState } = useOktaAuth(); const toast_topright = useRef(null); const personService = new PersonService(); const personSettingsService = new PersonSettingsService(); + const booleanTerms = useControlledVocabularyService('generic_boolean_terms'); let deleteLocalStorage = (result, success, key) => { - if(result.status !== 200) success = false; + if (result.status !== 200) success = false; localStorage.removeItem(key); - } + }; - const globalResetHandler = () =>{ + const globalResetHandler = () => { let success = true; - if(localUserInfo && localUserInfo.settings) { + if (localUserInfo && localUserInfo.settings) { for (let setting of localUserInfo.settings) { - personSettingsService.deleteUserSettings(setting.settingsKey).then((result) => deleteLocalStorage(result, success, setting.settingsKey)); + personSettingsService + .deleteUserSettings(setting.settingsKey) + .then((result) => deleteLocalStorage(result, success, setting.settingsKey)); } - if(success){ + if (success) { toast_topright.current.show([ - { life: 7000, severity: 'success', summary: 'Update success: ', - detail: "Application state has been reset", sticky: false } + { + life: 7000, + severity: 'success', + summary: 'Update success: ', + detail: 'Application state has been reset', + sticky: false, + }, ]); queryClient.invalidateQueries(['localUserInfo']); } else { toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', - detail: "An error has occured while trying to reset your application state", sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Update error: ', + detail: 'An error has occured while trying to reset your application state', + sticky: false, + }, ]); } } }; - + const resetTableState = (settingsKey) => { let success = true; - personSettingsService.deleteUserSettings(settingsKey).then((result) => deleteLocalStorage(result, success, settingsKey)); - if(success){ + personSettingsService + .deleteUserSettings(settingsKey) + .then((result) => deleteLocalStorage(result, success, settingsKey)); + if (success) { toast_topright.current.show([ - { life: 7000, severity: 'success', summary: 'Update success: ', - detail: "Table state has been reset", sticky: false } + { + life: 7000, + severity: 'success', + summary: 'Update success: ', + detail: 'Table state has been reset', + sticky: false, + }, ]); queryClient.invalidateQueries(['localUserInfo']); } else { toast_topright.current.show([ - { life: 7000, severity: 'error', summary: 'Update error: ', - detail: "An error has occured while trying to reset your table state", sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Update error: ', + detail: 'An error has occured while trying to reset your table state', + sticky: false, + }, ]); } }; - const themeResetHandler = () => { setThemeState(initialThemeState); window.location.reload(); }; const regenApiToken = () => { - personService.regenApiToken().then((data) => { - setLocalUserInfo(data); - }).catch((err) => { - console.log(err); - }); - } + personService + .regenApiToken() + .then((data) => { + setLocalUserInfo(data); + }) + .catch((err) => { + console.log(err); + }); + }; - useQuery(['localUserInfo'], - () => personService.getUserInfo(), { + useQuery(['localUserInfo'], () => personService.getUserInfo(), { onSuccess: (data) => { setLocalUserInfo(data); }, @@ -107,7 +139,7 @@ export const ProfileComponent = () => { }, keepPreviousData: true, refetchOnWindowFocus: false, - enabled: !!(authState?.isAuthenticated), + enabled: !!authState?.isAuthenticated, }); const valueTemplate = (props) => { @@ -115,34 +147,29 @@ export const ProfileComponent = () => { }; const textTemplate = (props) => { - return ( -

    { props.value }

    - ); + return

    {props.value}

    ; }; - const headerTemplate = (options, props) => { - const toggleIcon = options.collapsed ? 'pi pi-chevron-down' : 'pi pi-chevron-up'; - const className = `${options.className} justify-content-start`; - const titleClassName = `${options.titleClassName} pl-1`; - - return ( -
    - - - Expand - -
    - ) - }; + const toggleIcon = options.collapsed ? 'pi pi-chevron-down' : 'pi pi-chevron-up'; + const className = `${options.className} justify-content-start`; + const titleClassName = `${options.titleClassName} pl-1`; + + return ( +
    + + Expand +
    + ); + }; const jsonTemplate = (props) => { return ( - + ); }; @@ -151,7 +178,7 @@ export const ProfileComponent = () => { return ( <> - + { ); }; + const debugChange = (event) => { + let _siteState = { + ...siteState, + debug: event.value, + }; + setSiteState(_siteState); + }; + + const siteTemplate = (settings) => { + return ( +
    +
    + Debug:{' '} + +
    +
    + ); + }; + const userInfos = [ - { name: "Name", value: localUserInfo.firstName + " " + localUserInfo.lastName, template: textTemplate }, - { name: "Alliance Member", value: localUserInfo?.allianceMember?.fullName + " (" + localUserInfo?.allianceMember?.abbreviation + ")", template: textTemplate }, - { name: "Okta Email", value: localUserInfo.oktaEmail, template: textTemplate }, - { name: "Okta Access Token", value: oktaToken.accessToken.accessToken, template: textTemplate }, - { name: "Okta Id Token", value: oktaToken.idToken.idToken, template: textTemplate }, - { name: "Curation API Token", value: localUserInfo.apiToken, template: textTemplate }, - { name: "Okta Access Token Content", value: jose.decodeJwt(oktaToken.accessToken.accessToken), template: jsonTemplate }, - { name: "Okta Id Token Content", value: jose.decodeJwt(oktaToken.idToken.idToken), template: jsonTemplate }, - { name: "User Settings", value: localUserInfo.settings, template: jsonTemplate }, + { name: 'Name', value: localUserInfo.firstName + ' ' + localUserInfo.lastName, template: textTemplate }, + { + name: 'Alliance Member', + value: localUserInfo?.allianceMember?.fullName + ' (' + localUserInfo?.allianceMember?.abbreviation + ')', + template: textTemplate, + }, + { name: 'Okta Email', value: localUserInfo.oktaEmail, template: textTemplate }, + { name: 'Okta Access Token', value: oktaToken.accessToken.accessToken, template: textTemplate }, + { name: 'Okta Id Token', value: oktaToken.idToken.idToken, template: textTemplate }, + { name: 'Curation API Token', value: localUserInfo.apiToken, template: textTemplate }, + { + name: 'Okta Access Token Content', + value: jose.decodeJwt(oktaToken.accessToken.accessToken), + template: jsonTemplate, + }, + { name: 'Okta Id Token Content', value: jose.decodeJwt(oktaToken.idToken.idToken), template: jsonTemplate }, + { name: 'User Settings', value: localUserInfo.settings, template: jsonTemplate }, + { name: 'Site Settings', value: localUserInfo.settings, template: siteTemplate }, ]; - if(localUserInfo && localUserInfo.settings) { + if (localUserInfo && localUserInfo.settings) { for (let setting of localUserInfo.settings) { - if(setting.settingsKey === "themeSettings") continue; + if (setting.settingsKey === 'themeSettings') continue; + if (setting.settingsKey === 'siteSettings') continue; userInfos.push({ name: setting.settingsKey, value: setting.settingsMap, template: tableResetTemplate }); } } return ( <> - +
    - + diff --git a/src/main/cliapp/src/containers/profilePage/index.js b/src/main/cliapp/src/containers/profilePage/index.js index c6dd694d9..802f7add2 100644 --- a/src/main/cliapp/src/containers/profilePage/index.js +++ b/src/main/cliapp/src/containers/profilePage/index.js @@ -1,3 +1,3 @@ -import { ProfileComponent as ProfilePage } from "./ProfileComponent"; +import { ProfileComponent as ProfilePage } from './ProfileComponent'; export { ProfilePage }; diff --git a/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js b/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js index 4b2d4bf77..6af711f86 100644 --- a/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js +++ b/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js @@ -10,105 +10,108 @@ import { StringListTemplate } from '../../components/Templates/StringListTemplat import { NameTemplate } from '../../components/Templates/NameTemplate'; import { SearchService } from '../../service/SearchService'; - export const LiteratureReferenceTable = () => { + const [isInEditMode, setIsInEditMode] = useState(false); + const [errorMessages, setErrorMessages] = useState({}); - const [isInEditMode, setIsInEditMode] = useState(false); - const [errorMessages, setErrorMessages] = useState({}); + const [totalRecords, setTotalRecords] = useState(0); + const [literatureReferences, setLiteratureReferences] = useState([]); + const searchService = new SearchService(); - const [totalRecords, setTotalRecords] = useState(0); - const [literatureReferences, setLiteratureReferences] = useState([]); - const searchService = new SearchService(); + const toast_topleft = useRef(null); + const toast_topright = useRef(null); + const columns = [ + { + field: 'curie', + header: 'Curie', + sortable: { isInEditMode }, + filter: true, + filterConfig: FILTER_CONFIGS.curieFilterConfig, + }, + { + field: 'cross_references.curie', + header: 'Cross References', + sortable: true, + body: (rowData) => reference.curie)} />, + filter: true, + filterConfig: FILTER_CONFIGS.literatureCrossReferenceFilterConfig, + }, + { + field: 'title', + header: 'Title', + sortable: true, + filter: true, + body: (rowData) => , + filterConfig: FILTER_CONFIGS.titleFilterConfig, + }, + { + field: 'abstract', + header: 'Abstract', + sortable: true, + filter: true, + body: (rowData) => , + filterConfig: FILTER_CONFIGS.abstractFilterConfig, + }, + { + field: 'citation', + header: 'Citation', + sortable: true, + filter: true, + body: (rowData) => , + filterConfig: FILTER_CONFIGS.citationFilterConfig, + }, + { + field: 'short_citation', + header: 'Short Citation', + sortable: { isInEditMode }, + filter: true, + filterConfig: FILTER_CONFIGS.literatureShortCitationFilterConfig, + }, + ]; + const DEFAULT_COLUMN_WIDTH = 20; + const SEARCH_ENDPOINT = 'literature-reference'; - const toast_topleft = useRef(null); - const toast_topright = useRef(null); + const initialTableState = getDefaultTableState('LiteratureReferences', columns, DEFAULT_COLUMN_WIDTH); - const columns = [{ - field: "curie", - header: "Curie", - sortable: { isInEditMode }, - filter: true, - filterConfig: FILTER_CONFIGS.curieFilterConfig, - }, { - field: "cross_references.curie", - header: "Cross References", - sortable: true, - body: (rowData) => reference.curie)} - />, - filter: true, - filterConfig: FILTER_CONFIGS.literatureCrossReferenceFilterConfig, - }, { - field: "title", - header: "Title", - sortable: true, - filter: true, - body: (rowData) => , - filterConfig: FILTER_CONFIGS.titleFilterConfig, - }, { - field: "abstract", - header: "Abstract", - sortable: true, - filter: true, - body: (rowData) => , - filterConfig: FILTER_CONFIGS.abstractFilterConfig, - }, { - field: "citation", - header: "Citation", - sortable: true, - filter: true, - body: (rowData) => , - filterConfig: FILTER_CONFIGS.citationFilterConfig, - }, { - field: "short_citation", - header: "Short Citation", - sortable: { isInEditMode }, - filter: true, - filterConfig: FILTER_CONFIGS.literatureShortCitationFilterConfig, - } - ]; - const DEFAULT_COLUMN_WIDTH = 20; - const SEARCH_ENDPOINT = "literature-reference"; - - const initialTableState = getDefaultTableState("LiteratureReferences", columns, DEFAULT_COLUMN_WIDTH); - - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); - - const { isLoading, isFetching } = useGetTableData({ - tableState, - endpoint: SEARCH_ENDPOINT, - setIsInEditMode, - setEntities: setLiteratureReferences, - setTotalRecords, - toast_topleft, - searchService - }); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); - return ( - - - - - - ); + const { isLoading, isFetching } = useGetTableData({ + tableState, + endpoint: SEARCH_ENDPOINT, + setIsInEditMode, + setEntities: setLiteratureReferences, + setTotalRecords, + toast_topleft, + searchService, + }); -} + return ( + + + + + + ); +}; diff --git a/src/main/cliapp/src/containers/referencePage/Reference.js b/src/main/cliapp/src/containers/referencePage/Reference.js index b7681ce4b..ad92d555e 100644 --- a/src/main/cliapp/src/containers/referencePage/Reference.js +++ b/src/main/cliapp/src/containers/referencePage/Reference.js @@ -1,9 +1,7 @@ import React from 'react'; -import { LiteratureReferenceTable } from "./LiteratureReferenceTable"; +import { LiteratureReferenceTable } from './LiteratureReferenceTable'; export const Reference = () => { - return ( - - ); + return ; }; diff --git a/src/main/cliapp/src/containers/referencePage/__tests__/LiteratureTable.test.js b/src/main/cliapp/src/containers/referencePage/__tests__/LiteratureTable.test.js index 3d56a6907..2f55d1984 100644 --- a/src/main/cliapp/src/containers/referencePage/__tests__/LiteratureTable.test.js +++ b/src/main/cliapp/src/containers/referencePage/__tests__/LiteratureTable.test.js @@ -1,13 +1,18 @@ -import React from "react"; -import { waitFor } from "@testing-library/react"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; +import React from 'react'; +import { waitFor } from '@testing-library/react'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; import { renderWithClient } from '../../../tools/jest/utils'; -import { ReferencePage } from "../index"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData"; +import { ReferencePage } from '../index'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -15,30 +20,30 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); - + await waitFor(() => { expect(result); }); }); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Literature References Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("The table contains correct data", async () => { + it('The table contains correct data', async () => { let result = await renderWithClient(); const curieTd = await result.findByText(/AGRKB:101000000822386/i); const crossReferencesTd = await result.findByText(/MGI:62147/i); - const titleTd = await result.findByText("Typing of 27 polymorphic loci for 33 strains"); + const titleTd = await result.findByText('Typing of 27 polymorphic loci for 33 strains'); const abstractTd = await result.findByText(/Full text of MNL contribution/i); const citationTd = await result.findByText(/(1984)/i); - + await waitFor(() => { expect(curieTd).toBeInTheDocument(); expect(crossReferencesTd).toBeInTheDocument(); diff --git a/src/main/cliapp/src/containers/referencePage/index.js b/src/main/cliapp/src/containers/referencePage/index.js index 2bbfc865a..1b6c6aeae 100644 --- a/src/main/cliapp/src/containers/referencePage/index.js +++ b/src/main/cliapp/src/containers/referencePage/index.js @@ -1,3 +1,3 @@ -import { Reference as ReferencePage } from "./Reference"; +import { Reference as ReferencePage } from './Reference'; export { ReferencePage }; diff --git a/src/main/cliapp/src/containers/referencePage/mockData/mockData.js b/src/main/cliapp/src/containers/referencePage/mockData/mockData.js index 0b7ec7f5e..3e9abd03b 100644 --- a/src/main/cliapp/src/containers/referencePage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/referencePage/mockData/mockData.js @@ -1,16 +1,17 @@ export const data = { - "results": [ + results: [ { - "curie": "AGRKB:101000000822386", - "title": "Typing of 27 polymorphic loci for 33 strains", - "volume": "70", - "citation": "Nash HR, (1984) Typing of 27 polymorphic loci for 33 strains. 70 (): 86-7", - "cross_references": [ + curie: 'AGRKB:101000000822386', + title: 'Typing of 27 polymorphic loci for 33 strains', + volume: '70', + citation: 'Nash HR, (1984) Typing of 27 polymorphic loci for 33 strains. 70 (): 86-7', + cross_references: [ { - "curie": "MGI:62147" - } + curie: 'MGI:62147', + }, ], - "abstract": "Full text of MNL contribution: While our primary interest is the genetics of wild mice we have built up a considerable body of data on the biochemical variation in some inbred strains. Much of this information duplicates that available elsewhere, especially Staats, J. (1980) Cancer Res. 40:2083. However some of the information extends earlier listing and occasionally differs from it. For the sake of completeness the entire listing is given in the table attached. (Nash) Locus Chr: 1 1 2 3 4 4 4 5 7 7 7 7 7 7 7 8 8 8 8 8 9 9 9 10 11 14 17 I P S C P G A P G T P P X M H G E E E G P M T H E E P d e d a g p c g p a r r l o b r s s s o k o r k s s g h p h r m d o m i m t t d d b - - - - t - d f - - - k - - - - - - - - - - - - - - 1 1 11 2- 3 - 1 3 10 - 1 3 1 2 2 1 1 1 l>s< 1 4 5 1 2 2 1 2 STRAIN: A/J/Ola a b a b a b a a a a b b b b d a b a b b a a b a c a AISnOla a b a b a b a a a a b b b b d a b a b b a a b a c a AKR/Ola b b a a a b a a a c b b b b d a b a b b a b b a c b AU/SsJ b b a b a b a b b c b b b b p a b a b b a b a a c b a A2G/01a a b a b a c a b a a b b b b d b b a b b a a b a c a BALB/cOla a a a b a b a a a a b b d a b a b b a a b a a a BDP/J b c a a a b a b b b a b b a b a a a CBA/CaOla b b a a a b a b b c b b d a b a b b a b a a c b CBA/HnOla a b a b a a a a a a a a b b s a b a b b a a b a c b b CE/J a b a b a b a b b c 7 b b b d a b a b b a a b a c b b C3H/He Lac a b a b a b a b b c 7 b b b d a b a b b a a b a c b C3H/He Ola a b ' a b a b a b b c 7 b b b d a b a b b a a b a c b C3H/He-mg Ola a a a a a a a a b c b b b b s a a a b b a b b a a a a C57BL/Go C57BL/6 By a a a a a a a a b c b b b b s a a a b b a b b a a a a C57BL/6Ola a a a a a a a a b c b b b b s a a a b b a b b a a a C57BL/lOScSn/Ola a a a a a a a a b c b b b b s a a a b b a b b a a a C58/01a a a a a a a a a a c b b s a b a b b a b b a c a DBA/lOla b b a a a a 3 a b a b a c b b d a b a b b a a b a c b DBA/201a b b a b a b a b a b a c b b d a b a b b a b b a c b I/St Ola a b a b a b a b a b a c b b s a b a b b a b b a c b IS/Cam b b a a a a a b a a b d b b b a a b a b a c a NIH/Ola a b a b a b a a b c b b b b s b b a b a a b b a c a NZW/Ola b b a a a b a b a b b b d a b a b b a a b a c a P/J b c 4 a a a a a a b b d a b b b a b b a a a SEA/GnJ a a a a a a a a a 5 a b b b b d a b a b b a b 5 b a a a a SJL/Ola b b a b a b a b a b b b s b b a b b a a b a c b SM/J b c 4 a b b b a a b 5 a b b b a s a b a b b a a b a c b a ST/bJ a c a b a b c a a a b b b b d a b a b b a b b a b a b SWR/J a b a b a b a b b c b b b b s b a b a a a a c a a SWR/Ola a b a b a b a b b c b b b b s b b a b a a a b a c a 129/0la a b a a a a a a a a b b d a b a b b a a b a c b SPE/Pas<6> a b a m a m m a m m b c b s b m b a m b a b a Notes: 1) Same locus as Smg-1. Scored according to Otto J. and von Deimling, 0 (1981) Biochem. Genet. 19:431. 3) Contradicts CR-40 but this typing is correct, Staats and Roderick (pers. Com.) 4) Contradicts CR-40 but our animals are consistent in their phenotype, and after crossing. 5) Contradicts CR-40 but our animals are consistent. 6) Animals 13 generations inbred; 12 a t Institute Pasteur, 1 at UCL. All our animals derive from a single pair and phenotypes (m) above are consistent with a new homozygous electromorph; and see also Bonhomme et al, Biochem. Genet. (in press). 7) Diffuse activity only seen with as< 1 4 5 1 2 2 1 2 STRAIN: A/J/Ola a b a b a b a a a a b b b b d a b a b b a a b a c a AISnOla a b a b a b a a a a b b b b d a b a b b a a b a c a AKR/Ola b b a a a b a a a c b b b b d a b a b b a b b a c b AU/SsJ b b a b a b a b b c b b b b p a b a b b a b a a c b a A2G/01a a b a b a c a b a a b b b b d b b a b b a a b a c a BALB/cOla a a a b a b a a a a b b d a b a b b a a b a a a BDP/J b c a a a b a b b b a b b a b a a a CBA/CaOla b b a a a b a b b c b b d a b a b b a b a a c b CBA/HnOla a b a b a a a a a a a a b b s a b a b b a a b a c b b CE/J a b a b a b a b b c 7 b b b d a b a b b a a b a c b b C3H/He Lac a b a b a b a b b c 7 b b b d a b a b b a a b a c b C3H/He Ola a b ' a b a b a b b c 7 b b b d a b a b b a a b a c b C3H/He-mg Ola a a a a a a a a b c b b b b s a a a b b a b b a a a a C57BL/Go C57BL/6 By a a a a a a a a b c b b b b s a a a b b a b b a a a a C57BL/6Ola a a a a a a a a b c b b b b s a a a b b a b b a a a C57BL/lOScSn/Ola a a a a a a a a b c b b b b s a a a b b a b b a a a C58/01a a a a a a a a a a c b b s a b a b b a b b a c a DBA/lOla b b a a a a 3 a b a b a c b b d a b a b b a a b a c b DBA/201a b b a b a b a b a b a c b b d a b a b b a b b a c b I/St Ola a b a b a b a b a b a c b b s a b a b b a b b a c b IS/Cam b b a a a a a b a a b d b b b a a b a b a c a NIH/Ola a b a b a b a a b c b b b b s b b a b a a b b a c a NZW/Ola b b a a a b a b a b b b d a b a b b a a b a c a P/J b c 4 a a a a a a b b d a b b b a b b a a a SEA/GnJ a a a a a a a a a 5 a b b b b d a b a b b a b 5 b a a a a SJL/Ola b b a b a b a b a b b b s b b a b b a a b a c b SM/J b c 4 a b b b a a b 5 a b b b a s a b a b b a a b a c b a ST/bJ a c a b a b c a a a b b b b d a b a b b a b b a b a b SWR/J a b a b a b a b b c b b b b s b a b a a a a c a a SWR/Ola a b a b a b a b b c b b b b s b b a b a a a b a c a 129/0la a b a a a a a a a a b b d a b a b b a a b a c b SPE/Pas<6> a b a m a m m a m m b c b s b m b a m b a b a Notes: 1) Same locus as Smg-1. Scored according to Otto J. and von Deimling, 0 (1981) Biochem. Genet. 19:431. 3) Contradicts CR-40 but this typing is correct, Staats and Roderick (pers. Com.) 4) Contradicts CR-40 but our animals are consistent in their phenotype, and after crossing. 5) Contradicts CR-40 but our animals are consistent. 6) Animals 13 generations inbred; 12 a t Institute Pasteur, 1 at UCL. All our animals derive from a single pair and phenotypes (m) above are consistent with a new homozygous electromorph; and see also Bonhomme et al, Biochem. Genet. (in press). 7) Diffuse activity only seen with a const [expandedGroupRows, setExpandedGroupRows] = useState(null); const deleteGroup = (rowData) => { - getService().deleteGroup(rowData.id).then(() => { - queryClient.invalidateQueries('reporttable'); - }); + getService() + .deleteGroup(rowData.id) + .then(() => { + queryClient.invalidateQueries('reporttable'); + }); }; const groupActionBodyTemplate = (rowData) => { if (!rowData.curationReports || rowData.curationReports.length === 0) { - return (
    ); - }else { + } else { return null; - }; + } }; const reportActionBodyTemplate = (rowData) => { let buttons = []; - buttons.push(
    -
    -
    -
    -
    ); }; const scheduleActiveTemplate = (rowData) => { - return ( - <> - {rowData.scheduleActive ? "true" : "false"} - - ); + return <>{rowData.scheduleActive ? 'true' : 'false'}; }; - return ( -
    - - - - - } header="Status" /> - - - -
    - ); + return ( +
    + + + + + } header="Status" /> + + + +
    + ); }; diff --git a/src/main/cliapp/src/containers/reportsPage/ReportsComponent.js b/src/main/cliapp/src/containers/reportsPage/ReportsComponent.js index d9f2697ac..7015a8fbd 100644 --- a/src/main/cliapp/src/containers/reportsPage/ReportsComponent.js +++ b/src/main/cliapp/src/containers/reportsPage/ReportsComponent.js @@ -13,15 +13,13 @@ import { ReportTable } from './ReportTable'; import { TopButtons } from './TopButtons'; import { Toast } from 'primereact/toast'; - export const ReportsComponent = () => { - const reportReducer = (state, action) => { switch (action.type) { case 'EDIT': return { ...action.editReport }; case 'RESET': - return { name: "", cronSchedule: "" }; + return { name: '', cronSchedule: '' }; default: return { ...state, [action.field]: action.value }; } @@ -43,8 +41,7 @@ export const ReportsComponent = () => { let reportService = null; - useQuery(['reporttable'], - () => searchService.find('curationreportgroup', 100, 0, {}), { + useQuery(['reporttable'], () => searchService.find('curationreportgroup', 100, 0, {}), { onSuccess: (data) => { if (data.results) { for (let group of data.results) { @@ -58,7 +55,7 @@ export const ReportsComponent = () => { } }, keepPreviousData: true, - refetchOnWindowFocus: false + refetchOnWindowFocus: false, }); const getService = () => { @@ -66,17 +63,17 @@ export const ReportsComponent = () => { reportService = new ReportService(); } return reportService; - } + }; const reportTable = (group) => { return ( - @@ -86,7 +83,7 @@ export const ReportsComponent = () => { return (
    - { />

    Reports Table

    - + { groups={groups} reportService={reportService} /> - - + + />
    ); }; diff --git a/src/main/cliapp/src/containers/reportsPage/StatusTemplate.js b/src/main/cliapp/src/containers/reportsPage/StatusTemplate.js index 330d22ea9..8774ca2ac 100644 --- a/src/main/cliapp/src/containers/reportsPage/StatusTemplate.js +++ b/src/main/cliapp/src/containers/reportsPage/StatusTemplate.js @@ -2,16 +2,24 @@ import React from 'react'; import { Button } from 'primereact/button'; export const StatusTemplate = ({ rowData }) => { - let styleClass = 'p-button-text p-button-plain'; - if (rowData.curationReportStatus === 'FAILED') { styleClass = "p-button-danger"; } - if (rowData.status && ( - rowData.curationReportStatus.endsWith('STARTED') || + let styleClass = 'p-button-text p-button-plain'; + if (rowData.curationReportStatus === 'FAILED') { + styleClass = 'p-button-danger'; + } + if ( + rowData.status && + (rowData.curationReportStatus.endsWith('STARTED') || rowData.curationReportStatus.endsWith('RUNNING') || - rowData.curationReportStatus.endsWith('PENDING') - )) { styleClass = "p-button-success"; } - - return ( -
    - ) -} + ); +}; diff --git a/src/main/cliapp/src/containers/speciesPage/index.js b/src/main/cliapp/src/containers/speciesPage/index.js index 1f8da3542..d183abac0 100644 --- a/src/main/cliapp/src/containers/speciesPage/index.js +++ b/src/main/cliapp/src/containers/speciesPage/index.js @@ -1,3 +1,3 @@ -import SpeciesPage from "./SpeciesPage"; +import SpeciesPage from './SpeciesPage'; export { SpeciesPage }; diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsPage.js b/src/main/cliapp/src/containers/variantsPage/VariantsPage.js index dfaad6899..433545b06 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsPage.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { VariantsTable } from './VariantsTable'; function VariantsPage() { - return ( - - ); + return ; } -export default VariantsPage; \ No newline at end of file +export default VariantsPage; diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index 2e6b5f86b..143b1e4a3 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -26,12 +26,11 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; export const VariantsTable = () => { - const [isInEditMode, setIsInEditMode] = useState(false); const [errorMessages, setErrorMessages] = useState({}); const errorMessagesRef = useRef(); errorMessagesRef.current = errorMessages; - + const [totalRecords, setTotalRecords] = useState(0); const [variants, setVariants] = useState([]); @@ -50,7 +49,7 @@ export const VariantsTable = () => { let variantService = new VariantService(); - const mutation = useMutation(updatedVariant => { + const mutation = useMutation((updatedVariant) => { if (!variantService) { variantService = new VariantService(); } @@ -63,40 +62,54 @@ export const VariantsTable = () => { if (rowData?.taxon) { return ( <> - + {rowData.taxon.name} ({rowData.taxon.curie}) - + ); } - } + }; const sourceGeneralConsequenceTemplate = (rowData) => { if (rowData?.sourceGeneralConsequence) { return ( <> - + {rowData.sourceGeneralConsequence?.name} ({rowData.sourceGeneralConsequence?.curie}) - + ); } - } + }; const variantTypeTemplate = (rowData) => { if (rowData?.variantType) { return ( <> - + {rowData.variantType?.name} ({rowData.variantType?.curie}) - + ); } - } + }; const onVariantStatusEditorValueChange = (props, event) => { let updatedVariants = [...props.props.value]; @@ -113,18 +126,18 @@ export const VariantsTable = () => { props={props} showClear={true} /> - + ); }; const handleRelatedNotesOpen = (event, rowData, isInEdit) => { let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = rowData.relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = isInEdit; + _relatedNotesData['originalRelatedNotes'] = rowData.relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = isInEdit; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; @@ -133,26 +146,28 @@ export const VariantsTable = () => { const { rowIndex } = rowProps; const index = rowIndex % rows; let _relatedNotesData = {}; - _relatedNotesData["originalRelatedNotes"] = rowProps.rowData.relatedNotes; - _relatedNotesData["dialog"] = true; - _relatedNotesData["isInEdit"] = isInEdit; - _relatedNotesData["rowIndex"] = index; - _relatedNotesData["mainRowProps"] = rowProps; + _relatedNotesData['originalRelatedNotes'] = rowProps.rowData.relatedNotes; + _relatedNotesData['dialog'] = true; + _relatedNotesData['isInEdit'] = isInEdit; + _relatedNotesData['rowIndex'] = index; + _relatedNotesData['mainRowProps'] = rowProps; setRelatedNotesData(() => ({ - ..._relatedNotesData + ..._relatedNotesData, })); }; const relatedNotesTemplate = (rowData) => { if (rowData?.relatedNotes) { return ( - - ) + ); } }; @@ -160,167 +175,187 @@ export const VariantsTable = () => { if (props?.rowData?.relatedNotes) { return ( <> -
    - -
    - +
    + +
    + - ) + ); } else { return ( <>
    -
    - + - ) + ); } }; - const columns = [ { - field: "curie", - header: "Curie", + field: 'curie', + header: 'Curie', sortable: { isInEditMode }, filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { - field: "modEntityId", - header: "MOD Entity ID", - sortable: true, + field: 'modEntityId', + header: 'MOD Entity ID', + sortable: true, filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { - field: "modInternalId", - header: "MOD Internal ID", - sortable: true, + field: 'modInternalId', + header: 'MOD Internal ID', + sortable: true, filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { - field: "taxon.name", - header: "Taxon", + field: 'taxon.name', + header: 'Taxon', body: taxonTemplate, sortable: true, filterConfig: FILTER_CONFIGS.taxonFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "variantType.name", - header: "Variant Type", + field: 'variantType.name', + header: 'Variant Type', body: variantTypeTemplate, sortable: true, filterConfig: FILTER_CONFIGS.variantTypeFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "variantStatus.name", - header: "Variant Status", + field: 'variantStatus.name', + header: 'Variant Status', sortable: true, filterConfig: FILTER_CONFIGS.variantStatusFilterConfig, - editor: (props) => variantStatusEditor(props) + editor: (props) => variantStatusEditor(props), }, { - field: "relatedNotes.freeText", - header: "Related Notes", + field: 'relatedNotes.freeText', + header: 'Related Notes', body: relatedNotesTemplate, sortable: true, filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, - editor: relatedNotesEditor + editor: relatedNotesEditor, }, { - field: "sourceGeneralConsequence.name", - header: "Source General Consequence", + field: 'sourceGeneralConsequence.name', + header: 'Source General Consequence', body: sourceGeneralConsequenceTemplate, sortable: true, filterConfig: FILTER_CONFIGS.sourceGeneralConsequenceFilterConfig, - editor: (props) => + editor: (props) => , }, { - field: "dataProvider.sourceOrganization.abbreviation", - header: "Data Provider", + field: 'dataProvider.sourceOrganization.abbreviation', + header: 'Data Provider', sortable: true, filterConfig: FILTER_CONFIGS.variantDataProviderFilterConfig, }, { - field: "crossReferences.displayName", - header: "Cross References", + field: 'crossReferences.displayName', + header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => + body: (rowData) => , }, { - field: "updatedBy.uniqueId", - header: "Updated By", + field: 'updatedBy.uniqueId', + header: 'Updated By', sortable: true, filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { - field: "dateUpdated", - header: "Date Updated", + field: 'dateUpdated', + header: 'Date Updated', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig + filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { - field: "createdBy.uniqueId", - header: "Created By", + field: 'createdBy.uniqueId', + header: 'Created By', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.createdByFilterConfig + filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { - field: "dateCreated", - header: "Date Created", + field: 'dateCreated', + header: 'Date Created', sortable: true, filter: true, - filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig + filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { - field: "internal", - header: "Internal", + field: 'internal', + header: 'Internal', body: internalTemplate, filter: true, filterConfig: FILTER_CONFIGS.internalFilterConfig, sortable: true, editor: (props) => ( - - ) + + ), }, { - field: "obsolete", - header: "Obsolete", + field: 'obsolete', + header: 'Obsolete', body: obsoleteTemplate, filter: true, filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, sortable: true, editor: (props) => ( - - ) - } + + ), + }, ]; const DEFAULT_COLUMN_WIDTH = 10; - const SEARCH_ENDPOINT = "variant"; + const SEARCH_ENDPOINT = 'variant'; - const initialTableState = getDefaultTableState("Variants", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('Variants', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isFetching, isLoading } = useGetTableData({ tableState, @@ -329,7 +364,7 @@ export const VariantsTable = () => { setEntities: setVariants, setTotalRecords, toast_topleft, - searchService + searchService, }); return ( @@ -353,8 +388,8 @@ export const VariantsTable = () => { mutation={mutation} isInEditMode={isInEditMode} setIsInEditMode={setIsInEditMode} - toasts={{toast_topleft, toast_topright }} - errorObject = {{errorMessages, setErrorMessages}} + toasts={{ toast_topleft, toast_topright }} + errorObject={{ errorMessages, setErrorMessages }} defaultColumnWidth={DEFAULT_COLUMN_WIDTH} fetching={isFetching || isLoading} /> @@ -364,7 +399,7 @@ export const VariantsTable = () => { setOriginalRelatedNotesData={setRelatedNotesData} errorMessagesMainRow={errorMessages} setErrorMessagesMainRow={setErrorMessages} - noteTypeVocabularyTermSet='variant_note_type' + noteTypeVocabularyTermSet="variant_note_type" /> ); diff --git a/src/main/cliapp/src/containers/variantsPage/__tests__/VariantsTable.test.js b/src/main/cliapp/src/containers/variantsPage/__tests__/VariantsTable.test.js index 2fe01e339..988866a5a 100644 --- a/src/main/cliapp/src/containers/variantsPage/__tests__/VariantsTable.test.js +++ b/src/main/cliapp/src/containers/variantsPage/__tests__/VariantsTable.test.js @@ -1,14 +1,19 @@ -import React from "react"; -import { BrowserRouter } from "react-router-dom/cjs/react-router-dom"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { VariantsTable } from "../VariantsTable"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData.js"; +import { VariantsTable } from '../VariantsTable'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData.js'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -16,24 +21,35 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { - let result = await renderWithClient(); - + it('Renders without crashing', async () => { + let result = await renderWithClient( + + + + ); + await waitFor(() => { expect(result); }); - }); - it("Contains Correct Table Name", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Name', async () => { + let result = await renderWithClient( + + + + ); const tableTitle = await result.findByText(/Variants Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("Contains Correct Table Data", async () => { - let result = await renderWithClient(); + it('Contains Correct Table Data', async () => { + let result = await renderWithClient( + + + + ); const curieTd = await result.findByText(/WB:WBVarTest0002/i); const taxonTd = await result.findByText(/Caenorhabditis elegans/i); @@ -57,4 +73,4 @@ describe("", () => { expect(sourceGeneralConsequenceTd).toBeInTheDocument(); }); }); -}); \ No newline at end of file +}); diff --git a/src/main/cliapp/src/containers/variantsPage/index.js b/src/main/cliapp/src/containers/variantsPage/index.js index 80d0bfe76..18355741d 100644 --- a/src/main/cliapp/src/containers/variantsPage/index.js +++ b/src/main/cliapp/src/containers/variantsPage/index.js @@ -1,3 +1,3 @@ -import VariantsPage from "./VariantsPage"; +import VariantsPage from './VariantsPage'; -export { VariantsPage }; \ No newline at end of file +export { VariantsPage }; diff --git a/src/main/cliapp/src/containers/variantsPage/mockData/mockData.js b/src/main/cliapp/src/containers/variantsPage/mockData/mockData.js index 0e41bd790..9fcf27951 100644 --- a/src/main/cliapp/src/containers/variantsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/variantsPage/mockData/mockData.js @@ -1,272 +1,272 @@ - export const data = { - "results": [ - { - "type": "Variant", - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:35:18.190972+01:00", - "dbDateUpdated": "2023-10-12T13:35:18.190991+01:00", - "id": 135134336, - "uniqueId": "VARIANTTEST:Person0001" - }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:35:18.245745+01:00", - "dbDateUpdated": "2023-10-12T13:35:18.245759+01:00", - "id": 135134337, - "uniqueId": "VARIANTTEST:Person0002" - }, - "dateCreated": "2022-03-09T22:10:12Z", - "dateUpdated": "2022-03-10T22:10:12Z", - "internal": true, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.837428+01:00", - "dbDateUpdated": "2023-10-12T13:43:19.34603+01:00", - "curie": "WB:WBVarTest0002", - "taxon": { - "internal": false, - "obsolete": false, - "curie": "NCBITaxon:6239", - "name": "Caenorhabditis elegans" - }, - "dataProvider": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.79796+01:00", - "dbDateUpdated": "2023-10-12T13:36:42.797972+01:00", - "id": 135134369, - "sourceOrganization": { - "internal": false, - "obsolete": false, - "id": 20308683, - "uniqueId": "WB", - "abbreviation": "WB", - "fullName": "WormBase", - "homepageResourceDescriptorPage": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-02-20T09:26:39.609757Z", - "dbDateUpdated": "2023-08-27T22:00:03.833696+01:00", - "id": 41750788, - "name": "homepage", - "urlTemplate": "https://www.wormbase.org/" - } - } - }, - "variantType": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-02-19T22:00:17.970568Z", - "curie": "SO:0000694", - "name": "SNP", - "namespace": "sequence", - "definition": "SNPs are single base pair positions in genomic DNA at which different sequence alternatives exist in normal individuals in some population(s), wherein the least frequent variant has an abundance of 1% or greater." - }, - "variantStatus": { - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-07T09:16:24.627371+01:00", - "dbDateUpdated": "2023-09-07T09:16:24.627423+01:00", - "id": 133503891, - "uniqueId": "Local|Dev User|test@alliancegenome.org", - "firstName": "Local", - "lastName": "Dev User" - }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-07T09:16:24.627371+01:00", - "dbDateUpdated": "2023-09-07T09:16:24.627423+01:00", - "id": 133503891, - "uniqueId": "Local|Dev User|test@alliancegenome.org", - "firstName": "Local", - "lastName": "Dev User" - }, - "dateCreated": "2023-10-12T13:22:16.592841+01:00", - "dateUpdated": "2023-10-12T13:22:16.603352+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:22:16.613471+01:00", - "dbDateUpdated": "2023-10-12T13:22:16.613484+01:00", - "id": 135134309, - "name": "dead" - }, - "sourceGeneralConsequence": { - "internal": false, - "obsolete": false, - "dbDateUpdated": "2023-02-19T22:00:13.701218Z", - "curie": "SO:1000008", - "name": "point_mutation", - "namespace": "sequence", - "definition": "A single nucleotide change which has occurred at the same position of a corresponding nucleotide in a reference sequence." - }, - "relatedNotes": [ - { - "createdBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:35:18.190972+01:00", - "dbDateUpdated": "2023-10-12T13:35:18.190991+01:00", - "id": 135134336, - "uniqueId": "VARIANTTEST:Person0001" - }, - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:35:18.245745+01:00", - "dbDateUpdated": "2023-10-12T13:35:18.245759+01:00", - "id": 135134337, - "uniqueId": "VARIANTTEST:Person0002" - }, - "dateCreated": "2022-03-09T22:10:12Z", - "dateUpdated": "2022-03-10T22:10:12Z", - "internal": false, - "obsolete": true, - "dbDateCreated": "2023-10-12T18:19:09.279238+01:00", - "dbDateUpdated": "2023-10-12T18:19:09.279251+01:00", - "id": 135134459, - "freeText": "Test note 2", - "noteType": { - "internal": false, - "obsolete": false, - "id": 88139193, - "name": "comment", - "definition": "general comment" - }, - "references": [ - { - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-07T09:16:24.627371+01:00", - "dbDateUpdated": "2023-09-07T09:16:24.627423+01:00", - "id": 133503891, - "uniqueId": "Local|Dev User|test@alliancegenome.org", - "firstName": "Local", - "lastName": "Dev User" - }, - "dateUpdated": "2023-10-12T14:12:55.123893+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.627017+01:00", - "dbDateUpdated": "2023-10-12T14:12:55.125203+01:00", - "curie": "AGRKB:101000000394981", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.62545+01:00", - "dbDateUpdated": "2023-10-12T13:36:42.625465+01:00", - "id": 135134366, - "referencedCurie": "PMID:29874341", - "displayName": "PMID:29874341" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.608326+01:00", - "dbDateUpdated": "2023-10-12T13:36:42.608342+01:00", - "id": 135134365, - "referencedCurie": "PMCID:PMC5877110", - "displayName": "PMCID:PMC5877110" - } - ], - "shortCitation": " (2018) Int J Clin Exp Pathol 11(3):1837" - }, - { - "updatedBy": { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-09-07T09:16:24.627371+01:00", - "dbDateUpdated": "2023-09-07T09:16:24.627423+01:00", - "id": 133503891, - "uniqueId": "Local|Dev User|test@alliancegenome.org", - "firstName": "Local", - "lastName": "Dev User" - }, - "dateUpdated": "2023-10-12T14:12:55.131206+01:00", - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.448927+01:00", - "dbDateUpdated": "2023-10-12T14:12:55.14434+01:00", - "curie": "AGRKB:101000000392843", - "crossReferences": [ - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.447767+01:00", - "dbDateUpdated": "2023-10-12T13:36:42.447777+01:00", - "id": 135134364, - "referencedCurie": "PMID:26330574", - "displayName": "PMID:26330574" - }, - { - "internal": false, - "obsolete": false, - "dbDateCreated": "2023-10-12T13:36:42.427509+01:00", - "dbDateUpdated": "2023-10-12T13:36:42.42752+01:00", - "id": 135134363, - "referencedCurie": "PMCID:PMC4561500", - "displayName": "PMCID:PMC4561500" - } - ], - "shortCitation": " (2015) Genome Res 25(9):1410.2" - } - ] - } - ] - } - ], - "totalResults": 1, - "returnedRecords": 1 -} - + results: [ + { + type: 'Variant', + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:35:18.190972+01:00', + dbDateUpdated: '2023-10-12T13:35:18.190991+01:00', + id: 135134336, + uniqueId: 'VARIANTTEST:Person0001', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:35:18.245745+01:00', + dbDateUpdated: '2023-10-12T13:35:18.245759+01:00', + id: 135134337, + uniqueId: 'VARIANTTEST:Person0002', + }, + dateCreated: '2022-03-09T22:10:12Z', + dateUpdated: '2022-03-10T22:10:12Z', + internal: true, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.837428+01:00', + dbDateUpdated: '2023-10-12T13:43:19.34603+01:00', + curie: 'WB:WBVarTest0002', + taxon: { + internal: false, + obsolete: false, + curie: 'NCBITaxon:6239', + name: 'Caenorhabditis elegans', + }, + dataProvider: { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.79796+01:00', + dbDateUpdated: '2023-10-12T13:36:42.797972+01:00', + id: 135134369, + sourceOrganization: { + internal: false, + obsolete: false, + id: 20308683, + uniqueId: 'WB', + abbreviation: 'WB', + fullName: 'WormBase', + homepageResourceDescriptorPage: { + internal: false, + obsolete: false, + dbDateCreated: '2023-02-20T09:26:39.609757Z', + dbDateUpdated: '2023-08-27T22:00:03.833696+01:00', + id: 41750788, + name: 'homepage', + urlTemplate: 'https://www.wormbase.org/', + }, + }, + }, + variantType: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-02-19T22:00:17.970568Z', + curie: 'SO:0000694', + name: 'SNP', + namespace: 'sequence', + definition: + 'SNPs are single base pair positions in genomic DNA at which different sequence alternatives exist in normal individuals in some population(s), wherein the least frequent variant has an abundance of 1% or greater.', + }, + variantStatus: { + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-07T09:16:24.627371+01:00', + dbDateUpdated: '2023-09-07T09:16:24.627423+01:00', + id: 133503891, + uniqueId: 'Local|Dev User|test@alliancegenome.org', + firstName: 'Local', + lastName: 'Dev User', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-07T09:16:24.627371+01:00', + dbDateUpdated: '2023-09-07T09:16:24.627423+01:00', + id: 133503891, + uniqueId: 'Local|Dev User|test@alliancegenome.org', + firstName: 'Local', + lastName: 'Dev User', + }, + dateCreated: '2023-10-12T13:22:16.592841+01:00', + dateUpdated: '2023-10-12T13:22:16.603352+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:22:16.613471+01:00', + dbDateUpdated: '2023-10-12T13:22:16.613484+01:00', + id: 135134309, + name: 'dead', + }, + sourceGeneralConsequence: { + internal: false, + obsolete: false, + dbDateUpdated: '2023-02-19T22:00:13.701218Z', + curie: 'SO:1000008', + name: 'point_mutation', + namespace: 'sequence', + definition: + 'A single nucleotide change which has occurred at the same position of a corresponding nucleotide in a reference sequence.', + }, + relatedNotes: [ + { + createdBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:35:18.190972+01:00', + dbDateUpdated: '2023-10-12T13:35:18.190991+01:00', + id: 135134336, + uniqueId: 'VARIANTTEST:Person0001', + }, + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:35:18.245745+01:00', + dbDateUpdated: '2023-10-12T13:35:18.245759+01:00', + id: 135134337, + uniqueId: 'VARIANTTEST:Person0002', + }, + dateCreated: '2022-03-09T22:10:12Z', + dateUpdated: '2022-03-10T22:10:12Z', + internal: false, + obsolete: true, + dbDateCreated: '2023-10-12T18:19:09.279238+01:00', + dbDateUpdated: '2023-10-12T18:19:09.279251+01:00', + id: 135134459, + freeText: 'Test note 2', + noteType: { + internal: false, + obsolete: false, + id: 88139193, + name: 'comment', + definition: 'general comment', + }, + references: [ + { + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-07T09:16:24.627371+01:00', + dbDateUpdated: '2023-09-07T09:16:24.627423+01:00', + id: 133503891, + uniqueId: 'Local|Dev User|test@alliancegenome.org', + firstName: 'Local', + lastName: 'Dev User', + }, + dateUpdated: '2023-10-12T14:12:55.123893+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.627017+01:00', + dbDateUpdated: '2023-10-12T14:12:55.125203+01:00', + curie: 'AGRKB:101000000394981', + crossReferences: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.62545+01:00', + dbDateUpdated: '2023-10-12T13:36:42.625465+01:00', + id: 135134366, + referencedCurie: 'PMID:29874341', + displayName: 'PMID:29874341', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.608326+01:00', + dbDateUpdated: '2023-10-12T13:36:42.608342+01:00', + id: 135134365, + referencedCurie: 'PMCID:PMC5877110', + displayName: 'PMCID:PMC5877110', + }, + ], + shortCitation: ' (2018) Int J Clin Exp Pathol 11(3):1837', + }, + { + updatedBy: { + internal: false, + obsolete: false, + dbDateCreated: '2023-09-07T09:16:24.627371+01:00', + dbDateUpdated: '2023-09-07T09:16:24.627423+01:00', + id: 133503891, + uniqueId: 'Local|Dev User|test@alliancegenome.org', + firstName: 'Local', + lastName: 'Dev User', + }, + dateUpdated: '2023-10-12T14:12:55.131206+01:00', + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.448927+01:00', + dbDateUpdated: '2023-10-12T14:12:55.14434+01:00', + curie: 'AGRKB:101000000392843', + crossReferences: [ + { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.447767+01:00', + dbDateUpdated: '2023-10-12T13:36:42.447777+01:00', + id: 135134364, + referencedCurie: 'PMID:26330574', + displayName: 'PMID:26330574', + }, + { + internal: false, + obsolete: false, + dbDateCreated: '2023-10-12T13:36:42.427509+01:00', + dbDateUpdated: '2023-10-12T13:36:42.42752+01:00', + id: 135134363, + referencedCurie: 'PMCID:PMC4561500', + displayName: 'PMCID:PMC4561500', + }, + ], + shortCitation: ' (2015) Genome Res 25(9):1410.2', + }, + ], + }, + ], + }, + ], + totalResults: 1, + returnedRecords: 1, +}; export const mockSettingsData = { - "page": 0, - "first": 0, - "rows": 50, - "multiSortMeta": [], - "selectedColumnNames": [ - "Curie", - "Taxon", - "Variant Type", - "Variant Status", - "Related Notes", - "Source General Consequence", - "Data Provider", - "Updated By", - "Date Updated", - "Created By", - "Date Created", - "Internal", - "Obsolete" - ], - "filters": {}, - "tableKeyName": "Variants", - "tableSettingsKeyName": "VariantsTableSettings" + page: 0, + first: 0, + rows: 50, + multiSortMeta: [], + selectedColumnNames: [ + 'Curie', + 'Taxon', + 'Variant Type', + 'Variant Status', + 'Related Notes', + 'Source General Consequence', + 'Data Provider', + 'Updated By', + 'Date Updated', + 'Created By', + 'Date Created', + 'Internal', + 'Obsolete', + ], + filters: {}, + tableKeyName: 'Variants', + tableSettingsKeyName: 'VariantsTableSettings', }; export const termData = { - "generic_boolean_terms": { - "id": 23323, - "name": "generic_boolean_terms", - "displayName": "generic_boolean_terms", - "terms": [ - { - id: 213423, - name: true, - text: "true" - }, { - id: 3428828, - name: false, - text: "false" - } - ] - } + generic_boolean_terms: { + id: 23323, + name: 'generic_boolean_terms', + displayName: 'generic_boolean_terms', + terms: [ + { + id: 213423, + name: true, + text: 'true', + }, + { + id: 3428828, + name: false, + text: 'false', + }, + ], + }, }; - diff --git a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesPage.js b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesPage.js index d48d56b6f..98ad934eb 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesPage.js +++ b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { VocabulariesTable } from './VocabulariesTable'; function VocabulariesPage() { - return ( - - ); + return ; } export default VocabulariesPage; diff --git a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js index e23bc30b8..4d53b5142 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js +++ b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js @@ -3,24 +3,23 @@ import { useMutation } from '@tanstack/react-query'; import { Toast } from 'primereact/toast'; import { Button } from 'primereact/button'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; -import { VocabularyService } from "../../service/VocabularyService"; -import { useControlledVocabularyService } from "../../service/useControlledVocabularyService"; +import { VocabularyService } from '../../service/VocabularyService'; +import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { GenericDataTable } from '../../components/GenericDataTable/GenericDataTable'; -import { NewVocabularyForm } from "../../containers/controlledVocabularyPage/NewVocabularyForm"; +import { NewVocabularyForm } from '../../containers/controlledVocabularyPage/NewVocabularyForm'; import { EllipsisTableCell } from '../../components/EllipsisTableCell'; -import { ErrorMessageComponent } from "../../components/Error/ErrorMessageComponent"; +import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; import { Tooltip } from 'primereact/tooltip'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; -import { InputTextEditor } from "../../components/InputTextEditor"; -import { TrueFalseDropdown } from "../../components/TrueFalseDropDownSelector"; +import { InputTextEditor } from '../../components/InputTextEditor'; +import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; import { setNewEntity } from '../../utils/utils'; export const VocabulariesTable = () => { - const [isInEditMode, setIsInEditMode] = useState(false); const [totalRecords, setTotalRecords] = useState(0); const [errorMessages, setErrorMessages] = useState({}); @@ -39,7 +38,7 @@ export const VocabulariesTable = () => { let vocabularyService = new VocabularyService(); - const mutation = useMutation(updatedVocabulary => { + const mutation = useMutation((updatedVocabulary) => { if (!vocabularyService) { vocabularyService = new VocabularyService(); } @@ -50,7 +49,11 @@ export const VocabulariesTable = () => { return ( <> {rowData[field]} - + ); }; @@ -58,10 +61,7 @@ export const VocabulariesTable = () => { const stringEditor = (props, field) => { return ( <> - + ); @@ -74,9 +74,9 @@ export const VocabulariesTable = () => { options={obsoleteTerms} editorChange={onObsoleteEditorValueChange} props={props} - field={"obsolete"} + field={'obsolete'} /> - + ); }; @@ -90,44 +90,47 @@ export const VocabulariesTable = () => { const columns = [ { - field: "name", - header: "Name", + field: 'name', + header: 'Name', sortable: true, - body: (rowData) => stringBodyTemplate(rowData, "name"), + body: (rowData) => stringBodyTemplate(rowData, 'name'), filterConfig: FILTER_CONFIGS.nameFilterConfig, - editor: (props) => stringEditor(props, "name") + editor: (props) => stringEditor(props, 'name'), }, { - field: "vocabularyDescription", - header: "Description", + field: 'vocabularyDescription', + header: 'Description', sortable: true, - body: (rowData) => stringBodyTemplate(rowData, "vocabularyDescription"), + body: (rowData) => stringBodyTemplate(rowData, 'vocabularyDescription'), filterConfig: FILTER_CONFIGS.vocabularyDescriptionFilterConfig, - editor: (props) => stringEditor(props, "vocabularyDescription") + editor: (props) => stringEditor(props, 'vocabularyDescription'), }, { - field: "obsolete", - header: "Obsolete", + field: 'obsolete', + header: 'Obsolete', sortable: true, body: (rowData) => , filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, - editor: (props) => obsoleteEditorTemplate(props) + editor: (props) => obsoleteEditorTemplate(props), }, { - field: "vocabularyLabel", - header: "Label", + field: 'vocabularyLabel', + header: 'Label', sortable: true, filterConfig: FILTER_CONFIGS.vocabularyLabelFilterConfig, - body: (rowData) => stringBodyTemplate(rowData, "vocabularyLabel") - } + body: (rowData) => stringBodyTemplate(rowData, 'vocabularyLabel'), + }, ]; const DEFAULT_COLUMN_WIDTH = 20; - const SEARCH_ENDPOINT = "vocabulary"; + const SEARCH_ENDPOINT = 'vocabulary'; - const initialTableState = getDefaultTableState("Vocabularies", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('Vocabularies', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isLoading, isFetching } = useGetTableData({ tableState, @@ -136,17 +139,18 @@ export const VocabulariesTable = () => { setEntities: setVocabularies, setTotalRecords, toast_topleft, - searchService + searchService, }); const handleOpenNewVocabulary = () => { setNewVocabularyDialog(true); }; - const headerButtons = (disabled=false) => { + const headerButtons = (disabled = false) => { return ( <> -
    ); - }; diff --git a/src/main/cliapp/src/containers/vocabularyPage/__tests__/VocabulariesTable.test.js b/src/main/cliapp/src/containers/vocabularyPage/__tests__/VocabulariesTable.test.js index 207abe9bb..50db1a208 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/__tests__/VocabulariesTable.test.js +++ b/src/main/cliapp/src/containers/vocabularyPage/__tests__/VocabulariesTable.test.js @@ -1,13 +1,18 @@ -import React from "react"; -import { waitFor } from "@testing-library/react"; +import React from 'react'; +import { waitFor } from '@testing-library/react'; import { renderWithClient } from '../../../tools/jest/utils'; -import { VocabulariesPage } from "../index"; -import { setLocalStorage } from "../../../tools/jest/setupTests"; -import { setupSettingsHandler, setupFindHandler, setupSearchHandler, setupSaveSettingsHandler } from "../../../tools/jest/commonMswhandlers"; -import { data } from "../mockData/mockData"; +import { VocabulariesPage } from '../index'; +import { setLocalStorage } from '../../../tools/jest/setupTests'; +import { + setupSettingsHandler, + setupFindHandler, + setupSearchHandler, + setupSaveSettingsHandler, +} from '../../../tools/jest/commonMswhandlers'; +import { data } from '../mockData/mockData'; import 'core-js/features/structured-clone'; -describe("", () => { +describe('', () => { beforeEach(() => { setupFindHandler(); setupSettingsHandler(); @@ -15,7 +20,7 @@ describe("", () => { setupSearchHandler(data); }); - it("Renders without crashing", async () => { + it('Renders without crashing', async () => { let result = await renderWithClient(); await waitFor(() => { @@ -23,14 +28,14 @@ describe("", () => { }); }); - it("Contains Correct Table Name", async () => { + it('Contains Correct Table Name', async () => { let result = await renderWithClient(); const tableTitle = await result.findByText(/Vocabularies Table/i); expect(tableTitle).toBeInTheDocument(); }); - it("The table contains correct data", async () => { + it('The table contains correct data', async () => { let result = await renderWithClient(); const nameTd = await result.findByText(/Name type/i); diff --git a/src/main/cliapp/src/containers/vocabularyPage/index.js b/src/main/cliapp/src/containers/vocabularyPage/index.js index 38c539470..0e044a7bd 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/index.js +++ b/src/main/cliapp/src/containers/vocabularyPage/index.js @@ -1,3 +1,3 @@ -import VocabulariesPage from "./VocabulariesPage"; +import VocabulariesPage from './VocabulariesPage'; export { VocabulariesPage }; diff --git a/src/main/cliapp/src/containers/vocabularyPage/mockData/mockData.js b/src/main/cliapp/src/containers/vocabularyPage/mockData/mockData.js index 000a8303c..5198cb448 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/vocabularyPage/mockData/mockData.js @@ -1,13 +1,13 @@ export const data = { - "results": [ + results: [ { - "internal": false, - "obsolete": false, - "id": 20308688, - "name": "Name type", - "vocabularyDescription": "Type of name represented by a name annotation" - } + internal: false, + obsolete: false, + id: 20308688, + name: 'Name type', + vocabularyDescription: 'Type of name represented by a name annotation', + }, ], - "returnedRecords": 1, - "totalResults": 1 -}; \ No newline at end of file + returnedRecords: 1, + totalResults: 1, +}; diff --git a/src/main/cliapp/src/containers/vocabularyTermSetPage/NewVocabularyTermSetForm.js b/src/main/cliapp/src/containers/vocabularyTermSetPage/NewVocabularyTermSetForm.js index e0bd0e83e..673bc9831 100644 --- a/src/main/cliapp/src/containers/vocabularyTermSetPage/NewVocabularyTermSetForm.js +++ b/src/main/cliapp/src/containers/vocabularyTermSetPage/NewVocabularyTermSetForm.js @@ -1,18 +1,17 @@ -import React, { useRef } from "react"; -import { VocabularyTermSetService } from "../../service/VocabularyTermSetService"; -import { Dialog } from "primereact/dialog"; -import { Button } from "primereact/button"; -import { InputText } from "primereact/inputtext"; -import { Toast } from "primereact/toast"; +import React, { useRef } from 'react'; +import { VocabularyTermSetService } from '../../service/VocabularyTermSetService'; +import { Dialog } from 'primereact/dialog'; +import { Button } from 'primereact/button'; +import { InputText } from 'primereact/inputtext'; +import { Toast } from 'primereact/toast'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { VocabTermAutocompleteTemplate } from '../../components/Autocomplete/VocabTermAutocompleteTemplate'; -import { FormErrorMessageComponent } from "../../components/Error/FormErrorMessageComponent"; -import { classNames } from "primereact/utils"; -import { AutocompleteMultiEditor } from "../../components/Autocomplete/AutocompleteMultiEditor"; -import { AutocompleteEditor } from "../../components/Autocomplete/AutocompleteEditor"; -import { autocompleteSearch, buildAutocompleteFilter } from "../../utils/utils"; -import ErrorBoundary from "../../components/Error/ErrorBoundary"; - +import { FormErrorMessageComponent } from '../../components/Error/FormErrorMessageComponent'; +import { classNames } from 'primereact/utils'; +import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; +import { AutocompleteEditor } from '../../components/Autocomplete/AutocompleteEditor'; +import { autocompleteSearch, buildAutocompleteFilter } from '../../utils/utils'; +import ErrorBoundary from '../../components/Error/ErrorBoundary'; export const NewVocabularyTermSetForm = ({ newVocabularyTermSetState, @@ -26,12 +25,11 @@ export const NewVocabularyTermSetForm = ({ const { newVocabularyTermSet, errorMessages, submitted, newVocabularyTermSetDialog } = newVocabularyTermSetState; const queryClient = useQueryClient(); - const hideDialog = () => { - newVocabularyTermSetDispatch({ type: "RESET" }); + newVocabularyTermSetDispatch({ type: 'RESET' }); }; - const mutation = useMutation(newVocabularyTermSet => { + const mutation = useMutation((newVocabularyTermSet) => { if (!vocabularyTermSetService) { vocabularyTermSetService = new VocabularyTermSetService(); } @@ -40,50 +38,63 @@ export const NewVocabularyTermSetForm = ({ const handleSubmit = (event) => { event.preventDefault(); - newVocabularyTermSetDispatch({ type: "SUBMIT" }); + newVocabularyTermSetDispatch({ type: 'SUBMIT' }); mutation.mutate(newVocabularyTermSet, { onSuccess: (data) => { setNewVocabularyTermSet(data.data.entity, queryClient); - toast_success.current.show({ severity: 'success', summary: 'Successful', detail: 'New Vocabulary Term Set Added' }); - newVocabularyTermSetDispatch({ type: "RESET" }); + toast_success.current.show({ + severity: 'success', + summary: 'Successful', + detail: 'New Vocabulary Term Set Added', + }); + newVocabularyTermSetDispatch({ type: 'RESET' }); }, onError: (error) => { toast_error.current.show([ - { life: 7000, severity: 'error', summary: 'Page error: ', detail: error.response.data.errorMessage, sticky: false } + { + life: 7000, + severity: 'error', + summary: 'Page error: ', + detail: error.response.data.errorMessage, + sticky: false, + }, ]); - newVocabularyTermSetDispatch({ type: "UPDATE_ERROR_MESSAGES", errorMessages: error.response.data.errorMessages }); - } + newVocabularyTermSetDispatch({ + type: 'UPDATE_ERROR_MESSAGES', + errorMessages: error.response.data.errorMessages, + }); + }, }); }; const onNameChange = (event) => { newVocabularyTermSetDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onLabelChange = (event) => { newVocabularyTermSetDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; const onVocabularyChange = (event, setFieldValue) => { setFieldValue(event.target.value); newVocabularyTermSetDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, value: event.value, }); }; const vocabularySearch = (event, setFiltered, setQuery) => { - const autocompleteFields = ["name"]; - const endpoint = "vocabulary"; - const filterName = "vocabularyFilter"; + const autocompleteFields = ['name']; + const endpoint = 'vocabulary'; + const filterName = 'vocabularyFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); @@ -93,23 +104,23 @@ export const NewVocabularyTermSetForm = ({ const onMemberTermsChange = (event, setFieldValue) => { setFieldValue(event.value); newVocabularyTermSetDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.value + value: event.value, }); }; const memberTermSearch = (event, setFiltered, setInputValue, props) => { - const autocompleteFields = ["name"]; - const endpoint = "vocabularyterm"; - const filterName = "memberTermsFilter"; + const autocompleteFields = ['name']; + const endpoint = 'vocabularyterm'; + const filterName = 'memberTermsFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { vocabularyFilter: { - "vocabulary.name": { - queryString: newVocabularyTermSet?.vocabularyTermSetVocabulary?.name - } - } + 'vocabulary.name': { + queryString: newVocabularyTermSet?.vocabularyTermSetVocabulary?.name, + }, + }, }; setInputValue(event.query); @@ -118,9 +129,9 @@ export const NewVocabularyTermSetForm = ({ const onDescriptionChange = (event) => { newVocabularyTermSetDispatch({ - type: "EDIT", + type: 'EDIT', field: event.target.name, - value: event.target.value + value: event.target.value, }); }; @@ -142,12 +153,22 @@ export const NewVocabularyTermSetForm = ({
    - + -
    +
    - + - +
    - + - +
    - + - } + valueDisplay={(item, setAutocompleteSelectedItem, op, query) => ( + + )} /> - +
    @@ -195,29 +226,34 @@ export const NewVocabularyTermSetForm = ({ value={newVocabularyTermSet.vocabularyTermSetDescription} onChange={onDescriptionChange} /> - +
    - } + valueDisplay={(item, setAutocompleteSelectedItem, op, query) => ( + + )} classNames={classNames({ 'p-invalid': submitted && errorMessages?.memberTerms })} /> - +
    - ); }; diff --git a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetPage.js b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetPage.js index 9ac99ee19..d30e2608f 100644 --- a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetPage.js +++ b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetPage.js @@ -2,9 +2,7 @@ import React from 'react'; import { VocabularyTermSetTable } from './VocabularyTermSetTable'; export function VocabularyTermSetPage() { - return ( - - ); + return ; } export default VocabularyTermSetPage; diff --git a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js index 14f4abd83..739b7cc3e 100644 --- a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js +++ b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js @@ -1,21 +1,27 @@ -import React, {useRef, useState } from 'react'; +import React, { useRef, useState } from 'react'; import { useMutation } from '@tanstack/react-query'; import { Toast } from 'primereact/toast'; import { SearchService } from '../../service/SearchService'; import { Messages } from 'primereact/messages'; -import { ErrorMessageComponent } from "../../components/Error/ErrorMessageComponent"; -import { EllipsisTableCell } from "../../components/EllipsisTableCell"; -import { ListTableCell } from "../../components/ListTableCell"; +import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; +import { EllipsisTableCell } from '../../components/EllipsisTableCell'; +import { ListTableCell } from '../../components/ListTableCell'; import { Button } from 'primereact/button'; -import { VocabularyTermSetService } from "../../service/VocabularyTermSetService"; +import { VocabularyTermSetService } from '../../service/VocabularyTermSetService'; import { VocabTermAutocompleteTemplate } from '../../components/Autocomplete/VocabTermAutocompleteTemplate'; import { NewVocabularyTermSetForm } from './NewVocabularyTermSetForm'; import { useNewVocabularyTermSetReducer } from './useNewVocabularyTermSetReducer'; -import { InputTextEditor } from "../../components/InputTextEditor"; +import { InputTextEditor } from '../../components/InputTextEditor'; import { GenericDataTable } from '../../components/GenericDataTable/GenericDataTable'; -import {AutocompleteEditor} from "../../components/Autocomplete/AutocompleteEditor"; -import {autocompleteSearch, buildAutocompleteFilter, defaultAutocompleteOnChange, multipleAutocompleteOnChange, setNewEntity} from "../../utils/utils"; -import {AutocompleteMultiEditor} from "../../components/Autocomplete/AutocompleteMultiEditor"; +import { AutocompleteEditor } from '../../components/Autocomplete/AutocompleteEditor'; +import { + autocompleteSearch, + buildAutocompleteFilter, + defaultAutocompleteOnChange, + multipleAutocompleteOnChange, + setNewEntity, +} from '../../utils/utils'; +import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { Tooltip } from 'primereact/tooltip'; @@ -23,7 +29,6 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; export const VocabularyTermSetTable = () => { - const [isInEditMode, setIsInEditMode] = useState(false); const [totalRecords, setTotalRecords] = useState(0); const { newVocabularyTermSetState, newVocabularyTermSetDispatch } = useNewVocabularyTermSetReducer(); @@ -40,7 +45,7 @@ export const VocabularyTermSetTable = () => { let vocabularyTermSetService = new VocabularyTermSetService(); - const mutation = useMutation(updatedVocabularyTermSet => { + const mutation = useMutation((updatedVocabularyTermSet) => { if (!vocabularyTermSetService) { vocabularyTermSetService = new VocabularyTermSetService(); } @@ -48,32 +53,27 @@ export const VocabularyTermSetTable = () => { }); const handleNewVocabularyTermSetOpen = () => { - newVocabularyTermSetDispatch({type: "OPEN_DIALOG"}) + newVocabularyTermSetDispatch({ type: 'OPEN_DIALOG' }); }; - const vocabularyTemplate = (rowData) => { if (rowData.vocabularyTermSetVocabulary) { - return ( - - {rowData.vocabularyTermSetVocabulary.name} - - ); + return {rowData.vocabularyTermSetVocabulary.name}; } }; const onVocabularyChange = (event, setFieldValue, props) => { - defaultAutocompleteOnChange(props, event, "vocabularyTermSetVocabulary", setFieldValue, "name"); - } + defaultAutocompleteOnChange(props, event, 'vocabularyTermSetVocabulary', setFieldValue, 'name'); + }; const vocabularySearch = (event, setFiltered, setQuery) => { - const autocompleteFields =["name"]; - const endpoint="vocabulary"; - const filterName="vocabularyFilter"; + const autocompleteFields = ['name']; + const endpoint = 'vocabulary'; + const filterName = 'vocabularyFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); - } + }; const vocabularyEditorTemplate = (props) => { return ( @@ -82,15 +82,21 @@ export const VocabularyTermSetTable = () => { search={vocabularySearch} initialValue={props.rowData.vocabularyTermSetVocabulary?.name} rowProps={props} - fieldName='vocabularyTermSetVocabulary' - subField={"name"} - valueDisplay={(item, setAutocompleteSelectedItem, op, query) => - } + fieldName="vocabularyTermSetVocabulary" + subField={'name'} + valueDisplay={(item, setAutocompleteSelectedItem, op, query) => ( + + )} onValueChangeHandler={onVocabularyChange} /> ); @@ -99,59 +105,58 @@ export const VocabularyTermSetTable = () => { const memberTermsTemplate = (rowData) => { if (rowData.memberTerms) { const listTemplate = (memberTerm) => { - return ( - - {memberTerm.name} - - ); + return {memberTerm.name}; }; return ( <> - + ); } }; const onMemberTermsChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, "memberTerms", setFieldValue); + multipleAutocompleteOnChange(props, event, 'memberTerms', setFieldValue); }; const memberTermSearch = (event, setFiltered, setInputValue, props) => { - const autocompleteFields =["name"]; - const endpoint = "vocabularyterm"; - const filterName = "memberTermsFilter"; + const autocompleteFields = ['name']; + const endpoint = 'vocabularyterm'; + const filterName = 'memberTermsFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); const otherFilters = { vocabularyFilter: { - "vocabulary.name": { - queryString: props.props.value[props.rowIndex].vocabularyTermSetVocabulary.name - } - } - } + 'vocabulary.name': { + queryString: props.props.value[props.rowIndex].vocabularyTermSetVocabulary.name, + }, + }, + }; setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); - } + }; const memberTermsEditorTemplate = (props) => { return ( <> - } - /> - ( + + )} /> + ); }; @@ -159,11 +164,8 @@ export const VocabularyTermSetTable = () => { const nameEditor = (props) => { return ( <> - - + + ); }; @@ -171,11 +173,11 @@ export const VocabularyTermSetTable = () => { const descriptionEditor = (props) => { return ( <> - + - ); }; @@ -184,58 +186,65 @@ export const VocabularyTermSetTable = () => { return ( <> {rowData[field]} - + - ) - } + ); + }; const columns = [ { - field: "name", - header: "Name", - body: (rowData) => stringBodyTemplate(rowData, "name"), + field: 'name', + header: 'Name', + body: (rowData) => stringBodyTemplate(rowData, 'name'), sortable: true, filterConfig: FILTER_CONFIGS.nameFilterConfig, - editor: (props) => nameEditor(props) + editor: (props) => nameEditor(props), }, { - field: "vocabularyTermSetVocabulary.name", - header: "Vocabulary", + field: 'vocabularyTermSetVocabulary.name', + header: 'Vocabulary', sortable: true, body: (rowData) => vocabularyTemplate(rowData), filterConfig: FILTER_CONFIGS.vocabularyFieldSetFilterConfig, - editor: (props) => vocabularyEditorTemplate(props) + editor: (props) => vocabularyEditorTemplate(props), }, { - field: "memberTerms.name", - header: "Member Terms", + field: 'memberTerms.name', + header: 'Member Terms', sortable: true, body: memberTermsTemplate, filterConfig: FILTER_CONFIGS.vocabularyMemberTermsFilterConfig, - editor: (props) => memberTermsEditorTemplate(props) + editor: (props) => memberTermsEditorTemplate(props), }, { - field: "vocabularyTermSetDescription", - header: "Description", - body: (rowData) => stringBodyTemplate(rowData, "vocabularyTermSetDescription"), + field: 'vocabularyTermSetDescription', + header: 'Description', + body: (rowData) => stringBodyTemplate(rowData, 'vocabularyTermSetDescription'), sortable: true, filterConfig: FILTER_CONFIGS.vocabularyTermSetDescriptionFilterConfig, - editor: (props) => descriptionEditor(props) + editor: (props) => descriptionEditor(props), }, { - field: "vocabularyLabel", - header: "Label", + field: 'vocabularyLabel', + header: 'Label', filterConfig: FILTER_CONFIGS.vocabularyLabelFilterConfig, - body: (rowData) => stringBodyTemplate(rowData, "vocabularyLabel") - } + body: (rowData) => stringBodyTemplate(rowData, 'vocabularyLabel'), + }, ]; const DEFAULT_COLUMN_WIDTH = 15; - const SEARCH_ENDPOINT = "vocabularytermset"; + const SEARCH_ENDPOINT = 'vocabularytermset'; - const initialTableState = getDefaultTableState("VocabularyTermSets", columns, DEFAULT_COLUMN_WIDTH); + const initialTableState = getDefaultTableState('VocabularyTermSets', columns, DEFAULT_COLUMN_WIDTH); - const { settings: tableState, mutate: setTableState } = useGetUserSettings(initialTableState.tableSettingsKeyName, initialTableState); + const { settings: tableState, mutate: setTableState } = useGetUserSettings( + initialTableState.tableSettingsKeyName, + initialTableState + ); const { isLoading, isFetching } = useGetTableData({ tableState, @@ -244,22 +253,28 @@ export const VocabularyTermSetTable = () => { setEntities: setTermSets, setTotalRecords, toast_topleft, - searchService + searchService, }); - const headerButtons = (disabled=false) => { + const headerButtons = (disabled = false) => { return ( <> -