From a8e3db89ce0a8e958cea6426df3bbcff8a975c12 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 26 May 2023 19:40:29 +0000 Subject: [PATCH] Remove timeline application (#3971) * Remove timeline application In this PR, we made the following changes: First of all, clean out some advanced settings specific to timeline application and tests. * Remove timelion:default_rows: This setting defines the default number of rows that a new Timelion sheet should have. * Remove timelion:default_rows: This setting defines the default number of columns that a new Timelion sheet should have. * Remove timelion:showTutorial. Second, remove src/plugin/timeline completely and modify timeline vis. Third, remove all the functional tests related to timeline application. Issue resolve https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3519 https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3593 Signed-off-by: ananzh --------- Signed-off-by: Anan Zhuang Signed-off-by: ananzh (cherry picked from commit ec41f59cd2554d1626935de1481b6e57dbc3f571) Signed-off-by: github-actions[bot] # Conflicts: # CHANGELOG.md --- .i18nrc.json | 2 +- .../with-security/check_advanced_settings.js | 7 - .../with-security/helpers/generate_data.js | 3 - .../check_advanced_settings.js | 7 - .../without-security/helpers/generate_data.js | 3 - package.json | 1 - packages/osd-optimizer/limits.yml | 1 - .../public/doc_links/doc_links_service.ts | 3 - .../bin/opensearch-dashboards-docker | 1 - .../collectors/application_usage/schema.ts | 1 - .../server/collectors/management/schema.ts | 3 - .../get_saved_object_counts.test.ts | 3 - .../get_saved_object_counts.ts | 10 +- .../opensearch_dashboards/index.test.ts | 2 - .../server/collectors/ui_metric/schema.ts | 1 - src/plugins/telemetry/schema/oss_plugins.json | 57 -- src/plugins/timeline/README.md | 2 - .../timeline/opensearch_dashboards.json | 19 - src/plugins/timeline/public/_app.scss | 21 - src/plugins/timeline/public/_base.scss | 18 - src/plugins/timeline/public/app.js | 678 ------------------ src/plugins/timeline/public/application.ts | 164 ----- src/plugins/timeline/public/breadcrumbs.js | 59 -- .../components/timeline_deprecation.tsx | 64 -- .../timeline_deprecation_directive.js | 53 -- .../public/components/timelinehelp_tabs.js | 70 -- .../components/timelinehelp_tabs_directive.js | 54 -- .../timeline/public/directives/_form.scss | 36 - .../timeline/public/directives/_index.scss | 7 - .../directives/_saved_object_finder.scss | 95 --- .../_timeline_expression_input.scss | 15 - .../public/directives/cells/_cells.scss | 62 -- .../public/directives/cells/_index.scss | 1 - .../public/directives/cells/cells.html | 52 -- .../timeline/public/directives/cells/cells.js | 63 -- .../public/directives/cells/collection.ts | 87 --- .../timeline/public/directives/chart/chart.js | 77 -- .../public/directives/fixed_element.js | 61 -- .../directives/fullscreen/fullscreen.html | 14 - .../directives/fullscreen/fullscreen.js | 47 -- .../timeline/public/directives/input_focus.js | 46 -- .../timeline/public/directives/key_map.ts | 132 ---- .../directives/saved_object_finder.html | 118 --- .../public/directives/saved_object_finder.js | 327 --------- .../saved_object_save_as_checkbox.html | 28 - .../saved_object_save_as_checkbox.js | 44 -- .../directives/timeline_expression_input.html | 19 - .../directives/timeline_expression_input.js | 293 -------- .../timeline_expression_input_helpers.js | 291 -------- .../_index.scss | 1 - .../_timeline_expression_suggestions.scss | 36 - .../timeline_expression_suggestions.html | 109 --- .../timeline_expression_suggestions.js | 50 -- .../public/directives/timeline_grid.js | 79 -- .../directives/timeline_help/_index.scss | 1 - .../timeline_help/_timeline_help.scss | 24 - .../timeline_help/timeline_help.html | 507 ------------- .../directives/timeline_help/timeline_help.js | 177 ----- .../directives/timeline_interval/_index.scss | 1 - .../timeline_interval/_timeline_interval.scss | 24 - .../timeline_interval/timeline_interval.html | 22 - .../timeline_interval/timeline_interval.js | 94 --- .../public/directives/timeline_load_sheet.js | 41 -- .../directives/timeline_options_sheet.js | 41 -- .../public/directives/timeline_save_sheet.js | 41 -- src/plugins/timeline/public/index.html | 95 --- src/plugins/timeline/public/index.scss | 18 - src/plugins/timeline/public/index.ts | 36 - .../timeline/public/lib/observe_resize.js | 55 -- src/plugins/timeline/public/panels/panel.ts | 56 -- .../public/panels/timechart/schema.ts | 414 ----------- .../public/panels/timechart/timechart.ts | 39 - .../timeline/public/partials/load_sheet.html | 12 - .../timeline/public/partials/save_sheet.html | 106 --- .../public/partials/sheet_options.html | 36 - src/plugins/timeline/public/plugin.ts | 162 ----- .../timeline/public/services/_saved_sheet.ts | 92 --- .../timeline/public/services/saved_sheets.ts | 61 -- .../timeline/public/timeline_app_state.ts | 88 --- src/plugins/timeline/public/types.ts | 46 -- src/plugins/timeline/server/config.ts | 43 -- src/plugins/timeline/server/index.ts | 40 -- src/plugins/timeline/server/plugin.ts | 114 --- .../timeline/server/saved_objects/index.ts | 31 - .../server/saved_objects/timeline_sheet.ts | 56 -- src/plugins/vis_type_timeline/config.ts | 15 +- .../vis_type_timeline/public/plugin.ts | 11 +- src/plugins/vis_type_timeline/server/index.ts | 5 - .../vis_type_timeline/server/plugin.ts | 11 +- .../basic_opensearch_dashboards/mappings.json | 41 -- .../saved_objects/relationships/mappings.json | 43 +- .../saved_objects/search/mappings.json | 43 +- .../saved_objects/10k/mappings.json | 41 -- .../saved_objects/basic/mappings.json | 43 +- .../find_edgecases/mappings.json | 41 -- .../search/count/mappings.json | 44 +- .../apps/dashboard/dashboard_filtering.js | 10 - .../apps/timeline/_expression_typeahead.js | 119 --- test/functional/apps/timeline/index.js | 49 -- test/functional/config.js | 4 - .../opensearch_dashboards/mappings.json | 44 +- .../dashboard/legacy/mappings.json | 44 +- .../discover/mappings.json | 42 -- .../empty_opensearch_dashboards/mappings.json | 42 -- .../opensearch_archiver/hamlet/mappings.json | 44 +- .../invalid_scripted_field/mappings.json | 43 +- .../management/mappings.json | 44 +- .../opensearch_archiver/mgmt/mappings.json | 43 +- .../mappings.json | 44 +- .../saved_objects_imports/mappings.json | 44 +- .../edit_saved_object/mappings.json | 43 +- .../timeline/mappings.json | 44 +- .../visualize/mappings.json | 42 -- .../visualize_embedding/mappings.json | 44 +- .../visualize_source-filters/mappings.json | 44 +- .../visualize_source_filters/mappings.json | 44 +- test/functional/page_objects/index.ts | 2 - test/functional/page_objects/timeline_page.ts | 106 --- .../opensearch_dashboards/mappings.json | 44 +- yarn.lock | 5 - 120 files changed, 27 insertions(+), 7415 deletions(-) delete mode 100644 src/plugins/timeline/README.md delete mode 100644 src/plugins/timeline/opensearch_dashboards.json delete mode 100644 src/plugins/timeline/public/_app.scss delete mode 100644 src/plugins/timeline/public/_base.scss delete mode 100644 src/plugins/timeline/public/app.js delete mode 100644 src/plugins/timeline/public/application.ts delete mode 100644 src/plugins/timeline/public/breadcrumbs.js delete mode 100644 src/plugins/timeline/public/components/timeline_deprecation.tsx delete mode 100644 src/plugins/timeline/public/components/timeline_deprecation_directive.js delete mode 100644 src/plugins/timeline/public/components/timelinehelp_tabs.js delete mode 100644 src/plugins/timeline/public/components/timelinehelp_tabs_directive.js delete mode 100644 src/plugins/timeline/public/directives/_form.scss delete mode 100644 src/plugins/timeline/public/directives/_index.scss delete mode 100644 src/plugins/timeline/public/directives/_saved_object_finder.scss delete mode 100644 src/plugins/timeline/public/directives/_timeline_expression_input.scss delete mode 100644 src/plugins/timeline/public/directives/cells/_cells.scss delete mode 100644 src/plugins/timeline/public/directives/cells/_index.scss delete mode 100644 src/plugins/timeline/public/directives/cells/cells.html delete mode 100644 src/plugins/timeline/public/directives/cells/cells.js delete mode 100644 src/plugins/timeline/public/directives/cells/collection.ts delete mode 100644 src/plugins/timeline/public/directives/chart/chart.js delete mode 100644 src/plugins/timeline/public/directives/fixed_element.js delete mode 100644 src/plugins/timeline/public/directives/fullscreen/fullscreen.html delete mode 100644 src/plugins/timeline/public/directives/fullscreen/fullscreen.js delete mode 100644 src/plugins/timeline/public/directives/input_focus.js delete mode 100644 src/plugins/timeline/public/directives/key_map.ts delete mode 100644 src/plugins/timeline/public/directives/saved_object_finder.html delete mode 100644 src/plugins/timeline/public/directives/saved_object_finder.js delete mode 100644 src/plugins/timeline/public/directives/saved_object_save_as_checkbox.html delete mode 100644 src/plugins/timeline/public/directives/saved_object_save_as_checkbox.js delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_input.html delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_input.js delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_input_helpers.js delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_suggestions/_index.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_suggestions/_timeline_expression_suggestions.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.html delete mode 100644 src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.js delete mode 100644 src/plugins/timeline/public/directives/timeline_grid.js delete mode 100644 src/plugins/timeline/public/directives/timeline_help/_index.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_help/_timeline_help.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_help/timeline_help.html delete mode 100644 src/plugins/timeline/public/directives/timeline_help/timeline_help.js delete mode 100644 src/plugins/timeline/public/directives/timeline_interval/_index.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_interval/_timeline_interval.scss delete mode 100644 src/plugins/timeline/public/directives/timeline_interval/timeline_interval.html delete mode 100644 src/plugins/timeline/public/directives/timeline_interval/timeline_interval.js delete mode 100644 src/plugins/timeline/public/directives/timeline_load_sheet.js delete mode 100644 src/plugins/timeline/public/directives/timeline_options_sheet.js delete mode 100644 src/plugins/timeline/public/directives/timeline_save_sheet.js delete mode 100644 src/plugins/timeline/public/index.html delete mode 100644 src/plugins/timeline/public/index.scss delete mode 100644 src/plugins/timeline/public/index.ts delete mode 100644 src/plugins/timeline/public/lib/observe_resize.js delete mode 100644 src/plugins/timeline/public/panels/panel.ts delete mode 100644 src/plugins/timeline/public/panels/timechart/schema.ts delete mode 100644 src/plugins/timeline/public/panels/timechart/timechart.ts delete mode 100644 src/plugins/timeline/public/partials/load_sheet.html delete mode 100644 src/plugins/timeline/public/partials/save_sheet.html delete mode 100644 src/plugins/timeline/public/partials/sheet_options.html delete mode 100644 src/plugins/timeline/public/plugin.ts delete mode 100644 src/plugins/timeline/public/services/_saved_sheet.ts delete mode 100644 src/plugins/timeline/public/services/saved_sheets.ts delete mode 100644 src/plugins/timeline/public/timeline_app_state.ts delete mode 100644 src/plugins/timeline/public/types.ts delete mode 100644 src/plugins/timeline/server/config.ts delete mode 100644 src/plugins/timeline/server/index.ts delete mode 100644 src/plugins/timeline/server/plugin.ts delete mode 100644 src/plugins/timeline/server/saved_objects/index.ts delete mode 100644 src/plugins/timeline/server/saved_objects/timeline_sheet.ts delete mode 100644 test/functional/apps/timeline/_expression_typeahead.js delete mode 100644 test/functional/apps/timeline/index.js delete mode 100644 test/functional/page_objects/timeline_page.ts diff --git a/.i18nrc.json b/.i18nrc.json index 234aa8de0c25..64ca6528aa5e 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -48,7 +48,7 @@ "src/plugins/telemetry_management_section" ], "tileMap": "src/plugins/tile_map", - "timeline": ["src/plugins/timeline", "src/plugins/vis_type_timeline"], + "timeline": ["src/plugins/vis_type_timeline"], "uiActions": "src/plugins/ui_actions", "visDefaultEditor": "src/plugins/vis_default_editor", "visTypeMarkdown": "src/plugins/vis_type_markdown", diff --git a/cypress/integration/with-security/check_advanced_settings.js b/cypress/integration/with-security/check_advanced_settings.js index 502ee150a33f..9ca41207724e 100644 --- a/cypress/integration/with-security/check_advanced_settings.js +++ b/cypress/integration/with-security/check_advanced_settings.js @@ -25,13 +25,6 @@ describe('verify the advanced settings are saved', () => { .should('eq', 'true'); }); - it('the Timeline default columns field is set to 4', () => { - cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').should( - 'have.value', - 4 - ); - }); - it('the Timeline Maximum buckets field is set to 4', () => { cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').should( 'have.value', diff --git a/cypress/integration/with-security/helpers/generate_data.js b/cypress/integration/with-security/helpers/generate_data.js index 1509dca7b012..4833a81a1398 100755 --- a/cypress/integration/with-security/helpers/generate_data.js +++ b/cypress/integration/with-security/helpers/generate_data.js @@ -31,9 +31,6 @@ describe('Generating BWC test data with security', () => { it('adds advanced settings', () => { miscUtils.visitPage('app/management/opensearch-dashboards/settings'); cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); - cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').type( - '{selectAll}4' - ); cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( '{selectAll}4' ); diff --git a/cypress/integration/without-security/check_advanced_settings.js b/cypress/integration/without-security/check_advanced_settings.js index 474a8178441a..9268d86a16e5 100644 --- a/cypress/integration/without-security/check_advanced_settings.js +++ b/cypress/integration/without-security/check_advanced_settings.js @@ -18,13 +18,6 @@ describe('verify the advanced settings are saved', () => { .should('eq', 'true'); }); - it('the Timeline default columns field is set to 4', () => { - cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').should( - 'have.value', - 4 - ); - }); - it('the Timeline Maximum buckets field is set to 4', () => { cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').should( 'have.value', diff --git a/cypress/integration/without-security/helpers/generate_data.js b/cypress/integration/without-security/helpers/generate_data.js index f792a9b304a1..4f2962769c16 100755 --- a/cypress/integration/without-security/helpers/generate_data.js +++ b/cypress/integration/without-security/helpers/generate_data.js @@ -14,9 +14,6 @@ describe('Generating BWC test data without security', () => { it('adds advanced settings', () => { miscUtils.visitPage('app/management/opensearch-dashboards/settings'); cy.get('[data-test-subj="advancedSetting-editField-theme:darkMode"]').click(); - cy.get('[data-test-subj="advancedSetting-editField-timeline:default_columns"]').type( - '{selectAll}4' - ); cy.get('[data-test-subj="advancedSetting-editField-timeline:max_buckets"]').type( '{selectAll}4' ); diff --git a/package.json b/package.json index 0a34972bf9af..57f9c25cdd38 100644 --- a/package.json +++ b/package.json @@ -346,7 +346,6 @@ "angular-mocks": "^1.8.2", "angular-recursion": "^1.0.5", "angular-route": "^1.8.0", - "angular-sortable-view": "^0.0.17", "archiver": "^5.3.0", "axe-core": "^4.0.2", "babel-eslint": "^10.0.3", diff --git a/packages/osd-optimizer/limits.yml b/packages/osd-optimizer/limits.yml index d39f9316c80d..516ebae80abf 100644 --- a/packages/osd-optimizer/limits.yml +++ b/packages/osd-optimizer/limits.yml @@ -74,7 +74,6 @@ pageLoadAssetSize: telemetry: 91832 telemetryManagementSection: 52443 tileMap: 65337 - timeline: 29920 transform: 41151 triggersActionsUi: 170145 uiActions: 95074 diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 2faf70d54e82..7dd8c6561ade 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -421,7 +421,6 @@ export class DocLinksService { visualize: { // https://opensearch.org/docs/latest/dashboards/visualize/viz-index/ guide: `${OPENSEARCH_WEBSITE_DOCS}visualize/viz-index/`, - timelineDeprecation: `${OPENSEARCH_WEBSITE_DOCS}`, }, }, noDocumentation: { @@ -571,7 +570,6 @@ export class DocLinksService { reIndex: { rethrottle: `${OPENSEARCH_WEBSITE_DOCS}`, }, - timelineDeprecation: `${OPENSEARCH_WEBSITE_DOCS}`, apmServer: `${OPENSEARCH_WEBSITE_DOCS}`, tutorial: { loadDataTutorial: `${OPENSEARCH_WEBSITE_DOCS}`, @@ -919,7 +917,6 @@ export interface DocLinksStart { readonly reIndex: { readonly rethrottle: string; }; - readonly timelineDeprecation: string; readonly apmServer: string; readonly tutorial: { readonly loadDataTutorial: string; diff --git a/src/dev/build/tasks/os_packages/docker_generator/resources/bin/opensearch-dashboards-docker b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/opensearch-dashboards-docker index de9ec4e4b5de..124a5e074842 100755 --- a/src/dev/build/tasks/os_packages/docker_generator/resources/bin/opensearch-dashboards-docker +++ b/src/dev/build/tasks/os_packages/docker_generator/resources/bin/opensearch-dashboards-docker @@ -135,7 +135,6 @@ opensearch_dashboards_vars=( tilemap.options.minZoom tilemap.options.subdomains tilemap.url - timeline.enabled vega.enableExternalUrls apm_oss.apmAgentConfigurationIndex apm_oss.indexPattern diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/application_usage/schema.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/application_usage/schema.ts index 2c221aa6a0b5..2e0a76c56cd0 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/application_usage/schema.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/application_usage/schema.ts @@ -69,6 +69,5 @@ export const applicationUsageSchema = { opensearch_dashboards: commonSchema, // It's a forward app so we'll likely never report it management: commonSchema, short_url_redirect: commonSchema, // It's a forward app so we'll likely never report it - timelion: commonSchema, visualize: commonSchema, }; diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts index 8127664c02cd..72d8aa4d78e7 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/management/schema.ts @@ -47,11 +47,8 @@ export const stackManagementSchema: MakeSchemaFrom = { 'timelion:max_buckets': { type: 'long' }, 'timelion:es.timefield': { type: 'keyword' }, 'timelion:min_interval': { type: 'keyword' }, - 'timelion:default_rows': { type: 'long' }, - 'timelion:default_columns': { type: 'long' }, 'timelion:quandl.key': { type: 'keyword' }, 'timelion:es.default_index': { type: 'keyword' }, - 'timelion:showTutorial': { type: 'boolean' }, 'securitySolution:timeDefaults': { type: 'keyword' }, 'securitySolution:defaultAnomalyScore': { type: 'long' }, 'securitySolution:defaultIndex': { type: 'keyword' }, // it's an array diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.test.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.test.ts index cdfb918a1618..12b8d978fcbe 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.test.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.test.ts @@ -41,7 +41,6 @@ describe('getSavedObjectsCounts', () => { search: { total: 0 }, index_pattern: { total: 0 }, graph_workspace: { total: 0 }, - timelion_sheet: { total: 0 }, }); }); @@ -51,7 +50,6 @@ describe('getSavedObjectsCounts', () => { types: { buckets: [ { key: 'dashboard', doc_count: 1 }, - { key: 'timelion-sheet', doc_count: 2 }, { key: 'index-pattern', value: 2 }, // Malformed on purpose { key: 'graph_workspace', doc_count: 3 }, // already snake_cased ], @@ -66,7 +64,6 @@ describe('getSavedObjectsCounts', () => { search: { total: 0 }, index_pattern: { total: 0 }, graph_workspace: { total: 3 }, - timelion_sheet: { total: 2 }, }); }); }); diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.ts index e987af3bfc3c..040257cb7e78 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/get_saved_object_counts.ts @@ -40,14 +40,7 @@ import { snakeCase } from 'lodash'; import { LegacyAPICaller } from 'opensearch-dashboards/server'; -const TYPES = [ - 'dashboard', - 'visualization', - 'search', - 'index-pattern', - 'graph-workspace', - 'timelion-sheet', -]; +const TYPES = ['dashboard', 'visualization', 'search', 'index-pattern', 'graph-workspace']; export interface OpenSearchDashboardsSavedObjectCounts { dashboard: { total: number }; @@ -55,7 +48,6 @@ export interface OpenSearchDashboardsSavedObjectCounts { search: { total: number }; index_pattern: { total: number }; graph_workspace: { total: number }; - timelion_sheet: { total: number }; } export async function getSavedObjectsCounts( diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/index.test.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/index.test.ts index 0e20b1cd8111..105487ee5b08 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/index.test.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/opensearch_dashboards/index.test.ts @@ -64,7 +64,6 @@ describe('telemetry_opensearch_dashboards', () => { search: { total: 0 }, index_pattern: { total: 0 }, graph_workspace: { total: 0 }, - timelion_sheet: { total: 0 }, }); }); @@ -76,7 +75,6 @@ describe('telemetry_opensearch_dashboards', () => { search: { total: 0 }, index_pattern: { total: 0 }, graph_workspace: { total: 0 }, - timelion_sheet: { total: 0 }, }; expect(collector.formatForBulkUpload!(resultFromFetch)).toStrictEqual({ diff --git a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/ui_metric/schema.ts b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/ui_metric/schema.ts index e542d08d2056..2c398bc23708 100644 --- a/src/plugins/opensearch_dashboards_usage_collection/server/collectors/ui_metric/schema.ts +++ b/src/plugins/opensearch_dashboards_usage_collection/server/collectors/ui_metric/schema.ts @@ -50,7 +50,6 @@ const uiMetricFromDataPluginSchema: MakeSchemaFrom = { opensearch_dashboards: commonSchema, // It's a forward app so we'll likely never report it management: commonSchema, short_url_redirect: commonSchema, // It's a forward app so we'll likely never report it - timelion: commonSchema, visualize: commonSchema, }; diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index b1e09dda9794..f8dc8b7b8ae9 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -252,34 +252,6 @@ } } }, - "timeline": { - "properties": { - "clicks_total": { - "type": "long" - }, - "clicks_7_days": { - "type": "long" - }, - "clicks_30_days": { - "type": "long" - }, - "clicks_90_days": { - "type": "long" - }, - "minutes_on_screen_total": { - "type": "float" - }, - "minutes_on_screen_7_days": { - "type": "float" - }, - "minutes_on_screen_30_days": { - "type": "float" - }, - "minutes_on_screen_90_days": { - "type": "float" - } - } - }, "visualize": { "properties": { "clicks_total": { @@ -1342,13 +1314,6 @@ "type": "long" } } - }, - "timeline_sheet": { - "properties": { - "total": { - "type": "long" - } - } } } }, @@ -1393,21 +1358,12 @@ "timeline:min_interval": { "type": "keyword" }, - "timeline:default_rows": { - "type": "long" - }, - "timeline:default_columns": { - "type": "long" - }, "timeline:quandl.key": { "type": "keyword" }, "timeline:es.default_index": { "type": "keyword" }, - "timeline:showTutorial": { - "type": "boolean" - }, "securitySolution:timeDefaults": { "type": "keyword" }, @@ -1937,19 +1893,6 @@ } } }, - "timeline": { - "type": "array", - "items": { - "properties": { - "key": { - "type": "keyword" - }, - "value": { - "type": "long" - } - } - } - }, "csm": { "type": "array", "items": { diff --git a/src/plugins/timeline/README.md b/src/plugins/timeline/README.md deleted file mode 100644 index 22ed15ebf5c6..000000000000 --- a/src/plugins/timeline/README.md +++ /dev/null @@ -1,2 +0,0 @@ -Contains the deprecated timeline application. For the timeline visualization, -which also contains the timeline APIs and backend, look at the vis_type_timeline plugin. diff --git a/src/plugins/timeline/opensearch_dashboards.json b/src/plugins/timeline/opensearch_dashboards.json deleted file mode 100644 index 73cfbd3ee086..000000000000 --- a/src/plugins/timeline/opensearch_dashboards.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "id": "timeline", - "version": "opensearchDashboards", - "ui": true, - "server": true, - "requiredBundles": [ - "opensearchDashboardsLegacy", - "opensearchDashboardsUtils", - "savedObjects", - "visTypeTimeline" - ], - "requiredPlugins": [ - "visualizations", - "data", - "navigation", - "visTypeTimeline", - "opensearchDashboardsLegacy" - ] -} diff --git a/src/plugins/timeline/public/_app.scss b/src/plugins/timeline/public/_app.scss deleted file mode 100644 index 8b9078caba5a..000000000000 --- a/src/plugins/timeline/public/_app.scss +++ /dev/null @@ -1,21 +0,0 @@ -.timApp { - position: relative; - background: $euiColorEmptyShade; - - [ng-click] { - cursor: pointer; - } -} - -.timApp__container { - margin: $euiSizeM; -} - -.timApp__menus { - margin: $euiSizeM; -} - -.timApp__stats { - font-weight: $euiFontWeightRegular; - color: $euiColorMediumShade; -} diff --git a/src/plugins/timeline/public/_base.scss b/src/plugins/timeline/public/_base.scss deleted file mode 100644 index 4e64d237271a..000000000000 --- a/src/plugins/timeline/public/_base.scss +++ /dev/null @@ -1,18 +0,0 @@ -// Angular form states -.ng-invalid { - &.ng-dirty, - &.ng-touched { - border-color: $euiColorDanger; - } -} - -input[type="radio"], -input[type="checkbox"], -.radio, -.checkbox { - &[disabled], - fieldset[disabled] & { - cursor: default; - opacity: 0.8; - } -} diff --git a/src/plugins/timeline/public/app.js b/src/plugins/timeline/public/app.js deleted file mode 100644 index d0e940b9dded..000000000000 --- a/src/plugins/timeline/public/app.js +++ /dev/null @@ -1,678 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; - -import { i18n } from '@osd/i18n'; - -import { createHashHistory } from 'history'; - -import { - createOsdUrlStateStorage, - withNotifyOnErrors, -} from '../../opensearch_dashboards_utils/public'; -import { syncQueryStateWithUrl } from '../../data/public'; - -import { getSavedSheetBreadcrumbs, getCreateBreadcrumbs } from './breadcrumbs'; -import { - addFatalError, - registerListenEventListener, - watchMultiDecorator, -} from '../../opensearch_dashboards_legacy/public'; -import { getTimezone } from '../../vis_type_timeline/public'; -import { initCellsDirective } from './directives/cells/cells'; -import { initFullscreenDirective } from './directives/fullscreen/fullscreen'; -import { initFixedElementDirective } from './directives/fixed_element'; -import { initTimelineLoadSheetDirective } from './directives/timeline_load_sheet'; -import { initTimelineHelpDirective } from './directives/timeline_help/timeline_help'; -import { initTimelineSaveSheetDirective } from './directives/timeline_save_sheet'; -import { initTimelineOptionsSheetDirective } from './directives/timeline_options_sheet'; -import { initSavedObjectSaveAsCheckBoxDirective } from './directives/saved_object_save_as_checkbox'; -import { initSavedObjectFinderDirective } from './directives/saved_object_finder'; -import { initTimelineTabsDirective } from './components/timelinehelp_tabs_directive'; -import { initTimelineTDeprecationDirective } from './components/timeline_deprecation_directive'; -import { initInputFocusDirective } from './directives/input_focus'; -import { Chart } from './directives/chart/chart'; -import { TimelineInterval } from './directives/timeline_interval/timeline_interval'; -import { timelineExpInput } from './directives/timeline_expression_input'; -import { TimelineExpressionSuggestions } from './directives/timeline_expression_suggestions/timeline_expression_suggestions'; -import { initSavedSheetService } from './services/saved_sheets'; -import { initTimelineAppState } from './timeline_app_state'; - -import rootTemplate from './index.html'; - -export function initTimelineApp(app, deps) { - app.run(registerListenEventListener); - - const savedSheetLoader = initSavedSheetService(app, deps); - - app.factory('history', () => createHashHistory()); - app.factory('osdUrlStateStorage', (history) => - createOsdUrlStateStorage({ - history, - useHash: deps.core.uiSettings.get('state:storeInSessionStorage'), - ...withNotifyOnErrors(deps.core.notifications.toasts), - }) - ); - app.config(watchMultiDecorator); - - app - .controller('TimelineVisController', function ($scope) { - $scope.$on('timelineChartRendered', (event) => { - event.stopPropagation(); - $scope.renderComplete(); - }); - }) - .constant('timelinePanels', deps.timelinePanels) - .directive('chart', Chart) - .directive('timelineInterval', TimelineInterval) - .directive('timelineExpressionSuggestions', TimelineExpressionSuggestions) - .directive('timelineExpressionInput', timelineExpInput(deps)); - - initTimelineHelpDirective(app); - initInputFocusDirective(app); - initTimelineTabsDirective(app, deps); - initTimelineTDeprecationDirective(app, deps); - initSavedObjectFinderDirective(app, savedSheetLoader, deps.core.uiSettings); - initSavedObjectSaveAsCheckBoxDirective(app); - initCellsDirective(app); - initFixedElementDirective(app); - initFullscreenDirective(app); - initTimelineSaveSheetDirective(app); - initTimelineLoadSheetDirective(app); - initTimelineOptionsSheetDirective(app); - - const location = 'Timeline'; - - app.directive('timelineApp', function () { - return { - restrict: 'E', - controllerAs: 'timelineApp', - controller: timelineController, - }; - }); - - function timelineController( - $http, - $route, - $routeParams, - $scope, - $timeout, - history, - osdUrlStateStorage - ) { - // Keeping this at app scope allows us to keep the current page when the user - // switches to say, the timepicker. - $scope.page = deps.core.uiSettings.get('timeline:showTutorial', true) ? 1 : 0; - $scope.setPage = (page) => ($scope.page = page); - const timefilter = deps.plugins.data.query.timefilter.timefilter; - - timefilter.enableAutoRefreshSelector(); - timefilter.enableTimeRangeSelector(); - - deps.core.chrome.docTitle.change('Timeline - OpenSearch Dashboards'); - - // starts syncing `_g` portion of url with query services - const { stop: stopSyncingQueryServiceStateWithUrl } = syncQueryStateWithUrl( - deps.plugins.data.query, - osdUrlStateStorage - ); - - const savedSheet = $route.current.locals.savedSheet; - - function getStateDefaults() { - return { - sheet: savedSheet.timelion_sheet, - selected: 0, - columns: savedSheet.timelion_columns, - rows: savedSheet.timelion_rows, - interval: savedSheet.timelion_interval, - }; - } - - const { stateContainer, stopStateSync } = initTimelineAppState({ - stateDefaults: getStateDefaults(), - osdUrlStateStorage, - }); - - $scope.state = _.cloneDeep(stateContainer.getState()); - $scope.expression = _.clone($scope.state.sheet[$scope.state.selected]); - $scope.updatedSheets = []; - - const savedVisualizations = deps.plugins.visualizations.savedVisualizationsLoader; - const timezone = getTimezone(deps.core.uiSettings); - - const defaultExpression = '.opensearch(*)'; - - $scope.topNavMenu = getTopNavMenu(); - - $timeout(function () { - if (deps.core.uiSettings.get('timeline:showTutorial', true)) { - $scope.toggleMenu('showHelp'); - } - }, 0); - - $scope.transient = {}; - - function getTopNavMenu() { - const newSheetAction = { - id: 'new', - label: i18n.translate('timeline.topNavMenu.newSheetButtonLabel', { - defaultMessage: 'New', - }), - description: i18n.translate('timeline.topNavMenu.newSheetButtonAriaLabel', { - defaultMessage: 'New Sheet', - }), - run: function () { - history.push('/'); - $route.reload(); - }, - testId: 'timelineNewButton', - }; - - const addSheetAction = { - id: 'add', - label: i18n.translate('timeline.topNavMenu.addChartButtonLabel', { - defaultMessage: 'Add', - }), - description: i18n.translate('timeline.topNavMenu.addChartButtonAriaLabel', { - defaultMessage: 'Add a chart', - }), - run: function () { - $scope.$evalAsync(() => $scope.newCell()); - }, - testId: 'timelineAddChartButton', - }; - - const saveSheetAction = { - id: 'save', - label: i18n.translate('timeline.topNavMenu.saveSheetButtonLabel', { - defaultMessage: 'Save', - }), - description: i18n.translate('timeline.topNavMenu.saveSheetButtonAriaLabel', { - defaultMessage: 'Save Sheet', - }), - run: () => { - $scope.$evalAsync(() => $scope.toggleMenu('showSave')); - }, - testId: 'timelineSaveButton', - }; - - const deleteSheetAction = { - id: 'delete', - label: i18n.translate('timeline.topNavMenu.deleteSheetButtonLabel', { - defaultMessage: 'Delete', - }), - description: i18n.translate('timeline.topNavMenu.deleteSheetButtonAriaLabel', { - defaultMessage: 'Delete current sheet', - }), - disableButton: function () { - return !savedSheet.id; - }, - run: function () { - const title = savedSheet.title; - function doDelete() { - savedSheet - .delete() - .then(() => { - deps.core.notifications.toasts.addSuccess( - i18n.translate('timeline.topNavMenu.delete.modal.successNotificationText', { - defaultMessage: `Deleted '{title}'`, - values: { title }, - }) - ); - history.push('/'); - }) - .catch((error) => addFatalError(deps.core.fatalErrors, error, location)); - } - - const confirmModalOptions = { - confirmButtonText: i18n.translate( - 'timeline.topNavMenu.delete.modal.confirmButtonLabel', - { - defaultMessage: 'Delete', - } - ), - title: i18n.translate('timeline.topNavMenu.delete.modalTitle', { - defaultMessage: `Delete Timeline sheet '{title}'?`, - values: { title }, - }), - }; - - $scope.$evalAsync(() => { - deps.core.overlays - .openConfirm( - i18n.translate('timeline.topNavMenu.delete.modal.warningText', { - defaultMessage: `You can't recover deleted sheets.`, - }), - confirmModalOptions - ) - .then((isConfirmed) => { - if (isConfirmed) { - doDelete(); - } - }); - }); - }, - testId: 'timelineDeleteButton', - }; - - const openSheetAction = { - id: 'open', - label: i18n.translate('timeline.topNavMenu.openSheetButtonLabel', { - defaultMessage: 'Open', - }), - description: i18n.translate('timeline.topNavMenu.openSheetButtonAriaLabel', { - defaultMessage: 'Open Sheet', - }), - run: () => { - $scope.$evalAsync(() => $scope.toggleMenu('showLoad')); - }, - testId: 'timelineOpenButton', - }; - - const optionsAction = { - id: 'options', - label: i18n.translate('timeline.topNavMenu.optionsButtonLabel', { - defaultMessage: 'Options', - }), - description: i18n.translate('timeline.topNavMenu.optionsButtonAriaLabel', { - defaultMessage: 'Options', - }), - run: () => { - $scope.$evalAsync(() => $scope.toggleMenu('showOptions')); - }, - testId: 'timelineOptionsButton', - }; - - const helpAction = { - id: 'help', - label: i18n.translate('timeline.topNavMenu.helpButtonLabel', { - defaultMessage: 'Help', - }), - description: i18n.translate('timeline.topNavMenu.helpButtonAriaLabel', { - defaultMessage: 'Help', - }), - run: () => { - $scope.$evalAsync(() => $scope.toggleMenu('showHelp')); - }, - testId: 'timelineDocsButton', - }; - - if (deps.core.application.capabilities.timelion.save) { - return [ - newSheetAction, - addSheetAction, - saveSheetAction, - deleteSheetAction, - openSheetAction, - optionsAction, - helpAction, - ]; - } - return [newSheetAction, addSheetAction, openSheetAction, optionsAction, helpAction]; - } - - let refresher; - const setRefreshData = function () { - if (refresher) $timeout.cancel(refresher); - const interval = timefilter.getRefreshInterval(); - if (interval.value > 0 && !interval.pause) { - function startRefresh() { - refresher = $timeout(function () { - if (!$scope.running) $scope.search(); - startRefresh(); - }, interval.value); - } - startRefresh(); - } - }; - - const init = function () { - $scope.running = false; - $scope.search(); - setRefreshData(); - - $scope.model = { - timeRange: timefilter.getTime(), - refreshInterval: timefilter.getRefreshInterval(), - }; - - const unsubscribeStateUpdates = stateContainer.subscribe((state) => { - const clonedState = _.cloneDeep(state); - $scope.updatedSheets.forEach((updatedSheet) => { - clonedState.sheet[updatedSheet.id] = updatedSheet.expression; - }); - $scope.state = clonedState; - $scope.opts.state = clonedState; - $scope.expression = _.clone($scope.state.sheet[$scope.state.selected]); - $scope.search(); - }); - - timefilter.getFetch$().subscribe($scope.search); - - $scope.opts = { - saveExpression: saveExpression, - saveSheet: saveSheet, - savedSheet: savedSheet, - state: _.cloneDeep(stateContainer.getState()), - search: $scope.search, - dontShowHelp: function () { - deps.core.uiSettings.set('timeline:showTutorial', false); - $scope.setPage(0); - $scope.closeMenus(); - }, - }; - - $scope.$watch('opts.state.rows', function (newRow) { - const state = stateContainer.getState(); - if (state.rows !== newRow) { - stateContainer.transitions.set('rows', newRow); - } - }); - - $scope.$watch('opts.state.columns', function (newColumn) { - const state = stateContainer.getState(); - if (state.columns !== newColumn) { - stateContainer.transitions.set('columns', newColumn); - } - }); - - $scope.menus = { - showHelp: false, - showSave: false, - showLoad: false, - showOptions: false, - }; - - $scope.toggleMenu = (menuName) => { - const curState = $scope.menus[menuName]; - $scope.closeMenus(); - $scope.menus[menuName] = !curState; - }; - - $scope.closeMenus = () => { - _.forOwn($scope.menus, function (value, key) { - $scope.menus[key] = false; - }); - }; - - $scope.$on('$destroy', () => { - stopSyncingQueryServiceStateWithUrl(); - unsubscribeStateUpdates(); - stopStateSync(); - }); - }; - - $scope.onTimeUpdate = function ({ dateRange }) { - $scope.model.timeRange = { - ...dateRange, - }; - timefilter.setTime(dateRange); - if (!$scope.running) $scope.search(); - }; - - $scope.onRefreshChange = function ({ isPaused, refreshInterval }) { - $scope.model.refreshInterval = { - pause: isPaused, - value: refreshInterval, - }; - timefilter.setRefreshInterval({ - pause: isPaused, - value: refreshInterval ? refreshInterval : $scope.refreshInterval.value, - }); - - setRefreshData(); - }; - - $scope.$watch( - function () { - return savedSheet.lastSavedTitle; - }, - function (newTitle) { - if (savedSheet.id && newTitle) { - deps.core.chrome.docTitle.change(newTitle); - } - } - ); - - $scope.$watch('expression', function (newExpression) { - const state = stateContainer.getState(); - if (state.sheet[state.selected] !== newExpression) { - const updatedSheet = $scope.updatedSheets.find( - (updatedSheet) => updatedSheet.id === state.selected - ); - if (updatedSheet) { - updatedSheet.expression = newExpression; - } else { - $scope.updatedSheets.push({ - id: state.selected, - expression: newExpression, - }); - } - } - }); - - $scope.toggle = function (property) { - $scope[property] = !$scope[property]; - }; - - $scope.changeInterval = function (interval) { - $scope.currentInterval = interval; - }; - - $scope.updateChart = function () { - const state = stateContainer.getState(); - const newSheet = _.clone(state.sheet); - if ($scope.updatedSheets.length) { - $scope.updatedSheets.forEach((updatedSheet) => { - newSheet[updatedSheet.id] = updatedSheet.expression; - }); - $scope.updatedSheets = []; - } - stateContainer.transitions.updateState({ - interval: $scope.currentInterval ? $scope.currentInterval : state.interval, - sheet: newSheet, - }); - }; - - $scope.newSheet = function () { - history.push('/'); - }; - - $scope.removeSheet = function (removedIndex) { - const state = stateContainer.getState(); - const newSheet = state.sheet.filter((el, index) => index !== removedIndex); - $scope.updatedSheets = $scope.updatedSheets.filter((el) => el.id !== removedIndex); - stateContainer.transitions.updateState({ - sheet: newSheet, - selected: removedIndex ? removedIndex - 1 : removedIndex, - }); - }; - - $scope.newCell = function () { - const state = stateContainer.getState(); - const newSheet = [...state.sheet, defaultExpression]; - stateContainer.transitions.updateState({ sheet: newSheet, selected: newSheet.length - 1 }); - }; - - $scope.setActiveCell = function (cell) { - const state = stateContainer.getState(); - if (state.selected !== cell) { - stateContainer.transitions.updateState({ sheet: $scope.state.sheet, selected: cell }); - } - }; - - $scope.search = function () { - $scope.running = true; - const state = stateContainer.getState(); - - // parse the time range client side to make sure it behaves like other charts - const timeRangeBounds = timefilter.getBounds(); - - const httpResult = $http - .post('../api/timeline/run', { - sheet: state.sheet, - time: _.assignIn( - { - from: timeRangeBounds.min, - to: timeRangeBounds.max, - }, - { - interval: state.interval, - timezone: timezone, - } - ), - }) - .then((resp) => resp.data) - .catch((resp) => { - throw resp.data; - }); - - httpResult - .then(function (resp) { - $scope.stats = resp.stats; - $scope.sheet = resp.sheet; - _.forEach(resp.sheet, function (cell) { - if (cell.exception && cell.plot !== state.selected) { - stateContainer.transitions.set('selected', cell.plot); - } - }); - $scope.running = false; - }) - .catch(function (resp) { - $scope.sheet = []; - $scope.running = false; - - const err = new Error(resp.message); - err.stack = resp.stack; - deps.core.notifications.toasts.addError(err, { - title: i18n.translate('timeline.searchErrorTitle', { - defaultMessage: 'Timeline request error', - }), - }); - }); - }; - - $scope.safeSearch = _.debounce($scope.search, 500); - - function saveSheet() { - const state = stateContainer.getState(); - savedSheet.timeline_sheet = state.sheet; - savedSheet.timeline_interval = state.interval; - savedSheet.timeline_columns = state.columns; - savedSheet.timeline_rows = state.rows; - savedSheet.save().then(function (id) { - if (id) { - deps.core.notifications.toasts.addSuccess({ - title: i18n.translate('timeline.saveSheet.successNotificationText', { - defaultMessage: `Saved sheet '{title}'`, - values: { title: savedSheet.title }, - }), - 'data-test-subj': 'timelineSaveSuccessToast', - }); - - if (savedSheet.id !== $routeParams.id) { - history.push(`/${savedSheet.id}`); - } - } - }); - } - - async function saveExpression(title) { - const vis = await deps.plugins.visualizations.createVis('timelion', { - title, - params: { - expression: $scope.state.sheet[$scope.state.selected], - interval: $scope.state.interval, - }, - }); - const state = deps.plugins.visualizations.convertFromSerializedVis(vis.serialize()); - const visSavedObject = await savedVisualizations.get(); - Object.assign(visSavedObject, state); - const id = await visSavedObject.save(); - if (id) { - deps.core.notifications.toasts.addSuccess( - i18n.translate('timeline.saveExpression.successNotificationText', { - defaultMessage: `Saved expression '{title}'`, - values: { title: state.title }, - }) - ); - } - } - - init(); - } - - app.config(function ($routeProvider) { - $routeProvider - .when('/:id?', { - template: rootTemplate, - reloadOnSearch: false, - k7Breadcrumbs: ($injector, $route) => - $injector.invoke( - $route.current.params.id ? getSavedSheetBreadcrumbs : getCreateBreadcrumbs - ), - badge: () => { - if (deps.core.application.capabilities.timelion.save) { - return undefined; - } - - return { - text: i18n.translate('timeline.badge.readOnly.text', { - defaultMessage: 'Read only', - }), - tooltip: i18n.translate('timeline.badge.readOnly.tooltip', { - defaultMessage: 'Unable to save Timeline sheets', - }), - iconType: 'glasses', - }; - }, - resolve: { - savedSheet: function (savedSheets, $route) { - return savedSheets - .get($route.current.params.id) - .then((savedSheet) => { - if ($route.current.params.id) { - deps.core.chrome.recentlyAccessed.add( - savedSheet.getFullPath(), - savedSheet.title, - savedSheet.id - ); - } - return savedSheet; - }) - .catch(); - }, - }, - }) - .otherwise('/'); - }); -} diff --git a/src/plugins/timeline/public/application.ts b/src/plugins/timeline/public/application.ts deleted file mode 100644 index 5eb5d2fcb31c..000000000000 --- a/src/plugins/timeline/public/application.ts +++ /dev/null @@ -1,164 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import './index.scss'; - -import { EuiIcon } from '@elastic/eui'; -import angular, { IModule } from 'angular'; -// required for `ngSanitize` angular module -import 'angular-sanitize'; -// required for ngRoute -import 'angular-route'; -import 'angular-sortable-view'; -import { i18nDirective, i18nFilter, I18nProvider } from '@osd/i18n/angular'; -import { - IUiSettingsClient, - CoreStart, - PluginInitializerContext, - AppMountParameters, -} from 'opensearch-dashboards/public'; -import { getTimeChart } from './panels/timechart/timechart'; -import { Panel } from './panels/panel'; - -import { - configureAppAngularModule, - createTopNavDirective, - createTopNavHelper, -} from '../../opensearch_dashboards_legacy/public'; -import { TimelinePluginDependencies } from './plugin'; -import { DataPublicPluginStart } from '../../data/public'; -// @ts-ignore -import { initTimelineApp } from './app'; - -export interface RenderDeps { - pluginInitializerContext: PluginInitializerContext; - mountParams: AppMountParameters; - core: CoreStart; - plugins: TimelinePluginDependencies; - timelinePanels: Map; -} - -export interface TimelineVisualizationDependencies { - uiSettings: IUiSettingsClient; - timelinePanels: Map; - data: DataPublicPluginStart; - $rootScope: any; - $compile: any; -} - -let angularModuleInstance: IModule | null = null; - -export const renderApp = (deps: RenderDeps) => { - if (!angularModuleInstance) { - angularModuleInstance = createLocalAngularModule(deps); - // global routing stuff - configureAppAngularModule( - angularModuleInstance, - { core: deps.core, env: deps.pluginInitializerContext.env }, - true - ); - initTimelineApp(angularModuleInstance, deps); - } - - const $injector = mountTimelineApp(deps.mountParams.appBasePath, deps.mountParams.element, deps); - - return () => { - $injector.get('$rootScope').$destroy(); - }; -}; - -function registerPanels(dependencies: TimelineVisualizationDependencies) { - const timeChartPanel: Panel = getTimeChart(dependencies); - - dependencies.timelinePanels.set(timeChartPanel.name, timeChartPanel); -} - -const mainTemplate = (basePath: string) => `
- -
`; - -const moduleName = 'app/timeline'; - -const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react', 'angular-sortable-view']; - -function mountTimelineApp(appBasePath: string, element: HTMLElement, deps: RenderDeps) { - const mountpoint = document.createElement('div'); - mountpoint.setAttribute('class', 'timelineAppContainer'); - // eslint-disable-next-line no-unsanitized/property - mountpoint.innerHTML = mainTemplate(appBasePath); - // bootstrap angular into detached element and attach it later to - // make angular-within-angular possible - const $injector = angular.bootstrap(mountpoint, [moduleName]); - - registerPanels({ - uiSettings: deps.core.uiSettings, - timelinePanels: deps.timelinePanels, - data: deps.plugins.data, - $rootScope: $injector.get('$rootScope'), - $compile: $injector.get('$compile'), - }); - element.appendChild(mountpoint); - return $injector; -} - -function createLocalAngularModule(deps: RenderDeps) { - createLocalI18nModule(); - createLocalIconModule(); - createLocalTopNavModule(deps.plugins.navigation); - - const dashboardAngularModule = angular.module(moduleName, [ - ...thirdPartyAngularDependencies, - 'app/timeline/TopNav', - 'app/timeline/I18n', - 'app/timeline/icon', - ]); - return dashboardAngularModule; -} - -function createLocalIconModule() { - angular - .module('app/timeline/icon', ['react']) - .directive('icon', (reactDirective) => reactDirective(EuiIcon)); -} - -function createLocalTopNavModule(navigation: TimelinePluginDependencies['navigation']) { - angular - .module('app/timeline/TopNav', ['react']) - .directive('osdTopNav', createTopNavDirective) - .directive('osdTopNavHelper', createTopNavHelper(navigation.ui)); -} - -function createLocalI18nModule() { - angular - .module('app/timeline/I18n', []) - .provider('i18n', I18nProvider) - .filter('i18n', i18nFilter) - .directive('i18nId', i18nDirective); -} diff --git a/src/plugins/timeline/public/breadcrumbs.js b/src/plugins/timeline/public/breadcrumbs.js deleted file mode 100644 index dfee1407cef3..000000000000 --- a/src/plugins/timeline/public/breadcrumbs.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { i18n } from '@osd/i18n'; - -const ROOT_BREADCRUMB = { - text: i18n.translate('timeline.breadcrumbs.root', { - defaultMessage: 'Timeline', - }), - href: '#', -}; - -export function getCreateBreadcrumbs() { - return [ - ROOT_BREADCRUMB, - { - text: i18n.translate('timeline.breadcrumbs.create', { - defaultMessage: 'Create', - }), - }, - ]; -} - -export function getSavedSheetBreadcrumbs($route) { - const { savedSheet } = $route.current.locals; - return [ - ROOT_BREADCRUMB, - { - text: savedSheet.title, - }, - ]; -} diff --git a/src/plugins/timeline/public/components/timeline_deprecation.tsx b/src/plugins/timeline/public/components/timeline_deprecation.tsx deleted file mode 100644 index e97e325b22f8..000000000000 --- a/src/plugins/timeline/public/components/timeline_deprecation.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { FormattedMessage } from '@osd/i18n/react'; -import { EuiSpacer, EuiCallOut, EuiLink } from '@elastic/eui'; -import React from 'react'; -import { DocLinksStart } from '../../../../core/public'; - -export const TimelineDeprecation = ({ links }: DocLinksStart) => { - const timelineDeprecationLink = links.opensearchDashboards.visualize.timelineDeprecation; - return ( - <> - - - - ), - }} - /> - } - color="warning" - iconType="alert" - size="s" - /> - - - ); -}; diff --git a/src/plugins/timeline/public/components/timeline_deprecation_directive.js b/src/plugins/timeline/public/components/timeline_deprecation_directive.js deleted file mode 100644 index d45800db24b5..000000000000 --- a/src/plugins/timeline/public/components/timeline_deprecation_directive.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React from 'react'; -import { TimelineDeprecation } from './timeline_deprecation'; - -export function initTimelineTDeprecationDirective(app, deps) { - app.directive('timelineDeprecation', function (reactDirective) { - return reactDirective( - () => { - return ( - - - - ); - }, - [], - { - restrict: 'E', - scope: { - docLinks: '=', - }, - } - ); - }); -} diff --git a/src/plugins/timeline/public/components/timelinehelp_tabs.js b/src/plugins/timeline/public/components/timelinehelp_tabs.js deleted file mode 100644 index 1680b4de7ebc..000000000000 --- a/src/plugins/timeline/public/components/timelinehelp_tabs.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import PropTypes from 'prop-types'; -import React from 'react'; - -import { EuiTabs, EuiTab } from '@elastic/eui'; - -import { FormattedMessage } from '@osd/i18n/react'; - -function handleClick(activateTab, tabName) { - activateTab(tabName); -} - -export function TimelineHelpTabs(props) { - return ( - - handleClick(props.activateTab, 'funcref')} - > - - - handleClick(props.activateTab, 'keyboardtips')} - > - - - - ); -} - -TimelineHelpTabs.propTypes = { - activeTab: PropTypes.string, - activateTab: PropTypes.func, -}; diff --git a/src/plugins/timeline/public/components/timelinehelp_tabs_directive.js b/src/plugins/timeline/public/components/timelinehelp_tabs_directive.js deleted file mode 100644 index 772580e71bf6..000000000000 --- a/src/plugins/timeline/public/components/timelinehelp_tabs_directive.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import React from 'react'; -import { TimelineHelpTabs } from './timelinehelp_tabs'; - -export function initTimelineTabsDirective(app, deps) { - app.directive('timelineHelpTabs', function (reactDirective) { - return reactDirective( - (props) => { - return ( - - - - ); - }, - [['activeTab'], ['activateTab', { watchDepth: 'reference' }]], - { - restrict: 'E', - scope: { - activeTab: '=', - activateTab: '=', - }, - } - ); - }); -} diff --git a/src/plugins/timeline/public/directives/_form.scss b/src/plugins/timeline/public/directives/_form.scss deleted file mode 100644 index 2b946ec94791..000000000000 --- a/src/plugins/timeline/public/directives/_form.scss +++ /dev/null @@ -1,36 +0,0 @@ -.form-control { - @include euiFontSizeS; - - display: block; - width: 100%; - height: $euiFormControlCompressedHeight; - padding: $euiSizeXS $euiSizeM; - border: $euiBorderThin; - background-color: $euiFormBackgroundColor; - color: $euiTextColor; - border-radius: $euiBorderRadius; - cursor: pointer; - - &:not([type="range"]) { - appearance: none; - } - - &:focus { - border-color: $euiColorPrimary; - outline: none; - box-shadow: none; - } -} - -select.form-control { - // Makes the select arrow similar to EUI's arrowDown icon - background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"%3E%3Cpath fill="#{hexToRGB($euiTextColor)}" d="M13.0688508,5.15725038 L8.38423975,9.76827428 C8.17054415,9.97861308 7.82999214,9.97914095 7.61576025,9.76827428 L2.93114915,5.15725038 C2.7181359,4.94758321 2.37277319,4.94758321 2.15975994,5.15725038 C1.94674669,5.36691756 1.94674669,5.70685522 2.15975994,5.9165224 L6.84437104,10.5275463 C7.48517424,11.1582836 8.51644979,11.1566851 9.15562896,10.5275463 L13.8402401,5.9165224 C14.0532533,5.70685522 14.0532533,5.36691756 13.8402401,5.15725038 C13.6272268,4.94758321 13.2818641,4.94758321 13.0688508,5.15725038 Z"/%3E%3C/svg%3E'); - background-size: $euiSize; - background-repeat: no-repeat; - background-position: calc(100% - #{$euiSizeS}); - padding-right: $euiSizeXL; -} - -.fullWidth { - width: 100%; -} diff --git a/src/plugins/timeline/public/directives/_index.scss b/src/plugins/timeline/public/directives/_index.scss deleted file mode 100644 index 94f0b2286101..000000000000 --- a/src/plugins/timeline/public/directives/_index.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "./timeline_expression_input"; -@import "./cells/index"; -@import "./timeline_expression_suggestions/index"; -@import "./timeline_help/index"; -@import "./timeline_interval/index"; -@import "./saved_object_finder"; -@import "./form"; diff --git a/src/plugins/timeline/public/directives/_saved_object_finder.scss b/src/plugins/timeline/public/directives/_saved_object_finder.scss deleted file mode 100644 index a225f357949e..000000000000 --- a/src/plugins/timeline/public/directives/_saved_object_finder.scss +++ /dev/null @@ -1,95 +0,0 @@ -.list-group-menu { - &.select-mode a { - outline: none; - color: tintOrShade($euiColorPrimary, 10%, 10%); - } - - .list-group-menu-item { - list-style: none; - color: tintOrShade($euiColorPrimary, 10%, 10%); - - &.active { - font-weight: bold; - background-color: $euiColorLightShade; - } - - &:hover { - background-color: tintOrShade($euiColorPrimary, 90%, 90%); - } - - li { - list-style: none; - color: tintOrShade($euiColorPrimary, 10%, 10%); - } - } -} - -saved-object-finder { - .list-sort-button { - border-top-left-radius: 0; - border-top-right-radius: 0; - border: none; - padding: $euiSizeS $euiSize; - font-weight: $euiFontWeightRegular; - background-color: $euiColorLightestShade; - } - - .li-striped { - li { - border: none; - } - - li:nth-child(even) { - background-color: $euiColorLightestShade; - } - - li:nth-child(odd) { - background-color: $euiColorEmptyShade; - } - - .paginate-heading { - font-weight: $euiFontWeightRegular; - color: $euiColorDarkestShade; - } - - .list-group-item { - padding: $euiSizeS $euiSize; - - ul { - padding: 0; - display: flex; - flex-direction: row; - - .finder-type { - margin-right: $euiSizeS; - } - } - - a { - display: block; - color: $euiColorPrimary; - - i { - color: shade($euiColorPrimary, 10%); - margin-right: $euiSizeS; - } - } - - &:first-child { - border-top-left-radius: 0; - border-top-right-radius: 0; - } - - &.list-group-no-results p { - margin-bottom: 0; - } - } - } - - /* stylelint-disable-next-line selector-type-no-unknown */ - paginate { - paginate-controls { - margin: $euiSize; - } - } -} diff --git a/src/plugins/timeline/public/directives/_timeline_expression_input.scss b/src/plugins/timeline/public/directives/_timeline_expression_input.scss deleted file mode 100644 index e4294d8454c7..000000000000 --- a/src/plugins/timeline/public/directives/_timeline_expression_input.scss +++ /dev/null @@ -1,15 +0,0 @@ -/** - * 1. Anchor suggestions beneath input. - * 2. Allow for option of positioning suggestions absolutely. - */ - -.timExpressionInput__container { - flex: 1 1 auto; - display: flex; - flex-direction: column; /* 1 */ - position: relative; /* 2 */ -} - -.timExpressionInput { - min-height: 70px; // Matches buttons on the right with new vertical rhythm sizing -} diff --git a/src/plugins/timeline/public/directives/cells/_cells.scss b/src/plugins/timeline/public/directives/cells/_cells.scss deleted file mode 100644 index 61634a710260..000000000000 --- a/src/plugins/timeline/public/directives/cells/_cells.scss +++ /dev/null @@ -1,62 +0,0 @@ -.timCell { - display: inline-block; - cursor: pointer; - position: relative; - box-sizing: border-box; - border: 2px dashed transparent; - padding-left: 0 !important; - padding-right: 0 !important; - margin-bottom: $euiSizeM; - - &.active { - border-color: $euiColorLightShade; - } -} - -.timCell.running { - opacity: 0.5; -} - -.timCell__actions { - position: absolute; - bottom: $euiSizeXS; - left: $euiSizeXS; - - > .timCell__action, - > .timCell__id { - @include euiFontSizeXS; - - font-weight: $euiFontWeightBold; - color: $euiColorMediumShade; - display: inline-block; - text-align: center; - width: $euiSizeL; - height: $euiSizeL; - line-height: $euiSizeL; - border-radius: $euiSizeL / 2; - border: $euiBorderThin; - background-color: $euiColorLightestShade; - z-index: $euiZLevel1; - } - - > .timCell__action { - opacity: 0; - - &:focus { - opacity: 1; - } - - &:hover, - &:focus { - color: $euiTextColor; - border-color: $euiColorMediumShade; - background-color: $euiColorLightShade; - } - } -} - -.timCell:hover { - .timCell__action { - opacity: 1; - } -} diff --git a/src/plugins/timeline/public/directives/cells/_index.scss b/src/plugins/timeline/public/directives/cells/_index.scss deleted file mode 100644 index c537dd49d304..000000000000 --- a/src/plugins/timeline/public/directives/cells/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import "./cells"; diff --git a/src/plugins/timeline/public/directives/cells/cells.html b/src/plugins/timeline/public/directives/cells/cells.html deleted file mode 100644 index de30655b620f..000000000000 --- a/src/plugins/timeline/public/directives/cells/cells.html +++ /dev/null @@ -1,52 +0,0 @@ -
- -
- -
-
-
{{$index + 1}}
- - - - -
-
- -
diff --git a/src/plugins/timeline/public/directives/cells/cells.js b/src/plugins/timeline/public/directives/cells/cells.js deleted file mode 100644 index 3e10d92a5349..000000000000 --- a/src/plugins/timeline/public/directives/cells/cells.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { move } from './collection'; -import { initTimelineGridDirective } from '../timeline_grid'; - -import html from './cells.html'; - -export function initCellsDirective(app) { - initTimelineGridDirective(app); - - app.directive('timelineCells', function () { - return { - restrict: 'E', - scope: { - sheet: '=', - state: '=', - transient: '=', - onSearch: '=', - onSelect: '=', - onRemoveSheet: '=', - }, - template: html, - link: function ($scope) { - $scope.removeCell = function (index) { - $scope.onRemoveSheet(index); - }; - - $scope.dropCell = function (item, partFrom, partTo, indexFrom, indexTo) { - move($scope.sheet, indexFrom, indexTo); - $scope.onSelect(indexTo); - }; - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/cells/collection.ts b/src/plugins/timeline/public/directives/cells/collection.ts deleted file mode 100644 index aeb4f83a75ca..000000000000 --- a/src/plugins/timeline/public/directives/cells/collection.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; - -/** - * move an obj either up or down in the collection by - * injecting it either before/after the prev/next obj that - * satisfied the qualifier - * - * or, just from one index to another... - * - * @param {array} objs - the list to move the object within - * @param {number|any} obj - the object that should be moved, or the index that the object is currently at - * @param {number|boolean} below - the index to move the object to, or whether it should be moved up or down - * @param {function} qualifier - a lodash-y callback, object = _.where, string = _.pluck - * @return {array} - the objs argument - */ -export function move( - objs: any[], - obj: object | number, - below: number | boolean, - qualifier?: ((object: object, index: number) => any) | Record | string -): object[] { - const origI = _.isNumber(obj) ? obj : objs.indexOf(obj); - if (origI === -1) { - return objs; - } - - if (_.isNumber(below)) { - // move to a specific index - objs.splice(below, 0, objs.splice(origI, 1)[0]); - return objs; - } - - below = !!below; - qualifier = qualifier && _.iteratee(qualifier); - - const above = !below; - const finder = below ? _.findIndex : _.findLastIndex; - - // find the index of the next/previous obj that meets the qualifications - const targetI = finder(objs, (otherAgg, otherI) => { - if (below && otherI <= origI) { - return; - } - if (above && otherI >= origI) { - return; - } - return Boolean(_.isFunction(qualifier) && qualifier(otherAgg, otherI)); - }); - - if (targetI === -1) { - return objs; - } - - // place the obj at it's new index - objs.splice(targetI, 0, objs.splice(origI, 1)[0]); - return objs; -} diff --git a/src/plugins/timeline/public/directives/chart/chart.js b/src/plugins/timeline/public/directives/chart/chart.js deleted file mode 100644 index 0f26c92c2e17..000000000000 --- a/src/plugins/timeline/public/directives/chart/chart.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { i18n } from '@osd/i18n'; - -export function Chart(timelinePanels) { - return { - restrict: 'A', - scope: { - seriesList: '=chart', // The flot object, data, config and all - search: '=', // The function to execute to kick off a search - interval: '=', // Required for formatting x-axis ticks - rerenderTrigger: '=', - }, - link: function ($scope, $elem) { - let panelScope = $scope.$new(true); - - function render() { - panelScope.$destroy(); - - if (!$scope.seriesList) return; - - $scope.seriesList.render = $scope.seriesList.render || { - type: 'timechart', - }; - - const panelSchema = timelinePanels.get($scope.seriesList.render.type); - - if (!panelSchema) { - $elem.text( - i18n.translate('timeline.chart.seriesList.noSchemaWarning', { - defaultMessage: 'No such panel type: {renderType}', - values: { renderType: $scope.seriesList.render.type }, - }) - ); - return; - } - - panelScope = $scope.$new(true); - panelScope.seriesList = $scope.seriesList; - panelScope.interval = $scope.interval; - panelScope.search = $scope.search; - - panelSchema.render(panelScope, $elem); - } - - $scope.$watchGroup(['seriesList', 'rerenderTrigger'], render); - }, - }; -} diff --git a/src/plugins/timeline/public/directives/fixed_element.js b/src/plugins/timeline/public/directives/fixed_element.js deleted file mode 100644 index b201b70e26a7..000000000000 --- a/src/plugins/timeline/public/directives/fixed_element.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import $ from 'jquery'; - -export function initFixedElementDirective(app) { - app.directive('fixedElementRoot', function () { - return { - restrict: 'A', - link: function ($elem) { - let fixedAt; - $(window).bind('scroll', function () { - const fixed = $('[fixed-element]', $elem); - const body = $('[fixed-element-body]', $elem); - const top = fixed.offset().top; - - if ($(window).scrollTop() > top) { - // This is a gross hack, but its better than it was. I guess - fixedAt = $(window).scrollTop(); - fixed.addClass(fixed.attr('fixed-element')); - body.addClass(fixed.attr('fixed-element-body')); - body.css({ top: fixed.height() }); - } - - if ($(window).scrollTop() < fixedAt) { - fixed.removeClass(fixed.attr('fixed-element')); - body.removeClass(fixed.attr('fixed-element-body')); - body.removeAttr('style'); - } - }); - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/fullscreen/fullscreen.html b/src/plugins/timeline/public/directives/fullscreen/fullscreen.html deleted file mode 100644 index 9b5332a84a8c..000000000000 --- a/src/plugins/timeline/public/directives/fullscreen/fullscreen.html +++ /dev/null @@ -1,14 +0,0 @@ -
-
-
- -
-
diff --git a/src/plugins/timeline/public/directives/fullscreen/fullscreen.js b/src/plugins/timeline/public/directives/fullscreen/fullscreen.js deleted file mode 100644 index eec336572bef..000000000000 --- a/src/plugins/timeline/public/directives/fullscreen/fullscreen.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import html from './fullscreen.html'; - -export function initFullscreenDirective(app) { - app.directive('timelineFullscreen', function () { - return { - restrict: 'E', - scope: { - expression: '=', - series: '=', - state: '=', - transient: '=', - onSearch: '=', - }, - template: html, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/input_focus.js b/src/plugins/timeline/public/directives/input_focus.js deleted file mode 100644 index 518208c02a2b..000000000000 --- a/src/plugins/timeline/public/directives/input_focus.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export function initInputFocusDirective(app) { - app.directive('inputFocus', function ($parse, $timeout) { - return { - restrict: 'A', - link: function ($scope, $elem, attrs) { - const isDisabled = attrs.disableInputFocus && $parse(attrs.disableInputFocus)($scope); - if (!isDisabled) { - $timeout(function () { - $elem.focus(); - if (attrs.inputFocus === 'select') $elem.select(); - }); - } - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/key_map.ts b/src/plugins/timeline/public/directives/key_map.ts deleted file mode 100644 index e85deb4e2972..000000000000 --- a/src/plugins/timeline/public/directives/key_map.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export const keyMap: { [key: number]: string } = { - 8: 'backspace', - 9: 'tab', - 13: 'enter', - 16: 'shift', - 17: 'ctrl', - 18: 'alt', - 19: 'pause', - 20: 'capsLock', - 27: 'escape', - 32: 'space', - 33: 'pageUp', - 34: 'pageDown', - 35: 'end', - 36: 'home', - 37: 'left', - 38: 'up', - 39: 'right', - 40: 'down', - 45: 'insert', - 46: 'delete', - 48: '0', - 49: '1', - 50: '2', - 51: '3', - 52: '4', - 53: '5', - 54: '6', - 55: '7', - 56: '8', - 57: '9', - 65: 'a', - 66: 'b', - 67: 'c', - 68: 'd', - 69: 'e', - 70: 'f', - 71: 'g', - 72: 'h', - 73: 'i', - 74: 'j', - 75: 'k', - 76: 'l', - 77: 'm', - 78: 'n', - 79: 'o', - 80: 'p', - 81: 'q', - 82: 'r', - 83: 's', - 84: 't', - 85: 'u', - 86: 'v', - 87: 'w', - 88: 'x', - 89: 'y', - 90: 'z', - 91: 'leftWindowKey', - 92: 'rightWindowKey', - 93: 'selectKey', - 96: '0', - 97: '1', - 98: '2', - 99: '3', - 100: '4', - 101: '5', - 102: '6', - 103: '7', - 104: '8', - 105: '9', - 106: 'multiply', - 107: 'add', - 109: 'subtract', - 110: 'period', - 111: 'divide', - 112: 'f1', - 113: 'f2', - 114: 'f3', - 115: 'f4', - 116: 'f5', - 117: 'f6', - 118: 'f7', - 119: 'f8', - 120: 'f9', - 121: 'f10', - 122: 'f11', - 123: 'f12', - 144: 'numLock', - 145: 'scrollLock', - 186: 'semiColon', - 187: 'equalSign', - 188: 'comma', - 189: 'dash', - 190: 'period', - 191: 'forwardSlash', - 192: 'graveAccent', - 219: 'openBracket', - 220: 'backSlash', - 221: 'closeBracket', - 222: 'singleQuote', - 224: 'meta', -}; diff --git a/src/plugins/timeline/public/directives/saved_object_finder.html b/src/plugins/timeline/public/directives/saved_object_finder.html deleted file mode 100644 index 79e6121f458c..000000000000 --- a/src/plugins/timeline/public/directives/saved_object_finder.html +++ /dev/null @@ -1,118 +0,0 @@ -
-
-
-
- - -
-
- -
-

-
- - - -
-
-
-
- - - - - diff --git a/src/plugins/timeline/public/directives/saved_object_finder.js b/src/plugins/timeline/public/directives/saved_object_finder.js deleted file mode 100644 index 284b4e9d5fbd..000000000000 --- a/src/plugins/timeline/public/directives/saved_object_finder.js +++ /dev/null @@ -1,327 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; -import rison from 'rison-node'; -import savedObjectFinderTemplate from './saved_object_finder.html'; -import { keyMap } from './key_map'; -import { - PaginateControlsDirectiveProvider, - PaginateDirectiveProvider, -} from '../../../opensearch_dashboards_legacy/public'; -import { PER_PAGE_SETTING } from '../../../saved_objects/public'; -import { VISUALIZE_ENABLE_LABS_SETTING } from '../../../visualizations/public'; - -export function initSavedObjectFinderDirective(app, savedSheetLoader, uiSettings) { - app - .directive('paginate', PaginateDirectiveProvider) - .directive('paginateControls', PaginateControlsDirectiveProvider) - .directive('savedObjectFinder', function () { - return { - restrict: 'E', - scope: { - type: '@', - // optional make-url attr, sets the userMakeUrl in our scope - userMakeUrl: '=?makeUrl', - // optional on-choose attr, sets the userOnChoose in our scope - userOnChoose: '=?onChoose', - // optional useLocalManagement attr, removes link to management section - useLocalManagement: '=?useLocalManagement', - /** - * @type {function} - an optional function. If supplied an `Add new X` button is shown - * and this function is called when clicked. - */ - onAddNew: '=', - /** - * @{type} boolean - set this to true, if you don't want the search box above the - * table to automatically gain focus once loaded - */ - disableAutoFocus: '=', - }, - template: savedObjectFinderTemplate, - controllerAs: 'finder', - controller: function ($scope, $element, $location, history) { - const self = this; - - // the text input element - const $input = $element.find('input[ng-model=filter]'); - - // The number of items to show in the list - $scope.perPage = uiSettings.get(PER_PAGE_SETTING); - - // the list that will hold the suggestions - const $list = $element.find('ul'); - - // the current filter string, used to check that returned results are still useful - let currentFilter = $scope.filter; - - // the most recently entered search/filter - let prevSearch; - - // the list of hits, used to render display - self.hits = []; - - self.service = savedSheetLoader; - self.properties = self.service.loaderProperties; - - filterResults(); - - /** - * Boolean that keeps track of whether hits are sorted ascending (true) - * or descending (false) by title - * @type {Boolean} - */ - self.isAscending = true; - - /** - * Sorts saved object finder hits either ascending or descending - * @param {Array} hits Array of saved finder object hits - * @return {Array} Array sorted either ascending or descending - */ - self.sortHits = function (hits) { - self.isAscending = !self.isAscending; - self.hits = self.isAscending - ? _.sortBy(hits, ['title']) - : _.sortBy(hits, ['title']).reverse(); - }; - - /** - * Passed the hit objects and will determine if the - * hit should have a url in the UI, returns it if so - * @return {string|null} - the url or nothing - */ - self.makeUrl = function (hit) { - if ($scope.userMakeUrl) { - return $scope.userMakeUrl(hit); - } - - if (!$scope.userOnChoose) { - return hit.url; - } - - return '#'; - }; - - self.preventClick = function ($event) { - $event.preventDefault(); - }; - - /** - * Called when a hit object is clicked, can override the - * url behavior if necessary. - */ - self.onChoose = function (hit, $event) { - if ($scope.userOnChoose) { - $scope.userOnChoose(hit, $event); - } - - const url = self.makeUrl(hit); - if (!url || url === '#' || url.charAt(0) !== '#') return; - - $event.preventDefault(); - - history.push(url.substr(1)); - }; - - $scope.$watch('filter', function (newFilter) { - // ensure that the currentFilter changes from undefined to '' - // which triggers - currentFilter = newFilter || ''; - filterResults(); - }); - - $scope.pageFirstItem = 0; - $scope.pageLastItem = 0; - $scope.onPageChanged = (page) => { - $scope.pageFirstItem = page.firstItem; - $scope.pageLastItem = page.lastItem; - }; - - //manages the state of the keyboard selector - self.selector = { - enabled: false, - index: -1, - }; - - self.getLabel = function () { - return _.words(self.properties.nouns).map(_.capitalize).join(' '); - }; - - //key handler for the filter text box - self.filterKeyDown = function ($event) { - switch (keyMap[$event.keyCode]) { - case 'enter': - if (self.hitCount !== 1) return; - - const hit = self.hits[0]; - if (!hit) return; - - self.onChoose(hit, $event); - $event.preventDefault(); - break; - } - }; - - //key handler for the list items - self.hitKeyDown = function ($event, page, paginate) { - switch (keyMap[$event.keyCode]) { - case 'tab': - if (!self.selector.enabled) break; - - self.selector.index = -1; - self.selector.enabled = false; - - //if the user types shift-tab return to the textbox - //if the user types tab, set the focus to the currently selected hit. - if ($event.shiftKey) { - $input.focus(); - } else { - $list.find('li.active a').focus(); - } - - $event.preventDefault(); - break; - case 'down': - if (!self.selector.enabled) break; - - if (self.selector.index + 1 < page.length) { - self.selector.index += 1; - } - $event.preventDefault(); - break; - case 'up': - if (!self.selector.enabled) break; - - if (self.selector.index > 0) { - self.selector.index -= 1; - } - $event.preventDefault(); - break; - case 'right': - if (!self.selector.enabled) break; - - if (page.number < page.count) { - paginate.goToPage(page.number + 1); - self.selector.index = 0; - selectTopHit(); - } - $event.preventDefault(); - break; - case 'left': - if (!self.selector.enabled) break; - - if (page.number > 1) { - paginate.goToPage(page.number - 1); - self.selector.index = 0; - selectTopHit(); - } - $event.preventDefault(); - break; - case 'escape': - if (!self.selector.enabled) break; - - $input.focus(); - $event.preventDefault(); - break; - case 'enter': - if (!self.selector.enabled) break; - - const hitIndex = (page.number - 1) * paginate.perPage + self.selector.index; - const hit = self.hits[hitIndex]; - if (!hit) break; - - self.onChoose(hit, $event); - $event.preventDefault(); - break; - case 'shift': - break; - default: - $input.focus(); - break; - } - }; - - self.hitBlur = function () { - self.selector.index = -1; - self.selector.enabled = false; - }; - - self.manageObjects = function (type) { - $location.url( - '/management/opensearch-dashboards/objects?_a=' + rison.encode({ tab: type }) - ); - }; - - self.hitCountNoun = function () { - return (self.hitCount === 1 - ? self.properties.noun - : self.properties.nouns - ).toLowerCase(); - }; - - function selectTopHit() { - setTimeout(function () { - //triggering a focus event kicks off a new angular digest cycle. - $list.find('a:first').focus(); - }, 0); - } - - function filterResults() { - if (!self.service) return; - if (!self.properties) return; - - // track the filter that we use for this search, - // but ensure that we don't search for the same - // thing twice. This is called from multiple places - // and needs to be smart about when it actually searches - const filter = currentFilter; - if (prevSearch === filter) return; - - prevSearch = filter; - - const isLabsEnabled = uiSettings.get(VISUALIZE_ENABLE_LABS_SETTING); - self.service.find(filter).then(function (hits) { - hits.hits = hits.hits.filter( - (hit) => isLabsEnabled || _.get(hit, 'type.stage') !== 'experimental' - ); - hits.total = hits.hits.length; - - // ensure that we don't display old results - // as we can't really cancel requests - if (currentFilter === filter) { - self.hitCount = hits.total; - self.hits = _.sortBy(hits.hits, ['title']); - } - }); - } - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.html b/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.html deleted file mode 100644 index da16aafdf7af..000000000000 --- a/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.html +++ /dev/null @@ -1,28 +0,0 @@ -
-
- - -
- diff --git a/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.js b/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.js deleted file mode 100644 index 794ecb01f0a6..000000000000 --- a/src/plugins/timeline/public/directives/saved_object_save_as_checkbox.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import saveObjectSaveAsCheckboxTemplate from './saved_object_save_as_checkbox.html'; - -export function initSavedObjectSaveAsCheckBoxDirective(app) { - app.directive('savedObjectSaveAsCheckBox', function () { - return { - restrict: 'E', - template: saveObjectSaveAsCheckboxTemplate, - replace: true, - scope: { - savedObject: '=', - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/timeline_expression_input.html b/src/plugins/timeline/public/directives/timeline_expression_input.html deleted file mode 100644 index b565e6643fc6..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_input.html +++ /dev/null @@ -1,19 +0,0 @@ -
- - - - - -
diff --git a/src/plugins/timeline/public/directives/timeline_expression_input.js b/src/plugins/timeline/public/directives/timeline_expression_input.js deleted file mode 100644 index 0c4150c952a6..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_input.js +++ /dev/null @@ -1,293 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Timeline Expression Autocompleter - * - * This directive allows users to enter multiline timeline expressions. If the user has entered - * a valid expression and then types a ".", this directive will display a list of suggestions. - * - * Users can navigate suggestions using the arrow keys. When a user selects a suggestion, it's - * inserted into the expression and the caret position is updated to be inside of the newly- - * added function's parentheses. - * - * Beneath the hood, we use a PEG grammar to validate the Timeline expression and detect if - * the caret is in a position within the expression that allows functions to be suggested. - * - * NOTE: This directive doesn't work well with contenteditable divs. Challenges include: - * - You have to replace markup with newline characters and spaces when passing the expression - * to the grammar. - * - You have to do the opposite when loading a saved expression, so that it appears correctly - * within the contenteditable (i.e. replace newlines with
markup). - * - The Range and Selection APIs ignore newlines when providing caret position, so there is - * literally no way to insert suggestions into the correct place in a multiline expression - * that has more than a single consecutive newline. - */ - -import _ from 'lodash'; -import $ from 'jquery'; -import PEG from 'pegjs'; -import grammar from 'raw-loader!../../../vis_type_timeline/common/chain.peg'; -import timelineExpressionInputTemplate from './timeline_expression_input.html'; -import { - SUGGESTION_TYPE, - Suggestions, - suggest, - insertAtLocation, -} from './timeline_expression_input_helpers'; -import { comboBoxKeyCodes } from '@elastic/eui'; - -const Parser = PEG.generate(grammar); - -export function timelineExpInput(deps) { - return ($http, $timeout) => { - return { - restrict: 'E', - scope: { - rows: '=', - sheet: '=', - updateChart: '&', - shouldPopoverSuggestions: '@', - }, - replace: true, - template: timelineExpressionInputTemplate, - link: function (scope, elem) { - const argValueSuggestions = deps.plugins.visTypeTimeline.getArgValueSuggestions(); - const expressionInput = elem.find('[data-expression-input]'); - const functionReference = {}; - let suggestibleFunctionLocation = {}; - - scope.suggestions = new Suggestions(); - - function init() { - $http.get('../api/timeline/functions').then(function (resp) { - Object.assign(functionReference, { - byName: _.keyBy(resp.data, 'name'), - list: resp.data, - }); - }); - } - - function setCaretOffset(caretOffset) { - // Wait for Angular to update the input with the new expression and *then* we can set - // the caret position. - $timeout(() => { - expressionInput.focus(); - expressionInput[0].selectionStart = expressionInput[0].selectionEnd = caretOffset; - scope.$apply(); - }, 0); - } - - function insertSuggestionIntoExpression(suggestionIndex) { - if (scope.suggestions.isEmpty()) { - return; - } - - const { min, max } = suggestibleFunctionLocation; - let insertedValue; - let insertPositionMinOffset = 0; - - switch (scope.suggestions.type) { - case SUGGESTION_TYPE.FUNCTIONS: { - // Position the caret inside of the function parentheses. - insertedValue = `${scope.suggestions.list[suggestionIndex].name}()`; - - // min advanced one to not replace function '.' - insertPositionMinOffset = 1; - break; - } - case SUGGESTION_TYPE.ARGUMENTS: { - // Position the caret after the '=' - insertedValue = `${scope.suggestions.list[suggestionIndex].name}=`; - break; - } - case SUGGESTION_TYPE.ARGUMENT_VALUE: { - // Position the caret after the argument value - insertedValue = `${scope.suggestions.list[suggestionIndex].name}`; - break; - } - } - - const updatedExpression = insertAtLocation( - insertedValue, - scope.sheet, - min + insertPositionMinOffset, - max - ); - scope.sheet = updatedExpression; - - const newCaretOffset = min + insertedValue.length; - setCaretOffset(newCaretOffset); - } - - function scrollToSuggestionAt(index) { - // We don't cache these because the list changes based on user input. - const suggestionsList = $('[data-suggestions-list]'); - const suggestionListItem = $('[data-suggestion-list-item]')[index]; - // Scroll to the position of the item relative to the list, not to the window. - suggestionsList.scrollTop(suggestionListItem.offsetTop - suggestionsList[0].offsetTop); - } - - function getCursorPosition() { - if (expressionInput.length) { - return expressionInput[0].selectionStart; - } - return null; - } - - async function getSuggestions() { - const suggestions = await suggest( - scope.sheet, - functionReference.list, - Parser, - getCursorPosition(), - argValueSuggestions - ); - - // We're using ES6 Promises, not $q, so we have to wrap this in $apply. - scope.$apply(() => { - if (suggestions) { - scope.suggestions.setList(suggestions.list, suggestions.type); - scope.suggestions.show(); - suggestibleFunctionLocation = suggestions.location; - $timeout(() => { - const suggestionsList = $('[data-suggestions-list]'); - suggestionsList.scrollTop(0); - }, 0); - return; - } - - suggestibleFunctionLocation = undefined; - scope.suggestions.reset(); - }); - } - - function isNavigationalKey(keyCode) { - const keyCodes = _.values(comboBoxKeyCodes); - return keyCodes.includes(keyCode); - } - - scope.onFocusInput = () => { - // Wait for the caret position of the input to update and then we can get suggestions - // (which depends on the caret position). - $timeout(getSuggestions, 0); - }; - - scope.onBlurInput = () => { - scope.suggestions.hide(); - }; - - scope.onKeyDownInput = (e) => { - // If we've pressed any non-navigational keys, then the user has typed something and we - // can exit early without doing any navigation. The keyup handler will pull up suggestions. - if (!isNavigationalKey(e.keyCode)) { - return; - } - - switch (e.keyCode) { - case comboBoxKeyCodes.UP: - if (scope.suggestions.isVisible) { - // Up and down keys navigate through suggestions. - e.preventDefault(); - scope.suggestions.stepForward(); - scrollToSuggestionAt(scope.suggestions.index); - } - break; - - case comboBoxKeyCodes.DOWN: - if (scope.suggestions.isVisible) { - // Up and down keys navigate through suggestions. - e.preventDefault(); - scope.suggestions.stepBackward(); - scrollToSuggestionAt(scope.suggestions.index); - } - break; - - case comboBoxKeyCodes.TAB: - // If there are no suggestions or none is selected, the user tabs to the next input. - if (scope.suggestions.isEmpty() || scope.suggestions.index < 0) { - // Before letting the tab be handled to focus the next element - // we need to hide the suggestions, otherwise it will focus these - // instead of the time interval select. - scope.suggestions.hide(); - return; - } - - // If we have suggestions, complete the selected one. - e.preventDefault(); - insertSuggestionIntoExpression(scope.suggestions.index); - break; - - case comboBoxKeyCodes.ENTER: - if (e.metaKey || e.ctrlKey) { - // Re-render the chart when the user hits CMD+ENTER. - e.preventDefault(); - scope.updateChart(); - } else if (!scope.suggestions.isEmpty()) { - // If the suggestions are open, complete the expression with the suggestion. - e.preventDefault(); - insertSuggestionIntoExpression(scope.suggestions.index); - } - break; - - case comboBoxKeyCodes.ESCAPE: - e.preventDefault(); - scope.suggestions.hide(); - break; - } - }; - - scope.onKeyUpInput = (e) => { - // If the user isn't navigating, then we should update the suggestions based on their input. - if (!isNavigationalKey(e.keyCode)) { - getSuggestions(); - } - }; - - scope.onClickExpression = () => { - getSuggestions(); - }; - - scope.onClickSuggestion = (index) => { - insertSuggestionIntoExpression(index); - }; - - scope.getActiveSuggestionId = () => { - if (scope.suggestions.isVisible && scope.suggestions.index > -1) { - return `timelineSuggestion${scope.suggestions.index}`; - } - return ''; - }; - - init(); - }, - }; - }; -} diff --git a/src/plugins/timeline/public/directives/timeline_expression_input_helpers.js b/src/plugins/timeline/public/directives/timeline_expression_input_helpers.js deleted file mode 100644 index 62f496d0f6f0..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_input_helpers.js +++ /dev/null @@ -1,291 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; - -export const SUGGESTION_TYPE = { - ARGUMENTS: 'arguments', - ARGUMENT_VALUE: 'argument_value', - FUNCTIONS: 'functions', -}; - -export class Suggestions { - constructor() { - this.reset(); - } - - reset() { - this.index = -1; - this.list = []; - this.type = null; - this.isVisible = false; - } - - setList(list, type) { - this.list = list.sort((a, b) => { - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - // names must be equal - return 0; - }); - this.type = type; - - // Only try to position index inside of list range, when it was already focused - // beforehand (i.e. not -1) - if (this.index > -1) { - // We may get a shorter list than the one we have now, so we need to make sure our index doesn't - // fall outside of the new list's range. - this.index = Math.max(0, Math.min(this.index, this.list.length - 1)); - } - } - - getCount() { - return this.list.length; - } - - isEmpty() { - return this.list.length === 0; - } - - show() { - this.isVisible = true; - } - - hide() { - this.isVisible = false; - } - - stepForward() { - if (this.index > 0) { - this.index -= 1; - } - } - - stepBackward() { - if (this.index < this.list.length - 1) { - this.index += 1; - } - } -} - -function inLocation(cursorPosition, location) { - return cursorPosition >= location.min && cursorPosition <= location.max; -} - -function getArgumentsHelp(functionHelp, functionArgs = []) { - if (!functionHelp) { - return []; - } - - // Do not provide 'inputSeries' as argument suggestion for chainable functions - const argsHelp = functionHelp.chainable ? functionHelp.args.slice(1) : functionHelp.args.slice(0); - - // ignore arguments that are already provided in function declaration - const functionArgNames = functionArgs.map((arg) => { - return arg.name; - }); - return argsHelp.filter((arg) => { - return !functionArgNames.includes(arg.name); - }); -} - -async function extractSuggestionsFromParsedResult( - result, - cursorPosition, - functionList, - argValueSuggestions -) { - const activeFunc = result.functions.find((func) => { - return cursorPosition >= func.location.min && cursorPosition < func.location.max; - }); - - if (!activeFunc) { - return; - } - - const functionHelp = functionList.find((func) => { - return func.name === activeFunc.function; - }); - - // return function suggestion when cursor is outside of parentheses - // location range includes '.', function name, and '('. - const openParen = activeFunc.location.min + activeFunc.function.length + 2; - if (cursorPosition < openParen) { - return { list: [functionHelp], location: activeFunc.location, type: SUGGESTION_TYPE.FUNCTIONS }; - } - - // return argument value suggestions when cursor is inside argument value - const activeArg = activeFunc.arguments.find((argument) => { - return inLocation(cursorPosition, argument.location); - }); - if ( - activeArg && - activeArg.type === 'namedArg' && - inLocation(cursorPosition, activeArg.value.location) - ) { - const { function: functionName, arguments: functionArgs } = activeFunc; - - const { - name: argName, - value: { text: partialInput }, - } = activeArg; - - let valueSuggestions; - if (argValueSuggestions.hasDynamicSuggestionsForArgument(functionName, argName)) { - valueSuggestions = await argValueSuggestions.getDynamicSuggestionsForArgument( - functionName, - argName, - functionArgs, - partialInput - ); - } else { - const { suggestions: staticSuggestions } = functionHelp.args.find((arg) => { - return arg.name === activeArg.name; - }); - valueSuggestions = argValueSuggestions.getStaticSuggestionsForInput( - partialInput, - staticSuggestions - ); - } - return { - list: valueSuggestions, - location: activeArg.value.location, - type: SUGGESTION_TYPE.ARGUMENT_VALUE, - }; - } - - // return argument suggestions - const argsHelp = getArgumentsHelp(functionHelp, activeFunc.arguments); - const argumentSuggestions = argsHelp.filter((arg) => { - if (_.get(activeArg, 'type') === 'namedArg') { - return _.startsWith(arg.name, activeArg.name); - } else if (activeArg) { - return _.startsWith(arg.name, activeArg.text); - } - return true; - }); - const location = activeArg ? activeArg.location : { min: cursorPosition, max: cursorPosition }; - return { list: argumentSuggestions, location: location, type: SUGGESTION_TYPE.ARGUMENTS }; -} - -export async function suggest( - expression, - functionList, - Parser, - cursorPosition, - argValueSuggestions -) { - try { - const result = await Parser.parse(expression); - return await extractSuggestionsFromParsedResult( - result, - cursorPosition, - functionList, - argValueSuggestions - ); - } catch (e) { - let message; - try { - // The grammar will throw an error containing a message if the expression is formatted - // correctly and is prepared to accept suggestions. If the expression is not formatted - // correctly the grammar will just throw a regular PEG SyntaxError, and this JSON.parse - // attempt will throw an error. - message = JSON.parse(e.message); - } catch (e) { - // The expression isn't correctly formatted, so JSON.parse threw an error. - return; - } - - switch (message.type) { - case 'incompleteFunction': { - let list; - if (message.function) { - // The user has start typing a function name, so we'll filter the list down to only - // possible matches. - list = functionList.filter((func) => _.startsWith(func.name, message.function)); - } else { - // The user hasn't typed anything yet, so we'll just return the entire list. - list = functionList; - } - return { list, location: message.location, type: SUGGESTION_TYPE.FUNCTIONS }; - } - case 'incompleteArgument': { - const { currentFunction: functionName, currentArgs: functionArgs } = message; - const functionHelp = functionList.find((func) => func.name === functionName); - return { - list: getArgumentsHelp(functionHelp, functionArgs), - location: message.location, - type: SUGGESTION_TYPE.ARGUMENTS, - }; - } - case 'incompleteArgumentValue': { - const { name: argName, currentFunction: functionName, currentArgs: functionArgs } = message; - let valueSuggestions = []; - if (argValueSuggestions.hasDynamicSuggestionsForArgument(functionName, argName)) { - valueSuggestions = await argValueSuggestions.getDynamicSuggestionsForArgument( - functionName, - argName, - functionArgs - ); - } else { - const functionHelp = functionList.find((func) => func.name === functionName); - if (functionHelp) { - const argHelp = functionHelp.args.find((arg) => arg.name === argName); - if (argHelp && argHelp.suggestions) { - valueSuggestions = argHelp.suggestions; - } - } - } - return { - list: valueSuggestions, - location: { min: cursorPosition, max: cursorPosition }, - type: SUGGESTION_TYPE.ARGUMENT_VALUE, - }; - } - } - } -} - -export function insertAtLocation( - valueToInsert, - destination, - replacementRangeStart, - replacementRangeEnd -) { - // Insert the value at a location caret within the destination. - const prefix = destination.slice(0, replacementRangeStart); - const suffix = destination.slice(replacementRangeEnd, destination.length); - const result = `${prefix}${valueToInsert}${suffix}`; - return result; -} diff --git a/src/plugins/timeline/public/directives/timeline_expression_suggestions/_index.scss b/src/plugins/timeline/public/directives/timeline_expression_suggestions/_index.scss deleted file mode 100644 index e49c9151ff73..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_suggestions/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import "./timeline_expression_suggestions"; diff --git a/src/plugins/timeline/public/directives/timeline_expression_suggestions/_timeline_expression_suggestions.scss b/src/plugins/timeline/public/directives/timeline_expression_suggestions/_timeline_expression_suggestions.scss deleted file mode 100644 index 89b96d11c6fd..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_suggestions/_timeline_expression_suggestions.scss +++ /dev/null @@ -1,36 +0,0 @@ -.timSuggestions { - @include euiBottomShadowMedium; - - background-color: $euiColorLightestShade; - color: $euiTextColor; - border: $euiBorderThin; - border-radius: 0 0 $euiBorderRadius $euiBorderRadius !important; - z-index: $euiZLevel9; - max-height: $euiSizeXL * 10; - overflow-y: auto; - - &.timSuggestions-isPopover { - position: absolute; - top: 100%; - } -} - -.timSuggestions__item { - border-bottom: $euiBorderThin; - padding: $euiSizeXS $euiSizeL; - - &:hover, - &.active { - background-color: $euiColorLightShade; - } -} - -.timSuggestions__details { - background-color: $euiColorLightestShade; - padding: $euiSizeM; - border-radius: $euiBorderRadius; - - > table { - margin-bottom: 0; - } -} diff --git a/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.html b/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.html deleted file mode 100644 index f2469b99815a..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.html +++ /dev/null @@ -1,109 +0,0 @@ -
-
- -
- -
-

- .{{suggestion.name}}() - - - - -

- -
-
- - - {{arg.name}}=({{arg.types.join(' | ')}}) - , - -
- -
- - - - - - - - - - - -
{{arg.name}}{{arg.types.join(', ')}}{{arg.help}}
-
-
-
- -
-

- {{suggestion.name}}= - - {{suggestion.help}} - -

-
- Accepts: - {{suggestion.types.join(', ')}} -
-
- -
-

- {{suggestion.name}} - - {{suggestion.help}} - -

-
- -
-
-
diff --git a/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.js b/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.js deleted file mode 100644 index a2c24e57f756..000000000000 --- a/src/plugins/timeline/public/directives/timeline_expression_suggestions/timeline_expression_suggestions.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import template from './timeline_expression_suggestions.html'; - -export function TimelineExpressionSuggestions() { - return { - restrict: 'E', - scope: { - suggestions: '=', - suggestionsType: '=', - selectedIndex: '=', - onClickSuggestion: '&', - shouldPopover: '=', - }, - replace: true, - template, - link: function (scope) { - // This will prevent the expression input from losing focus. - scope.onMouseDown = (e) => e.preventDefault(); - }, - }; -} diff --git a/src/plugins/timeline/public/directives/timeline_grid.js b/src/plugins/timeline/public/directives/timeline_grid.js deleted file mode 100644 index 48db69aa4a0e..000000000000 --- a/src/plugins/timeline/public/directives/timeline_grid.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import $ from 'jquery'; - -export function initTimelineGridDirective(app) { - app.directive('timelineGrid', function () { - return { - restrict: 'A', - scope: { - timelineGridRows: '=', - timelineGridColumns: '=', - }, - link: function ($scope, $elem) { - function init() { - setDimensions(); - } - - $scope.$on('$destroy', function () { - $(window).off('resize'); //remove the handler added earlier - }); - - $(window).resize(function () { - setDimensions(); - }); - - $scope.$watchMulti(['timelineGridColumns', 'timelineGridRows'], function () { - setDimensions(); - }); - - function setDimensions() { - const borderSize = 2; - const headerSize = 45 + 35 + 28 + 20 * 2; // chrome + subnav + buttons + (container padding) - const verticalPadding = 10; - - if ($scope.timelineGridColumns != null) { - $elem.width($elem.parent().width() / $scope.timelineGridColumns - borderSize * 2); - } - - if ($scope.timelineGridRows != null) { - $elem.height( - ($(window).height() - headerSize) / $scope.timelineGridRows - - (verticalPadding + borderSize * 2) - ); - } - } - - init(); - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/timeline_help/_index.scss b/src/plugins/timeline/public/directives/timeline_help/_index.scss deleted file mode 100644 index 763746e95a10..000000000000 --- a/src/plugins/timeline/public/directives/timeline_help/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import "./timeline_help"; diff --git a/src/plugins/timeline/public/directives/timeline_help/_timeline_help.scss b/src/plugins/timeline/public/directives/timeline_help/_timeline_help.scss deleted file mode 100644 index c114f831adcb..000000000000 --- a/src/plugins/timeline/public/directives/timeline_help/_timeline_help.scss +++ /dev/null @@ -1,24 +0,0 @@ -.timHelp { - // EUITODO: Make .euiText > code background transparent - code { - background-color: transparentize($euiTextColor, 0.9); - } -} - -.timHelp__buttons { - display: flex; - justify-content: space-between; -} - -.timHelp__functions { - height: $euiSizeXL * 10; - overflow-y: auto; -} - -/** - * 1. Override bootstrap .table styles. - */ -.timHelp__functionsTableRow:hover, -.timHelp__functionDetailsTable { - background-color: $euiColorLightestShade !important; /* 1 */ -} diff --git a/src/plugins/timeline/public/directives/timeline_help/timeline_help.html b/src/plugins/timeline/public/directives/timeline_help/timeline_help.html deleted file mode 100644 index a241405b3c44..000000000000 --- a/src/plugins/timeline/public/directives/timeline_help/timeline_help.html +++ /dev/null @@ -1,507 +0,0 @@ -
-
-
-

-

-

- - . -

-
-
- - - -
-
-
-
-
-

-

-

-
-
- - - - - - -
-
-
-
-

-

- - - -

-

-
    -
  • - -

    - - - - - - -

    -
  • -
  • - -

    -
  • -
-

-

-
-
- - - -
-
-
-
-
-

-

-

- - - -

-

-

-

-

- - - -

-
-
- - - -
-
- -
-
-

-

-

-

- - - - - - - - - - - - - - - - - -
.opensearch(*), .opensearch(US)
.opensearch(*).color(#f66), .opensearch(US).bars(1)
- .opensearch(*).color(#f66).lines(fill=3), .opensearch(US).bars(1).points(radius=3, - weight=1) -
(.opensearch(*), .opensearch(GB)).points()
-

- - . -

-
-
- - - -
-
-
-
-

-

-

-

-

-

-

-

- - - -

-
-
- - - -
-
-
-
-

- - - - -
-
- - . -
- -
- - - - - - - - -
.{{function.name}}(){{function.help}}
-
- - - - - - - - - - - -
{{arg.name}}{{arg.types.join(', ')}}{{arg.help}}
-
- -
-
-
-
-
- -
- -
-
- -
-
-
Ctrl/Cmd + Enter
-
-
- - -
-
-
- -
-
-
-
-
Enter/Tab
-
-
Esc
-
-
-
-
diff --git a/src/plugins/timeline/public/directives/timeline_help/timeline_help.js b/src/plugins/timeline/public/directives/timeline_help/timeline_help.js deleted file mode 100644 index 86ba02c6c87b..000000000000 --- a/src/plugins/timeline/public/directives/timeline_help/timeline_help.js +++ /dev/null @@ -1,177 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import template from './timeline_help.html'; -import { i18n } from '@osd/i18n'; -import _ from 'lodash'; -import moment from 'moment'; - -export function initTimelineHelpDirective(app) { - app.directive('timelineHelp', function ($http) { - return { - restrict: 'E', - template, - controller: function ($scope) { - $scope.functions = { - list: [], - details: null, - }; - - $scope.activeTab = 'funcref'; - $scope.activateTab = function (tabName) { - $scope.activeTab = tabName; - }; - - function init() { - $scope.opensearch = { - invalidCount: 0, - }; - - $scope.translations = { - nextButtonLabel: i18n.translate('timeline.help.nextPageButtonLabel', { - defaultMessage: 'Next', - }), - previousButtonLabel: i18n.translate('timeline.help.previousPageButtonLabel', { - defaultMessage: 'Previous', - }), - dontShowHelpButtonLabel: i18n.translate('timeline.help.dontShowHelpButtonLabel', { - defaultMessage: `Don't show this again`, - }), - strongNextText: i18n.translate('timeline.help.welcome.content.strongNextText', { - defaultMessage: 'Next', - }), - emphasizedEverythingText: i18n.translate( - 'timeline.help.welcome.content.emphasizedEverythingText', - { - defaultMessage: 'everything', - } - ), - notValidAdvancedSettingsPath: i18n.translate( - 'timeline.help.configuration.notValid.advancedSettingsPathText', - { - defaultMessage: 'Management / OpenSearch Dashboards / Advanced Settings', - } - ), - validAdvancedSettingsPath: i18n.translate( - 'timeline.help.configuration.valid.advancedSettingsPathText', - { - defaultMessage: 'Management/OpenSearch Dashboards/Advanced Settings', - } - ), - opensearchAsteriskQueryDescription: i18n.translate( - 'timeline.help.querying.opensearchAsteriskQueryDescriptionText', - { - defaultMessage: 'hey OpenSearch, find everything in my default index', - } - ), - opensearchIndexQueryDescription: i18n.translate( - 'timeline.help.querying.opensearchIndexQueryDescriptionText', - { - defaultMessage: 'use * as the q (query) for the logstash-* index', - } - ), - strongAddText: i18n.translate('timeline.help.expressions.strongAddText', { - defaultMessage: 'Add', - }), - twoExpressionsDescriptionTitle: i18n.translate( - 'timeline.help.expressions.examples.twoExpressionsDescriptionTitle', - { - defaultMessage: 'Double the fun.', - } - ), - customStylingDescriptionTitle: i18n.translate( - 'timeline.help.expressions.examples.customStylingDescriptionTitle', - { - defaultMessage: 'Custom styling.', - } - ), - namedArgumentsDescriptionTitle: i18n.translate( - 'timeline.help.expressions.examples.namedArgumentsDescriptionTitle', - { - defaultMessage: 'Named arguments.', - } - ), - groupedExpressionsDescriptionTitle: i18n.translate( - 'timeline.help.expressions.examples.groupedExpressionsDescriptionTitle', - { - defaultMessage: 'Grouped expressions.', - } - ), - }; - - getFunctions(); - checkOpenSearch(); - } - - function getFunctions() { - return $http.get('../api/timeline/functions').then(function (resp) { - $scope.functions.list = resp.data; - }); - } - $scope.recheckOpenSearch = function () { - $scope.opensearch.valid = null; - checkOpenSearch().then(function (valid) { - if (!valid) $scope.opensearch.invalidCount++; - }); - }; - - function checkOpenSearch() { - return $http.get('../api/timeline/validate/opensearch').then(function (resp) { - if (resp.data.ok) { - $scope.opensearch.valid = true; - $scope.opensearch.stats = { - min: moment(resp.data.min).format('LLL'), - max: moment(resp.data.max).format('LLL'), - field: resp.data.field, - }; - } else { - $scope.opensearch.valid = false; - $scope.opensearch.invalidReason = (function () { - try { - const opensearchResp = JSON.parse(resp.data.resp.response); - return _.get(opensearchResp, 'error.root_cause[0].reason'); - } catch (e) { - if (_.get(resp, 'data.resp.message')) return _.get(resp, 'data.resp.message'); - if (_.get(resp, 'data.resp.output.payload.message')) - return _.get(resp, 'data.resp.output.payload.message'); - return i18n.translate('timeline.help.unknownErrorMessage', { - defaultMessage: 'Unknown error', - }); - } - })(); - } - return $scope.opensearch.valid; - }); - } - init(); - }, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/timeline_interval/_index.scss b/src/plugins/timeline/public/directives/timeline_interval/_index.scss deleted file mode 100644 index fb597657a0a7..000000000000 --- a/src/plugins/timeline/public/directives/timeline_interval/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import "./timeline_interval"; diff --git a/src/plugins/timeline/public/directives/timeline_interval/_timeline_interval.scss b/src/plugins/timeline/public/directives/timeline_interval/_timeline_interval.scss deleted file mode 100644 index 6117bbff13eb..000000000000 --- a/src/plugins/timeline/public/directives/timeline_interval/_timeline_interval.scss +++ /dev/null @@ -1,24 +0,0 @@ -timeline-interval { - display: flex; -} - -.timInterval__input { - width: $euiSizeXL * 2; -} - -.timInterval__input--compact { - border-top-right-radius: 0; - border-bottom-right-radius: 0; -} - -.timInterval__presets { - width: $euiSizeXL * 3; -} - -.timInterval__presets--compact { - width: $euiSizeXL * 1; - padding-left: 0; - border-left: none; - border-top-left-radius: 0; - border-bottom-left-radius: 0; -} diff --git a/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.html b/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.html deleted file mode 100644 index 7eb1b72e46fd..000000000000 --- a/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.html +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.js b/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.js deleted file mode 100644 index 66869155916a..000000000000 --- a/src/plugins/timeline/public/directives/timeline_interval/timeline_interval.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; -import $ from 'jquery'; -import template from './timeline_interval.html'; - -export function TimelineInterval($timeout) { - return { - restrict: 'E', - scope: { - // The interval model - model: '=', - changeInterval: '=', - }, - template, - link: function ($scope, $elem) { - $scope.intervalOptions = ['auto', '1s', '1m', '1h', '1d', '1w', '1M', '1y', 'other']; - $scope.intervalLabels = { - auto: 'auto', - '1s': '1 second', - '1m': '1 minute', - '1h': '1 hour', - '1d': '1 day', - '1w': '1 week', - '1M': '1 month', - '1y': '1 year', - other: 'other', - }; - - $scope.$watch('model', function (newVal, oldVal) { - // Only run this on initialization - if (newVal !== oldVal || oldVal == null) return; - - if (_.includes($scope.intervalOptions, newVal)) { - $scope.interval = newVal; - } else { - $scope.interval = 'other'; - } - - if (newVal !== 'other') { - $scope.otherInterval = newVal; - } - }); - - $scope.$watch('interval', function (newVal, oldVal) { - if (newVal === oldVal || $scope.model === newVal) return; - - if (newVal === 'other') { - $scope.otherInterval = oldVal; - $scope.changeInterval($scope.otherInterval); - $timeout(function () { - $('input', $elem).select(); - }, 0); - } else { - $scope.otherInterval = $scope.interval; - $scope.changeInterval($scope.interval); - } - }); - - $scope.$watch('otherInterval', function (newVal, oldVal) { - if (newVal === oldVal || $scope.model === newVal) return; - $scope.changeInterval(newVal); - }); - }, - }; -} diff --git a/src/plugins/timeline/public/directives/timeline_load_sheet.js b/src/plugins/timeline/public/directives/timeline_load_sheet.js deleted file mode 100644 index 718d090133e7..000000000000 --- a/src/plugins/timeline/public/directives/timeline_load_sheet.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import template from '../partials/load_sheet.html'; - -export function initTimelineLoadSheetDirective(app) { - app.directive('timelineLoad', function () { - return { - replace: true, - restrict: 'E', - template, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/timeline_options_sheet.js b/src/plugins/timeline/public/directives/timeline_options_sheet.js deleted file mode 100644 index 485869f5fcf8..000000000000 --- a/src/plugins/timeline/public/directives/timeline_options_sheet.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import template from '../partials/sheet_options.html'; - -export function initTimelineOptionsSheetDirective(app) { - app.directive('timelineOptions', function () { - return { - replace: true, - restrict: 'E', - template, - }; - }); -} diff --git a/src/plugins/timeline/public/directives/timeline_save_sheet.js b/src/plugins/timeline/public/directives/timeline_save_sheet.js deleted file mode 100644 index 80ffe3c4e294..000000000000 --- a/src/plugins/timeline/public/directives/timeline_save_sheet.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import saveTemplate from '../partials/save_sheet.html'; - -export function initTimelineSaveSheetDirective(app) { - app.directive('timelineSave', function () { - return { - replace: true, - restrict: 'E', - template: saveTemplate, - }; - }); -} diff --git a/src/plugins/timeline/public/index.html b/src/plugins/timeline/public/index.html deleted file mode 100644 index 1b116e54479b..000000000000 --- a/src/plugins/timeline/public/index.html +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - -
- - - - - -
- -
-
- -
-
- -
- -
- - - -
-
- -
- - - -
-
-
- - diff --git a/src/plugins/timeline/public/index.scss b/src/plugins/timeline/public/index.scss deleted file mode 100644 index 8c2a25c383a6..000000000000 --- a/src/plugins/timeline/public/index.scss +++ /dev/null @@ -1,18 +0,0 @@ -/* Timeline plugin styles */ - -// Prefix all styles with "tim" to avoid conflicts. -// Examples -// timChart -// timChart__legend -// timChart__legend--small -// timChart__legend-isLoading - -@import "./app"; -@import "./base"; -@import "./directives/index"; - -// these styles is needed to be loaded here explicitly if the timeline visualization was not opened in browser -// styles for timeline visualization are lazy loaded only while a vis is opened -// this will duplicate styles only if both Timeline app and timeline visualization are loaded -// could be left here as it is since the Timeline app is deprecated -@import "../../vis_type_timeline/public/components/timeline_vis"; diff --git a/src/plugins/timeline/public/index.ts b/src/plugins/timeline/public/index.ts deleted file mode 100644 index f4b35580b7d1..000000000000 --- a/src/plugins/timeline/public/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { PluginInitializerContext } from 'opensearch-dashboards/public'; -import { TimelinePlugin as Plugin } from './plugin'; - -export function plugin(initializerContext: PluginInitializerContext) { - return new Plugin(initializerContext); -} diff --git a/src/plugins/timeline/public/lib/observe_resize.js b/src/plugins/timeline/public/lib/observe_resize.js deleted file mode 100644 index 32a582b19be8..000000000000 --- a/src/plugins/timeline/public/lib/observe_resize.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export default function ($elem, fn, frequency) { - frequency = frequency || 500; - let currentHeight = $elem.height(); - let currentWidth = $elem.width(); - - let timeout; - - function checkLoop() { - timeout = setTimeout(function () { - if (currentHeight !== $elem.height() || currentWidth !== $elem.width()) { - currentHeight = $elem.height(); - currentWidth = $elem.width(); - - if (currentWidth > 0 && currentWidth > 0) fn(); - } - checkLoop(); - }, frequency); - } - - checkLoop(); - - return function () { - clearTimeout(timeout); - }; -} diff --git a/src/plugins/timeline/public/panels/panel.ts b/src/plugins/timeline/public/panels/panel.ts deleted file mode 100644 index bff7b49ab9f9..000000000000 --- a/src/plugins/timeline/public/panels/panel.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { i18n } from '@osd/i18n'; - -interface PanelConfig { - help?: string; - render?: Function; -} - -export class Panel { - name: string; - help: string; - render: Function | undefined; - - constructor(name: string, config: PanelConfig) { - this.name = name; - this.help = config.help || ''; - this.render = config.render; - - if (!config.render) { - throw new Error( - i18n.translate('timeline.panels.noRenderFunctionErrorMessage', { - defaultMessage: 'Panel must have a rendering function', - }) - ); - } - } -} diff --git a/src/plugins/timeline/public/panels/timechart/schema.ts b/src/plugins/timeline/public/panels/timechart/schema.ts deleted file mode 100644 index d18c5337440d..000000000000 --- a/src/plugins/timeline/public/panels/timechart/schema.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import _ from 'lodash'; -import $ from 'jquery'; -import moment from 'moment-timezone'; -// @ts-ignore -import observeResize from '../../lib/observe_resize'; -import { - calculateInterval, - DEFAULT_TIME_FORMAT, - tickFormatters, - xaxisFormatterProvider, - generateTicksProvider, -} from '../../../../vis_type_timeline/public'; -import { TimelineVisualizationDependencies } from '../../application'; - -const DEBOUNCE_DELAY = 50; - -export function timechartFn(dependencies: TimelineVisualizationDependencies) { - const { - $rootScope, - $compile, - uiSettings, - data: { - query: { timefilter }, - }, - } = dependencies; - - return function () { - return { - help: 'Draw a timeseries chart', - render($scope: any, $elem: any) { - const template = '
'; - const formatters = tickFormatters() as any; - const getxAxisFormatter = xaxisFormatterProvider(uiSettings); - const generateTicks = generateTicksProvider(); - - // TODO: I wonder if we should supply our own moment that sets this every time? - // could just use angular's injection to provide a moment service? - moment.tz.setDefault(uiSettings.get('dateFormat:tz')); - - const render = $scope.seriesList.render || {}; - - $scope.chart = $scope.seriesList.list; - $scope.interval = $scope.interval; - $scope.search = $scope.search || _.noop; - - let legendValueNumbers: any; - let legendCaption: any; - const debouncedSetLegendNumbers = _.debounce(setLegendNumbers, DEBOUNCE_DELAY, { - maxWait: DEBOUNCE_DELAY, - leading: true, - trailing: false, - }); - // ensure legend is the same height with or without a caption so legend items do not move around - const emptyCaption = '
'; - - const defaultOptions = { - xaxis: { - mode: 'time', - tickLength: 5, - timezone: 'browser', - }, - selection: { - mode: 'x', - color: '#ccc', - }, - crosshair: { - mode: 'x', - color: '#C66', - lineWidth: 2, - }, - grid: { - show: render.grid, - borderWidth: 0, - borderColor: null, - margin: 10, - hoverable: true, - autoHighlight: false, - }, - legend: { - backgroundColor: 'rgb(255,255,255,0)', - position: 'nw', - labelBoxBorderColor: 'rgb(255,255,255,0)', - labelFormatter(label: any, series: any) { - const wrapperSpan = document.createElement('span'); - const labelSpan = document.createElement('span'); - const numberSpan = document.createElement('span'); - - wrapperSpan.setAttribute('class', 'ngLegendValue'); - wrapperSpan.setAttribute('osd-accessible-click', ''); - wrapperSpan.setAttribute('ng-click', `toggleSeries(${series._id})`); - wrapperSpan.setAttribute('ng-focus', `focusSeries(${series._id})`); - wrapperSpan.setAttribute('ng-mouseover', `highlightSeries(${series._id})`); - - labelSpan.setAttribute('ng-non-bindable', ''); - labelSpan.appendChild(document.createTextNode(label)); - numberSpan.setAttribute('class', 'ngLegendValueNumber'); - - wrapperSpan.appendChild(labelSpan); - wrapperSpan.appendChild(numberSpan); - - return wrapperSpan.outerHTML; - }, - }, - colors: [ - '#01A4A4', - '#C66', - '#D0D102', - '#616161', - '#00A1CB', - '#32742C', - '#F18D05', - '#113F8C', - '#61AE24', - '#D70060', - ], - }; - - const originalColorMap = new Map(); - $scope.chart.forEach((series: any, seriesIndex: any) => { - if (!series.color) { - const colorIndex = seriesIndex % defaultOptions.colors.length; - series.color = defaultOptions.colors[colorIndex]; - } - originalColorMap.set(series, series.color); - }); - - let highlightedSeries: any; - let focusedSeries: any; - function unhighlightSeries() { - if (highlightedSeries === null) { - return; - } - - highlightedSeries = null; - focusedSeries = null; - $scope.chart.forEach((series: any) => { - series.color = originalColorMap.get(series); // reset the colors - }); - drawPlot($scope.chart); - } - $scope.highlightSeries = _.debounce(function (id: any) { - if (highlightedSeries === id) { - return; - } - - highlightedSeries = id; - $scope.chart.forEach((series: any, seriesIndex: any) => { - if (seriesIndex !== id) { - series.color = 'rgba(128,128,128,0.1)'; // mark as grey - } else { - series.color = originalColorMap.get(series); // color it like it was - } - }); - drawPlot($scope.chart); - }, DEBOUNCE_DELAY); - $scope.focusSeries = function (id: any) { - focusedSeries = id; - $scope.highlightSeries(id); - }; - - $scope.toggleSeries = function (id: any) { - const series = $scope.chart[id]; - series._hide = !series._hide; - drawPlot($scope.chart); - }; - - const cancelResize = observeResize($elem, function () { - drawPlot($scope.chart); - }); - - $scope.$on('$destroy', function () { - cancelResize(); - $elem.off('plothover'); - $elem.off('plotselected'); - $elem.off('mouseleave'); - }); - - $elem.on('plothover', function (event: any, pos: any, item: any) { - $rootScope.$broadcast('timelinePlotHover', event, pos, item); - }); - - $elem.on('plotselected', function (event: any, ranges: any) { - timefilter.timefilter.setTime({ - from: moment(ranges.xaxis.from), - to: moment(ranges.xaxis.to), - }); - }); - - $elem.on('mouseleave', function () { - $rootScope.$broadcast('timelinePlotLeave'); - }); - - $scope.$on('timelinePlotHover', function (angularEvent: any, flotEvent: any, pos: any) { - if (!$scope.plot) return; - $scope.plot.setCrosshair(pos); - debouncedSetLegendNumbers(pos); - }); - - $scope.$on('timelinePlotLeave', function () { - if (!$scope.plot) return; - $scope.plot.clearCrosshair(); - clearLegendNumbers(); - }); - - // Shamelessly borrowed from the flotCrosshairs example - function setLegendNumbers(pos: any) { - unhighlightSeries(); - - const plot = $scope.plot; - - const axes = plot.getAxes(); - if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max) { - return; - } - - let i; - const dataset = plot.getData(); - if (legendCaption) { - legendCaption.text( - moment(pos.x).format( - _.get(dataset, '[0]._global.legend.timeFormat', DEFAULT_TIME_FORMAT) - ) - ); - } - for (i = 0; i < dataset.length; ++i) { - const series = dataset[i]; - const useNearestPoint = series.lines.show && !series.lines.steps; - const precision = _.get(series, '_meta.precision', 2); - - if (series._hide) continue; - - const currentPoint = series.data.find((point: any, index: number) => { - if (index + 1 === series.data.length) { - return true; - } - if (useNearestPoint) { - return pos.x - point[0] < series.data[index + 1][0] - pos.x; - } else { - return pos.x < series.data[index + 1][0]; - } - }); - - const y = currentPoint[1]; - - if (y != null) { - let label = y.toFixed(precision); - if (series.yaxis.tickFormatter) { - label = series.yaxis.tickFormatter(label, series.yaxis); - } - legendValueNumbers.eq(i).text(`(${label})`); - } else { - legendValueNumbers.eq(i).empty(); - } - } - } - - function clearLegendNumbers() { - if (legendCaption) { - legendCaption.html(emptyCaption); - } - _.each(legendValueNumbers, function (num) { - $(num).empty(); - }); - } - - let legendScope = $scope.$new(); - function drawPlot(plotConfig: any) { - if (!$('.chart-canvas', $elem).length) $elem.html(template); - const canvasElem = $('.chart-canvas', $elem); - - // we can't use `$.plot` to draw the chart when the height or width is 0 - // so, we'll need another event to trigger drawPlot to actually draw it - if (canvasElem.height() === 0 || canvasElem.width() === 0) { - return; - } - - const title = _(plotConfig).map('_title').compact().last() as any; - $('.chart-top-title', $elem).text(title == null ? '' : title); - - const options = _.cloneDeep(defaultOptions) as any; - - // Get the X-axis tick format - const time = timefilter.timefilter.getBounds() as any; - const interval = calculateInterval( - time.min.valueOf(), - time.max.valueOf(), - uiSettings.get('timeline:target_buckets') || 200, - $scope.interval, - uiSettings.get('timeline:min_interval') || '1ms' - ); - const format = getxAxisFormatter(interval); - - // Use moment to format ticks so we get timezone correction - options.xaxis.tickFormatter = function (val: any) { - return moment(val).format(format); - }; - - // Calculate how many ticks can fit on the axis - const tickLetterWidth = 7; - const tickPadding = 45; - options.xaxis.ticks = Math.floor( - $elem.width() / (format.length * tickLetterWidth + tickPadding) - ); - - const series = _.map(plotConfig, function (serie: any, index) { - serie = _.cloneDeep( - _.defaults(serie, { - shadowSize: 0, - lines: { - lineWidth: 3, - }, - }) - ); - serie._id = index; - - if (serie.color) { - const span = document.createElement('span'); - span.style.color = serie.color; - serie.color = span.style.color; - } - - if (serie._hide) { - serie.data = []; - serie.stack = false; - // serie.color = "#ddd"; - serie.label = '(hidden) ' + serie.label; - } - - if (serie._global) { - _.mergeWith(options, serie._global, function (objVal, srcVal) { - // This is kind of gross, it means that you can't replace a global value with a null - // best you can do is an empty string. Deal with it. - if (objVal == null) return srcVal; - if (srcVal == null) return objVal; - }); - } - - return serie; - }); - - if (options.yaxes) { - options.yaxes.forEach((yaxis: any) => { - if (yaxis && yaxis.units) { - yaxis.tickFormatter = formatters[yaxis.units.type]; - const byteModes = ['bytes', 'bytes/s']; - if (byteModes.includes(yaxis.units.type)) { - yaxis.tickGenerator = generateTicks; - } - } - }); - } - - // @ts-ignore - $scope.plot = $.plot(canvasElem, _.compact(series), options); - - if ($scope.plot) { - $scope.$emit('timelineChartRendered'); - } - - legendScope.$destroy(); - legendScope = $scope.$new(); - // Used to toggle the series, and for displaying values on hover - legendValueNumbers = canvasElem.find('.ngLegendValueNumber'); - _.each(canvasElem.find('.ngLegendValue'), function (elem) { - $compile(elem)(legendScope); - }); - - if (_.get($scope.plot.getData(), '[0]._global.legend.showTime', true)) { - legendCaption = $(''); - legendCaption.html(emptyCaption); - canvasElem.find('div.legend table').append(legendCaption); - - // legend has been re-created. Apply focus on legend element when previously set - if (focusedSeries || focusedSeries === 0) { - const $legendLabels = canvasElem.find('div.legend table .legendLabel>span'); - $legendLabels.get(focusedSeries).focus(); - } - } - } - $scope.$watch('chart', drawPlot); - }, - }; - }; -} diff --git a/src/plugins/timeline/public/panels/timechart/timechart.ts b/src/plugins/timeline/public/panels/timechart/timechart.ts deleted file mode 100644 index 176d22e1016e..000000000000 --- a/src/plugins/timeline/public/panels/timechart/timechart.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { timechartFn } from './schema'; -import { Panel } from '../panel'; -import { TimelineVisualizationDependencies } from '../../application'; - -export function getTimeChart(dependencies: TimelineVisualizationDependencies) { - // Schema is broken out so that it may be extended for use in other plugins - // Its also easier to test. - return new Panel('timechart', timechartFn(dependencies)()); -} diff --git a/src/plugins/timeline/public/partials/load_sheet.html b/src/plugins/timeline/public/partials/load_sheet.html deleted file mode 100644 index 5e2c91e7627f..000000000000 --- a/src/plugins/timeline/public/partials/load_sheet.html +++ /dev/null @@ -1,12 +0,0 @@ -
-

- - -
diff --git a/src/plugins/timeline/public/partials/save_sheet.html b/src/plugins/timeline/public/partials/save_sheet.html deleted file mode 100644 index f2a5035a9c53..000000000000 --- a/src/plugins/timeline/public/partials/save_sheet.html +++ /dev/null @@ -1,106 +0,0 @@ -
- - -
-
- - - - - - - -
-
- - - -
-
-
- - {{opts.state.sheet[opts.state.selected]}} -
-
- - -
-
- -
-
-
-
diff --git a/src/plugins/timeline/public/partials/sheet_options.html b/src/plugins/timeline/public/partials/sheet_options.html deleted file mode 100644 index 83f0a122a987..000000000000 --- a/src/plugins/timeline/public/partials/sheet_options.html +++ /dev/null @@ -1,36 +0,0 @@ -
-

- -
-
- - -
-
- - -
-
-
diff --git a/src/plugins/timeline/public/plugin.ts b/src/plugins/timeline/public/plugin.ts deleted file mode 100644 index b6141d2c23e2..000000000000 --- a/src/plugins/timeline/public/plugin.ts +++ /dev/null @@ -1,162 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { BehaviorSubject } from 'rxjs'; -import { filter, map } from 'rxjs/operators'; -import { - CoreSetup, - CoreStart, - Plugin, - PluginInitializerContext, - DEFAULT_APP_CATEGORIES, - AppMountParameters, - AppUpdater, - ScopedHistory, - AppNavLinkStatus, -} from '../../../core/public'; -import { Panel } from './panels/panel'; -import { - initAngularBootstrap, - OpenSearchDashboardsLegacyStart, -} from '../../opensearch_dashboards_legacy/public'; -import { createOsdUrlTracker } from '../../opensearch_dashboards_utils/public'; -import { DataPublicPluginStart, opensearchFilters, DataPublicPluginSetup } from '../../data/public'; -import { NavigationPublicPluginStart } from '../../navigation/public'; -import { VisualizationsStart } from '../../visualizations/public'; -import { - VisTypeTimelinePluginStart, - VisTypeTimelinePluginSetup, -} from '../../vis_type_timeline/public'; - -export interface TimelinePluginDependencies { - data: DataPublicPluginStart; - navigation: NavigationPublicPluginStart; - visualizations: VisualizationsStart; - visTypeTimeline: VisTypeTimelinePluginStart; -} - -/** @internal */ -export class TimelinePlugin implements Plugin { - initializerContext: PluginInitializerContext; - private appStateUpdater = new BehaviorSubject(() => ({})); - private stopUrlTracking: (() => void) | undefined = undefined; - private currentHistory: ScopedHistory | undefined = undefined; - - constructor(initializerContext: PluginInitializerContext) { - this.initializerContext = initializerContext; - } - - public setup( - core: CoreSetup, - { - data, - visTypeTimeline, - }: { data: DataPublicPluginSetup; visTypeTimeline: VisTypeTimelinePluginSetup } - ) { - const timelinePanels: Map = new Map(); - - const { appMounted, appUnMounted, stop: stopUrlTracker } = createOsdUrlTracker({ - baseUrl: core.http.basePath.prepend('/app/timeline'), - defaultSubUrl: '#/', - storageKey: `lastUrl:${core.http.basePath.get()}:timeline`, - navLinkUpdater$: this.appStateUpdater, - toastNotifications: core.notifications.toasts, - stateParams: [ - { - osdUrlKey: '_g', - stateUpdate$: data.query.state$.pipe( - filter( - ({ changes }) => !!(changes.globalFilters || changes.time || changes.refreshInterval) - ), - map(({ state }) => ({ - ...state, - filters: state.filters?.filter(opensearchFilters.isFilterPinned), - })) - ), - }, - ], - getHistory: () => this.currentHistory!, - }); - - this.stopUrlTracking = () => { - stopUrlTracker(); - }; - - initAngularBootstrap(); - core.application.register({ - id: 'timelion', - title: 'Timeline', - order: 8000, - defaultPath: '#/', - euiIconType: 'inputOutput', - category: DEFAULT_APP_CATEGORIES.opensearchDashboards, - navLinkStatus: - visTypeTimeline.isUiEnabled === false ? AppNavLinkStatus.hidden : AppNavLinkStatus.default, - mount: async (params: AppMountParameters) => { - const [coreStart, pluginsStart] = await core.getStartServices(); - this.currentHistory = params.history; - - appMounted(); - - const unlistenParentHistory = params.history.listen(() => { - window.dispatchEvent(new HashChangeEvent('hashchange')); - }); - - const { renderApp } = await import('./application'); - params.element.classList.add('timelineAppContainer'); - const unmount = renderApp({ - mountParams: params, - pluginInitializerContext: this.initializerContext, - timelinePanels, - core: coreStart, - plugins: pluginsStart as TimelinePluginDependencies, - }); - return () => { - unlistenParentHistory(); - unmount(); - appUnMounted(); - }; - }, - }); - } - - public start( - core: CoreStart, - { opensearchDashboardsLegacy }: { opensearchDashboardsLegacy: OpenSearchDashboardsLegacyStart } - ) { - opensearchDashboardsLegacy.loadFontAwesome(); - } - - public stop(): void { - if (this.stopUrlTracking) { - this.stopUrlTracking(); - } - } -} diff --git a/src/plugins/timeline/public/services/_saved_sheet.ts b/src/plugins/timeline/public/services/_saved_sheet.ts deleted file mode 100644 index 06353b63388d..000000000000 --- a/src/plugins/timeline/public/services/_saved_sheet.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { IUiSettingsClient } from 'opensearch-dashboards/public'; -import { - createSavedObjectClass, - SavedObjectOpenSearchDashboardsServices, -} from '../../../saved_objects/public'; - -// Used only by the savedSheets service, usually no reason to change this -export function createSavedSheetClass( - services: SavedObjectOpenSearchDashboardsServices, - config: IUiSettingsClient -) { - const SavedObjectClass = createSavedObjectClass(services); - - class SavedSheet extends SavedObjectClass { - static type = 'timelion-sheet'; - - // if type:sheet has no mapping, we push this mapping into OpenSearch - static mapping = { - title: 'text', - hits: 'integer', - description: 'text', - timelion_sheet: 'text', - timelion_interval: 'keyword', - timelion_other_interval: 'keyword', - timelion_chart_height: 'integer', - timelion_columns: 'integer', - timelion_rows: 'integer', - version: 'integer', - }; - - // Order these fields to the top, the rest are alphabetical - static fieldOrder = ['title', 'description']; - // SavedSheet constructor. Usually you'd interact with an instance of this. - // ID is option, without it one will be generated on save. - constructor(id: string) { - super({ - type: SavedSheet.type, - mapping: SavedSheet.mapping, - - // if this is null/undefined then the SavedObject will be assigned the defaults - id, - - // default values that will get assigned if the doc is new - defaults: { - title: 'New Timeline Sheet', - hits: 0, - description: '', - timelion_sheet: ['.opensearch(*)'], - timelion_interval: 'auto', - timelion_chart_height: 275, - timelion_columns: config.get('timeline:default_columns') || 2, - timelion_rows: config.get('timeline:default_rows') || 2, - version: 1, - }, - }); - this.showInRecentlyAccessed = true; - this.getFullPath = () => `/app/timeline#/${this.id}`; - } - } - - return SavedSheet; -} diff --git a/src/plugins/timeline/public/services/saved_sheets.ts b/src/plugins/timeline/public/services/saved_sheets.ts deleted file mode 100644 index 4da4d7b9ed94..000000000000 --- a/src/plugins/timeline/public/services/saved_sheets.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { SavedObjectLoader } from '../../../saved_objects/public'; -import { createSavedSheetClass } from './_saved_sheet'; -import { RenderDeps } from '../application'; - -export function initSavedSheetService(app: angular.IModule, deps: RenderDeps) { - const savedObjectsClient = deps.core.savedObjects.client; - const services = { - savedObjectsClient, - indexPatterns: deps.plugins.data.indexPatterns, - search: deps.plugins.data.search, - chrome: deps.core.chrome, - overlays: deps.core.overlays, - }; - - const SavedSheet = createSavedSheetClass(services, deps.core.uiSettings); - - const savedSheetLoader = new SavedObjectLoader(SavedSheet, savedObjectsClient); - savedSheetLoader.urlFor = (id) => `#/${encodeURIComponent(id)}`; - // Customize loader properties since adding an 's' on type doesn't work for type 'timelion-sheet'. - savedSheetLoader.loaderProperties = { - name: 'timelion-sheet', - noun: 'Saved Sheets', - nouns: 'saved sheets', - }; - // This is the only thing that gets injected into controllers - app.service('savedSheets', function () { - return savedSheetLoader; - }); - - return savedSheetLoader; -} diff --git a/src/plugins/timeline/public/timeline_app_state.ts b/src/plugins/timeline/public/timeline_app_state.ts deleted file mode 100644 index 62487c2eba03..000000000000 --- a/src/plugins/timeline/public/timeline_app_state.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - createStateContainer, - syncState, - IOsdUrlStateStorage, -} from '../../opensearch_dashboards_utils/public'; - -import { TimelineAppState, TimelineAppStateTransitions } from './types'; - -const STATE_STORAGE_KEY = '_a'; - -interface Arguments { - osdUrlStateStorage: IOsdUrlStateStorage; - stateDefaults: TimelineAppState; -} - -export function initTimelineAppState({ stateDefaults, osdUrlStateStorage }: Arguments) { - const urlState = osdUrlStateStorage.get(STATE_STORAGE_KEY); - const initialState = { - ...stateDefaults, - ...urlState, - }; - - /* - make sure url ('_a') matches initial state - Initializing appState does two things - first it translates the defaults into AppState, - second it updates appState based on the url (the url trumps the defaults). This means if - we update the state format at all and want to handle BWC, we must not only migrate the - data stored with saved vis, but also any old state in the url. - */ - osdUrlStateStorage.set(STATE_STORAGE_KEY, initialState, { replace: true }); - - const stateContainer = createStateContainer( - initialState, - { - set: (state) => (prop, value) => ({ ...state, [prop]: value }), - updateState: (state) => (newValues) => ({ ...state, ...newValues }), - } - ); - - const { start: startStateSync, stop: stopStateSync } = syncState({ - storageKey: STATE_STORAGE_KEY, - stateContainer: { - ...stateContainer, - set: (state) => { - if (state) { - // syncState utils requires to handle incoming "null" value - stateContainer.set(state); - } - }, - }, - stateStorage: osdUrlStateStorage, - }); - - // start syncing the appState with the ('_a') url - startStateSync(); - - return { stateContainer, stopStateSync }; -} diff --git a/src/plugins/timeline/public/types.ts b/src/plugins/timeline/public/types.ts deleted file mode 100644 index c94fef3cff51..000000000000 --- a/src/plugins/timeline/public/types.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export interface TimelineAppState { - sheet: string[]; - selected: number; - columns: number; - rows: number; - interval: string; -} - -export interface TimelineAppStateTransitions { - set: ( - state: TimelineAppState - ) => (prop: T, value: TimelineAppState[T]) => TimelineAppState; - updateState: ( - state: TimelineAppState - ) => (newValues: Partial) => TimelineAppState; -} diff --git a/src/plugins/timeline/server/config.ts b/src/plugins/timeline/server/config.ts deleted file mode 100644 index b98585aaa695..000000000000 --- a/src/plugins/timeline/server/config.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { schema, TypeOf } from '@osd/config-schema'; - -export const configSchema = { - schema: schema.object({ - graphiteUrls: schema.maybe(schema.arrayOf(schema.string())), - enabled: schema.boolean({ defaultValue: true }), - ui: schema.object({ - enabled: schema.boolean({ defaultValue: true }), - }), - }), -}; - -export type TimelineConfigType = TypeOf; diff --git a/src/plugins/timeline/server/index.ts b/src/plugins/timeline/server/index.ts deleted file mode 100644 index 9b26a79d3a11..000000000000 --- a/src/plugins/timeline/server/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server'; -import { TimelinePlugin } from './plugin'; -import { configSchema, TimelineConfigType } from './config'; - -export const config: PluginConfigDescriptor = { - schema: configSchema.schema, -}; - -export const plugin = (context: PluginInitializerContext) => - new TimelinePlugin(context); diff --git a/src/plugins/timeline/server/plugin.ts b/src/plugins/timeline/server/plugin.ts deleted file mode 100644 index 2aa14e7dab57..000000000000 --- a/src/plugins/timeline/server/plugin.ts +++ /dev/null @@ -1,114 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { CoreSetup, CoreStart, Plugin, PluginInitializerContext, Logger } from 'src/core/server'; -import { i18n } from '@osd/i18n'; -import { schema } from '@osd/config-schema'; -import { TimelineConfigType } from './config'; -import { timelineSheetSavedObjectType } from './saved_objects'; - -/** - * Deprecated since 7.0, the Timeline app will be removed in 8.0. - * To continue using your Timeline worksheets, migrate them to a dashboard. - **/ -const showWarningMessageIfTimelineSheetWasFound = (core: CoreStart, logger: Logger) => { - const { savedObjects } = core; - const savedObjectsClient = savedObjects.createInternalRepository(); - - savedObjectsClient - .find({ - type: 'timelion-sheet', - perPage: 1, - }) - .then( - ({ total }) => - total && - logger.warn( - 'Deprecated since 7.0, the Timeline app will be removed in 8.0. To continue using your Timeline worksheets, migrate them to a dashboard.' - ) - ); -}; - -export class TimelinePlugin implements Plugin { - private logger: Logger; - - constructor(context: PluginInitializerContext) { - this.logger = context.logger.get(); - } - - public setup(core: CoreSetup) { - core.capabilities.registerProvider(() => ({ - timelion: { - save: true, - }, - })); - core.savedObjects.registerType(timelineSheetSavedObjectType); - - core.uiSettings.register({ - 'timeline:showTutorial': { - name: i18n.translate('timeline.uiSettings.showTutorialLabel', { - defaultMessage: 'Show tutorial', - }), - value: false, - description: i18n.translate('timeline.uiSettings.showTutorialDescription', { - defaultMessage: 'Should I show the tutorial by default when entering the timeline app?', - }), - category: ['timeline'], - schema: schema.boolean(), - }, - 'timeline:default_columns': { - name: i18n.translate('timeline.uiSettings.defaultColumnsLabel', { - defaultMessage: 'Default columns', - }), - value: 2, - description: i18n.translate('timeline.uiSettings.defaultColumnsDescription', { - defaultMessage: 'Number of columns on a timeline sheet by default', - }), - category: ['timeline'], - schema: schema.number(), - }, - 'timeline:default_rows': { - name: i18n.translate('timeline.uiSettings.defaultRowsLabel', { - defaultMessage: 'Default rows', - }), - value: 2, - description: i18n.translate('timeline.uiSettings.defaultRowsDescription', { - defaultMessage: 'Number of rows on a timeline sheet by default', - }), - category: ['timeline'], - schema: schema.number(), - }, - }); - } - start(core: CoreStart) { - showWarningMessageIfTimelineSheetWasFound(core, this.logger); - } - stop() {} -} diff --git a/src/plugins/timeline/server/saved_objects/index.ts b/src/plugins/timeline/server/saved_objects/index.ts deleted file mode 100644 index f0546d981aff..000000000000 --- a/src/plugins/timeline/server/saved_objects/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { timelineSheetSavedObjectType } from './timeline_sheet'; diff --git a/src/plugins/timeline/server/saved_objects/timeline_sheet.ts b/src/plugins/timeline/server/saved_objects/timeline_sheet.ts deleted file mode 100644 index 878a4d542db5..000000000000 --- a/src/plugins/timeline/server/saved_objects/timeline_sheet.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { SavedObjectsType } from 'opensearch-dashboards/server'; - -export const timelineSheetSavedObjectType: SavedObjectsType = { - name: 'timelion-sheet', - hidden: false, - namespaceType: 'single', - mappings: { - properties: { - description: { type: 'text' }, - hits: { type: 'integer' }, - kibanaSavedObjectMeta: { - properties: { - searchSourceJSON: { type: 'text' }, - }, - }, - timelion_chart_height: { type: 'integer' }, - timelion_columns: { type: 'integer' }, - timelion_interval: { type: 'keyword' }, - timelion_other_interval: { type: 'keyword' }, - timelion_rows: { type: 'integer' }, - timelion_sheet: { type: 'text' }, - title: { type: 'text' }, - version: { type: 'integer' }, - }, - }, -}; diff --git a/src/plugins/vis_type_timeline/config.ts b/src/plugins/vis_type_timeline/config.ts index 2d566ed390bd..07c0df4953dc 100644 --- a/src/plugins/vis_type_timeline/config.ts +++ b/src/plugins/vis_type_timeline/config.ts @@ -30,15 +30,10 @@ import { schema, TypeOf } from '@osd/config-schema'; -export const configSchema = schema.object( - { - enabled: schema.boolean({ defaultValue: true }), - ui: schema.object({ enabled: schema.boolean({ defaultValue: false }) }), - graphiteAllowedUrls: schema.maybe(schema.arrayOf(schema.string())), - graphiteBlockedIPs: schema.maybe(schema.arrayOf(schema.string())), - }, - // This option should be removed as soon as we entirely migrate config from legacy Timeline plugin. - { unknowns: 'allow' } -); +export const configSchema = schema.object({ + enabled: schema.boolean({ defaultValue: true }), + graphiteAllowedUrls: schema.maybe(schema.arrayOf(schema.string())), + graphiteBlockedIPs: schema.maybe(schema.arrayOf(schema.string())), +}); export type ConfigSchema = TypeOf; diff --git a/src/plugins/vis_type_timeline/public/plugin.ts b/src/plugins/vis_type_timeline/public/plugin.ts index a27c9bc783ea..92d466da56a5 100644 --- a/src/plugins/vis_type_timeline/public/plugin.ts +++ b/src/plugins/vis_type_timeline/public/plugin.ts @@ -77,16 +77,11 @@ export interface VisTypeTimelinePluginStart { getArgValueSuggestions: typeof getArgValueSuggestions; } -/** @public */ -export interface VisTypeTimelinePluginSetup { - isUiEnabled: boolean; -} - /** @internal */ export class TimelineVisPlugin implements Plugin< - VisTypeTimelinePluginSetup, + void, VisTypeTimelinePluginStart, TimelineVisSetupDependencies, TimelineVisStartDependencies @@ -106,10 +101,6 @@ export class TimelineVisPlugin expressions.registerFunction(() => getTimelineVisualizationConfig(dependencies)); expressions.registerRenderer(getTimelineVisRenderer(dependencies)); visualizations.createBaseVisualization(getTimelineVisDefinition(dependencies)); - - return { - isUiEnabled: this.initializerContext.config.get().ui.enabled, - }; } public start(core: CoreStart, plugins: TimelineVisStartDependencies) { diff --git a/src/plugins/vis_type_timeline/server/index.ts b/src/plugins/vis_type_timeline/server/index.ts index 9be2c2083414..3e41475bb8bb 100644 --- a/src/plugins/vis_type_timeline/server/index.ts +++ b/src/plugins/vis_type_timeline/server/index.ts @@ -32,13 +32,8 @@ import { PluginConfigDescriptor, PluginInitializerContext } from '../../../core/ import { configSchema, ConfigSchema } from '../config'; import { Plugin } from './plugin'; -export { PluginSetupContract } from './plugin'; - export const config: PluginConfigDescriptor = { schema: configSchema, - exposeToBrowser: { - ui: true, - }, deprecations: ({ renameFromRoot, renameFromRootWithoutMap }) => [ // timelion.enabled and timelion_vis.enabled deprecation renameFromRoot('timelion.enabled', 'vis_type_timeline.enabled'), diff --git a/src/plugins/vis_type_timeline/server/plugin.ts b/src/plugins/vis_type_timeline/server/plugin.ts index 88b33536bd99..d2c7097ac419 100644 --- a/src/plugins/vis_type_timeline/server/plugin.ts +++ b/src/plugins/vis_type_timeline/server/plugin.ts @@ -47,13 +47,6 @@ const experimentalLabel = i18n.translate('timeline.uiSettings.experimentalLabel' defaultMessage: 'experimental', }); -/** - * Describes public Timeline plugin contract returned at the `setup` stage. - */ -export interface PluginSetupContract { - uiEnabled: boolean; -} - export interface TimelinePluginStartDeps { data: PluginStart; } @@ -64,7 +57,7 @@ export interface TimelinePluginStartDeps { export class Plugin { constructor(private readonly initializerContext: PluginInitializerContext) {} - public async setup(core: CoreSetup): Promise> { + public async setup(core: CoreSetup): void { const config = await this.initializerContext.config .create>() .pipe(first()) @@ -193,8 +186,6 @@ export class Plugin { schema: schema.string(), }, }); - - return deepFreeze({ uiEnabled: config.ui.enabled }); } public start() { diff --git a/test/api_integration/fixtures/opensearch_archiver/index_patterns/basic_opensearch_dashboards/mappings.json b/test/api_integration/fixtures/opensearch_archiver/index_patterns/basic_opensearch_dashboards/mappings.json index c357464ef7ad..df28b3f143eb 100644 --- a/test/api_integration/fixtures/opensearch_archiver/index_patterns/basic_opensearch_dashboards/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/index_patterns/basic_opensearch_dashboards/mappings.json @@ -146,47 +146,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "namespace": { "type": "keyword" }, diff --git a/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/relationships/mappings.json b/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/relationships/mappings.json index f12e6a07b7e1..0f850ee15352 100644 --- a/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/relationships/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/relationships/mappings.json @@ -179,47 +179,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -280,4 +239,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/search/mappings.json b/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/search/mappings.json index f12e6a07b7e1..0f850ee15352 100644 --- a/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/search/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/management/saved_objects/search/mappings.json @@ -179,47 +179,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -280,4 +239,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/api_integration/fixtures/opensearch_archiver/saved_objects/10k/mappings.json b/test/api_integration/fixtures/opensearch_archiver/saved_objects/10k/mappings.json index c357464ef7ad..df28b3f143eb 100644 --- a/test/api_integration/fixtures/opensearch_archiver/saved_objects/10k/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/saved_objects/10k/mappings.json @@ -146,47 +146,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "namespace": { "type": "keyword" }, diff --git a/test/api_integration/fixtures/opensearch_archiver/saved_objects/basic/mappings.json b/test/api_integration/fixtures/opensearch_archiver/saved_objects/basic/mappings.json index 5777475bbfc4..df28b3f143eb 100644 --- a/test/api_integration/fixtures/opensearch_archiver/saved_objects/basic/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/saved_objects/basic/mappings.json @@ -146,47 +146,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "namespace": { "type": "keyword" }, @@ -250,4 +209,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/api_integration/fixtures/opensearch_archiver/saved_objects/find_edgecases/mappings.json b/test/api_integration/fixtures/opensearch_archiver/saved_objects/find_edgecases/mappings.json index 5bfb286b5ea6..7ff2743fc4a6 100644 --- a/test/api_integration/fixtures/opensearch_archiver/saved_objects/find_edgecases/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/saved_objects/find_edgecases/mappings.json @@ -146,47 +146,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "namespace": { "type": "keyword" }, diff --git a/test/api_integration/fixtures/opensearch_archiver/search/count/mappings.json b/test/api_integration/fixtures/opensearch_archiver/search/count/mappings.json index da1e59e86d90..d9638ae749a4 100644 --- a/test/api_integration/fixtures/opensearch_archiver/search/count/mappings.json +++ b/test/api_integration/fixtures/opensearch_archiver/search/count/mappings.json @@ -36,48 +36,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "visualization": { "dynamic": "strict", "properties": { @@ -293,4 +251,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/apps/dashboard/dashboard_filtering.js b/test/functional/apps/dashboard/dashboard_filtering.js index deb2ae399240..b3ff62c8b9da 100644 --- a/test/functional/apps/dashboard/dashboard_filtering.js +++ b/test/functional/apps/dashboard/dashboard_filtering.js @@ -126,11 +126,6 @@ export default function ({ getService, getPageObjects }) { await dashboardExpect.savedSearchRowCount(0); }); - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timeline is filtered', async () => { - // await dashboardExpect.timelineLegendCount(0); - // }); - it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); }); @@ -179,11 +174,6 @@ export default function ({ getService, getPageObjects }) { await dashboardExpect.savedSearchRowCount(0); }); - // TODO: Uncomment once https://github.com/elastic/kibana/issues/22561 is fixed - // it('timeline is filtered', async () => { - // await dashboardExpect.timelineLegendCount(0); - // }); - it('vega is filtered', async () => { await dashboardExpect.vegaTextsDoNotExist(['5,000']); }); diff --git a/test/functional/apps/timeline/_expression_typeahead.js b/test/functional/apps/timeline/_expression_typeahead.js deleted file mode 100644 index 5e395ec28a71..000000000000 --- a/test/functional/apps/timeline/_expression_typeahead.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import expect from '@osd/expect'; - -export default function ({ getPageObjects }) { - const PageObjects = getPageObjects(['common', 'timeline', 'settings', 'timePicker']); - - describe('expression typeahead', () => { - before(async () => { - await PageObjects.timeline.initTests(); - await PageObjects.timePicker.setDefaultAbsoluteRange(); - }); - - it('should display function suggestions filtered by function name', async () => { - await PageObjects.timeline.setExpression('.opensearch'); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(1); - expect(suggestions[0].includes('.opensearch()')).to.eql(true); - }); - - it('should show argument suggestions when function suggestion is selected', async () => { - await PageObjects.timeline.setExpression('.opensearch'); - await PageObjects.timeline.clickSuggestion(); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(10); - expect(suggestions[0].includes('fit=')).to.eql(true); - }); - - it('should show argument value suggestions when argument is selected', async () => { - await PageObjects.timeline.setExpression('.legend'); - await PageObjects.timeline.clickSuggestion(); - const argumentSuggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(argumentSuggestions.length).to.eql(4); - expect(argumentSuggestions[1].includes('position=')).to.eql(true); - await PageObjects.timeline.clickSuggestion(1); - const valueSuggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(valueSuggestions.length).to.eql(5); - expect(valueSuggestions[0].includes('disable legend')).to.eql(true); - expect(valueSuggestions[1].includes('place legend in north east corner')).to.eql(true); - }); - - // TODO: [RENAMEME] the index is not being loaded with the default data. - // While navigating creating an index pattern this would works. - // Need to fix why it's not loading prior to text run. - xdescribe('dynamic suggestions for argument values', () => { - describe('.opensearch()', () => { - before(async () => { - await PageObjects.timeline.setExpression('.opensearch'); - await PageObjects.timeline.clickSuggestion(); - }); - - it('should show index pattern suggestions for index argument', async () => { - await PageObjects.timeline.updateExpression('index'); - await PageObjects.timeline.clickSuggestion(); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(1); - expect(suggestions[0].includes('logstash-*')).to.eql(true); - await PageObjects.timeline.clickSuggestion(); - }); - - it('should show field suggestions for timefield argument when index pattern set', async () => { - await PageObjects.timeline.updateExpression(',timefield'); - await PageObjects.timeline.clickSuggestion(); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(4); - expect(suggestions[0].includes('@timestamp')).to.eql(true); - await PageObjects.timeline.clickSuggestion(); - }); - - it('should show field suggestions for split argument when index pattern set', async () => { - await PageObjects.timeline.updateExpression(',split'); - await PageObjects.timeline.clickSuggestion(); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(52); - expect(suggestions[0].includes('@message.raw')).to.eql(true); - await PageObjects.timeline.clickSuggestion(10); - }); - - it('should show field suggestions for metric argument when index pattern set', async () => { - await PageObjects.timeline.updateExpression(',metric'); - await PageObjects.timeline.clickSuggestion(); - await PageObjects.timeline.updateExpression('avg:'); - await PageObjects.timeline.clickSuggestion(); - const suggestions = await PageObjects.timeline.getSuggestionItemsText(); - expect(suggestions.length).to.eql(2); - expect(suggestions[0].includes('avg:bytes')).to.eql(true); - }); - }); - }); - }); -} diff --git a/test/functional/apps/timeline/index.js b/test/functional/apps/timeline/index.js deleted file mode 100644 index d89ffce2eda7..000000000000 --- a/test/functional/apps/timeline/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export default function ({ getService, loadTestFile }) { - const browser = getService('browser'); - const log = getService('log'); - const opensearchArchiver = getService('opensearchArchiver'); - const opensearchDashboardsServer = getService('opensearchDashboardsServer'); - - describe('timeline app', function () { - this.tags('ciGroup1'); - - before(async function () { - log.debug('Starting timeline before method'); - await browser.setWindowSize(1280, 800); - await opensearchArchiver.loadIfNeeded('logstash_functional'); - await opensearchDashboardsServer.uiSettings.replace({ defaultIndex: 'logstash-*' }); - }); - - loadTestFile(require.resolve('./_expression_typeahead')); - }); -} diff --git a/test/functional/config.js b/test/functional/config.js index 9485225dc8ca..d927aea2966f 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -46,7 +46,6 @@ export default async function ({ readConfigFile }) { require.resolve('./apps/management'), require.resolve('./apps/saved_objects_management'), require.resolve('./apps/status_page'), - require.resolve('./apps/timeline'), require.resolve('./apps/visualize'), require.resolve('./apps/vis_builder'), ], @@ -107,9 +106,6 @@ export default async function ({ readConfigFile }) { settings: { pathname: '/app/management', }, - timeline: { - pathname: '/app/timeline', - }, console: { pathname: '/app/dev_tools', hash: '/console', diff --git a/test/functional/fixtures/opensearch_archiver/dashboard/current/opensearch_dashboards/mappings.json b/test/functional/fixtures/opensearch_archiver/dashboard/current/opensearch_dashboards/mappings.json index 8ba03cf35876..c7fb3a03d629 100644 --- a/test/functional/fixtures/opensearch_archiver/dashboard/current/opensearch_dashboards/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/dashboard/current/opensearch_dashboards/mappings.json @@ -23,7 +23,6 @@ "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", "search": "181661168bbadd1eff5902361e2a0d5c", "telemetry": "36a616f7026dfa617d6655df850fe16d", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", "tsvb-validation-telemetry": "3a37ef6c8700ae6fc97d5c7da00e9215", "type": "2f4316de49999235636386fe51dc06c1", "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", @@ -366,47 +365,6 @@ } } }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "tsvb-validation-telemetry": { "properties": { "failedRequests": { @@ -487,4 +445,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/dashboard/legacy/mappings.json b/test/functional/fixtures/opensearch_archiver/dashboard/legacy/mappings.json index 9ca92fc2b55d..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/dashboard/legacy/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/dashboard/legacy/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/discover/mappings.json b/test/functional/fixtures/opensearch_archiver/discover/mappings.json index 2f24917b04fc..df2768093b7e 100644 --- a/test/functional/fixtures/opensearch_archiver/discover/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/discover/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, diff --git a/test/functional/fixtures/opensearch_archiver/empty_opensearch_dashboards/mappings.json b/test/functional/fixtures/opensearch_archiver/empty_opensearch_dashboards/mappings.json index a3a005fe8075..ad23c9028344 100644 --- a/test/functional/fixtures/opensearch_archiver/empty_opensearch_dashboards/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/empty_opensearch_dashboards/mappings.json @@ -143,48 +143,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, diff --git a/test/functional/fixtures/opensearch_archiver/hamlet/mappings.json b/test/functional/fixtures/opensearch_archiver/hamlet/mappings.json index 396bbadc30ba..d50b6c58bf99 100644 --- a/test/functional/fixtures/opensearch_archiver/hamlet/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/hamlet/mappings.json @@ -19,7 +19,6 @@ "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", "search": "181661168bbadd1eff5902361e2a0d5c", "server": "ec97f1c5da1a19609a60874e5af1100c", - "timeline-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", "type": "2f4316de49999235636386fe51dc06c1", "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", "updated_at": "00da57df13e94e9d98437d13ace4bfe0", @@ -230,47 +229,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -373,4 +331,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/invalid_scripted_field/mappings.json b/test/functional/fixtures/opensearch_archiver/invalid_scripted_field/mappings.json index 592b4cde4751..19c0d074f96d 100644 --- a/test/functional/fixtures/opensearch_archiver/invalid_scripted_field/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/invalid_scripted_field/mappings.json @@ -140,47 +140,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -247,4 +206,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/management/mappings.json b/test/functional/fixtures/opensearch_archiver/management/mappings.json index 9ca92fc2b55d..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/management/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/management/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/mgmt/mappings.json b/test/functional/fixtures/opensearch_archiver/mgmt/mappings.json index c7c440ac42e8..35948f59d0e8 100644 --- a/test/functional/fixtures/opensearch_archiver/mgmt/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/mgmt/mappings.json @@ -171,47 +171,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -279,4 +238,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/opensearch_dashboards_sample_data_flights_index_pattern/mappings.json b/test/functional/fixtures/opensearch_archiver/opensearch_dashboards_sample_data_flights_index_pattern/mappings.json index e404d68391c8..2f7eaf05472c 100644 --- a/test/functional/fixtures/opensearch_archiver/opensearch_dashboards_sample_data_flights_index_pattern/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/opensearch_dashboards_sample_data_flights_index_pattern/mappings.json @@ -19,7 +19,6 @@ "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", "search": "181661168bbadd1eff5902361e2a0d5c", "server": "ec97f1c5da1a19609a60874e5af1100c", - "timeline-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", "type": "2f4316de49999235636386fe51dc06c1", "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", "updated_at": "00da57df13e94e9d98437d13ace4bfe0", @@ -245,47 +244,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -461,4 +419,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/saved_objects_imports/mappings.json b/test/functional/fixtures/opensearch_archiver/saved_objects_imports/mappings.json index 9ca92fc2b55d..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/saved_objects_imports/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/saved_objects_imports/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/saved_objects_management/edit_saved_object/mappings.json b/test/functional/fixtures/opensearch_archiver/saved_objects_management/edit_saved_object/mappings.json index 3c2fcb67bd57..b2a66e47c403 100644 --- a/test/functional/fixtures/opensearch_archiver/saved_objects_management/edit_saved_object/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/saved_objects_management/edit_saved_object/mappings.json @@ -355,47 +355,6 @@ } } }, - "timeline-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -456,4 +415,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/timeline/mappings.json b/test/functional/fixtures/opensearch_archiver/timeline/mappings.json index 561ed8b85848..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/timeline/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/timeline/mappings.json @@ -134,48 +134,6 @@ } } }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/visualize/mappings.json b/test/functional/fixtures/opensearch_archiver/visualize/mappings.json index f93bab96c263..4046784ca4be 100644 --- a/test/functional/fixtures/opensearch_archiver/visualize/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/visualize/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, diff --git a/test/functional/fixtures/opensearch_archiver/visualize_embedding/mappings.json b/test/functional/fixtures/opensearch_archiver/visualize_embedding/mappings.json index 9ca92fc2b55d..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/visualize_embedding/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/visualize_embedding/mappings.json @@ -134,48 +134,6 @@ } } }, - "timeline-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timeline_chart_height": { - "type": "integer" - }, - "timeline_columns": { - "type": "integer" - }, - "timeline_interval": { - "type": "keyword" - }, - "timeline_other_interval": { - "type": "keyword" - }, - "timeline_rows": { - "type": "integer" - }, - "timeline_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/visualize_source-filters/mappings.json b/test/functional/fixtures/opensearch_archiver/visualize_source-filters/mappings.json index a89fe1dfacfc..afeb0422eb97 100644 --- a/test/functional/fixtures/opensearch_archiver/visualize_source-filters/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/visualize_source-filters/mappings.json @@ -134,48 +134,6 @@ } } }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -241,4 +199,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/fixtures/opensearch_archiver/visualize_source_filters/mappings.json b/test/functional/fixtures/opensearch_archiver/visualize_source_filters/mappings.json index 0f17621dbf52..b85e54477f8e 100644 --- a/test/functional/fixtures/opensearch_archiver/visualize_source_filters/mappings.json +++ b/test/functional/fixtures/opensearch_archiver/visualize_source_filters/mappings.json @@ -152,48 +152,6 @@ } } }, - "timelion-sheet": { - "dynamic": "strict", - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "type": { "type": "keyword" }, @@ -259,4 +217,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/functional/page_objects/index.ts b/test/functional/page_objects/index.ts index 63cd990c445b..2820f33a226f 100644 --- a/test/functional/page_objects/index.ts +++ b/test/functional/page_objects/index.ts @@ -41,7 +41,6 @@ import { SettingsPageProvider } from './settings_page'; import { SharePageProvider } from './share_page'; import { LoginPageProvider } from './login_page'; import { TimePickerProvider } from './time_picker'; -import { TimelinePageProvider } from './timeline_page'; import { VisualBuilderPageProvider } from './visual_builder_page'; import { VisualizePageProvider } from './visualize_page'; import { VisBuilderPageProvider } from './vis_builder_page'; @@ -65,7 +64,6 @@ export const pageObjects = { settings: SettingsPageProvider, share: SharePageProvider, login: LoginPageProvider, - timeline: TimelinePageProvider, timePicker: TimePickerProvider, visualBuilder: VisualBuilderPageProvider, visualize: VisualizePageProvider, diff --git a/test/functional/page_objects/timeline_page.ts b/test/functional/page_objects/timeline_page.ts deleted file mode 100644 index ee89665e4c01..000000000000 --- a/test/functional/page_objects/timeline_page.ts +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Any modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { FtrProviderContext } from '../ftr_provider_context'; - -export function TimelinePageProvider({ getService, getPageObjects }: FtrProviderContext) { - const testSubjects = getService('testSubjects'); - const log = getService('log'); - const PageObjects = getPageObjects(['common', 'header']); - const opensearchArchiver = getService('opensearchArchiver'); - const opensearchDashboardsServer = getService('opensearchDashboardsServer'); - - class TimelinePage { - public async initTests() { - await opensearchDashboardsServer.uiSettings.replace({ - defaultIndex: 'logstash-*', - }); - - log.debug('load opensearch-dashboards index'); - await opensearchArchiver.load('timeline'); - - await PageObjects.common.navigateToApp('timelion'); - } - - public async setExpression(expression: string) { - const input = await testSubjects.find('timelineExpressionTextArea'); - await input.clearValue(); - await input.type(expression); - } - - public async updateExpression(updates: string) { - const input = await testSubjects.find('timelineExpressionTextArea'); - await input.type(updates); - await PageObjects.common.sleep(1000); - } - - public async getExpression() { - const input = await testSubjects.find('timelineExpressionTextArea'); - return input.getVisibleText(); - } - - public async getSuggestionItemsText() { - const elements = await testSubjects.findAll('timelineSuggestionListItem'); - return await Promise.all(elements.map(async (element) => await element.getVisibleText())); - } - - public async clickSuggestion(suggestionIndex = 0, waitTime = 1000) { - const elements = await testSubjects.findAll('timelineSuggestionListItem'); - if (suggestionIndex > elements.length) { - throw new Error( - `Unable to select suggestion ${suggestionIndex}, only ${elements.length} suggestions available.` - ); - } - await elements[suggestionIndex].click(); - // Wait for timeline expression to be updated after clicking suggestions - await PageObjects.common.sleep(waitTime); - } - - public async saveTimelineSheet() { - await testSubjects.click('timelineSaveButton'); - await testSubjects.click('timelineSaveAsSheetButton'); - await testSubjects.click('timelineFinishSaveButton'); - await testSubjects.existOrFail('timelineSaveSuccessToast'); - await testSubjects.waitForDeleted('timelineSaveSuccessToast'); - } - - public async expectWriteControls() { - await testSubjects.existOrFail('timelineSaveButton'); - await testSubjects.existOrFail('timelineDeleteButton'); - } - - public async expectMissingWriteControls() { - await testSubjects.missingOrFail('timelineSaveButton'); - await testSubjects.missingOrFail('timelineDeleteButton'); - } - } - - return new TimelinePage(); -} diff --git a/test/new_visualize_flow/fixtures/opensearch_archiver/opensearch_dashboards/mappings.json b/test/new_visualize_flow/fixtures/opensearch_archiver/opensearch_dashboards/mappings.json index 8ba03cf35876..c7fb3a03d629 100644 --- a/test/new_visualize_flow/fixtures/opensearch_archiver/opensearch_dashboards/mappings.json +++ b/test/new_visualize_flow/fixtures/opensearch_archiver/opensearch_dashboards/mappings.json @@ -23,7 +23,6 @@ "sample-data-telemetry": "7d3cfeb915303c9641c59681967ffeb4", "search": "181661168bbadd1eff5902361e2a0d5c", "telemetry": "36a616f7026dfa617d6655df850fe16d", - "timelion-sheet": "9a2a2748877c7a7b582fef201ab1d4cf", "tsvb-validation-telemetry": "3a37ef6c8700ae6fc97d5c7da00e9215", "type": "2f4316de49999235636386fe51dc06c1", "ui-metric": "0d409297dc5ebe1e3a1da691c6ee32e3", @@ -366,47 +365,6 @@ } } }, - "timelion-sheet": { - "properties": { - "description": { - "type": "text" - }, - "hits": { - "type": "integer" - }, - "kibanaSavedObjectMeta": { - "properties": { - "searchSourceJSON": { - "type": "text" - } - } - }, - "timelion_chart_height": { - "type": "integer" - }, - "timelion_columns": { - "type": "integer" - }, - "timelion_interval": { - "type": "keyword" - }, - "timelion_other_interval": { - "type": "keyword" - }, - "timelion_rows": { - "type": "integer" - }, - "timelion_sheet": { - "type": "text" - }, - "title": { - "type": "text" - }, - "version": { - "type": "integer" - } - } - }, "tsvb-validation-telemetry": { "properties": { "failedRequests": { @@ -487,4 +445,4 @@ } } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index 314abbd49c56..26eebe266e0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4266,11 +4266,6 @@ angular-sanitize@^1.8.0: resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.8.2.tgz#ae78040f00c5e2ce1c63780bcc47fa14a1698296" integrity sha512-OB6Goa+QN3byf5asQ7XRl7DKZejm/F/ZOqa9z1skqYVOWA2hoBxoCmt9E7+i7T/TbxZP5zYzKxNZVVJNu860Hg== -angular-sortable-view@^0.0.17: - version "0.0.17" - resolved "https://registry.yarnpkg.com/angular-sortable-view/-/angular-sortable-view-0.0.17.tgz#99e2679951a86b6ee6ff27b099022943c683fb4f" - integrity sha512-2WkhM0Lt/wyMyrX/+7ve9ejSegBd7A4eRBNHEIJz8XMBIOjt+3oM1WpcAm+qNThkmNmmQaDeaYv0TQZw/WDMBw== - angular@>=1.0.6, angular@^1.8.2: version "1.8.2" resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.2.tgz#5983bbb5a9fa63e213cb7749199e0d352de3a2f1"