diff --git a/parse/common.js b/parse/common.js index b70e0203..285b10c1 100644 --- a/parse/common.js +++ b/parse/common.js @@ -24,7 +24,10 @@ const parseCommonData = (profile, opt, res) => { } res.icons = [] - if (Array.isArray(c.icoL)) res.icons = c.icoL.map(parseIcon) + if (Array.isArray(c.icoL)) { + res.icons = c.icoL.map(parseIcon) + resolveIdxRefs(res, '**.icoX', res.icons, 'icon') + } res.lines = [] if (Array.isArray(c.prodL)) { diff --git a/parse/hint.js b/parse/hint.js index 7f2cac57..cb0499c5 100644 --- a/parse/hint.js +++ b/parse/hint.js @@ -12,12 +12,11 @@ const codesByIcon = Object.assign(Object.create(null), { // "tagL": [ // "RES_JNY_DTL" // only shown in journey detail // ] -const parseHint = (profile, h, data) => { - const icons = data.icoL || [] +const parseHint = (profile, h, _) => { // todo: C const text = h.txtN && h.txtN.trim() || '' - const icon = 'number' === typeof h.icoX && icons[h.icoX] || null + const icon = h.icon || null const code = h.code || (icon && icon.type && codesByIcon[icon.type]) || null if (h.type === 'M') { diff --git a/parse/warning.js b/parse/warning.js index 70d1b07d..7829022b 100644 --- a/parse/warning.js +++ b/parse/warning.js @@ -11,8 +11,7 @@ const typesByIcon = Object.assign(Object.create(null), { const parseMsgEdge = (profile, data) => (e) => { const res = omit(e, ['icoX', 'fLocX', 'tLocX']) - const icons = data.icoL || [] - res.icon = 'number' === typeof e.icoX && icons[e.icoX] || null + res.icon = e.icon || null res.fromLoc = 'number' === typeof e.fLocX && data.locations[e.fLocX] || null res.toLoc = 'number' === typeof e.tLocX && data.locations[e.tLocX] || null return res @@ -28,7 +27,6 @@ const parseMsgEvent = (profile, data) => (e) => { } const parseWarning = (profile, w, data) => { - const icons = data.icoL || [] // todo: act, pub, lead, tckr, prod, comp, // todo: cat (1, 2), pubChL, rRefL, impactL // pubChL: @@ -48,7 +46,7 @@ const parseWarning = (profile, w, data) => { // tDate: '20190225', // tTime: '120000' } - const icon = 'number' === typeof w.icoX && icons[w.icoX] || null + const icon = w.icon || null const type = icon && icon.type && typesByIcon[icon.type] || 'warning' const res = {