sentryAppComponent.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import type {
  2. SentryAppComponent,
  3. SentryAppSchemaIssueLink,
  4. } from 'sentry/types/integrations';
  5. export function SentryAppComponentFixture(
  6. params = {}
  7. ): SentryAppComponent<SentryAppSchemaIssueLink> {
  8. return {
  9. uuid: 'ed517da4-a324-44c0-aeea-1894cd9923fb',
  10. type: 'issue-link',
  11. schema: {
  12. type: 'issue-link',
  13. create: {
  14. uri: '',
  15. required_fields: [
  16. {
  17. type: 'text',
  18. name: 'title',
  19. label: 'Title',
  20. default: 'issue.title',
  21. },
  22. {
  23. type: 'textarea',
  24. name: 'description',
  25. label: 'Description',
  26. default: 'issue.description',
  27. },
  28. {
  29. type: 'select',
  30. name: 'numbers',
  31. label: 'Numbers',
  32. choices: [
  33. ['number_1', 'one'],
  34. ['number_2', 'two'],
  35. ],
  36. },
  37. ],
  38. },
  39. link: {
  40. uri: '',
  41. required_fields: [
  42. {
  43. type: 'text',
  44. name: 'issue',
  45. label: 'Issue',
  46. },
  47. ],
  48. },
  49. },
  50. sentryApp: {
  51. uuid: 'b468fed3-afba-4917-80d6-bdac99c1ec05',
  52. slug: 'foo',
  53. name: 'Foo',
  54. avatars: [],
  55. },
  56. ...params,
  57. };
  58. }
  59. export function SentryAppComponentAsyncFixture(
  60. params = {}
  61. ): SentryAppComponent<SentryAppSchemaIssueLink> {
  62. return {
  63. uuid: 'ed517da4-a324-44c0-aeea-1894cd9923fb',
  64. type: 'issue-link',
  65. schema: {
  66. type: 'issue-link',
  67. create: {
  68. uri: '',
  69. required_fields: [
  70. {
  71. type: 'select',
  72. name: 'numbers',
  73. label: 'Numbers',
  74. uri: '/sentry/numbers',
  75. url: '/sentry/numbers',
  76. async: true,
  77. },
  78. ],
  79. },
  80. link: {
  81. uri: '',
  82. required_fields: [
  83. {
  84. type: 'text',
  85. name: 'issue',
  86. label: 'Issue',
  87. },
  88. ],
  89. },
  90. },
  91. sentryApp: {
  92. uuid: 'b468fed3-afba-4917-80d6-bdac99c1ec05',
  93. slug: 'foo',
  94. name: 'Foo',
  95. avatars: [],
  96. },
  97. ...params,
  98. };
  99. }
  100. export function SentryAppComponentDependentFixture(
  101. params = {}
  102. ): SentryAppComponent<SentryAppSchemaIssueLink> {
  103. return {
  104. type: 'issue-link',
  105. uuid: 'ed517da4-a324-44c0-aeea-1894cd9923fb',
  106. schema: {
  107. type: 'issue-link',
  108. link: {
  109. required_fields: [
  110. {
  111. choices: [
  112. ['A', 'project A'],
  113. ['B', 'project B'],
  114. ['C', 'project C'],
  115. ],
  116. type: 'select',
  117. uri: '/integrations/sentry/projects',
  118. name: 'project_id',
  119. label: 'Project',
  120. },
  121. {
  122. depends_on: ['project_id'],
  123. name: 'board_id',
  124. choices: [],
  125. type: 'select',
  126. uri: '/integrations/sentry/boards',
  127. label: 'Board',
  128. },
  129. ],
  130. uri: '/integrations/sentry/issues/link',
  131. },
  132. create: {
  133. required_fields: [
  134. {
  135. default: 'issue.title',
  136. type: 'text',
  137. name: 'title',
  138. label: 'Title',
  139. },
  140. {
  141. default: 'issue.description',
  142. type: 'textarea',
  143. name: 'description',
  144. label: 'Description',
  145. },
  146. {
  147. choices: [
  148. ['A', 'project A'],
  149. ['B', 'project B'],
  150. ],
  151. type: 'select',
  152. uri: '/integrations/sentry/projects',
  153. name: 'project_id',
  154. label: 'Project',
  155. },
  156. {
  157. depends_on: ['project_id'],
  158. name: 'board_id',
  159. choices: [],
  160. type: 'select',
  161. uri: '/integrations/sentry/boards',
  162. label: 'Board',
  163. },
  164. ],
  165. uri: '/integrations/sentry/issues/create',
  166. },
  167. },
  168. sentryApp: {
  169. uuid: 'b468fed3-afba-4917-80d6-bdac99c1ec05',
  170. slug: 'foo',
  171. name: 'Foo',
  172. avatars: [],
  173. },
  174. ...params,
  175. };
  176. }