Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tttttangTH committed Oct 3, 2020
1 parent 12d65fd commit 3178101
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 73 deletions.
2 changes: 1 addition & 1 deletion script/_nginx_configure → script/_nginx_server_install
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#

nginx_configure()
nginx_server_install()
{
if command -v nginx; then

Expand Down
2 changes: 1 addition & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ install_packages_rpm()

install_packages_brew()
{
brew install boost cmake cpputest dbus jsoncpp ninja nginx
brew install cmake cpputest dbus ninja nginx
}

install_packages_source()
Expand Down
4 changes: 2 additions & 2 deletions script/setup
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
. script/_swapfile
. script/_sudo_extend
. script/_disable_services
. script/_nginx_configure
. script/_nginx_server_install

main()
{
Expand All @@ -61,7 +61,7 @@ main()
dns64_install
network_manager_install
dhcpv6_pd_install
nginx_configure
nginx_server_install
otbr_install
. "$AFTER_HOOK"
}
Expand Down
1 change: 1 addition & 0 deletions src/rest/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ void Connection::ProcessWaitRead(fd_set &aReadFdSet)
// Check second failure situation : received = -1 error(indicates that our system call read raise an error )
// then try to send back a response that there is an internal error.
VerifyOrExit(received > 0 || (received == -1 && (err == EAGAIN || err == EWOULDBLOCK)), error = OTBR_ERROR_REST);

exit:

if (error != OTBR_ERROR_NONE)
Expand Down
8 changes: 4 additions & 4 deletions src/rest/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ <h4>Commission</h4>



<button ng-disabled="graphState == 1" class="mdl-button mdl-js-button mdl-button--raised" ng-click="showTopology()">Reload</button>
<button ng-disabled="topologyIsLoading" class="mdl-button mdl-js-button mdl-button--raised" ng-click="showTopology()">Reload</button>


</div>
Expand All @@ -343,18 +343,18 @@ <h4>Commission</h4>
</div>

<div class="mdl-graphs mdl-shadow--1dp mdl-cell mdl-cell--9-col" ng-show="menu[6].show">
<div ng-show="graphState==2" class="d3graph" id="topograph">
<div ng-show="topologyIsReady" class="d3graph" id="topograph">
</div>


<div ng-show="graphState==1" class="load_content">
<div ng-show="topologyIsLoading" class="load_content">
<div class="mdl-spinner mdl-js-spinner is-active"></div>


</div>

</div>
<div ng-show="graphState==2 && menu[6].show " class="demo-cards mdl-cell mdl-cell--top mdl-cell--3-col mdl-cell--8-col-tablet mdl-grid mdl-grid--no-spacing">
<div ng-show="topologyIsReady && menu[6].show " class="demo-cards mdl-cell mdl-cell--top mdl-cell--3-col mdl-cell--8-col-tablet mdl-grid mdl-grid--no-spacing">
<div class="demo-updates mdl-card mdl-shadow--1dp mdl-cell mdl-cell--3-col mdl-cell--3-col-tablet mdl-cell--12-col-desktop">
<div class="detailContainer">
<div class="detailElement" ng-if="isObject(detailList) && isObject(nodeDetailInfo) "ng-repeat="(key, data) in detailList track by $index">
Expand Down
95 changes: 45 additions & 50 deletions src/rest/frontend/res/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,24 @@
$scope.isLoading = false;

$scope.showScanAlert = function(ev,response) {
var text;
var alertMessage;
if (response.status == 200)
{
text = 'No available thread network now'
alertMessage = 'No available thread network now'
}
else
{
if ('ErrorDescription' in response.data)
{
text = response.data.ErrorDescription;
alertMessage = response.data.ErrorDescription;
}
else if ('ErorMessage' in response.data)
{
text= response.data.ErorMessage;
alertMessage= response.data.ErorMessage;
}
else
{
text = 'Undefined response';
alertMessage = 'Undefined response';
}
}

Expand All @@ -148,39 +148,39 @@
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('Information')
.textContent(text)
.textContent(alertMessage)
.ariaLabel('Alert Dialog Demo')
.ok('Okay')
);
};
$scope.showStatusAlert = function(ev,response) {
var text;
var alertMessage;
if ('ErrorDescription' in response.data)
{
text = response.data.ErrorDescription;
alertMessage = response.data.ErrorDescription;
}
else if ('ErrorMessage' in response.data)
{
text= response.data.ErrorMessage ;
alertMessage= response.data.ErrorMessage ;
}
else
{
text = 'Undefined response';
alertMessage = 'Undefined response';
}
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('Information')
.textContent(text)
.textContent(alertMessage)
.ariaLabel('Alert Dialog Demo')
.ok('Okay')
);
};

$scope.showPanels = function(index) {
$scope.headerTitle = $scope.menu[index].title;
for (var i = 0; i <= 6; i++) {
for (var i = 0; i < 7; i++) {
$scope.menu[i].show = false;
}
$scope.menu[index].show = true;
Expand Down Expand Up @@ -275,24 +275,24 @@

$scope.showAlert = function(ev, response) {

var text;
var alertMessage;
if (response.status == 200)
{
text = 'Successful'
alertMessage = 'Successful'
}
else
{
if ('ErrorDescription' in response.data)
{
text = response.data.ErrorDescription;
alertMessage = response.data.ErrorDescription;
}
else if ('ErorMessage' in response.data)
{
text= response.data.ErorMessage;
alertMessage= response.data.ErorMessage;
}
else
{
text = 'Failed bacause of Undefined response';
alertMessage = 'Failed bacause of Undefined response';
}
}

Expand All @@ -301,7 +301,7 @@
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('Information')
.textContent('Join operation is ' + text)
.textContent('Join operation is ' + alertMessage)
.ariaLabel('Alert Dialog Demo')
.ok('Okay')
.targetEvent(ev)
Expand Down Expand Up @@ -411,24 +411,24 @@
};

$scope.showAlert = function(ev, operation, response) {
var text;
var alertMessage;
if (response.status == 200)
{
text = 'Successful';
alertMessage = 'Successful';
}
else
{
if ('ErrorDescription' in response.data)
{
text = response.data.ErrorDescription;
alertMessage = response.data.ErrorDescription;
}
else if ('ErorMessage' in response.data)
{
text= response.data.ErorMessage;
alertMessage= response.data.ErorMessage;
}
else
{
text = 'Failed bacause of Undefined response';
alertMessage = 'Failed bacause of Undefined response';
}
}

Expand All @@ -437,7 +437,7 @@
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('Information')
.textContent(operation + ' operation is ' + text)
.textContent(operation + ' operation is ' + alertMessage)
.ariaLabel('Alert Dialog Demo')
.ok('Okay')
.targetEvent(ev)
Expand Down Expand Up @@ -524,16 +524,14 @@

httpRequest.then(function successCallback(response) {
$scope.showAlert(event, 'Commission', response);

ev.target.disabled = false;

}, function errorCallback(response){
$scope.showAlert(event, 'Commission', response);

});
};



// Basic information line
$scope.basicInfo = {
'NetworkName' : 'Unknown',
Expand All @@ -546,11 +544,8 @@
$scope.nodeDetailInfo = 'Unknown';
// For response of Diagnostic
$scope.networksDiagInfo = '';

// 0 : not call topology
// 1 : is loading
// 2 : topology is ready
$scope.graphState = 0;
$scope.topologyIsReady = false;
$scope.topologyIsLoading = false;

$scope.detailList = {
'ExtAddress': { 'title': false, 'content': true },
Expand Down Expand Up @@ -599,7 +594,7 @@
$scope.detailList[key]['content'] = !$scope.detailList[key]['content']
}

$scope.intToHexString = function(num , len){
$scope.intToHexString = function(num, len){
var value;
value = num.toString(16);

Expand All @@ -610,24 +605,24 @@
}

$scope.showTopologyAlert = function(ev,response) {
var text;
var alertMessage;
if (response.status == 200)
{
text = 'Empty diagnostic information returned, please check and try again later'
alertMessage = 'Empty diagnostic information returned, please check and try again later'
}
else
{
if ('ErrorDescription' in response.data)
{
text = response.data.ErrorDescription;
alertMessage = response.data.ErrorDescription;
}
else if ('ErorMessage' in response.data)
{
text= response.data.ErorMessage;
alertMessage= response.data.ErorMessage;
}
else
{
text = 'Undefined response';
alertMessage = 'Undefined response';
}
}

Expand All @@ -636,7 +631,7 @@
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('Information')
.textContent(text)
.textContent(alertMessage)
.ariaLabel('Alert Dialog Demo')
.ok('Okay')
);
Expand All @@ -645,7 +640,8 @@
$scope.showTopology = function(event) {

// Is loading
$scope.graphState = 1;
$scope.topologyIsLoading = true;
$scope.topologyIsReady = false;
$scope.graphInfo = {
'nodes': [],
'links': []
Expand All @@ -655,18 +651,21 @@
{
$scope.topology(response);
// Loads successfully
$scope.graphState = 2;
$scope.topologyIsLoading = false;
$scope.topologyIsReady = true;
}
else{
// Not show anything
$scope.graphState = 0;
$scope.topologyIsReady = false;
$scope.topologyIsLoading = false;
$scope.showTopologyAlert(event,response);
}
},
function errorCallback(response){
$scope.showTopologyAlert(event,response);
// Not show anything
$scope.graphState = 0;
$scope.topologyIsReady = false;
$scope.topologyIsLoading = false;
}


Expand Down Expand Up @@ -700,7 +699,7 @@
rloc = parseInt(diagOfNode['Rloc16'],16).toString(16);
nodeMap[rloc] = count;

if ( diagOfNode['RouteId'] == diagOfNode['LeaderData']['LeaderRouterId']) {
if (diagOfNode['RouteId'] == diagOfNode['LeaderData']['LeaderRouterId']) {
diagOfNode['Role'] = 'Leader';
}
else {
Expand All @@ -722,7 +721,7 @@
src = 0;

// Construct links
for (var diagOfNode of $scope.networksDiagInfo) {
for (diagOfNode of $scope.networksDiagInfo) {
if ('ChildTable' in diagOfNode) {
// Link bewtwen routers
for (linkNode of diagOfNode['Route']['RouteData']) {
Expand All @@ -733,8 +732,6 @@
$scope.graphInfo.links.push({
'source': src,
'target': dist,
'weight': 1,
'type': 0,
'linkInfo': {
'inQuality': linkNode['LinkQualityIn'],
'outQuality': linkNode['LinkQualityOut']
Expand All @@ -760,8 +757,6 @@
$scope.graphInfo.links.push({
'source': src,
'target': count,
'weight': 1,
'type': 1,
'linkInfo': {
'Timeout': childInfo['Timeout'],
'Mode': childInfo['Mode']
Expand Down Expand Up @@ -1028,7 +1023,7 @@
.style('stroke', '#f39191')
.style('stroke-width', '1px');
$scope.$apply(function() {
$scope.nodeDetailInfo = item ;
$scope.nodeDetailInfo = item;
$scope.updateDetailLabel();
});
});
Expand Down
Loading

0 comments on commit 3178101

Please sign in to comment.