<commit_before>'use strict';
var app = angular.module('com.module.dwDomainEntityTypes');

app.controller('EntityTypesCtrl', function($scope, $state, $stateParams, DwDomain, DwDomainEntityType, EntityTypesService, gettextCatalog, AppAuth) {

  //Put the currentUser in $scope for convenience
  $scope.currentUser = AppAuth.currentUser;
  $scope.domains = [];

  $scope.entityType = {};
  $scope.formFields = [{
      key: 'id',
      type: 'input',
      templateOptions: {
          label: gettextCatalog.getString('id'),
          disabled: true
    }
  },{
    key: 'name',
    type: 'input',
    templateOptions: {
      label: gettextCatalog.getString('Name'),
      required: true
    }
  }, {
    key: 'description',
    type: 'input',
    templateOptions: {
      label: gettextCatalog.getString('Description'),
      required: false
    }
  }, {
      key: 'dwDomainId',
      type: 'select',
      templateOptions: {
          label: gettextCatalog.getString('Domain'),
          options: $scope.domains,
          valueProp: 'id',
          labelProp: 'name',
          required: true,
          disabled: false
      }
  }];

  $scope.delete = function(id) {
    EntityTypesService.deleteEntityType(id, function() {
      $scope.safeDisplayedentityTypes = EntityTypesService.getEntityTypes();
      $state.go('^.list');
    });
  };

  $scope.onSubmit = function() {
    EntityTypesService.upsertEntityType($scope.entityType, function() {
      $scope.safeDisplayedentityTypes = EntityTypesService.getEntityTypes();
      $state.go('^.list');
    });
  };

  $scope.entityTypes = EntityTypesService.getEntityTypes();

  $scope.loading = true;
  DwDomainEntityType.find({filter: {include: ['domain','domainItems']}}).$promise
      .then(function (allEntityTypes) {
          $scope.safeDisplayedentityTypes = allEntityTypes;
          $scope.displayedEntityTypes = [].concat($scope.safeDisplayedentityTypes);
      })
      .catch(function (err) {
          console.log(err);
      })
      .then(function () {
          $scope.loading = false;
      });

  DwDomain.find({filter: {include: []}}).$promise
      .then(function (allDomains) {
          for (var i = 0; i < allDomains.length; ++i) {
               $scope.domains.push({
                    value: allDomains[i].name,
                    name: allDomains[i].description,
                    id: allDomains[i].id
               });
          }
      })
      .catch(function (err) {
          console.log(err);
      })
      .then(function () {
      }
  );

  if ($stateParams.id) {
    EntityTypesService.getEntityType($stateParams.id).$promise.then(function(result){
      $scope.entityType = result;})
  } else {
    $scope.entityType = {};
  }

  $scope.getDomains = function () {
    return [];
  }
<commit_msg>Modified domain picklist to show the name-description<commit_after>'use strict';
var app = angular.module('com.module.dwDomainEntityTypes');

app.controller('EntityTypesCtrl', function($scope, $state, $stateParams, DwDomain, DwDomainEntityType, EntityTypesService, gettextCatalog, AppAuth) {

  //Put the currentUser in $scope for convenience
  $scope.currentUser = AppAuth.currentUser;
  $scope.domains = [];

  $scope.entityType = {};
  $scope.formFields = [{
      key: 'id',
      type: 'input',
      templateOptions: {
          label: gettextCatalog.getString('id'),
          disabled: true
    }
  },{
    key: 'name',
    type: 'input',
    templateOptions: {
      label: gettextCatalog.getString('Name'),
      required: true
    }
  }, {
    key: 'description',
    type: 'input',
    templateOptions: {
      label: gettextCatalog.getString('Description'),
      required: false
    }
  }, {
      key: 'dwDomainId',
      type: 'select',
      templateOptions: {
          label: gettextCatalog.getString('Domain'),
          options: $scope.domains,
          valueProp: 'id',
          labelProp: 'name',
          required: true,
          disabled: false
      }
  }];

  $scope.delete = function(id) {
    EntityTypesService.deleteEntityType(id, function() {
      $scope.safeDisplayedentityTypes = EntityTypesService.getEntityTypes();
      $state.go('^.list');
    });
  };

  $scope.onSubmit = function() {
    EntityTypesService.upsertEntityType($scope.entityType, function() {
      $scope.safeDisplayedentityTypes = EntityTypesService.getEntityTypes();
      $state.go('^.list');
    });
  };

  $scope.entityTypes = EntityTypesService.getEntityTypes();

  $scope.loading = true;
  DwDomainEntityType.find({filter: {include: ['domain','domainItems']}}).$promise
      .then(function (allEntityTypes) {
          $scope.safeDisplayedentityTypes = allEntityTypes;
          $scope.displayedEntityTypes = [].concat($scope.safeDisplayedentityTypes);
      })
      .catch(function (err) {
          console.log(err);
      })
      .then(function () {
          $scope.loading = false;
      });

  DwDomain.find({filter: {include: []}}).$promise
      .then(function (allDomains) {
          for (var i = 0; i < allDomains.length; ++i) {
               $scope.domains.push({
                    value: allDomains[i].name,
                    name: allDomains[i].name + " - " + allDomains[i].description,
                    id: allDomains[i].id
               });
          }
      })
      .catch(function (err) {
          console.log(err);
      })
      .then(function () {
      }
  );

  if ($stateParams.id) {
    EntityTypesService.getEntityType($stateParams.id).$promise.then(function(result){
      $scope.entityType = result;})
  } else {
    $scope.entityType = {};
  }

  $scope.getDomains = function () {
    return [];
  }

{'fraction_non_alphanumeric': 0.14877056430214045, 'fraction_numerical': 0.0003537944454272068, 'mean_word_length': 2.503097893432466, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5712848', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1671, 'n_words': 279}