Commit 815722c3 by Torkel Ödegaard

Merge branch 'upgrade_typescript' of https://github.com/Nepomuceno/grafana into…

Merge branch 'upgrade_typescript' of https://github.com/Nepomuceno/grafana into Nepomuceno-upgrade_typescript
parents 3cbc325f cbf0d571
......@@ -10,51 +10,50 @@
"url": "http://github.com/grafana/grafana.git"
},
"devDependencies": {
"zone.js": "^0.6.6",
"autoprefixer": "^6.4.0",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.1",
"expect.js": "~0.2.0",
"glob": "~7.1.1",
"grunt": "~0.4.0",
"grunt-angular-templates": "^0.5.5",
"grunt-cli": "~0.1.13",
"grunt-contrib-clean": "~0.7.0",
"glob": "~7.0.0",
"grunt": "^0.4.5",
"grunt-angular-templates": "^1.1.0",
"grunt-cli": "~1.2.0",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-compress": "^1.3.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "~0.8.2",
"grunt-contrib-cssmin": "~0.14.0",
"grunt-contrib-htmlmin": "~0.6.0",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "~0.11.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^0.2.1",
"grunt-git-describe": "~2.3.2",
"grunt-karma": "~0.12.2",
"grunt-ng-annotate": "^1.0.1",
"grunt-notify": "^0.4.3",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~1.0.2",
"grunt-contrib-htmlmin": "~2.0.0",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-exec": "^1.0.1",
"grunt-filerev": "^2.3.1",
"grunt-git-describe": "~2.4.2",
"grunt-karma": "~2.0.0",
"grunt-ng-annotate": "^3.0.0",
"grunt-notify": "^0.4.5",
"grunt-postcss": "^0.8.0",
"grunt-sass": "^1.1.0",
"grunt-string-replace": "~1.2.1",
"grunt-systemjs-builder": "^0.2.6",
"grunt-tslint": "^3.0.2",
"grunt-typescript": "^0.8.0",
"grunt-usemin": "3.0.0",
"jshint-stylish": "~2.1.0",
"karma": "0.13.22",
"karma-chrome-launcher": "~0.2.2",
"karma-coverage": "0.5.3",
"grunt-sass": "^1.2.1",
"grunt-string-replace": "~1.3.1",
"grunt-systemjs-builder": "^0.2.7",
"grunt-usemin": "3.1.1",
"jshint-stylish": "~2.2.1",
"karma": "1.3.0",
"karma-chrome-launcher": "~2.0.0",
"karma-coverage": "1.1.1",
"karma-coveralls": "1.1.2",
"karma-expect": "~1.1.0",
"karma-mocha": "~0.2.1",
"karma-phantomjs-launcher": "1.0.0",
"load-grunt-tasks": "3.4.0",
"mocha": "2.3.4",
"phantomjs-prebuilt": "^2.1.7",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.4",
"sass-lint": "^1.7.0",
"systemjs": "0.19.24"
"karma-expect": "~1.1.3",
"karma-mocha": "~1.3.0",
"karma-phantomjs-launcher": "1.0.2",
"load-grunt-tasks": "3.5.2",
"mocha": "3.2.0",
"phantomjs-prebuilt": "^2.1.13",
"reflect-metadata": "0.1.8",
"rxjs": "^5.0.0-rc.5",
"sass-lint": "^1.10.2",
"systemjs": "0.19.41",
"zone.js": "^0.7.2"
},
"engines": {
"node": "4.x",
......@@ -67,21 +66,21 @@
},
"license": "Apache-2.0",
"dependencies": {
"eventemitter3": "^1.2.0",
"eventemitter3": "^2.0.2",
"gaze": "^1.1.2",
"grunt-jscs": "~1.5.x",
"grunt-sass-lint": "^0.2.0",
"grunt-sync": "^0.4.1",
"karma-sinon": "^1.0.3",
"lodash": "^2.4.1",
"grunt-jscs": "3.0.1",
"grunt-sass-lint": "^0.2.2",
"grunt-sync": "^0.6.2",
"karma-sinon": "^1.0.5",
"lodash": "^4.17.2",
"mousetrap": "^1.6.0",
"remarkable": "^1.6.2",
"sinon": "1.16.1",
"systemjs-builder": "^0.15.13",
"tether": "^1.2.0",
"remarkable": "^1.7.1",
"sinon": "1.17.6",
"systemjs-builder": "^0.15.34",
"tether": "^1.4.0",
"tether-drop": "^1.4.2",
"tslint": "^3.4.0",
"typescript": "^1.7.5",
"tslint": "^4.0.2",
"typescript": "^2.1.4",
"virtual-scroll": "^1.1.1"
}
}
......@@ -175,17 +175,17 @@ function (angular, _, coreModule) {
// Foreach keys in label (split on +)
for (var i = 0, l = keys.length; k = keys[i], i < l; i++) {
switch (k) {
case 'ctrl':
case 'control':
kp++;
modifiers.ctrl.wanted = true;
break;
case 'shift':
case 'alt':
case 'meta':
kp++;
modifiers[k].wanted = true;
break;
case 'ctrl':
case 'control':
kp++;
modifiers.ctrl.wanted = true;
break;
case 'shift':
case 'alt':
case 'meta':
kp++;
modifiers[k].wanted = true;
break;
}
if (k.length > 1) { // If it is a special key
......
......@@ -16,95 +16,95 @@ function($, _) {
kbn.round_interval = function(interval) {
switch (true) {
// 0.015s
case (interval <= 15):
return 10; // 0.01s
// 0.035s
case (interval <= 35):
return 20; // 0.02s
// 0.075s
case (interval <= 75):
return 50; // 0.05s
// 0.15s
case (interval <= 150):
return 100; // 0.1s
// 0.35s
case (interval <= 350):
return 200; // 0.2s
// 0.75s
case (interval <= 750):
return 500; // 0.5s
// 1.5s
case (interval <= 1500):
return 1000; // 1s
// 3.5s
case (interval <= 3500):
return 2000; // 2s
// 7.5s
case (interval <= 7500):
return 5000; // 5s
// 12.5s
case (interval <= 12500):
return 10000; // 10s
// 17.5s
case (interval <= 17500):
return 15000; // 15s
// 25s
case (interval <= 25000):
return 20000; // 20s
// 45s
case (interval <= 45000):
return 30000; // 30s
// 1.5m
case (interval <= 90000):
return 60000; // 1m
// 3.5m
case (interval <= 210000):
return 120000; // 2m
// 7.5m
case (interval <= 450000):
return 300000; // 5m
// 12.5m
case (interval <= 750000):
return 600000; // 10m
// 12.5m
case (interval <= 1050000):
return 900000; // 15m
// 25m
case (interval <= 1500000):
return 1200000; // 20m
// 45m
case (interval <= 2700000):
return 1800000; // 30m
// 1.5h
case (interval <= 5400000):
return 3600000; // 1h
// 2.5h
case (interval <= 9000000):
return 7200000; // 2h
// 4.5h
case (interval <= 16200000):
return 10800000; // 3h
// 9h
case (interval <= 32400000):
return 21600000; // 6h
// 24h
case (interval <= 86400000):
return 43200000; // 12h
// 48h
case (interval <= 172800000):
return 86400000; // 24h
// 1w
case (interval <= 604800000):
return 86400000; // 24h
// 3w
case (interval <= 1814400000):
return 604800000; // 1w
// 2y
case (interval < 3628800000):
return 2592000000; // 30d
default:
return 31536000000; // 1y
// 0.015s
case (interval <= 15):
return 10; // 0.01s
// 0.035s
case (interval <= 35):
return 20; // 0.02s
// 0.075s
case (interval <= 75):
return 50; // 0.05s
// 0.15s
case (interval <= 150):
return 100; // 0.1s
// 0.35s
case (interval <= 350):
return 200; // 0.2s
// 0.75s
case (interval <= 750):
return 500; // 0.5s
// 1.5s
case (interval <= 1500):
return 1000; // 1s
// 3.5s
case (interval <= 3500):
return 2000; // 2s
// 7.5s
case (interval <= 7500):
return 5000; // 5s
// 12.5s
case (interval <= 12500):
return 10000; // 10s
// 17.5s
case (interval <= 17500):
return 15000; // 15s
// 25s
case (interval <= 25000):
return 20000; // 20s
// 45s
case (interval <= 45000):
return 30000; // 30s
// 1.5m
case (interval <= 90000):
return 60000; // 1m
// 3.5m
case (interval <= 210000):
return 120000; // 2m
// 7.5m
case (interval <= 450000):
return 300000; // 5m
// 12.5m
case (interval <= 750000):
return 600000; // 10m
// 12.5m
case (interval <= 1050000):
return 900000; // 15m
// 25m
case (interval <= 1500000):
return 1200000; // 20m
// 45m
case (interval <= 2700000):
return 1800000; // 30m
// 1.5h
case (interval <= 5400000):
return 3600000; // 1h
// 2.5h
case (interval <= 9000000):
return 7200000; // 2h
// 4.5h
case (interval <= 16200000):
return 10800000; // 3h
// 9h
case (interval <= 32400000):
return 21600000; // 6h
// 24h
case (interval <= 86400000):
return 43200000; // 12h
// 48h
case (interval <= 172800000):
return 86400000; // 24h
// 1w
case (interval <= 604800000):
return 86400000; // 24h
// 3w
case (interval <= 1814400000):
return 604800000; // 1w
// 2y
case (interval < 3628800000):
return 2592000000; // 30d
default:
return 31536000000; // 1y
}
};
......
define([
define([
'angular',
'app/core/config',
'lodash'
......
......@@ -89,8 +89,10 @@ function (angular, _, moment, kbn, ElasticQueryBuilder, IndexPattern, ElasticRes
"bool": {
"must": [
{ "range": range },
{ "query_string": {
"query": queryInterpolated }
{
"query_string": {
"query": queryInterpolated
}
}
]
}
......
......@@ -135,9 +135,10 @@ function (queryDef) {
"bool": {
"must": [
{"range": this.getRangeFilter()},
{"query_string": {
"analyze_wildcard": true,
"query": '$lucene_query'
{
"query_string": {
"analyze_wildcard": true,
"query": '$lucene_query'
}
}
]
......
......@@ -130,14 +130,8 @@ export class DataProcessor {
let fields = [];
var firstItem = dataList[0];
if (firstItem.type === 'docs'){
if (firstItem.datapoints.length === 0) {
return [];
}
let fieldParts = [];
function getPropertiesRecursive(obj) {
let fieldParts = [];
function getPropertiesRecursive(obj) {
_.forEach(obj, (value, key) => {
if (_.isObject(value)) {
fieldParts.push(key);
......@@ -150,8 +144,11 @@ export class DataProcessor {
}
});
fieldParts.pop();
}
if (firstItem.type === 'docs'){
if (firstItem.datapoints.length === 0) {
return [];
}
getPropertiesRecursive(firstItem.datapoints[0]);
return fields;
}
......
......@@ -6,11 +6,11 @@ module.exports = function(grunt) {
'jshint:source',
'jshint:tests',
'jscs',
'tslint',
'exec:tslint',
'clean:release',
'copy:node_modules',
'copy:public_to_gen',
'typescript:build',
'exec:tscompile',
'karma:test',
'phantomjs',
'css',
......
......@@ -16,13 +16,13 @@ module.exports = function(grunt) {
grunt.registerTask('default', [
'jscs',
'jshint',
'tslint',
'exec:tslint',
'clean:gen',
'copy:node_modules',
'copy:public_to_gen',
'phantomjs',
'css',
'typescript:build'
'exec:tscompile'
]);
grunt.registerTask('test', ['default', 'karma:test', 'no-only-tests']);
......
module.exports = function(config) {
'use strict'
return {
tslint : "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project ./tsconfig.json",
tscompile: "node ./node_modules/typescript/lib/tsc.js -p tsconfig.json"
};
};
module.exports = function(config) {
return {
source: {
files: {
src: ['<%= srcDir %>/app/**/*.ts', '!<%= srcDir %>/app/**/*.d.ts'],
}
},
options: {
configuration: 'tslint.json'
// {
// rules: {
// curly: true,
// align: [true, "parameters", "statements"],
// indent: [true, "spaces"],
// "class-name": true,
// "interface-name": true,
// "semicolon": true,
// "use-strict": [false, "check-module", "check-function"],
// "whitespace": [true, "check-branch", "check-decl", "check-type"],
// }
// }
}
};
};
module.exports = function() {
'use strict';
return {
build: {
src: ['public/**/*.ts', "!public/vendor/**/*", "!**/*.d.ts"],
dest: 'public_gen/',
options: {
module: 'system', //or commonjs
target: 'es5', //or es3
rootDir: 'public/',
sourceRoot: 'public/',
declaration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
sourceMap: true,
noImplicitAny: false,
}
},
// build2: {
// src: ['public/app/alerting#<{(||)}>#*.ts'],
// dest: 'public/.app_gen/alerting/all.js',
// options: {
// target: 'es5', //or es3
// declaration: true,
// sourceMap: true,
// }
// },
watch: {
src: ['public/app/**/*.ts'],
dest: 'public/app_gen',
options: {
module: 'amd', //or commonjs
target: 'es5', //or es3
rootDir: 'public/app',
declaration: true,
sourceMap: true,
watch: true,
}
}
};
};
......@@ -64,8 +64,8 @@ module.exports = function(config, grunt) {
grunt.config('typescript.build.src', filepath);
grunt.config('tslint.source.files.src', filepath);
grunt.task.run('typescript:build');
grunt.task.run('tslint');
grunt.task.run('exec:tscompile');
grunt.task.run('exec:tslint');
}
done();
......
......@@ -10,9 +10,19 @@
"module": "system",
"noEmitOnError": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"noImplicitReturns":false,
"noImplicitThis":false,
"noImplicitUseStrict":false,
"noUnusedLocals":false,
"moduleResolution": "classic"
},
"files": [
"include": [
"public/app/**/*.ts"
],
"exclude": [
"public/vendor/**/*",
"public/**/*.d.ts"
]
}
{
"version": "v4",
"repo": "angular/DefinitelyTyped",
"ref": "master",
"path": "public/app/headers",
"bundle": "public/app/headers/tsd.d.ts",
"installed": {
"es6-promise/es6-promise.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"mocha/mocha.d.ts": {
"commit": "055b3172e8eb374a75826710c4d08677872620d3"
},
"zone/zone.d.ts": {
"commit": "055b3172e8eb374a75826710c4d08677872620d3"
},
"rx/rx.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"rx/rx-lite.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"angular2/angular2.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"es6-shim/es6-shim.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
},
"jquery/jquery.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
}
}
}
......@@ -7,7 +7,6 @@
"forin": false,
"indent": [true, "spaces"],
"label-position": true,
"label-undefined": true,
"max-line-length": [true, 140],
"member-access": false,
"no-arg": true,
......@@ -21,7 +20,6 @@
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-key": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-eval": true,
......@@ -31,8 +29,6 @@
"no-switch-case-fall-through": false,
"no-trailing-whitespace": true,
"no-unused-expression": false,
"no-unused-variable": false,
"no-unreachable": true,
"no-use-before-declare": true,
"no-var-keyword": false,
"object-literal-sort-keys": false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment