From 0eca44e2bd62012b893fdf417861092764cb70ec Mon Sep 17 00:00:00 2001 From: Julien Rebetez Date: Sun, 26 Apr 2020 17:16:22 +0200 Subject: [PATCH] WIP fixes for Statusimage --- README.md | 2 +- src/components/home.js | 18 +++++++++++++++++- src/components/map.js | 1 + src/components/results_pane.js | 5 +++-- src/components/uploader/StatusImage.js | 2 ++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b7a06059..ecf4c676 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Because `wdio` wraps `mocha`, you can send `mocha` args via `wdio.default.conf.j 1. Start oam-api: - `oam-api$ docker-compose up` + `oam-api$ docker-compose up` 2. Start chromedriver: diff --git a/src/components/home.js b/src/components/home.js index a3c0bd27..8893b2b4 100644 --- a/src/components/home.js +++ b/src/components/home.js @@ -65,15 +65,31 @@ export default createReactClass({ // The map parameters form the url take precedence over everything else // if they're not present try the cookie. state.map.view = this.getMapViewOrDefault(this.props.params.map); + console.log('state.map.view', state.map.view) state.selectedSquareQuadkey = this.props.params.square_id; state.selectedItemId = this.props.params.image_id; - + console.log('selectedItemId=' + state.selectedItemId) + /* + this.setState({ + map: { + view: this.getMapViewOrDefault(this.props.params.map) + }, + selectedSquareQuadkey: this.props.params.square_id, + selectedItemId: this.props.params.image_id + }) + */ + if (this.props.params.user_id) { mapStore.queryUserImagery(this.props.params.user_id); } + //this.setState(state); + + // TODO: Remove => this is already done in the loadImagery callback (which properly respects + // the async nature of queryUserImagery) state.results = this.getImagery(); + console.log('home results', state.results) this.setState(state); }, diff --git a/src/components/map.js b/src/components/map.js index 01f9fefd..9508429d 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -130,6 +130,7 @@ export default createReactClass({ this.mapGridLayer.on("click", this.onGridSqrClick); // Map position from path. + console.log('this.props.map', this.props.map) var mapString = this.stringToMapView(this.props.map.view); var view = [mapString.lat, mapString.lng]; var zoom = mapString.zoom; diff --git a/src/components/results_pane.js b/src/components/results_pane.js index bcc175d6..ee7bd9bb 100644 --- a/src/components/results_pane.js +++ b/src/components/results_pane.js @@ -29,6 +29,7 @@ export default createReactClass({ i.uuid.includes(this.props.selectedItemId) ); }); + console.log('setupCurrentImage, currentIndex=' + this.currentIndex) this.currentResult = this.props.results[this.currentIndex]; } else { this.currentResult = null; @@ -50,8 +51,8 @@ export default createReactClass({ render: function() { var resultsPane = null; - if (this.props.selectedItemId) { - this.setupCurrentImage(); + this.setupCurrentImage(); + if (this.currentResult) { var pg = { total: this.props.results.length, current: this.currentIndex + 1, diff --git a/src/components/uploader/StatusImage.js b/src/components/uploader/StatusImage.js index d5fdc324..d5fc9af0 100644 --- a/src/components/uploader/StatusImage.js +++ b/src/components/uploader/StatusImage.js @@ -13,6 +13,8 @@ function imageClick(event, metadata) { event.preventDefault(); const modifiedMetdata = Object.assign({}, metadata); modifiedMetdata._id = metadata.uuid.split("/").slice(-1)[0]; + console.log('metadata', metadata) + console.log('extracted id', modifiedMetdata._id) utils.imageUri(modifiedMetdata); }