<commit_before>// jscs:disable

app.controller('ViewHubCtrl', ViewHubCtrl);
ViewHubCtrl.$inject = ['$scope', '$state', '$stateParams', '$timeout', '$q', '$controller', '$interval', 'hub', 'printer', 'sensor'];

function ViewHubCtrl($scope, $state, $stateParams, $timeout, $q, $controller, $interval, hub, printer, sensor) {
  var hubId = Number($stateParams.hubId);

  var hubPromise = hub.getHub(hubId);
  var printersPromise = hub.getPrinters(hubId);

  $scope.sensors = {};
  $scope.updateSensorModal = {};
  $scope.updateSensorModal.form = {};
  $scope.updateSensorModal.attributes = {};
  $scope.updateSensorModalVisible = false;
  $scope.addSensorModal = {};
  $scope.addSensorModal.form = {};
  $scope.addSensorModal.attributes = {};
  $scope.addSensorModalVisible = false;
  $scope.showDeleteModal = false; // Set to true to show the delete confirmation modal
  $scope.printersCurrentPage = 1;
  $scope.printersItemsPerPage = 2;

  $controller('AlertCtrl', { $scope: $scope });
  $controller('AlertCtrl', { $scope: $scope.updateSensorModal});
  $controller('AlertCtrl', { $scope: $scope.addSensorModal});

  /*********************************************************
   *
   * FUNCTIONS
   *
   * /

  /**
   * Modal visibility toggling
   */
  $scope.showSensorModal = function() {
    $scope.updateSensorModalVisible = true;
  };

  $scope.hideSensorModal = function() {
    $scope.updateSensorModalVisible = false;
    $scope.updateSensorModal.alerts = [];
  };

  $scope.showAddSensorModal = function() {
    $scope.addSensorModalVisible = true;
    $scope.addSensorModal.alerts = [];
    $scope.addSensorModal.addAlert('warning', 'All fields are required unless otherwise stated.');
  };

  $scope.hideAddSensorModal = function() {
    $scope.addSensorModalVisible = false;
    $scope.addSensorModal.alerts = [];
  };

  /**
   * Add a sensor
   */
  $scope.addSensor = function(attributes) {
    // Check whether form has not been filled out
    if ($scope.addSensorModal.form.$pristine) {
      $scope.addSensorModal.addAlert('warning', 'Please fill out the form below before submitting.');
      return;
    }

    // Check whether any validation errors are present on the form
    if (!$scope.addSensorModal.form.$valid) {
      $scope.addSensorModal.addAlert('danger', 'Please correct the errors below and try submitting the form again.');
      return;
    }<commit_msg>Add node_id to sensor model<commit_after>// jscs:disable

app.controller('ViewHubCtrl', ViewHubCtrl);
ViewHubCtrl.$inject = ['$scope', '$state', '$stateParams', '$timeout', '$q', '$controller', '$interval', 'hub', 'printer', 'sensor'];

function ViewHubCtrl($scope, $state, $stateParams, $timeout, $q, $controller, $interval, hub, printer, sensor) {
  var hubId = Number($stateParams.hubId);

  var hubPromise = hub.getHub(hubId);
  var printersPromise = hub.getPrinters(hubId);

  $scope.sensors = {};
  $scope.updateSensorModal = {};
  $scope.updateSensorModal.form = {};
  $scope.updateSensorModal.attributes = {};
  $scope.updateSensorModalVisible = false;
  $scope.addSensorModal = {};
  $scope.addSensorModal.form = {};
  $scope.addSensorModal.attributes = {};
  $scope.addSensorModalVisible = false;
  $scope.showDeleteModal = false; // Set to true to show the delete confirmation modal
  $scope.printersCurrentPage = 1;
  $scope.printersItemsPerPage = 2;

  $controller('AlertCtrl', { $scope: $scope });
  $controller('AlertCtrl', { $scope: $scope.updateSensorModal});
  $controller('AlertCtrl', { $scope: $scope.addSensorModal});

  /*********************************************************
   *
   * FUNCTIONS
   *
   * /

  /**
   * Modal visibility toggling
   */
  $scope.showSensorModal = function() {
    $scope.updateSensorModalVisible = true;
  };

  $scope.hideSensorModal = function() {
    $scope.updateSensorModalVisible = false;
    $scope.updateSensorModal.alerts = [];
  };

  $scope.showAddSensorModal = function() {
    $scope.addSensorModalVisible = true;
    $scope.addSensorModal.alerts = [];
    $scope.addSensorModal.addAlert('warning', 'All fields are required unless otherwise stated.');
  };

  $scope.hideAddSensorModal = function() {
    $scope.addSensorModalVisible = false;
    $scope.addSensorModal.alerts = [];
    $scope.addSensorModal.attributes = {};
  };

  /**
   * Add a sensor
   */
  $scope.addSensor = function(attributes) {
    // Check whether form has not been filled out
    if ($scope.addSensorModal.form.$pristine) {
      $scope.addSensorModal.addAlert('warning', 'Please fill out the form below before submitting.');
      return;
    }

    // Check whether any validation errors are present on the form
    if (!$scope.addSensorModal.form.$valid) {
      $scope.addSensorModal.addAlert('danger', 'Please correct the errors below and try submitting the form again.');
      return;
    }
{'fraction_non_alphanumeric': 0.16980351602895552, 'fraction_numerical': 0.000827300930713547, 'mean_word_length': 4.13375796178344, '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': '923528', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1476, 'n_words': 307}