-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ResponseOps][Reporting] Schedule reporting tables enhancements #225449
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
Merged
js-jankisalvi
merged 11 commits into
elastic:main
from
js-jankisalvi:schedule-reporting-tables-enhancements
Jul 1, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
59fe754
initial commit
js-jankisalvi 6334fed
add functional tests
js-jankisalvi 24ff12d
Merge remote-tracking branch 'upstream' into schedule-reporting-table…
js-jankisalvi c6f83bc
more functional tests
js-jankisalvi b613b59
unskip ftr test
js-jankisalvi 861b29f
fix flakiness
js-jankisalvi 7d9a9ec
Merge remote-tracking branch 'upstream' into schedule-reporting-table…
js-jankisalvi 5bd4cc1
fix flakiness
js-jankisalvi 59ba01f
feedback addressed
js-jankisalvi 3556352
Merge branch 'main' into schedule-reporting-tables-enhancements
js-jankisalvi 5389d38
Merge branch 'main' into schedule-reporting-tables-enhancements
js-jankisalvi 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
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
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
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
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
69 changes: 69 additions & 0 deletions
69
...ck/platform/plugins/private/reporting/public/management/components/ilm_policy_wrapper.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui'; | ||
| import { RouteComponentProps } from 'react-router-dom'; | ||
| import { ClientConfigType, ReportingAPIClient, useKibana } from '@kbn/reporting-public'; | ||
| import { Section } from '../../constants'; | ||
|
|
||
| import { IlmPolicyLink } from './ilm_policy_link'; | ||
| import { ReportDiagnostic } from './report_diagnostic'; | ||
| import { useIlmPolicyStatus } from '../../lib/ilm_policy_status_context'; | ||
| import { MigrateIlmPolicyCallOut } from './migrate_ilm_policy_callout'; | ||
|
|
||
| export interface MatchParams { | ||
| section: Section; | ||
| } | ||
|
|
||
| export interface ReportingTabsProps { | ||
| config: ClientConfigType; | ||
| apiClient: ReportingAPIClient; | ||
| } | ||
|
|
||
| export const IlmPolicyWrapper: React.FunctionComponent< | ||
| Partial<RouteComponentProps> & ReportingTabsProps | ||
| > = (props) => { | ||
| const { config, apiClient } = props; | ||
| const { | ||
| services: { | ||
| application: { capabilities }, | ||
| share: { url: urlService }, | ||
| notifications, | ||
| }, | ||
| } = useKibana(); | ||
|
|
||
| const ilmLocator = urlService.locators.get('ILM_LOCATOR_ID'); | ||
| const ilmPolicyContextValue = useIlmPolicyStatus(); | ||
| const hasIlmPolicy = ilmPolicyContextValue?.status !== 'policy-not-found'; | ||
| const showIlmPolicyLink = Boolean(ilmLocator && hasIlmPolicy); | ||
|
|
||
| return ( | ||
| <> | ||
| <EuiFlexGroup justifyContent="spaceBetween" alignItems="center" gutterSize="s"> | ||
| <EuiFlexGroup justifyContent="flexEnd"> | ||
| {capabilities?.management?.data?.index_lifecycle_management && ( | ||
| <EuiFlexItem grow={false}> | ||
| {ilmPolicyContextValue?.isLoading ? ( | ||
| <EuiLoadingSpinner /> | ||
| ) : ( | ||
| showIlmPolicyLink && <IlmPolicyLink locator={ilmLocator!} /> | ||
| )} | ||
| </EuiFlexItem> | ||
| )} | ||
| </EuiFlexGroup> | ||
| <MigrateIlmPolicyCallOut toasts={notifications.toasts} /> | ||
| <EuiFlexItem grow={false}> | ||
| <ReportDiagnostic clientConfig={config} apiClient={apiClient} /> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| // eslint-disable-next-line import/no-default-export | ||
| export { IlmPolicyWrapper as default }; |
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
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
79 changes: 79 additions & 0 deletions
79
...plugins/private/reporting/public/management/components/report_schedule_indicator.test.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { render, screen } from '@testing-library/react'; | ||
| import React from 'react'; | ||
| import { Frequency } from '@kbn/rrule'; | ||
| import { ReportScheduleIndicator } from './report_schedule_indicator'; | ||
|
|
||
| describe('ReportScheduleIndicator', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('renders daily schedule indicator correctly', async () => { | ||
| render( | ||
| <ReportScheduleIndicator | ||
| schedule={{ | ||
| rrule: { | ||
| freq: Frequency.DAILY, | ||
| interval: 1, | ||
| tzid: 'UTC', | ||
| }, | ||
| }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(await screen.findByTestId('reportScheduleIndicator-3')).toBeInTheDocument(); | ||
| expect(await screen.findByText('Daily')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders weekly schedule indicator correctly', async () => { | ||
| render( | ||
| <ReportScheduleIndicator | ||
| schedule={{ | ||
| rrule: { freq: Frequency.WEEKLY, interval: 3, tzid: 'Europe/London' }, | ||
| }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(await screen.findByTestId('reportScheduleIndicator-2')).toBeInTheDocument(); | ||
| expect(await screen.findByText('Weekly')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('renders monthly schedule indicator correctly', async () => { | ||
| render( | ||
| <ReportScheduleIndicator | ||
| schedule={{ | ||
| rrule: { freq: Frequency.MONTHLY, interval: 6, tzid: 'America/NewYork' }, | ||
| }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(await screen.findByTestId('reportScheduleIndicator-1')).toBeInTheDocument(); | ||
| expect(await screen.findByText('Monthly')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('returns null when no frequency do not match', async () => { | ||
| render( | ||
| <ReportScheduleIndicator | ||
| // @ts-expect-error we don't need to provide all props for the test | ||
| schedule={{ rrule: { freq: Frequency.YEARLY, interval: 1, tzid: 'UTC' } }} | ||
| /> | ||
| ); | ||
|
|
||
| expect(screen.queryByTestId('reportScheduleIndicator-0')).not.toBeInTheDocument(); | ||
| expect(screen.queryByText('Yearly')).not.toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('returns null when no rrule', async () => { | ||
| // @ts-expect-error we don't need to provide all props for the test | ||
| const res = render(<ReportScheduleIndicator schedule={{}} />); | ||
|
|
||
| expect(res.container.getElementsByClassName('euiBadge').length).toBe(0); | ||
| }); | ||
| }); |
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
Oops, something went wrong.
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.
For my education, what did this entry fix?
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 moved from props to context
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.
A nice. It makes sense. And because it is part of the
requiredPlugins, it is getting passed in the context.