From 48dd4e9cba6ce0b933e4724e9cea7a2aac469735 Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 10:52:47 +0000 Subject: [PATCH 1/8] revert back to syntax for paginated view responses --- js/components/downloadPdb.js | 4 ++-- js/components/generalComponents.js | 2 +- js/components/hotspotList.js | 2 +- js/components/hotspotView.js | 8 ++++---- js/components/modalStateSave.js | 2 +- js/components/refinementOutcome.js | 2 +- js/components/sessionManagement.js | 4 ++-- js/containers/previewHolder.js | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/js/components/downloadPdb.js b/js/components/downloadPdb.js index 05d046970..3fc80cd07 100644 --- a/js/components/downloadPdb.js +++ b/js/components/downloadPdb.js @@ -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, '-'); diff --git a/js/components/generalComponents.js b/js/components/generalComponents.js index a4fbbf6e1..dc3df7fae 100644 --- a/js/components/generalComponents.js +++ b/js/components/generalComponents.js @@ -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; diff --git a/js/components/hotspotList.js b/js/components/hotspotList.js index 6e016b02b..9cd0171a3 100644 --- a/js/components/hotspotList.js +++ b/js/components/hotspotList.js @@ -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})); } } diff --git a/js/components/hotspotView.js b/js/components/hotspotView.js index 80df6bb6a..8dbc782c0 100644 --- a/js/components/hotspotView.js +++ b/js/components/hotspotView.js @@ -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 diff --git a/js/components/modalStateSave.js b/js/components/modalStateSave.js index 09fc07608..491cfe3df 100644 --- a/js/components/modalStateSave.js +++ b/js/components/modalStateSave.js @@ -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}))) diff --git a/js/components/refinementOutcome.js b/js/components/refinementOutcome.js index d187a6126..99dfde6a6 100644 --- a/js/components/refinementOutcome.js +++ b/js/components/refinementOutcome.js @@ -23,7 +23,7 @@ class RefinementOutcome extends React.Component{ } 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"){ diff --git a/js/components/sessionManagement.js b/js/components/sessionManagement.js index 514cc368f..d2b42eb8d 100644 --- a/js/components/sessionManagement.js +++ b/js/components/sessionManagement.js @@ -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)) } @@ -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){ diff --git a/js/containers/previewHolder.js b/js/containers/previewHolder.js index 1be0386ca..b555728ba 100644 --- a/js/containers/previewHolder.js +++ b/js/containers/previewHolder.js @@ -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); }) From 5dfe3776ba1d708532e49a2e7d58d8d4934e8681 Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 11:38:33 +0000 Subject: [PATCH 2/8] change to webpack execution to handle hanging at "92% chunk asset optimization UglifyJSPlugin" --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5b84dbe90..cadfb374b 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "webpack.config.js", "scripts": { "test": "jest", - "build": "webpack --config webpack.config.js --progress --colors --mode production", - "watch": "webpack --config webpack.config.js --watch", - "dev": "webpack --config webpack.config.js --mode development --watch" + "build": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --progress --colors --mode production", + "watch": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --watch", + "dev": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --mode development --watch" }, "jest": { "testEnvironment": "node" From 3d140156461bd9a8c92999e19d3dfb78b7793781 Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 11:47:25 +0000 Subject: [PATCH 3/8] try terminating statements (that I have changed) --- js/components/refinementOutcome.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/components/refinementOutcome.js b/js/components/refinementOutcome.js index 99dfde6a6..c3da19ea7 100644 --- a/js/components/refinementOutcome.js +++ b/js/components/refinementOutcome.js @@ -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["results"] + 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); } } From 0b7a5e5552503536c5af5a57aca9e5f081ca67eb Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 12:07:49 +0000 Subject: [PATCH 4/8] try without uglify --- package.json | 3 ++- webpack.config.js | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index cadfb374b..d0519b018 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,6 @@ "webpack": "^4.20.0", "webpack-bundle-tracker": "^0.3.0", "webpack-cli": "^3.1.1" - } + }, + "Pee" } diff --git a/webpack.config.js b/webpack.config.js index 7654eb014..2a316fef0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,19 +15,19 @@ module.exports = { plugins: [ new BundleTracker({filename: './webpack-stats.json', trackAssets:true}), - new UglifyJsPlugin( - { - uglifyOptions: - { - ecma: 7, - keep_fnames: true, - ie8: false, - output: { - comments: false - } - }, - } - ), + // new UglifyJsPlugin( + // { + // uglifyOptions: + // { + // ecma: 7, + // keep_fnames: true, + // ie8: false, + // output: { + // comments: false + // } + // }, + // } + // ), ], module: { From 1939bd660196e1249f2d45092cf2eff4cd03e2db Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 12:10:14 +0000 Subject: [PATCH 5/8] try without uglify --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index d0519b018..7ca595b6d 100644 --- a/package.json +++ b/package.json @@ -82,5 +82,4 @@ "webpack-bundle-tracker": "^0.3.0", "webpack-cli": "^3.1.1" }, - "Pee" } From 68b80b4c467331b30ede08e5a460a4a706ae8e72 Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 12:11:54 +0000 Subject: [PATCH 6/8] try without uglify --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ca595b6d..cadfb374b 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,5 @@ "webpack": "^4.20.0", "webpack-bundle-tracker": "^0.3.0", "webpack-cli": "^3.1.1" - }, + } } From c14f7476696f5f03a6488faaebb74375aee8f6df Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 12:20:33 +0000 Subject: [PATCH 7/8] revert to using regular webpack command, and just install and test without build --- .travis.yml | 2 +- package.json | 6 +++--- webpack.config.js | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index c393d119f..3a2e7d62d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: node_js node_js: - "8" script: - - npm run build && npm test + - npm install && npm test after_success: - if [ "$TRAVIS_BRANCH" == "master" ]; then npm run-script build; diff --git a/package.json b/package.json index cadfb374b..5b84dbe90 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "webpack.config.js", "scripts": { "test": "jest", - "build": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --progress --colors --mode production", - "watch": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --watch", - "dev": "node --max_old_space_size=4096 node_modules/.bin/webpack --config webpack.config.js --mode development --watch" + "build": "webpack --config webpack.config.js --progress --colors --mode production", + "watch": "webpack --config webpack.config.js --watch", + "dev": "webpack --config webpack.config.js --mode development --watch" }, "jest": { "testEnvironment": "node" diff --git a/webpack.config.js b/webpack.config.js index 2a316fef0..7654eb014 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -15,19 +15,19 @@ module.exports = { plugins: [ new BundleTracker({filename: './webpack-stats.json', trackAssets:true}), - // new UglifyJsPlugin( - // { - // uglifyOptions: - // { - // ecma: 7, - // keep_fnames: true, - // ie8: false, - // output: { - // comments: false - // } - // }, - // } - // ), + new UglifyJsPlugin( + { + uglifyOptions: + { + ecma: 7, + keep_fnames: true, + ie8: false, + output: { + comments: false + } + }, + } + ), ], module: { From 1d14c4d4dcdfdd158a7a57a3d222589cb00ee7ba Mon Sep 17 00:00:00 2001 From: reskyner Date: Thu, 27 Dec 2018 12:25:49 +0000 Subject: [PATCH 8/8] remove after-success npm build from travis build --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a2e7d62d..8a603e2df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ node_js: - "8" script: - npm install && npm test -after_success: - - if [ "$TRAVIS_BRANCH" == "master" ]; then - npm run-script build; - fi +#after_success: +# - if [ "$TRAVIS_BRANCH" == "master" ]; then +# npm run-script build; +# fi