grafana/public/app/features/search/testData.ts
Alex Khomenko d04dce6a37
Search/refactor dashboard search (#23274)
* Search: add search wrapper

* Search: add DashboardSearch.tsx

* Search: enable search

* Search: update types

* Search: useReducer for saving search results

* Search: use default query

* Search: add toggle custom action

* Search: add onQueryChange

* Search: debounce search

* Search: pas dispatch as a prop

* Search: add tag filter

* Search: Fix types

* Search: revert changes

* Search: close overlay on esc

* Search: enable tag filtering

* Search: clear query

* Search: add autofocus to search field

* Search: Rename close to closeSearch

* Search: Add no results message

* Search: Add loading state

* Search: Remove Select from Forms namespace

* Remove Add selectedIndex

* Remove Add getFlattenedSections

* Remove Enable selecting items

* Search: add hasId

* Search: preselect first item

* Search: Add utils tests

* Search: Fix moving selection down

* Search: Add findSelected

* Search: Add type to section

* Search: Handle Enter key press on item highlight

* Search: Move reducer et al. to separate files

* Search: Remove redundant render check

* Search: Close overlay on Esc and ArrowLeft press

* Search: Add close button

* Search: Document utils

* Search: use Icon for remove icon

* Search: Add DashboardSearch.test.tsx

* Search: Move test data to a separate file

* Search: Finalise DashboardSearch.test.tsx

* Add search reducer tests

* Search: Add search results loading indicator

* Search: Remove inline function

* Search: Do not mutate item

* Search: Tweak utils

* Search: Do not clear query on tag clear

* Search: Fix folder:current search

* Search: Fix results scroll

* Search: Update tests

* Search: Close overlay on cog icon click

* Add mobile styles for close button

* Search: Use CustomScrollbar

* Search: Memoize TagList.tsx

* Search: Fix type errors

* Search: More strictNullChecks fixes

* Search: Consistent handler names

* Search: Fix search items types in test

* Search: Fix merge conflicts

* Search: Fix strictNullChecks errors
2020-04-08 18:14:03 +03:00

171 lines
3.2 KiB
TypeScript

export const searchResults = [
{
id: 2,
uid: 'JB_zdOUWk',
title: 'gdev dashboards',
expanded: false,
//@ts-ignore
items: [],
url: '/dashboards/f/JB_zdOUWk/gdev-dashboards',
icon: 'folder',
score: 0,
checked: false,
},
{
id: 0,
title: 'General',
items: [
{
id: 1,
uid: 'lBdLINUWk',
title: 'Test 1',
uri: 'db/test1',
url: '/d/lBdLINUWk/test1',
slug: '',
type: 'dash-db',
//@ts-ignore
tags: [],
isStarred: false,
checked: false,
},
{
id: 46,
uid: '8DY63kQZk',
title: 'Test 2',
uri: 'db/test2',
url: '/d/8DY63kQZk/test2',
slug: '',
type: 'dash-db',
tags: [],
isStarred: false,
checked: false,
},
],
icon: 'folder-open',
score: 1,
expanded: true,
checked: false,
},
];
// Search results with more info
export const sections = [
{
title: 'Starred',
score: -2,
expanded: true,
items: [
{
id: 1,
uid: 'lBdLINUWk',
title: 'Prom dash',
type: 'dash-db',
},
],
},
{
title: 'Recent',
icon: 'clock-o',
score: -1,
removable: true,
expanded: false,
items: [
{
id: 4072,
uid: 'OzAIf_rWz',
title: 'New dashboard Copy 3',
type: 'dash-db',
isStarred: false,
},
{
id: 46,
uid: '8DY63kQZk',
title: 'Stocks',
type: 'dash-db',
isStarred: false,
},
{
id: 20,
uid: '7MeksYbmk',
title: 'Alerting with TestData',
type: 'dash-db',
isStarred: false,
folderId: 2,
},
{
id: 4073,
uid: 'j9SHflrWk',
title: 'New dashboard Copy 4',
type: 'dash-db',
isStarred: false,
folderId: 2,
},
],
},
{
id: 2,
uid: 'JB_zdOUWk',
title: 'gdev dashboards',
expanded: false,
url: '/dashboards/f/JB_zdOUWk/gdev-dashboards',
icon: 'folder',
score: 2,
//@ts-ignore
items: [],
},
{
id: 2568,
uid: 'search-test-data',
title: 'Search test data folder',
expanded: false,
items: [],
url: '/dashboards/f/search-test-data/search-test-data-folder',
icon: 'folder',
score: 3,
},
{
id: 4074,
uid: 'iN5TFj9Zk',
title: 'Test',
expanded: false,
items: [],
url: '/dashboards/f/iN5TFj9Zk/test',
icon: 'folder',
score: 4,
},
{
id: 0,
title: 'General',
icon: 'folder-open',
score: 5,
expanded: true,
items: [
{
id: 4069,
uid: 'LCFWfl9Zz',
title: 'New dashboard Copy',
uri: 'db/new-dashboard-copy',
url: '/d/LCFWfl9Zz/new-dashboard-copy',
slug: '',
type: 'dash-db',
isStarred: false,
},
{
id: 4072,
uid: 'OzAIf_rWz',
title: 'New dashboard Copy 3',
type: 'dash-db',
isStarred: false,
},
{
id: 1,
uid: 'lBdLINUWk',
title: 'Prom dash',
type: 'dash-db',
isStarred: true,
},
],
},
];