From 667633835d4ef735416453da38b16d84b56de52e Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Tue, 8 Nov 2022 11:08:23 +0800 Subject: [PATCH] #3168 update --- routers/admin/resources.go | 20 ++++++++++++++++++++ routers/routes/routes.go | 1 + 2 files changed, 21 insertions(+) diff --git a/routers/admin/resources.go b/routers/admin/resources.go index 20638553b..f6689acd4 100644 --- a/routers/admin/resources.go +++ b/routers/admin/resources.go @@ -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) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 322f746f4..b121f69de 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -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)