Skip to content

Commit

Permalink
Merge pull request #17 from manueligno78/master
Browse files Browse the repository at this point in the history
Support for dashboard uid
  • Loading branch information
manueligno78 authored Nov 13, 2019
2 parents 56f1df4 + 929a9b0 commit 539eb51
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions grafana_dashboards/client/grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@ def process_dashboard(self, project_name, dashboard_name, dashboard_data):
if 'folderId' in dashboard_data:
body.update({'folderId': dashboard_data['folderId']})

if 'uid' in dashboard_data:
body.update({'uid': dashboard_data['uid']})

logger.info("Uploading dashboard '%s' to %s", dashboard_name, self._host)
self._connection.make_request('/api/dashboards/db', body)
2 changes: 2 additions & 0 deletions grafana_dashboards/components/dashboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def gen_json_from_data(self, data, context):
json_data['refresh'] = data.get('refresh')
if 'folderId' in data:
json_data['folderId'] = data.get('folderId')
if 'uid' in data:
json_data['uid'] = data.get('uid')
if get_component_type(Annotations) in data:
json_data['annotations'] = {'list': self.registry.create_component(Annotations, data).gen_json()}
if get_component_type(Rows) in data:
Expand Down
1 change: 1 addition & 0 deletions samples/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

- name: overview
dashboard:
uid: 'uid{dashboard-prefix}'
title: '{dashboard-prefix} Overview'
tags:
- tag1
Expand Down

0 comments on commit 539eb51

Please sign in to comment.