From f7e72c0f835b708481ab94b3fc8167dbf4197e4d Mon Sep 17 00:00:00 2001 From: Kraiem Taha Yassine Date: Mon, 1 Jul 2024 16:11:06 +0200 Subject: [PATCH] Dev (#2329) * refactor(chalice): upgraded dependencies * refactor(chalice): upgraded dependencies feat(chalice): support heatmaps * feat(chalice): support table-of-browsers showing user-count * feat(chalice): support table-of-devices showing user-count * feat(chalice): support table-of-URLs showing user-count * refactor(chalice): return dashboard's owner email --- api/chalicelib/core/custom_metrics.py | 3 ++- api/chalicelib/core/dashboards.py | 7 ++++++- ee/api/chalicelib/core/custom_metrics.py | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/api/chalicelib/core/custom_metrics.py b/api/chalicelib/core/custom_metrics.py index 66e1e0779..7b68ea124 100644 --- a/api/chalicelib/core/custom_metrics.py +++ b/api/chalicelib/core/custom_metrics.py @@ -524,7 +524,8 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser def get_all(project_id, user_id): default_search = schemas.SearchCardsSchema() - result = rows = search_all(project_id=project_id, user_id=user_id, data=default_search) + result = [] + rows = search_all(project_id=project_id, user_id=user_id, data=default_search) while len(rows) == default_search.limit: default_search.page += 1 rows = search_all(project_id=project_id, user_id=user_id, data=default_search) diff --git a/api/chalicelib/core/dashboards.py b/api/chalicelib/core/dashboards.py index ed4ebcb6c..36b58dfa0 100644 --- a/api/chalicelib/core/dashboards.py +++ b/api/chalicelib/core/dashboards.py @@ -34,8 +34,13 @@ def create_dashboard(project_id, user_id, data: schemas.CreateDashboardSchema): def get_dashboards(project_id, user_id): with pg_client.PostgresClient() as cur: - pg_query = f"""SELECT * + pg_query = f"""SELECT *, owner_email FROM dashboards + LEFT JOIN LATERAL (SELECT email AS owner_email + FROM users + WHERE deleted_at ISNULL + AND users.user_id = dashboards.user_id + ) AS owner ON (TRUE) WHERE deleted_at ISNULL AND project_id = %(projectId)s AND (user_id = %(userId)s OR is_public);""" diff --git a/ee/api/chalicelib/core/custom_metrics.py b/ee/api/chalicelib/core/custom_metrics.py index 7b5f2be1a..b34bfa7d1 100644 --- a/ee/api/chalicelib/core/custom_metrics.py +++ b/ee/api/chalicelib/core/custom_metrics.py @@ -556,7 +556,8 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser def get_all(project_id, user_id): default_search = schemas.SearchCardsSchema() - result = rows = search_all(project_id=project_id, user_id=user_id, data=default_search) + result = [] + rows = search_all(project_id=project_id, user_id=user_id, data=default_search) while len(rows) == default_search.limit: default_search.page += 1 rows = search_all(project_id=project_id, user_id=user_id, data=default_search)