mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(irc): improve list view (#466)
* feat(irc): add irc status examples * feat(irc): add dropdown menu to list * feat(irc): update heroicons and add expand button * feat(irc): update heroicons and add expand button
This commit is contained in:
parent
f5faf066a9
commit
300418b9f1
34 changed files with 478 additions and 258 deletions
|
@ -19,6 +19,7 @@ type ircService interface {
|
|||
StoreNetwork(ctx context.Context, network *domain.IrcNetwork) error
|
||||
UpdateNetwork(ctx context.Context, network *domain.IrcNetwork) error
|
||||
StoreChannel(networkID int64, channel *domain.IrcChannel) error
|
||||
RestartNetwork(ctx context.Context, id int64) error
|
||||
}
|
||||
|
||||
type ircHandler struct {
|
||||
|
@ -38,6 +39,7 @@ func (h ircHandler) Routes(r chi.Router) {
|
|||
r.Post("/", h.storeNetwork)
|
||||
r.Put("/network/{networkID}", h.updateNetwork)
|
||||
r.Post("/network/{networkID}/channel", h.storeChannel)
|
||||
r.Get("/network/{networkID}/restart", h.restartNetwork)
|
||||
r.Get("/network/{networkID}", h.getNetworkByID)
|
||||
r.Delete("/network/{networkID}", h.deleteNetwork)
|
||||
}
|
||||
|
@ -69,6 +71,21 @@ func (h ircHandler) getNetworkByID(w http.ResponseWriter, r *http.Request) {
|
|||
h.encoder.StatusResponse(ctx, w, network, http.StatusOK)
|
||||
}
|
||||
|
||||
func (h ircHandler) restartNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
var (
|
||||
ctx = r.Context()
|
||||
networkID = chi.URLParam(r, "networkID")
|
||||
)
|
||||
|
||||
id, _ := strconv.Atoi(networkID)
|
||||
|
||||
if err := h.service.RestartNetwork(ctx, int64(id)); err != nil {
|
||||
h.encoder.Error(w, err)
|
||||
}
|
||||
|
||||
h.encoder.NoContent(w)
|
||||
}
|
||||
|
||||
func (h ircHandler) storeNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
var data domain.IrcNetwork
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue