Torkel Ödegaard 11 лет назад
Родитель
Сommit
3a5f718da8

+ 0 - 35
.jshintrc

@@ -1,35 +0,0 @@
-{
-  "browser": true,
-
-  "bitwise":false,
-  "curly": true,
-  "eqnull": true,
-  "globalstrict": true,
-  "devel": true,
-  "eqeqeq": true,
-  "forin": false,
-  "immed": true,
-  "supernew": true,
-  "expr": true,
-  "indent": 2,
-  "latedef": true,
-  "newcap": true,
-  "noarg": true,
-  "noempty": true,
-  "undef": true,
-  "boss": true,
-  "trailing": true,
-  "laxbreak": true,
-  "laxcomma": true,
-  "sub": true,
-  "unused": true,
-  "maxdepth": 5,
-  "maxlen": 140,
-
-  "globals": {
-    "define": true,
-    "require": true,
-    "Chromath": false,
-    "setImmediate": true
-  }
-}

+ 0 - 5
.travis.yml

@@ -1,5 +0,0 @@
-language: node_js
-node_js:
-  - "0.10"
-before_script:
-  - npm install -g grunt-cli

+ 0 - 38
Gruntfile.js

@@ -1,38 +0,0 @@
-/* jshint node:true */
-'use strict';
-module.exports = function (grunt) {
-
-  var config = {
-    pkg: grunt.file.readJSON('package.json'),
-    baseDir: '.',
-    srcDir: 'public',
-    destDir: 'dist',
-    tempDir: 'tmp',
-    docsDir: 'docs/'
-  };
-
-  // load plugins
-  require('load-grunt-tasks')(grunt);
-
-  // load task definitions
-  grunt.loadTasks('tasks');
-
-  // Utility function to load plugin settings into config
-  function loadConfig(config,path) {
-    require('glob').sync('*', {cwd: path}).forEach(function(option) {
-      var key = option.replace(/\.js$/,'');
-      // If key already exists, extend it. It is your responsibility to avoid naming collisions
-      config[key] = config[key] || {};
-      grunt.util._.extend(config[key], require(path + option)(config,grunt));
-    });
-    // technically not required
-    return config;
-  }
-
-  // Merge that object with what with whatever we have here
-  loadConfig(config,'./tasks/options/');
-
-  // pass the config to grunt
-  grunt.initConfig(config);
-
-};

+ 1 - 1
grafana

@@ -1 +1 @@
-Subproject commit 1bc277fd87469b1deb0e1b1571d7010f0f396d5a
+Subproject commit 8699dec57162ed419da47e7206ea58f8ec3250a3

+ 0 - 18
grafana-pro.sublime-project

@@ -1,18 +0,0 @@
-{
-	"folders":
-	[
-		{
-			"follow_symlinks": true,
-			"path": ".",
-			"folder_exclude_patterns": [
-	       "node_modules",
-	       "grafana"
-	     ]
-		}
-	],
-	"settings":
-  {
-    "tab_size": 2,
-    "trim_trailing_white_space_on_save": true
-  }
-}

+ 0 - 68
package.json

@@ -1,68 +0,0 @@
-{
-  "author": {
-    "name": "Torkel Ödegaard",
-    "company": "Coding Instinct AB"
-  },
-  "name": "grafana",
-  "version": "1.7.0-rc1",
-  "repository": {
-    "type": "git",
-    "url": "http://github.com/torkelo/grafana.git"
-  },
-  "devDependencies": {
-    "expect.js": "~0.2.0",
-    "glob": "~3.2.7",
-    "grunt": "~0.4.0",
-    "grunt-angular-templates": "^0.5.5",
-    "grunt-cli": "~0.1.13",
-    "grunt-contrib-clean": "~0.5.0",
-    "grunt-contrib-compress": "~0.5.2",
-    "grunt-contrib-concat": "^0.4.0",
-    "grunt-contrib-connect": "~0.5.0",
-    "grunt-contrib-copy": "~0.5.0",
-    "grunt-contrib-cssmin": "~0.6.1",
-    "grunt-contrib-htmlmin": "~0.1.3",
-    "grunt-contrib-jshint": "~0.10.0",
-    "grunt-contrib-less": "~0.7.0",
-    "grunt-contrib-requirejs": "~0.4.1",
-    "grunt-contrib-uglify": "~0.2.4",
-    "grunt-filerev": "^0.2.1",
-    "grunt-git-describe": "~2.3.2",
-    "grunt-karma": "~0.8.3",
-    "grunt-ngmin": "0.0.3",
-    "grunt-string-replace": "~0.2.4",
-    "grunt-usemin": "^2.1.1",
-    "jshint-stylish": "~0.1.5",
-    "karma": "~0.12.16",
-    "karma-chrome-launcher": "~0.1.4",
-    "karma-coffee-preprocessor": "~0.1.2",
-    "karma-coverage": "^0.2.5",
-    "karma-coveralls": "^0.1.4",
-    "karma-expect": "~1.1.0",
-    "karma-firefox-launcher": "~0.1.3",
-    "karma-html2js-preprocessor": "~0.1.0",
-    "karma-jasmine": "~0.2.2",
-    "karma-mocha": "~0.1.4",
-    "karma-phantomjs-launcher": "~0.1.1",
-    "karma-requirejs": "~0.2.1",
-    "karma-script-launcher": "~0.1.0",
-    "load-grunt-tasks": "~0.2.0",
-    "mocha": "~1.16.1",
-    "requirejs": "~2.1.14",
-    "rjs-build-analysis": "0.0.3"
-  },
-  "engines": {
-    "node": "0.10.x",
-    "npm": "1.2.x"
-  },
-  "scripts": {
-    "test": "grunt test",
-    "coveralls": "grunt karma:coveralls && rm -rf ./coverage"
-  },
-  "license": "Apache License",
-  "dependencies": {
-    "grunt-jscs-checker": "^0.4.4",
-    "karma-sinon": "^1.0.3",
-    "sinon": "^1.10.3"
-  }
-}

+ 0 - 37
tasks/build_task.js

@@ -1,37 +0,0 @@
-module.exports = function(grunt) {
-
-  // Concat and Minify the src directory into dist
-  grunt.registerTask('build', [
-    'jshint:source',
-    'jshint:tests',
-    'clean:on_start',
-    'less:src',
-    'concat:css',
-    'copy:everything_but_less_to_temp',
-    'htmlmin:build',
-    'ngtemplates',
-    'cssmin:build',
-    'build:grafanaVersion',
-    'ngmin:build',
-    'requirejs:build',
-    'concat:js',
-    'filerev',
-    'usemin',
-    'clean:temp',
-    'uglify:dest'
-  ]);
-
-
-  grunt.registerTask('build:grafanaVersion', function() {
-    grunt.config('string-replace.config', {
-      files: {
-        '<%= tempDir %>/app/app.js': '<%= tempDir %>/app/app.js'
-      },
-      options: {
-        replacements: [{ pattern: /@grafanaVersion@/g,  replacement: '<%= pkg.version %>' }]
-      }
-    });
-    grunt.task.run('string-replace:config');
-  });
-
-};

+ 0 - 5
tasks/default_task.js

@@ -1,5 +0,0 @@
-// Lint and build CSS
-module.exports = function(grunt) {
-  grunt.registerTask('default', ['jscs', 'jshint', 'less:src', 'concat:css']);
-  grunt.registerTask('test', ['default', 'karma:test']);
-};

+ 0 - 31
tasks/distribute_task.js

@@ -1,31 +0,0 @@
-module.exports = function(grunt) {
-
-  // build, then zip and upload to s3
-  grunt.registerTask('distribute', [
-    'distribute:load_s3_config',
-    'build',
-    'compress:zip',
-    'compress:tgz',
-    's3:dist',
-    'clean:temp'
-  ]);
-
-  // build, then zip and upload to s3
-  grunt.registerTask('release', [
-  //  'distribute:load_s3_config',
-    'build',
-    'compress:zip_release',
-    'compress:tgz_release',
-    //'s3:release',
-    //'clean:temp'
-  ]);
-
-  // collect the key and secret from the .aws-config.json file, finish configuring the s3 task
-  grunt.registerTask('distribute:load_s3_config', function () {
-    var config = grunt.file.readJSON('.aws-config.json');
-    grunt.config('s3.options', {
-      key: config.key,
-      secret: config.secret
-    });
-  });
-}

+ 0 - 7
tasks/options/clean.js

@@ -1,7 +0,0 @@
-module.exports = function(config) {
-  return {
-    on_start: ['<%= destDir %>', '<%= tempDir %>'],
-    temp: ['<%= tempDir %>'],
-    docs: ['<%= docsDir %>']
-  };
-};

+ 0 - 76
tasks/options/compress.js

@@ -1,76 +0,0 @@
-module.exports = function(config) {
-  return {
-    zip: {
-      options: {
-        archive: '<%= tempDir %>/<%= pkg.name %>-latest.zip'
-      },
-      files : [
-        {
-          expand: true,
-          cwd: '<%= destDir %>',
-          src: ['**/*'],
-          dest: '<%= pkg.name %>/',
-        },
-        {
-          expand: true,
-          dest: '<%= pkg.name %>/',
-          src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
-        }
-      ]
-    },
-    tgz: {
-      options: {
-        archive: '<%= tempDir %>/<%= pkg.name %>-latest.tar.gz'
-      },
-      files : [
-        {
-          expand: true,
-          cwd: '<%= destDir %>',
-          src: ['**/*'],
-          dest: '<%= pkg.name %>/',
-        },
-        {
-          expand: true,
-          src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
-          dest: '<%= pkg.name %>/',
-        }
-      ]
-    },
-    zip_release: {
-      options: {
-        archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.zip'
-      },
-      files : [
-        {
-          expand: true,
-          cwd: '<%= destDir %>',
-          src: ['**/*'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        },
-        {
-          expand: true,
-          src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        }
-      ]
-    },
-    tgz_release: {
-      options: {
-        archive: '<%= tempDir %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
-      },
-      files : [
-        {
-          expand: true,
-          cwd: '<%= destDir %>',
-          src: ['**/*'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        },
-        {
-          expand: true,
-          src: ['LICENSE.md', 'README.md', 'NOTICE.md'],
-          dest: '<%= pkg.name %>-<%= pkg.version %>/',
-        }
-      ]
-    }
-  };
-};

+ 0 - 22
tasks/options/concat.js

@@ -1,22 +0,0 @@
-module.exports = function(config) {
-  return {
-    css: {
-      src: [
-        '<%= srcDir %>/css/normalize.min.css',
-        '<%= srcDir %>/css/timepicker.css',
-        '<%= srcDir %>/css/spectrum.css',
-        '<%= srcDir %>/css/animate.min.css',
-        '<%= srcDir %>/css/bootstrap.dark.min.css'
-      ],
-      dest: '<%= srcDir %>/css/default.min.css'
-    },
-    js: {
-      src: [
-        '<%= destDir %>/vendor/require/require.js',
-        '<%= destDir %>/app/components/require.config.js',
-        '<%= destDir %>/app/app.js',
-      ],
-      dest: '<%= destDir %>/app/app.js'
-    },
-  };
-};

+ 0 - 20
tasks/options/connect.js

@@ -1,20 +0,0 @@
-module.exports = function(config) {
-  return {
-    dev: {
-      options: {
-        port: 5601,
-        hostname: '*',
-        base: config.srcDir,
-        keepalive: true
-      }
-    },
-    dist: {
-      options: {
-        port: 5605,
-        hostname: '*',
-        base: config.destDir,
-        keepalive: true
-      }
-    },
-  }
-};

+ 0 - 11
tasks/options/copy.js

@@ -1,11 +0,0 @@
-module.exports = function(config) {
-  return {
-    // copy source to temp, we will minify in place for the dist build
-    everything_but_less_to_temp: {
-      cwd: '<%= srcDir %>',
-      expand: true,
-      src: ['**/*', '!**/*.less', '!config.js'],
-      dest: '<%= tempDir %>'
-    }
-  };
-};

+ 0 - 10
tasks/options/cssmin.js

@@ -1,10 +0,0 @@
-module.exports = function(config) {
-  return {
-    build: {
-      expand: true,
-      cwd: '<%= tempDir %>',
-      src: '**/*.css',
-      dest: '<%= tempDir %>'
-    }
-  };
-};

+ 0 - 17
tasks/options/filerev.js

@@ -1,17 +0,0 @@
-module.exports = function(config) {
-  return {
-    options: {
-      encoding: 'utf8',
-      algorithm: 'md5',
-      length: 8,
-    },
-    css: {
-      src: '<%= destDir %>/css/default.min.css',
-      dest: '<%= destDir %>/css'
-    },
-    js: {
-      src: '<%= destDir %>/app/app.js',
-      dest: '<%= destDir %>/app'
-    }
-  };
-};

+ 0 - 7
tasks/options/git-describe.js

@@ -1,7 +0,0 @@
-module.exports = function(config) {
-  return {
-    me: {
-      // Target-specific file lists and/or options go here.
-    }
-  };
-};

+ 0 - 18
tasks/options/htmlmin.js

@@ -1,18 +0,0 @@
-module.exports = function(config) {
-  return {
-    build: {
-      options:{
-        removeComments: true,
-        collapseWhitespace: true
-      },
-      expand: true,
-      cwd: '<%= tempDir %>',
-      src: [
-        //'index.html',
-        'app/panels/**/*.html',
-        'app/partials/**/*.html'
-      ],
-      dest: '<%= tempDir %>'
-    }
-  };
-};

+ 0 - 22
tasks/options/jscs.js

@@ -1,22 +0,0 @@
-module.exports = function(config) {
-  return {
-    src: [
-      'Gruntfile.js',
-      '<%= srcDir %>/app/**/*.js',
-      '!<%= srcDir %>/app/panels/*/{lib,leaflet}/*',
-      '!<%= srcDir %>/app/dashboards/*'
-    ],
-    options: {
-      config: ".jscs.json",
-    },
-  };
-};
-
-/*
- "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
-    "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
-    "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
-    "disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
-    "requireRightStickedOperators": ["!"],
-    "requireLeftStickedOperators": [","],
-   */

+ 0 - 26
tasks/options/jshint.js

@@ -1,26 +0,0 @@
-module.exports = function(config) {
-  return {
-    source: {
-      files: {
-        src: ['Gruntfile.js', '<%= srcDir %>/app/**/*.js'],
-      }
-    },
-    tests: {
-      files: {
-        src: ['<%= srcDir %>/test/**/*.js'],
-      }
-    },
-    options: {
-      jshintrc: true,
-      reporter: require('jshint-stylish'),
-      ignores: [
-        'node_modules/*',
-        'dist/*',
-        'sample/*',
-        '<%= srcDir %>/vendor/*',
-        '<%= srcDir %>/app/panels/*/{lib,leaflet}/*',
-        '<%= srcDir %>/app/dashboards/*'
-      ]
-    }
-  };
-};

+ 0 - 27
tasks/options/karma.js

@@ -1,27 +0,0 @@
-module.exports = function(config) {
-  return {
-    dev: {
-      configFile: 'src/test/karma.conf.js',
-      singleRun: false,
-    },
-    debug: {
-      configFile: 'src/test/karma.conf.js',
-      singleRun: false,
-      browsers: ['Chrome']
-    },
-    test: {
-      configFile: 'src/test/karma.conf.js',
-    },
-    coveralls: {
-      configFile: 'src/test/karma.conf.js',
-      reporters: ['dots','coverage','coveralls'],
-      preprocessors: {
-        'src/app/**/*.js': ['coverage']
-      },
-      coverageReporter: {
-        type: 'lcov',
-        dir: 'coverage/'
-      }
-    }
-  };
-};

+ 0 - 25
tasks/options/less.js

@@ -1,25 +0,0 @@
-module.exports = function(config) {
-  return {
-    // this is the only task, other than copy, that runs on the src directory, since we don't really need
-    // the less files in the dist. Everything else runs from on temp, and require copys everything
-    // from temp -> dist
-    dist:{
-      expand: true,
-      cwd:'<%= srcDir %>/vendor/bootstrap/less/',
-      src: ['bootstrap.dark.less', 'bootstrap.light.less'],
-      dest: '<%= tempDir %>/css/',
-    },
-    // Compile in place when not building
-    src:{
-      options: {
-        paths: ["<%= srcDir %>/vendor/bootstrap/less", "<%= srcDir %>/css/less"],
-        yuicompress:true
-      },
-      files: {
-        "<%= srcDir %>/css/bootstrap.dark.min.css": "<%= srcDir %>/css/less/bootstrap.dark.less",
-        "<%= srcDir %>/css/bootstrap.light.min.css": "<%= srcDir %>/css/less/bootstrap.light.less",
-        "<%= srcDir %>/css/bootstrap-responsive.min.css": "<%= srcDir %>/css/less/grafana-responsive.less"
-      }
-    }
-  };
-};

+ 0 - 9
tasks/options/meta.js

@@ -1,9 +0,0 @@
-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'
-  };
-};

+ 0 - 19
tasks/options/ngmin.js

@@ -1,19 +0,0 @@
-module.exports = function(config) {
-  return {
-    build: {
-      expand:true,
-      cwd:'<%= tempDir %>',
-      src: [
-        'app/controllers/**/*.js',
-        'app/directives/**/*.js',
-        'app/services/**/*.js',
-        'app/filters/**/*.js',
-        'app/panels/**/*.js',
-        'app/routes/**/*.js',
-        'app/app.js',
-        'vendor/angular/**/*.js',
-      ],
-      dest: '<%= tempDir %>'
-    }
-  };
-};

+ 0 - 18
tasks/options/ngtemplates.js

@@ -1,18 +0,0 @@
-module.exports = function(config) {
-  return {
-    grafana: {
-      cwd:  '<%= tempDir %>',
-      src:  ['app/**/*.html', '!app/panels/*/module.html'],
-      dest: '<%= tempDir %>/app/components/partials.js',
-      options: {
-        bootstrap: function(module, script) {
-          return "define('components/partials', ['angular'], function(angular) { \n" +
-            "angular.module('grafana').run(['$templateCache', function($templateCache) { \n" +
-                script +
-            '\n}]);' +
-          '\n});';
-        }
-      }
-    }
-  };
-};

+ 0 - 83
tasks/options/requirejs.js

@@ -1,83 +0,0 @@
-module.exports = function(config,grunt) {
-  var _c = {
-    build: {
-      options: {
-        appDir: '<%= tempDir %>',
-        dir: '<%= destDir %>',
-
-        mainConfigFile: '<%= tempDir %>/app/components/require.config.js',
-        modules: [], // populated below
-
-        optimize: 'none',
-        optimizeCss: 'none',
-        optimizeAllPluginResources: false,
-
-        paths: { config: '../config.sample' }, // fix, fallbacks need to be specified
-
-        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();
-        }
-      }
-    }
-  };
-
-  // setup the modules require will build
-  var requireModules = _c.build.options.modules = [
-    {
-      // main/common module
-      name: 'app',
-      include: [
-        'css',
-        'kbn',
-        'text',
-        'jquery',
-        'angular',
-        'settings',
-        'bootstrap',
-        'modernizr',
-        'timepicker',
-        'datepicker',
-        'underscore',
-        'filters/all',
-        'jquery.flot',
-        'services/all',
-        'angular-strap',
-        'directives/all',
-        'jquery.flot.pie',
-        'angular-dragdrop',
-      ]
-    }
-  ];
-
-  var fs = require('fs');
-  var panelPath = config.srcDir+'/app/panels'
-
-  // create a module for each directory in src/app/panels/
-  fs.readdirSync(panelPath).forEach(function (panelName) {
-    requireModules[0].include.push('panels/'+panelName+'/module');
-    requireModules[0].include.push('text!panels/'+panelName+'/module.html');
-  });
-
-  // exclude the literal config definition from all modules
-  requireModules
-    .forEach(function (module) {
-      module.excludeShallow = module.excludeShallow || [];
-      module.excludeShallow.push('config');
-    });
-
-  return _c;
-};

+ 0 - 16
tasks/options/uglify.js

@@ -1,16 +0,0 @@
-module.exports = function(config) {
-  return {
-    dest: {
-      expand: true,
-      src: ['**/*.js', '!config.sample.js', '!app/dashboards/*.js', '!app/dashboards/**/*.js',],
-      dest: '<%= destDir %>',
-      cwd: '<%= destDir %>',
-      options: {
-        quite: true,
-        compress: true,
-        preserveComments: false,
-        banner: '<%= meta.banner %>'
-      }
-    }
-  };
-};

+ 0 - 5
tasks/options/usemin.js

@@ -1,5 +0,0 @@
-module.exports = function(config) {
-  return {
-    html: '<%= destDir %>/index.html',
-  };
-};

+ 0 - 5
tasks/options/useminPrepare.js

@@ -1,5 +0,0 @@
-module.exports = function(config) {
-  return {
-    html: 'tmp/index.html',
-  };
-};

+ 0 - 3
tasks/server_task.js

@@ -1,3 +0,0 @@
-module.exports = function(grunt) {
-  grunt.registerTask('server', ['connect:dev']);
-};

+ 2 - 4
views/index.html

@@ -7,7 +7,7 @@
     <meta name="viewport" content="width=device-width">
 
     <title>Grafana</title>
-    <link rel="stylesheet" href="public/css/default.min.css" title="Dark">
+    <link rel="stylesheet" href="public/css/grafana.dark.min.css" title="Dark">
 
     <!-- build:js app/app.js -->
     <script src="public/vendor/require/require.js"></script>
@@ -20,9 +20,7 @@
 
   <body ng-cloak ng-controller="GrafanaCtrl">
 
-    <link rel="stylesheet" href="public/css/bootstrap.light.min.css" ng-if="grafana.style === 'light'">
-    <link rel="stylesheet" href="public/css/bootstrap-responsive.min.css">
-    <link rel="stylesheet" href="public/css/font-awesome.min.css">
+    <link rel="stylesheet" href="public/css/grafana.light.min.css" ng-if="grafana.style === 'light'">
 
     <div ng-repeat='alert in dashAlerts.list' class="alert-{{alert.severity}} dashboard-notice" ng-show="$last">
       <button type="button" class="close" ng-click="dashAlerts.clear(alert)" style="padding-right:50px">&times;</button>