[search] set folder; case insensitive sort (#98335)

* [search] set folder
* sort case insensitive
* fix test
pull/98460/head
Scott Lepper 6 months ago committed by GitHub
parent 5a2344ed0c
commit 83bcd86d18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      pkg/storage/unified/resource/document.go
  2. 2
      pkg/storage/unified/search/testdata/doc/dashboard-aaa-out.json
  3. 2
      pkg/storage/unified/search/testdata/doc/playlist-aaa-out.json
  4. 2
      pkg/storage/unified/search/testdata/doc/report-aaa-out.json
  5. 4
      public/app/features/search/service/unified.ts

@ -166,8 +166,8 @@ func NewIndexableDocument(key *ResourceKey, rv int64, obj utils.GrafanaMetaAcces
Key: key,
Kind: key.Resource,
RV: rv,
Title: title, // We always want *something* to display
TitleSort: title,
Title: title, // We always want *something* to display
TitleSort: strings.ToLower(title), // Lowercase for case-insensitive sorting
Labels: obj.GetLabels(),
Folder: obj.GetFolder(),
CreatedBy: obj.GetCreatedBy(),

@ -8,7 +8,7 @@
"kind": "dashboards",
"rv": 1234,
"title": "Test title",
"title_sort": "Test title",
"title_sort": "test title",
"description": "test description",
"tags": [
"a",

@ -8,7 +8,7 @@
"kind": "dashboards",
"rv": 1234,
"title": "Test AAA",
"title_sort": "Test AAA",
"title_sort": "test aaa",
"created": 1731336353000,
"createdBy": "user:t000000001",
"repository": {

@ -8,7 +8,7 @@
"kind": "dashboards",
"rv": 1234,
"title": "Test AAA",
"title_sort": "Test AAA",
"title_sort": "test aaa",
"created": 1706690655000,
"createdBy": "user:abc",
"repository": {

@ -206,6 +206,10 @@ export class UnifiedSearcher implements GrafanaSearcher {
uri += `?query=${encodeURIComponent(query.query ?? '*')}`;
uri += `&limit=${query.limit ?? pageSize}`;
if (!isEmpty(query.location)) {
uri += `&folder=${query.location}`;
}
if (query.kind) {
// filter resource types
uri += '&' + query.kind.map((kind) => `type=${kind}`).join('&');

Loading…
Cancel
Save