Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fd0a43d
[Response Ops][Reporting] Scheduled Reports - Schedule API (#219771)
ymao1 May 20, 2025
a7065b2
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 20, 2025
717ebba
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 21, 2025
37e7fd2
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 23, 2025
08db312
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 27, 2025
577b517
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 29, 2025
9cf25dd
[Response Ops][Reporting] Scheduled Reports - Task (merging into feat…
ymao1 May 30, 2025
6010d6a
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 May 30, 2025
12d8064
Merge
ymao1 Jun 6, 2025
eb2cb21
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 Jun 10, 2025
c6e35e7
[Response Ops][Reporting] Scheduled Reports - List and Disable API (#…
ymao1 Jun 10, 2025
3b44fb3
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 Jun 12, 2025
f5f9d9d
Checking licensing for scheduled reports feature
ymao1 Jun 12, 2025
f2782b0
[Response Ops][Reporting] Scheduled Reports - Audit Logging (merging …
ymao1 Jun 15, 2025
41883e1
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 Jun 15, 2025
94d67af
[ResponseOps][Reporting] Send email with report attachment for schedu…
doakalexi Jun 17, 2025
0b0e3a5
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 Jun 17, 2025
2d6e8be
[Response Ops][Reports] Updating list scheduled report API response (…
ymao1 Jun 17, 2025
3e78c24
[ResponseOps] [Reporting] Update the email subject, message and attac…
doakalexi Jun 17, 2025
d8b80fd
PR feedback - improve readability
ymao1 Jun 18, 2025
48829a9
PR feedback - name in audit log
ymao1 Jun 18, 2025
3db7db6
Merge branch 'main' of github.com:elastic/kibana into scheduled-reports
ymao1 Jun 19, 2025
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
3 changes: 3 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,9 @@
"installCount",
"unInstallCount"
],
"scheduled_report": [
"createdBy"
],
"search": [
"description",
"title"
Expand Down
8 changes: 8 additions & 0 deletions packages/kbn-check-mappings-update-cli/current_mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3119,6 +3119,14 @@
}
}
},
"scheduled_report": {
"dynamic": false,
"properties": {
"createdBy": {
"type": "keyword"
}
}
},
"search": {
"dynamic": false,
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const previouslyRegisteredTypes = [
'query',
'rules-settings',
'sample-data-telemetry',
'scheduled_report',
'search',
'search-session',
'search-telemetry',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export class AuthenticationExpiredError extends ReportingError {
}
}

export class MissingAuthenticationError extends ReportingError {
static code = 'missing_authentication_header_error' as const;
public get code(): string {
return MissingAuthenticationError.code;
}
}

export class QueueTimeoutError extends ReportingError {
static code = 'queue_timeout_error' as const;
public get code(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ export const INTERNAL_ROUTES = {
DELETE_PREFIX: prefixInternalPath + '/jobs/delete', // docId is added to the final path
DOWNLOAD_PREFIX: prefixInternalPath + '/jobs/download', // docId is added to the final path
},
SCHEDULED: {
LIST: prefixInternalPath + '/scheduled/list',
BULK_DISABLE: prefixInternalPath + '/scheduled/bulk_disable',
},
HEALTH: prefixInternalPath + '/_health',
GENERATE_PREFIX: prefixInternalPath + '/generate', // exportTypeId is added to the final path
SCHEDULE_PREFIX: prefixInternalPath + '/schedule', // exportTypeId is added to the final path
};

const prefixPublicPath = '/api/reporting';
Expand Down
2 changes: 2 additions & 0 deletions src/platform/packages/private/kbn-reporting/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export interface BaseParams {
objectType: string;
title: string;
version: string; // to handle any state migrations
forceNow?: string;
layout?: LayoutParams; // png & pdf only
pagingStrategy?: CsvPagingStrategy; // csv only
}
Expand Down Expand Up @@ -152,6 +153,7 @@ export interface ReportSource {
created_at: string; // timestamp in UTC
'@timestamp'?: string; // creation timestamp, only used for data streams compatibility
status: JOB_STATUS;
scheduled_report_id?: string;

/*
* `output` is only populated if the report job is completed or failed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ describe('check_license', () => {
it('should set management.jobTypes to undefined', () => {
expect(checkLicense(exportTypesRegistry, undefined).management.jobTypes).toEqual(undefined);
});

it('should set scheduledReports.showLinks to true', () => {
expect(checkLicense(exportTypesRegistry, undefined).scheduledReports.showLinks).toEqual(true);
});

it('should set scheduledReports.enableLinks to false', () => {
expect(checkLicense(exportTypesRegistry, undefined).scheduledReports.enableLinks).toEqual(
false
);
});
});

describe('license information is not available', () => {
Expand Down Expand Up @@ -82,6 +92,16 @@ describe('check_license', () => {
it('should set management.jobTypes to undefined', () => {
expect(checkLicense(exportTypesRegistry, license).management.jobTypes).toEqual(undefined);
});

it('should set scheduledReports.showLinks to true', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.showLinks).toEqual(true);
});

it('should set scheduledReports.enableLinks to false', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.enableLinks).toEqual(
false
);
});
});

describe('license information is available', () => {
Expand Down Expand Up @@ -121,6 +141,18 @@ describe('check_license', () => {
'printable_pdf'
);
});

it('should set scheduledReports.showLinks to true', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.showLinks).toEqual(
true
);
});

it('should set scheduledReports.enableLinks to true', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.enableLinks).toEqual(
true
);
});
});

describe('& license is expired', () => {
Expand All @@ -147,6 +179,18 @@ describe('check_license', () => {
it('should set management.jobTypes to undefined', () => {
expect(checkLicense(exportTypesRegistry, license).management.jobTypes).toEqual(undefined);
});

it('should set scheduledReports.showLinks to true', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.showLinks).toEqual(
true
);
});

it('should set scheduledReports.enableLinks to false', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.enableLinks).toEqual(
false
);
});
});
});

Expand Down Expand Up @@ -175,6 +219,12 @@ describe('check_license', () => {
expect(checkLicense(exportTypesRegistry, license).management.jobTypes).toEqual([]);
expect(checkLicense(exportTypesRegistry, license).management.jobTypes).toHaveLength(0);
});

it('should set scheduledReports.showLinks to false', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.showLinks).toEqual(
false
);
});
});

describe('& license is expired', () => {
Expand All @@ -193,6 +243,12 @@ describe('check_license', () => {
it('should set management.jobTypes to undefined', () => {
expect(checkLicense(exportTypesRegistry, license).management.jobTypes).toEqual(undefined);
});

it('should set scheduledReports.showLinks to true', () => {
expect(checkLicense(exportTypesRegistry, license).scheduledReports.showLinks).toEqual(
true
);
});
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { ILicense } from '@kbn/licensing-plugin/server';
import { ILicense, LicenseType } from '@kbn/licensing-plugin/server';
import {
LICENSE_TYPE_CLOUD_STANDARD,
LICENSE_TYPE_ENTERPRISE,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
LICENSE_TYPE_TRIAL,
} from '@kbn/reporting-common';
import type { ExportType } from '.';
import { ExportTypesRegistry } from './export_types_registry';

Expand All @@ -18,6 +25,14 @@ export interface LicenseCheckResult {
jobTypes?: string[];
}

const scheduledReportValidLicenses: LicenseType[] = [
LICENSE_TYPE_TRIAL,
LICENSE_TYPE_CLOUD_STANDARD,
LICENSE_TYPE_GOLD,
LICENSE_TYPE_PLATINUM,
LICENSE_TYPE_ENTERPRISE,
];

const messages = {
getUnavailable: () => {
return 'You cannot use Reporting because license information is not available at this time.';
Expand Down Expand Up @@ -60,6 +75,42 @@ const makeManagementFeature = (exportTypes: ExportType[]) => {
};
};

const makeScheduledReportsFeature = () => {
return {
id: 'scheduledReports',
checkLicense: (license?: ILicense) => {
if (!license || !license.type) {
return {
showLinks: true,
enableLinks: false,
message: messages.getUnavailable(),
};
}

if (!license.isActive) {
return {
showLinks: true,
enableLinks: false,
message: messages.getExpired(license),
};
}

if (!scheduledReportValidLicenses.includes(license.type)) {
return {
showLinks: false,
enableLinks: false,
message: `Your ${license.type} license does not support Scheduled reports. Please upgrade your license.`,
};
}

return {
showLinks: true,
enableLinks: true,
};
},
};
};

const makeExportTypeFeature = (exportType: ExportType) => {
return {
id: exportType.id,
Expand Down Expand Up @@ -104,6 +155,7 @@ export function checkLicense(
const reportingFeatures = [
...exportTypes.map(makeExportTypeFeature),
makeManagementFeature(exportTypes),
makeScheduledReportsFeature(),
];

return reportingFeatures.reduce((result, feature) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ it('Provides a feature declaration ', () => {
"minimumLicense": "gold",
"name": "Generate PDF reports",
"savedObject": Object {
"all": Array [],
"all": Array [
"scheduled_report",
],
"read": Array [],
},
"ui": Array [
Expand Down Expand Up @@ -216,7 +218,9 @@ it(`Calls on Reporting whether to include Generate PDF as a sub-feature`, () =>
"minimumLicense": "gold",
"name": "Generate PDF reports",
"savedObject": Object {
"all": Array [],
"all": Array [
"scheduled_report",
],
"read": Array [],
},
"ui": Array [
Expand Down
2 changes: 1 addition & 1 deletion x-pack/platform/plugins/private/canvas/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getCanvasFeature(plugins: { reporting?: ReportingStart }): Kiban
includeIn: 'all',
management: { insightsAndAlerting: ['reporting'] },
minimumLicense: 'gold',
savedObject: { all: [], read: [] },
savedObject: { all: ['scheduled_report'], read: [] },
api: ['generateReport'],
ui: ['generatePdf'],
},
Expand Down
1 change: 1 addition & 0 deletions x-pack/platform/plugins/private/reporting/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"reporting"
],
"requiredPlugins": [
"actions",
"data",
"discover",
"encryptedSavedObjects",
Expand Down
Loading