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

Adjustments to work with the graph server calling the url directly.

parent 6c3fce1d
No related branches found
No related tags found
No related merge requests found
...@@ -19,14 +19,7 @@ const updateNoDataOverlay = function(container, store) { ...@@ -19,14 +19,7 @@ const updateNoDataOverlay = function(container, store) {
.call(link(store, (elem, layout) => { .call(link(store, (elem, layout) => {
elem.style('transform', `translateY(${layout.height / 2}px)`); elem.style('transform', `translateY(${layout.height / 2}px)`);
}, getMainLayout)); }, getMainLayout));
overlayDiv.append('svg') overlayDiv.append('div').text('No data available');
.attr('class', 'usa-icon')
.attr('aria-hidden', 'true')
.attr('focusable', 'false')
.attr('role', 'img')
.append('use')
.attr('xlink:href', `${config.STATIC_URL}/img/sprite.svg#priority_high`);
overlayDiv.append('div').text('No data available during the selected time range');
} }
}; };
......
...@@ -72,6 +72,8 @@ export const attachToNode = function(store, ...@@ -72,6 +72,8 @@ export const attachToNode = function(store,
const initialEndTime = endDT ? const initialEndTime = endDT ?
DateTime.fromISO(endDT, {zone: config.locationTimeZone}).endOf('day').toISO() : null; DateTime.fromISO(endDT, {zone: config.locationTimeZone}).endOf('day').toISO() : null;
const initialLoadCompare = compare === 'true' || compare === true ? true : false; const initialLoadCompare = compare === 'true' || compare === true ? true : false;
const thisShowOnlyGraph = showOnlyGraph === 'true' || showOnlyGraph === true ? true : false;
const thisShowMLName = showMLName === 'true' || showMLName === true ? true : false;
const fetchHydrographDataPromise = store.dispatch(retrieveHydrographData(siteno, { const fetchHydrographDataPromise = store.dispatch(retrieveHydrographData(siteno, {
parameterCode: parameterCode, parameterCode: parameterCode,
period: initialPeriod === 'custom' ? null : initialPeriod, period: initialPeriod === 'custom' ? null : initialPeriod,
...@@ -83,20 +85,20 @@ export const attachToNode = function(store, ...@@ -83,20 +85,20 @@ export const attachToNode = function(store,
// if showing the controls, fetch the parameters // if showing the controls, fetch the parameters
let fetchParametersPromise; let fetchParametersPromise;
if (!showOnlyGraph) { if (!thisShowOnlyGraph) {
fetchParametersPromise = store.dispatch(retrieveHydrographParameters(siteno)); fetchParametersPromise = store.dispatch(retrieveHydrographParameters(siteno));
}
// Initialize all hydrograph state variables if showing the control // Initialize all hydrograph state variables if showing the control
store.dispatch(setSelectedParameterCode(parameterCode)); store.dispatch(setSelectedParameterCode(parameterCode));
store.dispatch(setCompareDataVisibility(initialLoadCompare)); store.dispatch(setCompareDataVisibility(initialLoadCompare));
if (period) { if (period) {
store.dispatch(setSelectedDateRange(period)); store.dispatch(setSelectedDateRange(period));
} else if (startDT && endDT) { } else if (startDT && endDT) {
store.dispatch(setSelectedDateRange('custom')); store.dispatch(setSelectedDateRange('custom'));
store.dispatch(setSelectedCustomDateRange(startDT, endDT)); store.dispatch(setSelectedCustomDateRange(startDT, endDT));
} else { } else {
store.dispatch(setSelectedDateRange('P7D')); store.dispatch(setSelectedDateRange('P7D'));
}
} }
// Fetch waterwatch flood levels // Fetch waterwatch flood levels
...@@ -115,9 +117,9 @@ export const attachToNode = function(store, ...@@ -115,9 +117,9 @@ export const attachToNode = function(store,
showDataIndicators(false, store); showDataIndicators(false, store);
let graphContainer = nodeElem.select('.graph-container'); let graphContainer = nodeElem.select('.graph-container');
graphContainer.call(drawTimeSeriesGraph, store, siteno, agencyCd, sitename, showMLName, !showOnlyGraph); graphContainer.call(drawTimeSeriesGraph, store, siteno, agencyCd, sitename, thisShowMLName, !showOnlyGraph);
if (!showOnlyGraph) { if (!thisShowOnlyGraph) {
graphContainer graphContainer
.call(drawTooltipCursorSlider, store) .call(drawTooltipCursorSlider, store)
.call(drawGraphBrush, store); .call(drawGraphBrush, store);
...@@ -126,7 +128,7 @@ export const attachToNode = function(store, ...@@ -126,7 +128,7 @@ export const attachToNode = function(store,
.classed('ts-legend-controls-container', true) .classed('ts-legend-controls-container', true)
.call(drawTimeSeriesLegend, store); .call(drawTimeSeriesLegend, store);
if (!showOnlyGraph) { if (!thisShowOnlyGraph) {
nodeElem.select('#hydrograph-date-controls-container') nodeElem.select('#hydrograph-date-controls-container')
.call(drawDateRangeControls, store, siteno, initialPeriod, { .call(drawDateRangeControls, store, siteno, initialPeriod, {
start: startDT, start: startDT,
......
...@@ -32,13 +32,15 @@ const load = function() { ...@@ -32,13 +32,15 @@ const load = function() {
} }
}); });
let nodes = document.getElementsByClassName('wdfn-component'); let nodes = document.getElementsByClassName('wdfn-component');
const hashOptions = Object.fromEntries(new window.URLSearchParams(getParamString()));
for (let node of nodes) { for (let node of nodes) {
// If options is specified on the node, expect it to be a JSON string. if (!hashOptions.showOnlyGraph || node.dataset.component === 'hydrograph') {
// Otherwise, use the dataset attributes as the component options. // If options is specified on the node, expect it to be a JSON string.
const options = node.dataset.options ? JSON.parse(node.dataset.options) : node.dataset; // Otherwise, use the dataset attributes as the component options.
const hashOptions = Object.fromEntries(new window.URLSearchParams(getParamString())); const options = node.dataset.options ? JSON.parse(node.dataset.options) : node.dataset;
COMPONENTS[node.dataset.component](store, node, Object.assign({}, options, hashOptions)); COMPONENTS[node.dataset.component](store, node, Object.assign({}, options, hashOptions));
}
} }
window.onresize = function() { window.onresize = function() {
......
...@@ -141,7 +141,15 @@ ...@@ -141,7 +141,15 @@
vertical-align: middle; vertical-align: middle;
height: 100%; height: 100%;
width: 100%; width: 100%;
@include u-font('body', 'xl'); @include at-media('mobile') {
@include u-font('body', 'sm');
}
@include at-media('tablet') {
@include u-font('body', 'xl');
}
@include at-media('desktop') {
@include u-font('body', '3xl');
}
@include u-text('info-dark'); @include u-text('info-dark');
svg: { svg: {
display: inline-block; display: inline-block;
......
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