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

[Redesign add agent] Integration commands generator with UI #5593

Merged
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
005619d
Add useForm hook types
Machi3mfl May 15, 2023
c70bfdd
Add custom field use in useForm hook
Machi3mfl May 15, 2023
3f330ab
Add some code redeability fixes
Machi3mfl May 16, 2023
8179de0
Merge branch '4205-redesign-add-agent-page' into feat/5441-register-a…
Machi3mfl May 16, 2023
44384bc
Refactored useForm types and unit tests
Machi3mfl May 17, 2023
c91b6ff
Merge branch '4205-redesign-add-agent-page' into feat/5441-register-a…
Machi3mfl May 17, 2023
aad9795
Move types to types file
Machi3mfl May 17, 2023
2beb1c6
reuse of common form on the card
chantal-kelm May 17, 2023
0d06c89
Card with logic
chantal-kelm May 18, 2023
75dfe4b
CheckboxGroup component logic update
chantal-kelm May 18, 2023
e6c1516
CheckboxGroup component logic update
chantal-kelm May 18, 2023
e914de8
Adding card icons
chantal-kelm May 18, 2023
7816562
update checkbox logic, styles, and card styles
chantal-kelm May 19, 2023
2b36070
clean code
chantal-kelm May 19, 2023
dcf9fb1
clean code
chantal-kelm May 19, 2023
9ea9a5d
gitignore Mac files
chantal-kelm May 19, 2023
70056ea
updating checkbox logic, styles, and card styles
chantal-kelm May 19, 2023
21bf8fc
merge with 4205-redesign-add-agent-page and style update
chantal-kelm May 19, 2023
344c295
step component
chantal-kelm May 22, 2023
d63de90
Passing interfaces to a separate file, updating styles, and component…
chantal-kelm May 23, 2023
c7c6d1c
Update interfaces and clean up code
chantal-kelm May 23, 2023
81e6e5d
Merge branch '4205-redesign-add-agent-page' into 5477-create-componen…
chantal-kelm May 23, 2023
3061539
update of folder structure and step logic
chantal-kelm May 24, 2023
2eff32d
tcp, udp, protocols, password, groups, logics
chantal-kelm Jun 5, 2023
52b498e
input logic server address name password groups and styles
chantal-kelm Jun 8, 2023
7caaca9
group input logic
chantal-kelm Jun 8, 2023
02e1984
oscards input logic
chantal-kelm Jun 8, 2023
53a501d
oscards input logic
chantal-kelm Jun 8, 2023
cb80fe0
styles
chantal-kelm Jun 8, 2023
c884445
regex
chantal-kelm Jun 8, 2023
ad387c9
styles and settings
chantal-kelm Jun 8, 2023
463d5fa
styles
chantal-kelm Jun 8, 2023
e31cc50
various adjustments
chantal-kelm Jun 9, 2023
ed5920f
cleaning up code and changing some styles
chantal-kelm Jun 12, 2023
70b89b6
cleaning up code
chantal-kelm Jun 12, 2023
5a0d2cb
cleaning code
chantal-kelm Jun 13, 2023
a4c6fb5
Merge branch '4205-redesign-add-agent-page' into 5518-inputs-logic-se…
Machi3mfl Jun 13, 2023
33ba22c
update password
chantal-kelm Jun 13, 2023
0789b16
Merge branch '5518-inputs-logic-server-address-name-password-and-grou…
chantal-kelm Jun 13, 2023
afc4606
gitignore
chantal-kelm Jun 13, 2023
1ca980f
gitignore
chantal-kelm Jun 13, 2023
113850c
correcting validation text in input agent name
chantal-kelm Jun 13, 2023
c738d3c
correcting validation text in input agent name
chantal-kelm Jun 13, 2023
9d4a6ee
corrección de validación de input de nombre del agente
chantal-kelm Jun 13, 2023
ed1ec2c
cleaning code
chantal-kelm Jun 13, 2023
d0ce0d1
cleaning code
chantal-kelm Jun 13, 2023
0ed8bb6
regex that differentiates between FQDN and IP
chantal-kelm Jun 15, 2023
bcca0cc
Use of PLUGIN_VERSION_SHORT
chantal-kelm Jun 15, 2023
3783dab
Use of PLUGIN_VERSION_SHORT
chantal-kelm Jun 15, 2023
7c687cf
link
chantal-kelm Jun 16, 2023
60931d0
Revert "Merge branch '4205-redesign-add-agent-page' into 5518-inputs-…
chantal-kelm Jun 16, 2023
82be10a
link and revert
chantal-kelm Jun 16, 2023
4c4368e
merge
chantal-kelm Jun 16, 2023
9d5d2bf
characteres valid
chantal-kelm Jun 16, 2023
0bde57a
correction of styles when bringing changes from parent branch
chantal-kelm Jun 16, 2023
4198037
change tooltip to popover
chantal-kelm Jun 18, 2023
bdfe5a4
moving validations to a separate file with their tests
chantal-kelm Jun 20, 2023
777d15d
corrections and cleaning of comments
chantal-kelm Jun 21, 2023
224b1e4
camel case
chantal-kelm Jun 21, 2023
1a7c90d
change in function
chantal-kelm Jun 21, 2023
2bd7991
type
chantal-kelm Jun 21, 2023
61aa4b3
remove type
chantal-kelm Jun 21, 2023
00c4d57
fullWidth
chantal-kelm Jun 21, 2023
444ee42
type
chantal-kelm Jun 21, 2023
cd05ba5
change
chantal-kelm Jun 21, 2023
aa06b18
conditional
chantal-kelm Jun 21, 2023
b2c04c2
change label a to Euilink
chantal-kelm Jun 21, 2023
4a0761b
change label a to Euilink
chantal-kelm Jun 21, 2023
ef7543a
conditional
chantal-kelm Jun 21, 2023
c0fed1d
delete usePrevious
chantal-kelm Jun 21, 2023
df1295c
delete usePrevious
chantal-kelm Jun 21, 2023
db1f0cb
deleted files ds store
chantal-kelm Jun 21, 2023
26d361d
test correction and placeholder
chantal-kelm Jun 21, 2023
07182f3
show architecture instead of id
chantal-kelm Jun 21, 2023
e1611ea
Add register agent form values parser
Machi3mfl Jun 22, 2023
02543e6
Remove extension on operating system type
Machi3mfl Jun 22, 2023
7c9d80a
Add command sections with form values
Machi3mfl Jun 22, 2023
d5490e1
Merge branch '4205-redesign-add-agent-page' into feat/5547-integratio…
Machi3mfl Jun 23, 2023
afafbac
Create new components for steps inputs
Machi3mfl Jun 23, 2023
f646253
Fix some types
Machi3mfl Jun 23, 2023
ce3732c
Renamed some options
Machi3mfl Jun 23, 2023
4e5da2b
Move commands config inside core folder
Machi3mfl Jun 23, 2023
074f3d4
Fix server address error message display
Machi3mfl Jun 23, 2023
0c71296
Create methods to get form steps status
Machi3mfl Jun 23, 2023
57f2766
Allow select more than group
Machi3mfl Jun 26, 2023
cee16a6
Hide agent group param when is empty
Machi3mfl Jun 26, 2023
1c1b767
Fix steps form statuses
Machi3mfl Jun 26, 2023
9f3f548
Remove break lines in commands
Machi3mfl Jun 26, 2023
ecf856c
Add white space in error messages
Machi3mfl Jun 26, 2023
0a7d71e
Fix steps form status
Machi3mfl Jun 27, 2023
e20c365
Added new command component white custom copy and language
Machi3mfl Jun 27, 2023
793770e
Fixed step form status
Machi3mfl Jun 27, 2023
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
3 changes: 2 additions & 1 deletion public/components/common/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ interface EnhancedCustomField extends EnhancedField {
component: (props: any) => JSX.Element;
}

export type EnhancedFieldConfiguration = EnhancedDefaultField | EnhancedCustomField;
export interface EnhancedFields {
[key: string]: EnhancedDefaultField | EnhancedCustomField;
[key: string]: EnhancedFieldConfiguration;
}

export interface UseFormReturn {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { EuiCodeBlock } from '@elastic/eui';
import React, { Fragment } from 'react';

interface ICommandSectionProps {
commandText: string;
showCommand: boolean;
}

export default function CommandOutput(props: ICommandSectionProps) {
const { commandText, showCommand } = props;
return (
<Fragment>
<EuiCodeBlock language='shell' isCopyable>
{showCommand ? commandText : ''}
</EuiCodeBlock>
</Fragment>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React, { Fragment, useState } from 'react';
import { UseFormReturn } from '../../../../components/common/form/types';
import {
EuiFlexGroup,
EuiFlexItem,
EuiText,
EuiPopover,
EuiButtonEmpty,
EuiCallOut,
EuiLink,
} from '@elastic/eui';
import { InputForm } from '../../../../components/common/form';
import { OPTIONAL_PARAMETERS_TEXT } from '../../utils/register-agent-data';
import { webDocumentationLink } from '../../../../../common/services/web_documentation';
import { PLUGIN_VERSION_SHORT } from '../../../../../common/constants';
interface OptionalsInputsProps {
formFields: UseFormReturn['fields'];
}

const OptionalsInputs = (props: OptionalsInputsProps) => {
const { formFields } = props;
const [isPopoverAgentName, setIsPopoverAgentName] = useState(false);
const onButtonAgentName = () =>
setIsPopoverAgentName(isPopoverAgentName => !isPopoverAgentName);
const closeAgentName = () => setIsPopoverAgentName(false);

const popoverAgentName = (
<span>
Learn about{' '}
<EuiLink
href={webDocumentationLink(
'user-manual/reference/ossec-conf/client.html#enrollment-agent-name',
PLUGIN_VERSION_SHORT,
)}
target='_blank'
rel='noopener noreferrer'
>
Assigning an agent name.
</EuiLink>
</span>
);

const warningForAgentName =
'The agent name must be unique. It can’t be changed once the agent has been enrolled.';
return (
<Fragment>
<EuiFlexGroup gutterSize='s' wrap>
{OPTIONAL_PARAMETERS_TEXT.map((data, index) => (
<EuiFlexItem key={index}>
<EuiText className='stepSubtitle'>{data.subtitle}</EuiText>
</EuiFlexItem>
))}
</EuiFlexGroup>
<InputForm
{...formFields.agentName}
fullWidth={false}
label={
<>
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
button={
<EuiButtonEmpty
iconType='questionInCircle'
iconSide='right'
onClick={onButtonAgentName}
style={{
flexDirection: 'row',
fontStyle: 'normal',
fontWeight: 700,
fontSize: '12px',
lineHeight: '20px',
color: '#343741',
}}
>
Assign an agent name
</EuiButtonEmpty>
}
isOpen={isPopoverAgentName}
closePopover={closeAgentName}
anchorPosition='rightCenter'
>
{popoverAgentName}
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>
</>
}
placeholder='Agent name'
/>
<EuiCallOut
color='warning'
title={warningForAgentName}
iconType='iInCircle'
className='warningForAgentName'
/>
<InputForm {...formFields.agentGroups}></InputForm>
</Fragment>
);
};

export default OptionalsInputs;
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ import {
EuiLink,
EuiCheckbox,
} from '@elastic/eui';
import { REGISTER_AGENT_DATA_STEP_ONE } from '../../../utils/register-agent-data';
import { CheckboxGroupComponent } from '../../step-one/checkbox-group/checkbox-group';
import { OPERATING_SYSTEMS_OPTIONS } from '../../../utils/register-agent-data';
import { CheckboxGroupComponent } from '../checkbox-group/checkbox-group';
import './os-card.scss';
import { webDocumentationLink } from '../../../../../../common/services/web_documentation';

interface Props {
setStatusCheck: string;
onChange: React.ChangeEventHandler<HTMLInputElement>;
value: any;
}

export const OsCard = ({ onChange, value }: Props) => {
return (
<div data-testid='os-card'>
<EuiFlexGroup gutterSize='l' wrap>
{REGISTER_AGENT_DATA_STEP_ONE.map((data, index) => (
{OPERATING_SYSTEMS_OPTIONS.map((data, index) => (
<EuiFlexItem key={index}>
<EuiCard
title={
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui';
import React, { Fragment } from 'react';
import { SERVER_ADDRESS_TEXTS } from '../../utils/register-agent-data';
import { EnhancedFieldConfiguration } from '../../../../components/common/form/types';
import { InputForm } from '../../../../components/common/form';

interface ServerAddressInputProps {
formField: EnhancedFieldConfiguration;
}

const ServerAddressInput = (props: ServerAddressInputProps) => {
const { formField } = props;

return (
<Fragment>
<EuiFlexGroup gutterSize='s' wrap>
{SERVER_ADDRESS_TEXTS.map((data, index) => (
<EuiFlexItem key={index}>
<EuiText className='stepSubtitleServerAddress'>
{data.subtitle}
</EuiText>
</EuiFlexItem>
))}
</EuiFlexGroup>
<InputForm
{...formField}
label={<></>}
fullWidth={false}
placeholder='Server address'
/>
</Fragment>
);
};

export default ServerAddressInput;
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiLink, EuiPopover } from "@elastic/eui"
import React, { useState } from "react";
import { webDocumentationLink } from "../../../../../common/services/web_documentation";
import { PLUGIN_VERSION_SHORT } from "../../../../../common/constants";

const ServerAddressTitle = () => {
const [isPopoverServerAddress, setIsPopoverServerAddress] = useState(false);
const closeServerAddress = () => setIsPopoverServerAddress(false);
const onButtonServerAddress = () =>
setIsPopoverServerAddress(
isPopoverServerAddress => !isPopoverServerAddress,
);

const popoverServerAddress = (
<span>
Learn about{' '}
<EuiLink
href={webDocumentationLink(
'user-manual/reference/ossec-conf/client.html#groups',
PLUGIN_VERSION_SHORT,
)}
target='_blank'
rel='noopener noreferrer'
>
Server address.
</EuiLink>
</span>
);

return (<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiPopover
button={
<EuiButtonEmpty
iconType='questionInCircle'
iconSide='right'
onClick={onButtonServerAddress}
className='stepTitle'
>
Server address
</EuiButtonEmpty>
}
isOpen={isPopoverServerAddress}
closePopover={closeServerAddress}
anchorPosition='rightCenter'
>
{popoverServerAddress}
</EuiPopover>
</EuiFlexItem>
</EuiFlexGroup>)
}

export default ServerAddressTitle;
148 changes: 0 additions & 148 deletions public/controllers/register-agent/config/os-commands-definitions.ts

This file was deleted.

Loading