summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-04-14 09:58:17 +0200
committerJakob Borg <jakob@nym.se>2014-04-14 09:58:17 +0200
commit48bfc2d9ede88ebfdda6ff486e91c0f35ba6a565 (patch)
tree8009fbf24406f86873e21733f07fe7b7ce7fe721 /gui
parent5064f846fcea48a866da1551d01730dc64fb3cc8 (diff)
Show current repository state (fixes #89)
Diffstat (limited to 'gui')
-rw-r--r--gui/app.js30
-rw-r--r--gui/index.html7
2 files changed, 33 insertions, 4 deletions
diff --git a/gui/app.js b/gui/app.js
index ffe98dd08d..98dfbd5788 100644
--- a/gui/app.js
+++ b/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;
diff --git a/gui/index.html b/gui/index.html
index cce0ecdf38..14ddc50cbc 100644
--- a/gui/index.html
+++ b/gui/index.html
@@ -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>