Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	Gruntfile.js
	build/release/joola.min.css
	src/lib/viz/Canvas.js
  • Loading branch information
itayw committed Jun 21, 2015
2 parents 687f876 + 6355dac commit 5a4d5a2
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 57 deletions.
13 changes: 10 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,18 @@ module.exports = function (grunt) {
options: {
keepalive: true,
verbose: true,
debug: true
debug: true,

callback: function (b) {
// configure the browserify instance here
b.add('./build/temp/vendor.js', {expose: 'Highcharts'});
b.require('./build/temp/vendor.js', {expose: 'Highcharts'});
// return it
return b;
}
},
all: {
src: ['./build/temp/vendor.js', './src/lib/index.js'],

src: ['./src/lib/index.js'],
dest: 'build/release/joola.js'
}
},
Expand Down
2 changes: 1 addition & 1 deletion build/release/joola.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
border-spacing: 0;
}


[jio-domain="joola"] {
font-family: Signika, helvetica, arial, sans-serif;
}
Expand Down
57 changes: 43 additions & 14 deletions build/release/joola.js
Original file line number Diff line number Diff line change
Expand Up @@ -37043,17 +37043,17 @@ api.getJSON = function (options, objOptions, callback) {

objOptions._path = options.path;

joola.io.socket.emit(routeID, objOptions);
joola.io.emit(routeID, objOptions);
joola.events.emit('rpc:start', 1);
joola.events.emit('bandwidth', lengthInUtf8Bytes(JSON.stringify(objOptions)));
var shouldOn = objOptions && (objOptions.realtime || (objOptions.options && Array.isArray(objOptions.options) && objOptions.options.length > 0 && objOptions.options[0].realtime));
if (objOptions && objOptions.options && objOptions.options.realtime)
shouldOn = true;
if (shouldOn) {
joola.io.socket.on(routeID + ':done', processResponse);
joola.io.on(routeID + ':done', processResponse);
}
else {
joola.io.socket.once(routeID + ':done', processResponse);
joola.io.once(routeID + ':done', processResponse);
}
}
};
Expand All @@ -37062,12 +37062,19 @@ joola.events.on('rpc:start', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls++;

joola.events.emit('rpc:event', 'start');
});

joola.events.on('rpc:done', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls--;

if (joola.usage.currentCalls < 0)
joola.usage.currentCalls = 0;

joola.events.emit('rpc:event', 'done');
});
},{"../index":108,"http":13,"https":17,"querystring":23,"url":32}],101:[function(require,module,exports){
/**
Expand Down Expand Up @@ -37931,11 +37938,11 @@ joola._token = null;
joola._apitoken = null;

require('./common/modifiers');

Object.defineProperty(joola, 'TOKEN', {
get: function () {
return joola._token;
},
},
set: function (value) {
joola._token = value;
joola.events.emit('core.init.finish');
Expand Down Expand Up @@ -38035,31 +38042,32 @@ joola.init = function (options, callback) {
throw new Error('joola host not specified');

var io = require('socket.io-client');
joola.io = io;
joola.io.socket = joola.io.connect(joola.options.host);
joola.io.socket.on('event', function (data) {
joola.io = io.connect(joola.options.host, {'force new connection': true });
joola.io.on('error', function (reason) {
joola.connected = false;
joola.emit('disconnected', reason);
});
joola.io.socket.on('disconnect', function (reason) {
joola.io.on('disconnect', function (reason) {
joola.connected = false;
joola.emit('disconnected', reason);
});
joola.io.socket.on('connect_error', function (err) {
joola.io.on('connect_error', function (err) {
joola.connected = false;
if (!joola.online)
throw new Error('Failed to connect to Joola engine: ' + err);
joola.emit('disconnected', err);
});
joola.io.socket.on('connect_timeout', function (err) {
joola.io.on('connect_timeout', function (err) {
joola.connected = false;
if (!joola.online)
throw new Error('Failed to connect to Joola engine: Timeout');
joola.emit('disconnected', 'timeout');
});
joola.io.socket.on('connect', function () {
joola.io.on('connect', function () {
joola.connected = true;
if (!joola.online) {
joola.online = true;
joola.bringOnline(callback);
joola.bringOnline(callback);
}
joola.emit('connected');
});
Expand Down Expand Up @@ -39183,6 +39191,27 @@ var Canvas = module.exports = function (options, callback) {
//here we go
joola.viz.initialize(self, options || {});

//handle loading overlay
joola.events.on('rpc:event', function () {
if (joola.options.overlay && joola.options.isBrowser) {
if (joola.usage.currentCalls > 0) {
joola.logger.trace('show overlay');
if (self.options.overlay.timer)
window.clearTimeout(self.options.overlay.timer);
self.options.overlay.timer = setTimeout(function () {
$$(self.options.overlay.container).fadeIn('fast');
}, self.options.overlay.delay || 0);
}
else {
joola.logger.trace('hide overlay');
if (self.options.overlay.timer)
window.clearTimeout(self.options.overlay.timer);

$$(self.options.overlay.container).fadeOut('fast');
}
}
});

self.draw(null, function (err, ref) {
if (err)
return callback(err);
Expand Down Expand Up @@ -39273,7 +39302,7 @@ var DatePicker = module.exports = function (options, callback) {
var self = this;

this.addDays = function (o, days) {
// keep in mind, months in javascript are 0-11
// keep in mind, months in javascript are 0-11
return new Date(o.getFullYear(), o.getMonth(), o.getDate() + days);
};

Expand Down
2 changes: 1 addition & 1 deletion build/release/joola.min.css

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions build/release/joola.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/release/joola.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/temp/joola.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
border-spacing: 0;
}


[jio-domain="joola"] {
font-family: Signika, helvetica, arial, sans-serif;
}
Expand Down
57 changes: 43 additions & 14 deletions build/temp/joola.js
Original file line number Diff line number Diff line change
Expand Up @@ -33445,17 +33445,17 @@ api.getJSON = function (options, objOptions, callback) {

objOptions._path = options.path;

joola.io.socket.emit(routeID, objOptions);
joola.io.emit(routeID, objOptions);
joola.events.emit('rpc:start', 1);
joola.events.emit('bandwidth', lengthInUtf8Bytes(JSON.stringify(objOptions)));
var shouldOn = objOptions && (objOptions.realtime || (objOptions.options && Array.isArray(objOptions.options) && objOptions.options.length > 0 && objOptions.options[0].realtime));
if (objOptions && objOptions.options && objOptions.options.realtime)
shouldOn = true;
if (shouldOn) {
joola.io.socket.on(routeID + ':done', processResponse);
joola.io.on(routeID + ':done', processResponse);
}
else {
joola.io.socket.once(routeID + ':done', processResponse);
joola.io.once(routeID + ':done', processResponse);
}
}
};
Expand All @@ -33464,12 +33464,19 @@ joola.events.on('rpc:start', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls++;

joola.events.emit('rpc:event', 'start');
});

joola.events.on('rpc:done', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls--;

if (joola.usage.currentCalls < 0)
joola.usage.currentCalls = 0;

joola.events.emit('rpc:event', 'done');
});
},{"../index":108,"http":13,"https":17,"querystring":23,"url":32}],101:[function(require,module,exports){
/**
Expand Down Expand Up @@ -34333,11 +34340,11 @@ joola._token = null;
joola._apitoken = null;

require('./common/modifiers');

Object.defineProperty(joola, 'TOKEN', {
get: function () {
return joola._token;
},
},
set: function (value) {
joola._token = value;
joola.events.emit('core.init.finish');
Expand Down Expand Up @@ -34437,31 +34444,32 @@ joola.init = function (options, callback) {
throw new Error('joola host not specified');

var io = require('socket.io-client');
joola.io = io;
joola.io.socket = joola.io.connect(joola.options.host);
joola.io.socket.on('event', function (data) {
joola.io = io.connect(joola.options.host, {'force new connection': true });
joola.io.on('error', function (reason) {
joola.connected = false;
joola.emit('disconnected', reason);
});
joola.io.socket.on('disconnect', function (reason) {
joola.io.on('disconnect', function (reason) {
joola.connected = false;
joola.emit('disconnected', reason);
});
joola.io.socket.on('connect_error', function (err) {
joola.io.on('connect_error', function (err) {
joola.connected = false;
if (!joola.online)
throw new Error('Failed to connect to Joola engine: ' + err);
joola.emit('disconnected', err);
});
joola.io.socket.on('connect_timeout', function (err) {
joola.io.on('connect_timeout', function (err) {
joola.connected = false;
if (!joola.online)
throw new Error('Failed to connect to Joola engine: Timeout');
joola.emit('disconnected', 'timeout');
});
joola.io.socket.on('connect', function () {
joola.io.on('connect', function () {
joola.connected = true;
if (!joola.online) {
joola.online = true;
joola.bringOnline(callback);
joola.bringOnline(callback);
}
joola.emit('connected');
});
Expand Down Expand Up @@ -35585,6 +35593,27 @@ var Canvas = module.exports = function (options, callback) {
//here we go
joola.viz.initialize(self, options || {});

//handle loading overlay
joola.events.on('rpc:event', function () {
if (joola.options.overlay && joola.options.isBrowser) {
if (joola.usage.currentCalls > 0) {
joola.logger.trace('show overlay');
if (self.options.overlay.timer)
window.clearTimeout(self.options.overlay.timer);
self.options.overlay.timer = setTimeout(function () {
$$(self.options.overlay.container).fadeIn('fast');
}, self.options.overlay.delay || 0);
}
else {
joola.logger.trace('hide overlay');
if (self.options.overlay.timer)
window.clearTimeout(self.options.overlay.timer);

$$(self.options.overlay.container).fadeOut('fast');
}
}
});

self.draw(null, function (err, ref) {
if (err)
return callback(err);
Expand Down Expand Up @@ -35675,7 +35704,7 @@ var DatePicker = module.exports = function (options, callback) {
var self = this;

this.addDays = function (o, days) {
// keep in mind, months in javascript are 0-11
// keep in mind, months in javascript are 0-11
return new Date(o.getFullYear(), o.getMonth(), o.getDate() + days);
};

Expand Down
1 change: 1 addition & 0 deletions src/css/joola.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
border-spacing: 0;
}


13 changes: 10 additions & 3 deletions src/lib/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,17 @@ api.getJSON = function (options, objOptions, callback) {

objOptions._path = options.path;

joola.io.socket.emit(routeID, objOptions);
joola.io.emit(routeID, objOptions);
joola.events.emit('rpc:start', 1);
joola.events.emit('bandwidth', lengthInUtf8Bytes(JSON.stringify(objOptions)));
var shouldOn = objOptions && (objOptions.realtime || (objOptions.options && Array.isArray(objOptions.options) && objOptions.options.length > 0 && objOptions.options[0].realtime));
if (objOptions && objOptions.options && objOptions.options.realtime)
shouldOn = true;
if (shouldOn) {
joola.io.socket.on(routeID + ':done', processResponse);
joola.io.on(routeID + ':done', processResponse);
}
else {
joola.io.socket.once(routeID + ':done', processResponse);
joola.io.once(routeID + ':done', processResponse);
}
}
};
Expand All @@ -303,10 +303,17 @@ joola.events.on('rpc:start', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls++;

joola.events.emit('rpc:event', 'start');
});

joola.events.on('rpc:done', function () {
if (!joola.usage)
joola.usage = {currentCalls: 0};
joola.usage.currentCalls--;

if (joola.usage.currentCalls < 0)
joola.usage.currentCalls = 0;

joola.events.emit('rpc:event', 'done');
});
Loading

0 comments on commit 5a4d5a2

Please sign in to comment.