diff --git a/.buildkite/ftr_configs.yml b/.buildkite/ftr_configs.yml index bbdf1f61aad69..cb24ba6fd47ba 100644 --- a/.buildkite/ftr_configs.yml +++ b/.buildkite/ftr_configs.yml @@ -235,6 +235,7 @@ enabled: - x-pack/test/detection_engine_api_integration/security_and_spaces/bundled_prebuilt_rules_package/config.ts - x-pack/test/detection_engine_api_integration/security_and_spaces/large_prebuilt_rules_package/config.ts - x-pack/test/detection_engine_api_integration/security_and_spaces/update_prebuilt_rules_package/config.ts + - x-pack/test/disable_ems/config.ts - x-pack/test/encrypted_saved_objects_api_integration/config.ts - x-pack/test/examples/config.ts - x-pack/test/fleet_api_integration/config.agent.ts diff --git a/x-pack/plugins/maps/common/constants.ts b/x-pack/plugins/maps/common/constants.ts index 5adb8c9bafd55..06c84a7d06267 100644 --- a/x-pack/plugins/maps/common/constants.ts +++ b/x-pack/plugins/maps/common/constants.ts @@ -23,10 +23,10 @@ export const INITIAL_LAYERS_KEY = 'initialLayers'; export const MAPS_APP_PATH = `app/${APP_ID}`; export const MAP_PATH = 'map'; -export const GIS_INTERNAL_PATH = `internal/${APP_ID}`; -export const INDEX_SETTINGS_API_PATH = `${GIS_INTERNAL_PATH}/indexSettings`; -export const FONTS_API_PATH = `${GIS_INTERNAL_PATH}/fonts`; -export const INDEX_SOURCE_API_PATH = `${GIS_INTERNAL_PATH}/docSource`; +const GIS_INTERNAL_PATH = `internal/${APP_ID}`; +export const INDEX_SETTINGS_API_PATH = `/${GIS_INTERNAL_PATH}/indexSettings`; +export const FONTS_API_PATH = `/${GIS_INTERNAL_PATH}/fonts`; +export const INDEX_SOURCE_API_PATH = `/${GIS_INTERNAL_PATH}/docSource`; export const INDEX_FEATURE_PATH = `/${GIS_INTERNAL_PATH}/feature`; export const GET_MATCHING_INDEXES_PATH = `/${GIS_INTERNAL_PATH}/getMatchingIndexes`; export const CHECK_IS_DRAWING_INDEX = `/${GIS_INTERNAL_PATH}/checkIsDrawingIndex`; diff --git a/x-pack/plugins/maps/public/classes/layers/wizards/new_vector_layer_wizard/create_new_index_pattern.ts b/x-pack/plugins/maps/public/classes/layers/wizards/new_vector_layer_wizard/create_new_index_pattern.ts index 90e0bceec7ef6..f640380932839 100644 --- a/x-pack/plugins/maps/public/classes/layers/wizards/new_vector_layer_wizard/create_new_index_pattern.ts +++ b/x-pack/plugins/maps/public/classes/layers/wizards/new_vector_layer_wizard/create_new_index_pattern.ts @@ -17,7 +17,7 @@ export const createNewIndexAndPattern = async ({ defaultMappings: IndexSourceMappings | {}; }) => { return await getHttp().fetch({ - path: `/${INDEX_SOURCE_API_PATH}`, + path: INDEX_SOURCE_API_PATH, method: 'POST', version: '1', body: JSON.stringify({ diff --git a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/load_index_settings.ts b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/load_index_settings.ts index f9d68053246d1..43fe9f06dd116 100644 --- a/x-pack/plugins/maps/public/classes/sources/es_search_source/util/load_index_settings.ts +++ b/x-pack/plugins/maps/public/classes/sources/es_search_source/util/load_index_settings.ts @@ -35,7 +35,7 @@ async function fetchIndexSettings(indexPatternTitle: string): Promise; +export { services, pageObjects }; diff --git a/x-pack/test/disable_ems/kbn_archive.json b/x-pack/test/disable_ems/kbn_archive.json new file mode 100644 index 0000000000000..d272371b4be77 --- /dev/null +++ b/x-pack/test/disable_ems/kbn_archive.json @@ -0,0 +1,50 @@ +{ + "attributes": { + "fieldAttrs":"{}", + "fieldFormatMap":"{}", + "fields":"[]", + "name":"logstash-*", + "runtimeFieldMap":"{}", + "sourceFilters":"[]", + "timeFieldName":"@timestamp", + "title":"logstash-*", + "typeMeta":"{}" + }, + "coreMigrationVersion":"8.8.0", + "created_at":"2023-09-07T14:49:04.891Z", + "id":"fd405dbb-002b-4caa-aae1-0893e5ffb75b", + "managed":false, + "references":[], + "type":"index-pattern", + "typeMigrationVersion":"8.0.0", + "updated_at":"2023-09-07T14:49:04.891Z", + "version":"WzEwLDFd" +} + +{ + "id": "ee65a3b0-4d8d-11ee-a8ed-97fb2d02a957", + "type": "map", + "namespaces": [ + "default" + ], + "updated_at": "2023-09-07T14:50:48.043Z", + "created_at": "2023-09-07T14:50:48.043Z", + "version": "WzE1LDFd", + "attributes": { + "title": "mvt documents with labels", + "description": "", + "layerListJSON": "[{\"sourceDescriptor\":{\"geoField\":\"geo.coordinates\",\"scalingType\":\"MVT\",\"id\":\"57798aca-8a4e-4c35-9225-e8d4133ae8a7\",\"type\":\"ES_SEARCH\",\"applyGlobalQuery\":true,\"applyGlobalTime\":true,\"applyForceRefresh\":true,\"filterByMapBounds\":true,\"tooltipProperties\":[],\"sortField\":\"\",\"sortOrder\":\"desc\",\"topHitsGroupByTimeseries\":false,\"topHitsSplitField\":\"\",\"topHitsSize\":1,\"indexPatternRefName\":\"layer_0_source_index_pattern\"},\"id\":\"00c8d672-dc32-42cc-9e11-1c43d3e9a3be\",\"label\":null,\"minZoom\":0,\"maxZoom\":24,\"alpha\":0.75,\"visible\":true,\"style\":{\"type\":\"VECTOR\",\"properties\":{\"icon\":{\"type\":\"STATIC\",\"options\":{\"value\":\"marker\"}},\"fillColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#54B399\"}},\"lineColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#41937c\"}},\"lineWidth\":{\"type\":\"STATIC\",\"options\":{\"size\":0}},\"iconSize\":{\"type\":\"STATIC\",\"options\":{\"size\":6}},\"iconOrientation\":{\"type\":\"STATIC\",\"options\":{\"orientation\":0}},\"labelText\":{\"type\":\"DYNAMIC\",\"options\":{\"field\":{\"label\":\"bytes\",\"name\":\"bytes\",\"origin\":\"source\",\"type\":\"number\",\"supportsAutoDomain\":true,\"isUnsupported\":false}}},\"labelColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#000000\"}},\"labelSize\":{\"type\":\"STATIC\",\"options\":{\"size\":14}},\"labelZoomRange\":{\"options\":{\"useLayerZoomRange\":true,\"minZoom\":0,\"maxZoom\":24}},\"labelBorderColor\":{\"type\":\"STATIC\",\"options\":{\"color\":\"#FFFFFF\"}},\"symbolizeAs\":{\"options\":{\"value\":\"circle\"}},\"labelBorderSize\":{\"options\":{\"size\":\"SMALL\"}},\"labelPosition\":{\"options\":{\"position\":\"CENTER\"}}},\"isTimeAware\":true},\"includeInFitToBounds\":true,\"type\":\"MVT_VECTOR\",\"joins\":[],\"disableTooltips\":false}]", + "mapStateJSON": "{\"adHocDataViews\":[],\"zoom\":2.19,\"center\":{\"lon\":-116.75537,\"lat\":55.05932},\"timeFilters\":{\"from\":\"2015-09-19T21:21:45.309Z\",\"to\":\"2015-09-23T01:33:44.867Z\"},\"refreshConfig\":{\"isPaused\":true,\"interval\":60000},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[],\"settings\":{\"autoFitToDataBounds\":false,\"backgroundColor\":\"#ffffff\",\"customIcons\":[],\"disableInteractive\":false,\"disableTooltipControl\":false,\"hideToolbarOverlay\":false,\"hideLayerControl\":false,\"hideViewControl\":false,\"initialLocation\":\"LAST_SAVED_LOCATION\",\"fixedLocation\":{\"lat\":0,\"lon\":0,\"zoom\":2},\"browserLocation\":{\"zoom\":2},\"keydownScrollZoom\":false,\"maxZoom\":24,\"minZoom\":0,\"showScaleControl\":false,\"showSpatialFilters\":true,\"showTimesliderToggleButton\":true,\"spatialFiltersAlpa\":0.3,\"spatialFiltersFillColor\":\"#DA8B45\",\"spatialFiltersLineColor\":\"#DA8B45\"}}", + "uiStateJSON": "{\"isLayerTOCOpen\":true,\"openTOCDetails\":[\"00c8d672-dc32-42cc-9e11-1c43d3e9a3be\"]}" + }, + "references": [ + { + "name": "layer_0_source_index_pattern", + "type": "index-pattern", + "id": "fd405dbb-002b-4caa-aae1-0893e5ffb75b" + } + ], + "managed": false, + "coreMigrationVersion": "8.8.0", + "typeMigrationVersion": "8.4.0" +} \ No newline at end of file diff --git a/x-pack/test/disable_ems/tests/fonts.ts b/x-pack/test/disable_ems/tests/fonts.ts new file mode 100644 index 0000000000000..aec0b0a6d6802 --- /dev/null +++ b/x-pack/test/disable_ems/tests/fonts.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import expect from '@kbn/expect'; + +export default function ({ getService, getPageObjects }: FtrProviderContext) { + const PageObjects = getPageObjects(['maps']); + const security = getService('security'); + + describe('Fonts', function () { + before(async () => { + await security.testUser.setRoles(['test_logstash_reader', 'global_maps_all']); + await PageObjects.maps.loadSavedMap('mvt documents with labels'); + }); + + after(async () => { + await security.testUser.restoreDefaults(); + }); + + it('should load map with labels', async () => { + const doesLayerExist = await PageObjects.maps.doesLayerExist('logstash-*'); + expect(doesLayerExist).to.equal(true); + const tooltipText = await PageObjects.maps.getLayerTocTooltipMsg('logstash-*'); + expect(tooltipText).to.equal( + 'logstash-*\nFound 14,000 documents.\nResults narrowed by global time' + ); + }); + }); +} diff --git a/x-pack/test/disable_ems/tests/index.ts b/x-pack/test/disable_ems/tests/index.ts new file mode 100644 index 0000000000000..f4a87f7b99da9 --- /dev/null +++ b/x-pack/test/disable_ems/tests/index.ts @@ -0,0 +1,29 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import type { FtrProviderContext } from '../ftr_provider_context'; + +export default function ({ loadTestFile, getService }: FtrProviderContext) { + const kibanaServer = getService('kibanaServer'); + const esArchiver = getService('esArchiver'); + const browser = getService('browser'); + + describe('disable Elastic Maps Service', () => { + before(async () => { + await esArchiver.loadIfNeeded('x-pack/test/functional/es_archives/logstash_functional'); + await kibanaServer.importExport.load('x-pack/test/disable_ems/kbn_archive.json'); + await browser.setWindowSize(1600, 1000); + }); + + after(async () => { + await esArchiver.unload('x-pack/test/functional/es_archives/maps/data'); + await kibanaServer.importExport.unload('x-pack/test/disable_ems/kbn_archive.json'); + }); + + loadTestFile(require.resolve('./fonts')); + }); +}