sentryAppComponent.ts 4.0 KB

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