-
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathadmin.go
More file actions
27 lines (23 loc) · 611 Bytes
/
admin.go
File metadata and controls
27 lines (23 loc) · 611 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"context"
"net/http"
"github.com/ether/etherpad-proxy/databases/interfaces"
"github.com/ether/etherpad-proxy/ui"
"go.uber.org/zap"
)
type AdminPanel struct {
DB interfaces.IDB
logger *zap.SugaredLogger
}
func (a *AdminPanel) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
padIDMap, err := a.DB.GetAllPads()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
var component = ui.Management(padIDMap)
if err := component.Render(context.Background(), w); err != nil {
a.logger.Error("Error while rendering template: ", err)
}
}