freifunkmanager/js/route/aliases.js

36 lines
1.8 KiB
JavaScript

function routeAliases(){
fill = '<table class="mdl-data-table mdl-js-data-table mdl-shadow--2dp nodes-table">'
+ '<thead>'
+ '<tr>'
+ '<th class="mdl-data-table__cell--non-numeric">Hostname</th>'
+ '<th>Freq</th>'
+ '<th>Channel</th>'
+ '<th>Power</th>'
+ '<th class="mdl-data-table__cell--non-numeric">Location</th>'
+ '<th class="mdl-data-table__cell--non-numeric">SSH</th>'
+ '</tr>'
+ '</thead>'
+ '<tbody>'
Object.keys(internal.aliases).map(function(key){
fill += '<tr>'
+ '<td class="mdl-data-table__cell--non-numeric" rowspan="2">'
+ internal.aliases[key].hostname
+ '<br/>'
+ '<small>'+key+'</small>'
+ '</td>'
+ '<td>2.4 Ghz</td>'
+ '<td>'+((internal.aliases[key].wireless !== undefined && internal.aliases[key].wireless.channel2 !== undefined)?internal.aliases[key].wireless.channel2:'-')+ '</td>'
+ '<td>'+((internal.aliases[key].wireless !== undefined && internal.aliases[key].wireless.txpower2 !== undefined)?internal.aliases[key].wireless.txpower2:'-')+ '</td>'
+ '<td class="mdl-data-table__cell--non-numeric" rowspan="2">'+((internal.aliases[key].location)?'<i class="material-icons">place</i>':'')+'</td>'
+ '<td class="mdl-data-table__cell--non-numeric" rowspan="2">'+sshUrl(key)+'</td>'
+ '</tr>'
+ '<tr>'
+ '<td class="mdl-data-table__cell--non-numeric" style="padding-left:18px;">5Ghz</td>'
+ '<td>'+((internal.aliases[key].wireless !== undefined && internal.aliases[key].wireless.channel5 !== undefined)?internal.aliases[key].wireless.channel5:'-')+ '</td>'
+ '<td style="padding-right:18px;">'+((internal.aliases[key].wireless !== undefined && internal.aliases[key].wireless.txpower5 !== undefined)?internal.aliases[key].wireless.txpower5:'-')+ '</td>'
+ '</tr>'
})
fill += '</tbody></table>'
container.innerHTML = fill
}