Add page for showing pool uploads
This commit is contained in:
parent
874d49c6a5
commit
59076e9eb0
7 changed files with 232 additions and 193 deletions
25
sync/pool.go
Normal file
25
sync/pool.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package sync
|
||||
|
||||
import (
|
||||
"github.com/Gleipnir-Technology/nidus-sync/db/models"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/html"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ContentPoolList struct {
|
||||
URL ContentURL
|
||||
User User
|
||||
}
|
||||
|
||||
func getPoolList(w http.ResponseWriter, r *http.Request, u *models.User) {
|
||||
userContent, err := contentForUser(r.Context(), u)
|
||||
if err != nil {
|
||||
respondError(w, "Failed to get user", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
data := ContentPoolList{
|
||||
URL: newContentURL(),
|
||||
User: userContent,
|
||||
}
|
||||
html.RenderOrError(w, "sync/pool-list.html", data)
|
||||
}
|
||||
|
|
@ -62,6 +62,7 @@ func Router() chi.Router {
|
|||
r.Route("/api", api.AddRoutes)
|
||||
r.Method("GET", "/cell/{cell}", auth.NewEnsureAuth(getCellDetails))
|
||||
r.Method("GET", "/layout-test", auth.NewEnsureAuth(getLayoutTest))
|
||||
r.Method("GET", "/pool", auth.NewEnsureAuth(getPoolList))
|
||||
r.Method("GET", "/settings", auth.NewEnsureAuth(getSettings))
|
||||
r.Method("GET", "/signout", auth.NewEnsureAuth(getSignout))
|
||||
r.Method("GET", "/source/{globalid}", auth.NewEnsureAuth(getSource))
|
||||
|
|
|
|||
15
sync/url.go
Normal file
15
sync/url.go
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
package sync
|
||||
|
||||
import (
|
||||
"github.com/Gleipnir-Technology/nidus-sync/config"
|
||||
)
|
||||
|
||||
type ContentURL struct {
|
||||
PoolCSVUpload string
|
||||
}
|
||||
|
||||
func newContentURL() ContentURL {
|
||||
return ContentURL{
|
||||
PoolCSVUpload: config.MakeURLNidus("/pool/upload"),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue