forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[canvas] Create Reporting Service; remove legacy service (elastic#107352
- Loading branch information
1 parent
9ea84bf
commit d10c4ce
Showing
14 changed files
with
123 additions
and
96 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,45 @@ | ||
/* | ||
* 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 { KibanaPluginServiceFactory } from '../../../../../../src/plugins/presentation_util/public'; | ||
|
||
import { CanvasStartDeps } from '../../plugin'; | ||
import { CanvasReportingService } from '../reporting'; | ||
|
||
export type CanvasReportingServiceFactory = KibanaPluginServiceFactory< | ||
CanvasReportingService, | ||
CanvasStartDeps | ||
>; | ||
|
||
export const reportingServiceFactory: CanvasReportingServiceFactory = ({ | ||
startPlugins, | ||
coreStart, | ||
}) => { | ||
const { reporting } = startPlugins; | ||
|
||
const reportingEnabled = () => ({ | ||
getReportingPanelPDFComponent: () => reporting?.components.ReportingPanelPDF || null, | ||
}); | ||
const reportingDisabled = () => ({ getReportingPanelPDFComponent: () => null }); | ||
|
||
if (!reporting) { | ||
// Reporting is not enabled | ||
return reportingDisabled(); | ||
} | ||
|
||
if (reporting.usesUiCapabilities()) { | ||
if (coreStart.application.capabilities.canvas?.generatePdf === true) { | ||
// Canvas has declared Reporting as a subfeature with the `generatePdf` UI Capability | ||
return reportingEnabled(); | ||
} else { | ||
return reportingDisabled(); | ||
} | ||
} | ||
|
||
// Legacy/Deprecated: Reporting is enabled as an Elasticsearch feature | ||
return reportingEnabled(); | ||
}; |
This file contains 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 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 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
23 changes: 0 additions & 23 deletions
23
x-pack/plugins/canvas/public/services/legacy/stubs/reporting.ts
This file was deleted.
Oops, something went wrong.
This file contains 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,13 @@ | ||
/* | ||
* 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 { ReportingStart } from '../../../reporting/public'; | ||
|
||
type ReportingPanelPDFComponent = ReportingStart['components']['ReportingPanelPDF']; | ||
export interface CanvasReportingService { | ||
getReportingPanelPDFComponent: () => ReportingPanelPDFComponent | null; | ||
} |
Oops, something went wrong.