Skip to content

Commit

Permalink
Disable Monitor, Model tabs outside of CONUS
Browse files Browse the repository at this point in the history
Closes #3649
  • Loading branch information
rajadain committed Nov 2, 2024
1 parent 2e329f1 commit 9ef6faf
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 36 deletions.
80 changes: 51 additions & 29 deletions src/mmw/js/src/analyze/templates/resultsWindow.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,62 @@
<div role="tabpanel" id="analyze-tab-contents"
class="tab-pane analyze-stage-results-tab-pane"></div>
<div role="tabpanel" id="monitor-tab-contents"
class="tab-pane analyze-stage-monitor-tab-pane"></div>
class="tab-pane analyze-stage-monitor-tab-pane">
{% if not isInConus %}
<div class="output-tabs-wrapper">
<div class="tab-content">
<h3 style="margin: 12px 0">Monitoring Unavailable</h3>
<p>
Monitoring is only available within the Continental United States.
To monitor a watershed, please change the area of interest to be
contained within the Continental United States.
</p>
</div>
</div>
{% endif %}
</div>
<div role="tabpanel" id="model-tab-contents"
class="tab-pane analyze-stage-model-tab-pane">
<div class="output-tabs-wrapper">
<div class="tab-content">
<h3>Select a Model</h3>
<p>
Chose one of two models to simulate stormwater runoff
and water quality, to create different conservation and
development scenarios, and to compare human impacts of
these scenarios.
</p>
{% for model_package in model_packages %}
<div class="model-package">
{% if model_package.disabled %}
<a href="#" data-id="{{ model_package.name }}"
class="analyze-model-package-link disabled"
>
{{ model_package.display_name }}
(Coming Soon)
</a>
{% else %}
<a href="#" data-id="{{ model_package.name }}"
class="analyze-model-package-link"
>
<div class="analyze-model-name">
{% if isInConus %}
<h3>Select a Model</h3>
<p>
Chose one of two models to simulate stormwater runoff
and water quality, to create different conservation and
development scenarios, and to compare human impacts of
these scenarios.
</p>
{% for model_package in model_packages %}
<div class="model-package">
{% if model_package.disabled %}
<a href="#" data-id="{{ model_package.name }}"
class="analyze-model-package-link disabled"
>
{{ model_package.display_name }}
</div>
<p>{{ model_package.description }}</p>
</a>
{% endif %}
</div>
{% endfor %}
<hr />
(Coming Soon)
</a>
{% else %}
<a href="#" data-id="{{ model_package.name }}"
class="analyze-model-package-link"
>
<div class="analyze-model-name">
{{ model_package.display_name }}
</div>
<p>{{ model_package.description }}</p>
</a>
{% endif %}
</div>
{% endfor %}
<hr />
{% else %}
<h3 style="margin: 12px 0">Modeling Unavailable</h3>
<p>
Modeling is only available within the Continental United States.
To model a watershed, please change the area of interest to be
contained within the Continental United States.
</p>
{% endif %}
<div id="worksheet-export-region"></div>
</div>
</div>
Expand Down
26 changes: 19 additions & 7 deletions src/mmw/js/src/analyze/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,25 @@ var ResultsView = Marionette.LayoutView.extend({
worksheetRegion: '#worksheet-export-region',
},

templateHelpers: {
'data_catalog_enabled': settings.get('data_catalog_enabled'),
'model_packages': settings.get('model_packages'),
templateHelpers: function() {
return {
'data_catalog_enabled': settings.get('data_catalog_enabled'),
'model_packages': settings.get('model_packages'),
'isInConus': this.isInConus,
};
},

initialize: function() {
this.isInConus = utils.isInConus(App.map.get('areaOfInterest'));
},

onShow: function() {
this.showAoiRegion();
this.showDetailsRegion();
this.showWorksheetExportRegion();

if (this.isInConus) {
this.showWorksheetExportRegion();
}
},

onRender: function() {
Expand All @@ -110,9 +120,11 @@ var ResultsView = Marionette.LayoutView.extend({
collection: this.collection
}));

this.monitorRegion.show(new dataCatalogViews.DataCatalogWindow(
App.getDataCatalog()
));
if (this.isInConus) {
this.monitorRegion.show(new dataCatalogViews.DataCatalogWindow(
App.getDataCatalog()
));
}
},

showWorksheetExportRegion: function() {
Expand Down
6 changes: 6 additions & 0 deletions src/mmw/js/src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,12 @@ var utils = {
return this._containedIn(DRWI_SIMPLE_PERIMETER, geom);
}),

isInConus: _.memoize(function(geom) {
var CONUS = settings.get('conus_perimeter');

return this._containedIn(CONUS, geom);
}),

// Calculates a range from 0 to the upper bound
// of the order of magnitde of the value. Returns
// an object containing min and max.
Expand Down

0 comments on commit 9ef6faf

Please sign in to comment.