File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ async def search_dashboards(
19
19
folder_uids = None ,
20
20
starred = None ,
21
21
limit = None ,
22
+ page = None ,
22
23
):
23
24
"""
24
25
@@ -31,6 +32,7 @@ async def search_dashboards(
31
32
:param folder_uids:
32
33
:param starred:
33
34
:param limit:
35
+ :param page:
34
36
:return:
35
37
"""
36
38
list_dashboard_path = "/search"
@@ -63,4 +65,7 @@ async def search_dashboards(
63
65
if limit :
64
66
params ["limit" ] = limit
65
67
68
+ if page :
69
+ params ["page" ] = page
70
+
66
71
return await self .client .GET (list_dashboard_path , params = params )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def search_dashboards(
19
19
folder_uids = None ,
20
20
starred = None ,
21
21
limit = None ,
22
+ page = None ,
22
23
):
23
24
"""
24
25
@@ -31,6 +32,7 @@ def search_dashboards(
31
32
:param folder_uids:
32
33
:param starred:
33
34
:param limit:
35
+ :param page:
34
36
:return:
35
37
"""
36
38
list_dashboard_path = "/search"
@@ -63,4 +65,7 @@ def search_dashboards(
63
65
if limit :
64
66
params ["limit" ] = limit
65
67
68
+ if page :
69
+ params ["page" ] = page
70
+
66
71
return self .client .GET (list_dashboard_path , params = params )
Original file line number Diff line number Diff line change @@ -51,3 +51,29 @@ def test_search_dashboards_with_out_filter(self, m):
51
51
52
52
with self .assertRaises (GrafanaBadInputError ):
53
53
self .grafana .search .search_dashboards ()
54
+
55
+ @requests_mock .Mocker ()
56
+ def test_search_dashboards_with_page (self , m ):
57
+ m .get (
58
+ "http://localhost/api/search?page=1" ,
59
+ json = [
60
+ {
61
+ "id" : 2307 ,
62
+ "uid" : "LfQAz3t4z1DSA" ,
63
+ "title" : "ERRORS" ,
64
+ "uri" : "db/errors" ,
65
+ "url" : "/d/LfQAz3t4z1DSA/errors" ,
66
+ "slug" : "" ,
67
+ "type" : "dash-db" ,
68
+ "tags" : [],
69
+ "isStarred" : False ,
70
+ "sortMeta" : 0 ,
71
+ }
72
+ ],
73
+ )
74
+
75
+ result = self .grafana .search .search_dashboards (
76
+ page = 1 ,
77
+ )
78
+ self .assertEqual (result [0 ]["id" ], 2307 )
79
+ self .assertEqual (len (result ), 1 )
You can’t perform that action at this time.
0 commit comments