Skip to content

Commit

Permalink
improve geomap display
Browse files Browse the repository at this point in the history
  • Loading branch information
notandy committed Nov 30, 2023
1 parent 679949f commit 17e1128
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions internal/controller/geomap.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ func (c GeoMapController) GetGeomaps(params geographic_maps.GetGeomapsParams) mi
if err := rows.StructScan(&geoMap); err != nil {
panic(err)
}
if err := PopulateGeoMapAssignments(c.db, &geoMap); err != nil {
panic(err)
}
_geoMaps = append(_geoMaps, &geoMap)
}

Expand Down Expand Up @@ -185,3 +188,13 @@ func (c GeoMapController) DeleteGeomapsGeoMapID(params geographic_maps.DeleteGeo
}
return geographic_maps.NewDeleteGeomapsGeomapIDNoContent()
}

// PopulateDomainPools populates a domain instance with associated pools
func PopulateGeoMapAssignments(db *sqlx.DB, geomap *models.Geomap) error {
// Get pool_ids associated
sql := db.Rebind(`SELECT datacenter, country FROM geographic_map_assignment WHERE geographic_map_id = ?`)
if err := db.Select(&geomap.Assignments, sql, geomap.ID); err != nil {
return err
}
return nil
}
2 changes: 1 addition & 1 deletion internal/driver/akamai/geomap.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (s *AkamaiAgent) FetchAndSyncGeomaps(geomaps []string, force bool) error {
PageNumber: 0,
ResultPerPage: 1,
FullyPopulated: true,
Pending: geomaps == nil,
Pending: geomaps == nil && !force,
Ids: geomaps,
})
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/GeographicMaps/GeographicMapList.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ const GeographicMapList = () => {
/>
</Stack>
{isSuccess ? (
<DataGrid columns={7}>
<DataGrid columns={8}>
<DataGridRow>
<DataGridHeadCell>ID/Name</DataGridHeadCell>
<DataGridHeadCell>#Assignments</DataGridHeadCell>
<DataGridHeadCell>Scope</DataGridHeadCell>
<DataGridHeadCell>Provider</DataGridHeadCell>
<DataGridHeadCell>Created</DataGridHeadCell>
Expand Down
1 change: 1 addition & 0 deletions web/src/components/GeographicMaps/GeographicMapListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const GeographicMapListItem = ({geomap, setError}) => {
<DataGridCell>
<ListItemSpinner data={geomap} />
</DataGridCell>
<DataGridCell>{geomap.assignments.length}</DataGridCell>
<DataGridCell>{geomap.scope}</DataGridCell>
<DataGridCell>{geomap.provider}</DataGridCell>
<DataGridCell>{createdAt}</DataGridCell>
Expand Down

0 comments on commit 17e1128

Please sign in to comment.