-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Maps] Add draw wizard #100278
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
Merged
thomasneirynck
merged 85 commits into
elastic:master
from
thomasneirynck:maps/drawing_wizard
May 26, 2021
Merged
[Maps] Add draw wizard #100278
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
5f8aa18
Placeholder feature edit control in place
2cbd6b0
Merge remote-tracking branch 'upstream/master' into shape-drawing-ui
a80038a
Placeholder menu added
26ec7bf
Redux integrated
8ca809a
Single shape drawing
f9eeb95
Merge remote-tracking branch 'upstream/master' into shape-drawing-ui
b8eea96
Keep draw mode active
b4f3af0
Trigger editing through add layer wizard
001c87f
Add index checking utils
95f8f14
Connect error checking
2de30ec
Conditionally show edit toolbar
92e17aa
Connect missing shapes. Some clean up
143b24a
Track features and index name in store
e129539
Connect add layer button enablement
9c5ca16
Connect persistence utils
423e3aa
Dispatch clearing action
f238ccb
Full roundtrip w/ settings showing. Moved async calls to component
d450fd1
Adjust addLayer call for async
3d7ad76
Merge remote-tracking branch 'upstream/master' into shape-drawing-ui
b12ad85
Add edit controls
576b3d3
Fix deleting functionality to update store
cd211f9
Add toggle color to buttons. Fall back to edit between drawings
4f79738
Deselect features still selected when entering trash mode
ceae6d2
Add geometry check to filter out invalid geometries
bee0fd5
Clear out old drawing data on cancel. Update action names
3725859
Add circle drawing button
5200165
Add tools show on map with cancel. Not completely connected to add la…
2cb1832
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
4ab4c54
Controls and feature handling almost entirely removed. Index creation…
32e4dcf
Remove more unused files related to draw toolbar
9579d44
Fix step handling
da58916
Remove toolbar logic
28ffc5f
Add same disabling logic used by file upload
2217bc1
Put wizard behind feature flag
fa6fd2e
More clean up
7d2d5a4
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
634ede6
Remove unused source
a549a1e
Clean up, type fixes
5bcd3a9
Remove unused constant
5035bc5
Clean up unused feature actions. Misc. clean up
5e39efb
Fix i18n
7cd1482
eslint fix
958cc6a
Adding toolbar icons and draw layer icon
elizabetdev d3c064d
Merge branch 'shape-drawing-wizard' of https://github.com/aaronjcaldw…
elizabetdev 9529b94
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
177d5d2
TS conversions
65257a0
Review feedback. Lots of clean up
69e9393
Update card description
78c3721
Merge branch 'shape-drawing-wizard' of github.com:aaronjcaldwell/kiba…
9c817f7
Linting errors
431890a
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
a5b1b1d
Review feedback. Update layer card title and description
087861a
Review feedback. Update wording on index name entry page
e2b19c2
Update x-pack/plugins/maps/public/classes/layers/new_vector_layer_wiz…
kindsun 09017eb
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
2dd166d
Integrate file upload index name component
bc75830
Revise index calls to use kibana https fetch. Remove http service
4162876
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
b25bcae
Review feedback. Mostly clean up
73f2536
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
58c84e8
Make index name validation callback props optional
bd783ad
Review feedback. Async checks, revised async component init, clean up
8799716
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
7706cca
More clean up around async component init handling
f02a8d4
Review feedback. Handle async component load on file upload side
6107902
Update maps side to not use async in component load
4f09cd8
Merge remote-tracking branch 'upstream/master' into shape-drawing-wizard
065f745
Review feedback. Move button enable/disable out of callback
e4c1c92
Review feedback. Move wrapper components to api dir
0d8c253
Add semi-colon
6cb65ee
Merge branch 'shape-drawing-wizard' of https://github.com/aaronjcaldw…
thomasneirynck cf4ca63
Merge branch 'master' of github.com:elastic/kibana into maps/drawing_…
thomasneirynck ce73372
remove indirection
thomasneirynck ceefa04
use contentloading
thomasneirynck cc488a6
feedback
thomasneirynck 5ab8b71
reduce indirection
thomasneirynck 8c9e91f
feedback
thomasneirynck 3a63176
simplify
thomasneirynck 79953ec
language
thomasneirynck d561532
tighten ux
thomasneirynck 004fb15
Merge branch 'master' of github.com:elastic/kibana into maps/drawing_…
thomasneirynck 6f06429
init feedback
thomasneirynck 9e18b51
use callout
thomasneirynck 722e406
avoid loop
thomasneirynck 9b75b47
simplify
thomasneirynck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/file_upload/public/api/index_name_form_async_wrapper.tsx
This file contains hidden or 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,43 @@ | ||
| /* | ||
| * 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 { EuiLoadingContent } from '@elastic/eui'; | ||
| import { lazyLoadModules } from '../lazy_load_bundle'; | ||
| import { IndexNameFormProps } from '../index'; | ||
|
|
||
| interface State { | ||
| IndexNameForm: React.ComponentType<IndexNameFormProps> | null; | ||
| } | ||
|
|
||
| export class IndexNameFormAsyncWrapper extends React.Component<IndexNameFormProps, State> { | ||
| state: State = { | ||
| IndexNameForm: null, | ||
| }; | ||
|
|
||
| private _isMounted = false; | ||
|
|
||
| componentWillUnmount(): void { | ||
| this._isMounted = false; | ||
| } | ||
|
|
||
| componentDidMount() { | ||
| this._isMounted = true; | ||
| lazyLoadModules().then((modules) => { | ||
| if (this._isMounted) { | ||
| this.setState({ | ||
| IndexNameForm: modules.IndexNameForm, | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| render() { | ||
| const { IndexNameForm } = this.state; | ||
| return IndexNameForm ? <IndexNameForm {...this.props} /> : <EuiLoadingContent lines={3} />; | ||
| } | ||
| } |
48 changes: 48 additions & 0 deletions
48
x-pack/plugins/file_upload/public/api/json_upload_and_parse_async_wrapper.tsx
This file contains hidden or 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,48 @@ | ||
| /* | ||
| * 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 { EuiLoadingContent } from '@elastic/eui'; | ||
| import { FileUploadComponentProps, lazyLoadModules } from '../lazy_load_bundle'; | ||
|
|
||
| interface State { | ||
| JsonUploadAndParse: React.ComponentType<FileUploadComponentProps> | null; | ||
| } | ||
|
|
||
| export class JsonUploadAndParseAsyncWrapper extends React.Component< | ||
| FileUploadComponentProps, | ||
| State | ||
| > { | ||
| state: State = { | ||
| JsonUploadAndParse: null, | ||
| }; | ||
| private _isMounted = false; | ||
|
|
||
| componentDidMount() { | ||
| this._isMounted = true; | ||
| lazyLoadModules().then((modules) => { | ||
| if (this._isMounted) { | ||
| this.setState({ | ||
| JsonUploadAndParse: modules.JsonUploadAndParse, | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| componentWillUnmount(): void { | ||
| this._isMounted = false; | ||
| } | ||
|
|
||
| render() { | ||
| const { JsonUploadAndParse } = this.state; | ||
| return JsonUploadAndParse ? ( | ||
| <JsonUploadAndParse {...this.props} /> | ||
| ) : ( | ||
| <EuiLoadingContent lines={3} /> | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| */ | ||
|
|
||
| export interface CreateDocSourceResp { | ||
| indexPatternId?: string; | ||
| success: boolean; | ||
| error?: Error; | ||
| } | ||
|
|
||
This file contains hidden or 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 hidden or 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
37 changes: 37 additions & 0 deletions
37
x-pack/plugins/maps/public/classes/layers/icons/draw_layer_icon.tsx
This file contains hidden or 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,37 @@ | ||
| /* | ||
| * 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, { FunctionComponent } from 'react'; | ||
|
|
||
| export const DrawLayerIcon: FunctionComponent = () => ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| width="49" | ||
| height="25" | ||
| fill="none" | ||
| viewBox="0 0 49 25" | ||
| className="mapLayersWizardIcon" | ||
| > | ||
| <path | ||
| className="mapLayersWizardIcon__background" | ||
| d="M12.281 3l-6.625 7.625 1.657 8.938 35.218-.813v-13l-10.625-3.5-9.781 9.5L12.281 3z" | ||
| /> | ||
| <path | ||
| className="mapLayersWizardIcon__highlight" | ||
| fillRule="evenodd" | ||
| d="M31.775 1.68l11.256 3.708v13.85l-36.133.834-1.777-9.593 7.114-8.189 9.875 8.778 9.665-9.388zm.262 1.14l-9.897 9.612-9.813-8.722-6.135 7.06 1.535 8.283 34.304-.792V6.111L32.037 2.82z" | ||
| clipRule="evenodd" | ||
| /> | ||
| <circle cx="7.281" cy="19.5" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="5.656" cy="10.25" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="12.156" cy="3.625" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="22" cy="11.6" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="31.969" cy="2.5" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="42.344" cy="6.125" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| <circle cx="42.344" cy="19" r="2.5" className="mapLayersWizardIcon__highlight" /> | ||
| </svg> | ||
| ); |
This file contains hidden or 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
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/maps/public/classes/layers/new_vector_layer_wizard/config.tsx
This file contains hidden or 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,49 @@ | ||
| /* | ||
| * 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 { i18n } from '@kbn/i18n'; | ||
| import React from 'react'; | ||
| import { LayerWizard, RenderWizardArguments } from '../../layers/layer_wizard_registry'; | ||
| import { NewVectorLayerEditor } from './wizard'; | ||
| import { DrawLayerIcon } from '../../layers/icons/draw_layer_icon'; | ||
| import { getFileUpload } from '../../../kibana_services'; | ||
| import { LAYER_WIZARD_CATEGORY } from '../../../../common'; | ||
|
|
||
| const ADD_VECTOR_DRAWING_LAYER = 'ADD_VECTOR_DRAWING_LAYER'; | ||
|
|
||
| export const newVectorLayerWizardConfig: LayerWizard = { | ||
| categories: [LAYER_WIZARD_CATEGORY.ELASTICSEARCH], | ||
| description: i18n.translate('xpack.maps.newVectorLayerWizard.description', { | ||
| defaultMessage: 'Creates a new empty layer. Use this to add shapes to the map', | ||
| }), | ||
| disabledReason: i18n.translate('xpack.maps.newVectorLayerWizard.disabledDesc', { | ||
| defaultMessage: | ||
| 'Unable to draw vector shapes, you are missing the Kibana privilege "Index Pattern Management".', | ||
| }), | ||
| getIsDisabled: async () => { | ||
| const hasImportPermission = await getFileUpload().hasImportPermission({ | ||
| checkCreateIndexPattern: true, | ||
| checkHasManagePipeline: false, | ||
| }); | ||
| return !hasImportPermission; | ||
| }, | ||
| icon: DrawLayerIcon, | ||
| prerequisiteSteps: [ | ||
| { | ||
| id: ADD_VECTOR_DRAWING_LAYER, | ||
| label: i18n.translate('xpack.maps.newVectorLayerWizard.indexNewLayer', { | ||
| defaultMessage: 'Index new layer', | ||
| }), | ||
| }, | ||
| ], | ||
| renderWizard: (renderWizardArguments: RenderWizardArguments) => { | ||
| return <NewVectorLayerEditor {...renderWizardArguments} />; | ||
| }, | ||
| title: i18n.translate('xpack.maps.newVectorLayerWizard.title', { | ||
| defaultMessage: 'Create new layer', | ||
| }), | ||
| }; |
27 changes: 27 additions & 0 deletions
27
...ck/plugins/maps/public/classes/layers/new_vector_layer_wizard/create_new_index_pattern.ts
This file contains hidden or 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,27 @@ | ||
| /* | ||
| * 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 { getHttp } from '../../../kibana_services'; | ||
| import { CreateDocSourceResp, INDEX_SOURCE_API_PATH } from '../../../../common'; | ||
|
|
||
| export const createNewIndexAndPattern = async (indexName: string) => { | ||
| return await getHttp().fetch<CreateDocSourceResp>({ | ||
| path: `/${INDEX_SOURCE_API_PATH}`, | ||
| method: 'POST', | ||
| body: JSON.stringify({ | ||
| index: indexName, | ||
| // Initially set to static mappings | ||
| mappings: { | ||
| properties: { | ||
| coordinates: { | ||
| type: 'geo_shape', | ||
| }, | ||
| }, | ||
| }, | ||
| }), | ||
| }); | ||
| }; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.