<commit_before>import Backbone from 'backbone';
import d3 from 'd3';
import is from 'is_js';

import Router from './Router';
import User from './models/User';
import Project from './models/Project';

import Header from './views/layout/Header';
import WidgetPanels from './views/layout/WidgetPanels';
import Overlay from './views/layout/Overlay';
import HelpLayer from './views/layout/HelpLayer';
import NotificationLayer from './views/layout/NotificationLayer';

// Page-wide Styles
import colorScheme from '!!sass-variable-loader!./stylesheets/colors.scss';
import svgFilters from './stylesheets/svgFilters.html';
import './stylesheets/pure-css-custom-form-elements/style.css';
import './stylesheets/mainPage.scss';
import './stylesheets/girderPatches.scss';

// The API root is different
let girder = window.girder;
girder.apiRoot = 'api/v1';

// Our main view that coordinates each big chunk
let MainPage = Backbone.View.extend({
  initialize: function () {
    // Get the current app version
    this.versionNumber = this.girderRequest({
      path: 'system/resonantLabVersion',
      type: 'GET'
    });

    // Set up navigation
    this.router = new Router();

    // Initial empty state (assume no logged in user)
    this.currentUser = new User();
    // Attempt to log in (async result)
    this.currentUser.authenticate(true, this);

    this.listenTo(this.currentUser, 'rlab:logout', () => {
      this.switchProject(null).then(() => {
        this.overlay.render('StartingScreen');
      });
    });

    // Start with no datasets and no project
    this.loadedDatasets = {};
    this.project = null;

    // Respond to resize events
    window.onresize = () => {
      this.render();
      this.trigger('rl:resizeWindow');
    };
  },
  render: function () {
    /*
      Because each of the big chunks of the page
      refer directly to window.mainPage, we don't
      actually add them until we call render()
    */
    if (!this.addedPageChunks) {
      this.generateFilters();
      this.header = new Header({
        el: '#Header'
      });
      this.widgetPanels = new WidgetPanels({
        el: '#WidgetPanels'
      });
      this.overlay = new Overlay({
        el: '#Overlay'
      });
      this.helpLayer = new HelpLayer({
        el: '#HelpLayer'
      });
      this.notificationLayer = new NotificationLayer({
        el: '#NotificationLayer'
      });
      this.router.addListeners();
      this.currentUser.addListeners();
      this.header.addListeners();
      this.addedPageChunks = true;
    }

    this.header.render();
    this.widgetPanels.render();
    this.overlay.render();
    this.helpLayer.render();
    this.notificationLayer.render();

    if (!is.chrome()) {
      this.notificationLayer.displayNotification(
        'Warning: This application works best in Chrome. ' +
        'Functionality may be limited in this browser.');
    }
  },
  generateFilters: function () {<commit_msg>chore(resonantlab): Move code onto single line<commit_after>import Backbone from 'backbone';
import d3 from 'd3';
import is from 'is_js';

import Router from './Router';
import User from './models/User';
import Project from './models/Project';

import Header from './views/layout/Header';
import WidgetPanels from './views/layout/WidgetPanels';
import Overlay from './views/layout/Overlay';
import HelpLayer from './views/layout/HelpLayer';
import NotificationLayer from './views/layout/NotificationLayer';

// Page-wide Styles
import colorScheme from '!!sass-variable-loader!./stylesheets/colors.scss';
import svgFilters from './stylesheets/svgFilters.html';
import './stylesheets/pure-css-custom-form-elements/style.css';
import './stylesheets/mainPage.scss';
import './stylesheets/girderPatches.scss';

// The API root is different
let girder = window.girder;
girder.apiRoot = 'api/v1';

// Our main view that coordinates each big chunk
let MainPage = Backbone.View.extend({
  initialize: function () {
    // Get the current app version
    this.versionNumber = this.girderRequest({
      path: 'system/resonantLabVersion',
      type: 'GET'
    });

    // Set up navigation
    this.router = new Router();

    // Initial empty state (assume no logged in user)
    this.currentUser = new User();
    // Attempt to log in (async result)
    this.currentUser.authenticate(true, this);

    this.listenTo(this.currentUser, 'rlab:logout', () => {
      this.switchProject(null).then(() => {
        this.overlay.render('StartingScreen');
      });
    });

    // Start with no datasets and no project
    this.loadedDatasets = {};
    this.project = null;

    // Respond to resize events
    window.onresize = () => {
      this.render();
      this.trigger('rl:resizeWindow');
    };
  },
  render: function () {
    /*
      Because each of the big chunks of the page
      refer directly to window.mainPage, we don't
      actually add them until we call render()
    */
    if (!this.addedPageChunks) {
      this.generateFilters();
      this.header = new Header({
        el: '#Header'
      });
      this.widgetPanels = new WidgetPanels({
        el: '#WidgetPanels'
      });
      this.overlay = new Overlay({
        el: '#Overlay'
      });
      this.helpLayer = new HelpLayer({
        el: '#HelpLayer'
      });
      this.notificationLayer = new NotificationLayer({
        el: '#NotificationLayer'
      });
      this.router.addListeners();
      this.currentUser.addListeners();
      this.header.addListeners();
      this.addedPageChunks = true;
    }

    this.header.render();
    this.widgetPanels.render();
    this.overlay.render();
    this.helpLayer.render();
    this.notificationLayer.render();

    if (!is.chrome()) {
      this.notificationLayer.displayNotification('Warning: This application works best in Chrome. Functionality may be limited in this browser.');
    }
  },
  generateFilters: function () {
{'fraction_non_alphanumeric': 0.13476263399693722, 'fraction_numerical': 0.0010209290454313426, 'mean_word_length': 2.926519706078824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7028889', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1689, 'n_words': 446}