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] Manage Tags #21776

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ae0f496
[ML] Fixing issue with historical job audit messages (#21718)
jgowdyelastic Aug 7, 2018
dc0b707
Add proper aria-label for close inspector (#21719)
timroes Aug 7, 2018
4cf3308
[Beats Management] Initial scaffolding for plugin (#18977)
ycombinator May 11, 2018
88dcee6
[Beats Management] Install Beats index template on plugin init (#19072)
ycombinator May 15, 2018
cc7759f
[Beats Management] APIs: Create enrollment tokens (#19018)
ycombinator May 15, 2018
7468f99
Fixing name of test file (#19100)
ycombinator May 16, 2018
4193a51
[Beats Management] APIs: Enroll beat (#19056)
ycombinator May 16, 2018
29c9876
[Beats Management] APIs: List beats (#19086)
ycombinator May 16, 2018
88a0e56
[Beats Management] APIs: Verify beats (#19103)
ycombinator May 17, 2018
75cf004
Fixing assertions (#19194)
ycombinator May 18, 2018
3d8ca8a
[Beats Management] APIs: Update beat (#19148)
ycombinator May 21, 2018
66eb24c
[Beats Management] APIs: take auth tokens via headers (#19210)
ycombinator May 22, 2018
02ee43c
[Beats Management] APIs: Create configuration block (#19270)
ycombinator May 22, 2018
c5cbf11
Revert implementation of `POST /api/beats/configuration_blocks` API (…
ycombinator May 23, 2018
fbfbeba
[Beats Management] APIs: Create or update tag (#19342)
ycombinator May 23, 2018
1d766e3
[Beats Management] Prevent timing attacks when checking auth tokens (…
ycombinator May 25, 2018
d2ec2b7
[Beats Management] APIs: Assign tag(s) to beat(s) (#19431)
ycombinator May 31, 2018
29e8cf2
[Beats Management] APIs: Remove tag(s) from beat(s) (#19440)
ycombinator May 31, 2018
7338f13
[Beats Management] Move to Ingest UI arch and initial TS effort (#20039)
mattapperson Jun 26, 2018
c4d0776
[Beats Management] Move tokens to use JWT, add more complete test sui…
mattapperson Jul 6, 2018
f0d8c97
[Beats Management] add more tests, update types, break out ES into it…
mattapperson Jul 12, 2018
d2aa659
[Beats Management] add get beat endpoint (#20603)
mattapperson Jul 13, 2018
afdca74
fix bad rebase
mattapperson Jul 13, 2018
94be8ff
[Beats Management] [WIP] Create public resources for management plugi…
justinkambic Jul 17, 2018
d632dca
Beats/initial ui (#20994)
mattapperson Jul 26, 2018
4025917
add getAll method to tags adapter (#21287)
mattapperson Jul 26, 2018
87a8991
Beats/real adapters (#21481)
mattapperson Aug 2, 2018
1369e68
[Beats Management] Add BeatsTable/Bulk Action Search Component (#21182)
justinkambic Aug 3, 2018
93dac60
Beats/basic use cases (#21660)
mattapperson Aug 3, 2018
1e8415d
add update on client side, expand update on server to allow for parti…
mattapperson Aug 6, 2018
d7d6839
remove double beat lookup
mattapperson Aug 6, 2018
e9dab95
fix tests
mattapperson Aug 6, 2018
ad79998
only return active beats
mattapperson Aug 6, 2018
8d1030a
disenroll now working
mattapperson Aug 6, 2018
013b5cc
fig getAll query
mattapperson Aug 6, 2018
f07e713
re-enrolling a beat will now work
mattapperson Aug 6, 2018
c27491e
fix types
mattapperson Aug 7, 2018
c5fc941
Merge branch 'feature/x-pack/management/beats' into beats/update
mattapperson Aug 7, 2018
ab999d0
Add create tags view.
justinkambic Aug 7, 2018
f7c01fe
fix types
mattapperson Aug 7, 2018
f8faae9
update deps
mattapperson Aug 7, 2018
e270774
update kibana API for version
mattapperson Aug 7, 2018
a78f50a
Merge branch 'pr/21702' into ui/create-tag2
justinkambic Aug 8, 2018
369e200
Added component/config interface for editing/creating tags. Added sep…
justinkambic Aug 8, 2018
5eff1a6
Merge branch 'feature/x-pack/management/beats' into ui/create-tag
justinkambic Aug 8, 2018
2e484e5
Fixup.
justinkambic Aug 8, 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,8 @@
/*
* 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.
*/

export { TagCreateConfig, TagEditConfig, TagViewConfig } from './tag_configs';
export { TagEdit } from './tag_edit';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 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.
*/

export interface TagViewConfig {
showAttachedBeats: boolean;
}

export const TagCreateConfig: TagViewConfig = {
showAttachedBeats: false,
};

export const TagEditConfig: TagViewConfig = {
showAttachedBeats: true,
};
232 changes: 232 additions & 0 deletions x-pack/plugins/beats_management/public/components/tag/tag_edit.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
/*
* 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 {
// @ts-ignore
EuiBadge,
EuiButton,
EuiButtonEmpty,
// @ts-ignore
EuiCodeEditor,
// @ts-ignore
EuiColorPicker,
EuiFieldText,
EuiFlexGroup,
EuiFlexItem,
EuiFlyout,
EuiFlyoutBody,
EuiFlyoutFooter,
EuiFlyoutHeader,
// @ts-ignore
EuiForm,
EuiFormRow,
EuiPanel,
// @ts-ignore
EuiSearchBar,
EuiSpacer,
// @ts-ignore
EuiTabbedContent,
EuiText,
EuiTitle,
} from '@elastic/eui';
import 'brace/mode/yaml';
import 'brace/theme/github';
import React from 'react';
import { ConfigurationBlock } from '../../../common/domain_types';
import { Table } from '../table';
import { BeatsTableType } from '../table';
import { TagViewConfig } from '../tag';

interface TagEditProps {
items: any[];
config: TagViewConfig;
}

interface TagEditState {
color: string | null;
configurationBlocks: ConfigurationBlock[];
showFlyout: boolean;
tableRef: any;
tagName: string | null;
}

export class TagEdit extends React.PureComponent<TagEditProps, TagEditState> {
constructor(props: TagEditProps) {
super(props);

this.state = {
color: '#DD0A73',
configurationBlocks: [],
showFlyout: false,
tableRef: React.createRef(),
tagName: null,
};
}

public render() {
const {
config: { showAttachedBeats },
items,
} = this.props;
const { color, configurationBlocks, tagName } = this.state;
return (
<div>
<EuiTitle size="m">
<h1>Add a new tag</h1>
</EuiTitle>
<EuiSpacer size="m" />
<EuiPanel>
<EuiFlexGroup>
<EuiFlexItem>
<EuiTitle size="xs">
<h3>Define this tag</h3>
</EuiTitle>
<EuiText color="subdued">
<p>
Tags will apply a set configuration to a group of beats.
<br />
The tag type defines the options available.
</p>
</EuiText>
<div>
<EuiBadge color={color ? color : '#FF0'}>{tagName ? tagName : 'Tag name'}</EuiBadge>
</div>
</EuiFlexItem>
<EuiFlexItem>
<EuiForm>
<EuiFormRow label="Name">
<EuiFieldText
name="tagName"
onChange={this.updateBadgeName}
placeholder="Tag name"
/>
</EuiFormRow>
<EuiFormRow label="Color">
<EuiColorPicker color={color} onChange={this.updateBadgeColor} />
</EuiFormRow>
</EuiForm>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
<EuiSpacer />
<EuiPanel>
<EuiFlexGroup alignItems={configurationBlocks.length ? 'stretch' : 'center'}>
<EuiFlexItem>
<EuiTitle size="xs">
<h3>Configurations</h3>
</EuiTitle>
<EuiText color="subdued">
<p>
You can have multiple configurations applied to an individual tag. These
configurations can repeat or mix types as necessary. For example, you may utilize
three metricbeat configurations alongside one input and filebeat configuration.
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<div>
<EuiButton onClick={this.openConfigFlyout}>Add a new configuration</EuiButton>
</div>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
<EuiSpacer />
{showAttachedBeats && (
<EuiPanel paddingSize="m">
<EuiTitle size="xs">
<h3>Attached Beats</h3>
</EuiTitle>
<Table
actionHandler={(a, b) => {
/* TODO: handle assignment/delete actions */
}}
assignmentOptions={[]}
assignmentTitle={null}
items={items}
ref={this.state.tableRef}
showAssignmentOptions={false}
type={BeatsTableType}
/>
</EuiPanel>
)}
<EuiSpacer size="m" />
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiButton fill isDisabled={true}>
Save
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty>Cancel</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
{this.state.showFlyout && (
<EuiFlyout onClose={() => this.setState({ showFlyout: false })}>
<EuiFlyoutHeader>
<EuiTitle size="m">
<h2>Add Configuration</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
<EuiFormRow label="Configuration type">
<EuiSearchBar
onChange={() => {
// TODO: handle search changes
}}
/>
</EuiFormRow>
<EuiFormRow label="Configuration description">
<EuiFieldText
onChange={() => {
// TODO: update field value
}}
placeholder="Description (optional)"
/>
</EuiFormRow>
<EuiTabbedContent
tabs={[
{
id: 'basic_settings',
name: 'Basic Settings',
content: <div>Add configuration options here</div>,
},
{
id: 'yaml_editor',
name: 'YAML Editor',
content: <EuiCodeEditor mode="yaml" theme="github" />,
},
]}
/>
</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiButtonEmpty
iconType="cross"
onClick={() => this.setState({ showFlyout: false })}
>
Close
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton fill>Save</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlyoutFooter>
</EuiFlyout>
)}
</div>
);
}

private openConfigFlyout = () => {
this.setState({
showFlyout: true,
});
};
private updateBadgeColor = (e: any) => this.setState({ color: e });
private updateBadgeName = (e: any) => this.setState({ tagName: e.target.value });
}
40 changes: 40 additions & 0 deletions x-pack/plugins/beats_management/public/pages/main/create_tag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 'brace/mode/yaml';
import 'brace/theme/github';
import React from 'react';
import { ConfigurationBlock } from '../../../common/domain_types';
import { TagCreateConfig, TagEdit } from '../../components/tag';
import { FrontendLibs } from '../../lib/lib';

interface CreateTagPageProps {
libs: FrontendLibs;
}

interface CreateTagPageState {
color: string | null;
configurationBlocks: ConfigurationBlock[];
showFlyout: boolean;
tagName: string | null;
}

export class CreateTagPage extends React.PureComponent<CreateTagPageProps, CreateTagPageState> {
constructor(props: CreateTagPageProps) {
super(props);

this.state = {
color: '#DD0A73',
configurationBlocks: [],
showFlyout: false,
tagName: null,
};
}

public render() {
return <TagEdit config={TagCreateConfig} items={[]} />;
}
}
40 changes: 40 additions & 0 deletions x-pack/plugins/beats_management/public/pages/main/edit_tag.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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 'brace/mode/yaml';
import 'brace/theme/github';
import React from 'react';
import { ConfigurationBlock } from '../../../common/domain_types';
import { TagEdit, TagEditConfig } from '../../components/tag';
import { FrontendLibs } from '../../lib/lib';

interface EditTagPageProps {
libs: FrontendLibs;
}

interface EditTagPageState {
color: string | null;
configurationBlocks: ConfigurationBlock[];
showFlyout: boolean;
tagName: string | null;
}

export class EditTagPage extends React.PureComponent<EditTagPageProps, EditTagPageState> {
constructor(props: EditTagPageProps) {
super(props);

this.state = {
color: '#DD0A73',
configurationBlocks: [],
showFlyout: false,
tagName: null,
};
}

public render() {
return <TagEdit config={TagEditConfig} items={[]} />;
}
}
22 changes: 22 additions & 0 deletions x-pack/plugins/beats_management/public/pages/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { PrimaryLayout } from '../../components/layouts/primary';
import { FrontendLibs } from '../../lib/lib';
import { ActivityPage } from './activity';
import { BeatsPage } from './beats';
import { CreateTagPage } from './create_tag';
import { EditTagPage } from './edit_tag';
import { TagsPage } from './tags';

interface MainPagesProps {
Expand Down Expand Up @@ -60,6 +62,16 @@ export class MainPages extends React.PureComponent<MainPagesProps, MainPagesStat
name: 'Tags',
disabled: false,
},
{
id: '/createtag',
name: 'Create Tag',
disabled: false,
},
{
id: '/edittag',
name: 'Edit Tag',
disabled: false,
},
];

const renderedTabs = tabs.map((tab, index) => (
Expand Down Expand Up @@ -106,6 +118,16 @@ export class MainPages extends React.PureComponent<MainPagesProps, MainPagesStat
exact={true}
render={(props: any) => <TagsPage libs={this.props.libs} {...props} />}
/>
<Route
path="/createtag"
exact={true}
render={(props: any) => <CreateTagPage libs={this.props.libs} {...props} />}
/>
<Route
path="/edittag"
exact={true}
render={(props: any) => <EditTagPage libs={this.props.libs} {...props} />}
/>
</Switch>
</PrimaryLayout>
);
Expand Down