Mark unshared folders as 'Unshared' and in warning color (fixes #962)

This commit is contained in:
Jakob Borg 2014-11-29 09:18:52 +01:00
parent 254c63763a
commit 2926bbfe15
4 changed files with 26 additions and 13 deletions

View File

@ -130,6 +130,7 @@
"The rescan interval must be a non-negative number of seconds.": "The rescan interval must be a non-negative number of seconds.",
"The rescan interval must be at least 5 seconds.": "The rescan interval must be at least 5 seconds.",
"Unknown": "Unknown",
"Unshared": "Unshared",
"Up to Date": "Up to Date",
"Upgrade To {%version%}": "Upgrade To {{version}}",
"Upgrading": "Upgrading",

View File

@ -89,12 +89,13 @@
<div class="col-md-6">
<div class="panel-group" id="folders">
<div class="panel panel-{{folderClass(folder.ID)}}" ng-repeat="folder in folderList()">
<div class="panel panel-{{folderClass(folder)}}" ng-repeat="folder in folderList()">
<div class="panel-heading" data-toggle="collapse" data-parent="#folders" href="#folder-{{$index}}" style="cursor: pointer">
<h3 class="panel-title">
<span class="glyphicon glyphicon-hdd"></span>&emsp;{{folder.ID}}
<span class="pull-right hidden-xs" ng-switch="folderStatus(folder.ID)">
<span class="pull-right hidden-xs" ng-switch="folderStatus(folder)">
<span translate ng-switch-when="unknown">Unknown</span>
<span translate ng-switch-when="unshared">Unshared</span>
<span translate ng-switch-when="stopped">Stopped</span>
<span translate ng-switch-when="scanning">Scanning</span>
<span ng-switch-when="syncing">

View File

@ -397,28 +397,39 @@ angular.module('syncthing.core')
refreshErrors();
};
$scope.folderStatus = function (folder) {
if (typeof $scope.model[folder] === 'undefined') {
$scope.folderStatus = function (folderCfg) {
if (typeof $scope.model[folderCfg.ID] === 'undefined') {
return 'unknown';
}
if ($scope.model[folder].invalid !== '') {
if (folderCfg.Devices.length <= 1) {
return 'unshared';
}
if ($scope.model[folderCfg.ID].invalid !== '') {
return 'stopped';
}
return '' + $scope.model[folder].state;
return '' + $scope.model[folderCfg.ID].state;
};
$scope.folderClass = function (folder) {
if (typeof $scope.model[folder] === 'undefined') {
$scope.folderClass = function (folderCfg) {
if (typeof $scope.model[folderCfg.ID] === 'undefined') {
// Unknown
return 'info';
}
if ($scope.model[folder].invalid !== '') {
if (folderCfg.Devices.length <= 1) {
// Unshared
return 'warning';
}
if ($scope.model[folderCfg.ID].invalid !== '') {
// Errored
return 'danger';
}
var state = '' + $scope.model[folder].state;
var state = '' + $scope.model[folderCfg.ID].state;
if (state == 'idle') {
return 'success';
}

File diff suppressed because one or more lines are too long