[TASK] Add link type in lists

This commit is contained in:
Xaver Maierhofer 2018-01-05 00:18:50 +01:00
parent c3cda56fe9
commit 1673fe1248
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
3 changed files with 25 additions and 18 deletions

View File

@ -61,9 +61,9 @@ define(['sorttable', 'snabbdom', 'd3-interpolate', 'moment', 'helper', 'utils/no
}
function renderNeighbourRow(n) {
var icons = '';
var icons = [V.h('span', { props: { className: 'icon ion-' + (n.link.type.indexOf('wifi') === 0 ? 'wifi' : 'share-alt'), title: _.t(n.link.type) } })];
if (helper.hasLocation(n.node)) {
icons = V.h('span', { props: { className: 'ion-location' } });
icons.push(V.h('span', { props: { className: 'ion-location' } }));
}
return V.h('tr', [
@ -81,7 +81,10 @@ define(['sorttable', 'snabbdom', 'd3-interpolate', 'moment', 'helper', 'utils/no
var images = document.createElement('div');
var neighbours = document.createElement('h3');
var headings = [{
name: ''
name: '',
sort: function (a, b) {
return a.link.type.localeCompare(b.link.type);
}
}, {
name: 'node.nodes',
sort: function (a, b) {

View File

@ -7,6 +7,11 @@ define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
}
var headings = [{
name: '',
sort: function (a, b) {
return a.type.localeCompare(b.type);
}
}, {
name: 'node.nodes',
sort: function (a, b) {
return linkName(a).localeCompare(linkName(b));
@ -30,7 +35,7 @@ define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
}];
return function (linkScale) {
var table = new SortTable(headings, 2, renderRow);
var table = new SortTable(headings, 3, renderRow);
function renderRow(d) {
var td1Content = [V.h('a', {
@ -44,6 +49,7 @@ define(['sorttable', 'snabbdom', 'helper'], function (SortTable, V, helper) {
}, linkName(d))];
return V.h('tr', [
V.h('td', V.h('span', { props: { className: 'icon ion-' + (d.type.indexOf('wifi') === 0 ? 'wifi' : 'share-alt'), title: _.t(d.type) } })),
V.h('td', td1Content),
V.h('td', { style: { color: linkScale((d.source_tq + d.target_tq) / 2) } }, helper.showTq(d.source_tq) + ' - ' + helper.showTq(d.target_tq)),
V.h('td', helper.showDistance(d))

View File

@ -30,7 +30,8 @@
}
.node-list,
.node-links {
.node-links,
.link-list {
th,
td {
&:first-child {
@ -47,25 +48,22 @@
}
}
.link-list {
th,
td {
&:nth-child(2) {
width: 60%;
}
}
}
.node-links {
padding-bottom: 15px;
th,
td {
&:first-child {
width: 25px;
}
}
}
.link-list {
th,
td {
&:nth-child(1) {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 60%;
width: 35px;
}
}
}