mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
Only show address when connected (fixes #58)
The configured address is visible in the config dialog.
This commit is contained in:
parent
3a5b816125
commit
478300f6d8
File diff suppressed because one or more lines are too long
74
gui/app.js
74
gui/app.js
@ -1,7 +1,7 @@
|
|||||||
/*jslint browser: true, continue: true, plusplus: true */
|
/*jslint browser: true, continue: true, plusplus: true */
|
||||||
/*global $: false, angular: false */
|
/*global $: false, angular: false */
|
||||||
|
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
var syncthing = angular.module('syncthing', []);
|
var syncthing = angular.module('syncthing', []);
|
||||||
|
|
||||||
@ -11,24 +11,24 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
|
|
||||||
$scope.connections = {};
|
$scope.connections = {};
|
||||||
$scope.config = {};
|
$scope.config = {};
|
||||||
$scope.myID = "";
|
$scope.myID = '';
|
||||||
$scope.nodes = [];
|
$scope.nodes = [];
|
||||||
|
|
||||||
// Strings before bools look better
|
// Strings before bools look better
|
||||||
$scope.settings = [
|
$scope.settings = [
|
||||||
{id: 'ListenStr', descr: "Sync Protocol Listen Addresses", type: 'string', restart: true},
|
{id: 'ListenStr', descr: 'Sync Protocol Listen Addresses', type: 'string', restart: true},
|
||||||
{id: 'GUIAddress', descr: "GUI Listen Address", type: 'string', restart: true},
|
{id: 'GUIAddress', descr: 'GUI Listen Address', type: 'string', restart: true},
|
||||||
{id: 'MaxSendKbps', descr: "Outgoing Rate Limit (KBps)", type: 'string', restart: true},
|
{id: 'MaxSendKbps', descr: 'Outgoing Rate Limit (KBps)', type: 'string', restart: true},
|
||||||
{id: 'RescanIntervalS', descr: "Rescan Interval (s)", type: 'string', restart: true},
|
{id: 'RescanIntervalS', descr: 'Rescan Interval (s)', type: 'string', restart: true},
|
||||||
{id: 'ReconnectIntervalS', descr: "Reconnect Interval (s)", type: 'string', restart: true},
|
{id: 'ReconnectIntervalS', descr: 'Reconnect Interval (s)', type: 'string', restart: true},
|
||||||
{id: 'ParallelRequests', descr: "Max Outstanding Requests", type: 'string', restart: true},
|
{id: 'ParallelRequests', descr: 'Max Outstanding Requests', type: 'string', restart: true},
|
||||||
{id: 'MaxChangeKbps', descr: "Max File Change Rate (KBps)", type: 'string', restart: true},
|
{id: 'MaxChangeKbps', descr: 'Max File Change Rate (KBps)', type: 'string', restart: true},
|
||||||
|
|
||||||
{id: 'ReadOnly', descr: "Read Only", type: 'bool', restart: true},
|
{id: 'ReadOnly', descr: 'Read Only', type: 'bool', restart: true},
|
||||||
{id: 'AllowDelete', descr: "Allow Delete", type: 'bool', restart: true},
|
{id: 'AllowDelete', descr: 'Allow Delete', type: 'bool', restart: true},
|
||||||
{id: 'FollowSymlinks', descr: "Follow Symlinks", type: 'bool', restart: true},
|
{id: 'FollowSymlinks', descr: 'Follow Symlinks', type: 'bool', restart: true},
|
||||||
{id: 'GlobalAnnEnabled', descr: "Global Announce", type: 'bool', restart: true},
|
{id: 'GlobalAnnEnabled', descr: 'Global Announce', type: 'bool', restart: true},
|
||||||
{id: 'LocalAnnEnabled', descr: "Local Announce", type: 'bool', restart: true},
|
{id: 'LocalAnnEnabled', descr: 'Local Announce', type: 'bool', restart: true},
|
||||||
];
|
];
|
||||||
|
|
||||||
function modelGetSucceeded() {
|
function modelGetSucceeded() {
|
||||||
@ -58,16 +58,16 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
return a.NodeID > b.NodeID;
|
return a.NodeID > b.NodeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$http.get("/rest/version").success(function (data) {
|
$http.get('/rest/version').success(function (data) {
|
||||||
$scope.version = data;
|
$scope.version = data;
|
||||||
});
|
});
|
||||||
$http.get("/rest/system").success(function (data) {
|
$http.get('/rest/system').success(function (data) {
|
||||||
$scope.system = data;
|
$scope.system = data;
|
||||||
$scope.myID = data.myID;
|
$scope.myID = data.myID;
|
||||||
|
|
||||||
$http.get("/rest/config").success(function (data) {
|
$http.get('/rest/config').success(function (data) {
|
||||||
$scope.config = data;
|
$scope.config = data;
|
||||||
$scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(", ");
|
$scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(', ');
|
||||||
|
|
||||||
var nodes = $scope.config.Repositories[0].Nodes;
|
var nodes = $scope.config.Repositories[0].Nodes;
|
||||||
nodes.sort(nodeCompare);
|
nodes.sort(nodeCompare);
|
||||||
@ -76,16 +76,16 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.refresh = function () {
|
$scope.refresh = function () {
|
||||||
$http.get("/rest/system").success(function (data) {
|
$http.get('/rest/system').success(function (data) {
|
||||||
$scope.system = data;
|
$scope.system = data;
|
||||||
});
|
});
|
||||||
$http.get("/rest/model").success(function (data) {
|
$http.get('/rest/model').success(function (data) {
|
||||||
$scope.model = data;
|
$scope.model = data;
|
||||||
modelGetSucceeded();
|
modelGetSucceeded();
|
||||||
}).error(function () {
|
}).error(function () {
|
||||||
modelGetFailed();
|
modelGetFailed();
|
||||||
});
|
});
|
||||||
$http.get("/rest/connections").success(function (data) {
|
$http.get('/rest/connections').success(function (data) {
|
||||||
var now = Date.now(),
|
var now = Date.now(),
|
||||||
td = (now - prevDate) / 1000,
|
td = (now - prevDate) / 1000,
|
||||||
id;
|
id;
|
||||||
@ -105,15 +105,15 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
data[id].inbps = 0;
|
data[id].inbps = 0;
|
||||||
data[id].outbps = 0;
|
data[id].outbps = 0;
|
||||||
}
|
}
|
||||||
$scope.inbps += data[id].outbps;
|
$scope.inbps += data[id].inbps;
|
||||||
$scope.outbps += data[id].inbps;
|
$scope.outbps += data[id].outbps;
|
||||||
}
|
}
|
||||||
$scope.connections = data;
|
$scope.connections = data;
|
||||||
});
|
});
|
||||||
$http.get("/rest/need").success(function (data) {
|
$http.get('/rest/need').success(function (data) {
|
||||||
var i, name;
|
var i, name;
|
||||||
for (i = 0; i < data.length; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
name = data[i].Name.split("/");
|
name = data[i].Name.split('/');
|
||||||
data[i].ShortName = name[name.length - 1];
|
data[i].ShortName = name[name.length - 1];
|
||||||
}
|
}
|
||||||
data.sort(function (a, b) {
|
data.sort(function (a, b) {
|
||||||
@ -131,35 +131,35 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
|
|
||||||
$scope.nodeIcon = function (nodeCfg) {
|
$scope.nodeIcon = function (nodeCfg) {
|
||||||
if ($scope.connections[nodeCfg.NodeID]) {
|
if ($scope.connections[nodeCfg.NodeID]) {
|
||||||
return "ok";
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "minus";
|
return 'minus';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeStatus = function (nodeCfg) {
|
$scope.nodeStatus = function (nodeCfg) {
|
||||||
if ($scope.connections[nodeCfg.NodeID]) {
|
if ($scope.connections[nodeCfg.NodeID]) {
|
||||||
return "Connected";
|
return 'Connected';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Disconnected";
|
return 'Disconnected';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeIcon = function (nodeCfg) {
|
$scope.nodeIcon = function (nodeCfg) {
|
||||||
if ($scope.connections[nodeCfg.NodeID]) {
|
if ($scope.connections[nodeCfg.NodeID]) {
|
||||||
return "ok";
|
return 'ok';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "minus";
|
return 'minus';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeClass = function (nodeCfg) {
|
$scope.nodeClass = function (nodeCfg) {
|
||||||
var conn = $scope.connections[nodeCfg.NodeID];
|
var conn = $scope.connections[nodeCfg.NodeID];
|
||||||
if (conn) {
|
if (conn) {
|
||||||
return "success";
|
return 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
return "info";
|
return 'info';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeAddr = function (nodeCfg) {
|
$scope.nodeAddr = function (nodeCfg) {
|
||||||
@ -167,7 +167,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
if (conn) {
|
if (conn) {
|
||||||
return conn.Address;
|
return conn.Address;
|
||||||
}
|
}
|
||||||
return nodeCfg.Addresses.join(", ");
|
return '(unknown address)';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeVer = function (nodeCfg) {
|
$scope.nodeVer = function (nodeCfg) {
|
||||||
@ -178,7 +178,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
if (conn) {
|
if (conn) {
|
||||||
return conn.ClientVersion;
|
return conn.ClientVersion;
|
||||||
}
|
}
|
||||||
return "";
|
return '(unknown version)';
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nodeName = function (nodeCfg) {
|
$scope.nodeName = function (nodeCfg) {
|
||||||
@ -197,12 +197,12 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
|
|||||||
$scope.editNode = function (nodeCfg) {
|
$scope.editNode = function (nodeCfg) {
|
||||||
$scope.currentNode = nodeCfg;
|
$scope.currentNode = nodeCfg;
|
||||||
$scope.editingExisting = true;
|
$scope.editingExisting = true;
|
||||||
$scope.currentNode.AddressesStr = nodeCfg.Addresses.join(", ");
|
$scope.currentNode.AddressesStr = nodeCfg.Addresses.join(', ');
|
||||||
$('#editNode').modal({backdrop: 'static', keyboard: false});
|
$('#editNode').modal({backdrop: 'static', keyboard: false});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addNode = function () {
|
$scope.addNode = function () {
|
||||||
$scope.currentNode = {NodeID: "", AddressesStr: "dynamic"};
|
$scope.currentNode = {NodeID: '', AddressesStr: 'dynamic'};
|
||||||
$scope.editingExisting = false;
|
$scope.editingExisting = false;
|
||||||
$('#editNode').modal({backdrop: 'static', keyboard: false});
|
$('#editNode').modal({backdrop: 'static', keyboard: false});
|
||||||
};
|
};
|
||||||
|
@ -40,6 +40,10 @@ html, body {
|
|||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thead tr th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -76,7 +80,7 @@ html, body {
|
|||||||
<tbody>
|
<tbody>
|
||||||
<!-- myself -->
|
<!-- myself -->
|
||||||
<tr class="text-muted" ng-repeat="nodeCfg in thisNode()">
|
<tr class="text-muted" ng-repeat="nodeCfg in thisNode()">
|
||||||
<td style="width:13%">
|
<td style="width:13%" class="text-center">
|
||||||
<span class="label label-default">
|
<span class="label label-default">
|
||||||
<span class="glyphicon glyphicon-ok"></span> This node
|
<span class="glyphicon glyphicon-ok"></span> This node
|
||||||
</span>
|
</span>
|
||||||
@ -85,18 +89,14 @@ html, body {
|
|||||||
<span class="text-monospace">{{nodeName(nodeCfg)}}</span>
|
<span class="text-monospace">{{nodeName(nodeCfg)}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="width:20%">{{version}}</td>
|
<td style="width:20%">{{version}}</td>
|
||||||
<td style="width:25%"></td>
|
<td style="width:25%">(this node)</td>
|
||||||
<td style="width:10%" class="text-right">
|
<td style="width:10%" class="text-right">
|
||||||
<span ng-show="nodeCfg.NodeID != myID">
|
{{inbps | metric}}bps
|
||||||
{{inbps | metric}}bps
|
<span class="text-muted glyphicon glyphicon-chevron-down"></span>
|
||||||
<span class="text-muted glyphicon glyphicon-chevron-down"></span>
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td style="width:10%" class="text-right">
|
<td style="width:10%" class="text-right">
|
||||||
<span ng-show="nodeCfg.NodeID != myID">
|
{{outbps | metric}}bps
|
||||||
{{outbps | metric}}bps
|
<span class="text-muted glyphicon glyphicon-chevron-up"></span>
|
||||||
<span class="text-muted glyphicon glyphicon-chevron-up"></span>
|
|
||||||
</span>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<button type="button" ng-click="editNode(nodeCfg)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
|
<button type="button" ng-click="editNode(nodeCfg)" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-pencil"></span> Edit</button>
|
||||||
@ -104,7 +104,7 @@ html, body {
|
|||||||
</tr>
|
</tr>
|
||||||
<!-- all other nodes -->
|
<!-- all other nodes -->
|
||||||
<tr ng-repeat="nodeCfg in otherNodes()">
|
<tr ng-repeat="nodeCfg in otherNodes()">
|
||||||
<td>
|
<td class="text-center">
|
||||||
<span class="label label-{{nodeClass(nodeCfg)}}">
|
<span class="label label-{{nodeClass(nodeCfg)}}">
|
||||||
<span class="glyphicon glyphicon-{{nodeIcon(nodeCfg)}}"></span> {{nodeStatus(nodeCfg)}}
|
<span class="glyphicon glyphicon-{{nodeIcon(nodeCfg)}}"></span> {{nodeStatus(nodeCfg)}}
|
||||||
</span>
|
</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user