diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/index.js b/assets/src/scripts/monitoring-location/components/hydrograph/index.js index 3d0eae1ee710c7d597e4714d5f9d66f33c7fc852..805d64aff602e099578083406569ce97cb3bdae6 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/index.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/index.js @@ -163,8 +163,6 @@ export const attachToNode = function(store, .call(drawGraphControls, store); nodeElem.select('#iv-data-table-container') .call(drawDataTable, store); - nodeElem.select('.provisional-data-alert') - .attr('hidden', null); //TODO: Find out why putting this before drawDataTable causes the tests to not work correctly nodeElem.select('.select-time-series-container') .call(link(store, plotSeriesSelectTable, createStructuredSelector({ @@ -174,7 +172,6 @@ export const attachToNode = function(store, timeSeriesScalesByParmCd: getTimeSeriesScalesByParmCd('current', 'P7D', SPARK_LINE_DIM) }), store)); - renderTimeSeriesUrlParams(store); } } diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/index.spec.js b/assets/src/scripts/monitoring-location/components/hydrograph/index.spec.js index 08d552a686c33efcb6d75b8f6a1ca54abe5ef042..ebb1d15965bd9dd09d320fefb6c9f4789d0ff0fb 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/index.spec.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/index.spec.js @@ -174,7 +174,6 @@ describe('monitoring-location/components/hydrograph module', () => { component.append('div').attr('class', 'loading-indicator-container'); component.append('div').attr('class', 'graph-container'); component.append('div').attr('class', 'select-time-series-container'); - component.append('div').attr('class', 'provisional-data-alert'); component.append('div').attr('id', 'iv-data-table-container'); graphNode = document.getElementById('hydrograph'); diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/legend.spec.js b/assets/src/scripts/monitoring-location/components/hydrograph/legend.spec.js index 05fea7591aa89c24b5b8c787cdeeda4edc56b819..18bdcb3dde7423c03839838c22ae6f55260a3fb3 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/legend.spec.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/legend.spec.js @@ -118,7 +118,6 @@ describe('monitoring-location/components/hydrograph/legend module', () => { component.append('div').attr('class', 'loading-indicator-container'); component.append('div').attr('class', 'graph-container'); component.append('div').attr('class', 'select-time-series-container'); - component.append('div').attr('class', 'provisional-data-alert'); graphNode = document.getElementById('hydrograph'); diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js b/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js index 5913c26d415e25fc465f3e073ba36f3d112c6a11..780b164c3a7106e6838f5bb4e61e0669628c76d3 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js @@ -78,6 +78,10 @@ export const addSparkLine = function(svgSelection, {seriesLineSegments, scales}) } }; +export const addWaterAlertLink = function() { + console.log('add link') +}; + /** * Draws a table with clickable rows of time series parameter codes. Selecting * a row changes the active parameter code. @@ -103,7 +107,7 @@ export const plotSeriesSelectTable = function(elem, return; } - const columnHeaders = [' ', 'Parameter', 'Preview', '#', 'Period of Record']; + const columnHeaders = [' ', 'Parameter', 'Preview', '#', 'Period of Record', 'Subscribe']; const tableContainer = elem.append('div') .attr('id', 'select-time-series'); @@ -167,6 +171,12 @@ export const plotSeriesSelectTable = function(elem, tr.append('td') .style('white-space', 'nowrap') .text(param => `${config.uvPeriodOfRecord[param.parameterCode].begin_date} to ${config.uvPeriodOfRecord[param.parameterCode].end_date}`); + tr.append('td') + .append('a') + .attr('href', param => `${config.WATERALERT_SUBSCRIPTION}/?site_no=${siteno}&parm=${param.parameterCode}`) + .append('button') + .attr('class', 'usa-button usa-button--outline') + .text('WaterAlert'); }); @@ -177,6 +187,10 @@ export const plotSeriesSelectTable = function(elem, const paramCd = d.parameterCode; const lineSegments = lineSegmentsByParmCd[paramCd] ? lineSegmentsByParmCd[paramCd] : []; for (const seriesLineSegments of lineSegments) { + selection.call(addWaterAlertLink, { + seriesLineSegments: seriesLineSegments, + scales: timeSeriesScalesByParmCd[paramCd] + }); selection.call(addSparkLine, { seriesLineSegments: seriesLineSegments, scales: timeSeriesScalesByParmCd[paramCd] diff --git a/assets/src/styles/components/hydrograph/_app.scss b/assets/src/styles/components/hydrograph/_app.scss index dfe344a5451e754a8adbd9098f674a0a71b106ba..a54af328b0efb280524beac89c1410f04ecb2d7e 100644 --- a/assets/src/styles/components/hydrograph/_app.scss +++ b/assets/src/styles/components/hydrograph/_app.scss @@ -77,6 +77,12 @@ font-size: size('body', 'sm'); } + th:last-child { + background-color: color('blue-cool-40'); + color: color('white'); + text-align: center; + } + th, td { background-color: white; } @@ -225,16 +231,6 @@ } } -.provisional-data-alert { - p { - height: 6em; - overflow-y: scroll; - @include at-media('mobile-lg') { - height: 4em; - } - } -} - .pagination { li { display: inline-block; diff --git a/assets/src/styles/pages/_monitoring-location.scss b/assets/src/styles/pages/_monitoring-location.scss index 55482dd1c1d0d9032eb4de9109c04e3aeee0a52e..e986eec22a07f25856b731afd4d2fed4a1713700 100644 --- a/assets/src/styles/pages/_monitoring-location.scss +++ b/assets/src/styles/pages/_monitoring-location.scss @@ -14,7 +14,7 @@ } } -.outside-link { +.provisional-data-statement { @include u-padding-bottom(1); } diff --git a/wdfn-server/config.py b/wdfn-server/config.py index d317687883113c505fe441cd7513a66599d7de52..2dfaa406166f6c9d84be4683f933a340f550f649 100644 --- a/wdfn-server/config.py +++ b/wdfn-server/config.py @@ -53,7 +53,6 @@ NETWORK_ENDPOINT = 'https://labs.waterdata.usgs.gov/api/observations/collections WATERWATCH_ENDPOINT = 'https://waterwatch.usgs.gov/webservices' # WaterAlert -WATERALERT_HOMEPAGE = 'https://maps.waterdata.usgs.gov/mapper/wateralert' WATERALERT_SUBSCRIPTION = 'https://water.usgs.gov/wateralert/subscribe2' # Graph Server diff --git a/wdfn-server/waterdata/templates/base_plain.html b/wdfn-server/waterdata/templates/base_plain.html index bb3f07ca8bc1fbbcaac2a0772644769dd566e55c..fd2dd8690dfe41e70474992f18529ccf37f154de 100644 --- a/wdfn-server/waterdata/templates/base_plain.html +++ b/wdfn-server/waterdata/templates/base_plain.html @@ -42,7 +42,6 @@ 'NETWORK_ENDPOINT': '{{ config.NETWORK_ENDPOINT }}', 'WATERWATCH_ENDPOINT': '{{ config.WATERWATCH_ENDPOINT }}', 'GRAPH_SERVER_ENDPOINT': '{{ config.GRAPH_SERVER_ENDPOINT }}', - 'WATERALERT_ENDPOINT': '{{ config.WATERALERT_ENDPOINT }}', 'WATERALERT_SUBSCRIPTION': '{{ config.WATERALERT_SUBSCRIPTION }}' }; </script> diff --git a/wdfn-server/waterdata/templates/macros/components.html b/wdfn-server/waterdata/templates/macros/components.html index 9ab4c33e0cf6660aedefafe23ba3958186c89ed0..d7d79bd13b8cdd4b85862c21a0f11138e9bc1f0f 100644 --- a/wdfn-server/waterdata/templates/macros/components.html +++ b/wdfn-server/waterdata/templates/macros/components.html @@ -2,9 +2,12 @@ <div class="wdfn-component" data-component="hydrograph" data-siteno="{{ site_no }}" data-latitude="{{ latitude }}" data-longitude="{{ longitude }}"> <div class="loading-indicator-container"></div> <div class="graph-container"></div> - - {% include 'partials/hydrograph_related_links.html' %} - + <div class="provisional-data-statement"> + <p> + <span class="usa-tag">Important</span> + data may be provisional - <a class="usa-link" href="{{ url_for('provisional_data_statement') }}">learn more</a> + </p> + </div> <div class="select-time-series-container"></div> <div class="graph-data usa-accordion"> <h2 class="usa-accordion__heading"> diff --git a/wdfn-server/waterdata/templates/monitoring_location.html b/wdfn-server/waterdata/templates/monitoring_location.html index f5f16baefb1e1946a8aff5742e644d5843ac9322..7d19979279a80f850e7a9a37da4b2e4193bf5be3 100644 --- a/wdfn-server/waterdata/templates/monitoring_location.html +++ b/wdfn-server/waterdata/templates/monitoring_location.html @@ -101,26 +101,6 @@ staticGraphContainer.appendChild(staticGraphImage); } } - - function addWaterAlertLink(siteNumber, paramString) { - // This script creates a link for the WaterAlert service subscription page. - // The subscription page requires a site number and a parameter code to work properly. - // Most of the time we can get the parameter code from the URL or approximate it from the - // uvPeriodOfRecord, but not always. If we can't get a parameter code, we will make a - // link that goes to the WaterAlert homepage. - var href = ''; - var elementTarget = document.getElementById('water-alert-link'); - - if (CONFIG.uvPeriodOfRecord) { - var parameterCode = paramString.split('parameterCode=')[1]; - href = '{{ config.WATERALERT_SUBSCRIPTION }}' + '/?site_no=' + - siteNumber + '&parm=' + parameterCode; - } else { - href = '{{ config.WATERALERT_HOMEPAGE }}'; - } - - elementTarget.setAttribute('href', href); - } </script> {% endblock page_script %} @@ -164,7 +144,12 @@ </div> {% if request.user_agent.browser == 'msie' %} <div id="static-graph-div"></div> - {% include 'partials/hydrograph_related_links.html' %} + <div class="provisional-data-statement"> + <p> + <span class="usa-tag">Important</span> + data may be provisional - <a class="usa-link" href="{{ url_for('provisional_data_statement') }}">learn more</a> + </p> + </div> {% endif %} {% if request.user_agent.browser != 'msie' %} {{ components.TimeSeriesComponent(stations[0].site_no, stations[0].dec_lat_va, stations[0].dec_long_va) }}