Skip to content

Commit

Permalink
Merge pull request #130 from xchem/pagination
Browse files Browse the repository at this point in the history
revert back to syntax for paginated view responses
  • Loading branch information
reskyner authored Dec 27, 2018
2 parents e064500 + 1d14c4d commit 0813139
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ language: node_js
node_js:
- "8"
script:
- npm run build && npm test
after_success:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
npm run-script build;
fi
- npm install && npm test
#after_success:
# - if [ "$TRAVIS_BRANCH" == "master" ]; then
# npm run-script build;
# fi
4 changes: 2 additions & 2 deletions js/components/downloadPdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class DownloadPdb extends React.Component {
var proteinsUrl = window.location.protocol + "//" + window.location.host + "/api/proteins/?target_id=" + this.props.targetOn.toString();
const protResponse = await fetch(proteinsUrl);
const protJson = await protResponse.json();
const protInfo = protJson;
const protInfo = protJson.results;
const pdbResponse = await fetch(protPdbUrl);
const pdbJson = await pdbResponse.json();
const pdbInfo = pdbJson;
const pdbInfo = pdbJson.results;
var zip = new JSZip();
const timeOptions = {year: 'numeric', month: 'short', day: '2-digit'};
var fName = this.props.targetOnName + "_allPdb_" + new Intl.DateTimeFormat('en-GB', timeOptions).format(Date.now()).replace(/\s/g, '-');
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;
var results = json.results;
this.afterPush(results)
if (this.list_type == listTypes.SESSIONS && this.props.seshListSaving == true) {this.props.setSeshListSaving(false)}
return results;
Expand Down
2 changes: 1 addition & 1 deletion js/components/hotspotList.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class HotspotList extends GenericList {
}
})
var myJson = await response.json();
this.setState(prevState => ({hsCount: myJson.length}));
this.setState(prevState => ({hsCount: myJson.count}));
}
}

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[0].prot_id.toString() + mapType + isoLevel,
"hotUrl": myJson[0].map_info.replace("http:",window.location.protocol),
"name": "HOTSPOT_" + myJson.results[0].prot_id.toString() + mapType + isoLevel,
"hotUrl": myJson.results[0].map_info.replace("http:",window.location.protocol),
"display_div": "major_view",
"OBJECT_TYPE": nglObjectTypes.HOTSPOT,
"map_type": myJson[0].map_type.toString(),
"fragment": myJson[0].prot_id.toString(),
"map_type": myJson.results[0].map_type.toString(),
"fragment": myJson.results[0].prot_id.toString(),
"isoLevel": isoLevel,
"opacity": opacity,
"disablePicking": true
Expand Down
2 changes: 1 addition & 1 deletion js/components/modalStateSave.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ModalStateSave extends Component {
}).then(function (response) {
return response.json();
}).then(function (myJson) {
var getTitle = myJson[JSON.stringify(0)].title;
var getTitle = myJson.results[JSON.stringify(0)].title;
_this.props.setSessionTitle(getTitle);
return getTitle;
}).then(getTitle => this.setState(prevState => ({title: getTitle})))
Expand Down
8 changes: 4 additions & 4 deletions js/components/refinementOutcome.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ class RefinementOutcome extends React.Component{

constructor(props) {
super(props);
var base_url = window.location.protocol + "//" + window.location.host
var base_url = window.location.protocol + "//" + window.location.host;
this.base_url = base_url;
this.getUrl = this.getUrl.bind(this);
this.state = {refinementOutcome: undefined}
}

getUrl() {
var get_view = "/api/molannotation/?mol_id=" + this.props.data.id.toString()
var get_view = "/api/molannotation/?mol_id=" + this.props.data.id.toString();
return new URL(this.base_url + get_view)
}

convertJson(input_json){
var results = input_json
var results = input_json["results"];
for (var index in results){
var result = results[index];
if (result["annotation_type"]=="ligand_confidence"){
var result_text = result["annotation_text"]
var result_text = result["annotation_text"];
var int_conf = parseInt(result_text);
}
}
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[JSON.stringify(0)].title;
var title = myJson.results[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[0]))
}).then(json => this.handleJson(json.results[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[0].id))
.then(json => this.props.setTargetOn(json["results"][0].id))
.catch((error) => {
this.deployErrorModal(error);
})
Expand Down

0 comments on commit 0813139

Please sign in to comment.