Skip to content
Snippets Groups Projects
Commit 468411db authored by Bucknell, Mary S.'s avatar Bucknell, Mary S.
Browse files

Merge branch 'main' of https://code.usgs.gov/wma/iow/waterdataui into wdfn-790

parents cca631c6 41720503
No related branches found
No related tags found
1 merge request!408WDFN-790: Fixed bug with second parameter selection and sites with no IV data.
...@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ...@@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Parameter codes with multiple methods will now show statistical data for each method available. - Parameter codes with multiple methods will now show statistical data for each method available.
- The hydrograph legend and time span shortcuts will now correctly display for calculated temperature parameter codes. - The hydrograph legend and time span shortcuts will now correctly display for calculated temperature parameter codes.
- The DV graph will now have an inverted y-axis for only certain parameter codes. - The DV graph will now have an inverted y-axis for only certain parameter codes.
- When there is no data, title info icon will display appropriate text, rather than being blank.
## [1.2.0](https://code.usgs.gov/wma/iow/waterdataui/~/compare/waterdataui-1.1.0...waterdataui-1.2.0) - 2022-06-10 ## [1.2.0](https://code.usgs.gov/wma/iow/waterdataui/~/compare/waterdataui-1.1.0...waterdataui-1.2.0) - 2022-06-10
### Added ### Added
......
...@@ -12,7 +12,7 @@ import config from 'ui/config.js'; ...@@ -12,7 +12,7 @@ import config from 'ui/config.js';
import uswds_tooltip from 'uswds-components/usa-tooltip/src/index.js'; import uswds_tooltip from 'uswds-components/usa-tooltip/src/index.js';
export const appendInfoTooltip = function(elem, text, position = 'right') { export const appendInfoTooltip = function(elem, text, position = 'right') {
let tooltip = elem.append('div') const tooltip = elem.append('div')
.attr('class', 'usa-tooltip') .attr('class', 'usa-tooltip')
.attr('data-position', position) .attr('data-position', position)
.attr('title', text); .attr('title', text);
...@@ -20,6 +20,6 @@ export const appendInfoTooltip = function(elem, text, position = 'right') { ...@@ -20,6 +20,6 @@ export const appendInfoTooltip = function(elem, text, position = 'right') {
.attr('class', 'usa-icon') .attr('class', 'usa-icon')
.html(`<use xlink:href="${config.STATIC_URL}img/sprite.svg#info"></use>`); .html(`<use xlink:href="${config.STATIC_URL}img/sprite.svg#info"></use>`);
// Need to initialize USWDS tooltip explictly after page load // Need to initialize USWDS tooltip explicitly after page load
uswds_tooltip.on(elem.node()); uswds_tooltip.on(elem.node());
}; };
...@@ -116,25 +116,33 @@ const drawTitle = function(elem, store, siteNo, agencyCode, sitename, showMLName ...@@ -116,25 +116,33 @@ const drawTitle = function(elem, store, siteNo, agencyCode, sitename, showMLName
} }
titleDiv.append('div') titleDiv.append('div')
.attr('class', 'primary-title') .attr('class', 'primary-title')
.call(link(store, (elem, {title, parameter}) => { .call(link(store, (elem, {title, primaryParameter}) => {
elem.html(title); elem.html(title);
if (showTooltip) { if (showTooltip) {
elem.call(appendInfoTooltip, parameter ? parameter.description : 'No description available', 'bottom'); elem.call(
appendInfoTooltip,
primaryParameter ? primaryParameter.description || 'No description available' : '',
'bottom'
);
} }
}, createStructuredSelector({ }, createStructuredSelector({
title: getTitle('primary'), title: getTitle('primary'),
parameter: getPrimaryParameter primaryParameter: getPrimaryParameter
}))); })));
titleDiv.append('div') titleDiv.append('div')
.attr('class', 'secondary-title') .attr('class', 'secondary-title')
.call(link(store, (elem, {title, parameter}) => { .call(link(store, (elem, {title, secondaryParameter}) => {
elem.html(title); elem.html(title);
if (showTooltip && parameter) { if (showTooltip && secondaryParameter) {
elem.call(appendInfoTooltip, parameter ? parameter.description : 'No description available', 'bottom'); elem.call(
appendInfoTooltip,
secondaryParameter ? secondaryParameter.description || 'No description available' : '',
'bottom'
);
} }
}, createStructuredSelector({ }, createStructuredSelector({
title: getTitle('secondary'), title: getTitle('secondary'),
parameter: getIVParameter('secondary') secondaryParameter: getIVParameter('secondary')
}))); })));
}; };
......
...@@ -5,7 +5,8 @@ import * as utils from 'ui/utils'; ...@@ -5,7 +5,8 @@ import * as utils from 'ui/utils';
import {configureStore} from 'ml/store'; import {configureStore} from 'ml/store';
import {setMedianDataVisibility} from 'ml/store/hydrograph-state'; import {setMedianDataVisibility} from 'ml/store/hydrograph-state';
import {TEST_PRIMARY_IV_DATA, TEST_GW_LEVELS, TEST_STATS_DATA, import {
TEST_PRIMARY_IV_DATA, TEST_GW_LEVELS, TEST_STATS_DATA,
TEST_CURRENT_TIME_RANGE TEST_CURRENT_TIME_RANGE
} from './mock-hydrograph-state'; } from './mock-hydrograph-state';
import {drawTimeSeriesGraphData, initializeTimeSeriesGraph} from './time-series-graph'; import {drawTimeSeriesGraphData, initializeTimeSeriesGraph} from './time-series-graph';
...@@ -114,4 +115,32 @@ describe('monitoring-location/components/hydrograph/time-series-graph', () => { ...@@ -114,4 +115,32 @@ describe('monitoring-location/components/hydrograph/time-series-graph', () => {
expect(div.selectAll('.iv-graph-gw-levels-group').html()).not.toEqual(''); expect(div.selectAll('.iv-graph-gw-levels-group').html()).not.toEqual('');
expect(div.selectAll('.median-stats-group').size()).toBe(2); expect(div.selectAll('.median-stats-group').size()).toBe(2);
}); });
it('expects the correct tooltip text when the description is available', () => {
initializeTimeSeriesGraph(div, store, '11112222', 'USGS', 'This site', true, true);
const titleDiv = div.select('.time-series-graph-title');
expect(titleDiv.select('.usa-tooltip').text()).toBe('Depth to water level, feet');
});
it('expects the correct tooltip text when the description is NOT available', () => {
const NO_PARAMETER_DATA = {
parameter: {
parameterCode: '00065'
},
values: {}
};
store = configureStore({
...TEST_STATE,
hydrographData: {
primaryIVData: NO_PARAMETER_DATA
}
});
initializeTimeSeriesGraph(div, store, '11112222', 'USGS', 'This site', true, true);
const titleDiv = div.select('.time-series-graph-title');
expect(titleDiv.select('.usa-tooltip').text()).toBe('No description available');
});
}); });
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
} }
#hydrograph-no-data-overlay { #hydrograph-no-data-overlay {
color: red; pointer-events: none;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment