From 689d1edd04c189967e810a1a5dc7fea9e23158bc Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Fri, 4 Oct 2024 10:19:33 +0200 Subject: [PATCH 1/7] Fix bug with lineStyle matches in FEWS style string --- src/lib/charts/styles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/charts/styles.ts b/src/lib/charts/styles.ts index 8c0aaaa1d..1bfd9039b 100644 --- a/src/lib/charts/styles.ts +++ b/src/lib/charts/styles.ts @@ -49,7 +49,7 @@ export function cssStyleFromFewsLine(item: { /(?none|solid|dashed|dashdot|dotted)(;(?thick))?/ if (item.lineStyle !== undefined) { const matches = item.lineStyle.match(re) - if (matches?.groups?.lineWidth !== undefined) { + if (matches?.groups?.lineStyle !== undefined) { style = { ...style, ...cssStyleFromFewsLineStyle(matches.groups.lineStyle), From d3fc5fcbff6ca5f02ae554c882493475f5fc252e Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Fri, 4 Oct 2024 10:24:52 +0200 Subject: [PATCH 2/7] Remove needless undefined check --- src/views/TopologyDisplayView.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/TopologyDisplayView.vue b/src/views/TopologyDisplayView.vue index 240add29a..fd3787c04 100644 --- a/src/views/TopologyDisplayView.vue +++ b/src/views/TopologyDisplayView.vue @@ -311,8 +311,8 @@ watchEffect(() => { } // Create the displayTabs for the active node. - if (node === undefined) return displayTabs.value = displayTabsForNode(node, parentNodeIdNodeId) + externalLink.value = node.url }) From d41879931ea898bc3dd98ec2d1f12b10a16dce63 Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Fri, 8 Nov 2024 14:41:13 +0100 Subject: [PATCH 3/7] Reduce complexity of getAttributeValues --- .../download/DataDownloadDisplayComponent.vue | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/components/download/DataDownloadDisplayComponent.vue b/src/components/download/DataDownloadDisplayComponent.vue index 3f5203e20..cddb62cc7 100644 --- a/src/components/download/DataDownloadDisplayComponent.vue +++ b/src/components/download/DataDownloadDisplayComponent.vue @@ -482,26 +482,25 @@ async function getLocations(): Promise { } function getAttributeValues(locations: Location[]): string[][] { - const attributeValuesMap: string[][] = [] - const configuredAttributeIds = - props.topologyNode.dataDownloadDisplay?.attributes.map((item) => item.id) - configuredAttributeIds?.forEach((item) => attributeValuesMap.push([])) - if (configuredAttributeIds === undefined) return attributeValuesMap - for (const newLocation of locations) { - let attributes = newLocation.attributes - if (attributes == undefined) continue - for (let i = 0; i < attributes.length; i++) { - const attribute = attributes[i] - if (attribute.id === undefined) continue - if (attribute.value === undefined) continue - const arrayForAttribute = - attributeValuesMap[configuredAttributeIds.indexOf(attribute.id)] - if (!arrayForAttribute.includes(attribute.value)) { - arrayForAttribute.push(attribute.value) + const attributes = props.topologyNode.dataDownloadDisplay?.attributes + if (!attributes) return [] + + const attributeValuesMap: string[][] = attributes.map(() => []) + + locations.forEach((location) => { + location.attributes?.forEach((attribute) => { + const index = attributes.findIndex((attr) => attr.id === attribute.id) + if ( + index !== -1 && + attribute.value && + !attributeValuesMap[index].includes(attribute.value) + ) { + attributeValuesMap[index].push(attribute.value) } - } - } - attributeValuesMap.forEach((value, key) => value.sort()) + }) + }) + + attributeValuesMap.forEach((values) => values.sort()) return attributeValuesMap } From 544839fb88efc7c312941b9c5d083cdf3d492937 Mon Sep 17 00:00:00 2001 From: Werner Kramer Date: Fri, 8 Nov 2024 14:46:10 +0100 Subject: [PATCH 4/7] Move loading methods to onMounted method --- .../download/DataDownloadDisplayComponent.vue | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/src/components/download/DataDownloadDisplayComponent.vue b/src/components/download/DataDownloadDisplayComponent.vue index cddb62cc7..bfc7f702f 100644 --- a/src/components/download/DataDownloadDisplayComponent.vue +++ b/src/components/download/DataDownloadDisplayComponent.vue @@ -143,7 +143,7 @@