openreplay/frontend/app/services/SearchService.ts
Shekar Siri 4a54830cad Refactor filtering system with improved autocomplete and event handling
- Add property type icons and improved filter categorization
- Implement virtualized filter selection with VList
- Update autocomplete to use new property-based endpoints
- Add support for event vs property filter distinction
- Improve top values fetching with proper caching
- Add cards/try endpoint routing in API client
- Various code style and formatting improvements
Refactor filtering system with improved autocomplete and event handling
2025-06-02 13:11:36 +02:00

66 lines
1.7 KiB
TypeScript

import BaseService from 'App/services/BaseService';
export default class SearchService extends BaseService {
async fetchSessions(params: any) {
const r = await this.client.post('/PROJECT_ID/sessions/search', params);
const j = await r.json();
return j.data;
}
async fetchSavedSearchList() {
const r = await this.client.get('/PROJECT_ID/saved_search');
const j = await r.json();
return j.data;
}
async deleteSavedSearch(id: string) {
const r = await this.client.delete(`/saved_search/${id}`);
const j = await r.json();
return j.data;
}
async fetchFilterSearch(params: any) {
const r = await this.client.get('/PROJECT_ID/events/search', params);
const j = await r.json();
return j.data;
}
async saveSavedSearch(data: any, id: string) {
const r = await this.client.post(
id ? `/PROJECT_ID/saved_search/${id}` : '/PROJECT_ID/saved_search',
data,
);
const j = await r.json();
return j.data;
}
async fetchSavedSearch() {
const r = await this.client.get('/PROJECT_ID/saved_search');
const j = await r.json();
return j.data;
}
async checkLatestSessions(filter: any) {
const r = await this.client.post('/PROJECT_ID/sessions/search/ids', filter);
const j = await r.json();
return j.data;
}
async fetchTopValues(params: {}): Promise<any> {
const r = await this.client.get(
'/pa/PROJECT_ID/properties/autocomplete',
params,
);
const j = await r.json();
return j.data;
}
async fetchAutoCompleteValues(params: {}): Promise<any> {
const r = await this.client.get(
'/pa/PROJECT_ID/properties/autocomplete',
params,
);
const j = await r.json();
return j.data;
}
}