<commit_before>ManageIQ.angular.app.controller('retirementFormController', ['$http', '$scope', 'objectIds', 'miqService', function($http, $scope, objectIds, miqService) {
  $scope.objectIds = objectIds;
  $scope.retirementInfo = {
    retirementDate: null,
    retirementWarning: ''
  };
  $scope.datepickerStartDate = new Date();
  $scope.modelCopy = _.extend({}, $scope.retirementInfo);
  $scope.model = 'retirementInfo';

  if (objectIds.length == 1) {
    $http.get('retirement_info/' + objectIds[0]).success(function(response) {
      if (response.retirement_date != null) {
        $scope.retirementInfo.retirementDate = moment.utc(response.retirement_date, 'MM-DD-YYYY').toDate();
      }
      $scope.retirementInfo.retirementWarning = response.retirement_warning || "";
      $scope.modelCopy = _.extend({}, $scope.retirementInfo);
    });
  }

  $scope.cancelClicked = function() {
    miqService.sparkleOn();
    miqService.miqAjaxButton('retire?button=cancel');
  };

  $scope.saveClicked = function() {
    miqService.sparkleOn();
    miqService.miqAjaxButton('retire?button=save',
                             {'retire_date': $scope.retirementInfo.retirementDate,
                              'retire_warn': $scope.retirementInfo.retirementWarning});
  };
}]);
<commit_msg>Retirement Form -- Replace .success calls with .then/.catch<commit_after>ManageIQ.angular.app.controller('retirementFormController', ['$http', '$scope', 'objectIds', 'miqService', function($http, $scope, objectIds, miqService) {
  $scope.objectIds = objectIds;
  $scope.retirementInfo = {
    retirementDate: null,
    retirementWarning: ''
  };
  $scope.datepickerStartDate = new Date();
  $scope.modelCopy = _.extend({}, $scope.retirementInfo);
  $scope.model = 'retirementInfo';

  if (objectIds.length == 1) {
    $http.get('retirement_info/' + objectIds[0])
      .then(getRetirementInfoFormData)
      .catch(miqService.handleFailure);
  }

  $scope.cancelClicked = function() {
    miqService.sparkleOn();
    miqService.miqAjaxButton('retire?button=cancel');
  };

  $scope.saveClicked = function() {
    miqService.sparkleOn();
    miqService.miqAjaxButton('retire?button=save',
                             {'retire_date': $scope.retirementInfo.retirementDate,
                              'retire_warn': $scope.retirementInfo.retirementWarning});
  };

  function getRetirementInfoFormData(response) {
    var data = response.data;

    if (data.retirement_date != null) {
      $scope.retirementInfo.retirementDate = moment.utc(data.retirement_date, 'MM-DD-YYYY').toDate();
    }
    $scope.retirementInfo.retirementWarning = data.retirement_warning || "";
    $scope.modelCopy = _.extend({}, $scope.retirementInfo);
  }
}]);

{'fraction_non_alphanumeric': 0.15364869820315366, 'fraction_numerical': 0.0014668133480014668, 'mean_word_length': 3.777583187390543, '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': '5046219', 'n_tokens_mistral': 875, 'n_tokens_neox': 859, 'n_words': 115}