Show current repository state (fixes #89)
This commit is contained in:
30
gui/app.js
30
gui/app.js
@@ -108,6 +108,36 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
||||
});
|
||||
};
|
||||
|
||||
$scope.repoStatus = function (repo) {
|
||||
if (typeof $scope.model[repo] === 'undefined') {
|
||||
return 'Unknown';
|
||||
}
|
||||
|
||||
var state = '' + $scope.model[repo].state;
|
||||
state = state[0].toUpperCase() + state.substr(1);
|
||||
|
||||
if (state == "Syncing" || state == "Idle") {
|
||||
state += " (" + $scope.syncPercentage(repo) + "%)";
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
$scope.repoClass = function (repo) {
|
||||
if (typeof $scope.model[repo] === 'undefined') {
|
||||
return 'text-info';
|
||||
}
|
||||
|
||||
var state = '' + $scope.model[repo].state;
|
||||
if (state == 'idle') {
|
||||
return 'text-success';
|
||||
}
|
||||
if (state == 'syncing') {
|
||||
return 'text-primary';
|
||||
}
|
||||
return 'text-info';
|
||||
}
|
||||
|
||||
$scope.syncPercentage = function (repo) {
|
||||
if (typeof $scope.model[repo] === 'undefined') {
|
||||
return 100;
|
||||
|
||||
@@ -137,9 +137,8 @@
|
||||
<span class="data">{{repo.ID}}</span>
|
||||
</div>
|
||||
<div class="li-column">
|
||||
<span class="text-muted glyphicon glyphicon-home"></span>
|
||||
<span class="data text-success" ng-show="syncPercentage(repo.ID) == 100">In Sync</span>
|
||||
<span class="data text-primary" ng-hide="syncPercentage(repo.ID) == 100">Syncing ({{syncPercentage(repo.ID)}}%)</span>
|
||||
<span class="text-muted glyphicon glyphicon-comment"></span>
|
||||
<span class="data" ng-class="repoClass(repo.ID)">{{repoStatus(repo.ID)}}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
@@ -191,7 +190,7 @@
|
||||
<span class="data">{{nodeAddr(nodeCfg)}}</span>
|
||||
</div>
|
||||
<div class="li-column">
|
||||
<span class="text-muted glyphicon glyphicon-dashboard"></span>
|
||||
<span class="text-muted glyphicon glyphicon-comment"></span>
|
||||
<span class="data text-{{nodeClass(nodeCfg)}}">{{nodeStatus(nodeCfg)}}</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user