mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
parent
739e99c4d9
commit
7669af578a
@ -190,7 +190,7 @@
|
||||
|
||||
<!-- Panel: New Device -->
|
||||
|
||||
<div ng-repeat="pendingDevice in config.pendingDevices" class="row">
|
||||
<div ng-repeat="(deviceID, pendingDevice) in pendingDevices" class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
@ -202,17 +202,17 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<span translate translate-value-device="{{ pendingDevice.deviceID }}" translate-value-address="{{ pendingDevice.address }}" translate-value-name="{{ pendingDevice.name }}">
|
||||
<span translate translate-value-device="{{ deviceID }}" translate-value-address="{{ pendingDevice.address }}" translate-value-name="{{ pendingDevice.name }}">
|
||||
Device "{%name%}" ({%device%} at {%address%}) wants to connect. Add new device?
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="addDevice(pendingDevice.deviceID, pendingDevice.name)">
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="addDevice(deviceID, pendingDevice.name)">
|
||||
<span class="fas fa-plus"></span> <span translate>Add Device</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-danger" ng-click="ignoreDevice(pendingDevice)">
|
||||
<button type="button" class="btn btn-sm btn-danger" ng-click="ignoreDevice(deviceID, pendingDevice)">
|
||||
<span class="fas fa-times"></span> <span translate>Ignore</span>
|
||||
</button>
|
||||
</div>
|
||||
@ -222,8 +222,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Panel: New Folder -->
|
||||
<div ng-repeat="device in config.devices">
|
||||
<div ng-repeat="pendingFolder in device.pendingFolders" class="row reject">
|
||||
<div ng-repeat="(folderID, pendingFolder) in pendingFolders">
|
||||
<div ng-repeat="(deviceID, offeringDevice) in pendingFolder.offeredBy" class="row reject">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-warning">
|
||||
<div class="panel-heading">
|
||||
@ -231,32 +231,32 @@
|
||||
<div class="panel-icon">
|
||||
<span class="fas fa-folder"></span>
|
||||
</div>
|
||||
<span translate ng-if="!folders[pendingFolder.id]">New Folder</span>
|
||||
<span translate ng-if="folders[pendingFolder.id]">Share Folder</span>
|
||||
<span class="pull-right">{{ pendingFolder.time | date:"yyyy-MM-dd HH:mm:ss" }}</span>
|
||||
<span translate ng-if="!folders[folderID]">New Folder</span>
|
||||
<span translate ng-if="folders[folderID]">Share Folder</span>
|
||||
<span class="pull-right">{{ offeringDevice.time | date:"yyyy-MM-dd HH:mm:ss" }}</span>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<span ng-if="pendingFolder.label.length == 0" translate translate-value-device="{{ deviceName(devices[device.deviceID]) }}" translate-value-folder="{{ pendingFolder.id }}">
|
||||
<span ng-if="offeringDevice.label.length == 0" translate translate-value-device="{{ deviceName(devices[deviceID]) }}" translate-value-folder="{{ folderID }}">
|
||||
{%device%} wants to share folder "{%folder%}".
|
||||
</span>
|
||||
<span ng-if="pendingFolder.label.length != 0" translate translate-value-device="{{ deviceName(devices[device.deviceID]) }}" translate-value-folder="{{ pendingFolder.id }}" translate-value-folderlabel="{{ pendingFolder.label }}">
|
||||
<span ng-if="offeringDevice.label.length != 0" translate translate-value-device="{{ deviceName(devices[deviceID]) }}" translate-value-folder="{{ folderID }}" translate-value-folderlabel="{{ offeringDevice.label }}">
|
||||
{%device%} wants to share folder "{%folderlabel%}" ({%folder%}).
|
||||
</span>
|
||||
<span translate ng-if="folders[pendingFolder.id]">Share this folder?</span>
|
||||
<span translate ng-if="!folders[pendingFolder.id]">Add new folder?</span>
|
||||
<span translate ng-if="folders[folderID]">Share this folder?</span>
|
||||
<span translate ng-if="!folders[folderID]">Add new folder?</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel-footer clearfix">
|
||||
<div class="pull-right">
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="addFolderAndShare(pendingFolder.id, pendingFolder.label, device.deviceID)" ng-if="!folders[pendingFolder.id]">
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="addFolderAndShare(folderID, offeringDevice.label, deviceID)" ng-if="!folders[folderID]">
|
||||
<span class="fas fa-check"></span> <span translate>Add</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="shareFolderWithDevice(pendingFolder.id, device.deviceID)" ng-if="folders[pendingFolder.id]">
|
||||
<button type="button" class="btn btn-sm btn-success" ng-click="shareFolderWithDevice(folderID, deviceID)" ng-if="folders[folderID]">
|
||||
<span class="fas fa-check"></span> <span translate>Share</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-danger" ng-click="ignoreFolder(device.deviceID, pendingFolder)">
|
||||
<button type="button" class="btn btn-sm btn-danger" ng-click="ignoreFolder(deviceID, folderID, offeringDevice)">
|
||||
<span class="fas fa-times"></span> <span translate>Ignore</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -38,6 +38,8 @@ angular.module('syncthing.core')
|
||||
$scope.upgradeInfo = null;
|
||||
$scope.deviceStats = {};
|
||||
$scope.folderStats = {};
|
||||
$scope.pendingDevices = {};
|
||||
$scope.pendingFolders = {};
|
||||
$scope.progress = {};
|
||||
$scope.version = {};
|
||||
$scope.needed = {}
|
||||
@ -242,6 +244,34 @@ angular.module('syncthing.core')
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on(Events.DEVICE_REJECTED, function (event, arg) {
|
||||
var pendingDevice = {
|
||||
time: arg.time,
|
||||
name: arg.data.name,
|
||||
address: arg.data.address
|
||||
};
|
||||
console.log("rejected device:", arg.data.device, pendingDevice);
|
||||
|
||||
$scope.pendingDevices[arg.data.device] = pendingDevice;
|
||||
});
|
||||
|
||||
$scope.$on(Events.FOLDER_REJECTED, function (event, arg) {
|
||||
var offeringDevice = {
|
||||
time: arg.time,
|
||||
label: arg.data.folderLabel
|
||||
};
|
||||
console.log("rejected folder", arg.data.folder, "from device:", arg.data.device, offeringDevice);
|
||||
|
||||
var pendingFolder = $scope.pendingFolders[arg.data.folder];
|
||||
if (pendingFolder === undefined) {
|
||||
pendingFolder = {
|
||||
offeredBy: {}
|
||||
};
|
||||
}
|
||||
pendingFolder.offeredBy[arg.data.device] = offeringDevice;
|
||||
$scope.pendingFolders[arg.data.folder] = pendingFolder;
|
||||
});
|
||||
|
||||
$scope.$on('ConfigLoaded', function () {
|
||||
if ($scope.config.options.urAccepted === 0) {
|
||||
// If usage reporting has been neither accepted nor declined,
|
||||
@ -391,6 +421,7 @@ angular.module('syncthing.core')
|
||||
});
|
||||
});
|
||||
|
||||
refreshCluster();
|
||||
refreshNoAuthWarning();
|
||||
setDefaultTheme();
|
||||
|
||||
@ -455,6 +486,16 @@ angular.module('syncthing.core')
|
||||
}
|
||||
}
|
||||
|
||||
function refreshCluster() {
|
||||
$http.get(urlbase + '/cluster/pending/devices').success(function (data) {
|
||||
$scope.pendingDevices = data;
|
||||
console.log("refreshCluster devices", data);
|
||||
}).error($scope.emitHTTPError);
|
||||
$http.get(urlbase + '/cluster/pending/folders').success(function (data) {
|
||||
$scope.pendingFolders = data;
|
||||
console.log("refreshCluster folders", data);
|
||||
}).error($scope.emitHTTPError);
|
||||
}
|
||||
|
||||
function refreshDiscoveryCache() {
|
||||
$http.get(urlbase + '/system/discovery').success(function (data) {
|
||||
@ -1016,7 +1057,6 @@ angular.module('syncthing.core')
|
||||
|
||||
// loop through all devices
|
||||
var deviceCount = 0;
|
||||
var pendingFolders = 0;
|
||||
for (var id in $scope.devices) {
|
||||
var status = $scope.deviceStatus({
|
||||
deviceID: id
|
||||
@ -1032,14 +1072,11 @@ angular.module('syncthing.core')
|
||||
deviceCount--;
|
||||
break;
|
||||
}
|
||||
pendingFolders += $scope.devices[id].pendingFolders.length;
|
||||
deviceCount++;
|
||||
}
|
||||
|
||||
// enumerate notifications
|
||||
if ($scope.openNoAuth || !$scope.configInSync || $scope.errorList().length > 0 || !online || (
|
||||
!isEmptyObject($scope.config) && ($scope.config.pendingDevices.length > 0 || pendingFolders > 0)
|
||||
)) {
|
||||
if ($scope.openNoAuth || !$scope.configInSync || $scope.errorList().length > 0 || !online || Object.keys($scope.pendingDevices).length > 0 || Object.keys($scope.pendingFolders).length > 0) {
|
||||
notifyCount++;
|
||||
}
|
||||
|
||||
@ -1487,7 +1524,6 @@ angular.module('syncthing.core')
|
||||
_addressesStr: 'dynamic',
|
||||
compression: 'metadata',
|
||||
introducer: false,
|
||||
pendingFolders: [],
|
||||
ignoredFolders: []
|
||||
};
|
||||
$scope.editingExisting = false;
|
||||
@ -1563,11 +1599,12 @@ angular.module('syncthing.core')
|
||||
$scope.saveConfig();
|
||||
};
|
||||
|
||||
$scope.ignoreDevice = function (pendingDevice) {
|
||||
pendingDevice = angular.copy(pendingDevice);
|
||||
$scope.ignoreDevice = function (deviceID, pendingDevice) {
|
||||
var ignoredDevice = angular.copy(pendingDevice);
|
||||
ignoredDevice.deviceID = deviceID;
|
||||
// Bump time
|
||||
pendingDevice.time = (new Date()).toISOString();
|
||||
$scope.config.remoteIgnoredDevices.push(pendingDevice);
|
||||
ignoredDevice.time = (new Date()).toISOString();
|
||||
$scope.config.remoteIgnoredDevices.push(ignoredDevice);
|
||||
$scope.saveConfig();
|
||||
};
|
||||
|
||||
@ -1973,13 +2010,16 @@ angular.module('syncthing.core')
|
||||
});
|
||||
};
|
||||
|
||||
$scope.ignoreFolder = function (device, pendingFolder) {
|
||||
pendingFolder = angular.copy(pendingFolder);
|
||||
// Bump time
|
||||
pendingFolder.time = (new Date()).toISOString();
|
||||
$scope.ignoreFolder = function (device, folderID, offeringDevice) {
|
||||
var ignoredFolder = {
|
||||
id: folderID,
|
||||
label: offeringDevice.label,
|
||||
// Bump time
|
||||
time: (new Date()).toISOString()
|
||||
}
|
||||
|
||||
if (device in $scope.devices) {
|
||||
$scope.devices[device].ignoredFolders.push(pendingFolder);
|
||||
if (id in $scope.devices) {
|
||||
$scope.devices[id].ignoredFolders.push(ignoredFolder);
|
||||
$scope.saveConfig();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user