<commit_before>var module = angular.module(PKG.name+'.controllers');


module.controller('HomeCtrl', function ($scope, $filter, $modal, $alert, myAuth, myApi, myFileReader) {

  var filterFilter = $filter('filter');


  if(myAuth.isAuthenticated()) {
    getData();
  }

  $scope.doRefresh = getData;


  $scope.doImport = function() {
    myFileReader.get()
      .then(function (reader) {
        return myApi.Import.save(reader.result);
      })
      ['catch'](function (err) {
        $alert({
          title: 'import error!', 
          content: err, 
          type: 'danger', 
          duration: 3 
        });
      });
  };



  $scope.doExport = function () {
    var modalScope = $scope.$new();

    modalScope.filename = 'export.json';

    $modal({
      scope: modalScope,
      title: 'JSON export', 
      contentTemplate: '/partials/export.html', 
      placement: 'center', 
      show: true
    });<commit_msg>home doImport api call<commit_after>var module = angular.module(PKG.name+'.controllers');


module.controller('HomeCtrl', function ($scope, $filter, $modal, $alert, myAuth, myApi, myFileReader) {

  var filterFilter = $filter('filter');


  if(myAuth.isAuthenticated()) {
    getData();
  }

  $scope.doRefresh = getData;


  $scope.doImport = function () {
    myFileReader.get()
      .then(function (reader) {
        return myApi.Import.save(angular.fromJson(reader.result));
      })
      .then(function (result) {
        $alert({
          title: 'Import complete!', 
          type: 'success', 
          duration: 3 
        });
        getData();
      })
      ['catch'](function (err) {
        $alert({
          title: 'import error!', 
          content: err, 
          type: 'danger', 
          duration: 3 
        });
      });
  };



  $scope.doExport = function () {
    var modalScope = $scope.$new();

    modalScope.filename = 'export.json';

    $modal({
      scope: modalScope,
      title: 'JSON export', 
      contentTemplate: '/partials/export.html', 
      placement: 'center', 
      show: true
    });
{'fraction_non_alphanumeric': 0.1570048309178744, 'fraction_numerical': 0.0014492753623188406, 'mean_word_length': 2.276898734177215, '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': '1541511', 'n_tokens_mistral': 663, 'n_tokens_neox': 616, 'n_words': 128}