Skip to content

Commit

Permalink
Merge pull request #2855 from CannonLock/remove-inactive
Browse files Browse the repository at this point in the history
Remove Inactive Sites from Map Display
  • Loading branch information
matyasselmeci authored Jan 4, 2023
2 parents 1736ba3 + 44ef2a9 commit f1b5f73
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/templates/iframe.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,18 @@ will want to adjust the Map.data which populates the select input and legend.
let response = await fetch("/api/resource_group_summary")
let resourceGroupJson = await response.json()
// Filter out inactive resources and resource groups with only inactive resources
let activeResourceGroupJson = Object.entries(resourceGroupJson).reduce((o, [k,v]) => {
let activeResources = v["Resources"]["Resource"].filter(x => x['Active'])
if(activeResources.length){
v["Resources"]["Resource"] = activeResources
o[k] = v
}
return o
}, {})
let sites = {}
Object.entries(resourceGroupJson).forEach(([key, value]) => {
Object.entries(activeResourceGroupJson).forEach(([key, value]) => {
if(value?.Site?.Name in sites){
sites[value?.Site?.Name].addResourceGroup(value)
} else {
Expand Down

0 comments on commit f1b5f73

Please sign in to comment.