mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Reporting][Serverless] Make screenshotting in reporting plugin optional and disable in serverless (#168373)
## Summary Closes [#168379](https://github.com/elastic/kibana/issues/168379) ### After In logs for yarn serverless-es ```[2023-10-09T15:09:02.887-06:00][INFO ][plugins-service] Plugin "screenshotting" is disabled.``` ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This commit is contained in:
parent
bc8f45f529
commit
f5caf787af
14 changed files with 24 additions and 13 deletions
|
@ -52,6 +52,7 @@ xpack.canvas.enabled: false
|
|||
xpack.cloud_integrations.data_migration.enabled: false
|
||||
data.search.sessions.enabled: false
|
||||
advanced_settings.enabled: false
|
||||
xpack.screenshotting.enabled: false
|
||||
|
||||
# Disable the browser-side functionality that depends on SecurityCheckupGetStateRoutes
|
||||
xpack.security.showInsecureClusterWarning: false
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
"uiActions",
|
||||
"taskManager",
|
||||
"embeddable",
|
||||
"screenshotting",
|
||||
"screenshotMode",
|
||||
"share",
|
||||
"features"
|
||||
|
@ -30,7 +29,8 @@
|
|||
"optionalPlugins": [
|
||||
"security",
|
||||
"spaces",
|
||||
"usageCollection"
|
||||
"usageCollection",
|
||||
"screenshotting",
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaReact",
|
||||
|
|
|
@ -78,7 +78,7 @@ export interface ReportingInternalStart {
|
|||
fieldFormats: FieldFormatsStart;
|
||||
licensing: LicensingPluginStart;
|
||||
logger: Logger;
|
||||
screenshotting: ScreenshottingStart;
|
||||
screenshotting?: ScreenshottingStart;
|
||||
security?: SecurityPluginStart;
|
||||
taskManager: TaskManagerStartContract;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ export class ReportingCore {
|
|||
this.getContract = () => ({
|
||||
usesUiCapabilities: () => config.roles.enabled === false,
|
||||
registerExportTypes: (id) => id,
|
||||
getScreenshots: this.getScreenshots.bind(this),
|
||||
getScreenshots: config.statefulSettings.enabled ? this.getScreenshots.bind(this) : undefined,
|
||||
getSpaceId: this.getSpaceId.bind(this),
|
||||
});
|
||||
|
||||
|
@ -408,7 +408,7 @@ export class ReportingCore {
|
|||
): Rx.Observable<PngScreenshotResult | PdfScreenshotResult> {
|
||||
return Rx.defer(() => this.getPluginStartDeps()).pipe(
|
||||
switchMap(({ screenshotting }) => {
|
||||
return screenshotting.getScreenshots({
|
||||
return screenshotting!.getScreenshots({
|
||||
...options,
|
||||
urls: options.urls.map((url) =>
|
||||
typeof url === 'string'
|
||||
|
|
|
@ -37,7 +37,7 @@ export interface BaseExportTypeStartDeps {
|
|||
savedObjects: SavedObjectsServiceStart;
|
||||
uiSettings: UiSettingsServiceStart;
|
||||
esClient: IClusterClient;
|
||||
screenshotting: ScreenshottingStart;
|
||||
screenshotting?: ScreenshottingStart;
|
||||
reporting: ReportingStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ export class PngExportType extends ExportType<JobParamsPNGV2, TaskPayloadPNGV2>
|
|||
|
||||
return generatePngObservable(
|
||||
() =>
|
||||
this.startDeps.reporting.getScreenshots({
|
||||
this.startDeps.reporting.getScreenshots!({
|
||||
format: 'png',
|
||||
headers,
|
||||
layout: { ...payload.layout, id: 'preserve_layout' },
|
||||
|
|
|
@ -85,7 +85,7 @@ export class PdfV1ExportType extends ExportType<JobParamsPDFDeprecated, TaskPayl
|
|||
apmGeneratePdf = apmTrans.startSpan('generate-pdf-pipeline', 'execute');
|
||||
// make a new function that will call reporting.getScreenshots
|
||||
const snapshotFn = () =>
|
||||
this.startDeps.reporting.getScreenshots({
|
||||
this.startDeps.reporting.getScreenshots!({
|
||||
format: 'pdf',
|
||||
title,
|
||||
logo,
|
||||
|
|
|
@ -108,7 +108,7 @@ export class PdfExportType extends ExportType<JobParamsPDFV2, TaskPayloadPDFV2>
|
|||
this.config,
|
||||
this.getServerInfo(),
|
||||
() =>
|
||||
this.startDeps.reporting.getScreenshots({
|
||||
this.startDeps.reporting.getScreenshots!({
|
||||
format: 'pdf',
|
||||
title,
|
||||
logo,
|
||||
|
|
|
@ -54,6 +54,7 @@ export const registerDiagnoseBrowser = (reporting: ReportingCore, logger: Logger
|
|||
const logsToHelpMap = logsToHelpMapFactory(docLinks);
|
||||
try {
|
||||
const { screenshotting } = await reporting.getPluginStartDeps();
|
||||
if (!screenshotting) throw new Error('Screenshotting is not enabled!');
|
||||
const logs = await lastValueFrom(screenshotting.diagnose());
|
||||
const knownIssues = Object.keys(logsToHelpMap) as Array<keyof typeof logsToHelpMap>;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import { ExportTypesRegistry } from './lib';
|
|||
export interface ReportingSetup {
|
||||
registerExportTypes: ExportTypesRegistry['register'];
|
||||
getSpaceId: ReportingCore['getSpaceId'];
|
||||
getScreenshots: ReportingCore['getScreenshots'];
|
||||
getScreenshots?: ReportingCore['getScreenshots'];
|
||||
/**
|
||||
* Used to inform plugins if Reporting config is compatible with UI Capabilities / Application Sub-Feature Controls
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ export type RunTaskFn<TaskPayloadType = BasePayload> = (
|
|||
|
||||
export interface ReportingSetupDeps {
|
||||
features: FeaturesPluginSetup;
|
||||
screenshotMode: ScreenshotModePluginSetup;
|
||||
screenshotMode?: ScreenshotModePluginSetup;
|
||||
security?: SecurityPluginSetup;
|
||||
spaces?: SpacesPluginSetup;
|
||||
taskManager: TaskManagerSetupContract;
|
||||
|
@ -105,7 +105,7 @@ export interface ReportingStartDeps {
|
|||
discover: DiscoverServerPluginStart;
|
||||
fieldFormats: FieldFormatsStart;
|
||||
licensing: LicensingPluginStart;
|
||||
screenshotting: ScreenshottingStart;
|
||||
screenshotting?: ScreenshottingStart;
|
||||
security?: SecurityPluginStart;
|
||||
taskManager: TaskManagerStartContract;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ describe('chromium driver', () => {
|
|||
mockLogger.get = () => mockLogger;
|
||||
|
||||
mockConfig = {
|
||||
enabled: true,
|
||||
networkPolicy: {
|
||||
enabled: false,
|
||||
rules: [],
|
||||
|
|
|
@ -27,6 +27,7 @@ describe('ConfigSchema', () => {
|
|||
},
|
||||
"zoom": 2,
|
||||
},
|
||||
"enabled": true,
|
||||
"networkPolicy": Object {
|
||||
"enabled": true,
|
||||
"rules": Array [
|
||||
|
@ -87,6 +88,7 @@ describe('ConfigSchema', () => {
|
|||
},
|
||||
"zoom": 2,
|
||||
},
|
||||
"enabled": true,
|
||||
"networkPolicy": Object {
|
||||
"enabled": true,
|
||||
"rules": Array [
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { schema, TypeOf, offeringBasedSchema } from '@kbn/config-schema';
|
||||
import moment from 'moment';
|
||||
|
||||
const RulesSchema = schema.object({
|
||||
|
@ -23,6 +23,10 @@ const RulesSchema = schema.object({
|
|||
});
|
||||
|
||||
export const ConfigSchema = schema.object({
|
||||
enabled: offeringBasedSchema({
|
||||
serverless: schema.boolean({ defaultValue: false }),
|
||||
traditional: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
networkPolicy: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
rules: schema.arrayOf(RulesSchema, {
|
||||
|
|
|
@ -68,6 +68,7 @@ describe('Screenshot Observable Pipeline', () => {
|
|||
urls: ['/welcome/home/start/index.htm'],
|
||||
};
|
||||
config = {
|
||||
enabled: true,
|
||||
poolSize: 1,
|
||||
capture: {
|
||||
timeouts: {
|
||||
|
|
|
@ -37,6 +37,7 @@ describe('class Screenshots', () => {
|
|||
mockLogger = loggerMock.create();
|
||||
|
||||
mockConfig = {
|
||||
enabled: true,
|
||||
networkPolicy: {
|
||||
enabled: false,
|
||||
rules: [],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue