Browse Source

#3168

update
tags/v1.22.11.2^2
chenyifan01 3 years ago
parent
commit
667633835d
2 changed files with 21 additions and 0 deletions
  1. +20
    -0
      routers/admin/resources.go
  2. +1
    -0
      routers/routes/routes.go

+ 20
- 0
routers/admin/resources.go View File

@@ -136,6 +136,26 @@ func GetResourceSpecificationList(ctx *context.Context) {
ctx.JSON(http.StatusOK, response.SuccessWithData(list))
}

func GetAllResourceSpecificationList(ctx *context.Context) {
queue := ctx.QueryInt64("queue")
status := ctx.QueryInt("status")
cluster := ctx.Query("cluster")
available := ctx.QueryInt("available")
list, err := resource.GetResourceSpecificationList(models.SearchResourceSpecificationOptions{
ListOptions: models.ListOptions{Page: 1, PageSize: 1000},
QueueId: queue,
Status: status,
Cluster: cluster,
AvailableCode: available,
})
if err != nil {
log.Error("GetResourceSpecificationList error.%v", err)
ctx.JSON(http.StatusOK, response.ServerError(err.Error()))
return
}
ctx.JSON(http.StatusOK, response.SuccessWithData(list))
}

func GetResourceSpecificationScenes(ctx *context.Context) {
specId := ctx.ParamsInt64(":id")
list, err := resource.GetResourceSpecificationScenes(specId)


+ 1
- 0
routers/routes/routes.go View File

@@ -645,6 +645,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/specification", func() {
m.Get("", admin.GetSpecificationPage)
m.Get("/list", admin.GetResourceSpecificationList)
m.Get("/list/all", admin.GetAllResourceSpecificationList)
m.Get("/scenes/:id", admin.GetResourceSpecificationScenes)
m.Post("/grampus/sync", admin.SyncGrampusSpecs)
m.Post("/add", binding.Bind(models.ResourceSpecificationReq{}), admin.AddResourceSpecification)


Loading…
Cancel
Save