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

[Maps] layer groups #142528

Merged
merged 41 commits into from
Oct 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4eb259c
[Maps] layer groups
nreese Sep 28, 2022
da6276a
createLayerGroup
nreese Sep 28, 2022
5317c7c
create layer group
nreese Sep 30, 2022
2e3ab89
setChildren
nreese Sep 30, 2022
c139c87
display layer group legend
nreese Sep 30, 2022
4375f06
display nested layers in TOC
nreese Oct 1, 2022
66025fd
setLayerVisibility
nreese Oct 1, 2022
0ade5cf
set parent on layer re-order
nreese Oct 2, 2022
c734dd9
LayerGroup.getBounds
nreese Oct 3, 2022
5997a41
clean-up LayerGroup
nreese Oct 3, 2022
fda76e5
edit layer panel
nreese Oct 3, 2022
fc97ee0
LayerGroup.cloneDescriptor
nreese Oct 3, 2022
6db1186
clean up
nreese Oct 3, 2022
fabf45c
remove layer
nreese Oct 4, 2022
bef3d68
fix reorder bug
nreese Oct 4, 2022
f0d9b0e
move children on layer move
nreese Oct 4, 2022
13927dc
fix re-order bug when dragging layer group with collapsed details
nreese Oct 5, 2022
e184a5b
add check for dragging to same location
nreese Oct 5, 2022
c45bc66
add logic to prevent dragging layer group into its own family tree
nreese Oct 5, 2022
c4ee613
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine Oct 5, 2022
90569a3
add layer to layer group combine action with layer group
nreese Oct 5, 2022
afae7c7
clean up
nreese Oct 5, 2022
7e386ad
fix bug where unable to move layer to bottom
nreese Oct 5, 2022
0bb5dd9
mouse cursor styles
nreese Oct 6, 2022
d79fcac
clean up combine styling
nreese Oct 6, 2022
321cfc0
fix jest tests
nreese Oct 6, 2022
8ecd622
Merge branch 'main' into layer_groups
kibanamachine Oct 6, 2022
d5901d9
update toc_entry_actions_popover snapshots
nreese Oct 6, 2022
681e601
click confirm model on removeLayer in functional tests
nreese Oct 10, 2022
7b978b8
Merge branch 'main' into layer_groups
kibanamachine Oct 10, 2022
99c3450
update cloneLayer to move clones beneath parent
nreese Oct 10, 2022
4519cd9
LayerGroup.getErrors
nreese Oct 10, 2022
3acd081
Merge branch 'main' into layer_groups
kibanamachine Oct 11, 2022
c40ad96
Update x-pack/plugins/maps/common/descriptor_types/layer_descriptor_t…
nreese Oct 11, 2022
9959df7
fix show this layer only action when layer is nested
nreese Oct 11, 2022
cd1447c
recursive count children for remove layer warning
nreese Oct 11, 2022
713fade
Update x-pack/plugins/maps/public/components/remove_layer_confirm_mod…
nreese Oct 11, 2022
191ffda
resolve error with show this layer only on layer group
nreese Oct 11, 2022
88600b2
update remove statement to support plural
nreese Oct 11, 2022
1c1cfdb
perserve layer order when cloning layer group
nreese Oct 11, 2022
1d624bd
Merge branch 'main' into layer_groups
kibanamachine Oct 12, 2022
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
Prev Previous commit
Next Next commit
add layer to layer group combine action with layer group
nreese committed Oct 5, 2022
commit 90569a32a27c5038c0b4592a8328db979ac39211
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import _ from 'lodash';
import React, { Component } from 'react';
import { DropResult, EuiDragDropContext, EuiDroppable, EuiDraggable } from '@elastic/eui';
import { TOCEntry } from './toc_entry';
import { isLayerGroup } from '../../../../classes/layers/layer_group';
import { ILayer } from '../../../../classes/layers/layer';

export interface Props {
@@ -71,37 +72,37 @@ export class LayerTOC extends Component<Props> {
}

_onDragUpdate = ({ combine, destination, source }: DropResult) => {
const sourceIndex = this._reverseIndex(source.index);
const sourceLayer = this.props.layerList[sourceIndex];

if (combine) {
const sourceLayer = this.props.layerList[this._reverseIndex(source.index)];
const combineLayer = this.props.layerList.find((findLayer) => {
const combineIndex = this.props.layerList.findIndex((findLayer) => {
return findLayer.getId() === combine.draggableId;
});
const combineLayer = combineIndex !== -1 ? this.props.layerList[combineIndex] : null;

const newRightSiblingIndex = combineIndex - 1;
const newRightSiblingLayer =
newRightSiblingIndex < 0 ? null : this.props.layerList[newRightSiblingIndex];

const forebearers = combineLayer ? this._getForebearers(combineLayer) : [];

this.setState({
combineLayer,
newRightSiblingLayer: null,
newRightSiblingLayer,
sourceLayer,
isOwnAncestor: forebearers.includes(sourceLayer.getId()),
});
return;
}

// Dragging item out of EuiDroppable results in destination of null
if (!destination) {
this.setState({ ...CLEAR_DND_STATE });
return;
}

// Dragged item to same location, nothing to update
if (source.index === destination.index) {
this.setState({ ...CLEAR_DND_STATE });
return;
}

const sourceIndex = this._reverseIndex(source.index);
const sourceLayer = this.props.layerList[sourceIndex];

const destinationIndex = this._reverseIndex(destination.index);

const newRightSiblingIndex =
sourceIndex > destinationIndex
? // When layer is moved to the right, new right sibling is layer to the right of destination
@@ -110,6 +111,7 @@ export class LayerTOC extends Component<Props> {
destinationIndex;
const newRightSiblingLayer =
newRightSiblingIndex < 0 ? null : this.props.layerList[newRightSiblingIndex];

const forebearers = newRightSiblingLayer ? this._getForebearers(newRightSiblingLayer) : [];

this.setState({
@@ -129,6 +131,14 @@ export class LayerTOC extends Component<Props> {
}

if (combineLayer) {
// add source to combine when combine is layer group
if (isLayerGroup(combineLayer) && newRightSiblingLayer) {
this.props.setLayerParent(sourceLayer.getId(), combineLayer.getId());
this.props.moveLayerToLeftOfTarget(sourceLayer.getId(), newRightSiblingLayer.getId());
return;
}

// creage layer group that contains source and combine
this.props.createLayerGroup(sourceLayer.getId(), combineLayer.getId());
return;
}