Skip to content

Commit

Permalink
Merge pull request #1099 from hubmapconsortium/ubkg_api_get_organ_typ…
Browse files Browse the repository at this point in the history
…e_set_mockup

Ubkg api get organ type set mockup
  • Loading branch information
yuanzhou authored Apr 26, 2023
2 parents 125e290 + 9a40539 commit 4d9d422
Show file tree
Hide file tree
Showing 15 changed files with 381 additions and 91 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ favorites.json
*.lock
*.~lock
*.~lock.*

.idea
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.16
2.3.16
1 change: 1 addition & 0 deletions src/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REACT_APP_METADATA_API_URL = 'https://ingest-api.dev.hubmapconsortium.org'
REACT_APP_ENTITY_API_URL = 'https://entity-api.dev.hubmapconsortium.org'
REACT_APP_SEARCH_API_URL = 'https://search-api.dev.hubmapconsortium.org/v3'
REACT_APP_PORTAL_URL = 'https://portal.dev.hubmapconsortium.org/browse/dataset
REACT_APP_UBKG_API_URL = 'https://ontology-api.dev.hubmapconsortium.org'

# UI URL (default value used for local development)
# Point to remote URL for testing and production deployment
Expand Down
30 changes: 18 additions & 12 deletions src/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import { faExclamationTriangle}

import AnnouncementTwoToneIcon from '@mui/icons-material/AnnouncementTwoTone';
import { ingest_api_users_groups } from './service/ingest_api';
import {search_api_get_assay_set} from "./service/search_api";
import {BuildError} from "./utils/error_helper";
import { ubkg_api_get_assay_type_set } from "./service/ubkg_api";
import {BuildError, FormatError} from "./utils/error_helper";

// import {ErrBox} from "../utils/ui_elements";
// Site Content
Expand Down Expand Up @@ -110,14 +110,14 @@ export function App (props){
setGroupsToken(JSON.parse(localStorage.getItem("info")).groups_token);
setTimerStatus(false);
setAuthStatus(true);
search_api_get_assay_set("primary")
ubkg_api_get_assay_type_set("primary")
.then((response) => {
console.debug("search_api_get_assay_set");
console.debug("ubkg_api_get_assay_type_set");
let dtypes = response.data.result;
setDataTypeList(dtypes);
setDataTypeListPrimary(dtypes);
// setIsLoading(false)
search_api_get_assay_set()
ubkg_api_get_assay_type_set()
.then((response) => {
let dataAll = response.data.result;
setDataTypeListAll(dataAll);
Expand Down Expand Up @@ -202,13 +202,19 @@ export function App (props){

var bundledParameters = {entityType: queryType, keywords: queryKeyword, group: queryGroup};

function reportError (error){
console.error("!!!reportError", error);
var errString = JSON.stringify(BuildError(error), Object.getOwnPropertyNames(BuildError(error)))
console.debug("reportError", errString);
setErrorInfo(errString);
setErrorShow(true);
}
function reportError (error){
console.debug("Type", typeof error);
typeof error === "string" ? setErrorInfo(error) : setErrorInfo(JSON.stringify(error));

// var errString = JSON.stringify(BuildError(error), Object.getOwnPropertyNames(BuildError(error)))
// if(error.results){
// errString = JSON.stringify(BuildError(error.results), Object.getOwnPropertyNames(BuildError(error.results)))
// }
var formatError = FormatError(error);
console.debug("reportError", error, formatError);
// setErrorInfo(errString);
setErrorShow(true);
}

return (
<div className="App">
Expand Down
6 changes: 3 additions & 3 deletions src/src/components/datasets.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useState, useRef } from "react";
import { useParams }from 'react-router-dom';
import { entity_api_get_entity} from '../service/entity_api';
import { search_api_get_assay_list, search_api_get_assay_set } from '../service/search_api';
import { ubkg_api_get_assay_type_set } from "../service/ubkg_api";
import DatasetFormLegacy from "./ingest/dataset_edit";
import {useNavigate} from "react-router-dom";
import { useLocation } from 'react-router'
Expand Down Expand Up @@ -51,15 +51,15 @@ export const RenderDataset = (props) => {
setAuthToken(authSet);

function checkAssayType(dtype){
search_api_get_assay_set("primary")// the list call only gets primaries for now.
ubkg_api_get_assay_type_set("primary")// the list call only gets primaries for now.
.then((response) => {
let primaries = response.data.result ;
var primarySet = primaries.map((elt, idx) => {return elt.name});
var primaryStatus = primarySet.includes(dtype[0])
setDataTypeList(primaries);
setDtl_primary(primaries);
setDtl_status( primarySet.includes(dtype[0]));
search_api_get_assay_set()// the list call only gets primaries for now.
ubkg_api_get_assay_type_set()// the list call only gets primaries for now.
.then((response) => {
let allDTs = response.data.result;
setDtl_all(allDTs);
Expand Down
Loading

0 comments on commit 4d9d422

Please sign in to comment.