<commit_before>angular
.module('impac.components.dashboard-selector', [])
.directive('dashboardSelector', ($log, $compile, $templateCache, $http, $timeout, $uibModal, ImpacTheming, ImpacDashboardsSvc, ImpacMainSvc, ImpacUtilities) ->
  return {
    restrict: 'E'
    scope: {
      onCreateDashboard: '&'
      isWidgetSelectorShown: '&'
      onDisplayWidgetSelector: '&'
      onSelectDashboard: '&'
      pdfMode: '='
    }
    controller: ($scope) ->

      # ============================================
      # Select dashboards
      # ============================================

      $scope.organizationsNames = ->
        sortedOrgNames = _.sortBy($scope.currentDhb.data_sources, (org) -> org.label.toLowerCase())
         _.pluck(sortedOrgNames, 'label').join(", ")

      $scope.toggleShowDashboardsDropdown = ->
        return if $scope.showChangeDashboardNameBox

        if (ImpacDashboardsSvc.areThereSeveralDashboards() || $scope.showCreateDashboardButton)
          $scope.showDashboardsDropdown = !$scope.showDashboardsDropdown
        else
          $scope.showDashboardsDropdown = false

      # Use of timeouts for better fluidity (avoid freezing the display)
      $scope.selectDashboard = (dhbId) ->
        return if $scope.currentDhb.id == dhbId
        $scope.isLoading = true
        $scope.showDashboardsDropdown = false

        # make sure the dropdown disappears
        $timeout ->
          $scope.$apply ->
            ImpacDashboardsSvc.setCurrentDashboard(dhbId)
            $scope.onSelectDashboard()
            $scope.isLoading = false
        , 50


      # ============================================
      # Change dashboard name<commit_msg>Fix indendation bug<commit_after>angular
.module('impac.components.dashboard-selector', [])
.directive('dashboardSelector', ($log, $compile, $templateCache, $http, $timeout, $uibModal, ImpacTheming, ImpacDashboardsSvc, ImpacMainSvc, ImpacUtilities) ->
  return {
    restrict: 'E'
    scope: {
      onCreateDashboard: '&'
      isWidgetSelectorShown: '&'
      onDisplayWidgetSelector: '&'
      onSelectDashboard: '&'
      pdfMode: '='
    }
    controller: ($scope) ->

      # ============================================
      # Select dashboards
      # ============================================

      $scope.organizationsNames = ->
        sortedOrgNames = _.sortBy($scope.currentDhb.data_sources, (org) -> org.label.toLowerCase())
        _.pluck(sortedOrgNames, 'label').join(", ")

      $scope.toggleShowDashboardsDropdown = ->
        return if $scope.showChangeDashboardNameBox

        if (ImpacDashboardsSvc.areThereSeveralDashboards() || $scope.showCreateDashboardButton)
          $scope.showDashboardsDropdown = !$scope.showDashboardsDropdown
        else
          $scope.showDashboardsDropdown = false

      # Use of timeouts for better fluidity (avoid freezing the display)
      $scope.selectDashboard = (dhbId) ->
        return if $scope.currentDhb.id == dhbId
        $scope.isLoading = true
        $scope.showDashboardsDropdown = false

        # make sure the dropdown disappears
        $timeout ->
          $scope.$apply ->
            ImpacDashboardsSvc.setCurrentDashboard(dhbId)
            $scope.onSelectDashboard()
            $scope.isLoading = false
        , 50


      # ============================================
      # Change dashboard name
{'fraction_non_alphanumeric': 0.18171056525599288, 'fraction_numerical': 0.0011837821840781297, 'mean_word_length': 3.004739336492891, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '5937307', 'n_tokens_mistral': 991, 'n_tokens_neox': 964, 'n_words': 161}