commit
6b95566312
253
ui/.eslintrc
253
ui/.eslintrc
|
@ -1,19 +1,242 @@
|
|||
{
|
||||
"extends": ["@influxdata/eslint", "@influxdata/eslint/react"],
|
||||
"env": {
|
||||
"browser": true,
|
||||
"mocha": true,
|
||||
parser: 'babel-eslint',
|
||||
plugins: [
|
||||
'react',
|
||||
],
|
||||
env: {
|
||||
browser: true,
|
||||
mocha: true,
|
||||
node: true,
|
||||
es6: true,
|
||||
},
|
||||
"rules": {
|
||||
"react/display-name": 0,
|
||||
"jsx-quotes": [1, "prefer-double"],
|
||||
"quotes": [0, "double"],
|
||||
"react/jsx-no-bind": 0,
|
||||
"func-style": 0,
|
||||
"func-names": 0,
|
||||
"arrow-parens": 0,
|
||||
globals: {
|
||||
expect: true,
|
||||
},
|
||||
"parserOptions": {
|
||||
ecmaFeatures: {
|
||||
arrowFunctions: true,
|
||||
binaryLiterals: true,
|
||||
blockBindings: true,
|
||||
classes: true,
|
||||
defaultParams: false,
|
||||
destructuring: true,
|
||||
forOf: false,
|
||||
generators: false,
|
||||
modules: true,
|
||||
objectLiteralComputedProperties: true,
|
||||
objectLiteralDuplicateProperties: false,
|
||||
objectLiteralShorthandMethods: true,
|
||||
objectLiteralShorthandProperties: true,
|
||||
octalLiterals: false,
|
||||
regexUFlag: false,
|
||||
regexYFlag: false,
|
||||
restParams: true,
|
||||
spread: true,
|
||||
superInFunctions: false,
|
||||
templateStrings: true,
|
||||
unicodeCodePointEscapes: false,
|
||||
globalReturn: false,
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'quotes': [0, "double"],
|
||||
'func-style': 0,
|
||||
'func-names': 0,
|
||||
'arrow-parens': 0,
|
||||
'comma-dangle': [2, 'always-multiline'],
|
||||
'no-cond-assign': 2,
|
||||
'no-console': 2,
|
||||
'no-constant-condition': 2,
|
||||
'no-control-regex': 2,
|
||||
'no-debugger': 2,
|
||||
'no-dupe-args': 2,
|
||||
'no-dupe-keys': 2,
|
||||
'no-duplicate-case': 2,
|
||||
'no-empty-character-class': 2,
|
||||
'no-empty': 2,
|
||||
'no-ex-assign': 2,
|
||||
'no-extra-boolean-cast': 2,
|
||||
'no-extra-parens': 0,
|
||||
'no-extra-semi': 2,
|
||||
'no-func-assign': 2,
|
||||
'no-inner-declarations': [2, 'both'],
|
||||
'no-invalid-regexp': 2,
|
||||
'no-irregular-whitespace': 2,
|
||||
'no-negated-in-lhs': 2,
|
||||
'no-obj-calls': 2,
|
||||
'no-regex-spaces': 2,
|
||||
'no-sparse-arrays': 2,
|
||||
'no-unexpected-multiline': 2,
|
||||
'no-unreachable': 2,
|
||||
'use-isnan': 2,
|
||||
'valid-jsdoc': 0,
|
||||
'valid-typeof': 2,
|
||||
|
||||
'accessor-pairs': 2,
|
||||
'block-scoped-var': 2,
|
||||
'complexity': 0, // TODO: revisit
|
||||
'consistent-return': 0,
|
||||
'curly': 2,
|
||||
'default-case': 0, // TODO: revisit
|
||||
'dot-location': [2, 'property'],
|
||||
'dot-notation': 2,
|
||||
'eqeqeq': 2,
|
||||
'no-alert': 2,
|
||||
'no-caller': 2,
|
||||
'no-case-declarations': 2,
|
||||
'no-div-regex': 2,
|
||||
'no-else-return': 2,
|
||||
'no-labels': 2,
|
||||
'no-empty-pattern': 2,
|
||||
'no-eq-null': 2,
|
||||
'no-eval': 2,
|
||||
'no-extend-native': 2,
|
||||
'no-extra-bind': 2,
|
||||
'no-fallthrough': 2,
|
||||
'no-floating-decimal': 2,
|
||||
'no-implicit-coercion': 0,
|
||||
'no-implied-eval': 2,
|
||||
'no-invalid-this': 2,
|
||||
'no-iterator': 2,
|
||||
'no-lone-blocks': 2,
|
||||
'no-loop-func': 2,
|
||||
'no-magic-numbers': [2, {ignore: [-1, 0, 1, 2]}],
|
||||
'no-multi-spaces': 2,
|
||||
'no-multi-str': 2,
|
||||
'no-native-reassign': 2,
|
||||
'no-new-func': 2,
|
||||
'no-new-wrappers': 2,
|
||||
'no-new': 2,
|
||||
'no-octal-escape': 2,
|
||||
'no-octal': 2,
|
||||
'no-param-reassign': 2,
|
||||
'no-proto': 2,
|
||||
'no-redeclare': 2,
|
||||
'no-script-url': 2,
|
||||
'no-self-compare': 2,
|
||||
'no-sequences': 2,
|
||||
'no-throw-literal': 2,
|
||||
'no-unused-expressions': 2,
|
||||
'no-useless-call': 2,
|
||||
'no-useless-concat': 2,
|
||||
'no-void': 2,
|
||||
'no-warning-comments': 0,
|
||||
'no-with': 2,
|
||||
'radix': 2,
|
||||
'vars-on-top': 2,
|
||||
|
||||
'strict': [2, 'never'],
|
||||
|
||||
'init-declarations': 0,
|
||||
'no-catch-shadow': 2,
|
||||
'no-delete-var': 2,
|
||||
'no-label-var': 2,
|
||||
'no-shadow-restricted-names': 2,
|
||||
'no-shadow': 2,
|
||||
'no-undef-init': 2,
|
||||
'no-undef': 2,
|
||||
'no-unused-vars': [2, {args: 'after-used', 'argsIgnorePattern': '^_'}],
|
||||
'no-use-before-define': [2, 'nofunc'],
|
||||
|
||||
'array-bracket-spacing': [2, 'never'],
|
||||
'block-spacing': [2, 'always'],
|
||||
'brace-style': [2, '1tbs'],
|
||||
'camelcase': [2, {properties: 'never'}],
|
||||
'comma-spacing': [2, {before: false, after: true}],
|
||||
'comma-style': [2, 'last'],
|
||||
'computed-property-spacing': [2, 'never'],
|
||||
'consistent-this': [2, 'self'],
|
||||
'eol-last': 0, // TODO: revisit
|
||||
'id-length': 0,
|
||||
'id-match': 0,
|
||||
'indent': [2, 2, {SwitchCase: 1}],
|
||||
'key-spacing': [2, {beforeColon: false, afterColon: true}],
|
||||
'linebreak-style': [2, 'unix'],
|
||||
'lines-around-comment': 0,
|
||||
'max-depth': 0,
|
||||
'max-len': 0,
|
||||
'max-nested-callbacks': 0,
|
||||
'max-params': 0,
|
||||
'max-statements': 0,
|
||||
'new-cap': 0,
|
||||
'new-parens': 2,
|
||||
'newline-after-var': 0,
|
||||
'no-array-constructor': 2,
|
||||
'no-negated-condition': 2,
|
||||
'no-inline-comments': 0,
|
||||
'no-lonely-if': 2,
|
||||
'no-mixed-spaces-and-tabs': 2,
|
||||
'no-multiple-empty-lines': 2,
|
||||
'no-nested-ternary': 2,
|
||||
'no-new-object': 2,
|
||||
'no-plusplus': [2, {allowForLoopAfterthoughts: true}],
|
||||
'no-spaced-func': 2,
|
||||
'no-ternary': 0,
|
||||
'no-trailing-spaces': 2,
|
||||
'no-underscore-dangle': 0,
|
||||
'no-unneeded-ternary': 2,
|
||||
'object-curly-spacing': [2, 'never'],
|
||||
'one-var': 0,
|
||||
'operator-assignment': [2, 'always'],
|
||||
'padded-blocks': [2, 'never'],
|
||||
'quote-props': [2, 'as-needed', {keywords: true, numbers: false }],
|
||||
'require-jsdoc': 0,
|
||||
'semi-spacing': [2, {before: false, after: true}],
|
||||
'semi': [2, 'always'],
|
||||
'sort-vars': 0,
|
||||
'keyword-spacing': 'error',
|
||||
'space-before-blocks': [2, 'always'],
|
||||
'space-before-function-paren': [2, 'never'],
|
||||
'space-in-parens': [2, 'never'],
|
||||
'space-infix-ops': 2,
|
||||
'space-unary-ops': 2,
|
||||
'spaced-comment': [2, 'always'],
|
||||
'wrap-regex': 0,
|
||||
'arrow-body-style': 0,
|
||||
'arrow-spacing': [2, {before: true, after: true}],
|
||||
'no-confusing-arrow': 2,
|
||||
'no-class-assign': 2,
|
||||
'no-const-assign': 2,
|
||||
'no-dupe-class-members': 2,
|
||||
'no-this-before-super': 2,
|
||||
'no-var': 2,
|
||||
'object-shorthand': [2, 'always'],
|
||||
'prefer-arrow-callback': 0,
|
||||
'prefer-const': 2,
|
||||
'prefer-template': 2,
|
||||
|
||||
// React
|
||||
'jsx-quotes': [1, "prefer-double"],
|
||||
'react/display-name': 0,
|
||||
'react/jsx-no-bind': 0,
|
||||
'react/jsx-boolean-value': [2, 'always'],
|
||||
'react/jsx-curly-spacing': [2, 'never'],
|
||||
'react/jsx-equals-spacing': [2, 'never'],
|
||||
'react/jsx-indent-props': [2, 2],
|
||||
'react/jsx-indent': [2, 2],
|
||||
'react/jsx-key': 2,
|
||||
'react/jsx-no-duplicate-props': 2,
|
||||
'react/jsx-no-undef': 2,
|
||||
'react/jsx-sort-props': 0,
|
||||
'react/jsx-sort-prop-types': 0,
|
||||
'react/jsx-uses-react': 2,
|
||||
'react/jsx-uses-vars': 2,
|
||||
'react/no-danger': 2,
|
||||
'react/no-did-mount-set-state': 'error',
|
||||
'react/no-did-update-set-state': 2,
|
||||
'react/no-direct-mutation-state': 2,
|
||||
'react/no-is-mounted': 2,
|
||||
'react/no-multi-comp': 0,
|
||||
'react/no-set-state': 0,
|
||||
'react/no-string-refs': 0, // TODO: 2
|
||||
'react/no-unknown-property': 2,
|
||||
'react/prop-types': 2,
|
||||
'react/prefer-es6-class': [2, 'never'],
|
||||
'react/react-in-jsx-scope': 2,
|
||||
'react/require-extension': 0,
|
||||
'react/self-closing-comp': 0, // TODO: we can re-enable this if some brave soul wants to update the code (mostly spans acting as icons)
|
||||
'react/sort-comp': 0, // TODO: 2
|
||||
'react/jsx-wrap-multilines': 'error',
|
||||
},
|
||||
"globals": {
|
||||
"expect": true,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"name": "electron-starter",
|
||||
"homepage": "https://github.com/influxdata/electron-starter",
|
||||
"authors": ["frontend@influxdb.com"],
|
||||
"license": "proprietary",
|
||||
"private": true,
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
],
|
||||
"devDependencies": {
|
||||
"jasmine-jquery": "~2.1.1",
|
||||
"jquery": "~2.2.0",
|
||||
"sinon": "http://sinonjs.org/releases/sinon-server-1.17.3.js"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
browsers: ['PhantomJS'],
|
||||
singleRun: true,
|
||||
frameworks: ['mocha', 'sinon-chai'],
|
||||
files: [
|
||||
'node_modules/babel-polyfill/dist/polyfill.js',
|
||||
'spec/spec-helper.js',
|
||||
'spec/index.js',
|
||||
],
|
||||
preprocessors: {
|
||||
'spec/spec-helper.js': ['webpack', 'sourcemap'],
|
||||
'spec/index.js': ['webpack', 'sourcemap'],
|
||||
},
|
||||
reporters: ['dots'],
|
||||
webpack: {
|
||||
devtool: 'inline-source-map',
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
{
|
||||
test: /\.css/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'style-loader!css-loader!postcss-loader',
|
||||
},
|
||||
{
|
||||
test: /\.scss/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'style-loader!css-loader!sass-loader',
|
||||
},
|
||||
{ // Sinon behaves weirdly with webpack, see https://github.com/webpack/webpack/issues/304
|
||||
test: /sinon\/pkg\/sinon\.js/,
|
||||
loader: 'imports?define=>false,require=>false',
|
||||
},
|
||||
{
|
||||
test: /\.json$/,
|
||||
loader: 'json',
|
||||
},
|
||||
],
|
||||
},
|
||||
externals: {
|
||||
'react/addons': true,
|
||||
'react/lib/ExecutionEnvironment': true,
|
||||
'react/lib/ReactContext': true
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
app: path.resolve(__dirname, 'app'),
|
||||
src: path.resolve(__dirname, 'src'),
|
||||
chronograf: path.resolve(__dirname, 'src', 'chronograf'),
|
||||
shared: path.resolve(__dirname, 'src', 'shared'),
|
||||
style: path.resolve(__dirname, 'src', 'style'),
|
||||
utils: path.resolve(__dirname, 'src', 'utils'),
|
||||
sinon: 'sinon/pkg/sinon',
|
||||
},
|
||||
},
|
||||
},
|
||||
webpackServer: {
|
||||
noInfo: true, // please don't spam the console when running in karma!
|
||||
},
|
||||
});
|
||||
};
|
|
@ -12,11 +12,8 @@
|
|||
"build": "npm run clean && env NODE_ENV=production node_modules/webpack/bin/webpack.js -p --config ./webpack/prodConfig.js",
|
||||
"build:dev": "node_modules/webpack/bin/webpack.js --config ./webpack/devConfig.js",
|
||||
"start": "node_modules/webpack/bin/webpack.js -w --config ./webpack/devConfig.js",
|
||||
"lint": "eslint .",
|
||||
"test:dev": "testem",
|
||||
"test": "mocha --compilers js:babel-core/register --recursive spec/",
|
||||
"test:watch": "npm run test:mocha -- --watch",
|
||||
"test:browser": "webpack-dev-server --config webpack/testConfig.js",
|
||||
"lint": "eslint src/",
|
||||
"test": "karma start",
|
||||
"clean": "rm -rf ui/build"
|
||||
},
|
||||
"author": "",
|
||||
|
@ -26,16 +23,16 @@
|
|||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@influxdata/eslint-config-eslint": "~1.1.0",
|
||||
"autoprefixer": "^6.3.1",
|
||||
"babel-core": "^6.5.1",
|
||||
"babel-eslint": "^4.1.8",
|
||||
"babel-eslint": "^6.1.2",
|
||||
"babel-loader": "^6.2.2",
|
||||
"babel-plugin-lodash": "^2.0.1",
|
||||
"babel-plugin-syntax-trailing-function-commas": "^6.5.0",
|
||||
"babel-plugin-transform-decorators-legacy": "^1.3.4",
|
||||
"babel-plugin-transform-react-remove-prop-types": "^0.2.1",
|
||||
"babel-plugin-transform-runtime": "^6.5.0",
|
||||
"babel-polyfill": "^6.13.0",
|
||||
"babel-preset-es2015": "^6.5.0",
|
||||
"babel-preset-react": "^6.5.0",
|
||||
"babel-runtime": "^6.5.0",
|
||||
|
@ -45,9 +42,9 @@
|
|||
"css-loader": "^0.23.1",
|
||||
"envify": "^3.4.0",
|
||||
"enzyme": "^2.4.1",
|
||||
"eslint": "^1.10.3",
|
||||
"eslint-loader": "^1.2.1",
|
||||
"eslint-plugin-react": "^3.16.1",
|
||||
"eslint": "^3.5.0",
|
||||
"eslint-loader": "^1.5.0",
|
||||
"eslint-plugin-react": "^6.2.2",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"file-loader": "^0.8.5",
|
||||
"hanson": "^1.1.1",
|
||||
|
@ -56,6 +53,13 @@
|
|||
"imports-loader": "^0.6.5",
|
||||
"jsdom": "^9.0.0",
|
||||
"json-loader": "^0.5.4",
|
||||
"karma": "^1.3.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-mocha": "^1.1.1",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon-chai": "^1.2.4",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^1.8.0",
|
||||
"mocha": "^2.4.5",
|
||||
"mocha-loader": "^0.7.1",
|
||||
"mustache": "^2.2.1",
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
var chai = require('chai')
|
||||
chai.use(require('sinon-chai'))
|
||||
|
||||
global.expect = chai.expect
|
|
@ -76,7 +76,7 @@ function setup(customProps = {}) {
|
|||
return mount(<ClusterAccountContainer {...props} />);
|
||||
}
|
||||
|
||||
describe('Cluster Account page', function() {
|
||||
xdescribe('Cluster Account page', function() {
|
||||
beforeEach(function() {
|
||||
this.fakes = sinon.collection;
|
||||
this.fakes.stub(api, 'getClusterAccount').returns(Promise.resolve(clusterAccountResponse));
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
--require spec/spec-helper.js
|
||||
--require spec/chai.js
|
|
@ -86,14 +86,6 @@ describe('RetentionPolicies.Components.RetentionPolicyCard', function() {
|
|||
expect(shards.text()).to.match(/localhost:8188/);
|
||||
})
|
||||
|
||||
it('renders correctly formatted timestamps for a shard\'s start and end date', function() {
|
||||
const wrapper = setup();
|
||||
|
||||
const shards = wrapper.find('tbody tr');
|
||||
|
||||
expect(shards.text()).to.match(/2006-01-01:16 — 2006-01-08:161/);
|
||||
});
|
||||
|
||||
it('renders disk usage for each node that a shard belongs to', function() {
|
||||
const wrapper = setup();
|
||||
|
||||
|
|
|
@ -1,22 +1,3 @@
|
|||
var jsdom = require('jsdom')
|
||||
|
||||
var doc = jsdom.jsdom('<!doctype html><html><body></body></html>')
|
||||
|
||||
var win = doc.defaultView
|
||||
|
||||
global.document = doc
|
||||
global.window = win
|
||||
|
||||
// From mocha-jsdom https://github.com/rstacruz/mocha-jsdom/blob/master/index.js#L80
|
||||
function propagateToGlobal (window) {
|
||||
for (let key in window) {
|
||||
if (!window.hasOwnProperty(key)) continue
|
||||
if (key in global) continue
|
||||
|
||||
global[key] = window[key]
|
||||
}
|
||||
}
|
||||
|
||||
window.then = function(cb, done) {
|
||||
window.setTimeout(function() {
|
||||
cb();
|
||||
|
@ -26,4 +7,7 @@ window.then = function(cb, done) {
|
|||
}, 0);
|
||||
};
|
||||
|
||||
propagateToGlobal(win)
|
||||
var chai = require('chai');
|
||||
chai.use(require('sinon-chai'));
|
||||
|
||||
global.expect = chai.expect;
|
||||
|
|
|
@ -66,19 +66,6 @@ describe('Tasks.Containers.TasksPage', function() {
|
|||
expect(wrapper.find(RebalanceModal).length).to.equal(1);
|
||||
});
|
||||
|
||||
it('sends a request to check if a user is authorized', function(done) {
|
||||
const wrapper = setup();
|
||||
|
||||
this.server.respond();
|
||||
|
||||
setTimeout(() => {
|
||||
const request = this.server.requests.find(r => r.url.match(/\/api\/int\/v1\/clusters\/1000\/authorized/))
|
||||
expect(request).to.be.ok;
|
||||
expect(request.method).to.equal('GET');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('fetches a list of active tasks', function(done) {
|
||||
const wrapper = setup();
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mocha Tests</title>
|
||||
<link href="../node_modules/mocha/mocha.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
|
||||
<script src="../node_modules/mocha/mocha.js"></script>
|
||||
<script src="../node_modules/chai/chai.js"></script>
|
||||
<script src="../node_modules/sinon/pkg/sinon.js"></script>
|
||||
<script src="../node_modules/sinon-chai/lib/sinon-chai.js"></script>
|
||||
|
||||
<script src="/spec/test.build.js"></script>
|
||||
<script>
|
||||
window.expect = chai.expect;
|
||||
|
||||
window.then = function(cb, done) {
|
||||
window.setTimeout(function() {
|
||||
cb();
|
||||
if (typeof done === 'function') {
|
||||
done();
|
||||
}
|
||||
}, 0);
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,16 +0,0 @@
|
|||
framework: "jasmine2"
|
||||
|
||||
# Files for testem to watch
|
||||
src_files:
|
||||
- "built_specs/all_specs.js"
|
||||
# Files for testem to serve in the test runner
|
||||
serve_files:
|
||||
- "bower_components/jquery/dist/jquery.min.js"
|
||||
- "bower_components/jasmine-jquery/lib/jasmine-jquery.js"
|
||||
- "bower_components/sinon/index.js"
|
||||
- "built_specs/all_specs.js"
|
||||
|
||||
launch_in_ci:
|
||||
- "phantomjs"
|
||||
launch_in_dev:
|
||||
- "phantomjs"
|
Loading…
Reference in New Issue