<commit_before>'use strict';

(function() {
  angular.module('ncsaas')
    .directive('actionListResource', ['actionUtilsService', actionListResource]);

  function actionListResource(actionUtilsService) {
    return {
      restrict: 'E',
      templateUrl: 'views/directives/action-list-resource.html',
      replace: true,
      scope: {
        entity: '=',
        controller: '='
      },
      link: function(scope) {
        function loadActions() {
          scope.loading = true;
          actionUtilsService.loadActions(scope.entity).then(function(actions) {
            if (actions) {
              scope.actions = actions;
            }
          }).finally(function() {
            scope.loading = false;
          });
        }
        scope.buttonClick = function(name, action) {
          action.pending = true;
          var promise = actionUtilsService.buttonClick(scope.controller, scope.entity, name, action);
          promise.finally(function() {
            action.pending = false;
            loadActions();
          });
        }
        scope.loading = false;
        loadActions();
        scope.$watch('entity', function(newEntity, oldEntity) {
          if (newEntity.state != oldEntity.state) {
            loadActions();
          }
        });
      }
    };
  }
})();<commit_msg>Use strict condition in action list watcher (SAAS-1361)<commit_after>'use strict';

(function() {
  angular.module('ncsaas')
    .directive('actionListResource', ['actionUtilsService', actionListResource]);

  function actionListResource(actionUtilsService) {
    return {
      restrict: 'E',
      templateUrl: 'views/directives/action-list-resource.html',
      replace: true,
      scope: {
        entity: '=',
        controller: '='
      },
      link: function(scope) {
        function loadActions() {
          scope.loading = true;
          actionUtilsService.loadActions(scope.entity).then(function(actions) {
            if (actions) {
              scope.actions = actions;
            }
          }).finally(function() {
            scope.loading = false;
          });
        }
        scope.buttonClick = function(name, action) {
          action.pending = true;
          var promise = actionUtilsService.buttonClick(scope.controller, scope.entity, name, action);
          promise.finally(function() {
            action.pending = false;
            loadActions();
          });
        }
        scope.loading = false;
        loadActions();
        scope.$watch('entity', function(newEntity, oldEntity) {
          if (newEntity.state !== oldEntity.state) {
            loadActions();
          }
        });
      }
    };
  }
})();
{'fraction_non_alphanumeric': 0.13028828154249344, 'fraction_numerical': 0.001497566454511419, 'mean_word_length': 1.9655937846836848, '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': '2758319', 'n_tokens_mistral': 707, 'n_tokens_neox': 705, 'n_words': 123}