<commit_before>'use strict';

angular.module('app').controller('listConnectionsCtrl', [
  '$scope',
  '$timeout',
  '$log',
  'connectionCache',
  'notificationService',
  function($scope, $timeout, $log, connectionCache, notificationService) {
    const connectionModule = require('lib/modules/connection');

    $scope.connections = [];

    $scope.loading = false;

    $scope.$parent.selectedConnection = null; //reset the parent's selected connection

    _listConnections();

    $scope.selectAndConnect = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      _.each($scope.connections, (conn) => {
        conn.selected = false;
      });

      connection.selected = true;

      $scope.connect();
    };

    $scope.selectConnection = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      if (connection.selected) {
        connection.selected = false;
        return;
      }

      _.each($scope.connections, function(conn) {
        conn.selected = false;
      });

      connection.selected = true;
    };

    $scope.copyConnection = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      let newConnection = _.clone(connection);
      delete newConnection.id;

      $scope.changePage('add', newConnection);
    };

    $scope.connectionSelected = function() {
      return _.any($scope.connections, (conn) => {
        return conn.selected;
      });
    };

    $scope.connect = function($event) {
      if ($event) $event.preventDefault();<commit_msg>add ‘copy’ to new connection name when cloning<commit_after>'use strict';

angular.module('app').controller('listConnectionsCtrl', [
  '$scope',
  '$timeout',
  '$log',
  'connectionCache',
  'notificationService',
  function($scope, $timeout, $log, connectionCache, notificationService) {
    const connectionModule = require('lib/modules/connection');

    $scope.connections = [];

    $scope.loading = false;

    $scope.$parent.selectedConnection = null; //reset the parent's selected connection

    _listConnections();

    $scope.selectAndConnect = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      _.each($scope.connections, (conn) => {
        conn.selected = false;
      });

      connection.selected = true;

      $scope.connect();
    };

    $scope.selectConnection = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      if (connection.selected) {
        connection.selected = false;
        return;
      }

      _.each($scope.connections, function(conn) {
        conn.selected = false;
      });

      connection.selected = true;
    };

    $scope.copyConnection = function(connection, $event) {
      if (!connection) return false;
      if ($event) $event.preventDefault();

      let newConnection = _.clone(connection);
      delete newConnection.id;
      newConnection.name += ' copy';

      $scope.changePage('add', newConnection);
    };

    $scope.connectionSelected = function() {
      return _.any($scope.connections, (conn) => {
        return conn.selected;
      });
    };

    $scope.connect = function($event) {
      if ($event) $event.preventDefault();
{'fraction_non_alphanumeric': 0.14622641509433962, 'fraction_numerical': 0.0, 'mean_word_length': 2.968421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '532224', 'n_tokens_mistral': 943, 'n_tokens_neox': 905, 'n_words': 196}