Skip to content

Commit

Permalink
Create load functions
Browse files Browse the repository at this point in the history
  • Loading branch information
wkramer committed Nov 13, 2024
1 parent fc458ee commit c3ddd82
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/components/download/DataDownloadDisplayComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const options = computed<UseDisplayConfigOptions>(() => {
convertDatum: settings.convertDatum,
}
})
const downloadStartTime = ref<Date>()
const downloadEndTime = ref<Date>()
const timeSeriesFilter = ref<DataDownloadFilter>()
Expand All @@ -194,10 +195,13 @@ const filterId = props.topologyNode.filterIds
? props.topologyNode.filterIds[0]
: undefined
const attributes = props.topologyNode.dataDownloadDisplay?.attributes
const allLocations = ref<Location[]>([])
const allParameters = ref<TimeSeriesParameter[]>([])
const locations = ref<Location[]>([])
const selectedLocations = ref<Location[]>([])
const allParameters = ref<TimeSeriesParameter[]>([])
const parameterQualifiers = ref<ParameterQualifiersHeader[]>([])
const selectedParameterQualifiers = ref<ParameterQualifiersHeader[]>([])
const selectableAttributes = ref<string[][]>([])
Expand Down Expand Up @@ -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 = {
Expand All @@ -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)
Expand Down

0 comments on commit c3ddd82

Please sign in to comment.