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

Added default selected options in Deploy Agent page #5063

Merged
merged 5 commits into from Jan 4, 2023

Conversation

Machi3mfl
Copy link
Member

@Machi3mfl Machi3mfl commented Jan 3, 2023

Description

Added default selected options in Deploy Agent Page

Closes #5061

Testing cases

Check the auto-selected version and architecture when having only one option

  1. Go to Deploy agent
  2. Select any OS
  3. Check the auto-selected options when OS has only one option for architecture or version

Check the auto-selected OS options

  1. Go to Deploy agent
  2. Select any OS
  3. Check the auto-selected options for version and architecture
  4. Repeat for every OS

Check List

  • All tests pass
    • yarn test:jest
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@Machi3mfl Machi3mfl requested a review from a team as a code owner January 3, 2023 14:54
@Machi3mfl Machi3mfl self-assigned this Jan 3, 2023
@Machi3mfl Machi3mfl changed the title Added default selected options Added default selected options in Deploy Agent page Jan 3, 2023
@chantal-kelm chantal-kelm self-requested a review January 3, 2023 15:16
@Machi3mfl
Copy link
Member Author

Machi3mfl commented Jan 3, 2023

Solution details

Created a new component called RegisterAgentButtonGroup.
The component receives and renders buttons depending on the options list with the following structure:

{
  id: string,
  label: string,
  default?: boolean
}

Example for Amazon Linux

https://github.com/wazuh/wazuh-kibana-app/blob/ff113f924c5469b1636ea1d6020ace09aa626a20/public/controllers/agent/wazuh-config/index.ts#L125-L139

Behavior

  • When the component receives the options list with one option the button is auto-selected
  • When an option has the property default in true the button is auto-selected.

Behavior evidence

Screencast.2023-01-03.12.51.21.mp4

Unit tests

image

chantal-kelm
chantal-kelm previously approved these changes Jan 3, 2023
Copy link
Member

@chantal-kelm chantal-kelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✅
Test: ✅

@Machi3mfl Machi3mfl linked an issue Jan 3, 2023 that may be closed by this pull request
Tostti
Tostti previously approved these changes Jan 3, 2023
Copy link
Member

@Tostti Tostti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR ✔️
TEST ✔️

LGTM

yenienserrano
yenienserrano previously approved these changes Jan 3, 2023
Copy link
Member

@yenienserrano yenienserrano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

image

public/controllers/agent/components/register-agent.js Outdated Show resolved Hide resolved
public/controllers/agent/components/register-agent.js Outdated Show resolved Hide resolved
yenienserrano
yenienserrano previously approved these changes Jan 3, 2023
@chantal-kelm chantal-kelm self-requested a review January 3, 2023 18:32
chantal-kelm
chantal-kelm previously approved these changes Jan 3, 2023
Copy link
Member

@chantal-kelm chantal-kelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: ✅
Test: ✅

Tostti
Tostti previously approved these changes Jan 4, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

Code coverage (Jest) % values
Statements 8.76% ( 3241 / 37003 )
Branches 4.54% ( 1306 / 28740 )
Functions 7.67% ( 703 / 9171 )
Lines 8.82% ( 3126 / 35427 )

@Machi3mfl Machi3mfl merged commit e71b344 into 4.4-7.10 Jan 4, 2023
@Machi3mfl Machi3mfl deleted the feature/5061-deploy-agent-default-options branch January 4, 2023 13:59
@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

The backport to 4.4-2.4-wzd failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.4-2.4-wzd 4.4-2.4-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.4-2.4-wzd
# Create a new branch
git switch --create backport-5063-to-4.4-2.4-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e71b344b598c77a0af6ea414abb721666118353c
# Push it to GitHub
git push --set-upstream origin backport-5063-to-4.4-2.4-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-2.4-wzd

Then, create a pull request where the base branch is 4.4-2.4-wzd and the compare/head branch is backport-5063-to-4.4-2.4-wzd.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2023

The backport to 4.4-7.16 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-4.4-7.16 4.4-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.4-7.16
# Create a new branch
git switch --create backport-5063-to-4.4-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e71b344b598c77a0af6ea414abb721666118353c
# Push it to GitHub
git push --set-upstream origin backport-5063-to-4.4-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.4-7.16

Then, create a pull request where the base branch is 4.4-7.16 and the compare/head branch is backport-5063-to-4.4-7.16.

Machi3mfl added a commit that referenced this pull request Jan 4, 2023
* Added default selected options

* Updated CHANGELOG

* Removed unused code

* Added unit tests

* Cleaned imports

(cherry picked from commit e71b344)
Machi3mfl added a commit that referenced this pull request Jan 4, 2023
* Added default selected options

* Updated CHANGELOG

* Removed unused code

* Added unit tests

* Cleaned imports

(cherry picked from commit e71b344)
Machi3mfl added a commit that referenced this pull request Jan 4, 2023
* Added default selected options in Deploy Agent page (#5063)

* Added default selected options

* Updated CHANGELOG

* Removed unused code

* Added unit tests

* Cleaned imports

(cherry picked from commit e71b344)

* Updated snapshot
Machi3mfl added a commit that referenced this pull request Jan 4, 2023
* Added default selected options in Deploy Agent page (#5063)

* Added default selected options

* Updated CHANGELOG

* Removed unused code

* Added unit tests

* Cleaned imports

(cherry picked from commit e71b344)

* Updated snapshot

* Mocked component id to match snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Deploy Agent Page] Set default versions and architectures
4 participants