GUI -- Cleaned up table directives, device view, fixed flash-spec unit tests, started unt tests for table.js.
Change-Id: I3020fec5f3f57cebc237c1a6cbfd07deb3607189
diff --git a/web/gui/src/main/webapp/app/fw/svg/icon.css b/web/gui/src/main/webapp/app/fw/svg/icon.css
index ad4d4c9..7f3e8f4 100644
--- a/web/gui/src/main/webapp/app/fw/svg/icon.css
+++ b/web/gui/src/main/webapp/app/fw/svg/icon.css
@@ -28,10 +28,6 @@
fill-rule: evenodd;
}
-div.inline-icon {
- display: inline-block;
-}
-
.light svg.embeddedIcon .icon.deviceOnline,
.light svg.embeddedIcon .icon.deviceOffline {
fill: none;
diff --git a/web/gui/src/main/webapp/app/fw/svg/icon.js b/web/gui/src/main/webapp/app/fw/svg/icon.js
index 51e47b9..52ed46d 100644
--- a/web/gui/src/main/webapp/app/fw/svg/icon.js
+++ b/web/gui/src/main/webapp/app/fw/svg/icon.js
@@ -34,8 +34,7 @@
devIcon_SWITCH: 'switch',
tableColSortAsc: 'triangleUp',
- tableColSortDesc: 'triangleDown',
- tableColSortNone: '-'
+ tableColSortDesc: 'triangleDown'
};
@@ -86,15 +85,13 @@
rx: cornerSize
});
- if (gid !== '-') {
- g.append('use').attr({
- width: vboxSize,
- height: vboxSize,
- 'class': 'glyph',
- 'xlink:href': '#' + gid
- });
- }
- }
+ g.append('use').attr({
+ width: vboxSize,
+ height: vboxSize,
+ 'class': 'glyph',
+ 'xlink:href': '#' + gid
+ });
+}
function loadEmbeddedIcon(div, iconCls, size) {
loadIcon(div, iconCls, size, true);
diff --git a/web/gui/src/main/webapp/app/fw/widget/table.js b/web/gui/src/main/webapp/app/fw/widget/table.js
index d799946..1b999ae 100644
--- a/web/gui/src/main/webapp/app/fw/widget/table.js
+++ b/web/gui/src/main/webapp/app/fw/widget/table.js
@@ -21,51 +21,11 @@
'use strict';
var $log, $window, fs, is,
- div,
currCol = {},
prevCol = {},
- tableIconTdSize = 30,
+ tableIconTdSize = 33,
bottomMargin = 200;
-
- // Render a plain d3 table by giving it the div, a config file, and data
-
- function renderTable(div, config, data) {
- var table = div.append('table'),
- colIds = config.colIds,
- colText = config.colText,
- dataObjects = data[Object.keys(data)[0]],
- thead, tbody, tRows;
-
- thead = table.append('thead');
- tbody = table.append('tbody');
-
- thead.append('tr').selectAll('th')
- .data(colText)
- .enter()
- .append('th')
- .text(function(d) { return d });
-
- tRows = tbody.selectAll('tr')
- .data(dataObjects)
- .enter()
- .append('tr');
-
- tRows.selectAll('td')
- .data(function(row) {
- return colIds.map(function(headerId) {
- return {
- column: headerId, value: row[headerId]
- };
- });
- })
- .enter()
- .append('td')
- .html(function(d) { return d.value });
-
- return table;
- }
-
// Functions for creating a fixed header on a table (Angular Directive)
function setTableWidth(t) {
@@ -106,7 +66,10 @@
setTableHeight(th, tb);
}
+ // Functions for sorting table rows by header and choosing appropriate icon
+
function updateSortingIcons(thElem, api) {
+ var div;
currCol.colId = thElem.attr('colId');
if (currCol.colId === prevCol.colId) {
@@ -120,7 +83,7 @@
}
div = thElem.select('div');
- div.remove();
+ api.sortNone(div);
div = thElem.append('div');
if (currCol.icon === 'tableColSortAsc') {
@@ -151,15 +114,8 @@
}
angular.module('onosWidget')
- .factory('TableService', [function () {
- return {
- renderTable: renderTable
- };
- }])
-
- .directive('onosFixedHeader', ['$window', '$timeout',
- 'MastService', 'FnService',
- function (_$window_, $timeout, mast, _fs_) {
+ .directive('onosFixedHeader', ['$window', 'FnService',
+ function (_$window_, _fs_) {
return function (scope, element) {
$window = _$window_;
fs = _fs_;
@@ -206,7 +162,7 @@
scope: {
ctrlCallback: '&sortCallback'
},
- link: function (scope, element, attrs) {
+ link: function (scope, element) {
$log = _$log_;
is = _is_;
var table = d3.select(element[0]),
@@ -219,7 +175,6 @@
if (thElem.attr('sortable') === '') {
updateSortingIcons(thElem, sortIconAPI);
- // call the ctrl's rest callback function
scope.ctrlCallback({
urlSuffix: generateQueryParams()
});