From ae8c4df43e4871cb21e05b7a46d5760645f25d85 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 2 Apr 2020 11:49:29 +0300 Subject: [PATCH 001/134] Move visualize plugin to np --- src/legacy/core_plugins/kibana/index.js | 1 - .../core_plugins/kibana/public/kibana.js | 1 - .../kibana/public/visualize/_index.scss | 2 - .../kibana/public/visualize/legacy.ts | 28 -------- .../kibana/public/visualize/legacy_imports.ts | 36 ---------- .../public/default_editor.tsx | 2 +- .../public/default_editor_controller.tsx | 2 +- src/legacy/ui/public/_index.scss | 6 -- src/plugins/dashboard/public/index.ts | 1 + src/plugins/visualize/kibana.json | 17 +++++ .../public/application}/application.ts | 8 ++- .../public/application}/breadcrumbs.ts | 0 .../public/application}/editor/_editor.scss | 0 .../public/application}/editor/_index.scss | 0 .../public/application}/editor/editor.html | 0 .../public/application}/editor/editor.js | 23 +++---- .../public/application}/editor/lib/index.ts | 0 .../application}/editor/lib/make_stateful.ts | 4 +- .../editor/lib/migrate_app_state.ts | 0 .../editor/lib/url_helper.test.ts | 9 --- .../application}/editor/lib/url_helper.ts | 3 +- .../editor/lib/visualize_app_state.ts | 2 +- .../application}/editor/visualization.js | 0 .../editor/visualization_editor.js | 0 .../application}/help_menu/help_menu_util.js | 0 .../visualize/public/application/index.scss} | 0 .../public/application}/legacy_app.js | 4 +- .../public/application}/listing/_index.scss | 0 .../public/application}/listing/_listing.scss | 0 .../listing/visualize_listing.html | 0 .../application}/listing/visualize_listing.js | 2 +- .../listing/visualize_listing_table.js | 2 +- .../visualize/public/application/types.ts} | 11 ++- .../public/application}/visualize_app.ts | 0 .../application}/visualize_constants.ts | 0 .../visualize/public}/index.ts | 5 +- .../visualize/public}/kibana_services.ts | 23 ++++--- .../visualize/public}/plugin.ts | 67 +++++++++---------- .../dashboard/create_and_add_embeddables.js | 2 +- .../apps/dashboard/panel_controls.js | 2 +- .../functional/page_objects/visualize_page.ts | 2 +- .../feature_controls/visualize_spaces.ts | 2 +- 42 files changed, 97 insertions(+), 170 deletions(-) delete mode 100644 src/legacy/core_plugins/kibana/public/visualize/_index.scss delete mode 100644 src/legacy/core_plugins/kibana/public/visualize/legacy.ts delete mode 100644 src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts create mode 100644 src/plugins/visualize/kibana.json rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/application.ts (95%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/breadcrumbs.ts (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/_editor.scss (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/editor.html (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/editor.js (97%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/make_stateful.ts (91%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/migrate_app_state.ts (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/url_helper.test.ts (88%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/url_helper.ts (92%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/lib/visualize_app_state.ts (98%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/visualization.js (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/editor/visualization_editor.js (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/help_menu/help_menu_util.js (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready/_index.scss => plugins/visualize/public/application/index.scss} (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/legacy_app.js (98%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/listing/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/listing/_listing.scss (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/listing/visualize_listing.html (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/listing/visualize_listing.js (98%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/listing/visualize_listing_table.js (98%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts => plugins/visualize/public/application/types.ts} (84%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/visualize_app.ts (100%) rename src/{legacy/core_plugins/kibana/public/visualize/np_ready => plugins/visualize/public/application}/visualize_constants.ts (100%) rename src/{legacy/core_plugins/kibana/public/visualize => plugins/visualize/public}/index.ts (82%) rename src/{legacy/core_plugins/kibana/public/visualize => plugins/visualize/public}/kibana_services.ts (77%) rename src/{legacy/core_plugins/kibana/public/visualize => plugins/visualize/public}/plugin.ts (77%) diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index cac9ef30fba4f5..0c0734626c4e1a 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -57,7 +57,6 @@ export default function(kibana) { hacks: [ 'plugins/kibana/discover/legacy', 'plugins/kibana/dev_tools', - 'plugins/kibana/visualize/legacy', 'plugins/kibana/dashboard/legacy', ], app: { diff --git a/src/legacy/core_plugins/kibana/public/kibana.js b/src/legacy/core_plugins/kibana/public/kibana.js index df6b08ef765569..b789d3ef90887f 100644 --- a/src/legacy/core_plugins/kibana/public/kibana.js +++ b/src/legacy/core_plugins/kibana/public/kibana.js @@ -43,7 +43,6 @@ import 'uiExports/interpreter'; import 'ui/autoload/all'; import './discover/legacy'; -import './visualize/legacy'; import './dashboard/legacy'; import './management'; import './dev_tools'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/_index.scss b/src/legacy/core_plugins/kibana/public/visualize/_index.scss deleted file mode 100644 index 0632831578bd01..00000000000000 --- a/src/legacy/core_plugins/kibana/public/visualize/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -// Visualize plugin styles -@import 'np_ready/index'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/legacy.ts b/src/legacy/core_plugins/kibana/public/visualize/legacy.ts deleted file mode 100644 index 4ef2c936897141..00000000000000 --- a/src/legacy/core_plugins/kibana/public/visualize/legacy.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 'kibana/public'; -import { npSetup, npStart } from 'ui/new_platform'; -import { plugin } from './index'; - -const instance = plugin({ - env: npSetup.plugins.kibanaLegacy.env, -} as PluginInitializerContext); -instance.setup(npSetup.core, npSetup.plugins); -instance.start(npStart.core, npStart.plugins); diff --git a/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts b/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts deleted file mode 100644 index 6a2034d9a62e43..00000000000000 --- a/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ - -/** - * The imports in this file are static functions and types which still live in legacy folders and are used - * within dashboard. To consolidate them all in one place, they are re-exported from this file. Eventually - * this list should become empty. Imports from the top level of shimmed or moved plugins can be imported - * directly where they are needed. - */ - -export { DashboardConstants } from '../dashboard/np_ready/dashboard_constants'; -export { - VisSavedObject, - VISUALIZE_EMBEDDABLE_TYPE, -} from '../../../../../plugins/visualizations/public/'; -export { - configureAppAngularModule, - migrateLegacyQuery, - subscribeWithScope, -} from '../../../../../plugins/kibana_legacy/public'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx b/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx index 899b9c1b5fd6eb..a7213387085b78 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx @@ -19,7 +19,7 @@ import React, { useEffect, useRef, useState, useCallback } from 'react'; -import { EditorRenderProps } from '../../kibana/public/visualize/np_ready/types'; +import { EditorRenderProps } from 'src/plugins/visualize/public'; import { PanelsContainer, Panel } from '../../../../plugins/kibana_react/public'; import './vis_type_agg_filter'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx b/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx index 58e67b5064da51..c92e7171ada5fa 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx @@ -22,7 +22,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; import { EventEmitter } from 'events'; -import { EditorRenderProps } from 'src/legacy/core_plugins/kibana/public/visualize/np_ready/types'; +import { EditorRenderProps } from 'src/plugins/visualize/public'; import { Vis, VisualizeEmbeddableContract } from '../../../../plugins/visualizations/public'; import { Storage } from '../../../../plugins/kibana_utils/public'; import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; diff --git a/src/legacy/ui/public/_index.scss b/src/legacy/ui/public/_index.scss index 87006d9347de49..aaed52f8b120a9 100644 --- a/src/legacy/ui/public/_index.scss +++ b/src/legacy/ui/public/_index.scss @@ -17,9 +17,3 @@ @import './field_editor/index'; @import './style_compile/index'; @import '../../../plugins/management/public/components/index'; - -// The following are prefixed with "vis" - -// Can't import vis folder here because of cascading issues, it's imported in core_plugins/kibana -// @import './vis/index'; -@import './visualize/index'; diff --git a/src/plugins/dashboard/public/index.ts b/src/plugins/dashboard/public/index.ts index 070e437ce52ef4..efc8c79392f2e3 100644 --- a/src/plugins/dashboard/public/index.ts +++ b/src/plugins/dashboard/public/index.ts @@ -38,6 +38,7 @@ export { DashboardDocPre700, } from './bwc'; +export { DashboardConstants } from './dashboard_constants'; export {} from './types'; export {} from './actions'; export { diff --git a/src/plugins/visualize/kibana.json b/src/plugins/visualize/kibana.json new file mode 100644 index 00000000000000..2e82882d111731 --- /dev/null +++ b/src/plugins/visualize/kibana.json @@ -0,0 +1,17 @@ +{ + "id": "visualize", + "version": "kibana", + "server": false, + "ui": true, + "requiredPlugins": [ + "data", + "embeddable", + "navigation", + "savedObjects", + "visualizations" + ], + "optionalPlugins": [ + "home", + "share" + ] +} diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/application.ts b/src/plugins/visualize/public/application/application.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/application.ts rename to src/plugins/visualize/public/application/application.ts index 241397884c8fe5..9d8a1b98ef023d 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/application.ts +++ b/src/plugins/visualize/public/application/application.ts @@ -17,16 +17,18 @@ * under the License. */ +import './index.scss'; + import angular, { IModule } from 'angular'; import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; import { AppMountContext } from 'kibana/public'; -import { configureAppAngularModule } from '../legacy_imports'; -import { NavigationPublicPluginStart as NavigationStart } from '../../../../../../plugins/navigation/public'; +import { NavigationPublicPluginStart as NavigationStart } from 'src/plugins/navigation/public'; import { + configureAppAngularModule, createTopNavDirective, createTopNavHelper, -} from '../../../../../../plugins/kibana_legacy/public'; +} from '../../../kibana_legacy/public'; // @ts-ignore import { initVisualizeApp } from './legacy_app'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/breadcrumbs.ts b/src/plugins/visualize/public/application/breadcrumbs.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/breadcrumbs.ts rename to src/plugins/visualize/public/application/breadcrumbs.ts diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/_editor.scss b/src/plugins/visualize/public/application/editor/_editor.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/_editor.scss rename to src/plugins/visualize/public/application/editor/_editor.scss diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/_index.scss b/src/plugins/visualize/public/application/editor/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/_index.scss rename to src/plugins/visualize/public/application/editor/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.html b/src/plugins/visualize/public/application/editor/editor.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.html rename to src/plugins/visualize/public/application/editor/editor.html diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.js b/src/plugins/visualize/public/application/editor/editor.js similarity index 97% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.js rename to src/plugins/visualize/public/application/editor/editor.js index 9ccd45dfc1b458..ded049b3de25d2 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/editor.js +++ b/src/plugins/visualize/public/application/editor/editor.js @@ -31,22 +31,19 @@ import { VisualizeConstants } from '../visualize_constants'; import { getEditBreadcrumbs } from '../breadcrumbs'; import { addHelpMenuToAppChrome } from '../help_menu/help_menu_util'; -import { unhashUrl, removeQueryParam } from '../../../../../../../plugins/kibana_utils/public'; -import { MarkdownSimple, toMountPoint } from '../../../../../../../plugins/kibana_react/public'; -import { addFatalError } from '../../../../../../../plugins/kibana_legacy/public'; +import { unhashUrl, removeQueryParam } from '../../../../kibana_utils/public'; +import { MarkdownSimple, toMountPoint } from '../../../../kibana_react/public'; import { - SavedObjectSaveModal, - showSaveModal, -} from '../../../../../../../plugins/saved_objects/public'; -import { - esFilters, - connectToQueryState, - syncQueryStateWithUrl, -} from '../../../../../../../plugins/data/public'; + addFatalError, + subscribeWithScope, + migrateLegacyQuery, +} from '../../../../kibana_legacy/public'; +import { SavedObjectSaveModal, showSaveModal } from '../../../../saved_objects/public'; +import { esFilters, connectToQueryState, syncQueryStateWithUrl } from '../../../../data/public'; +import { DashboardConstants } from '../../../../dashboard/public'; import { initVisEditorDirective } from './visualization_editor'; import { initVisualizationDirective } from './visualization'; -import { subscribeWithScope, migrateLegacyQuery, DashboardConstants } from '../../legacy_imports'; import { getServices } from '../../kibana_services'; @@ -252,6 +249,8 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState isDirty: hasUnappliedChanges || hasUnsavedChanges, }); }, + // disable the Share button if no action specified + disableButton: !share, }, { id: 'inspector', diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/index.ts b/src/plugins/visualize/public/application/editor/lib/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/index.ts rename to src/plugins/visualize/public/application/editor/lib/index.ts diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/make_stateful.ts b/src/plugins/visualize/public/application/editor/lib/make_stateful.ts similarity index 91% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/make_stateful.ts rename to src/plugins/visualize/public/application/editor/lib/make_stateful.ts index 8384585108a594..d071df314d99c4 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/make_stateful.ts +++ b/src/plugins/visualize/public/application/editor/lib/make_stateful.ts @@ -17,8 +17,8 @@ * under the License. */ -import { PersistedState } from '../../../../../../../../plugins/visualizations/public'; -import { ReduxLikeStateContainer } from '../../../../../../../../plugins/kibana_utils/public'; +import { PersistedState } from '../../../../../visualizations/public'; +import { ReduxLikeStateContainer } from '../../../../../kibana_utils/public'; import { VisualizeAppState, VisualizeAppStateTransitions } from '../../types'; /** diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/migrate_app_state.ts b/src/plugins/visualize/public/application/editor/lib/migrate_app_state.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/migrate_app_state.ts rename to src/plugins/visualize/public/application/editor/lib/migrate_app_state.ts diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.test.ts b/src/plugins/visualize/public/application/editor/lib/url_helper.test.ts similarity index 88% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.test.ts rename to src/plugins/visualize/public/application/editor/lib/url_helper.test.ts index e6974af9af8322..09609e3d7e3620 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.test.ts +++ b/src/plugins/visualize/public/application/editor/lib/url_helper.test.ts @@ -19,15 +19,6 @@ import { addEmbeddableToDashboardUrl } from './url_helper'; -jest.mock('../../../legacy_imports', () => ({ - DashboardConstants: { - ADD_EMBEDDABLE_ID: 'addEmbeddableId', - ADD_EMBEDDABLE_TYPE: 'addEmbeddableType', - CREATE_NEW_DASHBOARD_URL: '/dashboard', - }, - VISUALIZE_EMBEDDABLE_TYPE: 'visualization', -})); - describe('', () => { it('addEmbeddableToDashboardUrl when dashboard is not saved', () => { const id = '123eb456cd'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.ts b/src/plugins/visualize/public/application/editor/lib/url_helper.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.ts rename to src/plugins/visualize/public/application/editor/lib/url_helper.ts index c7937c856184a8..84e1ef9687cd0f 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/url_helper.ts +++ b/src/plugins/visualize/public/application/editor/lib/url_helper.ts @@ -18,7 +18,8 @@ */ import { parseUrl, stringify } from 'query-string'; -import { DashboardConstants, VISUALIZE_EMBEDDABLE_TYPE } from '../../../legacy_imports'; +import { DashboardConstants } from '../../../../../dashboard/public'; +import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../visualizations/public'; /** * * Returns relative dashboard URL with added embeddableType and embeddableId query params diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/visualize_app_state.ts b/src/plugins/visualize/public/application/editor/lib/visualize_app_state.ts similarity index 98% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/visualize_app_state.ts rename to src/plugins/visualize/public/application/editor/lib/visualize_app_state.ts index 86f39ea76dd3a0..fe2a19b7315c32 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/lib/visualize_app_state.ts +++ b/src/plugins/visualize/public/application/editor/lib/visualize_app_state.ts @@ -24,7 +24,7 @@ import { createStateContainer, syncState, IKbnUrlStateStorage, -} from '../../../../../../../../plugins/kibana_utils/public'; +} from '../../../../../kibana_utils/public'; import { PureVisState, VisualizeAppState, VisualizeAppStateTransitions } from '../../types'; const STATE_STORAGE_KEY = '_a'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/visualization.js b/src/plugins/visualize/public/application/editor/visualization.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/visualization.js rename to src/plugins/visualize/public/application/editor/visualization.js diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/visualization_editor.js b/src/plugins/visualize/public/application/editor/visualization_editor.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/editor/visualization_editor.js rename to src/plugins/visualize/public/application/editor/visualization_editor.js diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/help_menu/help_menu_util.js b/src/plugins/visualize/public/application/help_menu/help_menu_util.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/help_menu/help_menu_util.js rename to src/plugins/visualize/public/application/help_menu/help_menu_util.js diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/_index.scss b/src/plugins/visualize/public/application/index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/_index.scss rename to src/plugins/visualize/public/application/index.scss diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js b/src/plugins/visualize/public/application/legacy_app.js similarity index 98% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js rename to src/plugins/visualize/public/application/legacy_app.js index d1bf4411cac2a7..9b9e84dbf28d62 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js +++ b/src/plugins/visualize/public/application/legacy_app.js @@ -25,7 +25,8 @@ import { createKbnUrlStateStorage, redirectWhenMissing, ensureDefaultIndexPattern, -} from '../../../../../../plugins/kibana_utils/public'; +} from '../../../kibana_utils/public'; +import { createSavedSearchesLoader } from '../../../discover/public'; import editorTemplate from './editor/editor.html'; import visualizeListingTemplate from './listing/visualize_listing.html'; @@ -40,7 +41,6 @@ import { getCreateBreadcrumbs, getEditBreadcrumbs, } from './breadcrumbs'; -import { createSavedSearchesLoader } from '../../../../../../plugins/discover/public'; const getResolvedResults = deps => { const { core, data, visualizations } = deps; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/_index.scss b/src/plugins/visualize/public/application/listing/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/_index.scss rename to src/plugins/visualize/public/application/listing/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/_listing.scss b/src/plugins/visualize/public/application/listing/_listing.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/_listing.scss rename to src/plugins/visualize/public/application/listing/_listing.scss diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.html b/src/plugins/visualize/public/application/listing/visualize_listing.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.html rename to src/plugins/visualize/public/application/listing/visualize_listing.html diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.js b/src/plugins/visualize/public/application/listing/visualize_listing.js similarity index 98% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.js rename to src/plugins/visualize/public/application/listing/visualize_listing.js index 098633d0460627..256b0b712d0ef1 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing.js @@ -24,7 +24,7 @@ import { VisualizeConstants } from '../visualize_constants'; import { i18n } from '@kbn/i18n'; import { getServices } from '../../kibana_services'; -import { syncQueryStateWithUrl } from '../../../../../../../plugins/data/public'; +import { syncQueryStateWithUrl } from '../../../../data/public'; export function initListingDirective(app, I18nContext) { app.directive('visualizeListingTable', reactDirective => diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing_table.js b/src/plugins/visualize/public/application/listing/visualize_listing_table.js similarity index 98% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing_table.js rename to src/plugins/visualize/public/application/listing/visualize_listing_table.js index 932ac8996e97ef..0ac1b02bf96eea 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/listing/visualize_listing_table.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing_table.js @@ -21,7 +21,7 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { TableListView } from '../../../../../../../plugins/kibana_react/public'; +import { TableListView } from '../../../../kibana_react/public'; import { EuiIcon, EuiBetaBadge, EuiLink, EuiButton, EuiEmptyPrompt } from '@elastic/eui'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts b/src/plugins/visualize/public/application/types.ts similarity index 84% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts rename to src/plugins/visualize/public/application/types.ts index e376b4f2bbacfe..6c8245ec0dc44b 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts +++ b/src/plugins/visualize/public/application/types.ts @@ -24,12 +24,9 @@ import { DataPublicPluginStart, SavedQuery, } from 'src/plugins/data/public'; -import { EmbeddableStart } from 'src/plugins/embeddable/public'; -import { PersistedState } from 'src/plugins/visualizations/public'; -import { LegacyCoreStart } from 'kibana/public'; -import { VisSavedObject } from '../legacy_imports'; -import { SavedVisState } from '../../../../../../plugins/visualizations/public'; -import { SavedSearch } from '../../../../../../plugins/discover/public'; +import { PersistedState, SavedVisState, VisSavedObject } from 'src/plugins/visualizations/public'; +import { CoreStart } from 'kibana/public'; +import { SavedSearch } from 'src/plugins/discover/public'; export type PureVisState = SavedVisState; @@ -59,7 +56,7 @@ export interface VisualizeAppStateTransitions { } export interface EditorRenderProps { - core: LegacyCoreStart; + core: CoreStart; data: DataPublicPluginStart; filters: Filter[]; timeRange: TimeRange; diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_app.ts b/src/plugins/visualize/public/application/visualize_app.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_app.ts rename to src/plugins/visualize/public/application/visualize_app.ts diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants.ts b/src/plugins/visualize/public/application/visualize_constants.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants.ts rename to src/plugins/visualize/public/application/visualize_constants.ts diff --git a/src/legacy/core_plugins/kibana/public/visualize/index.ts b/src/plugins/visualize/public/index.ts similarity index 82% rename from src/legacy/core_plugins/kibana/public/visualize/index.ts rename to src/plugins/visualize/public/index.ts index c3ae39d9fde255..f7bbcb1456da4b 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/index.ts +++ b/src/plugins/visualize/public/index.ts @@ -20,10 +20,9 @@ import { PluginInitializerContext } from 'kibana/public'; import { VisualizePlugin } from './plugin'; -export * from './np_ready/visualize_constants'; -export { VisualizeConstants, createVisualizeEditUrl } from './np_ready/visualize_constants'; +export { EditorRenderProps } from './application/types'; +export { VisualizeConstants, createVisualizeEditUrl } from './application/visualize_constants'; -// Core will be looking for this when loading our plugin in the new platform export const plugin = (context: PluginInitializerContext) => { return new VisualizePlugin(context); }; diff --git a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts b/src/plugins/visualize/public/kibana_services.ts similarity index 77% rename from src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts rename to src/plugins/visualize/public/kibana_services.ts index 2ed7e3d43168c8..1ff4a3dd0ac23a 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts +++ b/src/plugins/visualize/public/kibana_services.ts @@ -27,16 +27,17 @@ import { PluginInitializerContext, } from 'kibana/public'; -import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public'; -import { Storage } from '../../../../../plugins/kibana_utils/public'; -import { EmbeddableStart } from '../../../../../plugins/embeddable/public'; -import { SharePluginStart } from '../../../../../plugins/share/public'; -import { DataPublicPluginStart, IndexPatternsContract } from '../../../../../plugins/data/public'; -import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; -import { SavedVisualizations } from './np_ready/types'; -import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public'; -import { KibanaLegacyStart } from '../../../../../plugins/kibana_legacy/public'; -import { DefaultEditorController } from '../../../vis_default_editor/public'; +import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; +import { Storage } from '../../kibana_utils/public'; +import { EmbeddableStart } from '../../embeddable/public'; +import { SharePluginStart } from '../../share/public'; +import { DataPublicPluginStart, IndexPatternsContract } from '../../data/public'; +import { VisualizationsStart } from '../../visualizations/public'; +import { SavedVisualizations } from './application/types'; +import { UsageCollectionSetup } from '../../usage_collection/public'; +import { KibanaLegacyStart } from '../../kibana_legacy/public'; +// the vis_default_editor is about to be moved to NP, this import will be adjusted +import { DefaultEditorController } from '../../../legacy/core_plugins/vis_default_editor/public'; export interface VisualizeKibanaServices { pluginInitializerContext: PluginInitializerContext; @@ -52,7 +53,7 @@ export interface VisualizeKibanaServices { savedObjectsClient: SavedObjectsClientContract; savedQueryService: DataPublicPluginStart['query']['savedQueries']; savedVisualizations: SavedVisualizations; - share: SharePluginStart; + share?: SharePluginStart; uiSettings: IUiSettingsClient; config: KibanaLegacyStart['config']; visualizeCapabilities: any; diff --git a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts b/src/plugins/visualize/public/plugin.ts similarity index 77% rename from src/legacy/core_plugins/kibana/public/visualize/plugin.ts rename to src/plugins/visualize/public/plugin.ts index 6d32579f5c5412..15a21527846cea 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -30,39 +30,30 @@ import { SavedObjectsClientContract, } from 'kibana/public'; -import { Storage, createKbnUrlTracker } from '../../../../../plugins/kibana_utils/public'; -import { - DataPublicPluginStart, - DataPublicPluginSetup, - esFilters, -} from '../../../../../plugins/data/public'; -import { EmbeddableStart } from '../../../../../plugins/embeddable/public'; -import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public'; -import { SharePluginStart } from '../../../../../plugins/share/public'; -import { - KibanaLegacySetup, - AngularRenderedAppUpdater, -} from '../../../../../plugins/kibana_legacy/public'; -import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; -import { VisualizeConstants } from './np_ready/visualize_constants'; +import { Storage, createKbnUrlTracker } from '../../kibana_utils/public'; +import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public'; +import { EmbeddableStart } from '../../embeddable/public'; +import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; +import { SharePluginStart } from '../../share/public'; +import { KibanaLegacySetup, AngularRenderedAppUpdater } from '../../kibana_legacy/public'; +import { VisualizationsStart } from '../../visualizations/public'; +import { VisualizeConstants } from './application/visualize_constants'; import { setServices, VisualizeKibanaServices } from './kibana_services'; -import { - FeatureCatalogueCategory, - HomePublicPluginSetup, -} from '../../../../../plugins/home/public'; -import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public'; -import { DefaultEditorController } from '../../../vis_default_editor/public'; +import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public'; +import { UsageCollectionSetup } from '../../usage_collection/public'; +// the vis_default_editor is about to be moved to NP, this import will be adjusted +import { DefaultEditorController } from '../../../legacy/core_plugins/vis_default_editor/public'; export interface VisualizePluginStartDependencies { data: DataPublicPluginStart; embeddable: EmbeddableStart; navigation: NavigationStart; - share: SharePluginStart; + share?: SharePluginStart; visualizations: VisualizationsStart; } export interface VisualizePluginSetupDependencies { - home: HomePublicPluginSetup; + home?: HomePublicPluginSetup; kibanaLegacy: KibanaLegacySetup; usageCollection?: UsageCollectionSetup; data: DataPublicPluginSetup; @@ -74,7 +65,7 @@ export class VisualizePlugin implements Plugin { embeddable: EmbeddableStart; navigation: NavigationStart; savedObjectsClient: SavedObjectsClientContract; - share: SharePluginStart; + share?: SharePluginStart; visualizations: VisualizationsStart; } | null = null; private appStateUpdater = new BehaviorSubject(() => ({})); @@ -159,7 +150,7 @@ export class VisualizePlugin implements Plugin { }; setServices(deps); - const { renderApp } = await import('./np_ready/application'); + const { renderApp } = await import('./application/application'); const unmount = renderApp(params.element, params.appBasePath, deps); return () => { unmount(); @@ -168,18 +159,20 @@ export class VisualizePlugin implements Plugin { }, }); - home.featureCatalogue.register({ - id: 'visualize', - title: 'Visualize', - description: i18n.translate('kbn.visualize.visualizeDescription', { - defaultMessage: - 'Create visualizations and aggregate data stores in your Elasticsearch indices.', - }), - icon: 'visualizeApp', - path: `/app/kibana#${VisualizeConstants.LANDING_PAGE_PATH}`, - showOnHomePage: true, - category: FeatureCatalogueCategory.DATA, - }); + if (home) { + home.featureCatalogue.register({ + id: 'visualize', + title: 'Visualize', + description: i18n.translate('kbn.visualize.visualizeDescription', { + defaultMessage: + 'Create visualizations and aggregate data stores in your Elasticsearch indices.', + }), + icon: 'visualizeApp', + path: `/app/kibana#${VisualizeConstants.LANDING_PAGE_PATH}`, + showOnHomePage: true, + category: FeatureCatalogueCategory.DATA, + }); + } } public start( diff --git a/test/functional/apps/dashboard/create_and_add_embeddables.js b/test/functional/apps/dashboard/create_and_add_embeddables.js index 3ce8e353e61fc7..410acdcb5680d2 100644 --- a/test/functional/apps/dashboard/create_and_add_embeddables.js +++ b/test/functional/apps/dashboard/create_and_add_embeddables.js @@ -19,7 +19,7 @@ import expect from '@kbn/expect'; -import { VisualizeConstants } from '../../../../src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants'; +import { VisualizeConstants } from '../../../../src/plugins/visualize/public/application/visualize_constants'; export default function({ getService, getPageObjects }) { const retry = getService('retry'); diff --git a/test/functional/apps/dashboard/panel_controls.js b/test/functional/apps/dashboard/panel_controls.js index f30f58913bd970..52c4a11360355b 100644 --- a/test/functional/apps/dashboard/panel_controls.js +++ b/test/functional/apps/dashboard/panel_controls.js @@ -24,7 +24,7 @@ import { AREA_CHART_VIS_NAME, LINE_CHART_VIS_NAME, } from '../../page_objects/dashboard_page'; -import { VisualizeConstants } from '../../../../src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants'; +import { VisualizeConstants } from '../../../../src/plugins/visualize/public/application/visualize_constants'; export default function({ getService, getPageObjects }) { const browser = getService('browser'); diff --git a/test/functional/page_objects/visualize_page.ts b/test/functional/page_objects/visualize_page.ts index 3b63fa68d71ee9..220c2d8f6b3633 100644 --- a/test/functional/page_objects/visualize_page.ts +++ b/test/functional/page_objects/visualize_page.ts @@ -18,7 +18,7 @@ */ import { FtrProviderContext } from '../ftr_provider_context'; -import { VisualizeConstants } from '../../../src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants'; +import { VisualizeConstants } from '../../../src/plugins/visualize/public/application/visualize_constants'; export function VisualizePageProvider({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); diff --git a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts index 4f12dd16247f62..cbd03110b0f145 100644 --- a/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts +++ b/x-pack/test/functional/apps/visualize/feature_controls/visualize_spaces.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ import expect from '@kbn/expect'; -import { VisualizeConstants } from '../../../../../../src/legacy/core_plugins/kibana/public/visualize/np_ready/visualize_constants'; +import { VisualizeConstants } from '../../../../../../src/plugins/visualize/public/application/visualize_constants'; import { FtrProviderContext } from '../../../ftr_provider_context'; export default function({ getPageObjects, getService }: FtrProviderContext) { From 2ce021cc4fbcd56b4961e8c5de620a6d1c9b0b04 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 2 Apr 2020 12:23:32 +0300 Subject: [PATCH 002/134] Refactor plugin services --- .../public/application/editor/editor.js | 9 +-- .../public/application/legacy_app.js | 2 +- .../application/listing/visualize_listing.js | 3 +- .../listing/visualize_listing_table.js | 4 +- .../visualize/public/kibana_services.ts | 12 +--- src/plugins/visualize/public/plugin.ts | 67 ++++--------------- 6 files changed, 22 insertions(+), 75 deletions(-) diff --git a/src/plugins/visualize/public/application/editor/editor.js b/src/plugins/visualize/public/application/editor/editor.js index ded049b3de25d2..16edb33f6deb91 100644 --- a/src/plugins/visualize/public/application/editor/editor.js +++ b/src/plugins/visualize/public/application/editor/editor.js @@ -62,16 +62,13 @@ export function initEditorDirective(app, deps) { function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlStateStorage, history) { const { - indexPatterns, localStorage, visualizeCapabilities, share, - data: { query: queryService }, + data: { query: queryService, indexPatterns }, toastNotifications, chrome, - core: { docLinks, fatalErrors }, - savedQueryService, - uiSettings, + core: { docLinks, fatalErrors, uiSettings }, I18nContext, setActiveUrl, visualizations, @@ -369,7 +366,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState return; } - savedQueryService.getSavedQuery(savedQueryId).then(savedQuery => { + queryService.savedQueries.getSavedQuery(savedQueryId).then(savedQuery => { $scope.$evalAsync(() => { $scope.updateSavedQuery(savedQuery); }); diff --git a/src/plugins/visualize/public/application/legacy_app.js b/src/plugins/visualize/public/application/legacy_app.js index 9b9e84dbf28d62..544ee51f61b1e6 100644 --- a/src/plugins/visualize/public/application/legacy_app.js +++ b/src/plugins/visualize/public/application/legacy_app.js @@ -92,7 +92,7 @@ export function initVisualizeApp(app, deps) { app.factory('kbnUrlStateStorage', history => createKbnUrlStateStorage({ history, - useHash: deps.uiSettings.get('state:storeInSessionStorage'), + useHash: deps.core.uiSettings.get('state:storeInSessionStorage'), }) ); diff --git a/src/plugins/visualize/public/application/listing/visualize_listing.js b/src/plugins/visualize/public/application/listing/visualize_listing.js index 256b0b712d0ef1..c0e3f2d133052c 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing.js @@ -40,9 +40,8 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor savedVisualizations, data: { query }, toastNotifications, - uiSettings, visualizations, - core: { docLinks, savedObjects }, + core: { docLinks, savedObjects, uiSettings }, } = getServices(); // syncs `_g` portion of url with query services diff --git a/src/plugins/visualize/public/application/listing/visualize_listing_table.js b/src/plugins/visualize/public/application/listing/visualize_listing_table.js index 0ac1b02bf96eea..12af8911d588b7 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing_table.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing_table.js @@ -33,7 +33,7 @@ class VisualizeListingTable extends Component { } render() { - const { visualizeCapabilities, uiSettings, toastNotifications } = getServices(); + const { visualizeCapabilities, core, toastNotifications } = getServices(); return ( ); } diff --git a/src/plugins/visualize/public/kibana_services.ts b/src/plugins/visualize/public/kibana_services.ts index 1ff4a3dd0ac23a..b5bd728c66e570 100644 --- a/src/plugins/visualize/public/kibana_services.ts +++ b/src/plugins/visualize/public/kibana_services.ts @@ -22,8 +22,6 @@ import { CoreStart, SavedObjectsClientContract, ToastsStart, - IUiSettingsClient, - I18nStart, PluginInitializerContext, } from 'kibana/public'; @@ -31,11 +29,9 @@ import { NavigationPublicPluginStart as NavigationStart } from '../../navigation import { Storage } from '../../kibana_utils/public'; import { EmbeddableStart } from '../../embeddable/public'; import { SharePluginStart } from '../../share/public'; -import { DataPublicPluginStart, IndexPatternsContract } from '../../data/public'; +import { DataPublicPluginStart } from '../../data/public'; import { VisualizationsStart } from '../../visualizations/public'; import { SavedVisualizations } from './application/types'; -import { UsageCollectionSetup } from '../../usage_collection/public'; -import { KibanaLegacyStart } from '../../kibana_legacy/public'; // the vis_default_editor is about to be moved to NP, this import will be adjusted import { DefaultEditorController } from '../../../legacy/core_plugins/vis_default_editor/public'; @@ -46,20 +42,14 @@ export interface VisualizeKibanaServices { core: CoreStart; data: DataPublicPluginStart; embeddable: EmbeddableStart; - indexPatterns: IndexPatternsContract; localStorage: Storage; navigation: NavigationStart; toastNotifications: ToastsStart; savedObjectsClient: SavedObjectsClientContract; - savedQueryService: DataPublicPluginStart['query']['savedQueries']; savedVisualizations: SavedVisualizations; share?: SharePluginStart; - uiSettings: IUiSettingsClient; - config: KibanaLegacyStart['config']; visualizeCapabilities: any; visualizations: VisualizationsStart; - usageCollection?: UsageCollectionSetup; - I18nContext: I18nStart['Context']; setActiveUrl: (newUrl: string) => void; DefaultVisualizationEditor: typeof DefaultEditorController; } diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 15a21527846cea..71811758e6196e 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -27,7 +27,6 @@ import { CoreStart, Plugin, PluginInitializerContext, - SavedObjectsClientContract, } from 'kibana/public'; import { Storage, createKbnUrlTracker } from '../../kibana_utils/public'; @@ -40,7 +39,6 @@ import { VisualizationsStart } from '../../visualizations/public'; import { VisualizeConstants } from './application/visualize_constants'; import { setServices, VisualizeKibanaServices } from './kibana_services'; import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public'; -import { UsageCollectionSetup } from '../../usage_collection/public'; // the vis_default_editor is about to be moved to NP, this import will be adjusted import { DefaultEditorController } from '../../../legacy/core_plugins/vis_default_editor/public'; @@ -55,27 +53,20 @@ export interface VisualizePluginStartDependencies { export interface VisualizePluginSetupDependencies { home?: HomePublicPluginSetup; kibanaLegacy: KibanaLegacySetup; - usageCollection?: UsageCollectionSetup; data: DataPublicPluginSetup; } -export class VisualizePlugin implements Plugin { - private startDependencies: { - data: DataPublicPluginStart; - embeddable: EmbeddableStart; - navigation: NavigationStart; - savedObjectsClient: SavedObjectsClientContract; - share?: SharePluginStart; - visualizations: VisualizationsStart; - } | null = null; +export class VisualizePlugin + implements + Plugin { private appStateUpdater = new BehaviorSubject(() => ({})); private stopUrlTracking: (() => void) | undefined = undefined; constructor(private initializerContext: PluginInitializerContext) {} public async setup( - core: CoreSetup, - { home, kibanaLegacy, usageCollection, data }: VisualizePluginSetupDependencies + core: CoreSetup, + { home, kibanaLegacy, data }: VisualizePluginSetupDependencies ) { const { appMounted, appUnMounted, stop: stopUrlTracker, setActiveUrl } = createKbnUrlTracker({ baseUrl: core.http.basePath.prepend('/app/kibana'), @@ -108,43 +99,25 @@ export class VisualizePlugin implements Plugin { updater$: this.appStateUpdater.asObservable(), navLinkId: 'kibana:visualize', mount: async (params: AppMountParameters) => { - const [coreStart] = await core.getStartServices(); - - if (this.startDependencies === null) { - throw new Error('not started yet'); - } + const [coreStart, pluginsStart] = await core.getStartServices(); appMounted(); - const { - savedObjectsClient, - embeddable, - navigation, - visualizations, - data: dataStart, - share, - } = this.startDependencies; const deps: VisualizeKibanaServices = { pluginInitializerContext: this.initializerContext, addBasePath: coreStart.http.basePath.prepend, core: coreStart, chrome: coreStart.chrome, - data: dataStart, - embeddable, - indexPatterns: dataStart.indexPatterns, + data: pluginsStart.data, + embeddable: pluginsStart.embeddable, localStorage: new Storage(localStorage), - navigation, - savedObjectsClient, - savedVisualizations: visualizations.savedVisualizationsLoader, - savedQueryService: dataStart.query.savedQueries, - share, + navigation: pluginsStart.navigation, + savedObjectsClient: coreStart.savedObjects.client, + savedVisualizations: pluginsStart.visualizations.savedVisualizationsLoader, + share: pluginsStart.share, toastNotifications: coreStart.notifications.toasts, - uiSettings: coreStart.uiSettings, - config: kibanaLegacy.config, visualizeCapabilities: coreStart.application.capabilities.visualize, - visualizations, - usageCollection, - I18nContext: coreStart.i18n.Context, + visualizations: pluginsStart.visualizations, setActiveUrl, DefaultVisualizationEditor: DefaultEditorController, }; @@ -175,19 +148,7 @@ export class VisualizePlugin implements Plugin { } } - public start( - core: CoreStart, - { embeddable, navigation, data, share, visualizations }: VisualizePluginStartDependencies - ) { - this.startDependencies = { - data, - embeddable, - navigation, - savedObjectsClient: core.savedObjects.client, - share, - visualizations, - }; - } + public start(core: CoreStart, plugins: VisualizePluginStartDependencies) {} stop() { if (this.stopUrlTracking) { From 2a5e63f5452f551c68830bb2b4e6d239f8f307e7 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 2 Apr 2020 13:55:00 +0300 Subject: [PATCH 003/134] Clean up --- src/plugins/visualize/kibana.json | 1 + src/plugins/visualize/public/application/visualize_app.ts | 2 +- src/plugins/visualize/public/kibana_services.ts | 4 ++++ src/plugins/visualize/public/plugin.ts | 2 ++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/visualize/kibana.json b/src/plugins/visualize/kibana.json index 2e82882d111731..a6d97701329660 100644 --- a/src/plugins/visualize/kibana.json +++ b/src/plugins/visualize/kibana.json @@ -6,6 +6,7 @@ "requiredPlugins": [ "data", "embeddable", + "kibanaLegacy", "navigation", "savedObjects", "visualizations" diff --git a/src/plugins/visualize/public/application/visualize_app.ts b/src/plugins/visualize/public/application/visualize_app.ts index a4afac23f48429..1a4e1534db9e2c 100644 --- a/src/plugins/visualize/public/application/visualize_app.ts +++ b/src/plugins/visualize/public/application/visualize_app.ts @@ -27,5 +27,5 @@ import { initListingDirective } from './listing/visualize_listing'; export function initVisualizeAppDirective(app: IModule, deps: VisualizeKibanaServices) { initEditorDirective(app, deps); - initListingDirective(app, deps.core.i18n.Context); + initListingDirective(app, deps.I18nContext); } diff --git a/src/plugins/visualize/public/kibana_services.ts b/src/plugins/visualize/public/kibana_services.ts index b5bd728c66e570..05fb8959e522d2 100644 --- a/src/plugins/visualize/public/kibana_services.ts +++ b/src/plugins/visualize/public/kibana_services.ts @@ -23,6 +23,7 @@ import { SavedObjectsClientContract, ToastsStart, PluginInitializerContext, + I18nStart, } from 'kibana/public'; import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; @@ -32,6 +33,7 @@ import { SharePluginStart } from '../../share/public'; import { DataPublicPluginStart } from '../../data/public'; import { VisualizationsStart } from '../../visualizations/public'; import { SavedVisualizations } from './application/types'; +import { KibanaLegacyStart } from '../../kibana_legacy/public'; // the vis_default_editor is about to be moved to NP, this import will be adjusted import { DefaultEditorController } from '../../../legacy/core_plugins/vis_default_editor/public'; @@ -48,8 +50,10 @@ export interface VisualizeKibanaServices { savedObjectsClient: SavedObjectsClientContract; savedVisualizations: SavedVisualizations; share?: SharePluginStart; + config: KibanaLegacyStart['config']; visualizeCapabilities: any; visualizations: VisualizationsStart; + I18nContext: I18nStart['Context']; setActiveUrl: (newUrl: string) => void; DefaultVisualizationEditor: typeof DefaultEditorController; } diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 71811758e6196e..84dc794757a3a2 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -107,6 +107,7 @@ export class VisualizePlugin pluginInitializerContext: this.initializerContext, addBasePath: coreStart.http.basePath.prepend, core: coreStart, + config: kibanaLegacy.config, chrome: coreStart.chrome, data: pluginsStart.data, embeddable: pluginsStart.embeddable, @@ -118,6 +119,7 @@ export class VisualizePlugin toastNotifications: coreStart.notifications.toasts, visualizeCapabilities: coreStart.application.capabilities.visualize, visualizations: pluginsStart.visualizations, + I18nContext: coreStart.i18n.Context, setActiveUrl, DefaultVisualizationEditor: DefaultEditorController, }; From 325de835ede386faef99d4efe86e141aa9fbd593 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 8 Apr 2020 13:09:08 +0300 Subject: [PATCH 004/134] Remove legacy style usage --- src/legacy/core_plugins/kibana/public/index.scss | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index 9b7d0afcd7e39d..c9179bf4d6d000 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -13,8 +13,6 @@ // Discover styles @import 'discover/index'; -// Visualize styles -@import './visualize/index'; // Has to come after visualize because of some // bad cascading in the Editor layout @import 'src/legacy/ui/public/vis/index'; From b73d9aaaa128b18ae0556372fa5b9e8403363dd9 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Wed, 8 Apr 2020 16:31:29 +0300 Subject: [PATCH 005/134] Migrate Markdown to NP --- .i18nrc.json | 2 +- .../core_plugins/vis_type_markdown/index.ts | 44 ------------------- .../vis_type_markdown/package.json | 4 -- .../vis_type_markdown/public/legacy.ts | 33 -------------- src/plugins/vis_type_markdown/kibana.json | 6 +++ .../__snapshots__/markdown_fn.test.ts.snap | 0 .../public/_markdown_vis.scss | 0 .../vis_type_markdown/public/index.scss | 0 .../vis_type_markdown/public/index.ts | 2 +- .../public/markdown_fn.test.ts | 2 +- .../vis_type_markdown/public/markdown_fn.ts | 2 +- .../public/markdown_options.tsx | 0 .../vis_type_markdown/public/markdown_vis.ts | 2 +- .../public/markdown_vis_controller.test.tsx | 0 .../public/markdown_vis_controller.tsx | 2 +- .../vis_type_markdown/public/plugin.ts | 6 +-- .../public/settings_options.tsx | 6 +-- .../vis_type_markdown/public/types.ts | 0 18 files changed, 18 insertions(+), 93 deletions(-) delete mode 100644 src/legacy/core_plugins/vis_type_markdown/index.ts delete mode 100644 src/legacy/core_plugins/vis_type_markdown/package.json delete mode 100644 src/legacy/core_plugins/vis_type_markdown/public/legacy.ts create mode 100644 src/plugins/vis_type_markdown/kibana.json rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/__snapshots__/markdown_fn.test.ts.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/_markdown_vis.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/index.ts (93%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_fn.test.ts (91%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_fn.ts (95%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_options.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_vis.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_vis_controller.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/markdown_vis_controller.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/plugin.ts (89%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/settings_options.tsx (92%) rename src/{legacy/core_plugins => plugins}/vis_type_markdown/public/types.ts (100%) diff --git a/.i18nrc.json b/.i18nrc.json index 3b0b40b40792e8..9b25342f984459 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -44,7 +44,7 @@ "timelion": ["src/legacy/core_plugins/timelion", "src/legacy/core_plugins/vis_type_timelion", "src/plugins/timelion"], "uiActions": "src/plugins/ui_actions", "visDefaultEditor": "src/plugins/vis_default_editor", - "visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown", + "visTypeMarkdown": "src/plugins/vis_type_markdown", "visTypeMetric": "src/legacy/core_plugins/vis_type_metric", "visTypeTable": "src/legacy/core_plugins/vis_type_table", "visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud", diff --git a/src/legacy/core_plugins/vis_type_markdown/index.ts b/src/legacy/core_plugins/vis_type_markdown/index.ts deleted file mode 100644 index 3c00420e57d551..00000000000000 --- a/src/legacy/core_plugins/vis_type_markdown/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; - -const markdownPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => - new Plugin({ - id: 'markdown_vis', - require: ['kibana', 'elasticsearch'], - publicDir: resolve(__dirname, 'public'), - uiExports: { - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - hacks: [resolve(__dirname, 'public/legacy')], - injectDefaultVars: server => ({}), - }, - init: (server: Legacy.Server) => ({}), - config(Joi: any) { - return Joi.object({ - enabled: Joi.boolean().default(true), - }).default(); - }, - } as Legacy.PluginSpecOptions); - -// eslint-disable-next-line import/no-default-export -export default markdownPluginInitializer; diff --git a/src/legacy/core_plugins/vis_type_markdown/package.json b/src/legacy/core_plugins/vis_type_markdown/package.json deleted file mode 100644 index 5c233d82fe5067..00000000000000 --- a/src/legacy/core_plugins/vis_type_markdown/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "markdown_vis", - "version": "kibana" -} diff --git a/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts b/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts deleted file mode 100644 index 1cfc583f6e0052..00000000000000 --- a/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 'kibana/public'; -import { npSetup, npStart } from 'ui/new_platform'; -import { MarkdownPluginSetupDependencies } from './plugin'; -import { plugin } from '.'; - -const plugins: Readonly = { - expressions: npSetup.plugins.expressions, - visualizations: npSetup.plugins.visualizations, -}; - -const pluginInstance = plugin({} as PluginInitializerContext); - -export const setup = pluginInstance.setup(npSetup.core, plugins); -export const start = pluginInstance.start(npStart.core); diff --git a/src/plugins/vis_type_markdown/kibana.json b/src/plugins/vis_type_markdown/kibana.json new file mode 100644 index 00000000000000..6e2ddcae5d5dfd --- /dev/null +++ b/src/plugins/vis_type_markdown/kibana.json @@ -0,0 +1,6 @@ +{ + "id": "markdown_vis", + "version": "kibana", + "ui": true, + "requiredPlugins": ["expressions", "visualizations"] +} diff --git a/src/legacy/core_plugins/vis_type_markdown/public/__snapshots__/markdown_fn.test.ts.snap b/src/plugins/vis_type_markdown/public/__snapshots__/markdown_fn.test.ts.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/__snapshots__/markdown_fn.test.ts.snap rename to src/plugins/vis_type_markdown/public/__snapshots__/markdown_fn.test.ts.snap diff --git a/src/legacy/core_plugins/vis_type_markdown/public/_markdown_vis.scss b/src/plugins/vis_type_markdown/public/_markdown_vis.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/_markdown_vis.scss rename to src/plugins/vis_type_markdown/public/_markdown_vis.scss diff --git a/src/legacy/core_plugins/vis_type_markdown/public/index.scss b/src/plugins/vis_type_markdown/public/index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/index.scss rename to src/plugins/vis_type_markdown/public/index.scss diff --git a/src/legacy/core_plugins/vis_type_markdown/public/index.ts b/src/plugins/vis_type_markdown/public/index.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_markdown/public/index.ts rename to src/plugins/vis_type_markdown/public/index.ts index 22dd61b6bda9c0..bc3b6ff7bf1051 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/index.ts +++ b/src/plugins/vis_type_markdown/public/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { PluginInitializerContext } from '../../../../core/public'; +import { PluginInitializerContext } from '../../../core/public'; import { MarkdownPlugin as Plugin } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.test.ts b/src/plugins/vis_type_markdown/public/markdown_fn.test.ts similarity index 91% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.test.ts rename to src/plugins/vis_type_markdown/public/markdown_fn.test.ts index 5f41840bac99b6..ea06f3949501a8 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.test.ts +++ b/src/plugins/vis_type_markdown/public/markdown_fn.test.ts @@ -18,7 +18,7 @@ */ // eslint-disable-next-line -import { functionWrapper } from '../../../../plugins/expressions/common/expression_functions/specs/tests/utils'; +import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils'; import { createMarkdownVisFn } from './markdown_fn'; describe('interpreter/functions#markdown', () => { diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.ts b/src/plugins/vis_type_markdown/public/markdown_fn.ts similarity index 95% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.ts rename to src/plugins/vis_type_markdown/public/markdown_fn.ts index bbf2b7844c73fe..9f0809109e4653 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_fn.ts +++ b/src/plugins/vis_type_markdown/public/markdown_fn.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ExpressionFunctionDefinition, Render } from '../../../../plugins/expressions/public'; +import { ExpressionFunctionDefinition, Render } from '../../expressions/public'; import { Arguments, MarkdownVisParams } from './types'; interface RenderValue { diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx b/src/plugins/vis_type_markdown/public/markdown_options.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx rename to src/plugins/vis_type_markdown/public/markdown_options.tsx diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts b/src/plugins/vis_type_markdown/public/markdown_vis.ts similarity index 96% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts rename to src/plugins/vis_type_markdown/public/markdown_vis.ts index 57ea6d9c9bb3d6..b84d9638eb973d 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts +++ b/src/plugins/vis_type_markdown/public/markdown_vis.ts @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { MarkdownVisWrapper } from './markdown_vis_controller'; import { MarkdownOptions } from './markdown_options'; import { SettingsOptions } from './settings_options'; -import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; +import { DefaultEditorSize } from '../../vis_default_editor/public'; export const markdownVisDefinition = { name: 'markdown', diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx rename to src/plugins/vis_type_markdown/public/markdown_vis_controller.test.tsx diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis_controller.tsx b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_markdown/public/markdown_vis_controller.tsx rename to src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx index 3260e9f7d80919..4e77bb196b713d 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis_controller.tsx +++ b/src/plugins/vis_type_markdown/public/markdown_vis_controller.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; -import { Markdown } from '../../../../plugins/kibana_react/public'; +import { Markdown } from '../../kibana_react/public'; import { MarkdownVisParams } from './types'; interface MarkdownVisComponentProps extends MarkdownVisParams { diff --git a/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts b/src/plugins/vis_type_markdown/public/plugin.ts similarity index 89% rename from src/legacy/core_plugins/vis_type_markdown/public/plugin.ts rename to src/plugins/vis_type_markdown/public/plugin.ts index 0445d270c93305..34402abe4d4148 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts +++ b/src/plugins/vis_type_markdown/public/plugin.ts @@ -17,9 +17,9 @@ * under the License. */ -import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public'; -import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/public'; +import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; +import { VisualizationsSetup } from '../../visualizations/public'; import { markdownVisDefinition } from './markdown_vis'; import { createMarkdownVisFn } from './markdown_fn'; diff --git a/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx b/src/plugins/vis_type_markdown/public/settings_options.tsx similarity index 92% rename from src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx rename to src/plugins/vis_type_markdown/public/settings_options.tsx index 552fd633735543..55e1c5cb833993 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx +++ b/src/plugins/vis_type_markdown/public/settings_options.tsx @@ -22,13 +22,13 @@ import { EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; -import { RangeOption, SwitchOption } from '../../vis_type_vislib/public'; +// import { RangeOption, SwitchOption } from '../../../legacy/core_plugins/vis_type_vislib/public'; import { MarkdownVisParams } from './types'; function SettingsOptions({ stateParams, setValue }: VisOptionsProps) { return ( - + /> */} ); } diff --git a/src/legacy/core_plugins/vis_type_markdown/public/types.ts b/src/plugins/vis_type_markdown/public/types.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_markdown/public/types.ts rename to src/plugins/vis_type_markdown/public/types.ts From dbd1946c3d1256482ef3c7226b32e31379ab2599 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 8 Apr 2020 17:42:02 +0300 Subject: [PATCH 006/134] Fix style imports --- src/legacy/ui/public/visualize/_index.scss | 1 - src/plugins/visualizations/public/index.scss | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src/legacy/ui/public/visualize/_index.scss diff --git a/src/legacy/ui/public/visualize/_index.scss b/src/legacy/ui/public/visualize/_index.scss deleted file mode 100644 index d9761f741353bc..00000000000000 --- a/src/legacy/ui/public/visualize/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import '../../../../plugins/visualizations/public/components/index'; diff --git a/src/plugins/visualizations/public/index.scss b/src/plugins/visualizations/public/index.scss index eada763b63c4d4..2b61535f3e7f23 100644 --- a/src/plugins/visualizations/public/index.scss +++ b/src/plugins/visualizations/public/index.scss @@ -1,2 +1,3 @@ @import 'wizard/index'; @import 'embeddable/index'; +@import 'components/index'; From aa278887a9768fc8d7fa9b3e40a37e0909e358de Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 8 Apr 2020 17:42:45 +0300 Subject: [PATCH 007/134] Fix timelion_options context provider --- .../vis_type_timelion/public/timelion_options.tsx | 4 +++- .../vis_type_timelion/public/timelion_vis_type.tsx | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx b/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx index afffcf7ccaf7a7..dfe017d3a273f5 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx +++ b/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx @@ -24,7 +24,9 @@ import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { VisParams } from './timelion_vis_fn'; import { TimelionInterval, TimelionExpressionInput } from './components'; -function TimelionOptions({ stateParams, setValue, setValidity }: VisOptionsProps) { +export type TimelionOptionsProps = VisOptionsProps; + +function TimelionOptions({ stateParams, setValue, setValidity }: TimelionOptionsProps) { const setInterval = useCallback((value: VisParams['interval']) => setValue('interval', value), [ setValue, ]); diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx b/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx index 5be77b3e51a6ad..0900b7d898ede8 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx +++ b/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx @@ -24,7 +24,7 @@ import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; import { getTimelionRequestHandler } from './helpers/timelion_request_handler'; import { TimelionVisComponent, TimelionVisComponentProp } from './components'; -import { TimelionOptions } from './timelion_options'; +import { TimelionOptions, TimelionOptionsProps } from './timelion_options'; import { TimelionVisDependencies } from './plugin'; export const TIMELION_VIS_NAME = 'timelion'; @@ -53,7 +53,11 @@ export function getTimelionVisDefinition(dependencies: TimelionVisDependencies) ), }, editorConfig: { - optionsTemplate: TimelionOptions, + optionsTemplate: (props: TimelionOptionsProps) => ( + + + + ), defaultSize: DefaultEditorSize.MEDIUM, }, requestHandler: timelionRequestHandler, From a7edd02417cdb59a3393df7ee8415887cdc78d02 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 8 Apr 2020 17:43:27 +0300 Subject: [PATCH 008/134] Fix translations --- .i18nrc.json | 3 +- .../public/application/breadcrumbs.ts | 8 +- .../public/application/editor/editor.html | 2 +- .../public/application/editor/editor.js | 54 ++++++------ .../application/help_menu/help_menu_util.js | 2 +- .../public/application/legacy_app.js | 6 +- .../application/listing/visualize_listing.js | 4 +- .../listing/visualize_listing_table.js | 28 +++---- src/plugins/visualize/public/plugin.ts | 2 +- .../translations/translations/ja-JP.json | 84 +++++++++---------- .../translations/translations/zh-CN.json | 84 +++++++++---------- 11 files changed, 137 insertions(+), 140 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index 3b0b40b40792e8..5e9964f79c2331 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -52,7 +52,8 @@ "visTypeVega": "src/legacy/core_plugins/vis_type_vega", "visTypeVislib": "src/legacy/core_plugins/vis_type_vislib", "visTypeXy": "src/legacy/core_plugins/vis_type_xy", - "visualizations": "src/plugins/visualizations" + "visualizations": "src/plugins/visualizations", + "visualize": "src/plugins/visualize" }, "exclude": [ "src/legacy/ui/ui_render/ui_render_mixin.js" diff --git a/src/plugins/visualize/public/application/breadcrumbs.ts b/src/plugins/visualize/public/application/breadcrumbs.ts index b6a63d50b205be..972bdc1462b2c5 100644 --- a/src/plugins/visualize/public/application/breadcrumbs.ts +++ b/src/plugins/visualize/public/application/breadcrumbs.ts @@ -24,7 +24,7 @@ import { VisualizeConstants } from './visualize_constants'; export function getLandingBreadcrumbs() { return [ { - text: i18n.translate('kbn.visualize.listing.breadcrumb', { + text: i18n.translate('visualize.listing.breadcrumb', { defaultMessage: 'Visualize', }), href: `#${VisualizeConstants.LANDING_PAGE_PATH}`, @@ -36,7 +36,7 @@ export function getWizardStep1Breadcrumbs() { return [ ...getLandingBreadcrumbs(), { - text: i18n.translate('kbn.visualize.wizard.step1Breadcrumb', { + text: i18n.translate('visualize.wizard.step1Breadcrumb', { defaultMessage: 'Create', }), }, @@ -47,7 +47,7 @@ export function getWizardStep2Breadcrumbs() { return [ ...getLandingBreadcrumbs(), { - text: i18n.translate('kbn.visualize.wizard.step2Breadcrumb', { + text: i18n.translate('visualize.wizard.step2Breadcrumb', { defaultMessage: 'Create', }), }, @@ -58,7 +58,7 @@ export function getCreateBreadcrumbs() { return [ ...getLandingBreadcrumbs(), { - text: i18n.translate('kbn.visualize.editor.createBreadcrumb', { + text: i18n.translate('visualize.editor.createBreadcrumb', { defaultMessage: 'Create', }), }, diff --git a/src/plugins/visualize/public/application/editor/editor.html b/src/plugins/visualize/public/application/editor/editor.html index 0dcacd30fba4e2..a031d70ef9a83d 100644 --- a/src/plugins/visualize/public/application/editor/editor.html +++ b/src/plugins/visualize/public/application/editor/editor.html @@ -80,7 +80,7 @@

) : null; @@ -223,10 +220,10 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState : []), { id: 'share', - label: i18n.translate('kbn.topNavMenu.shareVisualizationButtonLabel', { + label: i18n.translate('visualize.topNavMenu.shareVisualizationButtonLabel', { defaultMessage: 'share', }), - description: i18n.translate('kbn.visualize.topNavMenu.shareVisualizationButtonAriaLabel', { + description: i18n.translate('visualize.topNavMenu.shareVisualizationButtonAriaLabel', { defaultMessage: 'Share Visualization', }), testId: 'shareTopNavButton', @@ -251,10 +248,10 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState }, { id: 'inspector', - label: i18n.translate('kbn.topNavMenu.openInspectorButtonLabel', { + label: i18n.translate('visualize.topNavMenu.openInspectorButtonLabel', { defaultMessage: 'inspect', }), - description: i18n.translate('kbn.visualize.topNavMenu.openInspectorButtonAriaLabel', { + description: i18n.translate('visualize.topNavMenu.openInspectorButtonAriaLabel', { defaultMessage: 'Open Inspector for visualization', }), testId: 'openInspectorButton', @@ -270,7 +267,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState }, tooltip() { if (!embeddableHandler.hasInspector || !embeddableHandler.hasInspector()) { - return i18n.translate('kbn.visualize.topNavMenu.openInspectorDisabledButtonTooltip', { + return i18n.translate('visualize.topNavMenu.openInspectorDisabledButtonTooltip', { defaultMessage: `This visualization doesn't support any inspectors.`, }); } @@ -278,8 +275,10 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState }, { id: 'refresh', - label: i18n.translate('kbn.topNavMenu.refreshButtonLabel', { defaultMessage: 'refresh' }), - description: i18n.translate('kbn.visualize.topNavMenu.refreshButtonAriaLabel', { + label: i18n.translate('visualize.topNavMenu.refreshButtonLabel', { + defaultMessage: 'refresh', + }), + description: i18n.translate('visualize.topNavMenu.refreshButtonAriaLabel', { defaultMessage: 'Refresh', }), run: function() { @@ -326,7 +325,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState stopAllSyncing(); toastNotifications.addWarning({ - title: i18n.translate('kbn.visualize.visualizationTypeInvalidNotificationMessage', { + title: i18n.translate('visualize.visualizationTypeInvalidNotificationMessage', { defaultMessage: 'Invalid visualization type', }), text: toMountPoint({error.message}), @@ -629,7 +628,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState if (id) { toastNotifications.addSuccess({ title: i18n.translate( - 'kbn.visualize.topNavMenu.saveVisualization.successNotificationText', + 'visualize.topNavMenu.saveVisualization.successNotificationText', { defaultMessage: `Saved '{visTitle}'`, values: { @@ -668,15 +667,12 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState // eslint-disable-next-line console.error(error); toastNotifications.addDanger({ - title: i18n.translate( - 'kbn.visualize.topNavMenu.saveVisualization.failureNotificationText', - { - defaultMessage: `Error on saving '{visTitle}'`, - values: { - visTitle: savedVis.title, - }, - } - ), + title: i18n.translate('visualize.topNavMenu.saveVisualization.failureNotificationText', { + defaultMessage: `Error on saving '{visTitle}'`, + values: { + visTitle: savedVis.title, + }, + }), text: error.message, 'data-test-subj': 'saveVisualizationError', }); @@ -699,7 +695,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState }); toastNotifications.addSuccess( - i18n.translate('kbn.visualize.linkedToSearch.unlinkSuccessNotificationText', { + i18n.translate('visualize.linkedToSearch.unlinkSuccessNotificationText', { defaultMessage: `Unlinked from saved search '{searchTitle}'`, values: { searchTitle: savedSearch.title, @@ -711,7 +707,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState $scope.getAdditionalMessage = () => { return ( '' + - i18n.translate('kbn.visualize.experimentalVisInfoText', { + i18n.translate('visualize.experimentalVisInfoText', { defaultMessage: 'This visualization is marked as experimental.', }) + ' ' + diff --git a/src/plugins/visualize/public/application/help_menu/help_menu_util.js b/src/plugins/visualize/public/application/help_menu/help_menu_util.js index 9c00947d7663c9..c297326f2e264e 100644 --- a/src/plugins/visualize/public/application/help_menu/help_menu_util.js +++ b/src/plugins/visualize/public/application/help_menu/help_menu_util.js @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; export function addHelpMenuToAppChrome(chrome, docLinks) { chrome.setHelpExtension({ - appName: i18n.translate('kbn.visualize.helpMenu.appName', { + appName: i18n.translate('visualize.helpMenu.appName', { defaultMessage: 'Visualize', }), links: [ diff --git a/src/plugins/visualize/public/application/legacy_app.js b/src/plugins/visualize/public/application/legacy_app.js index 5b7a40e1f75666..7152601f4acb22 100644 --- a/src/plugins/visualize/public/application/legacy_app.js +++ b/src/plugins/visualize/public/application/legacy_app.js @@ -106,10 +106,10 @@ export function initVisualizeApp(app, deps) { } return { - text: i18n.translate('kbn.visualize.badge.readOnly.text', { + text: i18n.translate('visualize.badge.readOnly.text', { defaultMessage: 'Read only', }), - tooltip: i18n.translate('kbn.visualize.badge.readOnly.tooltip', { + tooltip: i18n.translate('visualize.badge.readOnly.tooltip', { defaultMessage: 'Unable to save visualizations', }), iconType: 'glasses', @@ -155,7 +155,7 @@ export function initVisualizeApp(app, deps) { if (shouldHaveIndex && !hasIndex) { throw new Error( i18n.translate( - 'kbn.visualize.createVisualization.noIndexPatternOrSavedSearchIdErrorMessage', + 'visualize.createVisualization.noIndexPatternOrSavedSearchIdErrorMessage', { defaultMessage: 'You must provide either an indexPattern or a savedSearchId', } diff --git a/src/plugins/visualize/public/application/listing/visualize_listing.js b/src/plugins/visualize/public/application/listing/visualize_listing.js index c0e3f2d133052c..900c17fa394de9 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing.js @@ -109,7 +109,7 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor }) ).catch(error => { toastNotifications.addError(error, { - title: i18n.translate('kbn.visualize.visualizeListingDeleteErrorTitle', { + title: i18n.translate('visualize.visualizeListingDeleteErrorTitle', { defaultMessage: 'Error deleting visualization', }), }); @@ -118,7 +118,7 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor chrome.setBreadcrumbs([ { - text: i18n.translate('kbn.visualize.visualizeListingBreadcrumbsTitle', { + text: i18n.translate('visualize.visualizeListingBreadcrumbsTitle', { defaultMessage: 'Visualize', }), }, diff --git a/src/plugins/visualize/public/application/listing/visualize_listing_table.js b/src/plugins/visualize/public/application/listing/visualize_listing_table.js index 12af8911d588b7..100becdd3a80f3 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing_table.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing_table.js @@ -48,13 +48,13 @@ class VisualizeListingTable extends Component { selectable={item => item.canDelete} initialFilter={''} noItemsFragment={this.getNoItemsMessage()} - entityName={i18n.translate('kbn.visualize.listing.table.entityName', { + entityName={i18n.translate('visualize.listing.table.entityName', { defaultMessage: 'visualization', })} - entityNamePlural={i18n.translate('kbn.visualize.listing.table.entityNamePlural', { + entityNamePlural={i18n.translate('visualize.listing.table.entityNamePlural', { defaultMessage: 'visualizations', })} - tableListTitle={i18n.translate('kbn.visualize.listing.table.listTitle', { + tableListTitle={i18n.translate('visualize.listing.table.listTitle', { defaultMessage: 'Visualizations', })} toastNotifications={toastNotifications} @@ -67,7 +67,7 @@ class VisualizeListingTable extends Component { const tableColumns = [ { field: 'title', - name: i18n.translate('kbn.visualize.listing.table.titleColumnName', { + name: i18n.translate('visualize.listing.table.titleColumnName', { defaultMessage: 'Title', }), sortable: true, @@ -82,7 +82,7 @@ class VisualizeListingTable extends Component { }, { field: 'typeTitle', - name: i18n.translate('kbn.visualize.listing.table.typeColumnName', { + name: i18n.translate('visualize.listing.table.typeColumnName', { defaultMessage: 'Type', }), sortable: true, @@ -96,7 +96,7 @@ class VisualizeListingTable extends Component { }, { field: 'description', - name: i18n.translate('kbn.dashboard.listing.table.descriptionColumnName', { + name: i18n.translate('visualize.listing.table.descriptionColumnName', { defaultMessage: 'Description', }), sortable: true, @@ -116,7 +116,7 @@ class VisualizeListingTable extends Component { title={

@@ -133,7 +133,7 @@ class VisualizeListingTable extends Component { title={

@@ -142,7 +142,7 @@ class VisualizeListingTable extends Component {

@@ -156,7 +156,7 @@ class VisualizeListingTable extends Component { data-test-subj="createVisualizationPromptButton" > @@ -192,10 +192,10 @@ class VisualizeListingTable extends Component { Date: Wed, 8 Apr 2020 17:44:03 +0300 Subject: [PATCH 009/134] Change codeowners for visualize --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index feaf47e45fd69c..5c5c66235ee518 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,7 +9,6 @@ /src/legacy/server/sample_data/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app -/src/legacy/core_plugins/kibana/public/visualize/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app /src/legacy/core_plugins/metrics/ @elastic/kibana-app @@ -19,6 +18,7 @@ /src/plugins/timelion/ @elastic/kibana-app /src/plugins/dashboard/ @elastic/kibana-app /src/plugins/discover/ @elastic/kibana-app +/src/plugins/visualize/ @elastic/kibana-app # Core UI # Exclude tutorials folder for now because they are not owned by Kibana app and most will move out soon From 4daf88c90b16ef9b9a7d764b71e1897e089f921a Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 9 Apr 2020 13:04:52 +0300 Subject: [PATCH 010/134] Import styles in legacy for BWC in Browser tests --- src/legacy/core_plugins/kibana/public/index.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index c9179bf4d6d000..e31ac4ae4d672f 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -13,6 +13,10 @@ // Discover styles @import 'discover/index'; +// Visualization styles are imported here for running karma Browser tests +// should be somehow included through the "visualizations" plugin initialization +@import '../../../../plugins/visualizations/public/index'; + // Has to come after visualize because of some // bad cascading in the Editor layout @import 'src/legacy/ui/public/vis/index'; From 0887558d4a07938870a7d9635de150e93e0cd459 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Thu, 9 Apr 2020 15:21:49 +0300 Subject: [PATCH 011/134] Refactoring --- .../charts/public/static/components/index.ts | 21 +++++ .../charts/public/static/components/range.tsx | 85 +++++++++++++++++++ .../public/static/components/switch.tsx | 59 +++++++++++++ src/plugins/charts/public/static/index.ts | 1 + .../vis_type_markdown/public/index.scss | 2 - .../public/markdown_fn.test.ts | 1 - .../vis_type_markdown/public/plugin.ts | 2 + .../public/settings_options.tsx | 6 +- 8 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 src/plugins/charts/public/static/components/index.ts create mode 100644 src/plugins/charts/public/static/components/range.tsx create mode 100644 src/plugins/charts/public/static/components/switch.tsx diff --git a/src/plugins/charts/public/static/components/index.ts b/src/plugins/charts/public/static/components/index.ts new file mode 100644 index 00000000000000..72435b30fa808b --- /dev/null +++ b/src/plugins/charts/public/static/components/index.ts @@ -0,0 +1,21 @@ +/* + * 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 { RangeOption } from './range'; +export { SwitchOption } from './switch'; diff --git a/src/plugins/charts/public/static/components/range.tsx b/src/plugins/charts/public/static/components/range.tsx new file mode 100644 index 00000000000000..5c713180924dfc --- /dev/null +++ b/src/plugins/charts/public/static/components/range.tsx @@ -0,0 +1,85 @@ +/* + * 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, { useState } from 'react'; +import { EuiFormRow, EuiRange, EuiRangeProps } from '@elastic/eui'; +import { i18n } from '@kbn/i18n'; + +interface RangeOptionProps { + label: string; + max: number; + min: number; + paramName: ParamName; + showInput?: boolean; + showLabels?: boolean; + showValue?: boolean; + step?: number; + value: '' | number; + setValue: (paramName: ParamName, value: number) => void; +} + +function RangeOption({ + label, + max, + min, + showInput, + showLabels, + showValue = true, + step, + paramName, + value, + setValue, +}: RangeOptionProps) { + const [stateValue, setStateValue] = useState(value); + const [isValidState, setIsValidState] = useState(true); + + const error = i18n.translate('charts.controls.rangeErrorMessage', { + defaultMessage: 'Values must be on or between {min} and {max}', + values: { min, max }, + }); + + const onChangeHandler: EuiRangeProps['onChange'] = (event, isValid) => { + const { valueAsNumber } = event.target as HTMLInputElement; // since we don't show ticks on EuiRange, the target will definitely be HTMLInputElement type, so we can cast it directly. + + setStateValue(valueAsNumber); + setIsValidState(isValid); + + if (isValid) { + setValue(paramName, valueAsNumber); + } + }; + return ( + + + + ); +} + +export { RangeOption }; diff --git a/src/plugins/charts/public/static/components/switch.tsx b/src/plugins/charts/public/static/components/switch.tsx new file mode 100644 index 00000000000000..bdaf602cad5c67 --- /dev/null +++ b/src/plugins/charts/public/static/components/switch.tsx @@ -0,0 +1,59 @@ +/* + * 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 { EuiFormRow, EuiSwitch, EuiToolTip } from '@elastic/eui'; + +interface SwitchOptionProps { + 'data-test-subj'?: string; + label?: string; + tooltip?: string; + disabled?: boolean; + value?: boolean; + paramName: ParamName; + setValue: (paramName: ParamName, value: boolean) => void; +} + +function SwitchOption({ + 'data-test-subj': dataTestSubj, + tooltip, + label, + disabled, + paramName, + value = false, + setValue, +}: SwitchOptionProps) { + return ( + + + setValue(paramName, ev.target.checked)} + /> + + + ); +} + +export { SwitchOption }; diff --git a/src/plugins/charts/public/static/index.ts b/src/plugins/charts/public/static/index.ts index bee58e4f1e3e1e..6fc097d05467ff 100644 --- a/src/plugins/charts/public/static/index.ts +++ b/src/plugins/charts/public/static/index.ts @@ -18,3 +18,4 @@ */ export * from './color_maps'; +export * from './components'; diff --git a/src/plugins/vis_type_markdown/public/index.scss b/src/plugins/vis_type_markdown/public/index.scss index ebae2d1936a9e9..ddb7fe3a6b0d9f 100644 --- a/src/plugins/vis_type_markdown/public/index.scss +++ b/src/plugins/vis_type_markdown/public/index.scss @@ -1,5 +1,3 @@ -@import 'src/legacy/ui/public/styles/styling_constants'; - // Prefix all styles with "mkd" to avoid conflicts. // Examples // mkdChart diff --git a/src/plugins/vis_type_markdown/public/markdown_fn.test.ts b/src/plugins/vis_type_markdown/public/markdown_fn.test.ts index ea06f3949501a8..d6085804e74ab8 100644 --- a/src/plugins/vis_type_markdown/public/markdown_fn.test.ts +++ b/src/plugins/vis_type_markdown/public/markdown_fn.test.ts @@ -17,7 +17,6 @@ * under the License. */ -// eslint-disable-next-line import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils'; import { createMarkdownVisFn } from './markdown_fn'; diff --git a/src/plugins/vis_type_markdown/public/plugin.ts b/src/plugins/vis_type_markdown/public/plugin.ts index 34402abe4d4148..3befbd9ef64765 100644 --- a/src/plugins/vis_type_markdown/public/plugin.ts +++ b/src/plugins/vis_type_markdown/public/plugin.ts @@ -24,6 +24,8 @@ import { VisualizationsSetup } from '../../visualizations/public'; import { markdownVisDefinition } from './markdown_vis'; import { createMarkdownVisFn } from './markdown_fn'; +import './index.scss'; + /** @internal */ export interface MarkdownPluginSetupDependencies { expressions: ReturnType; diff --git a/src/plugins/vis_type_markdown/public/settings_options.tsx b/src/plugins/vis_type_markdown/public/settings_options.tsx index 55e1c5cb833993..6f6a80564ce076 100644 --- a/src/plugins/vis_type_markdown/public/settings_options.tsx +++ b/src/plugins/vis_type_markdown/public/settings_options.tsx @@ -22,13 +22,13 @@ import { EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; -// import { RangeOption, SwitchOption } from '../../../legacy/core_plugins/vis_type_vislib/public'; +import { RangeOption, SwitchOption } from '../../charts/public'; import { MarkdownVisParams } from './types'; function SettingsOptions({ stateParams, setValue }: VisOptionsProps) { return ( - {/* */} + /> ); } From 5f1407e0727cd1f47bbc642fa1bd563e2df6113f Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 13 Apr 2020 11:59:13 +0200 Subject: [PATCH 012/134] start moving apps over --- src/core/public/chrome/chrome_service.tsx | 2 +- src/legacy/core_plugins/kibana/index.js | 12 +----- .../core_plugins/kibana/public/kibana.js | 4 +- .../local_application_service.ts | 24 ++++++++--- .../kibana/ui_setting_defaults.js | 2 +- .../public/application/application.ts | 3 ++ .../public/application/legacy_app.js | 15 ++++--- .../dashboard/public/dashboard_constants.ts | 6 +-- src/plugins/dashboard/public/plugin.tsx | 35 +++++++++++----- .../public/application/components/add_data.js | 10 ++--- .../public/application/components/home.js | 2 +- .../public/application/components/home_app.js | 9 +++-- .../components/tutorial/tutorial.js | 4 +- .../components/tutorial_directory.js | 6 +-- .../public/application/components/welcome.tsx | 2 +- src/plugins/home/public/plugin.ts | 3 +- src/plugins/kibana_legacy/public/plugin.ts | 40 ++++++++++++++++--- 17 files changed, 120 insertions(+), 59 deletions(-) diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 7c9b644b8b9849..43fa8f1bb2e316 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -192,7 +192,7 @@ export class ChromeService { forceAppSwitcherNavigation$={navLinks.getForceAppSwitcherNavigation$()} helpExtension$={helpExtension$.pipe(takeUntil(this.stop$))} helpSupportUrl$={helpSupportUrl$.pipe(takeUntil(this.stop$))} - homeHref={http.basePath.prepend('/app/kibana#/home')} + homeHref={http.basePath.prepend('/app/home')} isVisible$={this.isVisible$} kibanaVersion={injectedMetadata.getKibanaVersion()} legacyMode={injectedMetadata.getLegacyMode()} diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 989583742acd0a..9143b46699079b 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -85,17 +85,7 @@ export default function(kibana) { disableSubUrlTracking: true, category: DEFAULT_APP_CATEGORIES.analyze, }, - { - id: 'kibana:dashboard', - title: i18n.translate('kbn.dashboardTitle', { - defaultMessage: 'Dashboard', - }), - order: -1001, - url: `${kbnBaseUrl}#/dashboards`, - euiIconType: 'dashboardApp', - disableSubUrlTracking: true, - category: DEFAULT_APP_CATEGORIES.analyze, - }, + // TODO get rid of kibana:dashboard references { id: 'kibana:dev_tools', title: i18n.translate('kbn.devToolsTitle', { diff --git a/src/legacy/core_plugins/kibana/public/kibana.js b/src/legacy/core_plugins/kibana/public/kibana.js index 20c46765dcb302..e92e3973f3a22e 100644 --- a/src/legacy/core_plugins/kibana/public/kibana.js +++ b/src/legacy/core_plugins/kibana/public/kibana.js @@ -49,8 +49,8 @@ import { showAppRedirectNotification } from '../../../../plugins/kibana_legacy/p import 'leaflet'; import { localApplicationService } from './local_application_service'; -npSetup.plugins.kibanaLegacy.forwardApp('doc', 'discover', { keepPrefix: true }); -npSetup.plugins.kibanaLegacy.forwardApp('context', 'discover', { keepPrefix: true }); +npSetup.plugins.kibanaLegacy.registerLegacyAppAlias('doc', 'discover', { keepPrefix: true }); +npSetup.plugins.kibanaLegacy.registerLegacyAppAlias('context', 'discover', { keepPrefix: true }); localApplicationService.attachToAngular(routes); routes.enable(); diff --git a/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts b/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts index 14564cfd9ee784..96244e3bd3d902 100644 --- a/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts +++ b/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts @@ -98,14 +98,28 @@ export class LocalApplicationService { } }); - npStart.plugins.kibanaLegacy.getForwards().forEach(({ legacyAppId, newAppId, keepPrefix }) => { - angularRouteManager.when(matchAllWithPrefix(legacyAppId), { - resolveRedirectTo: ($location: ILocationService) => { - const url = $location.url(); - return `/${newAppId}${keepPrefix ? url : url.replace(legacyAppId, '')}`; + npStart.plugins.kibanaLegacy.getForwards().forEach(forwardDefinition => { + angularRouteManager.when(matchAllWithPrefix(forwardDefinition.legacyAppId), { + outerAngularWrapperRoute: true, + reloadOnSearch: false, + reloadOnUrl: false, + controller($location: ILocationService) { + const newPath = forwardDefinition.rewritePath($location.url()); + npStart.core.application.navigateToApp(forwardDefinition.newAppId, { path: newPath }); }, }); }); + + npStart.plugins.kibanaLegacy + .getLegacyAppAliases() + .forEach(({ legacyAppId, newAppId, keepPrefix }) => { + angularRouteManager.when(matchAllWithPrefix(legacyAppId), { + resolveRedirectTo: ($location: ILocationService) => { + const url = $location.url(); + return `/${newAppId}${keepPrefix ? url : url.replace(legacyAppId, '')}`; + }, + }); + }); } } diff --git a/src/legacy/core_plugins/kibana/ui_setting_defaults.js b/src/legacy/core_plugins/kibana/ui_setting_defaults.js index 85b1956f453333..3bc38a9e28f0ef 100644 --- a/src/legacy/core_plugins/kibana/ui_setting_defaults.js +++ b/src/legacy/core_plugins/kibana/ui_setting_defaults.js @@ -68,7 +68,7 @@ export function getUiSettingDefaults() { name: i18n.translate('kbn.advancedSettings.defaultRoute.defaultRouteTitle', { defaultMessage: 'Default route', }), - value: '/app/kibana', + value: '/app/home', schema: schema.string({ validate(value) { if (!value.startsWith('/') || !isRelativeUrl(value)) { diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index 3134a5bfe2c67f..fbb534753b9086 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -46,6 +46,9 @@ import { } from '../../../kibana_legacy/public'; import { SavedObjectLoader } from '../../../saved_objects/public'; +// required for i18nIdDirective +import 'angular-sanitize'; + export interface RenderDeps { pluginInitializerContext: PluginInitializerContext; core: CoreStart; diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index 10243dbf2f9798..e9a109b2440c04 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -91,6 +91,9 @@ export function initDashboardApp(app, deps) { }; $routeProvider + .when('/', { + redirectTo: DashboardConstants.LANDING_PAGE_PATH, + }) .when(DashboardConstants.LANDING_PAGE_PATH, { ...defaults, template: dashboardListingTemplate, @@ -244,11 +247,13 @@ export function initDashboardApp(app, deps) { }, }, }) - .when(`dashboard/:tail*?`, { - redirectTo: `/${deps.config.defaultAppId}`, - }) - .when(`dashboards/:tail*?`, { - redirectTo: `/${deps.config.defaultAppId}`, + .otherwise({ + controller: function() { + // TODO this should probably be smarter and avoid the redirect if possible + window.location = deps.core.http.basePath.prepend( + `app/kibana#/${deps.config.defaultAppId}` + ); + }, }); }); } diff --git a/src/plugins/dashboard/public/dashboard_constants.ts b/src/plugins/dashboard/public/dashboard_constants.ts index 0820ebd3710042..a726b20f760525 100644 --- a/src/plugins/dashboard/public/dashboard_constants.ts +++ b/src/plugins/dashboard/public/dashboard_constants.ts @@ -19,8 +19,8 @@ export const DashboardConstants = { ADD_VISUALIZATION_TO_DASHBOARD_MODE_PARAM: 'addToDashboard', - LANDING_PAGE_PATH: '/dashboards', - CREATE_NEW_DASHBOARD_URL: '/dashboard', + LANDING_PAGE_PATH: '/list', + CREATE_NEW_DASHBOARD_URL: '/create', ADD_EMBEDDABLE_ID: 'addEmbeddableId', ADD_EMBEDDABLE_TYPE: 'addEmbeddableType', DASHBOARDS_ID: 'dashboards', @@ -28,5 +28,5 @@ export const DashboardConstants = { }; export function createDashboardEditUrl(id: string) { - return `/dashboard/${id}`; + return `/view/${id}`; } diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 322d734d9f39f4..00552fc3efbf0b 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -173,6 +173,7 @@ export class DashboardPlugin const factory = new DashboardContainerFactory(getStartServices); embeddable.registerEmbeddableFactory(factory.type, factory); + // TODO this doesn't work yet because the new platform doesn't allow it: https://github.com/elastic/kibana/issues/56027 const { appMounted, appUnMounted, stop: stopUrlTracker } = createKbnUrlTracker({ baseUrl: core.http.basePath.prepend('/app/kibana'), defaultSubUrl: `#${DashboardConstants.LANDING_PAGE_PATH}`, @@ -207,8 +208,10 @@ export class DashboardPlugin }; const app: App = { - id: '', + id: DashboardConstants.DASHBOARDS_ID, title: 'Dashboards', + order: -1001, + euiIconType: 'dashboardApp', mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart, dashboardStart] = await core.getStartServices(); appMounted(); @@ -254,14 +257,28 @@ export class DashboardPlugin initAngularBootstrap(); - kibanaLegacy.registerLegacyApp({ - ...app, - id: DashboardConstants.DASHBOARD_ID, - // only register the updater in once app, otherwise all updates would happen twice - updater$: this.appStateUpdater.asObservable(), - navLinkId: 'kibana:dashboard', - }); - kibanaLegacy.registerLegacyApp({ ...app, id: DashboardConstants.DASHBOARDS_ID }); + core.application.register(app); + kibanaLegacy.forwardApp( + DashboardConstants.DASHBOARD_ID, + DashboardConstants.DASHBOARDS_ID, + path => { + if (path === '#/dashboard') { + return '#/create'; + } + const id = /dashboard\/(.*)$/.exec(path)?.[2]; + if (!id) { + return '#/list'; + } + return `#/view/${id}`; + } + ); + kibanaLegacy.forwardApp( + DashboardConstants.DASHBOARDS_ID, + DashboardConstants.DASHBOARDS_ID, + () => { + return `#/list`; + } + ); if (home) { home.featureCatalogue.register({ diff --git a/src/plugins/home/public/application/components/add_data.js b/src/plugins/home/public/application/components/add_data.js index a8093bcd1122cb..f8d8a57ee04b01 100644 --- a/src/plugins/home/public/application/components/add_data.js +++ b/src/plugins/home/public/application/components/add_data.js @@ -101,7 +101,7 @@ const AddDataUi = ({ apmUiEnabled, isNewKibanaInstance, intl, mlEnabled }) => { footer={ @@ -159,7 +159,7 @@ const AddDataUi = ({ apmUiEnabled, isNewKibanaInstance, intl, mlEnabled }) => { { footer={ { footer={ { - + - - - + + + - + + {/* TODO redirect this right */} diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.js b/src/plugins/home/public/application/components/tutorial/tutorial.js index dbb7294729348e..5b2f5315b60ac2 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.js @@ -101,11 +101,11 @@ class TutorialUi extends React.Component { getServices().chrome.setBreadcrumbs([ { text: homeTitle, - href: '#/home', + href: '#/', }, { text: addDataTitle, - href: '#/home/tutorial_directory', + href: '#/tutorial_directory', }, { text: tutorial ? tutorial.name : this.props.tutorialId, diff --git a/src/plugins/home/public/application/components/tutorial_directory.js b/src/plugins/home/public/application/components/tutorial_directory.js index dcaf24a9709fea..18007931a194ab 100644 --- a/src/plugins/home/public/application/components/tutorial_directory.js +++ b/src/plugins/home/public/application/components/tutorial_directory.js @@ -115,7 +115,7 @@ class TutorialDirectoryUi extends React.Component { getServices().chrome.setBreadcrumbs([ { text: homeTitle, - href: '#/home', + href: '#/', }, { text: addDataTitle }, ]); @@ -138,7 +138,7 @@ class TutorialDirectoryUi extends React.Component { icon: icon, name: tutorialConfig.name, description: tutorialConfig.shortDescription, - url: this.props.addBasePath(`#/home/tutorial/${tutorialConfig.id}`), + url: this.props.addBasePath(`#/tutorial/${tutorialConfig.id}`), elasticCloud: tutorialConfig.elasticCloud, // Beta label is skipped on the tutorial overview page for now. Too many beta labels. //isBeta: tutorialConfig.isBeta, @@ -155,7 +155,7 @@ class TutorialDirectoryUi extends React.Component { id: 'home.tutorial.card.sampleDataDescription', defaultMessage: 'Get started exploring Kibana with these "one click" data sets.', }), - url: this.props.addBasePath('#/home/tutorial_directory/sampleData'), + url: this.props.addBasePath('#/tutorial_directory/sampleData'), elasticCloud: true, onClick: this.onSelectedTabChanged.bind(null, SAMPLE_DATA_TAB_ID), }); diff --git a/src/plugins/home/public/application/components/welcome.tsx b/src/plugins/home/public/application/components/welcome.tsx index 8461b10aaa5206..8f7ab5671e4624 100644 --- a/src/plugins/home/public/application/components/welcome.tsx +++ b/src/plugins/home/public/application/components/welcome.tsx @@ -61,7 +61,7 @@ export class Welcome extends React.Component { }; private redirecToSampleData() { - const path = this.services.addBasePath('#/home/tutorial_directory/sampleData'); + const path = this.services.addBasePath('#/tutorial_directory/sampleData'); window.location.href = path; } diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index fab7808b5072e9..ed1868c4505bcf 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -63,9 +63,10 @@ export class HomePublicPlugin core: CoreSetup, { kibanaLegacy, usageCollection }: HomePluginSetupDependencies ): HomePublicPluginSetup { - kibanaLegacy.registerLegacyApp({ + core.application.register({ id: 'home', title: 'Home', + navLinkStatus: 3, // TODO should be fetched by enum mount: async (params: AppMountParameters) => { const trackUiMetric = usageCollection ? usageCollection.reportUiStats.bind(usageCollection, 'Kibana_home') diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index 2ad620f355848a..8feb82a46841b0 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -28,12 +28,18 @@ import { Observable } from 'rxjs'; import { ConfigSchema } from '../config'; import { getDashboardConfig } from './dashboard_config'; -interface ForwardDefinition { +interface LegacyAppAliasDefinition { legacyAppId: string; newAppId: string; keepPrefix: boolean; } +interface ForwardDefinition { + legacyAppId: string; + newAppId: string; + rewritePath: (legacyPath: string) => string; +} + export type AngularRenderedAppUpdater = ( app: AppBase ) => Partial | undefined; @@ -54,7 +60,8 @@ export interface AngularRenderedApp extends App { export class KibanaLegacyPlugin { private apps: AngularRenderedApp[] = []; - private forwards: ForwardDefinition[] = []; + private legacyAppAliases: LegacyAppAliasDefinition[] = []; + private forwardDefinitions: ForwardDefinition[] = []; constructor(private readonly initializerContext: PluginInitializerContext) {} @@ -94,17 +101,35 @@ export class KibanaLegacyPlugin { * renaming or nesting plugins. For route changes after the prefix, please * use the routing mechanism of your app. * + * This method just redirects URLs within the legacy `kibana` app. + * * @param legacyAppId The name of the old app to forward URLs from * @param newAppId The name of the new app that handles the URLs now * @param options Whether the prefix of the old app is kept to nest the legacy * path into the new path */ - forwardApp: ( + registerLegacyAppAlias: ( legacyAppId: string, newAppId: string, options: { keepPrefix: boolean } = { keepPrefix: false } ) => { - this.forwards.push({ legacyAppId, newAppId, ...options }); + this.legacyAppAliases.push({ legacyAppId, newAppId, ...options }); + }, + + /** + * Forwards URLs within the legacy `kibana` app to a new platform application. + * + * @param legacyAppId The name of the old app to forward URLs from + * @param newAppId The name of the new app that handles the URLs now + * @param options Whether the prefix of the old app is kept to nest the legacy + * path into the new path + */ + forwardApp: ( + legacyAppId: string, + newAppId: string, + rewritePath: (legacyPath: string) => string + ) => { + this.forwardDefinitions.push({ legacyAppId, newAppId, rewritePath }); }, /** @@ -132,7 +157,12 @@ export class KibanaLegacyPlugin { * @deprecated * Just exported for wiring up with legacy platform, should not be used. */ - getForwards: () => this.forwards, + getLegacyAppAliases: () => this.legacyAppAliases, + /** + * @deprecated + * Just exported for wiring up with legacy platform, should not be used. + */ + getForwards: () => this.forwardDefinitions, config: this.initializerContext.config.get(), dashboardConfig: getDashboardConfig(!application.capabilities.dashboard.showWriteControls), }; From 39387b12f30e3c52f9e72621b6d7414a2feeaefa Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 14 Apr 2020 10:24:24 +0200 Subject: [PATCH 013/134] fix redirect for dashboards --- .../local_application_service.ts | 1 + .../public/application/legacy_app.js | 3 ++- src/plugins/dashboard/public/plugin.tsx | 21 ++++++++++++------- src/plugins/kibana_legacy/public/plugin.ts | 2 +- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts b/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts index 96244e3bd3d902..f38c410e6832f7 100644 --- a/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts +++ b/src/legacy/core_plugins/kibana/public/local_application_service/local_application_service.ts @@ -103,6 +103,7 @@ export class LocalApplicationService { outerAngularWrapperRoute: true, reloadOnSearch: false, reloadOnUrl: false, + template: '', controller($location: ILocationService) { const newPath = forwardDefinition.rewritePath($location.url()); npStart.core.application.navigateToApp(forwardDefinition.newAppId, { path: newPath }); diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index e9a109b2440c04..77f1e3126c2f32 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -248,8 +248,9 @@ export function initDashboardApp(app, deps) { }, }) .otherwise({ + template: '', controller: function() { - // TODO this should probably be smarter and avoid the redirect if possible + // TODO this should probably be smarter and avoid the double-redirect if possible window.location = deps.core.http.basePath.prepend( `app/kibana#/${deps.config.defaultAppId}` ); diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 00552fc3efbf0b..8777916adc87d2 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -262,21 +262,26 @@ export class DashboardPlugin DashboardConstants.DASHBOARD_ID, DashboardConstants.DASHBOARDS_ID, path => { - if (path === '#/dashboard') { - return '#/create'; - } - const id = /dashboard\/(.*)$/.exec(path)?.[2]; - if (!id) { + const [, id, tail] = /dashboard\/(.*?)($|\?)(.*)/.exec(path) || []; + if (!id && !tail) { + // unrecognized sub url return '#/list'; } - return `#/view/${id}`; + if (!id && tail) { + // unsaved dashboard, but probably state in URL + return `#/create${tail || ''}`; + } + // persisted dashboard, probably with url state + return `#/view/${id}${tail || ''}`; } ); kibanaLegacy.forwardApp( DashboardConstants.DASHBOARDS_ID, DashboardConstants.DASHBOARDS_ID, - () => { - return `#/list`; + path => { + const [, tail] = /(\?.*)/.exec(path) || []; + // carry over query if it exists + return `#/list${tail || ''}`; } ); diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index 8feb82a46841b0..83cb9473d607fc 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -121,7 +121,7 @@ export class KibanaLegacyPlugin { * * @param legacyAppId The name of the old app to forward URLs from * @param newAppId The name of the new app that handles the URLs now - * @param options Whether the prefix of the old app is kept to nest the legacy + * @param rewritePath Function to rewrite the legacy sub path of the app to the new path in the core app * path into the new path */ forwardApp: ( From dde7972876632fa7ea2f925734a29861c6685d0b Mon Sep 17 00:00:00 2001 From: sulemanof Date: Tue, 14 Apr 2020 18:22:12 +0300 Subject: [PATCH 014/134] Move discover into NP --- src/legacy/core_plugins/kibana/index.js | 6 +- .../kibana/public/discover/_index.scss | 2 - .../kibana/public/discover/index.ts | 26 -- .../kibana/public/discover/legacy.ts | 27 -- .../kibana/public/discover/plugin.ts | 229 --------------- .../core_plugins/kibana/public/index.scss | 3 - .../core_plugins/kibana/public/kibana.js | 1 - src/plugins/discover/kibana.json | 13 +- .../public/application}/_discover.scss | 0 .../discover/public/application}/_hacks.scss | 0 .../discover/public/application}/_mixins.scss | 0 .../public/application}/angular/_index.scss | 0 .../public/application}/angular/context.html | 0 .../public/application}/angular/context.js | 0 .../application}/angular/context/NOTES.md | 0 .../application}/angular/context/_index.scss | 0 .../angular/context/api/_stubs.js | 2 +- .../angular/context/api/anchor.js | 0 .../angular/context/api/anchor.test.js | 0 .../context/api/context.predecessors.test.js | 0 .../context/api/context.successors.test.js | 0 .../angular/context/api/context.ts | 2 +- .../api/utils}/date_conversion.test.ts | 2 +- .../context/api/utils/date_conversion.ts | 0 .../api/utils/fetch_hits_in_interval.ts | 6 +- .../context/api/utils/generate_intervals.ts | 2 +- .../api/utils/get_es_query_search_after.ts | 0 .../context/api/utils/get_es_query_sort.ts | 0 .../context/api/utils}/sorting.test.ts | 2 +- .../angular/context/api/utils/sorting.ts | 0 .../components/action_bar/_action_bar.scss | 0 .../context/components/action_bar/_index.scss | 0 .../components/action_bar/action_bar.test.tsx | 0 .../components/action_bar/action_bar.tsx | 0 .../action_bar/action_bar_directive.ts | 0 .../action_bar/action_bar_warning.tsx | 0 .../context/components/action_bar/index.ts | 0 .../helpers/call_after_bindings_workaround.js | 0 .../angular/context/query/actions.js | 2 +- .../angular/context/query/constants.js | 0 .../angular/context/query/index.js | 0 .../angular/context/query/state.js | 0 .../context/query_parameters/actions.js | 2 +- .../context/query_parameters/actions.test.ts | 4 +- .../context/query_parameters/constants.ts | 0 .../angular/context/query_parameters/index.js | 0 .../angular/context/query_parameters/state.ts | 0 .../application}/angular/context_app.html | 0 .../application}/angular/context_app.js | 0 .../angular/context_state.test.ts | 4 +- .../application}/angular/context_state.ts | 4 +- .../__snapshots__/no_results.test.js.snap | 0 .../angular/directives/_histogram.scss | 0 .../angular/directives/_index.scss | 0 .../angular/directives/_no_results.scss | 0 .../_collapsible_sidebar.scss | 0 .../collapsible_sidebar/_depth.scss | 0 .../collapsible_sidebar/_index.scss | 0 .../collapsible_sidebar.ts | 0 .../angular/directives/debounce/debounce.js | 0 .../directives/debounce/debounce.test.ts} | 70 +++-- .../angular/directives/debounce/index.js | 0 .../angular/directives/fixed_scroll.js | 0 .../angular/directives/histogram.tsx | 0 .../application}/angular/directives/index.js | 0 .../angular/directives/no_results.js | 0 .../angular/directives/no_results.test.js | 0 .../angular/directives/render_complete.ts | 2 +- .../angular/directives/uninitialized.tsx | 0 .../public/application}/angular/discover.html | 0 .../public/application}/angular/discover.js | 11 +- .../angular/discover_state.test.ts | 0 .../application}/angular/discover_state.ts | 6 +- .../public/application}/angular/doc.html | 0 .../public/application}/angular/doc.ts | 0 .../angular/doc_table/_doc_table.scss | 0 .../angular/doc_table/_index.scss | 0 .../angular/doc_table/actions/columns.ts | 0 .../angular/doc_table/components/_index.scss | 0 .../doc_table/components/_table_header.scss | 0 .../tool_bar_pager_buttons.test.tsx.snap | 0 .../tool_bar_pager_text.test.tsx.snap | 0 .../doc_table/components/pager/index.ts | 0 .../pager/tool_bar_pager_buttons.test.tsx | 0 .../pager/tool_bar_pager_buttons.tsx | 0 .../pager/tool_bar_pager_text.test.tsx | 0 .../components/pager/tool_bar_pager_text.tsx | 0 .../doc_table/components/table_header.ts | 0 .../__snapshots__/table_header.test.tsx.snap | 0 .../components/table_header/helpers.tsx | 0 .../table_header/table_header.test.tsx | 0 .../components/table_header/table_header.tsx | 0 .../table_header/table_header_column.tsx | 0 .../angular/doc_table/components/table_row.ts | 6 +- .../doc_table/components/table_row/_cell.scss | 0 .../components/table_row/_details.scss | 0 .../components/table_row/_index.scss | 0 .../doc_table/components/table_row/_open.scss | 0 .../doc_table/components/table_row/cell.html | 0 .../components/table_row/details.html | 0 .../doc_table/components/table_row/open.html | 0 .../table_row/truncate_by_height.html | 0 .../angular/doc_table/doc_table.html | 0 .../angular/doc_table/doc_table.ts | 2 +- .../angular/doc_table/doc_table_strings.js | 0 .../application}/angular/doc_table/index.ts | 0 .../angular/doc_table/infinite_scroll.ts | 0 .../angular/doc_table/lib/get_default_sort.ts | 0 .../angular/doc_table/lib/get_sort.test.ts | 0 .../angular/doc_table/lib/get_sort.ts | 2 +- .../lib/get_sort_for_search_source.ts | 0 .../angular/doc_table/lib/pager/index.js | 0 .../angular/doc_table/lib/pager/pager.js | 0 .../doc_table/lib/pager/pager_factory.ts | 0 .../application}/angular/doc_viewer.tsx | 3 +- .../angular/get_painless_error.ts | 0 .../application}/angular/helpers/index.ts | 0 .../angular/helpers/point_series.ts | 2 +- .../public/application}/angular/index.ts | 0 .../application}/angular/response_handler.js | 0 .../public/application}/application.ts | 1 + .../application}/components/_index.scss | 1 + .../application}/components/doc/doc.test.tsx | 1 - .../application}/components/doc/doc.tsx | 4 +- .../components/doc/use_es_doc_search.test.tsx | 0 .../components/doc/use_es_doc_search.ts | 2 +- .../__snapshots__/doc_viewer.test.tsx.snap | 0 .../doc_viewer_render_tab.test.tsx.snap | 0 .../components/doc_viewer/_doc_viewer.scss | 0 .../components/doc_viewer/_index.scss | 0 .../components/doc_viewer/doc_viewer.test.tsx | 2 +- .../components/doc_viewer/doc_viewer.tsx | 2 +- .../doc_viewer/doc_viewer_render_error.tsx | 2 +- .../doc_viewer/doc_viewer_render_tab.test.tsx | 0 .../doc_viewer/doc_viewer_render_tab.tsx | 0 .../components/doc_viewer/doc_viewer_tab.tsx | 0 .../components/fetch_error/_fetch_error.scss | 0 .../components/fetch_error/_index.scss | 0 .../components/fetch_error/fetch_error.tsx | 0 .../components/fetch_error/index.js | 0 .../__snapshots__/field_name.test.tsx.snap | 0 .../components/field_name/field_name.test.tsx | 0 .../components/field_name/field_name.tsx | 2 +- .../components/field_name/field_type_name.ts | 0 .../components/help_menu/help_menu_util.js | 0 .../json_code_block.test.tsx.snap | 0 .../json_code_block/json_code_block.test.tsx | 2 +- .../json_code_block/json_code_block.tsx | 0 .../discover_index_pattern.test.tsx.snap | 0 .../components/sidebar/_index.scss | 0 .../components/sidebar/_sidebar.scss | 0 .../sidebar/change_indexpattern.tsx | 0 .../sidebar/discover_field.test.tsx | 4 +- .../components/sidebar/discover_field.tsx | 4 +- .../sidebar/discover_field_bucket.tsx | 2 +- .../sidebar/discover_field_details.tsx | 2 +- .../sidebar/discover_field_search.test.tsx | 0 .../sidebar/discover_field_search.tsx | 0 .../sidebar/discover_index_pattern.test.tsx | 0 .../sidebar/discover_index_pattern.tsx | 0 .../sidebar/discover_sidebar.test.tsx | 6 +- .../components/sidebar/discover_sidebar.tsx | 10 +- .../sidebar/discover_sidebar_directive.ts | 0 .../application}/components/sidebar/index.ts | 0 .../sidebar/lib/field_calculator.js | 0 .../sidebar/lib/field_calculator.test.ts | 4 +- .../sidebar/lib/field_filter.test.ts | 2 +- .../components/sidebar/lib/field_filter.ts | 2 +- .../components/sidebar/lib/get_details.ts | 2 +- .../sidebar/lib/get_field_type_name.ts | 0 .../lib/get_index_pattern_field_list.ts | 2 +- .../components/sidebar/lib/get_warnings.ts | 2 +- .../sidebar/lib/group_fields.test.ts | 0 .../components/sidebar/lib/group_fields.tsx | 5 +- .../sidebar/lib/visualize_url_utils.ts | 7 +- .../sidebar/string_progress_bar.tsx | 0 .../application}/components/sidebar/types.ts | 0 .../components/table/table.test.tsx | 2 +- .../components/table/table.tsx | 0 .../components/table/table_helper.test.ts | 0 .../components/table/table_helper.tsx | 0 .../components/table/table_row.tsx | 0 .../table/table_row_btn_collapse.tsx | 0 .../table/table_row_btn_filter_add.tsx | 0 .../table/table_row_btn_filter_exists.tsx | 0 .../table/table_row_btn_filter_remove.tsx | 0 .../table/table_row_btn_toggle_column.tsx | 0 .../table/table_row_icon_no_mapping.tsx | 0 .../table/table_row_icon_underscore.tsx | 0 .../open_search_panel.test.js.snap | 0 .../components/top_nav/open_search_panel.js | 2 +- .../top_nav/open_search_panel.test.js | 0 .../top_nav/show_open_search_panel.js | 0 .../doc_views/doc_views_helpers.tsx | 0 .../doc_views/doc_views_registry.ts | 4 +- .../doc_views/doc_views_types.ts | 2 +- .../application}/embeddable/_embeddables.scss | 0 .../application}/embeddable/_index.scss | 0 .../application}/embeddable/constants.ts | 0 .../public/application}/embeddable/index.ts | 0 .../embeddable/search_embeddable.ts | 13 +- .../embeddable/search_embeddable_factory.ts | 4 +- .../embeddable/search_template.html | 0 .../public/application}/embeddable/types.ts | 4 +- .../application}/helpers/breadcrumbs.ts | 0 .../helpers/get_index_pattern_id.ts | 2 +- .../public/application}/helpers/index.ts | 0 .../helpers/shorten_dotted_string.ts | 0 .../discover/public/application/index.scss} | 0 .../discover/public}/build_services.ts | 28 +- .../discover/public/components/_index.scss | 1 - .../discover/public}/get_inner_angular.ts | 45 +-- src/plugins/discover/public/helpers/index.ts | 20 -- .../public/helpers/shorten_dotted_string.ts | 26 -- src/plugins/discover/public/index.scss | 1 - src/plugins/discover/public/index.ts | 14 +- .../discover/public}/kibana_services.ts | 19 +- src/plugins/discover/public/mocks.ts | 4 - src/plugins/discover/public/plugin.ts | 262 +++++++++++++++--- .../discover/public}/register_feature.ts | 5 +- .../discover/public/saved_searches/index.ts | 3 +- src/plugins/discover/public/services.ts | 25 -- 222 files changed, 411 insertions(+), 591 deletions(-) delete mode 100644 src/legacy/core_plugins/kibana/public/discover/_index.scss delete mode 100644 src/legacy/core_plugins/kibana/public/discover/index.ts delete mode 100644 src/legacy/core_plugins/kibana/public/discover/legacy.ts delete mode 100644 src/legacy/core_plugins/kibana/public/discover/plugin.ts rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/_discover.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/_hacks.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/_mixins.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/NOTES.md (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/_stubs.js (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/anchor.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/anchor.test.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/context.predecessors.test.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/context.successors.test.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/context.ts (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__ => plugins/discover/public/application/angular/context/api/utils}/date_conversion.test.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/date_conversion.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/fetch_hits_in_interval.ts (95%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/generate_intervals.ts (95%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/get_es_query_search_after.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/get_es_query_sort.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__ => plugins/discover/public/application/angular/context/api/utils}/sorting.test.ts (94%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/api/utils/sorting.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/_action_bar.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/action_bar.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/action_bar.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/action_bar_directive.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/action_bar_warning.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/components/action_bar/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/helpers/call_after_bindings_workaround.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query/actions.js (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query/constants.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query/index.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query/state.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query_parameters/actions.js (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query_parameters/actions.test.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query_parameters/constants.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query_parameters/index.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context/query_parameters/state.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context_app.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context_app.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context_state.test.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/context_state.ts (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/__snapshots__/no_results.test.js.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/_histogram.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/_no_results.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/collapsible_sidebar/_depth.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/collapsible_sidebar/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/collapsible_sidebar/collapsible_sidebar.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/debounce/debounce.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/__tests__/debounce.js => plugins/discover/public/application/angular/directives/debounce/debounce.test.ts} (71%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/debounce/index.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/fixed_scroll.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/histogram.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/index.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/no_results.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/no_results.test.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/render_complete.ts (92%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/directives/uninitialized.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/discover.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/discover.js (99%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/discover_state.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/discover_state.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/_doc_table.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/actions/columns.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/_table_header.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_buttons.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_text.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/pager/tool_bar_pager_text.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header/__snapshots__/table_header.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header/helpers.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header/table_header.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header/table_header.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_header/table_header_column.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/_cell.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/_details.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/_open.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/cell.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/details.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/open.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/components/table_row/truncate_by_height.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/doc_table.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/doc_table.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/doc_table_strings.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/infinite_scroll.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/get_default_sort.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/get_sort.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/get_sort.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/get_sort_for_search_source.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/pager/index.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/pager/pager.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_table/lib/pager/pager_factory.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/doc_viewer.tsx (93%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/get_painless_error.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/helpers/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/helpers/point_series.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/angular/response_handler.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/application.ts (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/_index.scss (65%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/doc/doc.test.tsx (99%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/doc/doc.tsx (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/doc/use_es_doc_search.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/doc/use_es_doc_search.ts (97%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/__snapshots__/doc_viewer_render_tab.test.tsx.snap (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/_doc_viewer.scss (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/_index.scss (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer.test.tsx (97%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer.tsx (96%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer_render_error.tsx (94%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer_render_tab.test.tsx (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer_render_tab.tsx (100%) rename src/plugins/discover/public/{ => application}/components/doc_viewer/doc_viewer_tab.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/fetch_error/_fetch_error.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/fetch_error/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/fetch_error/fetch_error.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/fetch_error/index.js (100%) rename src/plugins/discover/public/{ => application}/components/field_name/__snapshots__/field_name.test.tsx.snap (100%) rename src/plugins/discover/public/{ => application}/components/field_name/field_name.test.tsx (100%) rename src/plugins/discover/public/{ => application}/components/field_name/field_name.tsx (96%) rename src/plugins/discover/public/{ => application}/components/field_name/field_type_name.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/help_menu/help_menu_util.js (100%) rename src/plugins/discover/public/{ => application}/components/json_code_block/__snapshots__/json_code_block.test.tsx.snap (100%) rename src/plugins/discover/public/{ => application}/components/json_code_block/json_code_block.test.tsx (95%) rename src/plugins/discover/public/{ => application}/components/json_code_block/json_code_block.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/__snapshots__/discover_index_pattern.test.tsx.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/_sidebar.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/change_indexpattern.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field.test.tsx (95%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field.tsx (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field_bucket.tsx (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field_details.tsx (99%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field_search.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_field_search.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_index_pattern.test.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_index_pattern.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_sidebar.test.tsx (94%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_sidebar.tsx (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/discover_sidebar_directive.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/field_calculator.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/field_calculator.test.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/field_filter.test.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/field_filter.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/get_details.ts (98%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/get_field_type_name.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/get_index_pattern_field_list.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/get_warnings.ts (94%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/group_fields.test.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/group_fields.tsx (95%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/lib/visualize_url_utils.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/string_progress_bar.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/sidebar/types.ts (100%) rename src/plugins/discover/public/{ => application}/components/table/table.test.tsx (99%) rename src/plugins/discover/public/{ => application}/components/table/table.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_helper.test.ts (100%) rename src/plugins/discover/public/{ => application}/components/table/table_helper.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_btn_collapse.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_btn_filter_add.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_btn_filter_exists.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_btn_filter_remove.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_btn_toggle_column.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_icon_no_mapping.tsx (100%) rename src/plugins/discover/public/{ => application}/components/table/table_row_icon_underscore.tsx (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/top_nav/__snapshots__/open_search_panel.test.js.snap (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/top_nav/open_search_panel.js (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/top_nav/open_search_panel.test.js (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/components/top_nav/show_open_search_panel.js (100%) rename src/plugins/discover/public/{ => application}/doc_views/doc_views_helpers.tsx (100%) rename src/plugins/discover/public/{ => application}/doc_views/doc_views_registry.ts (95%) rename src/plugins/discover/public/{ => application}/doc_views/doc_views_types.ts (97%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/_embeddables.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/_index.scss (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/constants.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/search_embeddable.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/search_embeddable_factory.ts (96%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/search_template.html (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/embeddable/types.ts (93%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/helpers/breadcrumbs.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/helpers/get_index_pattern_id.ts (95%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/helpers/index.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public/application}/helpers/shorten_dotted_string.ts (100%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready/_index.scss => plugins/discover/public/application/index.scss} (100%) rename src/{legacy/core_plugins/kibana/public/discover => plugins/discover/public}/build_services.ts (83%) delete mode 100644 src/plugins/discover/public/components/_index.scss rename src/{legacy/core_plugins/kibana/public/discover => plugins/discover/public}/get_inner_angular.ts (79%) delete mode 100644 src/plugins/discover/public/helpers/index.ts delete mode 100644 src/plugins/discover/public/helpers/shorten_dotted_string.ts delete mode 100644 src/plugins/discover/public/index.scss rename src/{legacy/core_plugins/kibana/public/discover => plugins/discover/public}/kibana_services.ts (80%) rename src/{legacy/core_plugins/kibana/public/discover/np_ready => plugins/discover/public}/register_feature.ts (92%) delete mode 100644 src/plugins/discover/public/services.ts diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 1d643418997f56..021afb7ad5ae37 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -54,11 +54,7 @@ export default function(kibana) { }, uiExports: { - hacks: [ - 'plugins/kibana/discover/legacy', - 'plugins/kibana/dev_tools', - 'plugins/kibana/visualize/legacy', - ], + hacks: ['plugins/kibana/dev_tools', 'plugins/kibana/visualize/legacy'], app: { id: 'kibana', title: 'Kibana', diff --git a/src/legacy/core_plugins/kibana/public/discover/_index.scss b/src/legacy/core_plugins/kibana/public/discover/_index.scss deleted file mode 100644 index 386472a9f6e015..00000000000000 --- a/src/legacy/core_plugins/kibana/public/discover/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -// Discover plugin styles -@import 'np_ready/index'; diff --git a/src/legacy/core_plugins/kibana/public/discover/index.ts b/src/legacy/core_plugins/kibana/public/discover/index.ts deleted file mode 100644 index b449b70418d020..00000000000000 --- a/src/legacy/core_plugins/kibana/public/discover/index.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 'kibana/public'; -import { DiscoverPlugin } from './plugin'; - -// Core will be looking for this when loading our plugin in the new platform -export const plugin = (context: PluginInitializerContext) => { - return new DiscoverPlugin(); -}; diff --git a/src/legacy/core_plugins/kibana/public/discover/legacy.ts b/src/legacy/core_plugins/kibana/public/discover/legacy.ts deleted file mode 100644 index f08fd22c718504..00000000000000 --- a/src/legacy/core_plugins/kibana/public/discover/legacy.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 'kibana/public'; -import { npSetup, npStart } from 'ui/new_platform'; -import { plugin } from './index'; - -// Legacy compatibility part - to be removed at cutover, replaced by a kibana.json file -export const pluginInstance = plugin({} as PluginInitializerContext); -export const setup = pluginInstance.setup(npSetup.core, npSetup.plugins); -export const start = pluginInstance.start(npStart.core, npStart.plugins); diff --git a/src/legacy/core_plugins/kibana/public/discover/plugin.ts b/src/legacy/core_plugins/kibana/public/discover/plugin.ts deleted file mode 100644 index d05e96ccaaf0b0..00000000000000 --- a/src/legacy/core_plugins/kibana/public/discover/plugin.ts +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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 { AppMountParameters, CoreSetup, CoreStart, Plugin } from 'kibana/public'; -import angular, { auto } from 'angular'; -import { UiActionsSetup, UiActionsStart } from 'src/plugins/ui_actions/public'; -import { - DataPublicPluginStart, - DataPublicPluginSetup, - esFilters, -} from '../../../../../plugins/data/public'; -import { registerFeature } from './np_ready/register_feature'; -import './kibana_services'; -import { EmbeddableStart, EmbeddableSetup } from '../../../../../plugins/embeddable/public'; -import { getInnerAngularModule, getInnerAngularModuleEmbeddable } from './get_inner_angular'; -import { setAngularModule, setServices, setUrlTracker } from './kibana_services'; -import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public'; -import { ChartsPluginStart } from '../../../../../plugins/charts/public'; -import { buildServices } from './build_services'; -import { SharePluginStart } from '../../../../../plugins/share/public'; -import { - KibanaLegacySetup, - AngularRenderedAppUpdater, -} from '../../../../../plugins/kibana_legacy/public'; -import { DiscoverSetup, DiscoverStart } from '../../../../../plugins/discover/public'; -import { HomePublicPluginSetup } from '../../../../../plugins/home/public'; -import { - VisualizationsStart, - VisualizationsSetup, -} from '../../../../../plugins/visualizations/public'; -import { createKbnUrlTracker } from '../../../../../plugins/kibana_utils/public'; - -export interface DiscoverSetupPlugins { - uiActions: UiActionsSetup; - embeddable: EmbeddableSetup; - kibanaLegacy: KibanaLegacySetup; - home: HomePublicPluginSetup; - visualizations: VisualizationsSetup; - data: DataPublicPluginSetup; - discover: DiscoverSetup; -} -export interface DiscoverStartPlugins { - uiActions: UiActionsStart; - embeddable: EmbeddableStart; - navigation: NavigationStart; - charts: ChartsPluginStart; - data: DataPublicPluginStart; - share: SharePluginStart; - inspector: any; - visualizations: VisualizationsStart; - discover: DiscoverStart; -} -const innerAngularName = 'app/discover'; -const embeddableAngularName = 'app/discoverEmbeddable'; - -/** - * Contains Discover, one of the oldest parts of Kibana - * There are 2 kinds of Angular bootstrapped for rendering, additionally to the main Angular - * Discover provides embeddables, those contain a slimmer Angular - */ -export class DiscoverPlugin implements Plugin { - private servicesInitialized: boolean = false; - private innerAngularInitialized: boolean = false; - private embeddableInjector: auto.IInjectorService | null = null; - private getEmbeddableInjector: (() => Promise) | null = null; - private appStateUpdater = new BehaviorSubject(() => ({})); - private stopUrlTracking: (() => void) | undefined = undefined; - - /** - * why are those functions public? they are needed for some mocha tests - * can be removed once all is Jest - */ - public initializeInnerAngular?: () => void; - public initializeServices?: () => Promise<{ core: CoreStart; plugins: DiscoverStartPlugins }>; - - setup(core: CoreSetup, plugins: DiscoverSetupPlugins) { - const { - appMounted, - appUnMounted, - stop: stopUrlTracker, - setActiveUrl: setTrackedUrl, - } = createKbnUrlTracker({ - baseUrl: core.http.basePath.prepend('/app/kibana'), - defaultSubUrl: '#/discover', - storageKey: `lastUrl:${core.http.basePath.get()}:discover`, - navLinkUpdater$: this.appStateUpdater, - toastNotifications: core.notifications.toasts, - stateParams: [ - { - kbnUrlKey: '_g', - stateUpdate$: plugins.data.query.state$.pipe( - filter( - ({ changes }) => !!(changes.globalFilters || changes.time || changes.refreshInterval) - ), - map(({ state }) => ({ - ...state, - filters: state.filters?.filter(esFilters.isFilterPinned), - })) - ), - }, - ], - }); - setUrlTracker({ setTrackedUrl }); - this.stopUrlTracking = () => { - stopUrlTracker(); - }; - - this.getEmbeddableInjector = this.getInjector.bind(this); - plugins.discover.docViews.setAngularInjectorGetter(this.getEmbeddableInjector); - plugins.kibanaLegacy.registerLegacyApp({ - id: 'discover', - title: 'Discover', - updater$: this.appStateUpdater.asObservable(), - navLinkId: 'kibana:discover', - order: -1004, - euiIconType: 'discoverApp', - mount: async (params: AppMountParameters) => { - if (!this.initializeServices) { - throw Error('Discover plugin method initializeServices is undefined'); - } - if (!this.initializeInnerAngular) { - throw Error('Discover plugin method initializeInnerAngular is undefined'); - } - appMounted(); - await this.initializeServices(); - await this.initializeInnerAngular(); - - const { renderApp } = await import('./np_ready/application'); - const unmount = await renderApp(innerAngularName, params.element); - return () => { - unmount(); - appUnMounted(); - }; - }, - }); - registerFeature(plugins.home); - this.registerEmbeddable(core, plugins); - } - - start(core: CoreStart, plugins: DiscoverStartPlugins) { - // we need to register the application service at setup, but to render it - // there are some start dependencies necessary, for this reason - // initializeInnerAngular + initializeServices are assigned at start and used - // when the application/embeddable is mounted - this.initializeInnerAngular = async () => { - if (this.innerAngularInitialized) { - return; - } - // this is used by application mount and tests - const module = getInnerAngularModule(innerAngularName, core, plugins); - setAngularModule(module); - this.innerAngularInitialized = true; - }; - - this.initializeServices = async () => { - if (this.servicesInitialized) { - return { core, plugins }; - } - const services = await buildServices(core, plugins); - setServices(services); - this.servicesInitialized = true; - - return { core, plugins }; - }; - } - - stop() { - if (this.stopUrlTracking) { - this.stopUrlTracking(); - } - } - - /** - * register embeddable with a slimmer embeddable version of inner angular - */ - private async registerEmbeddable( - core: CoreSetup, - plugins: DiscoverSetupPlugins - ) { - const { SearchEmbeddableFactory } = await import('./np_ready/embeddable'); - - if (!this.getEmbeddableInjector) { - throw Error('Discover plugin method getEmbeddableInjector is undefined'); - } - - const getStartServices = async () => { - const [coreStart, deps] = await core.getStartServices(); - return { - executeTriggerActions: deps.uiActions.executeTriggerActions, - isEditable: () => coreStart.application.capabilities.discover.save as boolean, - }; - }; - - const factory = new SearchEmbeddableFactory(getStartServices, this.getEmbeddableInjector); - plugins.embeddable.registerEmbeddableFactory(factory.type, factory); - } - - private async getInjector() { - if (!this.embeddableInjector) { - if (!this.initializeServices) { - throw Error('Discover plugin getEmbeddableInjector: initializeServices is undefined'); - } - const { core, plugins } = await this.initializeServices(); - getInnerAngularModuleEmbeddable(embeddableAngularName, core, plugins); - const mountpoint = document.createElement('div'); - this.embeddableInjector = angular.bootstrap(mountpoint, [embeddableAngularName]); - } - - return this.embeddableInjector; - } -} diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index fbfb0a06fabcff..503f26ddb81408 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -10,9 +10,6 @@ // vis_type_vislib UI styles @import 'src/legacy/core_plugins/vis_type_vislib/public/index'; -// Discover styles -@import 'discover/index'; - // Visualize styles @import './visualize/index'; // Has to come after visualize because of some diff --git a/src/legacy/core_plugins/kibana/public/kibana.js b/src/legacy/core_plugins/kibana/public/kibana.js index 0a026a5e0c3109..f1debc08b937bf 100644 --- a/src/legacy/core_plugins/kibana/public/kibana.js +++ b/src/legacy/core_plugins/kibana/public/kibana.js @@ -42,7 +42,6 @@ import 'uiExports/shareContextMenuExtensions'; import 'uiExports/interpreter'; import 'ui/autoload/all'; -import './discover/legacy'; import './visualize/legacy'; import './management'; import './dev_tools'; diff --git a/src/plugins/discover/kibana.json b/src/plugins/discover/kibana.json index 91d6358d44c18f..124c4a297d80d7 100644 --- a/src/plugins/discover/kibana.json +++ b/src/plugins/discover/kibana.json @@ -2,5 +2,16 @@ "id": "discover", "version": "kibana", "server": false, - "ui": true + "ui": true, + "requiredPlugins": [ + "charts", + "data", + "embeddable", + "inspector", + "kibanaLegacy", + "navigation", + "uiActions", + "visualizations" + ], + "optionalPlugins": ["home", "share"] } diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/_discover.scss b/src/plugins/discover/public/application/_discover.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/_discover.scss rename to src/plugins/discover/public/application/_discover.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/_hacks.scss b/src/plugins/discover/public/application/_hacks.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/_hacks.scss rename to src/plugins/discover/public/application/_hacks.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/_mixins.scss b/src/plugins/discover/public/application/_mixins.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/_mixins.scss rename to src/plugins/discover/public/application/_mixins.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/_index.scss b/src/plugins/discover/public/application/angular/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/_index.scss rename to src/plugins/discover/public/application/angular/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context.html b/src/plugins/discover/public/application/angular/context.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context.html rename to src/plugins/discover/public/application/angular/context.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context.js b/src/plugins/discover/public/application/angular/context.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context.js rename to src/plugins/discover/public/application/angular/context.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/NOTES.md b/src/plugins/discover/public/application/angular/context/NOTES.md similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/NOTES.md rename to src/plugins/discover/public/application/angular/context/NOTES.md diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/_index.scss b/src/plugins/discover/public/application/angular/context/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/_index.scss rename to src/plugins/discover/public/application/angular/context/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/_stubs.js b/src/plugins/discover/public/application/angular/context/api/_stubs.js similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/_stubs.js rename to src/plugins/discover/public/application/angular/context/api/_stubs.js index f6ed570be2c373..959ccd3b80e203 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/_stubs.js +++ b/src/plugins/discover/public/application/angular/context/api/_stubs.js @@ -19,7 +19,7 @@ import sinon from 'sinon'; import moment from 'moment'; -import { SearchSource } from '../../../../../../../../../plugins/data/public'; +import { SearchSource } from '../../../../../../data/public'; export function createIndexPatternsStub() { return { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/anchor.js b/src/plugins/discover/public/application/angular/context/api/anchor.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/anchor.js rename to src/plugins/discover/public/application/angular/context/api/anchor.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/anchor.test.js b/src/plugins/discover/public/application/angular/context/api/anchor.test.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/anchor.test.js rename to src/plugins/discover/public/application/angular/context/api/anchor.test.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.predecessors.test.js b/src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.predecessors.test.js rename to src/plugins/discover/public/application/angular/context/api/context.predecessors.test.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.successors.test.js b/src/plugins/discover/public/application/angular/context/api/context.successors.test.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.successors.test.js rename to src/plugins/discover/public/application/angular/context/api/context.successors.test.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.ts b/src/plugins/discover/public/application/angular/context/api/context.ts similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.ts rename to src/plugins/discover/public/application/angular/context/api/context.ts index 507f927c608e1b..7fabef83f4c44b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/context.ts +++ b/src/plugins/discover/public/application/angular/context/api/context.ts @@ -28,7 +28,7 @@ import { IndexPatternsContract, IndexPattern, SearchSource, -} from '../../../../../../../../../plugins/data/public'; +} from '../../../../../../data/public'; export type SurrDocType = 'successors' | 'predecessors'; export interface EsHitRecord { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/date_conversion.test.ts b/src/plugins/discover/public/application/angular/context/api/utils/date_conversion.test.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/date_conversion.test.ts rename to src/plugins/discover/public/application/angular/context/api/utils/date_conversion.test.ts index b9ec105cc0e7bd..223b1747182966 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/date_conversion.test.ts +++ b/src/plugins/discover/public/application/angular/context/api/utils/date_conversion.test.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { extractNanos } from '../date_conversion'; +import { extractNanos } from './date_conversion'; describe('function extractNanos', function() { test('extract nanos of 2014-01-01', function() { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/date_conversion.ts b/src/plugins/discover/public/application/angular/context/api/utils/date_conversion.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/date_conversion.ts rename to src/plugins/discover/public/application/angular/context/api/utils/date_conversion.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/fetch_hits_in_interval.ts b/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/fetch_hits_in_interval.ts rename to src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts index 8eed5d33ab004b..437898201863f2 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/fetch_hits_in_interval.ts +++ b/src/plugins/discover/public/application/angular/context/api/utils/fetch_hits_in_interval.ts @@ -16,11 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - ISearchSource, - EsQuerySortValue, - SortDirection, -} from '../../../../../../../../../../plugins/data/public'; +import { ISearchSource, EsQuerySortValue, SortDirection } from '../../../../../../../data/public'; import { convertTimeValueToIso } from './date_conversion'; import { EsHitRecordList } from '../context'; import { IntervalValue } from './generate_intervals'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/generate_intervals.ts b/src/plugins/discover/public/application/angular/context/api/utils/generate_intervals.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/generate_intervals.ts rename to src/plugins/discover/public/application/angular/context/api/utils/generate_intervals.ts index b14180d32b4f24..1497f54aa5079a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/generate_intervals.ts +++ b/src/plugins/discover/public/application/angular/context/api/utils/generate_intervals.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { SortDirection } from '../../../../../../../../../../plugins/data/public'; +import { SortDirection } from '../../../../../../../data/public'; export type IntervalValue = number | null; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/get_es_query_search_after.ts b/src/plugins/discover/public/application/angular/context/api/utils/get_es_query_search_after.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/get_es_query_search_after.ts rename to src/plugins/discover/public/application/angular/context/api/utils/get_es_query_search_after.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/get_es_query_sort.ts b/src/plugins/discover/public/application/angular/context/api/utils/get_es_query_sort.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/get_es_query_sort.ts rename to src/plugins/discover/public/application/angular/context/api/utils/get_es_query_sort.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/sorting.test.ts b/src/plugins/discover/public/application/angular/context/api/utils/sorting.test.ts similarity index 94% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/sorting.test.ts rename to src/plugins/discover/public/application/angular/context/api/utils/sorting.test.ts index eeae2aa2c5d0ae..350a0a8ede8d5f 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/__tests__/sorting.test.ts +++ b/src/plugins/discover/public/application/angular/context/api/utils/sorting.test.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { reverseSortDir, SortDirection } from '../sorting'; +import { reverseSortDir, SortDirection } from './sorting'; describe('function reverseSortDir', function() { test('reverse a given sort direction', function() { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/sorting.ts b/src/plugins/discover/public/application/angular/context/api/utils/sorting.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/api/utils/sorting.ts rename to src/plugins/discover/public/application/angular/context/api/utils/sorting.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/_action_bar.scss b/src/plugins/discover/public/application/angular/context/components/action_bar/_action_bar.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/_action_bar.scss rename to src/plugins/discover/public/application/angular/context/components/action_bar/_action_bar.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/_index.scss b/src/plugins/discover/public/application/angular/context/components/action_bar/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/_index.scss rename to src/plugins/discover/public/application/angular/context/components/action_bar/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar.test.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar.test.tsx rename to src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar.tsx rename to src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar_directive.ts b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_directive.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar_directive.ts rename to src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_directive.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar_warning.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/action_bar_warning.tsx rename to src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/index.ts b/src/plugins/discover/public/application/angular/context/components/action_bar/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/components/action_bar/index.ts rename to src/plugins/discover/public/application/angular/context/components/action_bar/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/helpers/call_after_bindings_workaround.js b/src/plugins/discover/public/application/angular/context/helpers/call_after_bindings_workaround.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/helpers/call_after_bindings_workaround.js rename to src/plugins/discover/public/application/angular/context/helpers/call_after_bindings_workaround.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/actions.js b/src/plugins/discover/public/application/angular/context/query/actions.js similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/actions.js rename to src/plugins/discover/public/application/angular/context/query/actions.js index 9efddc52750699..f6a28b5607bc61 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/actions.js +++ b/src/plugins/discover/public/application/angular/context/query/actions.js @@ -26,7 +26,7 @@ import { fetchAnchorProvider } from '../api/anchor'; import { fetchContextProvider } from '../api/context'; import { getQueryParameterActions } from '../query_parameters'; import { FAILURE_REASONS, LOADING_STATUS } from './constants'; -import { MarkdownSimple } from '../../../../../../../../../plugins/kibana_react/public'; +import { MarkdownSimple } from '../../../../../../kibana_react/public'; export function QueryActionsProvider(Promise) { const { filterManager, indexPatterns } = getServices(); diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/constants.js b/src/plugins/discover/public/application/angular/context/query/constants.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/constants.js rename to src/plugins/discover/public/application/angular/context/query/constants.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/index.js b/src/plugins/discover/public/application/angular/context/query/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/index.js rename to src/plugins/discover/public/application/angular/context/query/index.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/state.js b/src/plugins/discover/public/application/angular/context/query/state.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query/state.js rename to src/plugins/discover/public/application/angular/context/query/state.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.js b/src/plugins/discover/public/application/angular/context/query_parameters/actions.js similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.js rename to src/plugins/discover/public/application/angular/context/query_parameters/actions.js index 5c1700e7763610..4f86dea08fe848 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.js +++ b/src/plugins/discover/public/application/angular/context/query_parameters/actions.js @@ -18,7 +18,7 @@ */ import _ from 'lodash'; -import { esFilters } from '../../../../../../../../../plugins/data/public'; +import { esFilters } from '../../../../../../data/public'; import { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE, QUERY_PARAMETER_KEYS } from './constants'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.test.ts b/src/plugins/discover/public/application/angular/context/query_parameters/actions.test.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.test.ts rename to src/plugins/discover/public/application/angular/context/query_parameters/actions.test.ts index 35fbd33fb4bc97..00747fcc812279 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/actions.test.ts +++ b/src/plugins/discover/public/application/angular/context/query_parameters/actions.test.ts @@ -19,8 +19,8 @@ // @ts-ignore import { getQueryParameterActions } from './actions'; -import { FilterManager } from '../../../../../../../../../plugins/data/public'; -import { coreMock } from '../../../../../../../../../core/public/mocks'; +import { FilterManager } from '../../../../../../data/public'; +import { coreMock } from '../../../../../../../core/public/mocks'; const setupMock = coreMock.createSetup(); let state: { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/constants.ts b/src/plugins/discover/public/application/angular/context/query_parameters/constants.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/constants.ts rename to src/plugins/discover/public/application/angular/context/query_parameters/constants.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/index.js b/src/plugins/discover/public/application/angular/context/query_parameters/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/index.js rename to src/plugins/discover/public/application/angular/context/query_parameters/index.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/state.ts b/src/plugins/discover/public/application/angular/context/query_parameters/state.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context/query_parameters/state.ts rename to src/plugins/discover/public/application/angular/context/query_parameters/state.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_app.html b/src/plugins/discover/public/application/angular/context_app.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_app.html rename to src/plugins/discover/public/application/angular/context_app.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_app.js b/src/plugins/discover/public/application/angular/context_app.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_app.js rename to src/plugins/discover/public/application/angular/context_app.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.test.ts b/src/plugins/discover/public/application/angular/context_state.test.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.test.ts rename to src/plugins/discover/public/application/angular/context_state.test.ts index 1fa71ed11643a6..83bf1b1d7e3d51 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.test.ts +++ b/src/plugins/discover/public/application/angular/context_state.test.ts @@ -19,8 +19,8 @@ import { getState } from './context_state'; import { createBrowserHistory, History } from 'history'; -import { FilterManager, Filter } from '../../../../../../../plugins/data/public'; -import { coreMock } from '../../../../../../../core/public/mocks'; +import { FilterManager, Filter } from '../../../../data/public'; +import { coreMock } from '../../../../../core/public/mocks'; const setupMock = coreMock.createSetup(); describe('Test Discover Context State', () => { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.ts b/src/plugins/discover/public/application/angular/context_state.ts similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.ts rename to src/plugins/discover/public/application/angular/context_state.ts index ed59143b163f69..66b352f7be4d82 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/context_state.ts +++ b/src/plugins/discover/public/application/angular/context_state.ts @@ -23,8 +23,8 @@ import { createKbnUrlStateStorage, syncStates, BaseStateContainer, -} from '../../../../../../../plugins/kibana_utils/public'; -import { esFilters, FilterManager, Filter, Query } from '../../../../../../../plugins/data/public'; +} from '../../../../kibana_utils/public'; +import { esFilters, FilterManager, Filter, Query } from '../../../../data/public'; export interface AppState { /** diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/__snapshots__/no_results.test.js.snap b/src/plugins/discover/public/application/angular/directives/__snapshots__/no_results.test.js.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/__snapshots__/no_results.test.js.snap rename to src/plugins/discover/public/application/angular/directives/__snapshots__/no_results.test.js.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_histogram.scss b/src/plugins/discover/public/application/angular/directives/_histogram.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_histogram.scss rename to src/plugins/discover/public/application/angular/directives/_histogram.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_index.scss b/src/plugins/discover/public/application/angular/directives/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_index.scss rename to src/plugins/discover/public/application/angular/directives/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_no_results.scss b/src/plugins/discover/public/application/angular/directives/_no_results.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/_no_results.scss rename to src/plugins/discover/public/application/angular/directives/_no_results.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss rename to src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_collapsible_sidebar.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_depth.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_depth.scss rename to src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_depth.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_index.scss b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/_index.scss rename to src/plugins/discover/public/application/angular/directives/collapsible_sidebar/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/collapsible_sidebar.ts b/src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/collapsible_sidebar/collapsible_sidebar.ts rename to src/plugins/discover/public/application/angular/directives/collapsible_sidebar/collapsible_sidebar.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/debounce.js b/src/plugins/discover/public/application/angular/directives/debounce/debounce.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/debounce.js rename to src/plugins/discover/public/application/angular/directives/debounce/debounce.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/__tests__/debounce.js b/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts similarity index 71% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/__tests__/debounce.js rename to src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts index 43fa5ffbf299a2..88d6dc8eaf4086 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/__tests__/debounce.js +++ b/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts @@ -17,42 +17,58 @@ * under the License. */ -import sinon from 'sinon'; -import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -import { DebounceProvider } from '../index'; -import { pluginInstance } from 'plugins/kibana/discover/legacy'; - -let debounce; -let debounceFromProvider; -let $timeout; - -function init() { - pluginInstance.initializeServices(); - pluginInstance.initializeInnerAngular(); - ngMock.module('app/discover'); - - ngMock.inject(function($injector, _$timeout_, Private) { - $timeout = _$timeout_; - - debounce = $injector.get('debounce'); - debounceFromProvider = Private(DebounceProvider); - }); -} +import sinon, { SinonSpy } from 'sinon'; +import angular, { auto, ITimeoutService } from 'angular'; +import 'angular-mocks'; +import 'angular-sanitize'; +import 'angular-route'; + +// @ts-ignore +import { DebounceProvider } from './index'; +import { coreMock } from '../../../../../../../core/public/mocks'; +import { initializeInnerAngularModule } from '../../../../get_inner_angular'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { navigationPluginMock } from 'src/plugins/navigation/public/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { dataPluginMock } from 'src/plugins/data/public/mocks'; +import { initAngularBootstrap } from 'src/plugins/kibana_legacy/public'; describe('debounce service', function() { - let spy; - beforeEach(function() { + let debounce: (fn: () => void, timeout: number, options?: any) => any; + let debounceFromProvider: (fn: () => void, timeout: number, options?: any) => any; + let $timeout: ITimeoutService; + let spy: SinonSpy; + + beforeEach(() => { spy = sinon.spy(); - init(); + + initAngularBootstrap(); + + initializeInnerAngularModule( + 'app/discover', + coreMock.createStart(), + navigationPluginMock.createStartContract(), + dataPluginMock.createStartContract() + ); + + angular.mock.module('app/discover'); + + angular.mock.inject( + ($injector: auto.IInjectorService, _$timeout_: ITimeoutService, Private: any) => { + $timeout = _$timeout_; + + debounce = $injector.get('debounce'); + debounceFromProvider = Private(DebounceProvider); + } + ); }); it('should have a cancel method', function() { const bouncer = debounce(() => {}, 100); const bouncerFromProvider = debounceFromProvider(() => {}, 100); - expect(bouncer).to.have.property('cancel'); - expect(bouncerFromProvider).to.have.property('cancel'); + expect(bouncer).toHaveProperty('cancel'); + expect(bouncerFromProvider).toHaveProperty('cancel'); }); describe('delayed execution', function() { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/index.js b/src/plugins/discover/public/application/angular/directives/debounce/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/debounce/index.js rename to src/plugins/discover/public/application/angular/directives/debounce/index.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/fixed_scroll.js b/src/plugins/discover/public/application/angular/directives/fixed_scroll.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/fixed_scroll.js rename to src/plugins/discover/public/application/angular/directives/fixed_scroll.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx b/src/plugins/discover/public/application/angular/directives/histogram.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/histogram.tsx rename to src/plugins/discover/public/application/angular/directives/histogram.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/index.js b/src/plugins/discover/public/application/angular/directives/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/index.js rename to src/plugins/discover/public/application/angular/directives/index.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/no_results.js b/src/plugins/discover/public/application/angular/directives/no_results.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/no_results.js rename to src/plugins/discover/public/application/angular/directives/no_results.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/no_results.test.js b/src/plugins/discover/public/application/angular/directives/no_results.test.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/no_results.test.js rename to src/plugins/discover/public/application/angular/directives/no_results.test.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/render_complete.ts b/src/plugins/discover/public/application/angular/directives/render_complete.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/render_complete.ts rename to src/plugins/discover/public/application/angular/directives/render_complete.ts index 7757deb806a18e..635cf68f12fcbb 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/render_complete.ts +++ b/src/plugins/discover/public/application/angular/directives/render_complete.ts @@ -17,7 +17,7 @@ * under the License. */ import { IScope } from 'angular'; -import { RenderCompleteHelper } from '../../../../../../../../plugins/kibana_utils/public'; +import { RenderCompleteHelper } from '../../../../../kibana_utils/public'; export function createRenderCompleteDirective() { return { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/uninitialized.tsx b/src/plugins/discover/public/application/angular/directives/uninitialized.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/directives/uninitialized.tsx rename to src/plugins/discover/public/application/angular/directives/uninitialized.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.html b/src/plugins/discover/public/application/angular/discover.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.html rename to src/plugins/discover/public/application/angular/discover.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js similarity index 99% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js rename to src/plugins/discover/public/application/angular/discover.js index 630ba22d4f3a6f..624eceff523e22 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -26,11 +26,8 @@ import dateMath from '@elastic/datemath'; import { i18n } from '@kbn/i18n'; import { getState, splitState } from './discover_state'; -import { RequestAdapter } from '../../../../../../../plugins/inspector/public'; -import { - SavedObjectSaveModal, - showSaveModal, -} from '../../../../../../../plugins/saved_objects/public'; +import { RequestAdapter } from '../../../../inspector/public'; +import { SavedObjectSaveModal, showSaveModal } from '../../../../saved_objects/public'; import { getSortArray, getSortForSearchSource } from './doc_table'; import * as columnActions from './doc_table/actions/columns'; @@ -77,9 +74,9 @@ import { syncQueryStateWithUrl, getDefaultQuery, search, -} from '../../../../../../../plugins/data/public'; +} from '../../../../data/public'; import { getIndexPatternId } from '../helpers/get_index_pattern_id'; -import { addFatalError } from '../../../../../../../plugins/kibana_legacy/public'; +import { addFatalError } from '../../../../kibana_legacy/public'; const fetchStatuses = { UNINITIALIZED: 'uninitialized', diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.test.ts b/src/plugins/discover/public/application/angular/discover_state.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.test.ts rename to src/plugins/discover/public/application/angular/discover_state.test.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.ts b/src/plugins/discover/public/application/angular/discover_state.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.ts rename to src/plugins/discover/public/application/angular/discover_state.ts index 2a036f0ac60ad3..46500d9fdf85e2 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover_state.ts +++ b/src/plugins/discover/public/application/angular/discover_state.ts @@ -24,9 +24,9 @@ import { syncState, ReduxLikeStateContainer, IKbnUrlStateStorage, -} from '../../../../../../../plugins/kibana_utils/public'; -import { esFilters, Filter, Query } from '../../../../../../../plugins/data/public'; -import { migrateLegacyQuery } from '../../../../../../../plugins/kibana_legacy/public'; +} from '../../../../kibana_utils/public'; +import { esFilters, Filter, Query } from '../../../../data/public'; +import { migrateLegacyQuery } from '../../../../kibana_legacy/public'; export interface AppState { /** diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc.html b/src/plugins/discover/public/application/angular/doc.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc.html rename to src/plugins/discover/public/application/angular/doc.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc.ts b/src/plugins/discover/public/application/angular/doc.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc.ts rename to src/plugins/discover/public/application/angular/doc.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/_doc_table.scss b/src/plugins/discover/public/application/angular/doc_table/_doc_table.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/_doc_table.scss rename to src/plugins/discover/public/application/angular/doc_table/_doc_table.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/_index.scss b/src/plugins/discover/public/application/angular/doc_table/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/_index.scss rename to src/plugins/discover/public/application/angular/doc_table/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/actions/columns.ts b/src/plugins/discover/public/application/angular/doc_table/actions/columns.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/actions/columns.ts rename to src/plugins/discover/public/application/angular/doc_table/actions/columns.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/_index.scss b/src/plugins/discover/public/application/angular/doc_table/components/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/_index.scss rename to src/plugins/discover/public/application/angular/doc_table/components/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/_table_header.scss b/src/plugins/discover/public/application/angular/doc_table/components/_table_header.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/_table_header.scss rename to src/plugins/discover/public/application/angular/doc_table/components/_table_header.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_buttons.test.tsx.snap b/src/plugins/discover/public/application/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_buttons.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_buttons.test.tsx.snap rename to src/plugins/discover/public/application/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_buttons.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_text.test.tsx.snap b/src/plugins/discover/public/application/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_text.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_text.test.tsx.snap rename to src/plugins/discover/public/application/angular/doc_table/components/pager/__snapshots__/tool_bar_pager_text.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/index.ts b/src/plugins/discover/public/application/angular/doc_table/components/pager/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/index.ts rename to src/plugins/discover/public/application/angular/doc_table/components/pager/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_text.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/pager/tool_bar_pager_text.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_header.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header.ts rename to src/plugins/discover/public/application/angular/doc_table/components/table_header.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/__snapshots__/table_header.test.tsx.snap b/src/plugins/discover/public/application/angular/doc_table/components/table_header/__snapshots__/table_header.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/__snapshots__/table_header.test.tsx.snap rename to src/plugins/discover/public/application/angular/doc_table/components/table_header/__snapshots__/table_header.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/helpers.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/helpers.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/helpers.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/table_header/helpers.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header.test.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header_column.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_header/table_header_column.tsx rename to src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row.ts rename to src/plugins/discover/public/application/angular/doc_table/components/table_row.ts index 698bfe7416d420..3b48c4c79365e2 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts @@ -23,15 +23,15 @@ import $ from 'jquery'; import rison from 'rison-node'; import '../../doc_viewer'; // @ts-ignore -import { noWhiteSpace } from '../../../../../../common/utils/no_white_space'; +import { noWhiteSpace } from '../../../../../../../legacy/core_plugins/kibana/common/utils/no_white_space'; import openRowHtml from './table_row/open.html'; import detailsHtml from './table_row/details.html'; -import { dispatchRenderComplete } from '../../../../../../../../../plugins/kibana_utils/public'; +import { dispatchRenderComplete } from '../../../../../../kibana_utils/public'; import cellTemplateHtml from '../components/table_row/cell.html'; import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_height.html'; -import { esFilters } from '../../../../../../../../../plugins/data/public'; +import { esFilters } from '../../../../../../data/public'; import { getServices } from '../../../../kibana_services'; // guesstimate at the minimum number of chars wide cells in the table should be diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_cell.scss b/src/plugins/discover/public/application/angular/doc_table/components/table_row/_cell.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_cell.scss rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/_cell.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_details.scss b/src/plugins/discover/public/application/angular/doc_table/components/table_row/_details.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_details.scss rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/_details.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_index.scss b/src/plugins/discover/public/application/angular/doc_table/components/table_row/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_index.scss rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_open.scss b/src/plugins/discover/public/application/angular/doc_table/components/table_row/_open.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/_open.scss rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/_open.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/cell.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/cell.html rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/details.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/details.html rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/open.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/open.html rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/truncate_by_height.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/truncate_by_height.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/components/table_row/truncate_by_height.html rename to src/plugins/discover/public/application/angular/doc_table/components/table_row/truncate_by_height.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table.html b/src/plugins/discover/public/application/angular/doc_table/doc_table.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table.html rename to src/plugins/discover/public/application/angular/doc_table/doc_table.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table.ts b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table.ts rename to src/plugins/discover/public/application/angular/doc_table/doc_table.ts index 3cb3a460af6495..a75f5fbe4bc8b9 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table.ts +++ b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts @@ -18,7 +18,7 @@ */ import html from './doc_table.html'; -import { dispatchRenderComplete } from '../../../../../../../../plugins/kibana_utils/public'; +import { dispatchRenderComplete } from '../../../../../kibana_utils/public'; // @ts-ignore import { getLimitedSearchResultsMessage } from './doc_table_strings'; import { getServices } from '../../../kibana_services'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table_strings.js b/src/plugins/discover/public/application/angular/doc_table/doc_table_strings.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/doc_table_strings.js rename to src/plugins/discover/public/application/angular/doc_table/doc_table_strings.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/index.ts b/src/plugins/discover/public/application/angular/doc_table/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/index.ts rename to src/plugins/discover/public/application/angular/doc_table/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/infinite_scroll.ts b/src/plugins/discover/public/application/angular/doc_table/infinite_scroll.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/infinite_scroll.ts rename to src/plugins/discover/public/application/angular/doc_table/infinite_scroll.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_default_sort.ts b/src/plugins/discover/public/application/angular/doc_table/lib/get_default_sort.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_default_sort.ts rename to src/plugins/discover/public/application/angular/doc_table/lib/get_default_sort.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort.test.ts b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort.test.ts rename to src/plugins/discover/public/application/angular/doc_table/lib/get_sort.test.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort.ts b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort.ts rename to src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts index a8dbaa50e5aa87..aa23aa4390673b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort.ts +++ b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort.ts @@ -18,7 +18,7 @@ */ import _ from 'lodash'; -import { IndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IndexPattern } from '../../../../../../data/public'; export type SortPairObj = Record; export type SortPairArr = [string, string]; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort_for_search_source.ts b/src/plugins/discover/public/application/angular/doc_table/lib/get_sort_for_search_source.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/get_sort_for_search_source.ts rename to src/plugins/discover/public/application/angular/doc_table/lib/get_sort_for_search_source.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/index.js b/src/plugins/discover/public/application/angular/doc_table/lib/pager/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/index.js rename to src/plugins/discover/public/application/angular/doc_table/lib/pager/index.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/pager.js b/src/plugins/discover/public/application/angular/doc_table/lib/pager/pager.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/pager.js rename to src/plugins/discover/public/application/angular/doc_table/lib/pager/pager.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/pager_factory.ts b/src/plugins/discover/public/application/angular/doc_table/lib/pager/pager_factory.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_table/lib/pager/pager_factory.ts rename to src/plugins/discover/public/application/angular/doc_table/lib/pager/pager_factory.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_viewer.tsx b/src/plugins/discover/public/application/angular/doc_viewer.tsx similarity index 93% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_viewer.tsx rename to src/plugins/discover/public/application/angular/doc_viewer.tsx index 90e061ac1aa058..d023af1c444875 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/doc_viewer.tsx +++ b/src/plugins/discover/public/application/angular/doc_viewer.tsx @@ -18,12 +18,11 @@ */ import React from 'react'; -import { getServices } from '../../kibana_services'; +import { DocViewer } from '../components/doc_viewer/doc_viewer'; export function createDocViewerDirective(reactDirective: any) { return reactDirective( (props: any) => { - const { DocViewer } = getServices(); return ; }, [ diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts b/src/plugins/discover/public/application/angular/get_painless_error.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/get_painless_error.ts rename to src/plugins/discover/public/application/angular/get_painless_error.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/index.ts b/src/plugins/discover/public/application/angular/helpers/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/index.ts rename to src/plugins/discover/public/application/angular/helpers/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts b/src/plugins/discover/public/application/angular/helpers/point_series.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts rename to src/plugins/discover/public/application/angular/helpers/point_series.ts index 02dd024b098127..db0ca85b0399a2 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/helpers/point_series.ts +++ b/src/plugins/discover/public/application/angular/helpers/point_series.ts @@ -21,7 +21,7 @@ import { uniq } from 'lodash'; import { Duration, Moment } from 'moment'; import { Unit } from '@elastic/datemath'; -import { SerializedFieldFormat } from '../../../../../../../../plugins/expressions/common/types'; +import { SerializedFieldFormat } from '../../../../../expressions/common/types'; export interface Column { id: string; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/index.ts b/src/plugins/discover/public/application/angular/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/index.ts rename to src/plugins/discover/public/application/angular/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/response_handler.js b/src/plugins/discover/public/application/angular/response_handler.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/angular/response_handler.js rename to src/plugins/discover/public/application/angular/response_handler.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/application.ts b/src/plugins/discover/public/application/application.ts similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/application.ts rename to src/plugins/discover/public/application/application.ts index 7a4819bb0f2d17..8167d4f9031956 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/application.ts +++ b/src/plugins/discover/public/application/application.ts @@ -17,6 +17,7 @@ * under the License. */ +import './index.scss'; import angular from 'angular'; /** diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/_index.scss b/src/plugins/discover/public/application/components/_index.scss similarity index 65% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/_index.scss rename to src/plugins/discover/public/application/components/_index.scss index 6ddd2e0eae8e34..91fb3df79b1777 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/_index.scss +++ b/src/plugins/discover/public/application/components/_index.scss @@ -1,2 +1,3 @@ +@import 'doc_viewer/index'; @import 'fetch_error/index'; @import 'sidebar/index'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.test.tsx b/src/plugins/discover/public/application/components/doc/doc.test.tsx similarity index 99% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.test.tsx rename to src/plugins/discover/public/application/components/doc/doc.test.tsx index 1d19dc112d1931..50f0c268bbe660 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -30,7 +30,6 @@ jest.mock('../../../kibana_services', () => { metadata: { branch: 'test', }, - DocViewer: () => null, }), }; }); diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.tsx b/src/plugins/discover/public/application/components/doc/doc.tsx similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.tsx rename to src/plugins/discover/public/application/components/doc/doc.tsx index f3ceaef57d7008..fe049f93efce8b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/doc.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.tsx @@ -22,7 +22,8 @@ import { EuiCallOut, EuiLink, EuiLoadingSpinner, EuiPageContent } from '@elastic import { IndexPatternsContract } from 'src/plugins/data/public'; import { ElasticRequestState, useEsDocSearch } from './use_es_doc_search'; import { getServices } from '../../../kibana_services'; -import { ElasticSearchHit } from '../../../../../../../../plugins/discover/public'; +import { DocViewer } from '../doc_viewer/doc_viewer'; +import { ElasticSearchHit } from '../../doc_views/doc_views_types'; export interface ElasticSearchResult { hits: { @@ -61,7 +62,6 @@ export interface DocProps { } export function Doc(props: DocProps) { - const { DocViewer } = getServices(); const [reqState, hit, indexPattern] = useEsDocSearch(props); return ( diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/use_es_doc_search.test.tsx b/src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/use_es_doc_search.test.tsx rename to src/plugins/discover/public/application/components/doc/use_es_doc_search.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/use_es_doc_search.ts b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/use_es_doc_search.ts rename to src/plugins/discover/public/application/components/doc/use_es_doc_search.ts index 2cd264578a5965..00496a3a72681a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/doc/use_es_doc_search.ts +++ b/src/plugins/discover/public/application/components/doc/use_es_doc_search.ts @@ -19,7 +19,7 @@ import { useEffect, useState } from 'react'; import { IndexPattern } from '../../../kibana_services'; import { DocProps } from './doc'; -import { ElasticSearchHit } from '../../../../../../../../plugins/discover/public'; +import { ElasticSearchHit } from '../../doc_views/doc_views_types'; export enum ElasticRequestState { Loading, diff --git a/src/plugins/discover/public/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap b/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap rename to src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer.test.tsx.snap diff --git a/src/plugins/discover/public/components/doc_viewer/__snapshots__/doc_viewer_render_tab.test.tsx.snap b/src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer_render_tab.test.tsx.snap similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/__snapshots__/doc_viewer_render_tab.test.tsx.snap rename to src/plugins/discover/public/application/components/doc_viewer/__snapshots__/doc_viewer_render_tab.test.tsx.snap diff --git a/src/plugins/discover/public/components/doc_viewer/_doc_viewer.scss b/src/plugins/discover/public/application/components/doc_viewer/_doc_viewer.scss similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/_doc_viewer.scss rename to src/plugins/discover/public/application/components/doc_viewer/_doc_viewer.scss diff --git a/src/plugins/discover/public/components/doc_viewer/_index.scss b/src/plugins/discover/public/application/components/doc_viewer/_index.scss similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/_index.scss rename to src/plugins/discover/public/application/components/doc_viewer/_index.scss diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer.test.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx similarity index 97% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer.test.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx index 6f29f10ddd0267..c2c2b49133818c 100644 --- a/src/plugins/discover/public/components/doc_viewer/doc_viewer.test.tsx +++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx @@ -21,7 +21,7 @@ import { mount, shallow } from 'enzyme'; import { DocViewer } from './doc_viewer'; // @ts-ignore import { findTestSubject } from '@elastic/eui/lib/test'; -import { getDocViewsRegistry } from '../../services'; +import { getDocViewsRegistry } from '../../../kibana_services'; import { DocViewRenderProps } from '../../doc_views/doc_views_types'; jest.mock('../../services', () => { diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.tsx similarity index 96% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer.tsx index 792d9c44400d7d..dce6de150155c1 100644 --- a/src/plugins/discover/public/components/doc_viewer/doc_viewer.tsx +++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { EuiTabbedContent } from '@elastic/eui'; -import { getDocViewsRegistry } from '../../services'; +import { getDocViewsRegistry } from '../../../kibana_services'; import { DocViewerTab } from './doc_viewer_tab'; import { DocView, DocViewRenderProps } from '../../doc_views/doc_views_types'; diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer_render_error.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_error.tsx similarity index 94% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer_render_error.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_error.tsx index 387e57dc8a7e3a..d1c016721f51f9 100644 --- a/src/plugins/discover/public/components/doc_viewer/doc_viewer_render_error.tsx +++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_error.tsx @@ -18,7 +18,7 @@ */ import React from 'react'; import { EuiCallOut, EuiCodeBlock } from '@elastic/eui'; -import { formatMsg, formatStack } from '../../../../kibana_legacy/public'; +import { formatMsg, formatStack } from '../../../../../kibana_legacy/public'; interface Props { error: Error | string; diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer_render_tab.test.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_tab.test.tsx similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer_render_tab.test.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_tab.test.tsx diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer_render_tab.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_tab.tsx similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer_render_tab.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer_render_tab.tsx diff --git a/src/plugins/discover/public/components/doc_viewer/doc_viewer_tab.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer_tab.tsx similarity index 100% rename from src/plugins/discover/public/components/doc_viewer/doc_viewer_tab.tsx rename to src/plugins/discover/public/application/components/doc_viewer/doc_viewer_tab.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/_fetch_error.scss b/src/plugins/discover/public/application/components/fetch_error/_fetch_error.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/_fetch_error.scss rename to src/plugins/discover/public/application/components/fetch_error/_fetch_error.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/_index.scss b/src/plugins/discover/public/application/components/fetch_error/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/_index.scss rename to src/plugins/discover/public/application/components/fetch_error/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx b/src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/fetch_error.tsx rename to src/plugins/discover/public/application/components/fetch_error/fetch_error.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/index.js b/src/plugins/discover/public/application/components/fetch_error/index.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/fetch_error/index.js rename to src/plugins/discover/public/application/components/fetch_error/index.js diff --git a/src/plugins/discover/public/components/field_name/__snapshots__/field_name.test.tsx.snap b/src/plugins/discover/public/application/components/field_name/__snapshots__/field_name.test.tsx.snap similarity index 100% rename from src/plugins/discover/public/components/field_name/__snapshots__/field_name.test.tsx.snap rename to src/plugins/discover/public/application/components/field_name/__snapshots__/field_name.test.tsx.snap diff --git a/src/plugins/discover/public/components/field_name/field_name.test.tsx b/src/plugins/discover/public/application/components/field_name/field_name.test.tsx similarity index 100% rename from src/plugins/discover/public/components/field_name/field_name.test.tsx rename to src/plugins/discover/public/application/components/field_name/field_name.test.tsx diff --git a/src/plugins/discover/public/components/field_name/field_name.tsx b/src/plugins/discover/public/application/components/field_name/field_name.tsx similarity index 96% rename from src/plugins/discover/public/components/field_name/field_name.tsx rename to src/plugins/discover/public/application/components/field_name/field_name.tsx index f7f1433328adf3..cf11f971ef76c2 100644 --- a/src/plugins/discover/public/components/field_name/field_name.tsx +++ b/src/plugins/discover/public/application/components/field_name/field_name.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui'; -import { FieldIcon, FieldIconProps } from '../../../../kibana_react/public'; +import { FieldIcon, FieldIconProps } from '../../../../../kibana_react/public'; import { shortenDottedString } from '../../helpers'; import { getFieldTypeName } from './field_type_name'; diff --git a/src/plugins/discover/public/components/field_name/field_type_name.ts b/src/plugins/discover/public/application/components/field_name/field_type_name.ts similarity index 100% rename from src/plugins/discover/public/components/field_name/field_type_name.ts rename to src/plugins/discover/public/application/components/field_name/field_type_name.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/help_menu/help_menu_util.js b/src/plugins/discover/public/application/components/help_menu/help_menu_util.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/help_menu/help_menu_util.js rename to src/plugins/discover/public/application/components/help_menu/help_menu_util.js diff --git a/src/plugins/discover/public/components/json_code_block/__snapshots__/json_code_block.test.tsx.snap b/src/plugins/discover/public/application/components/json_code_block/__snapshots__/json_code_block.test.tsx.snap similarity index 100% rename from src/plugins/discover/public/components/json_code_block/__snapshots__/json_code_block.test.tsx.snap rename to src/plugins/discover/public/application/components/json_code_block/__snapshots__/json_code_block.test.tsx.snap diff --git a/src/plugins/discover/public/components/json_code_block/json_code_block.test.tsx b/src/plugins/discover/public/application/components/json_code_block/json_code_block.test.tsx similarity index 95% rename from src/plugins/discover/public/components/json_code_block/json_code_block.test.tsx rename to src/plugins/discover/public/application/components/json_code_block/json_code_block.test.tsx index 7e7f80c6aaa565..3cbcab50362511 100644 --- a/src/plugins/discover/public/components/json_code_block/json_code_block.test.tsx +++ b/src/plugins/discover/public/application/components/json_code_block/json_code_block.test.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { JsonCodeBlock } from './json_code_block'; -import { IndexPattern } from '../../../../data/public'; +import { IndexPattern } from '../../../../../data/public'; it('returns the `JsonCodeEditor` component', () => { const props = { diff --git a/src/plugins/discover/public/components/json_code_block/json_code_block.tsx b/src/plugins/discover/public/application/components/json_code_block/json_code_block.tsx similarity index 100% rename from src/plugins/discover/public/components/json_code_block/json_code_block.tsx rename to src/plugins/discover/public/application/components/json_code_block/json_code_block.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/__snapshots__/discover_index_pattern.test.tsx.snap b/src/plugins/discover/public/application/components/sidebar/__snapshots__/discover_index_pattern.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/__snapshots__/discover_index_pattern.test.tsx.snap rename to src/plugins/discover/public/application/components/sidebar/__snapshots__/discover_index_pattern.test.tsx.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/_index.scss b/src/plugins/discover/public/application/components/sidebar/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/_index.scss rename to src/plugins/discover/public/application/components/sidebar/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/_sidebar.scss b/src/plugins/discover/public/application/components/sidebar/_sidebar.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/_sidebar.scss rename to src/plugins/discover/public/application/components/sidebar/_sidebar.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/change_indexpattern.tsx b/src/plugins/discover/public/application/components/sidebar/change_indexpattern.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/change_indexpattern.tsx rename to src/plugins/discover/public/application/components/sidebar/change_indexpattern.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx similarity index 95% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.test.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx index 9a6bd65813d184..7575070d2eafd0 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field.test.tsx @@ -26,8 +26,8 @@ import StubIndexPattern from 'test_utils/stub_index_pattern'; import stubbedLogstashFields from 'fixtures/logstash_fields'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { DiscoverField } from './discover_field'; -import { coreMock } from '../../../../../../../../core/public/mocks'; -import { IndexPatternField } from '../../../../../../../../plugins/data/public'; +import { coreMock } from '../../../../../../core/public/mocks'; +import { IndexPatternField } from '../../../../../data/public'; jest.mock('../../../kibana_services', () => ({ getServices: () => ({ diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field.tsx index f7acb751c487b0..bd6298769c5ed3 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field.tsx @@ -20,9 +20,9 @@ import React from 'react'; import { EuiButton, EuiToolTip, EuiText } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { DiscoverFieldDetails } from './discover_field_details'; -import { FieldIcon } from '../../../../../../../../plugins/kibana_react/public'; +import { FieldIcon } from '../../../../../kibana_react/public'; import { FieldDetails } from './types'; -import { IndexPatternField, IndexPattern } from '../../../../../../../../plugins/data/public'; +import { IndexPatternField, IndexPattern } from '../../../../../data/public'; import { shortenDottedString } from '../../helpers'; import { getFieldTypeName } from './lib/get_field_type_name'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_bucket.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_bucket.tsx similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_bucket.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field_bucket.tsx index 5a2b855828f53a..917c4b41d9b928 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_bucket.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_bucket.tsx @@ -21,7 +21,7 @@ import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiText } from '@elastic/eui' import { i18n } from '@kbn/i18n'; import { StringFieldProgressBar } from './string_progress_bar'; import { Bucket } from './types'; -import { IndexPatternField } from '../../../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../data/public'; interface Props { bucket: Bucket; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_details.tsx similarity index 99% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field_details.tsx index 6266c297457187..0cb677a871b5eb 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_field_details.tsx @@ -22,7 +22,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { DiscoverFieldBucket } from './discover_field_bucket'; import { getWarnings } from './lib/get_warnings'; import { Bucket, FieldDetails } from './types'; -import { IndexPatternField, IndexPattern } from '../../../../../../../../plugins/data/public'; +import { IndexPatternField, IndexPattern } from '../../../../../data/public'; interface DiscoverFieldDetailsProps { field: IndexPatternField; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_search.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_search.test.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field_search.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_search.tsx b/src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_search.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_field_search.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_index_pattern.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_index_pattern.test.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_index_pattern.test.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_index_pattern.tsx b/src/plugins/discover/public/application/components/sidebar/discover_index_pattern.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_index_pattern.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_index_pattern.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.test.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx similarity index 94% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.test.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx index 0df14515adc6d4..52f032fb90846b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.test.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.test.tsx @@ -30,9 +30,9 @@ import stubbedLogstashFields from 'fixtures/logstash_fields'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import React from 'react'; import { DiscoverSidebar, DiscoverSidebarProps } from './discover_sidebar'; -import { coreMock } from '../../../../../../../../core/public/mocks'; -import { IndexPatternAttributes } from '../../../../../../../../plugins/data/common'; -import { SavedObject } from '../../../../../../../../core/types'; +import { coreMock } from '../../../../../../core/public/mocks'; +import { IndexPatternAttributes } from '../../../../../data/common'; +import { SavedObject } from '../../../../../../core/types'; jest.mock('../../../kibana_services', () => ({ getServices: () => ({ diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.tsx rename to src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index 0adda0e484843a..9639753bd276be 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -24,14 +24,10 @@ import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { DiscoverField } from './discover_field'; import { DiscoverIndexPattern } from './discover_index_pattern'; import { DiscoverFieldSearch } from './discover_field_search'; -import { IndexPatternAttributes } from '../../../../../../../../plugins/data/common'; -import { SavedObject } from '../../../../../../../../core/types'; +import { IndexPatternAttributes } from '../../../../../data/common'; +import { SavedObject } from '../../../../../../core/types'; import { groupFields } from './lib/group_fields'; -import { - IndexPatternFieldList, - IndexPatternField, - IndexPattern, -} from '../../../../../../../../plugins/data/public'; +import { IndexPatternFieldList, IndexPatternField, IndexPattern } from '../../../../../data/public'; import { AppState } from '../../angular/discover_state'; import { getDetails } from './lib/get_details'; import { getDefaultFieldFilter, setFieldFilterProp } from './lib/field_filter'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar_directive.ts b/src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_sidebar_directive.ts rename to src/plugins/discover/public/application/components/sidebar/discover_sidebar_directive.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/index.ts b/src/plugins/discover/public/application/components/sidebar/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/index.ts rename to src/plugins/discover/public/application/components/sidebar/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_calculator.js b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_calculator.js rename to src/plugins/discover/public/application/components/sidebar/lib/field_calculator.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_calculator.test.ts b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_calculator.test.ts rename to src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts index 98763937e888fb..fdfc5364855798 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_calculator.test.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/field_calculator.test.ts @@ -24,8 +24,8 @@ import realHits from 'fixtures/real_hits.js'; import StubIndexPattern from 'test_utils/stub_index_pattern'; // @ts-ignore import stubbedLogstashFields from 'fixtures/logstash_fields'; -import { coreMock } from '../../../../../../../../../core/public/mocks'; -import { IndexPattern } from '../../../../../../../../../plugins/data/public'; +import { coreMock } from '../../../../../../../core/public/mocks'; +import { IndexPattern } from '../../../../../../data/public'; // @ts-ignore import { fieldCalculator } from './field_calculator'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.test.ts b/src/plugins/discover/public/application/components/sidebar/lib/field_filter.test.ts similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.test.ts rename to src/plugins/discover/public/application/components/sidebar/lib/field_filter.test.ts index ca0fcfc8463621..1351433e9dd0e7 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.test.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/field_filter.test.ts @@ -18,7 +18,7 @@ */ import { getDefaultFieldFilter, setFieldFilterProp, isFieldFiltered } from './field_filter'; -import { IndexPatternField } from '../../../../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../../data/public'; describe('field_filter', function() { it('getDefaultFieldFilter should return default filter state', function() { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.ts b/src/plugins/discover/public/application/components/sidebar/lib/field_filter.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.ts rename to src/plugins/discover/public/application/components/sidebar/lib/field_filter.ts index ed7ad1a43fa8cf..f0d9a2d8af20f7 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/field_filter.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/field_filter.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IndexPatternField } from '../../../../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../../data/public'; export interface FieldFilterState { missing: boolean; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_details.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_details.ts similarity index 98% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_details.ts rename to src/plugins/discover/public/application/components/sidebar/lib/get_details.ts index 9999b108c5cc1a..7ac9f009d73d51 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_details.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_details.ts @@ -20,7 +20,7 @@ import { getVisualizeUrl, isFieldVisualizable } from './visualize_url_utils'; import { AppState } from '../../../angular/discover_state'; // @ts-ignore import { fieldCalculator } from './field_calculator'; -import { IndexPatternField, IndexPattern } from '../../../../../../../../../plugins/data/public'; +import { IndexPatternField, IndexPattern } from '../../../../../../data/public'; import { DiscoverServices } from '../../../../build_services'; export function getDetails( diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_field_type_name.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_field_type_name.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_field_type_name.ts rename to src/plugins/discover/public/application/components/sidebar/lib/get_field_type_name.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_index_pattern_field_list.ts rename to src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts index 1b906501c6fe7d..2c461701255865 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts @@ -21,7 +21,7 @@ import { IndexPatternFieldList, IndexPattern, IndexPatternField, -} from '../../../../../../../../../plugins/data/public'; +} from '../../../../../../data/public'; export function getIndexPatternFieldList( indexPattern: IndexPattern, diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_warnings.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_warnings.ts similarity index 94% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_warnings.ts rename to src/plugins/discover/public/application/components/sidebar/lib/get_warnings.ts index 51d18c03888a71..a9eb42559e6003 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/get_warnings.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_warnings.ts @@ -17,7 +17,7 @@ * under the License. */ import { i18n } from '@kbn/i18n'; -import { IndexPatternField } from '../../../../../../../../../plugins/data/public'; +import { IndexPatternField } from '../../../../../../data/public'; export function getWarnings(field: IndexPatternField) { let warnings = []; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/group_fields.test.ts b/src/plugins/discover/public/application/components/sidebar/lib/group_fields.test.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/group_fields.test.ts rename to src/plugins/discover/public/application/components/sidebar/lib/group_fields.test.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/group_fields.tsx b/src/plugins/discover/public/application/components/sidebar/lib/group_fields.tsx similarity index 95% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/group_fields.tsx rename to src/plugins/discover/public/application/components/sidebar/lib/group_fields.tsx index 85ca8d6a4e15ed..37f6dafc0ea970 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/group_fields.tsx +++ b/src/plugins/discover/public/application/components/sidebar/lib/group_fields.tsx @@ -16,10 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { - IndexPatternFieldList, - IndexPatternField, -} from '../../../../../../../../../plugins/data/public'; +import { IndexPatternFieldList, IndexPatternField } from '../../../../../../data/public'; import { FieldFilterState, isFieldFiltered } from './field_filter'; interface GroupedFields { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts b/src/plugins/discover/public/application/components/sidebar/lib/visualize_url_utils.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts rename to src/plugins/discover/public/application/components/sidebar/lib/visualize_url_utils.ts index d146d212055b76..e3b1988dca2f31 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/visualize_url_utils.ts @@ -24,13 +24,10 @@ import { IIndexPattern, IndexPatternField, KBN_FIELD_TYPES, -} from '../../../../../../../../../plugins/data/public'; +} from '../../../../../../data/public'; import { AppState } from '../../../angular/discover_state'; import { DiscoverServices } from '../../../../build_services'; -import { - VisualizationsStart, - VisTypeAlias, -} from '../../../../../../../../../plugins/visualizations/public'; +import { VisualizationsStart, VisTypeAlias } from '../../../../../../visualizations/public'; function getMapsAppBaseUrl(visualizations: VisualizationsStart) { const mapsAppVisAlias = visualizations.getAliases().find(({ name }) => { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/string_progress_bar.tsx b/src/plugins/discover/public/application/components/sidebar/string_progress_bar.tsx similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/string_progress_bar.tsx rename to src/plugins/discover/public/application/components/sidebar/string_progress_bar.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts b/src/plugins/discover/public/application/components/sidebar/types.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts rename to src/plugins/discover/public/application/components/sidebar/types.ts diff --git a/src/plugins/discover/public/components/table/table.test.tsx b/src/plugins/discover/public/application/components/table/table.test.tsx similarity index 99% rename from src/plugins/discover/public/components/table/table.test.tsx rename to src/plugins/discover/public/application/components/table/table.test.tsx index 91e116c4c66967..04cf5d80da585f 100644 --- a/src/plugins/discover/public/components/table/table.test.tsx +++ b/src/plugins/discover/public/application/components/table/table.test.tsx @@ -21,7 +21,7 @@ import { mount } from 'enzyme'; // @ts-ignore import { findTestSubject } from '@elastic/eui/lib/test'; import { DocViewTable } from './table'; -import { indexPatterns, IndexPattern } from '../../../../data/public'; +import { indexPatterns, IndexPattern } from '../../../../../data/public'; const indexPattern = { fields: [ diff --git a/src/plugins/discover/public/components/table/table.tsx b/src/plugins/discover/public/application/components/table/table.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table.tsx rename to src/plugins/discover/public/application/components/table/table.tsx diff --git a/src/plugins/discover/public/components/table/table_helper.test.ts b/src/plugins/discover/public/application/components/table/table_helper.test.ts similarity index 100% rename from src/plugins/discover/public/components/table/table_helper.test.ts rename to src/plugins/discover/public/application/components/table/table_helper.test.ts diff --git a/src/plugins/discover/public/components/table/table_helper.tsx b/src/plugins/discover/public/application/components/table/table_helper.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_helper.tsx rename to src/plugins/discover/public/application/components/table/table_helper.tsx diff --git a/src/plugins/discover/public/components/table/table_row.tsx b/src/plugins/discover/public/application/components/table/table_row.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row.tsx rename to src/plugins/discover/public/application/components/table/table_row.tsx diff --git a/src/plugins/discover/public/components/table/table_row_btn_collapse.tsx b/src/plugins/discover/public/application/components/table/table_row_btn_collapse.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_btn_collapse.tsx rename to src/plugins/discover/public/application/components/table/table_row_btn_collapse.tsx diff --git a/src/plugins/discover/public/components/table/table_row_btn_filter_add.tsx b/src/plugins/discover/public/application/components/table/table_row_btn_filter_add.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_btn_filter_add.tsx rename to src/plugins/discover/public/application/components/table/table_row_btn_filter_add.tsx diff --git a/src/plugins/discover/public/components/table/table_row_btn_filter_exists.tsx b/src/plugins/discover/public/application/components/table/table_row_btn_filter_exists.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_btn_filter_exists.tsx rename to src/plugins/discover/public/application/components/table/table_row_btn_filter_exists.tsx diff --git a/src/plugins/discover/public/components/table/table_row_btn_filter_remove.tsx b/src/plugins/discover/public/application/components/table/table_row_btn_filter_remove.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_btn_filter_remove.tsx rename to src/plugins/discover/public/application/components/table/table_row_btn_filter_remove.tsx diff --git a/src/plugins/discover/public/components/table/table_row_btn_toggle_column.tsx b/src/plugins/discover/public/application/components/table/table_row_btn_toggle_column.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_btn_toggle_column.tsx rename to src/plugins/discover/public/application/components/table/table_row_btn_toggle_column.tsx diff --git a/src/plugins/discover/public/components/table/table_row_icon_no_mapping.tsx b/src/plugins/discover/public/application/components/table/table_row_icon_no_mapping.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_icon_no_mapping.tsx rename to src/plugins/discover/public/application/components/table/table_row_icon_no_mapping.tsx diff --git a/src/plugins/discover/public/components/table/table_row_icon_underscore.tsx b/src/plugins/discover/public/application/components/table/table_row_icon_underscore.tsx similarity index 100% rename from src/plugins/discover/public/components/table/table_row_icon_underscore.tsx rename to src/plugins/discover/public/application/components/table/table_row_icon_underscore.tsx diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/__snapshots__/open_search_panel.test.js.snap b/src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.js.snap similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/__snapshots__/open_search_panel.test.js.snap rename to src/plugins/discover/public/application/components/top_nav/__snapshots__/open_search_panel.test.js.snap diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/open_search_panel.js b/src/plugins/discover/public/application/components/top_nav/open_search_panel.js similarity index 97% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/open_search_panel.js rename to src/plugins/discover/public/application/components/top_nav/open_search_panel.js index 747dd9abe2f2aa..bbcfa2bd87d466 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/open_search_panel.js +++ b/src/plugins/discover/public/application/components/top_nav/open_search_panel.js @@ -32,7 +32,7 @@ import { EuiFlyoutBody, EuiTitle, } from '@elastic/eui'; -import { SavedObjectFinderUi } from '../../../../../../../../plugins/saved_objects/public'; +import { SavedObjectFinderUi } from '../../../../../saved_objects/public'; import { getServices } from '../../../kibana_services'; const SEARCH_OBJECT_TYPE = 'search'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/open_search_panel.test.js b/src/plugins/discover/public/application/components/top_nav/open_search_panel.test.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/open_search_panel.test.js rename to src/plugins/discover/public/application/components/top_nav/open_search_panel.test.js diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/show_open_search_panel.js b/src/plugins/discover/public/application/components/top_nav/show_open_search_panel.js similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/components/top_nav/show_open_search_panel.js rename to src/plugins/discover/public/application/components/top_nav/show_open_search_panel.js diff --git a/src/plugins/discover/public/doc_views/doc_views_helpers.tsx b/src/plugins/discover/public/application/doc_views/doc_views_helpers.tsx similarity index 100% rename from src/plugins/discover/public/doc_views/doc_views_helpers.tsx rename to src/plugins/discover/public/application/doc_views/doc_views_helpers.tsx diff --git a/src/plugins/discover/public/doc_views/doc_views_registry.ts b/src/plugins/discover/public/application/doc_views/doc_views_registry.ts similarity index 95% rename from src/plugins/discover/public/doc_views/doc_views_registry.ts rename to src/plugins/discover/public/application/doc_views/doc_views_registry.ts index 8f4518538be729..cdc22155f4710a 100644 --- a/src/plugins/discover/public/doc_views/doc_views_registry.ts +++ b/src/plugins/discover/public/application/doc_views/doc_views_registry.ts @@ -25,9 +25,9 @@ export class DocViewsRegistry { private docViews: DocView[] = []; private angularInjectorGetter: (() => Promise) | null = null; - setAngularInjectorGetter(injectorGetter: () => Promise) { + setAngularInjectorGetter = (injectorGetter: () => Promise) => { this.angularInjectorGetter = injectorGetter; - } + }; /** * Extends and adds the given doc view to the registry array diff --git a/src/plugins/discover/public/doc_views/doc_views_types.ts b/src/plugins/discover/public/application/doc_views/doc_views_types.ts similarity index 97% rename from src/plugins/discover/public/doc_views/doc_views_types.ts rename to src/plugins/discover/public/application/doc_views/doc_views_types.ts index 0a4b5bb570bd7b..0c86c4f812749e 100644 --- a/src/plugins/discover/public/doc_views/doc_views_types.ts +++ b/src/plugins/discover/public/application/doc_views/doc_views_types.ts @@ -18,7 +18,7 @@ */ import { ComponentType } from 'react'; import { IScope } from 'angular'; -import { IndexPattern } from '../../../data/public'; +import { IndexPattern } from '../../../../data/public'; export interface AngularDirective { controller: (...injectedServices: any[]) => void; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/_embeddables.scss b/src/plugins/discover/public/application/embeddable/_embeddables.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/_embeddables.scss rename to src/plugins/discover/public/application/embeddable/_embeddables.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/_index.scss b/src/plugins/discover/public/application/embeddable/_index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/_index.scss rename to src/plugins/discover/public/application/embeddable/_index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants.ts b/src/plugins/discover/public/application/embeddable/constants.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants.ts rename to src/plugins/discover/public/application/embeddable/constants.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts b/src/plugins/discover/public/application/embeddable/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts rename to src/plugins/discover/public/application/embeddable/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts b/src/plugins/discover/public/application/embeddable/search_embeddable.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts rename to src/plugins/discover/public/application/embeddable/search_embeddable.ts index f8e769d8374474..085dd9779f1080 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable.ts @@ -21,11 +21,8 @@ import _ from 'lodash'; import * as Rx from 'rxjs'; import { Subscription } from 'rxjs'; import { i18n } from '@kbn/i18n'; -import { - UiActionsStart, - APPLY_FILTER_TRIGGER, -} from '../../../../../../../plugins/ui_actions/public'; -import { RequestAdapter, Adapters } from '../../../../../../../plugins/inspector/public'; +import { UiActionsStart, APPLY_FILTER_TRIGGER } from '../../../../ui_actions/public'; +import { RequestAdapter, Adapters } from '../../../../inspector/public'; import { esFilters, Filter, @@ -34,8 +31,8 @@ import { getTime, Query, IFieldType, -} from '../../../../../../../plugins/data/public'; -import { Container, Embeddable } from '../../../../../../../plugins/embeddable/public'; +} from '../../../../data/public'; +import { Container, Embeddable } from '../../../../embeddable/public'; import * as columnActions from '../angular/doc_table/actions/columns'; import searchTemplate from './search_template.html'; import { ISearchEmbeddable, SearchInput, SearchOutput } from './types'; @@ -49,7 +46,7 @@ import { ISearchSource, } from '../../kibana_services'; import { SEARCH_EMBEDDABLE_TYPE } from './constants'; -import { SavedSearch } from '../../../../../../../plugins/discover/public'; +import { SavedSearch } from '../..'; interface SearchScope extends ng.IScope { columns?: string[]; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts similarity index 96% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts rename to src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts index ad61984a525365..187a2d6aca40c6 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts @@ -25,9 +25,9 @@ import { EmbeddableFactoryDefinition, Container, ErrorEmbeddable, -} from '../../../../../../../plugins/embeddable/public'; +} from '../../../../embeddable/public'; -import { TimeRange } from '../../../../../../../plugins/data/public'; +import { TimeRange } from '../../../../data/public'; import { SearchEmbeddable } from './search_embeddable'; import { SearchInput, SearchOutput } from './types'; import { SEARCH_EMBEDDABLE_TYPE } from './constants'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_template.html b/src/plugins/discover/public/application/embeddable/search_template.html similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_template.html rename to src/plugins/discover/public/application/embeddable/search_template.html diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts b/src/plugins/discover/public/application/embeddable/types.ts similarity index 93% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts rename to src/plugins/discover/public/application/embeddable/types.ts index b20e9b2faf7c49..80576eb4ed7cbb 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts +++ b/src/plugins/discover/public/application/embeddable/types.ts @@ -19,8 +19,8 @@ import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from 'src/plugins/embeddable/public'; import { SortOrder } from '../angular/doc_table/components/table_header/helpers'; -import { Filter, IIndexPattern, TimeRange, Query } from '../../../../../../../plugins/data/public'; -import { SavedSearch } from '../../../../../../../plugins/discover/public'; +import { Filter, IIndexPattern, TimeRange, Query } from '../../../../data/public'; +import { SavedSearch } from '../..'; export interface SearchInput extends EmbeddableInput { timeRange: TimeRange; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/breadcrumbs.ts b/src/plugins/discover/public/application/helpers/breadcrumbs.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/breadcrumbs.ts rename to src/plugins/discover/public/application/helpers/breadcrumbs.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/get_index_pattern_id.ts b/src/plugins/discover/public/application/helpers/get_index_pattern_id.ts similarity index 95% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/get_index_pattern_id.ts rename to src/plugins/discover/public/application/helpers/get_index_pattern_id.ts index 8f4d1b28624a42..b78c43b9a74ac5 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/get_index_pattern_id.ts +++ b/src/plugins/discover/public/application/helpers/get_index_pattern_id.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IIndexPattern } from '../../../../../../../plugins/data/common/index_patterns'; +import { IIndexPattern } from '../../../../data/common/index_patterns'; export function findIndexPatternById( indexPatterns: IIndexPattern[], diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/index.ts b/src/plugins/discover/public/application/helpers/index.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/index.ts rename to src/plugins/discover/public/application/helpers/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/shorten_dotted_string.ts b/src/plugins/discover/public/application/helpers/shorten_dotted_string.ts similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/helpers/shorten_dotted_string.ts rename to src/plugins/discover/public/application/helpers/shorten_dotted_string.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/_index.scss b/src/plugins/discover/public/application/index.scss similarity index 100% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/_index.scss rename to src/plugins/discover/public/application/index.scss diff --git a/src/legacy/core_plugins/kibana/public/discover/build_services.ts b/src/plugins/discover/public/build_services.ts similarity index 83% rename from src/legacy/core_plugins/kibana/public/discover/build_services.ts rename to src/plugins/discover/public/build_services.ts index a3a99a0ded523c..1c097d1249faf4 100644 --- a/src/legacy/core_plugins/kibana/public/discover/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -25,6 +25,7 @@ import { DocLinksStart, ToastsStart, IUiSettingsClient, + PluginInitializerContext, } from 'kibana/public'; import { FilterManager, @@ -32,16 +33,13 @@ import { IndexPatternsContract, DataPublicPluginStart, } from 'src/plugins/data/public'; +import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/public'; +import { SharePluginStart } from '../../share/public'; +import { ChartsPluginStart } from '../../charts/public'; +import { VisualizationsStart } from '../../visualizations/public'; +import { createSavedSearchesLoader, SavedSearch } from '.'; import { DiscoverStartPlugins } from './plugin'; -import { SharePluginStart } from '../../../../../plugins/share/public'; -import { ChartsPluginStart } from '../../../../../plugins/charts/public'; -import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; -import { - createSavedSearchesLoader, - DocViewerComponent, - SavedSearch, -} from '../../../../../plugins/discover/public'; export interface DiscoverServices { addBasePath: (path: string) => string; @@ -50,14 +48,13 @@ export interface DiscoverServices { core: CoreStart; data: DataPublicPluginStart; docLinks: DocLinksStart; - DocViewer: DocViewerComponent; history: History; theme: ChartsPluginStart['theme']; filterManager: FilterManager; indexPatterns: IndexPatternsContract; - inspector: unknown; + inspector: InspectorPublicPluginStart; metadata: { branch: string }; - share: SharePluginStart; + share?: SharePluginStart; timefilter: TimefilterContract; toastNotifications: ToastsStart; getSavedSearchById: (id: string) => Promise; @@ -67,7 +64,8 @@ export interface DiscoverServices { } export async function buildServices( core: CoreStart, - plugins: DiscoverStartPlugins + plugins: DiscoverStartPlugins, + context: PluginInitializerContext ): Promise { const services = { savedObjectsClient: core.savedObjects.client, @@ -84,7 +82,6 @@ export async function buildServices( core, data: plugins.data, docLinks: core.docLinks, - DocViewer: plugins.discover.docViews.DocViewer, history: createHashHistory(), theme: plugins.charts.theme, filterManager: plugins.data.query.filterManager, @@ -92,8 +89,9 @@ export async function buildServices( getSavedSearchUrlById: async (id: string) => savedObjectService.urlFor(id), indexPatterns: plugins.data.indexPatterns, inspector: plugins.inspector, - // @ts-ignore - metadata: core.injectedMetadata.getLegacyMetadata(), + metadata: { + branch: context.env.packageInfo.branch, + }, share: plugins.share, timefilter: plugins.data.query.timefilter.timefilter, toastNotifications: core.notifications.toasts, diff --git a/src/plugins/discover/public/components/_index.scss b/src/plugins/discover/public/components/_index.scss deleted file mode 100644 index ff50d4b5dca938..00000000000000 --- a/src/plugins/discover/public/components/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'doc_viewer/index'; diff --git a/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts similarity index 79% rename from src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts rename to src/plugins/discover/public/get_inner_angular.ts index 6ccbc13aeeb571..1f08cacbf8e6a4 100644 --- a/src/legacy/core_plugins/kibana/public/discover/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -23,27 +23,26 @@ import angular from 'angular'; import { EuiIcon } from '@elastic/eui'; import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; -import { CoreStart, LegacyCoreStart } from 'kibana/public'; -import { DataPublicPluginStart } from '../../../../../plugins/data/public'; -import { Storage } from '../../../../../plugins/kibana_utils/public'; -import { NavigationPublicPluginStart as NavigationStart } from '../../../../../plugins/navigation/public'; -import { createDocTableDirective } from './np_ready/angular/doc_table'; -import { createTableHeaderDirective } from './np_ready/angular/doc_table/components/table_header'; +import { CoreStart, LegacyCoreStart, PluginInitializerContext } from 'kibana/public'; +import { DataPublicPluginStart } from '../../data/public'; +import { Storage } from '../../kibana_utils/public'; +import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; +import { createDocTableDirective } from './application/angular/doc_table'; +import { createTableHeaderDirective } from './application/angular/doc_table/components/table_header'; import { createToolBarPagerButtonsDirective, createToolBarPagerTextDirective, -} from './np_ready/angular/doc_table/components/pager'; -import { createTableRowDirective } from './np_ready/angular/doc_table/components/table_row'; -import { createPagerFactory } from './np_ready/angular/doc_table/lib/pager/pager_factory'; -import { createInfiniteScrollDirective } from './np_ready/angular/doc_table/infinite_scroll'; -import { createDocViewerDirective } from './np_ready/angular/doc_viewer'; -import { CollapsibleSidebarProvider } from './np_ready/angular/directives/collapsible_sidebar/collapsible_sidebar'; -import { DiscoverStartPlugins } from './plugin'; +} from './application/angular/doc_table/components/pager'; +import { createTableRowDirective } from './application/angular/doc_table/components/table_row'; +import { createPagerFactory } from './application/angular/doc_table/lib/pager/pager_factory'; +import { createInfiniteScrollDirective } from './application/angular/doc_table/infinite_scroll'; +import { createDocViewerDirective } from './application/angular/doc_viewer'; +import { CollapsibleSidebarProvider } from './application/angular/directives/collapsible_sidebar/collapsible_sidebar'; // @ts-ignore -import { FixedScrollProvider } from './np_ready/angular/directives/fixed_scroll'; +import { FixedScrollProvider } from './application/angular/directives/fixed_scroll'; // @ts-ignore -import { DebounceProviderTimeout } from './np_ready/angular/directives/debounce/debounce'; -import { createRenderCompleteDirective } from './np_ready/angular/directives/render_complete'; +import { DebounceProviderTimeout } from './application/angular/directives/debounce/debounce'; +import { createRenderCompleteDirective } from './application/angular/directives/render_complete'; import { initAngularBootstrap, configureAppAngularModule, @@ -54,17 +53,23 @@ import { watchMultiDecorator, createTopNavDirective, createTopNavHelper, -} from '../../../../../plugins/kibana_legacy/public'; -import { createDiscoverSidebarDirective } from './np_ready/components/sidebar'; +} from '../../kibana_legacy/public'; +import { createDiscoverSidebarDirective } from './application/components/sidebar'; +import { DiscoverStartPlugins } from './plugin'; /** * returns the main inner angular module, it contains all the parts of Angular Discover * needs to render, so in the end the current 'kibana' angular module is no longer necessary */ -export function getInnerAngularModule(name: string, core: CoreStart, deps: DiscoverStartPlugins) { +export function getInnerAngularModule( + name: string, + core: CoreStart, + deps: DiscoverStartPlugins, + context: PluginInitializerContext +) { initAngularBootstrap(); const module = initializeInnerAngularModule(name, core, deps.navigation, deps.data); - configureAppAngularModule(module, core as LegacyCoreStart, true); + configureAppAngularModule(module, { core, env: context.env }, true); return module; } diff --git a/src/plugins/discover/public/helpers/index.ts b/src/plugins/discover/public/helpers/index.ts deleted file mode 100644 index 7196c96989e97d..00000000000000 --- a/src/plugins/discover/public/helpers/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { shortenDottedString } from './shorten_dotted_string'; diff --git a/src/plugins/discover/public/helpers/shorten_dotted_string.ts b/src/plugins/discover/public/helpers/shorten_dotted_string.ts deleted file mode 100644 index 9d78a96784339b..00000000000000 --- a/src/plugins/discover/public/helpers/shorten_dotted_string.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -const DOT_PREFIX_RE = /(.).+?\./g; - -/** - * Convert a dot.notated.string into a short - * version (d.n.string) - */ -export const shortenDottedString = (input: string) => input.replace(DOT_PREFIX_RE, '$1.'); diff --git a/src/plugins/discover/public/index.scss b/src/plugins/discover/public/index.scss deleted file mode 100644 index 841415620d6917..00000000000000 --- a/src/plugins/discover/public/index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'components/index'; diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts index dbc361ee59f497..171fb989162d65 100644 --- a/src/plugins/discover/public/index.ts +++ b/src/plugins/discover/public/index.ts @@ -17,18 +17,12 @@ * under the License. */ +import { PluginInitializerContext } from 'kibana/public'; import { DiscoverPlugin } from './plugin'; export { DiscoverSetup, DiscoverStart } from './plugin'; -export { DocViewTable } from './components/table/table'; -export { JsonCodeBlock } from './components/json_code_block/json_code_block'; -export { DocViewInput, DocViewInputFn, DocViewerComponent } from './doc_views/doc_views_types'; -export { FieldName } from './components/field_name/field_name'; -export * from './doc_views/doc_views_types'; - -export function plugin() { - return new DiscoverPlugin(); +export function plugin(initializerContext: PluginInitializerContext) { + return new DiscoverPlugin(initializerContext); } -export { createSavedSearchesLoader } from './saved_searches/saved_searches'; -export { SavedSearchLoader, SavedSearch } from './saved_searches/types'; +export { SavedSearch, SavedSearchLoader, createSavedSearchesLoader } from './saved_searches'; diff --git a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts b/src/plugins/discover/public/kibana_services.ts similarity index 80% rename from src/legacy/core_plugins/kibana/public/discover/kibana_services.ts rename to src/plugins/discover/public/kibana_services.ts index 0a81ca0222b0a0..391a7593f092b8 100644 --- a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts +++ b/src/plugins/discover/public/kibana_services.ts @@ -17,8 +17,9 @@ * under the License. */ import { DiscoverServices } from './build_services'; -import { createGetterSetter } from '../../../../../plugins/kibana_utils/public'; -import { search } from '../../../../../plugins/data/public'; +import { createGetterSetter } from '../../kibana_utils/public'; +import { search } from '../../data/public'; +import { DocViewsRegistry } from './application/doc_views/doc_views_registry'; let angularModule: any = null; let services: DiscoverServices | null = null; @@ -52,17 +53,17 @@ export const [getUrlTracker, setUrlTracker] = createGetterSetter<{ setTrackedUrl: (url: string) => void; }>('urlTracker'); +export const [getDocViewsRegistry, setDocViewsRegistry] = createGetterSetter( + 'DocViewsRegistry' +); + export const { getRequestInspectorStats, getResponseInspectorStats, tabifyAggResponse } = search; export { unhashUrl, redirectWhenMissing, ensureDefaultIndexPattern, -} from '../../../../../plugins/kibana_utils/public'; -export { - formatMsg, - formatStack, - subscribeWithScope, -} from '../../../../../plugins/kibana_legacy/public'; +} from '../../kibana_utils/public'; +export { formatMsg, formatStack, subscribeWithScope } from '../../kibana_legacy/public'; // EXPORT types export { @@ -75,4 +76,4 @@ export { ISearchSource, EsQuerySortValue, SortDirection, -} from '../../../../../plugins/data/public'; +} from '../../data/public'; diff --git a/src/plugins/discover/public/mocks.ts b/src/plugins/discover/public/mocks.ts index 218c59b5db07b6..dd7da5e8bc254f 100644 --- a/src/plugins/discover/public/mocks.ts +++ b/src/plugins/discover/public/mocks.ts @@ -26,7 +26,6 @@ const createSetupContract = (): Setup => { const setupContract: Setup = { docViews: { addDocView: jest.fn(), - setAngularInjectorGetter: jest.fn(), }, }; return setupContract; @@ -34,9 +33,6 @@ const createSetupContract = (): Setup => { const createStartContract = (): Start => { const startContract: Start = { - docViews: { - DocViewer: jest.fn(() => null), - }, savedSearches: { createLoader: jest.fn(), }, diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index aa54823e6ec4df..41cffcd480e4fa 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -17,20 +17,45 @@ * under the License. */ -import React from 'react'; import { i18n } from '@kbn/i18n'; -import { auto } from 'angular'; -import { CoreSetup, Plugin } from 'kibana/public'; +import angular, { auto } from 'angular'; +import { BehaviorSubject } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; + +import { + AppMountParameters, + CoreSetup, + CoreStart, + Plugin, + PluginInitializerContext, +} from 'kibana/public'; +import { UiActionsStart, UiActionsSetup } from 'src/plugins/ui_actions/public'; +import { EmbeddableStart, EmbeddableSetup } from 'src/plugins/embeddable/public'; +import { ChartsPluginStart } from 'src/plugins/charts/public'; +import { NavigationPublicPluginStart as NavigationStart } from 'src/plugins/navigation/public'; +import { SharePluginStart } from 'src/plugins/share/public'; +import { VisualizationsStart, VisualizationsSetup } from 'src/plugins/visualizations/public'; +import { KibanaLegacySetup, AngularRenderedAppUpdater } from 'src/plugins/kibana_legacy/public'; +import { HomePublicPluginSetup } from 'src/plugins/home/public'; +import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/public'; +import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public'; import { SavedObjectLoader, SavedObjectKibanaServices } from '../../saved_objects/public'; -import { DocViewInput, DocViewInputFn, DocViewRenderProps } from './doc_views/doc_views_types'; -import { DocViewsRegistry } from './doc_views/doc_views_registry'; -import { DocViewTable } from './components/table/table'; -import { JsonCodeBlock } from './components/json_code_block/json_code_block'; -import { DocViewer } from './components/doc_viewer/doc_viewer'; -import { setDocViewsRegistry } from './services'; -import { createSavedSearchesLoader } from './saved_searches'; +import { createKbnUrlTracker } from '../../kibana_utils/public'; -import './index.scss'; +import { DocViewInput, DocViewInputFn } from './application/doc_views/doc_views_types'; +import { DocViewsRegistry } from './application/doc_views/doc_views_registry'; +import { DocViewTable } from './application/components/table/table'; +import { JsonCodeBlock } from './application/components/json_code_block/json_code_block'; +import { + setDocViewsRegistry, + setUrlTracker, + setAngularModule, + setServices, +} from './kibana_services'; +import { createSavedSearchesLoader } from './saved_searches'; +import { getInnerAngularModuleEmbeddable, getInnerAngularModule } from './get_inner_angular'; +import { registerFeature } from './register_feature'; +import { buildServices } from './build_services'; /** * @public @@ -43,27 +68,10 @@ export interface DiscoverSetup { * @param docViewRaw */ addDocView(docViewRaw: DocViewInput | DocViewInputFn): void; - /** - * Set the angular injector for bootstrapping angular doc views. This is only exposed temporarily to aid - * migration to the new platform and will be removed soon. - * @deprecated - * @param injectorGetter - */ - setAngularInjectorGetter(injectorGetter: () => Promise): void; }; } -/** - * @public - */ + export interface DiscoverStart { - docViews: { - /** - * Component rendering all the doc views for a given document. - * This is only exposed temporarily to aid migration to the new platform and will be removed soon. - * @deprecated - */ - DocViewer: React.ComponentType; - }; savedSearches: { /** * Create a {@link SavedObjectLoader | loader} to handle the saved searches type. @@ -73,15 +81,59 @@ export interface DiscoverStart { }; } +/** + * @internal + */ +export interface DiscoverSetupPlugins { + uiActions: UiActionsSetup; + embeddable: EmbeddableSetup; + kibanaLegacy: KibanaLegacySetup; + home?: HomePublicPluginSetup; + visualizations: VisualizationsSetup; + data: DataPublicPluginSetup; +} + +/** + * @internal + */ +export interface DiscoverStartPlugins { + uiActions: UiActionsStart; + embeddable: EmbeddableStart; + navigation: NavigationStart; + charts: ChartsPluginStart; + data: DataPublicPluginStart; + share?: SharePluginStart; + inspector: InspectorPublicPluginStart; + visualizations: VisualizationsStart; +} + +const innerAngularName = 'app/discover'; +const embeddableAngularName = 'app/discoverEmbeddable'; + /** * Contains Discover, one of the oldest parts of Kibana * There are 2 kinds of Angular bootstrapped for rendering, additionally to the main Angular * Discover provides embeddables, those contain a slimmer Angular */ -export class DiscoverPlugin implements Plugin { +export class DiscoverPlugin + implements Plugin { + constructor(private readonly initializerContext: PluginInitializerContext) {} + + private appStateUpdater = new BehaviorSubject(() => ({})); private docViewsRegistry: DocViewsRegistry | null = null; + private embeddableInjector: auto.IInjectorService | null = null; + private stopUrlTracking: (() => void) | undefined = undefined; + private servicesInitialized: boolean = false; + private innerAngularInitialized: boolean = false; - setup(core: CoreSetup): DiscoverSetup { + /** + * why are those functions public? they are needed for some mocha tests + * can be removed once all is Jest + */ + public initializeInnerAngular?: () => void; + public initializeServices?: () => Promise<{ core: CoreStart; plugins: DiscoverStartPlugins }>; + + setup(core: CoreSetup, plugins: DiscoverSetupPlugins) { this.docViewsRegistry = new DocViewsRegistry(); setDocViewsRegistry(this.docViewsRegistry); this.docViewsRegistry.addDocView({ @@ -99,24 +151,158 @@ export class DiscoverPlugin implements Plugin { component: JsonCodeBlock, }); + const { + appMounted, + appUnMounted, + stop: stopUrlTracker, + setActiveUrl: setTrackedUrl, + } = createKbnUrlTracker({ + baseUrl: core.http.basePath.prepend('/app/kibana'), + defaultSubUrl: '#/discover', + storageKey: `lastUrl:${core.http.basePath.get()}:discover`, + navLinkUpdater$: this.appStateUpdater, + toastNotifications: core.notifications.toasts, + stateParams: [ + { + kbnUrlKey: '_g', + stateUpdate$: plugins.data.query.state$.pipe( + filter( + ({ changes }) => !!(changes.globalFilters || changes.time || changes.refreshInterval) + ), + map(({ state }) => ({ + ...state, + filters: state.filters?.filter(esFilters.isFilterPinned), + })) + ), + }, + ], + }); + setUrlTracker({ setTrackedUrl }); + this.stopUrlTracking = () => { + stopUrlTracker(); + }; + + this.docViewsRegistry.setAngularInjectorGetter(this.getEmbeddableInjector); + plugins.kibanaLegacy.registerLegacyApp({ + id: 'discover', + title: 'Discover', + updater$: this.appStateUpdater.asObservable(), + navLinkId: 'kibana:discover', + order: -1004, + euiIconType: 'discoverApp', + mount: async (params: AppMountParameters) => { + if (!this.initializeServices) { + throw Error('Discover plugin method initializeServices is undefined'); + } + if (!this.initializeInnerAngular) { + throw Error('Discover plugin method initializeInnerAngular is undefined'); + } + appMounted(); + await this.initializeServices(); + await this.initializeInnerAngular(); + + const { renderApp } = await import('./application/application'); + const unmount = await renderApp(innerAngularName, params.element); + return () => { + unmount(); + appUnMounted(); + }; + }, + }); + + if (plugins.home) { + registerFeature(plugins.home); + } + + this.registerEmbeddable(core, plugins); + return { docViews: { addDocView: this.docViewsRegistry.addDocView.bind(this.docViewsRegistry), - setAngularInjectorGetter: this.docViewsRegistry.setAngularInjectorGetter.bind( - this.docViewsRegistry - ), }, }; } - start() { + start(core: CoreStart, plugins: DiscoverStartPlugins) { + // we need to register the application service at setup, but to render it + // there are some start dependencies necessary, for this reason + // initializeInnerAngular + initializeServices are assigned at start and used + // when the application/embeddable is mounted + this.initializeInnerAngular = async () => { + if (this.innerAngularInitialized) { + return; + } + // this is used by application mount and tests + const module = getInnerAngularModule( + innerAngularName, + core, + plugins, + this.initializerContext + ); + setAngularModule(module); + this.innerAngularInitialized = true; + }; + + this.initializeServices = async () => { + if (this.servicesInitialized) { + return { core, plugins }; + } + const services = await buildServices(core, plugins, this.initializerContext); + setServices(services); + this.servicesInitialized = true; + + return { core, plugins }; + }; + return { - docViews: { - DocViewer, - }, savedSearches: { createLoader: createSavedSearchesLoader, }, }; } + + stop() { + if (this.stopUrlTracking) { + this.stopUrlTracking(); + } + } + + /** + * register embeddable with a slimmer embeddable version of inner angular + */ + private async registerEmbeddable( + core: CoreSetup, + plugins: DiscoverSetupPlugins + ) { + const { SearchEmbeddableFactory } = await import('./application/embeddable'); + + if (!this.getEmbeddableInjector) { + throw Error('Discover plugin method getEmbeddableInjector is undefined'); + } + + const getStartServices = async () => { + const [coreStart, deps] = await core.getStartServices(); + return { + executeTriggerActions: deps.uiActions.executeTriggerActions, + isEditable: () => coreStart.application.capabilities.discover.save as boolean, + }; + }; + + const factory = new SearchEmbeddableFactory(getStartServices, this.getEmbeddableInjector); + plugins.embeddable.registerEmbeddableFactory(factory.type, factory); + } + + private getEmbeddableInjector = async () => { + if (!this.embeddableInjector) { + if (!this.initializeServices) { + throw Error('Discover plugin getEmbeddableInjector: initializeServices is undefined'); + } + const { core, plugins } = await this.initializeServices(); + getInnerAngularModuleEmbeddable(embeddableAngularName, core, plugins); + const mountpoint = document.createElement('div'); + this.embeddableInjector = angular.bootstrap(mountpoint, [embeddableAngularName]); + } + + return this.embeddableInjector; + }; } diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/register_feature.ts b/src/plugins/discover/public/register_feature.ts similarity index 92% rename from src/legacy/core_plugins/kibana/public/discover/np_ready/register_feature.ts rename to src/plugins/discover/public/register_feature.ts index 74255642ab2c95..5ff722a86364af 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/register_feature.ts +++ b/src/plugins/discover/public/register_feature.ts @@ -17,10 +17,7 @@ * under the License. */ import { i18n } from '@kbn/i18n'; -import { - FeatureCatalogueCategory, - HomePublicPluginSetup, -} from '../../../../../../plugins/home/public'; +import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public'; export function registerFeature(home: HomePublicPluginSetup) { home.featureCatalogue.register({ diff --git a/src/plugins/discover/public/saved_searches/index.ts b/src/plugins/discover/public/saved_searches/index.ts index 24832df308a3ed..2ba7298b0f3273 100644 --- a/src/plugins/discover/public/saved_searches/index.ts +++ b/src/plugins/discover/public/saved_searches/index.ts @@ -17,4 +17,5 @@ * under the License. */ -export * from './saved_searches'; +export { createSavedSearchesLoader } from './saved_searches'; +export { SavedSearch, SavedSearchLoader } from './types'; diff --git a/src/plugins/discover/public/services.ts b/src/plugins/discover/public/services.ts deleted file mode 100644 index 37e2144800ea11..00000000000000 --- a/src/plugins/discover/public/services.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 { createGetterSetter } from '../../kibana_utils/public'; -import { DocViewsRegistry } from './doc_views/doc_views_registry'; - -export const [getDocViewsRegistry, setDocViewsRegistry] = createGetterSetter( - 'DocViewsRegistry' -); From d2c1ee6ff08a99963098218211ba1289d3e7178c Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 15 Apr 2020 17:09:09 +0300 Subject: [PATCH 015/134] Convert doc_table tests to jest --- .../discover/__tests__/doc_table/doc_table.js | 119 --------------- .../directives/debounce/debounce.test.ts | 8 +- .../angular/doc_table/doc_table.test.ts | 136 ++++++++++++++++++ .../angular/doc_table/doc_table.ts | 2 +- 4 files changed, 140 insertions(+), 125 deletions(-) delete mode 100644 src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/doc_table.js create mode 100644 src/plugins/discover/public/application/angular/doc_table/doc_table.test.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/doc_table.js b/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/doc_table.js deleted file mode 100644 index 9e74df08233dad..00000000000000 --- a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/doc_table.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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 angular from 'angular'; -import expect from '@kbn/expect'; -import _ from 'lodash'; -import ngMock from 'ng_mock'; -import 'ui/private'; -import { pluginInstance } from 'plugins/kibana/discover/legacy'; -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -import hits from 'fixtures/real_hits'; - -// Load the kibana app dependencies. - -let $parentScope; - -let $scope; - -let $timeout; - -let indexPattern; - -const init = function($elem, props) { - ngMock.inject(function($rootScope, $compile, _$timeout_) { - $timeout = _$timeout_; - $parentScope = $rootScope; - _.assign($parentScope, props); - - $compile($elem)($parentScope); - - // I think the prereq requires this? - $timeout(function() { - $elem.scope().$digest(); - }, 0); - - $scope = $elem.isolateScope(); - }); -}; - -const destroy = function() { - $scope.$destroy(); - $parentScope.$destroy(); -}; - -describe('docTable', function() { - let $elem; - beforeEach(() => pluginInstance.initializeInnerAngular()); - beforeEach(() => pluginInstance.initializeServices()); - beforeEach(ngMock.module('app/discover')); - beforeEach(function() { - $elem = angular.element(` - - `); - ngMock.inject(function(Private) { - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - }); - init($elem, { - indexPattern, - hits: [...hits], - totalHitCount: hits.length, - columns: [], - sorting: ['@timestamp', 'desc'], - }); - $scope.$digest(); - }); - - afterEach(function() { - destroy(); - }); - - it('should compile', function() { - expect($elem.text()).to.not.be.empty(); - }); - - it('should have an addRows function that increases the row count', function() { - expect($scope.addRows).to.be.a(Function); - $scope.$digest(); - expect($scope.limit).to.be(50); - $scope.addRows(); - expect($scope.limit).to.be(100); - }); - - it('should reset the row limit when results are received', function() { - $scope.limit = 100; - expect($scope.limit).to.be(100); - $scope.hits = [...hits]; - $scope.$digest(); - expect($scope.limit).to.be(50); - }); - - it('should have a header and a table element', function() { - $scope.$digest(); - - expect($elem.find('thead').length).to.be(1); - expect($elem.find('table').length).to.be(1); - }); -}); diff --git a/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts b/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts index 88d6dc8eaf4086..bc08d8566d48a4 100644 --- a/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts +++ b/src/plugins/discover/public/application/angular/directives/debounce/debounce.test.ts @@ -27,11 +27,9 @@ import 'angular-route'; import { DebounceProvider } from './index'; import { coreMock } from '../../../../../../../core/public/mocks'; import { initializeInnerAngularModule } from '../../../../get_inner_angular'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { navigationPluginMock } from 'src/plugins/navigation/public/mocks'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { dataPluginMock } from 'src/plugins/data/public/mocks'; -import { initAngularBootstrap } from 'src/plugins/kibana_legacy/public'; +import { navigationPluginMock } from '../../../../../../navigation/public/mocks'; +import { dataPluginMock } from '../../../../../../data/public/mocks'; +import { initAngularBootstrap } from '../../../../../../kibana_legacy/public'; describe('debounce service', function() { let debounce: (fn: () => void, timeout: number, options?: any) => any; diff --git a/src/plugins/discover/public/application/angular/doc_table/doc_table.test.ts b/src/plugins/discover/public/application/angular/doc_table/doc_table.test.ts new file mode 100644 index 00000000000000..14660516db1b13 --- /dev/null +++ b/src/plugins/discover/public/application/angular/doc_table/doc_table.test.ts @@ -0,0 +1,136 @@ +/* + * 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 angular, { ICompileService, IRootScopeService, ITimeoutService } from 'angular'; +import _ from 'lodash'; +// @ts-ignore +import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; +// @ts-ignore +import hits from 'fixtures/real_hits'; +import 'angular-mocks'; +import 'angular-sanitize'; +import 'angular-route'; + +import { coreMock } from '../../../../../../core/public/mocks'; +import { initializeInnerAngularModule } from '../../../get_inner_angular'; +import { navigationPluginMock } from '../../../../../navigation/public/mocks'; +import { dataPluginMock } from '../../../../../data/public/mocks'; +import { initAngularBootstrap } from '../../../../../kibana_legacy/public'; +import { LazyScope } from './doc_table'; + +jest.mock('../../../kibana_services', () => ({ + getServices: () => ({ + uiSettings: { + get: jest.fn(), + }, + }), +})); + +let $parentScope: IRootScopeService; +let $scope: LazyScope; +let indexPattern: any; + +const destroy = function() { + $scope.$destroy(); + $parentScope.$destroy(); +}; + +describe('docTable', function() { + let $elem: JQuery; + + beforeEach(() => { + initAngularBootstrap(); + initializeInnerAngularModule( + 'app/discover', + coreMock.createStart(), + navigationPluginMock.createStartContract(), + dataPluginMock.createStartContract() + ); + + $elem = angular.element(` + + `); + + angular.mock.module('app/discover'); + + angular.mock.inject(function(Private) { + indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); + }); + + angular.mock.inject( + ($compile: ICompileService, $timeout: ITimeoutService, $rootScope: IRootScopeService) => { + $parentScope = $rootScope; + _.assign($parentScope, { + indexPattern, + hits: [...hits], + totalHitCount: hits.length, + columns: [], + sorting: ['@timestamp', 'desc'], + }); + + $compile($elem)($parentScope); + + // I think the prereq requires this? + $timeout(function() { + $elem.scope().$digest(); + }, 0); + + $scope = $elem.isolateScope(); + } + ); + $scope.$digest(); + }); + + afterEach(function() { + destroy(); + }); + + it('should compile', function() { + expect($elem.text()).toBeTruthy(); + }); + + it('should have an addRows function that increases the row count', function() { + expect($scope.addRows).toEqual(expect.any(Function)); + $scope.$digest(); + expect($scope.limit).toBe(50); + $scope.addRows(); + expect($scope.limit).toBe(100); + }); + + it('should reset the row limit when results are received', function() { + $scope.limit = 100; + expect($scope.limit).toBe(100); + $scope.hits = [...hits]; + $scope.$digest(); + expect($scope.limit).toBe(50); + }); + + it('should have a header and a table element', function() { + $scope.$digest(); + + expect($elem.find('thead').length).toBe(1); + expect($elem.find('table').length).toBe(1); + }); +}); diff --git a/src/plugins/discover/public/application/angular/doc_table/doc_table.ts b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts index a75f5fbe4bc8b9..66b162a4584a77 100644 --- a/src/plugins/discover/public/application/angular/doc_table/doc_table.ts +++ b/src/plugins/discover/public/application/angular/doc_table/doc_table.ts @@ -23,7 +23,7 @@ import { dispatchRenderComplete } from '../../../../../kibana_utils/public'; import { getLimitedSearchResultsMessage } from './doc_table_strings'; import { getServices } from '../../../kibana_services'; -interface LazyScope extends ng.IScope { +export interface LazyScope extends ng.IScope { [key: string]: any; } From 420b22b0605a36b968ca780004308bd3ba599a76 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Wed, 15 Apr 2020 21:28:25 +0300 Subject: [PATCH 016/134] Move rows_headers to use jest --- .../components/rows_headers.test.js} | 58 ++++++++++++++----- .../table_header/table_header.test.tsx | 2 - .../application/components/doc/doc.test.tsx | 13 +++++ .../components/doc_viewer/doc_viewer.test.tsx | 2 +- 4 files changed, 58 insertions(+), 17 deletions(-) rename src/{legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js => plugins/discover/public/application/angular/doc_table/components/rows_headers.test.js} (91%) diff --git a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js b/src/plugins/discover/public/application/angular/doc_table/components/rows_headers.test.js similarity index 91% rename from src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js rename to src/plugins/discover/public/application/angular/doc_table/components/rows_headers.test.js index 9b63b8cd18f3e9..5cbd7f065d19e1 100644 --- a/src/legacy/core_plugins/kibana/public/discover/__tests__/doc_table/lib/rows_headers.js +++ b/src/plugins/discover/public/application/angular/doc_table/components/rows_headers.test.js @@ -19,14 +19,36 @@ import angular from 'angular'; import _ from 'lodash'; +import $ from 'jquery'; import sinon from 'sinon'; import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; +import 'angular-mocks'; +import 'angular-sanitize'; +import 'angular-route'; import { getFakeRow, getFakeRowVals } from 'fixtures/fake_row'; -import $ from 'jquery'; -import { pluginInstance } from 'plugins/kibana/discover/legacy'; import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; +import { coreMock } from '../../../../../../../core/public/mocks'; +import { initializeInnerAngularModule } from '../../../../get_inner_angular'; +import { navigationPluginMock } from '../../../../../../navigation/public/mocks'; +import { dataPluginMock } from '../../../../../../data/public/mocks'; +import { initAngularBootstrap } from '../../../../../../kibana_legacy/public'; + +jest.mock('../../../../kibana_services', () => ({ + getServices: () => ({ + uiSettings: { + get: jest.fn(), + }, + filterManager: { + getGlobalFilters: () => [], + getAppFilters: () => [], + }, + }), + getDocViewsRegistry: () => ({ + getDocViewsSorted: () => [], + }), +})); + describe('Doc Table', function() { let $parentScope; let $scope; @@ -36,11 +58,19 @@ describe('Doc Table', function() { let fakeRowVals; let stubFieldFormatConverter; - beforeEach(() => pluginInstance.initializeServices()); - beforeEach(() => pluginInstance.initializeInnerAngular()); - beforeEach(ngMock.module('app/discover')); - beforeEach( - ngMock.inject(function($rootScope, Private) { + + beforeEach(() => { + initAngularBootstrap(); + initializeInnerAngularModule( + 'app/discover', + coreMock.createStart(), + navigationPluginMock.createStartContract(), + dataPluginMock.createStartContract() + ); + + angular.mock.module('app/discover'); + + angular.mock.inject(function($rootScope, Private) { $parentScope = $rootScope; $parentScope.indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); mapping = $parentScope.indexPattern.fields; @@ -53,7 +83,7 @@ describe('Doc Table', function() { if (val) { return val; } - const fieldName = _.get(options, 'field.name', null); + const fieldName = _.get(options, 'field.name', ''); return fakeRowVals[fieldName] || ''; }; @@ -61,12 +91,12 @@ describe('Doc Table', function() { $root.indexPattern.fields.getByName(field).format.convert = convertFn; $root.indexPattern.fields.getByName(field).format.getConverterFor = () => convertFn; }; - }) - ); + }); + }); // Sets up the directive, take an element, and a list of properties to attach to the parent scope. const init = function($elem, props) { - ngMock.inject(function($compile) { + angular.mock.inject(function($compile) { _.assign($parentScope, props); $compile($elem)($parentScope); $elem.scope().$digest(); @@ -200,7 +230,7 @@ describe('Doc Table', function() { row = getFakeRow(0, mapping); init($elem, { - row: row, + row, columns: [], sorting: [], filtering: sinon.spy(), @@ -233,7 +263,7 @@ describe('Doc Table', function() { let $before; beforeEach( - ngMock.inject(function($rootScope, $compile, Private) { + angular.mock.inject(function($rootScope, $compile, Private) { $root = $rootScope; $root.row = getFakeRow(0, mapping); $root.columns = ['_source']; diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx index 89f73022627c50..b201bea26503ea 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header.test.tsx @@ -25,8 +25,6 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { SortOrder } from './helpers'; import { IndexPattern, IFieldType } from '../../../../../kibana_services'; -jest.mock('ui/new_platform'); - function getMockIndexPattern() { return ({ id: 'test', diff --git a/src/plugins/discover/public/application/components/doc/doc.test.tsx b/src/plugins/discover/public/application/components/doc/doc.test.tsx index 50f0c268bbe660..2cbc1547d1082f 100644 --- a/src/plugins/discover/public/application/components/doc/doc.test.tsx +++ b/src/plugins/discover/public/application/components/doc/doc.test.tsx @@ -25,12 +25,25 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { Doc, DocProps } from './doc'; jest.mock('../../../kibana_services', () => { + let registry: any[] = []; + return { getServices: () => ({ metadata: { branch: 'test', }, }), + getDocViewsRegistry: () => ({ + addDocView(view: any) { + registry.push(view); + }, + getDocViewsSorted() { + return registry; + }, + resetRegistry: () => { + registry = []; + }, + }), }; }); diff --git a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx index c2c2b49133818c..3710ce72533dbd 100644 --- a/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx +++ b/src/plugins/discover/public/application/components/doc_viewer/doc_viewer.test.tsx @@ -24,7 +24,7 @@ import { findTestSubject } from '@elastic/eui/lib/test'; import { getDocViewsRegistry } from '../../../kibana_services'; import { DocViewRenderProps } from '../../doc_views/doc_views_types'; -jest.mock('../../services', () => { +jest.mock('../../../kibana_services', () => { let registry: any[] = []; return { getDocViewsRegistry: () => ({ From 7e837cfac270740cd2f713cfc12fc67a9402012f Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 16 Apr 2020 12:13:40 +0300 Subject: [PATCH 017/134] Move fixed_scroll.test --- src/dev/jest/config.js | 1 + src/dev/jest/setup/jquery.js | 21 ++ .../angular/directives/fixed_scroll.test.ts | 213 ++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 src/dev/jest/setup/jquery.js create mode 100644 src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 7da14e0dfe51bf..780cafe01bd5ae 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -68,6 +68,7 @@ export default { '/src/dev/jest/setup/babel_polyfill.js', '/src/dev/jest/setup/polyfills.js', '/src/dev/jest/setup/enzyme.js', + '/src/dev/jest/setup/jquery.js', ], setupFilesAfterEnv: [ '/src/dev/jest/setup/mocks.js', diff --git a/src/dev/jest/setup/jquery.js b/src/dev/jest/setup/jquery.js new file mode 100644 index 00000000000000..52dba84c5844e7 --- /dev/null +++ b/src/dev/jest/setup/jquery.js @@ -0,0 +1,21 @@ +/* + * 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'; +global.$ = global.jQuery = $; diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts new file mode 100644 index 00000000000000..5c43a66d77a362 --- /dev/null +++ b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts @@ -0,0 +1,213 @@ +/* + * 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 sinon, { SinonSpy } from 'sinon'; +import expect from '@kbn/expect'; +import angular, { ITimeoutService, ICompileService, IRootScopeService } from 'angular'; +import 'angular-mocks'; +import 'angular-sanitize'; +import 'angular-route'; + +import { coreMock } from '../../../../../../core/public/mocks'; +import { initializeInnerAngularModule } from '../../../get_inner_angular'; +import { navigationPluginMock } from '../../../../../navigation/public/mocks'; +import { dataPluginMock } from '../../../../../data/public/mocks'; +import { initAngularBootstrap } from '../../../../../kibana_legacy/public'; + +describe.skip('FixedScroll directive', function() { + const sandbox = sinon.createSandbox(); + + let compile: ( + ratioY: number, + ratioX?: number + ) => { + $container: JQuery; + $content: JQuery; + $scroller: JQuery; + [key: string]: JQuery; + }; + let flushPendingTasks: () => void; + const trash: Array> = []; + + beforeEach(() => { + initAngularBootstrap(); + initializeInnerAngularModule( + 'app/discover', + coreMock.createStart(), + navigationPluginMock.createStartContract(), + dataPluginMock.createStartContract() + ); + + angular.mock.module('app/discover'); + angular.mock.inject( + ($compile: ICompileService, _$timeout_: ITimeoutService, $rootScope: IRootScopeService) => { + flushPendingTasks = () => { + $rootScope.$digest(); + _$timeout_.flush(); + }; + + compile = function(ratioY, ratioX = ratioY) { + // since the directive works at the sibling level we create a + // parent for everything to happen in + const $parent = $('
').css({ + position: 'fixed', + top: 0, + left: 0, + right: 0, + bottom: 0, + }); + + $parent.appendTo(document.body); + trash.push($parent); + + const $el = $('
') + .css({ + 'overflow-x': 'auto', + width: $parent.width()!, + }) + .appendTo($parent); + + const $content = $('
') + .css({ + width: $parent.width()! * ratioX, + height: $parent.height()! * ratioY, + }) + .appendTo($el); + + $compile($parent)($rootScope); + flushPendingTasks(); + + return { + $container: $el, + $content, + $scroller: $parent.find('.fixed-scroll-scroller'), + }; + }; + } + ); + }); + + afterEach(() => { + trash.splice(0).forEach(function($el) { + $el.remove(); + }); + + sandbox.restore(); + }); + + it('does nothing when not needed', function() { + let els = compile(0.5, 1.5); + expect(els.$scroller).to.have.length(0); + + els = compile(1.5, 0.5); + expect(els.$scroller).to.have.length(0); + }); + + it('attaches a scroller below the element when the content is larger then the container', function() { + const els = compile(1.5); + expect(els.$scroller).to.have.length(1); + }); + + it('copies the width of the container', function() { + const els = compile(1.5); + expect(els.$scroller.width()).to.be(els.$container.width()); + }); + + it('mimics the scrollWidth of the element', function() { + const els = compile(1.5); + expect(els.$scroller.prop('scrollWidth')).to.be(els.$container.prop('scrollWidth')); + }); + + describe.skip('scroll event handling / tug of war prevention', function() { + it('listens when needed, unlistens when not needed', function() { + const on = sandbox.spy($.fn, 'on'); + const off = sandbox.spy($.fn, 'off'); + + const els = compile(1.5); + expect(on.callCount).to.be(2); + checkThisVals('$.fn.on', on); + + expect(off.callCount).to.be(0); + els.$container.width(els.$container.prop('scrollWidth')); + flushPendingTasks(); + expect(off.callCount).to.be(2); + checkThisVals('$.fn.off', off); + + function checkThisVals(name: string, spy: SinonSpy) { + // the this values should be different + expect(spy.thisValues[0].is(spy.thisValues[1])).to.be(false); + // but they should be either $scroller or $container + spy.thisValues.forEach(function($this) { + if ($this.is(els.$scroller) || $this.is(els.$container)) return; + // @ts-ignore + expect.fail('expected ' + name + ' to be called with $scroller or $container'); + }); + } + }); + + [ + { from: '$container', to: '$scroller' }, + { from: '$scroller', to: '$container' }, + ].forEach(function(names) { + describe('scroll events ' + JSON.stringify(names), function() { + let spy: SinonSpy; + let els; + let $from: JQuery; + let $to: JQuery; + + beforeEach(function() { + spy = sandbox.spy($.fn, 'scrollLeft'); + els = compile(1.5); + $from = els[names.from]; + $to = els[names.to]; + }); + + it('transfers the scrollLeft', function() { + expect(spy.callCount).to.be(0); + $from.scroll(); + expect(spy.callCount).to.be(2); + + // first call should read the scrollLeft from the $container + const firstCall = spy.getCall(0); + expect(firstCall.thisValue.is($from)).to.be(true); + expect(firstCall.args).to.eql([]); + + // second call should be setting the scrollLeft on the $scroller + const secondCall = spy.getCall(1); + expect(secondCall.thisValue.is($to)).to.be(true); + expect(secondCall.args).to.eql([firstCall.returnValue]); + }); + + /** + * In practice, calling $el.scrollLeft() causes the "scroll" event to trigger, + * but the browser seems to be very careful about triggering the event too much + * and I can't reliably recreate the browsers behavior in a test. So... faking it! + */ + it('prevents tug of war by ignoring echo scroll events', function() { + $from.scroll(); + expect(spy.callCount).to.be(2); + + spy.resetHistory(); + $to.scroll(); + expect(spy.callCount).to.be(0); + }); + }); + }); + }); +}); From 5cd1d595be9ed05cc69d3e5f1421b6d6f026505e Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 17 Apr 2020 17:59:28 +0200 Subject: [PATCH 018/134] make a lot of stuff work --- src/core/public/chrome/ui/header/header.tsx | 1 + .../public/chrome/ui/header/header_logo.tsx | 14 +++-- src/legacy/core_plugins/kibana/index.js | 23 +------- .../sidebar/lib/visualize_url_utils.ts | 4 +- .../server/lib/__tests__/relationships.js | 20 +++---- .../ui/public/chrome/api/__tests__/nav.js | 16 +++--- .../ui/public/url/absolute_to_parsed_url.ts | 4 +- src/legacy/ui/public/url/kibana_parsed_url.ts | 8 +-- src/plugins/console/public/plugin.ts | 2 +- src/plugins/dashboard/public/plugin.tsx | 36 +++++++++---- .../public/url_utils}/url_helper.test.ts | 4 +- .../public/url_utils}/url_helper.ts | 23 ++++---- src/plugins/dev_tools/README.md | 2 +- src/plugins/dev_tools/public/application.tsx | 12 ++--- src/plugins/dev_tools/public/index.scss | 6 +++ src/plugins/dev_tools/public/plugin.ts | 16 +++++- .../state_management/url/kbn_url_tracker.ts | 11 ++-- .../saved_objects_table.test.tsx.snap | 2 +- .../__snapshots__/relationships.test.tsx.snap | 8 +-- .../components/relationships.test.tsx | 10 ++-- .../saved_objects_table.test.tsx | 2 +- .../visualize_embeddable_factory.tsx | 1 + src/plugins/visualizations/public/plugin.ts | 2 + .../public/saved_visualizations/_saved_vis.ts | 2 +- .../saved_visualizations.ts | 4 +- src/plugins/visualizations/public/services.ts | 3 ++ .../vis_types/vis_type_alias_registry.ts | 4 +- .../public/wizard/new_vis_modal.test.tsx | 2 +- .../public/wizard/new_vis_modal.tsx | 23 +++++--- .../public/wizard/show_new_vis.tsx | 18 ++++++- .../type_selection/new_vis_help.test.tsx | 2 +- .../wizard/type_selection/type_selection.tsx | 8 +-- .../server/saved_objects/visualization.ts | 2 +- src/plugins/visualize/kibana.json | 3 +- .../visualize/public/application/_app.scss | 5 ++ .../public/application/editor/editor.js | 11 ++-- .../public/application/editor/lib/index.ts | 2 +- .../visualize/public/application/index.scss | 1 + .../listing/visualize_listing.html | 2 +- .../application/listing/visualize_listing.js | 34 ++++++++++-- .../listing/visualize_listing_table.js | 13 ++--- .../public/application/visualize_constants.ts | 10 ++-- .../visualize/public/kibana_services.ts | 2 + src/plugins/visualize/public/plugin.ts | 23 ++++++-- .../apis/saved_objects_management/find.ts | 6 +-- .../saved_objects_management/relationships.ts | 14 ++--- test/api_integration/apis/shorten/index.js | 6 +-- test/functional/apps/home/_home.js | 2 +- vars/agentInfo.groovy | 2 +- .../grokdebugger/public/register_feature.ts | 2 +- .../helpers/create_tsvb_link.ts | 4 +- x-pack/plugins/lens/common/constants.ts | 5 +- x-pack/plugins/lens/kibana.json | 3 +- .../plugins/lens/public/app_plugin/_app.scss | 6 +++ .../lens/public/app_plugin/app.test.tsx | 4 +- x-pack/plugins/lens/public/app_plugin/app.tsx | 6 ++- x-pack/plugins/lens/public/helpers/index.ts | 7 --- .../lens/public/helpers/url_helper.test.ts | 49 ----------------- .../plugins/lens/public/helpers/url_helper.ts | 45 ---------------- x-pack/plugins/lens/public/plugin.tsx | 53 ++++++++----------- x-pack/plugins/lens/public/vis_type_alias.ts | 4 +- x-pack/plugins/painless_lab/public/plugin.tsx | 2 +- .../public/components/report_listing.test.tsx | 2 +- .../plugins/searchprofiler/public/plugin.ts | 2 +- .../__fixtures__/checkup_api_response.json | 8 +-- .../__snapshots__/checkup_tab.test.tsx.snap | 12 ++--- .../feature_controls/visualize_security.ts | 14 ++--- 67 files changed, 334 insertions(+), 325 deletions(-) rename src/plugins/{visualize/public/application/editor/lib => dashboard/public/url_utils}/url_helper.test.ts (92%) rename src/plugins/{visualize/public/application/editor/lib => dashboard/public/url_utils}/url_helper.ts (55%) create mode 100644 src/plugins/visualize/public/application/_app.scss delete mode 100644 x-pack/plugins/lens/public/helpers/index.ts delete mode 100644 x-pack/plugins/lens/public/helpers/url_helper.test.ts delete mode 100644 x-pack/plugins/lens/public/helpers/url_helper.ts diff --git a/src/core/public/chrome/ui/header/header.tsx b/src/core/public/chrome/ui/header/header.tsx index 66b34c3db7bad8..058c557a53885f 100644 --- a/src/core/public/chrome/ui/header/header.tsx +++ b/src/core/public/chrome/ui/header/header.tsx @@ -210,6 +210,7 @@ export class Header extends Component { href={this.props.homeHref} forceNavigation={this.state.forceNavigation} navLinks={navLinks} + navigateToApp={this.props.application.navigateToApp} /> diff --git a/src/core/public/chrome/ui/header/header_logo.tsx b/src/core/public/chrome/ui/header/header_logo.tsx index 793b8646dabf78..371e5039aab1e7 100644 --- a/src/core/public/chrome/ui/header/header_logo.tsx +++ b/src/core/public/chrome/ui/header/header_logo.tsx @@ -41,7 +41,8 @@ function findClosestAnchor(element: HTMLElement): HTMLAnchorElement | void { function onClick( event: React.MouseEvent, forceNavigation: boolean, - navLinks: NavLink[] + navLinks: NavLink[], + navigateToApp: (appId: string) => void ) { const anchor = findClosestAnchor((event as any).nativeEvent.target); if (!anchor) { @@ -54,6 +55,12 @@ function onClick( return; } + if (!forceNavigation && !event.altKey && !event.metaKey && !event.ctrlKey) { + navigateToApp('home'); + event.preventDefault(); + return; + } + if ( !forceNavigation || event.isDefaultPrevented() || @@ -87,14 +94,15 @@ interface Props { href: string; navLinks: NavLink[]; forceNavigation: boolean; + navigateToApp: (appId: string) => void; } -export function HeaderLogo({ href, forceNavigation, navLinks }: Props) { +export function HeaderLogo({ href, forceNavigation, navLinks, navigateToApp }: Props) { return ( onClick(e, forceNavigation, navLinks)} + onClick={e => onClick(e, forceNavigation, navLinks, navigateToApp)} href={href} aria-label={i18n.translate('core.ui.chrome.headerGlobalNav.goHomePageIconAriaLabel', { defaultMessage: 'Go to home page', diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 9143b46699079b..37a3506016c844 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -74,28 +74,9 @@ export default function(kibana) { disableSubUrlTracking: true, category: DEFAULT_APP_CATEGORIES.analyze, }, - { - id: 'kibana:visualize', - title: i18n.translate('kbn.visualizeTitle', { - defaultMessage: 'Visualize', - }), - order: -1002, - url: `${kbnBaseUrl}#/visualize`, - euiIconType: 'visualizeApp', - disableSubUrlTracking: true, - category: DEFAULT_APP_CATEGORIES.analyze, - }, + // TODO get rid of kibana:visualize references // TODO get rid of kibana:dashboard references - { - id: 'kibana:dev_tools', - title: i18n.translate('kbn.devToolsTitle', { - defaultMessage: 'Dev Tools', - }), - order: 9001, - url: '/app/kibana#/dev_tools', - euiIconType: 'devToolsApp', - category: DEFAULT_APP_CATEGORIES.management, - }, + // TODO get rid of kibana:dev_tools references { id: 'kibana:stack_management', title: i18n.translate('kbn.managementTitle', { diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts index d146d212055b76..779ef2222029c6 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts @@ -36,7 +36,7 @@ function getMapsAppBaseUrl(visualizations: VisualizationsStart) { const mapsAppVisAlias = visualizations.getAliases().find(({ name }) => { return name === 'maps'; }); - return mapsAppVisAlias ? mapsAppVisAlias.aliasUrl : null; + return mapsAppVisAlias ? mapsAppVisAlias.aliasPath : null; } export function isMapsAppRegistered(visualizations: VisualizationsStart) { @@ -184,5 +184,5 @@ export function getVisualizeUrl( }, }; - return `#/visualize/create?${stringify(linkUrlParams)}`; + return `/app/visualize#/create?${stringify(linkUrlParams)}`; } diff --git a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js index b06a5b443e709e..aea581f84cd2f9 100644 --- a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js +++ b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js @@ -85,7 +85,7 @@ const savedObjectsManagement = getManagementaMock({ }, getInAppUrl(obj) { return { - path: `/app/kibana#/visualize/edit/${encodeURIComponent(obj.id)}`, + path: `/app/visualize#/edit/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'visualize.show', }; }, @@ -200,7 +200,7 @@ describe('findRelationships', () => { title: 'Foo', editUrl: '/management/kibana/objects/savedVisualizations/1', inAppUrl: { - path: '/app/kibana#/visualize/edit/1', + path: '/app/visualize#/edit/1', uiCapabilitiesPath: 'visualize.show', }, }, @@ -214,7 +214,7 @@ describe('findRelationships', () => { title: 'Bar', editUrl: '/management/kibana/objects/savedVisualizations/2', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, }, @@ -228,7 +228,7 @@ describe('findRelationships', () => { title: 'FooBar', editUrl: '/management/kibana/objects/savedVisualizations/3', inAppUrl: { - path: '/app/kibana#/visualize/edit/3', + path: '/app/visualize#/edit/3', uiCapabilitiesPath: 'visualize.show', }, }, @@ -453,7 +453,7 @@ describe('findRelationships', () => { title: 'Foo', editUrl: '/management/kibana/objects/savedVisualizations/1', inAppUrl: { - path: '/app/kibana#/visualize/edit/1', + path: '/app/visualize#/edit/1', uiCapabilitiesPath: 'visualize.show', }, }, @@ -467,7 +467,7 @@ describe('findRelationships', () => { title: 'Bar', editUrl: '/management/kibana/objects/savedVisualizations/2', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, }, @@ -481,7 +481,7 @@ describe('findRelationships', () => { title: 'FooBar', editUrl: '/management/kibana/objects/savedVisualizations/3', inAppUrl: { - path: '/app/kibana#/visualize/edit/3', + path: '/app/visualize#/edit/3', uiCapabilitiesPath: 'visualize.show', }, }, @@ -567,7 +567,7 @@ describe('findRelationships', () => { title: 'Foo', editUrl: '/management/kibana/objects/savedVisualizations/1', inAppUrl: { - path: '/app/kibana#/visualize/edit/1', + path: '/app/visualize#/edit/1', uiCapabilitiesPath: 'visualize.show', }, }, @@ -581,7 +581,7 @@ describe('findRelationships', () => { title: 'Bar', editUrl: '/management/kibana/objects/savedVisualizations/2', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, }, @@ -595,7 +595,7 @@ describe('findRelationships', () => { title: 'FooBar', editUrl: '/management/kibana/objects/savedVisualizations/3', inAppUrl: { - path: '/app/kibana#/visualize/edit/3', + path: '/app/visualize#/edit/3', uiCapabilitiesPath: 'visualize.show', }, }, diff --git a/src/legacy/ui/public/chrome/api/__tests__/nav.js b/src/legacy/ui/public/chrome/api/__tests__/nav.js index 853ef4ad0b3dcd..078810d069f640 100644 --- a/src/legacy/ui/public/chrome/api/__tests__/nav.js +++ b/src/legacy/ui/public/chrome/api/__tests__/nav.js @@ -124,8 +124,8 @@ describe('chrome nav apis', function() { }, { id: 'kibana:visualize', - baseUrl: `${baseUrl}/app/kibana#visualize`, - subUrlBase: '/app/kibana#visualize', + baseUrl: `${baseUrl}/app/visualize#`, + subUrlBase: '/app/visualize#', legacy: true, }, { @@ -142,7 +142,7 @@ describe('chrome nav apis', function() { expect(fakedLinks[0].url).to.be(`${baseUrl}/app/kibana#discover?_g=globalstate`); expect(fakedLinks[0].active).to.be(false); - expect(fakedLinks[1].url).to.be(`${baseUrl}/app/kibana#visualize?_g=globalstate`); + expect(fakedLinks[1].url).to.be(`${baseUrl}/app/visualize#?_g=globalstate`); expect(fakedLinks[1].active).to.be(false); expect(fakedLinks[2].url).to.be(`${baseUrl}/app/kibana#dashboard?_g=globalstate`); @@ -156,22 +156,22 @@ describe('chrome nav apis', function() { fakedLinks = [ { id: 'kibana:visualize', - baseUrl: `${baseUrl}/app/kibana#visualize`, - url: `${baseUrl}/app/kibana#visualize`, - subUrlBase: '/app/kibana#visualize', + baseUrl: `${baseUrl}/app/visualize#`, + url: `${baseUrl}/app/visualize#`, + subUrlBase: '/app/visualize#', legacy: true, }, ]; const { chrome } = init({ appUrlStore }); const kibanaParsedUrl = absoluteToParsedUrl( - `${baseUrl}/xyz/app/kibana#visualize/1234?_g=globalstate`, + `${baseUrl}/xyz/app/visualize#/1234?_g=globalstate`, '/xyz' ); chrome.trackSubUrlForApp('kibana:visualize', kibanaParsedUrl); expect( coreNavLinks.update.calledWith('kibana:visualize', { - url: `${baseUrl}/xyz/app/kibana#visualize/1234?_g=globalstate`, + url: `${baseUrl}/xyz/app/visualize#/1234?_g=globalstate`, }) ).to.be(true); }); diff --git a/src/legacy/ui/public/url/absolute_to_parsed_url.ts b/src/legacy/ui/public/url/absolute_to_parsed_url.ts index cd2781c56eefe7..30f493c25776c2 100644 --- a/src/legacy/ui/public/url/absolute_to_parsed_url.ts +++ b/src/legacy/ui/public/url/absolute_to_parsed_url.ts @@ -24,9 +24,9 @@ import { KibanaParsedUrl } from './kibana_parsed_url'; /** * - * @param absoluteUrl - an absolute url, e.g. https://localhost:5601/gra/app/kibana#/visualize/edit/viz_id?hi=bye + * @param absoluteUrl - an absolute url, e.g. https://localhost:5601/gra/app/visualize#/edit/viz_id?hi=bye * @param basePath - An optional base path for kibana. If supplied, should start with a "/". - * e.g. in https://localhost:5601/gra/app/kibana#/visualize/edit/viz_id the basePath is + * e.g. in https://localhost:5601/gra/app/visualize#/edit/viz_id the basePath is * "/gra". * @return {KibanaParsedUrl} */ diff --git a/src/legacy/ui/public/url/kibana_parsed_url.ts b/src/legacy/ui/public/url/kibana_parsed_url.ts index 93d2e17d6038f6..d7d6d6431b7f20 100644 --- a/src/legacy/ui/public/url/kibana_parsed_url.ts +++ b/src/legacy/ui/public/url/kibana_parsed_url.ts @@ -25,22 +25,22 @@ import { prependPath } from './prepend_path'; interface Options { /** * An optional base path for kibana. If supplied, should start with a "/". - * e.g. in https://localhost:5601/gra/app/kibana#/visualize/edit/viz_id the + * e.g. in https://localhost:5601/gra/app/visualize#/edit/viz_id the * basePath is "/gra" */ basePath?: string; /** * The app id. - * e.g. in https://localhost:5601/gra/app/kibana#/visualize/edit/viz_id the app id is "kibana". + * e.g. in https://localhost:5601/gra/app/visualize#/edit/viz_id the app id is "kibana". */ appId: string; /** * The path for a page in the the app. Should start with a "/". Don't include the hash sign. Can * include all query parameters. - * e.g. in https://localhost:5601/gra/app/kibana#/visualize/edit/viz_id?g=state the appPath is - * "/visualize/edit/viz_id?g=state" + * e.g. in https://localhost:5601/gra/app/visualize#/edit/viz_id?g=state the appPath is + * "/edit/viz_id?g=state" */ appPath?: string; diff --git a/src/plugins/console/public/plugin.ts b/src/plugins/console/public/plugin.ts index 32be52885e2cb5..49a232ce35cd0c 100644 --- a/src/plugins/console/public/plugin.ts +++ b/src/plugins/console/public/plugin.ts @@ -41,7 +41,7 @@ export class ConsoleUIPlugin implements Plugin SavedObjectLoader; + addEmbeddableToDashboard: (options: { + embeddableId: string; + embeddableType: string; + }) => void | undefined; } declare module '../../../plugins/ui_actions/public' { @@ -124,6 +129,7 @@ export class DashboardPlugin private appStateUpdater = new BehaviorSubject(() => ({})); private stopUrlTracking: (() => void) | undefined = undefined; + private getActiveUrl: (() => string) | undefined = undefined; public setup( core: CoreSetup, @@ -174,16 +180,9 @@ export class DashboardPlugin embeddable.registerEmbeddableFactory(factory.type, factory); // TODO this doesn't work yet because the new platform doesn't allow it: https://github.com/elastic/kibana/issues/56027 - const { appMounted, appUnMounted, stop: stopUrlTracker } = createKbnUrlTracker({ - baseUrl: core.http.basePath.prepend('/app/kibana'), + const { appMounted, appUnMounted, stop: stopUrlTracker, getActiveUrl } = createKbnUrlTracker({ + baseUrl: core.http.basePath.prepend('/app/dashboards'), defaultSubUrl: `#${DashboardConstants.LANDING_PAGE_PATH}`, - shouldTrackUrlUpdate: pathname => { - const targetAppName = pathname.split('/')[1]; - return ( - targetAppName === DashboardConstants.DASHBOARDS_ID || - targetAppName === DashboardConstants.DASHBOARD_ID - ); - }, storageKey: `lastUrl:${core.http.basePath.get()}:dashboard`, navLinkUpdater$: this.appStateUpdater, toastNotifications: core.notifications.toasts, @@ -203,6 +202,7 @@ export class DashboardPlugin ], }); + this.getActiveUrl = getActiveUrl; this.stopUrlTracking = () => { stopUrlTracker(); }; @@ -302,6 +302,23 @@ export class DashboardPlugin } } + private addEmbeddableToDashboard( + core: CoreStart, + { embeddableId, embeddableType }: { embeddableId: string; embeddableType: string } + ) { + if (!this.getActiveUrl) { + throw new Error('dashboard is not ready yet.'); + } + + const lastDashboardUrl = this.getActiveUrl(); + const dashboardUrl = addEmbeddableToDashboardUrl( + lastDashboardUrl, + embeddableId, + embeddableType + ); + core.application.navigateToApp('dashboards', { path: dashboardUrl }); + } + public start(core: CoreStart, plugins: StartDependencies): DashboardStart { const { notifications } = core; const { @@ -328,6 +345,7 @@ export class DashboardPlugin }); return { getSavedDashboardLoader: () => savedDashboardLoader, + addEmbeddableToDashboard: this.addEmbeddableToDashboard.bind(this, core), }; } diff --git a/src/plugins/visualize/public/application/editor/lib/url_helper.test.ts b/src/plugins/dashboard/public/url_utils/url_helper.test.ts similarity index 92% rename from src/plugins/visualize/public/application/editor/lib/url_helper.test.ts rename to src/plugins/dashboard/public/url_utils/url_helper.test.ts index 09609e3d7e3620..703cc00ff8d89c 100644 --- a/src/plugins/visualize/public/application/editor/lib/url_helper.test.ts +++ b/src/plugins/dashboard/public/url_utils/url_helper.test.ts @@ -24,7 +24,7 @@ describe('', () => { const id = '123eb456cd'; const url = "/pep/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; - expect(addEmbeddableToDashboardUrl(url, id)).toEqual( + expect(addEmbeddableToDashboardUrl(url, id, 'visualization')).toEqual( `/dashboard?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` ); }); @@ -32,7 +32,7 @@ describe('', () => { const id = '123eb456cd'; const url = "/pep/app/kibana#/dashboard/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; - expect(addEmbeddableToDashboardUrl(url, id)).toEqual( + expect(addEmbeddableToDashboardUrl(url, id, 'visualization')).toEqual( `/dashboard/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` ); }); diff --git a/src/plugins/visualize/public/application/editor/lib/url_helper.ts b/src/plugins/dashboard/public/url_utils/url_helper.ts similarity index 55% rename from src/plugins/visualize/public/application/editor/lib/url_helper.ts rename to src/plugins/dashboard/public/url_utils/url_helper.ts index 84e1ef9687cd0f..c285c6f39503cc 100644 --- a/src/plugins/visualize/public/application/editor/lib/url_helper.ts +++ b/src/plugins/dashboard/public/url_utils/url_helper.ts @@ -18,23 +18,26 @@ */ import { parseUrl, stringify } from 'query-string'; -import { DashboardConstants } from '../../../../../dashboard/public'; -import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../visualizations/public'; +import { DashboardConstants } from '../index'; /** * * Returns relative dashboard URL with added embeddableType and embeddableId query params * eg. - * input: url: lol/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)), embeddableId: 12345 - * output: /dashboard?addEmbeddableType=visualization&addEmbeddableId=12345&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) - * @param url dasbhoard absolute url - * @param embeddableId id of the saved visualization + * input: url: #/create?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)), embeddableId: 12345 + * output: #/create?addEmbeddableType=visualization&addEmbeddableId=12345&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) + * @param url dasbhoard hash part of the url + * @param embeddableId id of the saved embeddable + * @param embeddableType type of the embeddable */ -export function addEmbeddableToDashboardUrl(dashboardUrl: string, embeddableId: string) { +export function addEmbeddableToDashboardUrl( + dashboardUrl: string, + embeddableId: string, + embeddableType: string +) { const { url, query } = parseUrl(dashboardUrl); - const [, dashboardId] = url.split(DashboardConstants.CREATE_NEW_DASHBOARD_URL); - query[DashboardConstants.ADD_EMBEDDABLE_TYPE] = VISUALIZE_EMBEDDABLE_TYPE; + query[DashboardConstants.ADD_EMBEDDABLE_TYPE] = embeddableType; query[DashboardConstants.ADD_EMBEDDABLE_ID] = embeddableId; - return `${DashboardConstants.CREATE_NEW_DASHBOARD_URL}${dashboardId}?${stringify(query)}`; + return `${url}?${stringify(query)}`; } diff --git a/src/plugins/dev_tools/README.md b/src/plugins/dev_tools/README.md index d04be5ee61e5c0..33c19bcc72efc5 100644 --- a/src/plugins/dev_tools/README.md +++ b/src/plugins/dev_tools/README.md @@ -2,7 +2,7 @@ The ui/registry/dev_tools is removed in favor of the `devTools` plugin which exposes a register method in the setup contract. Registering app works mostly the same as registering apps in core.application.register. -Routing will be handled by the id of the dev tool - your dev tool will be mounted when the URL matches `/app/kibana#/dev_tools/`. +Routing will be handled by the id of the dev tool - your dev tool will be mounted when the URL matches `/app/dev_tools#/`. This API doesn't support angular, for registering angular dev tools, bootstrap a local module on mount into the given HTML element. During the migration this plugin exposes the registered dev tools in the start contract. This is necessary to keep the dev tools app diff --git a/src/plugins/dev_tools/public/application.tsx b/src/plugins/dev_tools/public/application.tsx index 2c21b451cb9f70..432c429bbd9637 100644 --- a/src/plugins/dev_tools/public/application.tsx +++ b/src/plugins/dev_tools/public/application.tsx @@ -68,7 +68,7 @@ function DevToolsWrapper({ isSelected={currentDevTool === activeDevTool} onClick={() => { if (!currentDevTool.disabled) { - updateRoute(`/dev_tools/${currentDevTool.id}`); + updateRoute(`/${currentDevTool.id}`); } }} > @@ -115,7 +115,7 @@ function DevToolsWrapper({ function redirectOnMissingCapabilities(appMountContext: AppMountContext) { if (!appMountContext.core.application.capabilities.dev_tools.show) { - window.location.hash = '/home'; + appMountContext.core.application.navigateToApp('home'); return true; } return false; @@ -142,7 +142,7 @@ function setBreadcrumbs(appMountContext: AppMountContext) { text: i18n.translate('devTools.k7BreadcrumbsDevToolsLabel', { defaultMessage: 'Dev Tools', }), - href: '#/dev_tools', + href: '#/', }, ]); } @@ -165,7 +165,7 @@ export function renderApp( {devTools.map(devTool => ( ( ))} - - + + diff --git a/src/plugins/dev_tools/public/index.scss b/src/plugins/dev_tools/public/index.scss index 2e88d2e1285e3c..c9d8dc7470656a 100644 --- a/src/plugins/dev_tools/public/index.scss +++ b/src/plugins/dev_tools/public/index.scss @@ -19,3 +19,9 @@ .devApp { height: 100%; } + +.devAppWrapper { + display: flex; + flex-direction: column; + flex-grow: 1; +} diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index df61271baf879a..3f2091e21b17b8 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -17,6 +17,7 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; import { App, CoreSetup, Plugin } from 'kibana/public'; import { sortBy } from 'lodash'; import { KibanaLegacySetup } from '../../kibana_legacy/public'; @@ -97,14 +98,25 @@ export class DevToolsPlugin implements Plugin { } public setup(core: CoreSetup, { kibanaLegacy }: { kibanaLegacy: KibanaLegacySetup }) { - kibanaLegacy.registerLegacyApp({ + core.application.register({ id: 'dev_tools', - title: 'Dev Tools', + title: i18n.translate('kbn.devToolsTitle', { + defaultMessage: 'Dev Tools', + }), + euiIconType: 'devToolsApp', + order: 9001, + category: { + label: i18n.translate('core.ui.managementNavList.label', { + defaultMessage: 'Management', + }), + euiIconType: 'managementApp', + }, mount: async (appMountContext, params) => { if (!this.getSortedDevTools) { throw new Error('not started yet'); } const { renderApp } = await import('./application'); + params.element.classList.add('devAppWrapper'); return renderApp( params.element, appMountContext, diff --git a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts index af8811b1969e69..e1938ec96ddae7 100644 --- a/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts +++ b/src/plugins/kibana_utils/public/state_management/url/kbn_url_tracker.ts @@ -37,6 +37,7 @@ export interface KbnUrlTracker { */ stop: () => void; setActiveUrl: (newUrl: string) => void; + getActiveUrl: () => string; } /** @@ -58,11 +59,8 @@ export function createKbnUrlTracker({ toastNotifications, history, storage, - shouldTrackUrlUpdate = pathname => { - const currentAppName = defaultSubUrl.slice(2); // cut hash and slash symbols - const targetAppName = pathname.split('/')[1]; - - return currentAppName === targetAppName; + shouldTrackUrlUpdate = () => { + return true; }, }: { /** @@ -209,5 +207,8 @@ export function createKbnUrlTracker({ unsubscribe(); }, setActiveUrl, + getActiveUrl() { + return activeUrl; + }, }; } diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap index fe64df6ff51d1c..37e71696020179 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/__snapshots__/saved_objects_table.test.tsx.snap @@ -404,7 +404,7 @@ exports[`SavedObjectsTable should render normally 1`] = ` "editUrl": "#/management/kibana/objects/savedVisualizations/4", "icon": "visualizeApp", "inAppUrl": Object { - "path": "/visualize/edit/4", + "path": "/edit/4", "uiCapabilitiesPath": "visualize.show", }, "title": "MyViz", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap index a8bb691cd54e99..237a7e36de2315 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap @@ -93,7 +93,7 @@ exports[`Relationships should render dashboards normally 1`] = ` "editUrl": "/management/kibana/objects/savedVisualizations/1", "icon": "visualizeApp", "inAppUrl": Object { - "path": "/app/kibana#/visualize/edit/1", + "path": "/app/visualize#/edit/1", "uiCapabilitiesPath": "visualize.show", }, "title": "My Visualization Title 1", @@ -107,7 +107,7 @@ exports[`Relationships should render dashboards normally 1`] = ` "editUrl": "/management/kibana/objects/savedVisualizations/2", "icon": "visualizeApp", "inAppUrl": Object { - "path": "/app/kibana#/visualize/edit/2", + "path": "/app/visualize#/edit/2", "uiCapabilitiesPath": "visualize.show", }, "title": "My Visualization Title 2", @@ -320,7 +320,7 @@ exports[`Relationships should render index patterns normally 1`] = ` "editUrl": "/management/kibana/objects/savedVisualizations/2", "icon": "visualizeApp", "inAppUrl": Object { - "path": "/app/kibana#/visualize/edit/2", + "path": "/app/visualize#/edit/2", "uiCapabilitiesPath": "visualize.show", }, "title": "My Visualization Title", @@ -489,7 +489,7 @@ exports[`Relationships should render searches normally 1`] = ` "editUrl": "/management/kibana/objects/savedVisualizations/2", "icon": "visualizeApp", "inAppUrl": Object { - "path": "/app/kibana#/visualize/edit/2", + "path": "/app/visualize#/edit/2", "uiCapabilitiesPath": "visualize.show", }, "title": "My Visualization Title", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index 347f2d977015c7..76a877690ae779 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -59,7 +59,7 @@ describe('Relationships', () => { editUrl: '/management/kibana/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, title: 'My Visualization Title', @@ -126,7 +126,7 @@ describe('Relationships', () => { editUrl: '/management/kibana/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, title: 'My Visualization Title', @@ -210,7 +210,7 @@ describe('Relationships', () => { icon: 'visualizeApp', editUrl: '#/management/kibana/objects/savedVisualizations/1', inAppUrl: { - path: '/visualize/edit/1', + path: '/edit/1', uiCapabilitiesPath: 'visualize.show', }, }, @@ -246,7 +246,7 @@ describe('Relationships', () => { editUrl: '/management/kibana/objects/savedVisualizations/1', icon: 'visualizeApp', inAppUrl: { - path: '/app/kibana#/visualize/edit/1', + path: '/app/visualize#/edit/1', uiCapabilitiesPath: 'visualize.show', }, title: 'My Visualization Title 1', @@ -260,7 +260,7 @@ describe('Relationships', () => { editUrl: '/management/kibana/objects/savedVisualizations/2', icon: 'visualizeApp', inAppUrl: { - path: '/app/kibana#/visualize/edit/2', + path: '/app/visualize#/edit/2', uiCapabilitiesPath: 'visualize.show', }, title: 'My Visualization Title 2', diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx index 342fdc4784b098..16c6dd40e54bb6 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/saved_objects_table.test.tsx @@ -193,7 +193,7 @@ describe('SavedObjectsTable', () => { icon: 'visualizeApp', editUrl: '#/management/kibana/objects/savedVisualizations/4', inAppUrl: { - path: '/visualize/edit/4', + path: '/edit/4', uiCapabilitiesPath: 'visualize.show', }, }, diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx index 4b7d01ae3b2466..91aa3dbebd1bfe 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx @@ -113,6 +113,7 @@ export class VisualizeEmbeddableFactory // to allow for in place creation of visualizations without having to navigate away to a new URL. showNewVisModal({ editorParams: ['addToDashboard'], + outsideVisualizeApp: true, }); return undefined; } diff --git a/src/plugins/visualizations/public/plugin.ts b/src/plugins/visualizations/public/plugin.ts index 8fcb84b19a9be8..5cd06e3e99ee7f 100644 --- a/src/plugins/visualizations/public/plugin.ts +++ b/src/plugins/visualizations/public/plugin.ts @@ -23,6 +23,7 @@ import { setUISettings, setTypes, setI18n, + setApplication, setCapabilities, setHttp, setIndexPatterns, @@ -137,6 +138,7 @@ export class VisualizationsPlugin const types = this.types.start(); setI18n(core.i18n); setTypes(types); + setApplication(core.application); setCapabilities(core.application.capabilities); setHttp(core.http); setSavedObjects(core.savedObjects); diff --git a/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts b/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts index c99c7a4c2caa19..61c1eef69ad661 100644 --- a/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts +++ b/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts @@ -151,7 +151,7 @@ export function createSavedVisClass(services: SavedObjectKibanaServices) { }); this.showInRecentlyAccessed = true; this.getFullPath = () => { - return `/app/kibana#/visualize/edit/${this.id}`; + return `/app/visualize#/edit/${this.id}`; }; } } diff --git a/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts b/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts index e5d0c41712a91d..c6a25df7615a2b 100644 --- a/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts +++ b/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts @@ -56,12 +56,12 @@ export function createSavedVisLoader(services: SavedObjectKibanaServicesWithVisu source.icon = source.type.icon; source.image = source.type.image; source.typeTitle = source.type.title; - source.editUrl = `#/visualize/edit/${id}`; + source.editUrl = `#/edit/${id}`; return source; }; urlFor(id: string) { - return `#/visualize/edit/${encodeURIComponent(id)}`; + return `#/edit/${encodeURIComponent(id)}`; } // This behaves similarly to find, except it returns visualizations that are // defined as appExtensions and which may not conform to type: visualization diff --git a/src/plugins/visualizations/public/services.ts b/src/plugins/visualizations/public/services.ts index 618c61dff176a7..30ee6b91c5a5c4 100644 --- a/src/plugins/visualizations/public/services.ts +++ b/src/plugins/visualizations/public/services.ts @@ -18,6 +18,7 @@ */ import { + ApplicationStart, Capabilities, ChromeStart, HttpStart, @@ -45,6 +46,8 @@ export const [getCapabilities, setCapabilities] = createGetterSetter('Http'); +export const [getApplication, setApplication] = createGetterSetter('Application'); + export const [getSavedObjects, setSavedObjects] = createGetterSetter( 'SavedObjects' ); diff --git a/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts b/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts index 040fa22352a3a9..87a72e71fcd75f 100644 --- a/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts +++ b/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts @@ -19,6 +19,7 @@ export interface VisualizationListItem { editUrl: string; + editApp?: string; icon: string; id: string; stage: 'experimental' | 'beta' | 'production'; @@ -43,7 +44,8 @@ export interface VisTypeAliasPromotion { } export interface VisTypeAlias { - aliasUrl: string; + aliasPath: string; + aliasApp: string; name: string; title: string; icon: string; diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx index 5637aeafc6f141..3dac322f8efe4e 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -115,7 +115,7 @@ describe('NewVisModal', () => { ); const visButton = wrapper.find('button[data-test-subj="visType-vis"]'); visButton.simulate('click'); - expect(window.location.assign).toBeCalledWith('#/visualize/create?type=vis'); + expect(window.location.assign).toBeCalledWith('app/#/visualize/create?type=vis'); }); it('passes through editor params to the editor URL', () => { diff --git a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx index 448077819bb8d6..7bff154851f14c 100644 --- a/src/plugins/visualizations/public/wizard/new_vis_modal.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx @@ -23,7 +23,7 @@ import { EuiModal, EuiOverlayMask } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics'; -import { IUiSettingsClient, SavedObjectsStart } from '../../../../core/public'; +import { ApplicationStart, IUiSettingsClient, SavedObjectsStart } from '../../../../core/public'; import { SearchSelection } from './search_selection'; import { TypeSelection } from './type_selection'; import { TypesStart, VisType, VisTypeAlias } from '../vis_types'; @@ -38,6 +38,8 @@ interface TypeSelectionProps { uiSettings: IUiSettingsClient; savedObjects: SavedObjectsStart; usageCollection?: UsageCollectionSetup; + application: ApplicationStart; + outsideVisualizeApp?: boolean; } interface TypeSelectionState { @@ -47,7 +49,8 @@ interface TypeSelectionState { // TODO: redirect logic is specific to visualise & dashboard // but it is likely should be decoupled. e.g. handled by the container instead -const baseUrl = `#/visualize/create?`; +const basePath = `/create?`; +const baseUrl = `/app/visualize#${basePath}`; class NewVisModal extends React.Component { public static defaultProps = { @@ -121,7 +124,7 @@ class NewVisModal extends React.Component { - if (!('aliasUrl' in visType) && visType.requiresSearch && visType.options.showIndexSelection) { + if (!('aliasPath' in visType) && visType.requiresSearch && visType.options.showIndexSelection) { this.setState({ showSearchVisModal: true, visType, @@ -141,13 +144,13 @@ class NewVisModal extends React.Component void; + outsideVisualizeApp?: boolean; } /** @@ -34,7 +42,11 @@ export interface ShowNewVisModalParams { * @param {string[]} editorParams * @param {function} onClose - function that will be called when dialog is closed */ -export function showNewVisModal({ editorParams = [], onClose }: ShowNewVisModalParams = {}) { +export function showNewVisModal({ + editorParams = [], + onClose, + outsideVisualizeApp, +}: ShowNewVisModalParams = {}) { const container = document.createElement('div'); let isClosed = false; const handleClose = () => { @@ -53,12 +65,14 @@ export function showNewVisModal({ editorParams = [], onClose }: ShowNewVisModalP ); diff --git a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx index 138251beb9593d..a7967eea5ba06c 100644 --- a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx +++ b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx @@ -28,7 +28,7 @@ describe('NewVisHelp', () => { { let stage = {}; let highlightMsg; - if (!('aliasUrl' in visType) && visType.stage === 'experimental') { + if (!('aliasPath' in visType) && visType.stage === 'experimental') { stage = { betaBadgeLabel: i18n.translate('visualizations.newVisWizard.experimentalTitle', { defaultMessage: 'Experimental', @@ -219,7 +219,7 @@ class TypeSelection extends React.Component this.setHighlightType(null)} className="visNewVisDialog__type" data-test-subj={`visType-${visType.name}`} - data-vis-stage={!('aliasUrl' in visType) ? visType.stage : 'alias'} + data-vis-stage={!('aliasPath' in visType) ? visType.stage : 'alias'} disabled={isDisabled} aria-describedby={`visTypeDescription-${visType.name}`} role="menuitem" @@ -280,7 +280,7 @@ class TypeSelection extends React.Component ); diff --git a/src/plugins/visualizations/server/saved_objects/visualization.ts b/src/plugins/visualizations/server/saved_objects/visualization.ts index cd2211c1855302..c4756de0a83865 100644 --- a/src/plugins/visualizations/server/saved_objects/visualization.ts +++ b/src/plugins/visualizations/server/saved_objects/visualization.ts @@ -36,7 +36,7 @@ export const visualizationSavedObjectType: SavedObjectsType = { }, getInAppUrl(obj) { return { - path: `/app/kibana#/visualize/edit/${encodeURIComponent(obj.id)}`, + path: `/app/visualize#/edit/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'visualize.show', }; }, diff --git a/src/plugins/visualize/kibana.json b/src/plugins/visualize/kibana.json index a7afa0697a5eb1..05fd2bef7b63f0 100644 --- a/src/plugins/visualize/kibana.json +++ b/src/plugins/visualize/kibana.json @@ -8,7 +8,8 @@ "kibanaLegacy", "navigation", "savedObjects", - "visualizations" + "visualizations", + "dashboard" ], "optionalPlugins": [ "home", diff --git a/src/plugins/visualize/public/application/_app.scss b/src/plugins/visualize/public/application/_app.scss new file mode 100644 index 00000000000000..8a52ebf4cc0883 --- /dev/null +++ b/src/plugins/visualize/public/application/_app.scss @@ -0,0 +1,5 @@ +.visAppWrapper { + display: flex; + flex-direction: column; + flex-grow: 1; +} diff --git a/src/plugins/visualize/public/application/editor/editor.js b/src/plugins/visualize/public/application/editor/editor.js index ef359dc0cc1155..5f456214baed03 100644 --- a/src/plugins/visualize/public/application/editor/editor.js +++ b/src/plugins/visualize/public/application/editor/editor.js @@ -26,7 +26,7 @@ import { EventEmitter } from 'events'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; -import { makeStateful, useVisualizeAppState, addEmbeddableToDashboardUrl } from './lib'; +import { makeStateful, useVisualizeAppState } from './lib'; import { VisualizeConstants } from '../visualize_constants'; import { getEditBreadcrumbs } from '../breadcrumbs'; @@ -46,6 +46,7 @@ import { initVisEditorDirective } from './visualization_editor'; import { initVisualizationDirective } from './visualization'; import { getServices } from '../../kibana_services'; +import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../visualizations/public'; export function initEditorDirective(app, deps) { app.directive('visualizeApp', function() { @@ -72,6 +73,7 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState I18nContext, setActiveUrl, visualizations, + dashboard, } = getServices(); const { @@ -632,9 +634,10 @@ function VisualizeAppController($scope, $route, $injector, $timeout, kbnUrlState history.replace(appPath); setActiveUrl(appPath); - const lastDashboardUrl = chrome.navLinks.get('kibana:dashboard').url; - const dashboardUrl = addEmbeddableToDashboardUrl(lastDashboardUrl, savedVis.id); - history.push(dashboardUrl); + dashboard.addEmbeddableToDashboard({ + embeddableId: savedVis.id, + embeddableType: VISUALIZE_EMBEDDABLE_TYPE, + }); } else if (savedVis.id === $route.current.params.id) { chrome.docTitle.change(savedVis.lastSavedTitle); chrome.setBreadcrumbs($injector.invoke(getEditBreadcrumbs)); diff --git a/src/plugins/visualize/public/application/editor/lib/index.ts b/src/plugins/visualize/public/application/editor/lib/index.ts index 6e2f759c73f2f2..d2fe028b371c25 100644 --- a/src/plugins/visualize/public/application/editor/lib/index.ts +++ b/src/plugins/visualize/public/application/editor/lib/index.ts @@ -19,4 +19,4 @@ export { useVisualizeAppState } from './visualize_app_state'; export { makeStateful } from './make_stateful'; -export { addEmbeddableToDashboardUrl } from './url_helper'; +export { addEmbeddableToDashboardUrl } from '../../../../../dashboard/public/url_utils/url_helper'; diff --git a/src/plugins/visualize/public/application/index.scss b/src/plugins/visualize/public/application/index.scss index 847e72bf29fbc5..620380a77ba46c 100644 --- a/src/plugins/visualize/public/application/index.scss +++ b/src/plugins/visualize/public/application/index.scss @@ -5,5 +5,6 @@ // visChart__legend--small // visChart__legend-isLoading +@import 'app'; @import 'editor/index'; @import 'listing/index'; diff --git a/src/plugins/visualize/public/application/listing/visualize_listing.html b/src/plugins/visualize/public/application/listing/visualize_listing.html index 17caaba144a440..5cae187a393b21 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing.html +++ b/src/plugins/visualize/public/application/listing/visualize_listing.html @@ -5,7 +5,7 @@ find-items="listingController.fetchItems" delete-items="listingController.deleteSelectedItems" create-item="listingController.createNewVis" - get-view-url="listingController.getViewUrl" + get-view-element="listingController.getViewElement" edit-item="listingController.editItem" listing-limit="listingController.listingLimit" > diff --git a/src/plugins/visualize/public/application/listing/visualize_listing.js b/src/plugins/visualize/public/application/listing/visualize_listing.js index 900c17fa394de9..75e17237aa9d11 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing.js @@ -25,6 +25,8 @@ import { i18n } from '@kbn/i18n'; import { getServices } from '../../kibana_services'; import { syncQueryStateWithUrl } from '../../../../data/public'; +import { EuiLink } from '@elastic/eui'; +import React from 'react'; export function initListingDirective(app, I18nContext) { app.directive('visualizeListingTable', reactDirective => @@ -41,7 +43,7 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor data: { query }, toastNotifications, visualizations, - core: { docLinks, savedObjects, uiSettings }, + core: { docLinks, savedObjects, uiSettings, application }, } = getServices(); // syncs `_g` portion of url with query services @@ -65,13 +67,37 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor this.closeNewVisModal = visualizations.showNewVisModal(); }; - this.editItem = ({ editUrl }) => { + this.editItem = ({ editUrl, editApp }) => { + if (editApp) { + application.navigateToApp(editApp, { path: editUrl }); + return; + } // for visualizations the edit and view URLs are the same window.location.href = addBasePath(editUrl); }; - this.getViewUrl = ({ editUrl }) => { - return addBasePath(editUrl); + this.getViewElement = (field, record) => { + const dataTestSubj = `visListingTitleLink-${record.title.split(' ').join('-')}`; + if (record.editApp) { + return ( + { + application.navigateToApp(record.editApp, { path: record.editUrl }); + }} + data-test-subj={dataTestSubj} + > + {field} + + ); + } else if (record.editUrl) { + return ( + + {field} + + ); + } else { + return {field}; + } }; if (createNewVis) { diff --git a/src/plugins/visualize/public/application/listing/visualize_listing_table.js b/src/plugins/visualize/public/application/listing/visualize_listing_table.js index 100becdd3a80f3..3d49194c6778fc 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing_table.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing_table.js @@ -23,7 +23,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { TableListView } from '../../../../kibana_react/public'; -import { EuiIcon, EuiBetaBadge, EuiLink, EuiButton, EuiEmptyPrompt } from '@elastic/eui'; +import { EuiIcon, EuiBetaBadge, EuiButton, EuiEmptyPrompt } from '@elastic/eui'; import { getServices } from '../../kibana_services'; @@ -71,14 +71,7 @@ class VisualizeListingTable extends Component { defaultMessage: 'Title', }), sortable: true, - render: (field, record) => ( - - {field} - - ), + render: (field, record) => this.props.getViewElement(field, record), }, { field: 'typeTitle', @@ -225,7 +218,7 @@ VisualizeListingTable.propTypes = { deleteItems: PropTypes.func.isRequired, findItems: PropTypes.func.isRequired, createItem: PropTypes.func.isRequired, - getViewUrl: PropTypes.func.isRequired, + getViewElement: PropTypes.func.isRequired, editItem: PropTypes.func.isRequired, listingLimit: PropTypes.number.isRequired, }; diff --git a/src/plugins/visualize/public/application/visualize_constants.ts b/src/plugins/visualize/public/application/visualize_constants.ts index 574e747a7e0a69..0ca61c53f26c78 100644 --- a/src/plugins/visualize/public/application/visualize_constants.ts +++ b/src/plugins/visualize/public/application/visualize_constants.ts @@ -18,11 +18,11 @@ */ export const VisualizeConstants = { - LANDING_PAGE_PATH: '/visualize', - WIZARD_STEP_1_PAGE_PATH: '/visualize/new', - WIZARD_STEP_2_PAGE_PATH: '/visualize/new/configure', - CREATE_PATH: '/visualize/create', - EDIT_PATH: '/visualize/edit', + LANDING_PAGE_PATH: '/', + WIZARD_STEP_1_PAGE_PATH: '/new', + WIZARD_STEP_2_PAGE_PATH: '/new/configure', + CREATE_PATH: '/create', + EDIT_PATH: '/edit', }; export function createVisualizeEditUrl(id: string) { diff --git a/src/plugins/visualize/public/kibana_services.ts b/src/plugins/visualize/public/kibana_services.ts index 765e9a82ae899b..70fe086587d7d5 100644 --- a/src/plugins/visualize/public/kibana_services.ts +++ b/src/plugins/visualize/public/kibana_services.ts @@ -34,6 +34,7 @@ import { VisualizationsStart } from '../../visualizations/public'; import { SavedVisualizations } from './application/types'; import { KibanaLegacyStart } from '../../kibana_legacy/public'; import { DefaultEditorController } from '../../vis_default_editor/public'; +import { DashboardStart } from '../../dashboard/public'; export interface VisualizeKibanaServices { pluginInitializerContext: PluginInitializerContext; @@ -50,6 +51,7 @@ export interface VisualizeKibanaServices { config: KibanaLegacyStart['config']; visualizeCapabilities: any; visualizations: VisualizationsStart; + dashboard: DashboardStart; I18nContext: I18nStart['Context']; setActiveUrl: (newUrl: string) => void; DefaultVisualizationEditor: typeof DefaultEditorController; diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index ab64e083a553dc..07c62769e52448 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -39,12 +39,14 @@ import { VisualizeConstants } from './application/visualize_constants'; import { setServices, VisualizeKibanaServices } from './kibana_services'; import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public'; import { DefaultEditorController } from '../../vis_default_editor/public'; +import { DashboardStart } from '../../dashboard/public'; export interface VisualizePluginStartDependencies { data: DataPublicPluginStart; navigation: NavigationStart; share?: SharePluginStart; visualizations: VisualizationsStart; + dashboard: DashboardStart; } export interface VisualizePluginSetupDependencies { @@ -90,11 +92,19 @@ export class VisualizePlugin stopUrlTracker(); }; - kibanaLegacy.registerLegacyApp({ + core.application.register({ id: 'visualize', title: 'Visualize', + order: -1002, + euiIconType: 'visualizeApp', + category: { + label: i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }), + order: 1000, + }, updater$: this.appStateUpdater.asObservable(), - navLinkId: 'kibana:visualize', + // remove all references to kibana:visualize mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart] = await core.getStartServices(); @@ -120,10 +130,12 @@ export class VisualizePlugin DefaultVisualizationEditor: DefaultEditorController, createVisEmbeddableFromObject: pluginsStart.visualizations.__LEGACY.createVisEmbeddableFromObject, + dashboard: pluginsStart.dashboard, }; setServices(deps); const { renderApp } = await import('./application/application'); + params.element.classList.add('visAppWrapper'); const unmount = renderApp(params.element, params.appBasePath, deps); return () => { unmount(); @@ -132,6 +144,11 @@ export class VisualizePlugin }, }); + kibanaLegacy.forwardApp('visualize', 'visualize', path => { + const newPath = path.replace(/\/visualize/, ''); + return `#${newPath}`; + }); + if (home) { home.featureCatalogue.register({ id: 'visualize', @@ -141,7 +158,7 @@ export class VisualizePlugin 'Create visualizations and aggregate data stores in your Elasticsearch indices.', }), icon: 'visualizeApp', - path: `/app/kibana#${VisualizeConstants.LANDING_PAGE_PATH}`, + path: `/app/visualize#${VisualizeConstants.LANDING_PAGE_PATH}`, showOnHomePage: true, category: FeatureCatalogueCategory.DATA, }); diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 9b3eda4c0664b9..ecddbb3435b88f 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -62,7 +62,7 @@ export default function({ getService }: FtrProviderContext) { '/management/kibana/objects/savedVisualizations/dd7caf20-9efd-11e7-acb3-3dab96693fab', icon: 'visualizeApp', inAppUrl: { - path: '/app/kibana#/visualize/edit/dd7caf20-9efd-11e7-acb3-3dab96693fab', + path: '/app/visualize#/edit/dd7caf20-9efd-11e7-acb3-3dab96693fab', uiCapabilitiesPath: 'visualize.show', }, title: 'Count of requests', @@ -256,7 +256,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/a42c0580-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }); @@ -266,7 +266,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/add810b0-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }); diff --git a/test/api_integration/apis/saved_objects_management/relationships.ts b/test/api_integration/apis/saved_objects_management/relationships.ts index 78a437ab56cf79..c5b023a6f3d443 100644 --- a/test/api_integration/apis/saved_objects_management/relationships.ts +++ b/test/api_integration/apis/saved_objects_management/relationships.ts @@ -100,7 +100,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/a42c0580-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -140,7 +140,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/a42c0580-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -184,7 +184,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/add810b0-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -199,7 +199,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/a42c0580-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -222,7 +222,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/add810b0-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -237,7 +237,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/a42c0580-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/a42c0580-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/a42c0580-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, @@ -379,7 +379,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedVisualizations/add810b0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/visualize/edit/add810b0-3224-11e8-a572-ffca06da1357', + path: '/app/visualize#/edit/add810b0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'visualize.show', }, }, diff --git a/test/api_integration/apis/shorten/index.js b/test/api_integration/apis/shorten/index.js index 049718e4d34421..651868729b69fe 100644 --- a/test/api_integration/apis/shorten/index.js +++ b/test/api_integration/apis/shorten/index.js @@ -31,7 +31,7 @@ export default function({ getService }) { const resp = await supertest .post('/api/shorten_url') .set('content-type', 'application/json') - .send({ url: '/app/kibana#/visualize/create' }) + .send({ url: '/app/visualize#/create' }) .expect(200); expect(resp.body).to.have.property('urlId'); @@ -43,13 +43,13 @@ export default function({ getService }) { const resp = await supertest .post('/api/shorten_url') .set('content-type', 'application/json') - .send({ url: '/app/kibana#/visualize/create' }); + .send({ url: '/app/visualize#/create' }); const urlId = resp.body.urlId; await supertest .get(`/goto/${urlId}`) .expect(302) - .expect('location', '/app/kibana#/visualize/create'); + .expect('location', '/app/visualize#/create'); }); }); } diff --git a/test/functional/apps/home/_home.js b/test/functional/apps/home/_home.js index 6587c2f113b7f3..9886218ec29db1 100644 --- a/test/functional/apps/home/_home.js +++ b/test/functional/apps/home/_home.js @@ -37,7 +37,7 @@ export default function({ getService, getPageObjects }) { it('clicking on console on homepage should take you to console app', async () => { await PageObjects.home.clickSynopsis('console'); const url = await browser.getCurrentUrl(); - expect(url.includes('/app/kibana#/dev_tools/console')).to.be(true); + expect(url.includes('/app/dev_tools#/console')).to.be(true); }); }); } diff --git a/vars/agentInfo.groovy b/vars/agentInfo.groovy index 166a86c1692616..cb20b434ba34cf 100644 --- a/vars/agentInfo.groovy +++ b/vars/agentInfo.groovy @@ -5,7 +5,7 @@ def print() { def resourcesUrl = ( - "https://infra-stats.elastic.co/app/kibana#/visualize/edit/8bd92360-1b92-11ea-b719-aba04518cc34" + + "https://infra-stats.elastic.co/app/visualize#/edit/8bd92360-1b92-11ea-b719-aba04518cc34" + "?_g=(time:(from:'${startTime}',to:'${endTime}'))" + "&_a=(query:'host.name:${env.NODE_NAME}')" ) diff --git a/x-pack/plugins/grokdebugger/public/register_feature.ts b/x-pack/plugins/grokdebugger/public/register_feature.ts index f05d4c973a5fb4..fc45c9d435eab0 100644 --- a/x-pack/plugins/grokdebugger/public/register_feature.ts +++ b/x-pack/plugins/grokdebugger/public/register_feature.ts @@ -20,7 +20,7 @@ export const registerFeature = (homePlugin: HomePublicPluginSetup) => { defaultMessage: 'Simulate and debug grok patterns for data transformation on ingestion.', }), icon: 'grokApp', - path: '/app/kibana#/dev_tools/grokdebugger', + path: '/app/dev_tools#/grokdebugger', showOnHomePage: false, category: FeatureCatalogueCategory.ADMIN, }); diff --git a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts index 20706f563ec637..3f0767c7cfbf62 100644 --- a/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/infra/public/components/metrics_explorer/helpers/create_tsvb_link.ts @@ -140,8 +140,8 @@ export const createTSVBLink = ( }; return { - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { type: 'metrics', _g: encode(globalState), diff --git a/x-pack/plugins/lens/common/constants.ts b/x-pack/plugins/lens/common/constants.ts index 16ae1b8da752b2..16397d340d951b 100644 --- a/x-pack/plugins/lens/common/constants.ts +++ b/x-pack/plugins/lens/common/constants.ts @@ -7,13 +7,12 @@ export const PLUGIN_ID = 'lens'; export const LENS_EMBEDDABLE_TYPE = 'lens'; export const NOT_INTERNATIONALIZED_PRODUCT_NAME = 'Lens Visualizations'; -export const BASE_APP_URL = '/app/kibana'; export const BASE_API_URL = '/api/lens'; export function getBasePath() { - return `${BASE_APP_URL}#/lens`; + return `#/`; } export function getEditPath(id: string) { - return `${BASE_APP_URL}#/lens/edit/${encodeURIComponent(id)}`; + return `#/edit/${encodeURIComponent(id)}`; } diff --git a/x-pack/plugins/lens/kibana.json b/x-pack/plugins/lens/kibana.json index ce544b31b88ef4..d86a3180f64d9f 100644 --- a/x-pack/plugins/lens/kibana.json +++ b/x-pack/plugins/lens/kibana.json @@ -10,7 +10,8 @@ "navigation", "kibanaLegacy", "uiActions", - "visualizations" + "visualizations", + "dashboard" ], "optionalPlugins": ["embeddable", "usageCollection", "taskManager"], "configPath": ["xpack", "lens"] diff --git a/x-pack/plugins/lens/public/app_plugin/_app.scss b/x-pack/plugins/lens/public/app_plugin/_app.scss index ed3a178cdd5eaf..4ad8dd360bac65 100644 --- a/x-pack/plugins/lens/public/app_plugin/_app.scss +++ b/x-pack/plugins/lens/public/app_plugin/_app.scss @@ -1,3 +1,9 @@ +.lnsAppWrapper { + display: flex; + flex-direction: column; + flex-grow: 1; +} + .lnsApp { position: absolute; top: 0; diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 41d0e3a7aa9a07..1be27ca33a48b4 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -215,7 +215,7 @@ describe('Lens App', () => { instance = mount(); expect(core.chrome.setBreadcrumbs).toHaveBeenCalledWith([ - { text: 'Visualize', href: '/testbasepath/app/kibana#/visualize' }, + { text: 'Visualize', href: '/testbasepath/app/visualize#/' }, { text: 'Create' }, ]); @@ -233,7 +233,7 @@ describe('Lens App', () => { }); expect(defaultArgs.core.chrome.setBreadcrumbs).toHaveBeenCalledWith([ - { text: 'Visualize', href: '/testbasepath/app/kibana#/visualize' }, + { text: 'Visualize', href: '/testbasepath/app/visualize#/' }, { text: 'Daaaaaaadaumching!' }, ]); }); diff --git a/x-pack/plugins/lens/public/app_plugin/app.tsx b/x-pack/plugins/lens/public/app_plugin/app.tsx index 28135dd12a7249..41f30a4efd260d 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.tsx @@ -120,7 +120,11 @@ export function App({ useEffect(() => { core.chrome.setBreadcrumbs([ { - href: core.http.basePath.prepend(`/app/kibana#/visualize`), + href: core.http.basePath.prepend(`/app/visualize#/`), + onClick: e => { + core.application.navigateToApp('visualize', { path: '/' }); + e.preventDefault(); + }, text: i18n.translate('xpack.lens.breadcrumbsTitle', { defaultMessage: 'Visualize', }), diff --git a/x-pack/plugins/lens/public/helpers/index.ts b/x-pack/plugins/lens/public/helpers/index.ts deleted file mode 100644 index f464b5dcc97a32..00000000000000 --- a/x-pack/plugins/lens/public/helpers/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -export { addEmbeddableToDashboardUrl, getUrlVars } from './url_helper'; diff --git a/x-pack/plugins/lens/public/helpers/url_helper.test.ts b/x-pack/plugins/lens/public/helpers/url_helper.test.ts deleted file mode 100644 index 37e35ca17e0b3e..00000000000000 --- a/x-pack/plugins/lens/public/helpers/url_helper.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -jest.mock('../../../../../src/plugins/dashboard/public', () => ({ - DashboardConstants: { - ADD_EMBEDDABLE_ID: 'addEmbeddableId', - ADD_EMBEDDABLE_TYPE: 'addEmbeddableType', - }, -})); - -import { addEmbeddableToDashboardUrl, getUrlVars } from './url_helper'; - -describe('Dashboard URL Helper', () => { - it('addEmbeddableToDashboardUrl', () => { - const id = '123eb456cd'; - const urlVars = { - x: '1', - y: '2', - z: '3', - }; - const url = - "/pep/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; - expect(addEmbeddableToDashboardUrl(url, id, urlVars)).toEqual( - `/pep/app/kibana#/dashboard?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=lens&x=1&y=2&z=3` - ); - }); - - it('getUrlVars', () => { - let url = - "http://localhost:5601/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!()"; - expect(getUrlVars(url)).toEqual({ - _g: '(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))', - _a: "(description:'',filters:!()", - }); - url = 'http://mybusiness.mydomain.com/app/kibana#/dashboard?x=y&y=z'; - expect(getUrlVars(url)).toEqual({ - x: 'y', - y: 'z', - }); - url = 'http://localhost:5601/app/kibana#/dashboard/777182'; - expect(getUrlVars(url)).toEqual({}); - url = - 'http://localhost:5601/app/kibana#/dashboard/777182?title=Some%20Dashboard%20With%20Spaces'; - expect(getUrlVars(url)).toEqual({ title: 'Some Dashboard With Spaces' }); - }); -}); diff --git a/x-pack/plugins/lens/public/helpers/url_helper.ts b/x-pack/plugins/lens/public/helpers/url_helper.ts deleted file mode 100644 index 0a97ba4b2edf7a..00000000000000 --- a/x-pack/plugins/lens/public/helpers/url_helper.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { parseUrl, stringify } from 'query-string'; -import { DashboardConstants } from '../../../../../src/plugins/dashboard/public'; - -type UrlVars = Record; - -/** - * Return query params from URL - * @param url given url - */ -export function getUrlVars(url: string): Record { - const vars: UrlVars = {}; - for (const [, key, value] of url.matchAll(/[?&]+([^=&]+)=([^&]*)/gi)) { - vars[key] = decodeURIComponent(value); - } - return vars; -} - -/** * - * Returns dashboard URL with added embeddableType and embeddableId query params - * eg. - * input: url: /lol/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)), embeddableId: 12345 - * output: /lol/app/kibana#/dashboard?addEmbeddableType=lens&addEmbeddableId=12345&_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now)) - * @param url dasbhoard absolute url - * @param embeddableId id of the saved visualization - * @param urlVars url query params - */ -export function addEmbeddableToDashboardUrl(url: string, embeddableId: string, urlVars: UrlVars) { - const dashboardParsedUrl = parseUrl(url); - const keys = Object.keys(urlVars).sort(); - - keys.forEach(key => { - dashboardParsedUrl.query[key] = urlVars[key]; - }); - dashboardParsedUrl.query[DashboardConstants.ADD_EMBEDDABLE_TYPE] = 'lens'; - dashboardParsedUrl.query[DashboardConstants.ADD_EMBEDDABLE_ID] = embeddableId; - const query = stringify(dashboardParsedUrl.query); - - return `${dashboardParsedUrl.url}?${query}`; -} diff --git a/x-pack/plugins/lens/public/plugin.tsx b/x-pack/plugins/lens/public/plugin.tsx index 8d760eb0df5013..fdadd42e4fa778 100644 --- a/x-pack/plugins/lens/public/plugin.tsx +++ b/x-pack/plugins/lens/public/plugin.tsx @@ -8,8 +8,6 @@ import React from 'react'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { render, unmountComponentAtNode } from 'react-dom'; -import rison, { RisonObject, RisonValue } from 'rison-node'; -import { isObject } from 'lodash'; import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; @@ -18,7 +16,7 @@ import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/publ import { VisualizationsSetup } from 'src/plugins/visualizations/public'; import { NavigationPublicPluginStart } from 'src/plugins/navigation/public'; import { KibanaLegacySetup } from 'src/plugins/kibana_legacy/public'; -import { DashboardConstants } from '../../../../src/plugins/dashboard/public'; +import { DashboardConstants, DashboardStart } from '../../../../src/plugins/dashboard/public'; import { Storage } from '../../../../src/plugins/kibana_utils/public'; import { EditorFrameService } from './editor_frame_service'; import { IndexPatternDatasource } from './indexpattern_datasource'; @@ -36,8 +34,7 @@ import { } from './lens_ui_telemetry'; import { UiActionsStart } from '../../../../src/plugins/ui_actions/public'; -import { NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common'; -import { addEmbeddableToDashboardUrl, getUrlVars } from './helpers'; +import { LENS_EMBEDDABLE_TYPE, NOT_INTERNATIONALIZED_PRODUCT_NAME } from '../common'; import { EditorFrameStart } from './types'; import { getLensAliasConfig } from './vis_type_alias'; @@ -57,11 +54,9 @@ export interface LensPluginStartDependencies { expressions: ExpressionsStart; navigation: NavigationPublicPluginStart; uiActions: UiActionsStart; + dashboard: DashboardStart; } -export const isRisonObject = (value: RisonValue): value is RisonObject => { - return isObject(value); -}; export class LensPlugin { private datatableVisualization: DatatableVisualization; private editorFrameService: EditorFrameService; @@ -102,8 +97,9 @@ export class LensPlugin { visualizations.registerAlias(getLensAliasConfig()); - kibanaLegacy.registerLegacyApp({ + core.application.register({ id: 'lens', + navLinkStatus: 3, // TODO should be fetched by enum title: NOT_INTERNATIONALIZED_PRODUCT_NAME, mount: async (params: AppMountParameters) => { const [coreStart, startDependencies] = await core.getStartServices(); @@ -119,34 +115,21 @@ export class LensPlugin { http: core.http, }) ); - const updateUrlTime = (urlVars: Record): void => { - const decoded = rison.decode(urlVars._g); - if (!isRisonObject(decoded)) { - return; - } - // @ts-ignore - decoded.time = dataStart.query.timefilter.timefilter.getTime(); - urlVars._g = rison.encode(decoded); - }; const redirectTo = ( routeProps: RouteComponentProps<{ id?: string }>, addToDashboardMode: boolean, id?: string ) => { if (!id) { - routeProps.history.push('/lens'); + routeProps.history.push('/'); } else if (!addToDashboardMode) { - routeProps.history.push(`/lens/edit/${id}`); + routeProps.history.push(`/edit/${id}`); } else if (addToDashboardMode && id) { - routeProps.history.push(`/lens/edit/${id}`); - const lastDashboardLink = coreStart.chrome.navLinks.get('kibana:dashboard'); - if (!lastDashboardLink || !lastDashboardLink.url) { - throw new Error('Cannot get last dashboard url'); - } - const urlVars = getUrlVars(lastDashboardLink.url); - updateUrlTime(urlVars); // we need to pass in timerange in query params directly - const dashboardUrl = addEmbeddableToDashboardUrl(lastDashboardLink.url, id, urlVars); - window.history.pushState({}, '', dashboardUrl); + routeProps.history.push(`/edit/${id}`); + startDependencies.dashboard.addEmbeddableToDashboard({ + embeddableId: id, + embeddableType: LENS_EMBEDDABLE_TYPE, + }); } }; @@ -177,13 +160,14 @@ export class LensPlugin { return ; } + params.element.classList.add('lnsAppWrapper'); render( - - - + + + , @@ -195,6 +179,11 @@ export class LensPlugin { }; }, }); + + kibanaLegacy.forwardApp('lens', 'lens', path => { + const newPath = path.replace(/\/lens/, ''); + return `#${newPath}`; + }); } start(core: CoreStart, startDependencies: LensPluginStartDependencies) { diff --git a/x-pack/plugins/lens/public/vis_type_alias.ts b/x-pack/plugins/lens/public/vis_type_alias.ts index 807504ee2b9c24..a58288191325cb 100644 --- a/x-pack/plugins/lens/public/vis_type_alias.ts +++ b/x-pack/plugins/lens/public/vis_type_alias.ts @@ -9,7 +9,8 @@ import { VisTypeAlias } from 'src/plugins/visualizations/public'; import { getBasePath, getEditPath } from '../common'; export const getLensAliasConfig = (): VisTypeAlias => ({ - aliasUrl: getBasePath(), + aliasPath: getBasePath(), + aliasApp: 'lens', name: 'lens', promotion: { description: i18n.translate('xpack.lens.visTypeAlias.promotion.description', { @@ -38,6 +39,7 @@ export const getLensAliasConfig = (): VisTypeAlias => ({ id, title, editUrl: getEditPath(id), + editApp: 'lens', icon: 'lensApp', stage: 'beta', savedObjectType: type, diff --git a/x-pack/plugins/painless_lab/public/plugin.tsx b/x-pack/plugins/painless_lab/public/plugin.tsx index e76128313545ab..c730a1e56fbef8 100644 --- a/x-pack/plugins/painless_lab/public/plugin.tsx +++ b/x-pack/plugins/painless_lab/public/plugin.tsx @@ -34,7 +34,7 @@ export class PainlessLabUIPlugin implements Plugin Promise.resolve(18), } as any; diff --git a/x-pack/plugins/searchprofiler/public/plugin.ts b/x-pack/plugins/searchprofiler/public/plugin.ts index 179886c0807d2b..f0bf90a16cf79d 100644 --- a/x-pack/plugins/searchprofiler/public/plugin.ts +++ b/x-pack/plugins/searchprofiler/public/plugin.ts @@ -29,7 +29,7 @@ export class SearchProfilerUIPlugin implements Plugin { - await PageObjects.common.navigateToActualUrl('kibana', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('kibana', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -102,7 +102,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it('can save existing Visualization', async () => { - await PageObjects.common.navigateToActualUrl('kibana', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('kibana', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -216,7 +216,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`can view existing Visualization`, async () => { - await PageObjects.common.navigateToActualUrl('visualize', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('visualize', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -226,7 +226,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`can't save existing Visualization`, async () => { - await PageObjects.common.navigateToActualUrl('visualize', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('visualize', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -329,7 +329,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`can view existing Visualization`, async () => { - await PageObjects.common.navigateToActualUrl('visualize', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('visualize', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -337,7 +337,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`can't save existing Visualization`, async () => { - await PageObjects.common.navigateToActualUrl('visualize', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('visualize', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); @@ -430,7 +430,7 @@ export default function({ getPageObjects, getService }: FtrProviderContext) { }); it(`edit page redirects to home page`, async () => { - await PageObjects.common.navigateToActualUrl('visualize', '/visualize/edit/i-exist', { + await PageObjects.common.navigateToActualUrl('visualize', '/edit/i-exist', { ensureCurrentUrl: false, shouldLoginIfPrompted: false, }); From 6e769508eacbbc78c1f265aab4ba083b335ba91a Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 20 Apr 2020 14:25:19 +0200 Subject: [PATCH 019/134] migrate dashboard mode and make sure redirects and home links work fine --- .../discover/np_ready/angular/discover.js | 1 + .../sidebar/discover_field_details.tsx | 7 +- .../sidebar/lib/visualize_url_utils.ts | 19 +++--- .../np_ready/components/sidebar/types.ts | 5 +- .../core_plugins/kibana/public/kibana.js | 6 -- .../public/application/legacy_app.js | 2 + src/plugins/dashboard/public/plugin.tsx | 2 +- .../public/application/components/home.js | 12 ++++ .../public/application/kibana_services.ts | 2 + src/plugins/home/public/plugin.ts | 1 + .../notify/app_redirect/app_redirect.test.ts | 63 ----------------- .../notify/app_redirect/app_redirect.ts | 47 ------------- .../public/notify/app_redirect/index.ts | 20 ------ .../kibana_legacy/public/notify/index.ts | 1 - .../history/ensure_default_index_pattern.tsx | 26 +++---- .../public/history/redirect_when_missing.tsx | 36 ++++++++-- .../public/legacy/redirect_messages.tsx | 67 +++++++++++++++++++ src/plugins/management/public/plugin.ts | 2 + .../public/application/legacy_app.js | 26 +++++-- x-pack/legacy/plugins/dashboard_mode/index.js | 37 +--------- .../dashboard_mode/public/dashboard_viewer.js | 67 ------------------- .../dashboard_mode_request_interceptor.js | 26 ++++--- x-pack/plugins/dashboard_mode/kibana.json | 13 ++++ x-pack/plugins/dashboard_mode/public/index.ts | 7 ++ .../plugins/dashboard_mode/public/plugin.ts | 67 +++++++++++++++++++ x-pack/plugins/dashboard_mode/server/index.ts | 20 ++++++ x-pack/plugins/graph/public/application.ts | 10 ++- 27 files changed, 302 insertions(+), 290 deletions(-) delete mode 100644 src/plugins/kibana_legacy/public/notify/app_redirect/app_redirect.test.ts delete mode 100644 src/plugins/kibana_legacy/public/notify/app_redirect/app_redirect.ts delete mode 100644 src/plugins/kibana_legacy/public/notify/app_redirect/index.ts create mode 100644 src/plugins/management/public/legacy/redirect_messages.tsx delete mode 100644 x-pack/legacy/plugins/dashboard_mode/public/dashboard_viewer.js create mode 100644 x-pack/plugins/dashboard_mode/kibana.json create mode 100644 x-pack/plugins/dashboard_mode/public/index.ts create mode 100644 x-pack/plugins/dashboard_mode/public/plugin.ts create mode 100644 x-pack/plugins/dashboard_mode/server/index.ts diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js index 72276a38f6ac21..6bbf424826b02c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js @@ -155,6 +155,7 @@ app.config($routeProvider => { .catch( redirectWhenMissing({ history, + navigateToApp: core.application.navigateToApp, mapping: { search: '/discover', 'index-pattern': diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx index 6266c297457187..855b7b4f3d6933 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/discover_field_details.tsx @@ -23,6 +23,7 @@ import { DiscoverFieldBucket } from './discover_field_bucket'; import { getWarnings } from './lib/get_warnings'; import { Bucket, FieldDetails } from './types'; import { IndexPatternField, IndexPattern } from '../../../../../../../../plugins/data/public'; +import { getServices } from '../../../kibana_services'; interface DiscoverFieldDetailsProps { field: IndexPatternField; @@ -79,7 +80,11 @@ export function DiscoverFieldDetails({ <> { + getServices().core.application.navigateToApp(details.visualizeUrl.app, { + path: details.visualizeUrl.path, + }); + }} className="kuiButton kuiButton--secondary kuiButton--small kuiVerticalRhythmSmall" data-test-subj={`fieldVisualize-${field.name}`} > diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts index 779ef2222029c6..6b07eb5e4babb5 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/lib/visualize_url_utils.ts @@ -32,13 +32,6 @@ import { VisTypeAlias, } from '../../../../../../../../../plugins/visualizations/public'; -function getMapsAppBaseUrl(visualizations: VisualizationsStart) { - const mapsAppVisAlias = visualizations.getAliases().find(({ name }) => { - return name === 'maps'; - }); - return mapsAppVisAlias ? mapsAppVisAlias.aliasPath : null; -} - export function isMapsAppRegistered(visualizations: VisualizationsStart) { return visualizations.getAliases().some(({ name }: VisTypeAlias) => { return name === 'maps'; @@ -112,9 +105,10 @@ export function getMapsAppUrl( ]) ); - return services.addBasePath( - `${getMapsAppBaseUrl(services.visualizations)}?${mapAppParams.toString()}` - ); + return { + app: 'maps', + path: `#/map?${mapAppParams.toString()}`, + }; } export function getVisualizeUrl( @@ -184,5 +178,8 @@ export function getVisualizeUrl( }, }; - return `/app/visualize#/create?${stringify(linkUrlParams)}`; + return { + app: 'visualize', + path: `#/create?${stringify(linkUrlParams)}`, + }; } diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts index a1d71b4d3447d7..e86138761c747c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/sidebar/types.ts @@ -27,7 +27,10 @@ export interface FieldDetails { exists: number; total: boolean; buckets: Bucket[]; - visualizeUrl: string; + visualizeUrl: { + app: string; + path: string; + }; } export interface Bucket { diff --git a/src/legacy/core_plugins/kibana/public/kibana.js b/src/legacy/core_plugins/kibana/public/kibana.js index e92e3973f3a22e..55f59ac1753b8d 100644 --- a/src/legacy/core_plugins/kibana/public/kibana.js +++ b/src/legacy/core_plugins/kibana/public/kibana.js @@ -21,7 +21,6 @@ // preloading (for faster webpack builds) import routes from 'ui/routes'; -import { uiModules } from 'ui/modules'; import { npSetup } from 'ui/new_platform'; // import the uiExports that we want to "use" @@ -45,7 +44,6 @@ import 'ui/autoload/all'; import './discover/legacy'; import './management'; import './dev_tools'; -import { showAppRedirectNotification } from '../../../../plugins/kibana_legacy/public'; import 'leaflet'; import { localApplicationService } from './local_application_service'; @@ -59,7 +57,3 @@ const { config } = npSetup.plugins.kibanaLegacy; routes.otherwise({ redirectTo: `/${config.defaultAppId || 'discover'}`, }); - -uiModules - .get('kibana') - .run($location => showAppRedirectNotification($location, npSetup.core.notifications.toasts)); diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index 77f1e3126c2f32..b2dbad0dce8426 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -181,6 +181,7 @@ export function initDashboardApp(app, deps) { .catch( redirectWhenMissing({ history, + navigateToApp: deps.core.application.navigateToApp, mapping: { dashboard: DashboardConstants.LANDING_PAGE_PATH, }, @@ -238,6 +239,7 @@ export function initDashboardApp(app, deps) { .catch( redirectWhenMissing({ history, + navigateToApp: deps.core.application.navigateToApp, mapping: { dashboard: DashboardConstants.LANDING_PAGE_PATH, }, diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index fdcdf757e11d25..27844e7df9897c 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -295,7 +295,7 @@ export class DashboardPlugin defaultMessage: 'Display and share a collection of visualizations and saved searches.', }), icon: 'dashboardApp', - path: `/app/kibana#${DashboardConstants.LANDING_PAGE_PATH}`, + path: `/app/dashboards#${DashboardConstants.LANDING_PAGE_PATH}`, showOnHomePage: true, category: FeatureCatalogueCategory.DATA, }); diff --git a/src/plugins/home/public/application/components/home.js b/src/plugins/home/public/application/components/home.js index 7aa9f6c61aa4cf..26cf47410e6c28 100644 --- a/src/plugins/home/public/application/components/home.js +++ b/src/plugins/home/public/application/components/home.js @@ -44,6 +44,17 @@ import { FeatureCatalogueCategory } from '../../services'; const KEY_ENABLE_WELCOME = 'home:welcome:show'; +const createAppNavigationHandler = targetUrl => event => { + if (event.altKey || event.metaKey || event.ctrlKey) { + return; + } + if (targetUrl.startsWith('/app/')) { + const [, appId, path] = /\/app\/(.*?)((\/|\?|#|$).*)/.exec(targetUrl); + event.preventDefault(); + getServices().application.navigateToApp(appId, { path }); + } +}; + export class Home extends Component { constructor(props) { super(props); @@ -125,6 +136,7 @@ export class Home extends Component { return ( { - test('adds a message to the URL', () => { - const url = addAppRedirectMessageToUrl('', 'redirect message'); - expect(url).toBe('#?app_redirect_message=redirect%20message'); - }); -}); - -describe('showAppRedirectNotification', () => { - beforeEach(() => { - isToastAdded = false; - toasts.addDanger = (): any => { - isToastAdded = true; - }; - }); - - test(`adds a toast when there's a message in the URL`, () => { - showAppRedirectNotification( - { - search: () => ({ app_redirect_message: 'redirect message' }), - } as ILocationService, - toasts - ); - - expect(isToastAdded).toBe(true); - }); - - test(`doesn't add a toast when there's no message in the URL`, () => { - showAppRedirectNotification( - { - search: () => ({ app_redirect_message: '' }), - } as ILocationService, - toasts - ); - - expect(isToastAdded).toBe(false); - }); -}); diff --git a/src/plugins/kibana_legacy/public/notify/app_redirect/app_redirect.ts b/src/plugins/kibana_legacy/public/notify/app_redirect/app_redirect.ts deleted file mode 100644 index e79ab4b2fbc6d8..00000000000000 --- a/src/plugins/kibana_legacy/public/notify/app_redirect/app_redirect.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 { ILocationService } from 'angular'; -import { modifyUrl } from '../../../../../core/utils'; -import { ToastsStart } from '../../../../../core/public'; - -const APP_REDIRECT_MESSAGE_PARAM = 'app_redirect_message'; - -export function addAppRedirectMessageToUrl(url: string, message: string) { - return modifyUrl(url, urlParts => { - urlParts.hash = modifyUrl(urlParts.hash || '', hashParts => { - hashParts.query[APP_REDIRECT_MESSAGE_PARAM] = message; - }); - }); -} - -// If an app needs to redirect, e.g. due to an expired license, it can surface a message via -// the URL query params. -export function showAppRedirectNotification($location: ILocationService, toasts: ToastsStart) { - const queryString = $location.search(); - - if (!queryString[APP_REDIRECT_MESSAGE_PARAM]) { - return; - } - - const message = queryString[APP_REDIRECT_MESSAGE_PARAM]; - $location.search(APP_REDIRECT_MESSAGE_PARAM, null); - - toasts.addDanger(message); -} diff --git a/src/plugins/kibana_legacy/public/notify/app_redirect/index.ts b/src/plugins/kibana_legacy/public/notify/app_redirect/index.ts deleted file mode 100644 index 605f61cc601d0e..00000000000000 --- a/src/plugins/kibana_legacy/public/notify/app_redirect/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 { addAppRedirectMessageToUrl, showAppRedirectNotification } from './app_redirect'; diff --git a/src/plugins/kibana_legacy/public/notify/index.ts b/src/plugins/kibana_legacy/public/notify/index.ts index b6f29876c27372..6aa4e36ab7227a 100644 --- a/src/plugins/kibana_legacy/public/notify/index.ts +++ b/src/plugins/kibana_legacy/public/notify/index.ts @@ -18,4 +18,3 @@ */ export * from './toasts'; export * from './lib'; -export { addAppRedirectMessageToUrl, showAppRedirectNotification } from './app_redirect'; diff --git a/src/plugins/kibana_utils/public/history/ensure_default_index_pattern.tsx b/src/plugins/kibana_utils/public/history/ensure_default_index_pattern.tsx index 7992f650cb372d..9b9aad1194f5cb 100644 --- a/src/plugins/kibana_utils/public/history/ensure_default_index_pattern.tsx +++ b/src/plugins/kibana_utils/public/history/ensure_default_index_pattern.tsx @@ -62,26 +62,22 @@ export async function ensureDefaultIndexPattern( core.uiSettings.set('defaultIndex', defaultId); } else { const canManageIndexPatterns = core.application.capabilities.management.kibana.index_patterns; - const redirectTarget = canManageIndexPatterns ? '/management/kibana/index_pattern' : '/home'; + const redirectTarget = canManageIndexPatterns ? 'management' : 'home'; if (timeoutId) { clearTimeout(timeoutId); } + const bannerMessage = i18n.translate('kibana_utils.indexPattern.bannerLabel', { + defaultMessage: + "In order to visualize and explore data in Kibana, you'll need to create an index pattern to retrieve data from Elasticsearch.", + }); + // Avoid being hostile to new users who don't have an index pattern setup yet // give them a friendly info message instead of a terse error message bannerId = core.overlays.banners.replace( bannerId, - toMountPoint( - - ) + toMountPoint() ); // hide the message after the user has had a chance to acknowledge it -- so it doesn't permanently stick around @@ -90,7 +86,13 @@ export async function ensureDefaultIndexPattern( timeoutId = undefined; }, 15000); - history.push(redirectTarget); + if (redirectTarget === 'home') { + core.application.navigateToApp('home'); + } else { + window.location.href = core.http.basePath.prepend( + `/app/kibana#/management/kibana/index_pattern?bannerMessage=${bannerMessage}` + ); + } // return never-resolving promise to stop resolving and wait for the url change return new Promise(() => {}); diff --git a/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx b/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx index 8a4cc88999bfef..7ca48cfef7258f 100644 --- a/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx +++ b/src/plugins/kibana_utils/public/history/redirect_when_missing.tsx @@ -21,12 +21,20 @@ import React from 'react'; import { History } from 'history'; import { i18n } from '@kbn/i18n'; -import { ToastsSetup } from 'kibana/public'; +import { ApplicationStart, HttpStart, ToastsSetup } from 'kibana/public'; import { MarkdownSimple, toMountPoint } from '../../../kibana_react/public'; import { SavedObjectNotFound } from '../errors'; interface Mapping { - [key: string]: string; + [key: string]: string | { app: string; path: string }; +} + +function addNotFoundToPath(path: string, error: SavedObjectNotFound) { + return ( + path + + (path.indexOf('?') >= 0 ? '&' : '?') + + `notFound=${error.savedObjectType}¬FoundMessage=${error.message}` + ); } /** @@ -35,11 +43,15 @@ interface Mapping { */ export function redirectWhenMissing({ history, + navigateToApp, + basePath, mapping, toastNotifications, onBeforeRedirect, }: { history: History; + navigateToApp: ApplicationStart['navigateToApp']; + basePath: HttpStart['basePath']; /** * a mapping of url's to redirect to based on the saved object that * couldn't be found, or just a string that will be used for all types @@ -70,8 +82,13 @@ export function redirectWhenMissing({ throw error; } - let url = localMappingObject[error.savedObjectType] || localMappingObject['*'] || '/'; - url += (url.indexOf('?') >= 0 ? '&' : '?') + `notFound=${error.savedObjectType}`; + let redirectTarget = + localMappingObject[error.savedObjectType] || localMappingObject['*'] || '/'; + if (typeof redirectTarget !== 'string') { + redirectTarget.path = addNotFoundToPath(redirectTarget.path, error); + } else { + redirectTarget = addNotFoundToPath(redirectTarget, error); + } toastNotifications.addWarning({ title: i18n.translate('kibana_utils.history.savedObjectIsMissingNotificationMessage', { @@ -83,6 +100,15 @@ export function redirectWhenMissing({ if (onBeforeRedirect) { onBeforeRedirect(error); } - history.replace(url); + if (typeof redirectTarget !== 'string') { + if (redirectTarget.app === 'kibana') { + // exception for kibana app because redirect won't work right otherwise + window.location.href = basePath.prepend(`/app/kibana${redirectTarget.path}`); + } else { + navigateToApp(redirectTarget.app, { path: redirectTarget.path }); + } + } else { + history.replace(redirectTarget); + } }; } diff --git a/src/plugins/management/public/legacy/redirect_messages.tsx b/src/plugins/management/public/legacy/redirect_messages.tsx new file mode 100644 index 00000000000000..075a9adfcf5551 --- /dev/null +++ b/src/plugins/management/public/legacy/redirect_messages.tsx @@ -0,0 +1,67 @@ +/* + * 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 { EuiCallOut } from '@elastic/eui'; +import { NotificationsStart, OverlayStart } from 'kibana/public'; +import { parse } from 'query-string'; +import { i18n } from '@kbn/i18n'; +import { toMountPoint } from '../../../kibana_react/public'; +import { MarkdownSimple } from '../../../kibana_react/public'; + +/** + * Show banners and toasts carried over from other applications. This is only necessary as long as + * management is rendered in the legacy platform (which requires a full page reload to switch to). + * + * Once management is rendered using the core application service, this file and the places setting + * bannerMessage and notFoundMessage URL params can be removed. + * @param notifications Core notifications service + * @param overlays Core overlays service + */ +export function showLegacyRedirectMessages( + notifications: NotificationsStart, + overlays: OverlayStart +) { + const queryPosition = window.location.hash.indexOf('?'); + if (queryPosition === -1) { + return; + } + + const urlParams = parse(window.location.hash.substr(queryPosition)) as Record; + + if (urlParams.bannerMessage) { + const bannerId = overlays.banners.add( + toMountPoint( + + ) + ); + setTimeout(() => { + overlays.banners.remove(bannerId); + }, 15000); + } + + if (urlParams.notFoundMessage) { + notifications.toasts.addWarning({ + title: i18n.translate('kibana_utils.history.savedObjectIsMissingNotificationMessage', { + defaultMessage: 'Saved object is missing', + }), + text: toMountPoint({urlParams.notFoundMessage}), + }); + } +} diff --git a/src/plugins/management/public/plugin.ts b/src/plugins/management/public/plugin.ts index 1c9e1d5c895509..994ae9e82c120b 100644 --- a/src/plugins/management/public/plugin.ts +++ b/src/plugins/management/public/plugin.ts @@ -25,6 +25,7 @@ import { KibanaLegacySetup } from '../../kibana_legacy/public'; import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public'; // @ts-ignore import { LegacyManagementAdapter } from './legacy'; +import { showLegacyRedirectMessages } from './legacy/redirect_messages'; export class ManagementPlugin implements Plugin { private managementSections = new ManagementService(); @@ -58,6 +59,7 @@ export class ManagementPlugin implements Plugin showAppRedirectNotification($location, npStart.core.notifications.toasts)); - -/** - * If there is a configured `kibana.defaultAppId`, and it is a dashboard ID, we'll - * show that dashboard, otherwise, we'll show the default dasbhoard landing page. - */ -function defaultUrl() { - const defaultAppId = npStart.plugins.kibanaLegacy.config.defaultAppId || ''; - const isDashboardId = defaultAppId.startsWith(dashboardAppIdPrefix()); - return isDashboardId ? `/${defaultAppId}` : DashboardConstants.LANDING_PAGE_PATH; -} - -function dashboardAppIdPrefix() { - return _.trimLeft(createDashboardEditUrl(''), '/'); -} diff --git a/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js b/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js index 1f233bc38692a0..eb8331644cd880 100644 --- a/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js +++ b/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js @@ -16,11 +16,7 @@ const superuserRole = 'superuser'; * * @type {Hapi.RequestExtension} */ -export function createDashboardModeRequestInterceptor(dashboardViewerApp) { - if (!dashboardViewerApp) { - throw new TypeError('Expected to receive a `dashboardViewerApp` argument'); - } - +export function createDashboardModeRequestInterceptor() { return { type: 'onPostAuth', async method(request, h) { @@ -51,12 +47,22 @@ export function createDashboardModeRequestInterceptor(dashboardViewerApp) { const enforceDashboardOnlyMode = isDashboardOnlyModeUser && !isSuperUser; if (enforceDashboardOnlyMode) { - if (url.path.startsWith('/app/kibana')) { + if ( + url.path.startsWith('/app/home') || + url.path.startsWith('/app/kibana') || + url.path.startsWith('/app/dashboards') + ) { + console.log('redirecting'); + const basePath = request.server.newPlatform.setup.core.http.basePath.get(request); + const url = `${basePath}/app/dashboard_mode`; // If the user is in "Dashboard only mode" they should only be allowed to see - // that app and none others. Here we are intercepting all other routing and ensuring the viewer - // app is the only one ever rendered. - const response = await h.renderApp(dashboardViewerApp); - return response.takeover(); + // the dashboard app and none others. If the kibana app is requested, this might be a old + // url we will migrate on the fly. + return h.redirect(url).takeover(); + } + if (url.path.startsWith('/app/dashboard_mode')) { + // let through requests to the dashboard_mode app + return h.continue; } throw Boom.notFound(); diff --git a/x-pack/plugins/dashboard_mode/kibana.json b/x-pack/plugins/dashboard_mode/kibana.json new file mode 100644 index 00000000000000..dfe32210250928 --- /dev/null +++ b/x-pack/plugins/dashboard_mode/kibana.json @@ -0,0 +1,13 @@ +{ + "id": "dashboardMode", + "version": "8.0.0", + "kibanaVersion": "kibana", + "configPath": [ + "xpack", "dashboard_mode" + ], + "requiredPlugins": [ + "kibanaLegacy", "dashboard" + ], + "server": true, + "ui": true +} diff --git a/x-pack/plugins/dashboard_mode/public/index.ts b/x-pack/plugins/dashboard_mode/public/index.ts new file mode 100644 index 00000000000000..087e651e953733 --- /dev/null +++ b/x-pack/plugins/dashboard_mode/public/index.ts @@ -0,0 +1,7 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +export { plugin } from './plugin'; diff --git a/x-pack/plugins/dashboard_mode/public/plugin.ts b/x-pack/plugins/dashboard_mode/public/plugin.ts new file mode 100644 index 00000000000000..b77fdac32aff21 --- /dev/null +++ b/x-pack/plugins/dashboard_mode/public/plugin.ts @@ -0,0 +1,67 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { trimLeft } from 'lodash'; +import { CoreSetup } from 'kibana/public'; +import { KibanaLegacyStart } from '../../../../src/plugins/kibana_legacy/public'; +import { + createDashboardEditUrl, + DashboardConstants, +} from '../../../../src/plugins/dashboard/public'; + +function defaultUrl(defaultAppId: string) { + const isDashboardId = defaultAppId.startsWith(dashboardAppIdPrefix()); + return isDashboardId ? `/${defaultAppId}` : DashboardConstants.LANDING_PAGE_PATH; +} + +function dashboardAppIdPrefix() { + return trimLeft(createDashboardEditUrl(''), '/'); +} + +function migratePath(currentHash: string, kibanaLegacy: KibanaLegacyStart) { + if (currentHash === '' || currentHash === '#' || currentHash === '#/') { + return `#${defaultUrl(kibanaLegacy.config.defaultAppId || '')}`; + } + if (!currentHash.startsWith('#/dashboard')) { + return currentHash; + } + + const forwards = kibanaLegacy.getForwards(); + + if (currentHash.startsWith('#/dashboards')) { + const { rewritePath: migrateListingPath } = forwards.find( + ({ legacyAppId }) => legacyAppId === 'dashboards' + )!; + return migrateListingPath(currentHash); + } + + const { rewritePath: migrateDetailPath } = forwards.find( + ({ legacyAppId }) => legacyAppId === 'dashboard' + )!; + return migrateDetailPath(currentHash); +} + +export const plugin = () => ({ + setup(core: CoreSetup<{ kibanaLegacy: KibanaLegacyStart }>) { + core.application.register({ + id: 'dashboard_mode', + title: 'Dashboard mode', + navLinkStatus: 3, // TODO should be fetched by enum + mount: async () => { + const [coreStart, { kibanaLegacy }] = await core.getStartServices(); + kibanaLegacy.dashboardConfig.turnHideWriteControlsOn(); + coreStart.chrome.navLinks.showOnly('dashboards'); + setTimeout(() => { + coreStart.application.navigateToApp('dashboards', { + path: migratePath(window.location.hash, kibanaLegacy), + }); + }, 0); + return () => {}; + }, + }); + }, + start() {}, +}); diff --git a/x-pack/plugins/dashboard_mode/server/index.ts b/x-pack/plugins/dashboard_mode/server/index.ts new file mode 100644 index 00000000000000..2a8890c2f81acf --- /dev/null +++ b/x-pack/plugins/dashboard_mode/server/index.ts @@ -0,0 +1,20 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { PluginConfigDescriptor } from 'kibana/server'; + +import { schema } from '@kbn/config-schema'; + +export const config: PluginConfigDescriptor = { + schema: schema.object({ + enabled: schema.boolean({ defaultValue: true }), + }), +}; + +export const plugin = () => ({ + setup() {}, + start() {}, +}); diff --git a/x-pack/plugins/graph/public/application.ts b/x-pack/plugins/graph/public/application.ts index f804265f1f5ab2..e244db055b3fbf 100644 --- a/x-pack/plugins/graph/public/application.ts +++ b/x-pack/plugins/graph/public/application.ts @@ -31,7 +31,6 @@ import { checkLicense } from '../common/check_license'; import { NavigationPublicPluginStart as NavigationStart } from '../../../../src/plugins/navigation/public'; import { Storage } from '../../../../src/plugins/kibana_utils/public'; import { - addAppRedirectMessageToUrl, configureAppAngularModule, createTopNavDirective, createTopNavHelper, @@ -81,8 +80,13 @@ export const renderApp = ({ appBasePath, element, ...deps }: GraphDependencies) const licenseAllowsToShowThisPage = info.showAppLink && info.enableAppLink; if (!licenseAllowsToShowThisPage) { - const newUrl = addAppRedirectMessageToUrl(deps.addBasePath('/app/kibana'), info.message); - window.location.href = newUrl; + deps.coreStart.notifications.toasts.addDanger(info.message); + // This has to happen in the next tick because otherwise the original navigation + // bringing us to the graph app in the first place + // never completes and the browser enters are redirect loop + setTimeout(() => { + deps.coreStart.application.navigateToApp('home'); + }, 0); } }); From 3911e57bd459382afd2ec405040aed594ecaf671 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 20 Apr 2020 16:47:14 +0300 Subject: [PATCH 020/134] Move vis_type_vislib into NP --- .eslintignore | 2 +- .github/CODEOWNERS | 2 +- .i18nrc.json | 6 +- .sass-lint.yml | 4 +- src/dev/precommit_hook/casing_check_config.js | 1 - .../__tests__/vis_type_vislib}/index.js | 3 +- .../vis_type_vislib}/lib/axis_title.js | 12 +- .../vis_type_vislib}/lib/chart_title.js | 8 +- .../vis_type_vislib}/lib/dispatch.js | 9 +- .../vis_type_vislib}/lib/error_handler.js | 4 +- .../vis_type_vislib}/lib/handler/handler.js | 17 +- .../vis_type_vislib}/lib/layout/layout.js | 21 ++- .../vis_type_vislib}/lib/vis_config.js | 6 +- .../__tests__/vis_type_vislib}/lib/x_axis.js | 8 +- .../__tests__/vis_type_vislib}/lib/y_axis.js | 8 +- .../public/__tests__/vis_type_vislib}/vis.js | 15 +- .../visualizations/area_chart.js | 19 ++- .../vis_type_vislib}/visualizations/chart.js | 9 +- .../visualizations/column_chart.js | 27 +-- .../visualizations/gauge_chart.js | 9 +- .../visualizations/heatmap_chart.js | 19 ++- .../visualizations/line_chart.js | 21 ++- .../visualizations/pie_chart.js | 7 +- .../visualizations/pie_chart_mock_data.js | 0 .../visualizations/time_marker.js | 8 +- .../visualizations/vis_types.js | 4 +- .../core_plugins/kibana/public/index.scss | 5 +- .../core_plugins/vis_type_vislib/index.ts | 44 ----- .../core_plugins/vis_type_vislib/package.json | 4 - .../vis_type_vislib/public/legacy.ts | 43 ----- .../__tests__/lib/types/point_series.js | 128 --------------- src/plugins/vis_type_vislib/kibana.json | 8 + .../public/__snapshots__/pie_fn.test.ts.snap | 0 .../vis_type_vislib/public/area.ts | 6 +- .../public/components/common/index.ts | 0 .../components/common/truncate_labels.tsx | 0 .../components/common/validation_wrapper.tsx | 0 .../public/components/index.ts | 0 .../public/components/options/gauge/index.tsx | 0 .../components/options/gauge/labels_panel.tsx | 4 +- .../components/options/gauge/ranges_panel.tsx | 4 +- .../components/options/gauge/style_panel.tsx | 6 +- .../components/options/heatmap/index.tsx | 2 +- .../options/heatmap/labels_panel.tsx | 2 +- .../public/components/options/index.ts | 0 .../category_axis_panel.test.tsx.snap | 0 .../__snapshots__/chart_options.test.tsx.snap | 0 .../custom_extents_options.test.tsx.snap | 0 .../__snapshots__/index.test.tsx.snap | 0 .../__snapshots__/label_options.test.tsx.snap | 0 .../__snapshots__/line_options.test.tsx.snap | 0 .../value_axes_panel.test.tsx.snap | 0 .../value_axis_options.test.tsx.snap | 0 .../__snapshots__/y_extents.test.tsx.snap | 0 .../metrics_axes/category_axis_panel.test.tsx | 2 - .../metrics_axes/category_axis_panel.tsx | 2 +- .../metrics_axes/chart_options.test.tsx | 2 - .../options/metrics_axes/chart_options.tsx | 6 +- .../custom_extents_options.test.tsx | 2 - .../metrics_axes/custom_extents_options.tsx | 2 +- .../options/metrics_axes/index.test.tsx | 0 .../components/options/metrics_axes/index.tsx | 0 .../metrics_axes/label_options.test.tsx | 2 - .../options/metrics_axes/label_options.tsx | 2 +- .../metrics_axes/line_options.test.tsx | 4 +- .../options/metrics_axes/line_options.tsx | 8 +- .../components/options/metrics_axes/mocks.ts | 4 +- .../options/metrics_axes/series_panel.tsx | 4 +- .../components/options/metrics_axes/utils.ts | 0 .../metrics_axes/value_axes_panel.test.tsx | 2 - .../options/metrics_axes/value_axes_panel.tsx | 4 +- .../metrics_axes/value_axis_options.test.tsx | 4 +- .../metrics_axes/value_axis_options.tsx | 10 +- .../options/metrics_axes/y_extents.test.tsx | 4 +- .../options/metrics_axes/y_extents.tsx | 2 +- .../public/components/options/pie.tsx | 2 +- .../options/point_series/grid_panel.tsx | 2 +- .../components/options/point_series/index.ts | 0 .../options/point_series/point_series.tsx | 2 +- .../options/point_series/threshold_panel.tsx | 2 +- .../public}/fixtures/_vis_fixture.js | 11 +- .../dispatch_bar_chart_config_normal.json | 0 .../dispatch_bar_chart_config_percentage.json | 0 .../fixtures/dispatch_bar_chart_d3.json | 0 .../dispatch_bar_chart_data_point.json | 0 .../fixtures/dispatch_heatmap_config.json | 0 .../public}/fixtures/dispatch_heatmap_d3.json | 0 .../fixtures/dispatch_heatmap_data_point.json | 0 .../mock_data/date_histogram/_columns.js | 0 .../mock_data/date_histogram/_rows.js | 0 .../date_histogram/_rows_series_with_holes.js | 0 .../mock_data/date_histogram/_series.js | 0 .../_series_monthly_interval.js | 0 .../mock_data/date_histogram/_series_neg.js | 0 .../date_histogram/_series_pos_neg.js | 0 .../date_histogram/_stacked_series.js | 0 .../fixtures/mock_data/filters/_columns.js | 0 .../fixtures/mock_data/filters/_rows.js | 0 .../fixtures/mock_data/filters/_series.js | 0 .../fixtures/mock_data/geohash/_columns.js | 0 .../fixtures/mock_data/geohash/_geo_json.js | 0 .../fixtures/mock_data/geohash/_rows.js | 0 .../fixtures/mock_data/histogram/_columns.js | 0 .../fixtures/mock_data/histogram/_rows.js | 0 .../fixtures/mock_data/histogram/_series.js | 0 .../fixtures/mock_data/histogram/_slices.js | 0 .../mock_data/not_enough_data/_one_point.js | 0 .../fixtures/mock_data/range/_columns.js | 0 .../public}/fixtures/mock_data/range/_rows.js | 0 .../fixtures/mock_data/range/_series.js | 0 .../mock_data/significant_terms/_columns.js | 0 .../mock_data/significant_terms/_rows.js | 0 .../mock_data/significant_terms/_series.js | 0 .../fixtures/mock_data/stacked/_stacked.js | 0 .../fixtures/mock_data/terms/_columns.js | 0 .../public}/fixtures/mock_data/terms/_rows.js | 0 .../fixtures/mock_data/terms/_series.js | 0 .../mock_data/terms/_series_multiple.js} | 0 .../vis_type_vislib/public/gauge.ts | 12 +- .../vis_type_vislib/public/goal.ts | 6 +- .../vis_type_vislib/public/heatmap.ts | 6 +- .../vis_type_vislib/public/histogram.ts | 6 +- .../vis_type_vislib/public/horizontal_bar.ts | 10 +- .../vis_type_vislib/public/index.scss} | 0 .../vis_type_vislib/public/index.ts | 2 +- .../vis_type_vislib/public/line.ts | 10 +- .../vis_type_vislib/public/pie.ts | 4 +- .../vis_type_vislib/public/pie_fn.test.ts | 3 +- .../vis_type_vislib/public/pie_fn.ts | 6 +- .../vis_type_vislib/public/plugin.ts | 11 +- .../vis_type_vislib/public/services.ts | 4 +- .../vis_type_vislib/public/types.ts | 2 +- .../public/utils/collections.ts | 2 +- .../public/utils/common_config.tsx | 0 .../vis_type_vislib/public/vis_controller.tsx | 4 +- .../public/vis_type_vislib_vis_fn.ts | 6 +- .../public/vis_type_vislib_vis_types.ts | 0 .../vis_type_vislib/public/vislib/VISLIB.md | 0 .../vis_type_vislib/public/vislib/_index.scss | 0 .../public/vislib/_variables.scss | 0 .../public/vislib/_vislib_vis_type.scss | 0 .../vislib/components/labels/data_array.js | 0 .../components/labels/flatten_series.js | 0 .../public/vislib/components/labels/index.js | 0 .../public/vislib/components/labels/labels.js | 0 .../vislib/components/labels/labels.test.js} | 8 +- .../components/labels/truncate_labels.js | 0 .../vislib/components/labels/uniq_labels.js | 0 .../legend/__snapshots__/legend.test.tsx.snap | 0 .../vislib/components/legend/_index.scss | 0 .../vislib/components/legend/_legend.scss | 0 .../public/vislib/components/legend/index.ts | 0 .../vislib/components/legend/legend.test.tsx | 4 - .../vislib/components/legend/legend.tsx | 0 .../vislib/components/legend/legend_item.tsx | 0 .../public/vislib/components/legend/models.ts | 0 .../vislib/components/legend/pie_utils.ts | 2 +- .../components/tooltip/_collect_branch.js | 0 .../tooltip/_collect_branch.test.js | 0 .../_hierarchical_tooltip_formatter.js | 0 .../vislib/components/tooltip/_index.scss | 0 .../tooltip/_pointseries_tooltip_formatter.js | 0 .../_pointseries_tooltip_formatter.test.js} | 2 +- .../vislib/components/tooltip/_tooltip.scss | 0 .../public/vislib/components/tooltip/index.js | 0 .../components/tooltip/position_tooltip.js | 0 .../tooltip/position_tooltip.test.js} | 2 +- .../vislib/components/tooltip/tooltip.js | 0 .../components/zero_injection/flatten_data.js | 0 .../components/zero_injection/inject_zeros.js | 0 .../zero_injection/ordered_x_keys.js | 0 .../components/zero_injection/uniq_keys.js | 0 .../zero_injection/zero_fill_data_array.js | 0 .../zero_injection/zero_filled_array.js | 0 .../zero_injection/zero_injection.test.js | 0 .../vis_type_vislib/public/vislib/errors.ts | 2 +- .../build_hierarchical_data.test.ts | 0 .../hierarchical/build_hierarchical_data.ts | 2 +- .../public/vislib/helpers/index.ts | 0 .../helpers/point_series/_add_to_siri.test.ts | 0 .../helpers/point_series/_add_to_siri.ts | 0 .../point_series/_fake_x_aspect.test.ts | 0 .../helpers/point_series/_fake_x_aspect.ts | 0 .../helpers/point_series/_get_aspects.test.ts | 0 .../helpers/point_series/_get_aspects.ts | 0 .../helpers/point_series/_get_point.test.ts | 2 +- .../vislib/helpers/point_series/_get_point.ts | 0 .../helpers/point_series/_get_series.test.ts | 0 .../helpers/point_series/_get_series.ts | 0 .../helpers/point_series/_init_x_axis.test.ts | 0 .../helpers/point_series/_init_x_axis.ts | 0 .../helpers/point_series/_init_y_axis.test.ts | 0 .../helpers/point_series/_init_y_axis.ts | 0 .../point_series/_ordered_date_axis.test.ts | 0 .../point_series/_ordered_date_axis.ts | 0 .../vislib/helpers/point_series/index.ts | 0 .../helpers/point_series/point_series.test.ts | 0 .../helpers/point_series/point_series.ts | 0 .../vis_type_vislib/public/vislib/index.js | 0 .../dispatch_heatmap.test.js.snap | 0 .../public/vislib/lib/_alerts.scss | 0 .../public/vislib/lib/_data_label.js | 0 .../public/vislib/lib/_error_handler.js | 0 .../public/vislib/lib/_handler.scss | 0 .../public/vislib/lib/_index.scss | 0 .../public/vislib/lib/alerts.js | 0 .../public/vislib/lib/axis/axis.js | 0 .../public/vislib/lib/axis/axis.test.js} | 6 +- .../public/vislib/lib/axis/axis_config.js | 0 .../public/vislib/lib/axis/axis_labels.js | 0 .../public/vislib/lib/axis/axis_scale.js | 0 .../public/vislib/lib/axis/axis_title.js | 0 .../public/vislib/lib/axis/index.js | 0 .../public/vislib/lib/axis/scale_modes.js | 0 .../public/vislib/lib/axis/time_ticks.js | 0 .../public/vislib/lib/axis/time_ticks.test.js | 0 .../public/vislib/lib/binder.ts | 0 .../public/vislib/lib/chart_grid.js | 0 .../public/vislib/lib/chart_title.js | 0 .../vis_type_vislib/public/vislib/lib/data.js | 0 .../public/vislib/lib/data.test.js} | 4 +- .../public/vislib/lib/dispatch.js | 0 .../vislib}/lib/dispatch_heatmap.test.js | 18 +- .../lib/dispatch_vertical_bar_chart.test.js | 20 +-- .../public/vislib/lib/handler.js | 2 +- .../public/vislib/lib/layout/_index.scss | 0 .../public/vislib/lib/layout/_layout.scss | 0 .../public/vislib/lib/layout/index.js | 0 .../public/vislib/lib/layout/layout.js | 0 .../public/vislib/lib/layout/layout_types.js | 0 .../vislib/lib/layout/layout_types.test.js} | 2 +- .../layout/splits/column_chart/chart_split.js | 0 .../splits/column_chart/chart_title_split.js | 0 .../splits/column_chart/splits.test.js} | 8 +- .../splits/column_chart/x_axis_split.js | 0 .../splits/column_chart/y_axis_split.js | 0 .../layout/splits/gauge_chart/chart_split.js | 0 .../splits/gauge_chart/chart_title_split.js | 0 .../layout/splits/gauge_chart/splits.test.js} | 4 +- .../layout/splits/pie_chart/chart_split.js | 0 .../splits/pie_chart/chart_title_split.js | 0 .../vislib/lib/layout/types/column_layout.js | 0 .../lib/layout/types/column_layout.test.js} | 2 +- .../vislib/lib/layout/types/gauge_layout.js | 0 .../vislib/lib/layout/types/pie_layout.js | 0 .../public/vislib/lib/types/gauge.js | 0 .../public/vislib/lib/types/index.js | 0 .../public/vislib/lib/types/pie.js | 0 .../public/vislib/lib/types/point_series.js | 0 .../vislib/lib/types/point_series.test.js | 154 ++++++++++++------ .../types/testdata_linechart_percentile.json | 0 .../testdata_linechart_percentile_result.json | 0 .../public/vislib/lib/vis_config.js | 0 .../vislib/partials/touchdown.tmpl.html | 0 .../public/vislib/response_handler.js | 0 .../public/vislib/response_handler.test.ts | 0 .../vis_type_vislib/public/vislib/types.ts | 0 .../vis_type_vislib/public/vislib/vis.js | 0 .../vis_type_vislib/public/vislib/vislib.js | 0 .../public/vislib/visualizations/_chart.js | 0 .../vislib/visualizations/gauge_chart.js | 0 .../vislib/visualizations/gauges/_index.scss | 0 .../vislib/visualizations/gauges/_meter.scss | 0 .../visualizations/gauges/gauge_types.js | 0 .../vislib/visualizations/gauges/meter.js | 2 +- .../public/vislib/visualizations/pie_chart.js | 0 .../vislib/visualizations/point_series.js | 0 .../visualizations/point_series/_index.scss | 0 .../visualizations/point_series/_labels.scss | 0 .../point_series/_point_series.js | 0 .../visualizations/point_series/area_chart.js | 0 .../point_series/column_chart.js | 0 .../point_series/heatmap_chart.js | 2 +- .../visualizations/point_series/line_chart.js | 0 .../point_series/series_types.js | 0 .../vislib/visualizations/time_marker.d.ts | 0 .../vislib/visualizations/time_marker.js | 0 .../public/vislib/visualizations/vis_types.js | 0 .../vis_type_vislib/server/index.ts} | 12 +- x-pack/legacy/plugins/tilemap/index.js | 2 +- .../ml/public/application/util/chart_utils.js | 2 +- 281 files changed, 409 insertions(+), 539 deletions(-) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/index.js (89%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/axis_title.js (89%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/chart_title.js (89%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/dispatch.js (95%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/error_handler.js (90%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/handler/handler.js (86%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/layout/layout.js (85%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/vis_config.js (92%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/x_axis.js (94%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/lib/y_axis.js (96%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/vis.js (92%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/area_chart.js (89%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/chart.js (91%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/column_chart.js (88%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/gauge_chart.js (93%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/heatmap_chart.js (88%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/line_chart.js (88%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/pie_chart.js (97%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/pie_chart_mock_data.js (100%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/time_marker.js (91%) rename src/legacy/core_plugins/{vis_type_vislib/public/vislib/__tests__ => kibana/public/__tests__/vis_type_vislib}/visualizations/vis_types.js (87%) delete mode 100644 src/legacy/core_plugins/vis_type_vislib/index.ts delete mode 100644 src/legacy/core_plugins/vis_type_vislib/package.json delete mode 100644 src/legacy/core_plugins/vis_type_vislib/public/legacy.ts delete mode 100644 src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/point_series.js create mode 100644 src/plugins/vis_type_vislib/kibana.json rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/area.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/common/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/common/truncate_labels.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/common/validation_wrapper.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/gauge/index.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/gauge/labels_panel.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/gauge/style_panel.tsx (91%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/heatmap/index.tsx (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/index.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/index.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/index.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/mocks.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/utils.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/pie.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/point_series/grid_panel.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/point_series/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/point_series/point_series.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx (98%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/_vis_fixture.js (92%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_bar_chart_config_normal.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_bar_chart_config_percentage.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_bar_chart_d3.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_bar_chart_data_point.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_heatmap_config.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_heatmap_d3.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/dispatch_heatmap_data_point.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_rows_series_with_holes.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_series_monthly_interval.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_series_neg.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_series_pos_neg.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/date_histogram/_stacked_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/filters/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/filters/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/filters/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/geohash/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/geohash/_geo_json.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/geohash/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/histogram/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/histogram/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/histogram/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/histogram/_slices.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/not_enough_data/_one_point.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/range/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/range/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/range/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/significant_terms/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/significant_terms/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/significant_terms/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/stacked/_stacked.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/terms/_columns.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/terms/_rows.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib => plugins/vis_type_vislib/public}/fixtures/mock_data/terms/_series.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_seriesMultiple.js => plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js} (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/gauge.ts (93%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/goal.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/heatmap.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/histogram.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/horizontal_bar.ts (93%) rename src/{legacy/core_plugins/vis_type_vislib/public/_index.scss => plugins/vis_type_vislib/public/index.scss} (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/index.ts (93%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/line.ts (93%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/pie.ts (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/pie_fn.test.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/pie_fn.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/plugin.ts (92%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/services.ts (87%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/types.ts (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/utils/collections.ts (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/utils/common_config.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vis_controller.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vis_type_vislib_vis_fn.ts (94%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vis_type_vislib_vis_types.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/VISLIB.md (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/_variables.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/_vislib_vis_type.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/data_array.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/flatten_series.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/index.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/labels.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/labels.js => plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js} (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/truncate_labels.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/labels/uniq_labels.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/_legend.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/legend.test.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/legend.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/legend_item.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/models.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/legend/pie_utils.ts (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/_tooltip_formatter.js => plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js} (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/index.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/positioning.js => plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js} (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/tooltip/tooltip.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/errors.ts (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/index.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__ => plugins/vis_type_vislib/public/vislib}/lib/__snapshots__/dispatch_heatmap.test.js.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/_alerts.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/_data_label.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/_error_handler.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/_handler.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/alerts.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/axis.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis/axis.js => plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js} (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/axis_config.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/axis_labels.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/axis_scale.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/axis_title.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/index.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/scale_modes.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/time_ticks.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/binder.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/chart_grid.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/chart_title.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/data.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/data.js => plugins/vis_type_vislib/public/vislib/lib/data.test.js} (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/dispatch.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__ => plugins/vis_type_vislib/public/vislib}/lib/dispatch_heatmap.test.js (75%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__ => plugins/vis_type_vislib/public/vislib}/lib/dispatch_vertical_bar_chart.test.js (74%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/handler.js (98%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/_layout.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/index.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/layout.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/layout_types.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout_types.js => plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js} (93%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/column_chart/splits.js => plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js} (95%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/gauge_chart/splits.js => plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js} (96%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/types/column_layout.js => plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js} (97%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/types/gauge.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/types/index.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/types/pie.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/types/point_series.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/types/point_series.test.js (53%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__ => plugins/vis_type_vislib/public/vislib}/lib/types/testdata_linechart_percentile.json (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/vislib/__tests__ => plugins/vis_type_vislib/public/vislib}/lib/types/testdata_linechart_percentile_result.json (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/lib/vis_config.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/partials/touchdown.tmpl.html (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/response_handler.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/response_handler.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/types.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/vis.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/vislib.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/gauge_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/gauges/meter.js (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/pie_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js (99%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/time_marker.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_vislib/public/vislib/visualizations/vis_types.js (100%) rename src/{legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts => plugins/vis_type_vislib/server/index.ts} (78%) diff --git a/.eslintignore b/.eslintignore index 1f22b6074e76e0..4d5194c0a73dc4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -10,7 +10,7 @@ bower_components /html_docs /src/plugins/data/common/es_query/kuery/ast/_generated_/** /src/plugins/vis_type_timelion/public/_generated_/** -src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data +/src/plugins/vis_type_vislib/public/fixtures/mock_data /src/legacy/ui/public/flot-charts /test/fixtures/scenarios /src/legacy/core_plugins/console/public/webpackShims diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ab05b32ab063e2..b008d62ad1ff3b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -11,7 +11,7 @@ /src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app -/src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app +/src/plugins/vis_type_vislib/ @elastic/kibana-app /src/plugins/vis_type_xy/ @elastic/kibana-app /src/plugins/kibana_legacy/ @elastic/kibana-app /src/plugins/vis_type_timelion/ @elastic/kibana-app diff --git a/.i18nrc.json b/.i18nrc.json index 4a516f23ebf05d..cf90f71e876020 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -50,10 +50,10 @@ "visTypeMetric": "src/plugins/vis_type_metric", "visTypeTable": "src/legacy/core_plugins/vis_type_table", "visTypeTagCloud": "src/legacy/core_plugins/vis_type_tagcloud", - "visTypeTimeseries": ["src/legacy/core_plugins/vis_type_timeseries", "src/plugins/vis_type_timeseries"], + "visTypeTimeseries": "src/plugins/vis_type_timeseries", "visTypeVega": "src/legacy/core_plugins/vis_type_vega", - "visTypeVislib": "src/legacy/core_plugins/vis_type_vislib", - "visTypeXy": "src/legacy/core_plugins/vis_type_xy", + "visTypeVislib": "src/plugins/vis_type_vislib", + "visTypeXy": "src/plugins/vis_type_xy", "visualizations": "src/plugins/visualizations", "visualize": "src/plugins/visualize" }, diff --git a/.sass-lint.yml b/.sass-lint.yml index 5c2c88a1dad5dc..1eb79644adb008 100644 --- a/.sass-lint.yml +++ b/.sass-lint.yml @@ -2,8 +2,8 @@ files: include: - 'src/legacy/core_plugins/metrics/**/*.s+(a|c)ss' - 'src/legacy/core_plugins/timelion/**/*.s+(a|c)ss' - - 'src/legacy/core_plugins/vis_type_vislib/**/*.s+(a|c)ss' - - 'src/legacy/core_plugins/vis_type_xy/**/*.s+(a|c)ss' + - 'src/plugins/vis_type_vislib/**/*.s+(a|c)ss' + - 'src/plugins/vis_type_xy/**/*.s+(a|c)ss' - 'x-pack/legacy/plugins/rollup/**/*.s+(a|c)ss' - 'x-pack/legacy/plugins/security/**/*.s+(a|c)ss' - 'x-pack/legacy/plugins/canvas/**/*.s+(a|c)ss' diff --git a/src/dev/precommit_hook/casing_check_config.js b/src/dev/precommit_hook/casing_check_config.js index 1b5110a61cbc4d..db600ecc4a31d8 100644 --- a/src/dev/precommit_hook/casing_check_config.js +++ b/src/dev/precommit_hook/casing_check_config.js @@ -122,7 +122,6 @@ export const TEMPORARILY_IGNORED_PATHS = [ 'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/seriesList.js', 'src/legacy/core_plugins/timelion/server/series_functions/__tests__/fixtures/tlConfig.js', 'src/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json', - 'src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_seriesMultiple.js', 'src/core/server/core_app/assets/favicons/android-chrome-192x192.png', 'src/core/server/core_app/assets/favicons/android-chrome-256x256.png', 'src/core/server/core_app/assets/favicons/android-chrome-512x512.png', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/index.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js similarity index 89% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/index.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js index 734c6d003278fd..8e5be336d096b8 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/index.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js @@ -20,7 +20,8 @@ import _ from 'lodash'; import expect from '@kbn/expect'; -import VislibProvider from '..'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import VislibProvider from '../../../../../../plugins/vis_type_vislib/public/vislib'; describe('Vislib Index Test Suite', function() { let vislib; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js similarity index 89% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis_title.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js index fd25335dd2cd4c..e7ec6eea32162b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js @@ -17,16 +17,18 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { AxisTitle } from '../../lib/axis/axis_title'; -import { AxisConfig } from '../../lib/axis/axis_config'; -import { VisConfig } from '../../lib/vis_config'; -import { Data } from '../../lib/data'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { AxisTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis/axis_title'; +import { AxisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis/axis_config'; +import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { Data } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/data'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib AxisTitle Class Test Suite', function() { let el; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/chart_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js similarity index 89% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/chart_title.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js index b65571becd83c6..cd878f0ed98d71 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/chart_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js @@ -17,13 +17,15 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; -import { ChartTitle } from '../../lib/chart_title'; -import { VisConfig } from '../../lib/vis_config'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { ChartTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/chart_title'; +import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib ChartTitle Class Test Suite', function() { let mockUiState; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js index a5d8eb80419a11..b34c03aed98d1e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js @@ -17,14 +17,19 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import _ from 'lodash'; import d3 from 'd3'; import expect from '@kbn/expect'; // Data -import data from './fixtures/mock_data/date_histogram/_series'; +import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -import { getVis, getMockUiState } from './fixtures/_vis_fixture'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib Dispatch Class Test Suite', function() { function destroyVis(vis) { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/error_handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js similarity index 90% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/error_handler.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js index 4523e70ccbb4cb..3b8f0e7f4a2b47 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/error_handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js @@ -17,9 +17,11 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import expect from '@kbn/expect'; -import { ErrorHandler } from '../../lib/_error_handler'; +import { ErrorHandler } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/_error_handler'; describe('Vislib ErrorHandler Test Suite', function() { let errorHandler; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/handler/handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js similarity index 86% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/handler/handler.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js index 8e25015c101860..e0237fddd20022 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/handler/handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js @@ -17,16 +17,21 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import expect from '@kbn/expect'; import $ from 'jquery'; // Data -import series from '../fixtures/mock_data/date_histogram/_series'; -import columns from '../fixtures/mock_data/date_histogram/_columns'; -import rows from '../fixtures/mock_data/date_histogram/_rows'; -import stackedSeries from '../fixtures/mock_data/date_histogram/_stacked_series'; - -import { getVis, getMockUiState } from '../fixtures/_vis_fixture'; +import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; + +import { + getVis, + getMockUiState, +} from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js similarity index 85% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js index f72794e27e834a..35d22e245401b5 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js @@ -17,19 +17,24 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; // Data -import series from '../fixtures/mock_data/date_histogram/_series'; -import columns from '../fixtures/mock_data/date_histogram/_columns'; -import rows from '../fixtures/mock_data/date_histogram/_rows'; -import stackedSeries from '../fixtures/mock_data/date_histogram/_stacked_series'; - -import { Layout } from '../../../lib/layout/layout'; -import { getVis, getMockUiState } from '../fixtures/_vis_fixture'; -import { VisConfig } from '../../../lib/vis_config'; +import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; + +import { Layout } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/layout/layout'; +import { + getVis, + getMockUiState, +} from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { VisConfig } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; const dateHistogramArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/vis_config.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js similarity index 92% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/vis_config.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js index 7dfd2ded36a667..88605b90c6206b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/vis_config.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js @@ -17,11 +17,13 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import expect from '@kbn/expect'; -import { VisConfig } from '../../lib/vis_config'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib VisConfig Class Test Suite', function() { let el; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/x_axis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/x_axis.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js index d42562a87b825a..9cefa8eec182f6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/x_axis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js @@ -17,14 +17,16 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; import $ from 'jquery'; -import { Axis } from '../../lib/axis'; -import { VisConfig } from '../../lib/vis_config'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { Axis } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis'; +import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib xAxis Class Test Suite', function() { let mockUiState; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/y_axis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/y_axis.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js index f73011d6616451..70ba382378f3d2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/y_axis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js @@ -17,14 +17,16 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import _ from 'lodash'; import d3 from 'd3'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { Axis } from '../../lib/axis'; -import { VisConfig } from '../../lib/vis_config'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { Axis } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis'; +import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; const YAxis = Axis; let mockUiState; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/vis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js similarity index 92% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/vis.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js index 4852f71d8c45b3..cbea62ce25611a 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/vis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js @@ -17,15 +17,20 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import series from './lib/fixtures/mock_data/date_histogram/_series'; -import columns from './lib/fixtures/mock_data/date_histogram/_columns'; -import rows from './lib/fixtures/mock_data/date_histogram/_rows'; -import stackedSeries from './lib/fixtures/mock_data/date_histogram/_stacked_series'; -import { getVis, getMockUiState } from './lib/fixtures/_vis_fixture'; +import series from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import columns from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +import rows from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +import stackedSeries from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +import { + getVis, + getMockUiState, +} from '../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; const dataArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/area_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js similarity index 89% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/area_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js index c3f5859eb454cc..c025322de16279 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/area_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js @@ -17,20 +17,25 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; const dataTypesArray = { - 'series pos': require('../lib/fixtures/mock_data/date_histogram/_series'), - 'series pos neg': require('../lib/fixtures/mock_data/date_histogram/_series_pos_neg'), - 'series neg': require('../lib/fixtures/mock_data/date_histogram/_series_neg'), - 'term columns': require('../lib/fixtures/mock_data/terms/_columns'), - 'range rows': require('../lib/fixtures/mock_data/range/_rows'), - stackedSeries: require('../lib/fixtures/mock_data/date_histogram/_stacked_series'), + 'series pos': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'), + 'series pos neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'), + 'series neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'), + 'term columns': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'), + 'range rows': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'), + stackedSeries: require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'), }; const visLibParams = { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js similarity index 91% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js index 9653f9abab6fb8..6290743d60e836 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js @@ -17,11 +17,16 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import expect from '@kbn/expect'; -import { Chart } from '../../visualizations/_chart'; -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import { Chart } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/_chart'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib _chart Test Suite', function() { let vis; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/column_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js similarity index 88% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/column_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js index 2216294fcbac11..02bba88eae3a57 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/column_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js @@ -22,18 +22,23 @@ import d3 from 'd3'; import $ from 'jquery'; import expect from '@kbn/expect'; +/* eslint-disable @kbn/eslint/no-restricted-paths */ + // Data -import series from '../lib/fixtures/mock_data/date_histogram/_series'; -import seriesPosNeg from '../lib/fixtures/mock_data/date_histogram/_series_pos_neg'; -import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg'; -import termsColumns from '../lib/fixtures/mock_data/terms/_columns'; -import histogramRows from '../lib/fixtures/mock_data/histogram/_rows'; -import stackedSeries from '../lib/fixtures/mock_data/date_histogram/_stacked_series'; - -import { seriesMonthlyInterval } from '../lib/fixtures/mock_data/date_histogram/_series_monthly_interval'; -import { rowsSeriesWithHoles } from '../lib/fixtures/mock_data/date_histogram/_rows_series_with_holes'; -import rowsWithZeros from '../lib/fixtures/mock_data/date_histogram/_rows'; -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; +import histogramRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows'; +import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; + +import { seriesMonthlyInterval } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval'; +import { rowsSeriesWithHoles } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes'; +import rowsWithZeros from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; // tuple, with the format [description, mode, data] const dataTypesArray = [ diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/gauge_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/gauge_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js index fe25734fcbfde5..fa36facb374b0d 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/gauge_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js @@ -17,12 +17,17 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import $ from 'jquery'; import _ from 'lodash'; import expect from '@kbn/expect'; -import data from '../lib/fixtures/mock_data/terms/_seriesMultiple'; -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; describe('Vislib Gauge Chart Test Suite', function() { let vis; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/heatmap_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js similarity index 88% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/heatmap_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js index f4c952be191deb..e8519f31e0f74f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/heatmap_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js @@ -17,19 +17,24 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import _ from 'lodash'; import $ from 'jquery'; import d3 from 'd3'; import expect from '@kbn/expect'; // Data -import series from '../lib/fixtures/mock_data/date_histogram/_series'; -import seriesPosNeg from '../lib/fixtures/mock_data/date_histogram/_series_pos_neg'; -import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg'; -import termsColumns from '../lib/fixtures/mock_data/terms/_columns'; -import stackedSeries from '../lib/fixtures/mock_data/date_histogram/_stacked_series'; - -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; +import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; + +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; // tuple, with the format [description, mode, data] const dataTypesArray = [ diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/line_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js similarity index 88% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/line_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js index 1269fe7bcf62e9..c9718b78972c08 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/line_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js @@ -17,20 +17,25 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; import _ from 'lodash'; // Data -import seriesPos from '../lib/fixtures/mock_data/date_histogram/_series'; -import seriesPosNeg from '../lib/fixtures/mock_data/date_histogram/_series_pos_neg'; -import seriesNeg from '../lib/fixtures/mock_data/date_histogram/_series_neg'; -import histogramColumns from '../lib/fixtures/mock_data/histogram/_columns'; -import rangeRows from '../lib/fixtures/mock_data/range/_rows'; -import termSeries from '../lib/fixtures/mock_data/terms/_series'; - -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import seriesPos from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +import histogramColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns'; +import rangeRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'; +import termSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series'; + +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; const dataTypes = [ ['series pos', seriesPos], diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js index caafb2c636271a..da53122b1317c9 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js @@ -17,12 +17,17 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; +import { + getVis, + getMockUiState, +} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; const names = ['rows', 'columns', 'slices']; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart_mock_data.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart_mock_data.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart_mock_data.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart_mock_data.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/time_marker.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js similarity index 91% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/time_marker.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js index d69f952325ed02..fa1658f39b3a91 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/time_marker.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js @@ -17,13 +17,15 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import d3 from 'd3'; import $ from 'jquery'; import expect from '@kbn/expect'; -import series from '../lib/fixtures/mock_data/date_histogram/_series'; -import terms from '../lib/fixtures/mock_data/terms/_columns'; -import { TimeMarker } from '../../visualizations/time_marker'; +import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +import terms from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; +import { TimeMarker } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/time_marker'; describe('Vislib Time Marker Test Suite', function() { const height = 50; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/vis_types.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js similarity index 87% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/vis_types.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js index c8f0faf8dcca5d..3a209eddb0f746 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/vis_types.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js @@ -17,10 +17,12 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + import _ from 'lodash'; import expect from '@kbn/expect'; -import { visTypes } from '../../visualizations/vis_types'; +import { visTypes } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/vis_types'; describe('Vislib Vis Types Test Suite', function() { let visFunc; diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index d49c59970f521d..aa933302367533 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -7,8 +7,9 @@ // Public UI styles @import 'src/legacy/ui/public/index'; -// vis_type_vislib UI styles -@import 'src/legacy/core_plugins/vis_type_vislib/public/index'; +// vis_type_vislib UI styles are imported here for running karma Browser tests +// should be somehow included through the "vis_type_vislib" plugin initialization +@import '../../../../plugins/vis_type_vislib/public/index'; // Discover styles @import 'discover/index'; diff --git a/src/legacy/core_plugins/vis_type_vislib/index.ts b/src/legacy/core_plugins/vis_type_vislib/index.ts deleted file mode 100644 index da9476285a9b2e..00000000000000 --- a/src/legacy/core_plugins/vis_type_vislib/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { LegacyPluginApi, LegacyPluginInitializer } from '../../types'; - -const visTypeVislibPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => - new Plugin({ - id: 'vis_type_vislib', - require: ['kibana', 'elasticsearch', 'interpreter'], - publicDir: resolve(__dirname, 'public'), - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - uiExports: { - hacks: [resolve(__dirname, 'public/legacy')], - injectDefaultVars: server => ({}), - }, - init: (server: Legacy.Server) => ({}), - config(Joi: any) { - return Joi.object({ - enabled: Joi.boolean().default(true), - }).default(); - }, - } as Legacy.PluginSpecOptions); - -// eslint-disable-next-line import/no-default-export -export default visTypeVislibPluginInitializer; diff --git a/src/legacy/core_plugins/vis_type_vislib/package.json b/src/legacy/core_plugins/vis_type_vislib/package.json deleted file mode 100644 index e30a9e2b358342..00000000000000 --- a/src/legacy/core_plugins/vis_type_vislib/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "vis_type_vislib", - "version": "kibana" -} diff --git a/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts b/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts deleted file mode 100644 index 579caa1cb88f67..00000000000000 --- a/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 { npSetup, npStart } from 'ui/new_platform'; -import { PluginInitializerContext } from 'kibana/public'; - -import { plugin } from '.'; -import { - VisTypeVislibPluginSetupDependencies, - VisTypeVislibPluginStartDependencies, -} from './plugin'; - -const setupPlugins: Readonly = { - expressions: npSetup.plugins.expressions, - visualizations: npSetup.plugins.visualizations, - charts: npSetup.plugins.charts, - visTypeXy: npSetup.plugins.visTypeXy, -}; - -const startPlugins: Readonly = { - data: npStart.plugins.data, -}; - -const pluginInstance = plugin({} as PluginInitializerContext); - -export const setup = pluginInstance.setup(npSetup.core, setupPlugins); -export const start = pluginInstance.start(npStart.core, startPlugins); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/point_series.js b/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/point_series.js deleted file mode 100644 index 03646d08298dd6..00000000000000 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/point_series.js +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 '@kbn/expect'; - -import percentileTestdata from './testdata_linechart_percentile.json'; -import percentileTestdataResult from './testdata_linechart_percentile_result.json'; - -import { vislibPointSeriesTypes as pointSeriesConfig } from '../../../lib/types/point_series'; - -describe('Point Series Config Type Class Test Suite', function() { - let parsedConfig; - const histogramConfig = { - type: 'histogram', - addLegend: true, - tooltip: { - show: true, - }, - categoryAxes: [ - { - id: 'CategoryAxis-1', - type: 'category', - title: {}, - }, - ], - valueAxes: [ - { - id: 'ValueAxis-1', - type: 'value', - labels: {}, - title: {}, - }, - ], - }; - - const data = { - get: prop => { - return data[prop] || data.data[prop] || null; - }, - getLabels: () => [], - data: { - hits: 621, - ordered: { - date: true, - interval: 30000, - max: 1408734982458, - min: 1408734082458, - }, - series: [ - { label: 's1', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's2', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's3', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's4', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's5', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's6', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's7', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's8', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's9', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's10', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's11', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's12', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's13', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's14', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's15', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's16', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's17', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's18', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's19', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's20', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's21', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's22', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's23', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's24', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's25', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's26', values: [{ x: 1408734060000, y: 8 }] }, - ], - xAxisLabel: 'Date Histogram', - yAxisLabel: 'series', - yAxisFormatter: () => 'test', - }, - }; - - describe('histogram chart', function() { - beforeEach(function() { - parsedConfig = pointSeriesConfig.column(histogramConfig, data); - }); - it('should not throw an error when more than 25 series are provided', function() { - expect(parsedConfig.error).to.be.undefined; - }); - - it('should set axis title and formatter from data', () => { - expect(parsedConfig.categoryAxes[0].title.text).to.equal(data.data.xAxisLabel); - expect(parsedConfig.valueAxes[0].labels.axisFormatter).to.not.be.undefined; - }); - }); - - describe('line chart', function() { - beforeEach(function() { - const percentileDataObj = { - get: prop => { - return data[prop] || data.data[prop] || null; - }, - getLabels: () => [], - data: percentileTestdata.data, - }; - parsedConfig = pointSeriesConfig.line(percentileTestdata.cfg, percentileDataObj); - }); - it('should render a percentile line chart', function() { - expect(JSON.stringify(parsedConfig)).to.eql(JSON.stringify(percentileTestdataResult)); - }); - }); -}); diff --git a/src/plugins/vis_type_vislib/kibana.json b/src/plugins/vis_type_vislib/kibana.json new file mode 100644 index 00000000000000..5b3088b399ebff --- /dev/null +++ b/src/plugins/vis_type_vislib/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "visTypeVislib", + "version": "kibana", + "server": true, + "ui": true, + "requiredPlugins": ["charts", "data", "expressions", "visualizations"], + "optionalPlugins": ["visTypeXy"] +} diff --git a/src/legacy/core_plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap b/src/plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap rename to src/plugins/vis_type_vislib/public/__snapshots__/pie_fn.test.ts.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/area.ts b/src/plugins/vis_type_vislib/public/area.ts similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/area.ts rename to src/plugins/vis_type_vislib/public/area.ts index 8a196da64fc4bc..c42962ad50a4b0 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/area.ts +++ b/src/plugins/vis_type_vislib/public/area.ts @@ -23,8 +23,8 @@ import { palettes } from '@elastic/eui/lib/services'; // @ts-ignore import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; import { Positions, ChartTypes, @@ -39,7 +39,7 @@ import { import { getAreaOptionTabs, countLabel } from './utils/common_config'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; -import { Rotates } from '../../../../plugins/charts/public'; +import { Rotates } from '../../charts/public'; export const createAreaVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'area', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/index.ts b/src/plugins/vis_type_vislib/public/components/common/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/common/index.ts rename to src/plugins/vis_type_vislib/public/components/common/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/truncate_labels.tsx b/src/plugins/vis_type_vislib/public/components/common/truncate_labels.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/common/truncate_labels.tsx rename to src/plugins/vis_type_vislib/public/components/common/truncate_labels.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx b/src/plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx rename to src/plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/index.ts b/src/plugins/vis_type_vislib/public/components/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/index.ts rename to src/plugins/vis_type_vislib/public/components/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx b/src/plugins/vis_type_vislib/public/components/options/gauge/index.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx rename to src/plugins/vis_type_vislib/public/components/options/gauge/index.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx index 3fca9dc8adc08e..0bd5694f710213 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/gauge/labels_panel.tsx @@ -22,8 +22,8 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SwitchOption, TextInputOption } from '../../../../../../../plugins/charts/public'; -import { GaugeOptionsInternalProps } from '.'; +import { SwitchOption, TextInputOption } from '../../../../../charts/public'; +import { GaugeOptionsInternalProps } from '../gauge'; function LabelsPanel({ stateParams, setValue, setGaugeValue }: GaugeOptionsInternalProps) { return ( diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx index 433cc4edeb47b3..c297fb08e4b68b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/gauge/ranges_panel.tsx @@ -29,8 +29,8 @@ import { SetColorRangeValue, SwitchOption, ColorSchemas, -} from '../../../../../../../plugins/charts/public'; -import { GaugeOptionsInternalProps } from '.'; +} from '../../../../../charts/public'; +import { GaugeOptionsInternalProps } from '../gauge'; import { Gauge } from '../../../gauge'; function RangesPanel({ diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx similarity index 91% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx index 48711de7d171af..b299b2e86ca403 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/gauge/style_panel.tsx @@ -22,9 +22,9 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SelectOption } from '../../../../../../../plugins/charts/public'; -import { GaugeOptionsInternalProps } from '.'; -import { AggGroupNames } from '../../../../../../../plugins/data/public'; +import { SelectOption } from '../../../../../charts/public'; +import { GaugeOptionsInternalProps } from '../gauge'; +import { AggGroupNames } from '../../../../../data/public'; function StylePanel({ aggs, setGaugeValue, stateParams, vis }: GaugeOptionsInternalProps) { const diasableAlignment = diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx b/src/plugins/vis_type_vislib/public/components/options/heatmap/index.tsx similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx rename to src/plugins/vis_type_vislib/public/components/options/heatmap/index.tsx index dc207ad89286f2..7a89496d9441e8 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/heatmap/index.tsx @@ -33,7 +33,7 @@ import { SwitchOption, SetColorSchemaOptionsValue, SetColorRangeValue, -} from '../../../../../../../plugins/charts/public'; +} from '../../../../../charts/public'; import { HeatmapVisParams } from '../../../heatmap'; import { ValueAxis } from '../../../types'; import { LabelsPanel } from './labels_panel'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx index 3d1629740df2c8..8d5f529ce0fc76 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx @@ -26,7 +26,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { ValueAxis } from '../../../types'; import { HeatmapVisParams } from '../../../heatmap'; -import { SwitchOption } from '../../../../../../../plugins/charts/public'; +import { SwitchOption } from '../../../../../charts/public'; const VERTICAL_ROTATION = 270; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/index.ts b/src/plugins/vis_type_vislib/public/components/options/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/index.ts rename to src/plugins/vis_type_vislib/public/components/options/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/category_axis_panel.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/chart_options.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/custom_extents_options.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/index.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/index.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/index.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/index.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/label_options.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/line_options.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axes_panel.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/value_axis_options.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/__snapshots__/y_extents.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx index 91cdcd0f456b15..44ed0d5aeddabd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.test.tsx @@ -25,8 +25,6 @@ import { Positions } from '../../../utils/collections'; import { LabelOptions } from './label_options'; import { categoryAxis, vis } from './mocks'; -jest.mock('ui/new_platform'); - describe('CategoryAxisPanel component', () => { let setCategoryAxis: jest.Mock; let onPositionChanged: jest.Mock; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx index 246c20a14807c5..468fb1f8c315af 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx @@ -25,7 +25,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { Axis } from '../../../types'; -import { SelectOption, SwitchOption } from '../../../../../../../plugins/charts/public'; +import { SelectOption, SwitchOption } from '../../../../../charts/public'; import { LabelOptions, SetAxisLabel } from './label_options'; import { Positions } from '../../../utils/collections'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx index c913fd4f35713d..e2d4a0db9f1f9c 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.test.tsx @@ -25,8 +25,6 @@ import { LineOptions } from './line_options'; import { ChartTypes, ChartModes } from '../../../utils/collections'; import { valueAxis, seriesParam, vis } from './mocks'; -jest.mock('ui/new_platform'); - describe('ChartOptions component', () => { let setParamByIndex: jest.Mock; let changeValueAxis: jest.Mock; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx index 89aab3a19c5897..623a8d1f348e93 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx @@ -22,12 +22,12 @@ import React, { useMemo, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { SeriesParam, ValueAxis } from '../../../types'; import { ChartTypes } from '../../../utils/collections'; -import { SelectOption } from '../../../../../../../plugins/charts/public'; +import { SelectOption } from '../../../../../charts/public'; import { LineOptions } from './line_options'; -import { SetParamByIndex, ChangeValueAxis } from './'; +import { SetParamByIndex, ChangeValueAxis } from '.'; export type SetChart = (paramName: T, value: SeriesParam[T]) => void; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx index a93ee454a7afd1..4798c67928f7f6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.test.tsx @@ -28,8 +28,6 @@ const DEFAULT_Y_EXTENTS = 'defaultYExtents'; const SCALE = 'scale'; const SET_Y_EXTENTS = 'setYExtents'; -jest.mock('ui/new_platform'); - describe('CustomExtentsOptions component', () => { let setValueAxis: jest.Mock; let setValueAxisScale: jest.Mock; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx index a3a97df9e35ae2..634d6b3f0641cd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/custom_extents_options.tsx @@ -21,7 +21,7 @@ import React, { useCallback, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { ValueAxis } from '../../../types'; -import { NumberInputOption, SwitchOption } from '../../../../../../../plugins/charts/public'; +import { NumberInputOption, SwitchOption } from '../../../../../charts/public'; import { YExtents } from './y_extents'; import { SetScale } from './value_axis_options'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.test.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/index.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx index 48fcbdf8f9082e..f500b7e58e9fdb 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.test.tsx @@ -23,8 +23,6 @@ import { LabelOptions, LabelOptionsProps } from './label_options'; import { TruncateLabelsOption } from '../../common'; import { valueAxis } from './mocks'; -jest.mock('ui/new_platform'); - const FILTER = 'filter'; const ROTATE = 'rotate'; const DISABLED = 'disabled'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx index bc687e56646f63..14e1da6ebcc701 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/label_options.tsx @@ -26,7 +26,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { Axis } from '../../../types'; import { TruncateLabelsOption } from '../../common'; import { getRotateOptions } from '../../../utils/collections'; -import { SelectOption, SwitchOption } from '../../../../../../../plugins/charts/public'; +import { SelectOption, SwitchOption } from '../../../../../charts/public'; export type SetAxisLabel = ( paramName: T, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx index 5354bc9c033e6e..e90c96146ec2cd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.test.tsx @@ -20,11 +20,9 @@ import React from 'react'; import { shallow } from 'enzyme'; import { LineOptions, LineOptionsParams } from './line_options'; -import { NumberInputOption } from '../../../../../../../plugins/charts/public'; +import { NumberInputOption } from '../../../../../charts/public'; import { seriesParam, vis } from './mocks'; -jest.mock('ui/new_platform'); - const LINE_WIDTH = 'lineWidth'; const DRAW_LINES = 'drawLinesBetweenPoints'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx index 76f95bd93caf8c..4b0cce94267f12 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx @@ -22,13 +22,9 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { SeriesParam } from '../../../types'; -import { - NumberInputOption, - SelectOption, - SwitchOption, -} from '../../../../../../../plugins/charts/public'; +import { NumberInputOption, SelectOption, SwitchOption } from '../../../../../charts/public'; import { SetChart } from './chart_options'; export interface LineOptionsParams { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts index a296281375daca..277fcf0cdbc3de 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { Axis, ValueAxis, SeriesParam } from '../../../types'; import { ChartTypes, @@ -31,7 +31,7 @@ import { getPositions, getInterpolationModes, } from '../../../utils/collections'; -import { Style } from '../../../../../../../plugins/charts/public'; +import { Style } from '../../../../../charts/public'; const defaultValueAxisId = 'ValueAxis-1'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx index 22a726b53363b0..27c423860972c0 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx @@ -23,10 +23,10 @@ import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { ValueAxis, SeriesParam } from '../../../types'; import { ChartOptions } from './chart_options'; -import { SetParamByIndex, ChangeValueAxis } from './'; +import { SetParamByIndex, ChangeValueAxis } from '.'; export interface SeriesPanelProps { changeValueAxis: ChangeValueAxis; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/utils.ts b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/utils.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/utils.ts rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/utils.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx index 141273fa6bc3f8..2f7dd4071b52cd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.test.tsx @@ -25,8 +25,6 @@ import { Positions } from '../../../utils/collections'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { valueAxis, seriesParam, vis } from './mocks'; -jest.mock('ui/new_platform'); - describe('ValueAxesPanel component', () => { let setParamByIndex: jest.Mock; let onValueAxisPositionChanged: jest.Mock; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx index 912c3b904b110b..b17f67b81d2b04 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx @@ -31,10 +31,10 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { SeriesParam, ValueAxis } from '../../../types'; import { ValueAxisOptions } from './value_axis_options'; -import { SetParamByIndex } from './'; +import { SetParamByIndex } from '.'; export interface ValueAxesPanelProps { isCategoryAxisHorizontal: boolean; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx index 876a6917ee0b4c..1977bdba6eadfc 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.test.tsx @@ -21,13 +21,11 @@ import React from 'react'; import { shallow } from 'enzyme'; import { ValueAxisOptions, ValueAxisOptionsParams } from './value_axis_options'; import { ValueAxis } from '../../../types'; -import { TextInputOption } from '../../../../../../../plugins/charts/public'; +import { TextInputOption } from '../../../../../charts/public'; import { LabelOptions } from './label_options'; import { ScaleTypes, Positions } from '../../../utils/collections'; import { valueAxis, vis } from './mocks'; -jest.mock('ui/new_platform'); - const POSITION = 'position'; interface PositionOption { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx index 1b89a766d05913..52962fe813b446 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx @@ -21,18 +21,14 @@ import React, { useCallback, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiAccordion, EuiHorizontalRule } from '@elastic/eui'; -import { Vis } from '../../../../../../../plugins/visualizations/public'; +import { Vis } from '../../../../../visualizations/public'; import { ValueAxis } from '../../../types'; import { Positions } from '../../../utils/collections'; -import { - SelectOption, - SwitchOption, - TextInputOption, -} from '../../../../../../../plugins/charts/public'; +import { SelectOption, SwitchOption, TextInputOption } from '../../../../../charts/public'; import { LabelOptions, SetAxisLabel } from './label_options'; import { CustomExtentsOptions } from './custom_extents_options'; import { isAxisHorizontal } from './utils'; -import { SetParamByIndex } from './'; +import { SetParamByIndex } from '.'; export type SetScale = ( paramName: T, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx index b5ed475ca8e319..3bacb0be34d135 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.test.tsx @@ -21,9 +21,7 @@ import React from 'react'; import { mount, shallow } from 'enzyme'; import { YExtents, YExtentsProps } from './y_extents'; import { ScaleTypes } from '../../../utils/collections'; -import { NumberInputOption } from '../../../../../../../plugins/charts/public'; - -jest.mock('ui/new_platform'); +import { NumberInputOption } from '../../../../../charts/public'; describe('YExtents component', () => { let setMultipleValidity: jest.Mock; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx rename to src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx index faeb6069b51264..c2aa917dd3a6f6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/metrics_axes/y_extents.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { Scale } from '../../../types'; import { ScaleTypes } from '../../../utils/collections'; -import { NumberInputOption } from '../../../../../../../plugins/charts/public'; +import { NumberInputOption } from '../../../../../charts/public'; import { SetScale } from './value_axis_options'; const rangeError = i18n.translate('visTypeVislib.controls.pointSeries.valueAxes.minErrorMessage', { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx b/src/plugins/vis_type_vislib/public/components/options/pie.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx rename to src/plugins/vis_type_vislib/public/components/options/pie.tsx index f6be9cd0bd8fed..54ba307982967e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/pie.tsx @@ -24,7 +24,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { TruncateLabelsOption } from '../common'; -import { BasicOptions, SwitchOption } from '../../../../../../plugins/charts/public'; +import { BasicOptions, SwitchOption } from '../../../../charts/public'; import { PieVisParams } from '../../pie'; function PieOptions(props: VisOptionsProps) { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx index 392d180d2c5f26..0126dce37c9f24 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; -import { SelectOption, SwitchOption } from '../../../../../../../plugins/charts/public'; +import { SelectOption, SwitchOption } from '../../../../../charts/public'; import { BasicVislibParams, ValueAxis } from '../../../types'; function GridPanel({ stateParams, setValue, hasHistogramAgg }: VisOptionsProps) { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/index.ts b/src/plugins/vis_type_vislib/public/components/options/point_series/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/index.ts rename to src/plugins/vis_type_vislib/public/components/options/point_series/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx b/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx rename to src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx index 903c1917751d9e..60458b1f5c41f0 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/point_series/point_series.tsx @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { ValidationVisOptionsProps } from '../../common'; -import { BasicOptions, SwitchOption } from '../../../../../../../plugins/charts/public'; +import { BasicOptions, SwitchOption } from '../../../../../charts/public'; import { GridPanel } from './grid_panel'; import { ThresholdPanel } from './threshold_panel'; import { BasicVislibParams } from '../../../types'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx b/src/plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx rename to src/plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx index 12f058ec7dd1fc..08231803007563 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx +++ b/src/plugins/vis_type_vislib/public/components/options/point_series/threshold_panel.tsx @@ -26,7 +26,7 @@ import { SelectOption, SwitchOption, RequiredNumberInputOption, -} from '../../../../../../../plugins/charts/public'; +} from '../../../../../charts/public'; import { BasicVislibParams } from '../../../types'; function ThresholdPanel({ diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/_vis_fixture.js b/src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js similarity index 92% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/_vis_fixture.js rename to src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js index 05cea7addf560d..9f871dd0d2f7d6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/_vis_fixture.js +++ b/src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js @@ -20,13 +20,20 @@ import _ from 'lodash'; import $ from 'jquery'; -import { Vis } from '../../../vis'; +import { Vis } from '../vislib/vis'; // TODO: Remove when converted to jest mocks import { ColorsService, // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../../../../../plugins/charts/public/services'; +} from '../../../charts/public/services'; +import { setFormatService } from '../services'; + +setFormatService({ + deserialize: () => ({ + convert: v => v, + }), +}); const $visCanvas = $('
') .attr('id', 'vislib-vis-fixtures') diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_config_normal.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_normal.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_config_normal.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_normal.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_config_percentage.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_percentage.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_config_percentage.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_config_percentage.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_d3.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_d3.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_d3.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_d3.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_data_point.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_data_point.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_bar_chart_data_point.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_bar_chart_data_point.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_config.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_config.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_config.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_config.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_d3.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_d3.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_d3.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_d3.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_data_point.json b/src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_data_point.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/dispatch_heatmap_data_point.json rename to src/plugins/vis_type_vislib/public/fixtures/dispatch_heatmap_data_point.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_rows_series_with_holes.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_rows_series_with_holes.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_monthly_interval.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_monthly_interval.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_neg.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_neg.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_pos_neg.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_series_pos_neg.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_stacked_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/date_histogram/_stacked_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/filters/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_geo_json.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_geo_json.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/geohash/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_slices.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/histogram/_slices.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/not_enough_data/_one_point.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/not_enough_data/_one_point.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/range/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/significant_terms/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/stacked/_stacked.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/stacked/_stacked.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_columns.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_rows.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_series.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_seriesMultiple.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data/terms/_seriesMultiple.js rename to src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts b/src/plugins/vis_type_vislib/public/gauge.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/gauge.ts rename to src/plugins/vis_type_vislib/public/gauge.ts index 5e0b2b8fbd36cb..561c45d26fa7f6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts +++ b/src/plugins/vis_type_vislib/public/gauge.ts @@ -19,17 +19,11 @@ import { i18n } from '@kbn/i18n'; -import { RangeValues, Schemas } from '../../../../plugins/vis_default_editor/public'; -import { AggGroupNames } from '../../../../plugins/data/public'; +import { RangeValues, Schemas } from '../../vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; import { GaugeOptions } from './components/options'; import { getGaugeCollections, Alignments, GaugeTypes } from './utils/collections'; -import { - ColorModes, - ColorSchemas, - ColorSchemaParams, - Labels, - Style, -} from '../../../../plugins/charts/public'; +import { ColorModes, ColorSchemas, ColorSchemaParams, Labels, Style } from '../../charts/public'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/goal.ts b/src/plugins/vis_type_vislib/public/goal.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/goal.ts rename to src/plugins/vis_type_vislib/public/goal.ts index 0f70dca69728d2..5f74698938a0b1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/goal.ts +++ b/src/plugins/vis_type_vislib/public/goal.ts @@ -23,9 +23,9 @@ import { GaugeOptions } from './components/options'; import { getGaugeCollections, GaugeTypes } from './utils/collections'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; -import { ColorModes, ColorSchemas } from '../../../../plugins/charts/public'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { ColorModes, ColorSchemas } from '../../charts/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; export const createGoalVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'goal', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts b/src/plugins/vis_type_vislib/public/heatmap.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts rename to src/plugins/vis_type_vislib/public/heatmap.ts index 9feed60b984bae..ced7a38568ffd0 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts +++ b/src/plugins/vis_type_vislib/public/heatmap.ts @@ -19,15 +19,15 @@ import { i18n } from '@kbn/i18n'; -import { RangeValues, Schemas } from '../../../../plugins/vis_default_editor/public'; -import { AggGroupNames } from '../../../../plugins/data/public'; +import { RangeValues, Schemas } from '../../vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; import { AxisTypes, getHeatmapCollections, Positions, ScaleTypes } from './utils/collections'; import { HeatmapOptions } from './components/options'; import { createVislibVisController } from './vis_controller'; import { TimeMarker } from './vislib/visualizations/time_marker'; import { CommonVislibParams, ValueAxis } from './types'; import { VisTypeVislibDependencies } from './plugin'; -import { ColorSchemas, ColorSchemaParams } from '../../../../plugins/charts/public'; +import { ColorSchemas, ColorSchemaParams } from '../../charts/public'; export interface HeatmapVisParams extends CommonVislibParams, ColorSchemaParams { type: 'heatmap'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts b/src/plugins/vis_type_vislib/public/histogram.ts similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/histogram.ts rename to src/plugins/vis_type_vislib/public/histogram.ts index 54ccf66f362ca3..52242ad11e8f58 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts +++ b/src/plugins/vis_type_vislib/public/histogram.ts @@ -23,8 +23,8 @@ import { palettes } from '@elastic/eui/lib/services'; // @ts-ignore import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; import { Positions, ChartTypes, @@ -38,7 +38,7 @@ import { import { getAreaOptionTabs, countLabel } from './utils/common_config'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; -import { Rotates } from '../../../../plugins/charts/public'; +import { Rotates } from '../../charts/public'; export const createHistogramVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'histogram', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts b/src/plugins/vis_type_vislib/public/horizontal_bar.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts rename to src/plugins/vis_type_vislib/public/horizontal_bar.ts index 6f732717266601..a58c15f136431e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts +++ b/src/plugins/vis_type_vislib/public/horizontal_bar.ts @@ -19,12 +19,10 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore -import { palettes } from '@elastic/eui/lib/services'; -// @ts-ignore -import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; +import { palettes, euiPaletteColorBlind } from '@elastic/eui/lib/services'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; import { Positions, ChartTypes, @@ -38,7 +36,7 @@ import { import { getAreaOptionTabs, countLabel } from './utils/common_config'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; -import { Rotates } from '../../../../plugins/charts/public'; +import { Rotates } from '../../charts/public'; export const createHorizontalBarVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'horizontal_bar', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/_index.scss b/src/plugins/vis_type_vislib/public/index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/_index.scss rename to src/plugins/vis_type_vislib/public/index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/index.ts b/src/plugins/vis_type_vislib/public/index.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/index.ts rename to src/plugins/vis_type_vislib/public/index.ts index 4d7091ffb204be..665643a6763f6b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/index.ts +++ b/src/plugins/vis_type_vislib/public/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { PluginInitializerContext } from '../../../../core/public'; +import { PluginInitializerContext } from '../../../core/public'; import { VisTypeVislibPlugin as Plugin } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/line.ts b/src/plugins/vis_type_vislib/public/line.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/line.ts rename to src/plugins/vis_type_vislib/public/line.ts index 1f9a8d77398e63..a94fd3f3945ab7 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/line.ts +++ b/src/plugins/vis_type_vislib/public/line.ts @@ -19,12 +19,10 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore -import { palettes } from '@elastic/eui/lib/services'; -// @ts-ignore -import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; +import { palettes, euiPaletteColorBlind } from '@elastic/eui/lib/services'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; import { Positions, ChartTypes, @@ -39,7 +37,7 @@ import { import { getAreaOptionTabs, countLabel } from './utils/common_config'; import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; -import { Rotates } from '../../../../plugins/charts/public'; +import { Rotates } from '../../charts/public'; export const createLineVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'line', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/pie.ts b/src/plugins/vis_type_vislib/public/pie.ts similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/pie.ts rename to src/plugins/vis_type_vislib/public/pie.ts index 2774836baa3817..a68bc5893406f5 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/pie.ts +++ b/src/plugins/vis_type_vislib/public/pie.ts @@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n'; -import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../../../plugins/vis_default_editor/public'; +import { AggGroupNames } from '../../data/public'; +import { Schemas } from '../../vis_default_editor/public'; import { PieOptions } from './components/options'; import { getPositions, Positions } from './utils/collections'; import { createVislibVisController } from './vis_controller'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/pie_fn.test.ts b/src/plugins/vis_type_vislib/public/pie_fn.test.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/pie_fn.test.ts rename to src/plugins/vis_type_vislib/public/pie_fn.test.ts index 15c80e47194872..a8c03eba2b4499 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/pie_fn.test.ts +++ b/src/plugins/vis_type_vislib/public/pie_fn.test.ts @@ -18,12 +18,11 @@ */ // eslint-disable-next-line -import { functionWrapper } from '../../../../plugins/expressions/common/expression_functions/specs/tests/utils'; +import { functionWrapper } from '../../expressions/common/expression_functions/specs/tests/utils'; import { createPieVisFn } from './pie_fn'; // @ts-ignore import { vislibSlicesResponseHandler } from './vislib/response_handler'; -jest.mock('ui/new_platform'); jest.mock('./vislib/response_handler', () => ({ vislibSlicesResponseHandler: jest.fn().mockReturnValue({ hits: 1, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/pie_fn.ts b/src/plugins/vis_type_vislib/public/pie_fn.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/pie_fn.ts rename to src/plugins/vis_type_vislib/public/pie_fn.ts index 452e0be0df3e4a..52da0f7ac14eca 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/pie_fn.ts +++ b/src/plugins/vis_type_vislib/public/pie_fn.ts @@ -18,11 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { - ExpressionFunctionDefinition, - KibanaDatatable, - Render, -} from '../../../../plugins/expressions/public'; +import { ExpressionFunctionDefinition, KibanaDatatable, Render } from '../../expressions/public'; // @ts-ignore import { vislibSlicesResponseHandler } from './vislib/response_handler'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts b/src/plugins/vis_type_vislib/public/plugin.ts similarity index 92% rename from src/legacy/core_plugins/vis_type_vislib/public/plugin.ts rename to src/plugins/vis_type_vislib/public/plugin.ts index ef3f664252856e..f3380e20bac060 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts +++ b/src/plugins/vis_type_vislib/public/plugin.ts @@ -16,6 +16,9 @@ * specific language governing permissions and limitations * under the License. */ + +import './index.scss'; + import { CoreSetup, CoreStart, @@ -25,8 +28,8 @@ import { } from 'kibana/public'; import { VisTypeXyPluginSetup } from 'src/plugins/vis_type_xy/public'; -import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; +import { Plugin as ExpressionsPublicPlugin } from '../../expressions/public'; +import { VisualizationsSetup } from '../../visualizations/public'; import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn'; import { createPieVisFn } from './pie_fn'; import { @@ -39,8 +42,8 @@ import { createGaugeVisTypeDefinition, createGoalVisTypeDefinition, } from './vis_type_vislib_vis_types'; -import { ChartsPluginSetup } from '../../../../plugins/charts/public'; -import { DataPublicPluginStart } from '../../../../plugins/data/public'; +import { ChartsPluginSetup } from '../../charts/public'; +import { DataPublicPluginStart } from '../../data/public'; import { setFormatService, setDataActions } from './services'; export interface VisTypeVislibDependencies { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/services.ts b/src/plugins/vis_type_vislib/public/services.ts similarity index 87% rename from src/legacy/core_plugins/vis_type_vislib/public/services.ts rename to src/plugins/vis_type_vislib/public/services.ts index 0d6b1b5e8de589..633fae9c7f2a61 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/services.ts +++ b/src/plugins/vis_type_vislib/public/services.ts @@ -17,8 +17,8 @@ * under the License. */ -import { createGetterSetter } from '../../../../plugins/kibana_utils/public'; -import { DataPublicPluginStart } from '../../../../plugins/data/public'; +import { createGetterSetter } from '../../kibana_utils/public'; +import { DataPublicPluginStart } from '../../data/public'; export const [getDataActions, setDataActions] = createGetterSetter< DataPublicPluginStart['actions'] diff --git a/src/legacy/core_plugins/vis_type_vislib/public/types.ts b/src/plugins/vis_type_vislib/public/types.ts similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/types.ts rename to src/plugins/vis_type_vislib/public/types.ts index 25c6ae5439fe85..83d0b49b1c5518 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/types.ts +++ b/src/plugins/vis_type_vislib/public/types.ts @@ -28,7 +28,7 @@ import { ScaleTypes, ThresholdLineStyles, } from './utils/collections'; -import { Labels, Style } from '../../../../plugins/charts/public'; +import { Labels, Style } from '../../charts/public'; export interface CommonVislibParams { addTooltip: boolean; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/utils/collections.ts b/src/plugins/vis_type_vislib/public/utils/collections.ts similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/utils/collections.ts rename to src/plugins/vis_type_vislib/public/utils/collections.ts index 2024c43dd1c8b4..44df4864bfd68c 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/utils/collections.ts +++ b/src/plugins/vis_type_vislib/public/utils/collections.ts @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n'; import { $Values } from '@kbn/utility-types'; -import { colorSchemas, Rotates } from '../../../../../plugins/charts/public'; +import { colorSchemas, Rotates } from '../../../charts/public'; export const Positions = Object.freeze({ RIGHT: 'right' as 'right', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx b/src/plugins/vis_type_vislib/public/utils/common_config.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx rename to src/plugins/vis_type_vislib/public/utils/common_config.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx b/src/plugins/vis_type_vislib/public/vis_controller.tsx similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx rename to src/plugins/vis_type_vislib/public/vis_controller.tsx index ec091e5d29cfdf..65acc08b58da02 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/plugins/vis_type_vislib/public/vis_controller.tsx @@ -24,9 +24,9 @@ import React, { RefObject } from 'react'; import { Vis as Vislib } from './vislib/vis'; import { Positions } from './utils/collections'; import { VisTypeVislibDependencies } from './plugin'; -import { mountReactNode } from '../../../../core/public/utils'; +import { mountReactNode } from '../../../core/public/utils'; import { VisLegend, CUSTOM_LEGEND_VIS_TYPES } from './vislib/components/legend'; -import { VisParams, ExprVis } from '../../../../plugins/visualizations/public'; +import { VisParams, ExprVis } from '../../visualizations/public'; const legendClassName = { top: 'visLib--legend-top', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts b/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts similarity index 94% rename from src/legacy/core_plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts rename to src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts index 854b70b04e58a6..a4243c6d25c417 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts +++ b/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_fn.ts @@ -18,11 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { - ExpressionFunctionDefinition, - KibanaDatatable, - Render, -} from '../../../../plugins/expressions/public'; +import { ExpressionFunctionDefinition, KibanaDatatable, Render } from '../../expressions/public'; // @ts-ignore import { vislibSeriesResponseHandler } from './vislib/response_handler'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts b/src/plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts rename to src/plugins/vis_type_vislib/public/vis_type_vislib_vis_types.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/VISLIB.md b/src/plugins/vis_type_vislib/public/vislib/VISLIB.md similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/VISLIB.md rename to src/plugins/vis_type_vislib/public/vislib/VISLIB.md diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/_index.scss b/src/plugins/vis_type_vislib/public/vislib/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/_variables.scss b/src/plugins/vis_type_vislib/public/vislib/_variables.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/_variables.scss rename to src/plugins/vis_type_vislib/public/vislib/_variables.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss b/src/plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss rename to src/plugins/vis_type_vislib/public/vislib/_vislib_vis_type.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/data_array.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/data_array.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/data_array.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/data_array.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/flatten_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/index.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/index.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/labels.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/labels.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/labels.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/labels.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/labels.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js index db99b881a6e380..518406495df0d4 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/labels.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js @@ -20,10 +20,10 @@ import _ from 'lodash'; import expect from '@kbn/expect'; -import { labels } from '../../components/labels/labels'; -import { dataArray } from '../../components/labels/data_array'; -import { uniqLabels } from '../../components/labels/uniq_labels'; -import { flattenSeries as getSeries } from '../../components/labels/flatten_series'; +import { labels } from './labels'; +import { dataArray } from './data_array'; +import { uniqLabels } from './uniq_labels'; +import { flattenSeries as getSeries } from './flatten_series'; let seriesLabels; let rowsLabels; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/truncate_labels.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js rename to src/plugins/vis_type_vislib/public/vislib/components/labels/uniq_labels.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap b/src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap rename to src/plugins/vis_type_vislib/public/vislib/components/legend/__snapshots__/legend.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/_index.scss b/src/plugins/vis_type_vislib/public/vislib/components/legend/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/components/legend/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss b/src/plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss rename to src/plugins/vis_type_vislib/public/vislib/components/legend/_legend.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/index.ts b/src/plugins/vis_type_vislib/public/vislib/components/legend/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/index.ts rename to src/plugins/vis_type_vislib/public/vislib/components/legend/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx rename to src/plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx index c378ae7b05b376..0d480fe951e65c 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx +++ b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.test.tsx @@ -31,10 +31,6 @@ jest.mock('@elastic/eui', () => ({ htmlIdGenerator: jest.fn().mockReturnValue(() => 'legendId'), })); -jest.mock('../../../legacy_imports', () => ({ - getTableAggs: jest.fn(), -})); - jest.mock('../../../services', () => ({ getDataActions: () => ({ createFiltersFromEvent: jest.fn().mockResolvedValue(['yes']) }), })); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx rename to src/plugins/vis_type_vislib/public/vislib/components/legend/legend.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx b/src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx rename to src/plugins/vis_type_vislib/public/vislib/components/legend/legend_item.tsx diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/models.ts b/src/plugins/vis_type_vislib/public/vislib/components/legend/models.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/models.ts rename to src/plugins/vis_type_vislib/public/vislib/components/legend/models.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts b/src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts rename to src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts index d9eea83d40b48c..0167a542c6372e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts +++ b/src/plugins/vis_type_vislib/public/vislib/components/legend/pie_utils.ts @@ -25,7 +25,7 @@ import _ from 'lodash'; * * > Duplicated utilty method from vislib Data class to decouple `vislib_vis_legend` from `vislib` * - * @see src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/data.js + * @see src/plugins/vis_type_vislib/public/vislib/lib/data.js * * @returns {Array} Array of unique names (strings) */ diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_collect_branch.test.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_hierarchical_tooltip_formatter.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/_tooltip_formatter.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/_tooltip_formatter.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js index a3aabcb90be624..a836918551bcd8 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/_tooltip_formatter.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js @@ -21,7 +21,7 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { pointSeriesTooltipFormatter } from '../../components/tooltip'; +import { pointSeriesTooltipFormatter } from './_pointseries_tooltip_formatter'; describe('tooltipFormatter', function() { const tooltipFormatter = pointSeriesTooltipFormatter(); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/_tooltip.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/index.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/index.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/positioning.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/positioning.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js index f1c80c99810204..f8aabd230709f1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/components/positioning.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js @@ -22,7 +22,7 @@ import $ from 'jquery'; import _ from 'lodash'; import sinon from 'sinon'; -import { positionTooltip } from '../../components/tooltip/position_tooltip'; +import { positionTooltip } from './position_tooltip'; describe('Tooltip Positioning', function() { const sandbox = sinon.createSandbox(); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js rename to src/plugins/vis_type_vislib/public/vislib/components/tooltip/tooltip.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/flatten_data.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/inject_zeros.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/ordered_x_keys.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/uniq_keys.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_fill_data_array.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_filled_array.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js rename to src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/errors.ts b/src/plugins/vis_type_vislib/public/vislib/errors.ts similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/errors.ts rename to src/plugins/vis_type_vislib/public/vislib/errors.ts index 9014349c38d253..c2965e81657596 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/errors.ts +++ b/src/plugins/vis_type_vislib/public/vislib/errors.ts @@ -19,7 +19,7 @@ /* eslint-disable max-classes-per-file */ -import { KbnError } from '../../../../../plugins/kibana_utils/public'; +import { KbnError } from '../../../kibana_utils/public'; export class VislibError extends KbnError { constructor(message: string) { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts index 2c6d62ed084b57..c3b82f72af482e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts +++ b/src/plugins/vis_type_vislib/public/vislib/helpers/hierarchical/build_hierarchical_data.ts @@ -18,7 +18,7 @@ */ import { toArray } from 'lodash'; -import { SerializedFieldFormat } from '../../../../../../../plugins/expressions/common/types'; +import { SerializedFieldFormat } from '../../../../../expressions/common/types'; import { getFormatService } from '../../../services'; import { Table } from '../../types'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/index.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/index.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_add_to_siri.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_fake_x_aspect.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_aspects.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts index 0c79c5b263ceac..dc10c9f4938a0e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts +++ b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.test.ts @@ -17,7 +17,7 @@ * under the License. */ -import { IFieldFormatsRegistry } from '../../../../../../../plugins/data/common'; +import { IFieldFormatsRegistry } from '../../../../../data/common'; import { getPoint } from './_get_point'; import { setFormatService } from '../../../services'; import { Aspect } from './point_series'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_point.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_get_series.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_x_axis.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_init_y_axis.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/_ordered_date_axis.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/index.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts b/src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts rename to src/plugins/vis_type_vislib/public/vislib/helpers/point_series/point_series.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/index.js b/src/plugins/vis_type_vislib/public/vislib/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/index.js rename to src/plugins/vis_type_vislib/public/vislib/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/__snapshots__/dispatch_heatmap.test.js.snap b/src/plugins/vis_type_vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/__snapshots__/dispatch_heatmap.test.js.snap rename to src/plugins/vis_type_vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_alerts.scss b/src/plugins/vis_type_vislib/public/vislib/lib/_alerts.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_alerts.scss rename to src/plugins/vis_type_vislib/public/vislib/lib/_alerts.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_data_label.js b/src/plugins/vis_type_vislib/public/vislib/lib/_data_label.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_data_label.js rename to src/plugins/vis_type_vislib/public/vislib/lib/_data_label.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_error_handler.js b/src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_error_handler.js rename to src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_handler.scss b/src/plugins/vis_type_vislib/public/vislib/lib/_handler.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_handler.scss rename to src/plugins/vis_type_vislib/public/vislib/lib/_handler.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_index.scss b/src/plugins/vis_type_vislib/public/vislib/lib/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/lib/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/alerts.js b/src/plugins/vis_type_vislib/public/vislib/lib/alerts.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/alerts.js rename to src/plugins/vis_type_vislib/public/vislib/lib/alerts.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis/axis.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis/axis.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js index bc4a4f9925513c..7847cb1b15ddee 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/axis/axis.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js @@ -22,9 +22,9 @@ import _ from 'lodash'; import expect from '@kbn/expect'; import $ from 'jquery'; -import { Axis } from '../../../lib/axis'; -import { VisConfig } from '../../../lib/vis_config'; -import { getMockUiState } from '../fixtures/_vis_fixture'; +import { Axis } from './axis'; +import { VisConfig } from '../vis_config'; +import { getMockUiState } from '../../../fixtures/_vis_fixture'; describe('Vislib Axis Class Test Suite', function() { let mockUiState; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_config.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_scale.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/index.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/index.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/scale_modes.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/time_ticks.test.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/binder.ts b/src/plugins/vis_type_vislib/public/vislib/lib/binder.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/binder.ts rename to src/plugins/vis_type_vislib/public/vislib/lib/binder.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/chart_grid.js b/src/plugins/vis_type_vislib/public/vislib/lib/chart_grid.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/chart_grid.js rename to src/plugins/vis_type_vislib/public/vislib/lib/chart_grid.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/chart_title.js b/src/plugins/vis_type_vislib/public/vislib/lib/chart_title.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/chart_title.js rename to src/plugins/vis_type_vislib/public/vislib/lib/chart_title.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/data.js b/src/plugins/vis_type_vislib/public/vislib/lib/data.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/data.js rename to src/plugins/vis_type_vislib/public/vislib/lib/data.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/data.js b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/data.js rename to src/plugins/vis_type_vislib/public/vislib/lib/data.test.js index d4ec6f363a75b0..f890103aa5b0c9 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/data.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js @@ -20,8 +20,8 @@ import _ from 'lodash'; import expect from '@kbn/expect'; -import { Data } from '../../lib/data'; -import { getMockUiState } from './fixtures/_vis_fixture'; +import { Data } from './data'; +import { getMockUiState } from '../../fixtures/_vis_fixture'; const seriesData = { label: '', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/dispatch.js b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/dispatch.js rename to src/plugins/vis_type_vislib/public/vislib/lib/dispatch.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_heatmap.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_heatmap.test.js similarity index 75% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_heatmap.test.js rename to src/plugins/vis_type_vislib/public/vislib/lib/dispatch_heatmap.test.js index e22f19ea643fd3..4e650d4c20f977 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_heatmap.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_heatmap.test.js @@ -17,12 +17,11 @@ * under the License. */ -import mockDispatchDataD3 from './fixtures/dispatch_heatmap_d3.json'; -import { Dispatch } from '../../lib/dispatch'; -import mockdataPoint from './fixtures/dispatch_heatmap_data_point.json'; -import mockConfigPercentage from './fixtures/dispatch_heatmap_config.json'; +import mockDispatchDataD3 from '../../fixtures/dispatch_heatmap_d3.json'; +import { Dispatch } from './dispatch'; +import mockdataPoint from '../../fixtures/dispatch_heatmap_data_point.json'; +import mockConfigPercentage from '../../fixtures/dispatch_heatmap_config.json'; -jest.mock('ui/new_platform'); jest.mock('d3', () => ({ event: { target: { @@ -32,15 +31,6 @@ jest.mock('d3', () => ({ }, }, })); -jest.mock('../../../legacy_imports.ts', () => ({ - ...jest.requireActual('../../../legacy_imports.ts'), - chrome: { - getUiSettingsClient: () => ({ - get: () => '', - }), - addBasePath: () => {}, - }, -})); function getHandlerMock(config = {}, data = {}) { return { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_vertical_bar_chart.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js similarity index 74% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_vertical_bar_chart.test.js rename to src/plugins/vis_type_vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js index 8fe9ac24db77b5..a680788281fb16 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/dispatch_vertical_bar_chart.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/dispatch_vertical_bar_chart.test.js @@ -17,13 +17,12 @@ * under the License. */ -import mockDispatchDataD3 from './fixtures/dispatch_bar_chart_d3.json'; -import { Dispatch } from '../../lib/dispatch'; -import mockdataPoint from './fixtures/dispatch_bar_chart_data_point.json'; -import mockConfigPercentage from './fixtures/dispatch_bar_chart_config_percentage.json'; -import mockConfigNormal from './fixtures/dispatch_bar_chart_config_normal.json'; +import mockDispatchDataD3 from '../../fixtures/dispatch_bar_chart_d3.json'; +import { Dispatch } from './dispatch'; +import mockdataPoint from '../../fixtures/dispatch_bar_chart_data_point.json'; +import mockConfigPercentage from '../../fixtures/dispatch_bar_chart_config_percentage.json'; +import mockConfigNormal from '../../fixtures/dispatch_bar_chart_config_normal.json'; -jest.mock('ui/new_platform'); jest.mock('d3', () => ({ event: { target: { @@ -33,15 +32,6 @@ jest.mock('d3', () => ({ }, }, })); -jest.mock('../../../legacy_imports.ts', () => ({ - ...jest.requireActual('../../../legacy_imports.ts'), - chrome: { - getUiSettingsClient: () => ({ - get: () => '', - }), - addBasePath: () => {}, - }, -})); function getHandlerMock(config = {}, data = {}) { return { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/handler.js b/src/plugins/vis_type_vislib/public/vislib/lib/handler.js similarity index 98% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/handler.js rename to src/plugins/vis_type_vislib/public/vislib/lib/handler.js index ecf67ee3e017c5..2979c3d2c17342 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/handler.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/handler.js @@ -29,7 +29,7 @@ import { Axis } from './axis/axis'; import { ChartGrid as Grid } from './chart_grid'; import { visTypes as chartTypes } from '../visualizations/vis_types'; import { Binder } from './binder'; -import { dispatchRenderComplete } from '../../../../../../plugins/kibana_utils/public'; +import { dispatchRenderComplete } from '../../../../kibana_utils/public'; const markdownIt = new MarkdownIt({ html: false, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss b/src/plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss b/src/plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/_layout.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/index.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/index.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/layout.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/layout.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/layout.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout_types.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js similarity index 93% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout_types.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js index cc6d33a2d98daf..a9e6930a62e0c8 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/layout_types.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js @@ -20,7 +20,7 @@ import _ from 'lodash'; import expect from '@kbn/expect'; -import { layoutTypes as layoutType } from '../../../lib/layout/layout_types'; +import { layoutTypes as layoutType } from './layout_types'; describe('Vislib Layout Types Test Suite', function() { let layoutFunc; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/chart_title_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/column_chart/splits.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js similarity index 95% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/column_chart/splits.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js index 3942aa18891b84..0c24066b66032d 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/column_chart/splits.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js @@ -21,10 +21,10 @@ import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; -import { chartSplit } from '../../../../../lib/layout/splits/column_chart/chart_split'; -import { chartTitleSplit } from '../../../../../lib/layout/splits/column_chart/chart_title_split'; -import { xAxisSplit } from '../../../../../lib/layout/splits/column_chart/x_axis_split'; -import { yAxisSplit } from '../../../../../lib/layout/splits/column_chart/y_axis_split'; +import { chartSplit } from './chart_split'; +import { chartTitleSplit } from './chart_title_split'; +import { xAxisSplit } from './x_axis_split'; +import { yAxisSplit } from './y_axis_split'; describe('Vislib Split Function Test Suite', function() { describe('Column Chart', function() { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/x_axis_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/y_axis_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/chart_title_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/gauge_chart/splits.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js similarity index 96% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/gauge_chart/splits.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js index 8978f80f58dde8..5d927eaa040bc2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/splits/gauge_chart/splits.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js @@ -21,8 +21,8 @@ import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; -import { chartSplit } from '../../../../../lib/layout/splits/gauge_chart/chart_split'; -import { chartTitleSplit } from '../../../../../lib/layout/splits/gauge_chart/chart_title_split'; +import { chartSplit } from './chart_split'; +import { chartTitleSplit } from './chart_title_split'; describe('Vislib Gauge Split Function Test Suite', function() { describe('Column Chart', function() { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/pie_chart/chart_title_split.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/types/column_layout.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js similarity index 97% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/types/column_layout.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js index e9c2ff0d2fa078..ea8a7be4d2bf7b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/layout/types/column_layout.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js @@ -21,7 +21,7 @@ import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; -import { layoutTypes } from '../../../../lib/layout/layout_types'; +import { layoutTypes } from '../layout_types'; describe('Vislib Column Layout Test Suite', function() { let columnLayout; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/types/gauge_layout.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js rename to src/plugins/vis_type_vislib/public/vislib/lib/layout/types/pie_layout.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/gauge.js b/src/plugins/vis_type_vislib/public/vislib/lib/types/gauge.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/gauge.js rename to src/plugins/vis_type_vislib/public/vislib/lib/types/gauge.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/index.js b/src/plugins/vis_type_vislib/public/vislib/lib/types/index.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/index.js rename to src/plugins/vis_type_vislib/public/vislib/lib/types/index.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/pie.js b/src/plugins/vis_type_vislib/public/vislib/lib/types/pie.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/pie.js rename to src/plugins/vis_type_vislib/public/vislib/lib/types/pie.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/point_series.js b/src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/point_series.js rename to src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js similarity index 53% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js rename to src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js index 38a6be548594f3..684d8f346744e2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/types/point_series.test.js @@ -16,8 +16,57 @@ * specific language governing permissions and limitations * under the License. */ -import stackedSeries from '../../__tests__/lib/fixtures/mock_data/date_histogram/_stacked_series'; +import stackedSeries from '../../../fixtures/mock_data/date_histogram/_stacked_series'; import { vislibPointSeriesTypes } from './point_series'; +import percentileTestdata from './testdata_linechart_percentile.json'; +import percentileTestdataResult from './testdata_linechart_percentile_result.json'; + +const maxBucketData = { + get: prop => { + return maxBucketData[prop] || maxBucketData.data[prop] || null; + }, + getLabels: () => [], + data: { + hits: 621, + ordered: { + date: true, + interval: 30000, + max: 1408734982458, + min: 1408734082458, + }, + series: [ + { label: 's1', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's2', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's3', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's4', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's5', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's6', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's7', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's8', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's9', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's10', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's11', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's12', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's13', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's14', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's15', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's16', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's17', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's18', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's19', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's20', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's21', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's22', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's23', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's24', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's25', values: [{ x: 1408734060000, y: 8 }] }, + { label: 's26', values: [{ x: 1408734060000, y: 8 }] }, + ], + xAxisLabel: 'Date Histogram', + yAxisLabel: 'series', + yAxisFormatter: () => 'test', + }, +}; describe('vislibPointSeriesTypes', () => { const heatmapConfig = { @@ -41,53 +90,6 @@ describe('vislibPointSeriesTypes', () => { data: stackedSeries, }; - const maxBucketData = { - get: prop => { - return maxBucketData[prop] || maxBucketData.data[prop] || null; - }, - getLabels: () => [], - data: { - hits: 621, - ordered: { - date: true, - interval: 30000, - max: 1408734982458, - min: 1408734082458, - }, - series: [ - { label: 's1', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's2', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's3', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's4', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's5', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's6', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's7', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's8', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's9', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's10', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's11', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's12', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's13', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's14', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's15', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's16', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's17', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's18', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's19', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's20', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's21', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's22', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's23', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's24', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's25', values: [{ x: 1408734060000, y: 8 }] }, - { label: 's26', values: [{ x: 1408734060000, y: 8 }] }, - ], - xAxisLabel: 'Date Histogram', - yAxisLabel: 'series', - yAxisFormatter: () => 'test', - }, - }; - describe('axis formatters', () => { it('should create a value axis config with the default y axis formatter', () => { const parsedConfig = vislibPointSeriesTypes.line({}, maxBucketData); @@ -172,3 +174,59 @@ describe('vislibPointSeriesTypes', () => { }); }); }); + +describe('Point Series Config Type Class Test Suite', function() { + let parsedConfig; + const histogramConfig = { + type: 'histogram', + addLegend: true, + tooltip: { + show: true, + }, + categoryAxes: [ + { + id: 'CategoryAxis-1', + type: 'category', + title: {}, + }, + ], + valueAxes: [ + { + id: 'ValueAxis-1', + type: 'value', + labels: {}, + title: {}, + }, + ], + }; + + describe('histogram chart', function() { + beforeEach(function() { + parsedConfig = vislibPointSeriesTypes.column(histogramConfig, maxBucketData); + }); + it('should not throw an error when more than 25 series are provided', function() { + expect(parsedConfig.error).toBeUndefined(); + }); + + it('should set axis title and formatter from data', () => { + expect(parsedConfig.categoryAxes[0].title.text).toEqual(maxBucketData.data.xAxisLabel); + expect(parsedConfig.valueAxes[0].labels.axisFormatter).toBeDefined(); + }); + }); + + describe('line chart', function() { + beforeEach(function() { + const percentileDataObj = { + get: prop => { + return maxBucketData[prop] || maxBucketData.data[prop] || null; + }, + getLabels: () => [], + data: percentileTestdata.data, + }; + parsedConfig = vislibPointSeriesTypes.line(percentileTestdata.cfg, percentileDataObj); + }); + it('should render a percentile line chart', function() { + expect(JSON.stringify(parsedConfig)).toEqual(JSON.stringify(percentileTestdataResult)); + }); + }); +}); diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/testdata_linechart_percentile.json b/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/testdata_linechart_percentile.json rename to src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/testdata_linechart_percentile_result.json b/src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/types/testdata_linechart_percentile_result.json rename to src/plugins/vis_type_vislib/public/vislib/lib/types/testdata_linechart_percentile_result.json diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/vis_config.js b/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/vis_config.js rename to src/plugins/vis_type_vislib/public/vislib/lib/vis_config.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/partials/touchdown.tmpl.html b/src/plugins/vis_type_vislib/public/vislib/partials/touchdown.tmpl.html similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/partials/touchdown.tmpl.html rename to src/plugins/vis_type_vislib/public/vislib/partials/touchdown.tmpl.html diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/response_handler.js b/src/plugins/vis_type_vislib/public/vislib/response_handler.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/response_handler.js rename to src/plugins/vis_type_vislib/public/vislib/response_handler.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/response_handler.test.ts b/src/plugins/vis_type_vislib/public/vislib/response_handler.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/response_handler.test.ts rename to src/plugins/vis_type_vislib/public/vislib/response_handler.test.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts b/src/plugins/vis_type_vislib/public/vislib/types.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/types.ts rename to src/plugins/vis_type_vislib/public/vislib/types.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/vis.js b/src/plugins/vis_type_vislib/public/vislib/vis.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/vis.js rename to src/plugins/vis_type_vislib/public/vislib/vis.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/vislib.js b/src/plugins/vis_type_vislib/public/vislib/vislib.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/vislib.js rename to src/plugins/vis_type_vislib/public/vislib/vislib.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/gauge_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss rename to src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/_meter.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/gauge_types.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js index 62de6d84136641..deafe010b6773c 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/gauges/meter.js @@ -20,7 +20,7 @@ import d3 from 'd3'; import _ from 'lodash'; -import { getHeatmapColors } from '../../../../../../../plugins/charts/public'; +import { getHeatmapColors } from '../../../../../charts/public'; const arcAngles = { angleFactor: 0.75, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/pie_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_index.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_labels.scss diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/_point_series.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/area_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/column_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js similarity index 99% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js index 9822932c6071b8..6f497ae057d726 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/heatmap_chart.js @@ -23,7 +23,7 @@ import moment from 'moment'; import { isColorDark } from '@elastic/eui'; import { PointSeries } from './_point_series'; -import { getHeatmapColors } from '../../.../../../../../../../plugins/charts/public'; +import { getHeatmapColors } from '../../../../../../plugins/charts/public'; const defaults = { color: undefined, // todo diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/line_chart.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/point_series/series_types.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts b/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts rename to src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.d.ts diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js similarity index 100% rename from src/legacy/core_plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.js diff --git a/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts b/src/plugins/vis_type_vislib/server/index.ts similarity index 78% rename from src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts rename to src/plugins/vis_type_vislib/server/index.ts index c04ffa506eb04d..355c01d255ce77 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts +++ b/src/plugins/vis_type_vislib/server/index.ts @@ -17,5 +17,13 @@ * under the License. */ -import { search } from '../../../../plugins/data/public'; -export const { tabifyAggResponse, tabifyGetColumns } = search; +import { schema } from '@kbn/config-schema'; + +export const config = { + schema: schema.object({ enabled: schema.boolean({ defaultValue: true }) }), +}; + +export const plugin = () => ({ + setup() {}, + start() {}, +}); diff --git a/x-pack/legacy/plugins/tilemap/index.js b/x-pack/legacy/plugins/tilemap/index.js index d4105519ee0a77..f9c91b228075ff 100644 --- a/x-pack/legacy/plugins/tilemap/index.js +++ b/x-pack/legacy/plugins/tilemap/index.js @@ -12,7 +12,7 @@ export const tilemap = kibana => { return new kibana.Plugin({ id: 'tilemap', configPrefix: 'xpack.tilemap', - require: ['xpack_main', 'vis_type_vislib'], + require: ['xpack_main'], publicDir: resolve(__dirname, 'public'), uiExports: { hacks: ['plugins/tilemap/vis_type_enhancers/update_tilemap_settings'], diff --git a/x-pack/plugins/ml/public/application/util/chart_utils.js b/x-pack/plugins/ml/public/application/util/chart_utils.js index 3fd228377c57e4..5a062320ca6c5c 100644 --- a/x-pack/plugins/ml/public/application/util/chart_utils.js +++ b/x-pack/plugins/ml/public/application/util/chart_utils.js @@ -107,7 +107,7 @@ export function drawLineChartDots(data, lineChartGroup, lineChartValuesLine, rad } // this replicates Kibana's filterAxisLabels() behavior -// which can be found in src/legacy/core_plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js +// which can be found in src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_labels.js // axis labels which overflow the chart's boundaries will be removed export function filterAxisLabels(selection, chartWidth) { if (selection === undefined || selection.selectAll === undefined) { From 30ec2a4696f85a74cdeba57d0e647c2e34b3172a Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Tue, 21 Apr 2020 09:14:18 +0200 Subject: [PATCH 021/134] Migrate saved object of type url to kibana platform --- src/legacy/core_plugins/kibana/index.js | 7 --- src/legacy/core_plugins/kibana/mappings.json | 22 -------- src/plugins/share/server/plugin.ts | 2 + .../share/server/saved_objects/index.ts | 19 +++++++ src/plugins/share/server/saved_objects/url.ts | 54 +++++++++++++++++++ 5 files changed, 75 insertions(+), 29 deletions(-) create mode 100644 src/plugins/share/server/saved_objects/index.ts create mode 100644 src/plugins/share/server/saved_objects/url.ts diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 989583742acd0a..baac600b73b80a 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -137,13 +137,6 @@ export default function(kibana) { }; }, }, - url: { - defaultSearchField: 'url', - isImportableAndExportable: true, - getTitle(obj) { - return `/goto/${encodeURIComponent(obj.id)}`; - }, - }, }, savedObjectSchemas: { diff --git a/src/legacy/core_plugins/kibana/mappings.json b/src/legacy/core_plugins/kibana/mappings.json index af3f79588552b6..cfc7820eccdd48 100644 --- a/src/legacy/core_plugins/kibana/mappings.json +++ b/src/legacy/core_plugins/kibana/mappings.json @@ -53,28 +53,6 @@ } } }, - "url": { - "properties": { - "accessCount": { - "type": "long" - }, - "accessDate": { - "type": "date" - }, - "createDate": { - "type": "date" - }, - "url": { - "type": "text", - "fields": { - "keyword": { - "type": "keyword", - "ignore_above": 2048 - } - } - } - } - }, "server": { "properties": { "uuid": { diff --git a/src/plugins/share/server/plugin.ts b/src/plugins/share/server/plugin.ts index bcb681a50652a8..0d9f183d13404b 100644 --- a/src/plugins/share/server/plugin.ts +++ b/src/plugins/share/server/plugin.ts @@ -19,12 +19,14 @@ import { CoreSetup, Plugin, PluginInitializerContext } from 'kibana/server'; import { createRoutes } from './routes/create_routes'; +import { url } from './saved_objects'; export class SharePlugin implements Plugin { constructor(private readonly initializerContext: PluginInitializerContext) {} public async setup(core: CoreSetup) { createRoutes(core, this.initializerContext.logger.get()); + core.savedObjects.registerType(url); } public start() { diff --git a/src/plugins/share/server/saved_objects/index.ts b/src/plugins/share/server/saved_objects/index.ts new file mode 100644 index 00000000000000..956f031d2f1a54 --- /dev/null +++ b/src/plugins/share/server/saved_objects/index.ts @@ -0,0 +1,19 @@ +/* + * 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 { url } from './url'; diff --git a/src/plugins/share/server/saved_objects/url.ts b/src/plugins/share/server/saved_objects/url.ts new file mode 100644 index 00000000000000..c76c21993a13f1 --- /dev/null +++ b/src/plugins/share/server/saved_objects/url.ts @@ -0,0 +1,54 @@ +/* + * 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 'kibana/server'; + +export const url: SavedObjectsType = { + name: 'url', + namespaceType: 'single', + hidden: false, + management: { + icon: 'link', + defaultSearchField: 'url', + importableAndExportable: true, + getTitle(obj) { + return `/goto/${encodeURIComponent(obj.id)}`; + }, + }, + mappings: { + properties: { + accessCount: { + type: 'long', + }, + accessDate: { + type: 'date', + }, + createDate: { + type: 'date', + }, + url: { + type: 'text', + fields: { + keyword: { + type: 'keyword', + }, + }, + }, + }, + }, +}; From 57f83383af14d19dd8cdab7555c83268308699f8 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Tue, 21 Apr 2020 13:12:07 +0300 Subject: [PATCH 022/134] Move the rest of tests to jest, do a clean up --- .eslintrc.js | 3 + .../public/__tests__/vis_type_vislib/index.js | 40 ---- .../vis_type_vislib/lib/chart_title.js | 2 - .../__tests__/vis_type_vislib/lib/dispatch.js | 2 - .../vis_type_vislib/lib/handler/handler.js | 2 - .../vis_type_vislib/lib/layout/layout.js | 2 - .../public/__tests__/vis_type_vislib/vis.js | 2 - .../visualizations/area_chart.js | 2 - .../vis_type_vislib/visualizations/chart.js | 2 - .../visualizations/column_chart.js | 2 - .../visualizations/gauge_chart.js | 2 - .../visualizations/heatmap_chart.js | 2 - .../visualizations/line_chart.js | 2 - .../visualizations/pie_chart.js | 2 - .../vislib/components/labels/labels.test.js | 99 ++++---- .../_pointseries_tooltip_formatter.test.js | 17 +- .../tooltip/position_tooltip.test.js | 58 +++-- .../zero_injection/zero_injection.test.js | 223 +++++++++--------- .../vis_type_vislib/public/vislib/index.js | 23 -- .../public/vislib/lib/_error_handler.test.js} | 14 +- .../public/vislib/lib/axis/axis.test.js | 7 +- .../vislib/lib/axis/axis_title.test.js} | 29 +-- .../public/vislib/lib/axis/x_axis.test.js} | 49 ++-- .../public/vislib/lib/axis/y_axis.test.js} | 73 +++--- .../public/vislib/lib/data.test.js | 21 +- .../vislib/lib/layout/layout_types.test.js | 5 +- .../layout/splits/column_chart/splits.test.js | 17 +- .../layout/splits/gauge_chart/splits.test.js | 9 +- .../lib/layout/types/column_layout.test.js | 7 +- .../public/vislib/lib/vis_config.test.js} | 21 +- .../vis_type_vislib/public/vislib/vislib.js | 43 ---- .../visualizations/time_marker.test.js} | 25 +- .../vislib/visualizations/vis_types.test.js} | 9 +- 33 files changed, 328 insertions(+), 488 deletions(-) delete mode 100644 src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js delete mode 100644 src/plugins/vis_type_vislib/public/vislib/index.js rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js => plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js} (83%) rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js => plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js} (85%) rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js => plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js} (76%) rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js => plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js} (81%) rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js => plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js} (82%) delete mode 100644 src/plugins/vis_type_vislib/public/vislib/vislib.js rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js => plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js} (80%) rename src/{legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js => plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js} (78%) diff --git a/.eslintrc.js b/.eslintrc.js index a2b8ae7622d0b0..4d04768c83dbab 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -192,6 +192,9 @@ module.exports = { '(src|x-pack)/plugins/**/(public|server)/**/*', 'src/core/(public|server)/**/*', 'examples/**/*', + // next folder contains legacy browser tests which can't be migrated to jest + // which import np files + '!src/legacy/core_plugins/kibana/public/__tests__/**/*', ], from: [ 'src/core/public/**/*', diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js deleted file mode 100644 index 8e5be336d096b8..00000000000000 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 expect from '@kbn/expect'; - -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import VislibProvider from '../../../../../../plugins/vis_type_vislib/public/vislib'; - -describe('Vislib Index Test Suite', function() { - let vislib; - - beforeEach(() => { - vislib = new VislibProvider(); - }); - - it('should return an object', function() { - expect(_.isObject(vislib)).to.be(true); - }); - - it('should return a Vis function', function() { - expect(_.isFunction(vislib.Vis)).to.be(true); - }); -}); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js index cd878f0ed98d71..a69304164b2ad3 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js index b34c03aed98d1e..777c5187d29597 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import _ from 'lodash'; import d3 from 'd3'; import expect from '@kbn/expect'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js index e0237fddd20022..ee4daa8c244513 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import expect from '@kbn/expect'; import $ from 'jquery'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js index 35d22e245401b5..5bd58eee526c5d 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js index cbea62ce25611a..2e674742ab93c7 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js index c025322de16279..4daec921c6158f 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js index 6290743d60e836..1b393644c5191d 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import expect from '@kbn/expect'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js index 02bba88eae3a57..994eb1ae769323 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js @@ -22,8 +22,6 @@ import d3 from 'd3'; import $ from 'jquery'; import expect from '@kbn/expect'; -/* eslint-disable @kbn/eslint/no-restricted-paths */ - // Data import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js index fa36facb374b0d..a9f3e077cd95e6 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import $ from 'jquery'; import _ from 'lodash'; import expect from '@kbn/expect'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js index e8519f31e0f74f..e730a70b2412ea 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import _ from 'lodash'; import $ from 'jquery'; import d3 from 'd3'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js index c9718b78972c08..ad3c756f2c03c3 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import expect from '@kbn/expect'; import $ from 'jquery'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js index da53122b1317c9..84f67ee3dc00e0 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js @@ -17,8 +17,6 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; diff --git a/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js b/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js index 518406495df0d4..838275d44d2a1a 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/labels/labels.test.js @@ -18,7 +18,6 @@ */ import _ from 'lodash'; -import expect from '@kbn/expect'; import { labels } from './labels'; import { dataArray } from './data_array'; @@ -175,27 +174,27 @@ describe('Vislib Labels Module Test Suite', function() { }); it('should be a function', function() { - expect(typeof labels).to.be('function'); + expect(typeof labels).toBe('function'); }); it('should return an array if input is data.series', function() { - expect(seriesArr).to.be(true); + expect(seriesArr).toBe(true); }); it('should return an array if input is data.rows', function() { - expect(rowsArr).to.be(true); + expect(rowsArr).toBe(true); }); it('should throw an error if input is not an object', function() { expect(function() { labels('string not object'); - }).to.throwError(); + }).toThrow(); }); it('should return unique label values', function() { - expect(rowsLabels[0]).to.equal(uniqSeriesLabels[0]); - expect(rowsLabels[1]).to.equal(uniqSeriesLabels[1]); - expect(rowsLabels[2]).to.equal(uniqSeriesLabels[2]); + expect(rowsLabels[0]).toEqual(uniqSeriesLabels[0]); + expect(rowsLabels[1]).toEqual(uniqSeriesLabels[1]); + expect(rowsLabels[2]).toEqual(uniqSeriesLabels[2]); }); }); @@ -231,27 +230,27 @@ describe('Vislib Labels Module Test Suite', function() { it('should throw an error if the input is not an object', function() { expect(function() { dataArray(string); - }).to.throwError(); + }).toThrow(); expect(function() { dataArray(number); - }).to.throwError(); + }).toThrow(); expect(function() { dataArray(boolean); - }).to.throwError(); + }).toThrow(); expect(function() { dataArray(emptyArray); - }).to.throwError(); + }).toThrow(); expect(function() { dataArray(nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { dataArray(notAValue); - }).to.throwError(); + }).toThrow(); }); it( @@ -259,7 +258,7 @@ describe('Vislib Labels Module Test Suite', function() { function() { expect(function() { dataArray(childrenObject); - }).to.throwError(); + }).toThrow(); } ); @@ -268,42 +267,42 @@ describe('Vislib Labels Module Test Suite', function() { function() { expect(function() { dataArray(seriesObject); - }).to.not.throwError(); + }).not.toThrow(); expect(function() { dataArray(rowsObject); - }).to.not.throwError(); + }).not.toThrow(); expect(function() { dataArray(columnsObject); - }).to.not.throwError(); + }).not.toThrow(); } ); it('should be a function', function() { - expect(typeof dataArray).to.equal('function'); + expect(typeof dataArray).toEqual('function'); }); it('should return an array of objects if input is data.series', function() { - expect(testSeries).to.equal(true); + expect(testSeries).toEqual(true); }); it('should return an array of objects if input is data.rows', function() { - expect(testRows).to.equal(true); + expect(testRows).toEqual(true); }); it('should return an array of same length as input data.series', function() { - expect(seriesLabels.length).to.equal(seriesData.series.length); + expect(seriesLabels.length).toEqual(seriesData.series.length); }); it('should return an array of same length as input data.rows', function() { - expect(rowsLabels.length).to.equal(rowsData.rows.length); + expect(rowsLabels.length).toEqual(rowsData.rows.length); }); it('should return an array of objects with obj.labels and obj.values', function() { - expect(seriesLabels[0].label).to.equal('100'); - expect(seriesLabels[0].values[0].x).to.equal(0); - expect(seriesLabels[0].values[0].y).to.equal(1); + expect(seriesLabels[0].label).toEqual('100'); + expect(seriesLabels[0].values[0].x).toEqual(0); + expect(seriesLabels[0].values[0].y).toEqual(1); }); }); @@ -337,45 +336,45 @@ describe('Vislib Labels Module Test Suite', function() { it('should throw an error if input is not an array', function() { expect(function() { uniqLabels(string); - }).to.throwError(); + }).toThrow(); expect(function() { uniqLabels(number); - }).to.throwError(); + }).toThrow(); expect(function() { uniqLabels(boolean); - }).to.throwError(); + }).toThrow(); expect(function() { uniqLabels(nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { uniqLabels(emptyObject); - }).to.throwError(); + }).toThrow(); expect(function() { uniqLabels(notAValue); - }).to.throwError(); + }).toThrow(); }); it('should not throw an error if the input is an array', function() { expect(function() { uniqLabels(emptyArray); - }).to.not.throwError(); + }).not.toThrow(); }); it('should be a function', function() { - expect(typeof uniqLabels).to.be('function'); + expect(typeof uniqLabels).toBe('function'); }); it('should return an array', function() { - expect(testArr).to.be(true); + expect(testArr).toBe(true); }); it('should return array of 5 unique values', function() { - expect(uniq.length).to.be(5); + expect(uniq.length).toBe(5); }); }); @@ -408,63 +407,63 @@ describe('Vislib Labels Module Test Suite', function() { it('should throw an error if input is not an object', function() { expect(function() { getSeries(string); - }).to.throwError(); + }).toThrow(); expect(function() { getSeries(number); - }).to.throwError(); + }).toThrow(); expect(function() { getSeries(boolean); - }).to.throwError(); + }).toThrow(); expect(function() { getSeries(nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { getSeries(emptyArray); - }).to.throwError(); + }).toThrow(); expect(function() { getSeries(notAValue); - }).to.throwError(); + }).toThrow(); }); it('should throw an if property rows or columns is not set on the object', function() { expect(function() { getSeries(emptyObject); - }).to.throwError(); + }).toThrow(); }); it('should not throw an error if rows or columns set on object', function() { expect(function() { getSeries(rowsObject); - }).to.not.throwError(); + }).not.toThrow(); expect(function() { getSeries(columnsObject); - }).to.not.throwError(); + }).not.toThrow(); }); it('should be a function', function() { - expect(typeof getSeries).to.be('function'); + expect(typeof getSeries).toBe('function'); }); it('should return an array if input is data.columns', function() { - expect(columnsArr).to.be(true); + expect(columnsArr).toBe(true); }); it('should return an array if input is data.rows', function() { - expect(rowsArr).to.be(true); + expect(rowsArr).toBe(true); }); it('should return an array of the same length as as input data.columns', function() { - expect(columnsLabels.length).to.be(columnsData.columns.length); + expect(columnsLabels.length).toBe(columnsData.columns.length); }); it('should return an array of the same length as as input data.rows', function() { - expect(rowsLabels.length).to.be(rowsData.rows.length); + expect(rowsLabels.length).toBe(rowsData.rows.length); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js index a836918551bcd8..953c115cc0d024 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/_pointseries_tooltip_formatter.test.js @@ -19,7 +19,6 @@ import _ from 'lodash'; import $ from 'jquery'; -import expect from '@kbn/expect'; import { pointSeriesTooltipFormatter } from './_pointseries_tooltip_formatter'; @@ -64,19 +63,19 @@ describe('tooltipFormatter', function() { const event = _.cloneDeep(baseEvent); const $el = $(tooltipFormatter(event)); const $rows = $el.find('tr'); - expect($rows.length).to.be(3); + expect($rows.length).toBe(3); const $row1 = $rows.eq(0).find('td'); - expect(cell($row1, 0)).to.be('inner'); - expect(cell($row1, 1)).to.be('3'); + expect(cell($row1, 0)).toBe('inner'); + expect(cell($row1, 1)).toBe('3'); const $row2 = $rows.eq(1).find('td'); - expect(cell($row2, 0)).to.be('middle'); - expect(cell($row2, 1)).to.be('2'); + expect(cell($row2, 0)).toBe('middle'); + expect(cell($row2, 1)).toBe('2'); const $row3 = $rows.eq(2).find('td'); - expect(cell($row3, 0)).to.be('top'); - expect(cell($row3, 1)).to.be('1'); + expect(cell($row3, 0)).toBe('top'); + expect(cell($row3, 1)).toBe('1'); }); it('renders correctly on missing extraMetrics in datum', function() { @@ -84,6 +83,6 @@ describe('tooltipFormatter', function() { delete event.datum.extraMetrics; const $el = $(tooltipFormatter(event)); const $rows = $el.find('tr'); - expect($rows.length).to.be(3); + expect($rows.length).toBe(3); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js index f8aabd230709f1..c184d0e9fbcf7f 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/tooltip/position_tooltip.test.js @@ -17,7 +17,6 @@ * under the License. */ -import expect from '@kbn/expect'; import $ from 'jquery'; import _ from 'lodash'; import sinon from 'sinon'; @@ -95,11 +94,11 @@ describe('Tooltip Positioning', function() { positionTooltip.getTtSize($tooltip.html(), $sizer); [w, h].forEach(function(spy) { - expect(spy).to.have.property('callCount', 1); + expect(spy).toHaveProperty('callCount', 1); const matchHtml = w.thisValues.filter(function($t) { return !$t.is($tooltip) && $t.html() === $tooltip.html(); }); - expect(matchHtml).to.have.length(1); + expect(matchHtml).toHaveLength(1); }); }); }); @@ -110,11 +109,11 @@ describe('Tooltip Positioning', function() { const pos = positionTooltip.getBasePosition(size, makeEvent()); positions.forEach(function(p) { - expect(pos).to.have.property(p); + expect(pos).toHaveProperty(p); }); - expect(pos.north).to.be.lessThan(pos.south); - expect(pos.east).to.be.greaterThan(pos.west); + expect(pos.north).toBeLessThan(pos.south); + expect(pos.east).toBeGreaterThan(pos.west); }); }); @@ -123,11 +122,11 @@ describe('Tooltip Positioning', function() { const cbounds = positionTooltip.getBounds($chart); bounds.forEach(function(b) { - expect(cbounds).to.have.property(b); + expect(cbounds).toHaveProperty(b); }); - expect(cbounds.top).to.be.lessThan(cbounds.bottom); - expect(cbounds.left).to.be.lessThan(cbounds.right); + expect(cbounds.top).toBeLessThan(cbounds.bottom); + expect(cbounds.left).toBeLessThan(cbounds.right); }); }); @@ -137,18 +136,18 @@ describe('Tooltip Positioning', function() { $tooltip.css({ width: 15, height: 15 }); $sizer.css({ width: 15, height: 15 }); const size = positionTooltip.getTtSize($tooltip.html(), $sizer); - expect(size).to.have.property('width', 15); - expect(size).to.have.property('height', 15); + expect(size).toHaveProperty('width', 15); + expect(size).toHaveProperty('height', 15); // position the element based on a mouse that is in the middle of the chart const pos = positionTooltip.getBasePosition(size, makeEvent(0.5, 0.5)); const overflow = positionTooltip.getOverflow(size, pos, [$chart, $window]); positions.forEach(function(p) { - expect(overflow).to.have.property(p); + expect(overflow).toHaveProperty(p); // all positions should be less than 0 because the tooltip is so much smaller than the chart - expect(overflow[p]).to.be.lessThan(0); + expect(overflow[p]).toBeLessThan(0); }); }); @@ -160,12 +159,12 @@ describe('Tooltip Positioning', function() { const overflow = positionTooltip.getOverflow(size, pos, [$chart, $window]); positions.forEach(function(p) { - expect(overflow).to.have.property(p); + expect(overflow).toHaveProperty(p); if (p === 'south' || p === 'east') { - expect(overflow[p]).to.be.greaterThan(0); + expect(overflow[p]).toBeGreaterThan(0); } else { - expect(overflow[p]).to.be.lessThan(0); + expect(overflow[p]).toBeLessThan(0); } }); }); @@ -176,10 +175,10 @@ describe('Tooltip Positioning', function() { $tooltip.css({ width: largeWidth }); $sizer.css({ width: largeWidth }); const size = positionTooltip.getTtSize($tooltip.html(), $sizer); - expect(size).to.have.property('width', largeWidth); + expect(size).toHaveProperty('width', largeWidth); // $chart is flush with the $window on the left side - expect(positionTooltip.getBounds($chart).left).to.be(0); + expect(positionTooltip.getBounds($chart).left).toBe(0); // Size $window large enough for tooltip on right side $window.css({ width: $chart.width() * 3 }); @@ -190,17 +189,17 @@ describe('Tooltip Positioning', function() { const overflow = positionTooltip.getOverflow(size, pos, [$chart, $window]); // no overflow on left (east) - expect(overflow.east).to.be.lessThan(0); + expect(overflow.east).toBeLessThan(0); // overflow on right (west) - expect(overflow.west).to.be.greaterThan(0); + expect(overflow.west).toBeGreaterThan(0); }); }); describe('positionTooltip() integration', function() { it('returns nothing if the $chart or $tooltip are not passed in', function() { - expect(positionTooltip() === void 0).to.be(true); - expect(positionTooltip(null, null, null) === void 0).to.be(true); - expect(positionTooltip(null, $(), $()) === void 0).to.be(true); + expect(positionTooltip() === void 0).toBe(true); + expect(positionTooltip(null, null, null) === void 0).toBe(true); + expect(positionTooltip(null, $(), $()) === void 0).toBe(true); }); function check(xPercent, yPercent /*, prev, directions... */) { @@ -215,23 +214,22 @@ describe('Tooltip Positioning', function() { prev: _.isObject(directions[0]) ? directions.shift() : null, }); - expect(placement) - .to.have.property('top') - .and.property('left'); + expect(placement).toHaveProperty('top'); + expect(placement).toHaveProperty('left'); directions.forEach(function(dir) { switch (dir) { case 'top': - expect(placement.top).to.be.lessThan(event.clientY); + expect(placement.top).toBeLessThan(event.clientY); return; case 'bottom': - expect(placement.top).to.be.greaterThan(event.clientY); + expect(placement.top).toBeGreaterThan(event.clientY); return; case 'right': - expect(placement.left).to.be.greaterThan(event.clientX); + expect(placement.left).toBeGreaterThan(event.clientX); return; case 'left': - expect(placement.left).to.be.lessThan(event.clientX); + expect(placement.left).toBeLessThan(event.clientX); return; } }); diff --git a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js index 129006cdf0ca37..df502b7cde3dfb 100644 --- a/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/components/zero_injection/zero_injection.test.js @@ -18,7 +18,6 @@ */ import _ from 'lodash'; -import expect from '@kbn/expect'; import { injectZeros } from './inject_zeros'; import { orderXValues } from './ordered_x_keys'; import { getUniqKeys } from './uniq_keys'; @@ -159,45 +158,45 @@ describe('Vislib Zero Injection Module Test Suite', function() { }); it('should be a function', function() { - expect(_.isFunction(injectZeros)).to.be(true); + expect(_.isFunction(injectZeros)).toBe(true); }); it('should return an object with series[0].values', function() { - expect(_.isObject(sample1)).to.be(true); - expect(_.isObject(sample1[0].values)).to.be(true); + expect(_.isObject(sample1)).toBe(true); + expect(_.isObject(sample1[0].values)).toBe(true); }); it('should return the same array of objects when the length of the series array is 1', function() { - expect(sample1[0].values[0].x).to.be(seriesData[0].values[0].x); - expect(sample1[0].values[1].x).to.be(seriesData[0].values[1].x); - expect(sample1[0].values[2].x).to.be(seriesData[0].values[2].x); - expect(sample1[0].values[3].x).to.be(seriesData[0].values[3].x); - expect(sample1[0].values[4].x).to.be(seriesData[0].values[4].x); + expect(sample1[0].values[0].x).toBe(seriesData[0].values[0].x); + expect(sample1[0].values[1].x).toBe(seriesData[0].values[1].x); + expect(sample1[0].values[2].x).toBe(seriesData[0].values[2].x); + expect(sample1[0].values[3].x).toBe(seriesData[0].values[3].x); + expect(sample1[0].values[4].x).toBe(seriesData[0].values[4].x); }); it('should inject zeros in the input array', function() { - expect(sample2[1].values[1].y).to.be(0); - expect(sample2[2].values[0].y).to.be(0); - expect(sample2[2].values[1].y).to.be(0); - expect(sample2[2].values[4].y).to.be(0); - expect(sample3[1].values[1].y).to.be(0); - expect(sample3[2].values[0].y).to.be(0); - expect(sample3[2].values[1].y).to.be(0); - expect(sample3[2].values[4].y).to.be(0); + expect(sample2[1].values[1].y).toBe(0); + expect(sample2[2].values[0].y).toBe(0); + expect(sample2[2].values[1].y).toBe(0); + expect(sample2[2].values[4].y).toBe(0); + expect(sample3[1].values[1].y).toBe(0); + expect(sample3[2].values[0].y).toBe(0); + expect(sample3[2].values[1].y).toBe(0); + expect(sample3[2].values[4].y).toBe(0); }); it('should return values arrays with the same x values', function() { - expect(sample2[1].values[0].x).to.be(sample2[2].values[0].x); - expect(sample2[1].values[1].x).to.be(sample2[2].values[1].x); - expect(sample2[1].values[2].x).to.be(sample2[2].values[2].x); - expect(sample2[1].values[3].x).to.be(sample2[2].values[3].x); - expect(sample2[1].values[4].x).to.be(sample2[2].values[4].x); + expect(sample2[1].values[0].x).toBe(sample2[2].values[0].x); + expect(sample2[1].values[1].x).toBe(sample2[2].values[1].x); + expect(sample2[1].values[2].x).toBe(sample2[2].values[2].x); + expect(sample2[1].values[3].x).toBe(sample2[2].values[3].x); + expect(sample2[1].values[4].x).toBe(sample2[2].values[4].x); }); it('should return values arrays of the same length', function() { - expect(sample2[0].values.length).to.be(sample2[1].values.length); - expect(sample2[0].values.length).to.be(sample2[2].values.length); - expect(sample2[1].values.length).to.be(sample2[2].values.length); + expect(sample2[0].values.length).toBe(sample2[1].values.length); + expect(sample2[0].values.length).toBe(sample2[2].values.length); + expect(sample2[1].values.length).toBe(sample2[2].values.length); }); }); @@ -211,24 +210,24 @@ describe('Vislib Zero Injection Module Test Suite', function() { }); it('should return a function', function() { - expect(_.isFunction(orderXValues)).to.be(true); + expect(_.isFunction(orderXValues)).toBe(true); }); it('should return an array', function() { - expect(Array.isArray(results)).to.be(true); + expect(Array.isArray(results)).toBe(true); }); it('should return an array of values ordered by their index by default', function() { - expect(results[0]).to.be('1'); - expect(results[1]).to.be('2'); - expect(results[2]).to.be('3'); - expect(results[3]).to.be('4'); - expect(results[4]).to.be('5'); - expect(numberedResults[0]).to.be(1); - expect(numberedResults[1]).to.be(2); - expect(numberedResults[2]).to.be(3); - expect(numberedResults[3]).to.be(4); - expect(numberedResults[4]).to.be(5); + expect(results[0]).toBe('1'); + expect(results[1]).toBe('2'); + expect(results[2]).toBe('3'); + expect(results[3]).toBe('4'); + expect(results[4]).toBe('5'); + expect(numberedResults[0]).toBe(1); + expect(numberedResults[1]).toBe(2); + expect(numberedResults[2]).toBe(3); + expect(numberedResults[3]).toBe(4); + expect(numberedResults[4]).toBe(5); }); it('should return an array of values that preserve the index from xAxisOrderedValues', function() { @@ -257,7 +256,7 @@ describe('Vislib Zero Injection Module Test Suite', function() { ], }; const result = orderXValues(data); - expect(result).to.eql(['1', '2', '3', '4', '5']); + expect(result).toEqual(['1', '2', '3', '4', '5']); }); it('should return an array of values ordered by their sum when orderBucketsBySum is true', function() { @@ -265,16 +264,16 @@ describe('Vislib Zero Injection Module Test Suite', function() { results = orderXValues(multiSeriesDataObj, orderBucketsBySum); numberedResults = orderXValues(multiSeriesNumberedDataObj, orderBucketsBySum); - expect(results[0]).to.be('3'); - expect(results[1]).to.be('1'); - expect(results[2]).to.be('4'); - expect(results[3]).to.be('5'); - expect(results[4]).to.be('2'); - expect(numberedResults[0]).to.be(3); - expect(numberedResults[1]).to.be(1); - expect(numberedResults[2]).to.be(4); - expect(numberedResults[3]).to.be(5); - expect(numberedResults[4]).to.be(2); + expect(results[0]).toBe('3'); + expect(results[1]).toBe('1'); + expect(results[2]).toBe('4'); + expect(results[3]).toBe('5'); + expect(results[4]).toBe('2'); + expect(numberedResults[0]).toBe(3); + expect(numberedResults[1]).toBe(1); + expect(numberedResults[2]).toBe(4); + expect(numberedResults[3]).toBe(5); + expect(numberedResults[4]).toBe(2); }); }); @@ -288,39 +287,39 @@ describe('Vislib Zero Injection Module Test Suite', function() { it('should throw an error if input is not an object', function() { expect(function() { getUniqKeys(str); - }).to.throwError(); + }).toThrow(); expect(function() { getUniqKeys(number); - }).to.throwError(); + }).toThrow(); expect(function() { getUniqKeys(boolean); - }).to.throwError(); + }).toThrow(); expect(function() { getUniqKeys(nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { getUniqKeys(emptyArray); - }).to.throwError(); + }).toThrow(); expect(function() { getUniqKeys(notAValue); - }).to.throwError(); + }).toThrow(); }); it('should return a function', function() { - expect(_.isFunction(getUniqKeys)).to.be(true); + expect(_.isFunction(getUniqKeys)).toBe(true); }); it('should return an object', function() { - expect(_.isObject(results)).to.be(true); + expect(_.isObject(results)).toBe(true); }); it('should return an object of unique keys', function() { - expect(_.uniq(_.keys(results)).length).to.be(_.keys(results).length); + expect(_.uniq(_.keys(results)).length).toBe(_.keys(results).length); }); }); @@ -332,17 +331,17 @@ describe('Vislib Zero Injection Module Test Suite', function() { }); it('should return a function', function() { - expect(_.isFunction(flattenData)).to.be(true); + expect(_.isFunction(flattenData)).toBe(true); }); it('should return an array', function() { - expect(Array.isArray(results)).to.be(true); + expect(Array.isArray(results)).toBe(true); }); it('should return an array of objects', function() { - expect(_.isObject(results[0])).to.be(true); - expect(_.isObject(results[1])).to.be(true); - expect(_.isObject(results[2])).to.be(true); + expect(_.isObject(results[0])).toBe(true); + expect(_.isObject(results[1])).toBe(true); + expect(_.isObject(results[2])).toBe(true); }); }); @@ -360,67 +359,67 @@ describe('Vislib Zero Injection Module Test Suite', function() { it('should throw an error if input is not an array', function() { expect(function() { createZeroFilledArray(str); - }).to.throwError(); + }).toThrow(); expect(function() { createZeroFilledArray(number); - }).to.throwError(); + }).toThrow(); expect(function() { createZeroFilledArray(boolean); - }).to.throwError(); + }).toThrow(); expect(function() { createZeroFilledArray(nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { createZeroFilledArray(emptyObject); - }).to.throwError(); + }).toThrow(); expect(function() { createZeroFilledArray(notAValue); - }).to.throwError(); + }).toThrow(); }); it('should return a function', function() { - expect(_.isFunction(createZeroFilledArray)).to.be(true); + expect(_.isFunction(createZeroFilledArray)).toBe(true); }); it('should return an array', function() { - expect(Array.isArray(results1)).to.be(true); + expect(Array.isArray(results1)).toBe(true); }); it('should return an array of objects', function() { - expect(_.isObject(results1[0])).to.be(true); - expect(_.isObject(results1[1])).to.be(true); - expect(_.isObject(results1[2])).to.be(true); - expect(_.isObject(results1[3])).to.be(true); - expect(_.isObject(results1[4])).to.be(true); + expect(_.isObject(results1[0])).toBe(true); + expect(_.isObject(results1[1])).toBe(true); + expect(_.isObject(results1[2])).toBe(true); + expect(_.isObject(results1[3])).toBe(true); + expect(_.isObject(results1[4])).toBe(true); }); it('should return an array of objects where each y value is 0', function() { - expect(results1[0].y).to.be(0); - expect(results1[1].y).to.be(0); - expect(results1[2].y).to.be(0); - expect(results1[3].y).to.be(0); - expect(results1[4].y).to.be(0); + expect(results1[0].y).toBe(0); + expect(results1[1].y).toBe(0); + expect(results1[2].y).toBe(0); + expect(results1[3].y).toBe(0); + expect(results1[4].y).toBe(0); }); it('should return an array of objects where each x values are numbers', function() { - expect(_.isNumber(results1[0].x)).to.be(true); - expect(_.isNumber(results1[1].x)).to.be(true); - expect(_.isNumber(results1[2].x)).to.be(true); - expect(_.isNumber(results1[3].x)).to.be(true); - expect(_.isNumber(results1[4].x)).to.be(true); + expect(_.isNumber(results1[0].x)).toBe(true); + expect(_.isNumber(results1[1].x)).toBe(true); + expect(_.isNumber(results1[2].x)).toBe(true); + expect(_.isNumber(results1[3].x)).toBe(true); + expect(_.isNumber(results1[4].x)).toBe(true); }); it('should return an array of objects where each x values are strings', function() { - expect(_.isString(results2[0].x)).to.be(true); - expect(_.isString(results2[1].x)).to.be(true); - expect(_.isString(results2[2].x)).to.be(true); - expect(_.isString(results2[3].x)).to.be(true); - expect(_.isString(results2[4].x)).to.be(true); + expect(_.isString(results2[0].x)).toBe(true); + expect(_.isString(results2[1].x)).toBe(true); + expect(_.isString(results2[2].x)).toBe(true); + expect(_.isString(results2[3].x)).toBe(true); + expect(_.isString(results2[4].x)).toBe(true); }); }); @@ -439,48 +438,48 @@ describe('Vislib Zero Injection Module Test Suite', function() { it('should throw an error if input are not arrays', function() { expect(function() { zeroFillDataArray(str, str); - }).to.throwError(); + }).toThrow(); expect(function() { zeroFillDataArray(number, number); - }).to.throwError(); + }).toThrow(); expect(function() { zeroFillDataArray(boolean, boolean); - }).to.throwError(); + }).toThrow(); expect(function() { zeroFillDataArray(nullValue, nullValue); - }).to.throwError(); + }).toThrow(); expect(function() { zeroFillDataArray(emptyObject, emptyObject); - }).to.throwError(); + }).toThrow(); expect(function() { zeroFillDataArray(notAValue, notAValue); - }).to.throwError(); + }).toThrow(); }); it('should return a function', function() { - expect(_.isFunction(zeroFillDataArray)).to.be(true); + expect(_.isFunction(zeroFillDataArray)).toBe(true); }); it('should return an array', function() { - expect(Array.isArray(results)).to.be(true); + expect(Array.isArray(results)).toBe(true); }); it('should return an array of objects', function() { - expect(_.isObject(results[0])).to.be(true); - expect(_.isObject(results[1])).to.be(true); - expect(_.isObject(results[2])).to.be(true); + expect(_.isObject(results[0])).toBe(true); + expect(_.isObject(results[1])).toBe(true); + expect(_.isObject(results[2])).toBe(true); }); it('should return an array with zeros injected in the appropriate objects as y values', function() { - expect(results[0].y).to.be(0); - expect(results[1].y).to.be(0); - expect(results[3].y).to.be(0); - expect(results[4].y).to.be(0); + expect(results[0].y).toBe(0); + expect(results[1].y).toBe(0); + expect(results[3].y).toBe(0); + expect(results[4].y).toBe(0); }); }); @@ -493,18 +492,18 @@ describe('Vislib Zero Injection Module Test Suite', function() { it('should return an array of objects', function() { results.forEach(function(row) { - expect(Array.isArray(row.values)).to.be(true); + expect(Array.isArray(row.values)).toBe(true); }); }); it('should return ordered x values', function() { const values = results[0].values; - expect(values[0].x).to.be.lessThan(values[1].x); - expect(values[1].x).to.be.lessThan(values[2].x); - expect(values[2].x).to.be.lessThan(values[3].x); - expect(values[3].x).to.be.lessThan(values[4].x); - expect(values[4].x).to.be.lessThan(values[5].x); - expect(values[5].x).to.be.lessThan(values[6].x); + expect(values[0].x).toBeLessThan(values[1].x); + expect(values[1].x).toBeLessThan(values[2].x); + expect(values[2].x).toBeLessThan(values[3].x); + expect(values[3].x).toBeLessThan(values[4].x); + expect(values[4].x).toBeLessThan(values[5].x); + expect(values[5].x).toBeLessThan(values[6].x); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/index.js b/src/plugins/vis_type_vislib/public/vislib/index.js deleted file mode 100644 index b2559c085aeab3..00000000000000 --- a/src/plugins/vis_type_vislib/public/vislib/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 { VislibProvider } from './vislib'; - -// eslint-disable-next-line import/no-default-export -export default VislibProvider; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js b/src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js similarity index 83% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js rename to src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js index 3b8f0e7f4a2b47..b7764b92b78059 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/error_handler.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/_error_handler.test.js @@ -17,11 +17,7 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - -import expect from '@kbn/expect'; - -import { ErrorHandler } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/_error_handler'; +import { ErrorHandler } from './_error_handler'; describe('Vislib ErrorHandler Test Suite', function() { let errorHandler; @@ -34,19 +30,19 @@ describe('Vislib ErrorHandler Test Suite', function() { it('should throw an error when width and/or height is 0', function() { expect(function() { errorHandler.validateWidthandHeight(0, 200); - }).to.throwError(); + }).toThrow(); expect(function() { errorHandler.validateWidthandHeight(200, 0); - }).to.throwError(); + }).toThrow(); }); it('should throw an error when width and/or height is NaN', function() { expect(function() { errorHandler.validateWidthandHeight(null, 200); - }).to.throwError(); + }).toThrow(); expect(function() { errorHandler.validateWidthandHeight(200, null); - }).to.throwError(); + }).toThrow(); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js index 7847cb1b15ddee..8eb5c2c9d64c41 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js @@ -19,7 +19,6 @@ import d3 from 'd3'; import _ from 'lodash'; -import expect from '@kbn/expect'; import $ from 'jquery'; import { Axis } from './axis'; @@ -164,7 +163,7 @@ describe('Vislib Axis Class Test Suite', function() { }, ]; const stackedData = yAxis._stackNegAndPosVals(seriesData); - expect(stackedData[1]).to.eql(expectedResult); + expect(stackedData[1]).toEqual(expectedResult); }); it('should correctly stack pos and neg values', function() { @@ -200,7 +199,7 @@ describe('Vislib Axis Class Test Suite', function() { value.y = -value.y; }); const stackedData = yAxis._stackNegAndPosVals(dataClone); - expect(stackedData[1]).to.eql(expectedResult); + expect(stackedData[1]).toEqual(expectedResult); }); it('should correctly stack mixed pos and neg values', function() { @@ -236,7 +235,7 @@ describe('Vislib Axis Class Test Suite', function() { if (i % 2 === 1) value.y = -value.y; }); const stackedData = yAxis._stackNegAndPosVals(dataClone); - expect(stackedData[1]).to.eql(expectedResult); + expect(stackedData[1]).toEqual(expectedResult); }); }); }); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js similarity index 85% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js index e7ec6eea32162b..32f597648937b7 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/axis_title.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js @@ -17,18 +17,15 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import _ from 'lodash'; import $ from 'jquery'; -import expect from '@kbn/expect'; -import { AxisTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis/axis_title'; -import { AxisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis/axis_config'; -import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -import { Data } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/data'; -import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { AxisTitle } from './axis_title'; +import { AxisConfig } from './axis_config'; +import { VisConfig } from '../vis_config'; +import { Data } from '../data'; +import { getMockUiState } from '../../../fixtures/_vis_fixture'; describe('Vislib AxisTitle Class Test Suite', function() { let el; @@ -161,7 +158,7 @@ describe('Vislib AxisTitle Class Test Suite', function() { $(el.node()) .find('.x-axis-title') .find('svg').length - ).to.be(0); + ).toBe(0); }); describe('render Method', function() { @@ -171,8 +168,8 @@ describe('Vislib AxisTitle Class Test Suite', function() { }); it('should append an svg to div', function() { - expect(el.select('.x-axis-title').selectAll('svg').length).to.be(1); - expect(el.select('.y-axis-title').selectAll('svg').length).to.be(1); + expect(el.select('.x-axis-title').selectAll('svg').length).toBe(1); + expect(el.select('.y-axis-title').selectAll('svg').length).toBe(1); }); it('should append a g element to the svg', function() { @@ -181,13 +178,13 @@ describe('Vislib AxisTitle Class Test Suite', function() { .select('.x-axis-title') .selectAll('svg') .select('g').length - ).to.be(1); + ).toBe(1); expect( el .select('.y-axis-title') .selectAll('svg') .select('g').length - ).to.be(1); + ).toBe(1); }); it('should append text', function() { @@ -196,19 +193,19 @@ describe('Vislib AxisTitle Class Test Suite', function() { .select('.x-axis-title') .selectAll('svg') .selectAll('text') - ).to.be(true); + ).toBe(true); expect( !!el .select('.y-axis-title') .selectAll('svg') .selectAll('text') - ).to.be(true); + ).toBe(true); }); }); describe('draw Method', function() { it('should be a function', function() { - expect(_.isFunction(xTitle.draw())).to.be(true); + expect(_.isFunction(xTitle.draw())).toBe(true); }); }); }); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js similarity index 76% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js index 9cefa8eec182f6..d534b301c243d7 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/x_axis.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js @@ -17,16 +17,13 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import _ from 'lodash'; -import expect from '@kbn/expect'; import $ from 'jquery'; -import { Axis } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis'; -import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { Axis } from './axis'; +import { VisConfig } from '../vis_config'; +import { getMockUiState } from '../../../fixtures/_vis_fixture'; describe('Vislib xAxis Class Test Suite', function() { let mockUiState; @@ -143,15 +140,15 @@ describe('Vislib xAxis Class Test Suite', function() { }); it('should append an svg to div', function() { - expect(el.selectAll('svg').length).to.be(1); + expect(el.selectAll('svg').length).toBe(1); }); it('should append a g element to the svg', function() { - expect(el.selectAll('svg').select('g').length).to.be(1); + expect(el.selectAll('svg').select('g').length).toBe(1); }); it('should append ticks with text', function() { - expect(!!el.selectAll('svg').selectAll('.tick text')).to.be(true); + expect(!!el.selectAll('svg').selectAll('.tick text')).toBe(true); }); }); @@ -168,22 +165,22 @@ describe('Vislib xAxis Class Test Suite', function() { }); it('should return a function', function() { - expect(_.isFunction(timeScale)).to.be(true); + expect(_.isFunction(timeScale)).toBe(true); }); it('should return the correct domain', function() { - expect(_.isDate(timeScale.domain()[0])).to.be(true); - expect(_.isDate(timeScale.domain()[1])).to.be(true); + expect(_.isDate(timeScale.domain()[0])).toBe(true); + expect(_.isDate(timeScale.domain()[1])).toBe(true); }); it('should return the min and max dates', function() { - expect(timeScale.domain()[0].toDateString()).to.be(new Date(1408734060000).toDateString()); - expect(timeScale.domain()[1].toDateString()).to.be(new Date(1408734330000).toDateString()); + expect(timeScale.domain()[0].toDateString()).toBe(new Date(1408734060000).toDateString()); + expect(timeScale.domain()[1].toDateString()).toBe(new Date(1408734330000).toDateString()); }); it('should return the correct range', function() { - expect(range[0]).to.be(0); - expect(range[1]).to.be(width); + expect(range[0]).toBe(0); + expect(range[1]).toBe(width); }); }); @@ -202,12 +199,12 @@ describe('Vislib xAxis Class Test Suite', function() { }); it('should return an ordinal scale', function() { - expect(ordinalDomain.domain()[0]).to.be('this'); - expect(ordinalDomain.domain()[4]).to.be('array'); + expect(ordinalDomain.domain()[0]).toBe('this'); + expect(ordinalDomain.domain()[4]).toBe('array'); }); it('should return an array of values', function() { - expect(Array.isArray(ordinalDomain.domain())).to.be(true); + expect(Array.isArray(ordinalDomain.domain())).toBe(true); }); }); @@ -222,17 +219,17 @@ describe('Vislib xAxis Class Test Suite', function() { }); it('should return a function', function() { - expect(_.isFunction(xScale)).to.be(true); + expect(_.isFunction(xScale)).toBe(true); }); it('should return a domain', function() { - expect(_.isDate(xScale.domain()[0])).to.be(true); - expect(_.isDate(xScale.domain()[1])).to.be(true); + expect(_.isDate(xScale.domain()[0])).toBe(true); + expect(_.isDate(xScale.domain()[1])).toBe(true); }); it('should return a range', function() { - expect(xScale.range()[0]).to.be(0); - expect(xScale.range()[1]).to.be(width); + expect(xScale.range()[0]).toBe(0); + expect(xScale.range()[1]).toBe(width); }); }); @@ -245,13 +242,13 @@ describe('Vislib xAxis Class Test Suite', function() { }); it('should create an getScale function on the xAxis class', function() { - expect(_.isFunction(xAxis.getScale())).to.be(true); + expect(_.isFunction(xAxis.getScale())).toBe(true); }); }); describe('draw Method', function() { it('should be a function', function() { - expect(_.isFunction(xAxis.draw())).to.be(true); + expect(_.isFunction(xAxis.draw())).toBe(true); }); }); }); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js similarity index 81% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js rename to src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js index 70ba382378f3d2..ca7032a4a3eeca 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/y_axis.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js @@ -17,16 +17,13 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import _ from 'lodash'; import d3 from 'd3'; import $ from 'jquery'; -import expect from '@kbn/expect'; -import { Axis } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/axis'; -import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { Axis } from './axis'; +import { VisConfig } from '../vis_config'; +import { getMockUiState } from '../../../fixtures/_vis_fixture'; const YAxis = Axis; let mockUiState; @@ -125,7 +122,7 @@ function createData(seriesData) { describe('Vislib yAxis Class Test Suite', function() { beforeEach(() => { mockUiState = getMockUiState(); - expect($('.y-axis-wrapper')).to.have.length(0); + expect($('.y-axis-wrapper')).toHaveLength(0); }); afterEach(function() { @@ -142,15 +139,15 @@ describe('Vislib yAxis Class Test Suite', function() { }); it('should append an svg to div', function() { - expect(el.selectAll('svg').length).to.be(1); + expect(el.selectAll('svg').length).toBe(1); }); it('should append a g element to the svg', function() { - expect(el.selectAll('svg').select('g').length).to.be(1); + expect(el.selectAll('svg').select('g').length).toBe(1); }); it('should append ticks with text', function() { - expect(!!el.selectAll('svg').selectAll('.tick text')).to.be(true); + expect(!!el.selectAll('svg').selectAll('.tick text')).toBe(true); }); }); @@ -162,14 +159,14 @@ describe('Vislib yAxis Class Test Suite', function() { function checkDomain(min, max) { const domain = yScale.domain(); - expect(domain[0]).to.be.lessThan(min + 1); - expect(domain[1]).to.be.greaterThan(max - 1); + expect(domain[0]).toBeLessThan(min + 1); + expect(domain[1]).toBeGreaterThan(max - 1); return domain; } function checkRange() { - expect(yScale.range()[0]).to.be(height); - expect(yScale.range()[1]).to.be(0); + expect(yScale.range()[0]).toBe(height); + expect(yScale.range()[1]).toBe(0); } describe('API', function() { @@ -180,7 +177,7 @@ describe('Vislib yAxis Class Test Suite', function() { }); it('should return a function', function() { - expect(_.isFunction(yScale)).to.be(true); + expect(_.isFunction(yScale)).toBe(true); }); }); @@ -196,7 +193,7 @@ describe('Vislib yAxis Class Test Suite', function() { const min = 0; const max = _.max(_.flattenDeep(graphData)); const domain = checkDomain(min, max); - expect(domain[1]).to.be.greaterThan(0); + expect(domain[1]).toBeGreaterThan(0); checkRange(); }); }); @@ -216,7 +213,7 @@ describe('Vislib yAxis Class Test Suite', function() { const min = _.min(_.flattenDeep(graphData)); const max = 0; const domain = checkDomain(min, max); - expect(domain[0]).to.be.lessThan(0); + expect(domain[0]).toBeLessThan(0); checkRange(); }); }); @@ -236,8 +233,8 @@ describe('Vislib yAxis Class Test Suite', function() { const min = _.min(_.flattenDeep(graphData)); const max = _.max(_.flattenDeep(graphData)); const domain = checkDomain(min, max); - expect(domain[0]).to.be.lessThan(0); - expect(domain[1]).to.be.greaterThan(0); + expect(domain[0]).toBeLessThan(0); + expect(domain[1]).toBeGreaterThan(0); checkRange(); }); }); @@ -257,7 +254,7 @@ describe('Vislib yAxis Class Test Suite', function() { expect(function() { yAxis.axisScale.validateUserExtents(min, max); - }).to.throwError(); + }).toThrow(); }); it('should return a decimal value', function() { @@ -269,16 +266,16 @@ describe('Vislib yAxis Class Test Suite', function() { domain[1] = 80; const newDomain = yAxis.axisScale.validateUserExtents(domain); - expect(newDomain[0]).to.be(domain[0] / 100); - expect(newDomain[1]).to.be(domain[1] / 100); + expect(newDomain[0]).toBe(domain[0] / 100); + expect(newDomain[1]).toBe(domain[1] / 100); }); it('should return the user defined value', function() { domain = [20, 50]; const newDomain = yAxis.axisScale.validateUserExtents(domain); - expect(newDomain[0]).to.be(domain[0]); - expect(newDomain[1]).to.be(domain[1]); + expect(newDomain[0]).toBe(domain[0]); + expect(newDomain[1]).toBe(domain[1]); }); }); @@ -289,7 +286,7 @@ describe('Vislib yAxis Class Test Suite', function() { expect(function() { yAxis.axisScale.validateAxisExtents(min, max); - }).to.throwError(); + }).toThrow(); }); it('min > max', function() { @@ -298,7 +295,7 @@ describe('Vislib yAxis Class Test Suite', function() { expect(function() { yAxis.axisScale.validateAxisExtents(min, max); - }).to.throwError(); + }).toThrow(); }); }); }); @@ -308,17 +305,17 @@ describe('Vislib yAxis Class Test Suite', function() { it('should return a function', function() { fnNames.forEach(function(fnName) { - expect(yAxis.axisScale.getD3Scale(fnName)).to.be.a(Function); + expect(yAxis.axisScale.getD3Scale(fnName)).toEqual(expect.any(Function)); }); // if no value is provided to the function, scale should default to a linear scale - expect(yAxis.axisScale.getD3Scale()).to.be.a(Function); + expect(yAxis.axisScale.getD3Scale()).toEqual(expect.any(Function)); }); it('should throw an error if function name is undefined', function() { expect(function() { yAxis.axisScale.getD3Scale('square'); - }).to.throwError(); + }).toThrow(); }); }); @@ -326,18 +323,18 @@ describe('Vislib yAxis Class Test Suite', function() { it('should throw an error', function() { expect(function() { yAxis.axisScale.logDomain(-10, -5); - }).to.throwError(); + }).toThrow(); expect(function() { yAxis.axisScale.logDomain(-10, 5); - }).to.throwError(); + }).toThrow(); expect(function() { yAxis.axisScale.logDomain(0, -5); - }).to.throwError(); + }).toThrow(); }); it('should return a yMin value of 1', function() { const yMin = yAxis.axisScale.logDomain(0, 200)[0]; - expect(yMin).to.be(1); + expect(yMin).toBe(1); }); }); @@ -356,7 +353,7 @@ describe('Vislib yAxis Class Test Suite', function() { it('should use decimal format for small values', function() { yAxis.yMax = 1; const tickFormat = yAxis.getAxis().tickFormat(); - expect(tickFormat(0.8)).to.be('0.8'); + expect(tickFormat(0.8)).toBe('0.8'); }); }); @@ -366,7 +363,7 @@ describe('Vislib yAxis Class Test Suite', function() { }); it('should be a function', function() { - expect(_.isFunction(yAxis.draw())).to.be(true); + expect(_.isFunction(yAxis.draw())).toBe(true); }); }); @@ -376,9 +373,9 @@ describe('Vislib yAxis Class Test Suite', function() { }); it('should return the correct number of ticks', function() { - expect(yAxis.tickScale(1000)).to.be(11); - expect(yAxis.tickScale(40)).to.be(3); - expect(yAxis.tickScale(20)).to.be(0); + expect(yAxis.tickScale(1000)).toBe(11); + expect(yAxis.tickScale(40)).toBe(3); + expect(yAxis.tickScale(20)).toBe(0); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js index f890103aa5b0c9..13fb9ea7834a37 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js @@ -18,7 +18,6 @@ */ import _ from 'lodash'; -import expect from '@kbn/expect'; import { Data } from './data'; import { getMockUiState } from '../../fixtures/_vis_fixture'; @@ -160,12 +159,12 @@ describe('Vislib Data Class Test Suite', function() { describe('Data Class (main)', function() { it('should be a function', function() { - expect(_.isFunction(Data)).to.be(true); + expect(_.isFunction(Data)).toBe(true); }); it('should return an object', function() { const rowIn = new Data(rowsData, mockUiState, () => undefined); - expect(_.isObject(rowIn)).to.be(true); + expect(_.isObject(rowIn)).toBe(true); }); }); @@ -183,7 +182,7 @@ describe('Vislib Data Class Test Suite', function() { it('should remove zero values', function() { const slices = data._removeZeroSlices(data.data.slices); - expect(slices.children.length).to.be(2); + expect(slices.children.length).toBe(2); }); }); @@ -197,7 +196,7 @@ describe('Vislib Data Class Test Suite', function() { }); it('should return an array of value objects from every series', function() { - expect(serOut.every(_.isObject)).to.be(true); + expect(serOut.every(_.isObject)).toBe(true); }); it('should return all points from every series', testLength(seriesData)); @@ -220,7 +219,7 @@ describe('Vislib Data Class Test Suite', function() { 0 ); - expect(data.flatten()).to.have.length(len); + expect(data.flatten()).toHaveLength(len); }; } }); @@ -268,15 +267,15 @@ describe('Vislib Data Class Test Suite', function() { describe('getVisData', function() { it('should return the rows property', function() { const visData = data.getVisData(); - expect(visData[0].title).to.eql(geohashGridData.rows[0].title); + expect(visData[0].title).toEqual(geohashGridData.rows[0].title); }); }); describe('getGeoExtents', function() { it('should return the min and max geoJson properties', function() { const minMax = data.getGeoExtents(); - expect(minMax.min).to.be(1); - expect(minMax.max).to.be(331); + expect(minMax.min).toBe(1); + expect(minMax.max).toBe(331); }); }); }); @@ -284,7 +283,7 @@ describe('Vislib Data Class Test Suite', function() { describe('null value check', function() { it('should return false', function() { const data = new Data(rowsData, mockUiState, () => undefined); - expect(data.hasNullValues()).to.be(false); + expect(data.hasNullValues()).toBe(false); }); it('should return true', function() { @@ -304,7 +303,7 @@ describe('Vislib Data Class Test Suite', function() { }); const data = new Data(nullRowData, mockUiState, () => undefined); - expect(data.hasNullValues()).to.be(true); + expect(data.hasNullValues()).toBe(true); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js index a9e6930a62e0c8..0bc11e5124a077 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/layout_types.test.js @@ -18,7 +18,6 @@ */ import _ from 'lodash'; -import expect from '@kbn/expect'; import { layoutTypes as layoutType } from './layout_types'; @@ -30,10 +29,10 @@ describe('Vislib Layout Types Test Suite', function() { }); it('should be an object', function() { - expect(_.isObject(layoutType)).to.be(true); + expect(_.isObject(layoutType)).toBe(true); }); it('should return a function', function() { - expect(typeof layoutFunc).to.be('function'); + expect(typeof layoutFunc).toBe('function'); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js index 0c24066b66032d..117b346efda898 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/column_chart/splits.test.js @@ -18,7 +18,6 @@ */ import d3 from 'd3'; -import expect from '@kbn/expect'; import $ from 'jquery'; import { chartSplit } from './chart_split'; @@ -174,11 +173,11 @@ describe('Vislib Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect($('.chart').length).to.be(2); + expect($('.chart').length).toBe(2); }); it('should add the correct class name', function() { - expect(!!$('.visWrapper__splitCharts--row').length).to.be(true); + expect(!!$('.visWrapper__splitCharts--row').length).toBe(true); }); }); @@ -213,16 +212,16 @@ describe('Vislib Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect($('.chart-title').length).to.be(2); + expect($('.chart-title').length).toBe(2); }); it('should remove the correct div', function() { - expect($('.visAxis__splitTitles--y').length).to.be(1); - expect($('.visAxis__splitTitles--x').length).to.be(0); + expect($('.visAxis__splitTitles--y').length).toBe(1); + expect($('.visAxis__splitTitles--x').length).toBe(0); }); it('should remove all chart title divs when only one chart is rendered', function() { - expect(fixture).to.be(0); + expect(fixture).toBe(0); }); }); @@ -246,7 +245,7 @@ describe('Vislib Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect(divs.length).to.be(2); + expect(divs.length).toBe(2); }); }); @@ -272,7 +271,7 @@ describe('Vislib Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect(divs.length).to.be(2); + expect(divs.length).toBe(2); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js index 5d927eaa040bc2..05f6f72246d4a8 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/splits/gauge_chart/splits.test.js @@ -18,7 +18,6 @@ */ import d3 from 'd3'; -import expect from '@kbn/expect'; import $ from 'jquery'; import { chartSplit } from './chart_split'; @@ -172,11 +171,11 @@ describe('Vislib Gauge Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect($('.chart').length).to.be(2); + expect($('.chart').length).toBe(2); }); it('should add the correct class name', function() { - expect(!!$('.visWrapper__splitCharts--row').length).to.be(true); + expect(!!$('.visWrapper__splitCharts--row').length).toBe(true); }); }); @@ -196,8 +195,8 @@ describe('Vislib Gauge Split Function Test Suite', function() { }); it('should append the correct number of divs', function() { - expect($('.visAxis__splitTitles--x .chart-title').length).to.be(2); - expect($('.visAxis__splitTitles--y .chart-title').length).to.be(2); + expect($('.visAxis__splitTitles--x .chart-title').length).toBe(2); + expect($('.visAxis__splitTitles--y .chart-title').length).toBe(2); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js index ea8a7be4d2bf7b..a27ee57e64a5a9 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/layout/types/column_layout.test.js @@ -19,7 +19,6 @@ import d3 from 'd3'; import _ from 'lodash'; -import expect from '@kbn/expect'; import { layoutTypes } from '../layout_types'; @@ -98,13 +97,13 @@ describe('Vislib Column Layout Test Suite', function() { }); it('should return an array of objects', function() { - expect(Array.isArray(columnLayout)).to.be(true); - expect(_.isObject(columnLayout[0])).to.be(true); + expect(Array.isArray(columnLayout)).toBe(true); + expect(_.isObject(columnLayout[0])).toBe(true); }); it('should throw an error when the wrong number or no arguments provided', function() { expect(function() { layoutTypes.point_series(el); - }).to.throwError(); + }).toThrow(); }); }); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js b/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js similarity index 82% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js rename to src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js index 88605b90c6206b..b19d42b35346e1 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/vis_config.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js @@ -17,13 +17,10 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; -import expect from '@kbn/expect'; -import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { VisConfig } from './vis_config'; +import { getMockUiState } from '../../fixtures/_vis_fixture'; describe('Vislib VisConfig Class Test Suite', function() { let el; @@ -111,33 +108,33 @@ describe('Vislib VisConfig Class Test Suite', function() { describe('get Method', function() { it('should be a function', function() { - expect(typeof visConfig.get).to.be('function'); + expect(typeof visConfig.get).toBe('function'); }); it('should get the property', function() { - expect(visConfig.get('el')).to.be(el); - expect(visConfig.get('type')).to.be('point_series'); + expect(visConfig.get('el')).toBe(el); + expect(visConfig.get('type')).toBe('point_series'); }); it('should return defaults if property does not exist', function() { - expect(visConfig.get('this.does.not.exist', 'defaults')).to.be('defaults'); + expect(visConfig.get('this.does.not.exist', 'defaults')).toBe('defaults'); }); it('should throw an error if property does not exist and defaults were not provided', function() { expect(function() { visConfig.get('this.does.not.exist'); - }).to.throwError(); + }).toThrow(); }); }); describe('set Method', function() { it('should be a function', function() { - expect(typeof visConfig.set).to.be('function'); + expect(typeof visConfig.set).toBe('function'); }); it('should set a property', function() { visConfig.set('this.does.not.exist', 'it.does.now'); - expect(visConfig.get('this.does.not.exist')).to.be('it.does.now'); + expect(visConfig.get('this.does.not.exist')).toBe('it.does.now'); }); }); }); diff --git a/src/plugins/vis_type_vislib/public/vislib/vislib.js b/src/plugins/vis_type_vislib/public/vislib/vislib.js deleted file mode 100644 index 024dee60ef2bf4..00000000000000 --- a/src/plugins/vis_type_vislib/public/vislib/vislib.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 './lib/types/pie'; -import './lib/types/point_series'; -import './lib/types'; -import './lib/layout/layout_types'; -import './lib/data'; -import './visualizations/vis_types'; -import { Vis } from './vis'; - -// prefetched for faster optimization runs -// end prefetching - -/** - * Provides the Kibana4 Visualization Library - * - * @module vislib - * @main vislib - * @return {Object} Contains the version number and the Vis Class for creating visualizations - */ -export function VislibProvider() { - return { - version: '0.0.0', - Vis, - }; -} diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js similarity index 80% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js index fa1658f39b3a91..058bdb5de8785f 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/time_marker.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/time_marker.test.js @@ -17,15 +17,12 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import d3 from 'd3'; import $ from 'jquery'; -import expect from '@kbn/expect'; -import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -import terms from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; -import { TimeMarker } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/time_marker'; +import series from '../../fixtures/mock_data/date_histogram/_series'; +import terms from '../../fixtures/mock_data/terms/_columns'; +import { TimeMarker } from './time_marker'; describe('Vislib Time Marker Test Suite', function() { const height = 50; @@ -89,13 +86,13 @@ describe('Vislib Time Marker Test Suite', function() { it('should return true when data is time based', function() { boolean = defaultMarker._isTimeBasedChart(selection); - expect(boolean).to.be(true); + expect(boolean).toBe(true); }); it('should return false when data is not time based', function() { newSelection = selection.datum(terms); boolean = defaultMarker._isTimeBasedChart(newSelection); - expect(boolean).to.be(false); + expect(boolean).toBe(false); }); }); @@ -109,34 +106,34 @@ describe('Vislib Time Marker Test Suite', function() { }); it('should render the default line', function() { - expect(!!$('line.time-marker').length).to.be(true); + expect(!!$('line.time-marker').length).toBe(true); }); it('should render the custom (user defined) lines', function() { - expect($('line.custom-time-marker').length).to.be(myTimes.length); + expect($('line.custom-time-marker').length).toBe(myTimes.length); }); it('should set the class', function() { Array.prototype.forEach.call(lineArray, function(line) { - expect(line.getAttribute('class')).to.be(customClass); + expect(line.getAttribute('class')).toBe(customClass); }); }); it('should set the stroke', function() { Array.prototype.forEach.call(lineArray, function(line) { - expect(line.getAttribute('stroke')).to.be(color); + expect(line.getAttribute('stroke')).toBe(color); }); }); it('should set the stroke-opacity', function() { Array.prototype.forEach.call(lineArray, function(line) { - expect(+line.getAttribute('stroke-opacity')).to.be(opacity); + expect(+line.getAttribute('stroke-opacity')).toBe(opacity); }); }); it('should set the stroke-width', function() { Array.prototype.forEach.call(lineArray, function(line) { - expect(+line.getAttribute('stroke-width')).to.be(width); + expect(+line.getAttribute('stroke-width')).toBe(width); }); }); }); diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js b/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js similarity index 78% rename from src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js rename to src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js index 3a209eddb0f746..df044f46460c87 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/vis_types.js +++ b/src/plugins/vis_type_vislib/public/vislib/visualizations/vis_types.test.js @@ -17,12 +17,9 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ - import _ from 'lodash'; -import expect from '@kbn/expect'; -import { visTypes } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/vis_types'; +import { visTypes } from './vis_types'; describe('Vislib Vis Types Test Suite', function() { let visFunc; @@ -32,10 +29,10 @@ describe('Vislib Vis Types Test Suite', function() { }); it('should be an object', function() { - expect(_.isObject(visTypes)).to.be(true); + expect(_.isObject(visTypes)).toBe(true); }); it('should return a function', function() { - expect(typeof visFunc).to.be('function'); + expect(typeof visFunc).toBe('function'); }); }); From e87d994c8d0af0b657478d469851343ecddec094 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 21 Apr 2020 14:21:12 +0200 Subject: [PATCH 023/134] fix default app id redirect and console breakage --- src/plugins/console/public/lib/es/es.ts | 3 ++ src/plugins/console/public/lib/kb/kb.js | 3 ++ .../public/application/application.ts | 1 + .../public/application/legacy_app.js | 5 +- src/plugins/dashboard/public/plugin.tsx | 3 +- src/plugins/dev_tools/public/plugin.ts | 1 + .../public/application/components/home_app.js | 20 ++++--- .../components/tutorial/tutorial.js | 2 +- .../public/application/kibana_services.ts | 4 +- src/plugins/home/public/plugin.ts | 12 +++-- .../public/navigate_to_default_app.ts | 54 +++++++++++++++++++ src/plugins/kibana_legacy/public/plugin.ts | 43 ++++++++++++--- .../public/application/legacy_app.js | 7 ++- .../visualize/public/kibana_services.ts | 2 +- src/plugins/visualize/public/plugin.ts | 14 ++--- 15 files changed, 140 insertions(+), 34 deletions(-) create mode 100644 src/plugins/kibana_legacy/public/navigate_to_default_app.ts diff --git a/src/plugins/console/public/lib/es/es.ts b/src/plugins/console/public/lib/es/es.ts index f11692e1befadb..74ebb98f071900 100644 --- a/src/plugins/console/public/lib/es/es.ts +++ b/src/plugins/console/public/lib/es/es.ts @@ -36,6 +36,9 @@ export function send(method: string, path: string, data: any) { const options: JQuery.AjaxSettings = { url: '../api/console/proxy?' + stringify({ path, method }, { sort: false }), + headers: { + 'kbn-xsrf': 'kibana', + }, data, contentType: getContentType(data), cache: false, diff --git a/src/plugins/console/public/lib/kb/kb.js b/src/plugins/console/public/lib/kb/kb.js index ef921fa7f476e3..0d0f42319d0d81 100644 --- a/src/plugins/console/public/lib/kb/kb.js +++ b/src/plugins/console/public/lib/kb/kb.js @@ -155,6 +155,9 @@ export function setActiveApi(api) { $.ajax({ url: '../api/console/api_server', dataType: 'json', // disable automatic guessing + headers: { + 'kbn-xsrf': 'kibana', + }, }).then( function(data) { setActiveApi(loadApisFromJson(data)); diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index fbb534753b9086..0b272244c53b2b 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -71,6 +71,7 @@ export interface RenderDeps { share?: SharePluginStart; config: KibanaLegacyStart['config']; usageCollection?: UsageCollectionSetup; + navigateToDefaultApp: KibanaLegacyStart['navigateToDefaultApp']; } let angularModuleInstance: IModule | null = null; diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index b2dbad0dce8426..4268587acb9b58 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -252,10 +252,7 @@ export function initDashboardApp(app, deps) { .otherwise({ template: '', controller: function() { - // TODO this should probably be smarter and avoid the double-redirect if possible - window.location = deps.core.http.basePath.prepend( - `app/kibana#/${deps.config.defaultAppId}` - ); + deps.navigateToDefaultApp(); }, }); }); diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 8ed0b13dc2ce54..0b0ca58cb34651 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -228,13 +228,14 @@ export class DashboardPlugin navigation, share: shareStart, data: dataStart, - kibanaLegacy: { dashboardConfig }, + kibanaLegacy: { dashboardConfig, navigateToDefaultApp }, } = pluginsStart; const deps: RenderDeps = { pluginInitializerContext: this.initializerContext, core: coreStart, dashboardConfig, + navigateToDefaultApp, navigation, share: shareStart, data: dataStart, diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 3f2091e21b17b8..a8abeff8d0c10f 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -125,6 +125,7 @@ export class DevToolsPlugin implements Plugin { ); }, }); + kibanaLegacy.forwardApp('dev_tools', 'dev_tools'); return { register: (devTool: DevTool) => { diff --git a/src/plugins/home/public/application/components/home_app.js b/src/plugins/home/public/application/components/home_app.js index 3b4761e4bbac58..bbbb75cd664f74 100644 --- a/src/plugins/home/public/application/components/home_app.js +++ b/src/plugins/home/public/application/components/home_app.js @@ -24,13 +24,22 @@ import { Home } from './home'; import { FeatureDirectory } from './feature_directory'; import { TutorialDirectory } from './tutorial_directory'; import { Tutorial } from './tutorial/tutorial'; -import { HashRouter as Router, Switch, Route, Redirect } from 'react-router-dom'; +import { HashRouter as Router, Switch, Route } from 'react-router-dom'; import { getTutorial } from '../load_tutorials'; import { replaceTemplateStrings } from './tutorial/replace_template_strings'; import { getServices } from '../kibana_services'; +import { useMount } from 'react-use'; + +const RedirectToDefaultApp = () => { + useMount(() => { + const { kibanaLegacy } = getServices(); + kibanaLegacy.navigateToDefaultApp(); + }); + return null; +}; + export function HomeApp({ directories }) { const { - config, savedObjectsClient, getBasePath, addBasePath, @@ -42,8 +51,6 @@ export function HomeApp({ directories }) { const mlEnabled = environment.ml; const apmUiEnabled = environment.apmUi; - const defaultAppId = config.defaultAppId || 'discover'; - const renderTutorialDirectory = props => { return ( - {/* TODO redirect this right */} - - - + diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.js b/src/plugins/home/public/application/components/tutorial/tutorial.js index 5b2f5315b60ac2..762d7fde252a12 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.js @@ -325,7 +325,7 @@ class TutorialUi extends React.Component { }); if (overviewDashboard) { label = overviewDashboard.linkLabel; - url = this.props.addBasePath(`/app/kibana#/dashboard/${overviewDashboard.id}`); + url = this.props.addBasePath(`/app/dashboards#/view/${overviewDashboard.id}`); } } diff --git a/src/plugins/home/public/application/kibana_services.ts b/src/plugins/home/public/application/kibana_services.ts index 5e36efe9562087..8bd651d038128d 100644 --- a/src/plugins/home/public/application/kibana_services.ts +++ b/src/plugins/home/public/application/kibana_services.ts @@ -29,7 +29,7 @@ import { } from 'kibana/public'; import { UiStatsMetricType } from '@kbn/analytics'; import { TelemetryPluginStart } from '../../../telemetry/public'; -import { KibanaLegacySetup } from '../../../kibana_legacy/public'; +import { KibanaLegacyStart } from '../../../kibana_legacy/public'; import { TutorialService } from '../services/tutorials'; import { FeatureCatalogueRegistry } from '../services/feature_catalogue'; import { EnvironmentService } from '../services/environment'; @@ -41,7 +41,7 @@ export interface HomeKibanaServices { chrome: ChromeStart; application: ApplicationStart; uiSettings: IUiSettingsClient; - config: KibanaLegacySetup['config']; + kibanaLegacy: KibanaLegacyStart; homeConfig: ConfigSchema; featureCatalogue: FeatureCatalogueRegistry; http: HttpStart; diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 2f9aa5aeead6eb..37f1488d5081bb 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -38,11 +38,12 @@ import { setServices } from './application/kibana_services'; import { DataPublicPluginStart } from '../../data/public'; import { TelemetryPluginStart } from '../../telemetry/public'; import { UsageCollectionSetup } from '../../usage_collection/public'; -import { KibanaLegacySetup } from '../../kibana_legacy/public'; +import { KibanaLegacySetup, KibanaLegacyStart } from '../../kibana_legacy/public'; export interface HomePluginStartDependencies { data: DataPublicPluginStart; telemetry?: TelemetryPluginStart; + kibanaLegacy: KibanaLegacyStart; } export interface HomePluginSetupDependencies { @@ -71,7 +72,10 @@ export class HomePublicPlugin const trackUiMetric = usageCollection ? usageCollection.reportUiStats.bind(usageCollection, 'Kibana_home') : () => {}; - const [coreStart, { telemetry, data }] = await core.getStartServices(); + const [ + coreStart, + { telemetry, data, kibanaLegacy: kibanaLegacyStart }, + ] = await core.getStartServices(); setServices({ trackUiMetric, kibanaVersion: this.initializerContext.env.packageInfo.version, @@ -88,7 +92,7 @@ export class HomePublicPlugin getBasePath: core.http.basePath.get, indexPatternService: data.indexPatterns, environmentService: this.environmentService, - config: kibanaLegacy.config, + kibanaLegacy: kibanaLegacyStart, homeConfig: this.initializerContext.config.get(), tutorialService: this.tutorialService, featureCatalogue: this.featuresCatalogueRegistry, @@ -97,6 +101,8 @@ export class HomePublicPlugin return await renderApp(params.element); }, }); + kibanaLegacy.forwardApp('home', 'home'); + return { featureCatalogue: { ...this.featuresCatalogueRegistry.setup() }, environment: { ...this.environmentService.setup() }, diff --git a/src/plugins/kibana_legacy/public/navigate_to_default_app.ts b/src/plugins/kibana_legacy/public/navigate_to_default_app.ts new file mode 100644 index 00000000000000..61e546d3de01c1 --- /dev/null +++ b/src/plugins/kibana_legacy/public/navigate_to_default_app.ts @@ -0,0 +1,54 @@ +/* + * 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 { ApplicationStart, IBasePath } from 'kibana/public'; +import { ForwardDefinition } from './plugin'; + +export function navigateToDefaultApp( + defaultAppId: string, + forwards: ForwardDefinition[], + application: ApplicationStart, + basePath: IBasePath, + currentAppId: string | undefined +) { + // navigate to the respective path in the legacy kibana plugin by default (for unmigrated plugins) + let targetAppId = 'kibana'; + let targetAppPath = `#/${defaultAppId}`; + + // try to find an existing redirect for the target path if possible + // this avoids having to load the legacy app just to get redirected to a core application again afterwards + const relevantForward = forwards.find(forward => defaultAppId.startsWith(forward.legacyAppId)); + if (relevantForward) { + targetAppPath = relevantForward.rewritePath(`/${defaultAppId}`); + targetAppId = relevantForward.newAppId; + } + + // when the correct app is already loaded, just set the hash to the right value + // otherwise use navigateToApp (or setting href in case of kibana app) + if (currentAppId !== targetAppId) { + if (targetAppId === 'kibana') { + // exception for kibana app because redirect won't work right otherwise + window.location.href = basePath.prepend(`/app/kibana${targetAppPath}`); + } else { + application.navigateToApp(targetAppId, { path: targetAppPath }); + } + } else { + window.location.hash = targetAppPath; + } +} diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index 831fc3f0d4a71f..c4c97448c98561 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -24,9 +24,10 @@ import { AppUpdatableFields, CoreStart, } from 'kibana/public'; -import { Observable } from 'rxjs'; +import { Observable, Subscription } from 'rxjs'; import { ConfigSchema } from '../config'; import { getDashboardConfig } from './dashboard_config'; +import { navigateToDefaultApp } from './navigate_to_default_app'; interface LegacyAppAliasDefinition { legacyAppId: string; @@ -34,7 +35,7 @@ interface LegacyAppAliasDefinition { keepPrefix: boolean; } -interface ForwardDefinition { +export interface ForwardDefinition { legacyAppId: string; newAppId: string; rewritePath: (legacyPath: string) => string; @@ -62,6 +63,8 @@ export class KibanaLegacyPlugin { private apps: AngularRenderedApp[] = []; private legacyAppAliases: LegacyAppAliasDefinition[] = []; private forwardDefinitions: ForwardDefinition[] = []; + private currentAppId: string | undefined; + private currentAppIdSubscription: Subscription | undefined; constructor(private readonly initializerContext: PluginInitializerContext) {} @@ -121,7 +124,9 @@ export class KibanaLegacyPlugin { * * @param legacyAppId The name of the old app to forward URLs from * @param newAppId The name of the new app that handles the URLs now - * @param rewritePath Function to rewrite the legacy sub path of the app to the new path in the core app + * @param rewritePath Function to rewrite the legacy sub path of the app to the new path in the core app. + * If none is provided, it will just strip the prefix of the legacyAppId away + * * path into the new path * * Example usage: @@ -147,9 +152,13 @@ export class KibanaLegacyPlugin { forwardApp: ( legacyAppId: string, newAppId: string, - rewritePath: (legacyPath: string) => string + rewritePath?: (legacyPath: string) => string ) => { - this.forwardDefinitions.push({ legacyAppId, newAppId, rewritePath }); + this.forwardDefinitions.push({ + legacyAppId, + newAppId, + rewritePath: rewritePath || (path => `#${path.replace(`/${legacyAppId}`, '') || '/'}`), + }); }, /** @@ -166,7 +175,10 @@ export class KibanaLegacyPlugin { }; } - public start({ application }: CoreStart) { + public start({ application, http: { basePath } }: CoreStart) { + this.currentAppIdSubscription = application.currentAppId$.subscribe(currentAppId => { + this.currentAppId = currentAppId; + }); return { /** * @deprecated @@ -185,8 +197,27 @@ export class KibanaLegacyPlugin { getForwards: () => this.forwardDefinitions, config: this.initializerContext.config.get(), dashboardConfig: getDashboardConfig(!application.capabilities.dashboard.showWriteControls), + /** + * Navigates to the app defined as kibana.defaultAppId. + * This takes redirects into account and uses the right mechanism to navigate. + */ + navigateToDefaultApp: () => { + navigateToDefaultApp( + this.initializerContext.config.get().defaultAppId, + this.forwardDefinitions, + application, + basePath, + this.currentAppId + ); + }, }; } + + public stop() { + if (this.currentAppIdSubscription) { + this.currentAppIdSubscription.unsubscribe(); + } + } } export type KibanaLegacySetup = ReturnType; diff --git a/src/plugins/visualize/public/application/legacy_app.js b/src/plugins/visualize/public/application/legacy_app.js index 088d373dc1b29f..4cf1bc60d0f8a6 100644 --- a/src/plugins/visualize/public/application/legacy_app.js +++ b/src/plugins/visualize/public/application/legacy_app.js @@ -227,8 +227,11 @@ export function initVisualizeApp(app, deps) { }, }, }) - .when(`visualize/:tail*?`, { - redirectTo: `/${deps.config.defaultAppId}`, + .otherwise({ + template: '', + controller: function() { + deps.kibanaLegacy.navigateToDefaultApp(); + }, }); }); } diff --git a/src/plugins/visualize/public/kibana_services.ts b/src/plugins/visualize/public/kibana_services.ts index 70fe086587d7d5..16de7891e22409 100644 --- a/src/plugins/visualize/public/kibana_services.ts +++ b/src/plugins/visualize/public/kibana_services.ts @@ -48,7 +48,7 @@ export interface VisualizeKibanaServices { savedObjectsClient: SavedObjectsClientContract; savedVisualizations: SavedVisualizations; share?: SharePluginStart; - config: KibanaLegacyStart['config']; + kibanaLegacy: KibanaLegacyStart; visualizeCapabilities: any; visualizations: VisualizationsStart; dashboard: DashboardStart; diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 07c62769e52448..4d10fdef20b4ac 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -33,7 +33,11 @@ import { Storage, createKbnUrlTracker } from '../../kibana_utils/public'; import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public'; import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; import { SharePluginStart } from '../../share/public'; -import { KibanaLegacySetup, AngularRenderedAppUpdater } from '../../kibana_legacy/public'; +import { + KibanaLegacySetup, + AngularRenderedAppUpdater, + KibanaLegacyStart, +} from '../../kibana_legacy/public'; import { VisualizationsStart } from '../../visualizations/public'; import { VisualizeConstants } from './application/visualize_constants'; import { setServices, VisualizeKibanaServices } from './kibana_services'; @@ -47,6 +51,7 @@ export interface VisualizePluginStartDependencies { share?: SharePluginStart; visualizations: VisualizationsStart; dashboard: DashboardStart; + kibanaLegacy: KibanaLegacyStart; } export interface VisualizePluginSetupDependencies { @@ -114,7 +119,7 @@ export class VisualizePlugin pluginInitializerContext: this.initializerContext, addBasePath: coreStart.http.basePath.prepend, core: coreStart, - config: kibanaLegacy.config, + kibanaLegacy: pluginsStart.kibanaLegacy, chrome: coreStart.chrome, data: pluginsStart.data, localStorage: new Storage(localStorage), @@ -144,10 +149,7 @@ export class VisualizePlugin }, }); - kibanaLegacy.forwardApp('visualize', 'visualize', path => { - const newPath = path.replace(/\/visualize/, ''); - return `#${newPath}`; - }); + kibanaLegacy.forwardApp('visualize', 'visualize'); if (home) { home.featureCatalogue.register({ From 12d81765661728c0862484b325a4519c1104070a Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 21 Apr 2020 17:16:53 +0200 Subject: [PATCH 024/134] use navigateToApp in context menu --- docs/user/dashboard.asciidoc | 2 +- src/legacy/core_plugins/kibana/index.js | 2 +- .../embeddable/grid/dashboard_grid.tsx | 1 + .../tests/dashboard_container.test.tsx | 1 + .../lib/actions/edit_panel_action.test.tsx | 10 +++---- .../public/lib/actions/edit_panel_action.ts | 29 ++++++++++++++++--- .../embeddable_child_panel.test.tsx | 2 ++ .../lib/containers/embeddable_child_panel.tsx | 2 ++ .../public/lib/embeddables/i_embeddable.ts | 2 ++ .../lib/panel/embeddable_panel.test.tsx | 6 ++++ .../public/lib/panel/embeddable_panel.tsx | 3 +- .../embeddables/hello_world_container.tsx | 2 ++ .../hello_world_container_component.tsx | 2 ++ src/plugins/embeddable/public/plugin.tsx | 1 + .../public/tests/apply_filter_action.test.ts | 2 ++ .../embeddable/public/tests/container.test.ts | 8 +++++ .../tests/customize_panel_modal.test.tsx | 1 + .../public/tests/explicit_input.test.ts | 2 ++ .../sample_data_view_data_button.js | 4 +-- src/plugins/kibana_legacy/public/mocks.ts | 1 + .../create_vis_embeddable_from_object.ts | 4 ++- .../public/embeddable/visualize_embeddable.ts | 7 ++++- .../public/wizard/new_vis_modal.test.tsx | 11 ++++++- .../type_selection/new_vis_help.test.tsx | 3 +- src/plugins/visualize/public/plugin.ts | 4 +-- .../renderers/embeddable/embeddable.tsx | 1 + .../components/embeddables/embedded_map.tsx | 1 + .../data_or_index_missing.test.tsx.snap | 2 +- .../embeddable/embeddable.test.tsx | 5 ++++ .../embeddable/embeddable.tsx | 5 +++- .../embeddable/embeddable_factory.ts | 3 +- x-pack/plugins/lens/server/saved_objects.ts | 2 +- .../components/no_index_pattern_callout.js | 2 +- .../components/login_form/login_form.test.tsx | 4 +-- 34 files changed, 109 insertions(+), 28 deletions(-) diff --git a/docs/user/dashboard.asciidoc b/docs/user/dashboard.asciidoc index ab529a533d5e37..67cf974a14ed44 100644 --- a/docs/user/dashboard.asciidoc +++ b/docs/user/dashboard.asciidoc @@ -156,7 +156,7 @@ to view an embedded dashboard. * Generate a PNG report TIP: To create a link to a dashboard by title, use: + -`${domain}/${basepath?}/app/kibana#/dashboards?title=${yourdashboardtitle}` +`${domain}/${basepath?}/app/dashboards#/list?title=${yourdashboardtitle}` TIP: When sharing a link to a dashboard snapshot, use the *Short URL*. Snapshot URLs are long and can be problematic for Internet Explorer and other diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 37a3506016c844..6c8bad2a240792 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -103,7 +103,7 @@ export default function(kibana) { }, getInAppUrl(obj) { return { - path: `/app/kibana#/dashboard/${encodeURIComponent(obj.id)}`, + path: `/app/dashboards#/view/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'dashboard.show', }; }, diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx index b15a813aff903b..469bb494424236 100644 --- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx @@ -274,6 +274,7 @@ class DashboardGridUi extends React.Component { getEmbeddableFactory={this.props.kibana.services.embeddable.getEmbeddableFactory} getAllEmbeddableFactories={this.props.kibana.services.embeddable.getEmbeddableFactories} overlays={this.props.kibana.services.overlays} + application={this.props.kibana.services.application} notifications={this.props.kibana.services.notifications} inspector={this.props.kibana.services.inspector} SavedObjectFinder={this.props.kibana.services.SavedObjectFinder} diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx index 836cea298f0354..a363f6bf11b79a 100644 --- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx +++ b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx @@ -85,6 +85,7 @@ test('DashboardContainer in edit mode shows edit mode actions', async () => { getEmbeddableFactory={(() => null) as any} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} /> diff --git a/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx b/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx index d07bf915845e9a..fc5438b8c8dcb8 100644 --- a/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx +++ b/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx @@ -41,7 +41,7 @@ class EditableEmbeddable extends Embeddable { } test('is compatible when edit url is available, in edit mode and editable', async () => { - const action = new EditPanelAction(getFactory); + const action = new EditPanelAction(getFactory, {} as any); expect( await action.isCompatible({ embeddable: new EditableEmbeddable({ id: '123', viewMode: ViewMode.EDIT }, true), @@ -50,7 +50,7 @@ test('is compatible when edit url is available, in edit mode and editable', asyn }); test('getHref returns the edit urls', async () => { - const action = new EditPanelAction(getFactory); + const action = new EditPanelAction(getFactory, {} as any); expect(action.getHref).toBeDefined(); if (action.getHref) { @@ -64,7 +64,7 @@ test('getHref returns the edit urls', async () => { }); test('is not compatible when edit url is not available', async () => { - const action = new EditPanelAction(getFactory); + const action = new EditPanelAction(getFactory, {} as any); const embeddable = new ContactCardEmbeddable( { id: '123', @@ -83,7 +83,7 @@ test('is not compatible when edit url is not available', async () => { }); test('is not visible when edit url is available but in view mode', async () => { - const action = new EditPanelAction(getFactory); + const action = new EditPanelAction(getFactory, {} as any); expect( await action.isCompatible({ embeddable: new EditableEmbeddable( @@ -98,7 +98,7 @@ test('is not visible when edit url is available but in view mode', async () => { }); test('is not compatible when edit url is available, in edit mode, but not editable', async () => { - const action = new EditPanelAction(getFactory); + const action = new EditPanelAction(getFactory, {} as any); expect( await action.isCompatible({ embeddable: new EditableEmbeddable( diff --git a/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts b/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts index 044e7b5d35ad8b..0abbc25ff49a62 100644 --- a/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts +++ b/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts @@ -18,6 +18,7 @@ */ import { i18n } from '@kbn/i18n'; +import { ApplicationStart } from 'kibana/public'; import { Action } from 'src/plugins/ui_actions/public'; import { ViewMode } from '../types'; import { EmbeddableFactoryNotFoundError } from '../errors'; @@ -35,7 +36,10 @@ export class EditPanelAction implements Action { public readonly id = ACTION_EDIT_PANEL; public order = 15; - constructor(private readonly getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory']) {} + constructor( + private readonly getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory'], + private readonly application: ApplicationStart + ) {} public getDisplayName({ embeddable }: ActionContext) { const factory = this.getEmbeddableFactory(embeddable.type); @@ -56,18 +60,35 @@ export class EditPanelAction implements Action { public async isCompatible({ embeddable }: ActionContext) { const canEditEmbeddable = Boolean( - embeddable && embeddable.getOutput().editable && embeddable.getOutput().editUrl + embeddable && + embeddable.getOutput().editable && + (embeddable.getOutput().editUrl || + (embeddable.getOutput().editApp && embeddable.getOutput().editPath)) ); const inDashboardEditMode = embeddable.getInput().viewMode === ViewMode.EDIT; return Boolean(canEditEmbeddable && inDashboardEditMode); } public async execute(context: ActionContext) { + const appTarget = this.getAppTarget(context); + + if (appTarget) { + await this.application.navigateToApp(appTarget.app, { path: appTarget.path }); + return; + } + const href = await this.getHref(context); if (href) { - // TODO: when apps start using browser router instead of hash router this has to be fixed - // https://github.com/elastic/kibana/issues/58217 window.location.href = href; + return; + } + } + + public getAppTarget({ embeddable }: ActionContext): { app: string; path: string } | undefined { + const app = embeddable ? embeddable.getOutput().editApp : undefined; + const path = embeddable ? embeddable.getOutput().editPath : undefined; + if (app && path) { + return { app, path }; } } diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index 2a0ffd723850b3..b046376a304ae0 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx @@ -66,6 +66,7 @@ test('EmbeddableChildPanel renders an embeddable when it is done loading', async getAllEmbeddableFactories={start.getEmbeddableFactories} getEmbeddableFactory={getEmbeddableFactory} notifications={{} as any} + application={{} as any} overlays={{} as any} inspector={inspector} SavedObjectFinder={() => null} @@ -105,6 +106,7 @@ test(`EmbeddableChildPanel renders an error message if the factory doesn't exist getEmbeddableFactory={(() => undefined) as any} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} /> diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx index 4c08a80a356bff..70628665e6e8c9 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx @@ -40,6 +40,7 @@ export interface EmbeddableChildPanelProps { getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories']; overlays: CoreStart['overlays']; notifications: CoreStart['notifications']; + application: CoreStart['application']; inspector: InspectorStartContract; SavedObjectFinder: React.ComponentType; } @@ -101,6 +102,7 @@ export class EmbeddableChildPanel extends React.Component { getAllEmbeddableFactories={start.getEmbeddableFactories} getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} + application={{} as any} overlays={{} as any} inspector={inspector} SavedObjectFinder={() => null} @@ -198,6 +199,7 @@ const renderInEditModeAndOpenContextMenu = async ( getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} /> @@ -296,6 +298,7 @@ test('HelloWorldContainer in edit mode shows edit mode actions', async () => { getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} /> @@ -358,6 +361,7 @@ test('Updates when hidePanelTitles is toggled', async () => { getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} /> @@ -410,6 +414,7 @@ test('Check when hide header option is false', async () => { getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} hideHeader={false} @@ -447,6 +452,7 @@ test('Check when hide header option is true', async () => { getEmbeddableFactory={start.getEmbeddableFactory} notifications={{} as any} overlays={{} as any} + application={{} as any} inspector={inspector} SavedObjectFinder={() => null} hideHeader={true} diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx index b95060a73252f0..c43359382a33d2 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx @@ -45,6 +45,7 @@ interface Props { getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories']; overlays: CoreStart['overlays']; notifications: CoreStart['notifications']; + application: CoreStart['application']; inspector: InspectorStartContract; SavedObjectFinder: React.ComponentType; hideHeader?: boolean; @@ -243,7 +244,7 @@ export class EmbeddablePanel extends React.Component { ), new InspectPanelAction(this.props.inspector), new RemovePanelAction(), - new EditPanelAction(this.props.getEmbeddableFactory), + new EditPanelAction(this.props.getEmbeddableFactory, this.props.application), ]; const sorted = actions diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx index a88c3ba0863259..31e14a0af59d7d 100644 --- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx @@ -49,6 +49,7 @@ interface HelloWorldContainerOptions { getEmbeddableFactory: EmbeddableStart['getEmbeddableFactory']; getAllEmbeddableFactories: EmbeddableStart['getEmbeddableFactories']; overlays: CoreStart['overlays']; + application: CoreStart['application']; notifications: CoreStart['notifications']; inspector: InspectorStartContract; SavedObjectFinder: React.ComponentType; @@ -81,6 +82,7 @@ export class HelloWorldContainer extends Container; @@ -112,6 +113,7 @@ export class HelloWorldContainerComponent extends Component { getAllEmbeddableFactories={this.props.getAllEmbeddableFactories} overlays={this.props.overlays} notifications={this.props.notifications} + application={this.props.application} inspector={this.props.inspector} SavedObjectFinder={this.props.SavedObjectFinder} /> diff --git a/src/plugins/embeddable/public/plugin.tsx b/src/plugins/embeddable/public/plugin.tsx index 01fbf52c801823..36f49f2508e805 100644 --- a/src/plugins/embeddable/public/plugin.tsx +++ b/src/plugins/embeddable/public/plugin.tsx @@ -118,6 +118,7 @@ export class EmbeddablePublicPlugin implements Plugin diff --git a/src/plugins/embeddable/public/tests/apply_filter_action.test.ts b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts index 3bd414ecf0d4a9..ebb76c743393bc 100644 --- a/src/plugins/embeddable/public/tests/apply_filter_action.test.ts +++ b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts @@ -110,6 +110,7 @@ test('ApplyFilterAction is incompatible if the root container does not accept a getAllEmbeddableFactories: api.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector, SavedObjectFinder: () => null, } @@ -145,6 +146,7 @@ test('trying to execute on incompatible context throws an error ', async () => { getAllEmbeddableFactories: api.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector, SavedObjectFinder: () => null, } diff --git a/src/plugins/embeddable/public/tests/container.test.ts b/src/plugins/embeddable/public/tests/container.test.ts index 1aae43550ec6fc..d2769e208ba422 100644 --- a/src/plugins/embeddable/public/tests/container.test.ts +++ b/src/plugins/embeddable/public/tests/container.test.ts @@ -74,6 +74,7 @@ async function creatHelloWorldContainerAndEmbeddable( getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, }); @@ -147,6 +148,7 @@ test('Container.removeEmbeddable removes and cleans up', async done => { getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -327,6 +329,7 @@ test(`Container updates its state when a child's input is updated`, async done = getEmbeddableFactory: start.getEmbeddableFactory, notifications: coreStart.notifications, overlays: coreStart.overlays, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, }); @@ -584,6 +587,7 @@ test('Container changes made directly after adding a new embeddable are propagat getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -708,6 +712,7 @@ test('untilEmbeddableLoaded() throws an error if there is no such child panel in getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -742,6 +747,7 @@ test('untilEmbeddableLoaded() resolves if child is loaded in the container', asy getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -781,6 +787,7 @@ test('untilEmbeddableLoaded resolves with undefined if child is subsequently rem getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -821,6 +828,7 @@ test('adding a panel then subsequently removing it before its loaded removes the getAllEmbeddableFactories: start.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } diff --git a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx index 19e461b8bde7e8..a9cb83504d9584 100644 --- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -63,6 +63,7 @@ beforeEach(async () => { getAllEmbeddableFactories: api.getEmbeddableFactories, overlays: coreStart.overlays, notifications: coreStart.notifications, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } diff --git a/src/plugins/embeddable/public/tests/explicit_input.test.ts b/src/plugins/embeddable/public/tests/explicit_input.test.ts index 0e03db3ec83584..ef3c4b6f17e7f6 100644 --- a/src/plugins/embeddable/public/tests/explicit_input.test.ts +++ b/src/plugins/embeddable/public/tests/explicit_input.test.ts @@ -88,6 +88,7 @@ test('Explicit embeddable input mapped to undefined with no inherited value will getEmbeddableFactory: start.getEmbeddableFactory, notifications: coreStart.notifications, overlays: coreStart.overlays, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } @@ -136,6 +137,7 @@ test('Explicit input tests in async situations', (done: () => void) => { getEmbeddableFactory: start.getEmbeddableFactory, notifications: coreStart.notifications, overlays: coreStart.overlays, + application: coreStart.application, inspector: {} as any, SavedObjectFinder: () => null, } diff --git a/src/plugins/home/public/application/components/sample_data_view_data_button.js b/src/plugins/home/public/application/components/sample_data_view_data_button.js index a8a3cda3f95554..6a64bf64d06d3c 100644 --- a/src/plugins/home/public/application/components/sample_data_view_data_button.js +++ b/src/plugins/home/public/application/components/sample_data_view_data_button.js @@ -56,9 +56,7 @@ export class SampleDataViewDataButton extends React.Component { }, } ); - const dashboardPath = this.addBasePath( - `/app/kibana#/dashboard/${this.props.overviewDashboard}` - ); + const dashboardPath = this.addBasePath(`/app/dashboards#/view/${this.props.overviewDashboard}`); if (this.props.appLinks.length === 0) { return ( diff --git a/src/plugins/kibana_legacy/public/mocks.ts b/src/plugins/kibana_legacy/public/mocks.ts index 2fdd0d8b4be590..5bdc76d44e4bf6 100644 --- a/src/plugins/kibana_legacy/public/mocks.ts +++ b/src/plugins/kibana_legacy/public/mocks.ts @@ -47,6 +47,7 @@ const createStartContract = (): Start => ({ turnHideWriteControlsOn: jest.fn(), getHideWriteControls: jest.fn(), }, + navigateToDefaultApp: jest.fn(), }); export const kibanaLegacyPluginMock = { diff --git a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts index 8e51bd4ac5d4fa..81794c31527adb 100644 --- a/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts +++ b/src/plugins/visualizations/public/embeddable/create_vis_embeddable_from_object.ts @@ -40,8 +40,9 @@ export const createVisEmbeddableFromObject = (deps: VisualizeEmbeddableFactoryDe try { const visId = vis.id as string; + const editPath = visId ? savedVisualizations.urlFor(visId) : ''; const editUrl = visId - ? getHttp().basePath.prepend(`/app/kibana${savedVisualizations.urlFor(visId)}`) + ? getHttp().basePath.prepend(`/app/visualize${savedVisualizations.urlFor(visId)}`) : ''; const isLabsEnabled = getUISettings().get('visualize:enableLabs'); @@ -57,6 +58,7 @@ export const createVisEmbeddableFromObject = (deps: VisualizeEmbeddableFactoryDe { vis, indexPatterns, + editPath, editUrl, editable, deps, diff --git a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts index ffb028ff131b39..d7458a4b231396 100644 --- a/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts @@ -49,6 +49,7 @@ const getKeys = (o: T): Array => Object.keys(o) as Array< export interface VisualizeEmbeddableConfiguration { vis: Vis; indexPatterns?: IIndexPattern[]; + editPath: string; editUrl: string; editable: boolean; deps: VisualizeEmbeddableFactoryDeps; @@ -64,6 +65,8 @@ export interface VisualizeInput extends EmbeddableInput { } export interface VisualizeOutput extends EmbeddableOutput { + editPath: string; + editApp: string; editUrl: string; indexPatterns?: IIndexPattern[]; visTypeName: string; @@ -90,7 +93,7 @@ export class VisualizeEmbeddable extends Embeddable { const { location } = window; @@ -80,6 +80,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -94,6 +95,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -110,6 +112,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -128,6 +131,7 @@ describe('NewVisModal', () => { editorParams={['foo=true', 'bar=42']} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -147,6 +151,7 @@ describe('NewVisModal', () => { editorParams={['foo=true', 'bar=42', 'addToDashboard']} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -167,6 +172,7 @@ describe('NewVisModal', () => { editorParams={['foo=true', 'bar=42']} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -186,6 +192,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -205,6 +212,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); @@ -220,6 +228,7 @@ describe('NewVisModal', () => { visTypesRegistry={visTypes} addBasePath={addBasePath} uiSettings={uiSettings} + application={{} as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); diff --git a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx index a7967eea5ba06c..7e226fd39fe163 100644 --- a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx +++ b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx @@ -28,6 +28,7 @@ describe('NewVisHelp', () => { {

diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 4d10fdef20b4ac..c27aba9cecc708 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -73,8 +73,8 @@ export class VisualizePlugin { home, kibanaLegacy, data }: VisualizePluginSetupDependencies ) { const { appMounted, appUnMounted, stop: stopUrlTracker, setActiveUrl } = createKbnUrlTracker({ - baseUrl: core.http.basePath.prepend('/app/kibana'), - defaultSubUrl: '#/visualize', + baseUrl: core.http.basePath.prepend('/app/visualize'), + defaultSubUrl: '#/', storageKey: `lastUrl:${core.http.basePath.get()}:visualize`, navLinkUpdater$: this.appStateUpdater, toastNotifications: core.notifications.toasts, diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx index a1096d50c16535..321a385b4b64c1 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/embeddable.tsx @@ -43,6 +43,7 @@ const renderEmbeddableFactory = (core: CoreStart, plugins: StartDeps) => { getEmbeddableFactory={plugins.embeddable.getEmbeddableFactory} getAllEmbeddableFactories={plugins.embeddable.getEmbeddableFactories} notifications={core.notifications} + application={core.application} overlays={core.overlays} inspector={plugins.inspector} SavedObjectFinder={getSavedObjectFinder(core.savedObjects, core.uiSettings)} diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx index a7272593c2b27f..0bbe1d70ec49af 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx @@ -206,6 +206,7 @@ export const EmbeddedMapComponent = ({ getEmbeddableFactory={npStart.plugins.embeddable.getEmbeddableFactory} getAllEmbeddableFactories={npStart.plugins.embeddable.getEmbeddableFactories} notifications={services.notifications} + application={services.application} overlays={services.overlays} inspector={services.inspector} SavedObjectFinder={getSavedObjectFinder(services.savedObjects, services.uiSettings)} diff --git a/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap b/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap index 25ac5a1f0974e9..d7651fe6db4344 100644 --- a/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap +++ b/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/__tests__/__snapshots__/data_or_index_missing.test.tsx.snap @@ -24,7 +24,7 @@ exports[`DataOrIndexMissing component renders headingMessage 1`] = ` { dataPluginMock.createSetupContract().query.timefilter.timefilter, expressionRenderer, { + editPath: '', editUrl: '', editable: true, savedVis, @@ -70,6 +71,7 @@ describe('embeddable', () => { dataPluginMock.createSetupContract().query.timefilter.timefilter, expressionRenderer, { + editPath: '', editUrl: '', editable: true, savedVis, @@ -96,6 +98,7 @@ describe('embeddable', () => { dataPluginMock.createSetupContract().query.timefilter.timefilter, expressionRenderer, { + editPath: '', editUrl: '', editable: true, savedVis, @@ -120,6 +123,7 @@ describe('embeddable', () => { dataPluginMock.createSetupContract().query.timefilter.timefilter, expressionRenderer, { + editPath: '', editUrl: '', editable: true, savedVis, @@ -151,6 +155,7 @@ describe('embeddable', () => { timefilter, expressionRenderer, { + editPath: '', editUrl: '', editable: true, savedVis, diff --git a/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx b/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx index 0ef5f6d1a54706..3b9b6357aa3e38 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx @@ -31,6 +31,7 @@ import { ExpressionWrapper } from './expression_wrapper'; export interface LensEmbeddableConfiguration { savedVis: Document; editUrl: string; + editPath: string; editable: boolean; indexPatterns?: IIndexPattern[]; } @@ -64,7 +65,7 @@ export class Embeddable extends AbstractEmbeddable obj.attributes.title, getInAppUrl: (obj: { id: string }) => ({ - path: getEditPath(obj.id), + path: `/app/lens${getEditPath(obj.id)}`, uiCapabilitiesPath: 'visualize.show', }), }, diff --git a/x-pack/plugins/maps/public/components/no_index_pattern_callout.js b/x-pack/plugins/maps/public/components/no_index_pattern_callout.js index 13196075468088..f6c8b7ebba63b6 100644 --- a/x-pack/plugins/maps/public/components/no_index_pattern_callout.js +++ b/x-pack/plugins/maps/public/components/no_index_pattern_callout.js @@ -40,7 +40,7 @@ export function NoIndexPatternCallout() { id="xpack.maps.noIndexPattern.hintDescription" defaultMessage="Don't have any geospatial data sets? " /> - + { it('properly redirects after successful login', async () => { window.location.href = `https://some-host/login?next=${encodeURIComponent( - '/some-base-path/app/kibana#/home?_g=()' + '/some-base-path/app/home#/?_g=()' )}`; const coreStartMock = coreMock.createStart({ basePath: '/some-base-path' }); coreStartMock.http.post.mockResolvedValue({}); @@ -140,7 +140,7 @@ describe('LoginForm', () => { body: JSON.stringify({ username: 'username1', password: 'password1' }), }); - expect(window.location.href).toBe('/some-base-path/app/kibana#/home?_g=()'); + expect(window.location.href).toBe('/some-base-path/app/home#/?_g=()'); expect(wrapper.find(EuiCallOut).exists()).toBe(false); }); From c3cefe461c29bf68feaee6b5da0d4e125563e529 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 22 Apr 2020 10:53:44 +0200 Subject: [PATCH 025/134] include discover into cutover PR --- src/legacy/core_plugins/kibana/index.js | 12 +----- .../server/lib/__tests__/relationships.js | 4 +- .../ui/ui_nav_links/__tests__/ui_nav_link.js | 14 +++---- .../field_formats/converters/url.test.ts | 8 ++-- .../data/server/saved_objects/query.ts | 2 +- .../data/server/saved_objects/search.ts | 2 +- .../public/application/angular/context.js | 6 +-- .../public/application/angular/discover.js | 14 ++++--- .../embeddable/search_embeddable.ts | 11 ++++- .../embeddable/search_embeddable_factory.ts | 3 +- src/plugins/discover/public/index.ts | 4 ++ src/plugins/discover/public/plugin.ts | 18 ++++++--- .../discover/public/register_feature.ts | 2 +- .../public/saved_searches/_saved_search.ts | 2 +- .../public/saved_searches/saved_searches.ts | 2 +- .../tutorials/activemq_metrics/index.ts | 2 +- .../tutorials/aerospike_metrics/index.ts | 2 +- .../server/tutorials/azure_metrics/index.ts | 2 +- .../server/tutorials/ceph_metrics/index.ts | 2 +- .../server/tutorials/coredns_metrics/index.ts | 2 +- .../tutorials/couchbase_metrics/index.ts | 2 +- .../tutorials/dropwizard_metrics/index.ts | 2 +- .../tutorials/elasticsearch_logs/index.ts | 2 +- .../tutorials/elasticsearch_metrics/index.ts | 2 +- .../server/tutorials/etcd_metrics/index.ts | 2 +- .../server/tutorials/haproxy_metrics/index.ts | 2 +- .../server/tutorials/ibmmq_metrics/index.ts | 2 +- .../server/tutorials/kafka_metrics/index.ts | 2 +- .../server/tutorials/kibana_metrics/index.ts | 2 +- .../tutorials/logstash_metrics/index.ts | 2 +- .../tutorials/memcached_metrics/index.ts | 2 +- .../server/tutorials/munin_metrics/index.ts | 2 +- .../server/tutorials/oracle_metrics/index.ts | 2 +- .../tutorials/prometheus_metrics/index.ts | 2 +- .../redisenterprise_metrics/index.ts | 2 +- .../server/tutorials/vsphere_metrics/index.ts | 2 +- .../server/tutorials/windows_metrics/index.ts | 2 +- .../tutorials/zookeeper_metrics/index.ts | 2 +- .../url/hash_unhash_url.test.ts | 40 +++++++++---------- .../__snapshots__/relationships.test.tsx.snap | 2 +- .../components/relationships.test.tsx | 2 +- .../share/public/lib/url_shortener.test.ts | 4 +- .../apis/saved_objects_management/find.ts | 2 +- .../saved_objects_management/relationships.ts | 8 ++-- .../DiscoverLinks.integration.test.tsx | 8 ++-- .../__test__/sections.test.ts | 6 +-- .../expression_types/embeddable_types.ts | 2 +- .../graph/server/sample_data/ecommerce.ts | 2 +- .../graph/server/sample_data/flights.ts | 2 +- .../plugins/graph/server/sample_data/logs.ts | 2 +- .../components/anomalies_table/links_menu.js | 2 +- .../results_links/results_links.tsx | 2 +- .../panel_actions/get_csv_panel_action.tsx | 7 ++-- 53 files changed, 128 insertions(+), 113 deletions(-) diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index 935e041658d382..b2801810b2bf2f 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -62,17 +62,7 @@ export default function(kibana) { }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), links: [ - { - id: 'kibana:discover', - title: i18n.translate('kbn.discoverTitle', { - defaultMessage: 'Discover', - }), - order: -1003, - url: `${kbnBaseUrl}#/discover`, - euiIconType: 'discoverApp', - disableSubUrlTracking: true, - category: DEFAULT_APP_CATEGORIES.analyze, - }, + // TODO get rid of kibana:discover references // TODO get rid of kibana:visualize references // TODO get rid of kibana:dashboard references // TODO get rid of kibana:dev_tools references diff --git a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js index aea581f84cd2f9..e5d43fec4e59c4 100644 --- a/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js +++ b/src/legacy/core_plugins/kibana/server/lib/__tests__/relationships.js @@ -101,7 +101,7 @@ const savedObjectsManagement = getManagementaMock({ }, getInAppUrl(obj) { return { - path: `/app/kibana#/discover/${encodeURIComponent(obj.id)}`, + path: `/app/discover#//${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'discover.show', }; }, @@ -609,7 +609,7 @@ describe('findRelationships', () => { title: 'My Saved Search', editUrl: '/management/kibana/objects/savedSearches/1', inAppUrl: { - path: '/app/kibana#/discover/1', + path: '/app/discover#//1', uiCapabilitiesPath: 'discover.show', }, }, diff --git a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js index 27dbec0c2b7bc9..21ef6f973674e6 100644 --- a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js @@ -28,7 +28,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', euiIconType: 'discoverApp', hidden: true, disabled: true, @@ -58,7 +58,7 @@ describe('UiNavLink', () => { const spec = { id: 'kibana:discover', title: 'Discover', - url: '/app/kibana#/discover', + url: '/app/discover#/', }; const link = new UiNavLink(spec); @@ -70,7 +70,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', linkToLastSubUrl: false, }; const link = new UiNavLink(spec); @@ -83,7 +83,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', }; const link = new UiNavLink(spec); @@ -95,7 +95,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', }; const link = new UiNavLink(spec); @@ -107,7 +107,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', }; const link = new UiNavLink(spec); @@ -119,7 +119,7 @@ describe('UiNavLink', () => { id: 'kibana:discover', title: 'Discover', order: -1003, - url: '/app/kibana#/discover', + url: '/app/discover#/', }; const link = new UiNavLink(spec); diff --git a/src/plugins/data/common/field_formats/converters/url.test.ts b/src/plugins/data/common/field_formats/converters/url.test.ts index b1107d46179bff..5ee195f8c7752b 100644 --- a/src/plugins/data/common/field_formats/converters/url.test.ts +++ b/src/plugins/data/common/field_formats/converters/url.test.ts @@ -246,18 +246,18 @@ describe('UrlFormat', () => { test('should support multiple types of relative urls', () => { const parsedUrl = { origin: 'http://kibana.host.com', - pathname: '/nbc/app/kibana#/discover', + pathname: '/nbc/app/discover#/', basePath: '/nbc', }; const url = new UrlFormat({ parsedUrl }); const converter = url.getConverterFor(HTML_CONTEXT_TYPE) as Function; expect(converter('#/foo')).toBe( - '#/foo' + '#/foo' ); - expect(converter('/nbc/app/kibana#/discover')).toBe( - '/nbc/app/kibana#/discover' + expect(converter('/nbc/app/discover#/')).toBe( + '/nbc/app/discover#/' ); expect(converter('../foo/bar')).toBe( diff --git a/src/plugins/data/server/saved_objects/query.ts b/src/plugins/data/server/saved_objects/query.ts index 015cc7c6cb1349..6cd5052863b7ff 100644 --- a/src/plugins/data/server/saved_objects/query.ts +++ b/src/plugins/data/server/saved_objects/query.ts @@ -32,7 +32,7 @@ export const querySavedObjectType: SavedObjectsType = { }, getInAppUrl(obj) { return { - path: `/app/kibana#/discover?_a=(savedQuery:'${encodeURIComponent(obj.id)}')`, + path: `/app/discover#/?_a=(savedQuery:'${encodeURIComponent(obj.id)}')`, uiCapabilitiesPath: 'discover.show', }; }, diff --git a/src/plugins/data/server/saved_objects/search.ts b/src/plugins/data/server/saved_objects/search.ts index 54de35a90ae022..216606f65c1ab0 100644 --- a/src/plugins/data/server/saved_objects/search.ts +++ b/src/plugins/data/server/saved_objects/search.ts @@ -36,7 +36,7 @@ export const searchSavedObjectType: SavedObjectsType = { }, getInAppUrl(obj) { return { - path: `/app/kibana#/discover/${encodeURIComponent(obj.id)}`, + path: `/app/discover#//${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'discover.show', }; }, diff --git a/src/plugins/discover/public/application/angular/context.js b/src/plugins/discover/public/application/angular/context.js index 032ec7af09a301..c4eacd66a0e3b9 100644 --- a/src/plugins/discover/public/application/angular/context.js +++ b/src/plugins/discover/public/application/angular/context.js @@ -47,10 +47,10 @@ getAngularModule().config($routeProvider => { $routeProvider // deprecated route, kept for compatibility // should be removed in the future - .when('/discover/context/:indexPatternId/:type/:id*', { - redirectTo: '/discover/context/:indexPatternId/:id', + .when('/context/:indexPatternId/:type/:id*', { + redirectTo: '/context/:indexPatternId/:id', }) - .when('/discover/context/:indexPatternId/:id*', { + .when('/context/:indexPatternId/:id*', { controller: ContextAppRouteController, k7Breadcrumbs, controllerAs: 'contextAppRoute', diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index 334c023d0b7df4..94491896d31b34 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -107,7 +107,7 @@ app.config($routeProvider => { }; }, }; - $routeProvider.when('/discover/:id?', { + $routeProvider.when('/:id?', { ...defaults, template: indexTemplate, reloadOnSearch: false, @@ -154,13 +154,15 @@ app.config($routeProvider => { history, navigateToApp: core.application.navigateToApp, mapping: { - search: '/discover', - 'index-pattern': - '/management/kibana/objects/savedSearches/' + $route.current.params.id, + search: '/', + 'index-pattern': { + app: 'kibana', + path: `#/management/kibana/objects/savedSearches/${$route.current.params.id}`, + }, }, toastNotifications, onBeforeRedirect() { - getUrlTracker().setTrackedUrl('/discover'); + getUrlTracker().setTrackedUrl('/'); }, }) ), @@ -261,7 +263,7 @@ function discoverController( } }); - // this listener is waiting for such a path http://localhost:5601/app/kibana#/discover + // this listener is waiting for such a path http://localhost:5601/app/discover#/ // which could be set through pressing "New" button in top nav or go to "Discover" plugin from the sidebar // to reload the page in a right way const unlistenHistoryBasePath = history.listen(({ pathname, search, hash }) => { diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable.ts b/src/plugins/discover/public/application/embeddable/search_embeddable.ts index 085dd9779f1080..24cc20bdec996e 100644 --- a/src/plugins/discover/public/application/embeddable/search_embeddable.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable.ts @@ -70,6 +70,7 @@ interface SearchEmbeddableConfig { $compile: ng.ICompileService; savedSearch: SavedSearch; editUrl: string; + editPath: string; indexPatterns?: IndexPattern[]; editable: boolean; filterManager: FilterManager; @@ -101,6 +102,7 @@ export class SearchEmbeddable extends Embeddable $compile, savedSearch, editUrl, + editPath, indexPatterns, editable, filterManager, @@ -111,7 +113,14 @@ export class SearchEmbeddable extends Embeddable ) { super( initialInput, - { defaultTitle: savedSearch.title, editUrl, indexPatterns, editable }, + { + defaultTitle: savedSearch.title, + editUrl, + editPath, + editApp: 'discover', + indexPatterns, + editable, + }, parent ); diff --git a/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts index 187a2d6aca40c6..d1f3ec1a7efae0 100644 --- a/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts +++ b/src/plugins/discover/public/application/embeddable/search_embeddable_factory.ts @@ -87,7 +87,7 @@ export class SearchEmbeddableFactory const filterManager = getServices().filterManager; const url = await getServices().getSavedSearchUrlById(savedObjectId); - const editUrl = getServices().addBasePath(`/app/kibana${url}`); + const editUrl = getServices().addBasePath(`/app/discover${url}`); try { const savedObject = await getServices().getSavedSearchById(savedObjectId); const indexPattern = savedObject.searchSource.getField('index'); @@ -98,6 +98,7 @@ export class SearchEmbeddableFactory $rootScope, $compile, editUrl, + editPath: url, filterManager, editable: getServices().capabilities.discover.save as boolean, indexPatterns: indexPattern ? [indexPattern] : [], diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts index 171fb989162d65..39387a6c59bae5 100644 --- a/src/plugins/discover/public/index.ts +++ b/src/plugins/discover/public/index.ts @@ -26,3 +26,7 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { SavedSearch, SavedSearchLoader, createSavedSearchesLoader } from './saved_searches'; + +export { SEARCH_EMBEDDABLE_TYPE } from './application/embeddable/constants'; + +export { ISearchEmbeddable } from './application/embeddable/types'; diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 41cffcd480e4fa..4f8f6320d02d10 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -51,6 +51,7 @@ import { setUrlTracker, setAngularModule, setServices, + getHistory, } from './kibana_services'; import { createSavedSearchesLoader } from './saved_searches'; import { getInnerAngularModuleEmbeddable, getInnerAngularModule } from './get_inner_angular'; @@ -157,8 +158,8 @@ export class DiscoverPlugin stop: stopUrlTracker, setActiveUrl: setTrackedUrl, } = createKbnUrlTracker({ - baseUrl: core.http.basePath.prepend('/app/kibana'), - defaultSubUrl: '#/discover', + baseUrl: core.http.basePath.prepend('/app/discover'), + defaultSubUrl: '#/', storageKey: `lastUrl:${core.http.basePath.get()}:discover`, navLinkUpdater$: this.appStateUpdater, toastNotifications: core.notifications.toasts, @@ -183,13 +184,18 @@ export class DiscoverPlugin }; this.docViewsRegistry.setAngularInjectorGetter(this.getEmbeddableInjector); - plugins.kibanaLegacy.registerLegacyApp({ + core.application.register({ id: 'discover', title: 'Discover', updater$: this.appStateUpdater.asObservable(), - navLinkId: 'kibana:discover', order: -1004, euiIconType: 'discoverApp', + category: { + label: i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }), + order: 1000, + }, mount: async (params: AppMountParameters) => { if (!this.initializeServices) { throw Error('Discover plugin method initializeServices is undefined'); @@ -210,6 +216,8 @@ export class DiscoverPlugin }, }); + plugins.kibanaLegacy.forwardApp('discover', 'discover'); + if (plugins.home) { registerFeature(plugins.home); } @@ -247,7 +255,7 @@ export class DiscoverPlugin if (this.servicesInitialized) { return { core, plugins }; } - const services = await buildServices(core, plugins, this.initializerContext); + const services = await buildServices(core, plugins, getHistory, this.initializerContext); setServices(services); this.servicesInitialized = true; diff --git a/src/plugins/discover/public/register_feature.ts b/src/plugins/discover/public/register_feature.ts index 5ff722a86364af..dda1f9f5d6f8a6 100644 --- a/src/plugins/discover/public/register_feature.ts +++ b/src/plugins/discover/public/register_feature.ts @@ -29,7 +29,7 @@ export function registerFeature(home: HomePublicPluginSetup) { defaultMessage: 'Interactively explore your data by querying and filtering raw documents.', }), icon: 'discoverApp', - path: '/app/kibana#/discover', + path: '/app/discover#/', showOnHomePage: true, category: FeatureCatalogueCategory.DATA, }); diff --git a/src/plugins/discover/public/saved_searches/_saved_search.ts b/src/plugins/discover/public/saved_searches/_saved_search.ts index 56360b04a49c87..5d539482440793 100644 --- a/src/plugins/discover/public/saved_searches/_saved_search.ts +++ b/src/plugins/discover/public/saved_searches/_saved_search.ts @@ -66,7 +66,7 @@ export function createSavedSearchClass(services: SavedObjectKibanaServices) { }); this.showInRecentlyAccessed = true; this.id = id; - this.getFullPath = () => `/app/kibana#/discover/${String(id)}`; + this.getFullPath = () => `/app/discover#//${String(id)}`; } } diff --git a/src/plugins/discover/public/saved_searches/saved_searches.ts b/src/plugins/discover/public/saved_searches/saved_searches.ts index 9d815bee41af88..1d1d4f17742a2e 100644 --- a/src/plugins/discover/public/saved_searches/saved_searches.ts +++ b/src/plugins/discover/public/saved_searches/saved_searches.ts @@ -34,7 +34,7 @@ export function createSavedSearchesLoader(services: SavedObjectKibanaServices) { nouns: 'saved searches', }; - savedSearchLoader.urlFor = (id: string) => `#/discover/${encodeURIComponent(id)}`; + savedSearchLoader.urlFor = (id: string) => `#/${encodeURIComponent(id)}`; return savedSearchLoader; } diff --git a/src/plugins/home/server/tutorials/activemq_metrics/index.ts b/src/plugins/home/server/tutorials/activemq_metrics/index.ts index 3898e2b5338b1d..22485a0b3a32cc 100644 --- a/src/plugins/home/server/tutorials/activemq_metrics/index.ts +++ b/src/plugins/home/server/tutorials/activemq_metrics/index.ts @@ -55,7 +55,7 @@ export function activemqMetricsSpecProvider(context: TutorialContext): TutorialS label: i18n.translate('home.tutorials.activemqMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/aerospike_metrics/index.ts b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts index 656e7feceed0cc..58ab2dcf0986f9 100644 --- a/src/plugins/home/server/tutorials/aerospike_metrics/index.ts +++ b/src/plugins/home/server/tutorials/aerospike_metrics/index.ts @@ -55,7 +55,7 @@ export function aerospikeMetricsSpecProvider(context: TutorialContext): Tutorial label: i18n.translate('home.tutorials.aerospikeMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/azure_metrics/index.ts b/src/plugins/home/server/tutorials/azure_metrics/index.ts index 72befcf8d2065c..ddf70fcc837b24 100644 --- a/src/plugins/home/server/tutorials/azure_metrics/index.ts +++ b/src/plugins/home/server/tutorials/azure_metrics/index.ts @@ -55,7 +55,7 @@ export function azureMetricsSpecProvider(context: TutorialContext): TutorialSche label: i18n.translate('home.tutorials.azureMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/ceph_metrics/index.ts b/src/plugins/home/server/tutorials/ceph_metrics/index.ts index 6b5f9c4c6fe5fd..968a0a3f66b0a3 100644 --- a/src/plugins/home/server/tutorials/ceph_metrics/index.ts +++ b/src/plugins/home/server/tutorials/ceph_metrics/index.ts @@ -55,7 +55,7 @@ export function cephMetricsSpecProvider(context: TutorialContext): TutorialSchem label: i18n.translate('home.tutorials.cephMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/coredns_metrics/index.ts b/src/plugins/home/server/tutorials/coredns_metrics/index.ts index ad0ce4a58c738b..2e8fc1fcd9db36 100644 --- a/src/plugins/home/server/tutorials/coredns_metrics/index.ts +++ b/src/plugins/home/server/tutorials/coredns_metrics/index.ts @@ -54,7 +54,7 @@ export function corednsMetricsSpecProvider(context: TutorialContext): TutorialSc label: i18n.translate('home.tutorials.corednsMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/couchbase_metrics/index.ts b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts index 66b70ba2fb456e..efd59029c9c502 100644 --- a/src/plugins/home/server/tutorials/couchbase_metrics/index.ts +++ b/src/plugins/home/server/tutorials/couchbase_metrics/index.ts @@ -55,7 +55,7 @@ export function couchbaseMetricsSpecProvider(context: TutorialContext): Tutorial label: i18n.translate('home.tutorials.couchbaseMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts index 164214ffd749c2..008a7a9b3a6970 100644 --- a/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts +++ b/src/plugins/home/server/tutorials/dropwizard_metrics/index.ts @@ -55,7 +55,7 @@ export function dropwizardMetricsSpecProvider(context: TutorialContext): Tutoria label: i18n.translate('home.tutorials.dropwizardMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts index 4369c805dc7c42..515b06ea82a5ef 100644 --- a/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts +++ b/src/plugins/home/server/tutorials/elasticsearch_logs/index.ts @@ -56,7 +56,7 @@ export function elasticsearchLogsSpecProvider(context: TutorialContext): Tutoria label: i18n.translate('home.tutorials.elasticsearchLogs.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts index d9004e72733f93..ea6dcf86d23e21 100644 --- a/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts +++ b/src/plugins/home/server/tutorials/elasticsearch_metrics/index.ts @@ -55,7 +55,7 @@ export function elasticsearchMetricsSpecProvider(context: TutorialContext): Tuto label: i18n.translate('home.tutorials.elasticsearchMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/etcd_metrics/index.ts b/src/plugins/home/server/tutorials/etcd_metrics/index.ts index 919700356d98ab..2956473b6643bf 100644 --- a/src/plugins/home/server/tutorials/etcd_metrics/index.ts +++ b/src/plugins/home/server/tutorials/etcd_metrics/index.ts @@ -55,7 +55,7 @@ export function etcdMetricsSpecProvider(context: TutorialContext): TutorialSchem label: i18n.translate('home.tutorials.etcdMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/haproxy_metrics/index.ts b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts index 8e1c0a0da8b184..f06dfaa93063c0 100644 --- a/src/plugins/home/server/tutorials/haproxy_metrics/index.ts +++ b/src/plugins/home/server/tutorials/haproxy_metrics/index.ts @@ -55,7 +55,7 @@ export function haproxyMetricsSpecProvider(context: TutorialContext): TutorialSc label: i18n.translate('home.tutorials.haproxyMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts index 2055196f833b2d..fdfc9b7092f512 100644 --- a/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts +++ b/src/plugins/home/server/tutorials/ibmmq_metrics/index.ts @@ -55,7 +55,7 @@ export function ibmmqMetricsSpecProvider(context: TutorialContext): TutorialSche label: i18n.translate('home.tutorials.ibmmqMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/kafka_metrics/index.ts b/src/plugins/home/server/tutorials/kafka_metrics/index.ts index 98be309ca89cda..55860a3ab649a4 100644 --- a/src/plugins/home/server/tutorials/kafka_metrics/index.ts +++ b/src/plugins/home/server/tutorials/kafka_metrics/index.ts @@ -55,7 +55,7 @@ export function kafkaMetricsSpecProvider(context: TutorialContext): TutorialSche label: i18n.translate('home.tutorials.kafkaMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/kibana_metrics/index.ts b/src/plugins/home/server/tutorials/kibana_metrics/index.ts index c087212c46f783..fa966ac724a734 100644 --- a/src/plugins/home/server/tutorials/kibana_metrics/index.ts +++ b/src/plugins/home/server/tutorials/kibana_metrics/index.ts @@ -55,7 +55,7 @@ export function kibanaMetricsSpecProvider(context: TutorialContext): TutorialSch label: i18n.translate('home.tutorials.kibanaMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/logstash_metrics/index.ts b/src/plugins/home/server/tutorials/logstash_metrics/index.ts index 122f143e4b8343..383273a8c365cc 100644 --- a/src/plugins/home/server/tutorials/logstash_metrics/index.ts +++ b/src/plugins/home/server/tutorials/logstash_metrics/index.ts @@ -56,7 +56,7 @@ export function logstashMetricsSpecProvider(context: TutorialContext): TutorialS label: i18n.translate('home.tutorials.logstashMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/memcached_metrics/index.ts b/src/plugins/home/server/tutorials/memcached_metrics/index.ts index 1c9c9d975e4b89..94451556ad34c6 100644 --- a/src/plugins/home/server/tutorials/memcached_metrics/index.ts +++ b/src/plugins/home/server/tutorials/memcached_metrics/index.ts @@ -55,7 +55,7 @@ export function memcachedMetricsSpecProvider(context: TutorialContext): Tutorial label: i18n.translate('home.tutorials.memcachedMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/munin_metrics/index.ts b/src/plugins/home/server/tutorials/munin_metrics/index.ts index 90e4ac6026dadf..ff1069488ca63e 100644 --- a/src/plugins/home/server/tutorials/munin_metrics/index.ts +++ b/src/plugins/home/server/tutorials/munin_metrics/index.ts @@ -55,7 +55,7 @@ export function muninMetricsSpecProvider(context: TutorialContext): TutorialSche label: i18n.translate('home.tutorials.muninMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/oracle_metrics/index.ts b/src/plugins/home/server/tutorials/oracle_metrics/index.ts index d45dad0682e610..3144b0a21aab5f 100644 --- a/src/plugins/home/server/tutorials/oracle_metrics/index.ts +++ b/src/plugins/home/server/tutorials/oracle_metrics/index.ts @@ -55,7 +55,7 @@ export function oracleMetricsSpecProvider(context: TutorialContext): TutorialSch label: i18n.translate('home.tutorials.oracleMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/prometheus_metrics/index.ts b/src/plugins/home/server/tutorials/prometheus_metrics/index.ts index d79ce652db0d0e..06e8a138049d53 100644 --- a/src/plugins/home/server/tutorials/prometheus_metrics/index.ts +++ b/src/plugins/home/server/tutorials/prometheus_metrics/index.ts @@ -56,7 +56,7 @@ export function prometheusMetricsSpecProvider(context: TutorialContext): Tutoria label: i18n.translate('home.tutorials.prometheusMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/redisenterprise_metrics/index.ts b/src/plugins/home/server/tutorials/redisenterprise_metrics/index.ts index b352691f06afe5..72306f0c57bca7 100644 --- a/src/plugins/home/server/tutorials/redisenterprise_metrics/index.ts +++ b/src/plugins/home/server/tutorials/redisenterprise_metrics/index.ts @@ -55,7 +55,7 @@ export function redisenterpriseMetricsSpecProvider(context: TutorialContext): Tu label: i18n.translate('home.tutorials.redisenterpriseMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/vsphere_metrics/index.ts b/src/plugins/home/server/tutorials/vsphere_metrics/index.ts index 908b6440f88c66..4aefbbffebee82 100644 --- a/src/plugins/home/server/tutorials/vsphere_metrics/index.ts +++ b/src/plugins/home/server/tutorials/vsphere_metrics/index.ts @@ -55,7 +55,7 @@ export function vSphereMetricsSpecProvider(context: TutorialContext): TutorialSc label: i18n.translate('home.tutorials.vsphereMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/windows_metrics/index.ts b/src/plugins/home/server/tutorials/windows_metrics/index.ts index fa855a82b3b776..5333a7b1badf6b 100644 --- a/src/plugins/home/server/tutorials/windows_metrics/index.ts +++ b/src/plugins/home/server/tutorials/windows_metrics/index.ts @@ -55,7 +55,7 @@ export function windowsMetricsSpecProvider(context: TutorialContext): TutorialSc label: i18n.translate('home.tutorials.windowsMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts b/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts index 581b4a14a2f382..3d285808859d0c 100644 --- a/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts +++ b/src/plugins/home/server/tutorials/zookeeper_metrics/index.ts @@ -56,7 +56,7 @@ export function zookeeperMetricsSpecProvider(context: TutorialContext): Tutorial label: i18n.translate('home.tutorials.zookeeperMetrics.artifacts.application.label', { defaultMessage: 'Discover', }), - path: '/app/kibana#/discover', + path: '/app/discover#/', }, dashboards: [], exportedFields: { diff --git a/src/plugins/kibana_utils/public/state_management/url/hash_unhash_url.test.ts b/src/plugins/kibana_utils/public/state_management/url/hash_unhash_url.test.ts index ec87b8464ac2dc..ce8cd4acb24ab4 100644 --- a/src/plugins/kibana_utils/public/state_management/url/hash_unhash_url.test.ts +++ b/src/plugins/kibana_utils/public/state_management/url/hash_unhash_url.test.ts @@ -70,12 +70,12 @@ describe('hash unhash url', () => { }); it('if hash is just a path', () => { - const url = 'https://localhost:5601/app/kibana#/discover'; + const url = 'https://localhost:5601/app/discover#/'; expect(hashUrl(url)).toBe(url); }); it('if hash does not have matching query string vals', () => { - const url = 'https://localhost:5601/app/kibana#/discover?foo=bar'; + const url = 'https://localhost:5601/app/discover#/?foo=bar'; expect(hashUrl(url)).toBe(url); }); }); @@ -84,10 +84,10 @@ describe('hash unhash url', () => { it('if uses single state param', () => { const stateParamKey = '_g'; const stateParamValue = '(yes:!t)'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey}=${stateParamValue}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey}=${stateParamValue}`; const result = hashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=h@4e60e02"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=h@4e60e02"` ); expect(mockStorage.getItem('kbn.hashedItemsIndex.v1')).toBeTruthy(); expect(mockStorage.getItem('h@4e60e02')).toEqual(JSON.stringify({ yes: true })); @@ -100,10 +100,10 @@ describe('hash unhash url', () => { const stateParamValue2 = '(yes:!f)'; const stateParamKey3 = '_b'; const stateParamValue3 = '(yes:!f)'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; const result = hashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=h@4e60e02&_a=h@61fa078&_b=(yes:!f)"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=h@4e60e02&_a=h@61fa078&_b=(yes:!f)"` ); expect(mockStorage.getItem('h@4e60e02')).toEqual(JSON.stringify({ yes: true })); expect(mockStorage.getItem('h@61fa078')).toEqual(JSON.stringify({ yes: false })); @@ -123,10 +123,10 @@ describe('hash unhash url', () => { const stateParamValue2 = '(yes:!f)'; const stateParamKey3 = '_someother'; const stateParamValue3 = '(yes:!f)'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; const result = hashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=h@4e60e02&_a=h@61fa078&_someother=(yes:!f)"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=h@4e60e02&_a=h@61fa078&_someother=(yes:!f)"` ); expect(mockStorage.length).toBe(3); // 2 hashes + HashedItemStoreSingleton.PERSISTED_INDEX_KEY @@ -138,7 +138,7 @@ describe('hash unhash url', () => { const stateParamValue1 = '(yes:!t)'; mockStorage.setStubbedSizeLimit(1); - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValue1}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValue1}`; expect(() => hashUrl(url)).toThrowError(); }); }); @@ -177,19 +177,19 @@ describe('hash unhash url', () => { }); it('if hash is just a path', () => { - const url = 'https://localhost:5601/app/kibana#/discover'; + const url = 'https://localhost:5601/app/discover#/'; expect(unhashUrl(url)).toBe(url); }); it('if hash does not have matching query string vals', () => { - const url = 'https://localhost:5601/app/kibana#/discover?foo=bar'; + const url = 'https://localhost:5601/app/discover#/?foo=bar'; expect(unhashUrl(url)).toBe(url); }); it("if hash has matching query, but it isn't hashed", () => { const stateParamKey = '_g'; const stateParamValue = '(yes:!t)'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey}=${stateParamValue}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey}=${stateParamValue}`; expect(unhashUrl(url)).toBe(url); }); }); @@ -201,10 +201,10 @@ describe('hash unhash url', () => { const state = { yes: true }; mockStorage.setItem(stateParamValueHashed, JSON.stringify(state)); - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey}=${stateParamValueHashed}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey}=${stateParamValueHashed}`; const result = unhashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=(yes:!t)"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=(yes:!t)"` ); }); @@ -220,10 +220,10 @@ describe('hash unhash url', () => { mockStorage.setItem(stateParamValueHashed1, JSON.stringify(state1)); mockStorage.setItem(stateParamValueHashed2, JSON.stringify(state2)); - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValueHashed1}&${stateParamKey2}=${stateParamValueHashed2}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValueHashed1}&${stateParamKey2}=${stateParamValueHashed2}`; const result = unhashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=(yes:!t)&_a=(yes:!f)"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=(yes:!t)&_a=(yes:!f)"` ); }); @@ -244,10 +244,10 @@ describe('hash unhash url', () => { mockStorage.setItem(stateParamValueHashed2, JSON.stringify(state2)); mockStorage.setItem(stateParamValueHashed3, JSON.stringify(state3)); - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValueHashed1}&${stateParamKey2}=${stateParamValueHashed2}&${stateParamKey3}=${stateParamValueHashed3}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValueHashed1}&${stateParamKey2}=${stateParamValueHashed2}&${stateParamKey3}=${stateParamValueHashed3}`; const result = unhashUrl(url); expect(result).toMatchInlineSnapshot( - `"https://localhost:5601/app/kibana#/discover?foo=bar&_g=(yes:!t)&_a=(yes:!f)&_someother=h@61fa078"` + `"https://localhost:5601/app/discover#/?foo=bar&_g=(yes:!t)&_a=(yes:!f)&_someother=h@61fa078"` ); }); }); @@ -256,7 +256,7 @@ describe('hash unhash url', () => { const stateParamKey1 = '_g'; const stateParamValueHashed1 = 'h@4e60e02'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValueHashed1}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValueHashed1}`; expect(() => unhashUrl(url)).toThrowErrorMatchingInlineSnapshot( `"Unable to completely restore the URL, be sure to use the share functionality."` ); @@ -271,7 +271,7 @@ describe('hash unhash url', () => { const stateParamValue2 = '(yes:!f)'; const stateParamKey3 = '_someother'; const stateParamValue3 = '(yes:!f)'; - const url = `https://localhost:5601/app/kibana#/discover?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; + const url = `https://localhost:5601/app/discover#/?foo=bar&${stateParamKey1}=${stateParamValue1}&${stateParamKey2}=${stateParamValue2}&${stateParamKey3}=${stateParamValue3}`; const result = unhashUrl(hashUrl(url)); expect(url).toEqual(result); }); diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap index 237a7e36de2315..09063eebddfdf1 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/relationships.test.tsx.snap @@ -306,7 +306,7 @@ exports[`Relationships should render index patterns normally 1`] = ` "editUrl": "/management/kibana/objects/savedSearches/1", "icon": "search", "inAppUrl": Object { - "path": "/app/kibana#/discover/1", + "path": "/app/discover#//1", "uiCapabilitiesPath": "discover.show", }, "title": "My Search Title", diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx index 76a877690ae779..56245ab02fb43d 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/relationships.test.tsx @@ -45,7 +45,7 @@ describe('Relationships', () => { editUrl: '/management/kibana/objects/savedSearches/1', icon: 'search', inAppUrl: { - path: '/app/kibana#/discover/1', + path: '/app/discover#//1', uiCapabilitiesPath: 'discover.show', }, title: 'My Search Title', diff --git a/src/plugins/share/public/lib/url_shortener.test.ts b/src/plugins/share/public/lib/url_shortener.test.ts index 1c7bf08fa87815..a2ba2dad8f5c84 100644 --- a/src/plugins/share/public/lib/url_shortener.test.ts +++ b/src/plugins/share/public/lib/url_shortener.test.ts @@ -100,7 +100,7 @@ describe('Url shortener', () => { it('should shorten urls with a query string in the hash', async () => { const relativeUrl = - '/app/kibana#/discover?_g=(refreshInterval:(pause:!f,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:%27logstash-*%27,interval:auto,query:(query_string:(analyze_wildcard:!t,query:%27*%27)),sort:!(%27@timestamp%27,desc))'; + '/app/discover#/?_g=(refreshInterval:(pause:!f,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:%27logstash-*%27,interval:auto,query:(query_string:(analyze_wildcard:!t,query:%27*%27)),sort:!(%27@timestamp%27,desc))'; const shortUrl = await shortenUrl(`http://localhost${basePath}${relativeUrl}`, { basePath, post: postStub, @@ -108,7 +108,7 @@ describe('Url shortener', () => { expect(shortUrl).toBe(`http://localhost${basePath}/goto/${shareId}`); expect(postStub).toHaveBeenCalledWith(`/api/shorten_url`, { body: - '{"url":"/app/kibana#/discover?_g=(refreshInterval:(pause:!f,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:%27logstash-*%27,interval:auto,query:(query_string:(analyze_wildcard:!t,query:%27*%27)),sort:!(%27@timestamp%27,desc))"}', + '{"url":"/app/discover#/?_g=(refreshInterval:(pause:!f,value:0),time:(from:now-15m,mode:quick,to:now))&_a=(columns:!(_source),index:%27logstash-*%27,interval:auto,query:(query_string:(analyze_wildcard:!t,query:%27*%27)),sort:!(%27@timestamp%27,desc))"}', }); }); }); diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index ecddbb3435b88f..1412199d57a22e 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -220,7 +220,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/discover/960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }); diff --git a/test/api_integration/apis/saved_objects_management/relationships.ts b/test/api_integration/apis/saved_objects_management/relationships.ts index c5b023a6f3d443..048fdf5734b669 100644 --- a/test/api_integration/apis/saved_objects_management/relationships.ts +++ b/test/api_integration/apis/saved_objects_management/relationships.ts @@ -281,7 +281,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/discover/960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -321,7 +321,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/discover/960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -364,7 +364,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/discover/960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -404,7 +404,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/discover/960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx index 759caa785c1af3..5b1f2623a31b8f 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/__test__/DiscoverLinks.integration.test.tsx @@ -33,7 +33,7 @@ describe('DiscoverLinks', () => { ); expect(href).toEqual( - `/basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'processor.event:"transaction" AND transaction.id:"8b60bd32ecc6e150" AND trace.id:"8b60bd32ecc6e1506735a8b6cfcf175c"'))` + `/basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'processor.event:"transaction" AND transaction.id:"8b60bd32ecc6e150" AND trace.id:"8b60bd32ecc6e1506735a8b6cfcf175c"'))` ); }); @@ -49,7 +49,7 @@ describe('DiscoverLinks', () => { } as Location); expect(href).toEqual( - `/basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'span.id:"test-span-id"'))` + `/basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'span.id:"test-span-id"'))` ); }); @@ -70,7 +70,7 @@ describe('DiscoverLinks', () => { ); expect(href).toEqual( - `/basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'service.name:"service-name" AND error.grouping_key:"grouping-key"'),sort:('@timestamp':desc))` + `/basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'service.name:"service-name" AND error.grouping_key:"grouping-key"'),sort:('@timestamp':desc))` ); }); @@ -92,7 +92,7 @@ describe('DiscoverLinks', () => { ); expect(href).toEqual( - `/basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'service.name:"service-name" AND error.grouping_key:"grouping-key" AND some:kuery-string'),sort:('@timestamp':desc))` + `/basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:'0'),time:(from:now%2Fw,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:'service.name:"service-name" AND error.grouping_key:"grouping-key" AND some:kuery-string'),sort:('@timestamp':desc))` ); }); }); diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts index 3032dd1704f4e5..4fec94b06494fc 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionActionMenu/__test__/sections.test.ts @@ -56,7 +56,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] @@ -127,7 +127,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] @@ -197,7 +197,7 @@ describe('Transaction action menu', () => { key: 'sampleDocument', label: 'View sample document', href: - 'some-basepath/app/kibana#/discover?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', + 'some-basepath/app/discover#/?_g=(refreshInterval:(pause:true,value:\'0\'),time:(from:now-24h,to:now))&_a=(index:apm_static_index_pattern_id,interval:auto,query:(language:kuery,query:\'processor.event:"transaction" AND transaction.id:"123" AND trace.id:"123"\'))', condition: true } ] diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts index f5836fe91e0404..592da1ff039a15 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts @@ -7,7 +7,7 @@ import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/public'; import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/visualizations/public'; import { LENS_EMBEDDABLE_TYPE } from '../../../../../plugins/lens/common/constants'; -import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants'; +import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/discover/public'; export const EmbeddableTypes: { lens: string; diff --git a/x-pack/plugins/graph/server/sample_data/ecommerce.ts b/x-pack/plugins/graph/server/sample_data/ecommerce.ts index f70c7039b9b724..7543e9471f05cd 100644 --- a/x-pack/plugins/graph/server/sample_data/ecommerce.ts +++ b/x-pack/plugins/graph/server/sample_data/ecommerce.ts @@ -335,7 +335,7 @@ const wsState: any = { urlTemplates: [ { url: - '/app/kibana#/discover?_a=(columns%3A!(_source)%2Cindex%3Aff959d40-b880-11e8-a6d9-e546fe2bba5f%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', + '/app/discover#/?_a=(columns%3A!(_source)%2Cindex%3Aff959d40-b880-11e8-a6d9-e546fe2bba5f%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', description: 'Raw documents', isDefault: true, encoderID: 'kql-loose', diff --git a/x-pack/plugins/graph/server/sample_data/flights.ts b/x-pack/plugins/graph/server/sample_data/flights.ts index 3a61eb49cb5b16..bca1d0d093a8ec 100644 --- a/x-pack/plugins/graph/server/sample_data/flights.ts +++ b/x-pack/plugins/graph/server/sample_data/flights.ts @@ -1589,7 +1589,7 @@ const wsState: any = { urlTemplates: [ { url: - '/app/kibana#/discover?_a=(columns%3A!(_source)%2Cindex%3Ad3d7af60-4c81-11e8-b3d7-01146121b73d%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', + '/app/discover#/?_a=(columns%3A!(_source)%2Cindex%3Ad3d7af60-4c81-11e8-b3d7-01146121b73d%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', description: 'Raw documents', isDefault: true, encoderID: 'kql-loose', diff --git a/x-pack/plugins/graph/server/sample_data/logs.ts b/x-pack/plugins/graph/server/sample_data/logs.ts index b524e3ccd00720..5ca810b397cd27 100644 --- a/x-pack/plugins/graph/server/sample_data/logs.ts +++ b/x-pack/plugins/graph/server/sample_data/logs.ts @@ -407,7 +407,7 @@ const wsState: any = { urlTemplates: [ { url: - '/app/kibana#/discover?_a=(columns%3A!(_source)%2Cindex%3A%2790943e30-9a47-11e8-b64d-95841ca0b247%27%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', + '/app/discover#/?_a=(columns%3A!(_source)%2Cindex%3A%2790943e30-9a47-11e8-b64d-95841ca0b247%27%2Cinterval%3Aauto%2Cquery%3A(language%3Akuery%2Cquery%3A{{gquery}})%2Csort%3A!(_score%2Cdesc))', description: 'Raw documents', isDefault: true, encoderID: 'kql-loose', diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js index 2a34f12330a754..d76fb1348c0fd6 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js @@ -322,7 +322,7 @@ class LinksMenuUI extends Component { // Need to encode the _a parameter as it will contain characters such as '+' if using the regex. const { basePath } = this.props.kibana.services.http; let path = basePath.get(); - path += '/app/kibana#/discover'; + path += '/app/discover#/'; path += '?_g=' + _g; path += '&_a=' + encodeURIComponent(_a); window.open(path, '_blank'); diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx index dddf64ce2cfd36..b59eddcd9bb32f 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx @@ -89,7 +89,7 @@ export const ResultsLinks: FC = ({ /> } description="" - href={`${basePath.get()}/app/kibana#/discover?&_a=(index:'${indexPatternId}')${globalStateString}`} + href={`${basePath.get()}/app/discover#/?&_a=(index:'${indexPatternId}')${globalStateString}`} /> )} diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx index d4e3069186f606..6989cbe25088f0 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx @@ -13,9 +13,10 @@ import { checkLicense } from '../lib/license_check'; import { ViewMode, IEmbeddable } from '../../../../../src/plugins/embeddable/public'; -// @TODO: These import paths will need to be updated once discovery moves to non-legacy dir -import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants'; -import { ISearchEmbeddable } from '../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types'; +import { + SEARCH_EMBEDDABLE_TYPE, + ISearchEmbeddable, +} from '../../../../../src/plugins/discover/public'; import { API_GENERATE_IMMEDIATE, CSV_REPORTING_ACTION } from '../../constants'; From 2a038b261bc70968890e320bb2ef7931e316e788 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 23 Apr 2020 12:32:45 +0300 Subject: [PATCH 026/134] Divide legacy helpers --- .../vis_type_vislib}/_vis_fixture.js | 25 +------------ .../vis_type_vislib/lib/chart_title.js | 2 +- .../__tests__/vis_type_vislib/lib/dispatch.js | 6 +-- .../vis_type_vislib/lib/handler/handler.js | 7 +--- .../vis_type_vislib/lib/layout/layout.js | 7 +--- .../public/__tests__/vis_type_vislib/vis.js | 6 +-- .../visualizations/area_chart.js | 6 +-- .../vis_type_vislib/visualizations/chart.js | 6 +-- .../visualizations/column_chart.js | 6 +-- .../visualizations/gauge_chart.js | 6 +-- .../visualizations/heatmap_chart.js | 7 +--- .../visualizations/line_chart.js | 7 +--- .../visualizations/pie_chart.js | 6 +-- .../vis_type_vislib/public/fixtures/mocks.js | 37 +++++++++++++++++++ .../public/vislib/lib/axis/axis.test.js | 2 +- .../public/vislib/lib/axis/axis_title.test.js | 2 +- .../public/vislib/lib/axis/x_axis.test.js | 2 +- .../public/vislib/lib/axis/y_axis.test.js | 2 +- .../public/vislib/lib/data.test.js | 2 +- .../public/vislib/lib/vis_config.test.js | 2 +- 20 files changed, 68 insertions(+), 78 deletions(-) rename src/{plugins/vis_type_vislib/public/fixtures => legacy/core_plugins/kibana/public/__tests__/vis_type_vislib}/_vis_fixture.js (79%) create mode 100644 src/plugins/vis_type_vislib/public/fixtures/mocks.js diff --git a/src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js similarity index 79% rename from src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js rename to src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js index 9f871dd0d2f7d6..8a542fec0639c3 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/_vis_fixture.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js @@ -20,20 +20,10 @@ import _ from 'lodash'; import $ from 'jquery'; -import { Vis } from '../vislib/vis'; +import { Vis } from '../../../../../../plugins/vis_type_vislib/public/vislib/vis'; // TODO: Remove when converted to jest mocks -import { - ColorsService, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../charts/public/services'; -import { setFormatService } from '../services'; - -setFormatService({ - deserialize: () => ({ - convert: v => v, - }), -}); +import { ColorsService } from '../../../../../../plugins/charts/public/services'; const $visCanvas = $('

') .attr('id', 'vislib-vis-fixtures') @@ -79,17 +69,6 @@ const getDeps = () => { }; }; -export const getMockUiState = () => { - const map = new Map(); - - return (() => ({ - get: (...args) => map.get(...args), - set: (...args) => map.set(...args), - setSilent: (...args) => map.set(...args), - on: () => undefined, - }))(); -}; - export function getVis(visLibParams, element) { return new Vis( element || $visCanvas.new(), diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js index a69304164b2ad3..81fef155daf57e 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js @@ -23,7 +23,7 @@ import expect from '@kbn/expect'; import { ChartTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/chart_title'; import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; describe('Vislib ChartTitle Class Test Suite', function() { let mockUiState; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js index 777c5187d29597..eb4e109690c37f 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js @@ -24,10 +24,8 @@ import expect from '@kbn/expect'; // Data import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; describe('Vislib Dispatch Class Test Suite', function() { function destroyVis(vis) { diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js index ee4daa8c244513..27f7f4ed3e0732 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js @@ -25,11 +25,8 @@ import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtu import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; - -import { - getVis, - getMockUiState, -} from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js index 5bd58eee526c5d..505b0a04c61837 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js @@ -26,13 +26,10 @@ import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtu import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; - +import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { Layout } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/layout/layout'; -import { - getVis, - getMockUiState, -} from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; import { VisConfig } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js index 2e674742ab93c7..67f29ee96a3364 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js @@ -25,10 +25,8 @@ import series from '../../../../../../plugins/vis_type_vislib/public/fixtures/mo import columns from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; import rows from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; import stackedSeries from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -import { - getVis, - getMockUiState, -} from '../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from './_vis_fixture'; const dataArray = [series, columns, rows, stackedSeries]; const names = ['series', 'columns', 'rows', 'stackedSeries']; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js index 4daec921c6158f..eb529c380cdda4 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js @@ -22,10 +22,8 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; const dataTypesArray = { 'series pos': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'), diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js index 1b393644c5191d..4c5e3db3162430 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js @@ -21,10 +21,8 @@ import d3 from 'd3'; import expect from '@kbn/expect'; import { Chart } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/_chart'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; describe('Vislib _chart Test Suite', function() { let vis; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js index 994eb1ae769323..5cbd5948bc477a 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js @@ -33,10 +33,8 @@ import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/f import { seriesMonthlyInterval } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval'; import { rowsSeriesWithHoles } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes'; import rowsWithZeros from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; // tuple, with the format [description, mode, data] const dataTypesArray = [ diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js index a9f3e077cd95e6..d8ce8f1f5f44bf 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js @@ -22,10 +22,8 @@ import _ from 'lodash'; import expect from '@kbn/expect'; import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; describe('Vislib Gauge Chart Test Suite', function() { let vis; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js index e730a70b2412ea..765b9118e68445 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js @@ -28,11 +28,8 @@ import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fi import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; - -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; // tuple, with the format [description, mode, data] const dataTypesArray = [ diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js index ad3c756f2c03c3..691417e968eedb 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js @@ -29,11 +29,8 @@ import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtu import histogramColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns'; import rangeRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'; import termSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series'; - -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; const dataTypes = [ ['series pos', seriesPos], diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js index 84f67ee3dc00e0..506ad2af85c34d 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js @@ -22,10 +22,8 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { - getVis, - getMockUiState, -} from '../../../../../../../plugins/vis_type_vislib/public/fixtures/_vis_fixture'; +import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +import { getVis } from '../_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; const names = ['rows', 'columns', 'slices']; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mocks.js b/src/plugins/vis_type_vislib/public/fixtures/mocks.js new file mode 100644 index 00000000000000..60edf6c1ff05cc --- /dev/null +++ b/src/plugins/vis_type_vislib/public/fixtures/mocks.js @@ -0,0 +1,37 @@ +/* + * 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 { setFormatService } from '../services'; + +setFormatService({ + deserialize: () => ({ + convert: v => v, + }), +}); + +export const getMockUiState = () => { + const map = new Map(); + + return (() => ({ + get: (...args) => map.get(...args), + set: (...args) => map.set(...args), + setSilent: (...args) => map.set(...args), + on: () => undefined, + }))(); +}; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js index 8eb5c2c9d64c41..dec7de5ceeda95 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis.test.js @@ -23,7 +23,7 @@ import $ from 'jquery'; import { Axis } from './axis'; import { VisConfig } from '../vis_config'; -import { getMockUiState } from '../../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../../fixtures/mocks'; describe('Vislib Axis Class Test Suite', function() { let mockUiState; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js index 32f597648937b7..7901919d306d27 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/axis_title.test.js @@ -25,7 +25,7 @@ import { AxisTitle } from './axis_title'; import { AxisConfig } from './axis_config'; import { VisConfig } from '../vis_config'; import { Data } from '../data'; -import { getMockUiState } from '../../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../../fixtures/mocks'; describe('Vislib AxisTitle Class Test Suite', function() { let el; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js index d534b301c243d7..d007a8a14de131 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/x_axis.test.js @@ -23,7 +23,7 @@ import $ from 'jquery'; import { Axis } from './axis'; import { VisConfig } from '../vis_config'; -import { getMockUiState } from '../../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../../fixtures/mocks'; describe('Vislib xAxis Class Test Suite', function() { let mockUiState; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js index ca7032a4a3eeca..85378ff1a14e87 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/axis/y_axis.test.js @@ -23,7 +23,7 @@ import $ from 'jquery'; import { Axis } from './axis'; import { VisConfig } from '../vis_config'; -import { getMockUiState } from '../../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../../fixtures/mocks'; const YAxis = Axis; let mockUiState; diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js index 13fb9ea7834a37..b1a91979b3d9d8 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/data.test.js @@ -20,7 +20,7 @@ import _ from 'lodash'; import { Data } from './data'; -import { getMockUiState } from '../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../fixtures/mocks'; const seriesData = { label: '', diff --git a/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js b/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js index b19d42b35346e1..1ba7d4aaa8a0c9 100644 --- a/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js +++ b/src/plugins/vis_type_vislib/public/vislib/lib/vis_config.test.js @@ -20,7 +20,7 @@ import d3 from 'd3'; import { VisConfig } from './vis_config'; -import { getMockUiState } from '../../fixtures/_vis_fixture'; +import { getMockUiState } from '../../fixtures/mocks'; describe('Vislib VisConfig Class Test Suite', function() { let el; From 05a5e9e6fb2c0183c3c3a024cb32714f15f1168b Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 23 Apr 2020 13:16:45 +0300 Subject: [PATCH 027/134] Add licenses to mock data, fix eslint issues --- .eslintignore | 1 - .../mock_data/date_histogram/_columns.js | 317 +- .../mock_data/date_histogram/_rows.js | 2019 ++--- .../date_histogram/_rows_series_with_holes.js | 131 +- .../mock_data/date_histogram/_series.js | 181 +- .../_series_monthly_interval.js | 105 +- .../mock_data/date_histogram/_series_neg.js | 181 +- .../date_histogram/_series_pos_neg.js | 181 +- .../date_histogram/_stacked_series.js | 1525 ++-- .../fixtures/mock_data/filters/_columns.js | 147 +- .../fixtures/mock_data/filters/_rows.js | 139 +- .../fixtures/mock_data/filters/_series.js | 65 +- .../fixtures/mock_data/geohash/_columns.js | 6469 +++++++---------- .../fixtures/mock_data/geohash/_geo_json.js | 2743 +++---- .../fixtures/mock_data/geohash/_rows.js | 6233 +++++++--------- .../fixtures/mock_data/histogram/_columns.js | 435 +- .../fixtures/mock_data/histogram/_rows.js | 225 +- .../fixtures/mock_data/histogram/_series.js | 129 +- .../fixtures/mock_data/histogram/_slices.js | 501 +- .../mock_data/not_enough_data/_one_point.js | 57 +- .../fixtures/mock_data/range/_columns.js | 95 +- .../public/fixtures/mock_data/range/_rows.js | 137 +- .../fixtures/mock_data/range/_series.js | 61 +- .../mock_data/significant_terms/_columns.js | 285 +- .../mock_data/significant_terms/_rows.js | 285 +- .../mock_data/significant_terms/_series.js | 71 +- .../fixtures/mock_data/stacked/_stacked.js | 1919 ++--- .../fixtures/mock_data/terms/_columns.js | 177 +- .../public/fixtures/mock_data/terms/_rows.js | 127 +- .../fixtures/mock_data/terms/_series.js | 73 +- .../mock_data/terms/_series_multiple.js | 151 +- 31 files changed, 11734 insertions(+), 13431 deletions(-) diff --git a/.eslintignore b/.eslintignore index 4d5194c0a73dc4..2eaa498f86e5ae 100644 --- a/.eslintignore +++ b/.eslintignore @@ -10,7 +10,6 @@ bower_components /html_docs /src/plugins/data/common/es_query/kuery/ast/_generated_/** /src/plugins/vis_type_timelion/public/_generated_/** -/src/plugins/vis_type_vislib/public/fixtures/mock_data /src/legacy/ui/public/flot-charts /test/fixtures/scenarios /src/legacy/core_plugins/console/public/webpackShims diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js index b5b14c279b40e0..ff8538021d2756 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns.js @@ -1,269 +1,288 @@ +/* + * 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 moment from 'moment'; export default { - 'columns': [ + columns: [ { - 'label': '200: response', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1415826608440, - 'max': 1415827508440 + label: '200: response', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1415826608440, + max: 1415827508440, }, - 'yAxisLabel': 'Count of documents', - 'xAxisFormatter': function (thing) { + yAxisLabel: 'Count of documents', + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; }, - 'series': [ + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1415826600000, - 'y': 4 + x: 1415826600000, + y: 4, }, { - 'x': 1415826630000, - 'y': 8 + x: 1415826630000, + y: 8, }, { - 'x': 1415826660000, - 'y': 7 + x: 1415826660000, + y: 7, }, { - 'x': 1415826690000, - 'y': 5 + x: 1415826690000, + y: 5, }, { - 'x': 1415826720000, - 'y': 5 + x: 1415826720000, + y: 5, }, { - 'x': 1415826750000, - 'y': 4 + x: 1415826750000, + y: 4, }, { - 'x': 1415826780000, - 'y': 10 + x: 1415826780000, + y: 10, }, { - 'x': 1415826810000, - 'y': 7 + x: 1415826810000, + y: 7, }, { - 'x': 1415826840000, - 'y': 9 + x: 1415826840000, + y: 9, }, { - 'x': 1415826870000, - 'y': 8 + x: 1415826870000, + y: 8, }, { - 'x': 1415826900000, - 'y': 9 + x: 1415826900000, + y: 9, }, { - 'x': 1415826930000, - 'y': 8 + x: 1415826930000, + y: 8, }, { - 'x': 1415826960000, - 'y': 3 + x: 1415826960000, + y: 3, }, { - 'x': 1415826990000, - 'y': 9 + x: 1415826990000, + y: 9, }, { - 'x': 1415827020000, - 'y': 6 + x: 1415827020000, + y: 6, }, { - 'x': 1415827050000, - 'y': 8 + x: 1415827050000, + y: 8, }, { - 'x': 1415827080000, - 'y': 7 + x: 1415827080000, + y: 7, }, { - 'x': 1415827110000, - 'y': 4 + x: 1415827110000, + y: 4, }, { - 'x': 1415827140000, - 'y': 6 + x: 1415827140000, + y: 6, }, { - 'x': 1415827170000, - 'y': 10 + x: 1415827170000, + y: 10, }, { - 'x': 1415827200000, - 'y': 2 + x: 1415827200000, + y: 2, }, { - 'x': 1415827230000, - 'y': 8 + x: 1415827230000, + y: 8, }, { - 'x': 1415827260000, - 'y': 5 + x: 1415827260000, + y: 5, }, { - 'x': 1415827290000, - 'y': 6 + x: 1415827290000, + y: 6, }, { - 'x': 1415827320000, - 'y': 6 + x: 1415827320000, + y: 6, }, { - 'x': 1415827350000, - 'y': 10 + x: 1415827350000, + y: 10, }, { - 'x': 1415827380000, - 'y': 6 + x: 1415827380000, + y: 6, }, { - 'x': 1415827410000, - 'y': 6 + x: 1415827410000, + y: 6, }, { - 'x': 1415827440000, - 'y': 12 + x: 1415827440000, + y: 12, }, { - 'x': 1415827470000, - 'y': 9 + x: 1415827470000, + y: 9, }, { - 'x': 1415827500000, - 'y': 1 - } - ] - } - ] + x: 1415827500000, + y: 1, + }, + ], + }, + ], }, { - 'label': '503: response', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1415826608440, - 'max': 1415827508440 + label: '503: response', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1415826608440, + max: 1415827508440, }, - 'yAxisLabel': 'Count of documents', - 'xAxisFormatter': function (thing) { + yAxisLabel: 'Count of documents', + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; }, - 'series': [ + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1415826630000, - 'y': 1 + x: 1415826630000, + y: 1, }, { - 'x': 1415826660000, - 'y': 1 + x: 1415826660000, + y: 1, }, { - 'x': 1415826720000, - 'y': 1 + x: 1415826720000, + y: 1, }, { - 'x': 1415826780000, - 'y': 1 + x: 1415826780000, + y: 1, }, { - 'x': 1415826900000, - 'y': 1 + x: 1415826900000, + y: 1, }, { - 'x': 1415827020000, - 'y': 1 + x: 1415827020000, + y: 1, }, { - 'x': 1415827080000, - 'y': 1 + x: 1415827080000, + y: 1, }, { - 'x': 1415827110000, - 'y': 2 - } - ] - } - ] + x: 1415827110000, + y: 2, + }, + ], + }, + ], }, { - 'label': '404: response', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1415826608440, - 'max': 1415827508440 + label: '404: response', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1415826608440, + max: 1415827508440, }, - 'yAxisLabel': 'Count of documents', - 'xAxisFormatter': function (thing) { + yAxisLabel: 'Count of documents', + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; }, - 'series': [ + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1415826660000, - 'y': 1 + x: 1415826660000, + y: 1, }, { - 'x': 1415826720000, - 'y': 1 + x: 1415826720000, + y: 1, }, { - 'x': 1415826810000, - 'y': 1 + x: 1415826810000, + y: 1, }, { - 'x': 1415826960000, - 'y': 1 + x: 1415826960000, + y: 1, }, { - 'x': 1415827050000, - 'y': 1 + x: 1415827050000, + y: 1, }, { - 'x': 1415827260000, - 'y': 1 + x: 1415827260000, + y: 1, }, { - 'x': 1415827380000, - 'y': 1 + x: 1415827380000, + y: 1, }, { - 'x': 1415827410000, - 'y': 1 - } - ] - } - ] - } + x: 1415827410000, + y: 1, + }, + ], + }, + ], + }, ], - 'xAxisOrderedValues': [ + xAxisOrderedValues: [ 1415826600000, 1415826630000, 1415826660000, @@ -296,5 +315,5 @@ export default { 1415827470000, 1415827500000, ], - 'hits': 225 + hits: 225, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js index 98609d8ffbcd3b..6367197acdecea 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows.js @@ -1,1647 +1,1666 @@ +/* + * 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 moment from 'moment'; export default { - 'rows': [ + rows: [ { - 'label': '0.0-1000.0: bytes', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1415826260456, - 'max': 1415827160456 + label: '0.0-1000.0: bytes', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1415826260456, + max: 1415827160456, }, - 'yAxisLabel': 'Count of documents', - 'xAxisFormatter': function (thing) { + yAxisLabel: 'Count of documents', + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; }, - 'series': [ + series: [ { - 'label': 'jpg', - 'values': [ + label: 'jpg', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 1, - 'y0': 0 + x: 1415826330000, + y: 1, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 0 + x: 1415826570000, + y: 0, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 1, - 'y0': 0 + x: 1415826630000, + y: 1, + y0: 0, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 0 + x: 1415826660000, + y: 0, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 1, - 'y0': 0 + x: 1415826780000, + y: 1, + y0: 0, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 0 + x: 1415826810000, + y: 0, + y0: 0, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 0 + x: 1415826840000, + y: 0, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 1, - 'y0': 0 + x: 1415826900000, + y: 1, + y0: 0, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 1, - 'y0': 0 + x: 1415827020000, + y: 1, + y0: 0, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 1, - 'y0': 0 + x: 1415827110000, + y: 1, + y0: 0, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'css', - 'values': [ + label: 'css', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 1 + x: 1415826330000, + y: 0, + y0: 1, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 0 + x: 1415826570000, + y: 0, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 1 + x: 1415826630000, + y: 0, + y0: 1, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 0 + x: 1415826660000, + y: 0, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 1 + x: 1415826780000, + y: 0, + y0: 1, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 0 + x: 1415826810000, + y: 0, + y0: 0, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 0 + x: 1415826840000, + y: 0, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 1, - 'y0': 0 + x: 1415827080000, + y: 1, + y0: 0, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 1 + x: 1415827110000, + y: 0, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'png', - 'values': [ + label: 'png', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 1 + x: 1415826330000, + y: 0, + y0: 1, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 0 + x: 1415826570000, + y: 0, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 1 + x: 1415826630000, + y: 0, + y0: 1, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 0 + x: 1415826660000, + y: 0, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 1 + x: 1415826780000, + y: 0, + y0: 1, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 0 + x: 1415826810000, + y: 0, + y0: 0, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 0 + x: 1415826840000, + y: 0, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 1 + x: 1415827080000, + y: 0, + y0: 1, }, { - 'x': 1415827110000, - 'y': 1, - 'y0': 1 + x: 1415827110000, + y: 1, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'php', - 'values': [ + label: 'php', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 1, - 'y0': 0 + x: 1415826300000, + y: 1, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 1 + x: 1415826330000, + y: 0, + y0: 1, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 0 + x: 1415826570000, + y: 0, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 1 + x: 1415826630000, + y: 0, + y0: 1, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 0 + x: 1415826660000, + y: 0, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 1 + x: 1415826780000, + y: 0, + y0: 1, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 0 + x: 1415826810000, + y: 0, + y0: 0, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 0 + x: 1415826840000, + y: 0, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 1 + x: 1415827080000, + y: 0, + y0: 1, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 2 + x: 1415827110000, + y: 0, + y0: 2, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'gif', - 'values': [ + label: 'gif', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 1 + x: 1415826300000, + y: 0, + y0: 1, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 1 + x: 1415826330000, + y: 0, + y0: 1, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 1, - 'y0': 0 + x: 1415826450000, + y: 1, + y0: 0, }, { - 'x': 1415826480000, - 'y': 1, - 'y0': 0 + x: 1415826480000, + y: 1, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 3, - 'y0': 0 + x: 1415826540000, + y: 3, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 0 + x: 1415826570000, + y: 0, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 1 + x: 1415826630000, + y: 0, + y0: 1, }, { - 'x': 1415826660000, - 'y': 1, - 'y0': 0 + x: 1415826660000, + y: 1, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 1, - 'y0': 0 + x: 1415826720000, + y: 1, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 1, - 'y0': 1 + x: 1415826780000, + y: 1, + y0: 1, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 0 + x: 1415826810000, + y: 0, + y0: 0, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 0 + x: 1415826840000, + y: 0, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 1, - 'y0': 1 + x: 1415827080000, + y: 1, + y0: 1, }, { - 'x': 1415827110000, - 'y': 1, - 'y0': 2 + x: 1415827110000, + y: 1, + y0: 2, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], + }, + ], }, { - 'label': '1000.0-2000.0: bytes', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1415826260457, - 'max': 1415827160457 + label: '1000.0-2000.0: bytes', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1415826260457, + max: 1415827160457, }, - 'yAxisLabel': 'Count of documents', - 'xAxisFormatter': function (thing) { + yAxisLabel: 'Count of documents', + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; }, - 'series': [ + series: [ { - 'label': 'jpg', - 'values': [ + label: 'jpg', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 0 + x: 1415826330000, + y: 0, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 1, - 'y0': 0 + x: 1415826570000, + y: 1, + y0: 0, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 0 + x: 1415826630000, + y: 0, + y0: 0, }, { - 'x': 1415826660000, - 'y': 1, - 'y0': 0 + x: 1415826660000, + y: 1, + y0: 0, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 0 + x: 1415826780000, + y: 0, + y0: 0, }, { - 'x': 1415826810000, - 'y': 2, - 'y0': 0 + x: 1415826810000, + y: 2, + y0: 0, }, { - 'x': 1415826840000, - 'y': 1, - 'y0': 0 + x: 1415826840000, + y: 1, + y0: 0, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 1, - 'y0': 0 + x: 1415826900000, + y: 1, + y0: 0, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 1, - 'y0': 0 + x: 1415827020000, + y: 1, + y0: 0, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 1, - 'y0': 0 + x: 1415827110000, + y: 1, + y0: 0, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'css', - 'values': [ + label: 'css', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 0 + x: 1415826330000, + y: 0, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 1 + x: 1415826570000, + y: 0, + y0: 1, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 0 + x: 1415826630000, + y: 0, + y0: 0, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 1 + x: 1415826660000, + y: 0, + y0: 1, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 0 + x: 1415826780000, + y: 0, + y0: 0, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 2 + x: 1415826810000, + y: 0, + y0: 2, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 1 + x: 1415826840000, + y: 0, + y0: 1, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 0 + x: 1415826990000, + y: 0, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 1 + x: 1415827110000, + y: 0, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'png', - 'values': [ + label: 'png', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 0 + x: 1415826330000, + y: 0, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 0 + x: 1415826450000, + y: 0, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 1 + x: 1415826570000, + y: 0, + y0: 1, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 0 + x: 1415826630000, + y: 0, + y0: 0, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 1 + x: 1415826660000, + y: 0, + y0: 1, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 0 + x: 1415826780000, + y: 0, + y0: 0, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 2 + x: 1415826810000, + y: 0, + y0: 2, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 1 + x: 1415826840000, + y: 0, + y0: 1, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 1, - 'y0': 0 + x: 1415826990000, + y: 1, + y0: 0, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 1 + x: 1415827110000, + y: 0, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'php', - 'values': [ + label: 'php', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 0 + x: 1415826330000, + y: 0, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 1, - 'y0': 0 + x: 1415826450000, + y: 1, + y0: 0, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 1 + x: 1415826570000, + y: 0, + y0: 1, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 0 + x: 1415826630000, + y: 0, + y0: 0, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 1 + x: 1415826660000, + y: 0, + y0: 1, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 0 + x: 1415826780000, + y: 0, + y0: 0, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 2 + x: 1415826810000, + y: 0, + y0: 2, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 1 + x: 1415826840000, + y: 0, + y0: 1, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 1 + x: 1415826990000, + y: 0, + y0: 1, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 1 + x: 1415827110000, + y: 0, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] + x: 1415827140000, + y: 0, + y0: 0, + }, + ], }, { - 'label': 'gif', - 'values': [ + label: 'gif', + values: [ { - 'x': 1415826240000, - 'y': 0, - 'y0': 0 + x: 1415826240000, + y: 0, + y0: 0, }, { - 'x': 1415826270000, - 'y': 0, - 'y0': 0 + x: 1415826270000, + y: 0, + y0: 0, }, { - 'x': 1415826300000, - 'y': 0, - 'y0': 0 + x: 1415826300000, + y: 0, + y0: 0, }, { - 'x': 1415826330000, - 'y': 0, - 'y0': 0 + x: 1415826330000, + y: 0, + y0: 0, }, { - 'x': 1415826360000, - 'y': 0, - 'y0': 0 + x: 1415826360000, + y: 0, + y0: 0, }, { - 'x': 1415826390000, - 'y': 0, - 'y0': 0 + x: 1415826390000, + y: 0, + y0: 0, }, { - 'x': 1415826420000, - 'y': 0, - 'y0': 0 + x: 1415826420000, + y: 0, + y0: 0, }, { - 'x': 1415826450000, - 'y': 0, - 'y0': 1 + x: 1415826450000, + y: 0, + y0: 1, }, { - 'x': 1415826480000, - 'y': 0, - 'y0': 0 + x: 1415826480000, + y: 0, + y0: 0, }, { - 'x': 1415826510000, - 'y': 0, - 'y0': 0 + x: 1415826510000, + y: 0, + y0: 0, }, { - 'x': 1415826540000, - 'y': 0, - 'y0': 0 + x: 1415826540000, + y: 0, + y0: 0, }, { - 'x': 1415826570000, - 'y': 0, - 'y0': 1 + x: 1415826570000, + y: 0, + y0: 1, }, { - 'x': 1415826600000, - 'y': 0, - 'y0': 0 + x: 1415826600000, + y: 0, + y0: 0, }, { - 'x': 1415826630000, - 'y': 0, - 'y0': 0 + x: 1415826630000, + y: 0, + y0: 0, }, { - 'x': 1415826660000, - 'y': 0, - 'y0': 1 + x: 1415826660000, + y: 0, + y0: 1, }, { - 'x': 1415826690000, - 'y': 0, - 'y0': 0 + x: 1415826690000, + y: 0, + y0: 0, }, { - 'x': 1415826720000, - 'y': 0, - 'y0': 0 + x: 1415826720000, + y: 0, + y0: 0, }, { - 'x': 1415826750000, - 'y': 0, - 'y0': 0 + x: 1415826750000, + y: 0, + y0: 0, }, { - 'x': 1415826780000, - 'y': 0, - 'y0': 0 + x: 1415826780000, + y: 0, + y0: 0, }, { - 'x': 1415826810000, - 'y': 0, - 'y0': 2 + x: 1415826810000, + y: 0, + y0: 2, }, { - 'x': 1415826840000, - 'y': 0, - 'y0': 1 + x: 1415826840000, + y: 0, + y0: 1, }, { - 'x': 1415826870000, - 'y': 0, - 'y0': 0 + x: 1415826870000, + y: 0, + y0: 0, }, { - 'x': 1415826900000, - 'y': 0, - 'y0': 1 + x: 1415826900000, + y: 0, + y0: 1, }, { - 'x': 1415826930000, - 'y': 0, - 'y0': 0 + x: 1415826930000, + y: 0, + y0: 0, }, { - 'x': 1415826960000, - 'y': 0, - 'y0': 0 + x: 1415826960000, + y: 0, + y0: 0, }, { - 'x': 1415826990000, - 'y': 0, - 'y0': 1 + x: 1415826990000, + y: 0, + y0: 1, }, { - 'x': 1415827020000, - 'y': 0, - 'y0': 1 + x: 1415827020000, + y: 0, + y0: 1, }, { - 'x': 1415827050000, - 'y': 0, - 'y0': 0 + x: 1415827050000, + y: 0, + y0: 0, }, { - 'x': 1415827080000, - 'y': 0, - 'y0': 0 + x: 1415827080000, + y: 0, + y0: 0, }, { - 'x': 1415827110000, - 'y': 0, - 'y0': 1 + x: 1415827110000, + y: 0, + y0: 1, }, { - 'x': 1415827140000, - 'y': 0, - 'y0': 0 - } - ] - } - ] - } + x: 1415827140000, + y: 0, + y0: 0, + }, + ], + }, + ], + }, ], - 'xAxisOrderedValues': [ + xAxisOrderedValues: [ 1415826240000, 1415826270000, 1415826300000, @@ -1674,5 +1693,5 @@ export default { 1415827110000, 1415827140000, ], - 'hits': 236 + hits: 236, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js index 4ca631c7fc4972..ba0d8bf251c6fa 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes.js @@ -1,106 +1,125 @@ +/* + * 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 moment from 'moment'; export const rowsSeriesWithHoles = { rows: [ { - 'label': '', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'min': 1411761457636, - 'max': 1411762357636, - 'interval': 30000 + label: '', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + min: 1411761457636, + max: 1411762357636, + interval: 30000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1411761450000, - 'y': 41 + x: 1411761450000, + y: 41, }, { - 'x': 1411761510000, - 'y': 22 + x: 1411761510000, + y: 22, }, { - 'x': 1411761540000, - 'y': 17 + x: 1411761540000, + y: 17, }, { - 'x': 1411761840000, - 'y': 20 + x: 1411761840000, + y: 20, }, { - 'x': 1411761870000, - 'y': 20 + x: 1411761870000, + y: 20, }, { - 'x': 1411761900000, - 'y': 21 + x: 1411761900000, + y: 21, }, { - 'x': 1411761930000, - 'y': 17 + x: 1411761930000, + y: 17, }, { - 'x': 1411761960000, - 'y': 20 + x: 1411761960000, + y: 20, }, { - 'x': 1411761990000, - 'y': 13 + x: 1411761990000, + y: 13, }, { - 'x': 1411762020000, - 'y': 14 + x: 1411762020000, + y: 14, }, { - 'x': 1411762050000, - 'y': 25 + x: 1411762050000, + y: 25, }, { - 'x': 1411762080000, - 'y': 17 + x: 1411762080000, + y: 17, }, { - 'x': 1411762110000, - 'y': 14 + x: 1411762110000, + y: 14, }, { - 'x': 1411762140000, - 'y': 22 + x: 1411762140000, + y: 22, }, { - 'x': 1411762170000, - 'y': 14 + x: 1411762170000, + y: 14, }, { - 'x': 1411762200000, - 'y': 19 + x: 1411762200000, + y: 19, }, { - 'x': 1411762320000, - 'y': 15 + x: 1411762320000, + y: 15, }, { - 'x': 1411762350000, - 'y': 4 - } - ] - } + x: 1411762350000, + y: 4, + }, + ], + }, ], - 'hits': 533, - 'xAxisFormatter': function (thing) { + hits: 533, + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'xAxisOrderedValues': [ + xAxisOrderedValues: [ 1411761450000, 1411761510000, 1411761540000, diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js index 13e2ab7b7fb1ac..89e4f9a32cee16 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series.js @@ -1,148 +1,167 @@ +/* + * 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 moment from 'moment'; export default { - 'label': '', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'min': 1411761457636, - 'max': 1411762357636, - 'interval': 30000 + label: '', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + min: 1411761457636, + max: 1411762357636, + interval: 30000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1411761450000, - 'y': 41 + x: 1411761450000, + y: 41, }, { - 'x': 1411761480000, - 'y': 18 + x: 1411761480000, + y: 18, }, { - 'x': 1411761510000, - 'y': 22 + x: 1411761510000, + y: 22, }, { - 'x': 1411761540000, - 'y': 17 + x: 1411761540000, + y: 17, }, { - 'x': 1411761570000, - 'y': 17 + x: 1411761570000, + y: 17, }, { - 'x': 1411761600000, - 'y': 21 + x: 1411761600000, + y: 21, }, { - 'x': 1411761630000, - 'y': 16 + x: 1411761630000, + y: 16, }, { - 'x': 1411761660000, - 'y': 17 + x: 1411761660000, + y: 17, }, { - 'x': 1411761690000, - 'y': 15 + x: 1411761690000, + y: 15, }, { - 'x': 1411761720000, - 'y': 19 + x: 1411761720000, + y: 19, }, { - 'x': 1411761750000, - 'y': 11 + x: 1411761750000, + y: 11, }, { - 'x': 1411761780000, - 'y': 13 + x: 1411761780000, + y: 13, }, { - 'x': 1411761810000, - 'y': 24 + x: 1411761810000, + y: 24, }, { - 'x': 1411761840000, - 'y': 20 + x: 1411761840000, + y: 20, }, { - 'x': 1411761870000, - 'y': 20 + x: 1411761870000, + y: 20, }, { - 'x': 1411761900000, - 'y': 21 + x: 1411761900000, + y: 21, }, { - 'x': 1411761930000, - 'y': 17 + x: 1411761930000, + y: 17, }, { - 'x': 1411761960000, - 'y': 20 + x: 1411761960000, + y: 20, }, { - 'x': 1411761990000, - 'y': 13 + x: 1411761990000, + y: 13, }, { - 'x': 1411762020000, - 'y': 14 + x: 1411762020000, + y: 14, }, { - 'x': 1411762050000, - 'y': 25 + x: 1411762050000, + y: 25, }, { - 'x': 1411762080000, - 'y': 17 + x: 1411762080000, + y: 17, }, { - 'x': 1411762110000, - 'y': 14 + x: 1411762110000, + y: 14, }, { - 'x': 1411762140000, - 'y': 22 + x: 1411762140000, + y: 22, }, { - 'x': 1411762170000, - 'y': 14 + x: 1411762170000, + y: 14, }, { - 'x': 1411762200000, - 'y': 19 + x: 1411762200000, + y: 19, }, { - 'x': 1411762230000, - 'y': 22 + x: 1411762230000, + y: 22, }, { - 'x': 1411762260000, - 'y': 17 + x: 1411762260000, + y: 17, }, { - 'x': 1411762290000, - 'y': 8 + x: 1411762290000, + y: 8, }, { - 'x': 1411762320000, - 'y': 15 + x: 1411762320000, + y: 15, }, { - 'x': 1411762350000, - 'y': 4 - } - ] - } + x: 1411762350000, + y: 4, + }, + ], + }, ], - 'hits': 533, - 'xAxisOrderedValues': [ + hits: 533, + xAxisOrderedValues: [ 1411761450000, 1411761480000, 1411761510000, @@ -175,10 +194,10 @@ export default { 1411762320000, 1411762350000, ], - 'xAxisFormatter': function (thing) { + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js index 6b7c574ab55511..85078a2ec15af2 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval.js @@ -1,72 +1,91 @@ +/* + * 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 moment from 'moment'; export const seriesMonthlyInterval = { - 'label': '', - 'xAxisLabel': '@timestamp per month', - 'ordered': { - 'date': true, - 'min': 1451631600000, - 'max': 1483254000000, - 'interval': 2678000000 + label: '', + xAxisLabel: '@timestamp per month', + ordered: { + date: true, + min: 1451631600000, + max: 1483254000000, + interval: 2678000000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1451631600000, - 'y': 10220 + x: 1451631600000, + y: 10220, }, { - 'x': 1454310000000, - 'y': 9997, + x: 1454310000000, + y: 9997, }, { - 'x': 1456815600000, - 'y': 10792, + x: 1456815600000, + y: 10792, }, { - 'x': 1459490400000, - 'y': 10262 + x: 1459490400000, + y: 10262, }, { - 'x': 1462082400000, - 'y': 10080 + x: 1462082400000, + y: 10080, }, { - 'x': 1464760800000, - 'y': 11161 + x: 1464760800000, + y: 11161, }, { - 'x': 1467352800000, - 'y': 9933 + x: 1467352800000, + y: 9933, }, { - 'x': 1470031200000, - 'y': 10342 + x: 1470031200000, + y: 10342, }, { - 'x': 1472709600000, - 'y': 10887 + x: 1472709600000, + y: 10887, }, { - 'x': 1475301600000, - 'y': 9666 + x: 1475301600000, + y: 9666, }, { - 'x': 1477980000000, - 'y': 9556 + x: 1477980000000, + y: 9556, }, { - 'x': 1480575600000, - 'y': 11644 - } - ] - } + x: 1480575600000, + y: 11644, + }, + ], + }, ], - 'hits': 533, - 'xAxisOrderedValues': [ + hits: 533, + xAxisOrderedValues: [ 1451631600000, 1454310000000, 1456815600000, @@ -80,10 +99,10 @@ export const seriesMonthlyInterval = { 1477980000000, 1480575600000, ], - 'xAxisFormatter': function (thing) { + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js index ff5cd05b2f2d49..821c04685d22e5 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg.js @@ -1,148 +1,167 @@ +/* + * 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 moment from 'moment'; export default { - 'label': '', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'min': 1411761457636, - 'max': 1411762357636, - 'interval': 30000 + label: '', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + min: 1411761457636, + max: 1411762357636, + interval: 30000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1411761450000, - 'y': -41 + x: 1411761450000, + y: -41, }, { - 'x': 1411761480000, - 'y': -18 + x: 1411761480000, + y: -18, }, { - 'x': 1411761510000, - 'y': -22 + x: 1411761510000, + y: -22, }, { - 'x': 1411761540000, - 'y': -17 + x: 1411761540000, + y: -17, }, { - 'x': 1411761570000, - 'y': -17 + x: 1411761570000, + y: -17, }, { - 'x': 1411761600000, - 'y': -21 + x: 1411761600000, + y: -21, }, { - 'x': 1411761630000, - 'y': -16 + x: 1411761630000, + y: -16, }, { - 'x': 1411761660000, - 'y': -17 + x: 1411761660000, + y: -17, }, { - 'x': 1411761690000, - 'y': -15 + x: 1411761690000, + y: -15, }, { - 'x': 1411761720000, - 'y': -19 + x: 1411761720000, + y: -19, }, { - 'x': 1411761750000, - 'y': -11 + x: 1411761750000, + y: -11, }, { - 'x': 1411761780000, - 'y': -13 + x: 1411761780000, + y: -13, }, { - 'x': 1411761810000, - 'y': -24 + x: 1411761810000, + y: -24, }, { - 'x': 1411761840000, - 'y': -20 + x: 1411761840000, + y: -20, }, { - 'x': 1411761870000, - 'y': -20 + x: 1411761870000, + y: -20, }, { - 'x': 1411761900000, - 'y': -21 + x: 1411761900000, + y: -21, }, { - 'x': 1411761930000, - 'y': -17 + x: 1411761930000, + y: -17, }, { - 'x': 1411761960000, - 'y': -20 + x: 1411761960000, + y: -20, }, { - 'x': 1411761990000, - 'y': -13 + x: 1411761990000, + y: -13, }, { - 'x': 1411762020000, - 'y': -14 + x: 1411762020000, + y: -14, }, { - 'x': 1411762050000, - 'y': -25 + x: 1411762050000, + y: -25, }, { - 'x': 1411762080000, - 'y': -17 + x: 1411762080000, + y: -17, }, { - 'x': 1411762110000, - 'y': -14 + x: 1411762110000, + y: -14, }, { - 'x': 1411762140000, - 'y': -22 + x: 1411762140000, + y: -22, }, { - 'x': 1411762170000, - 'y': -14 + x: 1411762170000, + y: -14, }, { - 'x': 1411762200000, - 'y': -19 + x: 1411762200000, + y: -19, }, { - 'x': 1411762230000, - 'y': -22 + x: 1411762230000, + y: -22, }, { - 'x': 1411762260000, - 'y': -17 + x: 1411762260000, + y: -17, }, { - 'x': 1411762290000, - 'y': -8 + x: 1411762290000, + y: -8, }, { - 'x': 1411762320000, - 'y': -15 + x: 1411762320000, + y: -15, }, { - 'x': 1411762350000, - 'y': -4 - } - ] - } + x: 1411762350000, + y: -4, + }, + ], + }, ], - 'hits': 533, - 'xAxisOrderedValues': [ + hits: 533, + xAxisOrderedValues: [ 1411761450000, 1411761480000, 1411761510000, @@ -175,10 +194,10 @@ export default { 1411762320000, 1411762350000, ], - 'xAxisFormatter': function (thing) { + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js index 06d9b31dc6b578..65821ac58eb0db 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg.js @@ -1,148 +1,167 @@ +/* + * 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 moment from 'moment'; export default { - 'label': '', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'min': 1411761457636, - 'max': 1411762357636, - 'interval': 30000 + label: '', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + min: 1411761457636, + max: 1411762357636, + interval: 30000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 1411761450000, - 'y': 41 + x: 1411761450000, + y: 41, }, { - 'x': 1411761480000, - 'y': 18 + x: 1411761480000, + y: 18, }, { - 'x': 1411761510000, - 'y': -22 + x: 1411761510000, + y: -22, }, { - 'x': 1411761540000, - 'y': -17 + x: 1411761540000, + y: -17, }, { - 'x': 1411761570000, - 'y': -17 + x: 1411761570000, + y: -17, }, { - 'x': 1411761600000, - 'y': -21 + x: 1411761600000, + y: -21, }, { - 'x': 1411761630000, - 'y': -16 + x: 1411761630000, + y: -16, }, { - 'x': 1411761660000, - 'y': 17 + x: 1411761660000, + y: 17, }, { - 'x': 1411761690000, - 'y': 15 + x: 1411761690000, + y: 15, }, { - 'x': 1411761720000, - 'y': 19 + x: 1411761720000, + y: 19, }, { - 'x': 1411761750000, - 'y': 11 + x: 1411761750000, + y: 11, }, { - 'x': 1411761780000, - 'y': -13 + x: 1411761780000, + y: -13, }, { - 'x': 1411761810000, - 'y': -24 + x: 1411761810000, + y: -24, }, { - 'x': 1411761840000, - 'y': -20 + x: 1411761840000, + y: -20, }, { - 'x': 1411761870000, - 'y': -20 + x: 1411761870000, + y: -20, }, { - 'x': 1411761900000, - 'y': -21 + x: 1411761900000, + y: -21, }, { - 'x': 1411761930000, - 'y': 17 + x: 1411761930000, + y: 17, }, { - 'x': 1411761960000, - 'y': 20 + x: 1411761960000, + y: 20, }, { - 'x': 1411761990000, - 'y': -13 + x: 1411761990000, + y: -13, }, { - 'x': 1411762020000, - 'y': -14 + x: 1411762020000, + y: -14, }, { - 'x': 1411762050000, - 'y': 25 + x: 1411762050000, + y: 25, }, { - 'x': 1411762080000, - 'y': -17 + x: 1411762080000, + y: -17, }, { - 'x': 1411762110000, - 'y': -14 + x: 1411762110000, + y: -14, }, { - 'x': 1411762140000, - 'y': -22 + x: 1411762140000, + y: -22, }, { - 'x': 1411762170000, - 'y': -14 + x: 1411762170000, + y: -14, }, { - 'x': 1411762200000, - 'y': 19 + x: 1411762200000, + y: 19, }, { - 'x': 1411762230000, - 'y': 22 + x: 1411762230000, + y: 22, }, { - 'x': 1411762260000, - 'y': 17 + x: 1411762260000, + y: 17, }, { - 'x': 1411762290000, - 'y': 8 + x: 1411762290000, + y: 8, }, { - 'x': 1411762320000, - 'y': -15 + x: 1411762320000, + y: -15, }, { - 'x': 1411762350000, - 'y': -4 - } - ] - } + x: 1411762350000, + y: -4, + }, + ], + }, ], - 'hits': 533, - 'xAxisOrderedValues': [ + hits: 533, + xAxisOrderedValues: [ 1411761450000, 1411761480000, 1411761510000, @@ -175,10 +194,10 @@ export default { 1411762320000, 1411762350000, ], - 'xAxisFormatter': function (thing) { + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js index 5208c7e996cd87..b6f731c9655d41 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series.js @@ -1,1480 +1,1499 @@ +/* + * 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 moment from 'moment'; export default { - 'label': '', - 'xAxisLabel': '@timestamp per 10 min', - 'ordered': { - 'date': true, - 'min': 1413544140087, - 'max': 1413587340087, - 'interval': 600000 + label: '', + xAxisLabel: '@timestamp per 10 min', + ordered: { + date: true, + min: 1413544140087, + max: 1413587340087, + interval: 600000, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'html', - 'values': [ + label: 'html', + values: [ { - 'x': 1413543600000, - 'y': 140 + x: 1413543600000, + y: 140, }, { - 'x': 1413544200000, - 'y': 1388 + x: 1413544200000, + y: 1388, }, { - 'x': 1413544800000, - 'y': 1308 + x: 1413544800000, + y: 1308, }, { - 'x': 1413545400000, - 'y': 1356 + x: 1413545400000, + y: 1356, }, { - 'x': 1413546000000, - 'y': 1314 + x: 1413546000000, + y: 1314, }, { - 'x': 1413546600000, - 'y': 1343 + x: 1413546600000, + y: 1343, }, { - 'x': 1413547200000, - 'y': 1353 + x: 1413547200000, + y: 1353, }, { - 'x': 1413547800000, - 'y': 1353 + x: 1413547800000, + y: 1353, }, { - 'x': 1413548400000, - 'y': 1334 + x: 1413548400000, + y: 1334, }, { - 'x': 1413549000000, - 'y': 1433 + x: 1413549000000, + y: 1433, }, { - 'x': 1413549600000, - 'y': 1331 + x: 1413549600000, + y: 1331, }, { - 'x': 1413550200000, - 'y': 1349 + x: 1413550200000, + y: 1349, }, { - 'x': 1413550800000, - 'y': 1323 + x: 1413550800000, + y: 1323, }, { - 'x': 1413551400000, - 'y': 1203 + x: 1413551400000, + y: 1203, }, { - 'x': 1413552000000, - 'y': 1231 + x: 1413552000000, + y: 1231, }, { - 'x': 1413552600000, - 'y': 1227 + x: 1413552600000, + y: 1227, }, { - 'x': 1413553200000, - 'y': 1187 + x: 1413553200000, + y: 1187, }, { - 'x': 1413553800000, - 'y': 1119 + x: 1413553800000, + y: 1119, }, { - 'x': 1413554400000, - 'y': 1159 + x: 1413554400000, + y: 1159, }, { - 'x': 1413555000000, - 'y': 1117 + x: 1413555000000, + y: 1117, }, { - 'x': 1413555600000, - 'y': 1152 + x: 1413555600000, + y: 1152, }, { - 'x': 1413556200000, - 'y': 1057 + x: 1413556200000, + y: 1057, }, { - 'x': 1413556800000, - 'y': 1009 + x: 1413556800000, + y: 1009, }, { - 'x': 1413557400000, - 'y': 979 + x: 1413557400000, + y: 979, }, { - 'x': 1413558000000, - 'y': 975 + x: 1413558000000, + y: 975, }, { - 'x': 1413558600000, - 'y': 848 + x: 1413558600000, + y: 848, }, { - 'x': 1413559200000, - 'y': 873 + x: 1413559200000, + y: 873, }, { - 'x': 1413559800000, - 'y': 808 + x: 1413559800000, + y: 808, }, { - 'x': 1413560400000, - 'y': 784 + x: 1413560400000, + y: 784, }, { - 'x': 1413561000000, - 'y': 799 + x: 1413561000000, + y: 799, }, { - 'x': 1413561600000, - 'y': 684 + x: 1413561600000, + y: 684, }, { - 'x': 1413562200000, - 'y': 727 + x: 1413562200000, + y: 727, }, { - 'x': 1413562800000, - 'y': 621 + x: 1413562800000, + y: 621, }, { - 'x': 1413563400000, - 'y': 615 + x: 1413563400000, + y: 615, }, { - 'x': 1413564000000, - 'y': 569 + x: 1413564000000, + y: 569, }, { - 'x': 1413564600000, - 'y': 523 + x: 1413564600000, + y: 523, }, { - 'x': 1413565200000, - 'y': 474 + x: 1413565200000, + y: 474, }, { - 'x': 1413565800000, - 'y': 470 + x: 1413565800000, + y: 470, }, { - 'x': 1413566400000, - 'y': 466 + x: 1413566400000, + y: 466, }, { - 'x': 1413567000000, - 'y': 394 + x: 1413567000000, + y: 394, }, { - 'x': 1413567600000, - 'y': 404 + x: 1413567600000, + y: 404, }, { - 'x': 1413568200000, - 'y': 389 + x: 1413568200000, + y: 389, }, { - 'x': 1413568800000, - 'y': 312 + x: 1413568800000, + y: 312, }, { - 'x': 1413569400000, - 'y': 274 + x: 1413569400000, + y: 274, }, { - 'x': 1413570000000, - 'y': 285 + x: 1413570000000, + y: 285, }, { - 'x': 1413570600000, - 'y': 299 + x: 1413570600000, + y: 299, }, { - 'x': 1413571200000, - 'y': 207 + x: 1413571200000, + y: 207, }, { - 'x': 1413571800000, - 'y': 213 + x: 1413571800000, + y: 213, }, { - 'x': 1413572400000, - 'y': 119 + x: 1413572400000, + y: 119, }, { - 'x': 1413573600000, - 'y': 122 + x: 1413573600000, + y: 122, }, { - 'x': 1413574200000, - 'y': 169 + x: 1413574200000, + y: 169, }, { - 'x': 1413574800000, - 'y': 151 + x: 1413574800000, + y: 151, }, { - 'x': 1413575400000, - 'y': 152 + x: 1413575400000, + y: 152, }, { - 'x': 1413576000000, - 'y': 115 + x: 1413576000000, + y: 115, }, { - 'x': 1413576600000, - 'y': 117 + x: 1413576600000, + y: 117, }, { - 'x': 1413577200000, - 'y': 108 + x: 1413577200000, + y: 108, }, { - 'x': 1413577800000, - 'y': 100 + x: 1413577800000, + y: 100, }, { - 'x': 1413578400000, - 'y': 78 + x: 1413578400000, + y: 78, }, { - 'x': 1413579000000, - 'y': 88 + x: 1413579000000, + y: 88, }, { - 'x': 1413579600000, - 'y': 63 + x: 1413579600000, + y: 63, }, { - 'x': 1413580200000, - 'y': 58 + x: 1413580200000, + y: 58, }, { - 'x': 1413580800000, - 'y': 45 + x: 1413580800000, + y: 45, }, { - 'x': 1413581400000, - 'y': 57 + x: 1413581400000, + y: 57, }, { - 'x': 1413582000000, - 'y': 34 + x: 1413582000000, + y: 34, }, { - 'x': 1413582600000, - 'y': 41 + x: 1413582600000, + y: 41, }, { - 'x': 1413583200000, - 'y': 24 + x: 1413583200000, + y: 24, }, { - 'x': 1413583800000, - 'y': 27 + x: 1413583800000, + y: 27, }, { - 'x': 1413584400000, - 'y': 19 + x: 1413584400000, + y: 19, }, { - 'x': 1413585000000, - 'y': 24 + x: 1413585000000, + y: 24, }, { - 'x': 1413585600000, - 'y': 18 + x: 1413585600000, + y: 18, }, { - 'x': 1413586200000, - 'y': 17 + x: 1413586200000, + y: 17, }, { - 'x': 1413586800000, - 'y': 14 - } - ] + x: 1413586800000, + y: 14, + }, + ], }, { - 'label': 'php', - 'values': [ + label: 'php', + values: [ { - 'x': 1413543600000, - 'y': 90 + x: 1413543600000, + y: 90, }, { - 'x': 1413544200000, - 'y': 949 + x: 1413544200000, + y: 949, }, { - 'x': 1413544800000, - 'y': 1012 + x: 1413544800000, + y: 1012, }, { - 'x': 1413545400000, - 'y': 1027 + x: 1413545400000, + y: 1027, }, { - 'x': 1413546000000, - 'y': 1073 + x: 1413546000000, + y: 1073, }, { - 'x': 1413546600000, - 'y': 992 + x: 1413546600000, + y: 992, }, { - 'x': 1413547200000, - 'y': 1005 + x: 1413547200000, + y: 1005, }, { - 'x': 1413547800000, - 'y': 1014 + x: 1413547800000, + y: 1014, }, { - 'x': 1413548400000, - 'y': 987 + x: 1413548400000, + y: 987, }, { - 'x': 1413549000000, - 'y': 982 + x: 1413549000000, + y: 982, }, { - 'x': 1413549600000, - 'y': 1086 + x: 1413549600000, + y: 1086, }, { - 'x': 1413550200000, - 'y': 998 + x: 1413550200000, + y: 998, }, { - 'x': 1413550800000, - 'y': 935 + x: 1413550800000, + y: 935, }, { - 'x': 1413551400000, - 'y': 995 + x: 1413551400000, + y: 995, }, { - 'x': 1413552000000, - 'y': 926 + x: 1413552000000, + y: 926, }, { - 'x': 1413552600000, - 'y': 897 + x: 1413552600000, + y: 897, }, { - 'x': 1413553200000, - 'y': 873 + x: 1413553200000, + y: 873, }, { - 'x': 1413553800000, - 'y': 885 + x: 1413553800000, + y: 885, }, { - 'x': 1413554400000, - 'y': 859 + x: 1413554400000, + y: 859, }, { - 'x': 1413555000000, - 'y': 852 + x: 1413555000000, + y: 852, }, { - 'x': 1413555600000, - 'y': 779 + x: 1413555600000, + y: 779, }, { - 'x': 1413556200000, - 'y': 739 + x: 1413556200000, + y: 739, }, { - 'x': 1413556800000, - 'y': 783 + x: 1413556800000, + y: 783, }, { - 'x': 1413557400000, - 'y': 784 + x: 1413557400000, + y: 784, }, { - 'x': 1413558000000, - 'y': 687 + x: 1413558000000, + y: 687, }, { - 'x': 1413558600000, - 'y': 660 + x: 1413558600000, + y: 660, }, { - 'x': 1413559200000, - 'y': 672 + x: 1413559200000, + y: 672, }, { - 'x': 1413559800000, - 'y': 600 + x: 1413559800000, + y: 600, }, { - 'x': 1413560400000, - 'y': 659 + x: 1413560400000, + y: 659, }, { - 'x': 1413561000000, - 'y': 540 + x: 1413561000000, + y: 540, }, { - 'x': 1413561600000, - 'y': 539 + x: 1413561600000, + y: 539, }, { - 'x': 1413562200000, - 'y': 481 + x: 1413562200000, + y: 481, }, { - 'x': 1413562800000, - 'y': 498 + x: 1413562800000, + y: 498, }, { - 'x': 1413563400000, - 'y': 444 + x: 1413563400000, + y: 444, }, { - 'x': 1413564000000, - 'y': 452 + x: 1413564000000, + y: 452, }, { - 'x': 1413564600000, - 'y': 408 + x: 1413564600000, + y: 408, }, { - 'x': 1413565200000, - 'y': 358 + x: 1413565200000, + y: 358, }, { - 'x': 1413565800000, - 'y': 321 + x: 1413565800000, + y: 321, }, { - 'x': 1413566400000, - 'y': 305 + x: 1413566400000, + y: 305, }, { - 'x': 1413567000000, - 'y': 292 + x: 1413567000000, + y: 292, }, { - 'x': 1413567600000, - 'y': 289 + x: 1413567600000, + y: 289, }, { - 'x': 1413568200000, - 'y': 239 + x: 1413568200000, + y: 239, }, { - 'x': 1413568800000, - 'y': 256 + x: 1413568800000, + y: 256, }, { - 'x': 1413569400000, - 'y': 220 + x: 1413569400000, + y: 220, }, { - 'x': 1413570000000, - 'y': 205 + x: 1413570000000, + y: 205, }, { - 'x': 1413570600000, - 'y': 201 + x: 1413570600000, + y: 201, }, { - 'x': 1413571200000, - 'y': 183 + x: 1413571200000, + y: 183, }, { - 'x': 1413571800000, - 'y': 172 + x: 1413571800000, + y: 172, }, { - 'x': 1413572400000, - 'y': 73 + x: 1413572400000, + y: 73, }, { - 'x': 1413573600000, - 'y': 90 + x: 1413573600000, + y: 90, }, { - 'x': 1413574200000, - 'y': 130 + x: 1413574200000, + y: 130, }, { - 'x': 1413574800000, - 'y': 104 + x: 1413574800000, + y: 104, }, { - 'x': 1413575400000, - 'y': 108 + x: 1413575400000, + y: 108, }, { - 'x': 1413576000000, - 'y': 92 + x: 1413576000000, + y: 92, }, { - 'x': 1413576600000, - 'y': 79 + x: 1413576600000, + y: 79, }, { - 'x': 1413577200000, - 'y': 90 + x: 1413577200000, + y: 90, }, { - 'x': 1413577800000, - 'y': 72 + x: 1413577800000, + y: 72, }, { - 'x': 1413578400000, - 'y': 68 + x: 1413578400000, + y: 68, }, { - 'x': 1413579000000, - 'y': 52 + x: 1413579000000, + y: 52, }, { - 'x': 1413579600000, - 'y': 60 + x: 1413579600000, + y: 60, }, { - 'x': 1413580200000, - 'y': 51 + x: 1413580200000, + y: 51, }, { - 'x': 1413580800000, - 'y': 32 + x: 1413580800000, + y: 32, }, { - 'x': 1413581400000, - 'y': 37 + x: 1413581400000, + y: 37, }, { - 'x': 1413582000000, - 'y': 30 + x: 1413582000000, + y: 30, }, { - 'x': 1413582600000, - 'y': 29 + x: 1413582600000, + y: 29, }, { - 'x': 1413583200000, - 'y': 24 + x: 1413583200000, + y: 24, }, { - 'x': 1413583800000, - 'y': 16 + x: 1413583800000, + y: 16, }, { - 'x': 1413584400000, - 'y': 15 + x: 1413584400000, + y: 15, }, { - 'x': 1413585000000, - 'y': 15 + x: 1413585000000, + y: 15, }, { - 'x': 1413585600000, - 'y': 10 + x: 1413585600000, + y: 10, }, { - 'x': 1413586200000, - 'y': 9 + x: 1413586200000, + y: 9, }, { - 'x': 1413586800000, - 'y': 9 - } - ] + x: 1413586800000, + y: 9, + }, + ], }, { - 'label': 'png', - 'values': [ + label: 'png', + values: [ { - 'x': 1413543600000, - 'y': 44 + x: 1413543600000, + y: 44, }, { - 'x': 1413544200000, - 'y': 495 + x: 1413544200000, + y: 495, }, { - 'x': 1413544800000, - 'y': 489 + x: 1413544800000, + y: 489, }, { - 'x': 1413545400000, - 'y': 492 + x: 1413545400000, + y: 492, }, { - 'x': 1413546000000, - 'y': 556 + x: 1413546000000, + y: 556, }, { - 'x': 1413546600000, - 'y': 536 + x: 1413546600000, + y: 536, }, { - 'x': 1413547200000, - 'y': 511 + x: 1413547200000, + y: 511, }, { - 'x': 1413547800000, - 'y': 479 + x: 1413547800000, + y: 479, }, { - 'x': 1413548400000, - 'y': 544 + x: 1413548400000, + y: 544, }, { - 'x': 1413549000000, - 'y': 513 + x: 1413549000000, + y: 513, }, { - 'x': 1413549600000, - 'y': 501 + x: 1413549600000, + y: 501, }, { - 'x': 1413550200000, - 'y': 532 + x: 1413550200000, + y: 532, }, { - 'x': 1413550800000, - 'y': 440 + x: 1413550800000, + y: 440, }, { - 'x': 1413551400000, - 'y': 455 + x: 1413551400000, + y: 455, }, { - 'x': 1413552000000, - 'y': 455 + x: 1413552000000, + y: 455, }, { - 'x': 1413552600000, - 'y': 471 + x: 1413552600000, + y: 471, }, { - 'x': 1413553200000, - 'y': 428 + x: 1413553200000, + y: 428, }, { - 'x': 1413553800000, - 'y': 457 + x: 1413553800000, + y: 457, }, { - 'x': 1413554400000, - 'y': 450 + x: 1413554400000, + y: 450, }, { - 'x': 1413555000000, - 'y': 418 + x: 1413555000000, + y: 418, }, { - 'x': 1413555600000, - 'y': 398 + x: 1413555600000, + y: 398, }, { - 'x': 1413556200000, - 'y': 397 + x: 1413556200000, + y: 397, }, { - 'x': 1413556800000, - 'y': 359 + x: 1413556800000, + y: 359, }, { - 'x': 1413557400000, - 'y': 398 + x: 1413557400000, + y: 398, }, { - 'x': 1413558000000, - 'y': 339 + x: 1413558000000, + y: 339, }, { - 'x': 1413558600000, - 'y': 363 + x: 1413558600000, + y: 363, }, { - 'x': 1413559200000, - 'y': 297 + x: 1413559200000, + y: 297, }, { - 'x': 1413559800000, - 'y': 323 + x: 1413559800000, + y: 323, }, { - 'x': 1413560400000, - 'y': 302 + x: 1413560400000, + y: 302, }, { - 'x': 1413561000000, - 'y': 260 + x: 1413561000000, + y: 260, }, { - 'x': 1413561600000, - 'y': 276 + x: 1413561600000, + y: 276, }, { - 'x': 1413562200000, - 'y': 249 + x: 1413562200000, + y: 249, }, { - 'x': 1413562800000, - 'y': 248 + x: 1413562800000, + y: 248, }, { - 'x': 1413563400000, - 'y': 235 + x: 1413563400000, + y: 235, }, { - 'x': 1413564000000, - 'y': 234 + x: 1413564000000, + y: 234, }, { - 'x': 1413564600000, - 'y': 188 + x: 1413564600000, + y: 188, }, { - 'x': 1413565200000, - 'y': 192 + x: 1413565200000, + y: 192, }, { - 'x': 1413565800000, - 'y': 173 + x: 1413565800000, + y: 173, }, { - 'x': 1413566400000, - 'y': 160 + x: 1413566400000, + y: 160, }, { - 'x': 1413567000000, - 'y': 137 + x: 1413567000000, + y: 137, }, { - 'x': 1413567600000, - 'y': 158 + x: 1413567600000, + y: 158, }, { - 'x': 1413568200000, - 'y': 111 + x: 1413568200000, + y: 111, }, { - 'x': 1413568800000, - 'y': 145 + x: 1413568800000, + y: 145, }, { - 'x': 1413569400000, - 'y': 118 + x: 1413569400000, + y: 118, }, { - 'x': 1413570000000, - 'y': 104 + x: 1413570000000, + y: 104, }, { - 'x': 1413570600000, - 'y': 80 + x: 1413570600000, + y: 80, }, { - 'x': 1413571200000, - 'y': 79 + x: 1413571200000, + y: 79, }, { - 'x': 1413571800000, - 'y': 86 + x: 1413571800000, + y: 86, }, { - 'x': 1413572400000, - 'y': 47 + x: 1413572400000, + y: 47, }, { - 'x': 1413573600000, - 'y': 49 + x: 1413573600000, + y: 49, }, { - 'x': 1413574200000, - 'y': 68 + x: 1413574200000, + y: 68, }, { - 'x': 1413574800000, - 'y': 78 + x: 1413574800000, + y: 78, }, { - 'x': 1413575400000, - 'y': 77 + x: 1413575400000, + y: 77, }, { - 'x': 1413576000000, - 'y': 50 + x: 1413576000000, + y: 50, }, { - 'x': 1413576600000, - 'y': 51 + x: 1413576600000, + y: 51, }, { - 'x': 1413577200000, - 'y': 40 + x: 1413577200000, + y: 40, }, { - 'x': 1413577800000, - 'y': 42 + x: 1413577800000, + y: 42, }, { - 'x': 1413578400000, - 'y': 29 + x: 1413578400000, + y: 29, }, { - 'x': 1413579000000, - 'y': 24 + x: 1413579000000, + y: 24, }, { - 'x': 1413579600000, - 'y': 30 + x: 1413579600000, + y: 30, }, { - 'x': 1413580200000, - 'y': 18 + x: 1413580200000, + y: 18, }, { - 'x': 1413580800000, - 'y': 15 + x: 1413580800000, + y: 15, }, { - 'x': 1413581400000, - 'y': 19 + x: 1413581400000, + y: 19, }, { - 'x': 1413582000000, - 'y': 18 + x: 1413582000000, + y: 18, }, { - 'x': 1413582600000, - 'y': 13 + x: 1413582600000, + y: 13, }, { - 'x': 1413583200000, - 'y': 11 + x: 1413583200000, + y: 11, }, { - 'x': 1413583800000, - 'y': 11 + x: 1413583800000, + y: 11, }, { - 'x': 1413584400000, - 'y': 13 + x: 1413584400000, + y: 13, }, { - 'x': 1413585000000, - 'y': 9 + x: 1413585000000, + y: 9, }, { - 'x': 1413585600000, - 'y': 9 + x: 1413585600000, + y: 9, }, { - 'x': 1413586200000, - 'y': 9 + x: 1413586200000, + y: 9, }, { - 'x': 1413586800000, - 'y': 3 - } - ] + x: 1413586800000, + y: 3, + }, + ], }, { - 'label': 'css', - 'values': [ + label: 'css', + values: [ { - 'x': 1413543600000, - 'y': 35 + x: 1413543600000, + y: 35, }, { - 'x': 1413544200000, - 'y': 360 + x: 1413544200000, + y: 360, }, { - 'x': 1413544800000, - 'y': 343 + x: 1413544800000, + y: 343, }, { - 'x': 1413545400000, - 'y': 329 + x: 1413545400000, + y: 329, }, { - 'x': 1413546000000, - 'y': 345 + x: 1413546000000, + y: 345, }, { - 'x': 1413546600000, - 'y': 336 + x: 1413546600000, + y: 336, }, { - 'x': 1413547200000, - 'y': 330 + x: 1413547200000, + y: 330, }, { - 'x': 1413547800000, - 'y': 334 + x: 1413547800000, + y: 334, }, { - 'x': 1413548400000, - 'y': 326 + x: 1413548400000, + y: 326, }, { - 'x': 1413549000000, - 'y': 351 + x: 1413549000000, + y: 351, }, { - 'x': 1413549600000, - 'y': 334 + x: 1413549600000, + y: 334, }, { - 'x': 1413550200000, - 'y': 351 + x: 1413550200000, + y: 351, }, { - 'x': 1413550800000, - 'y': 337 + x: 1413550800000, + y: 337, }, { - 'x': 1413551400000, - 'y': 306 + x: 1413551400000, + y: 306, }, { - 'x': 1413552000000, - 'y': 346 + x: 1413552000000, + y: 346, }, { - 'x': 1413552600000, - 'y': 317 + x: 1413552600000, + y: 317, }, { - 'x': 1413553200000, - 'y': 298 + x: 1413553200000, + y: 298, }, { - 'x': 1413553800000, - 'y': 288 + x: 1413553800000, + y: 288, }, { - 'x': 1413554400000, - 'y': 283 + x: 1413554400000, + y: 283, }, { - 'x': 1413555000000, - 'y': 262 + x: 1413555000000, + y: 262, }, { - 'x': 1413555600000, - 'y': 245 + x: 1413555600000, + y: 245, }, { - 'x': 1413556200000, - 'y': 259 + x: 1413556200000, + y: 259, }, { - 'x': 1413556800000, - 'y': 267 + x: 1413556800000, + y: 267, }, { - 'x': 1413557400000, - 'y': 230 + x: 1413557400000, + y: 230, }, { - 'x': 1413558000000, - 'y': 218 + x: 1413558000000, + y: 218, }, { - 'x': 1413558600000, - 'y': 241 + x: 1413558600000, + y: 241, }, { - 'x': 1413559200000, - 'y': 213 + x: 1413559200000, + y: 213, }, { - 'x': 1413559800000, - 'y': 239 + x: 1413559800000, + y: 239, }, { - 'x': 1413560400000, - 'y': 208 + x: 1413560400000, + y: 208, }, { - 'x': 1413561000000, - 'y': 187 + x: 1413561000000, + y: 187, }, { - 'x': 1413561600000, - 'y': 166 + x: 1413561600000, + y: 166, }, { - 'x': 1413562200000, - 'y': 154 + x: 1413562200000, + y: 154, }, { - 'x': 1413562800000, - 'y': 184 + x: 1413562800000, + y: 184, }, { - 'x': 1413563400000, - 'y': 148 + x: 1413563400000, + y: 148, }, { - 'x': 1413564000000, - 'y': 153 + x: 1413564000000, + y: 153, }, { - 'x': 1413564600000, - 'y': 149 + x: 1413564600000, + y: 149, }, { - 'x': 1413565200000, - 'y': 102 + x: 1413565200000, + y: 102, }, { - 'x': 1413565800000, - 'y': 110 + x: 1413565800000, + y: 110, }, { - 'x': 1413566400000, - 'y': 121 + x: 1413566400000, + y: 121, }, { - 'x': 1413567000000, - 'y': 120 + x: 1413567000000, + y: 120, }, { - 'x': 1413567600000, - 'y': 86 + x: 1413567600000, + y: 86, }, { - 'x': 1413568200000, - 'y': 96 + x: 1413568200000, + y: 96, }, { - 'x': 1413568800000, - 'y': 71 + x: 1413568800000, + y: 71, }, { - 'x': 1413569400000, - 'y': 92 + x: 1413569400000, + y: 92, }, { - 'x': 1413570000000, - 'y': 65 + x: 1413570000000, + y: 65, }, { - 'x': 1413570600000, - 'y': 54 + x: 1413570600000, + y: 54, }, { - 'x': 1413571200000, - 'y': 68 + x: 1413571200000, + y: 68, }, { - 'x': 1413571800000, - 'y': 57 + x: 1413571800000, + y: 57, }, { - 'x': 1413572400000, - 'y': 33 + x: 1413572400000, + y: 33, }, { - 'x': 1413573600000, - 'y': 47 + x: 1413573600000, + y: 47, }, { - 'x': 1413574200000, - 'y': 42 + x: 1413574200000, + y: 42, }, { - 'x': 1413574800000, - 'y': 39 + x: 1413574800000, + y: 39, }, { - 'x': 1413575400000, - 'y': 25 + x: 1413575400000, + y: 25, }, { - 'x': 1413576000000, - 'y': 31 + x: 1413576000000, + y: 31, }, { - 'x': 1413576600000, - 'y': 37 + x: 1413576600000, + y: 37, }, { - 'x': 1413577200000, - 'y': 35 + x: 1413577200000, + y: 35, }, { - 'x': 1413577800000, - 'y': 19 + x: 1413577800000, + y: 19, }, { - 'x': 1413578400000, - 'y': 15 + x: 1413578400000, + y: 15, }, { - 'x': 1413579000000, - 'y': 21 + x: 1413579000000, + y: 21, }, { - 'x': 1413579600000, - 'y': 16 + x: 1413579600000, + y: 16, }, { - 'x': 1413580200000, - 'y': 18 + x: 1413580200000, + y: 18, }, { - 'x': 1413580800000, - 'y': 10 + x: 1413580800000, + y: 10, }, { - 'x': 1413581400000, - 'y': 13 + x: 1413581400000, + y: 13, }, { - 'x': 1413582000000, - 'y': 14 + x: 1413582000000, + y: 14, }, { - 'x': 1413582600000, - 'y': 11 + x: 1413582600000, + y: 11, }, { - 'x': 1413583200000, - 'y': 4 + x: 1413583200000, + y: 4, }, { - 'x': 1413583800000, - 'y': 6 + x: 1413583800000, + y: 6, }, { - 'x': 1413584400000, - 'y': 3 + x: 1413584400000, + y: 3, }, { - 'x': 1413585000000, - 'y': 6 + x: 1413585000000, + y: 6, }, { - 'x': 1413585600000, - 'y': 6 + x: 1413585600000, + y: 6, }, { - 'x': 1413586200000, - 'y': 2 + x: 1413586200000, + y: 2, }, { - 'x': 1413586800000, - 'y': 3 - } - ] + x: 1413586800000, + y: 3, + }, + ], }, { - 'label': 'gif', - 'values': [ + label: 'gif', + values: [ { - 'x': 1413543600000, - 'y': 21 + x: 1413543600000, + y: 21, }, { - 'x': 1413544200000, - 'y': 191 + x: 1413544200000, + y: 191, }, { - 'x': 1413544800000, - 'y': 176 + x: 1413544800000, + y: 176, }, { - 'x': 1413545400000, - 'y': 166 + x: 1413545400000, + y: 166, }, { - 'x': 1413546000000, - 'y': 183 + x: 1413546000000, + y: 183, }, { - 'x': 1413546600000, - 'y': 170 + x: 1413546600000, + y: 170, }, { - 'x': 1413547200000, - 'y': 153 + x: 1413547200000, + y: 153, }, { - 'x': 1413547800000, - 'y': 202 + x: 1413547800000, + y: 202, }, { - 'x': 1413548400000, - 'y': 175 + x: 1413548400000, + y: 175, }, { - 'x': 1413549000000, - 'y': 161 + x: 1413549000000, + y: 161, }, { - 'x': 1413549600000, - 'y': 174 + x: 1413549600000, + y: 174, }, { - 'x': 1413550200000, - 'y': 167 + x: 1413550200000, + y: 167, }, { - 'x': 1413550800000, - 'y': 171 + x: 1413550800000, + y: 171, }, { - 'x': 1413551400000, - 'y': 176 + x: 1413551400000, + y: 176, }, { - 'x': 1413552000000, - 'y': 139 + x: 1413552000000, + y: 139, }, { - 'x': 1413552600000, - 'y': 145 + x: 1413552600000, + y: 145, }, { - 'x': 1413553200000, - 'y': 157 + x: 1413553200000, + y: 157, }, { - 'x': 1413553800000, - 'y': 148 + x: 1413553800000, + y: 148, }, { - 'x': 1413554400000, - 'y': 149 + x: 1413554400000, + y: 149, }, { - 'x': 1413555000000, - 'y': 135 + x: 1413555000000, + y: 135, }, { - 'x': 1413555600000, - 'y': 118 + x: 1413555600000, + y: 118, }, { - 'x': 1413556200000, - 'y': 142 + x: 1413556200000, + y: 142, }, { - 'x': 1413556800000, - 'y': 141 + x: 1413556800000, + y: 141, }, { - 'x': 1413557400000, - 'y': 146 + x: 1413557400000, + y: 146, }, { - 'x': 1413558000000, - 'y': 114 + x: 1413558000000, + y: 114, }, { - 'x': 1413558600000, - 'y': 115 + x: 1413558600000, + y: 115, }, { - 'x': 1413559200000, - 'y': 136 + x: 1413559200000, + y: 136, }, { - 'x': 1413559800000, - 'y': 106 + x: 1413559800000, + y: 106, }, { - 'x': 1413560400000, - 'y': 92 + x: 1413560400000, + y: 92, }, { - 'x': 1413561000000, - 'y': 97 + x: 1413561000000, + y: 97, }, { - 'x': 1413561600000, - 'y': 90 + x: 1413561600000, + y: 90, }, { - 'x': 1413562200000, - 'y': 69 + x: 1413562200000, + y: 69, }, { - 'x': 1413562800000, - 'y': 66 + x: 1413562800000, + y: 66, }, { - 'x': 1413563400000, - 'y': 93 + x: 1413563400000, + y: 93, }, { - 'x': 1413564000000, - 'y': 75 + x: 1413564000000, + y: 75, }, { - 'x': 1413564600000, - 'y': 68 + x: 1413564600000, + y: 68, }, { - 'x': 1413565200000, - 'y': 55 + x: 1413565200000, + y: 55, }, { - 'x': 1413565800000, - 'y': 73 + x: 1413565800000, + y: 73, }, { - 'x': 1413566400000, - 'y': 57 + x: 1413566400000, + y: 57, }, { - 'x': 1413567000000, - 'y': 48 + x: 1413567000000, + y: 48, }, { - 'x': 1413567600000, - 'y': 41 + x: 1413567600000, + y: 41, }, { - 'x': 1413568200000, - 'y': 39 + x: 1413568200000, + y: 39, }, { - 'x': 1413568800000, - 'y': 32 + x: 1413568800000, + y: 32, }, { - 'x': 1413569400000, - 'y': 33 + x: 1413569400000, + y: 33, }, { - 'x': 1413570000000, - 'y': 39 + x: 1413570000000, + y: 39, }, { - 'x': 1413570600000, - 'y': 35 + x: 1413570600000, + y: 35, }, { - 'x': 1413571200000, - 'y': 25 + x: 1413571200000, + y: 25, }, { - 'x': 1413571800000, - 'y': 28 + x: 1413571800000, + y: 28, }, { - 'x': 1413572400000, - 'y': 8 + x: 1413572400000, + y: 8, }, { - 'x': 1413573600000, - 'y': 13 + x: 1413573600000, + y: 13, }, { - 'x': 1413574200000, - 'y': 23 + x: 1413574200000, + y: 23, }, { - 'x': 1413574800000, - 'y': 19 + x: 1413574800000, + y: 19, }, { - 'x': 1413575400000, - 'y': 16 + x: 1413575400000, + y: 16, }, { - 'x': 1413576000000, - 'y': 22 + x: 1413576000000, + y: 22, }, { - 'x': 1413576600000, - 'y': 13 + x: 1413576600000, + y: 13, }, { - 'x': 1413577200000, - 'y': 21 + x: 1413577200000, + y: 21, }, { - 'x': 1413577800000, - 'y': 11 + x: 1413577800000, + y: 11, }, { - 'x': 1413578400000, - 'y': 12 + x: 1413578400000, + y: 12, }, { - 'x': 1413579000000, - 'y': 10 + x: 1413579000000, + y: 10, }, { - 'x': 1413579600000, - 'y': 7 + x: 1413579600000, + y: 7, }, { - 'x': 1413580200000, - 'y': 4 + x: 1413580200000, + y: 4, }, { - 'x': 1413580800000, - 'y': 5 + x: 1413580800000, + y: 5, }, { - 'x': 1413581400000, - 'y': 7 + x: 1413581400000, + y: 7, }, { - 'x': 1413582000000, - 'y': 9 + x: 1413582000000, + y: 9, }, { - 'x': 1413582600000, - 'y': 2 + x: 1413582600000, + y: 2, }, { - 'x': 1413583200000, - 'y': 2 + x: 1413583200000, + y: 2, }, { - 'x': 1413583800000, - 'y': 4 + x: 1413583800000, + y: 4, }, { - 'x': 1413584400000, - 'y': 6 + x: 1413584400000, + y: 6, }, { - 'x': 1413585600000, - 'y': 2 + x: 1413585600000, + y: 2, }, { - 'x': 1413586200000, - 'y': 4 + x: 1413586200000, + y: 4, }, { - 'x': 1413586800000, - 'y': 4 - } - ] - } + x: 1413586800000, + y: 4, + }, + ], + }, ], - 'hits': 108970, - 'xAxisOrderedValues': [ + hits: 108970, + xAxisOrderedValues: [ 1413543600000, 1413544200000, 1413544800000, @@ -1548,10 +1567,10 @@ export default { 1413586200000, 1413586800000, ], - 'xAxisFormatter': function (thing) { + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js index 041fad2ed15b9c..8144a996e3424b 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_columns.js @@ -1,112 +1,127 @@ +/* + * 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 default { - 'columns': [ + columns: [ { - 'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 10379 + x: 'css', + y: 10379, }, { - 'x': 'png', - 'y': 6395 - } - ] - } + x: 'png', + y: 6395, + }, + ], + }, ], - 'xAxisOrderedValues': ['css', 'png'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['css', 'png'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: + 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 9253 + x: 'css', + y: 9253, }, { - 'x': 'png', - 'y': 5571 - } - ] - } + x: 'png', + y: 5571, + }, + ], + }, ], - 'xAxisOrderedValues': ['css', 'png'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['css', 'png'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: + 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 7740 + x: 'css', + y: 7740, }, { - 'x': 'png', - 'y': 4697 - } - ] - } + x: 'png', + y: 4697, + }, + ], + }, ], - 'xAxisOrderedValues': ['css', 'png'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['css', 'png'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'hits': 171443 + hits: 171443, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js index cc4f598c7b1b7f..e783246972e4a6 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_rows.js @@ -1,109 +1,122 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'label': '200: response', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '200: response', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 25260 + x: 'css', + y: 25260, }, { - 'x': 'png', - 'y': 15311 - } - ] - } + x: 'png', + y: 15311, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '404: response', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '404: response', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 1352 + x: 'css', + y: 1352, }, { - 'x': 'png', - 'y': 826 - } - ] - } + x: 'png', + y: 826, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '503: response', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '503: response', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 761 + x: 'css', + y: 761, }, { - 'x': 'png', - 'y': 527 - } - ] - } + x: 'png', + y: 527, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'hits': 171443 + hits: 171443, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js index 2a2d14d59b67ea..71ee039f989383 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/filters/_series.js @@ -1,42 +1,59 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': 'filters', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '', + xAxisLabel: 'filters', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'css', - 'y': 27374 + x: 'css', + y: 27374, }, { - 'x': 'html', - 'y': 0 + x: 'html', + y: 0, }, { - 'x': 'png', - 'y': 16663 - } - ] - } + x: 'png', + y: 16663, + }, + ], + }, ], - 'hits': 171454, - 'xAxisOrderedValues': ['css', 'html', 'png'], - 'xAxisFormatter': function (val) { + hits: 171454, + xAxisOrderedValues: ['css', 'html', 'png'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js index d283d793151772..c1044160c0e7a6 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_columns.js @@ -1,3745 +1,2918 @@ +/* + * 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 default { - 'columns': [ - { - 'title': 'Top 2 geo.dest: CN', - 'valueFormatter': _.identity, - 'geoJson': { - 'type': 'FeatureCollection', - 'features': [ - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 22.5 - ] - }, - 'properties': { - 'value': 42, - 'geohash': 's', - 'center': [ - 22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + columns: [ + { + title: 'Top 2 geo.dest: CN', + valueFormatter: _.identity, + geoJson: { + type: 'FeatureCollection', + features: [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 22.5], + }, + properties: { + value: 42, + geohash: 's', + center: [22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 's', - 'value': 's', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 42, - 'value': 42, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - 0 - ], - [ - 45, - 0 - ], - [ - 45, - 45 - ], - [ - 0, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 's', + value: 's', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 42, + value: 42, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 31, - 'geohash': 'd', - 'center': [ - -67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, 0], + [45, 0], + [45, 45], + [0, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 22.5], + }, + properties: { + value: 31, + geohash: 'd', + center: [-67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'd', - 'value': 'd', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 31, - 'value': 31, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - 0 - ], - [ - -45, - 0 - ], - [ - -45, - 45 - ], - [ - -90, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'd', + value: 'd', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 31, + value: 31, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 30, - 'geohash': 'w', - 'center': [ - 112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, 0], + [-45, 0], + [-45, 45], + [-90, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 22.5], + }, + properties: { + value: 30, + geohash: 'w', + center: [112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'w', - 'value': 'w', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 30, - 'value': 30, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - 0 - ], - [ - 135, - 0 - ], - [ - 135, - 45 - ], - [ - 90, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'w', + value: 'w', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 30, + value: 30, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 25, - 'geohash': '9', - 'center': [ - -112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, 0], + [135, 0], + [135, 45], + [90, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 22.5], + }, + properties: { + value: 25, + geohash: '9', + center: [-112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '9', - 'value': '9', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 25, - 'value': 25, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -135, - 0 - ], - [ - -90, - 0 - ], - [ - -90, - 45 - ], - [ - -135, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: '9', + value: '9', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 25, + value: 25, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 22, - 'geohash': 't', - 'center': [ - 67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-135, 0], + [-90, 0], + [-90, 45], + [-135, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 22.5], + }, + properties: { + value: 22, + geohash: 't', + center: [67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 't', - 'value': 't', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 22, - 'value': 22, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - 0 - ], - [ - 90, - 0 - ], - [ - 90, - 45 - ], - [ - 45, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 't', + value: 't', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 22, + value: 22, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 22, - 'geohash': 'k', - 'center': [ - 22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, 0], + [90, 0], + [90, 45], + [45, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -22.5], + }, + properties: { + value: 22, + geohash: 'k', + center: [22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'k', - 'value': 'k', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 22, - 'value': 22, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - -45 - ], - [ - 45, - -45 - ], - [ - 45, - 0 - ], - [ - 0, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'k', + value: 'k', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 22, + value: 22, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 21, - 'geohash': '6', - 'center': [ - -67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, -45], + [45, -45], + [45, 0], + [0, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -22.5], + }, + properties: { + value: 21, + geohash: '6', + center: [-67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '6', - 'value': '6', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 21, - 'value': 21, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - -45 - ], - [ - -45, - -45 - ], - [ - -45, - 0 - ], - [ - -90, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: '6', + value: '6', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 21, + value: 21, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 19, - 'geohash': 'u', - 'center': [ - 22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, -45], + [-45, -45], + [-45, 0], + [-90, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 67.5], + }, + properties: { + value: 19, + geohash: 'u', + center: [22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'u', - 'value': 'u', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 19, - 'value': 19, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - 45 - ], - [ - 45, - 45 - ], - [ - 45, - 90 - ], - [ - 0, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'u', + value: 'u', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 19, + value: 19, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 18, - 'geohash': 'v', - 'center': [ - 67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, 45], + [45, 45], + [45, 90], + [0, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 67.5], + }, + properties: { + value: 18, + geohash: 'v', + center: [67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'v', - 'value': 'v', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 18, - 'value': 18, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - 45 - ], - [ - 90, - 45 - ], - [ - 90, - 90 - ], - [ - 45, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'v', + value: 'v', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 18, + value: 18, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 11, - 'geohash': 'c', - 'center': [ - -112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, 45], + [90, 45], + [90, 90], + [45, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 67.5], + }, + properties: { + value: 11, + geohash: 'c', + center: [-112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'c', - 'value': 'c', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 11, - 'value': 11, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -135, - 45 - ], - [ - -90, - 45 - ], - [ - -90, - 90 - ], - [ - -135, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'c', + value: 'c', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 11, + value: 11, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 10, - 'geohash': 'r', - 'center': [ - 157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-135, 45], + [-90, 45], + [-90, 90], + [-135, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -22.5], + }, + properties: { + value: 10, + geohash: 'r', + center: [157.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'r', - 'value': 'r', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 10, - 'value': 10, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - -45 - ], - [ - 180, - -45 - ], - [ - 180, - 0 - ], - [ - 135, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'r', + value: 'r', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 10, + value: 10, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 9, - 'geohash': 'y', - 'center': [ - 112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, -45], + [180, -45], + [180, 0], + [135, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 67.5], + }, + properties: { + value: 9, + geohash: 'y', + center: [112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'y', - 'value': 'y', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 9, - 'value': 9, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - 45 - ], - [ - 135, - 45 - ], - [ - 135, - 90 - ], - [ - 90, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'y', + value: 'y', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 9, + value: 9, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 9, - 'geohash': 'e', - 'center': [ - -22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, 45], + [135, 45], + [135, 90], + [90, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 22.5], + }, + properties: { + value: 9, + geohash: 'e', + center: [-22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'e', - 'value': 'e', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 9, - 'value': 9, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 45 - ], - [ - -45, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'e', + value: 'e', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 9, + value: 9, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 8, - 'geohash': 'f', - 'center': [ - -67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, 0], + [0, 0], + [0, 45], + [-45, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 67.5], + }, + properties: { + value: 8, + geohash: 'f', + center: [-67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'f', - 'value': 'f', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 8, - 'value': 8, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - 45 - ], - [ - -45, - 45 - ], - [ - -45, - 90 - ], - [ - -90, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'f', + value: 'f', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 8, + value: 8, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 8, - 'geohash': '7', - 'center': [ - -22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, 45], + [-45, 45], + [-45, 90], + [-90, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -22.5], + }, + properties: { + value: 8, + geohash: '7', + center: [-22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '7', - 'value': '7', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 8, - 'value': 8, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - -45 - ], - [ - 0, - -45 - ], - [ - 0, - 0 - ], - [ - -45, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: '7', + value: '7', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 8, + value: 8, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 6, - 'geohash': 'q', - 'center': [ - 112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, -45], + [0, -45], + [0, 0], + [-45, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -22.5], + }, + properties: { + value: 6, + geohash: 'q', + center: [112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'q', - 'value': 'q', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - -45 - ], - [ - 135, - -45 - ], - [ - 135, - 0 - ], - [ - 90, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'q', + value: 'q', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 6, - 'geohash': 'g', - 'center': [ - -22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, -45], + [135, -45], + [135, 0], + [90, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 67.5], + }, + properties: { + value: 6, + geohash: 'g', + center: [-22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'g', - 'value': 'g', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - 45 - ], - [ - 0, - 45 - ], - [ - 0, - 90 - ], - [ - -45, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'g', + value: 'g', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 4, - 'geohash': 'x', - 'center': [ - 157.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, 45], + [0, 45], + [0, 90], + [-45, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 22.5], + }, + properties: { + value: 4, + geohash: 'x', + center: [157.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'x', - 'value': 'x', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 4, - 'value': 4, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - 0 - ], - [ - 180, - 0 - ], - [ - 180, - 45 - ], - [ - 135, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'x', + value: 'x', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 4, + value: 4, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 3, - 'geohash': 'b', - 'center': [ - -157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, 0], + [180, 0], + [180, 45], + [135, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, 67.5], + }, + properties: { + value: 3, + geohash: 'b', + center: [-157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'b', - 'value': 'b', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 3, - 'value': 3, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -180, - 45 - ], - [ - -135, - 45 - ], - [ - -135, - 90 - ], - [ - -180, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'b', + value: 'b', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 3, + value: 3, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 2, - 'geohash': 'z', - 'center': [ - 157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-180, 45], + [-135, 45], + [-135, 90], + [-180, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 67.5], + }, + properties: { + value: 2, + geohash: 'z', + center: [157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'z', - 'value': 'z', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - 45 - ], - [ - 180, - 45 - ], - [ - 180, - 90 - ], - [ - 135, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'z', + value: 'z', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': 'm', - 'center': [ - 67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, 45], + [180, 45], + [180, 90], + [135, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, -22.5], + }, + properties: { + value: 1, + geohash: 'm', + center: [67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'm', - 'value': 'm', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - -45 - ], - [ - 90, - -45 - ], - [ - 90, - 0 - ], - [ - 45, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -67.5 - ] + }, + type: 'bucket', + }, + key: 'm', + value: 'm', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': '5', - 'center': [ - -22.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, -45], + [90, -45], + [90, 0], + [45, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -67.5], + }, + properties: { + value: 1, + geohash: '5', + center: [-22.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '5', - 'value': '5', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - -90 - ], - [ - 0, - -90 - ], - [ - 0, - -45 - ], - [ - -45, - -45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -67.5 - ] + }, + type: 'bucket', + }, + key: '5', + value: '5', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': '4', - 'center': [ - -67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, -90], + [0, -90], + [0, -45], + [-45, -45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -67.5], + }, + properties: { + value: 1, + geohash: '4', + center: [-67.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '4', - 'value': '4', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - -90 - ], - [ - -45, - -90 - ], - [ - -45, - -45 - ], - [ - -90, - -45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: '4', + value: '4', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': '3', - 'center': [ - -112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, -90], + [-45, -90], + [-45, -45], + [-90, -45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, -22.5], + }, + properties: { + value: 1, + geohash: '3', + center: [-112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '3', - 'value': '3', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -135, - -45 - ], - [ - -90, - -45 - ], - [ - -90, - 0 - ], - [ - -135, - 0 - ] - ] - } - } - ], - 'properties': { - 'min': 1, - 'max': 42 - } - } - }, - { - 'label': 'Top 2 geo.dest: IN', - 'valueFormatter': _.identity, - 'geoJson': { - 'type': 'FeatureCollection', - 'features': [ - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: '3', + value: '3', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 32, - 'geohash': 's', - 'center': [ - 22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-135, -45], + [-90, -45], + [-90, 0], + [-135, 0], + ], + }, + }, + ], + properties: { + min: 1, + max: 42, + }, + }, + }, + { + label: 'Top 2 geo.dest: IN', + valueFormatter: _.identity, + geoJson: { + type: 'FeatureCollection', + features: [ + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 22.5], + }, + properties: { + value: 32, + geohash: 's', + center: [22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 's', - 'value': 's', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 32, - 'value': 32, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - 0 - ], - [ - 45, - 0 - ], - [ - 45, - 45 - ], - [ - 0, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 's', + value: 's', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 32, + value: 32, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 31, - 'geohash': '6', - 'center': [ - -67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, 0], + [45, 0], + [45, 45], + [0, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -22.5], + }, + properties: { + value: 31, + geohash: '6', + center: [-67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '6', - 'value': '6', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 31, - 'value': 31, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - -45 - ], - [ - -45, - -45 - ], - [ - -45, - 0 - ], - [ - -90, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: '6', + value: '6', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 31, + value: 31, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 28, - 'geohash': 'd', - 'center': [ - -67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, -45], + [-45, -45], + [-45, 0], + [-90, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 22.5], + }, + properties: { + value: 28, + geohash: 'd', + center: [-67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'd', - 'value': 'd', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 28, - 'value': 28, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - 0 - ], - [ - -45, - 0 - ], - [ - -45, - 45 - ], - [ - -90, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'd', + value: 'd', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 28, + value: 28, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 27, - 'geohash': 'w', - 'center': [ - 112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, 0], + [-45, 0], + [-45, 45], + [-90, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 22.5], + }, + properties: { + value: 27, + geohash: 'w', + center: [112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'w', - 'value': 'w', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 27, - 'value': 27, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - 0 - ], - [ - 135, - 0 - ], - [ - 135, - 45 - ], - [ - 90, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'w', + value: 'w', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 27, + value: 27, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 24, - 'geohash': 't', - 'center': [ - 67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, 0], + [135, 0], + [135, 45], + [90, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 22.5], + }, + properties: { + value: 24, + geohash: 't', + center: [67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 't', - 'value': 't', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 24, - 'value': 24, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - 0 - ], - [ - 90, - 0 - ], - [ - 90, - 45 - ], - [ - 45, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 't', + value: 't', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 24, + value: 24, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 23, - 'geohash': 'k', - 'center': [ - 22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, 0], + [90, 0], + [90, 45], + [45, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -22.5], + }, + properties: { + value: 23, + geohash: 'k', + center: [22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'k', - 'value': 'k', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 23, - 'value': 23, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - -45 - ], - [ - 45, - -45 - ], - [ - 45, - 0 - ], - [ - 0, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'k', + value: 'k', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 23, + value: 23, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 17, - 'geohash': 'u', - 'center': [ - 22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, -45], + [45, -45], + [45, 0], + [0, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 67.5], + }, + properties: { + value: 17, + geohash: 'u', + center: [22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'u', - 'value': 'u', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 17, - 'value': 17, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 0, - 45 - ], - [ - 45, - 45 - ], - [ - 45, - 90 - ], - [ - 0, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'u', + value: 'u', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 17, + value: 17, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 16, - 'geohash': '9', - 'center': [ - -112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [0, 45], + [45, 45], + [45, 90], + [0, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 22.5], + }, + properties: { + value: 16, + geohash: '9', + center: [-112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '9', - 'value': '9', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 16, - 'value': 16, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -135, - 0 - ], - [ - -90, - 0 - ], - [ - -90, - 45 - ], - [ - -135, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: '9', + value: '9', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 16, + value: 16, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 14, - 'geohash': 'v', - 'center': [ - 67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-135, 0], + [-90, 0], + [-90, 45], + [-135, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 67.5], + }, + properties: { + value: 14, + geohash: 'v', + center: [67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'v', - 'value': 'v', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 14, - 'value': 14, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - 45 - ], - [ - 90, - 45 - ], - [ - 90, - 90 - ], - [ - 45, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'v', + value: 'v', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 14, + value: 14, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 13, - 'geohash': 'e', - 'center': [ - -22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, 45], + [90, 45], + [90, 90], + [45, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 22.5], + }, + properties: { + value: 13, + geohash: 'e', + center: [-22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'e', - 'value': 'e', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 13, - 'value': 13, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 45 - ], - [ - -45, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'e', + value: 'e', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 13, + value: 13, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 9, - 'geohash': 'r', - 'center': [ - 157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, 0], + [0, 0], + [0, 45], + [-45, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -22.5], + }, + properties: { + value: 9, + geohash: 'r', + center: [157.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'r', - 'value': 'r', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 9, - 'value': 9, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - -45 - ], - [ - 180, - -45 - ], - [ - 180, - 0 - ], - [ - 135, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'r', + value: 'r', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 9, + value: 9, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 6, - 'geohash': 'y', - 'center': [ - 112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, -45], + [180, -45], + [180, 0], + [135, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 67.5], + }, + properties: { + value: 6, + geohash: 'y', + center: [112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'y', - 'value': 'y', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - 45 - ], - [ - 135, - 45 - ], - [ - 135, - 90 - ], - [ - 90, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'y', + value: 'y', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 6, - 'geohash': 'g', - 'center': [ - -22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, 45], + [135, 45], + [135, 90], + [90, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 67.5], + }, + properties: { + value: 6, + geohash: 'g', + center: [-22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'g', - 'value': 'g', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - 45 - ], - [ - 0, - 45 - ], - [ - 0, - 90 - ], - [ - -45, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'g', + value: 'g', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 6, - 'geohash': 'f', - 'center': [ - -67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-45, 45], + [0, 45], + [0, 90], + [-45, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 67.5], + }, + properties: { + value: 6, + geohash: 'f', + center: [-67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'f', - 'value': 'f', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - 45 - ], - [ - -45, - 45 - ], - [ - -45, - 90 - ], - [ - -90, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'f', + value: 'f', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 5, - 'geohash': 'c', - 'center': [ - -112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, 45], + [-45, 45], + [-45, 90], + [-90, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 67.5], + }, + properties: { + value: 5, + geohash: 'c', + center: [-112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'c', - 'value': 'c', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 5, - 'value': 5, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -135, - 45 - ], - [ - -90, - 45 - ], - [ - -90, - 90 - ], - [ - -135, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: 'c', + value: 'c', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 5, + value: 5, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 4, - 'geohash': 'b', - 'center': [ - -157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-135, 45], + [-90, 45], + [-90, 90], + [-135, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, 67.5], + }, + properties: { + value: 4, + geohash: 'b', + center: [-157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'b', - 'value': 'b', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 4, - 'value': 4, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -180, - 45 - ], - [ - -135, - 45 - ], - [ - -135, - 90 - ], - [ - -180, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'b', + value: 'b', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 4, + value: 4, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 3, - 'geohash': 'q', - 'center': [ - 112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-180, 45], + [-135, 45], + [-135, 90], + [-180, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -22.5], + }, + properties: { + value: 3, + geohash: 'q', + center: [112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'q', - 'value': 'q', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 3, - 'value': 3, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 90, - -45 - ], - [ - 135, - -45 - ], - [ - 135, - 0 - ], - [ - 90, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -67.5 - ] + }, + type: 'bucket', + }, + key: 'q', + value: 'q', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 3, + value: 3, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 2, - 'geohash': '4', - 'center': [ - -67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [90, -45], + [135, -45], + [135, 0], + [90, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -67.5], + }, + properties: { + value: 2, + geohash: '4', + center: [-67.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '4', - 'value': '4', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -90, - -90 - ], - [ - -45, - -90 - ], - [ - -45, - -45 - ], - [ - -90, - -45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 67.5 - ] + }, + type: 'bucket', + }, + key: '4', + value: '4', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': 'z', - 'center': [ - 157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [-90, -90], + [-45, -90], + [-45, -45], + [-90, -45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 67.5], + }, + properties: { + value: 1, + geohash: 'z', + center: [157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'z', - 'value': 'z', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - 45 - ], - [ - 180, - 45 - ], - [ - 180, - 90 - ], - [ - 135, - 90 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 22.5 - ] + }, + type: 'bucket', + }, + key: 'z', + value: 'z', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': 'x', - 'center': [ - 157.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, 45], + [180, 45], + [180, 90], + [135, 90], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 22.5], + }, + properties: { + value: 1, + geohash: 'x', + center: [157.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'x', - 'value': 'x', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - 0 - ], - [ - 180, - 0 - ], - [ - 180, - 45 - ], - [ - 135, - 45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -67.5 - ] + }, + type: 'bucket', + }, + key: 'x', + value: 'x', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': 'p', - 'center': [ - 157.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, 0], + [180, 0], + [180, 45], + [135, 45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -67.5], + }, + properties: { + value: 1, + geohash: 'p', + center: [157.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'p', - 'value': 'p', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 135, - -90 - ], - [ - 180, - -90 - ], - [ - 180, - -45 - ], - [ - 135, - -45 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'p', + value: 'p', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': 'm', - 'center': [ - 67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [135, -90], + [180, -90], + [180, -45], + [135, -45], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, -22.5], + }, + properties: { + value: 1, + geohash: 'm', + center: [67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': 'm', - 'value': 'm', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - 45, - -45 - ], - [ - 90, - -45 - ], - [ - 90, - 0 - ], - [ - 45, - 0 - ] - ] - } - }, - { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -22.5 - ] + }, + type: 'bucket', + }, + key: 'm', + value: 'm', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'properties': { - 'value': 1, - 'geohash': '7', - 'center': [ - -22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': false - } + rectangle: [ + [45, -45], + [90, -45], + [90, 0], + [45, 0], + ], + }, + }, + { + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -22.5], + }, + properties: { + value: 1, + geohash: '7', + center: [-22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: false, }, - 'type': 'bucket' - }, - 'key': '7', - 'value': '7', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' - }, - 'rectangle': [ - [ - -45, - -45 - ], - [ - 0, - -45 - ], - [ - 0, - 0 - ], - [ - -45, - 0 - ] - ] - } - } - ], - 'properties': { - 'min': 1, - 'max': 32 - } - } - } - ] + }, + type: 'bucket', + }, + key: '7', + value: '7', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', + }, + rectangle: [ + [-45, -45], + [0, -45], + [0, 0], + [-45, 0], + ], + }, + }, + ], + properties: { + min: 1, + max: 32, + }, + }, + }, + ], }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js index 4e65502f8d2788..a26dc9bd8b181c 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_geo_json.js @@ -1,1847 +1,1326 @@ +/* + * 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 default { - 'valueFormatter': _.identity, - 'geohashGridAgg': { 'vis': { 'params': {} } }, - 'geoJson': { - 'type': 'FeatureCollection', - 'features': [ + valueFormatter: _.identity, + geohashGridAgg: { vis: { params: {} } }, + geoJson: { + type: 'FeatureCollection', + features: [ { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 22.5], }, - 'properties': { - 'value': 608, - 'geohash': 's', - 'center': [ - 22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 's', - 'value': 's', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 608, + geohash: 's', + center: [22.5, 22.5], + aggConfigResult: { + $parent: { + key: 's', + value: 's', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 608, - 'value': 608, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 608, + value: 608, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - 0 - ], - [ - 0, - 45 - ], - [ - 45, - 45 - ], - [ - 45, - 0 - ] - ] - } + rectangle: [ + [0, 0], + [0, 45], + [45, 45], + [45, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 22.5], }, - 'properties': { - 'value': 522, - 'geohash': 'w', - 'center': [ - 112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'w', - 'value': 'w', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 522, + geohash: 'w', + center: [112.5, 22.5], + aggConfigResult: { + $parent: { + key: 'w', + value: 'w', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 522, - 'value': 522, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 522, + value: 522, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - 90 - ], - [ - 0, - 135 - ], - [ - 45, - 135 - ], - [ - 45, - 90 - ] - ] - } + rectangle: [ + [0, 90], + [0, 135], + [45, 135], + [45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -22.5], }, - 'properties': { - 'value': 517, - 'geohash': '6', - 'center': [ - -67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '6', - 'value': '6', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 517, + geohash: '6', + center: [-67.5, -22.5], + aggConfigResult: { + $parent: { + key: '6', + value: '6', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 517, - 'value': 517, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 517, + value: 517, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - -90 - ], - [ - -45, - -45 - ], - [ - 0, - -45 - ], - [ - 0, - -90 - ] - ] - } + rectangle: [ + [-45, -90], + [-45, -45], + [0, -45], + [0, -90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 22.5], }, - 'properties': { - 'value': 446, - 'geohash': 'd', - 'center': [ - -67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'd', - 'value': 'd', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 446, + geohash: 'd', + center: [-67.5, 22.5], + aggConfigResult: { + $parent: { + key: 'd', + value: 'd', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 446, - 'value': 446, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 446, + value: 446, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - -90 - ], - [ - 0, - -45 - ], - [ - 45, - -45 - ], - [ - 45, - -90 - ] - ] - } + rectangle: [ + [0, -90], + [0, -45], + [45, -45], + [45, -90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 67.5], }, - 'properties': { - 'value': 426, - 'geohash': 'u', - 'center': [ - 22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'u', - 'value': 'u', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 426, + geohash: 'u', + center: [22.5, 67.5], + aggConfigResult: { + $parent: { + key: 'u', + value: 'u', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 426, - 'value': 426, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 426, + value: 426, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - 0 - ], - [ - 45, - 45 - ], - [ - 90, - 45 - ], - [ - 90, - 0 - ] - ] - } + rectangle: [ + [45, 0], + [45, 45], + [90, 45], + [90, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 22.5], }, - 'properties': { - 'value': 413, - 'geohash': 't', - 'center': [ - 67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 't', - 'value': 't', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 413, + geohash: 't', + center: [67.5, 22.5], + aggConfigResult: { + $parent: { + key: 't', + value: 't', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 413, - 'value': 413, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 413, + value: 413, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - 45 - ], - [ - 0, - 90 - ], - [ - 45, - 90 - ], - [ - 45, - 45 - ] - ] - } + rectangle: [ + [0, 45], + [0, 90], + [45, 90], + [45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -22.5], }, - 'properties': { - 'value': 362, - 'geohash': 'k', - 'center': [ - 22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'k', - 'value': 'k', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 362, + geohash: 'k', + center: [22.5, -22.5], + aggConfigResult: { + $parent: { + key: 'k', + value: 'k', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 362, - 'value': 362, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 362, + value: 362, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - 0 - ], - [ - -45, - 45 - ], - [ - 0, - 45 - ], - [ - 0, - 0 - ] - ] - } + rectangle: [ + [-45, 0], + [-45, 45], + [0, 45], + [0, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 22.5], }, - 'properties': { - 'value': 352, - 'geohash': '9', - 'center': [ - -112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '9', - 'value': '9', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 352, + geohash: '9', + center: [-112.5, 22.5], + aggConfigResult: { + $parent: { + key: '9', + value: '9', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 352, - 'value': 352, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 352, + value: 352, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - -135 - ], - [ - 0, - -90 - ], - [ - 45, - -90 - ], - [ - 45, - -135 - ] - ] - } + rectangle: [ + [0, -135], + [0, -90], + [45, -90], + [45, -135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 22.5], }, - 'properties': { - 'value': 216, - 'geohash': 'e', - 'center': [ - -22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'e', - 'value': 'e', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 216, + geohash: 'e', + center: [-22.5, 22.5], + aggConfigResult: { + $parent: { + key: 'e', + value: 'e', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 216, - 'value': 216, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 216, + value: 216, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - -45 - ], - [ - 0, - 0 - ], - [ - 45, - 0 - ], - [ - 45, - -45 - ] - ] - } + rectangle: [ + [0, -45], + [0, 0], + [45, 0], + [45, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 67.5], }, - 'properties': { - 'value': 183, - 'geohash': 'v', - 'center': [ - 67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'v', - 'value': 'v', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 183, + geohash: 'v', + center: [67.5, 67.5], + aggConfigResult: { + $parent: { + key: 'v', + value: 'v', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 183, - 'value': 183, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 183, + value: 183, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - 45 - ], - [ - 45, - 90 - ], - [ - 90, - 90 - ], - [ - 90, - 45 - ] - ] - } + rectangle: [ + [45, 45], + [45, 90], + [90, 90], + [90, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -22.5], }, - 'properties': { - 'value': 158, - 'geohash': 'r', - 'center': [ - 157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'r', - 'value': 'r', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 158, + geohash: 'r', + center: [157.5, -22.5], + aggConfigResult: { + $parent: { + key: 'r', + value: 'r', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 158, - 'value': 158, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 158, + value: 158, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - 135 - ], - [ - -45, - 180 - ], - [ - 0, - 180 - ], - [ - 0, - 135 - ] - ] - } + rectangle: [ + [-45, 135], + [-45, 180], + [0, 180], + [0, 135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 67.5], }, - 'properties': { - 'value': 139, - 'geohash': 'y', - 'center': [ - 112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'y', - 'value': 'y', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 139, + geohash: 'y', + center: [112.5, 67.5], + aggConfigResult: { + $parent: { + key: 'y', + value: 'y', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 139, - 'value': 139, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 139, + value: 139, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - 90 - ], - [ - 45, - 135 - ], - [ - 90, - 135 - ], - [ - 90, - 90 - ] - ] - } + rectangle: [ + [45, 90], + [45, 135], + [90, 135], + [90, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 67.5], }, - 'properties': { - 'value': 110, - 'geohash': 'c', - 'center': [ - -112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'c', - 'value': 'c', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 110, + geohash: 'c', + center: [-112.5, 67.5], + aggConfigResult: { + $parent: { + key: 'c', + value: 'c', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 110, - 'value': 110, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 110, + value: 110, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - -135 - ], - [ - 45, - -90 - ], - [ - 90, - -90 - ], - [ - 90, - -135 - ] - ] - } + rectangle: [ + [45, -135], + [45, -90], + [90, -90], + [90, -135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -22.5], }, - 'properties': { - 'value': 101, - 'geohash': 'q', - 'center': [ - 112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'q', - 'value': 'q', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 101, + geohash: 'q', + center: [112.5, -22.5], + aggConfigResult: { + $parent: { + key: 'q', + value: 'q', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 101, - 'value': 101, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 101, + value: 101, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - 90 - ], - [ - -45, - 135 - ], - [ - 0, - 135 - ], - [ - 0, - 90 - ] - ] - } + rectangle: [ + [-45, 90], + [-45, 135], + [0, 135], + [0, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -22.5], }, - 'properties': { - 'value': 101, - 'geohash': '7', - 'center': [ - -22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '7', - 'value': '7', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 101, + geohash: '7', + center: [-22.5, -22.5], + aggConfigResult: { + $parent: { + key: '7', + value: '7', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 101, - 'value': 101, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 101, + value: 101, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - -45 - ], - [ - -45, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - -45 - ] - ] - } + rectangle: [ + [-45, -45], + [-45, 0], + [0, 0], + [0, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 67.5], }, - 'properties': { - 'value': 92, - 'geohash': 'f', - 'center': [ - -67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'f', - 'value': 'f', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 92, + geohash: 'f', + center: [-67.5, 67.5], + aggConfigResult: { + $parent: { + key: 'f', + value: 'f', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 92, - 'value': 92, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 92, + value: 92, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - -90 - ], - [ - 45, - -45 - ], - [ - 90, - -45 - ], - [ - 90, - -90 - ] - ] - } + rectangle: [ + [45, -90], + [45, -45], + [90, -45], + [90, -90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, 67.5], }, - 'properties': { - 'value': 75, - 'geohash': 'b', - 'center': [ - -157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'b', - 'value': 'b', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 75, + geohash: 'b', + center: [-157.5, 67.5], + aggConfigResult: { + $parent: { + key: 'b', + value: 'b', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 75, - 'value': 75, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 75, + value: 75, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - -180 - ], - [ - 45, - -135 - ], - [ - 90, - -135 - ], - [ - 90, - -180 - ] - ] - } + rectangle: [ + [45, -180], + [45, -135], + [90, -135], + [90, -180], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 67.5], }, - 'properties': { - 'value': 64, - 'geohash': 'g', - 'center': [ - -22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'g', - 'value': 'g', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 64, + geohash: 'g', + center: [-22.5, 67.5], + aggConfigResult: { + $parent: { + key: 'g', + value: 'g', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 64, - 'value': 64, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 64, + value: 64, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - -45 - ], - [ - 45, - 0 - ], - [ - 90, - 0 - ], - [ - 90, - -45 - ] - ] - } + rectangle: [ + [45, -45], + [45, 0], + [90, 0], + [90, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 67.5], }, - 'properties': { - 'value': 36, - 'geohash': 'z', - 'center': [ - 157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'z', - 'value': 'z', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 36, + geohash: 'z', + center: [157.5, 67.5], + aggConfigResult: { + $parent: { + key: 'z', + value: 'z', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 36, - 'value': 36, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 36, + value: 36, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 45, - 135 - ], - [ - 45, - 180 - ], - [ - 90, - 180 - ], - [ - 90, - 135 - ] - ] - } + rectangle: [ + [45, 135], + [45, 180], + [90, 180], + [90, 135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 22.5], }, - 'properties': { - 'value': 34, - 'geohash': 'x', - 'center': [ - 157.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'x', - 'value': 'x', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 34, + geohash: 'x', + center: [157.5, 22.5], + aggConfigResult: { + $parent: { + key: 'x', + value: 'x', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 34, - 'value': 34, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 34, + value: 34, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - 0, - 135 - ], - [ - 0, - 180 - ], - [ - 45, - 180 - ], - [ - 45, - 135 - ] - ] - } + rectangle: [ + [0, 135], + [0, 180], + [45, 180], + [45, 135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -67.5], }, - 'properties': { - 'value': 30, - 'geohash': '4', - 'center': [ - -67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '4', - 'value': '4', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 30, + geohash: '4', + center: [-67.5, -67.5], + aggConfigResult: { + $parent: { + key: '4', + value: '4', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 30, - 'value': 30, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 30, + value: 30, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - -90 - ], - [ - -90, - -45 - ], - [ - -45, - -45 - ], - [ - -45, - -90 - ] - ] - } + rectangle: [ + [-90, -90], + [-90, -45], + [-45, -45], + [-45, -90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, -22.5], }, - 'properties': { - 'value': 16, - 'geohash': 'm', - 'center': [ - 67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'm', - 'value': 'm', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 16, + geohash: 'm', + center: [67.5, -22.5], + aggConfigResult: { + $parent: { + key: 'm', + value: 'm', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 16, - 'value': 16, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 16, + value: 16, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - 45 - ], - [ - -45, - 90 - ], - [ - 0, - 90 - ], - [ - 0, - 45 - ] - ] - } + rectangle: [ + [-45, 45], + [-45, 90], + [0, 90], + [0, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -67.5], }, - 'properties': { - 'value': 10, - 'geohash': '5', - 'center': [ - -22.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '5', - 'value': '5', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 10, + geohash: '5', + center: [-22.5, -67.5], + aggConfigResult: { + $parent: { + key: '5', + value: '5', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 10, - 'value': 10, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 10, + value: 10, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - -45 - ], - [ - -90, - 0 - ], - [ - -45, - 0 - ], - [ - -45, - -45 - ] - ] - } + rectangle: [ + [-90, -45], + [-90, 0], + [-45, 0], + [-45, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -67.5], }, - 'properties': { - 'value': 6, - 'geohash': 'p', - 'center': [ - 157.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'p', - 'value': 'p', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 6, + geohash: 'p', + center: [157.5, -67.5], + aggConfigResult: { + $parent: { + key: 'p', + value: 'p', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - 135 - ], - [ - -90, - 180 - ], - [ - -45, - 180 - ], - [ - -45, - 135 - ] - ] - } + rectangle: [ + [-90, 135], + [-90, 180], + [-45, 180], + [-45, 135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, -22.5], }, - 'properties': { - 'value': 6, - 'geohash': '2', - 'center': [ - -157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '2', - 'value': '2', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 6, + geohash: '2', + center: [-157.5, -22.5], + aggConfigResult: { + $parent: { + key: '2', + value: '2', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - -180 - ], - [ - -45, - -135 - ], - [ - 0, - -135 - ], - [ - 0, - -180 - ] - ] - } + rectangle: [ + [-45, -180], + [-45, -135], + [0, -135], + [0, -180], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -67.5], }, - 'properties': { - 'value': 4, - 'geohash': 'h', - 'center': [ - 22.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'h', - 'value': 'h', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 4, + geohash: 'h', + center: [22.5, -67.5], + aggConfigResult: { + $parent: { + key: 'h', + value: 'h', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 4, - 'value': 4, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 4, + value: 4, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - 0 - ], - [ - -90, - 45 - ], - [ - -45, - 45 - ], - [ - -45, - 0 - ] - ] - } + rectangle: [ + [-90, 0], + [-90, 45], + [-45, 45], + [-45, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -67.5], }, - 'properties': { - 'value': 2, - 'geohash': 'n', - 'center': [ - 112.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'n', - 'value': 'n', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 2, + geohash: 'n', + center: [112.5, -67.5], + aggConfigResult: { + $parent: { + key: 'n', + value: 'n', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - 90 - ], - [ - -90, - 135 - ], - [ - -45, - 135 - ], - [ - -45, - 90 - ] - ] - } + rectangle: [ + [-90, 90], + [-90, 135], + [-45, 135], + [-45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, -67.5], }, - 'properties': { - 'value': 2, - 'geohash': 'j', - 'center': [ - 67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': 'j', - 'value': 'j', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 2, + geohash: 'j', + center: [67.5, -67.5], + aggConfigResult: { + $parent: { + key: 'j', + value: 'j', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - 45 - ], - [ - -90, - 90 - ], - [ - -45, - 90 - ], - [ - -45, - 45 - ] - ] - } + rectangle: [ + [-90, 45], + [-90, 90], + [-45, 90], + [-45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - -22.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, -22.5], }, - 'properties': { - 'value': 1, - 'geohash': '3', - 'center': [ - -112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '3', - 'value': '3', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 1, + geohash: '3', + center: [-112.5, -22.5], + aggConfigResult: { + $parent: { + key: '3', + value: '3', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -45, - -135 - ], - [ - -45, - -90 - ], - [ - 0, - -90 - ], - [ - 0, - -135 - ] - ] - } + rectangle: [ + [-45, -135], + [-45, -90], + [0, -90], + [0, -135], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - -67.5 - ] + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, -67.5], }, - 'properties': { - 'value': 1, - 'geohash': '1', - 'center': [ - -112.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - 'key': '1', - 'value': '1', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } + properties: { + value: 1, + geohash: '1', + center: [-112.5, -67.5], + aggConfigResult: { + $parent: { + key: '1', + value: '1', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, }, - 'type': 'bucket' + type: 'bucket', }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, }, - 'type': 'metric' + type: 'metric', }, - 'rectangle': [ - [ - -90, - -135 - ], - [ - -90, - -90 - ], - [ - -45, - -90 - ], - [ - -45, - -135 - ] - ] - } - } + rectangle: [ + [-90, -135], + [-90, -90], + [-45, -90], + [-45, -135], + ], + }, + }, ], - 'properties': { - 'min': 1, - 'max': 608, - 'zoom': 2, - 'center': [5, 15] - } + properties: { + min: 1, + max: 608, + zoom: 2, + center: [5, 15], + }, }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js index 64deea0e391a6e..ca4cb2a7feee1f 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/geohash/_rows.js @@ -1,3667 +1,2858 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'title': 'Top 2 geo.dest: CN', - 'valueFormatter': _.identity, - 'geoJson': { - 'type': 'FeatureCollection', - 'features': [ + title: 'Top 2 geo.dest: CN', + valueFormatter: _.identity, + geoJson: { + type: 'FeatureCollection', + features: [ { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 22.5 - ] - }, - 'properties': { - 'value': 39, - 'geohash': 's', - 'center': [ - 22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 's', - 'value': 's', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 39, - 'value': 39, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 22.5], + }, + properties: { + value: 39, + geohash: 's', + center: [22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 's', + value: 's', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 39, + value: 39, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - 0 - ], - [ - 45, - 0 - ], - [ - 45, - 45 - ], - [ - 0, - 45 - ] - ] - } + rectangle: [ + [0, 0], + [45, 0], + [45, 45], + [0, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 22.5 - ] - }, - 'properties': { - 'value': 31, - 'geohash': 'w', - 'center': [ - 112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'w', - 'value': 'w', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 31, - 'value': 31, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 22.5], + }, + properties: { + value: 31, + geohash: 'w', + center: [112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'w', + value: 'w', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 31, + value: 31, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - 0 - ], - [ - 135, - 0 - ], - [ - 135, - 45 - ], - [ - 90, - 45 - ] - ] - } + rectangle: [ + [90, 0], + [135, 0], + [135, 45], + [90, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 22.5 - ] - }, - 'properties': { - 'value': 30, - 'geohash': 'd', - 'center': [ - -67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'd', - 'value': 'd', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 30, - 'value': 30, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 22.5], + }, + properties: { + value: 30, + geohash: 'd', + center: [-67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'd', + value: 'd', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 30, + value: 30, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - 0 - ], - [ - -45, - 0 - ], - [ - -45, - 45 - ], - [ - -90, - 45 - ] - ] - } + rectangle: [ + [-90, 0], + [-45, 0], + [-45, 45], + [-90, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 22.5 - ] - }, - 'properties': { - 'value': 25, - 'geohash': '9', - 'center': [ - -112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '9', - 'value': '9', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 25, - 'value': 25, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 22.5], + }, + properties: { + value: 25, + geohash: '9', + center: [-112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '9', + value: '9', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 25, + value: 25, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -135, - 0 - ], - [ - -90, - 0 - ], - [ - -90, - 45 - ], - [ - -135, - 45 - ] - ] - } + rectangle: [ + [-135, 0], + [-90, 0], + [-90, 45], + [-135, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 22.5 - ] - }, - 'properties': { - 'value': 23, - 'geohash': 't', - 'center': [ - 67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 't', - 'value': 't', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 23, - 'value': 23, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 22.5], + }, + properties: { + value: 23, + geohash: 't', + center: [67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 't', + value: 't', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 23, + value: 23, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 45, - 0 - ], - [ - 90, - 0 - ], - [ - 90, - 45 - ], - [ - 45, - 45 - ] - ] - } + rectangle: [ + [45, 0], + [90, 0], + [90, 45], + [45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -22.5 - ] - }, - 'properties': { - 'value': 23, - 'geohash': 'k', - 'center': [ - 22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'k', - 'value': 'k', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 23, - 'value': 23, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -22.5], + }, + properties: { + value: 23, + geohash: 'k', + center: [22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'k', + value: 'k', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 23, + value: 23, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - -45 - ], - [ - 45, - -45 - ], - [ - 45, - 0 - ], - [ - 0, - 0 - ] - ] - } + rectangle: [ + [0, -45], + [45, -45], + [45, 0], + [0, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -22.5 - ] - }, - 'properties': { - 'value': 22, - 'geohash': '6', - 'center': [ - -67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '6', - 'value': '6', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 22, - 'value': 22, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -22.5], + }, + properties: { + value: 22, + geohash: '6', + center: [-67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '6', + value: '6', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 22, + value: 22, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - -45 - ], - [ - -45, - -45 - ], - [ - -45, - 0 - ], - [ - -90, - 0 - ] - ] - } + rectangle: [ + [-90, -45], + [-45, -45], + [-45, 0], + [-90, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 67.5 - ] - }, - 'properties': { - 'value': 20, - 'geohash': 'u', - 'center': [ - 22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'u', - 'value': 'u', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 20, - 'value': 20, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 67.5], + }, + properties: { + value: 20, + geohash: 'u', + center: [22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'u', + value: 'u', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 20, + value: 20, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - 45 - ], - [ - 45, - 45 - ], - [ - 45, - 90 - ], - [ - 0, - 90 - ] - ] - } + rectangle: [ + [0, 45], + [45, 45], + [45, 90], + [0, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 67.5 - ] - }, - 'properties': { - 'value': 18, - 'geohash': 'v', - 'center': [ - 67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'v', - 'value': 'v', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 18, - 'value': 18, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 67.5], + }, + properties: { + value: 18, + geohash: 'v', + center: [67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'v', + value: 'v', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 18, + value: 18, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 45, - 45 - ], - [ - 90, - 45 - ], - [ - 90, - 90 - ], - [ - 45, - 90 - ] - ] - } + rectangle: [ + [45, 45], + [90, 45], + [90, 90], + [45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -22.5 - ] - }, - 'properties': { - 'value': 11, - 'geohash': 'r', - 'center': [ - 157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'r', - 'value': 'r', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 11, - 'value': 11, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -22.5], + }, + properties: { + value: 11, + geohash: 'r', + center: [157.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'r', + value: 'r', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 11, + value: 11, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - -45 - ], - [ - 180, - -45 - ], - [ - 180, - 0 - ], - [ - 135, - 0 - ] - ] - } + rectangle: [ + [135, -45], + [180, -45], + [180, 0], + [135, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 22.5 - ] - }, - 'properties': { - 'value': 11, - 'geohash': 'e', - 'center': [ - -22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'e', - 'value': 'e', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 11, - 'value': 11, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 22.5], + }, + properties: { + value: 11, + geohash: 'e', + center: [-22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'e', + value: 'e', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 11, + value: 11, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 45 - ], - [ - -45, - 45 - ] - ] - } + rectangle: [ + [-45, 0], + [0, 0], + [0, 45], + [-45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 67.5 - ] - }, - 'properties': { - 'value': 10, - 'geohash': 'y', - 'center': [ - 112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'y', - 'value': 'y', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 10, - 'value': 10, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 67.5], + }, + properties: { + value: 10, + geohash: 'y', + center: [112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'y', + value: 'y', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 10, + value: 10, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - 45 - ], - [ - 135, - 45 - ], - [ - 135, - 90 - ], - [ - 90, - 90 - ] - ] - } + rectangle: [ + [90, 45], + [135, 45], + [135, 90], + [90, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 67.5 - ] - }, - 'properties': { - 'value': 10, - 'geohash': 'c', - 'center': [ - -112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'c', - 'value': 'c', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 10, - 'value': 10, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 67.5], + }, + properties: { + value: 10, + geohash: 'c', + center: [-112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'c', + value: 'c', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 10, + value: 10, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -135, - 45 - ], - [ - -90, - 45 - ], - [ - -90, - 90 - ], - [ - -135, - 90 - ] - ] - } + rectangle: [ + [-135, 45], + [-90, 45], + [-90, 90], + [-135, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 67.5 - ] - }, - 'properties': { - 'value': 8, - 'geohash': 'f', - 'center': [ - -67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'f', - 'value': 'f', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 8, - 'value': 8, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 67.5], + }, + properties: { + value: 8, + geohash: 'f', + center: [-67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'f', + value: 'f', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 8, + value: 8, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - 45 - ], - [ - -45, - 45 - ], - [ - -45, - 90 - ], - [ - -90, - 90 - ] - ] - } + rectangle: [ + [-90, 45], + [-45, 45], + [-45, 90], + [-90, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -22.5 - ] - }, - 'properties': { - 'value': 8, - 'geohash': '7', - 'center': [ - -22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '7', - 'value': '7', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 8, - 'value': 8, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -22.5], + }, + properties: { + value: 8, + geohash: '7', + center: [-22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '7', + value: '7', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 8, + value: 8, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - -45 - ], - [ - 0, - -45 - ], - [ - 0, - 0 - ], - [ - -45, - 0 - ] - ] - } + rectangle: [ + [-45, -45], + [0, -45], + [0, 0], + [-45, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -22.5 - ] - }, - 'properties': { - 'value': 6, - 'geohash': 'q', - 'center': [ - 112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'q', - 'value': 'q', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -22.5], + }, + properties: { + value: 6, + geohash: 'q', + center: [112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'q', + value: 'q', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - -45 - ], - [ - 135, - -45 - ], - [ - 135, - 0 - ], - [ - 90, - 0 - ] - ] - } + rectangle: [ + [90, -45], + [135, -45], + [135, 0], + [90, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 67.5 - ] - }, - 'properties': { - 'value': 6, - 'geohash': 'g', - 'center': [ - -22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'g', - 'value': 'g', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 67.5], + }, + properties: { + value: 6, + geohash: 'g', + center: [-22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'g', + value: 'g', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - 45 - ], - [ - 0, - 45 - ], - [ - 0, - 90 - ], - [ - -45, - 90 - ] - ] - } + rectangle: [ + [-45, 45], + [0, 45], + [0, 90], + [-45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 22.5 - ] - }, - 'properties': { - 'value': 4, - 'geohash': 'x', - 'center': [ - 157.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'x', - 'value': 'x', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 4, - 'value': 4, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 22.5], + }, + properties: { + value: 4, + geohash: 'x', + center: [157.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'x', + value: 'x', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 4, + value: 4, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - 0 - ], - [ - 180, - 0 - ], - [ - 180, - 45 - ], - [ - 135, - 45 - ] - ] - } + rectangle: [ + [135, 0], + [180, 0], + [180, 45], + [135, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - 67.5 - ] - }, - 'properties': { - 'value': 3, - 'geohash': 'b', - 'center': [ - -157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'b', - 'value': 'b', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 3, - 'value': 3, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, 67.5], + }, + properties: { + value: 3, + geohash: 'b', + center: [-157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'b', + value: 'b', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 3, + value: 3, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -180, - 45 - ], - [ - -135, - 45 - ], - [ - -135, - 90 - ], - [ - -180, - 90 - ] - ] - } + rectangle: [ + [-180, 45], + [-135, 45], + [-135, 90], + [-180, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 67.5 - ] - }, - 'properties': { - 'value': 2, - 'geohash': 'z', - 'center': [ - 157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'z', - 'value': 'z', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 67.5], + }, + properties: { + value: 2, + geohash: 'z', + center: [157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'z', + value: 'z', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - 45 - ], - [ - 180, - 45 - ], - [ - 180, - 90 - ], - [ - 135, - 90 - ] - ] - } + rectangle: [ + [135, 45], + [180, 45], + [180, 90], + [135, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -67.5 - ] - }, - 'properties': { - 'value': 2, - 'geohash': '4', - 'center': [ - -67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '4', - 'value': '4', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -67.5], + }, + properties: { + value: 2, + geohash: '4', + center: [-67.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '4', + value: '4', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - -90 - ], - [ - -45, - -90 - ], - [ - -45, - -45 - ], - [ - -90, - -45 - ] - ] - } + rectangle: [ + [-90, -90], + [-45, -90], + [-45, -45], + [-90, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -67.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': '5', - 'center': [ - -22.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '5', - 'value': '5', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -67.5], + }, + properties: { + value: 1, + geohash: '5', + center: [-22.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '5', + value: '5', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - -90 - ], - [ - 0, - -90 - ], - [ - 0, - -45 - ], - [ - -45, - -45 - ] - ] - } + rectangle: [ + [-45, -90], + [0, -90], + [0, -45], + [-45, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - -22.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': '3', - 'center': [ - -112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'CN', - 'value': 'CN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '3', - 'value': '3', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, -22.5], + }, + properties: { + value: 1, + geohash: '3', + center: [-112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'CN', + value: 'CN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '3', + value: '3', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -135, - -45 - ], - [ - -90, - -45 - ], - [ - -90, - 0 - ], - [ - -135, - 0 - ] - ] - } - } + rectangle: [ + [-135, -45], + [-90, -45], + [-90, 0], + [-135, 0], + ], + }, + }, ], - 'properties': { - 'min': 1, - 'max': 39 - } - } + properties: { + min: 1, + max: 39, + }, + }, }, { - 'label': 'Top 2 geo.dest: IN', - 'valueFormatter': _.identity, - 'geoJson': { - 'type': 'FeatureCollection', - 'features': [ + label: 'Top 2 geo.dest: IN', + valueFormatter: _.identity, + geoJson: { + type: 'FeatureCollection', + features: [ { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -22.5 - ] - }, - 'properties': { - 'value': 31, - 'geohash': '6', - 'center': [ - -67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '6', - 'value': '6', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 31, - 'value': 31, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -22.5], + }, + properties: { + value: 31, + geohash: '6', + center: [-67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '6', + value: '6', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 31, + value: 31, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - -45 - ], - [ - -45, - -45 - ], - [ - -45, - 0 - ], - [ - -90, - 0 - ] - ] - } + rectangle: [ + [-90, -45], + [-45, -45], + [-45, 0], + [-90, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 22.5 - ] - }, - 'properties': { - 'value': 30, - 'geohash': 's', - 'center': [ - 22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 's', - 'value': 's', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 30, - 'value': 30, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 22.5], + }, + properties: { + value: 30, + geohash: 's', + center: [22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 's', + value: 's', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 30, + value: 30, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - 0 - ], - [ - 45, - 0 - ], - [ - 45, - 45 - ], - [ - 0, - 45 - ] - ] - } + rectangle: [ + [0, 0], + [45, 0], + [45, 45], + [0, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 22.5 - ] - }, - 'properties': { - 'value': 29, - 'geohash': 'w', - 'center': [ - 112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'w', - 'value': 'w', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 29, - 'value': 29, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 22.5], + }, + properties: { + value: 29, + geohash: 'w', + center: [112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'w', + value: 'w', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 29, + value: 29, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - 0 - ], - [ - 135, - 0 - ], - [ - 135, - 45 - ], - [ - 90, - 45 - ] - ] - } + rectangle: [ + [90, 0], + [135, 0], + [135, 45], + [90, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 22.5 - ] - }, - 'properties': { - 'value': 28, - 'geohash': 'd', - 'center': [ - -67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'd', - 'value': 'd', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 28, - 'value': 28, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 22.5], + }, + properties: { + value: 28, + geohash: 'd', + center: [-67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'd', + value: 'd', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 28, + value: 28, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - 0 - ], - [ - -45, - 0 - ], - [ - -45, - 45 - ], - [ - -90, - 45 - ] - ] - } + rectangle: [ + [-90, 0], + [-45, 0], + [-45, 45], + [-90, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 22.5 - ] - }, - 'properties': { - 'value': 25, - 'geohash': 't', - 'center': [ - 67.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 't', - 'value': 't', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 25, - 'value': 25, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 22.5], + }, + properties: { + value: 25, + geohash: 't', + center: [67.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 't', + value: 't', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 25, + value: 25, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 45, - 0 - ], - [ - 90, - 0 - ], - [ - 90, - 45 - ], - [ - 45, - 45 - ] - ] - } + rectangle: [ + [45, 0], + [90, 0], + [90, 45], + [45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - -22.5 - ] - }, - 'properties': { - 'value': 24, - 'geohash': 'k', - 'center': [ - 22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'k', - 'value': 'k', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 24, - 'value': 24, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, -22.5], + }, + properties: { + value: 24, + geohash: 'k', + center: [22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'k', + value: 'k', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 24, + value: 24, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - -45 - ], - [ - 45, - -45 - ], - [ - 45, - 0 - ], - [ - 0, - 0 - ] - ] - } + rectangle: [ + [0, -45], + [45, -45], + [45, 0], + [0, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 22.5, - 67.5 - ] - }, - 'properties': { - 'value': 20, - 'geohash': 'u', - 'center': [ - 22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'u', - 'value': 'u', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 20, - 'value': 20, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [22.5, 67.5], + }, + properties: { + value: 20, + geohash: 'u', + center: [22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'u', + value: 'u', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 20, + value: 20, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 0, - 45 - ], - [ - 45, - 45 - ], - [ - 45, - 90 - ], - [ - 0, - 90 - ] - ] - } + rectangle: [ + [0, 45], + [45, 45], + [45, 90], + [0, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 22.5 - ] - }, - 'properties': { - 'value': 18, - 'geohash': '9', - 'center': [ - -112.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '9', - 'value': '9', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 18, - 'value': 18, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 22.5], + }, + properties: { + value: 18, + geohash: '9', + center: [-112.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '9', + value: '9', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 18, + value: 18, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -135, - 0 - ], - [ - -90, - 0 - ], - [ - -90, - 45 - ], - [ - -135, - 45 - ] - ] - } + rectangle: [ + [-135, 0], + [-90, 0], + [-90, 45], + [-135, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - 67.5 - ] - }, - 'properties': { - 'value': 14, - 'geohash': 'v', - 'center': [ - 67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'v', - 'value': 'v', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 14, - 'value': 14, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, 67.5], + }, + properties: { + value: 14, + geohash: 'v', + center: [67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'v', + value: 'v', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 14, + value: 14, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 45, - 45 - ], - [ - 90, - 45 - ], - [ - 90, - 90 - ], - [ - 45, - 90 - ] - ] - } + rectangle: [ + [45, 45], + [90, 45], + [90, 90], + [45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 22.5 - ] - }, - 'properties': { - 'value': 11, - 'geohash': 'e', - 'center': [ - -22.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'e', - 'value': 'e', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 11, - 'value': 11, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 22.5], + }, + properties: { + value: 11, + geohash: 'e', + center: [-22.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'e', + value: 'e', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 11, + value: 11, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - 0 - ], - [ - 0, - 0 - ], - [ - 0, - 45 - ], - [ - -45, - 45 - ] - ] - } + rectangle: [ + [-45, 0], + [0, 0], + [0, 45], + [-45, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -22.5 - ] - }, - 'properties': { - 'value': 9, - 'geohash': 'r', - 'center': [ - 157.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'r', - 'value': 'r', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 9, - 'value': 9, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -22.5], + }, + properties: { + value: 9, + geohash: 'r', + center: [157.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'r', + value: 'r', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 9, + value: 9, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - -45 - ], - [ - 180, - -45 - ], - [ - 180, - 0 - ], - [ - 135, - 0 - ] - ] - } + rectangle: [ + [135, -45], + [180, -45], + [180, 0], + [135, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - 67.5 - ] - }, - 'properties': { - 'value': 6, - 'geohash': 'y', - 'center': [ - 112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'y', - 'value': 'y', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, 67.5], + }, + properties: { + value: 6, + geohash: 'y', + center: [112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'y', + value: 'y', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - 45 - ], - [ - 135, - 45 - ], - [ - 135, - 90 - ], - [ - 90, - 90 - ] - ] - } + rectangle: [ + [90, 45], + [135, 45], + [135, 90], + [90, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - 67.5 - ] - }, - 'properties': { - 'value': 6, - 'geohash': 'f', - 'center': [ - -67.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'f', - 'value': 'f', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 6, - 'value': 6, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, 67.5], + }, + properties: { + value: 6, + geohash: 'f', + center: [-67.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'f', + value: 'f', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 6, + value: 6, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - 45 - ], - [ - -45, - 45 - ], - [ - -45, - 90 - ], - [ - -90, - 90 - ] - ] - } + rectangle: [ + [-90, 45], + [-45, 45], + [-45, 90], + [-90, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - 67.5 - ] - }, - 'properties': { - 'value': 5, - 'geohash': 'g', - 'center': [ - -22.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'g', - 'value': 'g', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 5, - 'value': 5, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, 67.5], + }, + properties: { + value: 5, + geohash: 'g', + center: [-22.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'g', + value: 'g', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 5, + value: 5, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - 45 - ], - [ - 0, - 45 - ], - [ - 0, - 90 - ], - [ - -45, - 90 - ] - ] - } + rectangle: [ + [-45, 45], + [0, 45], + [0, 90], + [-45, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -112.5, - 67.5 - ] - }, - 'properties': { - 'value': 5, - 'geohash': 'c', - 'center': [ - -112.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'c', - 'value': 'c', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 5, - 'value': 5, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-112.5, 67.5], + }, + properties: { + value: 5, + geohash: 'c', + center: [-112.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'c', + value: 'c', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 5, + value: 5, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -135, - 45 - ], - [ - -90, - 45 - ], - [ - -90, - 90 - ], - [ - -135, - 90 - ] - ] - } + rectangle: [ + [-135, 45], + [-90, 45], + [-90, 90], + [-135, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -157.5, - 67.5 - ] - }, - 'properties': { - 'value': 4, - 'geohash': 'b', - 'center': [ - -157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'b', - 'value': 'b', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 4, - 'value': 4, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-157.5, 67.5], + }, + properties: { + value: 4, + geohash: 'b', + center: [-157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'b', + value: 'b', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 4, + value: 4, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -180, - 45 - ], - [ - -135, - 45 - ], - [ - -135, - 90 - ], - [ - -180, - 90 - ] - ] - } + rectangle: [ + [-180, 45], + [-135, 45], + [-135, 90], + [-180, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 112.5, - -22.5 - ] - }, - 'properties': { - 'value': 3, - 'geohash': 'q', - 'center': [ - 112.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'q', - 'value': 'q', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 3, - 'value': 3, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [112.5, -22.5], + }, + properties: { + value: 3, + geohash: 'q', + center: [112.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'q', + value: 'q', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 3, + value: 3, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 90, - -45 - ], - [ - 135, - -45 - ], - [ - 135, - 0 - ], - [ - 90, - 0 - ] - ] - } + rectangle: [ + [90, -45], + [135, -45], + [135, 0], + [90, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -67.5, - -67.5 - ] - }, - 'properties': { - 'value': 2, - 'geohash': '4', - 'center': [ - -67.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '4', - 'value': '4', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 2, - 'value': 2, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-67.5, -67.5], + }, + properties: { + value: 2, + geohash: '4', + center: [-67.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '4', + value: '4', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 2, + value: 2, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -90, - -90 - ], - [ - -45, - -90 - ], - [ - -45, - -45 - ], - [ - -90, - -45 - ] - ] - } + rectangle: [ + [-90, -90], + [-45, -90], + [-45, -45], + [-90, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 67.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': 'z', - 'center': [ - 157.5, - 67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'z', - 'value': 'z', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 67.5], + }, + properties: { + value: 1, + geohash: 'z', + center: [157.5, 67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'z', + value: 'z', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - 45 - ], - [ - 180, - 45 - ], - [ - 180, - 90 - ], - [ - 135, - 90 - ] - ] - } + rectangle: [ + [135, 45], + [180, 45], + [180, 90], + [135, 90], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - 22.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': 'x', - 'center': [ - 157.5, - 22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'x', - 'value': 'x', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, 22.5], + }, + properties: { + value: 1, + geohash: 'x', + center: [157.5, 22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'x', + value: 'x', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - 0 - ], - [ - 180, - 0 - ], - [ - 180, - 45 - ], - [ - 135, - 45 - ] - ] - } + rectangle: [ + [135, 0], + [180, 0], + [180, 45], + [135, 45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 157.5, - -67.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': 'p', - 'center': [ - 157.5, - -67.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'p', - 'value': 'p', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [157.5, -67.5], + }, + properties: { + value: 1, + geohash: 'p', + center: [157.5, -67.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'p', + value: 'p', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 135, - -90 - ], - [ - 180, - -90 - ], - [ - 180, - -45 - ], - [ - 135, - -45 - ] - ] - } + rectangle: [ + [135, -90], + [180, -90], + [180, -45], + [135, -45], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - 67.5, - -22.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': 'm', - 'center': [ - 67.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': 'm', - 'value': 'm', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [67.5, -22.5], + }, + properties: { + value: 1, + geohash: 'm', + center: [67.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: 'm', + value: 'm', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - 45, - -45 - ], - [ - 90, - -45 - ], - [ - 90, - 0 - ], - [ - 45, - 0 - ] - ] - } + rectangle: [ + [45, -45], + [90, -45], + [90, 0], + [45, 0], + ], + }, }, { - 'type': 'Feature', - 'geometry': { - 'type': 'Point', - 'coordinates': [ - -22.5, - -22.5 - ] - }, - 'properties': { - 'value': 1, - 'geohash': '7', - 'center': [ - -22.5, - -22.5 - ], - 'aggConfigResult': { - '$parent': { - '$parent': { - '$parent': null, - 'key': 'IN', - 'value': 'IN', - 'aggConfig': { - 'id': '3', - 'type': 'terms', - 'schema': 'split', - 'params': { - 'field': 'geo.dest', - 'size': 2, - 'order': 'desc', - 'orderBy': '1', - 'row': true - } - }, - 'type': 'bucket' - }, - 'key': '7', - 'value': '7', - 'aggConfig': { - 'id': '2', - 'type': 'geohash_grid', - 'schema': 'segment', - 'params': { - 'field': 'geo.coordinates', - 'precision': 1 - } - }, - 'type': 'bucket' - }, - 'key': 1, - 'value': 1, - 'aggConfig': { - 'id': '1', - 'type': 'count', - 'schema': 'metric', - 'params': {} - }, - 'type': 'metric' + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-22.5, -22.5], + }, + properties: { + value: 1, + geohash: '7', + center: [-22.5, -22.5], + aggConfigResult: { + $parent: { + $parent: { + $parent: null, + key: 'IN', + value: 'IN', + aggConfig: { + id: '3', + type: 'terms', + schema: 'split', + params: { + field: 'geo.dest', + size: 2, + order: 'desc', + orderBy: '1', + row: true, + }, + }, + type: 'bucket', + }, + key: '7', + value: '7', + aggConfig: { + id: '2', + type: 'geohash_grid', + schema: 'segment', + params: { + field: 'geo.coordinates', + precision: 1, + }, + }, + type: 'bucket', + }, + key: 1, + value: 1, + aggConfig: { + id: '1', + type: 'count', + schema: 'metric', + params: {}, + }, + type: 'metric', }, - 'rectangle': [ - [ - -45, - -45 - ], - [ - 0, - -45 - ], - [ - 0, - 0 - ], - [ - -45, - 0 - ] - ] - } - } + rectangle: [ + [-45, -45], + [0, -45], + [0, 0], + [-45, 0], + ], + }, + }, ], - 'properties': { - 'min': 1, - 'max': 31 - } - } - } + properties: { + min: 1, + max: 31, + }, + }, + }, ], - 'hits': 1639 + hits: 1639, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js index 96d2cfd174579c..c93365234d1582 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns.js @@ -1,351 +1,364 @@ +/* + * 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 default { - 'columns': [ + columns: [ { - 'label': '404: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '404: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 2147483600, - 'y': 1, - 'y0': 0 + x: 2147483600, + y: 1, + y0: 0, }, { - 'x': 3221225400, - 'y': 0, - 'y0': 0 + x: 3221225400, + y: 0, + y0: 0, }, { - 'x': 4294967200, - 'y': 0, - 'y0': 0 + x: 4294967200, + y: 0, + y0: 0, }, { - 'x': 5368709100, - 'y': 0, - 'y0': 0 + x: 5368709100, + y: 0, + y0: 0, }, { - 'x': 6442450900, - 'y': 0, - 'y0': 0 + x: 6442450900, + y: 0, + y0: 0, }, { - 'x': 7516192700, - 'y': 0, - 'y0': 0 + x: 7516192700, + y: 0, + y0: 0, }, { - 'x': 8589934500, - 'y': 0, - 'y0': 0 + x: 8589934500, + y: 0, + y0: 0, }, { - 'x': 10737418200, - 'y': 0, - 'y0': 0 + x: 10737418200, + y: 0, + y0: 0, }, { - 'x': 11811160000, - 'y': 0, - 'y0': 0 + x: 11811160000, + y: 0, + y0: 0, }, { - 'x': 12884901800, - 'y': 1, - 'y0': 0 + x: 12884901800, + y: 1, + y0: 0, }, { - 'x': 13958643700, - 'y': 0, - 'y0': 0 + x: 13958643700, + y: 0, + y0: 0, }, { - 'x': 15032385500, - 'y': 0, - 'y0': 0 + x: 15032385500, + y: 0, + y0: 0, }, { - 'x': 16106127300, - 'y': 0, - 'y0': 0 + x: 16106127300, + y: 0, + y0: 0, }, { - 'x': 18253611000, - 'y': 0, - 'y0': 0 + x: 18253611000, + y: 0, + y0: 0, }, { - 'x': 19327352800, - 'y': 0, - 'y0': 0 + x: 19327352800, + y: 0, + y0: 0, }, { - 'x': 20401094600, - 'y': 0, - 'y0': 0 + x: 20401094600, + y: 0, + y0: 0, }, { - 'x': 21474836400, - 'y': 0, - 'y0': 0 - } - ] - } + x: 21474836400, + y: 0, + y0: 0, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '200: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '200: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 2147483600, - 'y': 0, - 'y0': 0 + x: 2147483600, + y: 0, + y0: 0, }, { - 'x': 3221225400, - 'y': 2, - 'y0': 0 + x: 3221225400, + y: 2, + y0: 0, }, { - 'x': 4294967200, - 'y': 3, - 'y0': 0 + x: 4294967200, + y: 3, + y0: 0, }, { - 'x': 5368709100, - 'y': 3, - 'y0': 0 + x: 5368709100, + y: 3, + y0: 0, }, { - 'x': 6442450900, - 'y': 1, - 'y0': 0 + x: 6442450900, + y: 1, + y0: 0, }, { - 'x': 7516192700, - 'y': 1, - 'y0': 0 + x: 7516192700, + y: 1, + y0: 0, }, { - 'x': 8589934500, - 'y': 4, - 'y0': 0 + x: 8589934500, + y: 4, + y0: 0, }, { - 'x': 10737418200, - 'y': 0, - 'y0': 0 + x: 10737418200, + y: 0, + y0: 0, }, { - 'x': 11811160000, - 'y': 1, - 'y0': 0 + x: 11811160000, + y: 1, + y0: 0, }, { - 'x': 12884901800, - 'y': 1, - 'y0': 0 + x: 12884901800, + y: 1, + y0: 0, }, { - 'x': 13958643700, - 'y': 1, - 'y0': 0 + x: 13958643700, + y: 1, + y0: 0, }, { - 'x': 15032385500, - 'y': 2, - 'y0': 0 + x: 15032385500, + y: 2, + y0: 0, }, { - 'x': 16106127300, - 'y': 3, - 'y0': 0 + x: 16106127300, + y: 3, + y0: 0, }, { - 'x': 18253611000, - 'y': 4, - 'y0': 0 + x: 18253611000, + y: 4, + y0: 0, }, { - 'x': 19327352800, - 'y': 5, - 'y0': 0 + x: 19327352800, + y: 5, + y0: 0, }, { - 'x': 20401094600, - 'y': 2, - 'y0': 0 + x: 20401094600, + y: 2, + y0: 0, }, { - 'x': 21474836400, - 'y': 2, - 'y0': 0 - } - ] - } + x: 21474836400, + y: 2, + y0: 0, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '503: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '503: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 2147483600, - 'y': 0, - 'y0': 0 + x: 2147483600, + y: 0, + y0: 0, }, { - 'x': 3221225400, - 'y': 0, - 'y0': 0 + x: 3221225400, + y: 0, + y0: 0, }, { - 'x': 4294967200, - 'y': 0, - 'y0': 0 + x: 4294967200, + y: 0, + y0: 0, }, { - 'x': 5368709100, - 'y': 0, - 'y0': 0 + x: 5368709100, + y: 0, + y0: 0, }, { - 'x': 6442450900, - 'y': 0, - 'y0': 0 + x: 6442450900, + y: 0, + y0: 0, }, { - 'x': 7516192700, - 'y': 0, - 'y0': 0 + x: 7516192700, + y: 0, + y0: 0, }, { - 'x': 8589934500, - 'y': 0, - 'y0': 0 + x: 8589934500, + y: 0, + y0: 0, }, { - 'x': 10737418200, - 'y': 1, - 'y0': 0 + x: 10737418200, + y: 1, + y0: 0, }, { - 'x': 11811160000, - 'y': 0, - 'y0': 0 + x: 11811160000, + y: 0, + y0: 0, }, { - 'x': 12884901800, - 'y': 0, - 'y0': 0 + x: 12884901800, + y: 0, + y0: 0, }, { - 'x': 13958643700, - 'y': 0, - 'y0': 0 + x: 13958643700, + y: 0, + y0: 0, }, { - 'x': 15032385500, - 'y': 0, - 'y0': 0 + x: 15032385500, + y: 0, + y0: 0, }, { - 'x': 16106127300, - 'y': 0, - 'y0': 0 + x: 16106127300, + y: 0, + y0: 0, }, { - 'x': 18253611000, - 'y': 0, - 'y0': 0 + x: 18253611000, + y: 0, + y0: 0, }, { - 'x': 19327352800, - 'y': 0, - 'y0': 0 + x: 19327352800, + y: 0, + y0: 0, }, { - 'x': 20401094600, - 'y': 0, - 'y0': 0 + x: 20401094600, + y: 0, + y0: 0, }, { - 'x': 21474836400, - 'y': 0, - 'y0': 0 - } - ] - } + x: 21474836400, + y: 0, + y0: 0, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'xAxisOrderedValues': [ + xAxisOrderedValues: [ 2147483600, 3221225400, 4294967200, @@ -364,5 +377,5 @@ export default { 20401094600, 21474836400, ], - 'hits': 40 + hits: 40, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js index 27050030ebdfd5..d88197c3737e52 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows.js @@ -1,192 +1,205 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'label': '404: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '404: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 2147483600, - 'y': 1 + x: 2147483600, + y: 1, }, { - 'x': 10737418200, - 'y': 1 + x: 10737418200, + y: 1, }, { - 'x': 15032385500, - 'y': 2 + x: 15032385500, + y: 2, }, { - 'x': 19327352800, - 'y': 1 + x: 19327352800, + y: 1, }, { - 'x': 32212254700, - 'y': 1 - } - ] - } + x: 32212254700, + y: 1, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '200: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '200: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 3221225400, - 'y': 4 + x: 3221225400, + y: 4, }, { - 'x': 4294967200, - 'y': 3 + x: 4294967200, + y: 3, }, { - 'x': 5368709100, - 'y': 3 + x: 5368709100, + y: 3, }, { - 'x': 6442450900, - 'y': 2 + x: 6442450900, + y: 2, }, { - 'x': 7516192700, - 'y': 2 + x: 7516192700, + y: 2, }, { - 'x': 8589934500, - 'y': 2 + x: 8589934500, + y: 2, }, { - 'x': 9663676400, - 'y': 3 + x: 9663676400, + y: 3, }, { - 'x': 11811160000, - 'y': 3 + x: 11811160000, + y: 3, }, { - 'x': 12884901800, - 'y': 2 + x: 12884901800, + y: 2, }, { - 'x': 13958643700, - 'y': 1 + x: 13958643700, + y: 1, }, { - 'x': 15032385500, - 'y': 2 + x: 15032385500, + y: 2, }, { - 'x': 16106127300, - 'y': 3 + x: 16106127300, + y: 3, }, { - 'x': 17179869100, - 'y': 1 + x: 17179869100, + y: 1, }, { - 'x': 18253611000, - 'y': 4 + x: 18253611000, + y: 4, }, { - 'x': 19327352800, - 'y': 1 + x: 19327352800, + y: 1, }, { - 'x': 20401094600, - 'y': 1 + x: 20401094600, + y: 1, }, { - 'x': 21474836400, - 'y': 4 + x: 21474836400, + y: 4, }, { - 'x': 32212254700, - 'y': 3 - } - ] - } + x: 32212254700, + y: 3, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '503: response', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '503: response', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 10737418200, - 'y': 1 - } - ] - } + x: 10737418200, + y: 1, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'xAxisOrderedValues': [ + xAxisOrderedValues: [ 2147483600, 3221225400, 4294967200, @@ -208,5 +221,5 @@ export default { 21474836400, 32212254700, ], - 'hits': 51 + hits: 51, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js index 5c7554db2060df..99511e693ff023 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_series.js @@ -1,93 +1,112 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': 'machine.ram', - 'ordered': { - 'interval': 100 + label: '', + xAxisLabel: 'machine.ram', + ordered: { + interval: 100, }, - 'yAxisLabel': 'Count of documents', - 'series': [ + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 3221225400, - 'y': 5 + x: 3221225400, + y: 5, }, { - 'x': 4294967200, - 'y': 2 + x: 4294967200, + y: 2, }, { - 'x': 5368709100, - 'y': 5 + x: 5368709100, + y: 5, }, { - 'x': 6442450900, - 'y': 4 + x: 6442450900, + y: 4, }, { - 'x': 7516192700, - 'y': 1 + x: 7516192700, + y: 1, }, { - 'x': 9663676400, - 'y': 9 + x: 9663676400, + y: 9, }, { - 'x': 10737418200, - 'y': 5 + x: 10737418200, + y: 5, }, { - 'x': 11811160000, - 'y': 5 + x: 11811160000, + y: 5, }, { - 'x': 12884901800, - 'y': 2 + x: 12884901800, + y: 2, }, { - 'x': 13958643700, - 'y': 3 + x: 13958643700, + y: 3, }, { - 'x': 15032385500, - 'y': 3 + x: 15032385500, + y: 3, }, { - 'x': 16106127300, - 'y': 3 + x: 16106127300, + y: 3, }, { - 'x': 17179869100, - 'y': 1 + x: 17179869100, + y: 1, }, { - 'x': 18253611000, - 'y': 6 + x: 18253611000, + y: 6, }, { - 'x': 19327352800, - 'y': 3 + x: 19327352800, + y: 3, }, { - 'x': 20401094600, - 'y': 3 + x: 20401094600, + y: 3, }, { - 'x': 21474836400, - 'y': 7 + x: 21474836400, + y: 7, }, { - 'x': 32212254700, - 'y': 4 - } - ] - } + x: 32212254700, + y: 4, + }, + ], + }, ], - 'hits': 71, - 'xAxisOrderedValues': [ + hits: 71, + xAxisOrderedValues: [ 3221225400, 4294967200, 5368709100, @@ -107,18 +126,16 @@ export default { 21474836400, 32212254700, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js index c47155840cec50..c23a89b755b5b3 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_slices.js @@ -1,285 +1,304 @@ +/* + * 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 default { - 'label': '', - 'slices': { - 'children': [ + label: '', + slices: { + children: [ { - 'name': 0, - 'size': 378611, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 0, + size: 378611, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 1000, - 'size': 205997, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 1000, + size: 205997, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 2000, - 'size': 397189, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 2000, + size: 397189, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 3000, - 'size': 397195, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 3000, + size: 397195, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 4000, - 'size': 398429, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 4000, + size: 398429, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 5000, - 'size': 397843, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 5000, + size: 397843, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 6000, - 'size': 398140, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 6000, + size: 398140, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 7000, - 'size': 398076, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 7000, + size: 398076, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 8000, - 'size': 396746, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 8000, + size: 396746, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 9000, - 'size': 397418, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 9000, + size: 397418, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 10000, - 'size': 20222, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 10000, + size: 20222, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 11000, - 'size': 20173, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 11000, + size: 20173, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 12000, - 'size': 20026, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 12000, + size: 20026, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 13000, - 'size': 19986, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 13000, + size: 19986, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 14000, - 'size': 20091, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 14000, + size: 20091, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 15000, - 'size': 20052, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 15000, + size: 20052, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 16000, - 'size': 20349, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 16000, + size: 20349, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 17000, - 'size': 20290, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 17000, + size: 20290, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 18000, - 'size': 20399, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 18000, + size: 20399, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 19000, - 'size': 20133, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } + name: 19000, + size: 20133, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, }, { - 'name': 20000, - 'size': 9, - 'aggConfig': { - 'type': 'histogram', - 'schema': 'segment', - 'fieldFormatter': _.constant(String), - 'params': { - 'interval': 1000, - 'extended_bounds': {} - } - } - } - ] + name: 20000, + size: 9, + aggConfig: { + type: 'histogram', + schema: 'segment', + fieldFormatter: _.constant(String), + params: { + interval: 1000, + extended_bounds: {}, + }, + }, + }, + ], }, - 'names': [ + names: [ 0, 1000, 2000, @@ -300,10 +319,10 @@ export default { 17000, 18000, 19000, - 20000 + 20000, ], - 'hits': 3967374, - 'tooltipFormatter': function (event) { + hits: 3967374, + tooltipFormatter: function(event) { return event.point; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js index b05e258133963b..df71f4efc58b55 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/not_enough_data/_one_point.js @@ -1,34 +1,51 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': '', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '', + xAxisLabel: '', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '_all', - 'y': 274 - } - ] - } + x: '_all', + y: 274, + }, + ], + }, ], - 'hits': 274, - 'xAxisOrderedValues': ['_all'], - 'xAxisFormatter': function (val) { + hits: 274, + xAxisOrderedValues: ['_all'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js index d6f3fc4361f329..b5b931383f7321 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_columns.js @@ -1,62 +1,79 @@ +/* + * 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 default { - 'columns': [ + columns: [ { - 'label': 'apache: _type', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'apache: _type', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 13309 + x: '0.0-1000.0', + y: 13309, }, { - 'x': '1000.0-2000.0', - 'y': 7196 - } - ] - } - ] + x: '1000.0-2000.0', + y: 7196, + }, + ], + }, + ], }, { - 'label': 'nginx: _type', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'nginx: _type', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 3278 + x: '0.0-1000.0', + y: 3278, }, { - 'x': '1000.0-2000.0', - 'y': 1804 - } - ] - } - ] - } + x: '1000.0-2000.0', + y: 1804, + }, + ], + }, + ], + }, ], - 'hits': 171499, - 'xAxisOrderedValues': ['0.0-1000.0', '1000.0-2000.0'], - 'xAxisFormatter': function (val) { + hits: 171499, + xAxisOrderedValues: ['0.0-1000.0', '1000.0-2000.0'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js index b420565b1c96b5..bc7e4c9f49625f 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows.js @@ -1,88 +1,107 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 6422, - 'y0': 0 + x: '0.0-1000.0', + y: 6422, + y0: 0, }, { - 'x': '1000.0-2000.0', - 'y': 3446, - 'y0': 0 - } - ] - } - ] + x: '1000.0-2000.0', + y: 3446, + y0: 0, + }, + ], + }, + ], }, { - 'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: + 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 5430, - 'y0': 0 + x: '0.0-1000.0', + y: 5430, + y0: 0, }, { - 'x': '1000.0-2000.0', - 'y': 3010, - 'y0': 0 - } - ] - } - ] + x: '1000.0-2000.0', + y: 3010, + y0: 0, + }, + ], + }, + ], }, { - 'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: + 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 4735, - 'y0': 0 + x: '0.0-1000.0', + y: 4735, + y0: 0, }, { - 'x': '1000.0-2000.0', - 'y': 2542, - 'y0': 0 - } - ] - } - ] - } + x: '1000.0-2000.0', + y: 2542, + y0: 0, + }, + ], + }, + ], + }, ], - 'hits': 171501, - 'xAxisOrderedValues': ['0.0-1000.0', '1000.0-2000.0'], - 'xAxisFormatter': function (val) { + hits: 171501, + xAxisOrderedValues: ['0.0-1000.0', '1000.0-2000.0'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js index 2ac35efadc8f2f..40c14beeb4f3ef 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/range/_series.js @@ -1,38 +1,55 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': 'bytes ranges', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '', + xAxisLabel: 'bytes ranges', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': '0.0-1000.0', - 'y': 16576 + x: '0.0-1000.0', + y: 16576, }, { - 'x': '1000.0-2000.0', - 'y': 9005 - } - ] - } + x: '1000.0-2000.0', + y: 9005, + }, + ], + }, ], - 'hits': 171500, - 'xAxisOrderedValues': ['0.0-1000.0', '1000.0-2000.0'], - 'xAxisFormatter': function (val) { + hits: 171500, + xAxisOrderedValues: ['0.0-1000.0', '1000.0-2000.0'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js index 5b1e29ac0d54ae..bf4fcb7e9e526a 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_columns.js @@ -1,242 +1,251 @@ +/* + * 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 default { - 'columns': [ + columns: [ { - 'label': 'http: links', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'http: links', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 144000 + x: 'success', + y: 144000, }, { - 'x': 'info', - 'y': 128237 + x: 'info', + y: 128237, }, { - 'x': 'security', - 'y': 34518 + x: 'security', + y: 34518, }, { - 'x': 'error', - 'y': 10258 + x: 'error', + y: 10258, }, { - 'x': 'warning', - 'y': 17188 - } - ] - } + x: 'warning', + y: 17188, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'info: links', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'info: links', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 108148 + x: 'success', + y: 108148, }, { - 'x': 'info', - 'y': 96242 + x: 'info', + y: 96242, }, { - 'x': 'security', - 'y': 25889 + x: 'security', + y: 25889, }, { - 'x': 'error', - 'y': 7673 + x: 'error', + y: 7673, }, { - 'x': 'warning', - 'y': 12842 - } - ] - } + x: 'warning', + y: 12842, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'www.slate.com: links', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'www.slate.com: links', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 98056 + x: 'success', + y: 98056, }, { - 'x': 'info', - 'y': 87344 + x: 'info', + y: 87344, }, { - 'x': 'security', - 'y': 23577 + x: 'security', + y: 23577, }, { - 'x': 'error', - 'y': 7004 + x: 'error', + y: 7004, }, { - 'x': 'warning', - 'y': 11759 - } - ] - } + x: 'warning', + y: 11759, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'twitter.com: links', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'twitter.com: links', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 74154 + x: 'success', + y: 74154, }, { - 'x': 'info', - 'y': 65963 + x: 'info', + y: 65963, }, { - 'x': 'security', - 'y': 17832 + x: 'security', + y: 17832, }, { - 'x': 'error', - 'y': 5258 + x: 'error', + y: 5258, }, { - 'x': 'warning', - 'y': 8906 - } - ] - } + x: 'warning', + y: 8906, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'www.www.slate.com: links', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'www.www.slate.com: links', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 62591 + x: 'success', + y: 62591, }, { - 'x': 'info', - 'y': 55822 + x: 'info', + y: 55822, }, { - 'x': 'security', - 'y': 15100 + x: 'security', + y: 15100, }, { - 'x': 'error', - 'y': 4564 + x: 'error', + y: 4564, }, { - 'x': 'warning', - 'y': 7498 - } - ] - } + x: 'warning', + y: 7498, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'hits': 171446 + hits: 171446, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js index 147eb691eb67bc..5d737131dc9980 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_rows.js @@ -1,242 +1,251 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'label': 'h3: headings', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'h3: headings', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 144000 + x: 'success', + y: 144000, }, { - 'x': 'info', - 'y': 128235 + x: 'info', + y: 128235, }, { - 'x': 'security', - 'y': 34518 + x: 'security', + y: 34518, }, { - 'x': 'error', - 'y': 10257 + x: 'error', + y: 10257, }, { - 'x': 'warning', - 'y': 17188 - } - ] - } + x: 'warning', + y: 17188, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'h5: headings', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'h5: headings', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 144000 + x: 'success', + y: 144000, }, { - 'x': 'info', - 'y': 128235 + x: 'info', + y: 128235, }, { - 'x': 'security', - 'y': 34518 + x: 'security', + y: 34518, }, { - 'x': 'error', - 'y': 10257 + x: 'error', + y: 10257, }, { - 'x': 'warning', - 'y': 17188 - } - ] - } + x: 'warning', + y: 17188, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'http: headings', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'http: headings', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 144000 + x: 'success', + y: 144000, }, { - 'x': 'info', - 'y': 128235 + x: 'info', + y: 128235, }, { - 'x': 'security', - 'y': 34518 + x: 'security', + y: 34518, }, { - 'x': 'error', - 'y': 10257 + x: 'error', + y: 10257, }, { - 'x': 'warning', - 'y': 17188 - } - ] - } + x: 'warning', + y: 17188, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'success: headings', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'success: headings', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 120689 + x: 'success', + y: 120689, }, { - 'x': 'info', - 'y': 107621 + x: 'info', + y: 107621, }, { - 'x': 'security', - 'y': 28916 + x: 'security', + y: 28916, }, { - 'x': 'error', - 'y': 8590 + x: 'error', + y: 8590, }, { - 'x': 'warning', - 'y': 14548 - } - ] - } + x: 'warning', + y: 14548, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': 'www.slate.com: headings', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'www.slate.com: headings', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 62292 + x: 'success', + y: 62292, }, { - 'x': 'info', - 'y': 55646 + x: 'info', + y: 55646, }, { - 'x': 'security', - 'y': 14823 + x: 'security', + y: 14823, }, { - 'x': 'error', - 'y': 4441 + x: 'error', + y: 4441, }, { - 'x': 'warning', - 'y': 7539 - } - ] - } + x: 'warning', + y: 7539, + }, + ], + }, ], - 'xAxisOrderedValues': ['success', 'info', 'security', 'error', 'warning'], - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['success', 'info', 'security', 'error', 'warning'], + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'hits': 171445 + hits: 171445, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js index 3691d854c6c2a9..36df8e091ba895 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/significant_terms/_series.js @@ -1,49 +1,66 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': 'Top 5 unusual terms in @tags', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '', + xAxisLabel: 'Top 5 unusual terms in @tags', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'success', - 'y': 143995 + x: 'success', + y: 143995, }, { - 'x': 'info', - 'y': 128233 + x: 'info', + y: 128233, }, { - 'x': 'security', - 'y': 34515 + x: 'security', + y: 34515, }, { - 'x': 'error', - 'y': 10256 + x: 'error', + y: 10256, }, { - 'x': 'warning', - 'y': 17188 - } - ] - } + x: 'warning', + y: 17188, + }, + ], + }, ], - 'hits': 171439, - 'xAxisFormatter': function (val) { + hits: 171439, + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js index 228a22ed534d59..a914f20a7ffc6f 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/stacked/_stacked.js @@ -1,16 +1,35 @@ +/* + * 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 moment from 'moment'; export default { - 'label': '', - 'xAxisLabel': '@timestamp per 30 sec', - 'ordered': { - 'date': true, - 'interval': 30000, - 'min': 1416850340336, - 'max': 1416852140336 + label: '', + xAxisLabel: '@timestamp per 30 sec', + ordered: { + date: true, + interval: 30000, + min: 1416850340336, + max: 1416852140336, }, - 'yAxisLabel': 'Count of documents', - 'xAxisOrderedValues': [ + yAxisLabel: 'Count of documents', + xAxisOrderedValues: [ 1416850320000, 1416850350000, 1416850380000, @@ -73,1563 +92,1563 @@ export default { 1416852090000, 1416852120000, ], - 'series': [ + series: [ { - 'label': 'jpg', - 'values': [ + label: 'jpg', + values: [ { - 'x': 1416850320000, - 'y': 110, - 'y0': 0 + x: 1416850320000, + y: 110, + y0: 0, }, { - 'x': 1416850350000, - 'y': 24, - 'y0': 0 + x: 1416850350000, + y: 24, + y0: 0, }, { - 'x': 1416850380000, - 'y': 34, - 'y0': 0 + x: 1416850380000, + y: 34, + y0: 0, }, { - 'x': 1416850410000, - 'y': 21, - 'y0': 0 + x: 1416850410000, + y: 21, + y0: 0, }, { - 'x': 1416850440000, - 'y': 32, - 'y0': 0 + x: 1416850440000, + y: 32, + y0: 0, }, { - 'x': 1416850470000, - 'y': 24, - 'y0': 0 + x: 1416850470000, + y: 24, + y0: 0, }, { - 'x': 1416850500000, - 'y': 16, - 'y0': 0 + x: 1416850500000, + y: 16, + y0: 0, }, { - 'x': 1416850530000, - 'y': 27, - 'y0': 0 + x: 1416850530000, + y: 27, + y0: 0, }, { - 'x': 1416850560000, - 'y': 24, - 'y0': 0 + x: 1416850560000, + y: 24, + y0: 0, }, { - 'x': 1416850590000, - 'y': 38, - 'y0': 0 + x: 1416850590000, + y: 38, + y0: 0, }, { - 'x': 1416850620000, - 'y': 33, - 'y0': 0 + x: 1416850620000, + y: 33, + y0: 0, }, { - 'x': 1416850650000, - 'y': 33, - 'y0': 0 + x: 1416850650000, + y: 33, + y0: 0, }, { - 'x': 1416850680000, - 'y': 31, - 'y0': 0 + x: 1416850680000, + y: 31, + y0: 0, }, { - 'x': 1416850710000, - 'y': 24, - 'y0': 0 + x: 1416850710000, + y: 24, + y0: 0, }, { - 'x': 1416850740000, - 'y': 24, - 'y0': 0 + x: 1416850740000, + y: 24, + y0: 0, }, { - 'x': 1416850770000, - 'y': 38, - 'y0': 0 + x: 1416850770000, + y: 38, + y0: 0, }, { - 'x': 1416850800000, - 'y': 34, - 'y0': 0 + x: 1416850800000, + y: 34, + y0: 0, }, { - 'x': 1416850830000, - 'y': 30, - 'y0': 0 + x: 1416850830000, + y: 30, + y0: 0, }, { - 'x': 1416850860000, - 'y': 38, - 'y0': 0 + x: 1416850860000, + y: 38, + y0: 0, }, { - 'x': 1416850890000, - 'y': 19, - 'y0': 0 + x: 1416850890000, + y: 19, + y0: 0, }, { - 'x': 1416850920000, - 'y': 23, - 'y0': 0 + x: 1416850920000, + y: 23, + y0: 0, }, { - 'x': 1416850950000, - 'y': 33, - 'y0': 0 + x: 1416850950000, + y: 33, + y0: 0, }, { - 'x': 1416850980000, - 'y': 28, - 'y0': 0 + x: 1416850980000, + y: 28, + y0: 0, }, { - 'x': 1416851010000, - 'y': 24, - 'y0': 0 + x: 1416851010000, + y: 24, + y0: 0, }, { - 'x': 1416851040000, - 'y': 22, - 'y0': 0 + x: 1416851040000, + y: 22, + y0: 0, }, { - 'x': 1416851070000, - 'y': 28, - 'y0': 0 + x: 1416851070000, + y: 28, + y0: 0, }, { - 'x': 1416851100000, - 'y': 27, - 'y0': 0 + x: 1416851100000, + y: 27, + y0: 0, }, { - 'x': 1416851130000, - 'y': 32, - 'y0': 0 + x: 1416851130000, + y: 32, + y0: 0, }, { - 'x': 1416851160000, - 'y': 32, - 'y0': 0 + x: 1416851160000, + y: 32, + y0: 0, }, { - 'x': 1416851190000, - 'y': 30, - 'y0': 0 + x: 1416851190000, + y: 30, + y0: 0, }, { - 'x': 1416851220000, - 'y': 32, - 'y0': 0 + x: 1416851220000, + y: 32, + y0: 0, }, { - 'x': 1416851250000, - 'y': 36, - 'y0': 0 + x: 1416851250000, + y: 36, + y0: 0, }, { - 'x': 1416851280000, - 'y': 32, - 'y0': 0 + x: 1416851280000, + y: 32, + y0: 0, }, { - 'x': 1416851310000, - 'y': 29, - 'y0': 0 + x: 1416851310000, + y: 29, + y0: 0, }, { - 'x': 1416851340000, - 'y': 22, - 'y0': 0 + x: 1416851340000, + y: 22, + y0: 0, }, { - 'x': 1416851370000, - 'y': 29, - 'y0': 0 + x: 1416851370000, + y: 29, + y0: 0, }, { - 'x': 1416851400000, - 'y': 33, - 'y0': 0 + x: 1416851400000, + y: 33, + y0: 0, }, { - 'x': 1416851430000, - 'y': 28, - 'y0': 0 + x: 1416851430000, + y: 28, + y0: 0, }, { - 'x': 1416851460000, - 'y': 39, - 'y0': 0 + x: 1416851460000, + y: 39, + y0: 0, }, { - 'x': 1416851490000, - 'y': 28, - 'y0': 0 + x: 1416851490000, + y: 28, + y0: 0, }, { - 'x': 1416851520000, - 'y': 28, - 'y0': 0 + x: 1416851520000, + y: 28, + y0: 0, }, { - 'x': 1416851550000, - 'y': 28, - 'y0': 0 + x: 1416851550000, + y: 28, + y0: 0, }, { - 'x': 1416851580000, - 'y': 30, - 'y0': 0 + x: 1416851580000, + y: 30, + y0: 0, }, { - 'x': 1416851610000, - 'y': 29, - 'y0': 0 + x: 1416851610000, + y: 29, + y0: 0, }, { - 'x': 1416851640000, - 'y': 30, - 'y0': 0 + x: 1416851640000, + y: 30, + y0: 0, }, { - 'x': 1416851670000, - 'y': 23, - 'y0': 0 + x: 1416851670000, + y: 23, + y0: 0, }, { - 'x': 1416851700000, - 'y': 23, - 'y0': 0 + x: 1416851700000, + y: 23, + y0: 0, }, { - 'x': 1416851730000, - 'y': 27, - 'y0': 0 + x: 1416851730000, + y: 27, + y0: 0, }, { - 'x': 1416851760000, - 'y': 21, - 'y0': 0 + x: 1416851760000, + y: 21, + y0: 0, }, { - 'x': 1416851790000, - 'y': 24, - 'y0': 0 + x: 1416851790000, + y: 24, + y0: 0, }, { - 'x': 1416851820000, - 'y': 26, - 'y0': 0 + x: 1416851820000, + y: 26, + y0: 0, }, { - 'x': 1416851850000, - 'y': 26, - 'y0': 0 + x: 1416851850000, + y: 26, + y0: 0, }, { - 'x': 1416851880000, - 'y': 21, - 'y0': 0 + x: 1416851880000, + y: 21, + y0: 0, }, { - 'x': 1416851910000, - 'y': 33, - 'y0': 0 + x: 1416851910000, + y: 33, + y0: 0, }, { - 'x': 1416851940000, - 'y': 23, - 'y0': 0 + x: 1416851940000, + y: 23, + y0: 0, }, { - 'x': 1416851970000, - 'y': 46, - 'y0': 0 + x: 1416851970000, + y: 46, + y0: 0, }, { - 'x': 1416852000000, - 'y': 27, - 'y0': 0 + x: 1416852000000, + y: 27, + y0: 0, }, { - 'x': 1416852030000, - 'y': 20, - 'y0': 0 + x: 1416852030000, + y: 20, + y0: 0, }, { - 'x': 1416852060000, - 'y': 34, - 'y0': 0 + x: 1416852060000, + y: 34, + y0: 0, }, { - 'x': 1416852090000, - 'y': 15, - 'y0': 0 + x: 1416852090000, + y: 15, + y0: 0, }, { - 'x': 1416852120000, - 'y': 18, - 'y0': 0 - } - ] + x: 1416852120000, + y: 18, + y0: 0, + }, + ], }, { - 'label': 'css', - 'values': [ + label: 'css', + values: [ { - 'x': 1416850320000, - 'y': 3, - 'y0': 11 + x: 1416850320000, + y: 3, + y0: 11, }, { - 'x': 1416850350000, - 'y': 13, - 'y0': 24 + x: 1416850350000, + y: 13, + y0: 24, }, { - 'x': 1416850380000, - 'y': 5, - 'y0': 34 + x: 1416850380000, + y: 5, + y0: 34, }, { - 'x': 1416850410000, - 'y': 12, - 'y0': 21 + x: 1416850410000, + y: 12, + y0: 21, }, { - 'x': 1416850440000, - 'y': 9, - 'y0': 32 + x: 1416850440000, + y: 9, + y0: 32, }, { - 'x': 1416850470000, - 'y': 12, - 'y0': 24 + x: 1416850470000, + y: 12, + y0: 24, }, { - 'x': 1416850500000, - 'y': 6, - 'y0': 16 + x: 1416850500000, + y: 6, + y0: 16, }, { - 'x': 1416850530000, - 'y': 6, - 'y0': 27 + x: 1416850530000, + y: 6, + y0: 27, }, { - 'x': 1416850560000, - 'y': 11, - 'y0': 24 + x: 1416850560000, + y: 11, + y0: 24, }, { - 'x': 1416850590000, - 'y': 11, - 'y0': 38 + x: 1416850590000, + y: 11, + y0: 38, }, { - 'x': 1416850620000, - 'y': 6, - 'y0': 33 + x: 1416850620000, + y: 6, + y0: 33, }, { - 'x': 1416850650000, - 'y': 8, - 'y0': 33 + x: 1416850650000, + y: 8, + y0: 33, }, { - 'x': 1416850680000, - 'y': 6, - 'y0': 31 + x: 1416850680000, + y: 6, + y0: 31, }, { - 'x': 1416850710000, - 'y': 4, - 'y0': 24 + x: 1416850710000, + y: 4, + y0: 24, }, { - 'x': 1416850740000, - 'y': 9, - 'y0': 24 + x: 1416850740000, + y: 9, + y0: 24, }, { - 'x': 1416850770000, - 'y': 3, - 'y0': 38 + x: 1416850770000, + y: 3, + y0: 38, }, { - 'x': 1416850800000, - 'y': 5, - 'y0': 34 + x: 1416850800000, + y: 5, + y0: 34, }, { - 'x': 1416850830000, - 'y': 6, - 'y0': 30 + x: 1416850830000, + y: 6, + y0: 30, }, { - 'x': 1416850860000, - 'y': 9, - 'y0': 38 + x: 1416850860000, + y: 9, + y0: 38, }, { - 'x': 1416850890000, - 'y': 5, - 'y0': 19 + x: 1416850890000, + y: 5, + y0: 19, }, { - 'x': 1416850920000, - 'y': 8, - 'y0': 23 + x: 1416850920000, + y: 8, + y0: 23, }, { - 'x': 1416850950000, - 'y': 9, - 'y0': 33 + x: 1416850950000, + y: 9, + y0: 33, }, { - 'x': 1416850980000, - 'y': 5, - 'y0': 28 + x: 1416850980000, + y: 5, + y0: 28, }, { - 'x': 1416851010000, - 'y': 6, - 'y0': 24 + x: 1416851010000, + y: 6, + y0: 24, }, { - 'x': 1416851040000, - 'y': 9, - 'y0': 22 + x: 1416851040000, + y: 9, + y0: 22, }, { - 'x': 1416851070000, - 'y': 9, - 'y0': 28 + x: 1416851070000, + y: 9, + y0: 28, }, { - 'x': 1416851100000, - 'y': 11, - 'y0': 27 + x: 1416851100000, + y: 11, + y0: 27, }, { - 'x': 1416851130000, - 'y': 5, - 'y0': 32 + x: 1416851130000, + y: 5, + y0: 32, }, { - 'x': 1416851160000, - 'y': 8, - 'y0': 32 + x: 1416851160000, + y: 8, + y0: 32, }, { - 'x': 1416851190000, - 'y': 6, - 'y0': 30 + x: 1416851190000, + y: 6, + y0: 30, }, { - 'x': 1416851220000, - 'y': 10, - 'y0': 32 + x: 1416851220000, + y: 10, + y0: 32, }, { - 'x': 1416851250000, - 'y': 5, - 'y0': 36 + x: 1416851250000, + y: 5, + y0: 36, }, { - 'x': 1416851280000, - 'y': 6, - 'y0': 32 + x: 1416851280000, + y: 6, + y0: 32, }, { - 'x': 1416851310000, - 'y': 4, - 'y0': 29 + x: 1416851310000, + y: 4, + y0: 29, }, { - 'x': 1416851340000, - 'y': 8, - 'y0': 22 + x: 1416851340000, + y: 8, + y0: 22, }, { - 'x': 1416851370000, - 'y': 3, - 'y0': 29 + x: 1416851370000, + y: 3, + y0: 29, }, { - 'x': 1416851400000, - 'y': 8, - 'y0': 33 + x: 1416851400000, + y: 8, + y0: 33, }, { - 'x': 1416851430000, - 'y': 10, - 'y0': 28 + x: 1416851430000, + y: 10, + y0: 28, }, { - 'x': 1416851460000, - 'y': 5, - 'y0': 39 + x: 1416851460000, + y: 5, + y0: 39, }, { - 'x': 1416851490000, - 'y': 7, - 'y0': 28 + x: 1416851490000, + y: 7, + y0: 28, }, { - 'x': 1416851520000, - 'y': 6, - 'y0': 28 + x: 1416851520000, + y: 6, + y0: 28, }, { - 'x': 1416851550000, - 'y': 4, - 'y0': 28 + x: 1416851550000, + y: 4, + y0: 28, }, { - 'x': 1416851580000, - 'y': 9, - 'y0': 30 + x: 1416851580000, + y: 9, + y0: 30, }, { - 'x': 1416851610000, - 'y': 3, - 'y0': 29 + x: 1416851610000, + y: 3, + y0: 29, }, { - 'x': 1416851640000, - 'y': 9, - 'y0': 30 + x: 1416851640000, + y: 9, + y0: 30, }, { - 'x': 1416851670000, - 'y': 6, - 'y0': 23 + x: 1416851670000, + y: 6, + y0: 23, }, { - 'x': 1416851700000, - 'y': 11, - 'y0': 23 + x: 1416851700000, + y: 11, + y0: 23, }, { - 'x': 1416851730000, - 'y': 4, - 'y0': 27 + x: 1416851730000, + y: 4, + y0: 27, }, { - 'x': 1416851760000, - 'y': 8, - 'y0': 21 + x: 1416851760000, + y: 8, + y0: 21, }, { - 'x': 1416851790000, - 'y': 5, - 'y0': 24 + x: 1416851790000, + y: 5, + y0: 24, }, { - 'x': 1416851820000, - 'y': 7, - 'y0': 26 + x: 1416851820000, + y: 7, + y0: 26, }, { - 'x': 1416851850000, - 'y': 7, - 'y0': 26 + x: 1416851850000, + y: 7, + y0: 26, }, { - 'x': 1416851880000, - 'y': 4, - 'y0': 21 + x: 1416851880000, + y: 4, + y0: 21, }, { - 'x': 1416851910000, - 'y': 8, - 'y0': 33 + x: 1416851910000, + y: 8, + y0: 33, }, { - 'x': 1416851940000, - 'y': 6, - 'y0': 23 + x: 1416851940000, + y: 6, + y0: 23, }, { - 'x': 1416851970000, - 'y': 6, - 'y0': 46 + x: 1416851970000, + y: 6, + y0: 46, }, { - 'x': 1416852000000, - 'y': 3, - 'y0': 27 + x: 1416852000000, + y: 3, + y0: 27, }, { - 'x': 1416852030000, - 'y': 6, - 'y0': 20 + x: 1416852030000, + y: 6, + y0: 20, }, { - 'x': 1416852060000, - 'y': 5, - 'y0': 34 + x: 1416852060000, + y: 5, + y0: 34, }, { - 'x': 1416852090000, - 'y': 5, - 'y0': 15 + x: 1416852090000, + y: 5, + y0: 15, }, { - 'x': 1416852120000, - 'y': 1, - 'y0': 18 - } - ] + x: 1416852120000, + y: 1, + y0: 18, + }, + ], }, { - 'label': 'gif', - 'values': [ + label: 'gif', + values: [ { - 'x': 1416850320000, - 'y': 1, - 'y0': 14 + x: 1416850320000, + y: 1, + y0: 14, }, { - 'x': 1416850350000, - 'y': 2, - 'y0': 37 + x: 1416850350000, + y: 2, + y0: 37, }, { - 'x': 1416850380000, - 'y': 4, - 'y0': 39 + x: 1416850380000, + y: 4, + y0: 39, }, { - 'x': 1416850410000, - 'y': 2, - 'y0': 33 + x: 1416850410000, + y: 2, + y0: 33, }, { - 'x': 1416850440000, - 'y': 3, - 'y0': 41 + x: 1416850440000, + y: 3, + y0: 41, }, { - 'x': 1416850470000, - 'y': 1, - 'y0': 36 + x: 1416850470000, + y: 1, + y0: 36, }, { - 'x': 1416850500000, - 'y': 1, - 'y0': 22 + x: 1416850500000, + y: 1, + y0: 22, }, { - 'x': 1416850530000, - 'y': 1, - 'y0': 33 + x: 1416850530000, + y: 1, + y0: 33, }, { - 'x': 1416850560000, - 'y': 2, - 'y0': 35 + x: 1416850560000, + y: 2, + y0: 35, }, { - 'x': 1416850590000, - 'y': 5, - 'y0': 49 + x: 1416850590000, + y: 5, + y0: 49, }, { - 'x': 1416850620000, - 'y': 1, - 'y0': 39 + x: 1416850620000, + y: 1, + y0: 39, }, { - 'x': 1416850650000, - 'y': 1, - 'y0': 41 + x: 1416850650000, + y: 1, + y0: 41, }, { - 'x': 1416850680000, - 'y': 4, - 'y0': 37 + x: 1416850680000, + y: 4, + y0: 37, }, { - 'x': 1416850710000, - 'y': 1, - 'y0': 28 + x: 1416850710000, + y: 1, + y0: 28, }, { - 'x': 1416850740000, - 'y': 3, - 'y0': 33 + x: 1416850740000, + y: 3, + y0: 33, }, { - 'x': 1416850770000, - 'y': 2, - 'y0': 41 + x: 1416850770000, + y: 2, + y0: 41, }, { - 'x': 1416850800000, - 'y': 2, - 'y0': 39 + x: 1416850800000, + y: 2, + y0: 39, }, { - 'x': 1416850830000, - 'y': 5, - 'y0': 36 + x: 1416850830000, + y: 5, + y0: 36, }, { - 'x': 1416850860000, - 'y': 3, - 'y0': 47 + x: 1416850860000, + y: 3, + y0: 47, }, { - 'x': 1416850890000, - 'y': 1, - 'y0': 24 + x: 1416850890000, + y: 1, + y0: 24, }, { - 'x': 1416850920000, - 'y': 3, - 'y0': 31 + x: 1416850920000, + y: 3, + y0: 31, }, { - 'x': 1416850950000, - 'y': 4, - 'y0': 42 + x: 1416850950000, + y: 4, + y0: 42, }, { - 'x': 1416850980000, - 'y': 3, - 'y0': 33 + x: 1416850980000, + y: 3, + y0: 33, }, { - 'x': 1416851010000, - 'y': 5, - 'y0': 30 + x: 1416851010000, + y: 5, + y0: 30, }, { - 'x': 1416851040000, - 'y': 2, - 'y0': 31 + x: 1416851040000, + y: 2, + y0: 31, }, { - 'x': 1416851070000, - 'y': 3, - 'y0': 37 + x: 1416851070000, + y: 3, + y0: 37, }, { - 'x': 1416851100000, - 'y': 5, - 'y0': 38 + x: 1416851100000, + y: 5, + y0: 38, }, { - 'x': 1416851130000, - 'y': 3, - 'y0': 37 + x: 1416851130000, + y: 3, + y0: 37, }, { - 'x': 1416851160000, - 'y': 4, - 'y0': 40 + x: 1416851160000, + y: 4, + y0: 40, }, { - 'x': 1416851190000, - 'y': 9, - 'y0': 36 + x: 1416851190000, + y: 9, + y0: 36, }, { - 'x': 1416851220000, - 'y': 7, - 'y0': 42 + x: 1416851220000, + y: 7, + y0: 42, }, { - 'x': 1416851250000, - 'y': 2, - 'y0': 41 + x: 1416851250000, + y: 2, + y0: 41, }, { - 'x': 1416851280000, - 'y': 1, - 'y0': 38 + x: 1416851280000, + y: 1, + y0: 38, }, { - 'x': 1416851310000, - 'y': 2, - 'y0': 33 + x: 1416851310000, + y: 2, + y0: 33, }, { - 'x': 1416851340000, - 'y': 5, - 'y0': 30 + x: 1416851340000, + y: 5, + y0: 30, }, { - 'x': 1416851370000, - 'y': 3, - 'y0': 32 + x: 1416851370000, + y: 3, + y0: 32, }, { - 'x': 1416851400000, - 'y': 5, - 'y0': 41 + x: 1416851400000, + y: 5, + y0: 41, }, { - 'x': 1416851430000, - 'y': 4, - 'y0': 38 + x: 1416851430000, + y: 4, + y0: 38, }, { - 'x': 1416851460000, - 'y': 5, - 'y0': 44 + x: 1416851460000, + y: 5, + y0: 44, }, { - 'x': 1416851490000, - 'y': 2, - 'y0': 35 + x: 1416851490000, + y: 2, + y0: 35, }, { - 'x': 1416851520000, - 'y': 2, - 'y0': 34 + x: 1416851520000, + y: 2, + y0: 34, }, { - 'x': 1416851550000, - 'y': 4, - 'y0': 32 + x: 1416851550000, + y: 4, + y0: 32, }, { - 'x': 1416851580000, - 'y': 3, - 'y0': 39 + x: 1416851580000, + y: 3, + y0: 39, }, { - 'x': 1416851610000, - 'y': 4, - 'y0': 32 + x: 1416851610000, + y: 4, + y0: 32, }, { - 'x': 1416851640000, - 'y': 0, - 'y0': 39 + x: 1416851640000, + y: 0, + y0: 39, }, { - 'x': 1416851670000, - 'y': 2, - 'y0': 29 + x: 1416851670000, + y: 2, + y0: 29, }, { - 'x': 1416851700000, - 'y': 1, - 'y0': 34 + x: 1416851700000, + y: 1, + y0: 34, }, { - 'x': 1416851730000, - 'y': 3, - 'y0': 31 + x: 1416851730000, + y: 3, + y0: 31, }, { - 'x': 1416851760000, - 'y': 0, - 'y0': 29 + x: 1416851760000, + y: 0, + y0: 29, }, { - 'x': 1416851790000, - 'y': 4, - 'y0': 29 + x: 1416851790000, + y: 4, + y0: 29, }, { - 'x': 1416851820000, - 'y': 3, - 'y0': 33 + x: 1416851820000, + y: 3, + y0: 33, }, { - 'x': 1416851850000, - 'y': 3, - 'y0': 33 + x: 1416851850000, + y: 3, + y0: 33, }, { - 'x': 1416851880000, - 'y': 0, - 'y0': 25 + x: 1416851880000, + y: 0, + y0: 25, }, { - 'x': 1416851910000, - 'y': 0, - 'y0': 41 + x: 1416851910000, + y: 0, + y0: 41, }, { - 'x': 1416851940000, - 'y': 3, - 'y0': 29 + x: 1416851940000, + y: 3, + y0: 29, }, { - 'x': 1416851970000, - 'y': 3, - 'y0': 52 + x: 1416851970000, + y: 3, + y0: 52, }, { - 'x': 1416852000000, - 'y': 1, - 'y0': 30 + x: 1416852000000, + y: 1, + y0: 30, }, { - 'x': 1416852030000, - 'y': 5, - 'y0': 26 + x: 1416852030000, + y: 5, + y0: 26, }, { - 'x': 1416852060000, - 'y': 3, - 'y0': 39 + x: 1416852060000, + y: 3, + y0: 39, }, { - 'x': 1416852090000, - 'y': 1, - 'y0': 20 + x: 1416852090000, + y: 1, + y0: 20, }, { - 'x': 1416852120000, - 'y': 2, - 'y0': 19 - } - ] + x: 1416852120000, + y: 2, + y0: 19, + }, + ], }, { - 'label': 'png', - 'values': [ + label: 'png', + values: [ { - 'x': 1416850320000, - 'y': 1, - 'y0': 15 + x: 1416850320000, + y: 1, + y0: 15, }, { - 'x': 1416850350000, - 'y': 6, - 'y0': 39 + x: 1416850350000, + y: 6, + y0: 39, }, { - 'x': 1416850380000, - 'y': 6, - 'y0': 43 + x: 1416850380000, + y: 6, + y0: 43, }, { - 'x': 1416850410000, - 'y': 5, - 'y0': 35 + x: 1416850410000, + y: 5, + y0: 35, }, { - 'x': 1416850440000, - 'y': 3, - 'y0': 44 + x: 1416850440000, + y: 3, + y0: 44, }, { - 'x': 1416850470000, - 'y': 5, - 'y0': 37 + x: 1416850470000, + y: 5, + y0: 37, }, { - 'x': 1416850500000, - 'y': 6, - 'y0': 23 + x: 1416850500000, + y: 6, + y0: 23, }, { - 'x': 1416850530000, - 'y': 1, - 'y0': 34 + x: 1416850530000, + y: 1, + y0: 34, }, { - 'x': 1416850560000, - 'y': 3, - 'y0': 37 + x: 1416850560000, + y: 3, + y0: 37, }, { - 'x': 1416850590000, - 'y': 2, - 'y0': 54 + x: 1416850590000, + y: 2, + y0: 54, }, { - 'x': 1416850620000, - 'y': 1, - 'y0': 40 + x: 1416850620000, + y: 1, + y0: 40, }, { - 'x': 1416850650000, - 'y': 1, - 'y0': 42 + x: 1416850650000, + y: 1, + y0: 42, }, { - 'x': 1416850680000, - 'y': 2, - 'y0': 41 + x: 1416850680000, + y: 2, + y0: 41, }, { - 'x': 1416850710000, - 'y': 5, - 'y0': 29 + x: 1416850710000, + y: 5, + y0: 29, }, { - 'x': 1416850740000, - 'y': 7, - 'y0': 36 + x: 1416850740000, + y: 7, + y0: 36, }, { - 'x': 1416850770000, - 'y': 2, - 'y0': 43 + x: 1416850770000, + y: 2, + y0: 43, }, { - 'x': 1416850800000, - 'y': 3, - 'y0': 41 + x: 1416850800000, + y: 3, + y0: 41, }, { - 'x': 1416850830000, - 'y': 6, - 'y0': 41 + x: 1416850830000, + y: 6, + y0: 41, }, { - 'x': 1416850860000, - 'y': 2, - 'y0': 50 + x: 1416850860000, + y: 2, + y0: 50, }, { - 'x': 1416850890000, - 'y': 4, - 'y0': 25 + x: 1416850890000, + y: 4, + y0: 25, }, { - 'x': 1416850920000, - 'y': 2, - 'y0': 34 + x: 1416850920000, + y: 2, + y0: 34, }, { - 'x': 1416850950000, - 'y': 3, - 'y0': 46 + x: 1416850950000, + y: 3, + y0: 46, }, { - 'x': 1416850980000, - 'y': 8, - 'y0': 36 + x: 1416850980000, + y: 8, + y0: 36, }, { - 'x': 1416851010000, - 'y': 4, - 'y0': 35 + x: 1416851010000, + y: 4, + y0: 35, }, { - 'x': 1416851040000, - 'y': 4, - 'y0': 33 + x: 1416851040000, + y: 4, + y0: 33, }, { - 'x': 1416851070000, - 'y': 1, - 'y0': 40 + x: 1416851070000, + y: 1, + y0: 40, }, { - 'x': 1416851100000, - 'y': 2, - 'y0': 43 + x: 1416851100000, + y: 2, + y0: 43, }, { - 'x': 1416851130000, - 'y': 4, - 'y0': 40 + x: 1416851130000, + y: 4, + y0: 40, }, { - 'x': 1416851160000, - 'y': 3, - 'y0': 44 + x: 1416851160000, + y: 3, + y0: 44, }, { - 'x': 1416851190000, - 'y': 4, - 'y0': 45 + x: 1416851190000, + y: 4, + y0: 45, }, { - 'x': 1416851220000, - 'y': 2, - 'y0': 49 + x: 1416851220000, + y: 2, + y0: 49, }, { - 'x': 1416851250000, - 'y': 4, - 'y0': 43 + x: 1416851250000, + y: 4, + y0: 43, }, { - 'x': 1416851280000, - 'y': 8, - 'y0': 39 + x: 1416851280000, + y: 8, + y0: 39, }, { - 'x': 1416851310000, - 'y': 4, - 'y0': 35 + x: 1416851310000, + y: 4, + y0: 35, }, { - 'x': 1416851340000, - 'y': 4, - 'y0': 35 + x: 1416851340000, + y: 4, + y0: 35, }, { - 'x': 1416851370000, - 'y': 7, - 'y0': 35 + x: 1416851370000, + y: 7, + y0: 35, }, { - 'x': 1416851400000, - 'y': 2, - 'y0': 46 + x: 1416851400000, + y: 2, + y0: 46, }, { - 'x': 1416851430000, - 'y': 3, - 'y0': 42 + x: 1416851430000, + y: 3, + y0: 42, }, { - 'x': 1416851460000, - 'y': 3, - 'y0': 49 + x: 1416851460000, + y: 3, + y0: 49, }, { - 'x': 1416851490000, - 'y': 3, - 'y0': 37 + x: 1416851490000, + y: 3, + y0: 37, }, { - 'x': 1416851520000, - 'y': 4, - 'y0': 36 + x: 1416851520000, + y: 4, + y0: 36, }, { - 'x': 1416851550000, - 'y': 3, - 'y0': 36 + x: 1416851550000, + y: 3, + y0: 36, }, { - 'x': 1416851580000, - 'y': 4, - 'y0': 42 + x: 1416851580000, + y: 4, + y0: 42, }, { - 'x': 1416851610000, - 'y': 5, - 'y0': 36 + x: 1416851610000, + y: 5, + y0: 36, }, { - 'x': 1416851640000, - 'y': 3, - 'y0': 39 + x: 1416851640000, + y: 3, + y0: 39, }, { - 'x': 1416851670000, - 'y': 3, - 'y0': 31 + x: 1416851670000, + y: 3, + y0: 31, }, { - 'x': 1416851700000, - 'y': 2, - 'y0': 35 + x: 1416851700000, + y: 2, + y0: 35, }, { - 'x': 1416851730000, - 'y': 5, - 'y0': 34 + x: 1416851730000, + y: 5, + y0: 34, }, { - 'x': 1416851760000, - 'y': 4, - 'y0': 29 + x: 1416851760000, + y: 4, + y0: 29, }, { - 'x': 1416851790000, - 'y': 5, - 'y0': 33 + x: 1416851790000, + y: 5, + y0: 33, }, { - 'x': 1416851820000, - 'y': 1, - 'y0': 36 + x: 1416851820000, + y: 1, + y0: 36, }, { - 'x': 1416851850000, - 'y': 3, - 'y0': 36 + x: 1416851850000, + y: 3, + y0: 36, }, { - 'x': 1416851880000, - 'y': 6, - 'y0': 25 + x: 1416851880000, + y: 6, + y0: 25, }, { - 'x': 1416851910000, - 'y': 4, - 'y0': 41 + x: 1416851910000, + y: 4, + y0: 41, }, { - 'x': 1416851940000, - 'y': 7, - 'y0': 32 + x: 1416851940000, + y: 7, + y0: 32, }, { - 'x': 1416851970000, - 'y': 5, - 'y0': 55 + x: 1416851970000, + y: 5, + y0: 55, }, { - 'x': 1416852000000, - 'y': 2, - 'y0': 31 + x: 1416852000000, + y: 2, + y0: 31, }, { - 'x': 1416852030000, - 'y': 2, - 'y0': 31 + x: 1416852030000, + y: 2, + y0: 31, }, { - 'x': 1416852060000, - 'y': 4, - 'y0': 42 + x: 1416852060000, + y: 4, + y0: 42, }, { - 'x': 1416852090000, - 'y': 6, - 'y0': 21 + x: 1416852090000, + y: 6, + y0: 21, }, { - 'x': 1416852120000, - 'y': 2, - 'y0': 21 - } - ] + x: 1416852120000, + y: 2, + y0: 21, + }, + ], }, { - 'label': 'php', - 'values': [ + label: 'php', + values: [ { - 'x': 1416850320000, - 'y': 0, - 'y0': 16 + x: 1416850320000, + y: 0, + y0: 16, }, { - 'x': 1416850350000, - 'y': 1, - 'y0': 45 + x: 1416850350000, + y: 1, + y0: 45, }, { - 'x': 1416850380000, - 'y': 0, - 'y0': 49 + x: 1416850380000, + y: 0, + y0: 49, }, { - 'x': 1416850410000, - 'y': 2, - 'y0': 40 + x: 1416850410000, + y: 2, + y0: 40, }, { - 'x': 1416850440000, - 'y': 0, - 'y0': 47 + x: 1416850440000, + y: 0, + y0: 47, }, { - 'x': 1416850470000, - 'y': 0, - 'y0': 42 + x: 1416850470000, + y: 0, + y0: 42, }, { - 'x': 1416850500000, - 'y': 3, - 'y0': 29 + x: 1416850500000, + y: 3, + y0: 29, }, { - 'x': 1416850530000, - 'y': 1, - 'y0': 35 + x: 1416850530000, + y: 1, + y0: 35, }, { - 'x': 1416850560000, - 'y': 3, - 'y0': 40 + x: 1416850560000, + y: 3, + y0: 40, }, { - 'x': 1416850590000, - 'y': 2, - 'y0': 56 + x: 1416850590000, + y: 2, + y0: 56, }, { - 'x': 1416850620000, - 'y': 2, - 'y0': 41 + x: 1416850620000, + y: 2, + y0: 41, }, { - 'x': 1416850650000, - 'y': 5, - 'y0': 43 + x: 1416850650000, + y: 5, + y0: 43, }, { - 'x': 1416850680000, - 'y': 2, - 'y0': 43 + x: 1416850680000, + y: 2, + y0: 43, }, { - 'x': 1416850710000, - 'y': 1, - 'y0': 34 + x: 1416850710000, + y: 1, + y0: 34, }, { - 'x': 1416850740000, - 'y': 2, - 'y0': 43 + x: 1416850740000, + y: 2, + y0: 43, }, { - 'x': 1416850770000, - 'y': 2, - 'y0': 45 + x: 1416850770000, + y: 2, + y0: 45, }, { - 'x': 1416850800000, - 'y': 1, - 'y0': 44 + x: 1416850800000, + y: 1, + y0: 44, }, { - 'x': 1416850830000, - 'y': 1, - 'y0': 47 + x: 1416850830000, + y: 1, + y0: 47, }, { - 'x': 1416850860000, - 'y': 1, - 'y0': 52 + x: 1416850860000, + y: 1, + y0: 52, }, { - 'x': 1416850890000, - 'y': 1, - 'y0': 29 + x: 1416850890000, + y: 1, + y0: 29, }, { - 'x': 1416850920000, - 'y': 2, - 'y0': 36 + x: 1416850920000, + y: 2, + y0: 36, }, { - 'x': 1416850950000, - 'y': 2, - 'y0': 49 + x: 1416850950000, + y: 2, + y0: 49, }, { - 'x': 1416850980000, - 'y': 0, - 'y0': 44 + x: 1416850980000, + y: 0, + y0: 44, }, { - 'x': 1416851010000, - 'y': 3, - 'y0': 39 + x: 1416851010000, + y: 3, + y0: 39, }, { - 'x': 1416851040000, - 'y': 2, - 'y0': 37 + x: 1416851040000, + y: 2, + y0: 37, }, { - 'x': 1416851070000, - 'y': 2, - 'y0': 41 + x: 1416851070000, + y: 2, + y0: 41, }, { - 'x': 1416851100000, - 'y': 2, - 'y0': 45 + x: 1416851100000, + y: 2, + y0: 45, }, { - 'x': 1416851130000, - 'y': 0, - 'y0': 44 + x: 1416851130000, + y: 0, + y0: 44, }, { - 'x': 1416851160000, - 'y': 1, - 'y0': 47 + x: 1416851160000, + y: 1, + y0: 47, }, { - 'x': 1416851190000, - 'y': 2, - 'y0': 49 + x: 1416851190000, + y: 2, + y0: 49, }, { - 'x': 1416851220000, - 'y': 4, - 'y0': 51 + x: 1416851220000, + y: 4, + y0: 51, }, { - 'x': 1416851250000, - 'y': 0, - 'y0': 47 + x: 1416851250000, + y: 0, + y0: 47, }, { - 'x': 1416851280000, - 'y': 3, - 'y0': 47 + x: 1416851280000, + y: 3, + y0: 47, }, { - 'x': 1416851310000, - 'y': 3, - 'y0': 39 + x: 1416851310000, + y: 3, + y0: 39, }, { - 'x': 1416851340000, - 'y': 2, - 'y0': 39 + x: 1416851340000, + y: 2, + y0: 39, }, { - 'x': 1416851370000, - 'y': 2, - 'y0': 42 + x: 1416851370000, + y: 2, + y0: 42, }, { - 'x': 1416851400000, - 'y': 3, - 'y0': 48 + x: 1416851400000, + y: 3, + y0: 48, }, { - 'x': 1416851430000, - 'y': 1, - 'y0': 45 + x: 1416851430000, + y: 1, + y0: 45, }, { - 'x': 1416851460000, - 'y': 0, - 'y0': 52 + x: 1416851460000, + y: 0, + y0: 52, }, { - 'x': 1416851490000, - 'y': 2, - 'y0': 40 + x: 1416851490000, + y: 2, + y0: 40, }, { - 'x': 1416851520000, - 'y': 1, - 'y0': 40 + x: 1416851520000, + y: 1, + y0: 40, }, { - 'x': 1416851550000, - 'y': 3, - 'y0': 39 + x: 1416851550000, + y: 3, + y0: 39, }, { - 'x': 1416851580000, - 'y': 1, - 'y0': 46 + x: 1416851580000, + y: 1, + y0: 46, }, { - 'x': 1416851610000, - 'y': 2, - 'y0': 41 + x: 1416851610000, + y: 2, + y0: 41, }, { - 'x': 1416851640000, - 'y': 1, - 'y0': 42 + x: 1416851640000, + y: 1, + y0: 42, }, { - 'x': 1416851670000, - 'y': 2, - 'y0': 34 + x: 1416851670000, + y: 2, + y0: 34, }, { - 'x': 1416851700000, - 'y': 3, - 'y0': 37 + x: 1416851700000, + y: 3, + y0: 37, }, { - 'x': 1416851730000, - 'y': 1, - 'y0': 39 + x: 1416851730000, + y: 1, + y0: 39, }, { - 'x': 1416851760000, - 'y': 1, - 'y0': 33 + x: 1416851760000, + y: 1, + y0: 33, }, { - 'x': 1416851790000, - 'y': 1, - 'y0': 38 + x: 1416851790000, + y: 1, + y0: 38, }, { - 'x': 1416851820000, - 'y': 1, - 'y0': 37 + x: 1416851820000, + y: 1, + y0: 37, }, { - 'x': 1416851850000, - 'y': 1, - 'y0': 39 + x: 1416851850000, + y: 1, + y0: 39, }, { - 'x': 1416851880000, - 'y': 1, - 'y0': 31 + x: 1416851880000, + y: 1, + y0: 31, }, { - 'x': 1416851910000, - 'y': 2, - 'y0': 45 + x: 1416851910000, + y: 2, + y0: 45, }, { - 'x': 1416851940000, - 'y': 0, - 'y0': 39 + x: 1416851940000, + y: 0, + y0: 39, }, { - 'x': 1416851970000, - 'y': 0, - 'y0': 60 + x: 1416851970000, + y: 0, + y0: 60, }, { - 'x': 1416852000000, - 'y': 1, - 'y0': 33 + x: 1416852000000, + y: 1, + y0: 33, }, { - 'x': 1416852030000, - 'y': 2, - 'y0': 33 + x: 1416852030000, + y: 2, + y0: 33, }, { - 'x': 1416852060000, - 'y': 1, - 'y0': 46 + x: 1416852060000, + y: 1, + y0: 46, }, { - 'x': 1416852090000, - 'y': 1, - 'y0': 27 + x: 1416852090000, + y: 1, + y0: 27, }, { - 'x': 1416852120000, - 'y': 0, - 'y0': 23 - } - ] - } + x: 1416852120000, + y: 0, + y0: 23, + }, + ], + }, ], - 'hits': 2595, - 'xAxisFormatter': function (thing) { + hits: 2595, + xAxisFormatter: function(thing) { return moment(thing); }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js index 4683640725f2a8..8891d9badb2be3 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns.js @@ -1,146 +1,159 @@ +/* + * 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 default { - 'columns': [ + columns: [ { - 'label': 'logstash: index', - 'xAxisLabel': 'Top 5 extension', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: 'logstash: index', + xAxisLabel: 'Top 5 extension', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 110710 + x: 'jpg', + y: 110710, }, { - 'x': 'css', - 'y': 27376 + x: 'css', + y: 27376, }, { - 'x': 'png', - 'y': 16664 + x: 'png', + y: 16664, }, { - 'x': 'gif', - 'y': 11264 + x: 'gif', + y: 11264, }, { - 'x': 'php', - 'y': 5448 - } - ] - } + x: 'php', + y: 5448, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '2014.11.12: index', - 'xAxisLabel': 'Top 5 extension', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '2014.11.12: index', + xAxisLabel: 'Top 5 extension', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 110643 + x: 'jpg', + y: 110643, }, { - 'x': 'css', - 'y': 27350 + x: 'css', + y: 27350, }, { - 'x': 'png', - 'y': 16648 + x: 'png', + y: 16648, }, { - 'x': 'gif', - 'y': 11257 + x: 'gif', + y: 11257, }, { - 'x': 'php', - 'y': 5440 - } - ] - } + x: 'php', + y: 5440, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '2014.11.11: index', - 'xAxisLabel': 'Top 5 extension', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '2014.11.11: index', + xAxisLabel: 'Top 5 extension', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 67 + x: 'jpg', + y: 67, }, { - 'x': 'css', - 'y': 26 + x: 'css', + y: 26, }, { - 'x': 'png', - 'y': 16 + x: 'png', + y: 16, }, { - 'x': 'gif', - 'y': 7 + x: 'gif', + y: 7, }, { - 'x': 'php', - 'y': 8 - } - ] - } + x: 'php', + y: 8, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'xAxisOrderedValues': ['jpg', 'css', 'png', 'gif', 'php'], - 'hits': 171462 + xAxisOrderedValues: ['jpg', 'css', 'png', 'gif', 'php'], + hits: 171462, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js index 2b4ee83eca44c7..09a1c159897603 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_rows.js @@ -1,100 +1,115 @@ +/* + * 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 default { - 'rows': [ + rows: [ { - 'label': '0.0-1000.0: bytes', - 'xAxisLabel': 'Top 5 extension', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '0.0-1000.0: bytes', + xAxisLabel: 'Top 5 extension', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 3378 + x: 'jpg', + y: 3378, }, { - 'x': 'css', - 'y': 762 + x: 'css', + y: 762, }, { - 'x': 'png', - 'y': 527 + x: 'png', + y: 527, }, { - 'x': 'gif', - 'y': 11258 + x: 'gif', + y: 11258, }, { - 'x': 'php', - 'y': 653 - } - ] - } + x: 'php', + y: 653, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }, { - 'label': '1000.0-2000.0: bytes', - 'xAxisLabel': 'Top 5 extension', - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '1000.0-2000.0: bytes', + xAxisLabel: 'Top 5 extension', + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 6422 + x: 'jpg', + y: 6422, }, { - 'x': 'css', - 'y': 1591 + x: 'css', + y: 1591, }, { - 'x': 'png', - 'y': 430 + x: 'png', + y: 430, }, { - 'x': 'gif', - 'y': 8 + x: 'gif', + y: 8, }, { - 'x': 'php', - 'y': 561 - } - ] - } + x: 'php', + y: 561, + }, + ], + }, ], - 'xAxisFormatter': function (val) { + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } - } + }, + }, ], - 'xAxisOrderedValues': ['jpg', 'css', 'png', 'gif', 'php'], - 'hits': 171458 + xAxisOrderedValues: ['jpg', 'css', 'png', 'gif', 'php'], + hits: 171458, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js index f717012d430cf3..c55bff5631e888 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series.js @@ -1,50 +1,67 @@ +/* + * 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 default { - 'label': '', - 'xAxisLabel': 'Top 5 extension', - 'xAxisOrderedValues': ['jpg', 'css', 'png', 'gif', 'php'], - 'yAxisLabel': 'Count of documents', - 'series': [ + label: '', + xAxisLabel: 'Top 5 extension', + xAxisOrderedValues: ['jpg', 'css', 'png', 'gif', 'php'], + yAxisLabel: 'Count of documents', + series: [ { - 'label': 'Count', - 'values': [ + label: 'Count', + values: [ { - 'x': 'jpg', - 'y': 110710 + x: 'jpg', + y: 110710, }, { - 'x': 'css', - 'y': 27389 + x: 'css', + y: 27389, }, { - 'x': 'png', - 'y': 16661 + x: 'png', + y: 16661, }, { - 'x': 'gif', - 'y': 11269 + x: 'gif', + y: 11269, }, { - 'x': 'php', - 'y': 5447 - } - ] - } + x: 'php', + y: 5447, + }, + ], + }, ], - 'hits': 171476, - 'xAxisFormatter': function (val) { + hits: 171476, + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; diff --git a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js index 2b86663ab4673e..372325120ee8ec 100644 --- a/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js +++ b/src/plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple.js @@ -1,72 +1,105 @@ +/* + * 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 default { - 'xAxisOrderedValues': ['_all'], - 'yAxisLabel': 'Count', - 'zAxisLabel': 'machine.os.raw: Descending', - 'yScale': null, - 'series': [{ - 'label': 'ios', - 'id': '1', - 'yAxisFormatter': _.identity, - 'values': [{ - 'x': '_all', - 'y': 2820, - 'series': 'ios' - }] - }, { - 'label': 'win 7', - 'aggId': '1', - 'yAxisFormatter': _.identity, - 'values': [{ - 'x': '_all', - 'y': 2319, - 'series': 'win 7' - }] - }, { - 'label': 'win 8', - 'id': '1', - 'yAxisFormatter': _.identity, - 'values': [{ - 'x': '_all', - 'y': 1835, - 'series': 'win 8' - }] - }, { - 'label': 'windows xp service pack 2 version 20123452', - 'id': '1', - 'yAxisFormatter': _.identity, - 'values': [{ - 'x': '_all', - 'y': 734, - 'series': 'win xp' - }] - }, { - 'label': 'osx', - 'id': '1', - 'yAxisFormatter': _.identity, - 'values': [{ - 'x': '_all', - 'y': 1352, - 'series': 'osx' - }] - }], - 'hits': 14005, - 'xAxisFormatter': function (val) { + xAxisOrderedValues: ['_all'], + yAxisLabel: 'Count', + zAxisLabel: 'machine.os.raw: Descending', + yScale: null, + series: [ + { + label: 'ios', + id: '1', + yAxisFormatter: _.identity, + values: [ + { + x: '_all', + y: 2820, + series: 'ios', + }, + ], + }, + { + label: 'win 7', + aggId: '1', + yAxisFormatter: _.identity, + values: [ + { + x: '_all', + y: 2319, + series: 'win 7', + }, + ], + }, + { + label: 'win 8', + id: '1', + yAxisFormatter: _.identity, + values: [ + { + x: '_all', + y: 1835, + series: 'win 8', + }, + ], + }, + { + label: 'windows xp service pack 2 version 20123452', + id: '1', + yAxisFormatter: _.identity, + values: [ + { + x: '_all', + y: 734, + series: 'win xp', + }, + ], + }, + { + label: 'osx', + id: '1', + yAxisFormatter: _.identity, + values: [ + { + x: '_all', + y: 1352, + series: 'osx', + }, + ], + }, + ], + hits: 14005, + xAxisFormatter: function(val) { if (_.isObject(val)) { return JSON.stringify(val); - } - else if (val == null) { + } else if (val == null) { return ''; - } - else { + } else { return '' + val; } }, - 'yAxisFormatter': function (val) { + yAxisFormatter: function(val) { return val; }, - 'tooltipFormatter': function (d) { + tooltipFormatter: function(d) { return d; - } + }, }; From d37f00002467c178583deeed933fb7e10fdaf4ac Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 23 Apr 2020 16:54:49 +0300 Subject: [PATCH 028/134] Clean up --- .github/CODEOWNERS | 2 - .../discover}/fixed_scroll.js | 20 +- .../styles/_legacy/components/_table.scss | 2 +- .../angular/context/api/context.ts | 6 +- .../angular/directives/fixed_scroll.test.ts | 213 ------------------ .../public/application/embeddable/index.ts | 1 + src/plugins/discover/public/build_services.ts | 15 +- src/plugins/discover/public/index.ts | 1 + src/plugins/discover/public/plugin.ts | 5 + .../expression_types/embeddable_types.ts | 2 +- .../panel_actions/get_csv_panel_action.tsx | 8 +- 11 files changed, 36 insertions(+), 239 deletions(-) rename src/legacy/core_plugins/kibana/public/{discover/__tests__/directives => __tests__/discover}/fixed_scroll.js (89%) delete mode 100644 src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c32bf8cbaa1c3e..59f62f9d1e5985 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,8 +7,6 @@ /x-pack/plugins/graph/ @elastic/kibana-app /src/legacy/server/url_shortening/ @elastic/kibana-app /src/legacy/server/sample_data/ @elastic/kibana-app -/src/legacy/core_plugins/kibana/public/dashboard/ @elastic/kibana-app -/src/legacy/core_plugins/kibana/public/discover/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/local_application_service/ @elastic/kibana-app /src/legacy/core_plugins/kibana/public/dev_tools/ @elastic/kibana-app /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app diff --git a/src/legacy/core_plugins/kibana/public/discover/__tests__/directives/fixed_scroll.js b/src/legacy/core_plugins/kibana/public/__tests__/discover/fixed_scroll.js similarity index 89% rename from src/legacy/core_plugins/kibana/public/discover/__tests__/directives/fixed_scroll.js rename to src/legacy/core_plugins/kibana/public/__tests__/discover/fixed_scroll.js index 49a0df54079ea5..4a8736cc0d6a45 100644 --- a/src/legacy/core_plugins/kibana/public/discover/__tests__/directives/fixed_scroll.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/discover/fixed_scroll.js @@ -17,21 +17,33 @@ * under the License. */ +/* eslint-disable @kbn/eslint/no-restricted-paths */ + +import angular from 'angular'; import expect from '@kbn/expect'; -import { pluginInstance } from 'plugins/kibana/discover/legacy'; import ngMock from 'ng_mock'; import $ from 'jquery'; import sinon from 'sinon'; +import { PrivateProvider } from '../../../../../../plugins/kibana_legacy/public'; +import { FixedScrollProvider } from '../../../../../../plugins/discover/public/application/angular/directives/fixed_scroll'; +import { DebounceProviderTimeout } from '../../../../../../plugins/discover/public/application/angular/directives/debounce/debounce'; + +const testModuleName = 'fixedScroll'; + +angular + .module(testModuleName, []) + .provider('Private', PrivateProvider) + .service('debounce', ['$timeout', DebounceProviderTimeout]) + .directive('fixedScroll', FixedScrollProvider); + describe('FixedScroll directive', function() { const sandbox = sinon.createSandbox(); let compile; let flushPendingTasks; const trash = []; - beforeEach(() => pluginInstance.initializeServices()); - beforeEach(() => pluginInstance.initializeInnerAngular()); - beforeEach(ngMock.module('app/discover')); + beforeEach(ngMock.module(testModuleName)); beforeEach( ngMock.inject(function($compile, $rootScope, $timeout) { flushPendingTasks = function flushPendingTasks() { diff --git a/src/legacy/ui/public/styles/_legacy/components/_table.scss b/src/legacy/ui/public/styles/_legacy/components/_table.scss index c9472cbd2faa73..d0ac9d6f798628 100644 --- a/src/legacy/ui/public/styles/_legacy/components/_table.scss +++ b/src/legacy/ui/public/styles/_legacy/components/_table.scss @@ -1,4 +1,4 @@ -@import '../../../../../core_plugins/kibana/public/discover/np_ready/mixins'; +@import '../../../../../../plugins/discover/public/application/mixins'; .table { // Nesting diff --git a/src/plugins/discover/public/application/angular/context/api/context.ts b/src/plugins/discover/public/application/angular/context/api/context.ts index 2760eec38755e2..0bca820f9a7238 100644 --- a/src/plugins/discover/public/application/angular/context/api/context.ts +++ b/src/plugins/discover/public/application/angular/context/api/context.ts @@ -17,17 +17,13 @@ * under the License. */ +import { Filter, IndexPatternsContract, IndexPattern } from 'src/plugins/data/public'; import { reverseSortDir, SortDirection } from './utils/sorting'; import { extractNanos, convertIsoToMillis } from './utils/date_conversion'; import { fetchHitsInInterval } from './utils/fetch_hits_in_interval'; import { generateIntervals } from './utils/generate_intervals'; import { getEsQuerySearchAfter } from './utils/get_es_query_search_after'; import { getEsQuerySort } from './utils/get_es_query_sort'; -import { - Filter, - IndexPatternsContract, - IndexPattern, -} from '../../../../../../../../../plugins/data/public'; import { getServices } from '../../../../kibana_services'; export type SurrDocType = 'successors' | 'predecessors'; diff --git a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts b/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts deleted file mode 100644 index 5c43a66d77a362..00000000000000 --- a/src/plugins/discover/public/application/angular/directives/fixed_scroll.test.ts +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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 sinon, { SinonSpy } from 'sinon'; -import expect from '@kbn/expect'; -import angular, { ITimeoutService, ICompileService, IRootScopeService } from 'angular'; -import 'angular-mocks'; -import 'angular-sanitize'; -import 'angular-route'; - -import { coreMock } from '../../../../../../core/public/mocks'; -import { initializeInnerAngularModule } from '../../../get_inner_angular'; -import { navigationPluginMock } from '../../../../../navigation/public/mocks'; -import { dataPluginMock } from '../../../../../data/public/mocks'; -import { initAngularBootstrap } from '../../../../../kibana_legacy/public'; - -describe.skip('FixedScroll directive', function() { - const sandbox = sinon.createSandbox(); - - let compile: ( - ratioY: number, - ratioX?: number - ) => { - $container: JQuery; - $content: JQuery; - $scroller: JQuery; - [key: string]: JQuery; - }; - let flushPendingTasks: () => void; - const trash: Array> = []; - - beforeEach(() => { - initAngularBootstrap(); - initializeInnerAngularModule( - 'app/discover', - coreMock.createStart(), - navigationPluginMock.createStartContract(), - dataPluginMock.createStartContract() - ); - - angular.mock.module('app/discover'); - angular.mock.inject( - ($compile: ICompileService, _$timeout_: ITimeoutService, $rootScope: IRootScopeService) => { - flushPendingTasks = () => { - $rootScope.$digest(); - _$timeout_.flush(); - }; - - compile = function(ratioY, ratioX = ratioY) { - // since the directive works at the sibling level we create a - // parent for everything to happen in - const $parent = $('
').css({ - position: 'fixed', - top: 0, - left: 0, - right: 0, - bottom: 0, - }); - - $parent.appendTo(document.body); - trash.push($parent); - - const $el = $('
') - .css({ - 'overflow-x': 'auto', - width: $parent.width()!, - }) - .appendTo($parent); - - const $content = $('
') - .css({ - width: $parent.width()! * ratioX, - height: $parent.height()! * ratioY, - }) - .appendTo($el); - - $compile($parent)($rootScope); - flushPendingTasks(); - - return { - $container: $el, - $content, - $scroller: $parent.find('.fixed-scroll-scroller'), - }; - }; - } - ); - }); - - afterEach(() => { - trash.splice(0).forEach(function($el) { - $el.remove(); - }); - - sandbox.restore(); - }); - - it('does nothing when not needed', function() { - let els = compile(0.5, 1.5); - expect(els.$scroller).to.have.length(0); - - els = compile(1.5, 0.5); - expect(els.$scroller).to.have.length(0); - }); - - it('attaches a scroller below the element when the content is larger then the container', function() { - const els = compile(1.5); - expect(els.$scroller).to.have.length(1); - }); - - it('copies the width of the container', function() { - const els = compile(1.5); - expect(els.$scroller.width()).to.be(els.$container.width()); - }); - - it('mimics the scrollWidth of the element', function() { - const els = compile(1.5); - expect(els.$scroller.prop('scrollWidth')).to.be(els.$container.prop('scrollWidth')); - }); - - describe.skip('scroll event handling / tug of war prevention', function() { - it('listens when needed, unlistens when not needed', function() { - const on = sandbox.spy($.fn, 'on'); - const off = sandbox.spy($.fn, 'off'); - - const els = compile(1.5); - expect(on.callCount).to.be(2); - checkThisVals('$.fn.on', on); - - expect(off.callCount).to.be(0); - els.$container.width(els.$container.prop('scrollWidth')); - flushPendingTasks(); - expect(off.callCount).to.be(2); - checkThisVals('$.fn.off', off); - - function checkThisVals(name: string, spy: SinonSpy) { - // the this values should be different - expect(spy.thisValues[0].is(spy.thisValues[1])).to.be(false); - // but they should be either $scroller or $container - spy.thisValues.forEach(function($this) { - if ($this.is(els.$scroller) || $this.is(els.$container)) return; - // @ts-ignore - expect.fail('expected ' + name + ' to be called with $scroller or $container'); - }); - } - }); - - [ - { from: '$container', to: '$scroller' }, - { from: '$scroller', to: '$container' }, - ].forEach(function(names) { - describe('scroll events ' + JSON.stringify(names), function() { - let spy: SinonSpy; - let els; - let $from: JQuery; - let $to: JQuery; - - beforeEach(function() { - spy = sandbox.spy($.fn, 'scrollLeft'); - els = compile(1.5); - $from = els[names.from]; - $to = els[names.to]; - }); - - it('transfers the scrollLeft', function() { - expect(spy.callCount).to.be(0); - $from.scroll(); - expect(spy.callCount).to.be(2); - - // first call should read the scrollLeft from the $container - const firstCall = spy.getCall(0); - expect(firstCall.thisValue.is($from)).to.be(true); - expect(firstCall.args).to.eql([]); - - // second call should be setting the scrollLeft on the $scroller - const secondCall = spy.getCall(1); - expect(secondCall.thisValue.is($to)).to.be(true); - expect(secondCall.args).to.eql([firstCall.returnValue]); - }); - - /** - * In practice, calling $el.scrollLeft() causes the "scroll" event to trigger, - * but the browser seems to be very careful about triggering the event too much - * and I can't reliably recreate the browsers behavior in a test. So... faking it! - */ - it('prevents tug of war by ignoring echo scroll events', function() { - $from.scroll(); - expect(spy.callCount).to.be(2); - - spy.resetHistory(); - $to.scroll(); - expect(spy.callCount).to.be(0); - }); - }); - }); - }); -}); diff --git a/src/plugins/discover/public/application/embeddable/index.ts b/src/plugins/discover/public/application/embeddable/index.ts index 3138008f3e3a00..b86a8daa119c58 100644 --- a/src/plugins/discover/public/application/embeddable/index.ts +++ b/src/plugins/discover/public/application/embeddable/index.ts @@ -17,6 +17,7 @@ * under the License. */ +export { SEARCH_EMBEDDABLE_TYPE } from './constants'; export * from './types'; export * from './search_embeddable_factory'; export * from './search_embeddable'; diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index 8a56f4060868bd..6d3e0b55140ba0 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -34,17 +34,14 @@ import { DataPublicPluginStart, } from 'src/plugins/data/public'; import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/public'; +import { SharePluginStart } from 'src/plugins/share/public'; +import { ChartsPluginStart } from 'src/plugins/charts/public'; +import { VisualizationsStart } from 'src/plugins/visualizations/public'; +import { SavedObjectKibanaServices } from 'src/plugins/saved_objects/public'; import { DiscoverStartPlugins } from './plugin'; -import { SharePluginStart } from '../../../../../plugins/share/public'; -import { ChartsPluginStart } from '../../../../../plugins/charts/public'; -import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; -import { - createSavedSearchesLoader, - DocViewerComponent, - SavedSearch, -} from '../../../../../plugins/discover/public'; -import { SavedObjectKibanaServices } from '../../../../../plugins/saved_objects/public'; +import { createSavedSearchesLoader, SavedSearch } from './saved_searches'; +import { getHistory } from './kibana_services'; export interface DiscoverServices { addBasePath: (path: string) => string; diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts index 171fb989162d65..d1871963fe4e97 100644 --- a/src/plugins/discover/public/index.ts +++ b/src/plugins/discover/public/index.ts @@ -26,3 +26,4 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { SavedSearch, SavedSearchLoader, createSavedSearchesLoader } from './saved_searches'; +export { ISearchEmbeddable, SEARCH_EMBEDDABLE_TYPE } from './application/embeddable'; diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index c25bec92f705ce..338cde8e4f0fa8 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -47,6 +47,7 @@ import { DocViewsRegistry } from './application/doc_views/doc_views_registry'; import { DocViewTable } from './application/components/table/table'; import { JsonCodeBlock } from './application/components/json_code_block/json_code_block'; import { + getHistory, setDocViewsRegistry, setUrlTracker, setAngularModule, @@ -157,6 +158,10 @@ export class DiscoverPlugin stop: stopUrlTracker, setActiveUrl: setTrackedUrl, } = createKbnUrlTracker({ + // we pass getter here instead of plain `history`, + // so history is lazily created (when app is mounted) + // this prevents redundant `#` when not in discover app + getHistory, baseUrl: core.http.basePath.prepend('/app/kibana'), defaultSubUrl: '#/discover', storageKey: `lastUrl:${core.http.basePath.get()}:discover`, diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts index f5836fe91e0404..592da1ff039a15 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts @@ -7,7 +7,7 @@ import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/public'; import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/visualizations/public'; import { LENS_EMBEDDABLE_TYPE } from '../../../../../plugins/lens/common/constants'; -import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants'; +import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/discover/public'; export const EmbeddableTypes: { lens: string; diff --git a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx index d4e3069186f606..ecac454ee8c2f9 100644 --- a/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx +++ b/x-pack/plugins/reporting/public/panel_actions/get_csv_panel_action.tsx @@ -12,10 +12,10 @@ import { LicensingPluginSetup } from '../../../licensing/public'; import { checkLicense } from '../lib/license_check'; import { ViewMode, IEmbeddable } from '../../../../../src/plugins/embeddable/public'; - -// @TODO: These import paths will need to be updated once discovery moves to non-legacy dir -import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants'; -import { ISearchEmbeddable } from '../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types'; +import { + ISearchEmbeddable, + SEARCH_EMBEDDABLE_TYPE, +} from '../../../../../src/plugins/discover/public'; import { API_GENERATE_IMMEDIATE, CSV_REPORTING_ACTION } from '../../constants'; From 62ced260656056297af0eb75d6eee6d339b29211 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 23 Apr 2020 17:11:08 +0300 Subject: [PATCH 029/134] Revert jest changes --- src/dev/jest/config.js | 1 - src/dev/jest/setup/jquery.js | 21 --------------------- 2 files changed, 22 deletions(-) delete mode 100644 src/dev/jest/setup/jquery.js diff --git a/src/dev/jest/config.js b/src/dev/jest/config.js index 780cafe01bd5ae..7da14e0dfe51bf 100644 --- a/src/dev/jest/config.js +++ b/src/dev/jest/config.js @@ -68,7 +68,6 @@ export default { '/src/dev/jest/setup/babel_polyfill.js', '/src/dev/jest/setup/polyfills.js', '/src/dev/jest/setup/enzyme.js', - '/src/dev/jest/setup/jquery.js', ], setupFilesAfterEnv: [ '/src/dev/jest/setup/mocks.js', diff --git a/src/dev/jest/setup/jquery.js b/src/dev/jest/setup/jquery.js deleted file mode 100644 index 52dba84c5844e7..00000000000000 --- a/src/dev/jest/setup/jquery.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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'; -global.$ = global.jQuery = $; From 9c0f47e20d97ed776b4b89a3618f882690bcd873 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 24 Apr 2020 10:10:35 +0200 Subject: [PATCH 030/134] move test styles to tests_bundle --- src/legacy/core_plugins/kibana/public/index.scss | 8 -------- src/legacy/core_plugins/tests_bundle/index.js | 2 ++ src/legacy/core_plugins/tests_bundle/public/index.scss | 9 +++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 src/legacy/core_plugins/tests_bundle/public/index.scss diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index aa933302367533..26805554370b96 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -7,17 +7,9 @@ // Public UI styles @import 'src/legacy/ui/public/index'; -// vis_type_vislib UI styles are imported here for running karma Browser tests -// should be somehow included through the "vis_type_vislib" plugin initialization -@import '../../../../plugins/vis_type_vislib/public/index'; - // Discover styles @import 'discover/index'; -// Visualization styles are imported here for running karma Browser tests -// should be somehow included through the "visualizations" plugin initialization -@import '../../../../plugins/visualizations/public/index'; - // Has to come after visualize because of some // bad cascading in the Editor layout @import '../../../../plugins/maps_legacy/public/index'; diff --git a/src/legacy/core_plugins/tests_bundle/index.js b/src/legacy/core_plugins/tests_bundle/index.js index 5e78047088d2a3..73fa6a5fc53e1d 100644 --- a/src/legacy/core_plugins/tests_bundle/index.js +++ b/src/legacy/core_plugins/tests_bundle/index.js @@ -18,6 +18,7 @@ */ import { createReadStream } from 'fs'; +import { resolve } from 'path'; import globby from 'globby'; import MultiStream from 'multistream'; @@ -40,6 +41,7 @@ export default kibana => { }, uiExports: { + styleSheetPaths: resolve(__dirname, 'public/index.scss'), async __bundleProvider__(kbnServer) { const modules = new Set(); diff --git a/src/legacy/core_plugins/tests_bundle/public/index.scss b/src/legacy/core_plugins/tests_bundle/public/index.scss new file mode 100644 index 00000000000000..0daace40affc96 --- /dev/null +++ b/src/legacy/core_plugins/tests_bundle/public/index.scss @@ -0,0 +1,9 @@ +@import 'src/legacy/ui/public/styles/styling_constants'; + +// vis_type_vislib UI styles are imported here for running karma Browser tests +// should be somehow included through the "vis_type_vislib" plugin initialization +@import '../../../../plugins/vis_type_vislib/public/index'; + +// Visualization styles are imported here for running karma Browser tests +// should be somehow included through the "visualizations" plugin initialization +@import '../../../../plugins/visualizations/public/index'; From efda5b3de77868a571c16cf5f4211b5d21d8fb29 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 24 Apr 2020 15:22:16 +0200 Subject: [PATCH 031/134] fix styling problems --- src/legacy/core_plugins/kibana/public/index.scss | 3 --- src/legacy/ui/public/styles/_legacy/components/_table.scss | 2 +- src/plugins/data/server/saved_objects/search.ts | 2 +- src/plugins/discover/public/application/angular/index.ts | 5 +++++ src/plugins/discover/public/build_services.ts | 2 +- src/plugins/home/public/application/application.tsx | 2 ++ .../home/public/application/{_index.scss => index.scss} | 0 7 files changed, 10 insertions(+), 6 deletions(-) rename src/plugins/home/public/application/{_index.scss => index.scss} (100%) diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index 503f26ddb81408..859ecbdddc77df 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -16,9 +16,6 @@ // bad cascading in the Editor layout @import '../../../../plugins/maps_legacy/public/index'; -// Home styles -@import '../../../../plugins/home/public/application/index'; - // Management styles @import './management/index'; diff --git a/src/legacy/ui/public/styles/_legacy/components/_table.scss b/src/legacy/ui/public/styles/_legacy/components/_table.scss index c9472cbd2faa73..d0ac9d6f798628 100644 --- a/src/legacy/ui/public/styles/_legacy/components/_table.scss +++ b/src/legacy/ui/public/styles/_legacy/components/_table.scss @@ -1,4 +1,4 @@ -@import '../../../../../core_plugins/kibana/public/discover/np_ready/mixins'; +@import '../../../../../../plugins/discover/public/application/mixins'; .table { // Nesting diff --git a/src/plugins/data/server/saved_objects/search.ts b/src/plugins/data/server/saved_objects/search.ts index 216606f65c1ab0..cf53a317419284 100644 --- a/src/plugins/data/server/saved_objects/search.ts +++ b/src/plugins/data/server/saved_objects/search.ts @@ -36,7 +36,7 @@ export const searchSavedObjectType: SavedObjectsType = { }, getInAppUrl(obj) { return { - path: `/app/discover#//${encodeURIComponent(obj.id)}`, + path: `/app/discover#/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'discover.show', }; }, diff --git a/src/plugins/discover/public/application/angular/index.ts b/src/plugins/discover/public/application/angular/index.ts index 5bae0d9d551e53..f3fd3fb6622ee8 100644 --- a/src/plugins/discover/public/application/angular/index.ts +++ b/src/plugins/discover/public/application/angular/index.ts @@ -16,6 +16,11 @@ * specific language governing permissions and limitations * under the License. */ +// required for i18nIdDirective +import 'angular-sanitize'; +// required for ngRoute +import 'angular-route'; + import './discover'; import './doc'; import './context'; diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index e40464d39669fd..315090a7805079 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -40,7 +40,7 @@ import { ChartsPluginStart } from '../../charts/public'; import { VisualizationsStart } from '../../visualizations/public'; import { createSavedSearchesLoader, SavedSearch } from '.'; import { DiscoverStartPlugins } from './plugin'; -import { SavedObjectKibanaServices } from '../../../../../plugins/saved_objects/public'; +import { SavedObjectKibanaServices } from '../../saved_objects/public'; export interface DiscoverServices { addBasePath: (path: string) => string; diff --git a/src/plugins/home/public/application/application.tsx b/src/plugins/home/public/application/application.tsx index fb45919a9732a2..934af806672720 100644 --- a/src/plugins/home/public/application/application.tsx +++ b/src/plugins/home/public/application/application.tsx @@ -24,6 +24,8 @@ import { i18n } from '@kbn/i18n'; import { HomeApp } from './components/home_app'; import { getServices } from './kibana_services'; +import './index.scss'; + export const renderApp = async (element: HTMLElement) => { const homeTitle = i18n.translate('home.breadcrumbs.homeTitle', { defaultMessage: 'Home' }); const { featureCatalogue, chrome } = getServices(); diff --git a/src/plugins/home/public/application/_index.scss b/src/plugins/home/public/application/index.scss similarity index 100% rename from src/plugins/home/public/application/_index.scss rename to src/plugins/home/public/application/index.scss From 7b54319d9ef7dac01bf13253420bd4490043f7cc Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 24 Apr 2020 16:35:31 +0300 Subject: [PATCH 032/134] Pass down deps into IndexPatternFieldList --- .../create_edit_field/create_edit_field.tsx | 22 ++++++++--- .../edit_index_pattern/edit_index_pattern.js | 1 + .../public/index_patterns/fields/field.ts | 25 ++++++++---- .../index_patterns/fields/field_list.ts | 38 +++++++++++++++++-- .../index_patterns/index_pattern.ts | 24 +++++++++++- .../components/sidebar/discover_sidebar.tsx | 4 +- .../lib/get_index_pattern_field_list.ts | 9 +++-- src/plugins/discover/public/build_services.ts | 2 + src/test_utils/public/stub_index_pattern.js | 11 +++++- 9 files changed, 112 insertions(+), 24 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx index 4839870f0f3c8a..60074210b70c8b 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/create_edit_field/create_edit_field.tsx @@ -24,7 +24,11 @@ import { FieldEditor } from 'ui/field_editor'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { IndexHeader } from '../index_header'; -import { IndexPattern, IndexPatternField } from '../../../../../../../../../plugins/data/public'; +import { + IndexPattern, + IndexPatternField, + DataPublicPluginStart, +} from '../../../../../../../../../plugins/data/public'; import { ChromeDocTitle, NotificationsStart } from '../../../../../../../../../core/public'; import { TAB_SCRIPTED_FIELDS, TAB_INDEXED_FIELDS } from '../constants'; @@ -35,6 +39,7 @@ interface CreateEditFieldProps extends RouteComponentProps { fieldFormatEditors: any; getConfig: (name: string) => any; services: { + fieldFormats: DataPublicPluginStart['fieldFormats']; notifications: NotificationsStart; docTitle: ChromeDocTitle; http: Function; @@ -61,10 +66,17 @@ export const CreateEditField = withRouter( const field = mode === 'edit' && fieldName ? indexPattern.fields.getByName(fieldName) - : new IndexPatternField(indexPattern, { - scripted: true, - type: 'number', - }); + : new IndexPatternField( + { + fieldFormats: services.fieldFormats, + toastNotifications: services.notifications.toasts, + }, + indexPattern, + { + scripted: true, + type: 'number', + } + ); const url = `/management/kibana/index_patterns/${indexPattern.id}`; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js index 3239a17f109e43..38975215779422 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js @@ -448,6 +448,7 @@ const renderCreateEditField = ($scope, $route, getConfig, $http, fieldFormatEdit fieldFormatEditors={fieldFormatEditors} getConfig={getConfig} services={{ + fieldFormats: npStart.plugins.data.fieldFormats, http: $http, notifications: npStart.core.notifications, docTitle: npStart.core.chrome.docTitle, diff --git a/src/plugins/data/public/index_patterns/fields/field.ts b/src/plugins/data/public/index_patterns/fields/field.ts index 0fb92393d56f71..2e3815f0cd1e77 100644 --- a/src/plugins/data/public/index_patterns/fields/field.ts +++ b/src/plugins/data/public/index_patterns/fields/field.ts @@ -18,15 +18,26 @@ */ import { i18n } from '@kbn/i18n'; +import { ToastsStart } from 'kibana/public'; // @ts-ignore import { ObjDefine } from './obj_define'; import { IndexPattern } from '../index_patterns'; -import { getNotifications, getFieldFormats } from '../../services'; -import { IFieldType, getKbnFieldType, IFieldSubType, FieldFormat } from '../../../common'; -import { shortenDottedString } from '../../../common/utils'; +import { + IFieldType, + getKbnFieldType, + IFieldSubType, + FieldFormat, + shortenDottedString, +} from '../../../common'; +import { FieldFormatsStart } from '../../field_formats'; export type FieldSpec = Record; +interface Deps { + fieldFormats: FieldFormatsStart; + toastNotifications: ToastsStart; +} + export class Field implements IFieldType { name: string; type: string; @@ -49,6 +60,7 @@ export class Field implements IFieldType { $$spec: FieldSpec; constructor( + { fieldFormats, toastNotifications }: Deps, indexPattern: IndexPattern, spec: FieldSpec | Field, shortDotsEnable: boolean = false @@ -76,9 +88,8 @@ export class Field implements IFieldType { values: { name: spec.name, title: indexPattern.title }, defaultMessage: 'Field {name} in indexPattern {title} is using an unknown field type.', }); - const { toasts } = getNotifications(); - toasts.addDanger({ + toastNotifications.addDanger({ title, text, }); @@ -89,11 +100,9 @@ export class Field implements IFieldType { let format = spec.format; if (!FieldFormat.isInstanceOfFieldFormat(format)) { - const fieldFormatsService = getFieldFormats(); - format = indexPattern.fieldFormatMap[spec.name] || - fieldFormatsService.getDefaultInstance(spec.type, spec.esTypes); + fieldFormats.getDefaultInstance(spec.type, spec.esTypes); } const indexed = !!spec.indexed; diff --git a/src/plugins/data/public/index_patterns/fields/field_list.ts b/src/plugins/data/public/index_patterns/fields/field_list.ts index d6067280fd7b67..ad22228e87d730 100644 --- a/src/plugins/data/public/index_patterns/fields/field_list.ts +++ b/src/plugins/data/public/index_patterns/fields/field_list.ts @@ -18,12 +18,19 @@ */ import { findIndex } from 'lodash'; +import { ToastsStart } from 'kibana/public'; import { IndexPattern } from '../index_patterns'; import { IFieldType } from '../../../common'; import { Field, FieldSpec } from './field'; +import { FieldFormatsStart } from '../../field_formats'; type FieldMap = Map; +interface Deps { + fieldFormats: FieldFormatsStart; + toastNotifications: ToastsStart; +} + export interface IFieldList extends Array { getByName(name: Field['name']): Field | undefined; getByType(type: Field['type']): Field[]; @@ -44,11 +51,20 @@ export class FieldList extends Array implements IFieldList { this.groups.get(field.type)!.set(field.name, field); }; private removeByGroup = (field: IFieldType) => this.groups.get(field.type)!.delete(field.name); + private fieldFormats: FieldFormatsStart; + private toastNotifications: ToastsStart; - constructor(indexPattern: IndexPattern, specs: FieldSpec[] = [], shortDotsEnable = false) { + constructor( + { fieldFormats, toastNotifications }: Deps, + indexPattern: IndexPattern, + specs: FieldSpec[] = [], + shortDotsEnable = false + ) { super(); this.indexPattern = indexPattern; this.shortDotsEnable = shortDotsEnable; + this.fieldFormats = fieldFormats; + this.toastNotifications = toastNotifications; specs.map(field => this.add(field)); } @@ -56,7 +72,15 @@ export class FieldList extends Array implements IFieldList { getByName = (name: Field['name']) => this.byName.get(name); getByType = (type: Field['type']) => [...(this.groups.get(type) || new Map()).values()]; add = (field: FieldSpec) => { - const newField = new Field(this.indexPattern, field, this.shortDotsEnable); + const newField = new Field( + { + fieldFormats: this.fieldFormats, + toastNotifications: this.toastNotifications, + }, + this.indexPattern, + field, + this.shortDotsEnable + ); this.push(newField); this.setByName(newField); this.setByGroup(newField); @@ -71,7 +95,15 @@ export class FieldList extends Array implements IFieldList { }; update = (field: FieldSpec) => { - const newField = new Field(this.indexPattern, field, this.shortDotsEnable); + const newField = new Field( + { + fieldFormats: this.fieldFormats, + toastNotifications: this.toastNotifications, + }, + this.indexPattern, + field, + this.shortDotsEnable + ); const index = this.findIndex(f => f.name === newField.name); this.splice(index, 1, newField); this.setByName(newField); diff --git a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts index 768029136879da..630ee664353358 100644 --- a/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts +++ b/src/plugins/data/public/index_patterns/index_patterns/index_pattern.ts @@ -106,7 +106,15 @@ export class IndexPattern implements IIndexPattern { this.shortDotsEnable = this.getConfig('shortDots:enable'); this.metaFields = this.getConfig('metaFields'); - this.fields = new FieldList(this, [], this.shortDotsEnable); + this.fields = new FieldList( + { + fieldFormats: getFieldFormats(), + toastNotifications: getNotifications().toasts, + }, + this, + [], + this.shortDotsEnable + ); this.fieldsFetcher = createFieldsFetcher(this, apiClient, this.getConfig('metaFields')); this.flattenHit = flattenHitWrapper(this, this.getConfig('metaFields')); this.formatHit = formatHitProvider( @@ -131,7 +139,15 @@ export class IndexPattern implements IIndexPattern { private initFields(input?: any) { const newValue = input || this.fields; - this.fields = new FieldList(this, newValue, this.shortDotsEnable); + this.fields = new FieldList( + { + fieldFormats: getFieldFormats(), + toastNotifications: getNotifications().toasts, + }, + this, + newValue, + this.shortDotsEnable + ); } private isFieldRefreshRequired(): boolean { @@ -270,6 +286,10 @@ export class IndexPattern implements IIndexPattern { this.fields.add( new Field( + { + fieldFormats: getFieldFormats(), + toastNotifications: getNotifications().toasts, + }, this, { name, diff --git a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx index 9639753bd276be..2799c7def09b47 100644 --- a/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx +++ b/src/plugins/discover/public/application/components/sidebar/discover_sidebar.tsx @@ -97,9 +97,9 @@ export function DiscoverSidebar({ const services = getServices(); useEffect(() => { - const newFields = getIndexPatternFieldList(selectedIndexPattern, fieldCounts); + const newFields = getIndexPatternFieldList(selectedIndexPattern, fieldCounts, services); setFields(newFields); - }, [selectedIndexPattern, fieldCounts, hits]); + }, [selectedIndexPattern, fieldCounts, hits, services]); const onShowDetails = useCallback( (show: boolean, field: IndexPatternField) => { diff --git a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts index 2c461701255865..e09d0d8a4734ea 100644 --- a/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts +++ b/src/plugins/discover/public/application/components/sidebar/lib/get_index_pattern_field_list.ts @@ -22,12 +22,15 @@ import { IndexPattern, IndexPatternField, } from '../../../../../../data/public'; +import { DiscoverServices } from '../../../../build_services'; export function getIndexPatternFieldList( indexPattern: IndexPattern, - fieldCounts: Record + fieldCounts: Record, + { fieldFormats, toastNotifications }: DiscoverServices ): IndexPatternFieldList { - if (!indexPattern || !fieldCounts) return new IndexPatternFieldList(indexPattern, []); + if (!indexPattern || !fieldCounts) + return new IndexPatternFieldList({ fieldFormats, toastNotifications }, indexPattern, []); const fieldSpecs = indexPattern.fields.slice(0); const fieldNamesInDocs = Object.keys(fieldCounts); @@ -40,5 +43,5 @@ export function getIndexPatternFieldList( } as IndexPatternField); }); - return new IndexPatternFieldList(indexPattern, fieldSpecs); + return new IndexPatternFieldList({ fieldFormats, toastNotifications }, indexPattern, fieldSpecs); } diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index 6d3e0b55140ba0..ca4a06b46177ad 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -50,6 +50,7 @@ export interface DiscoverServices { core: CoreStart; data: DataPublicPluginStart; docLinks: DocLinksStart; + fieldFormats: DataPublicPluginStart['fieldFormats']; history: () => History; theme: ChartsPluginStart['theme']; filterManager: FilterManager; @@ -87,6 +88,7 @@ export async function buildServices( data: plugins.data, docLinks: core.docLinks, theme: plugins.charts.theme, + fieldFormats: plugins.data.fieldFormats, filterManager: plugins.data.query.filterManager, getSavedSearchById: async (id: string) => savedObjectService.get(id), getSavedSearchUrlById: async (id: string) => savedObjectService.urlFor(id), diff --git a/src/test_utils/public/stub_index_pattern.js b/src/test_utils/public/stub_index_pattern.js index aecf8f9edee2a9..c0dbcda71929f8 100644 --- a/src/test_utils/public/stub_index_pattern.js +++ b/src/test_utils/public/stub_index_pattern.js @@ -67,7 +67,16 @@ export default function StubIndexPattern(pattern, getConfig, timeField, fields, this.formatField = this.formatHit.formatField; this._reindexFields = function() { - this.fields = new IndexPatternFieldList(this, this.fields || fields); + this.fields = new IndexPatternFieldList( + { + fieldFormats: { getDefaultInstance: () => '' }, + toastNotifications: { + addDanger: () => {}, + }, + }, + this, + this.fields || fields + ); }; this.stubSetFieldFormat = function(fieldName, id, params) { From ae26cffc8a7636d8cfec1c3df7bcdab3b889cfd1 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Fri, 24 Apr 2020 15:48:07 +0200 Subject: [PATCH 033/134] remove unused styles --- src/legacy/core_plugins/kibana/public/index.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/index.scss b/src/legacy/core_plugins/kibana/public/index.scss index b1614c0389b6aa..56a2543dbca788 100644 --- a/src/legacy/core_plugins/kibana/public/index.scss +++ b/src/legacy/core_plugins/kibana/public/index.scss @@ -7,12 +7,6 @@ // Public UI styles @import 'src/legacy/ui/public/index'; -// vis_type_vislib UI styles are imported here for running karma Browser tests -// should be somehow included through the "vis_type_vislib" plugin initialization -@import '../../../../plugins/vis_type_vislib/public/index'; - -// Visualize styles -@import './visualize/index'; // Has to come after visualize because of some // bad cascading in the Editor layout @import '../../../../plugins/maps_legacy/public/index'; From ca5f1b354c0f2e0190c6d84e4b5730b457336a42 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 24 Apr 2020 17:00:21 +0300 Subject: [PATCH 034/134] Fix conflicts --- .../sections/index_patterns/edit_index_pattern/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js index e05aea3678fe20..2ce0e924c7274b 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/index.js @@ -112,6 +112,7 @@ const renderCreateEditField = ($scope, $route, getConfig, $http, fieldFormatEdit fieldFormatEditors={fieldFormatEditors} getConfig={getConfig} services={{ + fieldFormats: npStart.plugins.data.fieldFormats, http: $http, notifications: npStart.core.notifications, docTitle: npStart.core.chrome.docTitle, From 096eed96db6f4a3d87581ea2a2dcc4263f21197d Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 24 Apr 2020 18:41:03 +0300 Subject: [PATCH 035/134] Pass env vars --- src/plugins/discover/public/get_inner_angular.ts | 5 +++-- src/plugins/discover/public/plugin.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 1f08cacbf8e6a4..40cf6adb172cd3 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -79,10 +79,11 @@ export function getInnerAngularModule( export function getInnerAngularModuleEmbeddable( name: string, core: CoreStart, - deps: DiscoverStartPlugins + deps: DiscoverStartPlugins, + context: PluginInitializerContext ) { const module = initializeInnerAngularModule(name, core, deps.navigation, deps.data, true); - configureAppAngularModule(module, core as LegacyCoreStart, true); + configureAppAngularModule(module, { core, env: context.env }, true); return module; } diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 338cde8e4f0fa8..807365cb26dc0e 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -307,7 +307,12 @@ export class DiscoverPlugin throw Error('Discover plugin getEmbeddableInjector: initializeServices is undefined'); } const { core, plugins } = await this.initializeServices(); - getInnerAngularModuleEmbeddable(embeddableAngularName, core, plugins); + getInnerAngularModuleEmbeddable( + embeddableAngularName, + core, + plugins, + this.initializerContext + ); const mountpoint = document.createElement('div'); this.embeddableInjector = angular.bootstrap(mountpoint, [embeddableAngularName]); } From d66eb1acc01f9de0ad8ba4e846cf174bcffac5a9 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Sat, 25 Apr 2020 20:55:47 +0200 Subject: [PATCH 036/134] fix discover stuff --- .../dashboard/public/application/application.ts | 2 ++ .../dashboard/server/saved_objects/dashboard.ts | 2 +- .../public/application/angular/context.html | 1 - .../discover/public/application/angular/context.js | 1 - .../public/application/angular/context_app.html | 14 +------------- .../public/application/angular/context_app.js | 11 ++--------- .../public/application/angular/discover.js | 14 +++++++------- .../discover/public/application/angular/doc.ts | 9 +++++---- .../angular/doc_table/components/table_row.ts | 6 +++--- .../doc_table/components/table_row/details.html | 2 +- .../public/application/helpers/breadcrumbs.ts | 2 +- src/plugins/discover/public/build_services.ts | 1 - src/plugins/discover/public/get_inner_angular.ts | 2 +- src/plugins/discover/public/kibana_services.ts | 3 --- src/plugins/discover/public/plugin.ts | 1 - .../public/saved_searches/_saved_search.ts | 2 +- .../visualize/public/application/application.ts | 6 ++++++ .../plugins/translations/translations/ja-JP.json | 3 --- .../plugins/translations/translations/zh-CN.json | 3 --- 19 files changed, 31 insertions(+), 54 deletions(-) diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index 4dbc101a77b8f5..c49b93489528ed 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -43,6 +43,8 @@ import { SavedObjectLoader } from '../../../saved_objects/public'; // required for i18nIdDirective import 'angular-sanitize'; +// required for ngRoute +import 'angular-route'; export interface RenderDeps { pluginInitializerContext: PluginInitializerContext; diff --git a/src/plugins/dashboard/server/saved_objects/dashboard.ts b/src/plugins/dashboard/server/saved_objects/dashboard.ts index 6c6cb848978d05..14d2c822a421e7 100644 --- a/src/plugins/dashboard/server/saved_objects/dashboard.ts +++ b/src/plugins/dashboard/server/saved_objects/dashboard.ts @@ -36,7 +36,7 @@ export const dashboardSavedObjectType: SavedObjectsType = { }, getInAppUrl(obj) { return { - path: `/app/dashboard#/view/${encodeURIComponent(obj.id)}`, + path: `/app/dashboards#/view/${encodeURIComponent(obj.id)}`, uiCapabilitiesPath: 'dashboard.show', }; }, diff --git a/src/plugins/discover/public/application/angular/context.html b/src/plugins/discover/public/application/angular/context.html index 1c870f56a1118e..2c8e9a2a5d6f0b 100644 --- a/src/plugins/discover/public/application/angular/context.html +++ b/src/plugins/discover/public/application/angular/context.html @@ -1,7 +1,6 @@ - -
diff --git a/src/plugins/discover/public/application/angular/context_app.js b/src/plugins/discover/public/application/angular/context_app.js index a6a1de695156d4..c4a42642f7fd5a 100644 --- a/src/plugins/discover/public/application/angular/context_app.js +++ b/src/plugins/discover/public/application/angular/context_app.js @@ -51,7 +51,6 @@ module.directive('contextApp', function ContextApp() { predecessorCount: '=', successorCount: '=', sort: '=', - discoverUrl: '=', }, template: contextAppTemplate, }; @@ -63,8 +62,7 @@ function ContextAppController($scope, Private) { const queryActions = Private(QueryActionsProvider); this.state = createInitialState( parseInt(uiSettings.get('context:step'), 10), - getFirstSortableField(this.indexPattern, uiSettings.get('context:tieBreakerFields')), - this.discoverUrl + getFirstSortableField(this.indexPattern, uiSettings.get('context:tieBreakerFields')) ); this.actions = _.mapValues( @@ -129,7 +127,7 @@ function ContextAppController($scope, Private) { ); } -function createInitialState(defaultStepSize, tieBreakerField, discoverUrl) { +function createInitialState(defaultStepSize, tieBreakerField) { return { queryParameters: createInitialQueryParametersState(defaultStepSize, tieBreakerField), rows: { @@ -139,10 +137,5 @@ function createInitialState(defaultStepSize, tieBreakerField, discoverUrl) { successors: [], }, loadingStatus: createInitialLoadingStatusState(), - navigation: { - discover: { - url: discoverUrl, - }, - }, }; } diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index d5da62a352d4a0..dbe77f93cd92ea 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -266,7 +266,7 @@ function discoverController( // which could be set through pressing "New" button in top nav or go to "Discover" plugin from the sidebar // to reload the page in a right way const unlistenHistoryBasePath = history.listen(({ pathname, search, hash }) => { - if (!search && !hash && pathname === '/discover') { + if (!search && !hash && pathname === '/') { $route.reload(); } }); @@ -341,7 +341,7 @@ function discoverController( }), run: function() { $scope.$evalAsync(() => { - history.push('/discover'); + history.push('/'); }); }, testId: 'discoverNewButton', @@ -411,7 +411,7 @@ function discoverController( testId: 'discoverOpenButton', run: () => { showOpenSearchPanel({ - makeUrl: searchId => `#/discover/${encodeURIComponent(searchId)}`, + makeUrl: searchId => `#/${encodeURIComponent(searchId)}`, I18nContext: core.i18n.Context, }); }, @@ -500,7 +500,7 @@ function discoverController( chrome.setBreadcrumbs([ { text: discoverBreadcrumbsTitle, - href: '#/discover', + href: '#/', }, { text: savedSearch.title }, ]); @@ -758,7 +758,7 @@ function discoverController( }); if (savedSearch.id !== $route.current.params.id) { - history.push(`/discover/${encodeURIComponent(savedSearch.id)}`); + history.push(`/${encodeURIComponent(savedSearch.id)}`); } else { // Update defaults so that "reload saved query" functions correctly setAppState(getStateDefaults()); @@ -929,11 +929,11 @@ function discoverController( }; $scope.resetQuery = function() { - history.push(`/discover/${encodeURIComponent($route.current.params.id)}`); + history.push(`/${encodeURIComponent($route.current.params.id)}`); }; $scope.newQuery = function() { - history.push('/discover'); + history.push('/'); }; $scope.updateDataSource = () => { diff --git a/src/plugins/discover/public/application/angular/doc.ts b/src/plugins/discover/public/application/angular/doc.ts index 092e3c79b1007c..25685ab68e24a4 100644 --- a/src/plugins/discover/public/application/angular/doc.ts +++ b/src/plugins/discover/public/application/angular/doc.ts @@ -44,12 +44,13 @@ app.directive('discoverDoc', function(reactDirective: any) { app.config(($routeProvider: any) => { $routeProvider - .when('/discover/doc/:indexPattern/:index/:type', { - redirectTo: '/discover/doc/:indexPattern/:index', + .when('/doc/:indexPattern/:index/:type', { + redirectTo: '/doc/:indexPattern/:index', }) // the new route, es 7 deprecated types, es 8 removed them - .when('/discover/doc/:indexPattern/:index', { - controller: ($scope: LazyScope, $route: any, es: any) => { + .when('/doc/:indexPattern/:index', { + // eslint-disable-next-line object-shorthand + controller: function($scope: LazyScope, $route: any, es: any) { timefilter.disableAutoRefreshSelector(); timefilter.disableTimeRangeSelector(); $scope.esClient = es; diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts index 3b48c4c79365e2..6feafe5e5e5972 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row.ts @@ -106,9 +106,9 @@ export function createTableRowDirective($compile: ng.ICompileService, $httpParam }; $scope.getContextAppHref = () => { - const path = `#/discover/context/${encodeURIComponent( - $scope.indexPattern.id - )}/${encodeURIComponent($scope.row._id)}`; + const path = `#/context/${encodeURIComponent($scope.indexPattern.id)}/${encodeURIComponent( + $scope.row._id + )}`; const globalFilters: any = getServices().filterManager.getGlobalFilters(); const appFilters: any = getServices().filterManager.getAppFilters(); const hash = $httpParamSerializer({ diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html index d149a9023816a8..36a72efbc06867 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html @@ -30,7 +30,7 @@ diff --git a/src/plugins/discover/public/application/helpers/breadcrumbs.ts b/src/plugins/discover/public/application/helpers/breadcrumbs.ts index 6c3856932c96c1..157c7d5794bd4d 100644 --- a/src/plugins/discover/public/application/helpers/breadcrumbs.ts +++ b/src/plugins/discover/public/application/helpers/breadcrumbs.ts @@ -25,7 +25,7 @@ export function getRootBreadcrumbs() { text: i18n.translate('kbn.discover.rootBreadcrumb', { defaultMessage: 'Discover', }), - href: '#/discover', + href: '#/', }, ]; } diff --git a/src/plugins/discover/public/build_services.ts b/src/plugins/discover/public/build_services.ts index e0c6245fc5465a..3737138ef3bba5 100644 --- a/src/plugins/discover/public/build_services.ts +++ b/src/plugins/discover/public/build_services.ts @@ -40,7 +40,6 @@ import { VisualizationsStart } from 'src/plugins/visualizations/public'; import { SavedObjectKibanaServices } from 'src/plugins/saved_objects/public'; import { DiscoverStartPlugins } from './plugin'; -import { SavedObjectKibanaServices } from '../../saved_objects/public'; import { createSavedSearchesLoader, SavedSearch } from './saved_searches'; export interface DiscoverServices { diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 1f08cacbf8e6a4..edaad3eeebdc51 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -191,7 +191,7 @@ function createElasticSearchModule(data: DataPublicPluginStart) { angular .module('discoverEs', []) // Elasticsearch client used for requesting data. Connects to the /elasticsearch proxy - .service('es', () => { + .service('es', function() { return data.search.__LEGACY.esClient; }); } diff --git a/src/plugins/discover/public/kibana_services.ts b/src/plugins/discover/public/kibana_services.ts index b414b8595484f5..f1cafaff5a0eaf 100644 --- a/src/plugins/discover/public/kibana_services.ts +++ b/src/plugins/discover/public/kibana_services.ts @@ -61,9 +61,6 @@ export const [getDocViewsRegistry, setDocViewsRegistry] = createGetterSetter createHashHistory()); -export const [getDocViewsRegistry, setDocViewsRegistry] = createGetterSetter( - 'DocViewsRegistry' -); export const { getRequestInspectorStats, getResponseInspectorStats, tabifyAggResponse } = search; export { formatMsg, formatStack, subscribeWithScope } from '../../kibana_legacy/public'; diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 2f1f0ecc70058d..7005f8822cc00c 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -52,7 +52,6 @@ import { setUrlTracker, setAngularModule, setServices, - getHistory, } from './kibana_services'; import { createSavedSearchesLoader } from './saved_searches'; import { getInnerAngularModuleEmbeddable, getInnerAngularModule } from './get_inner_angular'; diff --git a/src/plugins/discover/public/saved_searches/_saved_search.ts b/src/plugins/discover/public/saved_searches/_saved_search.ts index 5d539482440793..9eda4f6ce9d167 100644 --- a/src/plugins/discover/public/saved_searches/_saved_search.ts +++ b/src/plugins/discover/public/saved_searches/_saved_search.ts @@ -66,7 +66,7 @@ export function createSavedSearchClass(services: SavedObjectKibanaServices) { }); this.showInRecentlyAccessed = true; this.id = id; - this.getFullPath = () => `/app/discover#//${String(id)}`; + this.getFullPath = () => `/app/discover#/${String(id)}`; } } diff --git a/src/plugins/visualize/public/application/application.ts b/src/plugins/visualize/public/application/application.ts index 9d8a1b98ef023d..f0e359dd8286c4 100644 --- a/src/plugins/visualize/public/application/application.ts +++ b/src/plugins/visualize/public/application/application.ts @@ -20,6 +20,12 @@ import './index.scss'; import angular, { IModule } from 'angular'; + +// required for i18nIdDirective +import 'angular-sanitize'; +// required for ngRoute +import 'angular-route'; + import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; import { AppMountContext } from 'kibana/public'; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5b55c7a15f1b3a..0b2f9f2ed65e17 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2000,9 +2000,6 @@ "kbn.context.olderDocumentsDescription": "古いドキュメント", "kbn.context.olderDocumentsWarning": "アンカーよりも古いドキュメントは {docCount} 件しか見つかりませんでした。", "kbn.context.olderDocumentsWarningZero": "アンカーよりも古いドキュメントは見つかりませんでした。", - "kbn.context.reloadPageDescription.discoverLinkText": "ディスカバリ", - "kbn.context.reloadPageDescription.reloadOrVisitTextMessage": "再読み込みするか", - "kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage": "にアクセスして有効な別のドキュメントを選択してください。", "kbn.context.unableToLoadAnchorDocumentDescription": "別のドキュメントが読み込めません", "kbn.context.unableToLoadDocumentDescription": "ドキュメントが読み込めません", "kbn.dashboardTitle": "ダッシュボード", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 1758588d01ba80..7dd672274b03fc 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2001,9 +2001,6 @@ "kbn.context.olderDocumentsDescription": "较旧文档", "kbn.context.olderDocumentsWarning": "仅可以找到 {docCount} 个比定位标记旧的文档。", "kbn.context.olderDocumentsWarningZero": "找不到比定位标记旧的文档。", - "kbn.context.reloadPageDescription.discoverLinkText": "Discover", - "kbn.context.reloadPageDescription.reloadOrVisitTextMessage": "请重新加载或访问", - "kbn.context.reloadPageDescription.selectValidAnchorDocumentTextMessage": "以选择有效地定位点文档。", "kbn.context.unableToLoadAnchorDocumentDescription": "无法加载该定位点文档", "kbn.context.unableToLoadDocumentDescription": "无法加载文档", "kbn.dashboardTitle": "仪表板", From 124f9a3ae5d4739b38917eb75a4d827a488cbfe1 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Sat, 25 Apr 2020 21:55:58 +0200 Subject: [PATCH 037/134] fix maps and kbn url tracker --- src/plugins/dashboard/public/application/application.ts | 4 ++-- src/plugins/discover/public/get_inner_angular.ts | 3 ++- src/plugins/discover/public/plugin.ts | 3 ++- src/plugins/visualize/public/application/application.ts | 4 ++-- x-pack/plugins/maps/public/maps_vis_type_alias.js | 5 +++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/plugins/dashboard/public/application/application.ts b/src/plugins/dashboard/public/application/application.ts index c49b93489528ed..6c77d1c93c8c44 100644 --- a/src/plugins/dashboard/public/application/application.ts +++ b/src/plugins/dashboard/public/application/application.ts @@ -92,7 +92,7 @@ export const renderApp = (element: HTMLElement, appBasePath: string, deps: Rende }; }; -const mainTemplate = (basePath: string) => `
+const mainTemplate = (basePath: string) => `
`; @@ -102,7 +102,7 @@ const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react']; function mountDashboardApp(appBasePath: string, element: HTMLElement) { const mountpoint = document.createElement('div'); - mountpoint.setAttribute('class', 'kbnLocalApplicationWrapper'); + mountpoint.setAttribute('class', 'dshAppContainer'); // eslint-disable-next-line mountpoint.innerHTML = mainTemplate(appBasePath); // bootstrap angular into detached element and attach it later to diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index b41e157fc5eb29..ee47fd84d67c30 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -20,10 +20,11 @@ // inner angular imports // these are necessary to bootstrap the local angular. // They can stay even after NP cutover +import './application/index.scss'; import angular from 'angular'; import { EuiIcon } from '@elastic/eui'; import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; -import { CoreStart, LegacyCoreStart, PluginInitializerContext } from 'kibana/public'; +import { CoreStart, PluginInitializerContext } from 'kibana/public'; import { DataPublicPluginStart } from '../../data/public'; import { Storage } from '../../kibana_utils/public'; import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 35e2c6c731acf3..71a226a773f923 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -54,7 +54,6 @@ import { setServices, } from './kibana_services'; import { createSavedSearchesLoader } from './saved_searches'; -import { getInnerAngularModuleEmbeddable, getInnerAngularModule } from './get_inner_angular'; import { registerFeature } from './register_feature'; import { buildServices } from './build_services'; @@ -249,6 +248,7 @@ export class DiscoverPlugin return; } // this is used by application mount and tests + const { getInnerAngularModule } = await import('./get_inner_angular'); const module = getInnerAngularModule( innerAngularName, core, @@ -314,6 +314,7 @@ export class DiscoverPlugin throw Error('Discover plugin getEmbeddableInjector: initializeServices is undefined'); } const { core, plugins } = await this.initializeServices(); + const { getInnerAngularModuleEmbeddable } = await import('./get_inner_angular'); getInnerAngularModuleEmbeddable( embeddableAngularName, core, diff --git a/src/plugins/visualize/public/application/application.ts b/src/plugins/visualize/public/application/application.ts index f0e359dd8286c4..e2c0cc563f70aa 100644 --- a/src/plugins/visualize/public/application/application.ts +++ b/src/plugins/visualize/public/application/application.ts @@ -61,7 +61,7 @@ export const renderApp = ( return () => $injector.get('$rootScope').$destroy(); }; -const mainTemplate = (basePath: string) => `
+const mainTemplate = (basePath: string) => `
`; @@ -72,7 +72,7 @@ const thirdPartyAngularDependencies = ['ngSanitize', 'ngRoute', 'react']; function mountVisualizeApp(appBasePath: string, element: HTMLElement) { const mountpoint = document.createElement('div'); - mountpoint.setAttribute('class', 'kbnLocalApplicationWrapper'); + mountpoint.setAttribute('class', 'visAppWrapper'); mountpoint.innerHTML = mainTemplate(appBasePath); // bootstrap angular into detached element and attach it later to // make angular-within-angular possible diff --git a/x-pack/plugins/maps/public/maps_vis_type_alias.js b/x-pack/plugins/maps/public/maps_vis_type_alias.js index 85613f4608c6f4..8481a03e12231d 100644 --- a/x-pack/plugins/maps/public/maps_vis_type_alias.js +++ b/x-pack/plugins/maps/public/maps_vis_type_alias.js @@ -5,7 +5,7 @@ */ import { i18n } from '@kbn/i18n'; -import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants'; +import { APP_ID, APP_ICON, MAP_SAVED_OBJECT_TYPE } from '../common/constants'; import { getInjectedVarFunc, getVisualizations } from './kibana_services'; export function getMapsVisTypeAlias() { @@ -27,7 +27,8 @@ The Maps app offers more functionality and is easier to use.`, ); return { - aliasUrl: MAP_BASE_URL, + aliasApp: APP_ID, + aliasPath: `#/${MAP_SAVED_OBJECT_TYPE}`, name: APP_ID, title: i18n.translate('xpack.maps.visTypeAlias.title', { defaultMessage: 'Maps', From 6a82d9cbadd80e12d9313666d2ff6d6510aa62e3 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Sat, 25 Apr 2020 22:21:58 +0200 Subject: [PATCH 038/134] fix eslint warnings --- .../public/__tests__/vis_type_vislib/_vis_fixture.js | 2 ++ .../__tests__/vis_type_vislib/lib/chart_title.js | 3 +++ .../public/__tests__/vis_type_vislib/lib/dispatch.js | 2 ++ .../__tests__/vis_type_vislib/lib/handler/handler.js | 6 ++++++ .../__tests__/vis_type_vislib/lib/layout/layout.js | 8 ++++++++ .../kibana/public/__tests__/vis_type_vislib/vis.js | 6 ++++++ .../vis_type_vislib/visualizations/area_chart.js | 7 +++++++ .../__tests__/vis_type_vislib/visualizations/chart.js | 2 ++ .../vis_type_vislib/visualizations/column_chart.js | 10 ++++++++++ .../vis_type_vislib/visualizations/gauge_chart.js | 2 ++ .../vis_type_vislib/visualizations/heatmap_chart.js | 6 ++++++ .../vis_type_vislib/visualizations/line_chart.js | 7 +++++++ .../vis_type_vislib/visualizations/pie_chart.js | 1 + 13 files changed, 62 insertions(+) diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js index 8a542fec0639c3..6730d76f1a7da4 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js @@ -20,9 +20,11 @@ import _ from 'lodash'; import $ from 'jquery'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Vis } from '../../../../../../plugins/vis_type_vislib/public/vislib/vis'; // TODO: Remove when converted to jest mocks +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ColorsService } from '../../../../../../plugins/charts/public/services'; const $visCanvas = $('
') diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js index 81fef155daf57e..cb6fd641d5e114 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js @@ -21,8 +21,11 @@ import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/chart_title'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; describe('Vislib ChartTitle Class Test Suite', function() { diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js index eb4e109690c37f..57009e1b71db8d 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js @@ -22,8 +22,10 @@ import d3 from 'd3'; import expect from '@kbn/expect'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js index 27f7f4ed3e0732..439a5a99c3cd92 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js @@ -21,11 +21,17 @@ import expect from '@kbn/expect'; import $ from 'jquery'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js index 505b0a04c61837..de75274a2e323b 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js @@ -22,13 +22,21 @@ import expect from '@kbn/expect'; import $ from 'jquery'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Layout } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/layout/layout'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { VisConfig } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js index 67f29ee96a3364..be4390a5e0b502 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js @@ -21,11 +21,17 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from './_vis_fixture'; const dataArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js index eb529c380cdda4..738d36229d422a 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js @@ -22,15 +22,22 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; const dataTypesArray = { + // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series pos': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'), + // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series pos neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'), + // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'), + // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'term columns': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'), + // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'range rows': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'), + // eslint-disable-next-line @kbn/eslint/no-restricted-paths stackedSeries: require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'), }; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js index 4c5e3db3162430..01f93b8e679cae 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js @@ -20,7 +20,9 @@ import d3 from 'd3'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Chart } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/_chart'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js index 5cbd5948bc477a..47a679b7ee5b4b 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js @@ -23,16 +23,26 @@ import $ from 'jquery'; import expect from '@kbn/expect'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import histogramRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { seriesMonthlyInterval } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rowsSeriesWithHoles } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rowsWithZeros from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js index d8ce8f1f5f44bf..932282d8deebec 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js @@ -21,7 +21,9 @@ import $ from 'jquery'; import _ from 'lodash'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js index 765b9118e68445..7a30350286d095 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js @@ -23,11 +23,17 @@ import d3 from 'd3'; import expect from '@kbn/expect'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js index 691417e968eedb..534cc1ae6622f0 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js @@ -23,12 +23,19 @@ import $ from 'jquery'; import _ from 'lodash'; // Data +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPos from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import histogramColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rangeRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js index 506ad2af85c34d..7a7657808be2e5 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js @@ -22,6 +22,7 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; From 835cf4a71461da39e3c56a24007e8bc348848810 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Sat, 25 Apr 2020 23:59:31 +0200 Subject: [PATCH 039/134] Revert "fix eslint warnings" This reverts commit 6a82d9cbadd80e12d9313666d2ff6d6510aa62e3. --- .../public/__tests__/vis_type_vislib/_vis_fixture.js | 2 -- .../__tests__/vis_type_vislib/lib/chart_title.js | 3 --- .../public/__tests__/vis_type_vislib/lib/dispatch.js | 2 -- .../__tests__/vis_type_vislib/lib/handler/handler.js | 6 ------ .../__tests__/vis_type_vislib/lib/layout/layout.js | 8 -------- .../kibana/public/__tests__/vis_type_vislib/vis.js | 6 ------ .../vis_type_vislib/visualizations/area_chart.js | 7 ------- .../__tests__/vis_type_vislib/visualizations/chart.js | 2 -- .../vis_type_vislib/visualizations/column_chart.js | 10 ---------- .../vis_type_vislib/visualizations/gauge_chart.js | 2 -- .../vis_type_vislib/visualizations/heatmap_chart.js | 6 ------ .../vis_type_vislib/visualizations/line_chart.js | 7 ------- .../vis_type_vislib/visualizations/pie_chart.js | 1 - 13 files changed, 62 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js index 6730d76f1a7da4..8a542fec0639c3 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/_vis_fixture.js @@ -20,11 +20,9 @@ import _ from 'lodash'; import $ from 'jquery'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Vis } from '../../../../../../plugins/vis_type_vislib/public/vislib/vis'; // TODO: Remove when converted to jest mocks -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ColorsService } from '../../../../../../plugins/charts/public/services'; const $visCanvas = $('
') diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js index cb6fd641d5e114..81fef155daf57e 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/chart_title.js @@ -21,11 +21,8 @@ import d3 from 'd3'; import _ from 'lodash'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { ChartTitle } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/chart_title'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { VisConfig } from '../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; describe('Vislib ChartTitle Class Test Suite', function() { diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js index 57009e1b71db8d..eb4e109690c37f 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/dispatch.js @@ -22,10 +22,8 @@ import d3 from 'd3'; import expect from '@kbn/expect'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js index 439a5a99c3cd92..27f7f4ed3e0732 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/handler/handler.js @@ -21,17 +21,11 @@ import expect from '@kbn/expect'; import $ from 'jquery'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js index de75274a2e323b..505b0a04c61837 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/lib/layout/layout.js @@ -22,21 +22,13 @@ import expect from '@kbn/expect'; import $ from 'jquery'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Layout } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/layout/layout'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { VisConfig } from '../../../../../../../../plugins/vis_type_vislib/public/vislib/lib/vis_config'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from '../../_vis_fixture'; const dateHistogramArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js index be4390a5e0b502..67f29ee96a3364 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/vis.js @@ -21,17 +21,11 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import columns from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rows from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getVis } from './_vis_fixture'; const dataArray = [series, columns, rows, stackedSeries]; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js index 738d36229d422a..eb529c380cdda4 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/area_chart.js @@ -22,22 +22,15 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; const dataTypesArray = { - // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series pos': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'), - // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series pos neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'), - // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'series neg': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'), - // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'term columns': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'), - // eslint-disable-next-line @kbn/eslint/no-restricted-paths 'range rows': require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'), - // eslint-disable-next-line @kbn/eslint/no-restricted-paths stackedSeries: require('../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'), }; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js index 01f93b8e679cae..4c5e3db3162430 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/chart.js @@ -20,9 +20,7 @@ import d3 from 'd3'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { Chart } from '../../../../../../../plugins/vis_type_vislib/public/vislib/visualizations/_chart'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js index 47a679b7ee5b4b..5cbd5948bc477a 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/column_chart.js @@ -23,26 +23,16 @@ import $ from 'jquery'; import expect from '@kbn/expect'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import histogramRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { seriesMonthlyInterval } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_monthly_interval'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { rowsSeriesWithHoles } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows_series_with_holes'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rowsWithZeros from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js index 932282d8deebec..d8ce8f1f5f44bf 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/gauge_chart.js @@ -21,9 +21,7 @@ import $ from 'jquery'; import _ from 'lodash'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import data from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series_multiple'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js index 7a30350286d095..765b9118e68445 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/heatmap_chart.js @@ -23,17 +23,11 @@ import d3 from 'd3'; import expect from '@kbn/expect'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import series from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termsColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import stackedSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_stacked_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js index 534cc1ae6622f0..691417e968eedb 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/line_chart.js @@ -23,19 +23,12 @@ import $ from 'jquery'; import _ from 'lodash'; // Data -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPos from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesPosNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_pos_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import seriesNeg from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/date_histogram/_series_neg'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import histogramColumns from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/histogram/_columns'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import rangeRows from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/range/_rows'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import termSeries from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mock_data/terms/_series'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; diff --git a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js index 7a7657808be2e5..506ad2af85c34d 100644 --- a/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/kibana/public/__tests__/vis_type_vislib/visualizations/pie_chart.js @@ -22,7 +22,6 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { getMockUiState } from '../../../../../../../plugins/vis_type_vislib/public/fixtures/mocks'; import { getVis } from '../_vis_fixture'; import { pieChartMockData } from './pie_chart_mock_data'; From 9b12ef659104599d0c3918458fda5bdd12611030 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Sun, 26 Apr 2020 00:04:14 +0200 Subject: [PATCH 040/134] fix linting exception --- .eslintrc.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index dffd8ba3f0d7dd..e7c051b041676b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -188,9 +188,6 @@ module.exports = { '(src|x-pack)/legacy/**/*', '(src|x-pack)/plugins/**/(public|server)/**/*', 'examples/**/*', - // next folder contains legacy browser tests which can't be migrated to jest - // which import np files - '!src/legacy/core_plugins/kibana/public/__tests__/**/*', ], from: [ 'src/core/public/**/*', @@ -220,6 +217,9 @@ module.exports = { 'examples/**/*', '!(src|x-pack)/**/*.test.*', '!(x-pack/)?test/**/*', + // next folder contains legacy browser tests which can't be migrated to jest + // which import np files + '!src/legacy/core_plugins/kibana/public/__tests__/**/*', ], from: [ '(src|x-pack)/plugins/**/(public|server)/**/*', From ab99f534ec5b782ce00394fdfd503af1d046a89f Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Sun, 26 Apr 2020 19:51:38 +0200 Subject: [PATCH 041/134] Remove LegacyCoreStart --- src/plugins/discover/public/get_inner_angular.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 40cf6adb172cd3..88ad67876a9dee 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -23,7 +23,7 @@ import angular from 'angular'; import { EuiIcon } from '@elastic/eui'; import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular'; -import { CoreStart, LegacyCoreStart, PluginInitializerContext } from 'kibana/public'; +import { CoreStart, PluginInitializerContext } from 'kibana/public'; import { DataPublicPluginStart } from '../../data/public'; import { Storage } from '../../kibana_utils/public'; import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public'; From 071ee2e894f4be2645ddf917b3af313165d02149 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 09:23:09 +0200 Subject: [PATCH 042/134] add defaultPath to `AppBase` and use it in `navigateToApp` --- .../application/application_service.test.ts | 60 ++++++++++++++++++- .../application/application_service.tsx | 5 +- src/core/public/application/types.ts | 15 ++++- 3 files changed, 75 insertions(+), 5 deletions(-) diff --git a/src/core/public/application/application_service.test.ts b/src/core/public/application/application_service.test.ts index c25918c6b7328c..e382ac1bf9446e 100644 --- a/src/core/public/application/application_service.test.ts +++ b/src/core/public/application/application_service.test.ts @@ -87,7 +87,7 @@ describe('#setup()', () => { ).toThrowErrorMatchingInlineSnapshot(`"Applications cannot be registered after \\"setup\\""`); }); - it('allows to register a statusUpdater for the application', async () => { + it('allows to register an AppUpdater for the application', async () => { const setup = service.setup(setupDeps); const pluginId = Symbol('plugin'); @@ -118,6 +118,7 @@ describe('#setup()', () => { updater$.next(app => ({ status: AppStatus.inaccessible, tooltip: 'App inaccessible due to reason', + defaultPath: 'foo/bar', })); applications = await applications$.pipe(take(1)).toPromise(); @@ -128,6 +129,7 @@ describe('#setup()', () => { legacy: false, navLinkStatus: AppNavLinkStatus.default, status: AppStatus.inaccessible, + defaultPath: 'foo/bar', tooltip: 'App inaccessible due to reason', }) ); @@ -209,7 +211,7 @@ describe('#setup()', () => { }); }); - describe('registerAppStatusUpdater', () => { + describe('registerAppUpdater', () => { it('updates status fields', async () => { const setup = service.setup(setupDeps); @@ -413,6 +415,36 @@ describe('#setup()', () => { }) ); }); + + it('allows to update the basePath', async () => { + const setup = service.setup(setupDeps); + + const pluginId = Symbol('plugin'); + setup.register(pluginId, createApp({ id: 'app1' })); + + const updater = new BehaviorSubject(app => ({})); + setup.registerAppUpdater(updater); + + const start = await service.start(startDeps); + await start.navigateToApp('app1'); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1', undefined); + MockHistory.push.mockClear(); + + updater.next(app => ({ defaultPath: 'default-path' })); + await start.navigateToApp('app1'); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1/default-path', undefined); + MockHistory.push.mockClear(); + + updater.next(app => ({ defaultPath: 'another-path' })); + await start.navigateToApp('app1'); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1/another-path', undefined); + MockHistory.push.mockClear(); + + updater.next(app => ({})); + await start.navigateToApp('app1'); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1', undefined); + MockHistory.push.mockClear(); + }); }); it("`registerMountContext` calls context container's registerContext", () => { @@ -676,6 +708,30 @@ describe('#start()', () => { expect(MockHistory.push).toHaveBeenCalledWith('/custom/path#/hash/router/path', undefined); }); + it('appends the defaultPath when the path parameter is not specified', async () => { + const { register } = service.setup(setupDeps); + + register(Symbol(), createApp({ id: 'app1', defaultPath: 'default/path' })); + register( + Symbol(), + createApp({ id: 'app2', appRoute: '/custom-app-path', defaultPath: '/my-base' }) + ); + + const { navigateToApp } = await service.start(startDeps); + + await navigateToApp('app1', { path: 'defined-path' }); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1/defined-path', undefined); + + await navigateToApp('app1', {}); + expect(MockHistory.push).toHaveBeenCalledWith('/app/app1/default/path', undefined); + + await navigateToApp('app2', { path: 'defined-path' }); + expect(MockHistory.push).toHaveBeenCalledWith('/custom-app-path/defined-path', undefined); + + await navigateToApp('app2', {}); + expect(MockHistory.push).toHaveBeenCalledWith('/custom-app-path/my-base', undefined); + }); + it('includes state if specified', async () => { const { register } = service.setup(setupDeps); diff --git a/src/core/public/application/application_service.tsx b/src/core/public/application/application_service.tsx index 1c9492d81c7f68..7f1c6e4c1790a6 100644 --- a/src/core/public/application/application_service.tsx +++ b/src/core/public/application/application_service.tsx @@ -82,7 +82,7 @@ const getAppUrl = (mounters: Map, appId: string, path: string = ? `/${mounters.get(appId)!.appRoute}` : `/app/${appId}`; - // Only preppend slash if not a hash or query path + // Only prepend slash if not a hash or query path path = path.startsWith('#') || path.startsWith('?') ? path : `/${path}`; return `${appBasePath}${path}` @@ -290,6 +290,9 @@ export class ApplicationService { }, navigateToApp: async (appId, { path, state }: { path?: string; state?: any } = {}) => { if (await this.shouldNavigate(overlays)) { + if (path === undefined) { + path = applications$.value.get(appId)?.defaultPath; + } this.appLeaveHandlers.delete(this.currentAppId$.value!); this.navigate!(getAppUrl(availableMounters, appId, path), state); this.currentAppId$.next(appId); diff --git a/src/core/public/application/types.ts b/src/core/public/application/types.ts index 318afb652999ef..0734e178033e24 100644 --- a/src/core/public/application/types.ts +++ b/src/core/public/application/types.ts @@ -66,6 +66,13 @@ export interface AppBase { */ navLinkStatus?: AppNavLinkStatus; + /** + * Allow to define the default path a user should be directed to when navigating to the app. + * When defined, this value will be used as a default for the `path` option when calling {@link ApplicationStart.navigateToApp | navigateToApp}`, + * and will also be appended to the {@link ChromeNavLink | application navLink} in the navigation bar. + */ + defaultPath?: string; + /** * An {@link AppUpdater} observable that can be used to update the application {@link AppUpdatableFields} at runtime. * @@ -187,7 +194,10 @@ export enum AppNavLinkStatus { * Defines the list of fields that can be updated via an {@link AppUpdater}. * @public */ -export type AppUpdatableFields = Pick; +export type AppUpdatableFields = Pick< + AppBase, + 'status' | 'navLinkStatus' | 'tooltip' | 'defaultPath' +>; /** * Updater for applications. @@ -642,7 +652,8 @@ export interface ApplicationStart { * Navigate to a given app * * @param appId - * @param options.path - optional path inside application to deep link to + * @param options.path - optional path inside application to deep link to. + * If undefined, will use {@link AppBase.defaultPath | the app's default path}` as default. * @param options.state - optional state to forward to the application */ navigateToApp(appId: string, options?: { path?: string; state?: any }): Promise; From b4fa07d437b3f012e67afd08cb21a95143cc83e5 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 09:32:42 +0200 Subject: [PATCH 043/134] update yarn.lock --- yarn.lock | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/yarn.lock b/yarn.lock index 93b9bbe127d348..866aa7255baaa3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20589,11 +20589,6 @@ minimist@^1.2.5: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= - minimost@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/minimost/-/minimost-1.0.0.tgz#1d07954aa0268873408b95552fbffc5977dfc78b" @@ -22051,14 +22046,6 @@ optimism@^0.9.0: dependencies: "@wry/context" "^0.4.0" -optimist@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" - integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY= - dependencies: - minimist "~0.0.1" - wordwrap "~0.0.2" - optional-js@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/optional-js/-/optional-js-2.1.1.tgz#c2dc519ad119648510b4d241dbb60b1167c36a46" @@ -31850,11 +31837,6 @@ wordwrap@^1.0.0, wordwrap@~1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= - worker-farm@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" From 3ae2f6e4f8d87dbe9a7ad80341770ae6e68059ac Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 09:38:34 +0200 Subject: [PATCH 044/134] add removeSlashes util --- .../application/application_service.tsx | 9 ++-- src/core/public/application/utils.test.ts | 53 +++++++++++++++++++ src/core/public/application/utils.ts | 42 +++++++++++++++ 3 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 src/core/public/application/utils.test.ts create mode 100644 src/core/public/application/utils.ts diff --git a/src/core/public/application/application_service.tsx b/src/core/public/application/application_service.tsx index 7f1c6e4c1790a6..d0ff7b5bd50a3c 100644 --- a/src/core/public/application/application_service.tsx +++ b/src/core/public/application/application_service.tsx @@ -46,6 +46,7 @@ import { Mounter, } from './types'; import { getLeaveAction, isConfirmAction } from './application_leave'; +import { removeSlashes } from './utils'; interface SetupDeps { context: ContextSetup; @@ -85,9 +86,11 @@ const getAppUrl = (mounters: Map, appId: string, path: string = // Only prepend slash if not a hash or query path path = path.startsWith('#') || path.startsWith('?') ? path : `/${path}`; - return `${appBasePath}${path}` - .replace(/\/{2,}/g, '/') // Remove duplicate slashes - .replace(/\/$/, ''); // Remove trailing slash + return removeSlashes(`${appBasePath}${path}`, { + trailing: true, + duplicates: true, + leading: false, + }); }; const allApplicationsFilter = '__ALL__'; diff --git a/src/core/public/application/utils.test.ts b/src/core/public/application/utils.test.ts new file mode 100644 index 00000000000000..e913cf8d86a6e3 --- /dev/null +++ b/src/core/public/application/utils.test.ts @@ -0,0 +1,53 @@ +/* + * 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 { removeSlashes } from './utils'; + +describe('removeSlashes', () => { + it('only removes duplicates by default', () => { + expect(removeSlashes('/some//url//to//')).toEqual('/some/url/to/'); + expect(removeSlashes('some/////other//url')).toEqual('some/other/url'); + }); + + it('remove trailing slash when `trailing` is true', () => { + expect(removeSlashes('/some//url//to//', { trailing: true })).toEqual('/some/url/to'); + }); + + it('remove leading slash when `leading` is true', () => { + expect(removeSlashes('/some//url//to//', { leading: true })).toEqual('some/url/to/'); + }); + + it('does not removes duplicates when `duplicates` is false', () => { + expect(removeSlashes('/some//url//to/', { leading: true, duplicates: false })).toEqual( + 'some//url//to/' + ); + expect(removeSlashes('/some//url//to/', { trailing: true, duplicates: false })).toEqual( + '/some//url//to' + ); + }); + + it('accept mixed options', () => { + expect( + removeSlashes('/some//url//to/', { leading: true, duplicates: false, trailing: true }) + ).toEqual('some//url//to'); + expect( + removeSlashes('/some//url//to/', { leading: true, duplicates: true, trailing: true }) + ).toEqual('some/url/to'); + }); +}); diff --git a/src/core/public/application/utils.ts b/src/core/public/application/utils.ts new file mode 100644 index 00000000000000..641d7bc4164f48 --- /dev/null +++ b/src/core/public/application/utils.ts @@ -0,0 +1,42 @@ +/* + * 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. + */ + +/** + * Utility to remove trailing, leading or duplicate slashes. + * By default will only remove duplicates. + */ +export const removeSlashes = ( + url: string, + { + trailing = false, + leading = false, + duplicates = true, + }: { trailing?: boolean; leading?: boolean; duplicates?: boolean } = {} +): string => { + if (duplicates) { + url = url.replace(/\/{2,}/g, '/'); + } + if (trailing) { + url = url.replace(/\/$/, ''); + } + if (leading) { + url = url.replace(/^\//, ''); + } + return url; +}; From a5a3554a049d0c76e088842fd22c98c49c6531d2 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 09:53:53 +0200 Subject: [PATCH 045/134] adapt `toNavLink` to handle defaultPath --- .../chrome/nav_links/to_nav_link.test.ts | 25 +++++++++++++++++++ .../public/chrome/nav_links/to_nav_link.ts | 22 +++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/core/public/chrome/nav_links/to_nav_link.test.ts b/src/core/public/chrome/nav_links/to_nav_link.test.ts index 23fdabe0f34301..5c6de38ded3116 100644 --- a/src/core/public/chrome/nav_links/to_nav_link.test.ts +++ b/src/core/public/chrome/nav_links/to_nav_link.test.ts @@ -85,6 +85,31 @@ describe('toNavLink', () => { expect(link.properties.baseUrl).toEqual('http://localhost/base-path/my-route/my-path'); }); + //// + it('appends the defaultPath when present on app', () => { + const link = toNavLink( + app({ + appRoute: '/my-route/my-path', + defaultPath: 'some/default/path', + }), + basePath + ); + expect(link.properties.baseUrl).toEqual( + 'http://localhost/base-path/my-route/my-path/some/default/path' + ); + }); + + it('does not use defaultPath for legacy apps', () => { + const link = toNavLink( + legacyApp({ + appUrl: '/my-legacy-app/#foo', + defaultPath: '/some/default/path', + }), + basePath + ); + expect(link.properties.baseUrl).toEqual('http://localhost/base-path/my-legacy-app/#foo'); + }); + it('uses appUrl when converting legacy applications', () => { expect( toNavLink( diff --git a/src/core/public/chrome/nav_links/to_nav_link.ts b/src/core/public/chrome/nav_links/to_nav_link.ts index 18e4b7b26b6ba1..b4789a7c0171f5 100644 --- a/src/core/public/chrome/nav_links/to_nav_link.ts +++ b/src/core/public/chrome/nav_links/to_nav_link.ts @@ -20,6 +20,7 @@ import { App, AppNavLinkStatus, AppStatus, LegacyApp } from '../../application'; import { IBasePath } from '../../http'; import { NavLinkWrapper } from './nav_link'; +import { removeSlashes } from '../../application/utils'; export function toNavLink(app: App | LegacyApp, basePath: IBasePath): NavLinkWrapper { const useAppStatus = app.navLinkStatus === AppNavLinkStatus.default; @@ -30,12 +31,27 @@ export function toNavLink(app: App | LegacyApp, basePath: IBasePath): NavLinkWra : app.navLinkStatus === AppNavLinkStatus.hidden, disabled: useAppStatus ? false : app.navLinkStatus === AppNavLinkStatus.disabled, legacy: isLegacyApp(app), - baseUrl: isLegacyApp(app) - ? relativeToAbsolute(basePath.prepend(app.appUrl)) - : relativeToAbsolute(basePath.prepend(app.appRoute!)), + baseUrl: getBaseUrl(app, basePath), }); } +const getBaseUrl = (app: App | LegacyApp, basePath: IBasePath): string => { + if (isLegacyApp(app)) { + return relativeToAbsolute(basePath.prepend(app.appUrl)); + } + let baseUrl = basePath.prepend(app.appRoute!); + if (app.defaultPath) { + baseUrl = `${baseUrl}/${app.defaultPath}`; + } + return relativeToAbsolute( + removeSlashes(baseUrl, { + trailing: true, + duplicates: true, + leading: false, + }) + ); +}; + function relativeToAbsolute(url: string) { // convert all link urls to absolute urls const a = document.createElement('a'); From 52538ae0e498f0bebc0c5d179ebb3e8fc530a619 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 09:58:54 +0200 Subject: [PATCH 046/134] update generated doc --- ...kibana-plugin-core-public.appbase.defaultpath.md | 13 +++++++++++++ .../public/kibana-plugin-core-public.appbase.md | 1 + .../kibana-plugin-core-public.appupdatablefields.md | 2 +- src/core/public/public.api.md | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docs/development/core/public/kibana-plugin-core-public.appbase.defaultpath.md diff --git a/docs/development/core/public/kibana-plugin-core-public.appbase.defaultpath.md b/docs/development/core/public/kibana-plugin-core-public.appbase.defaultpath.md new file mode 100644 index 00000000000000..51492756ef2327 --- /dev/null +++ b/docs/development/core/public/kibana-plugin-core-public.appbase.defaultpath.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [AppBase](./kibana-plugin-core-public.appbase.md) > [defaultPath](./kibana-plugin-core-public.appbase.defaultpath.md) + +## AppBase.defaultPath property + +Allow to define the default path a user should be directed to when navigating to the app. When defined, this value will be used as a default for the `path` option when calling [navigateToApp](./kibana-plugin-core-public.applicationstart.navigatetoapp.md)\`, and will also be appended to the [application navLink](./kibana-plugin-core-public.chromenavlink.md) in the navigation bar. + +Signature: + +```typescript +defaultPath?: string; +``` diff --git a/docs/development/core/public/kibana-plugin-core-public.appbase.md b/docs/development/core/public/kibana-plugin-core-public.appbase.md index b73785647f23cc..7b624f12ac1df0 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appbase.md +++ b/docs/development/core/public/kibana-plugin-core-public.appbase.md @@ -18,6 +18,7 @@ export interface AppBase | [capabilities](./kibana-plugin-core-public.appbase.capabilities.md) | Partial<Capabilities> | Custom capabilities defined by the app. | | [category](./kibana-plugin-core-public.appbase.category.md) | AppCategory | The category definition of the product See [AppCategory](./kibana-plugin-core-public.appcategory.md) See DEFAULT\_APP\_CATEGORIES for more reference | | [chromeless](./kibana-plugin-core-public.appbase.chromeless.md) | boolean | Hide the UI chrome when the application is mounted. Defaults to false. Takes precedence over chrome service visibility settings. | +| [defaultPath](./kibana-plugin-core-public.appbase.defaultpath.md) | string | Allow to define the default path a user should be directed to when navigating to the app. When defined, this value will be used as a default for the path option when calling [navigateToApp](./kibana-plugin-core-public.applicationstart.navigatetoapp.md)\`, and will also be appended to the [application navLink](./kibana-plugin-core-public.chromenavlink.md) in the navigation bar. | | [euiIconType](./kibana-plugin-core-public.appbase.euiicontype.md) | string | A EUI iconType that will be used for the app's icon. This icon takes precendence over the icon property. | | [icon](./kibana-plugin-core-public.appbase.icon.md) | string | A URL to an image file used as an icon. Used as a fallback if euiIconType is not provided. | | [id](./kibana-plugin-core-public.appbase.id.md) | string | The unique identifier of the application | diff --git a/docs/development/core/public/kibana-plugin-core-public.appupdatablefields.md b/docs/development/core/public/kibana-plugin-core-public.appupdatablefields.md index cdf9171a46aed0..3d8b5d115c8a27 100644 --- a/docs/development/core/public/kibana-plugin-core-public.appupdatablefields.md +++ b/docs/development/core/public/kibana-plugin-core-public.appupdatablefields.md @@ -9,5 +9,5 @@ Defines the list of fields that can be updated via an [AppUpdater](./kibana-plug Signature: ```typescript -export declare type AppUpdatableFields = Pick; +export declare type AppUpdatableFields = Pick; ``` diff --git a/src/core/public/public.api.md b/src/core/public/public.api.md index b92bb209d26073..39a1b829cef366 100644 --- a/src/core/public/public.api.md +++ b/src/core/public/public.api.md @@ -36,6 +36,7 @@ export interface AppBase { capabilities?: Partial; category?: AppCategory; chromeless?: boolean; + defaultPath?: string; euiIconType?: string; icon?: string; id: string; @@ -168,7 +169,7 @@ export enum AppStatus { export type AppUnmount = () => void; // @public -export type AppUpdatableFields = Pick; +export type AppUpdatableFields = Pick; // @public export type AppUpdater = (app: AppBase) => Partial | undefined; From 08d81aff78ddc7431c6e2a368a7866e14ee22475 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 09:59:27 +0200 Subject: [PATCH 047/134] codestyle --- src/core/public/chrome/nav_links/to_nav_link.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/public/chrome/nav_links/to_nav_link.test.ts b/src/core/public/chrome/nav_links/to_nav_link.test.ts index 5c6de38ded3116..1fbf58e552cac2 100644 --- a/src/core/public/chrome/nav_links/to_nav_link.test.ts +++ b/src/core/public/chrome/nav_links/to_nav_link.test.ts @@ -85,7 +85,6 @@ describe('toNavLink', () => { expect(link.properties.baseUrl).toEqual('http://localhost/base-path/my-route/my-path'); }); - //// it('appends the defaultPath when present on app', () => { const link = toNavLink( app({ From 5122bbbe620e7719d9e2382c8a0e913f5afe3a66 Mon Sep 17 00:00:00 2001 From: pgayvallet Date: Mon, 27 Apr 2020 10:28:29 +0200 Subject: [PATCH 048/134] add FTR test --- .../core_plugins/application_status.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/plugin_functional/test_suites/core_plugins/application_status.ts b/test/plugin_functional/test_suites/core_plugins/application_status.ts index b6d13a5604011f..c384e41851e15f 100644 --- a/test/plugin_functional/test_suites/core_plugins/application_status.ts +++ b/test/plugin_functional/test_suites/core_plugins/application_status.ts @@ -17,6 +17,7 @@ * under the License. */ +import url from 'url'; import expect from '@kbn/expect'; import { AppNavLinkStatus, @@ -26,6 +27,15 @@ import { import { PluginFunctionalProviderContext } from '../../services'; import '../../plugins/core_app_status/public/types'; +const getKibanaUrl = (pathname?: string, search?: string) => + url.format({ + protocol: 'http:', + hostname: process.env.TEST_KIBANA_HOST || 'localhost', + port: process.env.TEST_KIBANA_PORT || '5620', + pathname, + search, + }); + // eslint-disable-next-line import/no-default-export export default function({ getService, getPageObjects }: PluginFunctionalProviderContext) { const PageObjects = getPageObjects(['common']); @@ -97,6 +107,22 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider expect(await testSubjects.exists('appStatusApp')).to.eql(true); }); + it('allows to change the defaultPath of an application', async () => { + let link = await appsMenu.getLink('App Status'); + expect(link!.href).to.eql(getKibanaUrl('/app/app_status')); + + await setAppStatus({ + defaultPath: '/arbitrary/path', + }); + + link = await appsMenu.getLink('App Status'); + expect(link!.href).to.eql(getKibanaUrl('/app/app_status/arbitrary/path')); + + await navigateToApp('app_status'); + expect(await testSubjects.exists('appStatusApp')).to.eql(true); + expect(await browser.getCurrentUrl()).to.eql(getKibanaUrl('/app/app_status/arbitrary/path')); + }); + it('can change the state of the currently mounted app', async () => { await setAppStatus({ status: AppStatus.accessible, From 7e396262f87ce4f08ef5f5472e137ee619abe693 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 11:15:44 +0200 Subject: [PATCH 049/134] migrate short urls --- .../public/forward_app/forward_app.ts | 48 +++++++++++++ .../kibana_legacy/public/forward_app/index.ts | 20 ++++++ .../navigate_to_legacy_kibana_url.test.ts | 69 +++++++++++++++++++ .../navigate_to_legacy_kibana_url.ts | 48 +++++++++++++ src/plugins/kibana_legacy/public/plugin.ts | 5 +- .../saved_objects/kibana_app_migration.ts | 38 ++++++++++ src/plugins/share/server/saved_objects/url.ts | 7 +- 7 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 src/plugins/kibana_legacy/public/forward_app/forward_app.ts create mode 100644 src/plugins/kibana_legacy/public/forward_app/index.ts create mode 100644 src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.test.ts create mode 100644 src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.ts create mode 100644 src/plugins/share/server/saved_objects/kibana_app_migration.ts diff --git a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts new file mode 100644 index 00000000000000..1c2e7487cc7927 --- /dev/null +++ b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts @@ -0,0 +1,48 @@ +/* + * 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 { AppMountParameters, CoreSetup } from 'kibana/public'; +import { navigateToLegacyKibanaUrl } from './navigate_to_legacy_kibana_url'; +import { KibanaLegacyStart } from '../plugin'; + +export const createLegacyUrlForwardApp = (core: CoreSetup<{}, KibanaLegacyStart>) => ({ + id: 'url_migrate', + chromeless: true, + title: 'Legacy URL migration', + async mount(params: AppMountParameters) { + const hash = params.history.location.hash.substr(1); + + if (!hash) { + throw new Error('Could not forward URL'); + } + + const [ + { + application, + http: { basePath }, + }, + , + { getForwards }, + ] = await core.getStartServices(); + + navigateToLegacyKibanaUrl(hash, getForwards(), basePath, application, window.location); + + return () => {}; + }, +}); diff --git a/src/plugins/kibana_legacy/public/forward_app/index.ts b/src/plugins/kibana_legacy/public/forward_app/index.ts new file mode 100644 index 00000000000000..2f7278e8619117 --- /dev/null +++ b/src/plugins/kibana_legacy/public/forward_app/index.ts @@ -0,0 +1,20 @@ +/* + * 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 * from './forward_app'; diff --git a/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.test.ts b/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.test.ts new file mode 100644 index 00000000000000..de8fa9de7241eb --- /dev/null +++ b/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.test.ts @@ -0,0 +1,69 @@ +/* + * 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 { ForwardDefinition } from '../index'; +import { navigateToLegacyKibanaUrl } from './navigate_to_legacy_kibana_url'; +import { CoreStart } from '../../../../core/public'; +import { coreMock } from '../../../../core/public/mocks'; + +describe('migrate legacy kibana urls', () => { + let forwardDefinitions: ForwardDefinition[]; + let coreStart: CoreStart; + let locationMock: Location; + + beforeEach(() => { + coreStart = coreMock.createStart({ basePath: '/base/path' }); + forwardDefinitions = [ + { + legacyAppId: 'myApp', + newAppId: 'updatedApp', + rewritePath: jest.fn(() => '/new/path'), + }, + ]; + locationMock = { href: '' } as Location; + }); + + it('should redirect to kibana if no forward definition is found', () => { + navigateToLegacyKibanaUrl( + '/myOtherApp/deep/path', + forwardDefinitions, + coreStart.http.basePath, + coreStart.application, + locationMock + ); + + expect(locationMock.href).toEqual('/base/path/app/kibana#/myOtherApp/deep/path'); + }); + + it('should call navigateToApp with migrated URL', () => { + navigateToLegacyKibanaUrl( + '/myApp/deep/path', + forwardDefinitions, + coreStart.http.basePath, + coreStart.application, + locationMock + ); + + expect(coreStart.application.navigateToApp).toHaveBeenCalledWith('updatedApp', { + path: '/new/path', + }); + expect(forwardDefinitions[0].rewritePath).toHaveBeenCalledWith('/myApp/deep/path'); + expect(locationMock.href).toEqual(''); + }); +}); diff --git a/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.ts b/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.ts new file mode 100644 index 00000000000000..58d086e7f24a9e --- /dev/null +++ b/src/plugins/kibana_legacy/public/forward_app/navigate_to_legacy_kibana_url.ts @@ -0,0 +1,48 @@ +/* + * 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 { ApplicationStart, IBasePath } from 'kibana/public'; +import { ForwardDefinition } from '../index'; + +export const navigateToLegacyKibanaUrl = ( + path: string, + forwards: ForwardDefinition[], + basePath: IBasePath, + application: ApplicationStart, + location: Location +) => { + // navigate to the respective path in the legacy kibana plugin by default (for unmigrated plugins) + let targetAppId = 'kibana'; + let targetAppPath = path; + + // try to find an existing redirect for the target path if possible + // this avoids having to load the legacy app just to get redirected to a core application again afterwards + const relevantForward = forwards.find(forward => path.startsWith(`/${forward.legacyAppId}`)); + if (relevantForward) { + targetAppPath = relevantForward.rewritePath(path); + targetAppId = relevantForward.newAppId; + } + + if (targetAppId === 'kibana') { + // exception for kibana app because redirect won't work right otherwise + location.href = basePath.prepend(`/app/kibana#${targetAppPath}`); + } else { + application.navigateToApp(targetAppId, { path: targetAppPath }); + } +}; diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index c4c97448c98561..ea52b9ec463cd5 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -23,11 +23,13 @@ import { PluginInitializerContext, AppUpdatableFields, CoreStart, + CoreSetup, } from 'kibana/public'; import { Observable, Subscription } from 'rxjs'; import { ConfigSchema } from '../config'; import { getDashboardConfig } from './dashboard_config'; import { navigateToDefaultApp } from './navigate_to_default_app'; +import { createLegacyUrlForwardApp } from './forward_app'; interface LegacyAppAliasDefinition { legacyAppId: string; @@ -68,7 +70,8 @@ export class KibanaLegacyPlugin { constructor(private readonly initializerContext: PluginInitializerContext) {} - public setup() { + public setup(core: CoreSetup<{}, KibanaLegacyStart>) { + core.application.register(createLegacyUrlForwardApp(core)); return { /** * @deprecated diff --git a/src/plugins/share/server/saved_objects/kibana_app_migration.ts b/src/plugins/share/server/saved_objects/kibana_app_migration.ts new file mode 100644 index 00000000000000..1fc8c07e047db8 --- /dev/null +++ b/src/plugins/share/server/saved_objects/kibana_app_migration.ts @@ -0,0 +1,38 @@ +/* + * 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 { SavedObjectMigrationFn } from 'kibana/server'; + +/** + * To avoid loading the client twice for old short urls pointing to the /app/kibana app, + * this PR rewrites them to point to the new platform app url_migrate instead. This app will + * migrate the url on the fly and redirect the user to the actual new location of the short url + * without loading the page again. + * @param doc + */ +export const migrateLegacyKibanaAppShortUrls: SavedObjectMigrationFn = doc => ({ + ...doc, + attributes: { + ...doc.attributes, + url: + typeof doc.attributes.url === 'string' && doc.attributes.url.startsWith('/app/kibana') + ? doc.attributes.url.replace('/app/kibana', '/app/url_migrate') + : doc.attributes.url, + }, +}); diff --git a/src/plugins/share/server/saved_objects/url.ts b/src/plugins/share/server/saved_objects/url.ts index c76c21993a13f1..3103777179741d 100644 --- a/src/plugins/share/server/saved_objects/url.ts +++ b/src/plugins/share/server/saved_objects/url.ts @@ -16,7 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { SavedObjectsType } from 'kibana/server'; +import { SavedObjectMigrationFn, SavedObjectsType } from 'kibana/server'; +import { flow } from 'lodash'; +import { migrateLegacyKibanaAppShortUrls } from './kibana_app_migration'; export const url: SavedObjectsType = { name: 'url', @@ -30,6 +32,9 @@ export const url: SavedObjectsType = { return `/goto/${encodeURIComponent(obj.id)}`; }, }, + migrations: { + '7.9.0': flow(migrateLegacyKibanaAppShortUrls), + }, mappings: { properties: { accessCount: { From 1cf393c3b4553a84e61a9e541838146af8f6273f Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 12:02:37 +0200 Subject: [PATCH 050/134] fix titles and types --- src/plugins/dashboard/public/application/legacy_app.js | 3 +++ src/plugins/dev_tools/public/application.tsx | 9 +++++++++ src/plugins/home/public/plugin.ts | 4 ++++ .../kibana_legacy/public/forward_app/forward_app.ts | 6 ++++-- .../public/application/listing/visualize_listing.js | 4 ++++ x-pack/plugins/graph/public/plugin.ts | 3 +++ x-pack/plugins/lens/public/plugin.tsx | 5 +++++ 7 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/plugins/dashboard/public/application/legacy_app.js b/src/plugins/dashboard/public/application/legacy_app.js index cfdb2c410fc8aa..d12d9de8c7dd49 100644 --- a/src/plugins/dashboard/public/application/legacy_app.js +++ b/src/plugins/dashboard/public/application/legacy_app.js @@ -97,6 +97,9 @@ export function initDashboardApp(app, deps) { ...defaults, template: dashboardListingTemplate, controller: function($scope, kbnUrlStateStorage, history) { + deps.core.chrome.docTitle.change( + i18n.translate('dashboard.dashboardPageTitle', { defaultMessage: 'Dashboards' }) + ); const service = deps.savedDashboards; const dashboardConfig = deps.dashboardConfig; diff --git a/src/plugins/dev_tools/public/application.tsx b/src/plugins/dev_tools/public/application.tsx index 432c429bbd9637..dab5f522c80087 100644 --- a/src/plugins/dev_tools/public/application.tsx +++ b/src/plugins/dev_tools/public/application.tsx @@ -136,6 +136,14 @@ function setBadge(appMountContext: AppMountContext) { }); } +function setTitle(appMountContext: AppMountContext) { + appMountContext.core.chrome.docTitle.change( + i18n.translate('devTools.pageTitle', { + defaultMessage: 'Dev Tools', + }) + ); +} + function setBreadcrumbs(appMountContext: AppMountContext) { appMountContext.core.chrome.setBreadcrumbs([ { @@ -158,6 +166,7 @@ export function renderApp( } setBadge(appMountContext); setBreadcrumbs(appMountContext); + setTitle(appMountContext); ReactDOM.render( diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 37f1488d5081bb..01835a5bc131f6 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -24,6 +24,7 @@ import { Plugin, PluginInitializerContext, } from 'kibana/public'; +import { i18n } from '@kbn/i18n'; import { EnvironmentService, @@ -97,6 +98,9 @@ export class HomePublicPlugin tutorialService: this.tutorialService, featureCatalogue: this.featuresCatalogueRegistry, }); + coreStart.chrome.docTitle.change( + i18n.translate('home.pageTitle', { defaultMessage: 'Home' }) + ); const { renderApp } = await import('./application'); return await renderApp(params.element); }, diff --git a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts index 1c2e7487cc7927..a85ea8d807d5fc 100644 --- a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts +++ b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts @@ -19,9 +19,11 @@ import { AppMountParameters, CoreSetup } from 'kibana/public'; import { navigateToLegacyKibanaUrl } from './navigate_to_legacy_kibana_url'; -import { KibanaLegacyStart } from '../plugin'; +import { ForwardDefinition } from '../plugin'; -export const createLegacyUrlForwardApp = (core: CoreSetup<{}, KibanaLegacyStart>) => ({ +export const createLegacyUrlForwardApp = ( + core: CoreSetup<{}, { getForwards: () => ForwardDefinition[] }> +) => ({ id: 'url_migrate', chromeless: true, title: 'Legacy URL migration', diff --git a/src/plugins/visualize/public/application/listing/visualize_listing.js b/src/plugins/visualize/public/application/listing/visualize_listing.js index 75e17237aa9d11..2a8c80f9352a5c 100644 --- a/src/plugins/visualize/public/application/listing/visualize_listing.js +++ b/src/plugins/visualize/public/application/listing/visualize_listing.js @@ -46,6 +46,10 @@ export function VisualizeListingController($scope, createNewVis, kbnUrlStateStor core: { docLinks, savedObjects, uiSettings, application }, } = getServices(); + chrome.docTitle.change( + i18n.translate('visualize.listingPageTitle', { defaultMessage: 'Visualize' }) + ); + // syncs `_g` portion of url with query services const { stop: stopSyncingQueryServiceStateWithUrl } = syncQueryStateWithUrl( query, diff --git a/x-pack/plugins/graph/public/plugin.ts b/x-pack/plugins/graph/public/plugin.ts index 5521de705b6ec7..576aad199b806e 100644 --- a/x-pack/plugins/graph/public/plugin.ts +++ b/x-pack/plugins/graph/public/plugin.ts @@ -72,6 +72,9 @@ export class GraphPlugin category: DEFAULT_APP_CATEGORIES.analyze, mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart] = await core.getStartServices(); + coreStart.chrome.docTitle.change( + i18n.translate('xpack.graph.pageTitle', { defaultMessage: 'Graph' }) + ); const { renderApp } = await import('./application'); return renderApp({ ...params, diff --git a/x-pack/plugins/lens/public/plugin.tsx b/x-pack/plugins/lens/public/plugin.tsx index fdadd42e4fa778..66f1d54bee2bba 100644 --- a/x-pack/plugins/lens/public/plugin.tsx +++ b/x-pack/plugins/lens/public/plugin.tsx @@ -8,6 +8,7 @@ import React from 'react'; import { FormattedMessage, I18nProvider } from '@kbn/i18n/react'; import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom'; import { render, unmountComponentAtNode } from 'react-dom'; +import { i18n } from '@kbn/i18n'; import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; @@ -107,6 +108,10 @@ export class LensPlugin { const savedObjectsClient = coreStart.savedObjects.client; addHelpMenuToAppChrome(coreStart.chrome, coreStart.docLinks); + coreStart.chrome.docTitle.change( + i18n.translate('xpack.lens.pageTitle', { defaultMessage: 'Lens' }) + ); + const instance = await this.createEditorFrame!(); setReportManager( From a3080f248281c0cb77484e9564c8687c3d4ebb8a Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 27 Apr 2020 12:59:33 +0200 Subject: [PATCH 051/134] Update generated doc --- ...-public.indexpatternfield._constructor_.md | 3 +- ...n-plugins-data-public.indexpatternfield.md | 2 +- ...lic.indexpatternfieldlist._constructor_.md | 3 +- ...ugins-data-public.indexpatternfieldlist.md | 2 +- ...in-plugins-data-public.querystringinput.md | 2 +- ...ibana-plugin-plugins-data-public.search.md | 68 +++++++++---------- ...na-plugin-plugins-data-public.searchbar.md | 4 +- src/plugins/data/public/public.api.md | 14 ++-- 8 files changed, 51 insertions(+), 47 deletions(-) diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md index cf7470c035a533..cd59e985e8a920 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md @@ -9,13 +9,14 @@ Constructs a new instance of the `Field` class Signature: ```typescript -constructor(indexPattern: IndexPattern, spec: FieldSpec | Field, shortDotsEnable?: boolean); +constructor({ fieldFormats, toastNotifications };: Deps, indexPattern;: IndexPattern, spec;: FieldSpec | Field, shortDotsEnable?: boolean;) ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | +| { fieldFormats, toastNotifications } | Deps | | | indexPattern | IndexPattern | | | spec | FieldSpec | Field | | | shortDotsEnable | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md index df0de6ce0e5419..e1f783f8ec1592 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfield.md @@ -14,7 +14,7 @@ export declare class Field implements IFieldType | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(indexPattern, spec, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md) | | Constructs a new instance of the Field class | +| [(constructor)({ fieldFormats, toastNotifications }, indexPattern, spec, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfield._constructor_.md) | | Constructs a new instance of the Field class | ## Properties diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md index 2207107db8b2b4..686e576f42c3de 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md @@ -9,13 +9,14 @@ Constructs a new instance of the `FieldList` class Signature: ```typescript -constructor(indexPattern: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean); +constructor({ fieldFormats, toastNotifications };: Deps, indexPattern;: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean;) ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | +| { fieldFormats, toastNotifications } | Deps | | | indexPattern | IndexPattern | | | specs | FieldSpec[] | | | shortDotsEnable | boolean | | diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md index 478b73f5f85813..6eb4cb5d736d3d 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.indexpatternfieldlist.md @@ -14,7 +14,7 @@ export declare class FieldList extends Array implements IFieldList | Constructor | Modifiers | Description | | --- | --- | --- | -| [(constructor)(indexPattern, specs, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md) | | Constructs a new instance of the FieldList class | +| [(constructor)({ fieldFormats, toastNotifications }, indexPattern, specs, shortDotsEnable)](./kibana-plugin-plugins-data-public.indexpatternfieldlist._constructor_.md) | | Constructs a new instance of the FieldList class | ## Properties diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md index d0d4cc491e1428..a9ed571b80bbc2 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.querystringinput.md @@ -7,5 +7,5 @@ Signature: ```typescript -QueryStringInput: React.FC> +React.FC> ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md index 9a22339fd05307..f377360bbf1863 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md @@ -7,42 +7,42 @@ Signature: ```typescript -search: { - aggs: { - AggConfigs: typeof AggConfigs; - aggGroupNamesMap: () => Record<"metrics" | "buckets", string>; - aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters; - CidrMask: typeof CidrMask; - convertDateRangeToString: typeof convertDateRangeToString; - convertIPRangeToString: (range: import("./search").IpRangeKey, format: (val: any) => string) => string; - dateHistogramInterval: typeof dateHistogramInterval; - intervalOptions: ({ +{ + { + typeof AggConfigs; + () => Record<"buckets" | "metrics", string>; + import("./search/aggs/filter/agg_type_filters").AggTypeFilters; + typeof CidrMask; + typeof convertDateRangeToString; + (range: import("./search").IpRangeKey, format: (val: any) => string) => string; + typeof dateHistogramInterval; + ({ display: string; - val: string; - enabled(agg: import("./search/aggs/buckets/bucket_agg_type").IBucketAggConfig): boolean | "" | undefined; + string; + enabled(agg;: import("./search/aggs/buckets/bucket_agg_type").IBucketAggConfig;): boolean | "" | undefined; } | { - display: string; - val: string; + string; + string; })[]; - InvalidEsCalendarIntervalError: typeof InvalidEsCalendarIntervalError; - InvalidEsIntervalFormatError: typeof InvalidEsIntervalFormatError; - isDateHistogramBucketAggConfig: typeof isDateHistogramBucketAggConfig; - isNumberType: (agg: import("./search").AggConfig) => boolean; - isStringType: (agg: import("./search").AggConfig) => boolean; - isType: (...types: string[]) => (agg: import("./search").AggConfig) => boolean; - isValidEsInterval: typeof isValidEsInterval; - isValidInterval: typeof isValidInterval; - parentPipelineType: string; - parseEsInterval: typeof parseEsInterval; - parseInterval: typeof parseInterval; - propFilter: typeof propFilter; - siblingPipelineType: string; - termsAggFilter: string[]; - toAbsoluteDates: typeof toAbsoluteDates; - }; - getRequestInspectorStats: typeof getRequestInspectorStats; - getResponseInspectorStats: typeof getResponseInspectorStats; - tabifyAggResponse: typeof tabifyAggResponse; - tabifyGetColumns: typeof tabifyGetColumns; + typeof InvalidEsCalendarIntervalError; + typeof InvalidEsIntervalFormatError; + typeof isDateHistogramBucketAggConfig; + (agg: import("./search").AggConfig) => boolean; + (agg: import("./search").AggConfig) => boolean; + (...types: string[]) => (agg: import("./search").AggConfig) => boolean; + typeof isValidEsInterval; + typeof isValidInterval; + string; + typeof parseEsInterval; + typeof parseInterval; + typeof propFilter; + string; + string[]; + typeof toAbsoluteDates; + } + typeof getRequestInspectorStats; + typeof getResponseInspectorStats; + typeof tabifyAggResponse; + typeof tabifyGetColumns; } ``` diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md index a0b879673e553c..a9a851e1c23076 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.searchbar.md @@ -7,7 +7,7 @@ Signature: ```typescript -SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "indexPatterns" | "refreshInterval" | "screenTitle" | "dataTestSubj" | "customSubmitButton" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { - WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; +React.ComponentClass, "query" | "isLoading" | "filters" | "indexPatterns" | "refreshInterval" | "customSubmitButton" | "screenTitle" | "dataTestSubj" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { + WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; } ``` diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index f5177df022ff2e..b08988d82b86c6 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -920,7 +920,8 @@ export class IndexPatternField implements IFieldType { // // (undocumented) $$spec: FieldSpec; - constructor(indexPattern: IndexPattern, spec: FieldSpec | IndexPatternField, shortDotsEnable?: boolean); + // Warning: (ae-forgotten-export) The symbol "Deps" needs to be exported by the entry point index.d.ts + constructor({ fieldFormats, toastNotifications }: Deps, indexPattern: IndexPattern, spec: FieldSpec | IndexPatternField, shortDotsEnable?: boolean); // (undocumented) aggregatable?: boolean; // (undocumented) @@ -959,7 +960,8 @@ export class IndexPatternField implements IFieldType { // // @public (undocumented) export class IndexPatternFieldList extends Array implements IFieldList { - constructor(indexPattern: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean); + // Warning: (ae-forgotten-export) The symbol "Deps" needs to be exported by the entry point index.d.ts + constructor({ fieldFormats, toastNotifications }: Deps_2, indexPattern: IndexPattern, specs?: FieldSpec[], shortDotsEnable?: boolean); // (undocumented) add: (field: Record) => void; // (undocumented) @@ -1341,7 +1343,7 @@ export interface QueryState { // Warning: (ae-missing-release-tag) "QueryStringInput" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const QueryStringInput: React.FC>; +export const QueryStringInput: React.FC>; // @public (undocumented) export type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField; @@ -1519,7 +1521,7 @@ export type SavedQueryTimeFilter = TimeRange & { export const search: { aggs: { AggConfigs: typeof AggConfigs; - aggGroupNamesMap: () => Record<"metrics" | "buckets", string>; + aggGroupNamesMap: () => Record<"buckets" | "metrics", string>; aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters; CidrMask: typeof CidrMask; convertDateRangeToString: typeof convertDateRangeToString; @@ -1558,8 +1560,8 @@ export const search: { // Warning: (ae-missing-release-tag) "SearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "indexPatterns" | "refreshInterval" | "screenTitle" | "dataTestSubj" | "customSubmitButton" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { - WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; +export const SearchBar: React.ComponentClass, "query" | "isLoading" | "filters" | "indexPatterns" | "refreshInterval" | "customSubmitButton" | "screenTitle" | "dataTestSubj" | "showQueryBar" | "showQueryInput" | "showFilterBar" | "showDatePicker" | "showAutoRefreshOnly" | "isRefreshPaused" | "dateRangeFrom" | "dateRangeTo" | "showSaveQuery" | "savedQuery" | "onQueryChange" | "onQuerySubmit" | "onSaved" | "onSavedQueryUpdated" | "onClearSavedQuery" | "onRefresh" | "timeHistory" | "onFiltersUpdated" | "onRefreshChange">, any> & { + WrappedComponent: React.ComponentType & ReactIntl.InjectedIntlProps>; }; // Warning: (ae-forgotten-export) The symbol "SearchBarOwnProps" needs to be exported by the entry point index.d.ts From 81fdcaa8bb437905c4a26c6f3ab8d83be0ba15e5 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 13:32:17 +0200 Subject: [PATCH 052/134] fix various functional tests --- .../functional/apps/discover/_shared_links.js | 4 ++-- test/functional/apps/home/_home.js | 2 +- test/functional/apps/home/_navigation.ts | 8 +++---- test/functional/config.js | 22 +++++++++---------- .../page_objects/space_selector_page.ts | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/functional/apps/discover/_shared_links.js b/test/functional/apps/discover/_shared_links.js index 75b14901497083..26ffd88662c8cd 100644 --- a/test/functional/apps/discover/_shared_links.js +++ b/test/functional/apps/discover/_shared_links.js @@ -108,8 +108,8 @@ export default function({ getService, getPageObjects }) { it('should allow for copying the saved object URL', async function() { const expectedUrl = baseUrl + - '/app/kibana#' + - '/discover/ab12e3c0-f231-11e6-9486-733b1ac9221a' + + '/app/discover#' + + '/ab12e3c0-f231-11e6-9486-733b1ac9221a' + '?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)' + "%2Ctime%3A(from%3A'2015-09-19T06%3A31%3A44.000Z'%2C" + "to%3A'2015-09-23T18%3A31%3A44.000Z'))"; diff --git a/test/functional/apps/home/_home.js b/test/functional/apps/home/_home.js index abcdbb440840c5..d4a34eceee10e1 100644 --- a/test/functional/apps/home/_home.js +++ b/test/functional/apps/home/_home.js @@ -31,7 +31,7 @@ export default function({ getService, getPageObjects }) { await PageObjects.common.navigateToApp('settings'); await globalNav.clickLogo(); const url = await browser.getCurrentUrl(); - expect(url.includes('/app/kibana#/home')).to.be(true); + expect(url.includes('/app/home#/')).to.be(true); }); it('clicking on console on homepage should take you to console app', async () => { diff --git a/test/functional/apps/home/_navigation.ts b/test/functional/apps/home/_navigation.ts index 2c927e9a2f4c75..a343363aafbc98 100644 --- a/test/functional/apps/home/_navigation.ts +++ b/test/functional/apps/home/_navigation.ts @@ -100,16 +100,16 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { it('encodes portions of the URL as necessary', async () => { await PageObjects.common.navigateToApp('home'); const basePath = getBasePath(); - await browser.get(`${basePath}/app/kibana#/home`, false); + await browser.get(`${basePath}/app/home#/`, false); await retry.waitFor( 'navigation to home app', - async () => (await browser.getCurrentUrl()) === `${basePath}/app/kibana#/home` + async () => (await browser.getCurrentUrl()) === `${basePath}/app/home#/` ); - await browser.get(`${basePath}/app/kibana#/home?_g=()&a=b/c`, false); + await browser.get(`${basePath}/app/home#/?_g=()&a=b/c`, false); await retry.waitFor( 'hash to be properly encoded', - async () => (await browser.getCurrentUrl()) === `${basePath}/app/kibana#/home?_g=()&a=b%2Fc` + async () => (await browser.getCurrentUrl()) === `${basePath}/app/home#/?_g=()&a=b%2Fc` ); }); }); diff --git a/test/functional/config.js b/test/functional/config.js index 0fbde95afe12c7..4bc8d0242f8308 100644 --- a/test/functional/config.js +++ b/test/functional/config.js @@ -67,20 +67,20 @@ export default async function({ readConfigFile }) { pathname: '/status', }, discover: { - pathname: '/app/kibana', - hash: '/discover', + pathname: '/app/discover', + hash: '/', }, context: { - pathname: '/app/kibana', + pathname: '/app/discover', hash: '/context', }, visualize: { - pathname: '/app/kibana', - hash: '/visualize', + pathname: '/app/visualize', + hash: '/', }, dashboard: { - pathname: '/app/kibana', - hash: '/dashboards', + pathname: '/app/dashboards', + hash: '/list', }, settings: { pathname: '/app/kibana', @@ -90,12 +90,12 @@ export default async function({ readConfigFile }) { pathname: '/app/timelion', }, console: { - pathname: '/app/kibana', - hash: '/dev_tools/console', + pathname: '/app/dev_tools', + hash: '/console', }, home: { - pathname: '/app/kibana', - hash: '/home', + pathname: '/app/home', + hash: '/', }, }, junit: { diff --git a/x-pack/test/functional/page_objects/space_selector_page.ts b/x-pack/test/functional/page_objects/space_selector_page.ts index 74f53a1cf551fb..90196c89170dd0 100644 --- a/x-pack/test/functional/page_objects/space_selector_page.ts +++ b/x-pack/test/functional/page_objects/space_selector_page.ts @@ -29,7 +29,7 @@ export function SpaceSelectorPageProvider({ getService, getPageObjects }: FtrPro } async expectHomePage(spaceId: string) { - return await this.expectRoute(spaceId, `/app/kibana#/home`); + return await this.expectRoute(spaceId, `/app/home#/`); } async expectRoute(spaceId: string, route: string) { From e473744c2e7cb9a4400cdd181b3cc8ee1da7b0fd Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 27 Apr 2020 15:15:37 +0200 Subject: [PATCH 053/134] Fix canvas type --- src/plugins/discover/public/index.ts | 2 +- .../canvas/canvas_plugin_src/functions/common/saved_search.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/discover/public/index.ts b/src/plugins/discover/public/index.ts index d1871963fe4e97..359d91325f064e 100644 --- a/src/plugins/discover/public/index.ts +++ b/src/plugins/discover/public/index.ts @@ -26,4 +26,4 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { SavedSearch, SavedSearchLoader, createSavedSearchesLoader } from './saved_searches'; -export { ISearchEmbeddable, SEARCH_EMBEDDABLE_TYPE } from './application/embeddable'; +export { ISearchEmbeddable, SEARCH_EMBEDDABLE_TYPE, SearchInput } from './application/embeddable'; diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_search.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_search.ts index 87dc7eb5e814cf..87c5955d6cb387 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_search.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_search.ts @@ -5,7 +5,7 @@ */ import { ExpressionFunctionDefinition } from 'src/plugins/expressions/common'; -import { SearchInput } from 'src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable'; +import { SearchInput } from 'src/plugins/discover/public'; import { EmbeddableTypes, EmbeddableExpressionType, From 6e016f7b7e336b775513b08ed679f67e2e951800 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 17:29:41 +0200 Subject: [PATCH 054/134] fix functional and unit tests --- docs/api/features.asciidoc | 8 ++--- ...pment-plugin-feature-registration.asciidoc | 4 +-- src/legacy/core_plugins/kibana/index.js | 8 ++--- .../kibana/public/dev_tools/index.ts | 2 +- .../ui/public/chrome/api/__tests__/nav.js | 12 +++---- .../ui/ui_nav_links/__tests__/ui_nav_link.js | 14 ++++---- src/plugins/dashboard/public/plugin.tsx | 2 +- src/plugins/visualize/public/plugin.ts | 2 +- .../functional/apps/discover/_shared_links.js | 4 +-- .../functional/page_objects/visualize_page.ts | 2 +- .../Links/DiscoverLinks/DiscoverLink.tsx | 4 +-- .../empty_state/data_or_index_missing.tsx | 2 +- .../plugins/features/server/oss_features.ts | 8 ++--- .../helpers/create_tsvb_link.test.ts | 32 +++++++++---------- .../lens/public/app_plugin/app.test.tsx | 2 +- .../roles/__fixtures__/kibana_features.ts | 2 +- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/docs/api/features.asciidoc b/docs/api/features.asciidoc index da8b0edfe22617..57a87ff6342f9a 100644 --- a/docs/api/features.asciidoc +++ b/docs/api/features.asciidoc @@ -29,7 +29,7 @@ The API returns the following: "id": "discover", "name": "Discover", "icon": "discoverApp", - "navLinkId": "kibana:discover", + "navLinkId": "discover", "app": [ "kibana" ], @@ -74,7 +74,7 @@ The API returns the following: "id": "visualize", "name": "Visualize", "icon": "visualizeApp", - "navLinkId": "kibana:visualize", + "navLinkId": "visualize", "app": [ "kibana" ], @@ -121,7 +121,7 @@ The API returns the following: "id": "dashboard", "name": "Dashboard", "icon": "dashboardApp", - "navLinkId": "kibana:dashboard", + "navLinkId": "dashboards", "app": [ "kibana" ], @@ -173,7 +173,7 @@ The API returns the following: "id": "dev_tools", "name": "Dev Tools", "icon": "devToolsApp", - "navLinkId": "kibana:dev_tools", + "navLinkId": "dev_tools", "app": [ "kibana" ], diff --git a/docs/developer/plugin/development-plugin-feature-registration.asciidoc b/docs/developer/plugin/development-plugin-feature-registration.asciidoc index 4702204196bf21..d594a6d4255b2e 100644 --- a/docs/developer/plugin/development-plugin-feature-registration.asciidoc +++ b/docs/developer/plugin/development-plugin-feature-registration.asciidoc @@ -153,7 +153,7 @@ init(server) { defaultMessage: 'Dev Tools', }), icon: 'devToolsApp', - navLinkId: 'kibana:dev_tools', + navLinkId: 'dev_tools', app: ['kibana'], catalogue: ['console', 'searchprofiler', 'grokdebugger'], privileges: { @@ -216,7 +216,7 @@ init(server) { }), order: 100, icon: 'discoverApp', - navLinkId: 'kibana:discover', + navLinkId: 'discover', app: ['kibana'], catalogue: ['discover'], privileges: { diff --git a/src/legacy/core_plugins/kibana/index.js b/src/legacy/core_plugins/kibana/index.js index d0a7d2da1e7869..67ed854c6c3e99 100644 --- a/src/legacy/core_plugins/kibana/index.js +++ b/src/legacy/core_plugins/kibana/index.js @@ -61,10 +61,10 @@ export default function(kibana) { }, styleSheetPaths: resolve(__dirname, 'public/index.scss'), links: [ - // TODO get rid of kibana:discover references - // TODO get rid of kibana:visualize references - // TODO get rid of kibana:dashboard references - // TODO get rid of kibana:dev_tools references + // TODO get rid of discover references + // TODO get rid of visualize references + // TODO get rid of dashboards references + // TODO get rid of dev_tools references { id: 'kibana:stack_management', title: i18n.translate('kbn.managementTitle', { diff --git a/src/legacy/core_plugins/kibana/public/dev_tools/index.ts b/src/legacy/core_plugins/kibana/public/dev_tools/index.ts index 6515674c6b52a1..365de2284dfe81 100644 --- a/src/legacy/core_plugins/kibana/public/dev_tools/index.ts +++ b/src/legacy/core_plugins/kibana/public/dev_tools/index.ts @@ -23,7 +23,7 @@ import 'uiExports/devTools'; import { npStart } from 'ui/new_platform'; if (npStart.plugins.devTools.getSortedDevTools().length === 0) { - npStart.core.chrome.navLinks.update('kibana:dev_tools', { + npStart.core.chrome.navLinks.update('dev_tools', { hidden: true, }); } diff --git a/src/legacy/ui/public/chrome/api/__tests__/nav.js b/src/legacy/ui/public/chrome/api/__tests__/nav.js index 078810d069f640..f09bc35911a8e1 100644 --- a/src/legacy/ui/public/chrome/api/__tests__/nav.js +++ b/src/legacy/ui/public/chrome/api/__tests__/nav.js @@ -117,19 +117,19 @@ describe('chrome nav apis', function() { const appUrlStore = new StubBrowserStorage(); fakedLinks = [ { - id: 'kibana:discover', + id: 'discover', baseUrl: `${baseUrl}/app/kibana#discover`, subUrlBase: '/app/kibana#discover', legacy: true, }, { - id: 'kibana:visualize', + id: 'visualize', baseUrl: `${baseUrl}/app/visualize#`, subUrlBase: '/app/visualize#', legacy: true, }, { - id: 'kibana:dashboard', + id: 'dashboards', baseUrl: `${baseUrl}/app/kibana#dashboards`, subUrlBase: '/app/kibana#dashboard', legacy: true, @@ -155,7 +155,7 @@ describe('chrome nav apis', function() { const appUrlStore = new StubBrowserStorage(); fakedLinks = [ { - id: 'kibana:visualize', + id: 'visualize', baseUrl: `${baseUrl}/app/visualize#`, url: `${baseUrl}/app/visualize#`, subUrlBase: '/app/visualize#', @@ -168,9 +168,9 @@ describe('chrome nav apis', function() { `${baseUrl}/xyz/app/visualize#/1234?_g=globalstate`, '/xyz' ); - chrome.trackSubUrlForApp('kibana:visualize', kibanaParsedUrl); + chrome.trackSubUrlForApp('visualize', kibanaParsedUrl); expect( - coreNavLinks.update.calledWith('kibana:visualize', { + coreNavLinks.update.calledWith('visualize', { url: `${baseUrl}/xyz/app/visualize#/1234?_g=globalstate`, }) ).to.be(true); diff --git a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js index 21ef6f973674e6..42368722f11ffa 100644 --- a/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js +++ b/src/legacy/ui/ui_nav_links/__tests__/ui_nav_link.js @@ -25,7 +25,7 @@ describe('UiNavLink', () => { describe('constructor', () => { it('initializes the object properties as expected', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', @@ -56,7 +56,7 @@ describe('UiNavLink', () => { it('initializes the order property to 0 when order is not specified in the spec', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', url: '/app/discover#/', }; @@ -67,7 +67,7 @@ describe('UiNavLink', () => { it('initializes the linkToLastSubUrl property to false when false is specified in the spec', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', @@ -80,7 +80,7 @@ describe('UiNavLink', () => { it('initializes the linkToLastSubUrl property to true by default', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', @@ -92,7 +92,7 @@ describe('UiNavLink', () => { it('initializes the hidden property to false by default', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', @@ -104,7 +104,7 @@ describe('UiNavLink', () => { it('initializes the disabled property to false by default', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', @@ -116,7 +116,7 @@ describe('UiNavLink', () => { it('initializes the tooltip property to an empty string by default', () => { const spec = { - id: 'kibana:discover', + id: 'discover', title: 'Discover', order: -1003, url: '/app/discover#/', diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index b0f15c08494c90..c5a9d5190944fe 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -217,7 +217,7 @@ export class DashboardPlugin const app: App = { id: DashboardConstants.DASHBOARDS_ID, - title: 'Dashboards', + title: 'Dashboard', order: -1001, euiIconType: 'dashboardApp', mount: async (params: AppMountParameters) => { diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index 34334075254fe7..eaf95629011d20 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -109,7 +109,7 @@ export class VisualizePlugin order: 1000, }, updater$: this.appStateUpdater.asObservable(), - // remove all references to kibana:visualize + // remove all references to visualize mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart] = await core.getStartServices(); diff --git a/test/functional/apps/discover/_shared_links.js b/test/functional/apps/discover/_shared_links.js index 26ffd88662c8cd..8f42633339e48b 100644 --- a/test/functional/apps/discover/_shared_links.js +++ b/test/functional/apps/discover/_shared_links.js @@ -83,8 +83,8 @@ export default function({ getService, getPageObjects }) { it('should allow for copying the snapshot URL', async function() { const expectedUrl = baseUrl + - '/app/kibana?_t=1453775307251#' + - '/discover?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time' + + '/app/discover?_t=1453775307251#' + + '/?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time' + ":(from:'2015-09-19T06:31:44.000Z',to:'2015-09" + "-23T18:31:44.000Z'))&_a=(columns:!(_source),filters:!(),index:'logstash-" + "*',interval:auto,query:(language:kuery,query:'')" + diff --git a/test/functional/page_objects/visualize_page.ts b/test/functional/page_objects/visualize_page.ts index 220c2d8f6b3633..7fd30a3904f719 100644 --- a/test/functional/page_objects/visualize_page.ts +++ b/test/functional/page_objects/visualize_page.ts @@ -250,7 +250,7 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide public async clickLoadSavedVisButton() { // TODO: Use a test subject selector once we rewrite breadcrumbs to accept each breadcrumb // element as a child instead of building the breadcrumbs dynamically. - await find.clickByCssSelector('[href="#/visualize"]'); + await find.clickByCssSelector('[href="#/"]'); } public async clickVisualizationByName(vizName: string) { diff --git a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx index 6dc93292956fa2..87b633eba5a098 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/Links/DiscoverLinks/DiscoverLink.tsx @@ -50,8 +50,8 @@ export const getDiscoverHref = ({ }; const href = url.format({ - pathname: basePath.prepend('/app/kibana'), - hash: `/discover?_g=${rison.encode(risonQuery._g)}&_a=${rison.encode( + pathname: basePath.prepend('/app/discover'), + hash: `/?_g=${rison.encode(risonQuery._g)}&_a=${rison.encode( risonQuery._a as RisonValue )}` }); diff --git a/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/data_or_index_missing.tsx b/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/data_or_index_missing.tsx index 88c0920138f682..b652bc7babc860 100644 --- a/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/data_or_index_missing.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/overview/empty_state/data_or_index_missing.tsx @@ -60,7 +60,7 @@ export const DataOrIndexMissing = ({ headingMessage, settings }: DataMissingProp { it('should just work', () => { const link = createTSVBLink(source, options, series, timeRange, chartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", @@ -46,8 +46,8 @@ describe('createTSVBLink()', () => { }; const link = createTSVBLink(source, customOptions, series, timeRange, chartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:bytes,id:test-id,label:'rate(system.network.out.bytes)',line_width:2,metrics:!((field:system.network.out.bytes,id:test-id,type:max),(field:test-id,id:test-id,type:derivative,unit:'1s'),(field:test-id,id:test-id,type:positive_only)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}}/s)),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", @@ -60,8 +60,8 @@ describe('createTSVBLink()', () => { const customTimeRange = { ...timeRange, from: 'now-10m', to: 'now' }; const link = createTSVBLink(source, options, series, customTimeRange, chartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", @@ -78,8 +78,8 @@ describe('createTSVBLink()', () => { }; const link = createTSVBLink(customSource, options, series, timeRange, chartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))", @@ -97,8 +97,8 @@ describe('createTSVBLink()', () => { const customOptions = { ...options, filterQuery: 'system.network.name:lo*' }; const link = createTSVBLink(customSource, customOptions, series, timeRange, chartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'my-beats-*',filter:(language:kuery,query:'system.network.name:lo* and host.name : \"example-01\"'),id:test-id,index_pattern:'my-beats-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:time,type:timeseries),title:example-01,type:metrics))", @@ -112,8 +112,8 @@ describe('createTSVBLink()', () => { const customChartOptions = { ...chartOptions, yAxisMode: MetricsExplorerYAxisMode.auto }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", @@ -127,8 +127,8 @@ describe('createTSVBLink()', () => { const customChartOptions = { ...chartOptions, type: MetricsExplorerChartType.area }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:none,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", @@ -146,8 +146,8 @@ describe('createTSVBLink()', () => { }; const link = createTSVBLink(source, options, series, timeRange, customChartOptions); expect(link).toStrictEqual({ - app: 'kibana', - hash: '/visualize/create', + app: 'visualize', + hash: '/create', search: { _a: "(filters:!(),linked:!f,query:(language:kuery,query:''),uiState:(),vis:(aggs:!(),params:(axis_formatter:number,axis_min:0,axis_position:left,axis_scale:normal,default_index_pattern:'metricbeat-*',filter:(language:kuery,query:'host.name : \"example-01\"'),id:test-id,index_pattern:'metricbeat-*',interval:auto,series:!((axis_position:right,chart_type:line,color:#6092C0,fill:0.5,formatter:percent,id:test-id,label:'avg(system.cpu.user.pct)',line_width:2,metrics:!((field:system.cpu.user.pct,id:test-id,type:avg)),point_size:0,separate_axis:0,split_mode:everything,stacked:stacked,value_template:{{value}})),show_grid:1,show_legend:1,time_field:'@timestamp',type:timeseries),title:example-01,type:metrics))", diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 1be27ca33a48b4..7b6533465e0c40 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -215,7 +215,7 @@ describe('Lens App', () => { instance = mount(); expect(core.chrome.setBreadcrumbs).toHaveBeenCalledWith([ - { text: 'Visualize', href: '/testbasepath/app/visualize#/' }, + { text: 'Visualize', href: '/testbasepath/app/visualize#/', onClick: expect.anything() }, { text: 'Create' }, ]); diff --git a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts index 68d352363d3637..10b5b3ce8521cb 100644 --- a/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts +++ b/x-pack/plugins/security/public/management/roles/__fixtures__/kibana_features.ts @@ -15,7 +15,7 @@ export const createFeature = ( const { excludeFromBaseAll, excludeFromBaseRead, ...rest } = config; return new Feature({ icon: 'discoverApp', - navLinkId: 'kibana:discover', + navLinkId: 'discover', app: [], catalogue: [], privileges: { From fe40d88d2805bd55a2a340187d37b0d8c4eb1384 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 17:55:36 +0200 Subject: [PATCH 055/134] import from core --- src/plugins/dashboard/public/plugin.tsx | 2 ++ src/plugins/dev_tools/public/plugin.ts | 9 ++------- src/plugins/discover/public/plugin.ts | 8 ++------ src/plugins/home/public/plugin.ts | 3 ++- .../kibana_legacy/public/forward_app/forward_app.ts | 6 ++++-- src/plugins/visualize/public/plugin.ts | 8 ++------ x-pack/plugins/lens/public/plugin.tsx | 4 ++-- 7 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index c5a9d5190944fe..20647f798126c7 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -30,6 +30,7 @@ import { PluginInitializerContext, Plugin, SavedObjectsClientContract, + DEFAULT_APP_CATEGORIES, } from 'src/core/public'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; import { @@ -220,6 +221,7 @@ export class DashboardPlugin title: 'Dashboard', order: -1001, euiIconType: 'dashboardApp', + category: DEFAULT_APP_CATEGORIES.analyze, mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart, dashboardStart] = await core.getStartServices(); appMounted(); diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index a8abeff8d0c10f..74b0eb090170f4 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { App, CoreSetup, Plugin } from 'kibana/public'; +import { App, CoreSetup, DEFAULT_APP_CATEGORIES, Plugin } from 'kibana/public'; import { sortBy } from 'lodash'; import { KibanaLegacySetup } from '../../kibana_legacy/public'; @@ -105,12 +105,7 @@ export class DevToolsPlugin implements Plugin { }), euiIconType: 'devToolsApp', order: 9001, - category: { - label: i18n.translate('core.ui.managementNavList.label', { - defaultMessage: 'Management', - }), - euiIconType: 'managementApp', - }, + category: DEFAULT_APP_CATEGORIES.management, mount: async (appMountContext, params) => { if (!this.getSortedDevTools) { throw new Error('not started yet'); diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index 71a226a773f923..aae4dd693cc135 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -41,6 +41,7 @@ import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/publi import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public'; import { SavedObjectLoader, SavedObjectKibanaServices } from '../../saved_objects/public'; import { createKbnUrlTracker } from '../../kibana_utils/public'; +import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; import { DocViewInput, DocViewInputFn } from './application/doc_views/doc_views_types'; import { DocViewsRegistry } from './application/doc_views/doc_views_registry'; @@ -193,12 +194,7 @@ export class DiscoverPlugin updater$: this.appStateUpdater.asObservable(), order: -1004, euiIconType: 'discoverApp', - category: { - label: i18n.translate('core.ui.analyzeNavList.label', { - defaultMessage: 'Analyze', - }), - order: 1000, - }, + category: DEFAULT_APP_CATEGORIES.analyze, mount: async (params: AppMountParameters) => { if (!this.initializeServices) { throw Error('Discover plugin method initializeServices is undefined'); diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 01835a5bc131f6..83acae2e4972df 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -40,6 +40,7 @@ import { DataPublicPluginStart } from '../../data/public'; import { TelemetryPluginStart } from '../../telemetry/public'; import { UsageCollectionSetup } from '../../usage_collection/public'; import { KibanaLegacySetup, KibanaLegacyStart } from '../../kibana_legacy/public'; +import { AppNavLinkStatus } from '../../../core/public'; export interface HomePluginStartDependencies { data: DataPublicPluginStart; @@ -68,7 +69,7 @@ export class HomePublicPlugin core.application.register({ id: 'home', title: 'Home', - navLinkStatus: 3, // TODO should be fetched by enum + navLinkStatus: AppNavLinkStatus.hidden, mount: async (params: AppMountParameters) => { const trackUiMetric = usageCollection ? usageCollection.reportUiStats.bind(usageCollection, 'Kibana_home') diff --git a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts index a85ea8d807d5fc..a5bccfc7d725de 100644 --- a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts +++ b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts @@ -17,16 +17,18 @@ * under the License. */ -import { AppMountParameters, CoreSetup } from 'kibana/public'; +import { App, AppMountParameters, CoreSetup } from 'kibana/public'; +import { AppNavLinkStatus } from '../../../../core/public'; import { navigateToLegacyKibanaUrl } from './navigate_to_legacy_kibana_url'; import { ForwardDefinition } from '../plugin'; export const createLegacyUrlForwardApp = ( core: CoreSetup<{}, { getForwards: () => ForwardDefinition[] }> -) => ({ +): App => ({ id: 'url_migrate', chromeless: true, title: 'Legacy URL migration', + navLinkStatus: AppNavLinkStatus.hidden, async mount(params: AppMountParameters) { const hash = params.history.location.hash.substr(1); diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index eaf95629011d20..e9d316dbaf7d5a 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -25,6 +25,7 @@ import { AppMountParameters, CoreSetup, CoreStart, + DEFAULT_APP_CATEGORIES, Plugin, PluginInitializerContext, } from 'kibana/public'; @@ -102,12 +103,7 @@ export class VisualizePlugin title: 'Visualize', order: -1002, euiIconType: 'visualizeApp', - category: { - label: i18n.translate('core.ui.analyzeNavList.label', { - defaultMessage: 'Analyze', - }), - order: 1000, - }, + category: DEFAULT_APP_CATEGORIES.analyze, updater$: this.appStateUpdater.asObservable(), // remove all references to visualize mount: async (params: AppMountParameters) => { diff --git a/x-pack/plugins/lens/public/plugin.tsx b/x-pack/plugins/lens/public/plugin.tsx index 66f1d54bee2bba..1be4468de606bb 100644 --- a/x-pack/plugins/lens/public/plugin.tsx +++ b/x-pack/plugins/lens/public/plugin.tsx @@ -10,7 +10,7 @@ import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; -import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; +import { AppMountParameters, AppNavLinkStatus, CoreSetup, CoreStart } from 'kibana/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; import { EmbeddableSetup, EmbeddableStart } from 'src/plugins/embeddable/public'; import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/public'; @@ -100,7 +100,7 @@ export class LensPlugin { core.application.register({ id: 'lens', - navLinkStatus: 3, // TODO should be fetched by enum + navLinkStatus: AppNavLinkStatus.hidden, title: NOT_INTERNATIONALIZED_PRODUCT_NAME, mount: async (params: AppMountParameters) => { const [coreStart, startDependencies] = await core.getStartServices(); From 47e6f7a1864cfeb8d8e479fb4ec9c1e9831200f1 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 27 Apr 2020 18:01:43 +0200 Subject: [PATCH 056/134] Revert "import from core" This reverts commit fe40d88d2805bd55a2a340187d37b0d8c4eb1384. --- src/plugins/dashboard/public/plugin.tsx | 2 -- src/plugins/dev_tools/public/plugin.ts | 9 +++++++-- src/plugins/discover/public/plugin.ts | 8 ++++++-- src/plugins/home/public/plugin.ts | 3 +-- .../kibana_legacy/public/forward_app/forward_app.ts | 6 ++---- src/plugins/visualize/public/plugin.ts | 8 ++++++-- x-pack/plugins/lens/public/plugin.tsx | 4 ++-- 7 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 20647f798126c7..c5a9d5190944fe 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -30,7 +30,6 @@ import { PluginInitializerContext, Plugin, SavedObjectsClientContract, - DEFAULT_APP_CATEGORIES, } from 'src/core/public'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; import { @@ -221,7 +220,6 @@ export class DashboardPlugin title: 'Dashboard', order: -1001, euiIconType: 'dashboardApp', - category: DEFAULT_APP_CATEGORIES.analyze, mount: async (params: AppMountParameters) => { const [coreStart, pluginsStart, dashboardStart] = await core.getStartServices(); appMounted(); diff --git a/src/plugins/dev_tools/public/plugin.ts b/src/plugins/dev_tools/public/plugin.ts index 74b0eb090170f4..a8abeff8d0c10f 100644 --- a/src/plugins/dev_tools/public/plugin.ts +++ b/src/plugins/dev_tools/public/plugin.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { App, CoreSetup, DEFAULT_APP_CATEGORIES, Plugin } from 'kibana/public'; +import { App, CoreSetup, Plugin } from 'kibana/public'; import { sortBy } from 'lodash'; import { KibanaLegacySetup } from '../../kibana_legacy/public'; @@ -105,7 +105,12 @@ export class DevToolsPlugin implements Plugin { }), euiIconType: 'devToolsApp', order: 9001, - category: DEFAULT_APP_CATEGORIES.management, + category: { + label: i18n.translate('core.ui.managementNavList.label', { + defaultMessage: 'Management', + }), + euiIconType: 'managementApp', + }, mount: async (appMountContext, params) => { if (!this.getSortedDevTools) { throw new Error('not started yet'); diff --git a/src/plugins/discover/public/plugin.ts b/src/plugins/discover/public/plugin.ts index aae4dd693cc135..71a226a773f923 100644 --- a/src/plugins/discover/public/plugin.ts +++ b/src/plugins/discover/public/plugin.ts @@ -41,7 +41,6 @@ import { Start as InspectorPublicPluginStart } from 'src/plugins/inspector/publi import { DataPublicPluginStart, DataPublicPluginSetup, esFilters } from '../../data/public'; import { SavedObjectLoader, SavedObjectKibanaServices } from '../../saved_objects/public'; import { createKbnUrlTracker } from '../../kibana_utils/public'; -import { DEFAULT_APP_CATEGORIES } from '../../../core/public'; import { DocViewInput, DocViewInputFn } from './application/doc_views/doc_views_types'; import { DocViewsRegistry } from './application/doc_views/doc_views_registry'; @@ -194,7 +193,12 @@ export class DiscoverPlugin updater$: this.appStateUpdater.asObservable(), order: -1004, euiIconType: 'discoverApp', - category: DEFAULT_APP_CATEGORIES.analyze, + category: { + label: i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }), + order: 1000, + }, mount: async (params: AppMountParameters) => { if (!this.initializeServices) { throw Error('Discover plugin method initializeServices is undefined'); diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 83acae2e4972df..01835a5bc131f6 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -40,7 +40,6 @@ import { DataPublicPluginStart } from '../../data/public'; import { TelemetryPluginStart } from '../../telemetry/public'; import { UsageCollectionSetup } from '../../usage_collection/public'; import { KibanaLegacySetup, KibanaLegacyStart } from '../../kibana_legacy/public'; -import { AppNavLinkStatus } from '../../../core/public'; export interface HomePluginStartDependencies { data: DataPublicPluginStart; @@ -69,7 +68,7 @@ export class HomePublicPlugin core.application.register({ id: 'home', title: 'Home', - navLinkStatus: AppNavLinkStatus.hidden, + navLinkStatus: 3, // TODO should be fetched by enum mount: async (params: AppMountParameters) => { const trackUiMetric = usageCollection ? usageCollection.reportUiStats.bind(usageCollection, 'Kibana_home') diff --git a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts index a5bccfc7d725de..a85ea8d807d5fc 100644 --- a/src/plugins/kibana_legacy/public/forward_app/forward_app.ts +++ b/src/plugins/kibana_legacy/public/forward_app/forward_app.ts @@ -17,18 +17,16 @@ * under the License. */ -import { App, AppMountParameters, CoreSetup } from 'kibana/public'; -import { AppNavLinkStatus } from '../../../../core/public'; +import { AppMountParameters, CoreSetup } from 'kibana/public'; import { navigateToLegacyKibanaUrl } from './navigate_to_legacy_kibana_url'; import { ForwardDefinition } from '../plugin'; export const createLegacyUrlForwardApp = ( core: CoreSetup<{}, { getForwards: () => ForwardDefinition[] }> -): App => ({ +) => ({ id: 'url_migrate', chromeless: true, title: 'Legacy URL migration', - navLinkStatus: AppNavLinkStatus.hidden, async mount(params: AppMountParameters) { const hash = params.history.location.hash.substr(1); diff --git a/src/plugins/visualize/public/plugin.ts b/src/plugins/visualize/public/plugin.ts index e9d316dbaf7d5a..eaf95629011d20 100644 --- a/src/plugins/visualize/public/plugin.ts +++ b/src/plugins/visualize/public/plugin.ts @@ -25,7 +25,6 @@ import { AppMountParameters, CoreSetup, CoreStart, - DEFAULT_APP_CATEGORIES, Plugin, PluginInitializerContext, } from 'kibana/public'; @@ -103,7 +102,12 @@ export class VisualizePlugin title: 'Visualize', order: -1002, euiIconType: 'visualizeApp', - category: DEFAULT_APP_CATEGORIES.analyze, + category: { + label: i18n.translate('core.ui.analyzeNavList.label', { + defaultMessage: 'Analyze', + }), + order: 1000, + }, updater$: this.appStateUpdater.asObservable(), // remove all references to visualize mount: async (params: AppMountParameters) => { diff --git a/x-pack/plugins/lens/public/plugin.tsx b/x-pack/plugins/lens/public/plugin.tsx index 1be4468de606bb..66f1d54bee2bba 100644 --- a/x-pack/plugins/lens/public/plugin.tsx +++ b/x-pack/plugins/lens/public/plugin.tsx @@ -10,7 +10,7 @@ import { HashRouter, Route, RouteComponentProps, Switch } from 'react-router-dom import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; -import { AppMountParameters, AppNavLinkStatus, CoreSetup, CoreStart } from 'kibana/public'; +import { AppMountParameters, CoreSetup, CoreStart } from 'kibana/public'; import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; import { EmbeddableSetup, EmbeddableStart } from 'src/plugins/embeddable/public'; import { ExpressionsSetup, ExpressionsStart } from 'src/plugins/expressions/public'; @@ -100,7 +100,7 @@ export class LensPlugin { core.application.register({ id: 'lens', - navLinkStatus: AppNavLinkStatus.hidden, + navLinkStatus: 3, // TODO should be fetched by enum title: NOT_INTERNATIONALIZED_PRODUCT_NAME, mount: async (params: AppMountParameters) => { const [coreStart, startDependencies] = await core.getStartServices(); From 1cf6e94ce2a9ae2cc2be8083957f16f6b9f857ce Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Mon, 27 Apr 2020 20:36:50 +0200 Subject: [PATCH 057/134] Fix i18n --- .../public/application/angular/context.js | 2 +- .../application/angular/context/api/anchor.js | 2 +- .../components/action_bar/action_bar.tsx | 10 +- .../action_bar/action_bar_warning.tsx | 8 +- .../angular/context/query/actions.js | 4 +- .../application/angular/context_app.html | 18 +- .../angular/directives/histogram.tsx | 2 +- .../angular/directives/no_results.js | 30 +- .../angular/directives/uninitialized.tsx | 6 +- .../public/application/angular/discover.html | 20 +- .../public/application/angular/discover.js | 50 +-- .../pager/tool_bar_pager_buttons.tsx | 4 +- .../components/pager/tool_bar_pager_text.tsx | 2 +- .../table_header/table_header_column.tsx | 18 +- .../doc_table/components/table_row/cell.html | 8 +- .../components/table_row/details.html | 6 +- .../doc_table/components/table_row/open.html | 2 +- .../angular/doc_table/doc_table.html | 2 +- .../angular/doc_table/doc_table_strings.js | 2 +- .../application/angular/get_painless_error.ts | 2 +- .../public/application/components/doc/doc.tsx | 14 +- .../components/fetch_error/fetch_error.tsx | 6 +- .../components/help_menu/help_menu_util.js | 2 +- .../sidebar/change_indexpattern.tsx | 2 +- .../components/sidebar/discover_field.tsx | 17 +- .../sidebar/discover_field_bucket.tsx | 15 +- .../sidebar/discover_field_details.tsx | 6 +- .../sidebar/discover_field_search.tsx | 20 +- .../components/sidebar/discover_sidebar.tsx | 19 +- .../sidebar/lib/field_calculator.js | 6 +- .../sidebar/lib/get_field_type_name.ts | 24 +- .../components/sidebar/lib/get_warnings.ts | 2 +- .../open_search_panel.test.js.snap | 6 +- .../components/top_nav/open_search_panel.js | 8 +- .../embeddable/search_embeddable.ts | 6 +- .../embeddable/search_embeddable_factory.ts | 4 +- .../public/application/helpers/breadcrumbs.ts | 2 +- .../discover/public/register_feature.ts | 4 +- .../translations/translations/ja-JP.json | 286 +++++++++--------- .../translations/translations/zh-CN.json | 286 +++++++++--------- 40 files changed, 462 insertions(+), 471 deletions(-) diff --git a/src/plugins/discover/public/application/angular/context.js b/src/plugins/discover/public/application/angular/context.js index 032ec7af09a301..33bbc8cb2e6cf9 100644 --- a/src/plugins/discover/public/application/angular/context.js +++ b/src/plugins/discover/public/application/angular/context.js @@ -32,7 +32,7 @@ const k7Breadcrumbs = $route => { return [ ...getRootBreadcrumbs(), { - text: i18n.translate('kbn.context.breadcrumb', { + text: i18n.translate('discover.context.breadcrumb', { defaultMessage: 'Context of {indexPatternTitle}#{docId}', values: { indexPatternTitle: indexPattern.title, diff --git a/src/plugins/discover/public/application/angular/context/api/anchor.js b/src/plugins/discover/public/application/angular/context/api/anchor.js index 4338d3e1dbdbd7..4df5ba989f7985 100644 --- a/src/plugins/discover/public/application/angular/context/api/anchor.js +++ b/src/plugins/discover/public/application/angular/context/api/anchor.js @@ -46,7 +46,7 @@ export function fetchAnchorProvider(indexPatterns, searchSource) { if (_.get(response, ['hits', 'total'], 0) < 1) { throw new Error( - i18n.translate('kbn.context.failedToLoadAnchorDocumentErrorDescription', { + i18n.translate('discover.context.failedToLoadAnchorDocumentErrorDescription', { defaultMessage: 'Failed to load anchor document.', }) ); diff --git a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx index 8fcfcba08955c3..97a29ab21c5818 100644 --- a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx +++ b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar.tsx @@ -111,7 +111,7 @@ export function ActionBar({ }} flush="right" > - + @@ -119,10 +119,10 @@ export function ActionBar({ {isSuccessor ? ( ) : ( )} diff --git a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx index 6b922bb05a2434..db757881ad819c 100644 --- a/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx +++ b/src/plugins/discover/public/application/angular/context/components/action_bar/action_bar_warning.tsx @@ -31,12 +31,12 @@ export function ActionBarWarning({ docCount, type }: { docCount: number; type: S title={ docCount === 0 ? ( ) : ( @@ -55,12 +55,12 @@ export function ActionBarWarning({ docCount, type }: { docCount: number; type: S title={ docCount === 0 ? ( ) : ( diff --git a/src/plugins/discover/public/application/angular/context/query/actions.js b/src/plugins/discover/public/application/angular/context/query/actions.js index 2c89e7e078b543..1b1fa7138bfda7 100644 --- a/src/plugins/discover/public/application/angular/context/query/actions.js +++ b/src/plugins/discover/public/application/angular/context/query/actions.js @@ -80,7 +80,7 @@ export function QueryActionsProvider(Promise) { error => { setFailedStatus(state)('anchor', { error }); getServices().toastNotifications.addDanger({ - title: i18n.translate('kbn.context.unableToLoadAnchorDocumentDescription', { + title: i18n.translate('discover.context.unableToLoadAnchorDocumentDescription', { defaultMessage: 'Unable to load the anchor document', }), text: {error.message}, @@ -133,7 +133,7 @@ export function QueryActionsProvider(Promise) { error => { setFailedStatus(state)(type, { error }); getServices().toastNotifications.addDanger({ - title: i18n.translate('kbn.context.unableToLoadDocumentDescription', { + title: i18n.translate('discover.context.unableToLoadDocumentDescription', { defaultMessage: 'Unable to load documents', }), text: {error.message}, diff --git a/src/plugins/discover/public/application/angular/context_app.html b/src/plugins/discover/public/application/angular/context_app.html index 8bbb746fa45f87..1f2d6a073150b2 100644 --- a/src/plugins/discover/public/application/angular/context_app.html +++ b/src/plugins/discover/public/application/angular/context_app.html @@ -21,7 +21,7 @@
@@ -30,7 +30,7 @@
@@ -92,7 +92,7 @@ >
diff --git a/src/plugins/discover/public/application/angular/directives/histogram.tsx b/src/plugins/discover/public/application/angular/directives/histogram.tsx index 8c55622e4c6041..e7e4cc0ad62f3e 100644 --- a/src/plugins/discover/public/application/angular/directives/histogram.tsx +++ b/src/plugins/discover/public/application/angular/directives/histogram.tsx @@ -175,7 +175,7 @@ export class DiscoverHistogram extends Component

@@ -114,14 +114,14 @@ export class DiscoverNoResults extends Component {

@@ -155,7 +155,7 @@ export class DiscoverNoResults extends Component { @@ -168,7 +168,7 @@ export class DiscoverNoResults extends Component { @@ -181,7 +181,7 @@ export class DiscoverNoResults extends Component { @@ -194,7 +194,7 @@ export class DiscoverNoResults extends Component { @@ -210,14 +210,14 @@ export class DiscoverNoResults extends Component {

@@ -256,7 +256,7 @@ export class DiscoverNoResults extends Component { } diff --git a/src/plugins/discover/public/application/angular/directives/uninitialized.tsx b/src/plugins/discover/public/application/angular/directives/uninitialized.tsx index b308607bbfbb07..d04aea09331159 100644 --- a/src/plugins/discover/public/application/angular/directives/uninitialized.tsx +++ b/src/plugins/discover/public/application/angular/directives/uninitialized.tsx @@ -37,7 +37,7 @@ export const DiscoverUninitialized = ({ onRefresh }: Props) => { title={

@@ -45,7 +45,7 @@ export const DiscoverUninitialized = ({ onRefresh }: Props) => { body={

@@ -53,7 +53,7 @@ export const DiscoverUninitialized = ({ onRefresh }: Props) => { actions={ diff --git a/src/plugins/discover/public/application/angular/discover.html b/src/plugins/discover/public/application/angular/discover.html index 1221b01657e45f..b4db89b9275b46 100644 --- a/src/plugins/discover/public/application/angular/discover.html +++ b/src/plugins/discover/public/application/angular/discover.html @@ -61,7 +61,7 @@

{{screenTitle}}

@@ -83,7 +83,7 @@

{{screenTitle}}

@@ -93,7 +93,7 @@

{{screenTitle}}

{{(hits || 0) | number:0}} @@ -104,12 +104,12 @@

{{screenTitle}}

id="reload_saved_search" ng-click="resetQuery()" > - {{::'kbn.discover.reloadSavedSearchButton' | i18n: {defaultMessage: 'Reset search'} }} + {{::'discover.reloadSavedSearchButton' | i18n: {defaultMessage: 'Reset search'} }}
@@ -117,7 +117,7 @@

{{screenTitle}}

@@ -141,7 +141,7 @@

{{screenTitle}}

> {{screenTitle}} >

{{screenTitle}} class="dscTable__footer" > {{screenTitle}}
diff --git a/src/plugins/discover/public/application/angular/discover.js b/src/plugins/discover/public/application/angular/discover.js index ebe8608b71d28c..2afd0322f87014 100644 --- a/src/plugins/discover/public/application/angular/discover.js +++ b/src/plugins/discover/public/application/angular/discover.js @@ -96,10 +96,10 @@ app.config($routeProvider => { } return { - text: i18n.translate('kbn.discover.badge.readOnly.text', { + text: i18n.translate('discover.badge.readOnly.text', { defaultMessage: 'Read only', }), - tooltip: i18n.translate('kbn.discover.badge.readOnly.tooltip', { + tooltip: i18n.translate('discover.badge.readOnly.tooltip', { defaultMessage: 'Unable to save searches', }), iconType: 'glasses', @@ -330,10 +330,10 @@ function discoverController( const getTopNavLinks = () => { const newSearch = { id: 'new', - label: i18n.translate('kbn.discover.localMenu.localMenu.newSearchTitle', { + label: i18n.translate('discover.localMenu.localMenu.newSearchTitle', { defaultMessage: 'New', }), - description: i18n.translate('kbn.discover.localMenu.newSearchDescription', { + description: i18n.translate('discover.localMenu.newSearchDescription', { defaultMessage: 'New Search', }), run: function() { @@ -346,10 +346,10 @@ function discoverController( const saveSearch = { id: 'save', - label: i18n.translate('kbn.discover.localMenu.saveTitle', { + label: i18n.translate('discover.localMenu.saveTitle', { defaultMessage: 'Save', }), - description: i18n.translate('kbn.discover.localMenu.saveSearchDescription', { + description: i18n.translate('discover.localMenu.saveSearchDescription', { defaultMessage: 'Save Search', }), testId: 'discoverSaveButton', @@ -386,7 +386,7 @@ function discoverController( title={savedSearch.title} showCopyOnSave={!!savedSearch.id} objectType="search" - description={i18n.translate('kbn.discover.localMenu.saveSaveSearchDescription', { + description={i18n.translate('discover.localMenu.saveSaveSearchDescription', { defaultMessage: 'Save your Discover search so you can use it in visualizations and dashboards', })} @@ -399,10 +399,10 @@ function discoverController( const openSearch = { id: 'open', - label: i18n.translate('kbn.discover.localMenu.openTitle', { + label: i18n.translate('discover.localMenu.openTitle', { defaultMessage: 'Open', }), - description: i18n.translate('kbn.discover.localMenu.openSavedSearchDescription', { + description: i18n.translate('discover.localMenu.openSavedSearchDescription', { defaultMessage: 'Open Saved Search', }), testId: 'discoverOpenButton', @@ -416,10 +416,10 @@ function discoverController( const shareSearch = { id: 'share', - label: i18n.translate('kbn.discover.localMenu.shareTitle', { + label: i18n.translate('discover.localMenu.shareTitle', { defaultMessage: 'Share', }), - description: i18n.translate('kbn.discover.localMenu.shareSearchDescription', { + description: i18n.translate('discover.localMenu.shareSearchDescription', { defaultMessage: 'Share Search', }), testId: 'shareTopNavButton', @@ -443,10 +443,10 @@ function discoverController( const inspectSearch = { id: 'inspect', - label: i18n.translate('kbn.discover.localMenu.inspectTitle', { + label: i18n.translate('discover.localMenu.inspectTitle', { defaultMessage: 'Inspect', }), - description: i18n.translate('kbn.discover.localMenu.openInspectorForSearchDescription', { + description: i18n.translate('discover.localMenu.openInspectorForSearchDescription', { defaultMessage: 'Open Inspector for search', }), testId: 'openInspectorButton', @@ -489,7 +489,7 @@ function discoverController( const pageTitleSuffix = savedSearch.id && savedSearch.title ? `: ${savedSearch.title}` : ''; chrome.docTitle.change(`Discover${pageTitleSuffix}`); - const discoverBreadcrumbsTitle = i18n.translate('kbn.discover.discoverBreadcrumbTitle', { + const discoverBreadcrumbsTitle = i18n.translate('discover.discoverBreadcrumbTitle', { defaultMessage: 'Discover', }); @@ -603,16 +603,16 @@ function discoverController( $scope.state.sort = getSortArray($scope.state.sort, $scope.indexPattern); $scope.getBucketIntervalToolTipText = () => { - return i18n.translate('kbn.discover.bucketIntervalTooltip', { + return i18n.translate('discover.bucketIntervalTooltip', { defaultMessage: 'This interval creates {bucketsDescription} to show in the selected time range, so it has been scaled to {bucketIntervalDescription}', values: { bucketsDescription: $scope.bucketInterval.scale > 1 - ? i18n.translate('kbn.discover.bucketIntervalTooltip.tooLargeBucketsText', { + ? i18n.translate('discover.bucketIntervalTooltip.tooLargeBucketsText', { defaultMessage: 'buckets that are too large', }) - : i18n.translate('kbn.discover.bucketIntervalTooltip.tooManyBucketsText', { + : i18n.translate('discover.bucketIntervalTooltip.tooManyBucketsText', { defaultMessage: 'too many buckets', }), bucketIntervalDescription: $scope.bucketInterval.description, @@ -745,7 +745,7 @@ function discoverController( $scope.$evalAsync(() => { if (id) { toastNotifications.addSuccess({ - title: i18n.translate('kbn.discover.notifications.savedSearchTitle', { + title: i18n.translate('discover.notifications.savedSearchTitle', { defaultMessage: `Search '{savedSearchTitle}' was saved`, values: { savedSearchTitle: savedSearch.title, @@ -766,7 +766,7 @@ function discoverController( return { id }; } catch (saveError) { toastNotifications.addDanger({ - title: i18n.translate('kbn.discover.notifications.notSavedSearchTitle', { + title: i18n.translate('discover.notifications.notSavedSearchTitle', { defaultMessage: `Search '{savedSearchTitle}' was not saved.`, values: { savedSearchTitle: savedSearch.title, @@ -809,7 +809,7 @@ function discoverController( $scope.fetchError = fetchError; } else { toastNotifications.addError(error, { - title: i18n.translate('kbn.discover.errorLoadingData', { + title: i18n.translate('discover.errorLoadingData', { defaultMessage: 'Error loading data', }), toastMessage: error.shortMessage || error.body?.message, @@ -900,10 +900,10 @@ function discoverController( function logInspectorRequest() { inspectorAdapters.requests.reset(); - const title = i18n.translate('kbn.discover.inspectorRequestDataTitle', { + const title = i18n.translate('discover.inspectorRequestDataTitle', { defaultMessage: 'data', }); - const description = i18n.translate('kbn.discover.inspectorRequestDescription', { + const description = i18n.translate('discover.inspectorRequestDescription', { defaultMessage: 'This request queries Elasticsearch to fetch the data for the search.', }); inspectorRequest = inspectorAdapters.requests.start(title, { description }); @@ -1046,7 +1046,7 @@ function discoverController( } function getIndexPatternWarning(index) { - return i18n.translate('kbn.discover.valueIsNotConfiguredIndexPatternIDWarningTitle', { + return i18n.translate('discover.valueIsNotConfiguredIndexPatternIDWarningTitle', { defaultMessage: '{stateVal} is not a configured index pattern ID', values: { stateVal: `"${index}"`, @@ -1073,7 +1073,7 @@ function discoverController( if (ownIndexPattern) { toastNotifications.addWarning({ title: warningTitle, - text: i18n.translate('kbn.discover.showingSavedIndexPatternWarningDescription', { + text: i18n.translate('discover.showingSavedIndexPatternWarningDescription', { defaultMessage: 'Showing the saved index pattern: "{ownIndexPatternTitle}" ({ownIndexPatternId})', values: { @@ -1087,7 +1087,7 @@ function discoverController( toastNotifications.addWarning({ title: warningTitle, - text: i18n.translate('kbn.discover.showingDefaultIndexPatternWarningDescription', { + text: i18n.translate('discover.showingDefaultIndexPatternWarningDescription', { defaultMessage: 'Showing the default index pattern: "{loadedIndexPatternTitle}" ({loadedIndexPatternId})', values: { diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx index 6f1cf81e2c541b..e95153d85b0641 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_buttons.tsx @@ -35,7 +35,7 @@ export function ToolBarPagerButtons(props: Props) { disabled={!props.hasPreviousPage} data-test-subj="btnPrevPage" aria-label={i18n.translate( - 'kbn.discover.docTable.pager.toolbarPagerButtons.previousButtonAriaLabel', + 'discover.docTable.pager.toolbarPagerButtons.previousButtonAriaLabel', { defaultMessage: 'Previous page in table', } @@ -49,7 +49,7 @@ export function ToolBarPagerButtons(props: Props) { disabled={!props.hasNextPage} data-test-subj="btnNextPage" aria-label={i18n.translate( - 'kbn.discover.docTable.pager.toolbarPagerButtons.nextButtonAriaLabel', + 'discover.docTable.pager.toolbarPagerButtons.nextButtonAriaLabel', { defaultMessage: 'Next page in table', } diff --git a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx index 84338d817c86b5..46e3cd9511eb59 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/pager/tool_bar_pager_text.tsx @@ -30,7 +30,7 @@ export function ToolBarPagerText({ startItem, endItem, totalItems }: Props) {
diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx index d1a9a5146fb8a5..4c09ff8701f30a 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_header/table_header_column.tsx @@ -80,21 +80,21 @@ export function TableHeaderColumn({ const getSortButtonAriaLabel = () => { const sortAscendingMessage = i18n.translate( - 'kbn.docTable.tableHeader.sortByColumnAscendingAriaLabel', + 'discover.docTable.tableHeader.sortByColumnAscendingAriaLabel', { defaultMessage: 'Sort {columnName} ascending', values: { columnName: name }, } ); const sortDescendingMessage = i18n.translate( - 'kbn.docTable.tableHeader.sortByColumnDescendingAriaLabel', + 'discover.docTable.tableHeader.sortByColumnDescendingAriaLabel', { defaultMessage: 'Sort {columnName} descending', values: { columnName: name }, } ); const stopSortingMessage = i18n.translate( - 'kbn.docTable.tableHeader.sortByColumnUnsortedAriaLabel', + 'discover.docTable.tableHeader.sortByColumnUnsortedAriaLabel', { defaultMessage: 'Stop sorting on {columnName}', values: { columnName: name }, @@ -126,42 +126,42 @@ export function TableHeaderColumn({ // Remove Button { active: isRemoveable && typeof onRemoveColumn === 'function', - ariaLabel: i18n.translate('kbn.docTable.tableHeader.removeColumnButtonAriaLabel', { + ariaLabel: i18n.translate('discover.docTable.tableHeader.removeColumnButtonAriaLabel', { defaultMessage: 'Remove {columnName} column', values: { columnName: name }, }), className: 'fa fa-remove kbnDocTableHeader__move', onClick: () => onRemoveColumn && onRemoveColumn(name), testSubject: `docTableRemoveHeader-${name}`, - tooltip: i18n.translate('kbn.docTable.tableHeader.removeColumnButtonTooltip', { + tooltip: i18n.translate('discover.docTable.tableHeader.removeColumnButtonTooltip', { defaultMessage: 'Remove Column', }), }, // Move Left Button { active: colLeftIdx >= 0 && typeof onMoveColumn === 'function', - ariaLabel: i18n.translate('kbn.docTable.tableHeader.moveColumnLeftButtonAriaLabel', { + ariaLabel: i18n.translate('discover.docTable.tableHeader.moveColumnLeftButtonAriaLabel', { defaultMessage: 'Move {columnName} column to the left', values: { columnName: name }, }), className: 'fa fa-angle-double-left kbnDocTableHeader__move', onClick: () => onMoveColumn && onMoveColumn(name, colLeftIdx), testSubject: `docTableMoveLeftHeader-${name}`, - tooltip: i18n.translate('kbn.docTable.tableHeader.moveColumnLeftButtonTooltip', { + tooltip: i18n.translate('discover.docTable.tableHeader.moveColumnLeftButtonTooltip', { defaultMessage: 'Move column to the left', }), }, // Move Right Button { active: colRightIdx >= 0 && typeof onMoveColumn === 'function', - ariaLabel: i18n.translate('kbn.docTable.tableHeader.moveColumnRightButtonAriaLabel', { + ariaLabel: i18n.translate('discover.docTable.tableHeader.moveColumnRightButtonAriaLabel', { defaultMessage: 'Move {columnName} column to the right', values: { columnName: name }, }), className: 'fa fa-angle-double-right kbnDocTableHeader__move', onClick: () => onMoveColumn && onMoveColumn(name, colRightIdx), testSubject: `docTableMoveRightHeader-${name}`, - tooltip: i18n.translate('kbn.docTable.tableHeader.moveColumnRightButtonTooltip', { + tooltip: i18n.translate('discover.docTable.tableHeader.moveColumnRightButtonTooltip', { defaultMessage: 'Move column to the right', }), }, diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html index 0704016a52bbdd..e8c4fceeca7ffd 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row/cell.html @@ -18,17 +18,17 @@ data-column="<%- column %>" tooltip-append-to-body="1" data-test-subj="docTableCellFilter" - tooltip="{{ ::'kbn.docTable.tableRow.filterForValueButtonTooltip' | i18n: {defaultMessage: 'Filter for value'} }}" + tooltip="{{ ::'discover.docTable.tableRow.filterForValueButtonTooltip' | i18n: {defaultMessage: 'Filter for value'} }}" tooltip-placement="bottom" - aria-label="{{ ::'kbn.docTable.tableRow.filterForValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter for value'} }}" + aria-label="{{ ::'discover.docTable.tableRow.filterForValueButtonAriaLabel' | i18n: {defaultMessage: 'Filter for value'} }}" > diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html index d149a9023816a8..37ae08246d1d3f 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row/details.html @@ -8,7 +8,7 @@

@@ -22,7 +22,7 @@ data-test-subj="docTableRowAction" ng-href="{{ getContextAppHref() }}" ng-if="indexPattern.isTimeBased()" - i18n-id="kbn.docTable.tableRow.viewSurroundingDocumentsLinkText" + i18n-id="discover.docTable.tableRow.viewSurroundingDocumentsLinkText" i18n-default-message="View surrounding documents" >
@@ -31,7 +31,7 @@ class="euiLink" data-test-subj="docTableRowAction" ng-href="#/discover/doc/{{indexPattern.id}}/{{row._index}}?id={{uriEncodedId}}" - i18n-id="kbn.docTable.tableRow.viewSingleDocumentLinkText" + i18n-id="discover.docTable.tableRow.viewSingleDocumentLinkText" i18n-default-message="View single document" >
diff --git a/src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html b/src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html index d6c4b858d2b476..6a14b6fc703489 100644 --- a/src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html +++ b/src/plugins/discover/public/application/angular/doc_table/components/table_row/open.html @@ -2,7 +2,7 @@
), getStartedLink: ( - + { it('addEmbeddableToDashboardUrl when dashboard is not saved', () => { const id = '123eb456cd'; const url = - "/pep/app/kibana#/dashboard?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; + "/pep/app/dashboards#/create?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; expect(addEmbeddableToDashboardUrl(url, id, 'visualization')).toEqual( - `/dashboard?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` + `/pep/app/dashboards#/create?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` ); }); it('addEmbeddableToDashboardUrl when dashboard is saved', () => { const id = '123eb456cd'; const url = - "/pep/app/kibana#/dashboard/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; + "/pep/app/dashboards#/view/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-15m,to:now))&_a=(description:'',filters:!())"; expect(addEmbeddableToDashboardUrl(url, id, 'visualization')).toEqual( - `/dashboard/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` + `/pep/app/dashboards#/view/9b780cd0-3dd3-11e8-b2b9-5d5dc1715159?_a=%28description%3A%27%27%2Cfilters%3A%21%28%29%29&_g=%28refreshInterval%3A%28pause%3A%21t%2Cvalue%3A0%29%2Ctime%3A%28from%3Anow-15m%2Cto%3Anow%29%29&addEmbeddableId=${id}&addEmbeddableType=visualization` ); }); }); diff --git a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap index 2a45ff60dda78e..4fa04bb64b1777 100644 --- a/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap +++ b/src/plugins/home/public/application/components/__snapshots__/home.test.js.snap @@ -101,7 +101,7 @@ exports[`home directories should not render directory entry when showOnHomePage /> @@ -229,7 +230,7 @@ exports[`home directories should render ADMIN directory entry in "Manage" panel /> @@ -357,7 +359,7 @@ exports[`home directories should render DATA directory entry in "Explore Data" p /> View data diff --git a/src/plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.tsx.snap b/src/plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.tsx.snap index 764fc3d66c965f..c54bf4929e9134 100644 --- a/src/plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.tsx.snap +++ b/src/plugins/input_control_vis/public/components/editor/__snapshots__/controls_tab.test.tsx.snap @@ -25,7 +25,6 @@ exports[`renders ControlsTab 1`] = ` "core": Object { "getStartServices": [MockFunction], }, - "getSettings": [MockFunction], "data": Object { "query": Object { "filterManager": Object { @@ -44,6 +43,7 @@ exports[`renders ControlsTab 1`] = ` }, }, }, + "getSettings": [MockFunction], } } getIndexPattern={[Function]} @@ -84,7 +84,6 @@ exports[`renders ControlsTab 1`] = ` "core": Object { "getStartServices": [MockFunction], }, - "getSettings": [MockFunction], "data": Object { "query": Object { "filterManager": Object { @@ -103,6 +102,7 @@ exports[`renders ControlsTab 1`] = ` }, }, }, + "getSettings": [MockFunction], } } getIndexPattern={[Function]} diff --git a/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap b/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap index 6aef2c2b2ceb77..cfe61889fc7698 100644 --- a/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap +++ b/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap @@ -3,6 +3,7 @@ exports[`NewVisModal filter for visualization types should render as expected 1`] = ` { name: 'visWithAliasUrl', title: 'Vis with alias Url', stage: 'production', - aliasUrl: '/aliasUrl', + aliasApp: 'otherApp', + aliasPath: '#/aliasUrl', }, ]; const visTypes: TypesStart = { @@ -118,7 +119,7 @@ describe('NewVisModal', () => { ); const visButton = wrapper.find('button[data-test-subj="visType-vis"]'); visButton.simulate('click'); - expect(window.location.assign).toBeCalledWith('app/#/visualize/create?type=vis'); + expect(window.location.assign).toBeCalledWith('testbasepath/app/visualize#/create?type=vis'); }); it('passes through editor params to the editor URL', () => { @@ -137,12 +138,14 @@ describe('NewVisModal', () => { ); const visButton = wrapper.find('button[data-test-subj="visType-vis"]'); visButton.simulate('click'); - expect(window.location.assign).toBeCalledWith('#/visualize/create?type=vis&foo=true&bar=42'); + expect(window.location.assign).toBeCalledWith( + 'testbasepath/app/visualize#/create?type=vis&foo=true&bar=42' + ); }); - it('closes and redirects properly if visualization with aliasUrl and addToDashboard in editorParams', () => { + it('closes and redirects properly if visualization with aliasPath and addToDashboard in editorParams', () => { const onClose = jest.fn(); - window.location.assign = jest.fn(); + const navigateToApp = jest.fn(); const wrapper = mountWithIntl( { editorParams={['foo=true', 'bar=42', 'addToDashboard']} addBasePath={addBasePath} uiSettings={uiSettings} - application={{} as ApplicationStart} + application={({ navigateToApp } as unknown) as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); const visButton = wrapper.find('button[data-test-subj="visType-visWithAliasUrl"]'); visButton.simulate('click'); - expect(window.location.assign).toBeCalledWith('testbasepath/aliasUrl?addToDashboard'); + expect(navigateToApp).toBeCalledWith('otherApp', { path: '#/aliasUrl?addToDashboard' }); expect(onClose).toHaveBeenCalled(); }); - it('closes and redirects properly if visualization with aliasUrl and without addToDashboard in editorParams', () => { + it('closes and redirects properly if visualization with aliasApp and without addToDashboard in editorParams', () => { const onClose = jest.fn(); - window.location.assign = jest.fn(); + const navigateToApp = jest.fn(); const wrapper = mountWithIntl( { editorParams={['foo=true', 'bar=42']} addBasePath={addBasePath} uiSettings={uiSettings} - application={{} as ApplicationStart} + application={({ navigateToApp } as unknown) as ApplicationStart} savedObjects={{} as SavedObjectsStart} /> ); const visButton = wrapper.find('button[data-test-subj="visType-visWithAliasUrl"]'); visButton.simulate('click'); - expect(window.location.assign).toBeCalledWith('testbasepath/aliasUrl'); + expect(navigateToApp).toBeCalledWith('otherApp', { path: '#/aliasUrl' }); expect(onClose).toHaveBeenCalled(); }); }); diff --git a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx index 7e226fd39fe163..fa15a6c9ba02bc 100644 --- a/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx +++ b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx @@ -51,7 +51,7 @@ describe('NewVisHelp', () => {

diff --git a/x-pack/legacy/plugins/dashboard_mode/server/__tests__/dashboard_mode_request_interceptor.js b/x-pack/legacy/plugins/dashboard_mode/server/__tests__/dashboard_mode_request_interceptor.js index a006770d7314cb..6735adbf65fed6 100644 --- a/x-pack/legacy/plugins/dashboard_mode/server/__tests__/dashboard_mode_request_interceptor.js +++ b/x-pack/legacy/plugins/dashboard_mode/server/__tests__/dashboard_mode_request_interceptor.js @@ -12,10 +12,6 @@ import { createDashboardModeRequestInterceptor } from '../dashboard_mode_request const DASHBOARD_ONLY_MODE_ROLE = 'test_dashboard_only_mode_role'; function setup() { - const dashboardViewerApp = { - name: 'dashboardViewerApp', - }; - const server = new Hapi.Server(); server.decorate('request', 'getUiSettingsService', () => { @@ -25,7 +21,7 @@ function setup() { }); // attach the extension - server.ext(createDashboardModeRequestInterceptor(dashboardViewerApp)); + server.ext(createDashboardModeRequestInterceptor()); // allow the extension to fake "render an app" server.decorate('toolkit', 'renderApp', function(app) { @@ -33,6 +29,18 @@ function setup() { return this.response({ renderApp: true, app }); }); + server.decorate('server', 'newPlatform', { + setup: { + core: { + http: { + basePath: { + get: () => '', + }, + }, + }, + }, + }); + server.route({ path: '/app/{appId}', method: 'GET', @@ -54,14 +62,6 @@ function setup() { } describe('DashboardOnlyModeRequestInterceptor', () => { - describe('basics', () => { - it('throws if it does not get the `dashboardViewerApp`', () => { - expect(() => { - createDashboardModeRequestInterceptor(); - }).to.throwError('dashboardViewerApp'); - }); - }); - describe('request is not for dashboad-only user', () => { describe('app route', () => { it('lets the route render as normal', async () => { @@ -119,31 +119,48 @@ describe('DashboardOnlyModeRequestInterceptor', () => { }); }); - function testRendersDashboardViewerApp(url) { + describe('requests to dashboard_mode app', () => { + it('lets the route render as normal', async () => { + const { server } = setup(); + const response = await server.inject({ + url: '/app/dashboard_mode', + credentials: { + roles: [DASHBOARD_ONLY_MODE_ROLE], + }, + }); + + expect(response) + .to.have.property('statusCode', 200) + .and.have.property('result') + .eql({ + renderApp: true, + app: { name: 'dashboard_mode' }, + }); + }); + }); + + function testRedirectToDashboardModeApp(url) { describe(`requests to url:"${url}"`, () => { - it('renders the dashboardViewerApp instead', async () => { + it('redirects to the dashboard_mode app instead', async () => { const { server } = setup(); const response = await server.inject({ - url: '/app/kibana', + url: url, credentials: { roles: [DASHBOARD_ONLY_MODE_ROLE], }, }); - expect(response) - .to.have.property('statusCode', 200) - .and.have.property('result') - .eql({ - renderApp: true, - app: { name: 'dashboardViewerApp' }, - }); + expect(response).to.have.property('statusCode', 301); + expect(response.headers).to.have.property('location', '/app/dashboard_mode'); }); }); } - testRendersDashboardViewerApp('/app/kibana'); - testRendersDashboardViewerApp('/app/kibana#/foo/bar'); - testRendersDashboardViewerApp('/app/kibana/foo/bar'); - testRendersDashboardViewerApp('/app/kibana?foo=bar'); + testRedirectToDashboardModeApp('/app/kibana'); + testRedirectToDashboardModeApp('/app/kibana#/foo/bar'); + testRedirectToDashboardModeApp('/app/kibana/foo/bar'); + testRedirectToDashboardModeApp('/app/kibana?foo=bar'); + testRedirectToDashboardModeApp('/app/dashboards?foo=bar'); + testRedirectToDashboardModeApp('/app/home?foo=bar'); }); }); diff --git a/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js b/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js index eb8331644cd880..4e42e3c69d314f 100644 --- a/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js +++ b/x-pack/legacy/plugins/dashboard_mode/server/dashboard_mode_request_interceptor.js @@ -52,13 +52,15 @@ export function createDashboardModeRequestInterceptor() { url.path.startsWith('/app/kibana') || url.path.startsWith('/app/dashboards') ) { - console.log('redirecting'); const basePath = request.server.newPlatform.setup.core.http.basePath.get(request); const url = `${basePath}/app/dashboard_mode`; // If the user is in "Dashboard only mode" they should only be allowed to see // the dashboard app and none others. If the kibana app is requested, this might be a old // url we will migrate on the fly. - return h.redirect(url).takeover(); + return h + .redirect(url) + .permanent() + .takeover(); } if (url.path.startsWith('/app/dashboard_mode')) { // let through requests to the dashboard_mode app From e84b54e911a86fd1a655c3a519dd440ff320323b Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 4 May 2020 11:53:24 +0200 Subject: [PATCH 100/134] fix jest integration tests --- .../integration_tests/default_route_provider_config.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/server/core_app/integration_tests/default_route_provider_config.test.ts b/src/core/server/core_app/integration_tests/default_route_provider_config.test.ts index 221e6fa42471cd..2c7efe075152bd 100644 --- a/src/core/server/core_app/integration_tests/default_route_provider_config.test.ts +++ b/src/core/server/core_app/integration_tests/default_route_provider_config.test.ts @@ -49,7 +49,7 @@ describe('default route provider', () => { expect(status).toEqual(302); expect(header).toMatchObject({ - location: '/hello/app/kibana', + location: '/hello/app/home', }); }); @@ -71,7 +71,7 @@ describe('default route provider', () => { const { status, header } = await kbnTestServer.request.get(root, '/'); expect(status).toEqual(302); expect(header).toMatchObject({ - location: '/hello/app/kibana', + location: '/hello/app/home', }); }); From 2873ff07b9405369086e9890f281a5a066894beb Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 4 May 2020 13:57:35 +0200 Subject: [PATCH 101/134] fix lens paths --- x-pack/plugins/lens/public/app_plugin/mounter.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/lens/public/app_plugin/mounter.tsx b/x-pack/plugins/lens/public/app_plugin/mounter.tsx index 4887429882a1ea..f29165e80728a2 100644 --- a/x-pack/plugins/lens/public/app_plugin/mounter.tsx +++ b/x-pack/plugins/lens/public/app_plugin/mounter.tsx @@ -95,9 +95,9 @@ export async function mountApp( - - - + + + , From 23cc3188c51fad8c9023519f066668d3f3c63e8e Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 4 May 2020 15:28:49 +0200 Subject: [PATCH 102/134] fix api integration snapshot --- test/api_integration/apis/saved_objects_management/find.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 1412199d57a22e..740cfce4968e80 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -220,7 +220,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }); From 2487db47c14a81e3a1dd6e72ca916e634107cf9d Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 4 May 2020 18:04:51 +0200 Subject: [PATCH 103/134] fix docs --- src/plugins/data/public/public.api.md | 77 +++++---------------------- 1 file changed, 14 insertions(+), 63 deletions(-) diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index 6e3db2ce27d44d..152f6dda84598f 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1789,54 +1789,6 @@ export type TSearchStrategyProvider = (context: ISearc // src/plugins/data/common/es_query/filters/match_all_filter.ts:28:3 - (ae-forgotten-export) The symbol "MatchAllFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts // src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts -<<<<<<< HEAD -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FilterLabel" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "generateFilters" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "changeTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:65:23 - (ae-forgotten-export) The symbol "extractTimeFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "buildEsQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "getEsQueryConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "luceneStringToDsl" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:135:21 - (ae-forgotten-export) The symbol "decorateQuery" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "FieldFormatsRegistry" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BoolFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "BytesFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "ColorFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "DateNanosFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "DurationFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "IpFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "NumberFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "PercentFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "RelativeDateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "SourceFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StaticLookupFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "UrlFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:177:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getFromSavedObject" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:236:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:376:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:378:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:388:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:394:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:398:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:402:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts -======= // src/plugins/data/public/index.ts:66:23 - (ae-forgotten-export) The symbol "FilterLabel" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:66:23 - (ae-forgotten-export) The symbol "FILTERS" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:66:23 - (ae-forgotten-export) The symbol "getDisplayValueFromFilter" needs to be exported by the entry point index.d.ts @@ -1870,21 +1822,20 @@ export type TSearchStrategyProvider = (context: ISearc // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "getRoutes" needs to be exported by the entry point index.d.ts // src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:377:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:379:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:389:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:395:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:399:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts -// src/plugins/data/public/index.ts:403:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts ->>>>>>> upstream/master +// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "getRequestInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:378:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:380:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:381:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:390:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:391:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:392:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:396:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:397:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:400:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:401:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts +// src/plugins/data/public/index.ts:404:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:33:33 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts // src/plugins/data/public/query/state_sync/connect_to_query_state.ts:37:1 - (ae-forgotten-export) The symbol "QueryStateChange" needs to be exported by the entry point index.d.ts // src/plugins/data/public/types.ts:52:5 - (ae-forgotten-export) The symbol "createFiltersFromValueClickAction" needs to be exported by the entry point index.d.ts From 0e5564260d5d4487d87ea4c05422db4aeda110f4 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 4 May 2020 18:05:32 +0200 Subject: [PATCH 104/134] fix paths in api integration tests --- .../apis/saved_objects_management/find.ts | 2 +- .../apis/saved_objects_management/relationships.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/api_integration/apis/saved_objects_management/find.ts b/test/api_integration/apis/saved_objects_management/find.ts index 740cfce4968e80..484b2c1500f550 100644 --- a/test/api_integration/apis/saved_objects_management/find.ts +++ b/test/api_integration/apis/saved_objects_management/find.ts @@ -238,7 +238,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/dashboard/b70c7ae0-3224-11e8-a572-ffca06da1357', + path: '/app/dashboards#/view/b70c7ae0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'dashboard.show', }, }); diff --git a/test/api_integration/apis/saved_objects_management/relationships.ts b/test/api_integration/apis/saved_objects_management/relationships.ts index 048fdf5734b669..715de332a16078 100644 --- a/test/api_integration/apis/saved_objects_management/relationships.ts +++ b/test/api_integration/apis/saved_objects_management/relationships.ts @@ -281,7 +281,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -296,7 +296,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedDashboards/b70c7ae0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/kibana#/dashboard/b70c7ae0-3224-11e8-a572-ffca06da1357', + path: '/app/dashboards#/view/b70c7ae0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'dashboard.show', }, }, @@ -321,7 +321,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -364,7 +364,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, @@ -404,7 +404,7 @@ export default function({ getService }: FtrProviderContext) { editUrl: '/management/kibana/objects/savedSearches/960372e0-3224-11e8-a572-ffca06da1357', inAppUrl: { - path: '/app/discover#//960372e0-3224-11e8-a572-ffca06da1357', + path: '/app/discover#/960372e0-3224-11e8-a572-ffca06da1357', uiCapabilitiesPath: 'discover.show', }, }, From a1f981c0eb5147519f5f584a3afbc028cdb8b278 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 5 May 2020 12:45:54 +0200 Subject: [PATCH 105/134] drilldown fixes --- src/plugins/dashboard/public/plugin.tsx | 2 +- src/plugins/dashboard/public/url_generator.test.ts | 12 ++++++------ src/plugins/dashboard/public/url_generator.ts | 2 +- .../kibana_legacy/public/angular/angular_config.tsx | 4 +++- .../drilldown.test.tsx | 4 ++-- .../dashboard_to_dashboard_drilldown/drilldown.tsx | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/plugins/dashboard/public/plugin.tsx b/src/plugins/dashboard/public/plugin.tsx index 54fbf23d6c9966..529a7d48a04892 100644 --- a/src/plugins/dashboard/public/plugin.tsx +++ b/src/plugins/dashboard/public/plugin.tsx @@ -153,7 +153,7 @@ export class DashboardPlugin createDirectAccessDashboardLinkGenerator(async () => { const [coreStart, , selfStart] = await startServices; return { - appBasePath: coreStart.application.getUrlForApp('dashboard'), + appBasePath: coreStart.application.getUrlForApp('dashboards'), useHashedUrl: coreStart.uiSettings.get('state:storeInSessionStorage'), savedDashboardLoader: selfStart.getSavedDashboardLoader(), }; diff --git a/src/plugins/dashboard/public/url_generator.test.ts b/src/plugins/dashboard/public/url_generator.test.ts index 248a3f991d6cbf..170677dec61b12 100644 --- a/src/plugins/dashboard/public/url_generator.test.ts +++ b/src/plugins/dashboard/public/url_generator.test.ts @@ -24,7 +24,7 @@ import { mockStorage } from '../../kibana_utils/public/storage/hashed_item_store import { esFilters, Filter } from '../../data/public'; import { SavedObjectLoader } from '../../saved_objects/public'; -const APP_BASE_PATH: string = 'xyz/app/kibana'; +const APP_BASE_PATH: string = 'xyz/app/dashboards'; const createMockDashboardLoader = ( dashboardToFilters: { @@ -63,7 +63,7 @@ describe('dashboard url generator', () => { }) ); const url = await generator.createUrl!({}); - expect(url).toMatchInlineSnapshot(`"xyz/app/kibana#/dashboard?_a=()&_g=()"`); + expect(url).toMatchInlineSnapshot(`"xyz/app/dashboards#/create?_a=()&_g=()"`); }); test('creates a link with global time range set up', async () => { @@ -78,7 +78,7 @@ describe('dashboard url generator', () => { timeRange: { to: 'now', from: 'now-15m', mode: 'relative' }, }); expect(url).toMatchInlineSnapshot( - `"xyz/app/kibana#/dashboard?_a=()&_g=(time:(from:now-15m,mode:relative,to:now))"` + `"xyz/app/dashboards#/create?_a=()&_g=(time:(from:now-15m,mode:relative,to:now))"` ); }); @@ -118,7 +118,7 @@ describe('dashboard url generator', () => { query: { query: 'bye', language: 'kuery' }, }); expect(url).toMatchInlineSnapshot( - `"xyz/app/kibana#/dashboard/123?_a=(filters:!((meta:(alias:!n,disabled:!f,negate:!f),query:(query:hi))),query:(language:kuery,query:bye))&_g=(filters:!(('$state':(store:globalState),meta:(alias:!n,disabled:!f,negate:!f),query:(query:hi))),refreshInterval:(pause:!f,value:300),time:(from:now-15m,mode:relative,to:now))"` + `"xyz/app/dashboards#/view/123?_a=(filters:!((meta:(alias:!n,disabled:!f,negate:!f),query:(query:hi))),query:(language:kuery,query:bye))&_g=(filters:!(('$state':(store:globalState),meta:(alias:!n,disabled:!f,negate:!f),query:(query:hi))),refreshInterval:(pause:!f,value:300),time:(from:now-15m,mode:relative,to:now))"` ); }); @@ -265,7 +265,7 @@ describe('dashboard url generator', () => { expect(url).not.toEqual(expect.stringContaining('query:savedfilter1')); expect(url).not.toEqual(expect.stringContaining('query:appliedfilter')); expect(url).toMatchInlineSnapshot( - `"xyz/app/kibana#/dashboard/dashboard1?_a=(filters:!())&_g=(filters:!())"` + `"xyz/app/dashboards#/view/dashboard1?_a=(filters:!())&_g=(filters:!())"` ); }); @@ -284,7 +284,7 @@ describe('dashboard url generator', () => { dashboardId: 'dashboard1', }); expect(url).not.toEqual(expect.stringContaining('filters')); - expect(url).toMatchInlineSnapshot(`"xyz/app/kibana#/dashboard/dashboard1?_a=()&_g=()"`); + expect(url).toMatchInlineSnapshot(`"xyz/app/dashboards#/view/dashboard1?_a=()&_g=()"`); }); test('can turn off preserving filters', async () => { diff --git a/src/plugins/dashboard/public/url_generator.ts b/src/plugins/dashboard/public/url_generator.ts index 6f121ceb2d3731..57d19fbb1666a0 100644 --- a/src/plugins/dashboard/public/url_generator.ts +++ b/src/plugins/dashboard/public/url_generator.ts @@ -87,7 +87,7 @@ export const createDirectAccessDashboardLinkGenerator = ( const startServices = await getStartServices(); const useHash = state.useHash ?? startServices.useHashedUrl; const appBasePath = startServices.appBasePath; - const hash = state.dashboardId ? `dashboard/${state.dashboardId}` : `dashboard`; + const hash = state.dashboardId ? `view/${state.dashboardId}` : `create`; const getSavedFiltersFromDestinationDashboardIfNeeded = async (): Promise => { if (state.preserveSavedFilters === false) return []; diff --git a/src/plugins/kibana_legacy/public/angular/angular_config.tsx b/src/plugins/kibana_legacy/public/angular/angular_config.tsx index 570f22f3eeec31..599162e52887cd 100644 --- a/src/plugins/kibana_legacy/public/angular/angular_config.tsx +++ b/src/plugins/kibana_legacy/public/angular/angular_config.tsx @@ -147,7 +147,9 @@ const getEsUrl = (newPlatform: CoreStart) => { const digestOnHashChange = (getHistory?: () => History) => ($rootScope: IRootScopeService) => { if (!getHistory) return; const unlisten = getHistory().listen(() => { - $rootScope.$applyAsync(); + // dispatch synthetic hash change event to update hash history objects and angular routing + // this is necessary because hash updates triggered by using popState won't trigger this event naturally. + window.dispatchEvent(new HashChangeEvent('hashchange')); }); $rootScope.$on('$destroy', unlisten); }; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.test.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.test.tsx index 18ee95cb57b3bc..9c5941d2638dc6 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.test.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.test.tsx @@ -163,7 +163,7 @@ describe('.execute() & getHref', () => { } expect(navigateToApp).toBeCalledTimes(1); - expect(navigateToApp.mock.calls[0][0]).toBe('kibana'); + expect(navigateToApp.mock.calls[0][0]).toBe('dashboards'); const executeNavigatedPath = navigateToApp.mock.calls[0][1]?.path; const href = await drilldown.getHref(completeConfig, context); @@ -186,7 +186,7 @@ describe('.execute() & getHref', () => { false ); - expect(href).toEqual(expect.stringContaining(`dashboard/${testDashboardId}`)); + expect(href).toEqual(expect.stringContaining(`view/${testDashboardId}`)); }); test('query is removed if filters are disabled', async () => { diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx index 848e77384f7f04..2760d497649c71 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx @@ -61,7 +61,7 @@ export class DashboardToDashboardDrilldown const dashboardPath = await this.getDestinationUrl(config, context); const dashboardHash = dashboardPath.split('#')[1]; - return this.params.start().core.application.getUrlForApp('kibana', { + return this.params.start().core.application.getUrlForApp('dashboards', { path: `#${dashboardHash}`, }); }; @@ -73,7 +73,7 @@ export class DashboardToDashboardDrilldown const dashboardPath = await this.getDestinationUrl(config, context); const dashboardHash = dashboardPath.split('#')[1]; - await this.params.start().core.application.navigateToApp('kibana', { + await this.params.start().core.application.navigateToApp('dashboards', { path: `#${dashboardHash}`, }); }; From 88b174362edc04c1a658369f4a6e6925d8e25565 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 5 May 2020 14:18:09 +0200 Subject: [PATCH 106/134] fix discover --- src/plugins/kibana_legacy/public/angular/angular_config.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/kibana_legacy/public/angular/angular_config.tsx b/src/plugins/kibana_legacy/public/angular/angular_config.tsx index 599162e52887cd..57e6e0d69ce313 100644 --- a/src/plugins/kibana_legacy/public/angular/angular_config.tsx +++ b/src/plugins/kibana_legacy/public/angular/angular_config.tsx @@ -149,7 +149,10 @@ const digestOnHashChange = (getHistory?: () => History) => ($rootScope: IRootSco const unlisten = getHistory().listen(() => { // dispatch synthetic hash change event to update hash history objects and angular routing // this is necessary because hash updates triggered by using popState won't trigger this event naturally. - window.dispatchEvent(new HashChangeEvent('hashchange')); + // this has to happen in the next tick to not change the existing timing of angular digest cycles. + setTimeout(() => { + window.dispatchEvent(new HashChangeEvent('hashchange')); + }, 0); }); $rootScope.$on('$destroy', unlisten); }; From ac7387e6368c2474b5f4229fa7122a6e57bbed45 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 6 May 2020 11:58:14 +0200 Subject: [PATCH 107/134] fix visualize dashboard jump back and stabilize lens dashboard tests --- .../public/save_modal/saved_object_save_modal_origin.tsx | 2 +- x-pack/test/functional/page_objects/lens_page.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx index 34f4bc593fdc4e..734ebb1095d84d 100644 --- a/src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx +++ b/src/plugins/saved_objects/public/save_modal/saved_object_save_modal_origin.tsx @@ -62,7 +62,7 @@ export function SavedObjectSaveModalOrigin(props: OriginSaveModalProps) { if ( !state.copyOnSave || - origin === 'dashboard' // dashboard supports adding a copied panel on save... + origin === 'dashboards' // dashboard supports adding a copied panel on save... ) { const originVerb = !documentInfo.id || state.copyOnSave ? addLabel : returnLabel; return ( diff --git a/x-pack/test/functional/page_objects/lens_page.ts b/x-pack/test/functional/page_objects/lens_page.ts index c4dcf63941cd51..2ee557c3ec5493 100644 --- a/x-pack/test/functional/page_objects/lens_page.ts +++ b/x-pack/test/functional/page_objects/lens_page.ts @@ -134,6 +134,7 @@ export function LensPageProvider({ getService, getPageObjects }: FtrProviderCont * Save the current Lens visualization. */ async save(title: string, saveAsNew?: boolean, redirectToOrigin?: boolean) { + await PageObjects.header.waitUntilLoadingHasFinished(); await testSubjects.click('lnsApp_saveButton'); await testSubjects.setValue('savedObjectTitle', title); From 1de8a10e60b760074f5733492391470699082dcd Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 6 May 2020 15:23:18 +0200 Subject: [PATCH 108/134] go to default app id when loading home --- src/plugins/home/public/plugin.ts | 3 +++ .../kibana_legacy/public/navigate_to_default_app.ts | 5 +++-- src/plugins/kibana_legacy/public/plugin.ts | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 83acae2e4972df..190cc2ef33ca2a 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -102,6 +102,9 @@ export class HomePublicPlugin coreStart.chrome.docTitle.change( i18n.translate('home.pageTitle', { defaultMessage: 'Home' }) ); + // Initially navigate to default app set by `kibana.defaultAppId`. + // This doesn't do anything as along as the default settings are kept. + kibanaLegacyStart.navigateToDefaultApp({ overwriteHash: false }); const { renderApp } = await import('./application'); return await renderApp(params.element); }, diff --git a/src/plugins/kibana_legacy/public/navigate_to_default_app.ts b/src/plugins/kibana_legacy/public/navigate_to_default_app.ts index 61e546d3de01c1..20e54b25d07c24 100644 --- a/src/plugins/kibana_legacy/public/navigate_to_default_app.ts +++ b/src/plugins/kibana_legacy/public/navigate_to_default_app.ts @@ -25,7 +25,8 @@ export function navigateToDefaultApp( forwards: ForwardDefinition[], application: ApplicationStart, basePath: IBasePath, - currentAppId: string | undefined + currentAppId: string | undefined, + overwriteHash: boolean ) { // navigate to the respective path in the legacy kibana plugin by default (for unmigrated plugins) let targetAppId = 'kibana'; @@ -48,7 +49,7 @@ export function navigateToDefaultApp( } else { application.navigateToApp(targetAppId, { path: targetAppPath }); } - } else { + } else if (overwriteHash) { window.location.hash = targetAppPath; } } diff --git a/src/plugins/kibana_legacy/public/plugin.ts b/src/plugins/kibana_legacy/public/plugin.ts index ea52b9ec463cd5..1c0d0aa54a8059 100644 --- a/src/plugins/kibana_legacy/public/plugin.ts +++ b/src/plugins/kibana_legacy/public/plugin.ts @@ -204,13 +204,16 @@ export class KibanaLegacyPlugin { * Navigates to the app defined as kibana.defaultAppId. * This takes redirects into account and uses the right mechanism to navigate. */ - navigateToDefaultApp: () => { + navigateToDefaultApp: ( + { overwriteHash }: { overwriteHash: boolean } = { overwriteHash: true } + ) => { navigateToDefaultApp( this.initializerContext.config.get().defaultAppId, this.forwardDefinitions, application, basePath, - this.currentAppId + this.currentAppId, + overwriteHash ); }, }; From e6b8f12f3a76b0b87f91a025b05e809167b70cf3 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 6 May 2020 15:51:08 +0200 Subject: [PATCH 109/134] initially go to defaultAppId if home is the first app accessed --- src/plugins/home/public/plugin.ts | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/plugins/home/public/plugin.ts b/src/plugins/home/public/plugin.ts index 190cc2ef33ca2a..8256058b287a4d 100644 --- a/src/plugins/home/public/plugin.ts +++ b/src/plugins/home/public/plugin.ts @@ -25,6 +25,7 @@ import { PluginInitializerContext, } from 'kibana/public'; import { i18n } from '@kbn/i18n'; +import { first } from 'rxjs/operators'; import { EnvironmentService, @@ -102,9 +103,6 @@ export class HomePublicPlugin coreStart.chrome.docTitle.change( i18n.translate('home.pageTitle', { defaultMessage: 'Home' }) ); - // Initially navigate to default app set by `kibana.defaultAppId`. - // This doesn't do anything as along as the default settings are kept. - kibanaLegacyStart.navigateToDefaultApp({ overwriteHash: false }); const { renderApp } = await import('./application'); return await renderApp(params.element); }, @@ -118,8 +116,26 @@ export class HomePublicPlugin }; } - public start({ application: { capabilities } }: CoreStart) { + public start( + { application: { capabilities, currentAppId$ }, http }: CoreStart, + { kibanaLegacy }: HomePluginStartDependencies + ) { this.featuresCatalogueRegistry.start({ capabilities }); + + // If the home app is the initial location when loading Kibana... + if ( + window.location.pathname === http.basePath.prepend(`/app/home`) && + window.location.hash === '' + ) { + // ...wait for the app to mount initially and then... + currentAppId$.pipe(first()).subscribe(appId => { + if (appId === 'home') { + // ...navigate to default app set by `kibana.defaultAppId`. + // This doesn't do anything as along as the default settings are kept. + kibanaLegacy.navigateToDefaultApp({ overwriteHash: false }); + } + }); + } } } From 9465eb5c789b14f59e217689be20314b02798100 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 7 May 2020 10:05:34 +0200 Subject: [PATCH 110/134] fix legacy links in infra app --- .../public/pages/logs/stream/page_no_indices_content.tsx | 4 ++-- .../infra/public/pages/metrics/inventory_view/index.tsx | 4 ++-- .../pages/metrics/metric_detail/components/invalid_node.tsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx index 7a84e67e8fc3d1..3c0b32955634b6 100644 --- a/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx +++ b/x-pack/plugins/infra/public/pages/logs/stream/page_no_indices_content.tsx @@ -21,8 +21,8 @@ export const LogsPageNoIndicesContent = () => { const canConfigureSource = application?.capabilities?.logs?.configureSource ? true : false; const tutorialLinkProps = useLinkProps({ - app: 'kibana', - hash: '/home/tutorial_directory/logging', + app: 'home', + hash: '/tutorial_directory/logging', }); return ( diff --git a/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx b/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx index 3a2c33d1c824c5..ef9508c61d4f86 100644 --- a/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/inventory_view/index.tsx @@ -36,8 +36,8 @@ export const SnapshotPage = () => { useTrackPageview({ app: 'infra_metrics', path: 'inventory', delay: 15000 }); const tutorialLinkProps = useLinkProps({ - app: 'kibana', - hash: '/home/tutorial_directory/metrics', + app: 'home', + hash: '/tutorial_directory/metrics', }); return ( diff --git a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/invalid_node.tsx b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/invalid_node.tsx index 6d83017a3f6892..b9b8e83b598f3b 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/invalid_node.tsx +++ b/x-pack/plugins/infra/public/pages/metrics/metric_detail/components/invalid_node.tsx @@ -17,8 +17,8 @@ interface InvalidNodeErrorProps { export const InvalidNodeError: React.FunctionComponent = ({ nodeName }) => { const tutorialLinkProps = useLinkProps({ - app: 'kibana', - hash: '/home/tutorial_directory/metrics', + app: 'home', + hash: '/tutorial_directory/metrics', }); return ( From a1a5563d3053780d43137cdeea205c2c36c2de5e Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 7 May 2020 10:35:52 +0200 Subject: [PATCH 111/134] add coordinate back to functional test --- test/functional/apps/visualize/_chart_types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/test/functional/apps/visualize/_chart_types.ts b/test/functional/apps/visualize/_chart_types.ts index 6b10600838c684..ac73c9ef3116a3 100644 --- a/test/functional/apps/visualize/_chart_types.ts +++ b/test/functional/apps/visualize/_chart_types.ts @@ -38,6 +38,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { let expectedChartTypes = [ 'Area', 'Controls', + 'Coordinate Map', // TODO skipped because legacy maps vis are not ready yet 'Data Table', 'Gauge', From 4fdb8fd03e758ada62cd27c91820d8231533f947 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 7 May 2020 12:27:13 +0200 Subject: [PATCH 112/134] remove redundant url parsing from dashboard_to_dashboard drilldown --- .../dashboard_to_dashboard_drilldown/drilldown.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx index 2760d497649c71..9c7bdede6fcdb0 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/dashboard_to_dashboard_drilldown/drilldown.tsx @@ -58,12 +58,7 @@ export class DashboardToDashboardDrilldown config: Config, context: ActionContext ): Promise => { - const dashboardPath = await this.getDestinationUrl(config, context); - const dashboardHash = dashboardPath.split('#')[1]; - - return this.params.start().core.application.getUrlForApp('dashboards', { - path: `#${dashboardHash}`, - }); + return this.getDestinationUrl(config, context); }; public readonly execute = async ( From 3dcf518fd47d34615f1bbd6ec24f4d4725731078 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 7 May 2020 12:27:35 +0200 Subject: [PATCH 113/134] fix dashboard_to_discover example --- .../public/dashboard_to_discover_drilldown/drilldown.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/examples/ui_actions_enhanced_examples/public/dashboard_to_discover_drilldown/drilldown.tsx b/x-pack/examples/ui_actions_enhanced_examples/public/dashboard_to_discover_drilldown/drilldown.tsx index 1213ec2f35995e..be2b6ef7a241c2 100644 --- a/x-pack/examples/ui_actions_enhanced_examples/public/dashboard_to_discover_drilldown/drilldown.tsx +++ b/x-pack/examples/ui_actions_enhanced_examples/public/dashboard_to_discover_drilldown/drilldown.tsx @@ -65,17 +65,17 @@ export class DashboardToDiscoverDrilldown implements Drilldown => { - return `kibana${await this.getPath(config, context)}`; + return `discover${await this.getPath(config, context)}`; }; public readonly execute = async (config: Config, context: ActionContext) => { const path = await this.getPath(config, context); - await this.params.start().core.application.navigateToApp('kibana', { + await this.params.start().core.application.navigateToApp('discover', { path, }); }; From f8ca0ae5a826e376c68a87c3853ee487b95b5d80 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Thu, 7 May 2020 14:29:32 +0200 Subject: [PATCH 114/134] Move and refactor style_compile to kibana_legacy In Discover the row height wasn't truncated because the style_compile functionality wasn't migrated to our new word. This commit removes the legacy style_compile and adds its functionality to kibana_legacy. It injects a custom style into the head section of the HTML, makes the height of a table row configureable in Advanced Settings of Management. --- src/legacy/ui/public/_index.scss | 1 - src/legacy/ui/public/autoload/modules.js | 1 - .../style_compile/__tests__/style_compile.js | 66 ------------------- .../ui/public/style_compile/_index.scss | 3 - .../style_compile/style_compile.css.tmpl | 7 -- .../ui/public/style_compile/style_compile.js | 52 --------------- src/plugins/kibana_legacy/public/plugin.ts | 4 +- .../public/utils/inject_header_style.ts} | 23 ++++++- 8 files changed, 25 insertions(+), 132 deletions(-) delete mode 100644 src/legacy/ui/public/style_compile/__tests__/style_compile.js delete mode 100644 src/legacy/ui/public/style_compile/_index.scss delete mode 100644 src/legacy/ui/public/style_compile/style_compile.css.tmpl delete mode 100644 src/legacy/ui/public/style_compile/style_compile.js rename src/{legacy/ui/public/style_compile/index.js => plugins/kibana_legacy/public/utils/inject_header_style.ts} (52%) diff --git a/src/legacy/ui/public/_index.scss b/src/legacy/ui/public/_index.scss index f10718ba58c2cb..d18d6fcefdab61 100644 --- a/src/legacy/ui/public/_index.scss +++ b/src/legacy/ui/public/_index.scss @@ -13,5 +13,4 @@ @import './error_url_overflow/index'; @import './exit_full_screen/index'; @import './field_editor/index'; -@import './style_compile/index'; @import '../../../plugins/management/public/components/index'; diff --git a/src/legacy/ui/public/autoload/modules.js b/src/legacy/ui/public/autoload/modules.js index b40f051a5ec101..94929c8ca26d34 100644 --- a/src/legacy/ui/public/autoload/modules.js +++ b/src/legacy/ui/public/autoload/modules.js @@ -25,7 +25,6 @@ import '../private'; import '../promises'; import '../state_management/app_state'; import '../state_management/global_state'; -import '../style_compile'; import '../url'; import '../directives/watch_multi'; import '../react_components'; diff --git a/src/legacy/ui/public/style_compile/__tests__/style_compile.js b/src/legacy/ui/public/style_compile/__tests__/style_compile.js deleted file mode 100644 index 329177f67539ba..00000000000000 --- a/src/legacy/ui/public/style_compile/__tests__/style_compile.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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'; -import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -describe('styleCompile directive', function() { - let config; - let $rootScope; - - beforeEach(ngMock.module('kibana')); - beforeEach( - ngMock.inject(function($injector) { - config = $injector.get('config'); - $rootScope = $injector.get('$rootScope'); - }) - ); - - it('exports a few config values as css', function() { - const $style = $('#style-compile'); - - config.set('truncate:maxHeight', 0); - $rootScope.$apply(); - expect($style.html().trim()).to.be( - [ - '.truncate-by-height {', - ' max-height: none;', - ' display: inline-block;', - '}', - '.truncate-by-height:before {', - ' top: -15px;', - '}', - ].join('\n') - ); - - config.set('truncate:maxHeight', 15); - $rootScope.$apply(); - expect($style.html().trim()).to.be( - [ - '.truncate-by-height {', - ' max-height: 15px !important;', - ' display: inline-block;', - '}', - '.truncate-by-height:before {', - ' top: 0px;', - '}', - ].join('\n') - ); - }); -}); diff --git a/src/legacy/ui/public/style_compile/_index.scss b/src/legacy/ui/public/style_compile/_index.scss deleted file mode 100644 index 6dd403d7303144..00000000000000 --- a/src/legacy/ui/public/style_compile/_index.scss +++ /dev/null @@ -1,3 +0,0 @@ -style-compile { - display: none; -} diff --git a/src/legacy/ui/public/style_compile/style_compile.css.tmpl b/src/legacy/ui/public/style_compile/style_compile.css.tmpl deleted file mode 100644 index 943b459acc5652..00000000000000 --- a/src/legacy/ui/public/style_compile/style_compile.css.tmpl +++ /dev/null @@ -1,7 +0,0 @@ -.truncate-by-height { - max-height: <%= truncateMaxHeight %>; - display: inline-block; -} -.truncate-by-height:before { - top: <%= truncateGradientTop %>; -} diff --git a/src/legacy/ui/public/style_compile/style_compile.js b/src/legacy/ui/public/style_compile/style_compile.js deleted file mode 100644 index 5b53947e6eb009..00000000000000 --- a/src/legacy/ui/public/style_compile/style_compile.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 '../config'; -import { uiModules } from '../modules'; -import cssTmpl from './style_compile.css.tmpl'; - -const $style = $('