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

Add auto refresh button to events page #20996

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

maxiadlovskii
Copy link
Contributor

@maxiadlovskii maxiadlovskii commented Nov 19, 2024

Description

This PR refactor creates CommonRefreshControls components to reuse most of the logic in RefreshControls components.
Also, we add a refresh action to events page.

Screenshot 2024-11-19 at 14 43 24

Motivation and Context

fix: https://github.com/Graylog2/graylog-plugin-enterprise/issues/8661

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

/jpd https://github.com/Graylog2/graylog-plugin-enterprise/pull/9269

Copy link
Contributor

@linuspahl linuspahl left a comment

Choose a reason for hiding this comment

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

Works well and looks good!

import useSearchConfiguration from 'hooks/useSearchConfiguration';
import useMinimumRefreshInterval from 'views/hooks/useMinimumRefreshInterval';

export const durationToMS = (duration: string) => moment.duration(duration).asMilliseconds();
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a good addition to the DateTime utils. It would be nice to add a comment with an example input.

humanName: string,
}

const CommonRefreshControls = ({ humanName, disable, onToggle = null, onEnable = null, onDisable = null, intervalOptions, onSelectInterval = null, isLoadingMinimumInterval, minimumRefreshInterval, defaultInterval }: Props) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are already in the common dir, let's just call it RefreshControls? If you want to avoid having two components with the name, you could rename the one in the views directory to ViewsRefreshControls? Similar to how you named EventsRefreshControls.

If we can avoid having the name of the directory in the component name, I would do that for the common refresh controls component.

@@ -0,0 +1,5 @@
type = "a"
message = "Add auto refresh to events page"
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like the events list is now refreshing automatically when you open it.

@linuspahl linuspahl merged commit 2dc935e into master Nov 26, 2024
9 of 10 checks passed
@linuspahl linuspahl deleted the feat/Add-auto-refresh-to-events branch November 26, 2024 14:15
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.

2 participants