diff --git a/src/main/cliapp/src/containers/dashboardPage/__tests__/dashboardPage.test.js b/src/main/cliapp/src/containers/dashboardPage/__tests__/dashboardPage.test.js
index 61be6f52a..f421923e2 100644
--- a/src/main/cliapp/src/containers/dashboardPage/__tests__/dashboardPage.test.js
+++ b/src/main/cliapp/src/containers/dashboardPage/__tests__/dashboardPage.test.js
@@ -1,17 +1,17 @@
-import React from "react";
+import React from 'react';
import { renderWithClient } from '../../../tools/jest/utils';
-import { DashboardPage } from "../index";
-import "../../../tools/jest/setupTests";
+import { DashboardPage } from '../index';
+import '../../../tools/jest/setupTests';
-describe("
", () => {
- it("Renders without crashing", async () => {
+describe('
', () => {
+ it('Renders without crashing', async () => {
let result = await renderWithClient(
);
await expect(result);
});
- it("Contains the Table Headers", async () => {
+ it('Contains the Table Headers', async () => {
let result = await renderWithClient(
);
-
+
const entities = await result.getByText(/Entities/i);
const ontologies = await result.getByText(/Ontologies/i);
const system = await result.getByText(/System/i);
diff --git a/src/main/cliapp/src/containers/dashboardPage/index.js b/src/main/cliapp/src/containers/dashboardPage/index.js
index f1fdd0332..6a7492e5a 100644
--- a/src/main/cliapp/src/containers/dashboardPage/index.js
+++ b/src/main/cliapp/src/containers/dashboardPage/index.js
@@ -1,3 +1,3 @@
-import { Dashboard as DashboardPage } from "./Dashboard";
+import { Dashboard as DashboardPage } from './Dashboard';
-export { DashboardPage };
\ No newline at end of file
+export { DashboardPage };
diff --git a/src/main/cliapp/src/containers/dashboardPage/mockData/mockData.js b/src/main/cliapp/src/containers/dashboardPage/mockData/mockData.js
index 2dd7b38ac..93d5ea897 100644
--- a/src/main/cliapp/src/containers/dashboardPage/mockData/mockData.js
+++ b/src/main/cliapp/src/containers/dashboardPage/mockData/mockData.js
@@ -1,95 +1,93 @@
export const data = {
- "entity": {
- "MATerm": { "esCount": 3230, "dbCount": 3230 },
- "FBDVTerm": { "esCount": 207, "dbCount": 207 },
- "Vocabulary": { "esCount": 16, "dbCount": 16 },
- "StageTerm": { "esCount": 0, "dbCount": 1248 },
- "GeneSynonymSlotAnnotation": { "esCount": 0, "dbCount": 466888 },
- "OntologyTerm": { "esCount": 0, "dbCount": 319426 },
- "CurationReportGroup": { "esCount": 0, "dbCount": 0 },
- "GeneSystematicNameSlotAnnotation": { "esCount": 0, "dbCount": 239244 },
- "BulkFMSLoad": { "esCount": 0, "dbCount": 1 },
- "Gene": { "esCount": 390204, "dbCount": 390204 },
- "SlotAnnotation": { "esCount": 0, "dbCount": 6833725 },
- "XSMOTerm": { "esCount": 326, "dbCount": 326 },
- "GeneFullNameSlotAnnotation": { "esCount": 0, "dbCount": 679927 },
- "DOTerm": { "esCount": 13678, "dbCount": 13678 },
- "ECOTerm": { "esCount": 1975, "dbCount": 1975 },
- "ConditionRelation": { "esCount": 1776, "dbCount": 1776 },
- "WBBTTerm": { "esCount": 7190, "dbCount": 7190 },
- "BulkLoad": { "esCount": 0, "dbCount": 51 },
- "CurationReport": { "esCount": 0, "dbCount": 0 },
- "ROTerm": { "esCount": 0, "dbCount": 0 },
- "AGMDiseaseAnnotation": { "esCount": 11403, "dbCount": 11403 },
- "XCOTerm": { "esCount": 961, "dbCount": 961 },
- "BulkManualLoad": { "esCount": 0, "dbCount": 26 },
- "AlleleMutationTypeSlotAnnotation": { "esCount": 0, "dbCount": 1 },
- "NameSlotAnnotation": { "esCount": 0, "dbCount": 6828355 },
- "ZFSTerm": { "esCount": 54, "dbCount": 54 },
- "BulkScheduledLoad": { "esCount": 0, "dbCount": 25 },
- "Molecule": { "esCount": 3748, "dbCount": 3748 },
- "ResourceDescriptorPage": { "esCount": 183, "dbCount": 183 },
- "EMAPATerm": { "esCount": 8021, "dbCount": 8021 },
- "VocabularyTerm": { "esCount": 197, "dbCount": 197 },
- "Note": { "esCount": 0, "dbCount": 22622 },
- "ChemicalTerm": { "esCount": 0, "dbCount": 167823 },
- "OBITerm": { "esCount": 3881, "dbCount": 3881 },
- "Synonym": { "esCount": 0, "dbCount": 2185913 },
- "CurationReportHistory": { "esCount": 0, "dbCount": 0 },
- "Person": { "esCount": 0, "dbCount": 53 },
- "ZFATerm": { "esCount": 3144, "dbCount": 3144 },
- "GenomicEntity": { "esCount": 0, "dbCount": 3518820 },
- "BulkLoadGroup": { "esCount": 0, "dbCount": 7 },
- "BulkLoadFileException": { "esCount": 0, "dbCount": 946632 },
- "Organization": { "esCount": 10, "dbCount": 10 },
- "CHEBITerm": { "esCount": 163749, "dbCount": 163749 },
- "BiologicalEntity": { "esCount": 0, "dbCount": 3518820 },
- "AlleleInheritanceModeSlotAnnotation": { "esCount": 0, "dbCount": 5368 },
- "XBSTerm": { "esCount": 97, "dbCount": 97 },
- "BulkLoadFileHistory": { "esCount": 0, "dbCount": 221 },
- "XPOTerm": { "esCount": 21059, "dbCount": 21059 },
- "SOTerm": { "esCount": 2597, "dbCount": 2597 },
- "GeneDiseaseAnnotation": { "esCount": 37242, "dbCount": 37242 },
- "DataProvider": { "esCount": 0, "dbCount": 57 },
- "VocabularyTermSet": { "esCount": 6, "dbCount": 6 },
- "ATPTerm": { "esCount": 135, "dbCount": 135 },
- "ExperimentalCondition": { "esCount": 481, "dbCount": 481 },
- "Association": { "esCount": 0, "dbCount": 60602 },
- "WBLSTerm": { "esCount": 777, "dbCount": 777 },
- "PhenotypeTerm": { "esCount": 0, "dbCount": 35211 },
- "BulkURLLoad": { "esCount": 0, "dbCount": 24 },
- "AlleleFullNameSlotAnnotation": { "esCount": 0, "dbCount": 1197176 },
- "AlleleSecondaryIdSlotAnnotation": { "esCount": 0, "dbCount": 1 },
- "LoggedInPerson": { "esCount": 0, "dbCount": 37 },
- "NCBITaxonTerm": { "esCount": 895, "dbCount": 895 },
- "AlleleSymbolSlotAnnotation": { "esCount": 0, "dbCount": 3002462 },
- "MPTerm": { "esCount": 14151, "dbCount": 14151 },
- "XBATerm": { "esCount": 1677, "dbCount": 1677 },
- "GOTerm": { "esCount": 47564, "dbCount": 47564 },
- "MMUSDVTerm": { "esCount": 113, "dbCount": 113 },
- "InformationContentEntity": { "esCount": 0, "dbCount": 311077 },
- "AnatomicalTerm": { "esCount": 0, "dbCount": 43102 },
- "ExperimentalConditionOntologyTerm": { "esCount": 0, "dbCount": 1122 },
- "Reference": { "esCount": 956237, "dbCount": 311077 },
- "GeneSymbolSlotAnnotation": { "esCount": 0, "dbCount": 797524 },
- "AlleleDiseaseAnnotation": { "esCount": 11956, "dbCount": 11956 },
- "BulkLoadFile": { "esCount": 0, "dbCount": 252 },
- "DAOTerm": { "esCount": 19840, "dbCount": 19840 },
- "ZECOTerm": { "esCount": 161, "dbCount": 161 },
- "Allele": { "esCount": 2932029, "dbCount": 2932029 },
- "XBEDTerm": { "esCount": 195, "dbCount": 195 },
- "AllianceMember": { "esCount": 0, "dbCount": 8 },
- "DiseaseAnnotation": { "esCount": 0, "dbCount": 60601 },
- "AffectedGenomicModel": { "esCount": 196587, "dbCount": 196587 },
- "CrossReference": { "esCount": 0, "dbCount": 1052011 },
- "AlleleSynonymSlotAnnotation": { "esCount": 0, "dbCount": 0 },
- "PersonSetting": { "esCount": 0, "dbCount": 85 },
- "ResourceDescriptor": { "esCount": 68, "dbCount": 68 }
- }
-}
+ entity: {
+ MATerm: { esCount: 3230, dbCount: 3230 },
+ FBDVTerm: { esCount: 207, dbCount: 207 },
+ Vocabulary: { esCount: 16, dbCount: 16 },
+ StageTerm: { esCount: 0, dbCount: 1248 },
+ GeneSynonymSlotAnnotation: { esCount: 0, dbCount: 466888 },
+ OntologyTerm: { esCount: 0, dbCount: 319426 },
+ CurationReportGroup: { esCount: 0, dbCount: 0 },
+ GeneSystematicNameSlotAnnotation: { esCount: 0, dbCount: 239244 },
+ BulkFMSLoad: { esCount: 0, dbCount: 1 },
+ Gene: { esCount: 390204, dbCount: 390204 },
+ SlotAnnotation: { esCount: 0, dbCount: 6833725 },
+ XSMOTerm: { esCount: 326, dbCount: 326 },
+ GeneFullNameSlotAnnotation: { esCount: 0, dbCount: 679927 },
+ DOTerm: { esCount: 13678, dbCount: 13678 },
+ ECOTerm: { esCount: 1975, dbCount: 1975 },
+ ConditionRelation: { esCount: 1776, dbCount: 1776 },
+ WBBTTerm: { esCount: 7190, dbCount: 7190 },
+ BulkLoad: { esCount: 0, dbCount: 51 },
+ CurationReport: { esCount: 0, dbCount: 0 },
+ ROTerm: { esCount: 0, dbCount: 0 },
+ AGMDiseaseAnnotation: { esCount: 11403, dbCount: 11403 },
+ XCOTerm: { esCount: 961, dbCount: 961 },
+ BulkManualLoad: { esCount: 0, dbCount: 26 },
+ AlleleMutationTypeSlotAnnotation: { esCount: 0, dbCount: 1 },
+ NameSlotAnnotation: { esCount: 0, dbCount: 6828355 },
+ ZFSTerm: { esCount: 54, dbCount: 54 },
+ BulkScheduledLoad: { esCount: 0, dbCount: 25 },
+ Molecule: { esCount: 3748, dbCount: 3748 },
+ ResourceDescriptorPage: { esCount: 183, dbCount: 183 },
+ EMAPATerm: { esCount: 8021, dbCount: 8021 },
+ VocabularyTerm: { esCount: 197, dbCount: 197 },
+ Note: { esCount: 0, dbCount: 22622 },
+ ChemicalTerm: { esCount: 0, dbCount: 167823 },
+ OBITerm: { esCount: 3881, dbCount: 3881 },
+ Synonym: { esCount: 0, dbCount: 2185913 },
+ CurationReportHistory: { esCount: 0, dbCount: 0 },
+ Person: { esCount: 0, dbCount: 53 },
+ ZFATerm: { esCount: 3144, dbCount: 3144 },
+ GenomicEntity: { esCount: 0, dbCount: 3518820 },
+ BulkLoadGroup: { esCount: 0, dbCount: 7 },
+ BulkLoadFileException: { esCount: 0, dbCount: 946632 },
+ Organization: { esCount: 10, dbCount: 10 },
+ CHEBITerm: { esCount: 163749, dbCount: 163749 },
+ BiologicalEntity: { esCount: 0, dbCount: 3518820 },
+ AlleleInheritanceModeSlotAnnotation: { esCount: 0, dbCount: 5368 },
+ XBSTerm: { esCount: 97, dbCount: 97 },
+ BulkLoadFileHistory: { esCount: 0, dbCount: 221 },
+ XPOTerm: { esCount: 21059, dbCount: 21059 },
+ SOTerm: { esCount: 2597, dbCount: 2597 },
+ GeneDiseaseAnnotation: { esCount: 37242, dbCount: 37242 },
+ DataProvider: { esCount: 0, dbCount: 57 },
+ VocabularyTermSet: { esCount: 6, dbCount: 6 },
+ ATPTerm: { esCount: 135, dbCount: 135 },
+ ExperimentalCondition: { esCount: 481, dbCount: 481 },
+ Association: { esCount: 0, dbCount: 60602 },
+ WBLSTerm: { esCount: 777, dbCount: 777 },
+ PhenotypeTerm: { esCount: 0, dbCount: 35211 },
+ BulkURLLoad: { esCount: 0, dbCount: 24 },
+ AlleleFullNameSlotAnnotation: { esCount: 0, dbCount: 1197176 },
+ AlleleSecondaryIdSlotAnnotation: { esCount: 0, dbCount: 1 },
+ LoggedInPerson: { esCount: 0, dbCount: 37 },
+ NCBITaxonTerm: { esCount: 895, dbCount: 895 },
+ AlleleSymbolSlotAnnotation: { esCount: 0, dbCount: 3002462 },
+ MPTerm: { esCount: 14151, dbCount: 14151 },
+ XBATerm: { esCount: 1677, dbCount: 1677 },
+ GOTerm: { esCount: 47564, dbCount: 47564 },
+ MMUSDVTerm: { esCount: 113, dbCount: 113 },
+ InformationContentEntity: { esCount: 0, dbCount: 311077 },
+ AnatomicalTerm: { esCount: 0, dbCount: 43102 },
+ ExperimentalConditionOntologyTerm: { esCount: 0, dbCount: 1122 },
+ Reference: { esCount: 956237, dbCount: 311077 },
+ GeneSymbolSlotAnnotation: { esCount: 0, dbCount: 797524 },
+ AlleleDiseaseAnnotation: { esCount: 11956, dbCount: 11956 },
+ BulkLoadFile: { esCount: 0, dbCount: 252 },
+ DAOTerm: { esCount: 19840, dbCount: 19840 },
+ ZECOTerm: { esCount: 161, dbCount: 161 },
+ Allele: { esCount: 2932029, dbCount: 2932029 },
+ XBEDTerm: { esCount: 195, dbCount: 195 },
+ AllianceMember: { esCount: 0, dbCount: 8 },
+ DiseaseAnnotation: { esCount: 0, dbCount: 60601 },
+ AffectedGenomicModel: { esCount: 196587, dbCount: 196587 },
+ CrossReference: { esCount: 0, dbCount: 1052011 },
+ AlleleSynonymSlotAnnotation: { esCount: 0, dbCount: 0 },
+ PersonSetting: { esCount: 0, dbCount: 85 },
+ ResourceDescriptor: { esCount: 68, dbCount: 68 },
+ },
+};
export const settings = {
- "filters": {}
-}
-
-
+ filters: {},
+};
diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js
index 54e8dfd26..360ec99b7 100644
--- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js
+++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js
@@ -3,7 +3,7 @@ import { useQuery } from '@tanstack/react-query';
import { DataTable } from 'primereact/datatable';
import { Column } from 'primereact/column';
import { FileUpload } from 'primereact/fileupload';
-import { Toast } from "primereact/toast";
+import { Toast } from 'primereact/toast';
import { Dialog } from 'primereact/dialog';
import { ProgressBar } from 'primereact/progressbar';
@@ -18,10 +18,9 @@ import { NewBulkLoadGroupForm } from './NewBulkLoadGroupForm';
import { HistoryDialog } from './HistoryDialog';
import { useQueryClient } from '@tanstack/react-query';
import { SiteContext } from '../layout/SiteContext';
-import { LoadingOverlay } from "../../components/LoadingOverlay";
+import { LoadingOverlay } from '../../components/LoadingOverlay';
export const DataLoadsComponent = () => {
-
const { authState } = useOktaAuth();
const bulkLoadReducer = (state, action) => {
@@ -29,18 +28,18 @@ export const DataLoadsComponent = () => {
case 'EDIT':
return { ...action.editBulkLoad };
case 'RESET':
- return { name: "" };
+ return { name: '' };
default:
return { ...state, [action.field]: action.value };
}
};
const { apiVersion } = useContext(SiteContext);
- const [isLoading,setIsLoading] = useState(false);
+ const [isLoading, setIsLoading] = useState(false);
const [groups, setGroups] = useState({});
const [errorLoads, setErrorLoads] = useState([]);
const [runningLoads, setRunningLoads] = useState({});
- const [history, setHistory] = useState({id: 0});
+ const [history, setHistory] = useState({ id: 0 });
const [bulkLoadGroupDialog, setBulkLoadGroupDialog] = useState(false);
const [historyDialog, setHistoryDialog] = useState(false);
const [bulkLoadDialog, setBulkLoadDialog] = useState(false);
@@ -68,29 +67,39 @@ export const DataLoadsComponent = () => {
};
const handleNewBulkLoadOpen = (event) => {
- bulkLoadDispatch({ type: "RESET" });
+ bulkLoadDispatch({ type: 'RESET' });
setBulkLoadDialog(true);
};
const loadTypeClasses = new Map([
- ["FULL_INGEST", ["GeneDiseaseAnnotationDTO", "AlleleDiseaseAnnotationDTO", "AGMDiseaseAnnotationDTO", "GeneDTO", "AlleleDTO", "AffectedGenomicModelDTO", "ConstructDTO"]],
- ["DISEASE_ANNOTATION", ["GeneDiseaseAnnotationDTO", "AlleleDiseaseAnnotationDTO", "AGMDiseaseAnnotationDTO"]],
- ["GENE_DISEASE_ANNOTATION", ["GeneDiseaseAnnotationDTO"]],
- ["ALLELE_DISEASE_ANNOTATION", ["AlleleDiseaseAnnotationDTO"]],
- ["AGM_DISEASE_ANNOTATION", ["AGMDiseaseAnnotationDTO"]],
- ["GENE", ["GeneDTO"]],
- ["ALLELE", ["AlleleDTO"]],
- ["AGM", ["AffectedGenomicModelDTO"]],
- ["VARIANT", ["VariantDTO"]],
- ["CONSTRUCT", ["ConstructDTO"]],
- ["ALLELE_ASSOCIATION", ["AlleleGeneAssociationDTO"]],
- ["CONSTRUCT_ASSOCIATION", ["ConstructGenomicEntityAssociationDTO"]]
- ]);
-
- useQuery(['bulkloadtable'],
- () => searchService.find('bulkloadgroup', 100, 0, {}), {
+ [
+ 'FULL_INGEST',
+ [
+ 'GeneDiseaseAnnotationDTO',
+ 'AlleleDiseaseAnnotationDTO',
+ 'AGMDiseaseAnnotationDTO',
+ 'GeneDTO',
+ 'AlleleDTO',
+ 'AffectedGenomicModelDTO',
+ 'ConstructDTO',
+ ],
+ ],
+ ['DISEASE_ANNOTATION', ['GeneDiseaseAnnotationDTO', 'AlleleDiseaseAnnotationDTO', 'AGMDiseaseAnnotationDTO']],
+ ['GENE_DISEASE_ANNOTATION', ['GeneDiseaseAnnotationDTO']],
+ ['ALLELE_DISEASE_ANNOTATION', ['AlleleDiseaseAnnotationDTO']],
+ ['AGM_DISEASE_ANNOTATION', ['AGMDiseaseAnnotationDTO']],
+ ['GENE', ['GeneDTO']],
+ ['ALLELE', ['AlleleDTO']],
+ ['AGM', ['AffectedGenomicModelDTO']],
+ ['VARIANT', ['VariantDTO']],
+ ['CONSTRUCT', ['ConstructDTO']],
+ ['ALLELE_ASSOCIATION', ['AlleleGeneAssociationDTO']],
+ ['CONSTRUCT_ASSOCIATION', ['ConstructGenomicEntityAssociationDTO']],
+ ]);
+
+ useQuery(['bulkloadtable'], () => searchService.find('bulkloadgroup', 100, 0, {}), {
onSuccess: (data) => {
- if(data.results) {
+ if (data.results) {
let _errorLoads = [];
for (let group of data.results) {
if (group.loads) {
@@ -98,30 +107,31 @@ export const DataLoadsComponent = () => {
load.group = group.id;
if (load.loadFiles) {
let sortedFiles = sortFilesByDate(load.loadFiles);
- if (sortedFiles[0].bulkloadStatus === "FAILED") {
+ if (sortedFiles[0].bulkloadStatus === 'FAILED') {
_errorLoads.push(load);
}
}
}
}
}
- setGroups(data.results.sort((a,b) => a.name > b.name ? 1 : -1));
- setErrorLoads(_errorLoads.sort((a, b) => (a.name > b.name) ? 1: -1));
+ setGroups(data.results.sort((a, b) => (a.name > b.name ? 1 : -1)));
+ setErrorLoads(_errorLoads.sort((a, b) => (a.name > b.name ? 1 : -1)));
}
- 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 + "load_processing_events";
+ new_uri += loc.pathname + 'load_processing_events';
//console.log(new_uri);
let ws = new WebSocket(new_uri);
@@ -132,22 +142,19 @@ export const DataLoadsComponent = () => {
let processingMessage = JSON.parse(e.data);
setRunningLoads((prevState) => {
//console.log(prevState);
- const newState = {...prevState};
+ const newState = { ...prevState };
newState[processingMessage.message] = processingMessage;
//console.log(newState);
return newState;
});
- }
-
+ };
},
keepPreviousData: true,
- refetchOnWindowFocus: false
+ refetchOnWindowFocus: false,
});
-
-
const getService = () => {
- if(!dataLoadService) {
+ if (!dataLoadService) {
dataLoadService = new DataLoadService(authState);
}
return dataLoadService;
@@ -162,39 +169,49 @@ export const DataLoadsComponent = () => {
};
const runLoad = (rowData) => {
- getService().restartLoad(rowData.type, rowData.id).then(response => {
- queryClient.invalidateQueries(['bulkloadtable']);
- });
+ getService()
+ .restartLoad(rowData.type, rowData.id)
+ .then((response) => {
+ queryClient.invalidateQueries(['bulkloadtable']);
+ });
};
const runLoadFile = (rowData) => {
- getService().restartLoadFile(rowData.id).then(response => {
- queryClient.invalidateQueries(['bulkloadtable']);
- });
+ getService()
+ .restartLoadFile(rowData.id)
+ .then((response) => {
+ queryClient.invalidateQueries(['bulkloadtable']);
+ });
};
const editLoad = (rowData) => {
- bulkLoadDispatch({ type: "EDIT", editBulkLoad: rowData });
+ bulkLoadDispatch({ type: 'EDIT', editBulkLoad: rowData });
setBulkLoadDialog(true);
setDisableFormFields(true);
};
const deleteLoadFile = (rowData) => {
- getService().deleteLoadFile(rowData.id).then(response => {
- queryClient.invalidateQueries(['bulkloadtable']);
- });
+ getService()
+ .deleteLoadFile(rowData.id)
+ .then((response) => {
+ queryClient.invalidateQueries(['bulkloadtable']);
+ });
};
const deleteLoad = (rowData) => {
- getService().deleteLoad(rowData.type, rowData.id).then(response => {
- queryClient.invalidateQueries(['bulkloadtable']);
- });
+ getService()
+ .deleteLoad(rowData.type, rowData.id)
+ .then((response) => {
+ queryClient.invalidateQueries(['bulkloadtable']);
+ });
};
const deleteGroup = (rowData) => {
- getService().deleteGroup(rowData.id).then(response => {
- queryClient.invalidateQueries(['bulkloadtable']);
- });
+ getService()
+ .deleteGroup(rowData.id)
+ .then((response) => {
+ queryClient.invalidateQueries(['bulkloadtable']);
+ });
};
const showHistory = (rowData) => {
@@ -205,7 +222,11 @@ export const DataLoadsComponent = () => {
const historyActionBodyTemplate = (rowData) => {
return (
-
- )
- }
+ );
+ };
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(
runLoadFile(rowData)} />);
+ ret.push(
+ runLoadFile(rowData)}
+ />
+ );
}
}
- if(!rowData.bulkloadStatus || rowData.bulkloadStatus === "FINISHED" || rowData.bulkloadStatus === "FAILED" || rowData.bulkloadStatus === "STOPPED") {
- ret.push( deleteLoadFile(rowData)} />);
+ if (
+ !rowData.bulkloadStatus ||
+ rowData.bulkloadStatus === 'FINISHED' ||
+ rowData.bulkloadStatus === 'FAILED' ||
+ rowData.bulkloadStatus === 'STOPPED'
+ ) {
+ ret.push(
+ deleteLoadFile(rowData)}
+ />
+ );
}
return ret;
-
};
const loadActionBodyTemplate = (rowData) => {
let ret = [];
- ret.push( editLoad(rowData)} />);
+ ret.push(
+ editLoad(rowData)}
+ />
+ );
if (rowData.type !== 'BulkManualLoad') {
- if (!rowData.bulkloadStatus || rowData.bulkloadStatus === "FINISHED" || rowData.bulkloadStatus === "FAILED" || rowData.bulkloadStatus === "STOPPED") {
- ret.push( runLoad(rowData)} />);
+ if (
+ !rowData.bulkloadStatus ||
+ rowData.bulkloadStatus === 'FINISHED' ||
+ rowData.bulkloadStatus === 'FAILED' ||
+ rowData.bulkloadStatus === 'STOPPED'
+ ) {
+ ret.push(
+ runLoad(rowData)}
+ />
+ );
}
- }else{
- ret.push( showUploadConfirmDialog(rowData)} />)
+ } else {
+ ret.push(
+ showUploadConfirmDialog(rowData)}
+ />
+ );
}
if (!rowData.loadFiles || rowData.loadFiles.length === 0) {
- ret.push( deleteLoad(rowData)} />);
+ ret.push(
+ deleteLoad(rowData)}
+ />
+ );
}
- return {ret}
;
+ return {ret}
;
};
const groupActionBodyTemplate = (rowData) => {
if (!rowData.loads || rowData.loads.length === 0) {
- return ( deleteGroup(rowData)} />);
+ return (
+ deleteGroup(rowData)}
+ />
+ );
}
};
const nameBodyTemplate = (rowData) => {
- return (
-
- {rowData.name}
-
- );
+ return {rowData.name};
};
const bulkloadUrlBodyTemplate = (rowData) => {
@@ -313,18 +392,14 @@ export const DataLoadsComponent = () => {
const backendBulkLoadTypeTemplate = (rowData) => {
if (rowData.backendBulkLoadType === 'ONTOLOGY') {
- return rowData.backendBulkLoadType + "(" + rowData.ontologyType + ")";
+ return rowData.backendBulkLoadType + '(' + rowData.ontologyType + ')';
} else {
return rowData.backendBulkLoadType;
}
};
const scheduleActiveTemplate = (rowData) => {
- return (
-
- {rowData.scheduleActive ? "true" : "false"}
-
- );
+ return {rowData.scheduleActive ? 'true' : 'false'}
;
};
const showModRelease = (load) => {
@@ -332,10 +407,9 @@ export const DataLoadsComponent = () => {
return null;
}
return ;
- }
+ };
const dynamicColumns = (loads) => {
-
let showFMSLoad = false;
let showURLLoad = false;
let showManualLoad = false;
@@ -344,14 +418,16 @@ export const DataLoadsComponent = () => {
if (loads) {
for (const load of loads) {
- if (load.type === "BulkFMSLoad") showFMSLoad = true;
- if (load.type === "BulkURLLoad") showURLLoad = true;
- if (load.type === "BulkManualLoad") showManualLoad = true;
+ if (load.type === 'BulkFMSLoad') showFMSLoad = true;
+ if (load.type === 'BulkURLLoad') showURLLoad = true;
+ if (load.type === 'BulkManualLoad') showManualLoad = true;
}
}
if (showFMSLoad || showURLLoad) {
- ret.push();
+ ret.push(
+
+ );
ret.push();
ret.push();
if (showFMSLoad) {
@@ -371,15 +447,24 @@ export const DataLoadsComponent = () => {
const bulkloadFileStatusTemplate = (rowData) => {
let styleClass = 'p-button-text p-button-plain';
- if (rowData.bulkloadStatus === 'FAILED') { styleClass = "p-button-danger"; }
- if (rowData.bulkloadStatus && (
- rowData.bulkloadStatus.endsWith('STARTED') ||
+ if (rowData.bulkloadStatus === 'FAILED') {
+ styleClass = 'p-button-danger';
+ }
+ if (
+ rowData.bulkloadStatus &&
+ (rowData.bulkloadStatus.endsWith('STARTED') ||
rowData.bulkloadStatus.endsWith('RUNNING') ||
- rowData.bulkloadStatus.endsWith('PENDING')
- )) { styleClass = "p-button-success"; }
+ rowData.bulkloadStatus.endsWith('PENDING'))
+ ) {
+ styleClass = 'p-button-success';
+ }
return (
-
+
);
};
@@ -395,23 +480,31 @@ export const DataLoadsComponent = () => {
latestError = sortedFiles[0].errorMessage;
}
let styleClass = 'p-button-text p-button-plain';
- if (latestStatus === 'FAILED') { styleClass = "p-button-danger"; }
- if (latestStatus && (
- latestStatus.endsWith('STARTED') ||
- latestStatus.endsWith('RUNNING') ||
- latestStatus.endsWith('PENDING')
- )) { styleClass = "p-button-success"; }
+ if (latestStatus === 'FAILED') {
+ styleClass = 'p-button-danger';
+ }
+ if (
+ latestStatus &&
+ (latestStatus.endsWith('STARTED') || latestStatus.endsWith('RUNNING') || latestStatus.endsWith('PENDING'))
+ ) {
+ styleClass = 'p-button-success';
+ }
- return (
-
- );
+ return ;
};
const historyTable = (file) => {
+ let sortedHistory = [];
+ if (file.history != null) {
+ sortedHistory = file.history.sort(function (a, b) {
+ const start1 = new Date(a.loadStarted);
+ const start2 = new Date(b.loadStarted);
+ return start2 - start1;
+ });
+ }
return (
-
-
+
@@ -430,8 +523,8 @@ export const DataLoadsComponent = () => {
let sortedFiles = [];
let lastLoadedDates = new Map();
let filesWithoutDates = [];
- files.forEach(file => {
- if (file.bulkloadStatus === "FINISHED" || file.bulkloadStatus === "STOPPED" || file.bulkloadStatus === "FAILED") {
+ files.forEach((file) => {
+ if (file.bulkloadStatus === 'FINISHED' || file.bulkloadStatus === 'STOPPED' || file.bulkloadStatus === 'FAILED') {
if (file.dateLastLoaded) {
lastLoadedDates.set(file.dateLastLoaded, file);
} else {
@@ -441,30 +534,42 @@ export const DataLoadsComponent = () => {
lastLoadedDates.set(new Date().toISOString(), file);
}
});
- Array.from(lastLoadedDates.keys()).sort(function(a,b) {
- const start1 = new Date(a);
- const start2 = new Date(b);
- return start2 - start1;
- }).forEach(date => sortedFiles.push(lastLoadedDates.get(date)));
+ Array.from(lastLoadedDates.keys())
+ .sort(function (a, b) {
+ const start1 = new Date(a);
+ const start2 = new Date(b);
+ return start2 - start1;
+ })
+ .forEach((date) => sortedFiles.push(lastLoadedDates.get(date)));
if (filesWithoutDates.length > 0) {
- filesWithoutDates.forEach(fwd => {sortedFiles.push(fwd)});
+ filesWithoutDates.forEach((fwd) => {
+ sortedFiles.push(fwd);
+ });
}
return sortedFiles;
- }
+ };
const fileTable = (load) => {
let sortedFiles = [];
if (load.loadFiles) {
sortedFiles = sortFilesByDate(load.loadFiles);
}
- sortedFiles.forEach(file => {file.loadType = load.backendBulkLoadType});
+ sortedFiles.forEach((file) => {
+ file.loadType = load.backendBulkLoadType;
+ });
return (
-
setExpandedFileRows(e.data)}
- rowExpansionTemplate={historyTable} dataKey="id">
+ setExpandedFileRows(e.data)}
+ rowExpansionTemplate={historyTable}
+ dataKey="id"
+ >
@@ -483,37 +588,48 @@ export const DataLoadsComponent = () => {
const loadTable = (group) => {
let sortedLoads = [];
if (group.loads) {
- sortedLoads = group.loads.sort((a, b) => (a.name > b.name) ? 1: -1);
+ sortedLoads = group.loads.sort((a, b) => (a.name > b.name ? 1 : -1));
}
return (
- setExpandedLoadRows(e.data)}
- rowExpansionTemplate={fileTable} dataKey="id">
+ setExpandedLoadRows(e.data)}
+ rowExpansionTemplate={fileTable}
+ dataKey="id"
+ >
{dynamicColumns(sortedLoads)}
-
+
);
};
const getSchemaVersionArray = (map) => {
- if(map) {
+ if (map) {
const array = [];
- for(let item in map) {
- array.push({ className: item, schemaVersion: map[item]});
+ for (let item in map) {
+ array.push({ className: item, schemaVersion: map[item] });
}
return array;
} else {
return [];
}
- }
+ };
const fileWithinSchemaRange = (fileVersion, loadType) => {
if (!fileVersion) return false;
@@ -526,21 +642,29 @@ export const DataLoadsComponent = () => {
if (loadTypeClasses.has(loadType)) {
loadedClasses = loadTypeClasses.get(loadType);
} else {
- console.error("Unrecognized load type " + loadType);
+ console.error('Unrecognized load type ' + loadType);
}
for (const loadedClass of loadedClasses) {
const classVersionRange = classVersions[loadedClass];
if (!classVersionRange) return false;
- let minMaxVersions = classVersionRange.includes("-") ? classVersionRange.split(" - ") : [classVersionRange, classVersionRange];
+ let minMaxVersions = classVersionRange.includes('-')
+ ? classVersionRange.split(' - ')
+ : [classVersionRange, classVersionRange];
if (minMaxVersions.length === 0 || minMaxVersions.length > 2) return false;
let minMaxVersionParts = [];
- minMaxVersions.forEach((version, ix) => {minMaxVersionParts[ix] = parseVersionString(version)});
+ minMaxVersions.forEach((version, ix) => {
+ minMaxVersionParts[ix] = parseVersionString(version);
+ });
const minVersionParts = minMaxVersionParts[0];
if (minMaxVersions.length === 1) {
- if (minVersionParts[0] !== fileVersionParts[0] || minVersionParts[1] !== fileVersionParts[1] || minVersionParts[2] !== fileVersionParts[2]) {
+ if (
+ minVersionParts[0] !== fileVersionParts[0] ||
+ minVersionParts[1] !== fileVersionParts[1] ||
+ minVersionParts[2] !== fileVersionParts[2]
+ ) {
return false;
}
}
@@ -573,7 +697,7 @@ export const DataLoadsComponent = () => {
const patchVersion = versionParts.patch ? parseInt(versionParts.patch) : 0;
return [majorVersion, minorVersion, patchVersion];
- }
+ };
const uploadConfirmDialogFooter = () => {
return (
@@ -581,8 +705,16 @@ export const DataLoadsComponent = () => {
- uploadLoadFile(e)} maxFileSize={1000000000000000} />
+ uploadLoadFile(e)}
+ maxFileSize={1000000000000000}
+ />
@@ -591,37 +723,40 @@ export const DataLoadsComponent = () => {
);
- }
+ };
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(
@@ -629,40 +764,65 @@ export const DataLoadsComponent = () => {
}
}
return ret;
- }
+ };
return (
<>
-
-
+
+
- {
- errorLoads.length > 0 &&
+ {errorLoads.length > 0 && (
-
+
Failed Loads Table
- setExpandedErrorLoadRows(e.data)}
- rowExpansionTemplate={fileTable} dataKey="id">
+ setExpandedErrorLoadRows(e.data)}
+ rowExpansionTemplate={fileTable}
+ dataKey="id"
+ >
{dynamicColumns(errorLoads)}
-
+
- }
+ )}
Data Loads Table
-
setExpandedGroupRows(e.data)}
- rowExpansionTemplate={loadTable} dataKey="id">
+ setExpandedGroupRows(e.data)}
+ rowExpansionTemplate={loadTable}
+ dataKey="id"
+ >
@@ -687,23 +847,40 @@ export const DataLoadsComponent = () => {
dataLoadService={getService()}
history={history}
/>
-
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 (
-
+
-
@@ -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 (
-
+
-
+
@@ -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 (
- { handleDeleteRelation(event, props) }}/>
+ {
+ handleDeleteRelation(event, props);
+ }}
+ />
);
- }
+ };
return (
-
- {showConditionRelations &&
-
- deleteAction(props)} body={(props) => deleteAction(props)} style={{ maxWidth: '4rem'}} frozen headerClassName='surface-0' bodyStyle={{textAlign: 'center'}}/>
-
-
-
+
+ {showConditionRelations && (
+
+ deleteAction(props)}
+ body={(props) => deleteAction(props)}
+ style={{ maxWidth: '4rem' }}
+ frozen
+ headerClassName="surface-0"
+ bodyStyle={{ textAlign: 'center' }}
+ />
+
+
+
- }
-
);
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 (
<>
-
- { handleRelatedNotesOpenInEdit(event, props, true) }} >
-
- {`Notes(${props.rowData.relatedNotes.length}) `}
-
-
-
-
-
-
+
+ {
+ handleRelatedNotesOpenInEdit(event, props, true);
+ }}
+ >
+
+ {`Notes(${props.rowData.relatedNotes.length}) `}
+
+
+
+
+
+
+
>
- )
+ );
} else {
return (
<>
- { handleRelatedNotesOpenInEdit(event, props, true) }} >
+ {
+ handleRelatedNotesOpenInEdit(event, props, true);
+ }}
+ >
Add Note
-
-
-
+
+
+
+
-
+
>
- )
+ );
}
};
const conditionRelationsEditor = (props) => {
-
if (props.rowData?.conditionRelations) {
const handle = props.rowData.conditionRelations[0]?.handle;
@@ -223,66 +249,81 @@ export const DiseaseAnnotationsTable = () => {
return (
<>
-
- { handleConditionRelationsOpenInEdit(event, props, true) }} >
-
- {!handle && `Conditions (${props.rowData.conditionRelations.length})`}
- {handle && handle}
-
-
-
-
-
-
+
+ {
+ handleConditionRelationsOpenInEdit(event, props, true);
+ }}
+ >
+
+ {!handle && `Conditions (${props.rowData.conditionRelations.length})`}
+ {handle && handle}
+
+
+
+
+
+
+
>
- )
+ );
} else {
return (
<>
- { handleConditionRelationsOpenInEdit(event, props, true) }} >
+ {
+ handleConditionRelationsOpenInEdit(event, props, true);
+ }}
+ >
Add Condition
-
-
-
+
+
+
+
>
- )
-
+ );
}
};
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 (
<>
-
+
+
>
);
};
@@ -1152,8 +1318,8 @@ const { isLoading, isFetching } = useGetTableData({
mutation={mutation}
isInEditMode={isInEditMode}
setIsInEditMode={setIsInEditMode}
- toasts={{toast_topleft, toast_topright }}
- errorObject={{errorMessages, setErrorMessages, uiErrorMessages, setUiErrorMessages}}
+ toasts={{ toast_topleft, toast_topright }}
+ errorObject={{ errorMessages, setErrorMessages, uiErrorMessages, setUiErrorMessages }}
headerButtons={headerButtons}
deletionEnabled={true}
deletionMethod={diseaseAnnotationService.deleteDiseaseAnnotation}
@@ -1164,7 +1330,7 @@ const { isLoading, isFetching } = useGetTableData({
duplicationEnabled={true}
defaultColumnWidth={DEFAULT_COLUMN_WIDTH}
fetching={isFetching || isLoading}
- defaultFilters = {defaultFilters}
+ defaultFilters={defaultFilters}
/>
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 = ({
-
-
+
-
-
+
+
>
);
const assertedGenesSearch = (event, setFiltered, setInputValue) => {
- const autocompleteFields = ["geneSymbol.displayText", "geneFullName.displayText", "modEntityId", "modInternalId", "curie", "crossReferences.referencedCurie", "geneSynonyms.displayText"];
- const endpoint = "gene";
- const filterName = "assertedGenesFilter";
+ const autocompleteFields = [
+ 'geneSymbol.displayText',
+ 'geneFullName.displayText',
+ 'modEntityId',
+ 'modInternalId',
+ 'curie',
+ 'crossReferences.referencedCurie',
+ 'geneSynonyms.displayText',
+ ];
+ const endpoint = 'gene';
+ const filterName = 'assertedGenesFilter';
const filter = buildAutocompleteFilter(event, autocompleteFields);
setInputValue(event.query);
autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered);
};
const assertedAlleleSearch = (event, setFiltered, setInputValue) => {
- const autocompleteFields = ["alleleSymbol.displayText", "alleleFullName.displayText", "modEntityId", "modInternalId", "curie", "crossReferences.referencedCurie", "alleleSecondaryIds.secondaryId", "alleleSynonyms.displayText"];
- const endpoint = "allele";
- const filterName = "assertedAlleleFilter";
+ const autocompleteFields = [
+ 'alleleSymbol.displayText',
+ 'alleleFullName.displayText',
+ 'modEntityId',
+ 'modInternalId',
+ 'curie',
+ 'crossReferences.referencedCurie',
+ 'alleleSecondaryIds.secondaryId',
+ 'alleleSynonyms.displayText',
+ ];
+ const endpoint = 'allele';
+ const filterName = 'assertedAlleleFilter';
const filter = buildAutocompleteFilter(event, autocompleteFields);
setInputValue(event.query);
autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered);
@@ -414,7 +490,7 @@ export const NewAnnotationForm = ({
};
const setToModDefault = () => {
- const modFormFields = getModFormFields("DiseaseAnnotations");
+ const modFormFields = getModFormFields('DiseaseAnnotations');
updateFormFields(modFormFields);
};
@@ -426,13 +502,13 @@ export const NewAnnotationForm = ({
updateFormFields(e.value)}
- className='w-20rem text-center'
+ className="w-20rem text-center"
maxSelectedLabels={4}
/>
@@ -450,9 +526,9 @@ export const NewAnnotationForm = ({
>
);
- const labelColumnSize = "col-2";
- const widgetColumnSize = "col-4";
- const fieldDetailsColumnSize = "col-5";
+ const labelColumnSize = 'col-2';
+ const widgetColumnSize = 'col-4';
+ const fieldDetailsColumnSize = 'col-5';
const requiredfield = *;
let required = '';
@@ -460,35 +536,52 @@ export const NewAnnotationForm = ({