controllers with new search

This commit is contained in:
mr 2024-08-01 09:27:38 +02:00
parent ea6c62be07
commit 815e1f48dc
9 changed files with 11 additions and 9 deletions

View File

@ -8,8 +8,6 @@ RUN apk add git
RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master
RUN go get cloud.o-forge.io/core/oc-lib
RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || : RUN timeout 15 bee run -gendoc=true -downdoc=true -runmode=dev || :
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html

View File

@ -55,7 +55,7 @@ func (o *DataController) GetAll() {
// @router /search/:search [get] // @router /search/:search [get]
func (o *DataController) Search() { func (o *DataController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(search, oclib.LibDataEnum(oclib.DATA_RESOURCE)) o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.DATA_RESOURCE))
o.ServeJSON() o.ServeJSON()
} }

View File

@ -55,7 +55,7 @@ func (o *DatacenterController) GetAll() {
// @router /search/:search [get] // @router /search/:search [get]
func (o *DatacenterController) Search() { func (o *DatacenterController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(search, oclib.LibDataEnum(oclib.DATACENTER_RESOURCE)) o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.DATACENTER_RESOURCE))
o.ServeJSON() o.ServeJSON()
} }

View File

@ -55,7 +55,7 @@ func (o *ProcessingController) GetAll() {
// @router /search/:search [get] // @router /search/:search [get]
func (o *ProcessingController) Search() { func (o *ProcessingController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(search, oclib.LibDataEnum(oclib.PROCESSING_RESOURCE)) o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.PROCESSING_RESOURCE))
o.ServeJSON() o.ServeJSON()
} }

View File

@ -37,7 +37,7 @@ func (o *ResourceController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
results := map[string]interface{}{} results := map[string]interface{}{}
for _, resource := range []oclib.LibDataEnum{oclib.LibDataEnum(oclib.DATACENTER_RESOURCE), oclib.LibDataEnum(oclib.DATACENTER_RESOURCE), oclib.LibDataEnum(oclib.STORAGE_RESOURCE), oclib.LibDataEnum(oclib.PROCESSING_RESOURCE), oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE)} { for _, resource := range []oclib.LibDataEnum{oclib.LibDataEnum(oclib.DATACENTER_RESOURCE), oclib.LibDataEnum(oclib.DATACENTER_RESOURCE), oclib.LibDataEnum(oclib.STORAGE_RESOURCE), oclib.LibDataEnum(oclib.PROCESSING_RESOURCE), oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE)} {
d := oclib.Search(search, resource) d := oclib.Search(nil, search, resource)
if d.Code != 200 || len(d.Data) == 0 { if d.Code != 200 || len(d.Data) == 0 {
results[resource.String()] = []interface{}{} results[resource.String()] = []interface{}{}
} else { } else {

View File

@ -34,7 +34,7 @@ func (o *StorageController) Put() {
// @router /search/:search [get] // @router /search/:search [get]
func (o *StorageController) Search() { func (o *StorageController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(search, oclib.LibDataEnum(oclib.STORAGE_RESOURCE)) o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.STORAGE_RESOURCE))
o.ServeJSON() o.ServeJSON()
} }

View File

@ -34,7 +34,7 @@ func (o *WorkflowController) Put() {
// @router /search/:search [get] // @router /search/:search [get]
func (o *WorkflowController) Search() { func (o *WorkflowController) Search() {
search := o.Ctx.Input.Param(":search") search := o.Ctx.Input.Param(":search")
o.Data["json"] = oclib.Search(search, oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE)) o.Data["json"] = oclib.Search(nil, search, oclib.LibDataEnum(oclib.WORKFLOW_RESOURCE))
o.ServeJSON() o.ServeJSON()
} }

2
go.mod
View File

@ -11,7 +11,7 @@ require (
) )
require ( require (
cloud.o-forge.io/core/oc-lib v0.0.0-20240731123052-78bef28a2171 // indirect cloud.o-forge.io/core/oc-lib v0.0.0-20240801071310-924a688a9d3f // indirect
filippo.io/edwards25519 v1.1.0 // indirect filippo.io/edwards25519 v1.1.0 // indirect
github.com/beego/bee/v2 v2.1.0 // indirect github.com/beego/bee/v2 v2.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect

4
go.sum
View File

@ -122,6 +122,10 @@ cloud.o-forge.io/core/oc-lib v0.0.0-20240730124133-b06193add2fe h1:dAA8GotTauJxV
cloud.o-forge.io/core/oc-lib v0.0.0-20240730124133-b06193add2fe/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= cloud.o-forge.io/core/oc-lib v0.0.0-20240730124133-b06193add2fe/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240731123052-78bef28a2171 h1:SiTy74sfSeO97umBOnUZNrBl613LM0oqBw8eOOsYv7I= cloud.o-forge.io/core/oc-lib v0.0.0-20240731123052-78bef28a2171 h1:SiTy74sfSeO97umBOnUZNrBl613LM0oqBw8eOOsYv7I=
cloud.o-forge.io/core/oc-lib v0.0.0-20240731123052-78bef28a2171/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo= cloud.o-forge.io/core/oc-lib v0.0.0-20240731123052-78bef28a2171/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240731145630-ad455e0e3a91 h1:o7hnTWo9VpoYV/+l/+ET8jVF4olagDMpVQ2w19Wp6z0=
cloud.o-forge.io/core/oc-lib v0.0.0-20240731145630-ad455e0e3a91/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
cloud.o-forge.io/core/oc-lib v0.0.0-20240801071310-924a688a9d3f h1:w4KMhEFwcJrVhinhuo4G/A/pJZOpHQSA8BB/1LV8aN4=
cloud.o-forge.io/core/oc-lib v0.0.0-20240801071310-924a688a9d3f/go.mod h1:V5EL+NV2s9P1/BcFm3/icfLeBYVVMLl1Z0F0eecJZGo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=