-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added server address and wazuh protocol definition in Deploy agent se…
…ction (#5166) * Added new WzServerAddressInput component * Updated CHANGELOG * Update state server address when is mounted * Resolved review comments * Updated CHANGELOG * Updated logic when protocol is UDP * Modified wazuh protocol param definition * Changed PR text in CHANGELOG * Reverted changes tsconfig (cherry picked from commit b167d6c)
- Loading branch information
Showing
4 changed files
with
83 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
public/controllers/agent/register-agent/steps/wz-manager-address.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { memo, useCallback, useEffect, useState } from 'react'; | ||
import { EuiText, EuiFieldText } from '@elastic/eui'; | ||
|
||
type Props = { | ||
onChange: (value: string) => void; | ||
defaultValue?: string; | ||
}; | ||
|
||
const WzManagerAddressInput = (props: Props) => { | ||
const { onChange, defaultValue } = props; | ||
const [value, setValue] = useState(''); | ||
|
||
useEffect(() => { | ||
if(defaultValue){ | ||
setValue(defaultValue); | ||
onChange(defaultValue); | ||
}else{ | ||
setValue(''); | ||
onChange(''); | ||
} | ||
},[]) | ||
/** | ||
* Handles the change of the selected node IP | ||
* @param value | ||
*/ | ||
const handleOnChange = (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const { value } = event.target; | ||
onChange(value); | ||
setValue(value); | ||
}; | ||
return ( | ||
<EuiText> | ||
<p> | ||
This is the address the agent uses to communicate with the Wazuh server. | ||
It can be an IP address or a fully qualified domain name (FQDN). | ||
</p> | ||
<EuiFieldText | ||
placeholder='Server Address' | ||
onChange={handleOnChange} | ||
value={value} | ||
/> | ||
</EuiText> | ||
); | ||
}; | ||
|
||
export default WzManagerAddressInput; |