Bri Prebilic Cole

ONOS-2074, ONOS-2075 - GUI -- App View Control Button state and icon bug fixes.

Change-Id: Icdaf5ca57963c6e4f30618cb6468c980ac3a786d
......@@ -72,8 +72,11 @@
iconSize: '@'
},
link: function (scope, element, attrs) {
is.loadEmbeddedIcon(d3.select(element[0]),
scope.iconId, scope.iconSize);
attrs.$observe('iconId', function () {
var div = d3.select(element[0]);
div.selectAll('*').remove();
is.loadEmbeddedIcon(div, scope.iconId, scope.iconSize);
});
}
};
}])
......
......@@ -56,7 +56,7 @@
</td>
</tr>
<tr ng-repeat="app in tableData track by app.id"
<tr ng-repeat="app in tableData"
ng-click="selectCallback($event, app)"
ng-class="{selected: app.id === selId}"
ng-repeat-done>
......
......@@ -33,7 +33,6 @@
'FnService', 'TableBuilderService', 'WebSocketService', 'UrlFnService',
function ($log, $scope, $http, fs, tbs, wss, ufs) {
var refreshCtrls;
$scope.ctrlBtnState = {};
function selCb($event, row) {
......@@ -41,28 +40,28 @@
$scope.ctrlBtnState.selection = !!$scope.selId;
$log.debug('Got a click on:', row);
refreshCtrls = function () {
refreshCtrls();
}
function refreshCtrls() {
var row, rowIdx;
if ($scope.ctrlBtnState.selection) {
$scope.ctrlBtnState.installed = row.state === INSTALLED;
$scope.ctrlBtnState.active = row.state === ACTIVE;
rowIdx = fs.find($scope.selId, $scope.tableData);
row = rowIdx >= 0 ? $scope.tableData[rowIdx] : null;
$scope.ctrlBtnState.installed = row && row.state === INSTALLED;
$scope.ctrlBtnState.active = row && row.state === ACTIVE;
} else {
$scope.ctrlBtnState.installed = false;
$scope.ctrlBtnState.active = false;
}
};
refreshCtrls();
}
function respCb() {
refreshCtrls && refreshCtrls();
}
tbs.buildTable({
scope: $scope,
tag: 'app',
selCb: selCb,
respCb: respCb
respCb: refreshCtrls
});
$scope.appAction = function (action) {
......@@ -85,14 +84,9 @@
'Content-Type': undefined
}
})
// TODO: look for finally function to combine lines
// TODO: reexamine reset input value
.success(function () {
.finally(function () {
$scope.sortCallback($scope.sortParams);
document.getElementById('inputFileForm').reset();
})
.error(function () {
$scope.sortCallback($scope.sortParams);
});
}
});
......