lib/redis-browser/templates/coffee/app.coffee in redis-browser-0.3.0 vs lib/redis-browser/templates/coffee/app.coffee in redis-browser-0.3.1

- old
+ new

@@ -17,12 +17,12 @@ document.getElementById('http-loader').style.display = "none" response ] app.factory 'API', ['$http', ($http) -> - (connection, database) -> - ps = {connection: connection, database: database} + (connection) -> + ps = {connection: connection} { ping: () -> $http.get("#{jsEnv.root_path}ping.json", { params: ps }).then (e) -> e.data, @@ -57,33 +57,32 @@ # Init variables $scope.keys = [] $scope.key = {type: "empty"} $scope.list = {} + $scope.connections = jsEnv.connections + $scope.config = {connection: jsEnv.connection} db = localStorageService $scope.config = - connection: db.get("connection") || "127.0.0.1:6379" - database: parseInt(db.get("database")) || 0 + connection: db.get("connection") || $scope.config.connection hashView: db.get("hashView") || "table" - databases: [0..15] open: -> $scope.config.show = true close: -> $scope.config.show = false save: -> # Check connection $scope.config.error = null - test = API($scope.config.connection, $scope.config.database) + test = API($scope.config.connection) test.ping().then (resp) -> if resp.ok db.add("connection", $scope.config.connection) - db.add("database", $scope.config.database) - $scope.api = API($scope.config.connection, $scope.config.database) + $scope.api = API($scope.config.connection) $scope.fetchKeys() $scope.show($scope.key) $scope.config.close() @@ -96,10 +95,10 @@ modalOpts: backdropFade: true dialogFade: true - $scope.api = API($scope.config.connection, $scope.config.database) + $scope.api = API($scope.config.connection) # Scope functions $scope.fetchKeys = -> $scope.keys = $scope.api.keys()