From c3ddd827be0dbebf9545c6ae41878ef7a424eb92 Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Fri, 8 Nov 2024 15:01:59 +0100 Subject: [PATCH] Create load functions --- .../download/DataDownloadDisplayComponent.vue | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/download/DataDownloadDisplayComponent.vue b/src/components/download/DataDownloadDisplayComponent.vue index bfc7f702f..cb24c175a 100644 --- a/src/components/download/DataDownloadDisplayComponent.vue +++ b/src/components/download/DataDownloadDisplayComponent.vue @@ -181,6 +181,7 @@ const options = computed(() => { convertDatum: settings.convertDatum, } }) + const downloadStartTime = ref() const downloadEndTime = ref() const timeSeriesFilter = ref() @@ -194,10 +195,13 @@ const filterId = props.topologyNode.filterIds ? props.topologyNode.filterIds[0] : undefined const attributes = props.topologyNode.dataDownloadDisplay?.attributes + const allLocations = ref([]) -const allParameters = ref([]) const locations = ref([]) const selectedLocations = ref([]) + +const allParameters = ref([]) + const parameterQualifiers = ref([]) const selectedParameterQualifiers = ref([]) const selectableAttributes = ref([]) @@ -227,14 +231,27 @@ const rules = { } onMounted(async () => { + loadLocations() + loadParameters() + loadTimeSeriesHeaders() + if (attributes) { + selectedAttributes.value = attributes.map(() => []) + } +}) + +async function loadLocations() { const locationsResponse = await getLocations() allLocations.value = locationsResponse locations.value = locationsResponse selectedLocations.value = locationsResponse selectableAttributes.value = getAttributeValues(locationsResponse) +} +async function loadParameters() { allParameters.value = await getParameters() +} +async function loadTimeSeriesHeaders() { const headersResponse = await getTimeSeriesHeaders() headersResponse?.forEach((timeSeriesResult) => { const parameterQualifiersHeader: ParameterQualifiersHeader = { @@ -245,10 +262,7 @@ onMounted(async () => { }) parameterQualifiers.value = uniqWith(parameterQualifiersHeaders, isEqual) selectedParameterQualifiers.value = parameterQualifiers.value - if (attributes) { - selectedAttributes.value = attributes.map(() => []) - } -}) +} watch(startDateString, (newValue) => { let newDateTime: DateTimeMaybeValid = DateTime.fromFormat(newValue, DATE_FMT)