Skip to content

Commit

Permalink
[Beat CM] Display config name instead of beat type in beat detail view (
Browse files Browse the repository at this point in the history
#23411)

* Update config table in beat detail view to show config type instead of beat type.

* Modify Beat Detail view to display human-friendly names for config block types.
  • Loading branch information
justinkambic authored Sep 21, 2018
1 parent 02bedce commit 0dc44ba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions x-pack/plugins/beats_management/public/pages/beat/detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import {
EuiText,
EuiTitle,
} from '@elastic/eui';
import { flatten } from 'lodash';
import { flatten, get } from 'lodash';
import React from 'react';
import { TABLE_CONFIG } from '../../../common/constants';
import { BeatTag, CMPopulatedBeat } from '../../../common/domain_types';
import { ConnectedLink } from '../../components/connected_link';
import { TagBadge } from '../../components/tag';
import { supportedConfigs } from '../../config_schemas';

interface BeatDetailPageProps {
beat: CMPopulatedBeat | undefined;
Expand All @@ -32,22 +33,29 @@ export const BeatDetailPage = (props: BeatDetailPageProps) => {
const configurationBlocks = flatten(
beat.full_tags.map((tag: BeatTag) => {
return tag.configuration_blocks.map(configuration => ({
...configuration,
// @ts-ignore one of the types on ConfigurationBlock doesn't define a "module" property
module: configuration.configs[0].module || null,
tagId: tag.id,
tagColor: tag.color,
...beat,
...configuration,
displayValue: get(
supportedConfigs.find(config => config.value === configuration.type),
'text',
null
),
}));
})
);

const columns = [
{
field: 'type',
field: 'displayValue',
name: 'Type',
sortable: true,
render: (type: string) => <EuiLink href="#">{type}</EuiLink>,
render: (value: string | null, configuration: any) => (
<EuiLink href="#">{value || configuration.type}</EuiLink>
),
},
{
field: 'module',
Expand Down

0 comments on commit 0dc44ba

Please sign in to comment.