<commit_before>/*jshint -W072 */
angular.module('DeviceWall')
  .controller('ClientController',
  function($rootScope, $scope, $location, $timeout, socketConnect, $window, appConfig, Util, $log) {
    var screensaverTimeoutPromise;
    var screensaverTimeoutSeconds = appConfig.client.screenSaverTimeoutSeconds || 60;
    var socket = socketConnect.connect('/devicewallapp');
    // Scope variables
    $scope.statusMessage = "Initializing connection";
    $scope.label = $window.localStorage.getItem('label') || '';
    $scope.oldLabel = $scope.label;
    $scope.model = '';
    $scope.platform = '';
    $scope.appPlatform = 'browser';
    $scope.version = '';
    $scope.online = '';
    $scope.batteryStatus = {level: '', isPlugged: ''};
    $scope.view = {
      label: $scope.label === '',
      connection: $scope.label !== '',
      screensaver: false,
      screensaverClass: "center"
    };

    $scope.showSettings = function() {
      $scope.view.label = true;
      $scope.view.connection = false;
    };

    $scope.showControlPanel = function() {
      $location.path('/devices');
    };

    $scope.showTutorial = function() {
      $location.path('/tutorial');
    };

    socket.on('connect', function() {
      $scope.statusMessage = "Ready for testing";
    });

    socket.on('disconnect', function() {
      $scope.statusMessage = "Not connected";
    });

    socket.on('start', function(data) {
      var id = socket.io().engine.id;
      socket.emit('started', { label: $scope.label, socketId: id });
      if (data.labels.indexOf($window.localStorage.getItem('label')) !== -1) {
        var url = Util.addSearchParamaterToURL(data.url, 'devicewall=' + id);
        $window.location.href = url;
      }
    });

    socket.on('stop', function(data) {
      $log.debug('stop: ', data);
    });


    $scope.updateLabel = function() {
      if ($scope.label) {
        $window.localStorage.setItem('label', $scope.label);

        $scope.view.label = false;
        $scope.view.connection = true;

        if ($scope.oldLabel !== '' && $scope.oldLabel !== $scope.label) {
          socket.emit('rename', {oldLabel: $scope.oldLabel, newLabel: $scope.label});
          $scope.oldLabel = $scope.label;
        } else {
          socket.emit('update', {label: $scope.label});
        }
      }
    };

    $scope.$on('$destroy', function() {
      socket.removeAllListeners();
    });
  });<commit_msg>device list update code was removed, added it back<commit_after>/*jshint -W072 */
angular.module('DeviceWall')
  .controller('ClientController',
  function($rootScope, $scope, $location, $timeout, socketConnect, $window, appConfig, Util, $log) {
    var screensaverTimeoutPromise;
    var screensaverTimeoutSeconds = appConfig.client.screenSaverTimeoutSeconds || 60;
    var socket = socketConnect.connect('/devicewallapp');
    // Scope variables
    $scope.statusMessage = "Initializing connection";
    $scope.label = $window.localStorage.getItem('label') || '';
    $scope.oldLabel = $scope.label;
    $scope.model = '';
    $scope.platform = '';
    $scope.appPlatform = 'browser';
    $scope.version = '';
    $scope.online = '';
    $scope.batteryStatus = {level: '', isPlugged: ''};
    $scope.view = {
      label: $scope.label === '',
      connection: $scope.label !== '',
      screensaver: false,
      screensaverClass: "center"
    };

    $scope.showSettings = function() {
      $scope.view.label = true;
      $scope.view.connection = false;
    };

    $scope.showControlPanel = function() {
      $location.path('/devices');
    };

    $scope.showTutorial = function() {
      $location.path('/tutorial');
    };

    socket.on('connect', function() {
      $scope.statusMessage = "Ready for testing";
    });

    socket.on('disconnect', function() {
      $scope.statusMessage = "Not connected";
    });

    socket.on('start', function(data) {
      var id = socket.io().engine.id;
      socket.emit('started', { label: $scope.label, socketId: id });
      if (data.labels.indexOf($window.localStorage.getItem('label')) !== -1) {
        var url = Util.addSearchParamaterToURL(data.url, 'devicewall=' + id);
        $window.location.href = url;
      }
    });

    socket.on('stop', function(data) {
      $log.debug('stop: ', data);
    });


    $scope.updateLabel = function() {
      if ($scope.label) {
        $window.localStorage.setItem('label', $scope.label);

        $scope.view.label = false;
        $scope.view.connection = true;

        if ($scope.oldLabel !== '' && $scope.oldLabel !== $scope.label) {
          socket.emit('rename', {oldLabel: $scope.oldLabel, newLabel: $scope.label});
          $scope.oldLabel = $scope.label;
        } else {
          socket.emit('update', {label: $scope.label});
        }
      }
    };

    if ($scope.label) {
      socket.emit('update', {label: $scope.label});
    }
    
    $scope.$on('$destroy', function() {
      socket.removeAllListeners();
    });
  });
{'fraction_non_alphanumeric': 0.1785426731078905, 'fraction_numerical': 0.0024154589371980675, 'mean_word_length': 2.8047473200612556, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2876379', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1501, 'n_words': 261}