0) {
+ for (var i = 0; i < d[0].values.length ; i++) {
var e = d[0].values[i];
d3g.push({
label : e.x,
@@ -319,13 +321,15 @@ module zeppelin {
var animationDuration = 300;
var numberOfDataThreshold = 150;
+
// turn off animation when dataset is too large. (for performance issue)
// still, since dataset is large, the chart content sequentially appears like animated.
try {
if (d3g[0].values.length > numberOfDataThreshold) {
animationDuration = 0;
}
- } catch(ignoreErr) {
+ } catch (ignoreErr) {
+ console.log('D3 animation error %o', ignoreErr);
}
var chartEl = d3.select('#p' + $scope.paragraph.id + '_' + type + ' svg')
@@ -342,11 +346,11 @@ module zeppelin {
if ($('#p' + $scope.paragraph.id + '_' + type + ' svg').length !== 0) {
try {
renderChart();
- } catch(err) {
+ } catch (err) {
console.log('Chart drawing error %o', err);
}
} else {
- $timeout(retryRenderer,10);
+ $timeout(retryRenderer, 10);
}
};
$timeout(retryRenderer);
@@ -462,27 +466,27 @@ module zeppelin {
var values = graph.values;
var aggrFunc = {
- sum : function(a,b) {
+ sum : function(a, b) {
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
return varA + varB;
},
- count : function(a,b) {
- var varA = (a !== undefined) ? parseInt(a) : 0;
+ count : function(a, b) {
+ var varA = (a !== undefined) ? parseInt(a, 10) : 0;
var varB = (b !== undefined) ? 1 : 0;
return varA + varB;
},
- min : function(a,b) {
+ min : function(a, b) {
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
- return Math.min(varA,varB);
+ return Math.min(varA, varB);
},
- max : function(a,b) {
+ max : function(a, b) {
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
- return Math.max(varA,varB);
+ return Math.max(varA, varB);
},
- avg : function(a,b,c) {
+ avg : function(a, b, c) {
var varA = (a !== undefined) ? (isNaN(a) ? 1 : parseFloat(a)) : 0;
var varB = (b !== undefined) ? (isNaN(b) ? 1 : parseFloat(b)) : 0;
return varA + varB;
@@ -500,13 +504,13 @@ module zeppelin {
var schema = {};
var rows = {};
- for (var i=0; i < data.rows.length; i++) {
+ for (var i = 0; i < data.rows.length; i++) {
var row = data.rows[i];
var newRow = {};
var s = schema;
var p = rows;
- for (var k=0; k < keys.length; k++) {
+ for (var k = 0; k < keys.length; k++) {
var key = keys[k];
// add key to schema
@@ -528,7 +532,7 @@ module zeppelin {
p = p[keyKey];
}
- for (var g=0; g < groups.length; g++) {
+ for (var g = 0; g < groups.length; g++) {
var group = groups[g];
var groupKey = row[group.index];
@@ -550,7 +554,7 @@ module zeppelin {
p = p[groupKey];
}
- for (var v=0; v < values.length; v++) {
+ for (var v = 0; v < values.length; v++) {
var value = values[v];
var valueKey = value.name + '(' + value.aggr + ')';
@@ -577,7 +581,7 @@ module zeppelin {
}
}
}
- //console.log('schema=%o, rows=%o', schema, rows);
+ // console.log('schema=%o, rows=%o', schema, rows);
return {
schema : schema,
@@ -609,7 +613,9 @@ module zeppelin {
};
var traverse = function(sKey, s, rKey, r, func, rowName?, rowValue?, colName?) {
- //console.log('TRAVERSE sKey=%o, s=%o, rKey=%o, r=%o, rowName=%o, rowValue=%o, colName=%o', sKey, s, rKey, r, rowName, rowValue, colName);
+ /* console.log('TRAVERSE sKey=%o, s=%o, rKey=%o, r=%o, rowName=%o,
+ ** rowValue=%o, colName=%o', sKey, s, rKey, r, rowName, rowValue, colName);
+ */
if (s.type === 'key') {
rowName = concat(rowName, sKey);
@@ -655,7 +661,7 @@ module zeppelin {
for (var k in rows) {
traverse(sKey, schema[sKey], k, rows[k], function(rowName, rowValue, colName, value) {
- //console.log('RowName=%o, row=%o, col=%o, value=%o', rowName, rowValue, colName, value);
+ // console.log('RowName=%o, row=%o, col=%o, value=%o', rowName, rowValue, colName, value);
if (rowNameIndex[rowValue] === undefined) {
rowIndexValue[rowIdx] = rowValue;
rowNameIndex[rowValue] = rowIdx++;
@@ -754,7 +760,7 @@ module zeppelin {
});
if (!String.prototype.startsWith) {
- String.prototype.startsWith = function (str: string) : boolean {
+ String.prototype.startsWith = function (str: string): boolean {
return this.indexOf(str) === 0;
};
}
diff --git a/zeppelin-web/app/typescripts/directives/resizable.ts b/zeppelin-web/app/typescripts/directives/resizable.ts
index aa04777f..c3a8201b 100644
--- a/zeppelin-web/app/typescripts/directives/resizable.ts
+++ b/zeppelin-web/app/typescripts/directives/resizable.ts
@@ -5,7 +5,7 @@ angular.module('zeppelinWebApp').directive('resizable', function () {
autoHide: true,
handles: 'se',
helper: 'resizable-helper',
- minHeight:100,
+ minHeight: 100,
grid: [10000, 10] // allow only vertical
};
@@ -14,7 +14,7 @@ angular.module('zeppelinWebApp').directive('resizable', function () {
scope: {
callback: '&onResize'
},
- link: function postLink(scope : any, elem, attrs) {
+ link: function postLink(scope: any, elem, attrs) {
attrs.$observe('allowresize', function(isAllowed) {
if (isAllowed === 'true') {
elem.resizable(resizableConfig);
diff --git a/zeppelin-web/app/typescripts/events.ts b/zeppelin-web/app/typescripts/events.ts
index 43241769..635b6a75 100644
--- a/zeppelin-web/app/typescripts/events.ts
+++ b/zeppelin-web/app/typescripts/events.ts
@@ -23,8 +23,8 @@ module zeppelin {
}
export class ZEvent {
- op:string;
- data:any;
+ op: string;
+ data: any;
toJson() {
return {op: this.op, data: this.data};
diff --git a/zeppelin-web/app/typescripts/types.ts b/zeppelin-web/app/typescripts/types.ts
index 965da6a0..7b190c83 100644
--- a/zeppelin-web/app/typescripts/types.ts
+++ b/zeppelin-web/app/typescripts/types.ts
@@ -11,7 +11,7 @@ interface JQuery {
}
// nvd3
-declare var nv: NVD3
+declare var nv: NVD3;
interface NVD3 {
models: any;
diff --git a/zeppelin-web/app/views/main.html b/zeppelin-web/app/views/main.html
index 001a076a..fb0a49e4 100644
--- a/zeppelin-web/app/views/main.html
+++ b/zeppelin-web/app/views/main.html
@@ -19,7 +19,7 @@
- Welcome to Zeppelin!
+ Welcome to Zeppelin! ROFL
Zeppelin is web-based notebook that enables interactive data analytics.
You can make beautiful data-driven, interactive, collaborative document with SQL, code and even more!
diff --git a/zeppelin-web/package.json b/zeppelin-web/package.json
index c498e615..2bcf605b 100644
--- a/zeppelin-web/package.json
+++ b/zeppelin-web/package.json
@@ -6,6 +6,7 @@
"bower": "",
"grunt": "^0.4.1",
"grunt-autoprefixer": "^0.7.3",
+ "grunt-cli": "^0.1.13",
"grunt-concurrent": "^0.5.0",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-concat": "^0.4.0",
@@ -17,20 +18,21 @@
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^0.2.1",
+ "grunt-karma": "~0.8.3",
"grunt-newer": "^0.7.0",
- "grunt-ngmin": "^0.0.3",
+ "grunt-ng-annotate": "^0.10.0",
"grunt-svgmin": "^0.4.0",
+ "grunt-tslint": "^2.0.0",
+ "grunt-typescript": "",
"grunt-usemin": "^2.1.1",
"grunt-wiredep": "~2.0.0",
- "grunt-cli": "^0.1.13",
"jshint-stylish": "^0.2.0",
- "load-grunt-tasks": "^0.4.0",
- "time-grunt": "^0.3.1",
- "grunt-karma": "~0.8.3",
- "karma-phantomjs-launcher": "~0.1.4",
"karma": "~0.12.23",
"karma-jasmine": "~0.1.5",
- "grunt-typescript": ""
+ "karma-phantomjs-launcher": "~0.1.4",
+ "load-grunt-tasks": "^0.4.0",
+ "time-grunt": "^0.3.1",
+ "tslint": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
diff --git a/zeppelin-web/tslint.json b/zeppelin-web/tslint.json
new file mode 100644
index 00000000..525e9d2e
--- /dev/null
+++ b/zeppelin-web/tslint.json
@@ -0,0 +1,84 @@
+{
+ "rules": {
+ "ban": false,
+ "class-name": true,
+ "comment-format": [true,
+ "check-space"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": false,
+ "indent": [true, 4],
+ "interface-name": false,
+ "jsdoc-format": true,
+ "label-position": true,
+ "label-undefined": true,
+ "max-line-length": [true, 140],
+ "member-ordering": [true,
+ "public-before-private",
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-constructor-vars": true,
+ "no-debugger": true,
+ "no-duplicate-key": true,
+ "no-duplicate-variable": false,
+ "no-empty": false,
+ "no-eval": true,
+ "no-string-literal": true,
+ "no-switch-case-fall-through": true,
+ "no-trailing-comma": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-unused-variable": false,
+ "no-unreachable": true,
+ "no-use-before-declare": false,
+ "no-var-requires": true,
+ "one-line": [true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "quotemark": [true, "single"],
+ "radix": true,
+ "semicolon": true,
+ "triple-equals": [true, "allow-null-check"],
+ "typedef": [false,
+ "call-signature",
+ "parameter",
+ "property-declaration",
+ "variable-declaration",
+ "member-variable-declaration"
+ ],
+ "typedef-whitespace": [true, {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }],
+ "use-strict": [true,
+ "check-module",
+ "check-function"
+ ],
+ "variable-name": false,
+ "whitespace": [true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ]
+ }
+}
\ No newline at end of file