diff --git a/html/static/js/map-arcgis-tile.js b/html/static/js/map-arcgis-tile.js index d875428f..b38717ac 100644 --- a/html/static/js/map-arcgis-tile.js +++ b/html/static/js/map-arcgis-tile.js @@ -1,5 +1,6 @@ // A map that can show ArcGIS map tiles class MapArcgisTile extends HTMLElement { + static observedAttributes = ["latitude", "longitude"]; constructor() { super(); @@ -13,6 +14,18 @@ class MapArcgisTile extends HTMLElement { this._markers = []; } + attributeChangedCallback(name, old_value, new_value) { + //console.log("map-arcgis-tile: attribute changed", name, old_value, new_value); + if (name == "latitude" || (name == "longitude" && this._map != null)) { + const latitude = parseFloat(this.getAttribute("latitude")); + const longitude = parseFloat(this.getAttribute("longitude")); + this._map.jumpTo({ + center: [longitude, latitude], + zoom: 19, + }); + } + } + // Lifecycle: when element is added to the DOM connectedCallback() { // Initialize the map when the element is added to the DOM diff --git a/html/template/sync/communication-root.html b/html/template/sync/communication-root.html index 32f9932a..1c1d2045 100644 --- a/html/template/sync/communication-root.html +++ b/html/template/sync/communication-root.html @@ -12,10 +12,6 @@ > - - + + + @@ -484,15 +496,17 @@ -
-
- -

Aerial Pool Image Placeholder

- Captured: - -
+
+ +
diff --git a/sync/review.go b/sync/review.go index d73850e9..7b499c47 100644 --- a/sync/review.go +++ b/sync/review.go @@ -4,16 +4,33 @@ import ( "context" "net/http" + "github.com/Gleipnir-Technology/nidus-sync/background" "github.com/Gleipnir-Technology/nidus-sync/db/models" "github.com/Gleipnir-Technology/nidus-sync/html" nhttp "github.com/Gleipnir-Technology/nidus-sync/http" + "github.com/rs/zerolog/log" ) -type contentReviewPool struct{} +type contentReviewPool struct { + ArcgisAccessToken string +} type contentReviewRoot struct{} -func getReviewPool(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*html.Response[contentReviewRoot], *nhttp.ErrorWithStatus) { - return html.NewResponse("sync/review/pool.html", contentReviewRoot{}), nil +func getReviewPool(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*html.Response[contentReviewPool], *nhttp.ErrorWithStatus) { + var oauth_token *models.ArcgisOauthToken + var err error + var access_token string + oauth_token, err = background.GetOAuthForOrg(ctx, org) + if err != nil { + log.Warn().Err(err).Msg("Failed to get oauth") + oauth_token = nil + access_token = "" + } else { + access_token = oauth_token.AccessToken + } + return html.NewResponse("sync/review/pool.html", contentReviewPool{ + ArcgisAccessToken: access_token, + }), nil } func getReviewRoot(ctx context.Context, r *http.Request, org *models.Organization, user *models.User) (*html.Response[contentReviewRoot], *nhttp.ErrorWithStatus) { return html.NewResponse("sync/review/root.html", contentReviewRoot{}), nil