-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Fleet] Fix agent status badge when stuck upgrading #226893
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
Open
Supplementing
wants to merge
7
commits into
elastic:main
Choose a base branch
from
Supplementing:fix-agent-status-table-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e627c68
changed logic to show failed when stuck or in bad state
Supplementing 19ed087
Merge branch 'main' into fix-agent-status-table-fix
elasticmachine a03dd6b
changed status component to only use the failed upgrade state, rather…
Supplementing 2d93f31
Merge branch 'fix-agent-status-table-fix' of https://github.com/Suppl…
Supplementing 029160e
updated getStatusComponent to use entire agent object rather than spe…
Supplementing fb23062
fix error related to type
Supplementing ed924d8
added union typing to props to make sure that at least one of the pro…
Supplementing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
it feels a bit odd to introduce a new prop just for this specific sub-state.. I wonder if we can just accept the agent upgrade details information like this:
and then use
isAgentInFailedUpgradeState()
directly in this component to derive the badge. WDYT?then this component could show other upgrade sub-states in the future if we choose to (I see 9 of them in
AgentUpgradeStateType
!)Uh oh!
There was an error while loading. Please reload this page.
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 agree, using something more extensible rather than a specific prop makes more sense in this case. However, that
isAgentInFailedUpgradeState()
function takes anAgent
rather thanupgrade_details
, so maybe it makes sense to simplify further and just pass the entire Agent into this function and then we can access thestatus
andupgrade_details
inside as needed. WDYT?EDIT: I went ahead and made the changes in the latest commits. However, there was a small implication in that, we are passing in only a string for the
previousToOfflineStatus
rather than an agent, so I needed to include that as a prop of its own.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.
this is true, but it is only using
upgrade_details
in its logic so can be easily refactoredThere 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.
Should we prefer refactoring that function then over my latest changes (passing in the Agent and using a union for the props type)?
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.
IMO
status
+upgradeDetails
makes more sense as props for this component thanagent
+previousStatus