GUI -- Removed onos-fixed-header redundancies, wrote unit tests for fixed-header and sortable-header directives.
Change-Id: Iccf9348a4697f494a4234b024781fede0719491d
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 1b999ae..dbfcfed 100644
--- a/web/gui/src/main/webapp/app/fw/widget/table.js
+++ b/web/gui/src/main/webapp/app/fw/widget/table.js
@@ -34,7 +34,7 @@
tHeaders = t.selectAll('th');
numCols = tHeaders[0].length;
- colWidth = Math.floor(winWidth/numCols);
+ colWidth = Math.floor(winWidth / numCols);
tHeaders.each(function(thElement, index) {
thElement = d3.select(this);
@@ -121,7 +121,9 @@
fs = _fs_;
var w = angular.element($window),
table = d3.select(element[0]),
- shouldResize = false;
+ thead = table.select('thead'),
+ tbody = table.select('tbody'),
+ canAdjust = false;
scope.$watch(function () {
return {
@@ -129,31 +131,24 @@
w: window.innerWidth
};
}, function (newVal) {
- var thead = table.select('thead'),
- tbody = table.select('tbody');
-
scope.windowHeight = newVal.h;
scope.windowWidth = newVal.w;
- scope.setTableHW = function () {
- scope.$on('LastElement', function (event) {
- // only adjust the table once it's completely loaded
- fixTable(table, thead, tbody);
- shouldResize = true;
- });
- };
+ scope.$on('LastElement', function () {
+ // only adjust the table once it's completely loaded
+ fixTable(table, thead, tbody);
+ canAdjust = true;
+ });
- if (shouldResize) {
+ if (canAdjust) {
fixTable(table, thead, tbody);
}
-
}, true);
w.bind('onos-fixed-header', function () {
scope.$apply();
});
};
-
}])
.directive('onosSortableHeader', ['$log', 'IconService',
diff --git a/web/gui/src/main/webapp/app/view/device/device.html b/web/gui/src/main/webapp/app/view/device/device.html
index 5f7f5cc..cff0845 100644
--- a/web/gui/src/main/webapp/app/view/device/device.html
+++ b/web/gui/src/main/webapp/app/view/device/device.html
@@ -3,7 +3,6 @@
<h2>Devices ({{ctrl.deviceData.length}} total)</h2>
<table class="summary-list"
onos-fixed-header
- ng-style="setTableHW()"
onos-sortable-header
sort-callback="sortCallback(urlSuffix)">
<thead>