Skip to content

Commit

Permalink
Merge pull request #124 from xchem/pagination
Browse files Browse the repository at this point in the history
change json.results to json for response without pagination
  • Loading branch information
reskyner authored Dec 18, 2018
2 parents b72b669 + aa1fab1 commit 7268447
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js/components/downloadPdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DownloadPdb extends React.Component {
var molGroupUrl = window.location.protocol + "//" + window.location.host + "/api/molecules/?prot_id=" + pdbInfo[0].id;
const molResponse = await fetch(molGroupUrl);
const molJson = await molResponse.json();
const sdfData = molJson.results[0].sdf_info;
const sdfData = molJson[0].sdf_info;
totFolder.file(pdbCode + ".pdb", pdbData);
totFolder.file(pdbCode + ".sdf", sdfData);
}
Expand Down
2 changes: 1 addition & 1 deletion js/components/generalComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export class GenericList extends React.Component {
* @returns {*}
*/
processResults(json) {
var results = json.results;
var results = json;
this.afterPush(results)
if (this.list_type == listTypes.SESSIONS && this.props.seshListSaving == true) {this.props.setSeshListSaving(false)}
return results;
Expand Down
8 changes: 4 additions & 4 deletions js/components/hotspotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class HotspotView extends React.Component {
return response.json();
}).then(function (myJson) {
var hotspotObject = {
"name": "HOTSPOT_" + myJson.results[0].prot_id.toString() + mapType + isoLevel,
"hotUrl": myJson.results[0].map_info.replace("http:",window.location.protocol),
"name": "HOTSPOT_" + myJson[0].prot_id.toString() + mapType + isoLevel,
"hotUrl": myJson[0].map_info.replace("http:",window.location.protocol),
"display_div": "major_view",
"OBJECT_TYPE": nglObjectTypes.HOTSPOT,
"map_type": myJson.results[0].map_type.toString(),
"fragment": myJson.results[0].prot_id.toString(),
"map_type": myJson[0].map_type.toString(),
"fragment": myJson[0].prot_id.toString(),
"isoLevel": isoLevel,
"opacity": opacity,
"disablePicking": true
Expand Down
2 changes: 1 addition & 1 deletion js/components/refinementOutcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RefinementOutcome extends React.Component{
}

convertJson(input_json){
var results = input_json["results"]
var results = input_json
for (var index in results){
var result = results[index];
if (result["annotation_type"]=="ligand_confidence"){
Expand Down
4 changes: 2 additions & 2 deletions js/components/sessionManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class SessionManagement extends React.Component {
}).then(function (response) {
return response.json();
}).then(function (myJson) {
var title = myJson.results[JSON.stringify(0)].title;
var title = myJson[JSON.stringify(0)].title;
return title;
}).then(title => this.props.setSessionTitle(title))
}
Expand All @@ -264,7 +264,7 @@ export class SessionManagement extends React.Component {
fetch("/api/viewscene/?uuid="+this.props.uuid)
.then(function(response) {
return response.json();
}).then(json => this.handleJson(json.results[0]))
}).then(json => this.handleJson(json[0]))
this.props.setUuid("UNSET");
}
for (var key in this.props.nglOrientations){
Expand Down
2 changes: 1 addition & 1 deletion js/containers/previewHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Preview extends Component {
this.props.setTargetUnrecognised(targetUnrecognised);
fetch(window.location.protocol + "//" + window.location.host+"/api/targets/?title="+target)
.then(response => response.json())
.then(json => this.props.setTargetOn(json["results"][0].id))
.then(json => this.props.setTargetOn(json[0].id))
.catch((error) => {
this.deployErrorModal(error);
})
Expand Down

0 comments on commit 7268447

Please sign in to comment.