<commit_before>import { translate } from '@waldur/i18n';
import { loadInstances } from '@waldur/openstack/api';
import { validateState } from '@waldur/resource/actions/base';
import { ResourceAction } from '@waldur/resource/actions/types';

export default function createAction(): ResourceAction {
  return {
    name: 'link_openstack',
    type: 'form',
    method: 'POST',
    title: translate('Link OpenStack Instance'),
    validators: [validateState('OK')],
    init: async (_, __, action) => {
      const instances = await loadInstances();

      action.fields.instance.choices = instances.map(choice => ({
        value: choice.url,
        display_name: choice.name,
      }));
    },
    serializer: form => {
      return {
        instance: form.instance.url,
      };
    },
    fields: [
      {
        name: 'instance',
        type: 'select',
        required: true,
        label: translate('OpenStack instance'),
      },
    ],
  };
}<commit_msg>Remove leftover.<commit_after>import { translate } from '@waldur/i18n';
import { loadInstances } from '@waldur/openstack/api';
import { validateState } from '@waldur/resource/actions/base';
import { ResourceAction } from '@waldur/resource/actions/types';

export default function createAction(): ResourceAction {
  return {
    name: 'link_openstack',
    type: 'form',
    method: 'POST',
    title: translate('Link OpenStack Instance'),
    validators: [validateState('OK')],
    init: async (_, __, action) => {
      const instances = await loadInstances();

      action.fields.instance.choices = instances.map(choice => ({
        value: choice.url,
        display_name: choice.name,
      }));
    },
    fields: [
      {
        name: 'instance',
        type: 'select',
        required: true,
        label: translate('OpenStack instance'),
      },
    ],
  };
}
{'fraction_non_alphanumeric': 0.14557305812058663, 'fraction_numerical': 0.0021727322107550242, 'mean_word_length': 2.861635220125786, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '5196229', 'n_tokens_mistral': 533, 'n_tokens_neox': 529, 'n_words': 120}