11454: Removed unnecessary call on migrateNonFederatedSessions()
[arvados.git] / apps / workbench / app / assets / javascripts / models / session_db.js
index 26306b8b104e3d762281bbc50cdefb9e6e7907c8..2d22a98958b2129025c83bd7521aaa6903e91ff2 100644 (file)
@@ -238,5 +238,23 @@ window.SessionDB = function() {
                 }
             })
         },
+        // If remoteHosts is listed on the local API discovery doc, try to add any
+        // listed remote without an active session.
+        autoLoadRemoteHosts: function() {
+            var activeSessions = db.loadActive()
+            var doc = db.discoveryDoc(db.loadLocal())
+            doc.map(function(d) {
+                // NOTE: the below line is to simulate that 9tee4 is included as a remote host
+                // the current test cluster
+                // d.remoteHosts = {"9tee4":"9tee4.arvadosapi.com"}
+                Object.keys(d.remoteHosts).map(function(uuidPrefix) {
+                    if (!(uuidPrefix in Object.keys(activeSessions))) {
+                        db.findAPI(d.remoteHosts[uuidPrefix]).then(function(baseURL) {
+                            db.login(baseURL, false)
+                        })
+                    }
+                })
+            })
+        },
     })
 }