feat(chalice): sessions search EE changes
feat(chalice): funnels EE changes feat(chalice): cards EE changes
This commit is contained in:
parent
bfb0a8b358
commit
8de8194ed5
3 changed files with 29 additions and 9 deletions
|
|
@ -137,7 +137,8 @@ def merged_live(project_id, data: schemas.CreateCardSchema, user_id=None):
|
|||
return __get_sessions_list(project_id=project_id, user_id=user_id, data=data)
|
||||
elif __is_click_map(data):
|
||||
return __get_click_map_chat(project_id=project_id, user_id=user_id, data=data)
|
||||
|
||||
elif len(data.series) == 0:
|
||||
return []
|
||||
series_charts = __try_live(project_id=project_id, data=data)
|
||||
if data.view_type == schemas.MetricTimeseriesViewType.progress or data.metric_type == schemas.MetricType.table:
|
||||
return series_charts
|
||||
|
|
@ -388,7 +389,9 @@ def search_all(project_id, user_id, data: schemas.SearchCardsSchema, include_ser
|
|||
AND metric_series.deleted_at ISNULL
|
||||
) AS metric_series ON (TRUE)"""
|
||||
query = cur.mogrify(
|
||||
f"""SELECT *
|
||||
f"""SELECT metric_id, project_id, user_id, name, is_public, created_at, edited_at,
|
||||
metric_type, metric_of, metric_format, metric_value, view_type, is_pinned,
|
||||
predefined_key, dashboards, owner_email, default_config AS config, thumbnail
|
||||
FROM metrics
|
||||
{sub_join}
|
||||
LEFT JOIN LATERAL (SELECT COALESCE(jsonb_agg(connected_dashboards.* ORDER BY is_public,name),'[]'::jsonb) AS dashboards
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ from typing import List
|
|||
import chalicelib.utils.helper
|
||||
import schemas
|
||||
from chalicelib.core import significance
|
||||
from chalicelib.utils import dev
|
||||
from chalicelib.utils import helper, pg_client
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
from decouple import config
|
||||
|
|
@ -46,7 +46,7 @@ def __fix_stages(f_events: List[schemas._SessionSearchEventSchema]):
|
|||
|
||||
if not isinstance(e.value, list):
|
||||
e.value = [e.value]
|
||||
is_any = sessions._isAny_opreator(e.operator)
|
||||
is_any = sh.isAny_opreator(e.operator)
|
||||
if not is_any and isinstance(e.value, list) and len(e.value) == 0:
|
||||
continue
|
||||
events.append(e)
|
||||
|
|
@ -163,7 +163,7 @@ def get_by_user(project_id, user_id, range_value=None, start_date=None, end_date
|
|||
|
||||
|
||||
def get_possible_issue_types(project_id):
|
||||
return [{"type": t, "title": chalicelib.utils.helper.get_issue_title(t)} for t in
|
||||
return [{"type": t, "title": helper.get_issue_title(t)} for t in
|
||||
['click_rage', 'dead_click', 'excessive_scrolling',
|
||||
'bad_request', 'missing_resource', 'memory', 'cpu',
|
||||
'slow_resource', 'slow_page_load', 'crash', 'custom_event_error',
|
||||
|
|
@ -260,7 +260,7 @@ def get_top_insights_on_the_fly(funnel_id, user_id, project_id, data: schemas.Fu
|
|||
|
||||
|
||||
# def get_top_insights_on_the_fly_widget(project_id, data: schemas.FunnelInsightsPayloadSchema):
|
||||
def get_top_insights_on_the_fly_widget(project_id, data: schemas.CustomMetricSeriesFilterSchema):
|
||||
def get_top_insights_on_the_fly_widget(project_id, data: schemas.CardSeriesFilterSchema):
|
||||
data.events = filter_stages(__parse_events(data.events))
|
||||
data.events = __fix_stages(data.events)
|
||||
if len(data.events) == 0:
|
||||
|
|
@ -309,7 +309,7 @@ def get_issues_on_the_fly(funnel_id, user_id, project_id, data: schemas.FunnelSe
|
|||
|
||||
|
||||
# def get_issues_on_the_fly_widget(project_id, data: schemas.FunnelSearchPayloadSchema):
|
||||
def get_issues_on_the_fly_widget(project_id, data: schemas.CustomMetricSeriesFilterSchema):
|
||||
def get_issues_on_the_fly_widget(project_id, data: schemas.CardSeriesFilterSchema):
|
||||
data.events = filter_stages(data.events)
|
||||
data.events = __fix_stages(data.events)
|
||||
if len(data.events) < 0:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from typing import List, Union
|
|||
import schemas
|
||||
import schemas_ee
|
||||
from chalicelib.core import events, metadata, events_ios, \
|
||||
sessions_mobs, issues, projects, errors, resources, assist, performance_event, sessions_viewed, sessions_favorite, \
|
||||
sessions_mobs, issues, projects, errors, resources, assist, performance_event, sessions_favorite, \
|
||||
sessions_devtool, sessions_notes
|
||||
from chalicelib.utils import pg_client, helper, metrics_helper
|
||||
from chalicelib.utils import sql_helper as sh
|
||||
|
|
@ -63,7 +63,7 @@ def get_by_id2_pg(project_id, session_id, context: schemas_ee.CurrentContext, fu
|
|||
(SELECT project_key FROM public.projects WHERE project_id = %(project_id)s LIMIT 1) AS project_key,
|
||||
encode(file_key,'hex') AS file_key
|
||||
{"," if len(extra_query) > 0 else ""}{",".join(extra_query)}
|
||||
{(",json_build_object(" + ",".join([f"'{m}',p.{m}" for m in metadata._get_column_names()]) + ") AS project_metadata") if group_metadata else ''}
|
||||
{(",json_build_object(" + ",".join([f"'{m}',p.{m}" for m in metadata.column_names()]) + ") AS project_metadata") if group_metadata else ''}
|
||||
FROM public.sessions AS s {"INNER JOIN public.projects AS p USING (project_id)" if group_metadata else ""}
|
||||
WHERE s.project_id = %(project_id)s
|
||||
AND s.session_id = %(session_id)s;""",
|
||||
|
|
@ -575,6 +575,23 @@ def search_query_parts(data, error_status, errors_only, favorite_only, issue, pr
|
|||
ss_constraints.append(
|
||||
sh.multi_conditions(f"%({f_k})s {op} ANY (ms.issue_types)", f.value, is_not=is_not,
|
||||
value_key=f_k))
|
||||
# search sessions with click_rage on a specific selector
|
||||
if len(f.filters) > 0 and schemas.IssueType.click_rage in f.value:
|
||||
for j, sf in enumerate(f.filters):
|
||||
if sf.operator == schemas.IssueFilterOperator._on_selector:
|
||||
f_k = f"f_value{i}_{j}"
|
||||
full_args = {**full_args, **sh.multi_values(sf.value, value_key=f_k)}
|
||||
extra_constraints += ["mc.timestamp>=%(startDate)s",
|
||||
"mc.timestamp<=%(endDate)s",
|
||||
"mis.type='click_rage'",
|
||||
sh.multi_conditions(f"mc.selector=%({f_k})s",
|
||||
sf.value, is_not=is_not,
|
||||
value_key=f_k)]
|
||||
|
||||
extra_from += """INNER JOIN events.clicks AS mc USING(session_id)
|
||||
INNER JOIN events_common.issues USING (session_id,timestamp)
|
||||
INNER JOIN public.issues AS mis USING (issue_id)\n"""
|
||||
|
||||
elif filter_type == schemas.FilterType.events_count:
|
||||
extra_constraints.append(
|
||||
sh.multi_conditions(f"s.events_count {op} %({f_k})s", f.value, is_not=is_not,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue