-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add maps saved object for sample datasets (#240)
* Add Default Saved object for Maps Signed-off-by: Naveen Tatikonda <[email protected]> * Consume config and output result Signed-off-by: Kawika Avilla <[email protected]> * Refactor the code Signed-off-by: Naveen Tatikonda <[email protected]> * Address Review Comments Signed-off-by: Naveen Tatikonda <[email protected]> --------- Signed-off-by: Naveen Tatikonda <[email protected]> Signed-off-by: Kawika Avilla <[email protected]> Co-authored-by: Kawika Avilla <[email protected]> (cherry picked from commit 816ce79)
- Loading branch information
1 parent
0e87a44
commit e4ed7a0
Showing
5 changed files
with
152 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { BASE_PATH } from '../utils/constants'; | ||
|
||
describe('Add flights dataset saved object', () => { | ||
before(() => { | ||
cy.visit(`${BASE_PATH}/app/maps-dashboards`, { | ||
retryOnStatusCodeFailure: true, | ||
timeout: 60000, | ||
}); | ||
cy.get('div[data-test-subj="indexPatternEmptyState"]', { timeout: 60000 }) | ||
.contains(/Add sample data/) | ||
.click(); | ||
cy.get('div[data-test-subj="sampleDataSetCardflights"]', { timeout: 60000 }) | ||
.contains(/Add data/) | ||
.click(); | ||
cy.wait(60000); | ||
}); | ||
|
||
after(() => { | ||
cy.visit(`${BASE_PATH}/app/home#/tutorial_directory`); | ||
cy.get('button[data-test-subj="removeSampleDataSetflights"]').should('be.visible').click(); | ||
}); | ||
|
||
it('check if maps saved object of flights dataset can be found and open', () => { | ||
cy.visit(`${BASE_PATH}/app/maps-dashboards`); | ||
cy.contains('[Flights] Maps Cancelled Flights Destination Location').click(); | ||
cy.get('[data-test-subj="layerControlPanel"]').should('contain', 'Cancelled flights'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { i18n } from '@osd/i18n'; | ||
import { ConfigSchema } from '../../../common/config'; | ||
|
||
const layerList = (config: ConfigSchema) => [ | ||
{ | ||
name: 'Default map', | ||
description: '', | ||
type: 'opensearch_vector_tile_map', | ||
id: 'cad56fcc-be02-43ea-a1a6-1d17f437acf7', | ||
zoomRange: [0, 22], | ||
opacity: 100, | ||
visibility: 'visible', | ||
source: { | ||
dataURL: config.opensearchVectorTileDataUrl, | ||
}, | ||
style: { | ||
styleURL: config.opensearchVectorTileStyleUrl, | ||
}, | ||
}, | ||
{ | ||
name: 'Cancelled flights', | ||
description: 'Shows cancelled flights', | ||
type: 'documents', | ||
id: 'f3ae28ce-2494-4e50-ae31-4603cfcbfd7d', | ||
zoomRange: [2, 22], | ||
opacity: 70, | ||
visibility: 'visible', | ||
source: { | ||
indexPatternRefName: 'opensearch_dashboards_sample_data_flights', | ||
geoFieldType: 'geo_point', | ||
geoFieldName: 'DestLocation', | ||
documentRequestNumber: 1000, | ||
tooltipFields: ['Carrier', 'Cancelled'], | ||
showTooltips: true, | ||
indexPatternId: 'd3d7af60-4c81-11e8-b3d7-01146121b73d', | ||
useGeoBoundingBoxFilter: true, | ||
filters: [ | ||
{ | ||
meta: { | ||
index: 'd3d7af60-4c81-11e8-b3d7-01146121b73d', | ||
alias: null, | ||
negate: false, | ||
disabled: false, | ||
}, | ||
query: { | ||
match_phrase: { | ||
Cancelled: true, | ||
}, | ||
}, | ||
$state: { | ||
store: 'appState', | ||
}, | ||
}, | ||
], | ||
}, | ||
style: { | ||
fillColor: '#CA8EAE', | ||
borderColor: '#CA8EAE', | ||
borderThickness: 1, | ||
markerSize: 5, | ||
}, | ||
}, | ||
]; | ||
|
||
export const getFlightsSavedObjects = (config: ConfigSchema) => { | ||
return [ | ||
{ | ||
id: '122713b0-9e70-11ed-9463-35a6f30dbef6', | ||
type: 'map', | ||
updated_at: '2023-01-27T18:26:09.643Z', | ||
version: 'WzIzLDFd', | ||
migrationVersion: {}, | ||
attributes: { | ||
title: i18n.translate('home.sampleData.flightsSpec.mapsCancelledFlights', { | ||
defaultMessage: '[Flights] Maps Cancelled Flights Destination Location', | ||
}), | ||
description: 'Sample map to show cancelled flights location at destination', | ||
layerList: JSON.stringify(layerList(config)), | ||
mapState: | ||
'{"timeRange":{"from":"now-15d","to":"now"},"query":{"query":"","language":"kuery"},"refreshInterval":{"pause":true,"value":12000}}', | ||
}, | ||
references: [], | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters