mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Enable CSV reporting in serverless (#162358)
## Summary This PR sets up the reporting plugin for the serverless implementation by adding properties to the existing reporting config. Image reporting is enabled for dev mode but disabled for serverless. Canvas is disabled for serverless. ## To Test Run `yarn es snapshot --license trial` in one terminal and then `yarn start`. Load sample data and you should be able to see the option to have PDF and PNG reports in Dashboard's Share Menu.  Now run `yarn es snapshot --license trial` and `yarn serverless-es`. You should see that Dashboard's share menu does not include PDF or PNG Reports. However there is still the option to see run CSV reports and see the Reporting in Management.  ### 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 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Timothy Sullivan <tsullivan@elastic.co>
This commit is contained in:
parent
af15cc19c4
commit
5864674ff6
6 changed files with 113 additions and 13 deletions
|
@ -42,7 +42,6 @@ management.deeplinks.navLinkStatus: visible
|
|||
|
||||
# Other disabled plugins
|
||||
#xpack.canvas.enabled: false #only disabable in dev-mode
|
||||
xpack.reporting.enabled: false
|
||||
xpack.cloud_integrations.data_migration.enabled: false
|
||||
data.search.sessions.enabled: false
|
||||
advanced_settings.enabled: false
|
||||
|
|
|
@ -46,6 +46,7 @@ import { JOB_COMPLETION_NOTIFICATIONS_SESSION_KEY } from '../common/constants';
|
|||
export interface ClientConfigType {
|
||||
poll: { jobsRefresh: { interval: number; intervalErrorMultiplier: number } };
|
||||
roles: { enabled: boolean };
|
||||
export_types: { pdf: { enabled: boolean }; png: { enabled: boolean }; csv: { enabled: boolean } };
|
||||
}
|
||||
|
||||
function getStored(): JobId[] {
|
||||
|
@ -236,17 +237,19 @@ export class ReportingPublicPlugin
|
|||
})
|
||||
);
|
||||
|
||||
share.register(
|
||||
reportingScreenshotShareProvider({
|
||||
apiClient,
|
||||
toasts,
|
||||
uiSettings,
|
||||
license,
|
||||
application,
|
||||
usesUiCapabilities,
|
||||
theme: core.theme,
|
||||
})
|
||||
);
|
||||
if (this.config.export_types.pdf.enabled || this.config.export_types.png.enabled) {
|
||||
share.register(
|
||||
reportingScreenshotShareProvider({
|
||||
apiClient,
|
||||
toasts,
|
||||
uiSettings,
|
||||
license,
|
||||
application,
|
||||
usesUiCapabilities,
|
||||
theme: core.theme,
|
||||
})
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -20,6 +20,17 @@ Object {
|
|||
},
|
||||
"enabled": true,
|
||||
"encryptionKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
||||
"export_types": Object {
|
||||
"csv": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"pdf": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"png": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
},
|
||||
"kibanaServer": Object {},
|
||||
"poll": Object {
|
||||
"jobCompletionNotifier": Object {
|
||||
|
@ -66,6 +77,17 @@ Object {
|
|||
"useByteOrderMarkEncoding": false,
|
||||
},
|
||||
"enabled": true,
|
||||
"export_types": Object {
|
||||
"csv": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"pdf": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"png": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
},
|
||||
"kibanaServer": Object {},
|
||||
"poll": Object {
|
||||
"jobCompletionNotifier": Object {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { get } from 'lodash';
|
|||
import { ConfigSchema, ReportingConfigType } from './schema';
|
||||
|
||||
export const config: PluginConfigDescriptor<ReportingConfigType> = {
|
||||
exposeToBrowser: { poll: true, roles: true },
|
||||
exposeToBrowser: { poll: true, roles: true, export_types: true },
|
||||
schema: ConfigSchema,
|
||||
deprecations: ({ unused }) => [
|
||||
unused('capture.browser.chromium.maxScreenshotDimension', { level: 'warning' }), // unused since 7.8
|
||||
|
|
|
@ -62,4 +62,54 @@ describe('Reporting Config Schema', () => {
|
|||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('permits csv with serverless', () => {
|
||||
expect(() =>
|
||||
ConfigSchema.validate({ export_types: { pdf: { enabled: true } } }, { dev: true })
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
it('enables all export types by default', () => {
|
||||
expect(ConfigSchema.validate({}, { serverless: false }).export_types).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"csv": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"pdf": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"png": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it('disables screenshot type exports in serverless', () => {
|
||||
expect(ConfigSchema.validate({}, { serverless: true }).export_types).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"csv": Object {
|
||||
"enabled": true,
|
||||
},
|
||||
"pdf": Object {
|
||||
"enabled": false,
|
||||
},
|
||||
"png": Object {
|
||||
"enabled": false,
|
||||
},
|
||||
}
|
||||
`);
|
||||
});
|
||||
|
||||
it('it should allow image reporting for any non-serverless config', () => {
|
||||
expect(() =>
|
||||
ConfigSchema.validate({ export_types: { pdf: { enabled: true } } }, { dev: true })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
ConfigSchema.validate({ export_types: { png: { enabled: true } } }, { dev: true })
|
||||
).not.toThrow();
|
||||
expect(() =>
|
||||
ConfigSchema.validate({ export_types: { csv: { enabled: true } } }, { dev: true })
|
||||
).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -101,6 +101,31 @@ const PollSchema = schema.object({
|
|||
}),
|
||||
});
|
||||
|
||||
const ExportTypeSchema = schema.object({
|
||||
// Csv reports are enabled in all offerings
|
||||
csv: schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
}),
|
||||
// Png reports are disabled in serverless
|
||||
png: schema.object({
|
||||
enabled: schema.conditional(
|
||||
schema.contextRef('serverless'),
|
||||
true,
|
||||
schema.boolean({ defaultValue: false }),
|
||||
schema.boolean({ defaultValue: true })
|
||||
),
|
||||
}),
|
||||
// Pdf reports are disabled in serverless
|
||||
pdf: schema.object({
|
||||
enabled: schema.conditional(
|
||||
schema.contextRef('serverless'),
|
||||
true,
|
||||
schema.boolean({ defaultValue: false }),
|
||||
schema.boolean({ defaultValue: true })
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
export const ConfigSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
kibanaServer: KibanaServerSchema,
|
||||
|
@ -110,6 +135,7 @@ export const ConfigSchema = schema.object({
|
|||
encryptionKey: EncryptionKeySchema,
|
||||
roles: RolesSchema,
|
||||
poll: PollSchema,
|
||||
export_types: ExportTypeSchema,
|
||||
});
|
||||
|
||||
export type ReportingConfigType = TypeOf<typeof ConfigSchema>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue