Add Show Widget for library actions with Overview charts from last run output.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"codeberg.org/SquidSE/ClusterCanvas/service/internal/settings"
|
||||
)
|
||||
|
||||
type actionWidgetsResponse struct {
|
||||
Widgets []settings.ActionWidgetSnapshot `json:"widgets"`
|
||||
}
|
||||
|
||||
func (app *App) actionWidgetsListHandler(writer http.ResponseWriter, request *http.Request) {
|
||||
node, ok := app.loadAccessibleNode(writer, request)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
store, err := settings.LoadActionWidgetsOrEmpty(app.ConfigDir)
|
||||
if err != nil {
|
||||
writeJSON(writer, http.StatusInternalServerError, apiErrorResponse{Error: err.Error()})
|
||||
return
|
||||
}
|
||||
writeJSON(writer, http.StatusOK, actionWidgetsResponse{
|
||||
Widgets: settings.WidgetsForNode(store, node.ID),
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user