Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add global time filter bar to maps #131

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions maps_dashboards/public/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

$mapHeaderOffset: 154px;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '@elastic/eui';
import './add_layer_panel.scss';
import { DOCUMENTS, OPENSEARCH_MAP_LAYER, CUSTOM_MAP, Layer } from '../../../common';
import { getLayerConfigMap } from '../../utils/getIntialLayerConfig';
import { getLayerConfigMap } from '../../utils/getIntialConfig';

interface Props {
setIsLayerConfigVisible: Function;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import React, { Fragment } from 'react';
import { EuiSpacer, EuiTabbedContent } from '@elastic/eui';
import { IndexPattern } from '../../../../../../src/plugins/data/public';
import { DocumentLayerSpecification } from '../../../model/mapLayerType';
import { LayerBasicSettings } from '../layer_basic_settings';
import { DocumentLayerSource } from './document_layer_source';
Expand All @@ -14,6 +15,7 @@ interface Props {
selectedLayerConfig: DocumentLayerSpecification;
setSelectedLayerConfig: Function;
setIsUpdateDisabled: Function;
layersIndexPatterns: IndexPattern[];
isLayerExists: Function;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,24 @@ import {
} from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import _, { Dictionary } from 'lodash';
import { Filter, IndexPattern, IndexPatternField } from '../../../../../../src/plugins/data/public';
import { useOpenSearchDashboards } from '../../../../../../src/plugins/opensearch_dashboards_react/public';
import { MapServices } from '../../../types';
import { DocumentLayerSpecification } from '../../../model/mapLayerType';
import _, { Dictionary } from 'lodash';

interface Props {
setSelectedLayerConfig: Function;
selectedLayerConfig: DocumentLayerSpecification;
setIsUpdateDisabled: Function;
layersIndexPatterns: IndexPattern[];
}

export const DocumentLayerSource = ({
setSelectedLayerConfig,
selectedLayerConfig,
setIsUpdateDisabled,
layersIndexPatterns,
}: Props) => {
const {
services: {
Expand Down Expand Up @@ -150,10 +152,10 @@ export const DocumentLayerSource = ({
useEffect(() => {
const selectIndexPattern = async () => {
if (selectedLayerConfig.source.indexPatternId) {
const savedIndexPattern = await indexPatterns.get(
selectedLayerConfig.source.indexPatternId
const selectedIndexPattern = layersIndexPatterns.find(
(ip) => ip.id === selectedLayerConfig.source.indexPatternId
);
setIndexPattern(savedIndexPattern);
setIndexPattern(selectedIndexPattern);
}
};
selectIndexPattern();
Expand Down Expand Up @@ -205,7 +207,7 @@ export const DocumentLayerSource = ({

const shouldTooltipSectionOpen = () => {
return (
selectedLayerConfig.source.showTooltips === true &&
selectedLayerConfig.source.showTooltips &&
selectedLayerConfig.source.tooltipFields?.length > 0
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { MapLayerSpecification } from '../../model/mapLayerType';
import { BaseMapLayerConfigPanel } from './index';
import { DASHBOARDS_MAPS_LAYER_TYPE } from '../../../common';
import { DocumentLayerConfigPanel } from './documents_config/document_layer_config_panel';
import { IndexPattern } from '../../../../../src/plugins/data/public';

interface Props {
closeLayerConfigPanel: Function;
Expand All @@ -35,6 +36,8 @@ interface Props {
removeLayer: Function;
isNewLayer: boolean;
setIsNewLayer: Function;
layersIndexPatterns: IndexPattern[];
updateIndexPatterns: Function;
isLayerExists: Function;
}

Expand All @@ -46,6 +49,8 @@ export const LayerConfigPanel = ({
removeLayer,
isNewLayer,
setIsNewLayer,
layersIndexPatterns,
updateIndexPatterns,
isLayerExists,
}: Props) => {
const [isUpdateDisabled, setIsUpdateDisabled] = useState(false);
Expand Down Expand Up @@ -107,6 +112,7 @@ export const LayerConfigPanel = ({
selectedLayerConfig={selectedLayerConfig}
setSelectedLayerConfig={setSelectedLayerConfig}
setIsUpdateDisabled={setIsUpdateDisabled}
layersIndexPatterns={layersIndexPatterns}
isLayerExists={isLayerExists}
/>
)}
Expand Down
Loading