Handle select properties in search
This commit is contained in:
parent
2a16322492
commit
a6347f9741
1 changed files with 17 additions and 6 deletions
|
@ -203,14 +203,25 @@ class MutableBoardTree implements BoardTree {
|
||||||
if (searchTextInCardTitle) {
|
if (searchTextInCardTitle) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
for (const property in card.properties) {
|
|
||||||
if (
|
// Search for text in properties
|
||||||
Object.prototype.hasOwnProperty.call(card.properties, property) &&
|
const {board} = this
|
||||||
card.properties[property].toLowerCase().includes(searchText)
|
for (const [propertyId, propertyValue] of Object.entries(card.properties)) {
|
||||||
) {
|
// TODO: Refactor to a shared function that returns the display value of a property
|
||||||
return true
|
const propertyTemplate = board.cardProperties.find((o) => o.id === propertyId)
|
||||||
|
if (propertyTemplate) {
|
||||||
|
if (propertyTemplate.type === 'select') {
|
||||||
|
// Look up the value of the select option
|
||||||
|
const option = propertyTemplate.options.find((o) => o.id === propertyValue)
|
||||||
|
if (option?.value.toLowerCase().includes(searchText)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
} else if (propertyValue.toLowerCase().includes(searchText)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue