diff --git a/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue b/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue index 65af27a5b0..ee6dee39ca 100644 --- a/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue +++ b/apps/web/src/services/alert-manager/v2/components/AlertsManagementTable.vue @@ -200,36 +200,14 @@ const handleCustomFieldUpdate = (fields: DataTableFieldType[]) => { state.fields = fields; }; const handleExportToExcel = async () => { - // TODO: File manager changes need to be applied. - // const alertsExcelExportParams: ExportParameter = { - // file_name: FILE_NAME_PREFIX.alert, - // options: [ - // { - // name: 'Alert List', - // query_type: QueryType.SEARCH, - // search_query: { - // ...alertListApiQueryHelper.data, - // fields: ALERT_EXCEL_FIELDS, - // }, - // }, - // ], - // timezone: storeState.timezone, - // }; - // return SpaceConnector.clientV2.alertManager.alert.export(alertsExcelExportParams); - const data = state.refinedAlertList.map((i) => ({ - service_name: storeState.serviceList[i.service_id].data.name, - title: i.title, - description: i.description, - status: i.status, - urgency: i.urgency, - labels: i.labels, - triggered_by: getCreatedByNames(i.triggered_by), - created_at: i.created_at, - })); await downloadExcel({ - data, + url: '/alert-manager/alert/list', + param: { + query: { ...alertListApiQueryHelper.data, only: ALERT_EXCEL_FIELDS.map((d) => d.key) }, + }, fields: ALERT_EXCEL_FIELDS, file_name_prefix: FILE_NAME_PREFIX.alert, + timezone: storeState.timezone, }); }; diff --git a/apps/web/src/services/alert-manager/v2/constants/alert-table-constant.ts b/apps/web/src/services/alert-manager/v2/constants/alert-table-constant.ts index adb365f863..f6e47cf837 100644 --- a/apps/web/src/services/alert-manager/v2/constants/alert-table-constant.ts +++ b/apps/web/src/services/alert-manager/v2/constants/alert-table-constant.ts @@ -37,13 +37,13 @@ export const ALERT_MANAGEMENT_TABLE_HANDLER: AlertManagementTableHandlerType = { }, }; export const ALERT_EXCEL_FIELDS: ExcelDataField[] = [ - { key: 'service_name', name: 'Service' }, + { key: 'service_id', name: 'Service', reference: { reference_key: 'service_id', resource_type: 'alert_manager.Service' } }, { key: 'title', name: 'Title' }, { key: 'description', name: 'Description' }, { key: 'status', name: 'Status' }, { key: 'urgency', name: 'Urgency' }, { key: 'labels', name: 'Labels' }, - { key: 'triggered_by', name: 'Triggered by' }, + { key: 'triggered_by', name: 'Triggered by', reference: { reference_key: 'webhook_id', resource_type: 'alert_manager.Webhook' } }, { key: 'created_at', name: 'Created' }, ];