-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[ResponseOps][Reporting] Scheduled report flyout UI #222135
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
Changes from all commits
c68ffaf
ff4f897
dc4c074
0ddb6ea
5914e61
d4b6cde
1af5c5f
3dbdd71
c24eaf5
aa3154f
f0a92a2
07725d1
acdd24a
ea2dc7d
a492c73
65dea18
04cc893
9673dbf
4b87914
7ff7bdb
ff6ff75
95c706a
e9bf5cd
77e387a
aab40a3
03d14c9
03d256f
0981e53
bc6aa0c
bc68511
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,5 +21,6 @@ | |
| "@kbn/i18n", | ||
| "@kbn/task-manager-plugin", | ||
| "@kbn/deeplinks-analytics", | ||
| "@kbn/licensing-plugin", | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,8 @@ | |
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import type { ActionsPublicPluginSetup } from '@kbn/actions-plugin/public'; | ||
|
|
||
| export type { ClientConfigType } from './types'; | ||
| export { Job } from './job'; | ||
| export * from './job_completion_notifications'; | ||
|
|
@@ -15,7 +17,7 @@ export { useCheckIlmPolicyStatus } from './hooks'; | |
| export { ReportingAPIClient } from './reporting_api_client'; | ||
| export { checkLicense } from './license_check'; | ||
|
|
||
| import type { CoreSetup, CoreStart } from '@kbn/core/public'; | ||
| import type { CoreSetup, CoreStart, NotificationsStart } from '@kbn/core/public'; | ||
| import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; | ||
| import { useKibana as _useKibana } from '@kbn/kibana-react-plugin/public'; | ||
| import type { SharePluginStart } from '@kbn/share-plugin/public'; | ||
|
|
@@ -26,10 +28,13 @@ import type { SharePluginStart } from '@kbn/share-plugin/public'; | |
| export interface KibanaContext { | ||
| http: CoreSetup['http']; | ||
| application: CoreStart['application']; | ||
| settings: CoreStart['settings']; | ||
| uiSettings: CoreStart['uiSettings']; | ||
| docLinks: CoreStart['docLinks']; | ||
| data: DataPublicPluginStart; | ||
| share: SharePluginStart; | ||
| actions: ActionsPublicPluginSetup; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need the actions plugin to get the |
||
| notifications: NotificationsStart; | ||
| } | ||
|
|
||
| export const useKibana = () => _useKibana<KibanaContext>(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,10 +15,42 @@ import type { SerializedSearchSourceFields } from '@kbn/data-plugin/common'; | |
| import { FormattedMessage, InjectedIntl } from '@kbn/i18n-react'; | ||
| import { ShareContext, type ExportShare } from '@kbn/share-plugin/public'; | ||
| import { LocatorParams } from '@kbn/reporting-common/types'; | ||
| import { ReportParamsGetter, ReportParamsGetterOptions } from '../../types'; | ||
| import { getSearchCsvJobParams, CsvSearchModeParams } from '../shared/get_search_csv_job_params'; | ||
| import type { ExportModalShareOpts } from '.'; | ||
| import { checkLicense } from '../..'; | ||
|
|
||
| export const getCsvReportParams: ReportParamsGetter< | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I exported the params getters for all types of exports since I need to generate params in the scheduled report flyout too |
||
| ReportParamsGetterOptions & { forShareUrl?: boolean }, | ||
| CsvSearchModeParams | ||
| > = ({ sharingData, forShareUrl = false }) => { | ||
| const getSearchSource = sharingData.getSearchSource as ({ | ||
| addGlobalTimeFilter, | ||
| absoluteTime, | ||
| }: { | ||
| addGlobalTimeFilter?: boolean; | ||
| absoluteTime?: boolean; | ||
| }) => SerializedSearchSourceFields; | ||
|
|
||
| if (sharingData.isTextBased) { | ||
| // csv v2 uses locator params | ||
| return { | ||
| isEsqlMode: true, | ||
| locatorParams: sharingData.locatorParams as LocatorParams[], | ||
| }; | ||
| } | ||
|
|
||
| // csv v1 uses search source and columns | ||
| return { | ||
| isEsqlMode: false, | ||
| columns: sharingData.columns as string[] | undefined, | ||
| searchSource: getSearchSource({ | ||
| addGlobalTimeFilter: true, | ||
| absoluteTime: !forShareUrl, | ||
| }), | ||
| }; | ||
| }; | ||
|
|
||
| export const reportingCsvExportProvider = ({ | ||
| apiClient, | ||
| startServices$, | ||
|
|
@@ -27,33 +59,8 @@ export const reportingCsvExportProvider = ({ | |
| objectType, | ||
| sharingData, | ||
| }: ShareContext): ReturnType<ExportShare['config']> => { | ||
| const getSearchSource = sharingData.getSearchSource as ({ | ||
| addGlobalTimeFilter, | ||
| absoluteTime, | ||
| }: { | ||
| addGlobalTimeFilter?: boolean; | ||
| absoluteTime?: boolean; | ||
| }) => SerializedSearchSourceFields; | ||
|
|
||
| const getSearchModeParams = (forShareUrl?: boolean): CsvSearchModeParams => { | ||
| if (sharingData.isTextBased) { | ||
| // csv v2 uses locator params | ||
| return { | ||
| isEsqlMode: true, | ||
| locatorParams: sharingData.locatorParams as LocatorParams[], | ||
| }; | ||
| } | ||
|
|
||
| // csv v1 uses search source and columns | ||
| return { | ||
| isEsqlMode: false, | ||
| columns: sharingData.columns as string[] | undefined, | ||
| searchSource: getSearchSource({ | ||
| addGlobalTimeFilter: true, | ||
| absoluteTime: !forShareUrl, | ||
| }), | ||
| }; | ||
| }; | ||
| const getSearchModeParams = (forShareUrl?: boolean): CsvSearchModeParams => | ||
| getCsvReportParams({ sharingData, forShareUrl }); | ||
|
|
||
| const generateReportingJobCSV = ({ intl }: { intl: InjectedIntl }) => { | ||
| const { reportType, decoratedJobParams } = getSearchCsvJobParams({ | ||
|
|
@@ -132,7 +139,7 @@ export const reportingCsvExportProvider = ({ | |
| name: panelTitle, | ||
| exportType: reportType, | ||
| label: 'CSV', | ||
| icon: 'documents', | ||
| icon: 'tableDensityNormal', | ||
| generateAssetExport: generateReportingJobCSV, | ||
| helpText: ( | ||
| <FormattedMessage | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,5 +27,6 @@ | |
| "@kbn/home-plugin", | ||
| "@kbn/management-plugin", | ||
| "@kbn/ui-actions-plugin", | ||
| "@kbn/actions-plugin", | ||
| ] | ||
| } | ||
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.
Picked from #224354 just to provide a utility to integrate our PRs together