Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions geoinsight/core/rest/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class AnalyticsViewSet(ReadOnlyModelViewSet):
url_path=r'project/(?P<project_id>[\d*]+)/types',
)
def list_types(self, request, project_id: int, **kwargs):
# TODO: remove this when analytics are ready to be shown to all users
if not request.user.is_superuser:
return Response([], status=200)

serialized = []
for analysis_type in analysis_types:
if not analysis_type.is_enabled():
Expand Down
6 changes: 5 additions & 1 deletion geoinsight/core/tests/test_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@


@pytest.mark.django_db
def test_rest_list_analysis_types(authenticated_api_client, project):
def test_rest_list_analysis_types(user, authenticated_api_client, project):
from geoinsight.core.tasks.analytics import analysis_types

# TODO: remove this when analytics are no longer hidden from non-superusers
user.is_superuser = True
user.save()

analysis_type_instances = [at() for at in analysis_types]
resp = authenticated_api_client.get(f'/api/v1/analytics/project/{project.id}/types/')
data = resp.json()
Expand Down
2 changes: 1 addition & 1 deletion web/src/store/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ref } from 'vue';

export const useAppStore = defineStore('app', () => {
const theme = ref<"dark" | "light">("light");
const openSidebars = ref<("left" | "right")[]>(["left", "right"]);
const openSidebars = ref<("left" | "right")[]>(["left"]);
const currentUser = ref<User>();
const currentError = ref<string>();

Expand Down
5 changes: 4 additions & 1 deletion web/src/store/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function defaultPanelArrangement(): FloatingPanelConfig[] {
label: "Charts",
visible: true,
closeable: true,
collapsed: true,
dock: 'right',
order: 1,
},
Expand All @@ -48,14 +49,16 @@ function defaultPanelArrangement(): FloatingPanelConfig[] {
label: 'Networks',
visible: true,
closeable: true,
collapsed: true,
dock: 'right',
order: 2,
},
{
id: "analytics",
label: "Analytics",
visible: true,
visible: false,
closeable: true,
collapsed: true,
dock: 'right',
order: 3,
},
Expand Down