Skip to content

Commit

Permalink
Add folder id at dashboard level. Resolves #156.
Browse files Browse the repository at this point in the history
  • Loading branch information
trampfox committed Jul 2, 2019
1 parent cf5a219 commit 8b7d2bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions grafana_dashboards/client/grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@ def __init__(self, **kwargs):
def process_dashboard(self, project_name, dashboard_name, dashboard_data):
super(GrafanaExporter, self).process_dashboard(project_name, dashboard_name, dashboard_data)
body = {'overwrite': True, 'dashboard': dashboard_data}

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

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 @@ -52,6 +52,8 @@ def gen_json_from_data(self, data, context):
nav['refresh_intervals'] = data.get('refresh_intervals', [])
if 'refresh' in data:
json_data['refresh'] = data.get('refresh')
if 'folderId' in data:
json_data['folderId'] = data.get('folderId')
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

0 comments on commit 8b7d2bb

Please sign in to comment.