Skip to content

Commit

Permalink
fixing mappings query
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Jan 6, 2021
1 parent ff7ea1d commit 8e49199
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/concepts/ConceptHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ConceptHome extends React.Component {
this.setState({isLoading: true}, () => {
APIService.new()
.overrideURL(this.getConceptURLFromPath())
.get(null, null, {includeInverseMappings: true, lookupConcepts: true})
.get(null, null, {includeInverseMappings: true})
.then(response => {
this.setState({isLoading: false, concept: response.data}, () => {
if(this.state.tab === 2)
Expand Down
4 changes: 2 additions & 2 deletions src/components/concepts/ConceptsComparison.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getLocaleLabelExpanded = (locale, formatted=false) => {
}

const getMappingConceptName = (mapping, rel) => {
return get(mapping, `${rel}_name`) || get(mapping, `${rel}.display_name`)
return get(mapping, `${rel}_name`) || get(mapping, `${rel}_name_resolved`) || get(mapping, `${rel}.display_name`)
}

const getMappingLabel = (mapping, formatted=false) => {
Expand Down Expand Up @@ -161,7 +161,7 @@ class ConceptsComparison extends React.Component {

fetchConcept(uri, attr, loadingAttr) {
if(uri && attr && loadingAttr) {
APIService.new().overrideURL(uri).get(null, null, {includeInverseMappings: true, lookupConcepts: true}).then(response => {
APIService.new().overrideURL(uri).get(null, null, {includeInverseMappings: true}).then(response => {
if(get(response, 'status') === 200)
this.setState({[attr]: this.formatConcept(response.data), [loadingAttr]: false}, this.sortMappings)
})
Expand Down
3 changes: 2 additions & 1 deletion src/components/mappings/FromConceptLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import ResourceLabel from '../common/ResourceLabel';
import { DARKGRAY } from '../../common/constants';

const FromConceptLabel = props => {
const conceptName = props.from_concept_name || props.from_concept_name_resolved || get(props, 'from_concept.display_name')
const labelComponent = <ResourceLabel
owner={props.from_source_owner}
parent={props.from_source_name}
id={props.from_concept_code}
name={props.from_concept_name || get(props, 'from_concept.display_name')}
name={conceptName}
icon={
<LocalOfferIcon
fontSize='small'
Expand Down
2 changes: 1 addition & 1 deletion src/components/mappings/MappingHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MappingHome extends React.Component {
this.setState({isLoading: true}, () => {
APIService.new()
.overrideURL(this.getMappingURLFromPath())
.get(null, null, {lookupConcepts: true})
.get()
.then(response => {
this.setState({isLoading: false, mapping: response.data}, () => {
if(this.state.tab === 1)
Expand Down
2 changes: 1 addition & 1 deletion src/components/mappings/NestedMappingsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const NestedMappingsTable = ({ mappings, isIndirect }) => {
}

const getConceptName = (mapping, attr) => {
let name = get(mapping, attr);
let name = get(mapping, attr) || get(mapping, `${attr}_resolved`);
if(name) return name;
return get(mapping, `${attr.split('_name')[0]}.display_name`)
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/mappings/ToConceptLabel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import ResourceLabel from '../common/ResourceLabel';
import { DARKGRAY } from '../../common/constants';

const ToConceptLabel = props => {
const conceptName = props.to_concept_name || props.to_concept_name_resolved || get(props, 'to_concept.display_name')
const labelComponent = <ResourceLabel
owner={props.to_source_owner}
parent={props.to_source_name}
id={props.to_concept_code}
name={props.to_concept_name || get(props, 'to_concept.display_name')}
name={conceptName}
icon={
<LocalOfferIcon
fontSize='small'
Expand Down
2 changes: 1 addition & 1 deletion src/components/search/ResultsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ const ExpandibleRow = props => {
if(item) {
APIService.new().overrideURL(item.url)
.appendToUrl('mappings/')
.get(null, null, {includeInverseMappings: true, lookupConcepts: true})
.get(null, null, {includeInverseMappings: true})
.then(response => {
if(response.status === 200)
setMappings(response.data)
Expand Down
2 changes: 0 additions & 2 deletions src/components/search/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ class Search extends React.Component {
let _resource = resource
if(_resource === 'organizations')
_resource = 'orgs'
if(_resource === 'mappings')
queryParams['lookupConcepts'] = true
fetchSearchResults(
_resource,
{...queryParams, ...sortParams},
Expand Down

0 comments on commit 8e49199

Please sign in to comment.