Skip to content
Snippets Groups Projects
Commit 6b30745c authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Allow setting home dashboard for an organization

parent bb499eb7
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ import logging
from typing import Dict, List, Union
from datetime import datetime
from brian_dashboard_manager.grafana.utils.request import AdminRequest
from brian_dashboard_manager.grafana.utils.request import AdminRequest, TokenRequest
logger = logging.getLogger(__name__)
......@@ -87,3 +87,9 @@ def delete_expired_api_tokens(request: AdminRequest, org_id: int) -> bool:
for token in expired_tokens:
delete_api_token(request, org_id, token['id'])
return True
def set_home_dashboard(request: TokenRequest, dashboard_id: int):
r = request.put(f'api/org/preferences', json={
'homeDashboardId': dashboard_id
})
return r and r.get('message') == 'Preferences updated'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment