Skip to content

Commit

Permalink
Fix empty dashboard, dashboard update, and example
Browse files Browse the repository at this point in the history
  • Loading branch information
davideschiera committed Apr 14, 2019
1 parent 22ef8d9 commit cb8bc93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions examples/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def usage():
]
sort_direction = 'desc'
limit = 10
ok, res = sdclient.add_dashboard_panel(dashboard_configuration, panel_name, panel_type, metrics, sort_direction=sort_direction, limit=limit)
layout = {'col': 1, 'row': 7, 'size_x': 12, 'size_y': 6}
ok, res = sdclient.add_dashboard_panel(dashboard_configuration, panel_name, panel_type, metrics, sort_direction=sort_direction, limit=limit, layout=layout)

# Check the result
if ok:
Expand All @@ -122,7 +123,7 @@ def usage():
metrics = [
{'id': 'cpu.used.percent', 'aggregations': {'time': 'avg', 'group': 'avg'}}
]
layout = {'col': 6, 'row': 1, 'size_x': 2, 'size_y': 3}
layout = {'col': 1, 'row': 13, 'size_x': 12, 'size_y': 6}
ok, res = sdclient.add_dashboard_panel(dashboard_configuration, panel_name, panel_type, metrics, layout=layout)

# Check the result
Expand Down
9 changes: 6 additions & 3 deletions sdcclient/_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ def create_dashboard(self, name):
dashboard_configuration = {
'name': name,
'schema': 2,
'widgets': []
'widgets': [],
'eventsOverlaySettings': {
'filterNotificationsUserInputFilter': ''
}
}

#
Expand Down Expand Up @@ -403,7 +406,8 @@ def add_dashboard_panel(self, dashboard, name, panel_type, metrics, scope=None,
'row': 1,
'size_x': 12,
'size_y': 6
}
},
'customDisplayOptions': {}
}

if panel_type == 'timeSeries':
Expand Down Expand Up @@ -531,7 +535,6 @@ def remove_dashboard_panel(self, dashboard, panel_name):
# Clone existing dashboard...
#
dashboard_configuration = copy.deepcopy(dashboard)
del dashboard_configuration['id']

#
# ... find the panel
Expand Down

0 comments on commit cb8bc93

Please sign in to comment.