2021-12-06 12:24:22 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2022-01-06 08:54:14 +00:00
|
|
|
"time"
|
|
|
|
|
2021-12-06 12:24:22 +00:00
|
|
|
"github.com/cuigh/auxo/app/container"
|
|
|
|
"github.com/cuigh/auxo/net/web"
|
|
|
|
)
|
|
|
|
|
2022-01-06 08:54:14 +00:00
|
|
|
const defaultTimeout = 30 * time.Second
|
|
|
|
|
2021-12-06 12:24:22 +00:00
|
|
|
func ajax(ctx web.Context, err error) error {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return success(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func success(ctx web.Context, data interface{}) error {
|
|
|
|
return ctx.Result(0, "", data)
|
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
container.Put(NewSystem, container.Name("api.system"))
|
|
|
|
container.Put(NewSetting, container.Name("api.setting"))
|
|
|
|
container.Put(NewUser, container.Name("api.user"))
|
|
|
|
container.Put(NewNode, container.Name("api.node"))
|
|
|
|
container.Put(NewRegistry, container.Name("api.registry"))
|
|
|
|
container.Put(NewNetwork, container.Name("api.network"))
|
|
|
|
container.Put(NewService, container.Name("api.service"))
|
|
|
|
container.Put(NewTask, container.Name("api.task"))
|
|
|
|
container.Put(NewConfig, container.Name("api.config"))
|
|
|
|
container.Put(NewSecret, container.Name("api.secret"))
|
|
|
|
container.Put(NewStack, container.Name("api.stack"))
|
|
|
|
container.Put(NewImage, container.Name("api.image"))
|
|
|
|
container.Put(NewContainer, container.Name("api.container"))
|
|
|
|
container.Put(NewVolume, container.Name("api.volume"))
|
|
|
|
container.Put(NewUser, container.Name("api.user"))
|
|
|
|
container.Put(NewRole, container.Name("api.role"))
|
|
|
|
container.Put(NewEvent, container.Name("api.event"))
|
|
|
|
container.Put(NewChart, container.Name("api.chart"))
|
2021-12-22 09:43:26 +00:00
|
|
|
container.Put(NewDashboard, container.Name("api.dashboard"))
|
2021-12-06 12:24:22 +00:00
|
|
|
}
|