From 8c4723ff430f79184b17de3033950482d6d9cda0 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Wed, 1 Jun 2016 20:24:43 +0000 Subject: [PATCH] gui: Fix editing devices (fixes #3236) GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3237 --- gui/default/index.html | 2 +- gui/default/syncthing/core/syncthingController.js | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/default/index.html b/gui/default/index.html index 7cbc90e7c..f4a13660f 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -539,7 +539,7 @@  Folders - {{deviceFolders(deviceCfg).join(", ")}} + {{deviceFolders(deviceCfg).map(folderLabel).join(", ")}} diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 0d058c5da..8ac4b1771 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -784,7 +784,7 @@ angular.module('syncthing.core') var syncCount = 0; var notifyCount = 0; var pauseCount = 0; - + // loop through all folders var folderListCache = $scope.folderList(); for (var i = 0; i < folderListCache.length; i++) { @@ -835,12 +835,12 @@ angular.module('syncthing.core') if (notifyCount > 0) { return 'notify'; } - + // all used devices are paused except (this) one if (pauseCount === deviceCount-1) { return 'pause'; } - + return 'default'; }; @@ -1406,8 +1406,7 @@ angular.module('syncthing.core') var devices = $scope.folders[folderID].devices; for (var i = 0; i < devices.length; i++) { if (devices[i].deviceID === deviceCfg.deviceID) { - var label = $scope.folders[folderID].label; - folders.push(label.length > 0 ? label : folderID); + folders.push(folderID); break; } } @@ -1417,6 +1416,11 @@ angular.module('syncthing.core') return folders; }; + $scope.folderLabel = function (folderID) { + var label = $scope.folders[folderID].label; + return label.length > 0 ? label : folderID; + } + $scope.deleteFolder = function (id) { $('#editFolder').modal('hide'); if (!$scope.editingExisting) {