-
Notifications
You must be signed in to change notification settings - Fork 198
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
Consistency in the non-core visualizations and agent status #4166
Conversation
…bels and colors - Consistency in custom donut visualizations: - Replaced the visualizations in `Agents` and `Modules/SCA/Inventory` by the `VisualizationBasic` component - Removed the `Pie` component - Consistency in agent status, labels, and colors: - Centralized the agent status, labels, and colors to constants.ts file - Replaced the hardcoded values with the centralized ones - Added the `pending` status to: - Agents stats in Modules directory - Status visualization in `Agents` section - Details panel in `Agents` section - Agents stats in Management/Status - Created a service to get the color and label depending on the agent status. It is shared by the backend and frontend. - Created a component to display the agent status: AgentStatus. It is adapted to the different use cases. - Replaced the old rendering with the new one in some components. Removed unnecessary methods and layout. - Removed deprecated methods and files - Rendering agent status stats when the monitoring job was disabled and the visualization of agent status evolution was in Modules/Security events. `WzVisualize` component. - Removed an API request to get the agent status data - Refactored the API request managing in: - `Modules/SCA/Inventory` - `Agents` - `Management/Status` - Added a new property `error` to `VisualizationBasic` to render the error message coming from `error.message` - Fixed an error when creating a visualization that didn't apply the definitions in `uiStateJSON` property. This is due to a bug in Kibana 7.10.2 - Fixed some typos
0b68a75
to
7ab242e
Compare
Testing in progress |
Add missing parentheses
Test
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Test: ✔️
- Code Review: ✔️*
*Left some feedback. Check the comments.
common/services/wz_agent_status.ts
Outdated
@@ -0,0 +1,11 @@ | |||
import { UI_COLOR_AGENT_STATUS, UI_LABEL_NAME_AGENT_STATUS } from '../constants'; | |||
|
|||
type AgentStatus = 'active' | 'disconected' | 'pending' | 'never_connected'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated values from API_NAME_AGENT_STATUS
.
Couldn't it be used instead??
import { API_NAME_AGENT_STATUS } from '../constants';
type AgentStatus = API_NAME_AGENT_STATUS
Or even better, use enums: https://www.typescriptlang.org/docs/handbook/enums.html#string-enums
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will see if I can redefine this type to avoid the hardcoded values and use the constant.
import React from 'react'; | ||
import { EuiToolTip } from '@elastic/eui'; | ||
import { agentStatusColorByAgentStatus, agentStatusLabelByAgentStatus } from '../../../common/services/wz_agent_status'; | ||
|
||
export const AgentStatus = ({ status, children = null, labelProps = {}, style = {} }) => ( | ||
<span className="euiFlexGroup euiFlexGroup--gutterExtraSmall euiFlexGroup--alignItemsCenter euiFlexGroup--directionRow" style={style}> | ||
<EuiToolTip position="top" content={agentStatusLabelByAgentStatus(status).toLowerCase()}> | ||
<span className="euiFlexItem euiFlexItem--flexGrowZero"> | ||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" className={`euiIcon euiIcon--medium`} style={{ color: agentStatusColorByAgentStatus(status) }} focusable="false" role="img" aria-hidden="true"> | ||
<circle cx="8" cy="8" r="4"></circle> | ||
</svg> | ||
</span> | ||
</EuiToolTip> | ||
<span className="euiFlexItem euiFlexItem--flexGrowZero" {...labelProps}>{children || agentStatusLabelByAgentStatus(status).toLowerCase()}</span> | ||
</span> | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run formatter
|
||
export class Inventory extends Component { | ||
_isMount = false; | ||
constructor(props) { | ||
super(props); | ||
const { agent } = this.props; | ||
this.state = { agent, items: [], itemIdToExpandedRowMap: {}, showMoreInfo: false, loading: false, filters: [], pageTableChecks: {pageIndex: 0} } | ||
this.policies = []; | ||
this.state = { agent, items: [], itemIdToExpandedRowMap: {}, showMoreInfo: false, loading: false, filters: [], pageTableChecks: {pageIndex: 0}, policies: [] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatter here
public/controllers/management/components/management/status/status-stats.js
Show resolved
Hide resolved
@@ -96,7 +98,7 @@ export default [ | |||
], | |||
}), | |||
uiStateJSON: JSON.stringify({ | |||
vis: { colors: { never_connected: '#447EBC', active: '#E5AC0E' } }, | |||
vis: { colors: { active: UI_COLOR_AGENT_STATUS.active, disconnected: UI_COLOR_AGENT_STATUS.disconnected, pending: UI_COLOR_AGENT_STATUS.pending, never_connected: UI_COLOR_AGENT_STATUS.never_connected } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format
@@ -96,7 +98,7 @@ export default [ | |||
], | |||
}), | |||
uiStateJSON: JSON.stringify({ | |||
vis: { colors: { never_connected: '#447EBC', active: '#E5AC0E' } }, | |||
vis: { colors: { active: UI_COLOR_AGENT_STATUS.active, disconnected: UI_COLOR_AGENT_STATUS.disconnected, pending: UI_COLOR_AGENT_STATUS.pending, never_connected: UI_COLOR_AGENT_STATUS.never_connected } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test: ✔️
CR: ✔️
…into feat/4077-consistency-charts-agent-status
The backport to
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.3-7.16 4.3-7.16
# Navigate to the new working tree
cd .worktrees/backport-4.3-7.16
# Create a new branch
git switch --create backport-4166-to-4.3-7.16
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cacf7923c8ed33cc6397b6f1c28a3ee2ed3fe66b
# Push it to GitHub
git push --set-upstream origin backport-4166-to-4.3-7.16
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-7.16 Then, create a pull request where the |
The backport to
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.3-1.2-wzd 4.3-1.2-wzd
# Navigate to the new working tree
cd .worktrees/backport-4.3-1.2-wzd
# Create a new branch
git switch --create backport-4166-to-4.3-1.2-wzd
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cacf7923c8ed33cc6397b6f1c28a3ee2ed3fe66b
# Push it to GitHub
git push --set-upstream origin backport-4166-to-4.3-1.2-wzd
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-4.3-1.2-wzd Then, create a pull request where the |
The backport to
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-cloud/4.3-7.10 cloud/4.3-7.10
# Navigate to the new working tree
cd .worktrees/backport-cloud/4.3-7.10
# Create a new branch
git switch --create backport-4166-to-cloud/4.3-7.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cacf7923c8ed33cc6397b6f1c28a3ee2ed3fe66b
# Push it to GitHub
git push --set-upstream origin backport-4166-to-cloud/4.3-7.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-cloud/4.3-7.10 Then, create a pull request where the |
The backport to
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-cloud/4.3-7.10-custom-agents-view cloud/4.3-7.10-custom-agents-view
# Navigate to the new working tree
cd .worktrees/backport-cloud/4.3-7.10-custom-agents-view
# Create a new branch
git switch --create backport-4166-to-cloud/4.3-7.10-custom-agents-view
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 cacf7923c8ed33cc6397b6f1c28a3ee2ed3fe66b
# Push it to GitHub
git push --set-upstream origin backport-4166-to-cloud/4.3-7.10-custom-agents-view
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-cloud/4.3-7.10-custom-agents-view Then, create a pull request where the |
|
Description
This PR adds some enhancements in the consistency of non-core visualizations and agent status.
Changes
Agents
andModules/SCA/Inventory
by theVisualizationBasic
componentPie
componentpending
status to:Agents
sectionAgents
sectionstatus. It is shared by the backend and frontend.
It is adapted to the different use cases.
and the visualization of agent status evolution was in Modules/Security events.
WzVisualize
component.Modules/SCA/Inventory
Agents
Management/Status
error
toVisualizationBasic
to render theerror message coming from
error.message
definitions in
uiStateJSON
property. This is due to a bug in Kibana 7.10.2Screenshots
Test
Pending
statusPending
statusstatus
suggestion includespending
statusstatus
suggestion includespending
statusStatus
colum displays the status indicator and the label.status
suggestion includespending
statuspending
statepending
stateModules/File integrity monitoring/Inventory
active
: display the dataactive
: display a prompt related to the agent statusModules/SCA/Inventory
never_connected
: prompt with a message related to the agent statusnever_connected
: display the dataAgent/Stats
:active
: display the dataactive
: display a prompt related to the agent statusAgent/Inventory
active
: display the datadisconnected
: display a prompt related to the agent statusnever_connected
: display a prompt related to the agent statusAgent/Overview
:never_connected
: display a prompt related to the agent statusnever_connected
: display the dataAgents
never_connected
: not display the button to open the agent configurationStatus
column is rendered with an indicator that depends on the agent status and a label without_
characterAgent/Configuration
active
: display the sectionnever_connected
: display a prompt related to the agent status<Module> - Generate a report in PDF
active
: display a message with the current state of the agent.active
,disconnected
,pending
,never_connected
Closes #4077