Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display subbasin results view via water quality tab link #2744

Merged
merged 2 commits into from
Apr 5, 2018

Conversation

kellyi
Copy link
Contributor

@kellyi kellyi commented Mar 28, 2018

Overview

This PR adds a link to MapShed water quality results for valid WKAOIs to kick off subbasin modeling, along with a new panel which will be used to display subbasin results in #2650.

In this PR we don't add the subbasin results to the new scenario/results/collection, but just log to the console that it's succeeded. However, we do keep the old mapshed results around to afford not having them replaced by the incoming subbasin results.

Connects #2647

Demo

screen shot 2018-04-02 at 6 33 50 pm

screen shot 2018-04-02 at 6 33 58 pm

... and meanwhile, in the console ...

screen shot 2018-04-02 at 6 27 55 pm

Testing

  • get branch, rebuild, etc
  • try modeling a non-subbasin-valid-aoi and verify that you don't see the new link
  • model a HUC 8 or HUC 10 and verify that you do see the new link, then check that clicking it shows the new view and also commences subbasin modeling, which will be logged to the console and show the correct result from its last network request

@kellyi kellyi force-pushed the ki/add-hotspot-view-toggle branch 6 times, most recently from 3be522b to cae4d61 Compare April 2, 2018 22:25
@kellyi kellyi requested a review from arottersman April 2, 2018 22:35
@kellyi kellyi force-pushed the ki/add-hotspot-view-toggle branch from cae4d61 to f47b8ca Compare April 2, 2018 22:39
@kellyi kellyi changed the title WIP: Display subbasin results view via wq tab link Display subbasin results view via water quality tab link Apr 2, 2018
@arottersman
Copy link

Testing this out now!

Copy link

@arottersman arottersman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working this all out!

The most important things from the attached comments are:

  1. the undefined model error when clicking the subbasin button
  2. "Exit subbasin mode" taking you back to hydrology instead of water quality.

As a complete aside, the way you wired up the subbasin view toggling seems to be more akin to our react projects (passing a function bound to a parent view down the child views). This isn't a bad thing at all, but it might be worth noting some other ways MMW has accomplished the same thing:

  • Similar to your implementation, listen in the parent for bubbled up method triggers. We do this in the modals, layer selector and some BiG-CZ views. It's kind of weird.
  • Add a model to ResultsDetailsView that has an attribute if it's showing the primary results or the secondary (subbasin) results. Put the model on another accessible model like the active scenario, or pass the model as an option down.

},

viewSubbasinResults: function() {
this.options.showSubbasinHotSpotView();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider putting the function on this in initialize with the other options so its clear at a glance what options the view takes.

this.showHydrologyAndWaterQualityResults();
},

showHydrologyAndWaterQualityResults: function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming to showPrimaryTabResults or something more generic. TR-55 has Runoff and Water Quality results, so we shouldn't make reference to Hydrology.


this.subbasinRegion.show(new gwlfeSubbasinViews.ResultView({
hideSubbasinHotSpotView: this.hideSubbasinHotSpotView,
model: this.collection.findWhere({ name: 'subbasin' }),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first time this button is clicked, the subbasin model hasn't run yet, so the model will be undefined in the result view and break.

screen shot 2018-04-03 at 12 38 10 pm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch -- I removed the mock subbasin model (the stray "remove this" comment was supposed to go with it) since we currently don't persist the results.


showSubbasinHotSpotView: function() {
this.panelsRegion.empty();
this.contentRegion.empty();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you click Exit subbasin attenuated results you should go back to the Water Quality view, not Hydrology. Is there a way to preserve the view or at the least the Water Quality active state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Sounds good. I'll adjust this.

this.subbasinRegion.empty();
this.showHydrologyAndWaterQualityResults();

return this;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to return this in all these functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary but if I remember correctly it's semi-common practice in Backbone/Marionette views which allows one to chain method calls together.

However, I don't think we really chain these now so I can remove.


// TODO: remove this!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep -- this was an artifact of setting up a subbasin model and including it in the other results. Removed the result but apparently forgot this one.

@kellyi
Copy link
Contributor Author

kellyi commented Apr 3, 2018

Pushed fixups to address most of the comments above. Still to come is starting on the water quality tab on clicking back from subbasin. As best I can tell the state of what tab we're on isn't really tracked anywhere except by adjusting an .active class from tab to tab and li to li in the UI? Are we storing it somewhere else?

@arottersman
Copy link

Are we storing it somewhere else?

I don't think so. The tabs all manage their own business. Perhaps it is finally time for it to be a modal?

@kellyi
Copy link
Contributor Author

kellyi commented Apr 4, 2018

6f34ce9 fixes the water quality thing by replacing the .empty calls with .hide and .show -- which means the elements stick around on the DOM along with their state but aren't visible when the hotspot region is.

I noticed that due to something, I think, in the task model, it appears that polling will start on the main mapshed views at the point that the calculating results step starts with subbasin. Not sure what to do with this but I'm inclined to treat it as part of #2650 since I believe it'll require figuring out the exact task model for subbbasin.

Kelly Innes added 2 commits April 5, 2018 11:04
- enable displaying subbasin results view via a link on the water
quality tab
- empty subbasin view and return to hydrology/water quality tab view
on clicking subbasin back button
- add mock subbasin result to collection temporarily
- display subbasin panel and retrieve (but do not yet display) subbasin
results on clicking the link for valid WKAOIs from the water quality tab
@kellyi kellyi force-pushed the ki/add-hotspot-view-toggle branch from 6f34ce9 to bb2a080 Compare April 5, 2018 15:07
@kellyi
Copy link
Contributor Author

kellyi commented Apr 5, 2018

Made an adjustment to only set the polling state true if we're in a non-subbasin task model. Also squashed and rebased on develop. @arottersman and I discussed designing the subbasin task/scenario/results models as part of a revised and larger version of #2650.

Copy link

@arottersman arottersman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Kelly!

@arottersman arottersman assigned kellyi and unassigned arottersman Apr 5, 2018
@kellyi
Copy link
Contributor Author

kellyi commented Apr 5, 2018

Thanks for your help with this!

@kellyi kellyi merged commit 9a2f7e9 into develop Apr 5, 2018
@kellyi kellyi deleted the ki/add-hotspot-view-toggle branch April 5, 2018 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants