-
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.
Browse files
Browse the repository at this point in the history
* [Maps] source descriptor types * make SORT_ORDER an enum * fix type error * finish defining descriptors for all sources * fill out layer descriptor * fix type * make some properties optional to avoid type explosions * make type optional * nest types a bit more so they better match class structor * in progress work from pairing with Thomas * one more thing * add unit test (#35) * add functions removed from fields typescript converstion * move joins from VectorTileLayer constructor to VectorLayer constructor, add mock to fix map_selectors test Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Thomas Neirynck <thomas@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Thomas Neirynck <thomas@elastic.co>
- Loading branch information
1 parent
e132178
commit 8a48ccf
Showing
27 changed files
with
361 additions
and
138 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* 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 { FIELD_ORIGIN } from '../../../common/constants'; | ||
import { IVectorSource } from '../sources/vector_source'; | ||
|
||
export interface IField { | ||
getName(): string; | ||
getRootName(): string; | ||
canValueBeFormatted(): boolean; | ||
getLabel(): Promise<string>; | ||
getDataType(): Promise<string>; | ||
} | ||
|
||
export class AbstractField implements IField { | ||
private _fieldName: string; | ||
private _source: IVectorSource; | ||
private _origin: string; | ||
|
||
constructor({ | ||
fieldName, | ||
source, | ||
origin, | ||
}: { | ||
fieldName: string; | ||
source: IVectorSource; | ||
origin: string; | ||
}) { | ||
this._fieldName = fieldName; | ||
this._source = source; | ||
this._origin = origin || FIELD_ORIGIN.SOURCE; | ||
} | ||
|
||
getName(): string { | ||
return this._fieldName; | ||
} | ||
|
||
getRootName(): string { | ||
return this.getName(); | ||
} | ||
|
||
canValueBeFormatted(): boolean { | ||
return true; | ||
} | ||
|
||
getSource(): IVectorSource { | ||
return this._source; | ||
} | ||
|
||
isValid(): boolean { | ||
return !!this._fieldName; | ||
} | ||
|
||
async getDataType(): Promise<string> { | ||
return 'string'; | ||
} | ||
|
||
async getLabel(): Promise<string> { | ||
return this._fieldName; | ||
} | ||
|
||
async createTooltipProperty(): Promise<unknown> { | ||
throw new Error('must implement Field#createTooltipProperty'); | ||
} | ||
|
||
getOrigin(): string { | ||
return this._origin; | ||
} | ||
|
||
supportsFieldMeta(): boolean { | ||
return false; | ||
} | ||
|
||
async getOrdinalFieldMetaRequest(/* config */): Promise<unknown> { | ||
return null; | ||
} | ||
|
||
async getCategoricalFieldMetaRequest(): Promise<unknown> { | ||
return null; | ||
} | ||
} |
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.