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 Sample Data Component #3475
Added Sample Data Component #3475
Conversation
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.
Just some comments, great job!! 💯
title: error.name || error, | ||
}, | ||
}; | ||
getErrorOrchestrator.mockImplementation(() => { |
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.
🚀
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.
LGTM ! 🚀
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.
const usesSampleData = async () => { | ||
try { | ||
const result = (await WzRequest.genericReq('GET', '/elastic/samplealerts', {})).data | ||
.sampleAlertsInstalled; | ||
setIsSampleData(result); | ||
} catch (error) { | ||
const options = { | ||
context: `${SampleData.name}.usesSampleData`, | ||
level: UI_LOGGER_LEVELS.ERROR, | ||
severity: UI_ERROR_SEVERITIES.UI, | ||
error: { | ||
error: error, | ||
message: error.message || error, | ||
title: error.name || error, | ||
}, | ||
}; | ||
getErrorOrchestrator().handleError(options); | ||
} | ||
}; | ||
useEffect(() => { | ||
usesSampleData(); |
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.
nitpick: I would avoid the prefix use
for a function, this prefix is usually used for hooks
.
You could move the usesSampleData
to the useEffect
. You could use the async/await
with a Self Invoking Function
as:
useEffect(() => {
(async(){
// logic
})()
},[dependencies])
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.
Applied in the latest commit
Applied Prettier to wz-visualize
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.
Testing: ✔️
CR: ✔️
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.
review:
- Code review ✅
|
Closes #3423
Created a component to check for sample data and display a message if it does.
This component also replaces the implementation in
WzVisualize
To test: