Dashboard corrections
This commit is contained in:
@@ -118,10 +118,23 @@ export function mapTitleTip(card, item) {
|
||||
return key ? (item[key] || '') : ''
|
||||
}
|
||||
|
||||
// Floor-plan preview on hover, for rows that carry coordinates. Returns null
|
||||
// when the card declares none or the row has not been placed on the map - an
|
||||
// unplaced printer still belongs on the card, it just has nothing to preview.
|
||||
export function mapHover(card, item) {
|
||||
const spec = card.map && card.map.maphover
|
||||
if (!spec) return null
|
||||
const x = item[spec.x]
|
||||
const y = item[spec.y]
|
||||
if (x === null || x === undefined || y === null || y === undefined) return null
|
||||
return { x, y, label: spec.label ? (item[spec.label] || '') : '' }
|
||||
}
|
||||
|
||||
export function cardRows(card) {
|
||||
return rows(card).map((item) => ({
|
||||
title: mapTitle(card, item),
|
||||
titletip: mapTitleTip(card, item),
|
||||
maphover: mapHover(card, item),
|
||||
detail: mapDetail(card, item),
|
||||
detailtip: mapDetailTip(card, item),
|
||||
meta: mapMeta(card, item),
|
||||
|
||||
Reference in New Issue
Block a user