From cb8bc930f3af8be607273ceca1f822a9961d1ce1 Mon Sep 17 00:00:00 2001 From: davideschiera Date: Sun, 14 Apr 2019 14:26:04 -0700 Subject: [PATCH] Fix empty dashboard, dashboard update, and example --- examples/dashboard.py | 5 +++-- sdcclient/_monitor.py | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/dashboard.py b/examples/dashboard.py index 79adc255..bcfab2aa 100755 --- a/examples/dashboard.py +++ b/examples/dashboard.py @@ -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: @@ -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 diff --git a/sdcclient/_monitor.py b/sdcclient/_monitor.py index 9de57a3c..1f6ce936 100644 --- a/sdcclient/_monitor.py +++ b/sdcclient/_monitor.py @@ -361,7 +361,10 @@ def create_dashboard(self, name): dashboard_configuration = { 'name': name, 'schema': 2, - 'widgets': [] + 'widgets': [], + 'eventsOverlaySettings': { + 'filterNotificationsUserInputFilter': '' + } } # @@ -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': @@ -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