From 0b63bdf94d3cccf0b42df729ca0f786d6455417e Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Wed, 2 Feb 2022 17:58:31 +0100 Subject: [PATCH] feat(api): changed autocomplete --- api/routers/core.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/api/routers/core.py b/api/routers/core.py index 9630fa6de..01df90ec6 100644 --- a/api/routers/core.py +++ b/api/routers/core.py @@ -105,14 +105,18 @@ def events_search(projectId: int, q: str, source: str = None, context: schemas.CurrentContext = Depends(OR_context)): if len(q) == 0: return {"data": []} - if isinstance(type, schemas.PerformanceEventType) \ - and type in [schemas.PerformanceEventType.location_dom_complete, - schemas.PerformanceEventType.location_largest_contentful_paint_time, - schemas.PerformanceEventType.location_ttfb, - schemas.PerformanceEventType.location_avg_cpu_load, - schemas.PerformanceEventType.location_avg_memory_usage - ]: - type = schemas.EventType.location + if isinstance(type, schemas.PerformanceEventType): + if type in [schemas.PerformanceEventType.location_dom_complete, + schemas.PerformanceEventType.location_largest_contentful_paint_time, + schemas.PerformanceEventType.location_ttfb, + schemas.PerformanceEventType.location_avg_cpu_load, + schemas.PerformanceEventType.location_avg_memory_usage + ]: + type = schemas.EventType.location + elif type in [schemas.PerformanceEventType.fetch_failed]: + type = schemas.EventType.request + else: + return {"data": []} result = events.search_pg2(text=q, event_type=type, project_id=projectId, source=source, key=key) return result