Disable value interpretion for 'id'
This commit is contained in:
parent
c968d7d454
commit
bdcedae003
1 changed files with 12 additions and 6 deletions
|
@ -525,7 +525,7 @@ export default class SpecialVisualizations {
|
||||||
defaultValue: "18",
|
defaultValue: "18",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
doc: "(Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap.",
|
doc: "(Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap. (Note: if the key is 'id', list interpration is disabled)",
|
||||||
name: "idKey",
|
name: "idKey",
|
||||||
defaultValue: "id",
|
defaultValue: "id",
|
||||||
},
|
},
|
||||||
|
@ -541,19 +541,25 @@ export default class SpecialVisualizations {
|
||||||
const featureStore = state.allElements.ContainingFeatures
|
const featureStore = state.allElements.ContainingFeatures
|
||||||
const featuresToShow: Store<{ freshness: Date; feature: any }[]> =
|
const featuresToShow: Store<{ freshness: Date; feature: any }[]> =
|
||||||
tagSource.map((properties) => {
|
tagSource.map((properties) => {
|
||||||
const values: string[] = Utils.NoNull(
|
|
||||||
keys.map((key) => properties[key])
|
|
||||||
)
|
|
||||||
const features: { freshness: Date; feature: any }[] = []
|
const features: { freshness: Date; feature: any }[] = []
|
||||||
for (const value of values) {
|
for (const key of keys) {
|
||||||
|
const value = properties[key]
|
||||||
|
if(value === undefined || value === null){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
let idList = [value]
|
let idList = [value]
|
||||||
if (value.startsWith("[")) {
|
if (key !== "id" && value.startsWith("[")) {
|
||||||
// This is a list of values
|
// This is a list of values
|
||||||
idList = JSON.parse(value)
|
idList = JSON.parse(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const id of idList) {
|
for (const id of idList) {
|
||||||
const feature = featureStore.get(id)
|
const feature = featureStore.get(id)
|
||||||
|
if(feature === undefined){
|
||||||
|
console.warn("No feature found for id ", id)
|
||||||
|
continue
|
||||||
|
}
|
||||||
features.push({
|
features.push({
|
||||||
freshness: new Date(),
|
freshness: new Date(),
|
||||||
feature,
|
feature,
|
||||||
|
|
Loading…
Reference in a new issue