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
366408d
[Reporting] Replace Job Completion Notifier as NP Plugin
tsullivan Oct 8, 2019
1b94a7c
beautiful toasts
tsullivan Oct 8, 2019
3fb1b02
unit test
tsullivan Oct 8, 2019
4e98814
showNotifications returns observable
tsullivan Oct 9, 2019
2c9c92c
Merge branch 'master' into reporting/np-job-completion-notifier
tsullivan Oct 9, 2019
d96ed8f
fix kibana.json
tsullivan Oct 9, 2019
4056e8d
depends on links
tsullivan Oct 9, 2019
6e14613
Merge branch 'master' into reporting/np-job-completion-notifier
tsullivan Oct 15, 2019
39abf8b
no prettier ignore
tsullivan Oct 15, 2019
8288273
Merge branch 'master' into reporting/np-job-completion-notifier
tsullivan Oct 16, 2019
9a19f8c
Update content per feedback
tsullivan Oct 16, 2019
926a392
Remove unnecessary wrapper
tsullivan Oct 16, 2019
69edf32
remove type annos and condense
tsullivan Oct 16, 2019
89332af
use an observable of the stop method
tsullivan Oct 16, 2019
b0669d0
Merge branch 'master' into reporting/np-job-completion-notifier
tsullivan Oct 18, 2019
f346d28
rename the new platform plugin to match legacy
tsullivan Oct 18, 2019
923873c
fix i18n config
tsullivan Oct 18, 2019
a582c81
additional plugin rename
tsullivan Oct 18, 2019
b045027
i18n strings prefix change
tsullivan Oct 18, 2019
3b78a36
try something with x-pack/.i18nrc.json
tsullivan Oct 18, 2019
63d5270
remove a few more notifier phrasing from plugin definition
tsullivan Oct 18, 2019
f84dbde
Merge branch 'master' into reporting/np-job-completion-notifier
tsullivan Oct 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"xpack.main": "legacy/plugins/xpack_main",
"xpack.monitoring": "legacy/plugins/monitoring",
"xpack.remoteClusters": "legacy/plugins/remote_clusters",
"xpack.reporting": "legacy/plugins/reporting",
"xpack.reporting": [ "plugins/reporting", "legacy/plugins/reporting" ],
"xpack.rollupJobs": "legacy/plugins/rollup",
"xpack.searchProfiler": "legacy/plugins/searchprofiler",
"xpack.siem": "legacy/plugins/siem",
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/reporting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export const reporting = (kibana) => {
embeddableActions: [
'plugins/reporting/panel_actions/get_csv_panel_action',
],
hacks: ['plugins/reporting/hacks/job_completion_notifier'],
home: ['plugins/reporting/register_feature'],
managementSections: ['plugins/reporting/views/management'],
injectDefaultVars(server, options) {
Expand Down

This file was deleted.

This file was deleted.

17 changes: 11 additions & 6 deletions x-pack/legacy/plugins/reporting/server/routes/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import boom from 'boom';
import { RequestQuery } from 'hapi';
import { Request, ResponseToolkit } from 'hapi';
import { API_BASE_URL } from '../../common/constants';
import { JobDoc, KbnServer } from '../../types';
Expand All @@ -19,6 +20,12 @@ import {

const MAIN_ENTRY = `${API_BASE_URL}/jobs`;

type ListQuery = RequestQuery & {
page: string;
size: string;
ids?: string; // optional field forbids us from extending RequestQuery
};

export function registerJobs(server: KbnServer) {
const jobsQuery = jobsQueryFactory(server);
const getRouteConfig = getRouteConfigFactoryManagementPre(server);
Expand All @@ -30,12 +37,10 @@ export function registerJobs(server: KbnServer) {
method: 'GET',
config: getRouteConfig(),
handler: (request: Request) => {
// @ts-ignore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated cleanup of TS

const page = parseInt(request.query.page, 10) || 0;
// @ts-ignore
const size = Math.min(100, parseInt(request.query.size, 10) || 10);
// @ts-ignore
const jobIds = request.query.ids ? request.query.ids.split(',') : null;
const { page: queryPage, size: querySize, ids: queryIds } = request.query as ListQuery;
const page = parseInt(queryPage, 10) || 0;
const size = Math.min(100, parseInt(querySize, 10) || 10);
const jobIds = queryIds ? queryIds.split(',') : null;

const results = jobsQuery.list(
request.pre.management.jobTypes,
Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/reporting/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const reportingPollConfig = {
jobCompletionNotifier: { interval: 10000, intervalErrorMultiplier: 5 },
jobsRefresh: { interval: 5000, intervalErrorMultiplier: 5 },
};
21 changes: 21 additions & 0 deletions x-pack/plugins/reporting/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const JOB_COMPLETION_NOTIFICATIONS_SESSION_KEY =
'xpack.reporting.jobCompletionNotifications';

export const JOB_COMPLETION_NOTIFICATIONS_POLLER_CONFIG = {
jobCompletionNotifier: {
interval: 10000,
intervalErrorMultiplier: 5,
},
};

export const API_BASE_URL = '/api/reporting/jobs';
export const REPORTING_MANAGEMENT_HOME = '/app/kibana#/management/kibana/reporting';

export const JOB_STATUS_FAILED = 'failed';
export const JOB_STATUS_COMPLETED = 'completed';
59 changes: 59 additions & 0 deletions x-pack/plugins/reporting/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import {
CoreSetup,
CoreStart,
HttpServiceBase,
Plugin,
PluginInitializerContext,
NotificationsStart,
} from '../../../src/core/public';

export type JobId = string;
export type JobStatus = 'completed' | 'pending' | 'processing' | 'failed';

export type HttpService = HttpServiceBase;
export type NotificationsService = NotificationsStart;

export interface SourceJob {
_id: JobId;
_source: {
status: JobStatus;
output: {
max_size_reached: boolean;
csv_contains_formulas: boolean;
};
payload: {
type: string;
title: string;
};
};
}

export interface JobContent {
content: string;
}

export interface JobSummary {
id: JobId;
status: JobStatus;
title: string;
type: string;
maxSizeReached: boolean;
csvContainsFormulas: boolean;
}

export interface JobStatusBuckets {
completed: JobSummary[];
failed: JobSummary[];
}

type DownloadLink = string;
export type DownloadReportFn = (jobId: JobId) => DownloadLink;

type ManagementLink = string;
export type ManagementLinkFn = () => ManagementLink;
8 changes: 8 additions & 0 deletions x-pack/plugins/reporting/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "reporting",
"version": "8.0.0",
"kibanaVersion": "kibana",
"requiredPlugins": [],
"server": false,
"ui": true
}
Loading