mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
remove some unused files
This commit is contained in:
parent
fbabd7a544
commit
bf59783a4b
33 changed files with 2 additions and 2145 deletions
63
.eslintrc
63
.eslintrc
|
@ -1,63 +0,0 @@
|
|||
---
|
||||
env:
|
||||
node: true
|
||||
browser: true
|
||||
|
||||
rules:
|
||||
block-scoped-var: 0 # 2
|
||||
camelcase: 0 # [ 2, { properties: never } ]
|
||||
comma-dangle: 0
|
||||
comma-style: [ 2, last ]
|
||||
consistent-return: 0
|
||||
curly: 0 # [ 2, multi-line ]
|
||||
dot-location: [ 2, property ]
|
||||
dot-notation: [ 2, { allowKeywords: true } ]
|
||||
eqeqeq: 0 # [ 2, allow-null ]
|
||||
guard-for-in: 0 # 2
|
||||
indent: [ 2, 2, { SwitchCase: 1 } ]
|
||||
key-spacing: [ 0, { align: value } ]
|
||||
max-len: [ 2, 140, 2, { ignoreComments: true, ignoreUrls: true } ]
|
||||
new-cap: [ 2, { capIsNewExceptions: [ Private ] } ]
|
||||
no-bitwise: 0
|
||||
no-caller: 2
|
||||
no-cond-assign: 0
|
||||
no-debugger: 2
|
||||
no-empty: 0 # 2
|
||||
no-eval: 2
|
||||
no-extend-native: 2
|
||||
no-extra-parens: 0
|
||||
no-irregular-whitespace: 2
|
||||
no-iterator: 2
|
||||
no-loop-func: 2
|
||||
no-multi-spaces: 0
|
||||
no-multi-str: 2
|
||||
no-nested-ternary: 2
|
||||
no-new: 0
|
||||
no-path-concat: 0
|
||||
no-proto: 2
|
||||
no-return-assign: 0
|
||||
no-script-url: 2
|
||||
no-sequences: 2
|
||||
no-shadow: 0
|
||||
no-trailing-spaces: 2
|
||||
no-undef: 2
|
||||
no-underscore-dangle: 0
|
||||
no-unused-expressions: 0
|
||||
no-unused-vars: 0
|
||||
no-use-before-define: [ 2, nofunc ]
|
||||
no-with: 2
|
||||
one-var: 0 # [ 2, never ]
|
||||
quotes: 0 # [ 2, single ]
|
||||
semi-spacing: [ 2, { before: false, after: true } ]
|
||||
semi: 0 # [ 2, always ]
|
||||
space-after-keywords: 0 # [ 2, always ]
|
||||
space-before-blocks: [ 2, always ]
|
||||
space-before-function-paren: [ 2, { anonymous: always, named: never } ]
|
||||
space-in-parens: [ 2, never ]
|
||||
space-infix-ops: [ 2, { int32Hint: false } ]
|
||||
space-return-throw-case: [ 2 ]
|
||||
space-unary-ops: [ 2 ]
|
||||
strict: 0 # [ 2, never ]
|
||||
valid-typeof: 2
|
||||
wrap-iife: [ 2, outside ]
|
||||
yoda: 0
|
65
Gruntfile.js
65
Gruntfile.js
|
@ -1,65 +0,0 @@
|
|||
'use strict';
|
||||
module.exports = function (grunt) {
|
||||
|
||||
var config = {
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
kibanaCheckoutDir: './kibana/vendor/kibana',
|
||||
kibanaRevision: 'd8d401764dee4aa9bccd603739e8b771aa853488',
|
||||
agentDir: 'agent',
|
||||
buildDir: 'build',
|
||||
packageDir: 'build/packages',
|
||||
senseDir: './sense',
|
||||
testDir: './test',
|
||||
esPort: {
|
||||
dev: '":'+ (grunt.option('es_port') || 9200) +'"',
|
||||
dist: "(window.location.port !== '' ? ':'+window.location.port : '')"
|
||||
},
|
||||
ga_tracking_code: {
|
||||
dev: 'UA-12395217-6',
|
||||
dist: 'UA-12395217-5'
|
||||
},
|
||||
statsReportUrl: {
|
||||
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/report',
|
||||
dist: 'https://marvel-stats.elasticsearch.com/'
|
||||
},
|
||||
registrationUrl: {
|
||||
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/registration',
|
||||
dist: 'https://marvel-stats.elasticsearch.com/registration'
|
||||
},
|
||||
purchaseConfirmationUrl: {
|
||||
dev: 'http://'+(grunt.option('host') || 'localhost')+':'+ (grunt.option('es_port') || 9200) +'/.marvel_cluster_report/purchase_confirmation',
|
||||
dist: 'https://marvel-stats.elasticsearch.com/purchase_confirmation'
|
||||
},
|
||||
kibanaPort: grunt.option('port') || 5601,
|
||||
kibanaHost: grunt.option('host') ||'localhost'
|
||||
};
|
||||
|
||||
// more detailed config
|
||||
config['buildTempDir'] = config['buildDir'] + '/tmp'; // kibana and custom panels will be merged here
|
||||
config['buildSiteDir'] = config['buildDir'] + '/_site';
|
||||
config['buildSenseDir'] = config['buildSiteDir'] + '/sense'; // compressed minified sense site will be here
|
||||
config['buildKibanaDir'] = config['buildSiteDir'] + '/kibana'; // compressed minified marvel's kibana site will be output here
|
||||
|
||||
// Utility function to load plugin settings into the above config object
|
||||
function loadConfig(config, path) {
|
||||
require('glob').sync('*', {cwd: path}).forEach(function (option) {
|
||||
var key = option.replace(/\.js$/, '');
|
||||
// Merge duplicate plugin configs. It is your responsibility to avoid naming collisions
|
||||
// in tasks
|
||||
config[key] = config[key] || {};
|
||||
grunt.util._.extend(config[key], require(path + option)(config, grunt));
|
||||
});
|
||||
return config;
|
||||
}
|
||||
|
||||
// load plugins
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
// Load Marvel tasks. Identical task names will override kibana tasks
|
||||
grunt.loadTasks('tasks');
|
||||
loadConfig(config, './tasks/options/');
|
||||
|
||||
// pass the config to grunt
|
||||
grunt.initConfig(config);
|
||||
|
||||
};
|
Binary file not shown.
Before Width: | Height: | Size: 147 KiB |
Binary file not shown.
Before Width: | Height: | Size: 91 KiB |
35
package.json
35
package.json
|
@ -4,43 +4,12 @@
|
|||
"company": "Elasticsearch BV"
|
||||
},
|
||||
"name": "marvel",
|
||||
"version": "1.4.0-SNAPSHOT",
|
||||
"version": "2.0.0-SNAPSHOT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/elasticsearch/elasticsearch-marvel.git"
|
||||
"url": "http://github.com/elastic/sense.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rjs-build-analysis": "0.0.3",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-contrib-copy": "~0.4.1",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-compress": "~0.5.2",
|
||||
"grunt-s3": "~0.2.0-alpha.2",
|
||||
"grunt-ngmin": "0.0.3",
|
||||
"grunt-contrib-less": "^0.10.0",
|
||||
"grunt-git-describe": "~2.3.2",
|
||||
"grunt-contrib-cssmin": "~0.6.2",
|
||||
"grunt-contrib-jshint": "~0.8.0",
|
||||
"grunt-contrib-htmlmin": "~0.1.3",
|
||||
"grunt-contrib-requirejs": "~0.4.1",
|
||||
"grunt-angular-templates": "~0.3.12",
|
||||
"grunt-contrib-uglify": "~0.2.4",
|
||||
"load-grunt-tasks": "~0.2.0",
|
||||
"glob": "~3.2.7",
|
||||
"grunt-contrib-symlink": "~0.2.0",
|
||||
"grunt-replace": "~0.5.1",
|
||||
"grunt-string-replace": "~0.2.4",
|
||||
"grunt-shell": "~0.6.0",
|
||||
"grunt-contrib-connect": "~0.5.0",
|
||||
"grunt-connect-rewrite": "~0.1.1",
|
||||
"csso": "~1.3.10",
|
||||
"grunt-mocha": "~0.4.10",
|
||||
"mocha": "~1.17.1",
|
||||
"grunt-contrib-jade": "~0.10.0",
|
||||
"lodash": "~2.4.1",
|
||||
"grunt-contrib-watch": "~0.5.3",
|
||||
"grunt-blanket-mocha": "^0.4.0",
|
||||
"moment": "~2.6.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -1,281 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
define(function (require) {
|
||||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var $ = require("jquery");
|
||||
|
||||
var ATTR_DEFAULTS= {
|
||||
report: true,
|
||||
status: 'trial'
|
||||
};
|
||||
|
||||
function PhoneHome (options) {
|
||||
this._id = options._id || 'marvelOpts';
|
||||
this._type = options._type || 'appdata';
|
||||
this.client = options.client || $;
|
||||
this.baseUrl = options.baseUrl;
|
||||
this.index = options.index;
|
||||
// set defaults
|
||||
this.attributes = _.defaults({},ATTR_DEFAULTS);
|
||||
this.events = {};
|
||||
this.currentBaseUrl = this.baseUrl;
|
||||
|
||||
this.fieldsToES= [
|
||||
'registrationData',
|
||||
'status',
|
||||
'version',
|
||||
'report'
|
||||
];
|
||||
|
||||
this.fieldsToBrowser = [
|
||||
'trialTimestamp',
|
||||
'lastReport',
|
||||
'registrationSent',
|
||||
'report',
|
||||
'status'
|
||||
];
|
||||
|
||||
var self = this;
|
||||
this.on('change:data', function (data) {
|
||||
self.sendIfDue(data);
|
||||
self.checkAndSendRegistrationData();
|
||||
});
|
||||
}
|
||||
|
||||
PhoneHome.prototype = {
|
||||
|
||||
on: function (id, cb) {
|
||||
if (!_.isArray(this.events[id])) {
|
||||
this.events[id] = [];
|
||||
}
|
||||
this.events[id].push(cb);
|
||||
},
|
||||
|
||||
clear: function (id) {
|
||||
delete this.events[id];
|
||||
},
|
||||
|
||||
trigger: function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var id = args.shift();
|
||||
if (this.events[id]) {
|
||||
_.each(this.events[id], function (cb) {
|
||||
cb.apply(null, args);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setBaseUrl: function (url) {
|
||||
this.baseUrl = url;
|
||||
},
|
||||
|
||||
set: function (key, value) {
|
||||
var self = this;
|
||||
var previous;
|
||||
if (typeof(key) === 'object') {
|
||||
previous = _.pick(this.attributes, _.keys(key));
|
||||
this.attributes = _.assign(this.attributes, key);
|
||||
_.each(key, function (value, name) {
|
||||
self.trigger('change:'+name, value, previous[name]);
|
||||
});
|
||||
} else {
|
||||
previous = this.attributes[key];
|
||||
this.attributes[key] = value;
|
||||
this.trigger('change:'+key, value, previous);
|
||||
}
|
||||
},
|
||||
|
||||
get: function (key) {
|
||||
if (_.isUndefined(key)) {
|
||||
return this.attributes;
|
||||
} else {
|
||||
return this.attributes[key];
|
||||
}
|
||||
},
|
||||
|
||||
setTrialTimestamp: function (timestamp) {
|
||||
this.set('trialTimestamp', timestamp);
|
||||
this.saveToBrowser();
|
||||
},
|
||||
|
||||
saveToES: function () {
|
||||
var data = _.pick(this.attributes, this.fieldsToES);
|
||||
var url = this.baseUrl+'/'+this.index+'/'+this._type+'/'+this._id;
|
||||
return this.client.put(url, data);
|
||||
},
|
||||
|
||||
saveToBrowser: function () {
|
||||
var data = _.pick(this.attributes, this.fieldsToBrowser);
|
||||
localStorage.setItem(this._id, JSON.stringify(data));
|
||||
},
|
||||
|
||||
saveAll: function () {
|
||||
this.saveToBrowser();
|
||||
return this.saveToES();
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
var url = this.baseUrl+'/'+this.index+'/'+this._type+'/'+this._id;
|
||||
localStorage.removeItem(this._id);
|
||||
return this.client.delete(url);
|
||||
},
|
||||
|
||||
checkReportStatus: function () {
|
||||
var reportInterval = 86400000;
|
||||
var sendReport = false;
|
||||
|
||||
// Check to see if the currentBaseUrl is set along with if it has changed
|
||||
// since the last time we checked.
|
||||
var urlChanged = (!_.isEmpty(this.currentBaseUrl) && (this.currentBaseUrl !== this.baseUrl));
|
||||
this.currentBaseUrl = this.baseUrl;
|
||||
|
||||
if (this.get('version') && this.get('report')) {
|
||||
// if the URL changes we need to send what we can
|
||||
if (urlChanged) {
|
||||
sendReport = true;
|
||||
}
|
||||
// If the last report is empty it means we've never sent an report and
|
||||
// now is the time to send it.
|
||||
if (!this.get('lastReport')) {
|
||||
sendReport = true;
|
||||
}
|
||||
// If it's been a day since we last sent an report, send one.
|
||||
if (new Date().getTime() - parseInt(this.get('lastReport'), 10) > reportInterval) {
|
||||
sendReport = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we need to send a report then we need to record the last time we
|
||||
// sent it and store it
|
||||
if (sendReport) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If all else fails... don't send
|
||||
return false;
|
||||
},
|
||||
|
||||
checkRegistratonStatus: function () {
|
||||
var regTimeout = (86400000*7); // 7 days
|
||||
// Calculate if the registration is due
|
||||
var regDue = (new Date().getTime() - parseInt(this.get('trialTimestamp'), 10) > regTimeout);
|
||||
// if the user is not registers and they haven't purchased and it's been 7 days
|
||||
// since we displayed the welcome screen then force registration.
|
||||
return (this.get('status') === 'trial' && regDue);
|
||||
},
|
||||
|
||||
sendIfDue: function (data) {
|
||||
var self = this;
|
||||
if (this.checkReportStatus()) {
|
||||
return this.client.post(this.getStatsReportUrl(), data).then(function () {
|
||||
self.set('lastReport', new Date().getTime());
|
||||
self.saveToBrowser();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
register: function (data) {
|
||||
var self = this;
|
||||
data.creationDate = new Date().toISOString();
|
||||
this.set('registrationData', data);
|
||||
this.set('status', 'registered');
|
||||
self.saveToBrowser();
|
||||
return self.saveToES();
|
||||
},
|
||||
|
||||
confirmPurchase: function (data) {
|
||||
var self = this;
|
||||
data.creationDate = new Date().toISOString();
|
||||
this.set('registrationData', data);
|
||||
this.set('status', 'purchased');
|
||||
this.set('registrationSent', false);
|
||||
self.saveToBrowser();
|
||||
return self.saveToES();
|
||||
},
|
||||
|
||||
checkAndSendRegistrationData: function () {
|
||||
var self = this;
|
||||
var regData;
|
||||
var registrationData = this.get('registrationData');
|
||||
var data = this.get('data');
|
||||
var url = this.getRegistrationUrl();
|
||||
|
||||
if (!this.get('registrationSent') && registrationData && data && data.uuid ) {
|
||||
registrationData.uuid = data.uuid;
|
||||
|
||||
if (this.get('status') === 'purchased') {
|
||||
url = this.getPurchaseConfirmationUrl();
|
||||
}
|
||||
|
||||
return this.client.post(url, registrationData).then(function () {
|
||||
self.set('registrationSent', true);
|
||||
self.saveToBrowser();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
fetch: function () {
|
||||
var data, self = this;
|
||||
|
||||
try {
|
||||
data = JSON.parse(localStorage.getItem(self._id));
|
||||
this.set(data);
|
||||
} catch (err) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
var emptyESVars = _.transform(self.fieldsToES, function (res, key) { res[key]= ATTR_DEFAULTS[key]; }, {});
|
||||
|
||||
// for now, just delete report as we don't want to override people opting out locally when they
|
||||
// have no write access to their ES instance.
|
||||
delete emptyESVars.report;
|
||||
|
||||
var url = this.baseUrl+'/'+this.index+'/'+this._type+'/'+this._id;
|
||||
return this.client.get(url).then(function (resp) {
|
||||
// make sure that all missing vars are overridden to missing
|
||||
var data = _.defaults(resp.data._source, emptyESVars);
|
||||
self.set(data);
|
||||
self.saveToBrowser();
|
||||
return self.attributes;
|
||||
}, function (resp) {
|
||||
// error loading ES, make all variables and override browser
|
||||
self.set(emptyESVars);
|
||||
self.saveToBrowser();
|
||||
});
|
||||
},
|
||||
|
||||
// needed for testing
|
||||
getStatsReportUrl: function () {
|
||||
return '@@stats_report_url';
|
||||
},
|
||||
getRegistrationUrl: function () {
|
||||
return '@@registration_url';
|
||||
},
|
||||
getPurchaseConfirmationUrl: function () {
|
||||
return '@@purchase_confirmation_url';
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return PhoneHome;
|
||||
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* jshint globalstrict: false */
|
||||
/* global module */
|
||||
module.exports = function (grunt) {
|
||||
'use strict';
|
||||
|
||||
grunt.registerTask('build', [
|
||||
'shell:verify_kibana_status',
|
||||
'jshint',
|
||||
'clean:build',
|
||||
'build:load_git_versions',
|
||||
'shell:maven_clean',
|
||||
'shell:maven_package',
|
||||
'copy:merge_marvel_kibana',
|
||||
'replace:dist_marvel_config',
|
||||
'shell:build_kibana',
|
||||
'build_sense',
|
||||
'copy:artifacts_to_build',
|
||||
'clean:build_tmp',
|
||||
'replace:git_commits',
|
||||
'replace:kibana_replace_title'
|
||||
]);
|
||||
|
||||
grunt.registerTask('build_sense', [
|
||||
'requirejs:build_sense',
|
||||
'clean:sense_build_tests'
|
||||
]);
|
||||
|
||||
grunt.registerTask('build:load_git_versions', function () {
|
||||
grunt.event.once('git-describe', function (desc) {
|
||||
grunt.config.set('kibanaCommit', desc.object);
|
||||
grunt.event.once('git-describe', function (desc) {
|
||||
grunt.config.set('marvelCommit', desc.object);
|
||||
});
|
||||
grunt.task.run('git-describe:marvel');
|
||||
});
|
||||
grunt.task.run('git-describe:kibana');
|
||||
});
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('default', ['jshint:kibana', 'jshint:sense']);
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
all: {
|
||||
options: {
|
||||
verbose: true,
|
||||
threshold: 80,
|
||||
log: true,
|
||||
logErros: true,
|
||||
urls: ['http://localhost:6767/test/index.html'],
|
||||
reporter: 'Spec'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
setup: [ '<%= kibanaCheckoutDir %>', '<%= buildDir %>' ],
|
||||
build: [ '<%= buildDir %>' ],
|
||||
build_tmp: [ '<%= buildTempDir %>' ],
|
||||
package: ['<%= packageDir %>'],
|
||||
sense_build_tests: ['<%= buildSenseDir %>/tests']
|
||||
};
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
zip: {
|
||||
options: {
|
||||
archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.zip'
|
||||
},
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= buildDir %>',
|
||||
src: ['**/*'],
|
||||
dest: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
tgz: {
|
||||
options: {
|
||||
archive: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
|
||||
},
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= buildDir %>',
|
||||
src: ['**/*'],
|
||||
dest: ''
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,69 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var _ = require('lodash');
|
||||
module.exports = function (config) {
|
||||
var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest;
|
||||
|
||||
var middleware = function (connect, options) {
|
||||
return [
|
||||
rewriteRulesSnippet, // RewriteRules support
|
||||
connect.static(require('path').resolve(options.base)) // mount filesystem
|
||||
];
|
||||
};
|
||||
|
||||
var testBase = '.';
|
||||
|
||||
return {
|
||||
rules: {
|
||||
'^/kibana/app/dashboards/marvel/(.*)$': './kibana/dashboards/$1',
|
||||
'^/kibana/app/panels/marvel/(.*)$': './kibana/panels/$1',
|
||||
'^/kibana/app/services/marvel/(.*)$': '/kibana/services/$1',
|
||||
'^/kibana/app/lib/(.*)$': '/kibana/lib/$1',
|
||||
'^/kibana/vendor/marvel/(.*)$': '/kibana/vendor/$1',
|
||||
'^/kibana/config.js$': './<%= buildTempDir %>/config.js',
|
||||
'^/kibana(.*)$': '<%= kibanaCheckoutDir %>/src$1',
|
||||
'^/common/analytics.js$': '/<%= buildTempDir %>/common/analytics.js',
|
||||
'^/common/PhoneHome.js$': '/<%= buildTempDir %>/common/PhoneHome.js',
|
||||
'^/sense(.*)$': '/sense$1',
|
||||
'^/common(.*)$': '/common$1',
|
||||
'^/test/panels(.*)$': '/kibana/panels$1',
|
||||
'^/test/app(.*)$': '<%= kibanaCheckoutDir %>/src/app$1',
|
||||
'^/test/vendor(.*)$': '<%= kibanaCheckoutDir %>/src/vendor$1',
|
||||
},
|
||||
server: {
|
||||
options: {
|
||||
port: '<%= kibanaPort %>',
|
||||
hostname: '<%= kibanaHost %>',
|
||||
base: '.',
|
||||
keepalive: false,
|
||||
middleware: middleware
|
||||
}
|
||||
},
|
||||
test: {
|
||||
options: {
|
||||
hostname: '<%= kibanaHost %>',
|
||||
port: '6767',
|
||||
base: testBase,
|
||||
keepalive: false,
|
||||
middleware: middleware
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,105 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
function exclude(src) {
|
||||
return !(/(analytics|PhoneHome)/.test(src));
|
||||
}
|
||||
|
||||
return {
|
||||
artifacts_to_build: {
|
||||
files: [
|
||||
{
|
||||
// LICENSE.txt
|
||||
cwd: '.',
|
||||
expand: true,
|
||||
src: ['LICENSE.txt'],
|
||||
dest: '<%= buildDir %>'
|
||||
},
|
||||
{
|
||||
// agent jar
|
||||
cwd: '<%= agentDir %>/target',
|
||||
expand: true,
|
||||
src: ['<%= pkg.name %>-<%= pkg.version %>.jar'],
|
||||
dest: '<%= buildDir %>'
|
||||
},
|
||||
{
|
||||
// merged kibana
|
||||
cwd: '<%= buildTempDir %>/dist',
|
||||
expand: true,
|
||||
src: ['**'],
|
||||
dest: '<%= buildKibanaDir %>'
|
||||
},
|
||||
{
|
||||
cwd: '.',
|
||||
expand: true,
|
||||
src: ['index.html', './common/**/*'],
|
||||
dest: '<%= buildSiteDir %>',
|
||||
filter: exclude
|
||||
}
|
||||
]},
|
||||
merge_marvel_kibana: {
|
||||
files: [
|
||||
{
|
||||
expand: true,
|
||||
cwd: '<%= kibanaCheckoutDir %>',
|
||||
src: [ '**', '.jshintrc', '.git/**'],
|
||||
dest: '<%= buildTempDir %>'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'kibana/dashboards',
|
||||
src: '**',
|
||||
dest: '<%= buildTempDir %>/src/app/dashboards/marvel'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'kibana/panels',
|
||||
src: '**',
|
||||
dest: '<%= buildTempDir %>/src/app/panels/marvel'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'kibana/services',
|
||||
src: '**',
|
||||
dest: '<%= buildTempDir %>/src/app/services/marvel'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'kibana/lib',
|
||||
src: '**',
|
||||
dest: '<%= buildTempDir %>/src/app/lib'
|
||||
},
|
||||
{
|
||||
src: 'kibana/vendor/react/react.js',
|
||||
dest: '<%= buildTempDir %>/src/vendor/marvel/react/react.js'
|
||||
},
|
||||
{
|
||||
expand: true,
|
||||
cwd: 'kibana/vendor',
|
||||
src: '**',
|
||||
dest: '<%= buildTempDir %>/src/vendor/marvel',
|
||||
filter: function (src) {
|
||||
return !/vendor\/(kibana|react)/.test(src);
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,33 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
marvel: {
|
||||
options: {
|
||||
cwd: '.'
|
||||
}
|
||||
},
|
||||
kibana: {
|
||||
options: {
|
||||
cwd: '<%= kibanaCheckoutDir %>'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
kibana: {
|
||||
options: {
|
||||
repository: 'git://github.com/elasticsearch/kibana.git',
|
||||
directory: '<%= kibanaCheckoutDir %>'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
var glob = require('glob');
|
||||
module.exports = function (grunt) {
|
||||
var tests = glob.sync('./test/unit/**/*.js').map(function (file) {
|
||||
return file.replace(/^\./,'');
|
||||
});
|
||||
return {
|
||||
test: {
|
||||
options: {
|
||||
data: {
|
||||
tests: JSON.stringify(tests),
|
||||
host: '<%= kibanaHost %>'
|
||||
},
|
||||
client: false
|
||||
},
|
||||
files: {
|
||||
'./test/index.html': './test/templates/index.jade'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
// just lint the source dir
|
||||
kibana: {
|
||||
src: [
|
||||
'Gruntfile.js',
|
||||
'kibana/panels/**/*.js',
|
||||
'kibana/dashboards/**/*.js'
|
||||
],
|
||||
options: {
|
||||
jshintrc: 'kibana/.jshintrc'
|
||||
}
|
||||
},
|
||||
sense: {
|
||||
src: '<%= senseDir %>/app/**/*.js',
|
||||
options: {
|
||||
jshintrc: 'sense/.jshintrc'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
shard_allocation: {
|
||||
options: {
|
||||
paths: ['kibana/panels/shard_allocation/css']
|
||||
},
|
||||
files: {
|
||||
'kibana/panels/shard_allocation/css/style.css': 'kibana/panels/shard_allocation/css/style.less'
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function(config) {
|
||||
return {
|
||||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
|
||||
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
||||
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
|
||||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||
' Licensed <%= pkg.license %> */\n\n'
|
||||
};
|
||||
};
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
unit: {
|
||||
options: {
|
||||
reporter: 'Spec',
|
||||
log: true,
|
||||
logErrors: true,
|
||||
urls: [
|
||||
'http://localhost:6767/test/'
|
||||
],
|
||||
run: false
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,124 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
// copy source to temp, we will minify in place for the dist build
|
||||
dev_marvel_config: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: 'port',
|
||||
replacement: '<%= esPort.dev %>',
|
||||
},
|
||||
{
|
||||
match: 'stats_report_url',
|
||||
replacement: '<%= statsReportUrl.dev %>',
|
||||
},
|
||||
{
|
||||
match: 'registration_url',
|
||||
replacement: '<%= registrationUrl.dev %>',
|
||||
},
|
||||
{
|
||||
match: 'purchase_confirmation_url',
|
||||
replacement: '<%= purchaseConfirmationUrl.dev %>',
|
||||
},
|
||||
{
|
||||
match: 'ga_tracking_code',
|
||||
replacement: '<%= ga_tracking_code.dev %>',
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{expand: true, flatten: true, src: ['./kibana/config.js'], dest: '<%= buildTempDir %>'},
|
||||
{expand: true, flatten: true, src: ['./common/analytics.js'], dest: '<%= buildTempDir %>/common/'},
|
||||
{expand: true, flatten: true, src: ['./common/PhoneHome.js'], dest: '<%= buildTempDir %>/common/'}
|
||||
]
|
||||
},
|
||||
dist_marvel_config: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: 'port',
|
||||
replacement: '<%= esPort.dist %>',
|
||||
},
|
||||
{
|
||||
match: 'stats_report_url',
|
||||
replacement: '<%= statsReportUrl.dist %>',
|
||||
},
|
||||
{
|
||||
match: 'registration_url',
|
||||
replacement: '<%= registrationUrl.dist %>',
|
||||
},
|
||||
{
|
||||
match: 'purchase_confirmation_url',
|
||||
replacement: '<%= purchaseConfirmationUrl.dist %>',
|
||||
},
|
||||
{
|
||||
match: 'ga_tracking_code',
|
||||
replacement: '<%= ga_tracking_code.dist %>',
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{expand: true, flatten: true, src: ['./kibana/config.js'], dest: '<%= buildTempDir %>/src/'},
|
||||
{expand: true, flatten: true, src: ['./common/analytics.js'], dest: '<%= buildTempDir %>/common/'},
|
||||
{expand: true, flatten: true, src: ['./common/PhoneHome.js'], dest: '<%= buildTempDir %>/common/'}
|
||||
]
|
||||
},
|
||||
git_commits: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: 'MARVEL_REVISION',
|
||||
replacement: '<%= marvelCommit %>'
|
||||
},
|
||||
{
|
||||
match: /@MARVEL_REV@/g,
|
||||
replacement: config.pkg.version + "-" + '<%= marvelCommit %>'
|
||||
},
|
||||
{
|
||||
match: 'KIBANA_REVISION',
|
||||
replacement: '<%= kibanaCommit %>'
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{
|
||||
cwd: '<%= buildSiteDir %>',
|
||||
expand: true, src: ['**/*'], dest: '<%= buildSiteDir %>/'}
|
||||
]
|
||||
},
|
||||
kibana_replace_title: {
|
||||
options: {
|
||||
patterns: [
|
||||
{
|
||||
match: /<title>.*?<\/title>/,
|
||||
replacement: '<title>{{dashboard.current.title ? dashboard.current.title : "Marvel"}}</title>'
|
||||
}
|
||||
]
|
||||
},
|
||||
files: [
|
||||
{
|
||||
cwd: '<%= buildSiteDir %>',
|
||||
expand: true, src: ['kibana/index.html'], dest: '<%= buildSiteDir %>/'}
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* jshint node:true */
|
||||
'use strict';
|
||||
module.exports = function (grunt) {
|
||||
return {
|
||||
build_sense: {
|
||||
options: {
|
||||
appDir: '<%= senseDir %>',
|
||||
dir: '<%= buildSenseDir %>',
|
||||
|
||||
modules: [
|
||||
{
|
||||
name: 'app',
|
||||
exclude: [
|
||||
'ace'
|
||||
],
|
||||
excludeShallow: [
|
||||
'welcome_popup'
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
mainConfigFile: '<%= senseDir %>/app/require.config.js',
|
||||
paths: {
|
||||
'analytics': __dirname+'/../../build/tmp/common/analytics',
|
||||
},
|
||||
optimize: 'uglify2',
|
||||
optimizeAllPluginResources: true,
|
||||
preserveLicenseComments: true,
|
||||
generateSourceMaps: false,
|
||||
|
||||
uglify2: {
|
||||
max_line_len: 100
|
||||
},
|
||||
|
||||
removeCombined: true,
|
||||
findNestedDependencies: true,
|
||||
normalizeDirDefines: 'all',
|
||||
inlineText: true,
|
||||
skipPragmas: true,
|
||||
|
||||
done: function (done, output) {
|
||||
var duplicates = require('rjs-build-analysis').duplicates(output);
|
||||
|
||||
if (duplicates.length > 0) {
|
||||
grunt.log.subhead('Duplicates found in requirejs build:');
|
||||
grunt.log.warn(duplicates);
|
||||
done(new Error('r.js built duplicate modules, please check the excludes option.'));
|
||||
}
|
||||
|
||||
done();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,55 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config, grunt) {
|
||||
var upload;
|
||||
|
||||
if (grunt.option('latest')) {
|
||||
upload = [
|
||||
{
|
||||
src: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.zip',
|
||||
dest: 'elasticsearch/<%= pkg.name %>/<%= pkg.name %>-latest.zip',
|
||||
},
|
||||
{
|
||||
src: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz',
|
||||
dest: 'elasticsearch/<%= pkg.name %>/<%= pkg.name %>-latest.tar.gz',
|
||||
}
|
||||
];
|
||||
} else {
|
||||
upload = [
|
||||
{
|
||||
src: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.zip',
|
||||
dest: 'elasticsearch/<%= pkg.name %>/<%= pkg.name %>-<%= pkg.version %>.zip',
|
||||
},
|
||||
{
|
||||
src: '<%= packageDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz',
|
||||
dest: 'elasticsearch/<%= pkg.name %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz',
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
return {
|
||||
release: {
|
||||
bucket: 'download.elasticsearch.org',
|
||||
access: 'private',
|
||||
//debug: true, // uncommment to prevent actual upload
|
||||
upload: upload
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,85 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (config) {
|
||||
return {
|
||||
maven_clean: {
|
||||
command: 'mvn clean',
|
||||
cwd: '<%= agentDir %>',
|
||||
options: {
|
||||
stdout: true,
|
||||
failOnError: true,
|
||||
execOptions: {
|
||||
cwd: '<%= agentDir %>',
|
||||
}
|
||||
},
|
||||
},
|
||||
maven_package: {
|
||||
command: 'mvn package',
|
||||
options: {
|
||||
stdout: true,
|
||||
failOnError: true,
|
||||
execOptions: {
|
||||
cwd: '<%= agentDir %>',
|
||||
maxBuffer: 1024 * 1024 * 1024,
|
||||
}
|
||||
},
|
||||
},
|
||||
build_kibana: {
|
||||
command: [ 'npm install', 'grunt build' ].join("&&"),
|
||||
options: {
|
||||
stdout: true,
|
||||
failOnError: true,
|
||||
execOptions: {
|
||||
cwd: '<%= buildTempDir %>',
|
||||
}
|
||||
}
|
||||
},
|
||||
verify_kibana_status: {
|
||||
command: [ 'test -z "`git status --porcelain`"', 'git diff-index --quiet <%= kibanaRevision %> --' ].join("&&"),
|
||||
options: {
|
||||
stdout: true,
|
||||
stderr: true,
|
||||
failOnError: true,
|
||||
execOptions: {
|
||||
cwd: '<%= kibanaCheckoutDir %>',
|
||||
},
|
||||
callback: function (error, stdout, stderr, cb) {
|
||||
if (error) {
|
||||
require("grunt").fatal("Kibana checkout is dirty or not on the right branch");
|
||||
}
|
||||
cb();
|
||||
}
|
||||
}
|
||||
},
|
||||
clone_kibana: {
|
||||
command: [ 'git clone git://github.com/elasticsearch/kibana.git <%= kibanaCheckoutDir %>',
|
||||
'cd <%= kibanaCheckoutDir %>',
|
||||
'git checkout <%= kibanaRevision %>'
|
||||
].join('&&'),
|
||||
options: {
|
||||
stdout: true,
|
||||
stderr: true,
|
||||
failOnError: true,
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
|
@ -1,49 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
var testFiles = [
|
||||
'common/**/*.js',
|
||||
'kibana/**/*.js',
|
||||
'test/**/*.js',
|
||||
'test/templates/**/*.jade'
|
||||
];
|
||||
return {
|
||||
test: {
|
||||
files: testFiles,
|
||||
tasks: [ 'jade:test', 'mocha:unit' ]
|
||||
},
|
||||
less: {
|
||||
files: ['kibana/panels/**/*.less'],
|
||||
tasks: ['less']
|
||||
},
|
||||
common: {
|
||||
files: ['common/**/*.js'],
|
||||
tasks: ['replace:dev_marvel_config']
|
||||
|
||||
},
|
||||
dev: {
|
||||
files: testFiles,
|
||||
tasks: [ 'jade:test', 'replace:dev_marvel_config'],
|
||||
options: {
|
||||
livereload: true,
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('package', [
|
||||
'build',
|
||||
'compress:zip',
|
||||
'compress:tgz'
|
||||
]);
|
||||
};
|
|
@ -1,32 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.registerTask('release', [
|
||||
'release:load_s3_config',
|
||||
's3:release'
|
||||
]);
|
||||
grunt.registerTask('release:load_s3_config', function () {
|
||||
var config = grunt.file.readJSON('.aws-config.json');
|
||||
grunt.config('s3.options', {
|
||||
key: config.key,
|
||||
secret: config.secret
|
||||
});
|
||||
});
|
||||
};
|
|
@ -1,30 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('server', function () {
|
||||
grunt.task.run([
|
||||
'replace:dev_marvel_config',
|
||||
'configureRewriteRules',
|
||||
'less',
|
||||
'connect:server',
|
||||
'watch:common'
|
||||
]);
|
||||
});
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('setup', [
|
||||
'clean:setup',
|
||||
'shell:clone_kibana'
|
||||
]);
|
||||
};
|
|
@ -1,37 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('test:dev', [
|
||||
'replace:dev_marvel_config',
|
||||
'configureRewriteRules',
|
||||
'jade:test',
|
||||
'connect:test',
|
||||
'watch:dev'
|
||||
]);
|
||||
grunt.registerTask('test', [
|
||||
'replace:dev_marvel_config',
|
||||
'configureRewriteRules',
|
||||
'jade:test',
|
||||
'connect:test',
|
||||
// 'mocha:unit',
|
||||
'blanket_mocha'
|
||||
]);
|
||||
grunt.registerTask('test:watch', [ 'test', 'watch:test' ]);
|
||||
};
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"extends": "../../kibana/.jshintrc",
|
||||
"strict": false,
|
||||
"globals": {
|
||||
"define": true,
|
||||
"expect": true,
|
||||
"require": true,
|
||||
"Chromath": false,
|
||||
"describe": true,
|
||||
"it": true,
|
||||
"before": true,
|
||||
"beforeEach": true,
|
||||
"after": true,
|
||||
"afterEach": true,
|
||||
"inject": true,
|
||||
"sinon": true
|
||||
}
|
||||
}
|
|
@ -1,479 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
define(function (require) {
|
||||
'use strict';
|
||||
var $ = require("jquery");
|
||||
var PhoneHome = require('common/PhoneHome');
|
||||
|
||||
describe('common/PhoneHome.js', function() {
|
||||
describe('Object Model', function() {
|
||||
|
||||
var phoneHome, client;
|
||||
|
||||
beforeEach(function () {
|
||||
client = { delete: sinon.stub(), put: sinon.stub(), post: sinon.stub(), get: sinon.stub() };
|
||||
phoneHome = new PhoneHome({
|
||||
client: client,
|
||||
baseUrl: 'http://localhost:9200',
|
||||
index: '.marvel-kibana'
|
||||
});
|
||||
});
|
||||
|
||||
describe('set()', function() {
|
||||
it('should set a single value', function() {
|
||||
phoneHome.set('test', '123');
|
||||
expect(phoneHome.attributes).to.have.property('test', '123');
|
||||
});
|
||||
|
||||
it('should bulk set using an object', function() {
|
||||
phoneHome.set({ 'key1': 'value1', 'key2': 'value2' });
|
||||
expect(phoneHome.attributes).to.have.property('key1', 'value1');
|
||||
expect(phoneHome.attributes).to.have.property('key2', 'value2');
|
||||
});
|
||||
|
||||
it('should fire a change event on set', function(done) {
|
||||
phoneHome.on('change:key1', function (value) {
|
||||
expect(value).to.equal('value1');
|
||||
done();
|
||||
});
|
||||
phoneHome.set('key1', 'value1');
|
||||
});
|
||||
|
||||
it('should fire a change event on bulk set for each', function(done) {
|
||||
var count = 0;
|
||||
var checkIfDone = function () {
|
||||
count++;
|
||||
if (count === 2) {
|
||||
done();
|
||||
}
|
||||
};
|
||||
phoneHome.on('change:key1', function (value) {
|
||||
expect(value).to.equal('value1');
|
||||
checkIfDone();
|
||||
});
|
||||
phoneHome.on('change:key1', function (value) {
|
||||
expect(value).to.equal('value1');
|
||||
checkIfDone();
|
||||
});
|
||||
phoneHome.set({ 'key1': 'value1', 'key2': 'value2' });
|
||||
});
|
||||
|
||||
it('should set the old value for the change event for single set', function (done) {
|
||||
phoneHome.set('key1', 'value0');
|
||||
phoneHome.on('change:key1', function (newVal, oldVal) {
|
||||
expect(oldVal).to.equal('value0');
|
||||
expect(newVal).to.equal('value1');
|
||||
done();
|
||||
});
|
||||
setTimeout(function () {
|
||||
phoneHome.set('key1', 'value1');
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should set the old value for the change event for bulk set', function (done) {
|
||||
phoneHome.set('key1', 'value0');
|
||||
phoneHome.on('change:key1', function (newVal, oldVal) {
|
||||
expect(oldVal).to.equal('value0');
|
||||
expect(newVal).to.equal('value1');
|
||||
done();
|
||||
});
|
||||
setTimeout(function () {
|
||||
phoneHome.set({ 'key1': 'value1' });
|
||||
}, 0);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('get()', function() {
|
||||
|
||||
it('should return a value when get is called', function() {
|
||||
phoneHome.set('key1', 'value1');
|
||||
expect(phoneHome.get('key1')).to.equal('value1');
|
||||
});
|
||||
|
||||
it('should return a hash when get is called without a key', function() {
|
||||
phoneHome.set('key1', 'value1');
|
||||
phoneHome.set('key2', 'value2');
|
||||
expect(phoneHome.get()).to.have.property('key1', 'value1');
|
||||
expect(phoneHome.get()).to.have.property('key2', 'value2');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('save functions', function() {
|
||||
it('should save only fieldsToBrowser fields to the localStore', function () {
|
||||
var data = {
|
||||
trialTimestamp: 1,
|
||||
report: true,
|
||||
status: 'test',
|
||||
foo: true
|
||||
};
|
||||
phoneHome.set(data);
|
||||
phoneHome.saveToBrowser();
|
||||
expect(localStorage.getItem('marvelOpts')).to.equal(JSON.stringify({ trialTimestamp: 1, report: true, status: 'test' }));
|
||||
});
|
||||
|
||||
it('should save only fieldsToES fields to the Elasticsearch', function () {
|
||||
var data = {
|
||||
registrationData: 'test',
|
||||
report: true,
|
||||
status: 'purchased',
|
||||
trialTimestamp: 1
|
||||
};
|
||||
phoneHome.set(data);
|
||||
phoneHome.saveToES();
|
||||
sinon.assert.calledOnce(client.put);
|
||||
expect(client.put.args[0][0]).to.equal('http://localhost:9200/.marvel-kibana/appdata/marvelOpts');
|
||||
expect(client.put.args[0][1]).to.have.property('status', 'purchased');
|
||||
expect(client.put.args[0][1]).to.have.property('registrationData', 'test');
|
||||
expect(client.put.args[0][1]).to.have.property('report', true);
|
||||
expect(client.put.args[0][1]).to.not.have.property('trialTimestamp');
|
||||
});
|
||||
});
|
||||
|
||||
describe('misc functions', function() {
|
||||
it('should delete everyting when destory is called', function() {
|
||||
var lsRemoveStub = sinon.stub(localStorage, 'removeItem');
|
||||
phoneHome.destroy();
|
||||
sinon.assert.calledOnce(lsRemoveStub);
|
||||
sinon.assert.calledOnce(client.delete);
|
||||
sinon.assert.calledWith(client.delete, 'http://localhost:9200/.marvel-kibana/appdata/marvelOpts');
|
||||
lsRemoveStub.restore();
|
||||
});
|
||||
|
||||
it('should set the baseUrl', function() {
|
||||
phoneHome.setBaseUrl('http://foo');
|
||||
expect(phoneHome).to.have.property('baseUrl', 'http://foo');
|
||||
});
|
||||
|
||||
it('should set trialTimestamp', function() {
|
||||
var saveToBrowserStub = sinon.stub(phoneHome, 'saveToBrowser');
|
||||
phoneHome.setTrialTimestamp(1);
|
||||
expect(phoneHome.get('trialTimestamp')).to.equal(1);
|
||||
sinon.assert.calledOnce(saveToBrowserStub);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Phone Home Features', function() {
|
||||
var phoneHome, client;
|
||||
|
||||
beforeEach(function () {
|
||||
client = { delete: sinon.stub(), put: sinon.stub(), post: sinon.stub(), get: sinon.stub() };
|
||||
phoneHome = new PhoneHome({
|
||||
client: client,
|
||||
baseUrl: 'http://localhost:9200',
|
||||
index: '.marvel-kibana'
|
||||
});
|
||||
});
|
||||
|
||||
describe('change:data events', function() {
|
||||
it('should call sendIfDue()', function(done) {
|
||||
var sendIfDueStub = sinon.stub(phoneHome, 'sendIfDue');
|
||||
phoneHome.on('change:data', function () {
|
||||
sinon.assert.calledOnce(sendIfDueStub);
|
||||
expect(sendIfDueStub.args[0][0]).to.have.property('key1', 'value1');
|
||||
sendIfDueStub.restore();
|
||||
done();
|
||||
});
|
||||
phoneHome.set('data', { 'key1': 'value1' });
|
||||
});
|
||||
|
||||
it('should call checkAndSendRegistrationData()', function(done) {
|
||||
var checkStub = sinon.stub(phoneHome, 'checkAndSendRegistrationData');
|
||||
phoneHome.on('change:data', function () {
|
||||
sinon.assert.calledOnce(checkStub);
|
||||
checkStub.restore();
|
||||
done();
|
||||
});
|
||||
phoneHome.set('data', {});
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkReportStatus()', function() {
|
||||
it('should return true if lastReport is NOT set', function() {
|
||||
phoneHome.set({
|
||||
version: '1.0',
|
||||
report: true
|
||||
});
|
||||
expect(phoneHome.checkReportStatus()).to.equal(true);
|
||||
});
|
||||
|
||||
it('should return true if url changed', function() {
|
||||
phoneHome.setBaseUrl('http://search-01:4080');
|
||||
phoneHome.set({
|
||||
version: '1.0',
|
||||
lastReport: new Date().getTime(),
|
||||
report: true
|
||||
});
|
||||
expect(phoneHome.checkReportStatus()).to.equal(true);
|
||||
});
|
||||
|
||||
it('should return true if lastReport is older then a day', function() {
|
||||
phoneHome.set({
|
||||
version: '1.0',
|
||||
lastReport: new Date().getTime()-86400001,
|
||||
report: true
|
||||
});
|
||||
expect(phoneHome.checkReportStatus()).to.equal(true);
|
||||
});
|
||||
|
||||
it('should return false if lastReport is NOT older then a day', function() {
|
||||
phoneHome.set({
|
||||
version: '1.0',
|
||||
lastReport: new Date().getTime()-3600,
|
||||
report: true
|
||||
});
|
||||
expect(phoneHome.checkReportStatus()).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('checkRegistratonStatus()', function() {
|
||||
it('should return true if registered is false and trialTimestamp is older then 7 days', function() {
|
||||
phoneHome.set({
|
||||
status: 'trial',
|
||||
trialTimestamp: new Date().getTime()-(86400000*7.25)
|
||||
});
|
||||
expect(phoneHome.checkRegistratonStatus()).to.equal(true);
|
||||
});
|
||||
|
||||
it('should return false if registered is true and trialTimestamp is older then 7 days', function() {
|
||||
phoneHome.set({
|
||||
status: 'registered',
|
||||
trialTimestamp: new Date().getTime()-(86400000*7.25)
|
||||
});
|
||||
expect(phoneHome.checkRegistratonStatus()).to.equal(false);
|
||||
});
|
||||
|
||||
it('should return false if purchased is true and trialTimestamp is older then 7 days', function() {
|
||||
phoneHome.set({
|
||||
status: 'purchased',
|
||||
trialTimestamp: new Date().getTime()-(86400000*7.25)
|
||||
});
|
||||
expect(phoneHome.checkRegistratonStatus()).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('sendIfDue()', function() {
|
||||
it('should post to registration url when sendIfDue() is due', function() {
|
||||
var promise = $.Deferred();
|
||||
var checkStub = sinon.stub(phoneHome, 'checkReportStatus');
|
||||
checkStub.onFirstCall().returns(true);
|
||||
client.post.onFirstCall().returns(promise);
|
||||
phoneHome.sendIfDue({ key1: 'value1' });
|
||||
sinon.assert.calledOnce(client.post);
|
||||
expect(client.post.args[0][0]).to.equal(phoneHome.getStatsReportUrl());
|
||||
expect(client.post.args[0][1]).to.have.property('key1', 'value1');
|
||||
});
|
||||
|
||||
it('should set lastReport when sendIfDue() is due', function(done) {
|
||||
var promise = $.Deferred();
|
||||
var checkStub = sinon.stub(phoneHome, 'checkReportStatus');
|
||||
checkStub.onFirstCall().returns(true);
|
||||
client.post.onFirstCall().returns(promise);
|
||||
phoneHome.sendIfDue({ key1: 'value1' }).then(function () {
|
||||
expect(phoneHome.get('lastReport')).to.be.greaterThan(1);
|
||||
done();
|
||||
});
|
||||
promise.resolve({});
|
||||
});
|
||||
|
||||
it('should call saveToBrowser() when sendIfDue() is due', function(done) {
|
||||
var promise = $.Deferred();
|
||||
var checkStub = sinon.stub(phoneHome, 'checkReportStatus');
|
||||
var saveToBrowserStub = sinon.stub(phoneHome, 'saveToBrowser');
|
||||
checkStub.onFirstCall().returns(true);
|
||||
client.post.onFirstCall().returns(promise);
|
||||
phoneHome.sendIfDue({ key1: 'value1' }).then(function () {
|
||||
sinon.assert.calledOnce(saveToBrowserStub);
|
||||
saveToBrowserStub.restore();
|
||||
done();
|
||||
});
|
||||
promise.resolve({});
|
||||
});
|
||||
});
|
||||
|
||||
describe('register()', function() {
|
||||
it('should call saveToBrowser() and saveToES()', function() {
|
||||
var saveToBrowserStub = sinon.stub(phoneHome, 'saveToBrowser');
|
||||
var saveToESStub = sinon.stub(phoneHome, 'saveToES');
|
||||
phoneHome.register({ key1: 'value1' });
|
||||
sinon.assert.calledOnce(saveToBrowserStub);
|
||||
sinon.assert.calledOnce(saveToESStub);
|
||||
});
|
||||
|
||||
it('should set registrationData', function() {
|
||||
phoneHome.register({ key1: 'value1' });
|
||||
expect(phoneHome.get('registrationData')).to.have.property('key1', 'value1');
|
||||
});
|
||||
|
||||
it('should set status to registered', function() {
|
||||
phoneHome.register({ key1: 'value1' });
|
||||
expect(phoneHome.get('status')).to.equal('registered');
|
||||
});
|
||||
});
|
||||
|
||||
describe('confirmPurchase()', function() {
|
||||
it('should call saveToBrowser() and saveToES()', function() {
|
||||
var saveToBrowserStub = sinon.stub(phoneHome, 'saveToBrowser');
|
||||
var saveToESStub = sinon.stub(phoneHome, 'saveToES');
|
||||
phoneHome.confirmPurchase({ key1: 'value1' });
|
||||
sinon.assert.calledOnce(saveToBrowserStub);
|
||||
sinon.assert.calledOnce(saveToESStub);
|
||||
});
|
||||
|
||||
it('should set registrationData', function() {
|
||||
phoneHome.confirmPurchase({ key1: 'value1' });
|
||||
expect(phoneHome.get('registrationData')).to.have.property('key1', 'value1');
|
||||
});
|
||||
|
||||
it('should set purchased to true', function() {
|
||||
phoneHome.confirmPurchase({ key1: 'value1' });
|
||||
expect(phoneHome.get('status')).to.equal('purchased');
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkAndSendRegistrationData()', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
phoneHome.attributes = {
|
||||
registrationData: { key1: 'value1' },
|
||||
registrationSent: false,
|
||||
data: {
|
||||
uuid: 123456789
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
client.post.reset();
|
||||
});
|
||||
|
||||
it('should not send registration if registrationSent is true', function () {
|
||||
phoneHome.set('registrationSent', true);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
sinon.assert.notCalled(client.post);
|
||||
});
|
||||
|
||||
it('should not send registration if data.uuid is not set', function () {
|
||||
delete phoneHome.attributes.data.uuid;
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
sinon.assert.notCalled(client.post);
|
||||
});
|
||||
|
||||
it('should not send registration if registrationData is not set', function () {
|
||||
delete phoneHome.attributes.registrationData;
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
sinon.assert.notCalled(client.post);
|
||||
});
|
||||
|
||||
it('should send registration to the right url', function() {
|
||||
var promise = $.Deferred();
|
||||
client.post.returns(promise);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
expect(client.post.args[0][0]).to.equal(phoneHome.getRegistrationUrl());
|
||||
promise.resolve(true);
|
||||
});
|
||||
|
||||
it('should send purchase information to the right url', function() {
|
||||
var promise = $.Deferred();
|
||||
client.post.returns(promise);
|
||||
phoneHome.set('status', 'purchased');
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
expect(client.post.args[0][0]).to.equal(phoneHome.getPurchaseConfirmationUrl());
|
||||
promise.resolve(true);
|
||||
});
|
||||
|
||||
it('should set the uuid for registrationData', function() {
|
||||
var promise = $.Deferred();
|
||||
client.post.returns(promise);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
sinon.assert.calledOnce(client.post);
|
||||
expect(client.post.args[0][1]).to.have.property('uuid', 123456789);
|
||||
});
|
||||
|
||||
it('should set the values for registrationData', function() {
|
||||
var promise = $.Deferred();
|
||||
client.post.returns(promise);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
sinon.assert.calledOnce(client.post);
|
||||
expect(client.post.args[0][1]).to.have.property('key1', 'value1');
|
||||
});
|
||||
|
||||
it('should set registrationSent to true', function() {
|
||||
var promise = $.Deferred();
|
||||
client.post.returns(promise);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
promise.resolve({});
|
||||
sinon.assert.calledOnce(client.post);
|
||||
expect(phoneHome.get('registrationSent')).to.equal(true);
|
||||
});
|
||||
|
||||
it('should call saveToBrowser() upon successful submission', function() {
|
||||
var promise = $.Deferred();
|
||||
var saveToBrowserStub = sinon.stub(phoneHome, 'saveToBrowser');
|
||||
client.post.returns(promise);
|
||||
phoneHome.checkAndSendRegistrationData();
|
||||
promise.resolve(true);
|
||||
sinon.assert.calledOnce(saveToBrowserStub);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetch()', function() {
|
||||
|
||||
var promise, lsGetItemStub;
|
||||
|
||||
beforeEach(function() {
|
||||
promise = $.Deferred();
|
||||
lsGetItemStub = sinon.stub(localStorage, 'getItem');
|
||||
client.get.returns(promise);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
lsGetItemStub.restore();
|
||||
client.get.reset();
|
||||
});
|
||||
|
||||
it('should set values stored from the browser', function(done) {
|
||||
lsGetItemStub.returns('{ "key1": "value1" }');
|
||||
phoneHome.fetch().then(function () {
|
||||
expect(phoneHome.get('key1')).to.equal('value1');
|
||||
done();
|
||||
});
|
||||
promise.resolve({ data: { _source: {} } });
|
||||
});
|
||||
|
||||
it('should set values stored in Elasticsearch', function(done) {
|
||||
lsGetItemStub.returns('{}');
|
||||
phoneHome.fetch().then(function () {
|
||||
expect(phoneHome.get('key2')).to.equal('value2');
|
||||
done();
|
||||
});
|
||||
promise.resolve({ data: { _source: { key2: 'value2' } } });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,72 +0,0 @@
|
|||
/**
|
||||
* ELASTICSEARCH CONFIDENTIAL
|
||||
* _____________________________
|
||||
*
|
||||
* [2014] Elasticsearch Incorporated All Rights Reserved.
|
||||
*
|
||||
* NOTICE: All information contained herein is, and remains
|
||||
* the property of Elasticsearch Incorporated and its suppliers,
|
||||
* if any. The intellectual and technical concepts contained
|
||||
* herein are proprietary to Elasticsearch Incorporated
|
||||
* and its suppliers and may be covered by U.S. and Foreign Patents,
|
||||
* patents in process, and are protected by trade secret or copyright law.
|
||||
* Dissemination of this information or reproduction of this material
|
||||
* is strictly forbidden unless prior written permission is obtained
|
||||
* from Elasticsearch Incorporated.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
define(function (require) {
|
||||
'use strict';
|
||||
var detectSplitBrain = require('panels/marvel/stats_table/lib/detectSplitBrain');
|
||||
var masterSwap = require('/test/fixtures/masterSwap.js');
|
||||
var redSplit = require('/test/fixtures/redSplit.js');
|
||||
var yellowSplit = require('/test/fixtures/yellowSplit.js');
|
||||
|
||||
describe('stats_table', function () {
|
||||
describe('lib/detectSplitBrain.js', function() {
|
||||
|
||||
it('should detect a master swap and set status to green', function () {
|
||||
var results = detectSplitBrain(masterSwap);
|
||||
expect(results).to.have.property('status', 'green');
|
||||
expect(results).to.have.property('master')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(1);
|
||||
expect(results.master[0]).to.equal('127.0.0.1:9301');
|
||||
});
|
||||
|
||||
it('should detect split brain and set status to red', function () {
|
||||
var results = detectSplitBrain(redSplit);
|
||||
expect(results).to.have.property('status', 'red');
|
||||
expect(results).to.have.property('master')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(2);
|
||||
expect(results).to.have.property('red')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(1);
|
||||
expect(results).to.have.property('yellow')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(0);
|
||||
expect(results.master[0]).to.equal('127.0.0.1:9300');
|
||||
expect(results.master[1]).to.equal('127.0.0.1:9301');
|
||||
});
|
||||
|
||||
it('should detect split in the past and set status to yellow', function () {
|
||||
var results = detectSplitBrain(yellowSplit);
|
||||
expect(results).to.have.property('status', 'yellow');
|
||||
expect(results).to.have.property('master')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(1);
|
||||
expect(results).to.have.property('yellow')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(1);
|
||||
expect(results).to.have.property('red')
|
||||
.to.be.instanceOf(Array)
|
||||
.to.have.length(0);
|
||||
expect(results.master[0]).to.equal('127.0.0.1:9301');
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue