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
Create hydrology tables #2924
Create hydrology tables #2924
Conversation
74ad1c8
to
f3c004f
Compare
94cae83
to
888c129
Compare
} else { | ||
window.console.warn('TODO: Implement GWLFE Table'); | ||
window.console.log('TODO Implement GWLFE Water Quality table & chart'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Committed this by mistake but I guess it'll be removed semi-immediately anyway.
@@ -201,10 +205,21 @@ var CompareWindow2 = modalViews.ModalBaseView.extend({ | |||
var selected = | |||
activeTab.get('selections').findWhere({ active: true }); | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also committed by mistake, but this function's going to get removed when the water quality work is in.
This looks really good! I noticed that the pagination wasn't working out of the box as I expected, so I looked into the code, and found that extending the existing TableRowView and TableView works just as well, makes pagination work, and is more compact: diff --git a/src/mmw/js/src/compare/views.js b/src/mmw/js/src/compare/views.js
index 780a7634..79195ba4 100644
--- a/src/mmw/js/src/compare/views.js
+++ b/src/mmw/js/src/compare/views.js
@@ -747,32 +747,6 @@ var GWLFEHydrologyChartView = Marionette.CollectionView.extend({
childView: LineChartRowView,
});
-var GWLFEHydrologyTableRowView = Marionette.ItemView.extend({
- models: models.MonthlyTableRowModel,
- className: 'compare-table-row -hydrology',
- template: compareTableRowTmpl,
-
- modelEvents: {
- 'change': 'render',
- },
-
- templateHelpers: function() {
- var selectedAttribute = this.model.get('selectedAttribute');
-
- return {
- values: this.model
- .get('values')
- .map(function(v) {
- return v[selectedAttribute];
- }),
- };
- },
-});
-
-var GWLFEHydrologyTableView = Marionette.CollectionView.extend({
- childView: GWLFEHydrologyTableRowView,
-});
-
var TR55ChartView = Marionette.CollectionView.extend({
childView: BarChartRowView,
@@ -856,6 +830,22 @@ var TableView = Marionette.CollectionView.extend({
}
});
+var GWLFEHydrologyTableRowView = TableRowView.extend({
+ className: 'compare-table-row -hydrology',
+
+ templateHelpers: function() {
+ var selectedAttribute = this.model.get('selectedAttribute');
+
+ return {
+ values: this.model.get('values').pluck(selectedAttribute)
+ };
+ },
+});
+
+var GWLFEHydrologyTableView = TableView.extend({
+ childView: GWLFEHydrologyTableRowView,
+});
+
var CompareWindow = Marionette.LayoutView.extend({
//model: modelingModels.ProjectModel,
I would recommend adding that change and this will be good to merge! Will take care of the other demo stuff in this PR in upcoming Water Quality PRs. |
Sounds good to me. I'm making that change & will amend the existing commit to include it. For whatever reason I've not been able to get |
- use map & reduce to create reformatted GWLFE Hydrology data in a shape to use in the compare view table: each month has its own row, displaying that data from the scenario - conditionally adjust Sass rules to set column opacity to 1.0 in order to circumvent a bug whereby opening the compare view kicks off polling - use `text-align: right` to right-align Current Conditions column header until it's remedied in additional design work - toggle attributes with selection component
888c129
to
a49edd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 tested. Working well. Great job!
Great! Thanks for your help with this! |
Overview
This PR implements the hydrology tables as depicted below. Was able to reuse the the table view from TR55, with the data adjusted to reformat it for GWLFE.
The bulk of the change here is a reduce function to transform the GWLFE data into a shape for display in the tables.
Connects #2915
Demo
Testing Instructions