IAM: Add search for teams in app platform (#113503)

* add legacy search (wip)

* fix search field name

* implement team search endpoint

* generate openapi spec

* generate endpoints for frontend

* minor fixes

* fix issues found while testing

* add more fields to search result

* add basic unit tests

* add more unit tests

* improve getColumns() func in legacy search

* configure search endpoint in team.cue

* add team search handler

* add the searchTeams endpoint to manifest.cue

* make gofmt

* update openapi spec

* generate frontend endpoints

* remove unused field

* move fields defiitions to separate builder

* fix legacy search

* fix unit tests

* fix unit test

* address feedback

* fix unit test

* update openapi specs

* yarn generate-apis

* add missing unit tests
This commit is contained in:
Mihai Doarna
2025-12-08 15:02:59 +02:00
committed by GitHub
parent 5bd73f3264
commit b2e1b257b3
27 changed files with 1957 additions and 15 deletions
@@ -912,6 +912,115 @@
}
]
},
"/apis/iam.grafana.app/v0alpha1/namespaces/{namespace}/searchTeams": {
"get": {
"tags": [
"Search"
],
"description": "Team search",
"parameters": [
{
"name": "namespace",
"in": "path",
"description": "workspace",
"required": true,
"schema": {
"type": "string"
},
"example": "default"
},
{
"name": "query",
"in": "query",
"description": "team name query string",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"in": "query",
"description": "limit the number of results",
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "offset",
"in": "query",
"description": "start the query at the given offset",
"schema": {
"type": "integer",
"format": "int64"
}
},
{
"name": "page",
"in": "query",
"description": "page number to start from",
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"offset",
"totalHits",
"hits",
"queryCost",
"maxScore"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"hits": {
"type": "array",
"items": {
"default": {}
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"maxScore": {
"type": "number",
"format": "double",
"default": 0
},
"offset": {
"type": "integer",
"format": "int64",
"default": 0
},
"queryCost": {
"type": "number",
"format": "double",
"default": 0
},
"totalHits": {
"type": "integer",
"format": "int64",
"default": 0
}
}
}
}
}
}
}
}
},
"/apis/iam.grafana.app/v0alpha1/namespaces/{namespace}/serviceaccounts": {
"get": {
"tags": [
@@ -6373,6 +6482,90 @@
}
}
},
"github.com/grafana/grafana/apps/iam/pkg/apis/iam/v0alpha1.GetSearchTeams": {
"type": "object",
"required": [
"offset",
"totalHits",
"hits",
"queryCost",
"maxScore"
],
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
"type": "string"
},
"hits": {
"type": "array",
"items": {
"default": {}
}
},
"kind": {
"description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
"type": "string"
},
"maxScore": {
"type": "number",
"format": "double",
"default": 0
},
"offset": {
"type": "integer",
"format": "int64",
"default": 0
},
"queryCost": {
"type": "number",
"format": "double",
"default": 0
},
"totalHits": {
"type": "integer",
"format": "int64",
"default": 0
}
}
},
"github.com/grafana/grafana/apps/iam/pkg/apis/iam/v0alpha1.GetSearchTeamsBody": {
"type": "object",
"required": [
"offset",
"totalHits",
"hits",
"queryCost",
"maxScore"
],
"properties": {
"hits": {
"type": "array",
"items": {
"default": {}
}
},
"maxScore": {
"type": "number",
"format": "double",
"default": 0
},
"offset": {
"type": "integer",
"format": "int64",
"default": 0
},
"queryCost": {
"type": "number",
"format": "double",
"default": 0
},
"totalHits": {
"type": "integer",
"format": "int64",
"default": 0
}
}
},
"github.com/grafana/grafana/apps/iam/pkg/apis/iam/v0alpha1.GlobalRole": {
"type": "object",
"required": [
@@ -7726,6 +7919,38 @@
}
}
},
"github.com/grafana/grafana/apps/iam/pkg/apis/iam/v0alpha1.VersionsV0alpha1RoutesNamespacedSearchTeamsGETResponseTeamHit": {
"type": "object",
"required": [
"name",
"title",
"email",
"provisioned",
"externalUID"
],
"properties": {
"email": {
"type": "string",
"default": ""
},
"externalUID": {
"type": "string",
"default": ""
},
"name": {
"type": "string",
"default": ""
},
"provisioned": {
"type": "boolean",
"default": false
},
"title": {
"type": "string",
"default": ""
}
}
},
"io.k8s.apimachinery.pkg.apis.meta.v1.APIResource": {
"description": "APIResource specifies the name of a resource and whether it is namespaced.",
"type": "object",