Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Beats CM] Disallow tag assignment for multiple outputs #24106

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
46135cd
[Beats Management] Initial scaffolding for plugin (#18977)
ycombinator May 11, 2018
40719d7
[Beats Management] Install Beats index template on plugin init (#19072)
ycombinator May 15, 2018
dd6ac3c
[Beats Management] APIs: Create enrollment tokens (#19018)
ycombinator May 15, 2018
692e668
Fixing name of test file (#19100)
ycombinator May 16, 2018
4676f3b
[Beats Management] APIs: Enroll beat (#19056)
ycombinator May 16, 2018
2a6ebda
[Beats Management] APIs: List beats (#19086)
ycombinator May 16, 2018
ebe3fac
[Beats Management] APIs: Verify beats (#19103)
ycombinator May 17, 2018
2cea7a6
Fixing assertions (#19194)
ycombinator May 18, 2018
6e2c1a3
[Beats Management] APIs: Update beat (#19148)
ycombinator May 21, 2018
36962f0
[Beats Management] APIs: take auth tokens via headers (#19210)
ycombinator May 22, 2018
07f78be
[Beats Management] APIs: Create configuration block (#19270)
ycombinator May 22, 2018
1bcf5ba
Revert implementation of `POST /api/beats/configuration_blocks` API (…
ycombinator May 23, 2018
710e7c7
[Beats Management] APIs: Create or update tag (#19342)
ycombinator May 23, 2018
239de1c
[Beats Management] Prevent timing attacks when checking auth tokens (…
ycombinator May 25, 2018
5f97a92
[Beats Management] APIs: Assign tag(s) to beat(s) (#19431)
ycombinator May 31, 2018
8436fc3
[Beats Management] APIs: Remove tag(s) from beat(s) (#19440)
ycombinator May 31, 2018
0ffc218
[Beats Management] Move to Ingest UI arch and initial TS effort (#20039)
mattapperson Jun 26, 2018
ef4946a
[Beats Management] Move tokens to use JWT, add more complete test sui…
mattapperson Jul 6, 2018
adfb1b9
[Beats Management] add more tests, update types, break out ES into it…
mattapperson Jul 12, 2018
13d212d
[Beats Management] add get beat endpoint (#20603)
mattapperson Jul 13, 2018
22bfd0f
fix bad rebase
mattapperson Jul 13, 2018
e31856e
[Beats Management] [WIP] Create public resources for management plugi…
justinkambic Jul 17, 2018
d18218f
Beats/initial ui (#20994)
mattapperson Jul 26, 2018
a0d814a
add getAll method to tags adapter (#21287)
mattapperson Jul 26, 2018
3953fb4
Beats/real adapters (#21481)
mattapperson Aug 2, 2018
b68dab8
[Beats Management] Add BeatsTable/Bulk Action Search Component (#21182)
justinkambic Aug 3, 2018
2089fe8
Beats/basic use cases (#21660)
mattapperson Aug 3, 2018
264a566
[Beats Management] Add Tags List (#21274)
justinkambic Aug 7, 2018
bb7d0e7
Beats/update (#21702)
mattapperson Aug 8, 2018
13bf2bc
[Beats CM] Manage Tags (#21776)
justinkambic Aug 8, 2018
cd8f274
Beats/beat tags workflow (#21923)
mattapperson Aug 15, 2018
b0f0848
Beats/config view (#22177)
mattapperson Aug 28, 2018
e4b3ad2
Beats/security (#22500)
mattapperson Aug 30, 2018
fdc4286
[Beats CM] Add beats details pages (#22455)
justinkambic Aug 30, 2018
c4e55d4
[Beats CM] move to json for configs (#22693)
mattapperson Sep 5, 2018
09042bb
add fixes (#22711)
mattapperson Sep 5, 2018
ff64079
[Beats CM] Improve UX for assignment of tag to list of beats (#22687)
justinkambic Sep 5, 2018
6ecce0f
[Beats CM] Sort beat list tags (#22729)
justinkambic Sep 7, 2018
5c4a8d9
[Beats CM] Remove key warnings from beat list components (#22772)
justinkambic Sep 7, 2018
27a1485
[Beats CM] Add check for BeatsPage component to avoid setState when u…
justinkambic Sep 10, 2018
3047e08
Update field name in table type config. (#23228)
justinkambic Sep 17, 2018
1c8ccda
Utilize TagBadge functional component to standardize display of tag n…
justinkambic Sep 17, 2018
e53366a
[Beats CM] Add beat name to update endpoint (#23291)
justinkambic Sep 20, 2018
689a740
Edit beats list table config to display most recently-updated tag tim…
justinkambic Sep 21, 2018
43c09a4
Update beat detail view info. (#23369)
justinkambic Sep 21, 2018
c1cd328
[Beat CM] Show only tags associated with selected beat (#23398)
justinkambic Sep 21, 2018
02bedce
Display beat name instead of ID on details screen. (#23410)
justinkambic Sep 21, 2018
0dc44ba
[Beat CM] Display config name instead of beat type in beat detail vie…
justinkambic Sep 21, 2018
27e96f0
[Beats CM] Add password input and re-enable output config schema (#23…
justinkambic Sep 24, 2018
6231db6
Add full list of current Filebeat & Metricbeat module (#23258)
exekias Sep 25, 2018
f93d715
Beats/ui tweaks (#23655)
mattapperson Oct 2, 2018
e85d867
Add walkthrough (#23785)
mattapperson Oct 4, 2018
1562dc5
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 4, 2018
c0ccab5
update yarn lock files
mattapperson Oct 4, 2018
77dbe52
fix prettier
mattapperson Oct 4, 2018
78fe612
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 8, 2018
07d915e
fix x-pack package.json formatting
mattapperson Oct 8, 2018
3e6d475
update kbn server creation
mattapperson Oct 9, 2018
bd117a4
remove types from old table implementation
mattapperson Oct 9, 2018
1cc3296
move to Boom.boomify
mattapperson Oct 9, 2018
d38123b
fix TS errors
mattapperson Oct 9, 2018
c1468a5
fix type
mattapperson Oct 9, 2018
0639f33
rollback dep version
mattapperson Oct 9, 2018
edd7e00
fix more conflicting dep issues
mattapperson Oct 9, 2018
8b97759
deps
mattapperson Oct 9, 2018
9b5bd6e
force correct node type resolution
mattapperson Oct 9, 2018
6c3314d
cleanup and skip tests (kbn test util is broken)
mattapperson Oct 10, 2018
c437c1b
added formsy and basePath
mattapperson Oct 10, 2018
6257297
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 10, 2018
b84233d
update yarn lock file
mattapperson Oct 10, 2018
eded0a4
add beats management icon
mattapperson Oct 10, 2018
3d41c9f
rename beats management main section
mattapperson Oct 10, 2018
2d83d47
Tags now called Configuration Tags in the tabs
mattapperson Oct 14, 2018
4c0cecb
tokens must expire at most after 2 weeks
mattapperson Oct 14, 2018
f46e714
fix bad auto-import
mattapperson Oct 14, 2018
e78beb6
beat details now shows the extra data needed
mattapperson Oct 14, 2018
0ffe1d0
tweak package.json deps for continuity
mattapperson Oct 16, 2018
68e3481
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 16, 2018
66f8afc
update yarn lock for new yarn version
mattapperson Oct 16, 2018
234eae0
[Beats CM] Re-arch table assignment control definitions (#23663)
justinkambic Oct 16, 2018
c95b30d
Tweaked enrollment UI to inlcude beat type selection
mattapperson Oct 16, 2018
dd53a3b
Merge branch 'feature/x-pack/management/beats' of github.com:elastic/…
mattapperson Oct 16, 2018
8f472fd
Reduce badge list gutter size, change logic for tag assignment to una…
justinkambic Oct 16, 2018
a4b90e5
dont use genaric search bar
mattapperson Oct 16, 2018
c63ce93
Merge branch 'feature/x-pack/management/beats' of github.com:elastic/…
mattapperson Oct 16, 2018
e143abf
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 16, 2018
7c6efe3
Add logic to gray out tag badges in list.
justinkambic Oct 16, 2018
0b44822
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 16, 2018
cb6fc73
Update logic for mapping tags to unassigned state.
justinkambic Oct 16, 2018
63f5d79
Destructure anonymous function parameters.
justinkambic Oct 16, 2018
411f9e3
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 17, 2018
f627957
removed unused import
mattapperson Oct 17, 2018
638540b
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 17, 2018
d6d7c87
fix es-lint error
mattapperson Oct 17, 2018
7033d53
fix outputs
mattapperson Oct 17, 2018
b488c98
fix types from infra merge
mattapperson Oct 17, 2018
30ac542
remove dupe dep
mattapperson Oct 17, 2018
2e4b9d2
Update tag disable logic to check for uniqueness requirements.
justinkambic Oct 17, 2018
638ba5b
update lock file
mattapperson Oct 17, 2018
8be69a5
push another lock file
mattapperson Oct 17, 2018
0ac378b
Merge branch 'master' of github.com:elastic/kibana into feature/x-pac…
mattapperson Oct 17, 2018
d0f0557
Add unfilteredBeats field to beat list state to prevent inappropriate…
justinkambic Oct 17, 2018
f88afec
fix yarn lock because yarn is dumb
mattapperson Oct 17, 2018
5f94892
Merge branch 'feature/x-pack/management/beats' of github.com:elastic/…
mattapperson Oct 17, 2018
1e90c73
Fix broken tests
mattapperson Oct 18, 2018
1c3ff3d
Merge branch 'feature/x-pack/management/beats' into beatsCM_disallow-…
justinkambic Oct 18, 2018
925c9b9
Merge branch 'master' into beatsCM_disallow-tag-assignment-for-multip…
justinkambic Oct 18, 2018
62e36f1
Remove unused import.
justinkambic Oct 18, 2018
02a0515
Merge branch 'master' into beatsCM_disallow-tag-assignment-for-multip…
justinkambic Oct 18, 2018
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
@@ -0,0 +1,25 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiBadge } from '@elastic/eui';
import React from 'react';
import { TABLE_CONFIG } from '../../../common/constants';

interface TagBadgeProps {
maxIdRenderSize?: number;
id: string;
}

export const DisabledTagBadge = (props: TagBadgeProps) => {
const { id, maxIdRenderSize } = props;
const idRenderSize = maxIdRenderSize || TABLE_CONFIG.TRUNCATE_TAG_LENGTH;
const idToRender = id.length > idRenderSize ? `${id.substring(0, idRenderSize)}...` : id;
return (
<EuiBadge color="default" iconType="cross">
{idToRender}
</EuiBadge>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@
import { EuiBadge } from '@elastic/eui';
import React from 'react';
import { TABLE_CONFIG } from '../../../common/constants';
import { DisabledTagBadge } from './disabled_tag_badge';

interface TagBadgeProps {
iconType?: any;
onClick?: () => void;
onClickAriaLabel?: string;
maxIdRenderSize?: number;
tag: { color?: string; id: string };
tag: { color?: string; disabled?: boolean; id: string };
}

export const TagBadge = (props: TagBadgeProps) => {
const {
iconType,
onClick,
onClickAriaLabel,
tag: { color, id },
tag: { color, disabled, id },
} = props;

const maxIdRenderSize = props.maxIdRenderSize || TABLE_CONFIG.TRUNCATE_TAG_LENGTH;
const idToRender = id.length > maxIdRenderSize ? `${id.substring(0, maxIdRenderSize)}...` : id;
return (
return disabled ? (
<DisabledTagBadge maxIdRenderSize={props.maxIdRenderSize} id={id} />
) : (
<EuiBadge
color={color || 'primary'}
iconType={iconType}
Expand Down
35 changes: 32 additions & 3 deletions x-pack/plugins/beats_management/public/pages/main/beats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import {
EuiModalHeaderTitle,
EuiOverlayMask,
} from '@elastic/eui';
import { sortBy } from 'lodash';
import { flatten, intersection, sortBy } from 'lodash';
import moment from 'moment';
import React from 'react';
import { RouteComponentProps } from 'react-router';
import { CMPopulatedBeat } from '../../../common/domain_types';
import { UNIQUENESS_ENFORCING_TYPES } from 'x-pack/plugins/beats_management/common/constants';
import { BeatTag, CMPopulatedBeat, ConfigurationBlock } from '../../../common/domain_types';
import { BeatsTagAssignment } from '../../../server/lib/adapters/beats/adapter_types';
import { AppURLState } from '../../app';
import { BeatsTableType, Table } from '../../components/table';
Expand Down Expand Up @@ -122,7 +123,7 @@ export class BeatsPage extends React.PureComponent<BeatsPageProps, BeatsPageStat
value: this.props.urlState.beatsKBar || '',
}}
assignmentOptions={{
items: this.state.tags || [],
items: this.filterSelectedBeatTags(),
schema: beatsListAssignmentOptions,
type: 'assignment',
actionHandler: this.handleBeatsActions,
Expand Down Expand Up @@ -289,4 +290,32 @@ export class BeatsPage extends React.PureComponent<BeatsPageProps, BeatsPageStat
});
return beats;
};

private filterSelectedBeatTags = () => {
if (!this.state.tags) {
return [];
}
return this.selectedBeatConfigsRequireUniqueness()
? this.state.tags.map(this.disableTagForUniquenessEnforcement)
: this.state.tags;
};

private configBlocksRequireUniqueness = (configurationBlocks: ConfigurationBlock[]) =>
intersection(UNIQUENESS_ENFORCING_TYPES, configurationBlocks.map(block => block.type))
.length !== 0;

private disableTagForUniquenessEnforcement = (tag: BeatTag) =>
this.configBlocksRequireUniqueness(tag.configuration_blocks) &&
// if > 0 beats are associated with the tag, it will result in disassociation, so do not disable it
!this.getSelectedBeats().some(beat => beat.full_tags.some(({ id }) => id === tag.id))
? { ...tag, disabled: true }
: tag;

private selectedBeatConfigsRequireUniqueness = () =>
// union beat tags
flatten(this.getSelectedBeats().map(({ full_tags }) => full_tags))
// map tag list to bool
.map(({ configuration_blocks }) => this.configBlocksRequireUniqueness(configuration_blocks))
// reduce to result
.reduce((acc, cur) => acc || cur, false);
}