Modularization, dynamic service add/remove, refactoring and (possibly) bugfixing #36

Merged
merged 16 commits into from Jan 23, 2013

3 participants

@stelcheck

First, my apologies. I REALLY went overboard with changing the code. Rest assured though that as far as I have seen it should all work.

This addresses mainly #35 and #34. I have already wrote a first integration in my application, and the service list basically updates itself using node-mdns. Pretty cool stuff :). Now I will be using the events from the api to enable and disable other higher level service across our architecture with it.

It also, I think, makes the code more readable, and standard (I jshinted the files I modified as I go). I fixed a few things here and there (see commit log).

I would still need to fix a thing or two before really having something ready (for instance, moving default config to server.js so that it is taken in consideration when starting statusdashboard from code), but I thought I should let you guys know of what I had done in terms of changes.

Again, apologies for the aggressive rewrites, but I hope you will find value in what is in this.

stelcheck added some commits Jan 15, 2013
@stelcheck stelcheck * Refactored api.js, now contains only api calls and the check loop
* Refactored server.js so that it can become embeddable as a ndoe module
* created bin/statusdashboard, to be used as a binary app instead of server.js
* created lib/sources, for creating different source check
* created lib/checks, for creating shared checks between sources
* All touched code should now pass standard jshint test
4cad66f
@stelcheck stelcheck * adding an entry specifying the binary 7a3e8ae
@stelcheck stelcheck * shuffled some functions around and added some comments for clarity fbeb664
@stelcheck stelcheck * reconfigure, start and stop for the scheduler 24283ec
@stelcheck stelcheck * Fixed double-callback issue with statusDashboard check sequence 45c35bb
@stelcheck stelcheck * new api function: addService and removeService
* some code refactoring to keep module internal variables close to what uses them
* renamed api.start/stop to startChecking/stopChecking
dd83d32
@stelcheck stelcheck * Updating the package.json a bit, and adding myself as a contributor c1887d9
@stelcheck stelcheck * Fixed logging: now uses the same logging strategy as the rest of th…
…e app
b509733
@stelcheck stelcheck * Updated the README file 6e28e0e
@stelcheck stelcheck * Bugfix: splice the status object as well to remove it from the stat…
… list
4f8ecc5
@stelcheck stelcheck * Adding callback for httpStatusCodeCheck
* Bugfix: incorrect path for static content delivery when used as a node submodule
23a6a45
@stelcheck stelcheck * Made the code use callback in http and https, instead of calling th…
…e controller.emit twice
0de287a
@stelcheck stelcheck * bugfix: bin definition was wrong c6f4305
@stelcheck stelcheck * Adding possiblility of custom http checks 4911fc9
@chamerling
Statusdashboard project member

Not tested but looks like a very nice contribution!

@obazoud
Statusdashboard project member

Thanks for your contribution.
I need time to test.

@stelcheck
@obazoud
Statusdashboard project member

After some tests, I think there is a bug in ftp check.
I can see in my log

 TypeError: Object [object Object] has no method 'command'

I think it is line 50

var ftp = new Ftp(service, stream);

this 'ftp object' does not have a command function.

With demo settings, it seems to block other checks.

@stelcheck stelcheck * Bugfix: Ftp methods were note prototype methods
* Uncaught exception now prints stacktrace instead of just the error message
c78a7fc
@stelcheck
@obazoud
Statusdashboard project member

I think callback is not defined

I have refactored ftp.js a bit now, that should solve the problem

@obazoud
Statusdashboard project member

I think that ftp is not defined

Just refactored, this should solve the problem. indeed, this should gave used this instead of ftp

@obazoud
Statusdashboard project member

Looks great.
@stelcheck thank you for this awesome contribution

@obazoud obazoud merged commit ec8f18e into statusdashboard:master Jan 23, 2013
@obazoud
Statusdashboard project member
@stelcheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment