Show pool map in planning workbench when signal is selected

This commit is contained in:
Eli Ribble 2026-03-20 22:47:03 +00:00
parent 931ea00e22
commit ddc63bfa91
No known key found for this signature in database
4 changed files with 68 additions and 35 deletions

View file

@ -2,32 +2,23 @@ package sync
import (
"context"
"fmt"
"html/template"
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
"github.com/Gleipnir-Technology/nidus-sync/config"
"github.com/Gleipnir-Technology/nidus-sync/html"
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
"github.com/Gleipnir-Technology/nidus-sync/platform"
"github.com/rs/zerolog/log"
//"github.com/rs/zerolog/log"
)
type contentPlanningRoot struct {
ArcgisAccessToken string
URLTiles template.HTMLAttr
}
func getPlanningRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentPlanningRoot], *nhttp.ErrorWithStatus) {
var oauth_token *models.ArcgisOauthToken
var err error
var access_token string
oauth_token, err = platform.GetOAuthForOrg(ctx, user.Organization)
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/planning-root.html", contentPlanningRoot{
ArcgisAccessToken: access_token,
URLTiles: template.HTMLAttr(fmt.Sprintf(`url-tiles="%s"`, config.MakeURLNidus("/api/tile/{z}/{y}/{x}"))),
}), nil
}

View file

@ -7,34 +7,20 @@ import (
"net/http"
"github.com/Gleipnir-Technology/nidus-sync/config"
"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/Gleipnir-Technology/nidus-sync/platform"
"github.com/rs/zerolog/log"
//"github.com/rs/zerolog/log"
)
type contentReviewPool struct {
ArcgisAccessToken string
URLTiles template.HTMLAttr
URLTiles template.HTMLAttr
}
type contentReviewRoot struct{}
func getReviewPool(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentReviewPool], *nhttp.ErrorWithStatus) {
var oauth_token *models.ArcgisOauthToken
var err error
var access_token string
oauth_token, err = platform.GetOAuthForOrg(ctx, user.Organization)
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,
URLTiles: template.HTMLAttr(fmt.Sprintf(`url-tiles="%s"`, config.MakeURLNidus("/api/tile/{z}/{y}/{x}"))),
URLTiles: template.HTMLAttr(fmt.Sprintf(`url-tiles="%s"`, config.MakeURLNidus("/api/tile/{z}/{y}/{x}"))),
}), nil
}
func getReviewRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentReviewRoot], *nhttp.ErrorWithStatus) {