<commit_before>import template from './appstore-field-select-openstack-tenant.html';

class AppstoreFieldSelectOpenstackTenantController {
  // @ngInject
  constructor(ncUtilsFlash, openstackTenantsService, currentStateService) {
    this.ncUtilsFlash = ncUtilsFlash;
    this.openstackTenantsService = openstackTenantsService;
    this.currentStateService = currentStateService;
  }

  $onInit() {
    this.loading = true;
    this.currentStateService.getProject().then(project => {
      this.openstackTenantsService.getAll({
        field: ['name', 'uuid'],
        project_uuid: project.uuid,
      }).then(tenants => {
        this.choices = tenants.map(tenant => ({
          display_name: tenant.name,
          value: `Tenant UUID: ${tenant.backend_id}. Name: ${tenant.name}`
        }));
        this.loading = false;
        this.loaded = true;
      })
      .catch(response => {
        this.ncUtilsFlash.errorFromResponse(response, gettext('Unable to get list of OpenStack tenants.'));
        this.loading = false;
        this.loaded = false;
      });
    });
  }
}

const appstoreFieldSelectOpenstackTenant = {
  template,
  bindings: {
    field: '<',
    model: '<'
  },
  controller: AppstoreFieldSelectOpenstackTenantController,
};

export default appstoreFieldSelectOpenstackTenant;<commit_msg>Fix filter for fields when displaying OpenStack select<commit_after>import template from './appstore-field-select-openstack-tenant.html';

class AppstoreFieldSelectOpenstackTenantController {
  // @ngInject
  constructor(ncUtilsFlash, openstackTenantsService, currentStateService) {
    this.ncUtilsFlash = ncUtilsFlash;
    this.openstackTenantsService = openstackTenantsService;
    this.currentStateService = currentStateService;
  }

  $onInit() {
    this.loading = true;
    this.currentStateService.getProject().then(project => {
      this.openstackTenantsService.getAll({
        field: ['name', 'backend_id'],
        project_uuid: project.uuid,
      }).then(tenants => {
        this.choices = tenants.map(tenant => ({
          display_name: tenant.name,
          value: `Tenant UUID: ${tenant.backend_id}. Name: ${tenant.name}`
        }));
        this.loading = false;
        this.loaded = true;
      })
      .catch(response => {
        this.ncUtilsFlash.errorFromResponse(response, gettext('Unable to get list of OpenStack tenants.'));
        this.loading = false;
        this.loaded = false;
      });
    });
  }
}

const appstoreFieldSelectOpenstackTenant = {
  template,
  bindings: {
    field: '<',
    model: '<'
  },
  controller: AppstoreFieldSelectOpenstackTenantController,
};

export default appstoreFieldSelectOpenstackTenant;
{'fraction_non_alphanumeric': 0.1187010078387458, 'fraction_numerical': 0.0, 'mean_word_length': 3.281150159744409, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '5111537', 'n_tokens_mistral': 786, 'n_tokens_neox': 783, 'n_words': 136}