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

5518 inputs logic server address name password and group #5554

Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
80 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
65155a5
removing console css warnings
chantal-kelm Jun 22, 2023
37be021
fixed regex fqdn
chantal-kelm Jun 23, 2023
7282c61
fixed regex fqdn
chantal-kelm Jun 23, 2023
f09f5f3
data
chantal-kelm Jun 23, 2023
b5f55dc
changelog
chantal-kelm Jun 23, 2023
17672c4
changelog
chantal-kelm Jun 23, 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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to the Wazuh app project will be documented in this file.

## Wazuh v4.6.0 - OpenSearch Dashboards 2.6.0 - Revision 4500

### Added

### Changed

- Changed the deploy a new agent page from step one to step three. [#5554](https://github.com/wazuh/wazuh-kibana-app/pull/5554)

### Fixed

## Wazuh v4.5.0 - OpenSearch Dashboards 2.6.0 - Revision 4500

### Added
Expand Down
2 changes: 1 addition & 1 deletion public/components/common/form/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const useForm = (fields: FormConfiguration): UseFormReturn => {
Object.entries(enhanceFields as EnhancedFields)
.filter(([, { error }]) => error)
.map(([fieldKey, { error }]) => [fieldKey, error]),
) as { [key: string]: string };
);

function undoChanges() {
setFormFields(state =>
Expand Down
9 changes: 2 additions & 7 deletions public/components/common/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { InputFormSwitch } from './input_switch';
import { InputFormFilePicker } from './input_filepicker';
import { InputFormTextArea } from './input_text_area';
import { EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui';
import { OsCard } from '../../../controllers/register-agent/components/os-card/os-card';
import { SettingTypes } from './types';

interface InputFormProps {
export interface InputFormProps {
type: SettingTypes;
value: any;
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
Expand Down Expand Up @@ -65,10 +64,6 @@ export const InputForm = ({
/>
);

if (type === 'custom') {
return <OsCard {...rest} />;
}

return label ? (
<EuiFormRow label={label} fullWidth isInvalid={isInvalid} error={error}>
<>
Expand Down Expand Up @@ -98,5 +93,5 @@ const Input = {
select: InputFormSelect,
text: InputFormText,
textarea: InputFormTextArea,
custom: OsCard,
custom: ({ component, ...rest }) => component(rest),
};
30 changes: 22 additions & 8 deletions public/components/common/form/input_select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@ import React from 'react';
import { EuiSelect } from '@elastic/eui';
import { IInputFormType } from './types';

export const InputFormSelect = ({ options, value, onChange }: IInputFormType) => {
return (
<EuiSelect
options={options.select}
value={value}
onChange={onChange}
/>
)
export const InputFormSelect = ({
options,
value,
onChange,
placeholder,
selectedOptions,
isDisabled,
isClearable,
dataTestSubj,
}: IInputFormType) => {
return (
<EuiSelect
options={options.select}
value={value}
onChange={onChange}
placeholder={placeholder}
selectedOptions={selectedOptions}
isDisabled={isDisabled}
isClearable={isClearable}
data-test-subj={dataTestSubj}
/>
);
};
27 changes: 17 additions & 10 deletions public/components/common/form/input_text.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import React from 'react';
import { EuiFieldText } from '@elastic/eui';
import { IInputFormType } from "./types";
import { IInputFormType } from './types';

export const InputFormText = ({ value, isInvalid, onChange }: IInputFormType) => {
return (
<EuiFieldText
fullWidth
value={value}
isInvalid={isInvalid}
onChange={onChange}
/>
);
export const InputFormText = ({
value,
isInvalid,
onChange,
placeholder,
fullWidth,
}: IInputFormType) => {
return (
<EuiFieldText
fullWidth={typeof fullWidth === 'undefined' ? true : fullWidth}
value={value}
isInvalid={isInvalid}
onChange={onChange}
placeholder={placeholder}
/>
);
};
3 changes: 2 additions & 1 deletion public/components/common/form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface IInputForm {
}

/// use form hook types

export type SettingTypes =
| 'text'
| 'textarea'
Expand Down Expand Up @@ -54,7 +55,7 @@ interface EnhancedField {
initialValue: any;
value: any;
changed: boolean;
error: string | null;
error: string | null | undefined;
setInputRef: (reference: any) => void;
inputRef: any;
onChange: (event: any) => void;
Expand Down
2 changes: 1 addition & 1 deletion public/controllers/agent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import { AgentsPreviewController } from './agents-preview';
import { AgentsController } from './agents';
import { RegisterAgent } from '../register-agent/container/register-agent';
import { RegisterAgent } from '../../controllers/register-agent/containers/register-agent/register-agent';
import { ExportConfiguration } from './components/export-configuration';
import { AgentsWelcome } from '../../components/common/welcome/agents-welcome';
import { Mitre } from '../../components/overview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const WzManagerAddressInput = (props: Props) => {
const [value, setValue] = useState('');

useEffect(() => {
if(defaultValue){
if (defaultValue) {
setValue(defaultValue);
onChange(defaultValue);
}else{
} else {
setValue('');
onChange('');
}
},[])
}, []);
/**
* Handles the change of the selected node IP
* @param value
Expand Down
56 changes: 0 additions & 56 deletions public/controllers/register-agent/components/os-card/os-card.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
.checkbox-group-container {
display: flex;
flex-wrap: wrap;
display: grid;
grid-template-columns: 1fr 1fr;
margin-top: 26px;
margin-bottom: 11px;
justify-content: center;
}

.checkbox-item {
width: 50%;
display: flex;
flex-direction: row-reverse;
align-items: center;
justify-content: center;
}

Expand All @@ -28,24 +28,21 @@
.checkbox-item {
display: flex;
flex-direction: row-reverse;
justify-content: start;
// justify-content: start;
align-self: baseline;
}
}

.architecture-label {
margin-left: 8px;
font-style: normal;
font-weight: 400;
font-size: 14px;
font-size: 12px;
color: #343741;
}

.first-card-four-items {
.checkbox-item:nth-child(n + 3) {
padding-top: 16px;
justify-content: center;
}
}

.first-of-row {
padding-right: 17px;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { CheckboxGroupComponent } from './checkbox-group';
import { CheckboxGroupComponent } from '../../step-one/checkbox-group/checkbox-group';

describe('CheckboxGroupComponent', () => {
const data = ['Option 1', 'Option 2', 'Option 3'];
Expand Down Expand Up @@ -50,6 +50,10 @@ describe('CheckboxGroupComponent', () => {
fireEvent.click(checkboxItems[1]);

expect(onOptionChange).toHaveBeenCalledTimes(1);
expect(onOptionChange).toHaveBeenCalledWith('option-0-1');
expect(onOptionChange).toHaveBeenCalledWith(
expect.objectContaining({
target: { value: `option-${cardIndex}-1` },
}),
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ import React from 'react';
import { EuiRadioGroup } from '@elastic/eui';
import './checkbox-group.scss';

interface RegisterAgentData {
icon: string;
title: string;
hr: boolean;
architecture: string[];
}

interface Props {
data: string[];
cardIndex: number;
Expand All @@ -23,14 +16,9 @@ const CheckboxGroupComponent: React.FC<Props> = ({
selectedOption,
onOptionChange,
}) => {
const handleOptionChange = (optionId: string) => {
onOptionChange(optionId);
};

const isSingleArchitecture = data.length === 1;
const isDoubleArchitecture = data.length === 2;
const isFirstCardWithFourItems = cardIndex === 0 && data.length === 4;

return (
<div
className={`checkbox-group-container${
Expand All @@ -48,9 +36,11 @@ const CheckboxGroupComponent: React.FC<Props> = ({
>
<span className='architecture-label'>{arch}</span>
<EuiRadioGroup
options={[{ id: `option-${cardIndex}-${idx}` }]}
options={[{ id: `${arch}` }]}
idSelected={selectedOption}
onChange={(id: string) => handleOptionChange(id)}
onChange={(id: string) => {
onOptionChange({ target: { value: id } });
}}
/>
</div>
))}
Expand All @@ -59,4 +49,3 @@ const CheckboxGroupComponent: React.FC<Props> = ({
};

export { CheckboxGroupComponent };
export type { RegisterAgentData };
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@
.last-card {
margin-right: 63px;
}

.cardsCallOut {
margin-top: 16px;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { OsCard } from './os-card';
import { OsCard } from '../../step-one/os-card/os-card';

describe('OsCard', () => {
test('renders three cards with different titles', () => {
Expand Down
Loading