nathangiusti/PySense

Ability to import dashboards using .dash

Closed this issue · 2 comments

The ability to import dashboards using the .dash appears to be missing.

I don't appear to have the permissions to branch to add the code for this, so if you could add this to the DashboardMixIn.py:

def import_dashboard(self, path, *, action='overwrite', republish=True):
    """Import dashboard file from path

    Sisense does not support this in Windows

    Can be used to update an existing dashboard.

    Args:
        path: The path to the schema smodel file
        action: Determines if the dashboard should be overwritten
        republish: Republishes dashboards on target server after copying
    """

    query_params = {'action': action, 'republish': republish}
    json_obj = PySenseUtils.read_json(path)
    json_array = [ json_obj ]
    result_json = self.connector.rest_call('post', 'api/v1/dashboards/import/bulk',
                                               query_params=query_params, json_payload=json_array)
    dashboard_json=result_json["succeded"][0]
    return PySenseDashboard.Dashboard(self, dashboard_json)

Hey @jbeuree

Thanks for the contribution.

I've added it to PySense. It was a nice addition.

Cheers,

Nathan