Skip to content

Commit

Permalink
Merge branch 'webpack'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Oct 21, 2018
2 parents 8bcd9bc + 373769e commit fadc042
Show file tree
Hide file tree
Showing 22 changed files with 2,203 additions and 726 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"presets": [
"es2015"
"env"
]
}
23 changes: 23 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ jobs:
- ./node_modules
- run: npm run build

lint:
working_directory: ~/alexanderzobnin/grafana-zabbix
docker:
- image: circleci/node:8
steps:
- checkout
- restore_cache:
keys:
- dependency-cache-{{ checksum "yarn.lock" }}
- run:
name: yarn install
command: 'yarn install --pure-lockfile --no-progress'
no_output_timeout: 15m
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- run: npm run lint

test:
working_directory: ~/alexanderzobnin/grafana-zabbix
environment:
Expand Down Expand Up @@ -68,12 +87,16 @@ workflows:
jobs:
- build:
filters: *filter-only-master
- lint:
filters: *filter-only-master
- test:
filters: *filter-only-master

build-branches-and-prs:
jobs:
- build:
filters: *filter-not-release-or-master
- lint:
filters: *filter-not-release-or-master
- test:
filters: *filter-not-release-or-master
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ docs/site/
dist/test/
dist/test-setup/

vendor/npm
vendor
src/vendor
src/vendor/npm
node_modules
npm-debug.log
coverage/
.aws-config.json
awsconfig
/emails/dist
/public_gen
/tmp
vendor/phantomjs/phantomjs

# Tools logs
npm-debug.log
yarn-error.log

# Built plugin
Expand Down
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"sinon": true,
"module": true,
"beforeEach": true,
"inject": true
"inject": true,
"__dirname": true
}
}
168 changes: 1 addition & 167 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,190 +1,24 @@
module.exports = function(grunt) {

const sass = require('node-sass');
require('load-grunt-tasks')(grunt);

grunt.loadNpmTasks('grunt-execute');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-benchmark');

grunt.initConfig({

clean: {
dist: {
src: ["dist"]
},
test: {
src: ["dist/test"]
},
vendor: {
src: ["vendor"]
},
tmp: {
src: ["tmp"]
}
},

copy: {
node_modules: {
cwd: './node_modules',
expand: true,
flatten: true,
filter: 'isFile',
src: [
'tether-drop/dist/js/drop.min.js',
'tether/dist/js/tether.min.js',
],
dest: 'vendor/npm'
},
vendor_to_dist: {
cwd: 'vendor',
expand: true,
src: [
'**/*'
],
dest: 'dist/vendor'
},
src_to_dist: {
cwd: 'src',
expand: true,
src: [
'**/*',
'!datasource-zabbix/*.js',
'!panel-triggers/*.js',
'!components/*.js',
'!vendor/*.js',
'!module.js',
'!**/*.scss'
],
dest: 'dist/'
},
pluginDef: {
expand: true,
src: ['plugin.json'],
dest: 'dist/',
}
},

watch: {
rebuild_all: {
files: ['src/**/*', 'plugin.json'],
tasks: ['watchTask'],
options: {spawn: false}
},
},

babel: {
options: {
presets: ["es2015"]
},
dist: {
options: {
sourceMap: true,
plugins: ['transform-es2015-modules-systemjs', "transform-es2015-for-of"]
},
files: [{
cwd: 'src',
expand: true,
src: [
'datasource-zabbix/**/*.js',
'panel-triggers/*.js',
'components/*.js',
'vendor/*.js',
'module.js',
],
dest: 'dist/'
}]
},
distTestNoSystemJs: {
files: [{
cwd: 'src',
expand: true,
src: ['**/*.js'],
dest: 'dist/test'
}]
},
distTestsSpecsNoSystemJs: {
files: [{
expand: true,
cwd: 'specs',
src: ['**/*.js'],
dest: 'dist/test/specs'
}]
}
},

sass: {
options: {
implementation: sass,
sourceMap: true
},
dist: {
files: {
'dist/css/grafana-zabbix.light.css': 'src/sass/grafana-zabbix.light.scss',
'dist/css/grafana-zabbix.dark.css': 'src/sass/grafana-zabbix.dark.scss'
}
}
},

jshint: {
source: {
files: {
src: ['src/**/*.js'],
}
},
options: {
jshintrc: true,
reporter: require('jshint-stylish'),
ignores: [
'node_modules/*',
'dist/*',
'src/datasource-zabbix/benchmarks/*'
]
}
},

jscs: {
src: ['src/**/*.js'],
options: {
config: ".jscs.json",
},
},

benchmark: {
options: {
displayResults: true
},
timeseriesBench: {
src: ['dist/test/datasource-zabbix/benchmarks/*.js'],
src: ['tmp/**/*_bench.js'],
dest: 'tmp/benchmark.csv'
}
}

});

grunt.registerTask('default', [
'clean',
'sass',
'copy',
'jshint',
'jscs',
'babel:dist'
]);

grunt.registerTask('watchTask', [
'clean:dist',
'sass',
'copy',
'babel:dist',
'jshint',
'jscs'
]);

grunt.registerTask('bench', [
'clean:test',
'clean:tmp',
'babel:distTestNoSystemJs',
'babel:distTestsSpecsNoSystemJs',
'benchmark'
]);
};
39 changes: 21 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"version": "3.6.0",
"description": "Zabbix plugin for Grafana",
"scripts": {
"build": "webpack --config webpack/webpack.prod.conf.js",
"dev": "webpack --config webpack/webpack.dev.conf.js",
"watch": "webpack --config webpack/webpack.dev.conf.js",
"test": "jest",
"jest": "jest --notify --watch",
"build": "grunt",
"watch": "grunt watch",
"codecov": "jest --coverage && codecov",
"ci-test": "jest --coverage && codecov",
"benchmark": "grunt bench"
"lint": "jshint --reporter=node_modules/jshint-stylish src/ & jscs src/",
"benchmark": "webpack --config webpack/webpack.bench.conf.js && grunt bench"
},
"repository": {
"type": "git",
Expand All @@ -22,35 +24,36 @@
"url": "https://github.com/alexanderzobnin/grafana-zabbix/issues"
},
"devDependencies": {
"babel": "^6.23.0",
"babel-core": "^6.26.3",
"babel-jest": "^23.6.0",
"babel-plugin-transform-es2015-for-of": "^6.6.0",
"babel-plugin-transform-es2015-modules-systemjs": "^6.5.0",
"babel-preset-es2015": "^6.5.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.7.0",
"benchmark": "^2.1.4",
"clean-webpack-plugin": "^0.1.19",
"codecov": "^3.1.0",
"copy-webpack-plugin": "^4.5.4",
"css-loader": "^1.0.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"grunt": "^1.0.3",
"grunt-babel": "^7.0.0",
"grunt-benchmark": "^1.0.0",
"grunt-cli": "^1.3.1",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^2.0.0",
"grunt-contrib-uglify": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-execute": "^0.2.2",
"grunt-jscs": "^3.0.1",
"grunt-sass": "^3.0.2",
"grunt-systemjs-builder": "^1.0.0",
"html-loader": "^0.5.5",
"jest": "^23.5.0",
"jscs": "^3.0.7",
"jsdom": "~11.3.0",
"jshint": "^2.9.6",
"jshint-stylish": "^2.1.0",
"load-grunt-tasks": "~3.2.0",
"lodash": "~4.17.5",
"moment": "~2.21.0",
"ng-annotate-webpack-plugin": "^0.3.0",
"node-sass": "^4.9.4",
"systemjs": "^0.20.19",
"tether-drop": "^1.4.2"
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"tether-drop": "^1.4.2",
"webpack": "^4.22.0",
"webpack-cli": "^3.1.2"
},
"homepage": "http://grafana-zabbix.org"
}
22 changes: 0 additions & 22 deletions src/README.md

This file was deleted.

1 change: 1 addition & 0 deletions src/datasource-zabbix/benchmarks/timeseries_bench.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import _ from 'lodash';
import ts from '../timeseries';

/* jshint maxlen: false */
let datapoints = [[10.7104, 1498409636085], [10.578, 1498409651011], [10.5985, 1498409666628], [10.6877, 1498409681525], [10.5495, 1498409696586], [10.5981, 1498409711009], [10.5076, 1498409726949], [11.4807, 1498409741853], [11.6165, 1498409756165], [11.8575, 1498409771018], [11.9936, 1498409786056], [10.7566, 1498409801942], [10.7484, 1498409816010], [10.6038, 1498409831018], [10.2932, 1498409846010], [10.4912, 1498409861946], [10.4151, 1498409876871], [10.2401, 1498409891710], [10.4921, 1498409906143], [10.4413, 1498409921477], [10.6318, 1498409936147], [10.5277, 1498409951915], [10.6333, 1498409966052], [10.6417, 1498409981944], [10.4505, 1498409996867], [10.5812, 1498410011770], [10.4934, 1498410026573], [10.5731, 1498410041317], [10.5, 1498410056213], [10.6505, 1498410071013], [9.4035, 1498410086387]];

let series_set = [
Expand Down
2 changes: 1 addition & 1 deletion src/datasource-zabbix/datasource.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash';
import * as dateMath from 'app/core/utils/datemath';
import * as dateMath from 'grafana/app/core/utils/datemath';
import * as utils from './utils';
import * as migrations from './migrations';
import * as metricFunctions from './metricFunctions';
Expand Down
6 changes: 0 additions & 6 deletions src/datasource-zabbix/module.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { loadPluginCss } from 'app/plugins/sdk';
import { ZabbixDatasource } from './datasource';
import { ZabbixQueryController } from './query.controller';
import { ZabbixDSConfigController } from './config.controller';
import './zabbixAlerting.service.js';
import './add-metric-function.directive';
import './metric-function-editor.directive';

loadPluginCss({
dark: 'plugins/alexanderzobnin-zabbix-app/css/grafana-zabbix.dark.css',
light: 'plugins/alexanderzobnin-zabbix-app/css/grafana-zabbix.light.css'
});

class ZabbixQueryOptionsController {}
ZabbixQueryOptionsController.templateUrl = 'datasource-zabbix/partials/query.options.html';

Expand Down
Loading

0 comments on commit fadc042

Please sign in to comment.