[TASK] Pass children to attributeEntry

This commit is contained in:
Xaver Maierhofer 2017-11-04 16:23:17 +01:00 committed by Xaver Maierhofer
parent 6091a8b82c
commit fd6c7c7f1e
4 changed files with 25 additions and 22 deletions

View File

@ -20,10 +20,10 @@
"name": "node.coordinates", "name": "node.coordinates",
"value": "GeoURI" "value": "GeoURI"
}, },
// { // {
// "name": "node.contact", // "name": "node.contact",
// "value": "owner" // "value": "owner"
// }, // },
{ {
"name": "node.hardware", "name": "node.hardware",
"value": "model" "value": "model"

View File

@ -37,17 +37,18 @@ define(['helper', 'snabbdom'], function (helper, V) {
header = V.patch(header, V.h('div', headers)); header = V.patch(header, V.h('div', headers));
children.push(helper.attributeEntry(V, 'node.connectionType', d.type)); helper.attributeEntry(V, children, 'node.connectionType', d.type);
children.push(helper.attributeEntry(V, 'node.tq', V.h('span', helper.attributeEntry(V, children, 'node.tq', V.h('span',
{ {
style: style:
{ {
color: linkScale((d.source_tq + d.target_tq) / 2) color: linkScale((d.source_tq + d.target_tq) / 2)
} }
}, helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq)))); }, helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq))
children.push(helper.attributeEntry(V, 'node.distance', helper.showDistance(d))); );
children.push(helper.attributeEntry(V, 'node.hardware', (d.source.model ? d.source.model + ' ' : '') + helper.attributeEntry(V, children, 'node.distance', helper.showDistance(d));
(d.target.model ? d.target.model : ''))); helper.attributeEntry(V, children, 'node.hardware', (d.source.model ? d.source.model + ' ' : '') +
(d.target.model ? d.target.model : ''));
var elNew = V.h('table', children); var elNew = V.h('table', children);
table = V.patch(table, elNew); table = V.patch(table, elNew);

View File

@ -138,7 +138,11 @@ define(['sorttable', 'snabbdom', 'd3-interpolate', 'moment', 'helper', 'utils/no
} }
}); });
children.push(helper.attributeEntry(V, 'node.gateway', showGateway(d)));
children.push(V.h('tr', [
V.h('th', _.t('node.gateway')),
showGateway(d)
]));
var elNew = V.h('table', children); var elNew = V.h('table', children);
table = V.patch(table, elNew); table = V.patch(table, elNew);

View File

@ -104,19 +104,17 @@ define({
return (d * 100).toFixed(0) + '%'; return (d * 100).toFixed(0) + '%';
}, },
attributeEntry: function attributeEntry(V, label, value) { attributeEntry: function attributeEntry(V, children, label, value) {
if (value === undefined) { if (value !== undefined) {
return ''; if (typeof value !== 'object') {
} value = V.h('td', value);
}
if (typeof value !== 'object') { children.push(V.h('tr', [
value = V.h('td', value); V.h('th', _.t(label)),
value
]));
} }
return V.h('tr', [
V.h('th', _.t(label)),
value
]);
}, },
showStat: function showStat(V, o, subst) { showStat: function showStat(V, o, subst) {
var content; var content;