From d72bf4455e4436bce2618b5f5c12251a862839dd Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 28 Oct 2024 14:03:34 +0100 Subject: [PATCH 1/6] remove legacy heatmap tests --- .../apps/visualize/group2/_heatmap_chart.ts | 179 ------------------ .../functional/apps/visualize/group2/index.ts | 3 - .../apps/visualize/group3/_pie_chart.ts | 5 +- .../functional/page_objects/visualize_page.ts | 3 +- .../apps/lens/open_in_lens/agg_based/gauge.ts | 4 +- .../apps/lens/open_in_lens/agg_based/goal.ts | 4 +- .../lens/open_in_lens/agg_based/heatmap.ts | 4 +- .../lens/open_in_lens/agg_based/metric.ts | 4 +- .../apps/lens/open_in_lens/agg_based/pie.ts | 2 +- .../apps/lens/open_in_lens/agg_based/table.ts | 4 +- .../apps/lens/open_in_lens/agg_based/xy.ts | 2 +- .../functional/apps/visualize/telemetry.ts | 2 - 12 files changed, 10 insertions(+), 206 deletions(-) delete mode 100644 test/functional/apps/visualize/group2/_heatmap_chart.ts diff --git a/test/functional/apps/visualize/group2/_heatmap_chart.ts b/test/functional/apps/visualize/group2/_heatmap_chart.ts deleted file mode 100644 index a8944f1131d06..0000000000000 --- a/test/functional/apps/visualize/group2/_heatmap_chart.ts +++ /dev/null @@ -1,179 +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 - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -import expect from '@kbn/expect'; - -import { FtrProviderContext } from '../../../ftr_provider_context'; - -export default function ({ getService, getPageObjects }: FtrProviderContext) { - const log = getService('log'); - const inspector = getService('inspector'); - const { visualize, visEditor, visChart, timePicker } = getPageObjects([ - 'visualize', - 'visEditor', - 'visChart', - 'timePicker', - ]); - - describe('heatmap chart', function indexPatternCreation() { - const vizName1 = 'Visualization HeatmapChart'; - let isNewChartsLibraryEnabled = false; - - before(async function () { - isNewChartsLibraryEnabled = await visChart.isNewChartsLibraryEnabled( - 'visualization:visualize:legacyHeatmapChartsLibrary' - ); - await visualize.initTests(isNewChartsLibraryEnabled); - log.debug('navigateToApp visualize'); - await visualize.navigateToNewAggBasedVisualization(); - log.debug('clickHeatmapChart'); - await visualize.clickHeatmapChart(); - await visualize.clickNewSearch(); - await timePicker.setDefaultAbsoluteRange(); - log.debug('Bucket = X-Axis'); - await visEditor.clickBucket('X-axis'); - log.debug('Aggregation = Date Histogram'); - await visEditor.selectAggregation('Date Histogram'); - log.debug('Field = @timestamp'); - await visEditor.selectField('@timestamp'); - // leaving Interval set to Auto - await visEditor.clickGo(isNewChartsLibraryEnabled); - }); - - it('should save and load', async function () { - await visualize.saveVisualizationExpectSuccessAndBreadcrumb(vizName1); - - await visualize.loadSavedVisualization(vizName1); - await visChart.waitForVisualization(); - }); - - it('should have inspector enabled', async function () { - await inspector.expectIsEnabled(); - }); - - it('should show correct data', async function () { - // this is only the first page of the tabular data. - const expectedChartData = [ - ['2015-09-20 00:00', '37'], - ['2015-09-20 03:00', '202'], - ['2015-09-20 06:00', '740'], - ['2015-09-20 09:00', '1,437'], - ['2015-09-20 12:00', '1,371'], - ['2015-09-20 15:00', '751'], - ['2015-09-20 18:00', '188'], - ['2015-09-20 21:00', '31'], - ['2015-09-21 00:00', '42'], - ['2015-09-21 03:00', '202'], - ['2015-09-21 06:00', '683'], - ['2015-09-21 09:00', '1,361'], - ['2015-09-21 12:00', '1,415'], - ['2015-09-21 15:00', '707'], - ['2015-09-21 18:00', '177'], - ['2015-09-21 21:00', '27'], - ['2015-09-22 00:00', '32'], - ['2015-09-22 03:00', '175'], - ['2015-09-22 06:00', '707'], - ['2015-09-22 09:00', '1,408'], - ]; - - await inspector.open(); - await inspector.expectTableData(expectedChartData); - await inspector.close(); - }); - - it('should show 4 color ranges as default colorNumbers param', async function () { - const legends = await visChart.getLegendEntries(); - let expectedLegends = []; - if (isNewChartsLibraryEnabled) { - // the bands are different because we always scale to data bounds in the implementation - expectedLegends = ['27 - 379.5', '379.5 - 732', '732 - 1,084.5', '1,084.5 - 1,437']; - } else { - expectedLegends = ['0 - 400', '400 - 800', '800 - 1,200', '1,200 - 1,600']; - } - expect(legends).to.eql(expectedLegends); - }); - - it('should show 6 color ranges if changed on options', async function () { - await visEditor.clickOptionsTab(); - await visEditor.changeHeatmapColorNumbers(6); - await visEditor.clickGo(isNewChartsLibraryEnabled); - await visChart.waitForVisualizationRenderingStabilized(); - - const legends = await visChart.getLegendEntries(); - let expectedLegends = []; - if (isNewChartsLibraryEnabled) { - // the bands are different because we always scale to data bounds in the implementation - expectedLegends = [ - '27 - 262', - '262 - 497', - '497 - 732', - '732 - 967', - '967 - 1,202', - '1,202 - 1,437', - ]; - } else { - expectedLegends = [ - '0 - 267', - '267 - 534', - '534 - 800', - '800 - 1,067', - '1,067 - 1,334', - '1,334 - 1,600', - ]; - } - expect(legends).to.eql(expectedLegends); - }); - it('should show 6 custom color ranges', async function () { - await visEditor.clickOptionsTab(); - await visEditor.clickEnableCustomRanges(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - await visEditor.clickAddRange(); - - log.debug('customize 2 last ranges'); - await visEditor.setCustomRangeByIndex(6, '650', '720'); - await visEditor.setCustomRangeByIndex(7, '800', '905'); - await visEditor.clickGo(isNewChartsLibraryEnabled); - - await visChart.waitForVisualizationRenderingStabilized(); - const legends = await visChart.getLegendEntries(); - let expectedLegends = []; - if (isNewChartsLibraryEnabled) { - expectedLegends = [ - '0 - 100', - '100 - 200', - '200 - 300', - '300 - 400', - '400 - 500', - '500 - 600', - '600 - 650', - '650 - 720', - '720 - 800', - '800 - 905', - ]; - } else { - expectedLegends = [ - '0 - 100', - '100 - 200', - '200 - 300', - '300 - 400', - '400 - 500', - '500 - 600', - '650 - 720', - '800 - 905', - ]; - } - expect(legends).to.eql(expectedLegends); - }); - }); -} diff --git a/test/functional/apps/visualize/group2/index.ts b/test/functional/apps/visualize/group2/index.ts index 7e17b356b7ea9..ac36733339f77 100644 --- a/test/functional/apps/visualize/group2/index.ts +++ b/test/functional/apps/visualize/group2/index.ts @@ -22,7 +22,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { await kibanaServer.savedObjects.cleanStandardList(); await kibanaServer.uiSettings.update({ 'histogram:maxBars': 100, - 'visualization:visualize:legacyHeatmapChartsLibrary': true, }); await browser.refresh(); @@ -33,7 +32,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { after(async () => { await kibanaServer.uiSettings.update({ 'histogram:maxBars': 1000, - 'visualization:visualize:legacyHeatmapChartsLibrary': false, }); await browser.refresh(); }); @@ -41,7 +39,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./_inspector')); loadTestFile(require.resolve('./_experimental_vis')); loadTestFile(require.resolve('./_gauge_chart')); - loadTestFile(require.resolve('./_heatmap_chart')); loadTestFile(require.resolve('./_histogram_request_start')); loadTestFile(require.resolve('./_metric_chart')); }); diff --git a/test/functional/apps/visualize/group3/_pie_chart.ts b/test/functional/apps/visualize/group3/_pie_chart.ts index d42d6e72f232f..f1939af16ed46 100644 --- a/test/functional/apps/visualize/group3/_pie_chart.ts +++ b/test/functional/apps/visualize/group3/_pie_chart.ts @@ -28,11 +28,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('pie chart', function () { // Used to track flag before and after reset - let isNewChartsLibraryEnabled = false; + const isNewChartsLibraryEnabled = false; const vizName1 = 'Visualization PieChart'; before(async function () { - isNewChartsLibraryEnabled = await visChart.isNewChartsLibraryEnabled(); - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); log.debug('navigateToApp visualize'); await visualize.navigateToNewAggBasedVisualization(); diff --git a/test/functional/page_objects/visualize_page.ts b/test/functional/page_objects/visualize_page.ts index 1f6c9cc11c474..76d7c6c74bec8 100644 --- a/test/functional/page_objects/visualize_page.ts +++ b/test/functional/page_objects/visualize_page.ts @@ -52,7 +52,7 @@ export class VisualizePageObject extends FtrService { remoteEsPrefix = 'ftr-remote:'; defaultIndexString = 'logstash-*'; - public async initTests(isNewLibrary = false) { + public async initTests() { await this.kibanaServer.savedObjects.clean({ types: ['visualization'] }); await this.kibanaServer.importExport.load( 'test/functional/fixtures/kbn_archiver/visualize.json' @@ -61,7 +61,6 @@ export class VisualizePageObject extends FtrService { await this.kibanaServer.uiSettings.replace({ defaultIndex: this.defaultIndexString, [FORMATS_UI_SETTINGS.FORMAT_BYTES_DEFAULT_PATTERN]: '0,0.[000]b', - 'visualization:visualize:legacyHeatmapChartsLibrary': !isNewLibrary, 'histogram:maxBars': 100, }); } diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts index 8a0cd091bb85d..2d302bd7b7466 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/gauge.ts @@ -22,10 +22,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const elasticChart = getService('elasticChart'); describe('Gauge', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/goal.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/goal.ts index 9d547f60c3def..89d08c0abeb16 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/goal.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/goal.ts @@ -20,10 +20,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); describe('Goal', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/heatmap.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/heatmap.ts index dbc02a11c9c80..0f30e21942734 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/heatmap.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/heatmap.ts @@ -18,10 +18,8 @@ export default function ({ getPageObjects }: FtrProviderContext) { ]); describe('Heatmap', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/metric.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/metric.ts index 8d966bf24e7a2..0ff670848d47b 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/metric.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/metric.ts @@ -21,10 +21,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const find = getService('find'); describe('Metric', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts index 5d075a5bca88b..d4b3407676ae7 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts @@ -24,7 +24,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const isNewChartsLibraryEnabled = true; before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/table.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/table.ts index 56a4ad07285f5..380f58f2ea8bb 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/table.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/table.ts @@ -21,10 +21,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const comboBox = getService('comboBox'); describe('Table', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts index c615bb9a1b52f..ced90182a64e1 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts @@ -25,7 +25,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const isNewChartsLibraryEnabled = true; before(async () => { - await visualize.initTests(isNewChartsLibraryEnabled); + await visualize.initTests(); }); beforeEach(async () => { diff --git a/x-pack/test/functional/apps/visualize/telemetry.ts b/x-pack/test/functional/apps/visualize/telemetry.ts index 19c4ad83ce906..002f581e81ab0 100644 --- a/x-pack/test/functional/apps/visualize/telemetry.ts +++ b/x-pack/test/functional/apps/visualize/telemetry.ts @@ -34,7 +34,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); await kibanaServer.uiSettings.update({ 'histogram:maxBars': 100, - 'visualization:visualize:legacyHeatmapChartsLibrary': true, }); await retry.try(async () => { @@ -55,7 +54,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); await kibanaServer.uiSettings.update({ 'histogram:maxBars': 1000, - 'visualization:visualize:legacyHeatmapChartsLibrary': false, }); await kibanaServer.savedObjects.cleanStandardList(); }); From 8611e8452ee8a35a20deff0e2748a052c83ddb0e Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 28 Oct 2024 14:11:58 +0100 Subject: [PATCH 2/6] remove the setting --- docs/management/advanced-options.asciidoc | 3 -- .../settings/setting_ids/index.ts | 2 - .../server/collectors/management/schema.ts | 4 -- .../server/collectors/management/types.ts | 1 - src/plugins/telemetry/schema/oss_plugins.json | 8 +--- src/plugins/vis_types/heatmap/common/index.ts | 2 - .../vis_types/heatmap/public/plugin.ts | 22 ++++------ .../vis_types/heatmap/server/plugin.ts | 41 +------------------ src/plugins/vis_types/vislib/kibana.jsonc | 1 - src/plugins/vis_types/vislib/public/plugin.ts | 11 ----- .../vis_types/vislib/public/vislib/VISLIB.md | 7 +--- .../translations/translations/fr-FR.json | 5 +-- .../translations/translations/ja-JP.json | 5 +-- .../translations/translations/zh-CN.json | 5 +-- 14 files changed, 15 insertions(+), 102 deletions(-) diff --git a/docs/management/advanced-options.asciidoc b/docs/management/advanced-options.asciidoc index d6ae2aecaf276..d54bc12780b15 100644 --- a/docs/management/advanced-options.asciidoc +++ b/docs/management/advanced-options.asciidoc @@ -635,9 +635,6 @@ Enables the legacy time axis for charts in Lens, Discover, Visualize and TSVB [[visualization-heatmap-maxbuckets]]`visualization:heatmap:maxBuckets`:: The maximum number of buckets a datasource can return. High numbers can have a negative impact on your browser rendering performance. -[[visualization-visualize-heatmapChartslibrary]]`visualization:visualize:legacyHeatmapChartsLibrary`:: -Disable this option if you prefer to use the new heatmap charts with improved performance, legend settings, and more.. - [float] [[kibana-global-settings-reference]] === Change the global settings diff --git a/packages/kbn-management/settings/setting_ids/index.ts b/packages/kbn-management/settings/setting_ids/index.ts index b146be6f6e252..fbde9c5dbd83d 100644 --- a/packages/kbn-management/settings/setting_ids/index.ts +++ b/packages/kbn-management/settings/setting_ids/index.ts @@ -196,6 +196,4 @@ export const VISUALIZATION_HEATMAP_MAX_BUCKETS_ID = 'visualization:heatmap:maxBu export const VISUALIZATION_USE_LEGACY_TIME_AXIS_ID = 'visualization:useLegacyTimeAxis'; export const VISUALIZATION_LEGACY_GAUGE_CHARTS_LIBRARY_ID = 'visualization:visualize:legacyGaugeChartsLibrary'; -export const VISUALIZATION_LEGACY_HEATMAP_CHARTS_LIBRARY_ID = - 'visualization:visualize:legacyHeatmapChartsLibrary'; export const VISUALIZATION_ENABLE_LABS_ID = 'visualize:enableLabs'; diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts index 779150faa89fb..a0158792e7f01 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/schema.ts @@ -420,10 +420,6 @@ export const stackManagementSchema: MakeSchemaFrom = { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, }, - 'visualization:visualize:legacyHeatmapChartsLibrary': { - type: 'boolean', - _meta: { description: 'Non-default value of setting.' }, - }, 'doc_table:legacy': { type: 'boolean', _meta: { description: 'Non-default value of setting.' }, diff --git a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts index 2734ab6304319..6a1c77d235e15 100644 --- a/src/plugins/kibana_usage_collection/server/collectors/management/types.ts +++ b/src/plugins/kibana_usage_collection/server/collectors/management/types.ts @@ -29,7 +29,6 @@ export interface UsageStats { 'autocomplete:useTimeRange': boolean; 'autocomplete:valueSuggestionMethod': string; 'search:timeout': number; - 'visualization:visualize:legacyHeatmapChartsLibrary': boolean; 'doc_table:legacy': boolean; 'discover:modifyColumnsOnSwitch': boolean; 'discover:searchFieldsFromSource': boolean; diff --git a/src/plugins/telemetry/schema/oss_plugins.json b/src/plugins/telemetry/schema/oss_plugins.json index d54a75b313cd8..0e85c6ed2cb77 100644 --- a/src/plugins/telemetry/schema/oss_plugins.json +++ b/src/plugins/telemetry/schema/oss_plugins.json @@ -10485,12 +10485,6 @@ "description": "Non-default value of setting." } }, - "visualization:visualize:legacyHeatmapChartsLibrary": { - "type": "boolean", - "_meta": { - "description": "Non-default value of setting." - } - }, "doc_table:legacy": { "type": "boolean", "_meta": { @@ -12343,4 +12337,4 @@ } } } -} +} \ No newline at end of file diff --git a/src/plugins/vis_types/heatmap/common/index.ts b/src/plugins/vis_types/heatmap/common/index.ts index 6b932c375cd59..ad21076a9ca93 100644 --- a/src/plugins/vis_types/heatmap/common/index.ts +++ b/src/plugins/vis_types/heatmap/common/index.ts @@ -6,5 +6,3 @@ * your election, the "Elastic License 2.0", the "GNU Affero General Public * License v3.0 only", or the "Server Side Public License, v 1". */ - -export const LEGACY_HEATMAP_CHARTS_LIBRARY = 'visualization:visualize:legacyHeatmapChartsLibrary'; diff --git a/src/plugins/vis_types/heatmap/public/plugin.ts b/src/plugins/vis_types/heatmap/public/plugin.ts index f19d33fb1c3e5..74f6252fffb25 100644 --- a/src/plugins/vis_types/heatmap/public/plugin.ts +++ b/src/plugins/vis_types/heatmap/public/plugin.ts @@ -15,7 +15,6 @@ import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { HeatmapPublicConfig } from '../server/config'; -import { LEGACY_HEATMAP_CHARTS_LIBRARY } from '../common'; import { heatmapVisType } from './vis_type'; import { setDataViewsStart } from './services'; @@ -48,18 +47,15 @@ export class VisTypeHeatmapPlugin { core: CoreSetup, { visualizations, charts, usageCollection }: VisTypeHeatmapSetupDependencies ) { - if (!core.uiSettings.get(LEGACY_HEATMAP_CHARTS_LIBRARY)) { - const { readOnly } = this.initializerContext.config.get(); - visualizations.createBaseVisualization({ - ...heatmapVisType({ - showElasticChartsOptions: true, - palettes: charts.palettes, - }), - disableCreate: Boolean(readOnly), - disableEdit: Boolean(readOnly), - }); - } - return {}; + const { readOnly } = this.initializerContext.config.get(); + visualizations.createBaseVisualization({ + ...heatmapVisType({ + showElasticChartsOptions: true, + palettes: charts.palettes, + }), + disableCreate: Boolean(readOnly), + disableEdit: Boolean(readOnly), + }); } start(core: CoreStart, { dataViews }: VisTypeHeatmapStartDependencies) { diff --git a/src/plugins/vis_types/heatmap/server/plugin.ts b/src/plugins/vis_types/heatmap/server/plugin.ts index bd655a7f991a5..98eeee8cad1da 100644 --- a/src/plugins/vis_types/heatmap/server/plugin.ts +++ b/src/plugins/vis_types/heatmap/server/plugin.ts @@ -7,47 +7,10 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { i18n } from '@kbn/i18n'; -import { schema } from '@kbn/config-schema'; - -import { CoreSetup, Plugin, PluginInitializerContext, UiSettingsParams } from '@kbn/core/server'; +import { CoreSetup, Plugin, PluginInitializerContext } from '@kbn/core/server'; import type { VisualizationsServerSetup } from '@kbn/visualizations-plugin/server'; import { HeatmapConfig } from './config'; -import { LEGACY_HEATMAP_CHARTS_LIBRARY } from '../common'; - -export const getUiSettingsConfig: () => Record> = () => ({ - // TODO: Remove this when vislib heatmap is removed - [LEGACY_HEATMAP_CHARTS_LIBRARY]: { - name: i18n.translate( - 'visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.name', - { - defaultMessage: 'Heatmap legacy charts library', - } - ), - requiresPageReload: true, - value: false, - description: i18n.translate( - 'visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.description', - { - defaultMessage: 'Enables legacy charts library for heatmap charts in visualize.', - } - ), - deprecation: { - message: i18n.translate( - 'visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.deprecation', - { - defaultMessage: - 'The legacy charts library for heatmap in visualize is deprecated and will not be supported in a future version.', - } - ), - docLinksKey: 'visualizationSettings', - }, - category: ['visualization'], - schema: schema.boolean(), - }, -}); - interface PluginSetupDependencies { visualizations: VisualizationsServerSetup; } @@ -58,8 +21,6 @@ export class VisTypeHeatmapServerPlugin implements Plugin { } public setup(core: CoreSetup, plugins: PluginSetupDependencies) { - core.uiSettings.register(getUiSettingsConfig()); - const { readOnly } = this.initializerContext.config.get(); if (readOnly) { plugins.visualizations.registerReadOnlyVisType('heatmap'); diff --git a/src/plugins/vis_types/vislib/kibana.jsonc b/src/plugins/vis_types/vislib/kibana.jsonc index 8521b198c2b6a..eff40aa113b17 100644 --- a/src/plugins/vis_types/vislib/kibana.jsonc +++ b/src/plugins/vis_types/vislib/kibana.jsonc @@ -23,7 +23,6 @@ ], "requiredBundles": [ "kibanaUtils", - "visTypeHeatmap", "visTypeGauge" ] } diff --git a/src/plugins/vis_types/vislib/public/plugin.ts b/src/plugins/vis_types/vislib/public/plugin.ts index 47ba0306b5393..ccedf28f933ec 100644 --- a/src/plugins/vis_types/vislib/public/plugin.ts +++ b/src/plugins/vis_types/vislib/public/plugin.ts @@ -15,11 +15,9 @@ import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import type { UsageCollectionStart } from '@kbn/usage-collection-plugin/public'; -import { LEGACY_HEATMAP_CHARTS_LIBRARY } from '@kbn/vis-type-heatmap-plugin/common'; import { LEGACY_GAUGE_CHARTS_LIBRARY } from '@kbn/vis-type-gauge-plugin/common'; import type { VislibPublicConfig } from '../server/config'; import { setAnalytics, setI18n, setUsageCollectionStart } from './services'; -import { heatmapVisTypeDefinition } from './heatmap'; import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn'; import { setFormatService, setDataActions, setTheme } from './services'; @@ -59,15 +57,6 @@ export class VisTypeVislibPlugin const { readOnly } = this.initializerContext.config.get(); - if (core.uiSettings.get(LEGACY_HEATMAP_CHARTS_LIBRARY)) { - // register vislib heatmap chart - visualizations.createBaseVisualization({ - ...heatmapVisTypeDefinition, - disableCreate: Boolean(readOnly), - disableEdit: Boolean(readOnly), - }); - } - if (core.uiSettings.get(LEGACY_GAUGE_CHARTS_LIBRARY)) { // register vislib gauge and goal charts visualizations.createBaseVisualization({ diff --git a/src/plugins/vis_types/vislib/public/vislib/VISLIB.md b/src/plugins/vis_types/vislib/public/vislib/VISLIB.md index 3e4641f319875..727bb4132ce88 100644 --- a/src/plugins/vis_types/vislib/public/vislib/VISLIB.md +++ b/src/plugins/vis_types/vislib/public/vislib/VISLIB.md @@ -1,6 +1,6 @@ # Charts supported -Vislib supports the gauge/goal charts from the aggregation-based visualizations. It also contains the legacy implemementation of the heatmap chart (enabled by the visualization:visualize:legacyHeatmapChartsLibrary advanced setting). +Vislib supports the gauge/goal charts from the aggregation-based visualizations. # General overview @@ -16,9 +16,4 @@ Each base vis type (`lib/types`) can have a different layout defined (`lib/layou All base visualizations extend from `visualizations/_chart` - ### Map - -### Point series chart - -`visualizations/point_series` takes care of drawing the point series chart (no axes or titles, just the chart itself). It creates all the series defined and calls render method on them. \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 1c432e420d2a3..9ffe8d85cecd8 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -8181,9 +8181,6 @@ "visTypeGauge.goal.groupTitle": "Diviser le groupe", "visTypeGauge.goal.metricTitle": "Indicateur", "visTypeGauge.splitTitle.tooltip": "l'agrégation de graphique divisé n’est pas encore compatible avec la nouvelle bibliothèque de graphiques. Veuillez activer le paramètre avancé de la bibliothèque de graphiques héritée pour les jauges afin d'utiliser l'agrégation de graphique divisé.", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.deprecation": "La bibliothèque de graphiques héritée pour les cartes thermiques dans Visualize est déclassée et ne sera plus prise en charge dans une future version.", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.description": "Active la bibliothèque de graphiques héritée pour les graphiques à carte thermique dans Visualize.", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.name": "Bibliothèque de graphiques héritée pour les cartes thermiques", "visTypeHeatmap.controls.heatmapOptions.colorLabel": "Couleur", "visTypeHeatmap.controls.heatmapOptions.colorScaleLabel": "Échelle de couleurs", "visTypeHeatmap.controls.heatmapOptions.colorsNumberLabel": "Nombre de couleurs", @@ -47375,4 +47372,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "Ce champ est requis.", "xpack.watcher.watcherDescription": "Détectez les modifications survenant dans vos données en créant, gérant et monitorant des alertes." } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 1293fddd55857..a83558fef4e63 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7935,9 +7935,6 @@ "visTypeGauge.goal.groupTitle": "グループを分割", "visTypeGauge.goal.metricTitle": "メトリック", "visTypeGauge.splitTitle.tooltip": "分割グラフアグリゲーションは、新しいグラフライブラリでまだサポートされていません。分割グラフアグリゲーションを使用するには、ゲージグラフのレガシーグラフライブラリと詳細設定を有効にしてください。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.deprecation": "Visualizeのヒートマップのレガシーグラフライブラリは廃止予定であり、将来のバージョンではサポートされません。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.description": "Visualizeでヒートマップのレガシーグラフライブラリを有効にします。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.name": "ヒートマップのレガシーグラフライブラリ", "visTypeHeatmap.controls.heatmapOptions.colorLabel": "色", "visTypeHeatmap.controls.heatmapOptions.colorScaleLabel": "カラースケール", "visTypeHeatmap.controls.heatmapOptions.colorsNumberLabel": "色の数", @@ -47111,4 +47108,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "フィールドを選択してください。", "xpack.watcher.watcherDescription": "アラートの作成、管理、監視によりデータへの変更を検知します。" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index c1df2f95c5384..229e8f870ec9b 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7951,9 +7951,6 @@ "visTypeGauge.goal.groupTitle": "拆分组", "visTypeGauge.goal.metricTitle": "指标", "visTypeGauge.splitTitle.tooltip": "新图表库尚不支持拆分图表聚合。请启用仪表盘旧版图表库高级设置以使用拆分图表聚合。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.deprecation": "Visualize 中热图的旧版图表库已过时,在未来版本中将不受支持。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.description": "在 Visualize 中启用热图图表的旧版图表库。", - "visTypeHeatmap.advancedSettings.visualization.legacyHeatmapChartsLibrary.name": "热图旧版图表库", "visTypeHeatmap.controls.heatmapOptions.colorLabel": "颜色", "visTypeHeatmap.controls.heatmapOptions.colorScaleLabel": "色阶", "visTypeHeatmap.controls.heatmapOptions.colorsNumberLabel": "颜色个数", @@ -47164,4 +47161,4 @@ "xpack.watcher.watchEdit.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage": "此字段必填。", "xpack.watcher.watcherDescription": "通过创建、管理和监测警报来检测数据中的更改。" } -} +} \ No newline at end of file From 8776b4c08a99fe9d158e0a59b9c38e33d94da259 Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 28 Oct 2024 16:08:10 +0100 Subject: [PATCH 3/6] wip --- .../fixtures/dispatch_heatmap_config.json | 82 ---------- .../public/fixtures/dispatch_heatmap_d3.json | 34 ---- .../fixtures/dispatch_heatmap_data_point.json | 13 -- src/plugins/vis_types/vislib/public/types.ts | 1 - .../dispatch_heatmap.test.js.snap | 153 ------------------ .../vislib/lib/dispatch_heatmap.test.js | 41 ----- .../vislib/public/vislib/lib/types/index.js | 2 - .../vislib/public/vislib/vis.test.js | 28 ++-- .../public/vislib/visualizations/vis_types.js | 2 - .../replaced_vislib_chart_types/_timelion.ts | 2 +- .../replaced_vislib_chart_types/index.ts | 1 - 11 files changed, 20 insertions(+), 339 deletions(-) delete mode 100644 src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json delete mode 100644 src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json delete mode 100644 src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json delete mode 100644 src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap delete mode 100644 src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js diff --git a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json deleted file mode 100644 index c940904a56c18..0000000000000 --- a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_config.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "data": { - }, - "_values": { - "addLegend": true, - "addTooltip": true, - "colorSchema": "Greens", - "colorsNumber": 4, - "colorsRange": [], - "type": "point_series", - "valueAxes": [ - { - "id": "ValueAxis-1", - "labels": { - "color": "black", - "overwriteColor": false, - "rotate": 0, - "show": false - }, - "scale": { - "defaultYExtents": false, - "type": "linear" - }, - "show": false, - "type": "value" - } - ], - "chartTitle": {}, - "mode": "normal", - "tooltip": { - "show": true - }, - "categoryAxes": [ - { - "id": "CategoryAxis-1", - "type": "category", - "labels": {}, - "scale": {}, - "title": { - "text": "products.category.keyword: Descending" - }, - "style": { - "rangePadding": 0, - "rangeOuterPadding": 0 - } - }, - { - "id": "CategoryAxis-2", - "type": "category", - "position": "left", - "values": [ - "Thursday", - "Friday", - "Tuesday", - "Wednesday", - "Saturday" - ], - "scale": { - "inverted": true - }, - "labels": { - "filter": false - }, - "style": { - "rangePadding": 0, - "rangeOuterPadding": 0 - }, - "title": { - "text": "" - } - } - ], - "charts": [ - { - "type": "point_series", - "series":[], - "width": 610, - "height": 124 - } - ] - } -} \ No newline at end of file diff --git a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json deleted file mode 100644 index 4d01d67975878..0000000000000 --- a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_d3.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "series": [ - { - "id": "1", - "rawId": "Thursday-col-2-1", - "label": "Thursday", - "values": [] - }, - { - "id": "1", - "rawId": "Friday-col-2-1", - "label": "Friday", - "values": [] - }, - { - "id": "1", - "rawId": "Tuesday-col-2-1", - "label": "Tuesday", - "values": [] - }, - { - "id": "1", - "rawId": "Wednesday-col-2-1", - "label": "Wednesday", - "values": [] - }, - { - "id": "1", - "rawId": "Saturday-col-2-1", - "label": "Saturday", - "values": [] - } - ] -} \ No newline at end of file diff --git a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json b/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json deleted file mode 100644 index a76475a534be4..0000000000000 --- a/src/plugins/vis_types/vislib/public/fixtures/dispatch_heatmap_data_point.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "x": "Men's Shoes", - "y": 43, - "extraMetrics": [], - "parent": { - "accessor": "col-0-2", - "column": 0, - "title": "day_of_week: Descending", - "params": {} - }, - "series": "Thursday", - "seriesId": "Thursday-col-2-1" -} \ No newline at end of file diff --git a/src/plugins/vis_types/vislib/public/types.ts b/src/plugins/vis_types/vislib/public/types.ts index 188d78d415e9e..db6b1c371cfef 100644 --- a/src/plugins/vis_types/vislib/public/types.ts +++ b/src/plugins/vis_types/vislib/public/types.ts @@ -38,7 +38,6 @@ export const GaugeType = Object.freeze({ export type GaugeType = $Values; export const VislibChartType = Object.freeze({ - Heatmap: 'heatmap' as const, Gauge: 'gauge' as const, Goal: 'goal' as const, Metric: 'metric' as const, diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap b/src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap deleted file mode 100644 index 98b5572221864..0000000000000 --- a/src/plugins/vis_types/vislib/public/vislib/lib/__snapshots__/dispatch_heatmap.test.js.snap +++ /dev/null @@ -1,153 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Vislib event responses dispatcher - for heatmap return valid data for a heatmap popover 1`] = ` -Object { - "color": undefined, - "config": Object { - "get": [Function], - }, - "data": Object { - "series": Array [ - Object { - "id": "1", - "label": "Thursday", - "rawId": "Thursday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Friday", - "rawId": "Friday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Tuesday", - "rawId": "Tuesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Wednesday", - "rawId": "Wednesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Saturday", - "rawId": "Saturday-col-2-1", - "values": Array [], - }, - ], - }, - "datum": Object { - "extraMetrics": Array [], - "parent": Object { - "accessor": "col-0-2", - "column": 0, - "params": Object {}, - "title": "day_of_week: Descending", - }, - "series": "Thursday", - "seriesId": "Thursday-col-2-1", - "x": "Men's Shoes", - "y": 43, - }, - "e": Object { - "target": Object { - "nearestViewportElement": Object { - "__data__": Object { - "series": Array [ - Object { - "id": "1", - "label": "Thursday", - "rawId": "Thursday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Friday", - "rawId": "Friday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Tuesday", - "rawId": "Tuesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Wednesday", - "rawId": "Wednesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Saturday", - "rawId": "Saturday-col-2-1", - "values": Array [], - }, - ], - }, - }, - }, - }, - "handler": Object { - "data": Object {}, - "visConfig": Object { - "get": [Function], - }, - }, - "isPercentageMode": false, - "label": "Thursday", - "point": Object { - "extraMetrics": Array [], - "parent": Object { - "accessor": "col-0-2", - "column": 0, - "params": Object {}, - "title": "day_of_week: Descending", - }, - "series": "Thursday", - "seriesId": "Thursday-col-2-1", - "x": "Men's Shoes", - "y": 43, - }, - "pointIndex": 0, - "series": Array [ - Object { - "id": "1", - "label": "Thursday", - "rawId": "Thursday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Friday", - "rawId": "Friday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Tuesday", - "rawId": "Tuesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Wednesday", - "rawId": "Wednesday-col-2-1", - "values": Array [], - }, - Object { - "id": "1", - "label": "Saturday", - "rawId": "Saturday-col-2-1", - "values": Array [], - }, - ], - "slices": undefined, - "value": 43, -} -`; diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js deleted file mode 100644 index 90eb0ca9fce78..0000000000000 --- a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch_heatmap.test.js +++ /dev/null @@ -1,41 +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 - * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side - * Public License v 1"; you may not use this file except in compliance with, at - * your election, the "Elastic License 2.0", the "GNU Affero General Public - * License v3.0 only", or the "Server Side Public License, v 1". - */ - -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('d3', () => ({ - event: { - target: { - nearestViewportElement: { - __data__: mockDispatchDataD3, - }, - }, - }, -})); - -function getHandlerMock(config = {}, data = {}) { - return { - visConfig: { get: (id, fallback) => config[id] || fallback }, - data, - }; -} - -describe('Vislib event responses dispatcher - for heatmap', () => { - test('return valid data for a heatmap popover', () => { - // this is mainly a test that isPercentageMode doesn't fail with other data than vertical barcharts - const dataPoint = mockdataPoint; - const handlerMock = getHandlerMock(mockConfigPercentage); - const dispatch = new Dispatch(handlerMock); - const actual = dispatch.eventResponse(dataPoint, 0); - expect(actual).toMatchSnapshot(); - }); -}); diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/types/index.js b/src/plugins/vis_types/vislib/public/vislib/lib/types/index.js index 89f03ef2f829b..be2eef79caa79 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/types/index.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/types/index.js @@ -7,11 +7,9 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { vislibPointSeriesTypes as pointSeries } from './point_series'; import { vislibGaugeConfig } from './gauge'; export const vislibTypesConfig = { - heatmap: pointSeries.heatmap, gauge: vislibGaugeConfig, goal: vislibGaugeConfig, metric: vislibGaugeConfig, diff --git a/src/plugins/vis_types/vislib/public/vislib/vis.test.js b/src/plugins/vis_types/vislib/public/vislib/vis.test.js index 0023c1b0254c8..f30ce3ea26fde 100644 --- a/src/plugins/vis_types/vislib/public/vislib/vis.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/vis.test.js @@ -48,17 +48,27 @@ dataArray.forEach(function (data, i) { beforeEach(() => { config = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; + vis = getVis(config); secondVis = getVis(config); mockUiState = getMockUiState(); @@ -144,7 +154,7 @@ dataArray.forEach(function (data, i) { test('should get attribute values', function () { expect(vis.get('addLegend')).toBe(true); expect(vis.get('addTooltip')).toBe(true); - expect(vis.get('type')).toBe('point_series'); + expect(vis.get('type')).toBe('gauge'); }); }); diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js index fe2904ee9d1ba..fa9a1f7c9df83 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.js @@ -7,11 +7,9 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import { PointSeries } from './point_series'; import { GaugeChart } from './gauge_chart'; export const visTypes = { - point_series: PointSeries, gauge: GaugeChart, goal: GaugeChart, metric: GaugeChart, diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_timelion.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_timelion.ts index 6c96c9095f2f0..5832609747aa5 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_timelion.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_timelion.ts @@ -34,7 +34,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { 'long_window_logstash', 'test_logstash_reader', ]); - await visualize.initTests(true); + await visualize.initTests(); await visualize.navigateToNewAggBasedVisualization(); await visualize.clickTimelion(); await timePicker.setDefaultAbsoluteRange(); diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/index.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/index.ts index c6bb66fdc93c7..c145b22db8117 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/index.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/index.ts @@ -46,6 +46,5 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) { loadTestFile(require.resolve('./_vertical_bar_chart_nontimeindex')); loadTestFile(require.resolve('./_timelion')); loadTestFile(require.resolve('../group3/_pie_chart')); - loadTestFile(require.resolve('../group2/_heatmap_chart')); }); } From c45c43e65e8afe99a77dd2589e5e809d06ad8c0a Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Tue, 29 Oct 2024 13:10:35 +0100 Subject: [PATCH 4/6] cleanup pie legacy --- .../apps/visualize/group3/_pie_chart.ts | 3 +- .../_vertical_bar_chart.ts | 2 +- .../page_objects/visualize_chart_page.ts | 51 ++---- .../services/visualizations/pie_chart.ts | 158 ++++++------------ 4 files changed, 71 insertions(+), 143 deletions(-) diff --git a/test/functional/apps/visualize/group3/_pie_chart.ts b/test/functional/apps/visualize/group3/_pie_chart.ts index f1939af16ed46..f8196709a2b46 100644 --- a/test/functional/apps/visualize/group3/_pie_chart.ts +++ b/test/functional/apps/visualize/group3/_pie_chart.ts @@ -69,7 +69,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should show 10 slices in pie chart', async function () { - await pieChart.expectPieSliceCount(10, isNewChartsLibraryEnabled); + await pieChart.expectPieSliceCount(10); }); it('should show correct data', async function () { @@ -314,7 +314,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ); await timePicker.setAbsoluteRange(emptyFromTime, emptyToTime); await visChart.waitForVisualization(); - await visChart.expectError(); }); }); describe('multi series slice', () => { diff --git a/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts b/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts index 3d0f25b7870a6..4718465534f7c 100644 --- a/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts +++ b/test/functional/apps/visualize/replaced_vislib_chart_types/_vertical_bar_chart.ts @@ -324,7 +324,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); it('should correctly filter by legend', async () => { - await visChart.filterLegend('200', true); + await visChart.filterLegend('200'); await visChart.waitForVisualization(); const legendEntries = await visChart.getLegendEntriesXYCharts(xyChartSelector); const expectedEntries = ['200']; diff --git a/test/functional/page_objects/visualize_chart_page.ts b/test/functional/page_objects/visualize_chart_page.ts index 9fe9afb32d869..31d33eca7da35 100644 --- a/test/functional/page_objects/visualize_chart_page.ts +++ b/test/functional/page_objects/visualize_chart_page.ts @@ -153,20 +153,17 @@ export class VisualizeChartPageObject extends FtrService { return values.sort((a, b) => a.x - b.x).map(({ y }) => y); } - private async toggleLegend(force = false) { - const isVisTypePieChart = await this.isNewLibraryChart(partitionVisChartSelector); - const legendSelector = force || isVisTypePieChart ? '.echLegend' : '.visLegend'; - + private async toggleLegend() { await this.retry.try(async () => { - const isVisible = await this.find.existsByCssSelector(legendSelector); + const isVisible = await this.find.existsByCssSelector('.echLegend'); if (!isVisible) { await this.testSubjects.click('vislibToggleLegend'); } }); } - public async filterLegend(name: string, force = false) { - await this.toggleLegend(force); + public async filterLegend(name: string) { + await this.toggleLegend(); await this.testSubjects.click(`legend-${name}`); // wait for a short amount of time for popover to stabilize as there is no good way to check for that await this.common.sleep(250); @@ -189,23 +186,13 @@ export class VisualizeChartPageObject extends FtrService { } public async doesSelectedLegendColorExistForPie(matchingColor: string) { - if (await this.isNewLibraryChart(partitionVisChartSelector)) { - const hexMatchingColor = chroma(matchingColor).hex().toUpperCase(); - const slices = - (await this.getEsChartDebugState(partitionVisChartSelector))?.partition?.[0]?.partitions ?? - []; - return slices.some(({ color }) => { - return hexMatchingColor === chroma(color).hex().toUpperCase(); - }); - } - - return await this.testSubjects.exists(`legendSelectedColor-${matchingColor}`); - } - - public async expectError() { - if (!this.isNewLibraryChart(partitionVisChartSelector)) { - await this.testSubjects.existOrFail('vislibVisualizeError'); - } + const hexMatchingColor = chroma(matchingColor).hex().toUpperCase(); + const slices = + (await this.getEsChartDebugState(partitionVisChartSelector))?.partition?.[0]?.partitions ?? + []; + return slices.some(({ color }) => { + return hexMatchingColor === chroma(color).hex().toUpperCase(); + }); } public async getVisualizationRenderingCount() { @@ -305,17 +292,11 @@ export class VisualizeChartPageObject extends FtrService { public async openLegendOptionColorsForPie(name: string, chartSelector: string) { await this.waitForVisualizationRenderingStabilized(); await this.retry.try(async () => { - if (await this.isNewLibraryChart(partitionVisChartSelector)) { - const chart = await this.find.byCssSelector(chartSelector); - const legendItemColor = await chart.findByCssSelector( - `[data-ech-series-name="${name}"] .echLegendItem__color` - ); - await legendItemColor.click(); - } else { - // This click has been flaky in opening the legend, hence the this.retry. See - // https://github.com/elastic/kibana/issues/17468 - await this.testSubjects.click(`legend-${name}`); - } + const chart = await this.find.byCssSelector(chartSelector); + const legendItemColor = await chart.findByCssSelector( + `[data-ech-series-name="${name}"] .echLegendItem__color` + ); + await legendItemColor.click(); await this.waitForVisualizationRenderingStabilized(); // arbitrary color chosen, any available would do diff --git a/test/functional/services/visualizations/pie_chart.ts b/test/functional/services/visualizations/pie_chart.ts index d5b1a636d2b2c..f58970b9218ff 100644 --- a/test/functional/services/visualizations/pie_chart.ts +++ b/test/functional/services/visualizations/pie_chart.ts @@ -8,7 +8,6 @@ */ import expect from '@kbn/expect'; -import { isNil } from 'lodash'; import { DebugState } from '@elastic/charts'; import { FtrService } from '../../ftr_provider_context'; @@ -30,36 +29,24 @@ export class PieChartService extends FtrService { async clickOnPieSlice(name?: string) { this.log.debug(`PieChart.clickOnPieSlice(${name})`); - if (await this.visChart.isNewLibraryChart(partitionVisChartSelector)) { - const slices = this.getSlices( - await this.visChart.getEsChartDebugState(partitionVisChartSelector) - ); - let sliceLabel = name || slices[0].name; - if (name === 'Other') { - sliceLabel = '__other__'; - } - const pieSlice = slices.find((slice) => String(slice.name) === sliceLabel); - const pie = await this.testSubjects.find(partitionVisChartSelector); - if (pieSlice) { - const pieSize = await pie.getSize(); - const pieHeight = pieSize.height; - const pieWidth = pieSize.width; - await pie.clickMouseButton({ - xOffset: pieSlice.coords[0] - Math.floor(pieWidth / 2), - yOffset: pieSlice.coords[1] - Math.floor(pieHeight / 2), - }); - } - } else { - if (name) { - await this.testSubjects.click(`pieSlice-${name.split(' ').join('-')}`); - } else { - // If no pie slice has been provided, find the first one available. - await this.retry.try(async () => { - const slices = await this.find.allByCssSelector('svg > g > g.arcs > path.slice'); - this.log.debug('Slices found:' + slices.length); - return slices[0].click(); - }); - } + + const slices = this.getSlices( + await this.visChart.getEsChartDebugState(partitionVisChartSelector) + ); + let sliceLabel = name || slices[0].name; + if (name === 'Other') { + sliceLabel = '__other__'; + } + const pieSlice = slices.find((slice) => String(slice.name) === sliceLabel); + const pie = await this.testSubjects.find(partitionVisChartSelector); + if (pieSlice) { + const pieSize = await pie.getSize(); + const pieHeight = pieSize.height; + const pieWidth = pieSize.width; + await pie.clickMouseButton({ + xOffset: pieSlice.coords[0] - Math.floor(pieWidth / 2), + yOffset: pieSlice.coords[1] - Math.floor(pieHeight / 2), + }); } } @@ -100,12 +87,8 @@ export class PieChartService extends FtrService { async getPieSliceStyle(name: string) { this.log.debug(`VisualizePage.getPieSliceStyle(${name})`); - if (await this.visChart.isNewLibraryChart(partitionVisChartSelector)) { - const selectedSlice = await this.getSelectedSlice(name); - return selectedSlice[0]?.color; - } - const pieSlice = await this.getPieSlice(name); - return await pieSlice.getAttribute('style'); + const selectedSlice = await this.getSelectedSlice(name); + return selectedSlice[0]?.color; } async getAllPieSlicesColors() { @@ -121,27 +104,8 @@ export class PieChartService extends FtrService { async getAllPieSliceColor(name: string) { this.log.debug(`VisualizePage.getAllPieSliceColor(${name})`); - if (await this.visChart.isNewLibraryChart(partitionVisChartSelector)) { - const selectedSlice = await this.getSelectedSlice(name); - return selectedSlice.map((slice) => slice.color); - } - const pieSlices = await this.getAllPieSlices(name); - const slicesStyles = await Promise.all( - pieSlices.map(async (pieSlice) => (await pieSlice.getAttribute('style')) ?? '') - ); - return slicesStyles - .map( - (styles) => - styles.split(';').reduce>((styleAsObj, style) => { - const stylePair = style.split(':'); - if (stylePair.length !== 2) { - return styleAsObj; - } - styleAsObj[stylePair[0].trim()] = stylePair[1].trim(); - return styleAsObj; - }, {}).fill // in vislib the color is available on the `fill` style prop - ) - .filter((d) => !isNil(d)); + const selectedSlice = await this.getSelectedSlice(name); + return selectedSlice.map((slice) => slice.color); } async getPieChartData() { @@ -155,57 +119,41 @@ export class PieChartService extends FtrService { await this.inspector.expectTableData(expectedTableData); } - async getPieChartLabels(isNewLibrary: boolean = true) { - if (isNewLibrary) { - const slices = this.getSlices( - await this.visChart.getEsChartDebugState(partitionVisChartSelector) - ); - return slices.map((slice) => { - if (slice.name === '__missing__') { - return 'Missing'; - } else if (slice.name === '__other__') { - return 'Other'; - } else if (typeof slice.name === 'number') { - // debugState of escharts returns the numbers without comma - const val = slice.name as number; - return val.toString().replace(/\B(? await chart.getAttribute('data-label')) + async getPieChartLabels() { + const slices = this.getSlices( + await this.visChart.getEsChartDebugState(partitionVisChartSelector) ); + return slices.map((slice) => { + if (slice.name === '__missing__') { + return 'Missing'; + } else if (slice.name === '__other__') { + return 'Other'; + } else if (typeof slice.name === 'number') { + // debugState of escharts returns the numbers without comma + const val = slice.name as number; + return val.toString().replace(/\B(? { - return slice.value; - }); - } - const chartTypes = await this.find.allByCssSelector('path.slice', this.defaultFindTimeout * 2); - return await Promise.all( - chartTypes.map(async (chart) => await chart.getAttribute('data-value')) + const slices = this.getSlices( + await this.visChart.getEsChartDebugState(partitionVisChartSelector) ); + return slices.map((slice) => { + return slice.value; + }); } - async getPieSliceCount(isNewLibrary: boolean = true) { + async getPieSliceCount() { this.log.debug('PieChart.getPieSliceCount'); - if (isNewLibrary) { - const slices = this.getSlices( - await this.visChart.getEsChartDebugState(partitionVisChartSelector) - ); - return slices?.length; - } - const slices = await this.find.allByCssSelector('svg > g > g.arcs > path.slice'); - return slices.length; + const slices = this.getSlices( + await this.visChart.getEsChartDebugState(partitionVisChartSelector) + ); + return slices?.length; } async getSliceCountForAllPies() { @@ -234,10 +182,10 @@ export class PieChartService extends FtrService { expect(slices.length).to.be(expectedCount); } - async expectPieSliceCount(expectedCount: number, isNewLibrary: boolean = true) { + async expectPieSliceCount(expectedCount: number) { this.log.debug(`PieChart.expectPieSliceCount(${expectedCount})`); await this.retry.try(async () => { - const slicesCount = await this.getPieSliceCount(isNewLibrary); + const slicesCount = await this.getPieSliceCount(); expect(slicesCount).to.be(expectedCount); }); } @@ -254,10 +202,10 @@ export class PieChartService extends FtrService { expect(noResult).to.be(true); } - async expectPieChartLabels(expectedLabels: string[], isNewLibrary: boolean = true) { + async expectPieChartLabels(expectedLabels: string[]) { this.log.debug(`PieChart.expectPieChartLabels(${expectedLabels.join(',')})`); await this.retry.try(async () => { - const pieData = await this.getPieChartLabels(isNewLibrary); + const pieData = await this.getPieChartLabels(); expect(pieData.sort()).to.eql(expectedLabels); }); } From 1a368d9ac50611f2fb3b3cff5c61297755da0477 Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Thu, 31 Oct 2024 09:16:49 +0100 Subject: [PATCH 5/6] test --- .../public/vislib/lib/chart_title.test.js | 2 +- .../vislib/public/vislib/lib/dispatch.test.js | 75 +++++++++++++------ .../vislib/public/vislib/lib/handler.test.js | 25 +++++-- .../public/vislib/lib/layout/layout.test.js | 27 ++++--- .../public/vislib/lib/vis_config.test.js | 4 +- .../vislib/visualizations/chart.test.js | 25 +++++-- .../vislib/visualizations/vis_types.test.js | 2 +- 7 files changed, 107 insertions(+), 53 deletions(-) diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js index d7eb66210028d..8cccf700dad54 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/chart_title.test.js @@ -100,7 +100,7 @@ describe('Vislib ChartTitle Class Test Suite', function () { const visConfig = new VisConfig( { - type: 'heatmap', + type: 'gauge', title: { text: 'rows', }, diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js index 92a75b2cf814c..2ac92863de952 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/dispatch.test.js @@ -55,16 +55,25 @@ describe('Vislib Dispatch Class Test Suite', function () { let mockUiState; const vislibParams = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; function generateVis(opts = {}) { @@ -99,16 +108,25 @@ describe('Vislib Dispatch Class Test Suite', function () { let mockUiState; const vislibParams = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; function generateVis(opts = {}) { @@ -205,16 +223,25 @@ describe('Vislib Dispatch Class Test Suite', function () { describe('Custom event handlers', function () { const vislibParams = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; const config = _.defaultsDeep({}, vislibParams); const vis = getVis(config); diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js index 2f8b837f154b8..d6399d5dcc409 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/handler.test.js @@ -44,16 +44,25 @@ dateHistogramArray.forEach(function (data, i) { beforeEach(() => { const vislibParams = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; const config = _.defaultsDeep({}, vislibParams); vis = getVis(config); diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js index 846e991d475c1..81fea571cba4d 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/layout/layout.test.js @@ -50,16 +50,25 @@ dateHistogramArray.forEach(function (data, i) { beforeEach(() => { const vislibParams = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; const config = _.defaultsDeep({}, vislibParams); vis = getVis(config); @@ -99,7 +108,7 @@ dateHistogramArray.forEach(function (data, i) { beforeEach(function () { const visConfig = new VisConfig( { - type: 'heatmap', + type: 'gauge', }, data, mockUiState, diff --git a/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js b/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js index aa3c4d546a781..14b1e8dde5f07 100644 --- a/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/lib/vis_config.test.js @@ -79,7 +79,7 @@ describe('Vislib VisConfig Class Test Suite', function () { visConfig = new VisConfig( { - type: 'heatmap', + type: 'gauge', }, data, getMockUiState(), @@ -99,7 +99,7 @@ describe('Vislib VisConfig Class Test Suite', function () { it('should get the property', function () { expect(visConfig.get('el')).toBe(el); - expect(visConfig.get('type')).toBe('point_series'); + expect(visConfig.get('type')).toBe('gauge'); }); it('should return defaults if property does not exist', function () { diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js index c393070e5c501..07f3a8c1afb89 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/chart.test.js @@ -108,16 +108,25 @@ describe('Vislib _chart Test Suite', function () { el = d3.select('body').append('div').attr('class', 'column-chart'); config = { - type: 'heatmap', + type: 'gauge', addLegend: true, addTooltip: true, - colorsNumber: 4, - colorSchema: 'Greens', - setColorRange: false, - percentageMode: true, - percentageFormatPattern: '0.0%', - invertColors: false, - colorsRange: [], + gauge: { + alignment: 'horizontal', + autoExtend: false, + percentageMode: false, + gaugeStyle: 'Full', + backStyle: 'Full', + orientation: 'vertical', + colorSchema: 'Greens', + colorsRange: [ + { from: 0, to: 1500 }, + { from: 1500, to: 2500 }, + { from: 2500, to: 3000 }, + ], + invertColors: false, + type: 'meter', + }, }; vis = getVis(config, el[0][0]); vis.render(data, getMockUiState()); diff --git a/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js index 052c16b692fbf..67f64cdc65f27 100644 --- a/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js +++ b/src/plugins/vis_types/vislib/public/vislib/visualizations/vis_types.test.js @@ -15,7 +15,7 @@ describe('Vislib Vis Types Test Suite', function () { let visFunc; beforeEach(function () { - visFunc = visTypes.point_series; + visFunc = visTypes.gauge; }); it('should be an object', function () { From 4bd496d5ec45c6a79501c3d0af88125646f7a17e Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Thu, 31 Oct 2024 10:06:40 +0100 Subject: [PATCH 6/6] remove check --- .../apps/visualize/group2/_gauge_chart.ts | 6 +- .../apps/visualize/group3/_pie_chart.ts | 61 +++++++++---------- .../apps/lens/open_in_lens/agg_based/pie.ts | 14 ++--- .../apps/lens/open_in_lens/agg_based/xy.ts | 36 ++++++----- 4 files changed, 56 insertions(+), 61 deletions(-) diff --git a/test/functional/apps/visualize/group2/_gauge_chart.ts b/test/functional/apps/visualize/group2/_gauge_chart.ts index 8ff6d31229081..a6942cd284e5d 100644 --- a/test/functional/apps/visualize/group2/_gauge_chart.ts +++ b/test/functional/apps/visualize/group2/_gauge_chart.ts @@ -62,7 +62,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await testSubjects.click('gaugePercentageMode'); await testSubjects.setValue('gaugePercentageModeFormatPattern', '0.0%'); await visChart.waitForVisualizationRenderingStabilized(); - await visEditor.clickGo(false); + await visEditor.clickGo(); await retry.try(async function tryingForTime() { const expectedTexts = ['57.3%', 'Average bytes']; @@ -82,7 +82,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.selectField('machine.os.raw'); log.debug('Size = 4'); await visEditor.setSize(4); - await visEditor.clickGo(false); + await visEditor.clickGo(); }); it('should show Split Gauges', async () => { @@ -118,7 +118,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.clickBucket('Metric', 'metrics'); await visEditor.selectAggregation('Min', 'metrics'); await visEditor.selectField('bytes', 'metrics'); - await visEditor.clickGo(false); + await visEditor.clickGo(); await retry.try(async function tryingForTime() { const metricValue = await visChart.getGaugeValue(); diff --git a/test/functional/apps/visualize/group3/_pie_chart.ts b/test/functional/apps/visualize/group3/_pie_chart.ts index f8196709a2b46..f7559c43a6f53 100644 --- a/test/functional/apps/visualize/group3/_pie_chart.ts +++ b/test/functional/apps/visualize/group3/_pie_chart.ts @@ -28,7 +28,6 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('pie chart', function () { // Used to track flag before and after reset - const isNewChartsLibraryEnabled = false; const vizName1 = 'Visualization PieChart'; before(async function () { await visualize.initTests(); @@ -50,7 +49,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { log.debug('setNumericInterval 4000'); await visEditor.setInterval('40000', { type: 'numeric' }); log.debug('clickGo'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); }); after(async () => { @@ -108,8 +107,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.toggleOtherBucket(2); await visEditor.toggleMissingBucket(2); log.debug('clickGo'); - await visEditor.clickGo(isNewChartsLibraryEnabled); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await visEditor.clickGo(true); + await pieChart.expectPieChartLabels(expectedTableData); }); it('should apply correct filter on other bucket', async () => { @@ -117,7 +116,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await pieChart.filterOnPieSlice('Other'); await visChart.waitForVisualization(); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); await filterBar.removeFilter('machine.os.raw'); await visChart.waitForVisualization(); }); @@ -127,7 +126,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visChart.filterLegend('Other'); await visChart.waitForVisualization(); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); await filterBar.removeFilter('machine.os.raw'); await visChart.waitForVisualization(); }); @@ -186,8 +185,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.toggleOtherBucket(3); await visEditor.toggleMissingBucket(3); log.debug('clickGo'); - await visEditor.clickGo(isNewChartsLibraryEnabled); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await visEditor.clickGo(true); + await pieChart.expectPieChartLabels(expectedTableData); }); }); @@ -204,9 +203,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); await visEditor.toggleDisabledAgg(2); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); }); it('should correctly save disabled agg', async () => { @@ -216,12 +215,12 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visChart.waitForRenderingCount(); const expectedTableData = ['ios', 'osx', 'win 7', 'win 8', 'win xp']; - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); }); it('should show correct result when agg is re-enabled', async () => { await visEditor.toggleDisabledAgg(2); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); const expectedTableData = [ '0', @@ -286,7 +285,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { 'osx', ].sort(); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); }); }); @@ -306,7 +305,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.addNewFilterAggregation(); log.debug('Set the 2nd filter value'); await visEditor.setFilterAggregationValue('geo.dest:"CN"', 1); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); const emptyFromTime = 'Sep 19, 2016 @ 06:31:44.000'; const emptyToTime = 'Sep 23, 2016 @ 18:31:44.000'; log.debug( @@ -339,7 +338,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.clickBucket('Split slices'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('geo.dest'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); }); it('should show correct chart', async () => { @@ -396,7 +395,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ['360,000', '47', 'BR', '2'], ].map((row) => // the count of records is not shown for every split level in the new charting library - isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row + [row[0], ...row.slice(2)] ); await inspector.open(); @@ -428,23 +427,23 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { '360,000', 'CN', ].sort(); - if (isNewChartsLibraryEnabled) { - await visEditor.clickOptionsTab(); - await visEditor.togglePieLegend(); - await visEditor.togglePieNestedLegend(); - await visEditor.clickDataTab(); - await visEditor.clickGo(isNewChartsLibraryEnabled); - } + + await visEditor.clickOptionsTab(); + await visEditor.togglePieLegend(); + await visEditor.togglePieNestedLegend(); + await visEditor.clickDataTab(); + await visEditor.clickGo(true); + await visChart.filterLegend('CN'); await visChart.waitForVisualization(); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); await filterBar.removeFilter('geo.dest'); await visChart.waitForVisualization(); }); - it('should still showing pie chart when a subseries have zero data', async function () { - if (isNewChartsLibraryEnabled) { - // TODO: it seems that adding a filter agg which has no results to a pie chart breaks it and instead it shows "no data" + // TODO: it seems that adding a filter agg which has no results to a pie chart breaks it and instead it shows "no data" + it.skip('should still showing pie chart when a subseries have zero data', async function () { + if (/* isNewChartsLibraryEnabled*/ true) { return; } @@ -466,7 +465,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.selectAggregation('Filters'); log.debug('Set the 1st filter value of the aggregation id 3'); await visEditor.setFilterAggregationValue('geo.dest:"UX"', 0, 3); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); const legends = await visChart.getLegendEntries(); const expectedLegends = ['geo.dest:"US"', 'geo.dest:"UX"']; expect(legends).to.eql(expectedLegends); @@ -487,7 +486,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await visEditor.clickBucket('Split slices'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('geo.src'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); }); it('shows correct split chart', async () => { @@ -519,7 +518,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ['osx', '1,322', 'BR', '30'], ].map((row) => // the count of records is not shown for every split level in the new charting library - isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row + [row[0], ...row.slice(2)] ); await inspector.open(); await inspector.setTablePageSize(50); @@ -536,7 +535,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ['osx', '228', 'CN', '228'], ].map((row) => // the count of records is not shown for every split level in the new charting library - isNewChartsLibraryEnabled ? [row[0], ...row.slice(2)] : row + [row[0], ...row.slice(2)] ); await visChart.filterLegend('CN'); await header.waitUntilLoadingHasFinished(); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts index d4b3407676ae7..6e1534ad6e6c9 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/pie.ts @@ -21,17 +21,15 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); describe('Pie', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { await visualize.initTests(); + await timePicker.setDefaultAbsoluteRangeViaUiSettings(); }); beforeEach(async () => { await visualize.navigateToNewAggBasedVisualization(); await visualize.clickPieChart(); await visualize.clickNewSearch(); - await timePicker.setDefaultAbsoluteRange(); }); it('should hide the "Edit Visualization in Lens" menu item if no split slices were defined', async () => { @@ -60,7 +58,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); await header.waitUntilLoadingHasFinished(); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); expect(await visualize.hasNavigateToLensButton()).to.eql(true); }); @@ -94,7 +92,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickBucket('Split slices'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -108,7 +106,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { expect(sliceByText).to.be('machine.os.raw: Descending'); expect(sizeByText).to.be('Count'); - await pieChart.expectPieChartLabels(expectedTableData, isNewChartsLibraryEnabled); + await pieChart.expectPieChartLabels(expectedTableData); }); it('should convert types correctly', async () => { @@ -116,7 +114,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -133,7 +131,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickOptionsTab(); const isDonutButton = await testSubjects.find('visTypePieIsDonut'); await isDonutButton.click(); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); diff --git a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts index ced90182a64e1..a024a1b294298 100644 --- a/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts +++ b/x-pack/test/functional/apps/lens/open_in_lens/agg_based/xy.ts @@ -22,8 +22,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { const retry = getService('retry'); describe('XY', function describeIndexTests() { - const isNewChartsLibraryEnabled = true; - before(async () => { await visualize.initTests(); }); @@ -43,7 +41,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickBucket('Dot size', 'metrics'); await visEditor.selectAggregation('Max', 'metrics'); await visEditor.selectField('memory', 'metrics'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); expect(await visualize.hasNavigateToLensButton()).to.eql(false); }); @@ -52,7 +50,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickBucket('Split chart'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); expect(await visualize.hasNavigateToLensButton()).to.eql(false); }); @@ -69,7 +67,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectYAxisPosition('ValueAxis-1', 'left'); await visEditor.clickYAxisOptions('ValueAxis-2'); await visEditor.selectYAxisPosition('ValueAxis-2', 'left'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); expect(await visualize.hasNavigateToLensButton()).to.eql(false); }); @@ -80,7 +78,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectField('machine.os.raw'); await visEditor.clickBucket('Split series'); await visEditor.selectAggregation('Date histogram', 'buckets', false, 1); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); expect(await visualize.hasNavigateToLensButton()).to.eql(false); }); @@ -91,7 +89,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickBucket('Split series'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); expect(await visualize.hasNavigateToLensButton()).to.eql(false); }); @@ -101,7 +99,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectAggregation('Serial diff', 'metrics'); await visEditor.clickBucket('Split series'); await visEditor.selectAggregation('Date histogram'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); const button = await testSubjects.exists('visualizeEditInLensButton'); expect(button).to.eql(false); @@ -116,7 +114,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.setSeriesType(0, 'area'); await visEditor.toggleAccordion('visEditorSeriesAccordion2'); await visEditor.setSeriesType(1, 'histogram'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); await lens.waitForVisualization('xyVisChart'); @@ -143,7 +141,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.setSeriesType(0, 'histogram'); await visEditor.toggleAccordion('visEditorSeriesAccordion2'); await visEditor.setSeriesType(1, 'histogram'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); await lens.waitForVisualization('xyVisChart'); @@ -165,7 +163,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectAggregation('Cumulative sum', 'metrics'); await visEditor.clickBucket('Split series'); await visEditor.selectAggregation('Date histogram'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); await lens.waitForVisualization('xyVisChart'); @@ -182,7 +180,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('should convert sibling pipeline aggregation', async () => { await visEditor.clickMetricEditor(); await visEditor.selectAggregation('Max Bucket', 'metrics'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -204,7 +202,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { it('should draw a reference line', async () => { await visEditor.clickOptionsTab(); await visEditor.toggleShowThresholdLine(); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); const line = await visChart.getReferenceLine('xyVisChart'); expect(line?.length).to.be(1); await header.waitUntilLoadingHasFinished(); @@ -229,7 +227,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.toggleAccordion('visEditorSeriesAccordion1'); await visEditor.setSeriesType(0, 'line'); await visEditor.selectChartMode('stacked'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -249,7 +247,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectChartMode('normal'); await visEditor.clickYAxisOptions('ValueAxis-1'); await visEditor.selectYAxisMode('percentage'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -268,7 +266,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.setSeriesType(0, 'histogram'); await visEditor.clickYAxisOptions('ValueAxis-1'); await visEditor.selectYAxisPosition('ValueAxis-1', 'top'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -294,7 +292,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectYAxisPosition('ValueAxis-1', 'left'); await visEditor.clickYAxisOptions('ValueAxis-2'); await visEditor.selectYAxisPosition('ValueAxis-2', 'right'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); await visualize.navigateToLensFromAnotherVisualization(); @@ -322,7 +320,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); await header.waitUntilLoadingHasFinished(); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); const expectedData = await visChart.getLegendEntriesXYCharts('xyVisChart'); await visualize.navigateToLensFromAnotherVisualization(); @@ -344,7 +342,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await visEditor.clickBucket('X-axis'); await visEditor.selectAggregation('Terms'); await visEditor.selectField('machine.os.raw'); - await visEditor.clickGo(isNewChartsLibraryEnabled); + await visEditor.clickGo(true); await header.waitUntilLoadingHasFinished(); const expectedData = await visChart.getLegendEntriesXYCharts('xyVisChart'); await visualize.navigateToLensFromAnotherVisualization();