lint: remove unused code from sync/ package
Deleted 15 entirely-unused files: admin, cell, communication, dash, download, intelligence, messages, mock, notification, operations, parcel, planning, pool, radar, review. Removed unused contentOauthPrompt and getOAuthRefresh from oauth.go.
This commit is contained in:
parent
53a3f9816a
commit
9ce5058e85
16 changed files with 1 additions and 545 deletions
|
|
@ -1,17 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentAdminDash struct{}
|
|
||||||
|
|
||||||
func getAdminDash(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentAdminDash], *nhttp.ErrorWithStatus) {
|
|
||||||
content := contentAdminDash{}
|
|
||||||
return html.NewResponse("sync/admin-dash.html", content), nil
|
|
||||||
}
|
|
||||||
72
sync/cell.go
72
sync/cell.go
|
|
@ -1,72 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
//"github.com/Gleipnir-Technology/nidus-sync/h3utils"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"github.com/uber/h3-go/v4"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentCell struct {
|
|
||||||
BreedingSources []platform.BreedingSourceSummary
|
|
||||||
CellBoundary h3.CellBoundary
|
|
||||||
Inspections []platform.Inspection
|
|
||||||
Traps []platform.TrapSummary
|
|
||||||
Treatments []platform.Treatment
|
|
||||||
}
|
|
||||||
|
|
||||||
func getCellDetails(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentCell], *nhttp.ErrorWithStatus) {
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
cell_str := vars["cell"]
|
|
||||||
if cell_str == "" {
|
|
||||||
return nil, nhttp.NewErrorStatus(http.StatusBadRequest, "There should always be a cell")
|
|
||||||
}
|
|
||||||
c, err := HexToInt64(cell_str)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewErrorStatus(http.StatusBadRequest, "Cannot convert provided cell to uint64")
|
|
||||||
}
|
|
||||||
boundary, err := h3.Cell(c).Boundary()
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get boundary: %w", err)
|
|
||||||
}
|
|
||||||
inspections, err := platform.InspectionsByCell(ctx, user.Organization, h3.Cell(c))
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get inspections by cell: %w", err)
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
center, err := h3.Cell(c).LatLng()
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get center: %w", err)
|
|
||||||
}
|
|
||||||
geojson, err := h3utils.H3ToGeoJSON([]h3.Cell{h3.Cell(c)})
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get boundaries: %w", err)
|
|
||||||
}
|
|
||||||
resolution := h3.Cell(c).Resolution()
|
|
||||||
*/
|
|
||||||
sources, err := platform.BreedingSourcesByCell(ctx, user.Organization, h3.Cell(c))
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get sources: %w", err)
|
|
||||||
}
|
|
||||||
traps, err := platform.TrapsByCell(ctx, user.Organization, h3.Cell(c))
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get traps: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
treatments, err := platform.TreatmentsByCell(ctx, user.Organization, h3.Cell(c))
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get treatments: %w", err)
|
|
||||||
}
|
|
||||||
return html.NewResponse("sync/cell.html", contentCell{
|
|
||||||
BreedingSources: sources,
|
|
||||||
CellBoundary: boundary,
|
|
||||||
Inspections: inspections,
|
|
||||||
Traps: traps,
|
|
||||||
Treatments: treatments,
|
|
||||||
}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentCommunicationRoot struct{}
|
|
||||||
|
|
||||||
func getCommunicationRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentCommunicationRoot], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/communication-root.html", contentCommunicationRoot{}), nil
|
|
||||||
}
|
|
||||||
112
sync/dash.go
112
sync/dash.go
|
|
@ -1,112 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentSource struct {
|
|
||||||
Inspections []platform.Inspection
|
|
||||||
Source *platform.BreedingSourceDetail
|
|
||||||
Traps []platform.TrapNearby
|
|
||||||
Treatments []platform.Treatment
|
|
||||||
//TreatmentCadence TreatmentCadence
|
|
||||||
TreatmentModels []platform.TreatmentModel
|
|
||||||
User platform.User
|
|
||||||
}
|
|
||||||
type contentTrap struct {
|
|
||||||
Trap platform.Trap
|
|
||||||
User platform.User
|
|
||||||
}
|
|
||||||
type contentLayoutTest struct {
|
|
||||||
User platform.User
|
|
||||||
}
|
|
||||||
type ContentDistrict struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func getLayoutTest(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentLayoutTest], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/layout-test.html", contentLayoutTest{}), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getRoot(w http.ResponseWriter, r *http.Request) {
|
|
||||||
html.RenderOrError(w, "static/gen/main.html", struct{}{})
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSource(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentSource], *nhttp.ErrorWithStatus) {
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
globalid_s := vars["globalid"]
|
|
||||||
if globalid_s == "" {
|
|
||||||
return nil, nhttp.NewError("No globalid provided: %w", nil)
|
|
||||||
}
|
|
||||||
globalid, err := uuid.Parse(globalid_s)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("globalid is not a UUID: %w", nil)
|
|
||||||
}
|
|
||||||
s, err := platform.SourceByGlobalID(ctx, user.Organization, globalid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get source: %w", err)
|
|
||||||
}
|
|
||||||
inspections, err := platform.InspectionsBySource(ctx, user.Organization, globalid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get inspections: %w", err)
|
|
||||||
}
|
|
||||||
traps, err := platform.TrapsBySource(ctx, user.Organization, globalid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get traps: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
treatments, err := platform.TreatmentsBySource(ctx, user.Organization, globalid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get treatments: %w", err)
|
|
||||||
}
|
|
||||||
treatment_models := platform.ModelTreatment(treatments)
|
|
||||||
data := contentSource{
|
|
||||||
Inspections: inspections,
|
|
||||||
Source: s,
|
|
||||||
Traps: traps,
|
|
||||||
Treatments: treatments,
|
|
||||||
TreatmentModels: treatment_models,
|
|
||||||
User: user,
|
|
||||||
}
|
|
||||||
|
|
||||||
return html.NewResponse("sync/source.html", data), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTrap(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentTrap], *nhttp.ErrorWithStatus) {
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
globalid_s := vars["globalid"]
|
|
||||||
if globalid_s == "" {
|
|
||||||
return nil, nhttp.NewError("No globalid provided: %w", nil)
|
|
||||||
}
|
|
||||||
globalid, err := uuid.Parse(globalid_s)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("globalid is not a UUID: %w", nil)
|
|
||||||
}
|
|
||||||
t, err := platform.TrapByGlobalId(ctx, user.Organization, globalid)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get trap: %w", err)
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
latlng, err := t.H3Cell.LatLng()
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get latlng: %w", err)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
data := contentTrap{
|
|
||||||
Trap: *t,
|
|
||||||
User: user,
|
|
||||||
}
|
|
||||||
return html.NewResponse("sync/trap.html", data), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func source(w http.ResponseWriter, r *http.Request, user platform.User, id uuid.UUID) {
|
|
||||||
}
|
|
||||||
|
|
||||||
func trap(w http.ResponseWriter, r *http.Request, user platform.User, id uuid.UUID) {
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentDownloadPlaceholder struct{}
|
|
||||||
|
|
||||||
func getDownloadList(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentDownloadPlaceholder], *nhttp.ErrorWithStatus) {
|
|
||||||
content := contentDownloadPlaceholder{}
|
|
||||||
return html.NewResponse("sync/download-list.html", content), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentIntelligenceRoot struct{}
|
|
||||||
|
|
||||||
func getIntelligenceRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentIntelligenceRoot], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/intelligence-root.html", contentIntelligenceRoot{}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentMessageList struct{}
|
|
||||||
|
|
||||||
func getMessageList(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentMessageList], *nhttp.ErrorWithStatus) {
|
|
||||||
content := contentMessageList{}
|
|
||||||
return html.NewResponse("sync/message-list.html", content), nil
|
|
||||||
}
|
|
||||||
105
sync/mock.go
105
sync/mock.go
|
|
@ -1,105 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
"net/http"
|
|
||||||
//"github.com/rs/zerolog/log"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Unauthenticated pages
|
|
||||||
/*
|
|
||||||
admin = buildTemplate("admin", "base")
|
|
||||||
dataEntry = buildTemplate("data-entry", "base")
|
|
||||||
dataEntryBad = buildTemplate("data-entry-bad", "base")
|
|
||||||
dispatch = buildTemplate("dispatch", "base")
|
|
||||||
dispatchResults = buildTemplate("dispatch-results", "base")
|
|
||||||
mockRoot = buildTemplate("mock-root", "base")
|
|
||||||
reportPage = buildTemplate("report", "base")
|
|
||||||
reportConfirmation = buildTemplate("report-confirmation", "base")
|
|
||||||
reportContribute = buildTemplate("report-contribute", "base")
|
|
||||||
reportDetail = buildTemplate("report-detail", "base")
|
|
||||||
reportEvidence = buildTemplate("report-evidence", "base")
|
|
||||||
reportSchedule = buildTemplate("report-schedule", "base")
|
|
||||||
reportUpdate = buildTemplate("report-update", "base")
|
|
||||||
serviceRequest = buildTemplate("service-request", "base")
|
|
||||||
serviceRequestDetail = buildTemplate("service-request-detail", "base")
|
|
||||||
serviceRequestLocation = buildTemplate("service-request-location", "base")
|
|
||||||
serviceRequestMosquito = buildTemplate("service-request-mosquito", "base")
|
|
||||||
serviceRequestPool = buildTemplate("service-request-pool", "base")
|
|
||||||
serviceRequestQuick = buildTemplate("service-request-quick", "base")
|
|
||||||
serviceRequestQuickConfirmation = buildTemplate("service-request-quick-confirmation", "base")
|
|
||||||
serviceRequestUpdates = buildTemplate("service-request-updates", "base")
|
|
||||||
settingRoot = buildTemplate("setting-mock", "base")
|
|
||||||
settingPesticide = buildTemplate("setting-pesticide", "base")
|
|
||||||
settingPesticideAdd = buildTemplate("setting-pesticide-add", "base")
|
|
||||||
settingUsers = buildTemplate("setting-user", "base")
|
|
||||||
settingUsersAdd = buildTemplate("setting-user-add", "base")
|
|
||||||
*/
|
|
||||||
|
|
||||||
type mock struct {
|
|
||||||
Path string
|
|
||||||
template string
|
|
||||||
}
|
|
||||||
|
|
||||||
var mocks = []mock{}
|
|
||||||
|
|
||||||
func addMock(r *mux.Router, path string, template string) {
|
|
||||||
mocks = append(mocks, mock{
|
|
||||||
Path: path,
|
|
||||||
template: template,
|
|
||||||
})
|
|
||||||
r.HandleFunc(path, renderMock(template))
|
|
||||||
}
|
|
||||||
|
|
||||||
type contentMock struct {
|
|
||||||
Config html.ContentConfig
|
|
||||||
DistrictName string
|
|
||||||
URLs ContentMockURLs
|
|
||||||
}
|
|
||||||
|
|
||||||
func renderMock(template_name string) http.HandlerFunc {
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
|
||||||
vars := mux.Vars(r)
|
|
||||||
code := vars["code"]
|
|
||||||
if code == "" {
|
|
||||||
code = "abc-123"
|
|
||||||
}
|
|
||||||
data := contentMock{
|
|
||||||
Config: html.NewContentConfig(),
|
|
||||||
DistrictName: "Delta MVCD",
|
|
||||||
URLs: ContentMockURLs{
|
|
||||||
Dispatch: "/mock/dispatch",
|
|
||||||
DispatchResults: "/mock/dispatch-results",
|
|
||||||
ReportConfirmation: fmt.Sprintf("/mock/report/%s/confirm", code),
|
|
||||||
ReportDetail: fmt.Sprintf("/mock/report/%s", code),
|
|
||||||
ReportContribute: fmt.Sprintf("/mock/report/%s/contribute", code),
|
|
||||||
ReportEvidence: fmt.Sprintf("/mock/report/%s/evidence", code),
|
|
||||||
ReportSchedule: fmt.Sprintf("/mock/report/%s/schedule", code),
|
|
||||||
ReportUpdate: fmt.Sprintf("/mock/report/%s/update", code),
|
|
||||||
Root: "/mock",
|
|
||||||
Setting: "/mock/setting",
|
|
||||||
SettingIntegration: "/mock/setting/integration",
|
|
||||||
SettingPesticide: "/mock/setting/pesticide",
|
|
||||||
SettingPesticideAdd: "/mock/setting/pesticide/add",
|
|
||||||
SettingUser: "/mock/setting/user",
|
|
||||||
SettingUserAdd: "/mock/setting/user/add",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
html.RenderOrError(w, template_name, data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type contentMockList struct {
|
|
||||||
Config html.ContentConfig
|
|
||||||
Mocks []mock
|
|
||||||
}
|
|
||||||
|
|
||||||
func renderMockList(w http.ResponseWriter, r *http.Request) {
|
|
||||||
data := contentMockList{
|
|
||||||
Config: html.NewContentConfig(),
|
|
||||||
Mocks: mocks,
|
|
||||||
}
|
|
||||||
html.RenderOrError(w, "sync/mock/root.html", data)
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
//"fmt"
|
|
||||||
"net/http"
|
|
||||||
//"strings"
|
|
||||||
//"time"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
//"github.com/Gleipnir-Technology/bob"
|
|
||||||
//"github.com/Gleipnir-Technology/bob/dialect/psql"
|
|
||||||
//"github.com/Gleipnir-Technology/bob/dialect/psql/sm"
|
|
||||||
//"github.com/Gleipnir-Technology/nidus-sync/db"
|
|
||||||
//"github.com/Gleipnir-Technology/nidus-sync/db/sql"
|
|
||||||
//"github.com/google/uuid"
|
|
||||||
//"github.com/uber/h3-go/v4"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentNotificationList struct {
|
|
||||||
Notifications []platform.Notification
|
|
||||||
}
|
|
||||||
|
|
||||||
func getNotificationList(ctx context.Context, r *http.Request, u platform.User) (*html.Response[contentNotificationList], *nhttp.ErrorWithStatus) {
|
|
||||||
notifications, err := platform.NotificationsForUser(ctx, u)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nhttp.NewError("Failed to get notifications: %w", err)
|
|
||||||
}
|
|
||||||
return html.NewResponse("sync/notification-list.html", contentNotificationList{
|
|
||||||
Notifications: notifications,
|
|
||||||
}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +1,16 @@
|
||||||
package sync
|
package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
"github.com/Gleipnir-Technology/nidus-sync/auth"
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
"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/Gleipnir-Technology/nidus-sync/platform"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type contentOauthPrompt struct{}
|
|
||||||
|
|
||||||
// Build the ArcGIS authorization URL with PKCE
|
// Build the ArcGIS authorization URL with PKCE
|
||||||
func buildArcGISAuthURL(clientID string) string {
|
func buildArcGISAuthURL(clientID string) string {
|
||||||
baseURL := "https://www.arcgis.com/sharing/rest/oauth2/authorize/"
|
baseURL := "https://www.arcgis.com/sharing/rest/oauth2/authorize/"
|
||||||
|
|
@ -66,7 +61,4 @@ func getArcgisOauthCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, config.MakeURLNidus("/"), http.StatusFound)
|
http.Redirect(w, r, config.MakeURLNidus("/"), http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getOAuthRefresh(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentOauthPrompt], *nhttp.ErrorWithStatus) {
|
|
||||||
data := contentOauthPrompt{}
|
|
||||||
return html.NewResponse("sync/oauth-prompt.html", data), nil
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentOperationsRoot struct{}
|
|
||||||
|
|
||||||
func getOperationsRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentOperationsRoot], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/operations-root.html", contentOperationsRoot{}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentParcel struct{}
|
|
||||||
|
|
||||||
func getParcel(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentParcel], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/parcel.html", contentParcel{}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentPlanningRoot struct {
|
|
||||||
URLTiles template.HTMLAttr
|
|
||||||
}
|
|
||||||
|
|
||||||
func getPlanningRoot(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentPlanningRoot], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/planning-root.html", contentPlanningRoot{
|
|
||||||
URLTiles: template.HTMLAttr(fmt.Sprintf(`url-tiles="%s"`, config.MakeURLNidus("/api/tile/{z}/{y}/{x}"))),
|
|
||||||
}), nil
|
|
||||||
}
|
|
||||||
22
sync/pool.go
22
sync/pool.go
|
|
@ -1,22 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentPoolList struct{}
|
|
||||||
|
|
||||||
func getPoolList(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentPoolList], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/pool-list.html", contentPoolList{}), nil
|
|
||||||
}
|
|
||||||
func getPoolCreate(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentPoolList], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/pool-upload.html", contentPoolList{}), nil
|
|
||||||
}
|
|
||||||
func getPoolByID(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentPoolList], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/pool-by-id.html", contentPoolList{}), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
|
||||||
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
|
|
||||||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentRadar struct {
|
|
||||||
Organization platform.Organization
|
|
||||||
}
|
|
||||||
|
|
||||||
func getRadar(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentRadar], *nhttp.ErrorWithStatus) {
|
|
||||||
data := contentRadar{
|
|
||||||
Organization: user.Organization,
|
|
||||||
}
|
|
||||||
return html.NewResponse("sync/radar.html", data), nil
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
package sync
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"html/template"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"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"
|
|
||||||
)
|
|
||||||
|
|
||||||
type contentReviewPool struct {
|
|
||||||
URLTiles template.HTMLAttr
|
|
||||||
}
|
|
||||||
type contentReviewRoot struct{}
|
|
||||||
|
|
||||||
func getReviewPool(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentReviewPool], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/review/pool.html", contentReviewPool{
|
|
||||||
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) {
|
|
||||||
return html.NewResponse("sync/review/root.html", contentReviewRoot{}), nil
|
|
||||||
}
|
|
||||||
func getReviewSite(ctx context.Context, r *http.Request, user platform.User) (*html.Response[contentReviewRoot], *nhttp.ErrorWithStatus) {
|
|
||||||
return html.NewResponse("sync/review/site.html", contentReviewRoot{}), nil
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue