Permalink
Browse files

0.0.8 - fix issues

  • Loading branch information...
1 parent 8aba57a commit 984a698c8475d94f9288bbfde230035c243b87ef @contra committed Oct 2, 2012
View
@@ -66,6 +66,7 @@ $ smog -u
* Streaming results (when a new document is added that matches the query it should be added)
* Inline editor
* Graphs
+* Pagination
## LICENSE
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1 +1 @@
-define ["ext/vein"], (Vein) -> new Vein
+define ["ext/vein"], (Vein) -> Vein.createClient()
View
@@ -1,30 +1,30 @@
-module.exports = (res, socket) ->
- return res.send "Not connected" unless res.socket.mongo?
+module.exports = (cb, socket) ->
+ return cb "Not connected" unless cb.socket.mongo?
out = {}
- db = res.socket.mongo.database
- admin = res.socket.mongo.admin
+ db = cb.socket.mongo.database
+ admin = cb.socket.mongo.admin
db.collectionNames (err, r) ->
- return res.send err if err?
+ return cb err if err?
out.collections = r
admin.serverStatus (err, r) ->
- return res.send err if err?
+ return cb err if err?
out.serverStatus = r
admin.buildInfo (err, r) ->
- return res.send err if err?
+ return cb err if err?
out.buildInfo = r
admin.profilingLevel (err, r) ->
- return res.send err if err?
+ return cb err if err?
out.profilingLevel = r
admin.profilingInfo (err, r) ->
- return res.send err if err?
+ return cb err if err?
out.profilingInfo = r
admin.replSetGetStatus (err, r) ->
out.replSetGetStatus = r unless err?
- return res.send null, out
+ return cb null, out
@@ -78,19 +78,19 @@ tasks =
col.save command.query, cb
-module.exports = (res, command) ->
- return unless res.socket?
- return res.send "Not connected" unless res.socket.mongo?
- return res.send "Missing command" unless command?
- return res.send "Missing type" unless command.type?
- return res.send "Missing collection" unless command.collection?
- return res.send "Invalid command" unless tasks[command.type]?
+module.exports = (cb, command) ->
+ return unless cb.socket?
+ return cb "Not connected" unless cb.socket.mongo?
+ return cb "Missing command" unless command?
+ return cb "Missing type" unless command.type?
+ return cb "Missing collection" unless command.collection?
+ return cb "Invalid command" unless tasks[command.type]?
- res.socket.mongo.database.collection command.collection, {safe:true}, (err, col) ->
- return res.send err if err?
+ cb.socket.mongo.database.collection command.collection, {safe:true}, (err, col) ->
+ return cb err if err?
if command.query? and typeof command.query is 'string'
try
command.query = ton.parse command.query
catch err
- return res.send err.message
- tasks[command.type] col, command, res.send
+ return cb err.message
+ tasks[command.type] col, command, cb
@@ -1,19 +1,19 @@
{Server, Db} = require 'mongodb'
-module.exports = (res, host, port, database) ->
- return res.send "Missing host" unless host? and typeof host is 'string' and host.length > 0
- return res.send "Missing port" unless port? and typeof port is 'number'
- return res.send "Missing database" unless database? and typeof database is 'string' and database.length > 0
- return res.send null, true if res.socket.mongo? and res.socket.mongo.database?
+module.exports = (cb, host, port, database) ->
+ return cb "Missing host" unless host? and typeof host is 'string' and host.length > 0
+ return cb "Missing port" unless port? and typeof port is 'number'
+ return cb "Missing database" unless database? and typeof database is 'string' and database.length > 0
+ return cb null, true if cb.socket.mongo?.database?
- res.socket.mongo = {}
- res.socket.mongo.server = new Server host, port, auto_reconnect: true
- dbt = new Db database, res.socket.mongo.server, strict: true
+ cb.socket.mongo = {}
+ cb.socket.mongo.server = new Server host, port, auto_reconnect: true
+ dbt = new Db database, cb.socket.mongo.server, strict: true
dbt.open (err, db) ->
- return res.send err if err?
- res.socket.mongo.database = db
+ return cb err if err?
+ cb.socket.mongo.database = db
db.admin (err, admin) ->
- return res.send err if err?
- res.socket.mongo.admin = admin
- return res.send null, true
+ return cb err if err?
+ cb.socket.mongo.admin = admin
+ return cb null, true
@@ -1,9 +1,9 @@
-module.exports = (res, name, options={}) ->
- return res.send "Not connected" unless res.socket.mongo?
- return res.send "Missing name" unless name? and typeof name is "string" and name.length > 0
+module.exports = (cb, name, options={}) ->
+ return cb "Not connected" unless cb.socket.mongo?
+ return cb "Missing name" unless name? and typeof name is "string" and name.length > 0
options.safe = true
- res.socket.mongo.database.createCollection name, options, (err, col) ->
- return res.send err if err?
- return res.send "Not created" unless col?
- res.send()
+ cb.socket.mongo.database.createCollection name, options, (err, col) ->
+ return cb err if err?
+ return cb "Not created" unless col?
+ cb()
@@ -1,9 +1,9 @@
{Server, Db} = require 'mongodb'
-module.exports = (res, host, port, database) ->
- return es.send "Not connected" unless res.socket.mongo?
+module.exports = (cb, host, port, database) ->
+ return cb "Not connected" unless cb.socket.mongo?
- res.socket.mongo.database.close true, (err) ->
- return res.send err if err?
- res.send()
- delete res.socket.mongo
+ cb.socket.mongo.database.close true, (err) ->
+ return cb err if err?
+ cb()
+ delete cb.socket.mongo
View
@@ -1,7 +1,7 @@
{
"name": "smog",
"description": "HTML5/Node/WebSocket MongoDB viewer",
- "version": "0.0.7-1",
+ "version": "0.0.8",
"homepage": "http://github.com/wearefractal/smog",
"repository": "git://github.com/wearefractal/smog.git",
"author": "Fractal <contact@wearefractal.com> (http://wearefractal.com/)",
@@ -12,7 +12,7 @@
"coffee-script": "*",
"mongodb": "*",
"connect": "*",
- "vein": "*",
+ "vein": "0.4.5",
"async": "*",
"mongo-ton": "*",
"uglify-js": "*"
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -11,7 +11,7 @@ app.use connect.static join __dirname, './public/'
server = app.listen port
# Vein
-vein = new Vein server
+vein = Vein.createServer server: server
vein.addFolder join __dirname, './lib/services/'
console.log "Server started on #{port}"

0 comments on commit 984a698

Please sign in to comment.