[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

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

View File

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