forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tech Debt] Reorder Alerts page (elastic#152888)
- Loading branch information
1 parent
6b7cc2f
commit 9853983
Showing
64 changed files
with
392 additions
and
734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...k/plugins/observability/public/components/alerts_table/get_alerts_table_configuration.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { GetRenderCellValue } from '@kbn/triggers-actions-ui-plugin/public'; | ||
import { TIMESTAMP } from '@kbn/rule-data-utils'; | ||
import { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | ||
import { | ||
AlertsTableConfigurationRegistry, | ||
RenderCustomActionsRowArgs, | ||
} from '@kbn/triggers-actions-ui-plugin/public/types'; | ||
import { casesFeatureId, observabilityFeatureId } from '../../../common'; | ||
import { useBulkAddToCaseTriggerActions } from '../../hooks/use_alert_bulk_case_actions'; | ||
import { getRenderCellValue } from './render_cell_value'; | ||
import { columns } from './default_columns'; | ||
import { | ||
AlertActions, | ||
Props as AlertActionsProps, | ||
} from '../../pages/alerts/components/alert_actions'; | ||
import { useGetAlertFlyoutComponents } from '../use_get_alert_flyout_components'; | ||
import type { ObservabilityRuleTypeRegistry } from '../../rules/create_observability_rule_type_registry'; | ||
import type { ConfigSchema } from '../../plugin'; | ||
import type { TopAlert } from '../../typings/alerts'; | ||
|
||
export const getAlertsTableConfiguration = ( | ||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry, | ||
config: ConfigSchema | ||
): AlertsTableConfigurationRegistry => ({ | ||
id: observabilityFeatureId, | ||
casesFeatureId, | ||
columns, | ||
getRenderCellValue: (({ setFlyoutAlert }: { setFlyoutAlert: (data: TopAlert) => void }) => { | ||
return getRenderCellValue({ observabilityRuleTypeRegistry, setFlyoutAlert }); | ||
}) as unknown as GetRenderCellValue, | ||
sort: [ | ||
{ | ||
[TIMESTAMP]: { | ||
order: 'desc' as SortOrder, | ||
}, | ||
}, | ||
], | ||
useActionsColumn: () => ({ | ||
renderCustomActionsRow: ({ alert, id, setFlyoutAlert }: RenderCustomActionsRowArgs) => { | ||
return ( | ||
<AlertActions | ||
config={config} | ||
data={Object.entries(alert).reduce<AlertActionsProps['data']>( | ||
(acc, [field, value]) => [...acc, { field, value: value as string[] }], | ||
[] | ||
)} | ||
ecsData={{ _id: alert._id, _index: alert._index }} | ||
eventId={alert._id} | ||
id={id} | ||
observabilityRuleTypeRegistry={observabilityRuleTypeRegistry} | ||
setFlyoutAlert={setFlyoutAlert} | ||
/> | ||
); | ||
}, | ||
}), | ||
useBulkActions: useBulkAddToCaseTriggerActions, | ||
useInternalFlyout: () => { | ||
const { header, body, footer } = useGetAlertFlyoutComponents(observabilityRuleTypeRegistry); | ||
return { header, body, footer }; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.