streamGroup.stories.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. import {Component} from 'react';
  2. import {browserHistory, Route, Router} from 'react-router';
  3. import PropTypes from 'prop-types';
  4. import StreamGroup from 'sentry/components/stream/group';
  5. import GroupStore from 'sentry/stores/groupStore';
  6. export default {
  7. title: 'Features/Issues/Stream Group',
  8. };
  9. const selection = {
  10. projects: [1],
  11. environments: ['production', 'staging'],
  12. datetime: {
  13. start: '2019-10-09T11:18:59',
  14. end: '2019-09-09T11:18:59',
  15. period: null,
  16. utc: true,
  17. },
  18. };
  19. const organization = {
  20. id: '1',
  21. slug: 'test-org',
  22. features: [],
  23. };
  24. function loadGroups() {
  25. const group = {
  26. assignedTo: null,
  27. count: '327482',
  28. culprit: 'fetchData(app/components/group/suggestedOwners/suggestedOwners)',
  29. firstRelease: null,
  30. firstSeen: '2020-10-05T19:44:05.963Z',
  31. hasSeen: false,
  32. id: '1',
  33. isBookmarked: false,
  34. isPublic: false,
  35. isSubscribed: false,
  36. lastSeen: '2020-10-11T01:08:59Z',
  37. level: 'warning',
  38. logger: null,
  39. metadata: {function: 'fetchData', type: 'RequestError'},
  40. numComments: 0,
  41. permalink: 'https://foo.io/organizations/foo/issues/1234/',
  42. platform: 'javascript',
  43. project: {
  44. platform: 'javascript',
  45. id: 1,
  46. slug: 'test-project',
  47. },
  48. shareId: null,
  49. shortId: 'JAVASCRIPT-6QS',
  50. stats: {
  51. '24h': [
  52. [1517281200, 2],
  53. [1517310000, 1],
  54. ],
  55. '30d': [
  56. [1514764800, 1],
  57. [1515024000, 122],
  58. ],
  59. },
  60. status: 'unresolved',
  61. title: 'RequestError: GET /issues/ 404',
  62. type: 'error',
  63. userCount: 35097,
  64. userReportCount: 0,
  65. inbox: {
  66. date_added: '2020-11-24T13:17:42.248751Z',
  67. reason: 0,
  68. reason_details: {},
  69. },
  70. };
  71. const unhandledGroup = {
  72. ...group,
  73. id: '2',
  74. culprit: 'sentry.tasks.email.send_email',
  75. isUnhandled: true,
  76. level: 'error',
  77. count: '12',
  78. userCount: 1337,
  79. metadata: {
  80. function: 'send_messages',
  81. type: 'SMTPServerDisconnected',
  82. value: 'Connection unexpectedly closed',
  83. filename: 'sentry/utils/email.py',
  84. },
  85. annotations: ['<a href="https://sentry.io">PROD-72</a>'],
  86. title: 'UnhandledError: GET /issues/ 404',
  87. inbox: {
  88. date_added: '2020-11-24T13:17:42.248751Z',
  89. reason: 2,
  90. reason_details: {},
  91. },
  92. };
  93. const resolvedGroup = {
  94. ...group,
  95. id: '3',
  96. status: 'resolved',
  97. isUnhandled: true,
  98. metadata: {function: 'fetchData', type: 'ResolvedError'},
  99. numComments: 2,
  100. inbox: null,
  101. };
  102. const ignoredGroup = {
  103. ...group,
  104. id: '4',
  105. status: 'ignored',
  106. culprit: 'culprit',
  107. metadata: {function: 'fetchData', type: 'IgnoredErrorType'},
  108. inbox: null,
  109. };
  110. const bookmarkedGroup = {
  111. ...group,
  112. id: '5',
  113. metadata: {
  114. function: 'send_messages',
  115. type: 'BookmarkedError',
  116. value: 'Connection unexpectedly closed',
  117. filename: 'sentry/utils/email.py',
  118. },
  119. culprit: '',
  120. isBookmarked: true,
  121. logger: 'sentry.incidents.tasks',
  122. shortId: 'JAVASCRIPT-LONGNAME-6QS',
  123. inbox: {
  124. date_added: '2020-11-24T13:17:42.248751Z',
  125. reason: 3,
  126. reason_details: {},
  127. },
  128. };
  129. const slimGroup = {
  130. ...group,
  131. id: '6',
  132. title: 'Monitor failure: getsentry-expire-plan-trials (missed_checkin)',
  133. metadata: {
  134. type: 'Monitor failure: getsentry-expire-plan-trials (missed_checkin)',
  135. },
  136. culprit: '',
  137. logger: 'sentry.incidents.tasks',
  138. annotations: ['<a href="https://sentry.io">PROD-72</a>'],
  139. inbox: {
  140. date_added: '2020-11-24T13:17:42.248751Z',
  141. reason: 1,
  142. reason_details: {},
  143. },
  144. };
  145. GroupStore.loadInitialData([
  146. group,
  147. unhandledGroup,
  148. resolvedGroup,
  149. ignoredGroup,
  150. bookmarkedGroup,
  151. slimGroup,
  152. ]);
  153. }
  154. class LocationContext extends Component {
  155. static childContextTypes = {
  156. location: PropTypes.object,
  157. };
  158. getChildContext() {
  159. return {location: {query: {}}};
  160. }
  161. render() {
  162. return (
  163. <Router history={browserHistory}>
  164. <Route path="/*" component={() => this.props.children} />
  165. </Router>
  166. );
  167. }
  168. }
  169. export const _StreamGroup = () => {
  170. loadGroups();
  171. return (
  172. <LocationContext>
  173. <StreamGroup
  174. id="1"
  175. canSelect
  176. withChart={null}
  177. memberList={[]}
  178. organization={organization}
  179. selection={selection}
  180. query=""
  181. isGlobalSelectionReady
  182. />
  183. <StreamGroup
  184. id="2"
  185. canSelect
  186. withChart={null}
  187. memberList={[]}
  188. organization={organization}
  189. selection={selection}
  190. query=""
  191. isGlobalSelectionReady
  192. />
  193. <StreamGroup
  194. id="3"
  195. canSelect
  196. withChart={null}
  197. memberList={[]}
  198. organization={organization}
  199. selection={selection}
  200. query=""
  201. isGlobalSelectionReady
  202. />
  203. <StreamGroup
  204. id="4"
  205. canSelect
  206. withChart={null}
  207. memberList={[]}
  208. organization={organization}
  209. selection={selection}
  210. query=""
  211. isGlobalSelectionReady
  212. />
  213. <StreamGroup
  214. id="5"
  215. canSelect
  216. withChart={null}
  217. memberList={[]}
  218. organization={organization}
  219. selection={selection}
  220. query=""
  221. isGlobalSelectionReady
  222. />
  223. <StreamGroup
  224. id="6"
  225. canSelect
  226. withChart={null}
  227. memberList={[]}
  228. organization={organization}
  229. selection={selection}
  230. query=""
  231. isGlobalSelectionReady
  232. />
  233. </LocationContext>
  234. );
  235. };
  236. _StreamGroup.storyName = 'Stream Group';