From 1673fe1248b029429e6ae739c4d3b93b2173d601 Mon Sep 17 00:00:00 2001 From: Xaver Maierhofer Date: Fri, 5 Jan 2018 00:18:50 +0100 Subject: [PATCH] [TASK] Add link type in lists --- lib/infobox/node.js | 9 ++++++--- lib/linklist.js | 8 +++++++- scss/modules/_sidebar.scss | 26 ++++++++++++-------------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/lib/infobox/node.js b/lib/infobox/node.js index cd5a699..1de0ffe 100644 --- a/lib/infobox/node.js +++ b/lib/infobox/node.js @@ -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) { diff --git a/lib/linklist.js b/lib/linklist.js index 5e77348..cc5b190 100644 --- a/lib/linklist.js +++ b/lib/linklist.js @@ -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)) diff --git a/scss/modules/_sidebar.scss b/scss/modules/_sidebar.scss index 4dfd2db..ba6794a 100644 --- a/scss/modules/_sidebar.scss +++ b/scss/modules/_sidebar.scss @@ -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; } } }