Skip to content

feat: suppression of empty timeseries displays#1945

Open
AntonPetry-Hydrotec wants to merge 4 commits into
Deltares:mainfrom
AntonPetry-Hydrotec:1765-hydrotec-suppression-of-empty-timeseries-displays
Open

feat: suppression of empty timeseries displays#1945
AntonPetry-Hydrotec wants to merge 4 commits into
Deltares:mainfrom
AntonPetry-Hydrotec:1765-hydrotec-suppression-of-empty-timeseries-displays

Conversation

@AntonPetry-Hydrotec
Copy link
Copy Markdown

@AntonPetry-Hydrotec AntonPetry-Hydrotec commented Apr 15, 2026

close #1765

@AntonPetry-Hydrotec AntonPetry-Hydrotec force-pushed the 1765-hydrotec-suppression-of-empty-timeseries-displays branch from c07b316 to a936503 Compare April 15, 2026 08:59
@AntonPetry-Hydrotec AntonPetry-Hydrotec changed the title 1765 hydrotec suppression of empty timeseries displays feat: suppression of empty timeseries displays Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements configurable suppression of time series chart/table panels for locations that should not show time series content (e.g., “external gauges”), addressing issue #1765 in the spatial/topology time series display flow.

Changes:

  • Extends chart/component settings typings to support a per-location enable/disable attribute for the time series chart and table.
  • Passes the selected Location object down into the time series window so it can evaluate location attributes.
  • Requests location attributes from the locations service when the new settings are configured, enabling attribute-driven UI suppression.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/topology/componentSettings/settings.ts Adjusts ComponentSettings typing to use the locally-extended ChartsSettings.
src/lib/topology/componentSettings/chartSettings.ts Extends ChartsSettings so timeSeriesChart/timeSeriesTable can include locationEnabledAttribute.
src/components/timeseries/TimeSeriesWindowComponent.vue Adds attribute-based logic to hide chart/table display types based on the selected location’s attributes.
src/components/spatialdisplay/SpatialTimeSeriesDisplay.vue Forwards location to the time series window component.
src/components/spatialdisplay/SpatialDisplay.vue Fetches requested location attributes and derives a selectedLocation to drive attribute-based suppression.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +144 to +147
const selectedLocation = computed<Location | undefined>(() => {
if (!props.locationIds) return undefined
const firstId = props.locationIds.split(',')[0]
return locations.value?.find((l) => l.locationId === firstId)
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedLocation is derived from locationIds.split(',')[0], but locationIds can represent multiple selected locations (they’re joined with , when opening the display). Using only the first ID can hide/show chart/table based on the wrong location attributes when multiple locations are selected. Consider basing the enable/disable decision on all selected locations (e.g., any enabled) or tracking the actively clicked location separately.

Suggested change
const selectedLocation = computed<Location | undefined>(() => {
if (!props.locationIds) return undefined
const firstId = props.locationIds.split(',')[0]
return locations.value?.find((l) => l.locationId === firstId)
const selectedLocationIds = computed(() => {
if (!props.locationIds) return []
return props.locationIds
.split(',')
.map((locationId) => locationId.trim())
.filter((locationId) => locationId.length > 0)
})
const selectedLocation = computed<Location | undefined>(() => {
if (selectedLocationIds.value.length !== 1) return undefined
const [selectedLocationId] = selectedLocationIds.value
return locations.value?.find((l) => l.locationId === selectedLocationId)

Copilot uses AI. Check for mistakes.
const elevationChartEnabled =
props.settings.verticalProfileChart.enabled && elevationChartsDefined
const tableEnabled = props.settings.timeSeriesTable.enabled
props.settings.verticalProfileChart.enabled && elevationChartsDefined
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There appears to be trailing whitespace at the end of the elevationChartEnabled line, which will cause prettier --check to fail. Please remove the extra spaces (or run the formatter) so CI formatting checks pass.

Suggested change
props.settings.verticalProfileChart.enabled && elevationChartsDefined
props.settings.verticalProfileChart.enabled && elevationChartsDefined

Copilot uses AI. Check for mistakes.
Comment on lines +175 to +177
if (!attributeId) return settingsEnabled
const attr = props.location?.attributes?.find((a) => a.id === attributeId)
if (attr === undefined) return settingsEnabled
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDisplayEnabled ignores settingsEnabled when an attributeId is configured and the attribute exists. If timeSeriesChart.enabled (or table) is false in settings but the attribute value is anything other than the string 'false', this function returns true and re-enables the display. Consider always honoring settingsEnabled (e.g., short-circuit to false when it’s disabled, or combine the checks with settingsEnabled && ...).

Suggested change
if (!attributeId) return settingsEnabled
const attr = props.location?.attributes?.find((a) => a.id === attributeId)
if (attr === undefined) return settingsEnabled
if (!settingsEnabled) return false
if (!attributeId) return true
const attr = props.location?.attributes?.find((a) => a.id === attributeId)
if (attr === undefined) return true

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check with @bogaardt what is the desired behavior. I think the current implementation is what we discussed.

Copy link
Copy Markdown
Contributor

@TGehrmannHydrotec TGehrmannHydrotec Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know it was possible to select multiple locations. Do you want to discuss or will you come back to us when you decided about the desired behavior for multiple selected locations? Anton and I discussed it today but haven't managed to find a good solution yet.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can CTRL click locations to select multiple.
FEWS can also have parent/child locations. Clicking a parent will select all child locations.
In the Web OC the url/route will have comma separated list of locationIds.

type PiChart = NonNullable<PiChartsSettings['timeSeriesChart']>
type PiTimeSeriesTable = NonNullable<PiChartsSettings['timeSeriesTable']>

export type ChartsSettings = Omit<
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update to "@deltares/fews-pi-requests": "^2.0.1" in the package.json. That should include these type definitions.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating leads to several problems in various files.
The usage of updated ChartsSettings asks for changes in a couple of files and ComponentSettings in even more files because of changed attribute types.
I checked the main and you're still using the old version there aswell if I'm correct.
We're not sure if you're going to update yourself or you want us to do it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will fix this. I had a check an the nicest solution is to fix the issue in OpenAPI specification and regenerate the types in fews-pi-requests library. I will do this early next week.

informationContent?: string | null
filter?: filterActionsFilter | timeSeriesGridActionsFilter
settings: ChartsSettings
location?: Location
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider what is the correct behavior when multiple locations are selected. Currently only the attributes of the first selected location are applied.

Comment on lines +175 to +177
if (!attributeId) return settingsEnabled
const attr = props.location?.attributes?.find((a) => a.id === attributeId)
if (attr === undefined) return settingsEnabled
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check with @bogaardt what is the desired behavior. I think the current implementation is what we discussed.

@wkramer
Copy link
Copy Markdown
Collaborator

wkramer commented Apr 30, 2026

We need another approach due to the multiple locations issue:

Move the getDisplayEnabled function

Move

function getDisplayEnabled(
  settingsEnabled: boolean,
  attributeId: string | undefined,
)

out of the TimeSeriesComponent.vue to SpatialDisplay.vue.

Restore TimeSeriesComponent

We will keep current version (i.e main branch version) of TimeSeriesComponent.vue. This already checks
settings.timeSeriesChart.enabled, settings.verticalProfileChart.enabled, etc.

Use current settings prop

In SpatialDisplay.vue we pass the settings object to SpatialTimeSeriesDisplay -> TimeSeriesComponentWindow -> TimeSeriesComponent.

Update settings.timeSeriesChart.enabled based on selected locations

In SpatialDisplay.vue if settings.timeSeriesChart.locationEnabledAttribute is set, determine for provided locationIds

Update to the getDisplayEnabled function to loop over the locations.

function getDisplayEnabledFromLocationAttributes(
  locations: Location[],
  attributeId: string | undefined,
  default: boolean,
)

If default = false and any location has an attribute

{ attributeId: true }

return true

If default = true and any location has an attribute

{ attributeId: false }

return false.

@TGehrmannHydrotec
Copy link
Copy Markdown
Contributor

I implemented the requested changes, they were pushed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hydrotec: Suppression of empty time series displays

4 participants