diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 3ad6e833..f28413f3 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -13,10 +13,53 @@ on: env: OPENSEARCH_DASHBOARDS_BRANCH: 'main' jobs: - tests: + Get-CI-Image-Tag: + uses: opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main + with: + product: opensearch-dashboards + + tests-linux: + needs: Get-CI-Image-Tag + name: Run unit tests + runs-on: ubuntu-latest + container: + # using the same image which is used by opensearch-build team to build the OpenSearch Distribution + # this image tag is subject to change as more dependencies and updates will arrive over time + image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }} + # need to switch to root so that github actions can install runner binary on container without permission issues. + options: --user root + + steps: + - name: Checkout Plugin + uses: actions/checkout@v3 + with: + path: dashboards-maps + + - name: Checkout OpenSearch Dashboards + uses: actions/checkout@v3 + with: + repository: opensearch-project/OpenSearch-Dashboards + ref: ${{ env.OPENSEARCH_DASHBOARDS_BRANCH }} + path: OpenSearch-Dashboards + + - name: Move plugin to OpenSearch-Dashboard Plugins Directory + run: mv dashboards-maps OpenSearch-Dashboards/plugins/dashboards-maps + + - name: Bootstrap plugin + run: | + chown -R 1000:1000 `pwd` + cd ./OpenSearch-Dashboards/ + su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && + cd ./plugins/dashboards-maps && + whoami && yarn osd bootstrap && yarn run test:jest --coverage" + + - name: Uploads coverage + uses: codecov/codecov-action@v1 + + tests-windows-macos: strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ windows-latest, macos-latest ] name: Run unit tests runs-on: ${{ matrix.os }} @@ -70,5 +113,3 @@ jobs: - name: Uploads coverage uses: codecov/codecov-action@v1 - - diff --git a/.gitignore b/.gitignore index 4be21c66..5100fe85 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ cypress/videos/ cypress/screenshots/ yarn-error.log .DS_Store +.idea diff --git a/CHANGELOG.md b/CHANGELOG.md index 513d14ca..8cc6c097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,20 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Maintenance ### Refactoring -## [Unreleased 2.x](https://github.com/opensearch-project/dashboards-maps/compare/2.9...2.x) +## [Unreleased 2.x](https://github.com/opensearch-project/dashboards-maps/compare/2.11...2.x) ### Features -* Allow filtering geo_shape fields around map extent ([#452](https://github.com/opensearch-project/dashboards-maps/pull/452)) -* Support dark mode in maps-dashboards([#455](https://github.com/opensearch-project/dashboards-maps/pull/455)) - ### Enhancements - ### Bug Fixes - +* Fixed maps tooltip display at dark mode[#564](https://github.com/opensearch-project/dashboards-maps/pull/564) ### Infrastructure - ### Documentation - ### Maintenance -* Bump cypress version to ^13.1.0 ([#462](https://github.com/opensearch-project/dashboards-maps/pull/462)) - ### Refactoring diff --git a/public/components/tooltip/create_tooltip.scss b/public/components/tooltip/create_tooltip.scss new file mode 100644 index 00000000..add0ef11 --- /dev/null +++ b/public/components/tooltip/create_tooltip.scss @@ -0,0 +1,35 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +.mapTooltip { + div.maplibregl-popup-content.mapboxgl-popup-content { + padding: 0; + background: none; + } +} + +.maplibregl-popup-anchor-top { + .maplibregl-popup-tip { + border-bottom-color:lightOrDarkTheme($ouiColorEmptyShade, $ouiColorLightestShade) !important; + } +} + +.maplibregl-popup-anchor-bottom { + .maplibregl-popup-tip { + border-top-color:lightOrDarkTheme($ouiColorEmptyShade, $ouiColorLightestShade) !important; + } +} + +.maplibregl-popup-anchor-left { + .maplibregl-popup-tip { + border-right-color:lightOrDarkTheme($ouiColorEmptyShade, $ouiColorLightestShade) !important; + } +} + +.maplibregl-popup-anchor-right { + .maplibregl-popup-tip { + border-left-color:lightOrDarkTheme($ouiColorEmptyShade, $ouiColorLightestShade) !important; + } +} diff --git a/public/components/tooltip/create_tooltip.tsx b/public/components/tooltip/create_tooltip.tsx index 4e378aa4..93e394e7 100644 --- a/public/components/tooltip/create_tooltip.tsx +++ b/public/components/tooltip/create_tooltip.tsx @@ -5,6 +5,7 @@ import { Popup, MapGeoJSONFeature, LngLat } from 'maplibre-gl'; import { MapLayerSpecification, DocumentLayerSpecification } from '../../model/mapLayerType'; import { FeatureGroupItem, TooltipContainer } from './tooltipContainer'; import { MAX_LONGITUDE } from '../../../common'; +import './create_tooltip.scss'; interface Options { features: MapGeoJSONFeature[]; @@ -76,6 +77,7 @@ export function createPopup({ closeButton: false, closeOnClick: false, maxWidth: 'max-content', + className: 'mapTooltip', }); const featureGroup = groupFeaturesByLayers(features, layers); diff --git a/public/components/tooltip/tooltipTable.tsx b/public/components/tooltip/tooltipTable.tsx index 4ca7a571..8d10734f 100644 --- a/public/components/tooltip/tooltipTable.tsx +++ b/public/components/tooltip/tooltipTable.tsx @@ -15,13 +15,16 @@ import { } from '@elastic/eui'; import React, { useState, Fragment, useCallback, useEffect, useMemo } from 'react'; -export type RowData = { +export interface RowData { key: string; value: string; -}; +} export type PageData = RowData[]; export type TableData = PageData[]; -type Table = { table: TableData; layer: string }; +interface Table { + table: TableData; + layer: string; +} export const ALL_LAYERS = -1; @@ -66,7 +69,7 @@ const TooltipTable = ({ showPagination = true, showLayerSelection = true, }: Props) => { - const [selectedLayers, setSelectedLayers] = useState[]>([ + const [selectedLayers, setSelectedLayers] = useState>>([ { label: tables[0]?.layer ?? '', value: 0, @@ -103,7 +106,7 @@ const TooltipTable = ({ }; const handleLayerChange = useCallback( - (layerSelections: EuiComboBoxOptionOption[]) => { + (layerSelections: Array>) => { if (tables.length === 0) { return; } @@ -152,7 +155,7 @@ const TooltipTable = ({ return ( - +