apiApplication.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import {JsonFormObject} from 'sentry/components/forms/types';
  2. import {convertMultilineFieldValue, extractMultilineFields} from 'sentry/utils';
  3. import getDynamicText from 'sentry/utils/getDynamicText';
  4. const forms: JsonFormObject[] = [
  5. {
  6. // Form "section"/"panel"
  7. title: 'Application Details',
  8. fields: [
  9. {
  10. name: 'name',
  11. type: 'string',
  12. required: true,
  13. // additional data/props that is related to rendering of form field rather than data
  14. label: 'Name',
  15. help: 'e.g. My Application',
  16. setValue: value => getDynamicText({value, fixed: 'CI_APPLICATION_NAME'}),
  17. },
  18. {
  19. name: 'homepageUrl',
  20. type: 'string',
  21. required: false,
  22. label: 'Homepage',
  23. placeholder: 'e.g. https://example.com/',
  24. help: "An optional link to your application's homepage",
  25. },
  26. {
  27. name: 'privacyUrl',
  28. type: 'string',
  29. label: 'Privacy Policy',
  30. placeholder: 'e.g. https://example.com/privacy',
  31. help: 'An optional link to your Privacy Policy',
  32. },
  33. {
  34. name: 'termsUrl',
  35. type: 'string',
  36. label: 'Terms of Service',
  37. placeholder: 'e.g. https://example.com/terms',
  38. help: 'An optional link to your Terms of Service agreement',
  39. },
  40. ],
  41. },
  42. {
  43. title: 'Security',
  44. fields: [
  45. {
  46. name: 'redirectUris',
  47. type: 'string',
  48. multiline: true,
  49. placeholder: 'e.g. https://example.com/oauth/complete',
  50. label: 'Authorized Redirect URIs',
  51. help: 'Separate multiple entries with a newline.',
  52. getValue: val => extractMultilineFields(val),
  53. setValue: val => convertMultilineFieldValue(val),
  54. },
  55. {
  56. name: 'allowedOrigins',
  57. type: 'string',
  58. multiline: true,
  59. placeholder: 'e.g. example.com',
  60. label: 'Authorized JavaScript Origins',
  61. help: 'Separate multiple entries with a newline.',
  62. getValue: val => extractMultilineFields(val),
  63. setValue: val => convertMultilineFieldValue(val),
  64. },
  65. ],
  66. },
  67. ];
  68. export default forms;