<commit_before>var webpack = require('webpack');

module.exports = function (config) {
  // Browsers to run on BrowserStack
  var customLaunchers = {
    BS_Chrome: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'chrome',
      browser_version: '39.0',
    },
    BS_Firefox: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'firefox',
      browser_version: '32.0',
    },
    BS_Safari: {
      base: 'BrowserStack',
      os: 'OS X',
      os_version: 'Yosemite',
      browser: 'safari',
      browser_version: '8.0',
    },
//    BS_InternetExplorer9: {
//      base: 'BrowserStack',
//      os: 'Windows',
//      os_version: '7',
//      browser: 'ie',
//      browser_version: '9.0',
//    },
    BS_InternetExplorer10: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8',
      browser: 'ie',
      browser_version: '10.0',
    },
    BS_InternetExplorer11: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'ie',
      browser_version: '11.0',
    },
    BS_MobileSafari: {
      base: 'BrowserStack',
      os: 'ios',
      os_version: '7.0',
      browser: 'iphone'
    },
  };

  config.set({
    customLaunchers: customLaunchers,

    browsers: [ 'Chrome' ],
    frameworks: [ 'mocha' ],
    reporters: [ 'mocha' ],

    files: [
      'tests.webpack.js'
    ],

    preprocessors: {
      'tests.webpack.js': [ 'webpack', 'sourcemap' ]
    },

    webpack: {
      devtool: 'inline-source-map',
      module: {
        loaders: [
          { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
        ]
      },
      plugins: [
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': JSON.stringify('test')
        })
      ]
    },

    webpackServer: {
      noInfo: true
    }
  });

  if (process.env.USE_CLOUD) {
    config.browsers = Object.keys(customLaunchers);
    config.reporters = [ 'dots' ];
    config.browserDisconnectTimeout = 10000;
    config.browserDisconnectTolerance = 3;
    config.browserNoActivityTimeout = 30000;
    config.captureTimeout = 120000;

    if (process.env.TRAVIS) {
      var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';

      config.browserStack = {
        username: process.env.BROWSER_STACK_USERNAME,
        accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
        pollingTimeout: 10000,
        startTunnel: false,
        project: 'react-router',
        build: buildLabel,
        name: process.env.TRAVIS_JOB_NUMBER,
      };

      config.singleRun = true;
    } else {
      config.browserStack = {
        username: process.env.BROWSER_STACK_USERNAME,
        accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
        pollingTimeout: 10000,
        startTunnel: true,
      };
    }
  }
};
<commit_msg>Run mobile Safari build on simulator<commit_after>var webpack = require('webpack');

module.exports = function (config) {
  // Browsers to run on BrowserStack
  var customLaunchers = {
    BS_Chrome: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'chrome',
      browser_version: '39.0',
    },
    BS_Firefox: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'firefox',
      browser_version: '32.0',
    },
    BS_Safari: {
      base: 'BrowserStack',
      os: 'OS X',
      os_version: 'Yosemite',
      browser: 'safari',
      browser_version: '8.0',
    },
    BS_MobileSafari: {
      base: 'BrowserStack',
      os: 'ios',
      os_version: '7.0',
      browser: 'iphone',
      real_mobile: false,
    },
//    BS_InternetExplorer9: {
//      base: 'BrowserStack',
//      os: 'Windows',
//      os_version: '7',
//      browser: 'ie',
//      browser_version: '9.0',
//    },
    BS_InternetExplorer10: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8',
      browser: 'ie',
      browser_version: '10.0',
    },
    BS_InternetExplorer11: {
      base: 'BrowserStack',
      os: 'Windows',
      os_version: '8.1',
      browser: 'ie',
      browser_version: '11.0',
    },
  };

  config.set({
    customLaunchers: customLaunchers,

    browsers: [ 'Chrome' ],
    frameworks: [ 'mocha' ],
    reporters: [ 'mocha' ],

    files: [
      'tests.webpack.js'
    ],

    preprocessors: {
      'tests.webpack.js': [ 'webpack', 'sourcemap' ]
    },

    webpack: {
      devtool: 'inline-source-map',
      module: {
        loaders: [
          { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
        ]
      },
      plugins: [
        new webpack.DefinePlugin({
          'process.env.NODE_ENV': JSON.stringify('test')
        })
      ]
    },

    webpackServer: {
      noInfo: true
    }
  });

  if (process.env.USE_CLOUD) {
    config.browsers = Object.keys(customLaunchers);
    config.reporters = [ 'dots' ];
    config.browserDisconnectTimeout = 10000;
    config.browserDisconnectTolerance = 3;
    config.browserNoActivityTimeout = 30000;
    config.captureTimeout = 120000;

    if (process.env.TRAVIS) {
      var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';

      config.browserStack = {
        username: process.env.BROWSER_STACK_USERNAME,
        accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
        pollingTimeout: 10000,
        startTunnel: false,
        project: 'react-router',
        build: buildLabel,
        name: process.env.TRAVIS_JOB_NUMBER,
      };

      config.singleRun = true;
    } else {
      config.browserStack = {
        username: process.env.BROWSER_STACK_USERNAME,
        accessKey: process.env.BROWSER_STACK_ACCESS_KEY,
        pollingTimeout: 10000,
        startTunnel: true,
      };
    }
  }
};
<|endoftext|>


<commit_before>module.exports = function(config){
  config.set({

    basePath : '',

    files : [
      'bower_components/angular/angular.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'bower_components/farmbuild-farmdata/dist/farmbuild-farmdata.js',
      'src/nutrient-calculator.js',
      'src/google-analytic/index.src.js',
      'src/animals-purchased/animalTypes.conf.src.js',
      'src/animals-purchased/index.src.js',
      'src/validations/index.src.js',
      'src/milk-sold/index.src.js',
      'src/index.js',
      'src/*.js',
      'src/**/*.js'
    ],

    autoWatch : true,

    frameworks: ['jasmine'],

    browsers : ['Chrome'],

    plugins : [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine',
            'karma-junit-reporter'
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

  });
};
<commit_msg>Added core to karma.conf<commit_after>module.exports = function(config){
  config.set({

    basePath : '',

    files : [
      'bower_components/farmbuild-core/dist/farmbuild-core.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'bower_components/farmbuild-farmdata/dist/farmbuild-farmdata.js',
      'src/nutrient-calculator.js',
      'src/google-analytic/index.src.js',
      'src/animals-purchased/animalTypes.conf.src.js',
      'src/animals-purchased/index.src.js',
      'src/validations/index.src.js',
      'src/milk-sold/index.src.js',
      'src/index.js',
      'src/*.js',
      'src/**/*.js'
    ],

    autoWatch : true,

    frameworks: ['jasmine'],

    browsers : ['Chrome'],

    plugins : [
            'karma-chrome-launcher',
            'karma-firefox-launcher',
            'karma-jasmine',
            'karma-junit-reporter'
            ],

    junitReporter : {
      outputFile: 'test_out/unit.xml',
      suite: 'unit'
    }

  });
};
<|endoftext|>


<commit_before>var clone= require('clone');
var paths = require('./build/paths');
var webpackConfig = clone(require('./webpack.config.js'));

// Add istanbul-instrumenter to webpack configuration
webpackConfig.module.loaders.push(
    {
        test: /\.js$/,
        exclude: /(node_modules|test)/,
        loader: 'babel-istanbul-loader'
    }
);

webpackConfig.output.filename += '.test';
webpackConfig.plugins = [];
webpackConfig.externals = [];

function ConfigException(message) {
   this.message = message;
   this.name = 'ConfigException';
}

// The main configuration
module.exports = function(config) {
    if (process.env.CI && (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY)) {
        throw ConfigException('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.')
    }

    var customLaunchers = {
        sl_chrome: {
            base: 'SauceLabs',
            browserName: 'chrome',
            platform: 'Windows 7',
            version: '35'
        },
        sl_firefox: {
            base: 'SauceLabs',
            browserName: 'firefox',
            version: '30'
        },
        sl_ie_11: {
            base: 'SauceLabs',
            browserName: 'internet explorer',
            platform: 'Windows 8.1',
            version: '11'
        }
    }

    config.set({
        frameworks: [
            'jasmine-jquery',
            'jasmine-ajax',
            'jasmine'
        ],

        files: [
            'test/*.spec.js'
        ],

        preprocessors: {
            'test/*.spec.js': [
                'webpack'
            ]
        },

        coverageReporter: {
            reporters: [
                { type: 'lcov', dir: paths.coverageDir },
                { type: 'text' }
            ]
        },

        webpack: webpackConfig,

        webpackMiddleware: {
            noInfo: true
        },
        colors: true,
        recordScreenshots: false,
        reporters: (process.env.TRAVIS) ? ['spec', 'coverage', 'coveralls', 'saucelabs'] : ['spec', 'coverage', 'saucelabs'],

        sauceLabs: {
            testName: 'Dual listbox browser testing',
            public: 'public'
        },
        customLaunchers: customLaunchers,
        captureTimeout: 120000,
        browsers: Object.keys(customLaunchers),
        singleRun: true
    });
}
<commit_msg>Updated the browsers that are tested<commit_after>var clone= require('clone');
var paths = require('./build/paths');
var webpackConfig = clone(require('./webpack.config.js'));

// Add istanbul-instrumenter to webpack configuration
webpackConfig.module.loaders.push(
    {
        test: /\.js$/,
        exclude: /(node_modules|test)/,
        loader: 'babel-istanbul-loader'
    }
);

webpackConfig.output.filename += '.test';
webpackConfig.plugins = [];
webpackConfig.externals = [];

function ConfigException(message) {
   this.message = message;
   this.name = 'ConfigException';
}

// The main configuration
module.exports = function(config) {
    if (process.env.CI && (!process.env.SAUCE_USERNAME || !process.env.SAUCE_ACCESS_KEY)) {
        throw ConfigException('Make sure the SAUCE_USERNAME and SAUCE_ACCESS_KEY environment variables are set.')
    }

    var customLaunchers = {
        sl_chrome: {
            base: 'SauceLabs',
            browserName: 'chrome',
            platform: 'Windows 7',
            version: '58'
        },
        sl_chrome_2: {
            base: 'SauceLabs',
            browserName: 'chrome',
            platform: 'Windows 7',
            version: '57'
        },
        sl_edge: {
            base: 'SauceLabs',
            browserName: 'edge',
            platform: 'Windows 7',
            version: '15'
        },
        sl_edge_2: {
            base: 'SauceLabs',
            browserName: 'edge',
            platform: 'Windows 7',
            version: '14'
        },
        sl_safari: {
            base: 'SauceLabs',
            browserName: 'safari',
            platform: 'macOS 10.12',
            version: '10'
        },
        sl_safari_2: {
            base: 'SauceLabs',
            browserName: 'safari',
            platform: 'macOS 10.11',
            version: '9'
        },
        sl_firefox: {
            base: 'SauceLabs',
            browserName: 'firefox',
            version: '54'
        },
        sl_ie_11: {
            base: 'SauceLabs',
            browserName: 'internet explorer',
            platform: 'Windows 8.1',
            version: '11'
        }
    }

    config.set({
        frameworks: [
            'jasmine-jquery',
            'jasmine-ajax',
            'jasmine'
        ],

        files: [
            'test/*.spec.js'
        ],

        preprocessors: {
            'test/*.spec.js': [
                'webpack'
            ]
        },

        coverageReporter: {
            reporters: [
                { type: 'lcov', dir: paths.coverageDir },
                { type: 'text' }
            ]
        },

        webpack: webpackConfig,

        webpackMiddleware: {
            noInfo: true
        },
        colors: true,
        recordScreenshots: false,
        reporters: (process.env.TRAVIS) ? ['spec', 'coverage', 'coveralls', 'saucelabs'] : ['spec', 'coverage', 'saucelabs'],

        sauceLabs: {
            testName: 'Dual listbox browser testing',
            public: 'public'
        },
        customLaunchers: customLaunchers,
        captureTimeout: 120000,
        browsers: Object.keys(customLaunchers),
        singleRun: true
    });
}
<|endoftext|>


<commit_before>// Karma configuration
// Generated on Tue Jul 07 2015 20:44:56 GMT-0500 (CDT)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    plugins: [
      'karma-mocha',
      'karma-chai-plugins',
      'karma-phantomjs-launcher'
    ],

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'chai', 'sinon-chai'],

    // File load order: Vendors (includes angular) -> angular-mocks -> app -> specs
    files: [
      'build/vendors*.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'build/app**.js*',
      'test/**/*.spec.js'
    ],

    // list of files to exclude
    exclude: [
      'build/*.js.map'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
  })
}
<commit_msg>Fix linting errors<commit_after>'use strict';

// Karma configuration
// Generated on Tue Jul 07 2015 20:44:56 GMT-0500 (CDT)

module.exports = function (config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    plugins: [
      'karma-mocha',
      'karma-chai-plugins',
      'karma-phantomjs-launcher'
    ],

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'chai', 'sinon-chai'],

    // File load order: Vendors (includes angular) -> angular-mocks -> app -> specs
    files: [
      'build/vendors*.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'build/app**.js*',
      'test/**/*.spec.js'
    ],

    // list of files to exclude
    exclude: [
      'build/*.js.map'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false
  });
};
<|endoftext|>


<commit_before>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-spec-reporter'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    proxies: {
      '/assets/': '/base/src/assets/'
    },
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: process.env.CODECOV
      ? ['spec', 'coverage-istanbul']
      : ['spec', 'kjhtml'],
    specReporter: {
      maxLogLines: 5,
      suppressErrorSummary: true,
      suppressFailed: false,
      suppressPassed: false,
      suppressSkipped: true,
      showSpecTiming: false
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: [process.env.PHANTOM ? 'PhantomJS' : 'Chrome'],
    singleRun: false
  });
};
<commit_msg>Allow remote debugger attachment to Karma<commit_after>// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-phantomjs-launcher'),
      require('karma-spec-reporter'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    proxies: {
      '/assets/': '/base/src/assets/'
    },
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: process.env.CODECOV
      ? ['spec', 'coverage-istanbul']
      : ['spec', 'kjhtml'],
    specReporter: {
      maxLogLines: 5,
      suppressErrorSummary: true,
      suppressFailed: false,
      suppressPassed: false,
      suppressSkipped: true,
      showSpecTiming: false
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: [process.env.PHANTOM ? 'PhantomJS' : 'ChromeRemoteDebug'],
    singleRun: false,
    customLaunchers: {
      ChromeRemoteDebug: {
        base: 'Chrome',
        flags: ['--remote-debugging-port=9222']
      }
    }
  });
};
<|endoftext|>


<commit_before>module.exports = function(config) {
	config.set({
		// base path, that will be used to resolve files and exclude
		basePath: '',

		// frameworks to use
		frameworks: ['mocha'],

		preprocessors: {
			'fogbugz.js': 'coverage',
			'test/*.coffee': 'coffee'
		},

		// list of files / patterns to load in the browser
		files: [
			// TODO install jquery locally
			'http://code.jquery.com/jquery-2.0.3.js',
			'node_modules/jquery-xml2json/src/xml2json.js',
			'node_modules/expect.js/expect.js',
			'node_modules/underscore/underscore.js',
			'karma-require.js',
			'fogbugz.js',
			'test/*.coffee'
		],

		// list of files to exclude
		exclude: [],

		// test results reporter to use
		// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
		reporters: ['dots', 'coverage'],

		coverageReporter: {
			type: 'html',
			dir: '.coverage'
		},

		// web server port
		port: 9876,

		// enable / disable colors in the output (reporters and logs)
		colors: true,

		// level of logging
		// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
		logLevel: config.LOG_INFO,

		// enable / disable watching file and executing tests whenever any file changes
		autoWatch: false,

		// Start these browsers, currently available:
		// - Chrome
		// - ChromeCanary
		// - Firefox
		// - Opera
		// - Safari (only Mac)
		// - PhantomJS
		// - IE (only Windows)
		browsers: ['PhantomJS'],

		// If browser does not capture in given timeout [ms], kill it
		captureTimeout: 60000,

		// Continuous Integration mode
		// if true, it capture browsers, run tests and exit
		singleRun: false
	});
};
<commit_msg>fixing build<commit_after>module.exports = function(config) {
	config.set({
		// base path, that will be used to resolve files and exclude
		basePath: '',

		// frameworks to use
		frameworks: ['mocha'],

		preprocessors: {
			'fogbugz.js': 'coverage',
			'test/*.coffee': 'coffee'
		},

		// list of files / patterns to load in the browser
		files: [
			// TODO install jquery locally
			'http://code.jquery.com/jquery-2.0.3.js',
			'node_modules/jquery-xml2json/src/xml2json.js',
			'node_modules/expect.js/index.js',
			'node_modules/underscore/underscore.js',
			'karma-require.js',
			'fogbugz.js',
			'test/*.coffee'
		],

		// list of files to exclude
		exclude: [],

		// test results reporter to use
		// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
		reporters: ['dots', 'coverage'],

		coverageReporter: {
			type: 'html',
			dir: '.coverage'
		},

		// web server port
		port: 9876,

		// enable / disable colors in the output (reporters and logs)
		colors: true,

		// level of logging
		// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
		logLevel: config.LOG_INFO,

		// enable / disable watching file and executing tests whenever any file changes
		autoWatch: false,

		// Start these browsers, currently available:
		// - Chrome
		// - ChromeCanary
		// - Firefox
		// - Opera
		// - Safari (only Mac)
		// - PhantomJS
		// - IE (only Windows)
		browsers: ['PhantomJS'],

		// If browser does not capture in given timeout [ms], kill it
		captureTimeout: 60000,

		// Continuous Integration mode
		// if true, it capture browsers, run tests and exit
		singleRun: false
	});
};
<|endoftext|>


<commit_before>module.exports = function (config) {
    var configuration = {

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '',

        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            'node_modules/jquery/dist/jquery.js',
            'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
            'node_modules/jasmine2-custom-message/jasmine2-custom-message.js',
            { pattern: 'Tests/*.html', included: true },
            { pattern: 'Tests/*.js', included: true },
            { pattern: 'Scripts/*.js', included: true }
        ],

        // list of files to exclude
        exclude: [
        ],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
        },

        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['mocha'],

        // enable / disable colors in the output (reporters and logs)
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: false,

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: true
    };

    config.set(configuration);
}

<commit_msg>fixed include order<commit_after>module.exports = function (config) {
    var configuration = {

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '',

        // frameworks to use
        // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
        frameworks: ['jasmine'],

        // list of files / patterns to load in the browser
        files: [
            'node_modules/jquery/dist/jquery.js',
            'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
            'node_modules/jasmine2-custom-message/jasmine2-custom-message.js',
            { pattern: 'Tests/*.html', included: true },
            { pattern: 'Tests/*.js', included: true },
            'Scripts/moment.min.js',
            'Scripts/bootstrap-sortable.js'
        ],

        // list of files to exclude
        exclude: [
        ],

        // preprocess matching files before serving them to the browser
        // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
        preprocessors: {
        },

        // test results reporter to use
        // possible values: 'dots', 'progress'
        // available reporters: https://npmjs.org/browse/keyword/karma-reporter
        reporters: ['mocha'],

        // enable / disable colors in the output (reporters and logs)
        colors: true,

        // level of logging
        // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
        logLevel: config.LOG_INFO,

        // enable / disable watching file and executing tests whenever any file changes
        autoWatch: false,

        // start these browsers
        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
        browsers: ['PhantomJS'],

        // Continuous Integration mode
        // if true, Karma captures browsers, runs the tests and exits
        singleRun: true
    };

    config.set(configuration);
}

<|endoftext|>


<commit_before>// Karma configuration
// Generated on Tue Mar 17 2015 21:35:02 GMT-0400 (EDT)

module.exports = function(config) {
  'use strict';
  var customLaunchers = {
    chromeWin: {
      browserName: 'chrome',
      platform: 'Windows 7'
    },
    chromeLinux: {
      browserName: 'chrome',
      platform: 'Linux'
    },
    chromeOSX: {
      browserName: 'chrome',
      platform: 'OS X 10.9'
    },
    firefoxWin: {
      browserName: 'firefox',
      platform: 'Windows 7'
    },
    firefoxLinux: {
      browserName: 'firefox',
      platform: 'Linux'
    },
    firefoxOSX: {
      browserName: 'firefox',
      platform: 'OS X 10.9'
    },
    ie10: {
      browserName: 'internet explorer',
      version: '10'
    },
    ie11: {
      browserName: 'internet explorer',
      version: '11'
    }
  };
  for (var l in customLaunchers) {
    customLaunchers[l].base = 'SauceLabs';
  }
  var browsers = ['Chrome'];
  var reporters = ['clear-screen', 'mocha', 'coverage'];
  if (process.env.CI === 'true') {
    browsers = Object.keys(customLaunchers);
    reporters = ['dots', 'saucelabs'];
  }
  config.set({
    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'sinon-chai'],

    // list of files / patterns to load in the browser
    files: [
      'src/boa.js',
      'tests/**/*.coffee'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'src/**/*.js': 'coverage',
      '**/*.coffee': ['coffee']
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: reporters,

    coverageReporter: {
      reporters: [
        {type: 'text-summary'},
        {type: 'html'}
      ]
    },

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: browsers,

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    customLaunchers: customLaunchers
  });
};
<commit_msg>Remove IE10, switch reporter to mocha<commit_after>// Karma configuration
// Generated on Tue Mar 17 2015 21:35:02 GMT-0400 (EDT)

module.exports = function(config) {
  'use strict';
  var customLaunchers = {
    chromeWin: {
      browserName: 'chrome',
      platform: 'Windows 7'
    },
    chromeLinux: {
      browserName: 'chrome',
      platform: 'Linux'
    },
    chromeOSX: {
      browserName: 'chrome',
      platform: 'OS X 10.9'
    },
    firefoxWin: {
      browserName: 'firefox',
      platform: 'Windows 7'
    },
    firefoxLinux: {
      browserName: 'firefox',
      platform: 'Linux'
    },
    firefoxOSX: {
      browserName: 'firefox',
      platform: 'OS X 10.9'
    },
    ie11: {
      browserName: 'internet explorer',
      version: '11'
    }
  };
  for (var l in customLaunchers) {
    customLaunchers[l].base = 'SauceLabs';
  }
  var browsers = ['Chrome'];
  var reporters = ['clear-screen', 'mocha', 'coverage'];
  if (process.env.CI === 'true') {
    browsers = Object.keys(customLaunchers);
    reporters = ['mocha', 'saucelabs'];
  }
  config.set({
    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'sinon-chai'],

    // list of files / patterns to load in the browser
    files: [
      'src/boa.js',
      'tests/**/*.coffee'
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'src/**/*.js': 'coverage',
      '**/*.coffee': ['coffee']
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: reporters,

    coverageReporter: {
      reporters: [
        {type: 'text-summary'},
        {type: 'html'}
      ]
    },

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: browsers,

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    customLaunchers: customLaunchers
  });
};
<|endoftext|>


<commit_before>/**
 Copyright 2016, RadiantBlue Technologies, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
// Karma configuration
// Generated on Fri May 20 2016 09:17:02 GMT-0400 (Eastern Daylight Time)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
        'public/js/lib/jquery.min.js',
        'public/js/lib/angular.js',
        'public/js/lib/angular-mocks-1.5.5.js',
        'public/treeview.js',
        'public/js/lib/*.js',
        'public/**/*.js',
        'public/app/**/*test.js'
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'public/app/**/!(*test).js': 'coverage'
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress','coverage'],

    coverageReporter : {
      type : 'text-summary',
      dir : 'coverage/',
      file : 'textsummary.txt'
    },

    // web server port
    port: 9876,
    //port: 80,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}
<commit_msg>Switch to lcov tests to play better with sonarqube<commit_after>/**
 Copyright 2016, RadiantBlue Technologies, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */
// Karma configuration
// Generated on Fri May 20 2016 09:17:02 GMT-0400 (Eastern Daylight Time)

module.exports = function(config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
        'public/js/lib/jquery.min.js',
        'public/js/lib/angular.js',
        'public/js/lib/angular-mocks-1.5.5.js',
        'public/treeview.js',
        'public/js/lib/*.js',
        'public/**/*.js',
        'public/app/**/*test.js'
    ],

    // list of files to exclude
    exclude: [
    ],

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        'public/app/**/!(*test).js': 'coverage'
    },

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress','coverage'],

    coverageReporter : {
      type : 'lcov',
      dir : 'coverage/'
    },

    // web server port
    port: 9876,
    //port: 80,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity
  })
}
<|endoftext|>


<commit_before>import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency-decorators';

export default class SettingsDesignCustomizeController extends Controller {
    @service customThemeSettings;
    @service notifications;
    @service router;
    @service settings;

    @task
    *saveTask() {
        try {
            if (this.settings.get('errors').length !== 0) {
                return;
            }

            yield Promise.all(
                this.settings.save(),
                this.customThemeSettings.save()
            );

            this.router.transitionTo('settings.design');

            // ensure task button switches to success state
            return true;
        } catch (error) {
            if (error) {
                this.notifications.showAPIError(error);
                throw error;
            }
        }
    }
}
<commit_msg>Fixed error when saving custom design modal<commit_after>import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency-decorators';

export default class SettingsDesignCustomizeController extends Controller {
    @service customThemeSettings;
    @service notifications;
    @service router;
    @service settings;

    @task
    *saveTask() {
        try {
            if (this.settings.get('errors').length !== 0) {
                return;
            }

            yield Promise.all([
                this.settings.save(),
                this.customThemeSettings.save()
            ]);

            this.router.transitionTo('settings.design');

            // ensure task button switches to success state
            return true;
        } catch (error) {
            if (error) {
                this.notifications.showAPIError(error);
                throw error;
            }
        }
    }
}
<|endoftext|>


<commit_before>/**
 * Created by mike3 on 4/29/2017.
 */
import { Template } from 'meteor/templating';

$(document).ready(function(){
    // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
    //$('.modal-trigger').leanModal();
    //$('.modal1').modal();

});

Template.Electric_Consumption_Page.onRendered(function onRendered() {
   // $(document).ready(function(){
        // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
     //   $('.modal').modal();
    //});
});

Template.Electric_Consumption_Page.helpers({

    sliderValue(deviceId) {
        const sliderData = document.getElementById(deviceId).value;
        return sliderData;
    },

    errorClass() {
        return Template.instance().messageFlags.get(displayErrorMessages) ? 'error' : '';
    },

});
<commit_msg>Starting to build add device<commit_after>/**
 * Created by mike3 on 4/29/2017.
 */
import { Template } from 'meteor/templating';

$(document).ready(function(){
    // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
    //$('.modal-trigger').leanModal();
    //$('.modal1').modal();

});

Template.Electric_Consumption_Page.onRendered(function onRendered() {
   // $(document).ready(function(){
        // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
     //   $('.modal').modal();
    //});
});
//name
//time--> minutes
//power usage
let device1 = {"Lab", 60, 2000};
let device2 = {"Small Appliance", 90, 500};
let device3 = {"Large Appliance", 30, 1000};

Template.Electric_Consumption_Page.helpers({

    addDevice: function(name, time, power){

    },

});
<|endoftext|>


<commit_before>import {
  REBLOG_REQUEST,
  REBLOG_SUCCESS,
  REBLOG_FAIL,
  UNREBLOG_SUCCESS,
  FAVOURITE_REQUEST,
  FAVOURITE_SUCCESS,
  FAVOURITE_FAIL,
  UNFAVOURITE_SUCCESS,
  PIN_SUCCESS,
  UNPIN_SUCCESS,
} from '../actions/interactions';
import {
  STATUS_FETCH_SUCCESS,
  CONTEXT_FETCH_SUCCESS,
  STATUS_MUTE_SUCCESS,
  STATUS_UNMUTE_SUCCESS,
} from '../actions/statuses';
import {
  TIMELINE_REFRESH_SUCCESS,
  TIMELINE_UPDATE,
  TIMELINE_DELETE,
  TIMELINE_EXPAND_SUCCESS,
} from '../actions/timelines';
import {
  NOTIFICATIONS_UPDATE,
  NOTIFICATIONS_REFRESH_SUCCESS,
  NOTIFICATIONS_EXPAND_SUCCESS,
} from '../actions/notifications';
import {
  FAVOURITED_STATUSES_FETCH_SUCCESS,
  FAVOURITED_STATUSES_EXPAND_SUCCESS,
} from '../actions/favourites';
import {
  PINNED_STATUSES_FETCH_SUCCESS,
} from '../actions/pin_statuses';
import { SEARCH_FETCH_SUCCESS } from '../actions/search';
import {
  SCHEDULED_STATUSES_FETCH_SUCCESS as PAWOO_SCHEDULED_STATUSES_FETCH_SUCCESS,
  SCHEDULED_STATUSES_EXPAND_SUCCESS as PAWOO_SCHEDULED_STATUSES_EXPAND_SUCCESS,
  SCHEDULED_STATUSES_ADDITION as PAWOO_SCHEDULED_STATUSES_ADDITION,
} from '../../pawoo/actions/schedules';
import emojify from '../features/emoji/emoji';
import { Map as ImmutableMap, fromJS } from 'immutable';
import escapeTextContentForBrowser from 'escape-html';

const domParser = new DOMParser();

const normalizeStatus = (state, status) => {
  if (!status) {
    return state;
  }

  const normalStatus   = { ...status };
  normalStatus.account = status.account.id;

  if (status.reblog && status.reblog.id) {
    state               = normalizeStatus(state, status.reblog);
    normalStatus.reblog = status.reblog.id;
  }

  const searchContent = [status.spoiler_text, status.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');

  const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
    obj[`:${emoji.shortcode}:`] = emoji;
    return obj;
  }, {});

  normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent;
  normalStatus.contentHtml = emojify(normalStatus.content, emojiMap);
  normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap);

  return state.update(status.id, ImmutableMap(), map => map.mergeDeep(fromJS(normalStatus)));
};

const normalizeStatuses = (state, statuses) => {
  statuses.forEach(status => {
    state = normalizeStatus(state, status);
  });

  return state;
};

const deleteStatus = (state, id, references) => {
  references.forEach(ref => {
    state = deleteStatus(state, ref[0], []);
  });

  return state.delete(id);
};

const initialState = ImmutableMap();

export default function statuses(state = initialState, action) {
  switch(action.type) {
  case TIMELINE_UPDATE:
  case STATUS_FETCH_SUCCESS:
  case NOTIFICATIONS_UPDATE:
    return normalizeStatus(state, action.status);
  case REBLOG_SUCCESS:
  case UNREBLOG_SUCCESS:
  case FAVOURITE_SUCCESS:
  case UNFAVOURITE_SUCCESS:
  case PIN_SUCCESS:
  case UNPIN_SUCCESS:
    return normalizeStatus(state, action.response);
  case FAVOURITE_REQUEST:
    return state.setIn([action.status.get('id'), 'favourited'], true);
  case FAVOURITE_FAIL:
    return state.setIn([action.status.get('id'), 'favourited'], false);
  case REBLOG_REQUEST:
    return state.setIn([action.status.get('id'), 'reblogged'], true);
  case REBLOG_FAIL:
    return state.setIn([action.status.get('id'), 'reblogged'], false);
  case STATUS_MUTE_SUCCESS:
    return state.setIn([action.id, 'muted'], true);
  case STATUS_UNMUTE_SUCCESS:
    return state.setIn([action.id, 'muted'], false);
  case TIMELINE_REFRESH_SUCCESS:
  case TIMELINE_EXPAND_SUCCESS:
  case CONTEXT_FETCH_SUCCESS:
  case NOTIFICATIONS_REFRESH_SUCCESS:
  case NOTIFICATIONS_EXPAND_SUCCESS:
  case FAVOURITED_STATUSES_FETCH_SUCCESS:
  case FAVOURITED_STATUSES_EXPAND_SUCCESS:
  case PINNED_STATUSES_FETCH_SUCCESS:
  case SEARCH_FETCH_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_FETCH_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_EXPAND_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_ADDITION:
    return normalizeStatuses(state, action.statuses);
  case TIMELINE_DELETE:
    return deleteStatus(state, action.id, action.references);
  default:
    return state;
  }
};
<commit_msg>Fix normalize statuses<commit_after>import {
  REBLOG_REQUEST,
  REBLOG_SUCCESS,
  REBLOG_FAIL,
  UNREBLOG_SUCCESS,
  FAVOURITE_REQUEST,
  FAVOURITE_SUCCESS,
  FAVOURITE_FAIL,
  UNFAVOURITE_SUCCESS,
  PIN_SUCCESS,
  UNPIN_SUCCESS,
} from '../actions/interactions';
import {
  STATUS_FETCH_SUCCESS,
  CONTEXT_FETCH_SUCCESS,
  STATUS_MUTE_SUCCESS,
  STATUS_UNMUTE_SUCCESS,
} from '../actions/statuses';
import {
  TIMELINE_REFRESH_SUCCESS,
  TIMELINE_UPDATE,
  TIMELINE_DELETE,
  TIMELINE_EXPAND_SUCCESS,
} from '../actions/timelines';
import {
  NOTIFICATIONS_UPDATE,
  NOTIFICATIONS_REFRESH_SUCCESS,
  NOTIFICATIONS_EXPAND_SUCCESS,
} from '../actions/notifications';
import {
  FAVOURITED_STATUSES_FETCH_SUCCESS,
  FAVOURITED_STATUSES_EXPAND_SUCCESS,
} from '../actions/favourites';
import {
  PINNED_STATUSES_FETCH_SUCCESS,
} from '../actions/pin_statuses';
import { SEARCH_FETCH_SUCCESS } from '../actions/search';
import {
  SCHEDULED_STATUSES_FETCH_SUCCESS as PAWOO_SCHEDULED_STATUSES_FETCH_SUCCESS,
  SCHEDULED_STATUSES_EXPAND_SUCCESS as PAWOO_SCHEDULED_STATUSES_EXPAND_SUCCESS,
  SCHEDULED_STATUSES_ADDITION as PAWOO_SCHEDULED_STATUSES_ADDITION,
} from '../../pawoo/actions/schedules';
import emojify from '../features/emoji/emoji';
import { Map as ImmutableMap, fromJS } from 'immutable';
import escapeTextContentForBrowser from 'escape-html';
import {
  FIRST_ANNIVERSARY_INITIALIZE_TIMELINE as PAWOO_FIRST_ANNIVERSARY_INITIALIZE_TIMELINE,
} from '../../pawoo/actions/first_anniversary';

const domParser = new DOMParser();

const normalizeStatus = (state, status) => {
  if (!status) {
    return state;
  }

  const normalStatus   = { ...status };
  normalStatus.account = status.account.id;

  if (status.reblog && status.reblog.id) {
    state               = normalizeStatus(state, status.reblog);
    normalStatus.reblog = status.reblog.id;
  }

  const searchContent = [status.spoiler_text, status.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');

  const emojiMap = normalStatus.emojis.reduce((obj, emoji) => {
    obj[`:${emoji.shortcode}:`] = emoji;
    return obj;
  }, {});

  normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent;
  normalStatus.contentHtml = emojify(normalStatus.content, emojiMap);
  normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(normalStatus.spoiler_text || ''), emojiMap);

  return state.update(status.id, ImmutableMap(), map => map.mergeDeep(fromJS(normalStatus)));
};

const normalizeStatuses = (state, statuses) => {
  statuses.forEach(status => {
    state = normalizeStatus(state, status);
  });

  return state;
};

const deleteStatus = (state, id, references) => {
  references.forEach(ref => {
    state = deleteStatus(state, ref[0], []);
  });

  return state.delete(id);
};

const initialState = ImmutableMap();

export default function statuses(state = initialState, action) {
  switch(action.type) {
  case TIMELINE_UPDATE:
  case STATUS_FETCH_SUCCESS:
  case NOTIFICATIONS_UPDATE:
    return normalizeStatus(state, action.status);
  case REBLOG_SUCCESS:
  case UNREBLOG_SUCCESS:
  case FAVOURITE_SUCCESS:
  case UNFAVOURITE_SUCCESS:
  case PIN_SUCCESS:
  case UNPIN_SUCCESS:
    return normalizeStatus(state, action.response);
  case FAVOURITE_REQUEST:
    return state.setIn([action.status.get('id'), 'favourited'], true);
  case FAVOURITE_FAIL:
    return state.setIn([action.status.get('id'), 'favourited'], false);
  case REBLOG_REQUEST:
    return state.setIn([action.status.get('id'), 'reblogged'], true);
  case REBLOG_FAIL:
    return state.setIn([action.status.get('id'), 'reblogged'], false);
  case STATUS_MUTE_SUCCESS:
    return state.setIn([action.id, 'muted'], true);
  case STATUS_UNMUTE_SUCCESS:
    return state.setIn([action.id, 'muted'], false);
  case TIMELINE_REFRESH_SUCCESS:
  case TIMELINE_EXPAND_SUCCESS:
  case CONTEXT_FETCH_SUCCESS:
  case NOTIFICATIONS_REFRESH_SUCCESS:
  case NOTIFICATIONS_EXPAND_SUCCESS:
  case FAVOURITED_STATUSES_FETCH_SUCCESS:
  case FAVOURITED_STATUSES_EXPAND_SUCCESS:
  case PINNED_STATUSES_FETCH_SUCCESS:
  case SEARCH_FETCH_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_FETCH_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_EXPAND_SUCCESS:
  case PAWOO_SCHEDULED_STATUSES_ADDITION:
  case PAWOO_FIRST_ANNIVERSARY_INITIALIZE_TIMELINE:
    return normalizeStatuses(state, action.statuses);
  case TIMELINE_DELETE:
    return deleteStatus(state, action.id, action.references);
  default:
    return state;
  }
};
<|endoftext|>


<commit_before>/*
 * instanceDetailController
 * Main instance detailed view
 */

var _ = require('lodash');

function instanceDetailController($scope, instanceService, containerService) {
    'use strict';

    $scope.instance = {};
    $scope.containers = {};

    $scope.getInstance = function(host) {
        var instances = instanceService.getInstances();
        $scope.instance = _.find(instances, {'name': host});
        $scope.containers = containerService.list(host).then(
            // success
            function (containers) {
                $scope.containers = containers;
            },
            // error
            function (response) {
                console.log(response);
            }
        );
    }
}

instanceController.$inject = ['$scope', 'instanceService', 'containerService'];
module.exports = instanceDetailController;
<commit_msg>redo instanceDetailController<commit_after>/*
 * instanceDetailController
 * Main instance detailed view
 */

var _ = require('lodash');

function instanceDetailController($scope, $routeParams, instanceService, containerService) {
    'use strict';

    var host = $routeParams.host;
    $scope.instance = {};
    $scope.containers = {};

    instanceService.getInstances().then(
        // success
        function (instances) {
            $scope.instance = _.find(instances, {'name': host});
        },
        function (response) {
            console.log(response);
        }
    );

    containerService.list(host).then(
        // success
        function (containers) {
            $scope.containers = containers;
        },
        function (response) {
            console.log(response);
        }
    );
}

instanceDetailController.$inject = ['$scope', 'instanceService', 'containerService'];
module.exports = instanceDetailController;
<|endoftext|>


<commit_before>import React from 'react';
import MessagesType from '../constants/MessagesType';

export default React.createClass({
  getChannel(id) {
    let channels = this.props.channels;
    return channels && channels[id];
  },
  getUser(id) {
    let users = this.props.users;
    return users && users[id];
  },
  formatDate(date) {
    return new Date(date * 1000).toLocaleString();
  },
  formatText(text) {
    let channelLink = (id) => {
      let channel = this.getChannel(id);
      return `#${channel && channel.name}`;
    };
    let userLink = (id) => {
      let user = this.getUser(id);
      return `@${user && user.name}`;
    };
    let specialCommand = (command) => `@${command}`;
    let uriLink = (uri) => `<a href="${uri}" target="_blank">${uri}</a>`;
    if (text) {
      return text.replace(/<#([0-9A-Za-z]+)>/, (m, id) => channelLink(id))
        .replace(/<#([0-9A-Za-z]+)\|([0-9A-Za-z]+)>/gi, (m, id) => channelLink(id))
        .replace(/<@([0-9A-Za-z]+)>/gi, (m, id) => userLink(id))
        .replace(/<@([0-9A-Za-z]+)\|([0-9A-Za-z]+)>/gi, (m, id) => userLink(id))
        .replace(/<!(channel|everyone|group)>/gi, (m, command) => specialCommand(command))
        .replace(/<(https?:\/\/[^>]*)>/gi, (m, uri) => uriLink(uri));
    }
    return text;
  },
  render() {
    let createMarkup = (text) => {
      return {
        __html: this.formatText(text) || ''
      };
    };
    let channelInfo = (message, showChannel) => {
      let channel = this.getChannel(message.channel);
      if (showChannel && channel) {
        return
#{channel.name}
;
      }
    };
    let botMessage = (message, showChannel) => {
      let attachment = _.find(message.attachments, (attachment) => attachment.text);
      let text = attachment ? attachment.text : '';
      let icon = message.icons ? message.icons.image_48 : (attachment ? attachment.author_icon : '');
      return (

{message.username}

{this.formatDate(message.ts)}

            {channelInfo(message, showChannel)}

      );
    };
    let normalMessage = (message, user, showChannel) => {
      return (

{user && user.name}

{this.formatDate(message.ts)}

            {channelInfo(message, showChannel)}

      );
    };

    if (this.props.message.hidden) {
      return null;
    }

    let message = this.props.message;
    let showChannel = this.props.type === MessagesType.SEARCH_MESSAGES;
    switch (this.props.message.subtype) {
      case 'bot_message':
        return botMessage(message, showChannel);
        break;
      default:
        return normalMessage(message, this.getUser(message.user), showChannel);
        break;
    }
  }
});
<commit_msg>fix bot message is empty<commit_after>import React from 'react';
import MessagesType from '../constants/MessagesType';

export default React.createClass({
  getChannel(id) {
    let channels = this.props.channels;
    return channels && channels[id];
  },
  getUser(id) {
    let users = this.props.users;
    return users && users[id];
  },
  formatDate(date) {
    return new Date(date * 1000).toLocaleString();
  },
  formatText(text) {
    let channelLink = (id) => {
      let channel = this.getChannel(id);
      return `#${channel && channel.name}`;
    };
    let userLink = (id) => {
      let user = this.getUser(id);
      return `@${user && user.name}`;
    };
    let specialCommand = (command) => `@${command}`;
    let uriLink = (uri) => `<a href="${uri}" target="_blank">${uri}</a>`;
    if (text) {
      return text.replace(/<#([0-9A-Za-z]+)>/, (m, id) => channelLink(id))
        .replace(/<#([0-9A-Za-z]+)\|([0-9A-Za-z]+)>/gi, (m, id) => channelLink(id))
        .replace(/<@([0-9A-Za-z]+)>/gi, (m, id) => userLink(id))
        .replace(/<@([0-9A-Za-z]+)\|([0-9A-Za-z]+)>/gi, (m, id) => userLink(id))
        .replace(/<!(channel|everyone|group)>/gi, (m, command) => specialCommand(command))
        .replace(/<(https?:\/\/[^>]*)>/gi, (m, uri) => uriLink(uri));
    }
    return text;
  },
  render() {
    let createMarkup = (text) => {
      return {
        __html: this.formatText(text) || ''
      };
    };
    let channelInfo = (message, showChannel) => {
      let channel = this.getChannel(message.channel);
      if (showChannel && channel) {
        return
#{channel.name}
;
      }
    };
    let botMessage = (message, showChannel) => {
      let attachment = _.find(message.attachments, (attachment) => attachment.text);
      let text = attachment ? attachment.text : message.text;
      let icon = message.icons ? message.icons.image_48 : (attachment ? attachment.author_icon : '');
      return (

{message.username}

{this.formatDate(message.ts)}

            {channelInfo(message, showChannel)}

      );
    };
    let normalMessage = (message, user, showChannel) => {
      return (

{user && user.name}

{this.formatDate(message.ts)}

            {channelInfo(message, showChannel)}

      );
    };

    if (this.props.message.hidden) {
      return null;
    }

    let message = this.props.message;
    let showChannel = this.props.type === MessagesType.SEARCH_MESSAGES;
    switch (this.props.message.subtype) {
      case 'bot_message':
        return botMessage(message, showChannel);
        break;
      default:
        return normalMessage(message, this.getUser(message.user), showChannel);
        break;
    }
  }
});
<|endoftext|>


<commit_before>'use strict';

(function() {
  angular.module('ncsaas')
    .service('baseEventListController', [
      'baseControllerListClass', 'eventsService', 'EVENTTYPE', baseEventListController]);

  function baseEventListController(baseControllerListClass, eventsService, EVENTTYPE) {
    var ControllerListClass = baseControllerListClass.extend({
      EVENTTYPE: EVENTTYPE,

      init:function() {
        this.service = eventsService;
        this.searchFieldName = 'search';
        this.searchFilters = [
          {
            name: 'event_type',
            title: 'Logged in',
            value: EVENTTYPE.auth_logged_in_with_username
          },
          {
            name: 'event_type',
            title: 'Project creation',
            value: EVENTTYPE.project_creation_succeeded
          },
          {
            name: 'event_type',
            title: 'Organization creation',
            value: EVENTTYPE.customer_creation_succeeded
          }
        ];
        this._super();
      },
      isTemplateTypeReady: function(type) {
        var typesReady = [
          EVENTTYPE.auth_logged_in_with_username,
          EVENTTYPE.role_granted,
          EVENTTYPE.role_granted_structure_type_project,
          EVENTTYPE.role_granted_structure_type_customer,
          EVENTTYPE.user_update_succeeded,
          EVENTTYPE.project_creation_succeeded,
          EVENTTYPE.iaas_service_sync_failed,
          EVENTTYPE.iaas_instance_creation_scheduled,
          EVENTTYPE.customer_creation_succeeded,
          EVENTTYPE.project_group_creation_succeeded,
          EVENTTYPE.customer_update_succeeded,
          EVENTTYPE.user_activated,
          EVENTTYPE.user_deactivated,
          EVENTTYPE.user_password_updated
        ];
        return ~typesReady.indexOf(type);
      }
    });

    return ControllerListClass;
  }

  angular.module('ncsaas')
    .controller('EventListController', [
      '$scope',
      'baseEventListController',
      'currentStateService',
      'ENV',
      EventListController]);

  function EventListController(
    $scope,
    baseEventListController,
    currentStateService,
    ENV) {
    var controllerScope = this;
    var EventController = baseEventListController.extend({
      init:function() {
        this.controllerScope = controllerScope;
        this.cacheTime = ENV.dashboardEventsCacheTime;
        this._super();

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
      },

      onCustomerUpdate: function() {
        this.getList();
      },

      getList: function(filter) {
        var vm = this;
        var fn = this._super.bind(vm);
        filter = filter || {};
        currentStateService.getCustomer().then(function(customer){
          filter['scope'] = customer.url;
          vm.service.defaultFilter.scope = customer.url;
          fn(filter);
        })
      }
    });

    controllerScope.__proto__ = new EventController();
  }

  angular.module('ncsaas')
    .controller('CustomerAlertsListController', [
      '$scope',
      'baseControllerListClass',
      'currentStateService',
      'alertsService',
      'ENTITYLISTFIELDTYPES',
      CustomerAlertsListController]);

  function CustomerAlertsListController(
    $scope,
    baseControllerListClass,
    currentStateService,
    alertsService,
    ENTITYLISTFIELDTYPES) {
    var controllerScope = this;
    var controllerClass = baseControllerListClass.extend({
      init: function() {
        this.controllerScope = controllerScope;
        this.service = alertsService;
        this._super();

        this.entityOptions = {
          entityData: {
            noDataText: 'No alerts yet'
          },
          list: [
            {
              name: 'Message',
              propertyName: 'message',
              type: ENTITYLISTFIELDTYPES.noType
            }
          ]
        };

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
      },

      onCustomerUpdate: function() {
        this.getList();
      },

      getList: function(filter) {
        var vm = this;
        var fn = this._super.bind(vm);
        filter = filter || {};
        currentStateService.getCustomer().then(function(customer){
          filter['aggregate'] = 'customer';
          filter['uuid'] = customer.uuid;
          vm.service.defaultFilter.aggregate = 'customer';
          vm.service.defaultFilter.uuid = customer.uuid;
          fn(filter);
        })
      }
    });

    controllerScope.__proto__ = new controllerClass();
  }

  angular.module('ncsaas')
    .controller('DashboardIndexController', [
      '$scope',
      'baseEventListController',
      'projectsService',
      'alertsService',
      'eventsService',
      'eventStatisticsService',
      'resourcesCountService',
      'currentStateService',
      'ENV',
      DashboardIndexController]);

  function DashboardIndexController(
    $scope,
    baseEventListController,
    projectsService,
    alertsService,
    eventsService,
    eventStatisticsService,
    resourcesCountService,
    currentStateService,
    ENV) {
    var controllerScope = this;
    var EventController = baseEventListController.extend({
      init:function() {
        this.controllerScope = controllerScope;
        this.cacheTime = ENV.dashboardEventsCacheTime;
        this._super();
        this.activeTab = 'activity';
        this.costData = {
          labels: ["January", "February", "March", "April", "May", "June", "July"],
          datasets: [
            {
              label: "Events",
              fillColor: "rgba(123, 166, 196,0.5)",
              strokeColor: "rgba(123, 166, 196,1)",
              pointColor: "rgba(123, 166, 196,1)",
              pointStrokeColor: "#fff",
              pointHighlightFill: "#fff",
              pointHighlightStroke: "rgba(123, 166, 196,1)",
              data: [0, 59, 80, 81, 56, 55, 40]
            },
            {
              label: "Alerts",
              fillColor: "rgba(206, 230, 174,0.5)",
              strokeColor: "rgba(206, 230, 174,1)",
              pointColor: "rgba(206, 230, 174,1)",
              pointStrokeColor: "#fff",
              pointHighlightFill: "#fff",
              pointHighlightStroke: "rgba(206, 230, 174,1)",
              data: [0, 48, 40, 19, 86, 27, 90]
            }
          ]
        };

        this.chartOptions = {
          responsive: true,
          scaleShowVerticalLines: false,
          scaleShowGridLines: false,
          bezierCurve: false
        };

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
        this.onCustomerUpdate();
      },

      selectProject: function (project) {
        project.selected=!project.selected;
        this.getProjectResources(project);
        this.getProjectEvents(project);
      },

      onCustomerUpdate: function() {
        this.getCustomerProjects();
        this.getCustomerEvents();
        this.getCustomerAlerts();
      },

      getCustomerAlerts: function () {
        var vm = this;
        currentStateService.getCustomer().then(function(customer) {
          alertsService.getList({'aggregate': 'customer', 'uuid': customer.uuid}).then(function(response){
            vm.alerts = response;
          })
        })
      },

      getCustomerEvents: function () {
        var vm = this;
        currentStateService.getCustomer().then(function(customer) {
          eventsService.getList({'scope': customer.url}).then(function(response){
            vm.events = response;
          })
        })
      },

      getCustomerProjects: function() {
        var vm = this;
        projectsService.getList().then(function(response) {
          vm.projects = response;
          vm.selectProject(vm.projects[0]);
        });
      },

      getProjectResources: function (project) {
        if (project.count) {
          return;
        }
        project.count = {};
        project.count.services = project.services.length;
        resourcesCountService.users({'project': project.uuid}).then(function(count) {
          project.count.users = count;
        })
        resourcesCountService.resources({'project_uuid': project.uuid}).then(function(count) {
          project.count.resources = count;
        })
        resourcesCountService.alerts({'scope': project.url}).then(function(count) {
          project.count.alerts = count;
        })
      },

      getProjectEvents: function (project) {
        if (project.chartData) {
          return;
        }
        var end = moment.utc().unix();
        var count = 7;
        var start = moment.utc().subtract(count + 1, 'days').unix();
        eventStatisticsService.getList({
          'scope': project.url,
          'start': start,
          'end': end,
          'points_count': count + 1
        }).then(function(response) {
          var labels = [];
          var total = [];
          for (var i = 0; i < response.length; i++) {
            var date = moment.unix(response[i].point);
            var day = date.format('dddd');
            var value = response[i].object.count;
            labels.push(day);
            total.push(value);
          }

          var points = [];
          for (var i = 1; i < total.length; i++) {
            points[i] = total[i] - total[i-1];
          }
          labels.shift();
          points.shift();

          project.chartData = {
            labels: labels,
            datasets: [
              {
                label: "Events",
                fillColor: "rgba(220,220,220,0.2)",
                strokeColor: "rgba(220,220,220,1)",
                pointColor: "rgba(220,220,220,1)",
                pointStrokeColor: "#fff",
                pointHighlightFill: "#fff",
                pointHighlightStroke: "rgba(220,220,220,1)",
                data: points
              }
            ]
          };
        })
      }
    });

    controllerScope.__proto__ = new EventController();
  }
})();
<commit_msg>Fix indent (SAAS-501)<commit_after>'use strict';

(function() {
  angular.module('ncsaas')
    .service('baseEventListController', [
      'baseControllerListClass', 'eventsService', 'EVENTTYPE', baseEventListController]);

  function baseEventListController(baseControllerListClass, eventsService, EVENTTYPE) {
    var ControllerListClass = baseControllerListClass.extend({
      EVENTTYPE: EVENTTYPE,

      init:function() {
        this.service = eventsService;
        this.searchFieldName = 'search';
        this.searchFilters = [
          {
            name: 'event_type',
            title: 'Logged in',
            value: EVENTTYPE.auth_logged_in_with_username
          },
          {
            name: 'event_type',
            title: 'Project creation',
            value: EVENTTYPE.project_creation_succeeded
          },
          {
            name: 'event_type',
            title: 'Organization creation',
            value: EVENTTYPE.customer_creation_succeeded
          }
        ];
        this._super();
      },
      isTemplateTypeReady: function(type) {
        var typesReady = [
          EVENTTYPE.auth_logged_in_with_username,
          EVENTTYPE.role_granted,
          EVENTTYPE.role_granted_structure_type_project,
          EVENTTYPE.role_granted_structure_type_customer,
          EVENTTYPE.user_update_succeeded,
          EVENTTYPE.project_creation_succeeded,
          EVENTTYPE.iaas_service_sync_failed,
          EVENTTYPE.iaas_instance_creation_scheduled,
          EVENTTYPE.customer_creation_succeeded,
          EVENTTYPE.project_group_creation_succeeded,
          EVENTTYPE.customer_update_succeeded,
          EVENTTYPE.user_activated,
          EVENTTYPE.user_deactivated,
          EVENTTYPE.user_password_updated
        ];
        return ~typesReady.indexOf(type);
      }
    });

    return ControllerListClass;
  }

  angular.module('ncsaas')
    .controller('EventListController', [
      '$scope',
      'baseEventListController',
      'currentStateService',
      'ENV',
      EventListController]);

  function EventListController(
    $scope,
    baseEventListController,
    currentStateService,
    ENV) {
    var controllerScope = this;
    var EventController = baseEventListController.extend({
      init:function() {
        this.controllerScope = controllerScope;
        this.cacheTime = ENV.dashboardEventsCacheTime;
        this._super();

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
      },

      onCustomerUpdate: function() {
        this.getList();
      },

      getList: function(filter) {
        var vm = this;
        var fn = this._super.bind(vm);
        filter = filter || {};
        currentStateService.getCustomer().then(function(customer) {
          filter['scope'] = customer.url;
          vm.service.defaultFilter.scope = customer.url;
          fn(filter);
        })
      }
    });

    controllerScope.__proto__ = new EventController();
  }

  angular.module('ncsaas')
    .controller('CustomerAlertsListController', [
      '$scope',
      'baseControllerListClass',
      'currentStateService',
      'alertsService',
      'ENTITYLISTFIELDTYPES',
      CustomerAlertsListController]);

  function CustomerAlertsListController(
    $scope,
    baseControllerListClass,
    currentStateService,
    alertsService,
    ENTITYLISTFIELDTYPES) {
    var controllerScope = this;
    var controllerClass = baseControllerListClass.extend({
      init: function() {
        this.controllerScope = controllerScope;
        this.service = alertsService;
        this._super();

        this.entityOptions = {
          entityData: {
            noDataText: 'No alerts yet'
          },
          list: [
            {
              name: 'Message',
              propertyName: 'message',
              type: ENTITYLISTFIELDTYPES.noType
            }
          ]
        };

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
      },

      onCustomerUpdate: function() {
        this.getList();
      },

      getList: function(filter) {
        var vm = this;
        var fn = this._super.bind(vm);
        filter = filter || {};
        currentStateService.getCustomer().then(function(customer) {
          vm.service.defaultFilter.aggregate = 'customer';
          vm.service.defaultFilter.uuid = customer.uuid;
          fn(filter);
        })
      }
    });

    controllerScope.__proto__ = new controllerClass();
  }

  angular.module('ncsaas')
    .controller('DashboardIndexController', [
      '$scope',
      'baseEventListController',
      'projectsService',
      'alertsService',
      'eventsService',
      'eventStatisticsService',
      'resourcesCountService',
      'currentStateService',
      'ENV',
      DashboardIndexController]);

  function DashboardIndexController(
    $scope,
    baseEventListController,
    projectsService,
    alertsService,
    eventsService,
    eventStatisticsService,
    resourcesCountService,
    currentStateService,
    ENV) {
    var controllerScope = this;
    var EventController = baseEventListController.extend({
      init:function() {
        this.controllerScope = controllerScope;
        this.cacheTime = ENV.dashboardEventsCacheTime;
        this._super();
        this.activeTab = 'activity';
        this.costData = {
          labels: ["January", "February", "March", "April", "May", "June", "July"],
          datasets: [
            {
              label: "Events",
              fillColor: "rgba(123, 166, 196,0.5)",
              strokeColor: "rgba(123, 166, 196,1)",
              pointColor: "rgba(123, 166, 196,1)",
              pointStrokeColor: "#fff",
              pointHighlightFill: "#fff",
              pointHighlightStroke: "rgba(123, 166, 196,1)",
              data: [0, 59, 80, 81, 56, 55, 40]
            },
            {
              label: "Alerts",
              fillColor: "rgba(206, 230, 174,0.5)",
              strokeColor: "rgba(206, 230, 174,1)",
              pointColor: "rgba(206, 230, 174,1)",
              pointStrokeColor: "#fff",
              pointHighlightFill: "#fff",
              pointHighlightStroke: "rgba(206, 230, 174,1)",
              data: [0, 48, 40, 19, 86, 27, 90]
            }
          ]
        };

        this.chartOptions = {
          responsive: true,
          scaleShowVerticalLines: false,
          scaleShowGridLines: false,
          bezierCurve: false
        };

        $scope.$on('currentCustomerUpdated', this.onCustomerUpdate.bind(this));
        this.onCustomerUpdate();
      },
      selectProject: function (project) {
        project.selected=!project.selected;
        this.getProjectResources(project);
        this.getProjectEvents(project);
      },
      onCustomerUpdate: function() {
        this.getCustomerProjects();
        this.getCustomerEvents();
        this.getCustomerAlerts();
      },
      getCustomerAlerts: function () {
        var vm = this;
        currentStateService.getCustomer().then(function(customer) {
          alertsService.getList({'aggregate': 'customer', 'uuid': customer.uuid}).then(function(response) {
            vm.alerts = response;
          })
        })
      },
      getCustomerEvents: function () {
        var vm = this;
        currentStateService.getCustomer().then(function(customer) {
          eventsService.getList({'scope': customer.url}).then(function(response) {
            vm.events = response;
          })
        })
      },
      getCustomerProjects: function() {
        var vm = this;
        projectsService.getList().then(function(response) {
          vm.projects = response;
          vm.selectProject(vm.projects[0]);
        });
      },
      getProjectResources: function (project) {
        if (project.count) {
          return;
        }
        project.count = {};
        project.count.services = project.services.length;
        resourcesCountService.users({'project': project.uuid}).then(function(count) {
          project.count.users = count;
        })
        resourcesCountService.resources({'project_uuid': project.uuid}).then(function(count) {
          project.count.resources = count;
        })
        resourcesCountService.alerts({'scope': project.url}).then(function(count) {
          project.count.alerts = count;
        })
      },
      getProjectEvents: function (project) {
        if (project.chartData) {
          return;
        }
        var end = moment.utc().unix();
        var count = 7;
        var start = moment.utc().subtract(count + 1, 'days').unix();
        eventStatisticsService.getList({
          'scope': project.url,
          'start': start,
          'end': end,
          'points_count': count + 1
        }).then(function(response) {
          var labels = [];
          var total = [];
          for (var i = 0; i < response.length; i++) {
            var date = moment.unix(response[i].point);
            var day = date.format('dddd');
            var value = response[i].object.count;
            labels.push(day);
            total.push(value);
          }

          var points = [];
          for (var i = 1; i < total.length; i++) {
            points[i] = total[i] - total[i-1];
          }
          labels.shift();
          points.shift();

          project.chartData = {
            labels: labels,
            datasets: [
              {
                label: "Events",
                fillColor: "rgba(220,220,220,0.2)",
                strokeColor: "rgba(220,220,220,1)",
                pointColor: "rgba(220,220,220,1)",
                pointStrokeColor: "#fff",
                pointHighlightFill: "#fff",
                pointHighlightStroke: "rgba(220,220,220,1)",
                data: points
              }
            ]
          };
        })
      }
    });

    controllerScope.__proto__ = new EventController();
  }
})();
<|endoftext|>


<commit_before>import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import ProjectsImage from "../components/images/frontendImage"
import SEO from "../components/seo"
import Codepen from "react-codepen-embed";

const FrontEndPage = () => (
  <Layout>

Projects

<Link to="/projects">Javascript</Link>

<Link to="/frontend">CSS</Link>

          <ProjectsImage />

CSS Projects

    {/* Waves */}

        <Codepen
              hash="GVOWPQ"
              user="mpakleung"
              defaultTab="result"
              loader={() =>
Loading...
}
            />

    {/* GOOEY */}

      <Codepen
            hash="voRYwP"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

    {/* Bokeh */}

          <Codepen
                hash="RXYvrE"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Tree */}

          <Codepen
                hash="JgYzeG"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Moon/Sun */}

          <Codepen
                hash="WVEvVE"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Mario */}

          <Codepen
                hash="wVmWRv"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Ruby Gem */}

          <Codepen
                hash="YooZdQ"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

     {/* Rocket */}

          <Codepen
                hash="rbOxXy"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Word Carousel 73 */}

          <Codepen
                hash="mZxOQe"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Keyboard 71 */}

          <Codepen
                hash="WqMQJP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Gradient 61 */}

          <Codepen
                hash="WqopWx"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

     {/* Pig */}

          <Codepen
                hash="QeyJvO"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Canada */}

          <Codepen
                hash="eqYoYW"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Nasa */}

          <Codepen
                hash="eqmajb"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Dodo */}

          <Codepen
                hash="zgGpaP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* TRex */}

          <Codepen
                hash="ZgWgNY"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

               {/* Candle */}

          <Codepen
                hash="RzXjgO"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* React */}

          <Codepen
                hash="vqmeYR"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

       {/* Stars */}

          <Codepen
                hash="QRJpEP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Hello */}

      <Codepen
            hash="arqjYP"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

        {/* Checklist #27 */}

      <Codepen
            hash="pmPzEq"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

         {/* Button 24 */}

          <Codepen
                hash="QRKwmR"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

          {/* Pacman 21 */}

      <Codepen
            hash="vwGErv"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

            {/* Upload 15 */}

          <Codepen
                hash="oRvdLj"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Bike 14 */}

          <Codepen
                hash="YbKymq"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Dogs #13  */}

          <Codepen
                hash="eqPRdK"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Panda */}

          <Codepen
                hash="ZZRmdz"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* 100 Days 6 */}

          <Codepen
                hash="ZgXjOr"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* 100 Days 1 */}

          <Codepen
                hash="PMpYbp"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

  <SEO title="Projects" />
  </Layout>
)
export default FrontEndPage
<commit_msg>Update portfolio<commit_after>import React from "react"
import { Link } from "gatsby"
import Layout from "../components/layout"
import ProjectsImage from "../components/images/frontendImage"
import SEO from "../components/seo"
import Codepen from "react-codepen-embed";

const FrontEndPage = () => (
  <Layout>

Projects

<Link to="/projects">Javascript</Link>

<Link to="/frontend">CSS</Link>

          <ProjectsImage />

CSS Projects

    {/* Waves */}

        <Codepen
              hash="GVOWPQ"
              user="mpakleung"
              defaultTab="result"
              loader={() =>
Loading...
}
            />

    {/* GOOEY */}

      <Codepen
            hash="voRYwP"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

    {/* Bokeh */}

          <Codepen
                hash="RXYvrE"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Tree */}

          <Codepen
                hash="JgYzeG"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Moon/Sun */}

          <Codepen
                hash="WVEvVE"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Mario */}

          <Codepen
                hash="wVmWRv"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Ruby Gem */}

          <Codepen
                hash="YooZdQ"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

     {/* Rocket */}

          <Codepen
                hash="rbOxXy"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Word Carousel 73 */}

          <Codepen
                hash="mZxOQe"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Keyboard 71 */}

          <Codepen
                hash="WqMQJP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

             {/* Gradient 61 */}

          <Codepen
                hash="WqopWx"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

     {/* Pig */}

          <Codepen
                hash="QeyJvO"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Canada */}

          <Codepen
                hash="eqYoYW"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Nasa */}

          <Codepen
                hash="eqmajb"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Dodo */}

          <Codepen
                hash="zgGpaP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* TRex */}

          <Codepen
                hash="ZgWgNY"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

               {/* Candle */}

          <Codepen
                hash="RzXjgO"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* React */}

          <Codepen
                hash="vqmeYR"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

       {/* Stars */}

          <Codepen
                hash="QRJpEP"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

    {/* Hello */}

      <Codepen
            hash="arqjYP"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

        {/* Checklist #27 */}

      <Codepen
            hash="pmPzEq"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

         {/* Button 24 */}

          <Codepen
                hash="QRKwmR"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

          {/* Pacman 21 */}

      <Codepen
            hash="vwGErv"
            user="mpakleung"
            defaultTab="result"
            loader={() =>
Loading...
}
          />

            {/* Upload 15 */}

          <Codepen
                hash="oRvdLj"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Bike 14 */}

          <Codepen
                hash="YbKymq"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Dogs #13  */}

          <Codepen
                hash="eqPRdK"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

      {/* Toggle Night and Day  */}

          <Codepen
                hash="ymRowy"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* Panda */}

          <Codepen
                hash="ZZRmdz"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* 100 Days 6 */}

          <Codepen
                hash="ZgXjOr"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

        {/* 100 Days 1 */}

          <Codepen
                hash="PMpYbp"
                user="mpakleung"
                defaultTab="result"
                loader={() =>
Loading...
}
              />

  <SEO title="Projects" />
  </Layout>
)
export default FrontEndPage
<|endoftext|>