Give friendly names to nodes (fixes #54)

This commit is contained in:
Jakob Borg 2014-02-05 22:49:26 +01:00
parent ea41acfff5
commit 2297e29502
4 changed files with 15 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,7 @@ type RepositoryConfiguration struct {
type NodeConfiguration struct { type NodeConfiguration struct {
NodeID string `xml:"id,attr"` NodeID string `xml:"id,attr"`
Name string `xml:"name,attr"`
Addresses []string `xml:"address"` Addresses []string `xml:"address"`
} }

View File

@ -162,6 +162,13 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
return ""; return "";
}; };
$scope.nodeName = function (nodeCfg) {
if (nodeCfg.Name) {
return nodeCfg.Name;
}
return nodeCfg.NodeID.substr(0, 6);
};
$scope.saveSettings = function () { $scope.saveSettings = function () {
$http.post('/rest/config', JSON.stringify($scope.config), {headers: {'Content-Type': 'application/json'}}); $http.post('/rest/config', JSON.stringify($scope.config), {headers: {'Content-Type': 'application/json'}});
$('#settingsTable').collapse('hide'); $('#settingsTable').collapse('hide');

View File

@ -108,7 +108,7 @@ html, body {
</span> </span>
</td> </td>
<td> <td>
<span class="text-monospace">{{nodeCfg.NodeID | short}}</span> <span class="text-monospace">{{nodeName(nodeCfg)}}</span>
</td> </td>
<td> <td>
{{nodeVer(nodeCfg)}} {{nodeVer(nodeCfg)}}
@ -241,6 +241,11 @@ html, body {
<input placeholder="YUFJOUDPORCMA..." ng-disabled="editingExisting" id="nodeID" class="form-control" type="text" ng-model="currentNode.NodeID"></input> <input placeholder="YUFJOUDPORCMA..." ng-disabled="editingExisting" id="nodeID" class="form-control" type="text" ng-model="currentNode.NodeID"></input>
<p class="help-block">The node ID can be found in the logs or in the "Add Node" dialog on the other node.</p> <p class="help-block">The node ID can be found in the logs or in the "Add Node" dialog on the other node.</p>
</div> </div>
<div class="form-group">
<label for="name">Name</label>
<input placeholder="Home Server" id="name" class="form-control" type="text" ng-model="currentNode.Name"></input>
<p class="help-block">Shown instead of Node ID in the cluster status.</p>
</div>
<div class="form-group"> <div class="form-group">
<label for="addresses">Addresses</label> <label for="addresses">Addresses</label>
<input placeholder="dynamic" id="addresses" class="form-control" type="text" ng-model="currentNode.AddressesStr"></input> <input placeholder="dynamic" id="addresses" class="form-control" type="text" ng-model="currentNode.AddressesStr"></input>