Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
];

Expand Down
Loading