diff --git a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts index e2602c3041..97f46373a6 100644 --- a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts +++ b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.component.ts @@ -382,7 +382,7 @@ export class CreateProjectComponent implements OnInit { if (this.privateService.getProjectDetails?.type === 'incoming') return; try { - const response = await this.createProjectService.getEventTypes(); + const response = await this.privateService.getEventTypes(); this.eventTypes = response.data.event_types ? response.data.event_types : []; return; } catch (error) { diff --git a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.service.ts b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.service.ts index fa4a7ee440..16936c6dad 100644 --- a/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.service.ts +++ b/web/ui/dashboard/src/app/private/components/create-project-component/create-project-component.service.ts @@ -60,22 +60,6 @@ export class CreateProjectComponentService { }); } - async getEventTypes(): Promise { - return new Promise(async (resolve, reject) => { - try { - const response = await this.http.request({ - url: `/event-types`, - method: 'get', - level: 'org_project' - }); - - return resolve(response); - } catch (error) { - return reject(error); - } - }); - } - createEventType(requestDetails: any): Promise { return new Promise(async (resolve, reject) => { try { diff --git a/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.component.ts b/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.component.ts index 652b233264..7f6c3bdce9 100644 --- a/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.component.ts +++ b/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.component.ts @@ -177,7 +177,7 @@ export class CreateSubscriptionComponent implements OnInit { if (this.privateService.getProjectDetails?.type === 'incoming') return; try { - const response = await this.createSubscriptionService.getEventTypes(); + const response = await this.privateService.getEventTypes(); const { event_types } = response.data; this.eventTypes = event_types.filter((type: EVENT_TYPE) => !type.deprecated_at) diff --git a/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.service.ts b/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.service.ts index 72c0fb98f6..539cef64f1 100644 --- a/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.service.ts +++ b/web/ui/dashboard/src/app/private/components/create-subscription/create-subscription.service.ts @@ -106,20 +106,4 @@ export class CreateSubscriptionService { } }); } - - async getEventTypes(): Promise { - return new Promise(async (resolve, reject) => { - try { - const response = await this.http.request({ - url: `/event-types`, - method: 'get', - level: 'org_project' - }); - - return resolve(response); - } catch (error) { - return reject(error); - } - }); - } } diff --git a/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.html b/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.html index c7daafa240..3ff54144a6 100644 --- a/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.html +++ b/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.html @@ -167,15 +167,21 @@
Event Type
-
-
- search icon - - -
-
+ + +
diff --git a/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.ts b/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.ts index 37ae0ccc4e..e5da5d8d80 100644 --- a/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.ts +++ b/web/ui/dashboard/src/app/private/components/event-delivery-filter/event-delivery-filter.component.ts @@ -4,7 +4,7 @@ import { ButtonComponent } from 'src/app/components/button/button.component'; import { DatePickerComponent } from 'src/app/components/date-picker/date-picker.component'; import { EndpointFilterComponent } from '../endpoints-filter/endpoints-filter.component'; import { DropdownComponent, DropdownOptionDirective } from 'src/app/components/dropdown/dropdown.component'; -import { FILTER_QUERY_PARAM } from 'src/app/models/event.model'; +import { EVENT_TYPE, FILTER_QUERY_PARAM } from 'src/app/models/event.model'; import { ActivatedRoute } from '@angular/router'; import { ListItemComponent } from 'src/app/components/list-item/list-item.component'; import { ProjectService } from '../../pages/project/project.service'; @@ -61,6 +61,8 @@ export class EventDeliveryFilterComponent implements OnInit { { name: 'Endpoint', id: 'endpoint', show: false }, { name: 'Event type', id: 'eventType', show: false } ]; + + eventTypes: EVENT_TYPE[] = []; constructor(private route: ActivatedRoute, private _location: Location, public projectService: ProjectService, private privateService: PrivateService, private generalService: GeneralService, public licenseService: LicensesService) {} async ngOnInit() { @@ -78,6 +80,8 @@ export class EventDeliveryFilterComponent implements OnInit { if (this.eventDeliveriesEndpoint) this.eventDeliveriesEndpointData = await this.getSelectedEndpointData(); if (!this.portalToken || this.projectService.activeProjectDetails?.type == 'incoming') this.getSourcesForFilter(); + + this.getEventTypesForFilter(); } getFiltersFromURL() { @@ -185,9 +189,9 @@ export class EventDeliveryFilterComponent implements OnInit { this.filter.emit(this.queryParams); } - setEventType() { - this.eventDelEventType = this.eventsTypeSearchString; - this.queryParams = this.generalService.addFilterToURL({ ...this.queryParams, eventType: this.eventsTypeSearchString }); + setEventType(eventType: string) { + this.eventDelEventType = eventType; + this.queryParams = this.generalService.addFilterToURL({ ...this.queryParams, eventType }); this.checkIfTailModeIsEnabled() ? this.toggleTailMode(false, 'on') : this.toggleTailMode(false, 'off'); this.filter.emit(this.queryParams); this.toggleFilter('eventType', false); @@ -260,6 +264,18 @@ export class EventDeliveryFilterComponent implements OnInit { } catch (error) {} } + async getEventTypesForFilter() { + if (this.projectService.activeProjectDetails?.type === 'incoming') return; + try { + const response = await this.privateService.getEventTypes(); + this.eventTypes = response.data.event_types ? response.data.event_types : []; + return; + } catch (error) { + return; + } + } + + showBatchRetry() { this.batchRetry.emit(this.queryParams); } diff --git a/web/ui/dashboard/src/app/private/private.service.ts b/web/ui/dashboard/src/app/private/private.service.ts index 62747c1eb9..51543a52d6 100644 --- a/web/ui/dashboard/src/app/private/private.service.ts +++ b/web/ui/dashboard/src/app/private/private.service.ts @@ -410,6 +410,22 @@ export class PrivateService { level: 'org_project' }); + return resolve(response); + } catch (error) { + return reject(error); + } + }); + } + + async getEventTypes(): Promise { + return new Promise(async (resolve, reject) => { + try { + const response = await this.http.request({ + url: `/event-types`, + method: 'get', + level: 'org_project' + }); + return resolve(response); } catch (error) { return reject(error);