File tree 3 files changed +15
-12
lines changed 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
# CHANGELOG
2
2
3
3
## unreleased
4
+ - Fixed ` update_dashboard ` to also handle ` folderUid ` well. Thanks, @CantankerousBullMoose .
4
5
5
6
## 4.3.0 (2025-02-08)
6
7
- Added support for querying all data source-managed alerts. Thanks, @dmyerscough .
Original file line number Diff line number Diff line change @@ -40,12 +40,13 @@ async def update_dashboard(self, dashboard):
40
40
:return:
41
41
"""
42
42
43
- # When the "folderId" is not available within the dashboard payload,
44
- # populate it from the nested "meta" object, if given.
45
- if "folderId" not in dashboard :
46
- if "meta" in dashboard and "folderId" in dashboard ["meta" ]:
47
- dashboard = dashboard .copy ()
48
- dashboard ["folderId" ] = dashboard ["meta" ]["folderId" ]
43
+ # When `folderId` or `folderUid` are not available within the dashboard payload,
44
+ # populate them from the nested `meta` object, when given.
45
+ for attribute in ["folderId" , "folderUid" ]:
46
+ if attribute not in dashboard :
47
+ if "meta" in dashboard and attribute in dashboard ["meta" ]:
48
+ dashboard = dashboard .copy ()
49
+ dashboard [attribute ] = dashboard ["meta" ][attribute ]
49
50
50
51
put_dashboard_path = "/dashboards/db"
51
52
return await self .client .POST (put_dashboard_path , json = dashboard )
Original file line number Diff line number Diff line change @@ -40,12 +40,13 @@ def update_dashboard(self, dashboard):
40
40
:return:
41
41
"""
42
42
43
- # When the "folderId" is not available within the dashboard payload,
44
- # populate it from the nested "meta" object, if given.
45
- if "folderId" not in dashboard :
46
- if "meta" in dashboard and "folderId" in dashboard ["meta" ]:
47
- dashboard = dashboard .copy ()
48
- dashboard ["folderId" ] = dashboard ["meta" ]["folderId" ]
43
+ # When `folderId` or `folderUid` are not available within the dashboard payload,
44
+ # populate them from the nested `meta` object, when given.
45
+ for attribute in ["folderId" , "folderUid" ]:
46
+ if attribute not in dashboard :
47
+ if "meta" in dashboard and attribute in dashboard ["meta" ]:
48
+ dashboard = dashboard .copy ()
49
+ dashboard [attribute ] = dashboard ["meta" ][attribute ]
49
50
50
51
put_dashboard_path = "/dashboards/db"
51
52
return self .client .POST (put_dashboard_path , json = dashboard )
You can’t perform that action at this time.
0 commit comments