-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] visualize in maps button (#98677)
* [Lens] visualize in maps button * clean up dependency injection as suggested * add custom workspace render for geo fields * tslint and finish drag and drop for geo field * convert react class to function component * prevent page reload when clicking visualize in maps button * filter allFields instead of using condition to populate fieldTypeNames to fix tslint * clean up UI * fix jest test * globe illustration * UI cleanup * functional test * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx Co-authored-by: Michael Marcialis <[email protected]> * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.scss Co-authored-by: Michael Marcialis <[email protected]> * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx Co-authored-by: Michael Marcialis <[email protected]> * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.scss Co-authored-by: Michael Marcialis <[email protected]> * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.scss Co-authored-by: Michael Marcialis <[email protected]> * Update x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx Co-authored-by: Michael Marcialis <[email protected]> * updated globe svg * remove unused * better message for drop zone screen reader * Update x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx Co-authored-by: Michael Marcialis <[email protected]> * tslint Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Michael Marcialis <[email protected]>
- Loading branch information
1 parent
4b22037
commit b097385
Showing
24 changed files
with
403 additions
and
30 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
18 changes: 18 additions & 0 deletions
18
...s/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.scss
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,18 @@ | ||
@import '../../../mixins'; | ||
|
||
.lnsVisualizeGeoFieldWorkspacePanel__dragDrop { | ||
padding: $euiSizeXXL ($euiSizeXL * 2); | ||
border: $euiBorderThin; | ||
border-radius: $euiBorderRadius; | ||
|
||
&.lnsDragDrop-isDropTarget { | ||
@include lnsDroppable; | ||
@include lnsDroppableActive; | ||
|
||
} | ||
|
||
&.lnsDragDrop-isActiveDropTarget { | ||
@include lnsDroppableActiveHover; | ||
|
||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...ns/public/editor_frame_service/editor_frame/workspace_panel/geo_field_workspace_panel.tsx
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,75 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { EuiPageContentBody, EuiText } from '@elastic/eui'; | ||
import { FormattedMessage } from '@kbn/i18n/react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { | ||
UiActionsStart, | ||
VISUALIZE_GEO_FIELD_TRIGGER, | ||
} from '../../../../../../../src/plugins/ui_actions/public'; | ||
import { getVisualizeGeoFieldMessage } from '../../../utils'; | ||
import { DragDrop } from '../../../drag_drop'; | ||
import { GlobeIllustration } from '../../../assets/globe_illustration'; | ||
import './geo_field_workspace_panel.scss'; | ||
|
||
interface Props { | ||
fieldType: string; | ||
fieldName: string; | ||
indexPatternId: string; | ||
uiActions: UiActionsStart; | ||
} | ||
|
||
const dragDropIdentifier = { | ||
id: 'lnsGeoFieldWorkspace', | ||
humanData: { | ||
label: i18n.translate('xpack.lens.geoFieldWorkspace.dropZoneLabel', { | ||
defaultMessage: 'drop zone to open in maps', | ||
}), | ||
}, | ||
}; | ||
|
||
const dragDropOrder = [1, 0, 0, 0]; | ||
|
||
export function GeoFieldWorkspacePanel(props: Props) { | ||
function onDrop() { | ||
props.uiActions.getTrigger(VISUALIZE_GEO_FIELD_TRIGGER).exec({ | ||
indexPatternId: props.indexPatternId, | ||
fieldName: props.fieldName, | ||
}); | ||
} | ||
|
||
return ( | ||
<EuiPageContentBody className="lnsWorkspacePanelWrapper__pageContentBody"> | ||
<EuiText className="lnsWorkspacePanel__emptyContent" textAlign="center" size="s"> | ||
<h2> | ||
<strong>{getVisualizeGeoFieldMessage(props.fieldType)}</strong> | ||
</h2> | ||
<GlobeIllustration aria-hidden={true} className="lnsWorkspacePanel__dropIllustration" /> | ||
<DragDrop | ||
className="lnsVisualizeGeoFieldWorkspacePanel__dragDrop" | ||
dataTestSubj="lnsGeoFieldWorkspace" | ||
draggable={false} | ||
dropTypes={['field_add']} | ||
order={dragDropOrder} | ||
value={dragDropIdentifier} | ||
onDrop={onDrop} | ||
> | ||
<p> | ||
<strong> | ||
<FormattedMessage | ||
id="xpack.lens.geoFieldWorkspace.dropMessage" | ||
defaultMessage="Drop field here to open in Maps" | ||
/> | ||
</strong> | ||
</p> | ||
</DragDrop> | ||
</EuiText> | ||
</EuiPageContentBody> | ||
); | ||
} |
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
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
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
Oops, something went wrong.