forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] Add styling and tooltip support to mapbox mvt vector tile sour…
…ces (elastic#64488) * tmp commit * rename * more boilerpalte * more boiler * more boilerpalte * typing * fix import * boilerplate * more boiler * enable custom palettes * fix label text and orientation * fix merge errors * remove dupe import * stash commit * tmp commit * debounce settings * return null * slight rearrangement * tooltip guard * minor tweaks * feedback * ts fixes * ts fixes * more ts fixes * ts fixes * jest test * fix typo * spacing * fix typing * add unit test * add more tests * add snapshot test * add snapshot * add field editor snapshot test * fix snapshot * add snapshot * remove unused import * test stub for mvt layer fix optional param more checks * add snapshot test more unit tests more unit tests ts fixes * add data syncing unit test * fix autorefactor * fix merge and replace snapshots * field editor changes * field editor changes * ts fixes * update snapshots * fix things * fix names * fix tooltip * add more error handling * improve copy * styling changes * style option box a little better * ts fixes * fix console error * remove mbProperties from interface * remove unused method * remove cruft * rename for consistency * remove unused param * feedback * feedback * ensure properties are always present * handle possible null values * feedback * typo * update SIEM * feedback * remove cruft * remove unused translations * feedback * improve readability * fix brittle test * fix snapshot after master merge * remove unused method * feedback * revert some feedback * remove micro-optimization * initialize in constructor * simplify wording * add snapshot * naming * add clarifying comment * remove unused import * sanitize tooltips * remove cruft * feedback * fix typo * remove export * Design fixes * clean up supportsAutoDomain * remove patch.txt * cleanup * clean-up * Merge in styling changes * Tweak message format * fix broken import Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: miukimiu <elizabet.oliveira@elastic.co> Co-authored-by: Nathan Reese <reese.nathan@gmail.com>
- Loading branch information
1 parent
289652d
commit fef75ee
Showing
62 changed files
with
2,405 additions
and
378 deletions.
There are no files selected for viewing
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
File renamed without changes.
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { AbstractField, IField } from './field'; | ||
import { FIELD_ORIGIN, MVT_FIELD_TYPE } from '../../../common/constants'; | ||
import { ITiledSingleLayerVectorSource, IVectorSource } from '../sources/vector_source'; | ||
import { MVTFieldDescriptor } from '../../../common/descriptor_types'; | ||
|
||
export class MVTField extends AbstractField implements IField { | ||
private readonly _source: ITiledSingleLayerVectorSource; | ||
private readonly _type: MVT_FIELD_TYPE; | ||
constructor({ | ||
fieldName, | ||
type, | ||
source, | ||
origin, | ||
}: { | ||
fieldName: string; | ||
source: ITiledSingleLayerVectorSource; | ||
origin: FIELD_ORIGIN; | ||
type: MVT_FIELD_TYPE; | ||
}) { | ||
super({ fieldName, origin }); | ||
this._source = source; | ||
this._type = type; | ||
} | ||
|
||
getMVTFieldDescriptor(): MVTFieldDescriptor { | ||
return { | ||
type: this._type, | ||
name: this.getName(), | ||
}; | ||
} | ||
|
||
getSource(): IVectorSource { | ||
return this._source; | ||
} | ||
|
||
async getDataType(): Promise<string> { | ||
if (this._type === MVT_FIELD_TYPE.STRING) { | ||
return 'string'; | ||
} else if (this._type === MVT_FIELD_TYPE.NUMBER) { | ||
return 'number'; | ||
} else { | ||
throw new Error(`Unrecognized MVT field-type ${this._type}`); | ||
} | ||
} | ||
|
||
async getLabel(): Promise<string> { | ||
return this.getName(); | ||
} | ||
|
||
supportsAutoDomain() { | ||
return false; | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/maps/public/classes/layers/__tests__/mock_sync_context.ts
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,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import sinon from 'sinon'; | ||
import { DataRequestContext } from '../../../actions'; | ||
import { DataMeta, MapFilters } from '../../../../common/descriptor_types'; | ||
|
||
export class MockSyncContext implements DataRequestContext { | ||
dataFilters: MapFilters; | ||
isRequestStillActive: (dataId: string, requestToken: symbol) => boolean; | ||
onLoadError: (dataId: string, requestToken: symbol, errorMessage: string) => void; | ||
registerCancelCallback: (requestToken: symbol, callback: () => void) => void; | ||
startLoading: (dataId: string, requestToken: symbol, meta: DataMeta) => void; | ||
stopLoading: (dataId: string, requestToken: symbol, data: object, meta: DataMeta) => void; | ||
updateSourceData: (newData: unknown) => void; | ||
|
||
constructor({ dataFilters }: { dataFilters: Partial<MapFilters> }) { | ||
const mapFilters: MapFilters = { | ||
filters: [], | ||
timeFilters: { | ||
from: 'now', | ||
to: '15m', | ||
mode: 'relative', | ||
}, | ||
zoom: 0, | ||
...dataFilters, | ||
}; | ||
|
||
this.dataFilters = mapFilters; | ||
this.isRequestStillActive = sinon.spy(); | ||
this.onLoadError = sinon.spy(); | ||
this.registerCancelCallback = sinon.spy(); | ||
this.startLoading = sinon.spy(); | ||
this.stopLoading = sinon.spy(); | ||
this.updateSourceData = sinon.spy(); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
...s/public/classes/layers/tiled_vector_layer/__snapshots__/tiled_vector_layer.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.