Browse Source

Give friendly names to nodes (fixes #54)

Jakob Borg 11 years ago
parent
commit
2297e29502
4 changed files with 14 additions and 1 deletions
  1. 0 0
      auto/gui.files.go
  2. 1 0
      config.go
  3. 7 0
      gui/app.js
  4. 6 1
      gui/index.html

File diff suppressed because it is too large
+ 0 - 0
auto/gui.files.go


+ 1 - 0
config.go

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

+ 7 - 0
gui/app.js

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

+ 6 - 1
gui/index.html

@@ -108,7 +108,7 @@ html, body {
                                 </span>
                             </td>
                             <td>
-                                <span class="text-monospace">{{nodeCfg.NodeID | short}}</span>
+                                <span class="text-monospace">{{nodeName(nodeCfg)}}</span>
                             </td>
                             <td>
                                 {{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>
                         <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 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">
                         <label for="addresses">Addresses</label>
                         <input placeholder="dynamic" id="addresses" class="form-control" type="text" ng-model="currentNode.AddressesStr"></input>

Some files were not shown because too many files changed in this diff