mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
# Backport This will backport the following commits from `main` to `7.17`: - [[SharedUX/Locators] Add limits around legacy locator (#222273)](https://github.com/elastic/kibana/pull/222273) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Tim Sullivan","email":"tsullivan@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-04T19:55:47Z","message":"[SharedUX/Locators] Add limits around legacy locator (#222273)\n\n## Summary\n\nWe've decided that we want to enforce sanity checks around the \"legacy\"\nlocator and phase out its usage. This PR ensures the legacy locator can\nnot be used from the Reporting plugin.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b96e7c37b83dc3f3ec08860d10413127baf13196","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.1.0","v8.19.0","v7.17.29","v9.0.3","v8.18.3","v8.17.8"],"title":"[SharedUX/Locators] Add limits around legacy locator","number":222273,"url":"https://github.com/elastic/kibana/pull/222273","mergeCommit":{"message":"[SharedUX/Locators] Add limits around legacy locator (#222273)\n\n## Summary\n\nWe've decided that we want to enforce sanity checks around the \"legacy\"\nlocator and phase out its usage. This PR ensures the legacy locator can\nnot be used from the Reporting plugin.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b96e7c37b83dc3f3ec08860d10413127baf13196"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","7.17","9.0","8.18","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/222273","number":222273,"mergeCommit":{"message":"[SharedUX/Locators] Add limits around legacy locator (#222273)\n\n## Summary\n\nWe've decided that we want to enforce sanity checks around the \"legacy\"\nlocator and phase out its usage. This PR ensures the legacy locator can\nnot be used from the Reporting plugin.\n\n### Checklist\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b96e7c37b83dc3f3ec08860d10413127baf13196"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"7.17","label":"v7.17.29","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co>
157 lines
5.3 KiB
TypeScript
157 lines
5.3 KiB
TypeScript
/*
|
|
* 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.
|
|
*/
|
|
|
|
export const PLUGIN_ID = 'reporting';
|
|
|
|
export const REPORTING_TRANSACTION_TYPE = PLUGIN_ID;
|
|
|
|
export const JOB_COMPLETION_NOTIFICATIONS_SESSION_KEY =
|
|
'xpack.reporting.jobCompletionNotifications';
|
|
|
|
export const CONTENT_TYPE_CSV = 'text/csv';
|
|
export const CSV_REPORTING_ACTION = 'downloadCsvReport';
|
|
export const CSV_BOM_CHARS = '\ufeff';
|
|
export const CSV_FORMULA_CHARS = ['=', '+', '-', '@'];
|
|
|
|
export const ALLOWED_JOB_CONTENT_TYPES = [
|
|
'application/json',
|
|
'application/pdf',
|
|
CONTENT_TYPE_CSV,
|
|
'image/png',
|
|
'text/plain',
|
|
];
|
|
|
|
// See:
|
|
// https://github.com/chromium/chromium/blob/3611052c055897e5ebbc5b73ea295092e0c20141/services/network/public/cpp/header_util_unittest.cc#L50
|
|
// For a list of headers that chromium doesn't like
|
|
export const KBN_SCREENSHOT_HEADER_BLOCK_LIST = [
|
|
'accept-encoding',
|
|
'connection',
|
|
'content-length',
|
|
'content-type',
|
|
'host',
|
|
'referer',
|
|
// `Transfer-Encoding` is hop-by-hop header that is meaningful
|
|
// only for a single transport-level connection, and shouldn't
|
|
// be stored by caches or forwarded by proxies.
|
|
'transfer-encoding',
|
|
'trailer',
|
|
'te',
|
|
'upgrade',
|
|
'keep-alive',
|
|
];
|
|
|
|
export const KBN_SCREENSHOT_HEADER_BLOCK_LIST_STARTS_WITH_PATTERN = ['proxy-'];
|
|
|
|
export const UI_SETTINGS_SEARCH_INCLUDE_FROZEN = 'search:includeFrozen';
|
|
export const UI_SETTINGS_CUSTOM_PDF_LOGO = 'xpackReporting:customPdfLogo';
|
|
export const UI_SETTINGS_CSV_SEPARATOR = 'csv:separator';
|
|
export const UI_SETTINGS_CSV_QUOTE_VALUES = 'csv:quoteValues';
|
|
export const UI_SETTINGS_DATEFORMAT_TZ = 'dateFormat:tz';
|
|
|
|
export const LAYOUT_TYPES = {
|
|
CANVAS: 'canvas',
|
|
PRESERVE_LAYOUT: 'preserve_layout',
|
|
PRINT: 'print',
|
|
};
|
|
|
|
export const DEFAULT_VIEWPORT = {
|
|
width: 1950,
|
|
height: 1200,
|
|
deviceScaleFactor: 1,
|
|
};
|
|
|
|
// Export Type Definitions
|
|
export const CSV_SAVED_OBJECT_JOB_TYPE = 'csv_saved_object';
|
|
|
|
export const CSV_REPORT_TYPE = 'CSV';
|
|
export const CSV_JOB_TYPE = 'csv_searchsource';
|
|
|
|
export const PDF_REPORT_TYPE = 'printablePdf';
|
|
export const PDF_REPORT_TYPE_V2 = 'printablePdfV2';
|
|
export const PDF_JOB_TYPE = 'printable_pdf';
|
|
export const PDF_JOB_TYPE_V2 = 'printable_pdf_v2';
|
|
|
|
export const PNG_REPORT_TYPE = 'PNG';
|
|
export const PNG_REPORT_TYPE_V2 = 'pngV2';
|
|
export const PNG_JOB_TYPE = 'PNG';
|
|
export const PNG_JOB_TYPE_V2 = 'PNGV2';
|
|
|
|
export const CSV_SEARCHSOURCE_IMMEDIATE_TYPE = 'csv_searchsource_immediate';
|
|
|
|
// This is deprecated because it lacks support for runtime fields
|
|
// but the extension points are still needed for pre-existing scripted automation, until 8.0
|
|
export const CSV_REPORT_TYPE_DEPRECATED = 'CSV';
|
|
export const CSV_JOB_TYPE_DEPRECATED = 'csv';
|
|
|
|
export const USES_HEADLESS_JOB_TYPES = [PDF_JOB_TYPE, PNG_JOB_TYPE];
|
|
|
|
export const DEPRECATED_JOB_TYPES = [CSV_JOB_TYPE_DEPRECATED];
|
|
|
|
// Licenses
|
|
export const LICENSE_TYPE_TRIAL = 'trial';
|
|
export const LICENSE_TYPE_BASIC = 'basic';
|
|
export const LICENSE_TYPE_CLOUD_STANDARD = 'standard';
|
|
export const LICENSE_TYPE_GOLD = 'gold';
|
|
export const LICENSE_TYPE_PLATINUM = 'platinum';
|
|
export const LICENSE_TYPE_ENTERPRISE = 'enterprise';
|
|
|
|
// Routes
|
|
export const API_BASE_URL = '/api/reporting'; // "Generation URL" from share menu
|
|
export const API_BASE_GENERATE = `${API_BASE_URL}/generate`;
|
|
export const API_LIST_URL = `${API_BASE_URL}/jobs`;
|
|
export const API_DIAGNOSE_URL = `${API_BASE_URL}/diagnose`;
|
|
|
|
export const API_GET_ILM_POLICY_STATUS = `${API_BASE_URL}/ilm_policy_status`;
|
|
export const API_MIGRATE_ILM_POLICY_URL = `${API_BASE_URL}/deprecations/migrate_ilm_policy`;
|
|
export const API_BASE_URL_V1 = '/api/reporting/v1'; //
|
|
|
|
export const ILM_POLICY_NAME = 'kibana-reporting';
|
|
|
|
// Management UI route
|
|
export const REPORTING_MANAGEMENT_HOME = '/app/management/insightsAndAlerting/reporting';
|
|
|
|
// Allowed locator types for reporting: the "reportable" analytical apps we expect to redirect to during screenshotting
|
|
export const REPORTING_REDIRECT_ALLOWED_LOCATOR_TYPES = [
|
|
'DASHBOARD_APP_LOCATOR',
|
|
'LENS_APP_LOCATOR',
|
|
'VISUALIZE_APP_LOCATOR',
|
|
];
|
|
|
|
export const REPORTING_REDIRECT_LOCATOR_STORE_KEY = '__REPORTING_REDIRECT_LOCATOR_STORE_KEY__';
|
|
|
|
/**
|
|
* A way to get the client side route for the reporting redirect app.
|
|
*
|
|
* TODO: Add a job ID and a locator to use so that we can redirect without expecting state to
|
|
* be injected to the page
|
|
*/
|
|
export const getRedirectAppPath = () => {
|
|
return '/app/management/insightsAndAlerting/reporting/r';
|
|
};
|
|
|
|
// Statuses
|
|
export enum JOB_STATUSES {
|
|
PENDING = 'pending',
|
|
PROCESSING = 'processing',
|
|
COMPLETED = 'completed',
|
|
FAILED = 'failed',
|
|
WARNINGS = 'completed_with_warnings',
|
|
}
|
|
|
|
// Test Subjects
|
|
export const REPORT_TABLE_ID = 'reportJobListing';
|
|
export const REPORT_TABLE_ROW_ID = 'reportJobRow';
|
|
|
|
// Job params require a `version` field as of 7.15.0. For older jobs set with
|
|
// automation that have no version value in the job params, we assume the
|
|
// intended version is 7.14.0
|
|
export const UNVERSIONED_VERSION = '7.14.0';
|
|
|
|
// hacky endpoint: download CSV without queueing a report
|
|
// FIXME: find a way to make these endpoints "generic" instead of hardcoded, as are the queued report export types
|
|
export const API_GENERATE_IMMEDIATE = `${API_BASE_URL_V1}/generate/immediate/csv_searchsource`;
|