Skip to content

Commit 2cd4e42

Browse files
committed
added the ability to create shared dashboards
1 parent 9674099 commit 2cd4e42

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

sdcclient/_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def filter_fn(panel):
603603
else:
604604
return [False, 'Not found']
605605

606-
def create_dashboard_from_template(self, newdashname, template, scope):
606+
def create_dashboard_from_template(self, newdashname, template, scope=[], shared=False):
607607
if scope is None:
608608
scope = []
609609

@@ -635,7 +635,7 @@ def create_dashboard_from_template(self, newdashname, template, scope):
635635
template['version'] = None
636636
template['schema'] = 1
637637
template['name'] = newdashname
638-
template['isShared'] = False # make sure the dashboard is not shared
638+
template['isShared'] = shared # make sure the dashboard is not shared
639639

640640
#
641641
# Assign the filter and the group ID to each view to point to this service
@@ -701,7 +701,7 @@ def create_dashboard_from_template(self, newdashname, template, scope):
701701
else:
702702
return [True, res.json()]
703703

704-
def create_dashboard_from_view(self, newdashname, viewname, filter):
704+
def create_dashboard_from_view(self, newdashname, viewname, filter, shared=False):
705705
#
706706
# Find our template view
707707
#
@@ -717,9 +717,9 @@ def create_dashboard_from_view(self, newdashname, viewname, filter):
717717
#
718718
# Create the new dashboard
719719
#
720-
return self.create_dashboard_from_template(newdashname, view, filter)
720+
return self.create_dashboard_from_template(newdashname, view, filter, shared)
721721

722-
def create_dashboard_from_dashboard(self, newdashname, templatename, filter):
722+
def create_dashboard_from_dashboard(self, newdashname, templatename, filter, shared=False):
723723
#
724724
# Get the list of dashboards from the server
725725
#
@@ -746,9 +746,9 @@ def create_dashboard_from_dashboard(self, newdashname, templatename, filter):
746746
#
747747
# Create the dashboard
748748
#
749-
return self.create_dashboard_from_template(newdashname, dboard, filter)
749+
return self.create_dashboard_from_template(newdashname, dboard, filter, shared)
750750

751-
def create_dashboard_from_file(self, newdashname, filename, filter):
751+
def create_dashboard_from_file(self, newdashname, filename, filter, shared=False):
752752
#
753753
# Load the Dashboard
754754
#
@@ -761,7 +761,7 @@ def create_dashboard_from_file(self, newdashname, filename, filter):
761761
#
762762
# Create the new dashboard
763763
#
764-
return self.create_dashboard_from_template(newdashname, dboard, filter)
764+
return self.create_dashboard_from_template(newdashname, dboard, filter, shared)
765765

766766
def delete_dashboard(self, dashboard):
767767
if 'id' not in dashboard:

0 commit comments

Comments
 (0)