<commit_before>'use strict';

/**
 * @ngdoc function
 * @name clientApp.controller:UsermanagementCtrl
 * @description
 * # UsermanagementCtrl
 * Controller of the clientApp
 */

angular.module('clientApp')
  .controller('UsermanagementCtrl', function (
    $location,
    $scope,
    $http
  ) {
      servicelocation = "https://" + $location.$$host + "/api/";
      $scope.userManagmentModel = {};
  //  listUsers();
    $scope.checkServiceStatus = function() {
        console.log("Interval occurred check status");
        var data = "servicename=elasticsearch";
        var config = {headers:{
          "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
        }};
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.elasticsearchstatusbit=data;
            });
         data = "servicename=logstash";
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.logstashstatusbit=data;
            });
         data = "servicename=kibana4";
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.kibanastatusbit=data;
            });
    };

    $scope.clearForm = function() {
      $scope.userManagmentModel.selectedUser = "";
      $scope.userManagmentModel.passwd = "";
    };
      console.log("Get List of users");
      var data = "";
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"ListUsers",data,config)
        .success(function(data)
          {
             $scope.userManagmentModel.userList=data;
          });


    $scope.listUsers = function(){
      console.log("Get List of users");
      var data = "";
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"ListUsers",data,config)
        .success(function(data)
          {
             $scope.userManagmentModel.userList=data;
          });
    };

    $scope.updateUser = function(){
      console.log("Update User: " + $scope.userManagmentModel.selectedUser);

      var data = "User=" +$scope.userManagmentModel.selectedUser + ";Password=" + $scope.userManagmentModel.password;
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"UpdateUser",data,config)
        .success(function(data)
          {
             $scope.listUsers();
          });
    };

    $scope.deleteUser = function(){
      console.log("Delete User: " + $scope.userManagmentModel.selectedUser);
      var data = "User=" + $scope.userManagmentModel.selectedUser;
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"DeleteUser",data,config)
        .success(function(data)
          {
             $scope.listUsers();
          });
    };
  });<commit_msg>Updates to delete function to clear form.<commit_after>'use strict';

/**
 * @ngdoc function
 * @name clientApp.controller:UsermanagementCtrl
 * @description
 * # UsermanagementCtrl
 * Controller of the clientApp
 */

angular.module('clientApp')
  .controller('UsermanagementCtrl', function (
    $location,
    $scope,
    $http
  ) {
      servicelocation = "https://" + $location.$$host + "/api/";
      $scope.userManagmentModel = {};
  //  listUsers();
    $scope.checkServiceStatus = function() {
        console.log("Interval occurred check status");
        var data = "servicename=elasticsearch";
        var config = {headers:{
          "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
        }};
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.elasticsearchstatusbit=data;
            });
         data = "servicename=logstash";
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.logstashstatusbit=data;
            });
         data = "servicename=kibana4";
        $http.post(servicelocation+"IsServiceRunning",data,config)
          .success(function(data)
            {
               $scope.systemsettings.kibanastatusbit=data;
            });
    };

    $scope.clearForm = function() {
      $scope.userManagmentModel.selectedUser = "";
      $scope.userManagmentModel.passwd = "";
    };
      console.log("Get List of users");
      var data = "";
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"ListUsers",data,config)
        .success(function(data)
          {
             $scope.userManagmentModel.userList=data;
          });


    $scope.listUsers = function(){
      console.log("Get List of users");
      var data = "";
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"ListUsers",data,config)
        .success(function(data)
          {
             $scope.userManagmentModel.userList=data;
          });
    };

    $scope.updateUser = function(){
      console.log("Update User: " + $scope.userManagmentModel.selectedUser);

      var data = "User=" +$scope.userManagmentModel.selectedUser + ";Password=" + $scope.userManagmentModel.password;
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"UpdateUser",data,config)
        .success(function(data)
          {
             $scope.listUsers();
             $scope.clearForm();
          });
    };

    $scope.deleteUser = function(){
      console.log("Delete User: " + $scope.userManagmentModel.selectedUser);
      var data = "User=" + $scope.userManagmentModel.selectedUser;
      var config = {headers:{
        "Content-type": "application/x-www-form-urlencoded; charset=utf-8"
      }};
      $http.post(servicelocation+"DeleteUser",data,config)
        .success(function(data)
          {
             $scope.listUsers();
             $scope.clearForm();
          });
    };
  });
{'fraction_non_alphanumeric': 0.146, 'fraction_numerical': 0.0018461538461538461, 'mean_word_length': 2.396551724137931, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 10, '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': '6303085', 'n_tokens_mistral': 1904, 'n_tokens_neox': 1887, 'n_words': 260}