Open jsoref opened 3 years ago
Hello! I was trying to work on coming up with a fix for this issue. My original plan was to just add a parenthesis with the number of events to the tab for now (ex. Events (0)
), but at the moment I'm stuck in an infinite loop with the events number rendering and was wondering if someone could help me find a way to either get out of it or suggest a better way to render the events number.
This file is huge, so in order to avoid pasting the whole thing, I'm just providing the main pieces of code I've added and if you need to see the whole file for more context, it can found on my branch here.
I've added numOfEvents
to state:
constructor(props: RouteComponentProps<{name: string}>) {
super(props);
this.state = {
page: 0,
numOfEvents: 0,
};
}
(immediately before return statement) Logic to set state:
if (this.state.numOfEvents === 0) {
services.applications.events(application.metadata.name).then(events => {
console.log(events);
this.setState({numOfEvents : events.length})
});
}
Events tab object in tabs
array:
{
title: 'EVENTS' + ` (${this.state.numOfEvents})`,
key: 'event',
content: <ApplicationResourceEvents applicationName={application.metadata.name} />
}
The main problem for this entire issue is that the tabs do not know about the data contained within their content.
Something I also considered was refactoring the events tab to make it into a new component, but I'm not sure if that's an acceptable solution or not. Any input is greatly appreciated, thank you!
If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.
Checklist:
argocd version
.Describe the bug
I'm constantly clicking the events tab only to be told there are no events
To Reproduce
Expected behavior
The events tab should be gray or somehow hint that as of some time there were no events available
Screenshots
Version
Logs