<commit_before>import React from 'react';

import {t} from 'app/locale';
import {CSRF_COOKIE_NAME} from 'app/constants';
import AsyncView from 'app/views/asyncView';
import NarrowLayout from 'app/components/narrowLayout';
import {Form, SelectField} from 'app/components/forms';
import getCookie from 'app/utils/getCookie';

export default class VSTSOrganizationLink extends AsyncView {
  getEndpoints() {
    return [['organizations', '/organizations/']];
  }

  getTitle() {
    return 'Link Organization to VSTS';
  }

  getDefaultState() {
    return {
      organizations: [],
    };
  }

  get targetId() {
    return this.props.location.query.targetId;
  }

  get targetName() {
    return this.props.location.query.targetName;
  }

  get organizations() {
    return this.state.organizations.map(o => [o.slug, o.name]);
  }

  get defaultChoice() {
    return !!this.organizations[0] ? this.organizations[0][0] : '';
  }

  onSubmit() {
    // Because Form can't also just be a normal form.
    const form = $('.link-org-form');
    form.attr('method', 'POST');
    form.attr('action', '/extensions/vsts/configure/');
    form.submit();
  }

  render() {
    return (
      <NarrowLayout>
        <Form
          className="link-org-form"
          submitLabel={t('Continue')}
          onSubmit={this.onSubmit}
        >
          <input
            type="hidden"
            name="csrfmiddlewaretoken"
            value={getCookie(CSRF_COOKIE_NAME)}
          />

          <input type="hidden" name="vsts_id" value={this.targetId} />
          <input type="hidden" name="vsts_name" value={this.targetName} />

          <SelectField
            choices={this.organizations}
            clearable={false}
            value={this.defaultChoice}
            name="organization"
            label={t('Organization to use with VSTS')}
          />
        </Form>
      </NarrowLayout>
    );
  }
}<commit_msg>fix(integrations): Rename VSTS on Org Link (#9836)<commit_after>import React from 'react';

import {t} from 'app/locale';
import {CSRF_COOKIE_NAME} from 'app/constants';
import AsyncView from 'app/views/asyncView';
import NarrowLayout from 'app/components/narrowLayout';
import {Form, SelectField} from 'app/components/forms';
import getCookie from 'app/utils/getCookie';

export default class VSTSOrganizationLink extends AsyncView {
  getEndpoints() {
    return [['organizations', '/organizations/']];
  }

  getTitle() {
    return 'Link Organization to VSTS';
  }

  getDefaultState() {
    return {
      organizations: [],
    };
  }

  get targetId() {
    return this.props.location.query.targetId;
  }

  get targetName() {
    return this.props.location.query.targetName;
  }

  get organizations() {
    return this.state.organizations.map(o => [o.slug, o.name]);
  }

  get defaultChoice() {
    return !!this.organizations[0] ? this.organizations[0][0] : '';
  }

  onSubmit() {
    // Because Form can't also just be a normal form.
    const form = $('.link-org-form');
    form.attr('method', 'POST');
    form.attr('action', '/extensions/vsts/configure/');
    form.submit();
  }

  render() {
    return (
      <NarrowLayout>
        <Form
          className="link-org-form"
          submitLabel={t('Continue')}
          onSubmit={this.onSubmit}
        >
          <input
            type="hidden"
            name="csrfmiddlewaretoken"
            value={getCookie(CSRF_COOKIE_NAME)}
          />

          <input type="hidden" name="vsts_id" value={this.targetId} />
          <input type="hidden" name="vsts_name" value={this.targetName} />

          <SelectField
            choices={this.organizations}
            clearable={false}
            value={this.defaultChoice}
            name="organization"
            label={t('Organization to use with Azure DevOps')}
          />
        </Form>
      </NarrowLayout>
    );
  }
}
{'fraction_non_alphanumeric': 0.14193548387096774, 'fraction_numerical': 0.0025806451612903226, 'mean_word_length': 2.5625, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '2367474', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1171, 'n_words': 239}