sentryTypes.tsx 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. import PropTypes from 'prop-types';
  2. export const Metadata = PropTypes.shape({
  3. value: PropTypes.string,
  4. message: PropTypes.string,
  5. directive: PropTypes.string,
  6. type: PropTypes.string,
  7. title: PropTypes.string,
  8. uri: PropTypes.string,
  9. });
  10. const Avatar = PropTypes.shape({
  11. avatarType: PropTypes.oneOf(['letter_avatar', 'upload', 'gravatar']),
  12. avatarUuid: PropTypes.string,
  13. });
  14. /**
  15. * A User is someone that has registered on Sentry
  16. */
  17. export const User = PropTypes.shape({
  18. avatar: Avatar,
  19. avatarUrl: PropTypes.string,
  20. dateJoined: PropTypes.string,
  21. email: PropTypes.string,
  22. emails: PropTypes.arrayOf(
  23. PropTypes.shape({
  24. is_verified: PropTypes.bool,
  25. id: PropTypes.string,
  26. email: PropTypes.string,
  27. })
  28. ),
  29. has2fa: PropTypes.bool,
  30. hasPasswordAuth: PropTypes.bool,
  31. id: PropTypes.string,
  32. identities: PropTypes.array,
  33. isActive: PropTypes.bool,
  34. isManaged: PropTypes.bool,
  35. lastActive: PropTypes.string,
  36. lastLogin: PropTypes.string,
  37. username: PropTypes.string,
  38. });
  39. export const AuthConfig = PropTypes.shape({
  40. canRegister: PropTypes.bool,
  41. serverHostname: PropTypes.string,
  42. hasNewsletter: PropTypes.bool,
  43. githubLoginLink: PropTypes.string,
  44. vstsLoginLink: PropTypes.string,
  45. });
  46. export const Config = PropTypes.shape({
  47. languageCode: PropTypes.string,
  48. csrfCookieName: PropTypes.string,
  49. lastOrganization: PropTypes.string,
  50. dsn: PropTypes.string,
  51. features: PropTypes.instanceOf(Set),
  52. gravatarBaseUrl: PropTypes.string,
  53. invitesEnabled: PropTypes.bool,
  54. isAuthenticated: PropTypes.bool,
  55. isOnPremise: PropTypes.bool,
  56. messages: PropTypes.array,
  57. needsUpgrade: PropTypes.bool,
  58. privacyUrl: PropTypes.string,
  59. singleOrganization: PropTypes.bool,
  60. supportEmail: PropTypes.string,
  61. termsUrl: PropTypes.string,
  62. urlPrefix: PropTypes.string,
  63. user: User,
  64. statuspage: PropTypes.shape({
  65. id: PropTypes.string,
  66. api_host: PropTypes.string,
  67. }),
  68. version: PropTypes.shape({
  69. current: PropTypes.string,
  70. build: PropTypes.string,
  71. latest: PropTypes.string,
  72. upgradeAvailable: PropTypes.bool,
  73. }),
  74. userIdentity: PropTypes.shape({
  75. ip_address: PropTypes.string,
  76. email: PropTypes.string,
  77. id: PropTypes.number,
  78. isStaff: PropTypes.bool,
  79. }),
  80. sentryConfig: PropTypes.shape({
  81. dsn: PropTypes.string,
  82. release: PropTypes.string,
  83. whitelistUrls: PropTypes.arrayOf(PropTypes.string),
  84. }),
  85. distPrefix: PropTypes.string,
  86. });
  87. export const Deploy = PropTypes.shape({
  88. environment: PropTypes.string,
  89. dateFinished: PropTypes.string,
  90. version: PropTypes.string,
  91. });
  92. const DiscoverQueryShape = {
  93. projects: PropTypes.arrayOf(PropTypes.number),
  94. fields: PropTypes.arrayOf(PropTypes.string),
  95. aggregations: PropTypes.arrayOf(PropTypes.array),
  96. conditions: PropTypes.arrayOf(PropTypes.array),
  97. limit: PropTypes.number,
  98. range: PropTypes.string,
  99. start: PropTypes.string,
  100. end: PropTypes.string,
  101. };
  102. export const DiscoverQuery = PropTypes.shape(DiscoverQueryShape);
  103. export const DiscoverSavedQuery = PropTypes.shape({
  104. id: PropTypes.string.isRequired,
  105. dateCreated: PropTypes.string.isRequired,
  106. dateUpdated: PropTypes.string.isRequired,
  107. name: PropTypes.string.isRequired,
  108. createdBy: PropTypes.string,
  109. ...DiscoverQueryShape,
  110. });
  111. const DiscoverResultsShape = {
  112. data: PropTypes.arrayOf(PropTypes.object),
  113. meta: PropTypes.arrayOf(
  114. PropTypes.shape({
  115. type: PropTypes.string,
  116. name: PropTypes.string,
  117. })
  118. ),
  119. timing: PropTypes.shape({
  120. duration_ms: PropTypes.number,
  121. marks_ms: PropTypes.object,
  122. timestamp: PropTypes.number,
  123. }),
  124. };
  125. export const DiscoverResults = PropTypes.arrayOf(PropTypes.shape(DiscoverResultsShape));
  126. export const EventView = PropTypes.shape({
  127. id: PropTypes.string.isRequired,
  128. name: PropTypes.string.isRequired,
  129. data: PropTypes.shape({
  130. fields: PropTypes.arrayOf(PropTypes.string),
  131. groupby: PropTypes.arrayOf(PropTypes.string),
  132. orderby: PropTypes.arrayOf(PropTypes.string),
  133. }).isRequired,
  134. tags: PropTypes.arrayOf(PropTypes.string).isRequired,
  135. });
  136. /**
  137. * A Member is someone that was invited to Sentry but may
  138. * not have registered for an account yet
  139. */
  140. export const Member = PropTypes.shape({
  141. dateCreated: PropTypes.string,
  142. email: PropTypes.string.isRequired,
  143. flags: PropTypes.shape({
  144. 'sso:linked': PropTypes.bool,
  145. 'sso:invalid': PropTypes.bool,
  146. }),
  147. id: PropTypes.string.isRequired,
  148. name: PropTypes.string.isRequired,
  149. pending: PropTypes.bool,
  150. role: PropTypes.string.isRequired,
  151. roleName: PropTypes.string.isRequired,
  152. user: User,
  153. });
  154. const EventOrGroupType = PropTypes.oneOf([
  155. 'error',
  156. 'csp',
  157. 'hpkp',
  158. 'expectct',
  159. 'expectstaple',
  160. 'default',
  161. 'transaction',
  162. ]);
  163. export const Group = PropTypes.shape({
  164. id: PropTypes.string.isRequired,
  165. annotations: PropTypes.array,
  166. assignedTo: User,
  167. count: PropTypes.string,
  168. culprit: PropTypes.string,
  169. firstSeen: PropTypes.string,
  170. hasSeen: PropTypes.bool,
  171. isBookmarked: PropTypes.bool,
  172. isPublic: PropTypes.bool,
  173. isSubscribed: PropTypes.bool,
  174. lastSeen: PropTypes.string,
  175. level: PropTypes.string,
  176. logger: PropTypes.string,
  177. metadata: Metadata,
  178. numComments: PropTypes.number,
  179. permalink: PropTypes.string,
  180. project: PropTypes.shape({
  181. name: PropTypes.string,
  182. slug: PropTypes.string,
  183. }),
  184. shareId: PropTypes.string,
  185. shortId: PropTypes.string,
  186. status: PropTypes.string,
  187. statusDetails: PropTypes.object,
  188. title: PropTypes.string,
  189. type: EventOrGroupType,
  190. userCount: PropTypes.number,
  191. });
  192. export const Event = PropTypes.shape({
  193. id: PropTypes.string.isRequired,
  194. context: PropTypes.object,
  195. contexts: PropTypes.object,
  196. dateCreated: PropTypes.string,
  197. dateReceived: PropTypes.string,
  198. entries: PropTypes.arrayOf(
  199. PropTypes.shape({
  200. data: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
  201. type: PropTypes.string,
  202. })
  203. ),
  204. errors: PropTypes.arrayOf(
  205. PropTypes.shape({
  206. data: PropTypes.object,
  207. message: PropTypes.string,
  208. type: PropTypes.string,
  209. })
  210. ),
  211. eventID: PropTypes.string,
  212. fingerprints: PropTypes.arrayOf(PropTypes.string),
  213. groupID: PropTypes.string,
  214. message: PropTypes.string,
  215. metadata: Metadata,
  216. packages: PropTypes.object,
  217. platform: PropTypes.string,
  218. sdk: PropTypes.object,
  219. size: PropTypes.number,
  220. tags: PropTypes.arrayOf(
  221. PropTypes.shape({
  222. key: PropTypes.string,
  223. value: PropTypes.string,
  224. })
  225. ),
  226. type: EventOrGroupType,
  227. user: PropTypes.object,
  228. });
  229. export const EventAttachment = PropTypes.shape({
  230. id: PropTypes.string.isRequired,
  231. name: PropTypes.string.isRequired,
  232. headers: PropTypes.object,
  233. size: PropTypes.number.isRequired,
  234. sha1: PropTypes.string.isRequired,
  235. dateCreated: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
  236. type: PropTypes.string.isRequired,
  237. });
  238. export const EventError = PropTypes.shape({
  239. type: PropTypes.string.isRequired,
  240. message: PropTypes.string.isRequired,
  241. data: PropTypes.object,
  242. });
  243. export const Tag = PropTypes.shape({
  244. key: PropTypes.string.isRequired,
  245. name: PropTypes.string,
  246. uniqueValues: PropTypes.number,
  247. });
  248. export const Actor = PropTypes.shape({
  249. type: PropTypes.oneOf(['user', 'team']),
  250. id: PropTypes.string.isRequired,
  251. name: PropTypes.string.isRequired,
  252. });
  253. export const Team = PropTypes.shape({
  254. id: PropTypes.string.isRequired,
  255. slug: PropTypes.string.isRequired,
  256. });
  257. export const Monitor = PropTypes.shape({
  258. id: PropTypes.string.isRequired,
  259. name: PropTypes.string.isRequired,
  260. dateCreated: PropTypes.string,
  261. });
  262. export const Project = PropTypes.shape({
  263. // snuba returns id as number
  264. id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
  265. slug: PropTypes.string.isRequired,
  266. // snuba results may not contain a `name` or `isBookmarked
  267. teams: PropTypes.arrayOf(Team),
  268. name: PropTypes.string,
  269. isBookmarked: PropTypes.bool,
  270. status: PropTypes.string,
  271. });
  272. export const ProjectDetail = PropTypes.shape({
  273. id: PropTypes.string.isRequired,
  274. name: PropTypes.string.isRequired,
  275. slug: PropTypes.string.isRequired,
  276. dateCreated: PropTypes.string.isRequired,
  277. isBookmarked: PropTypes.bool.isRequired,
  278. isMember: PropTypes.bool.isRequired,
  279. hasAccess: PropTypes.bool.isRequired,
  280. teams: PropTypes.arrayOf(Team).isRequired,
  281. color: PropTypes.string,
  282. features: PropTypes.arrayOf(PropTypes.string),
  283. firstEvent: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
  284. isPublic: PropTypes.bool,
  285. platform: PropTypes.string,
  286. stats: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),
  287. status: PropTypes.string,
  288. });
  289. export const Release = PropTypes.shape({
  290. version: PropTypes.string.isRequired,
  291. ref: PropTypes.string,
  292. url: PropTypes.string,
  293. dateReleased: PropTypes.string,
  294. owner: User,
  295. status: PropTypes.oneOf(['archived', 'open']),
  296. });
  297. export const Repository = PropTypes.shape({
  298. id: PropTypes.string.isRequired,
  299. name: PropTypes.string,
  300. url: PropTypes.string,
  301. status: PropTypes.string,
  302. });
  303. export const NavigationObject = PropTypes.shape({
  304. name: PropTypes.string,
  305. items: PropTypes.arrayOf(
  306. PropTypes.shape({
  307. path: PropTypes.string.isRequired,
  308. title: PropTypes.string.isRequired,
  309. /**
  310. * Function that is given an object with
  311. * `access`, `features`
  312. *
  313. * Return true to show nav item, false to hide
  314. */
  315. show: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
  316. /**
  317. * Function that is given an object with
  318. * `access`, `features`, `organization`
  319. *
  320. * Return number to show in badge
  321. */
  322. badge: PropTypes.func,
  323. })
  324. ),
  325. });
  326. export const Environment = PropTypes.shape({
  327. id: PropTypes.string.isRequired,
  328. name: PropTypes.string.isRequired,
  329. });
  330. export const PageLinks = PropTypes.string;
  331. export const Plugin = {
  332. assets: PropTypes.array,
  333. author: PropTypes.shape({
  334. url: PropTypes.string,
  335. name: PropTypes.string,
  336. }),
  337. canDisable: PropTypes.bool,
  338. contexts: PropTypes.array,
  339. doc: PropTypes.string,
  340. enabled: PropTypes.bool,
  341. hasConfiguration: PropTypes.bool,
  342. id: PropTypes.string,
  343. isTestable: PropTypes.bool,
  344. metadata: PropTypes.object,
  345. name: PropTypes.string,
  346. shortName: PropTypes.string,
  347. slug: PropTypes.string,
  348. status: PropTypes.string,
  349. type: PropTypes.string,
  350. version: PropTypes.string,
  351. };
  352. export const PluginShape = PropTypes.shape(Plugin);
  353. export const PluginsStore = PropTypes.shape({
  354. loading: PropTypes.bool,
  355. plugins: PropTypes.arrayOf(PluginShape),
  356. error: PropTypes.object,
  357. pageLinks: PropTypes.any,
  358. });
  359. export const AuthProvider = PropTypes.shape({
  360. key: PropTypes.string,
  361. name: PropTypes.string,
  362. requiredFeature: PropTypes.string,
  363. disables2FA: PropTypes.bool,
  364. });
  365. export const ProjectDsn = {
  366. secret: PropTypes.string,
  367. minidump: PropTypes.string,
  368. public: PropTypes.string,
  369. csp: PropTypes.string,
  370. };
  371. export const ProjectDsnShape = PropTypes.shape(ProjectDsn);
  372. export const ProjectKey = PropTypes.shape({
  373. dsn: ProjectDsnShape,
  374. public: PropTypes.string,
  375. secret: PropTypes.string,
  376. name: PropTypes.string,
  377. rateLimit: PropTypes.shape({
  378. count: PropTypes.number,
  379. window: PropTypes.number,
  380. }),
  381. projectId: PropTypes.number,
  382. dateCreated: PropTypes.string,
  383. id: PropTypes.string,
  384. isActive: PropTypes.bool,
  385. label: PropTypes.string,
  386. relay: PropTypes.shape({
  387. url: PropTypes.string,
  388. }),
  389. cdnSdkUrl: PropTypes.string,
  390. });
  391. export const SentryApplication = PropTypes.shape({
  392. name: PropTypes.string,
  393. slug: PropTypes.string,
  394. uuid: PropTypes.string,
  395. scopes: PropTypes.arrayOf(PropTypes.string),
  396. status: PropTypes.string,
  397. });
  398. export const SavedSearch = PropTypes.shape({
  399. id: PropTypes.string,
  400. dateCreated: PropTypes.string,
  401. isDefault: PropTypes.bool,
  402. isGlobal: PropTypes.bool,
  403. isOrgCustom: PropTypes.bool,
  404. isPinned: PropTypes.bool,
  405. isPrivate: PropTypes.bool,
  406. isUserDefault: PropTypes.bool,
  407. name: PropTypes.string,
  408. projectId: PropTypes.string,
  409. query: PropTypes.string,
  410. type: PropTypes.number,
  411. });
  412. export const Incident = PropTypes.shape({
  413. id: PropTypes.string.isRequired,
  414. identifier: PropTypes.string.isRequired,
  415. organizationId: PropTypes.string.isRequired,
  416. title: PropTypes.string.isRequired,
  417. status: PropTypes.number.isRequired,
  418. query: PropTypes.string,
  419. projects: PropTypes.array.isRequired,
  420. eventStats: PropTypes.shape({
  421. data: PropTypes.arrayOf(
  422. PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.array]))
  423. ),
  424. }),
  425. totalEvents: PropTypes.number.isRequired,
  426. uniqueUsers: PropTypes.number.isRequired,
  427. isSubscribed: PropTypes.bool,
  428. dateClosed: PropTypes.string,
  429. dateStarted: PropTypes.string.isRequired,
  430. dateDetected: PropTypes.string.isRequired,
  431. dateCreated: PropTypes.string.isRequired,
  432. });
  433. export const IncidentSuspectData = PropTypes.shape({
  434. author: User,
  435. dateCreated: PropTypes.string.isRequired,
  436. id: PropTypes.string.isRequired,
  437. message: PropTypes.string,
  438. repository: Repository,
  439. score: PropTypes.number,
  440. });
  441. export const IncidentSuspect = PropTypes.shape({
  442. type: PropTypes.oneOf(['commit']).isRequired,
  443. data: IncidentSuspectData.isRequired,
  444. });
  445. export const Activity = PropTypes.shape({
  446. id: PropTypes.string.isRequired,
  447. type: PropTypes.string.isRequired,
  448. dateCreated: PropTypes.string.isRequired,
  449. user: User,
  450. data: PropTypes.shape({
  451. text: PropTypes.string,
  452. }),
  453. });
  454. export const IncidentActivity = PropTypes.shape({
  455. id: PropTypes.string.isRequired,
  456. type: PropTypes.number.isRequired,
  457. dateCreated: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])
  458. .isRequired,
  459. user: User,
  460. comment: PropTypes.string,
  461. value: PropTypes.string,
  462. previousValue: PropTypes.string,
  463. });
  464. export const GlobalSelection = PropTypes.shape({
  465. projects: PropTypes.arrayOf(PropTypes.number),
  466. environments: PropTypes.arrayOf(PropTypes.string),
  467. datetime: PropTypes.shape({
  468. period: PropTypes.string,
  469. start: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
  470. end: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
  471. utc: PropTypes.bool,
  472. }),
  473. });
  474. export const UserReport = PropTypes.shape({
  475. id: PropTypes.string.isRequired,
  476. eventID: PropTypes.string.isRequired,
  477. issue: Group,
  478. name: PropTypes.string.isRequired,
  479. event: PropTypes.shape({
  480. eventID: PropTypes.string.isRequired,
  481. id: PropTypes.string.isRequired,
  482. }),
  483. user: User.isRequired,
  484. dateCreated: PropTypes.string.isRequired,
  485. comments: PropTypes.string.isRequired,
  486. email: PropTypes.string.isRequired,
  487. });
  488. export const DebugSourceType = PropTypes.oneOf(['http', 's3', 'gcs']);
  489. // Avoiding code duplication here. This is validated strictly by the server and
  490. // form elements in the `DebugFilesSourceModal`.
  491. export const DebugSourceConfig = PropTypes.object;
  492. export const Widget = PropTypes.shape({
  493. queries: PropTypes.shape({
  494. discover: PropTypes.arrayOf(DiscoverQuery),
  495. }),
  496. title: PropTypes.node,
  497. fieldLabelMap: PropTypes.object,
  498. yAxisMapping: PropTypes.array,
  499. });
  500. export const EChartsData = PropTypes.arrayOf(
  501. PropTypes.oneOfType([
  502. // `PercentageBarChart` has a fixed dataset of 0, 25, 50, 100
  503. PropTypes.number,
  504. // e.g. ['Category', 123, 123, 123]
  505. PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
  506. // e.g. PieCharts
  507. PropTypes.shape({
  508. name: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  509. value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  510. }),
  511. // e.g. Barchart with itemStyle {itemStyle: {color: '#fff'}, value: ['category', 123]}
  512. PropTypes.shape({
  513. value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])),
  514. itemStyle: PropTypes.shape({color: PropTypes.string}),
  515. }),
  516. ])
  517. );
  518. export const EChartsSeriesUnit = PropTypes.shape({
  519. type: PropTypes.oneOf(['line', 'bar', 'pie', 'map']),
  520. showSymbol: PropTypes.bool,
  521. name: PropTypes.string,
  522. data: EChartsData,
  523. });
  524. export const EChartsSeries = PropTypes.arrayOf(EChartsSeriesUnit);
  525. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#xAxis
  526. export const EChartsAxis = PropTypes.shape({
  527. // Component ID, not specified by default. If specified, it can be used to
  528. // refer the component in option or API.
  529. id: PropTypes.string,
  530. // If show x axis.
  531. show: PropTypes.bool,
  532. gridIndex: PropTypes.number,
  533. // The index of grid which the x axis belongs to. Defaults to be in the first
  534. // grid.
  535. // The position of x axis.
  536. // The first x axis in grid defaults to be on the bottom of the grid, and the
  537. // second x axis is on the other side against the first x axis.
  538. position: PropTypes.oneOf(['top', 'bottom']),
  539. // Offset of x axis relative to default position. Useful when multiple x axis has same position value.
  540. offset: PropTypes.number,
  541. // Type of axis
  542. // Option:
  543. //
  544. // 'value' Numerical axis, suitable for continuous data.
  545. // 'category' Category axis, suitable for discrete category data. Data should
  546. // only be set via data for this type.
  547. // 'time' Time axis, suitable for continuous time series data. As
  548. // compared to value axis, it has a better formatting for time and
  549. // a different tick calculation method. For example, it decides to
  550. // use month, week, day or hour for tick based on the range of
  551. // span.
  552. // 'log' Log axis, suitable for log data.
  553. type: PropTypes.oneOf(['value', 'category', 'time', 'log']),
  554. // Name of axis.
  555. name: PropTypes.string,
  556. // Location of axis name.
  557. nameLocation: PropTypes.oneOf(['start', 'middle', 'center', 'end']),
  558. // Text style of axis name.
  559. nameTextStyle: PropTypes.object,
  560. // Gap between axis name and axis line.
  561. nameGap: PropTypes.number,
  562. // Rotation of axis name.
  563. nameRotate: PropTypes.number,
  564. // Whether axis is inversed. New option from ECharts 3.
  565. inverse: PropTypes.bool,
  566. // The boundary gap on both sides of a coordinate axis. The setting and
  567. // behavior of category axes and non-category axes are different.
  568. //
  569. // The boundaryGap of category axis can be set to either true or false.
  570. // Default value is set to be true, in which case axisTick is served only as
  571. // a separation line, and labels and data appear only in the center part of
  572. // two axis ticks, which is called band.
  573. //
  574. // For non-category axis, including time, numerical value, and log axes,
  575. // boundaryGap is an array of two values, representing the spanning range
  576. // between minimum and maximum value. The value can be set in numeric value
  577. // or relative percentage, which becomes invalid after setting min and max.
  578. // Example:
  579. boundaryGap: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
  580. // The minimun value of axis.
  581. //
  582. // It can be set to a special value 'dataMin' so that the minimum value on
  583. // this axis is set to be the minimum label.
  584. //
  585. // It will be automatically computed to make sure axis tick is equally
  586. // distributed when not set.
  587. //
  588. // In category axis, it can also be set as the ordinal number. For example,
  589. // if a catergory axis has data: ['categoryA', 'categoryB', 'categoryC'], and
  590. // the ordinal 2 represents 'categoryC'. Moreover, it can be set as negative
  591. // number, like -3.
  592. min: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  593. // The maximum value of axis.
  594. // It can be set to a special value 'dataMax' so that the minimum value on
  595. // this axis is set to be the maximum label.
  596. //
  597. // It will be automatically computed to make sure axis tick is equally
  598. // distributed when not set.
  599. //
  600. // In category axis, it can also be set as the ordinal number. For example,
  601. // if a catergory axis has data: ['categoryA', 'categoryB', 'categoryC'], and
  602. // the ordinal 2 represents 'categoryC'. Moreover, it can be set as negative
  603. // number, like -3.
  604. max: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  605. // It is available only in numerical axis, i.e., type: 'value'.
  606. //
  607. // It specifies whether not to contain zero position of axis compulsively.
  608. // When it is set to be true, the axis may not contain zero position, which
  609. // is useful in the scatter chart for both value axes.
  610. //
  611. // This configuration item is unavailable when the min and max are set.
  612. scale: PropTypes.bool,
  613. // Number of segments that the axis is split into. Note that this number
  614. // serves only as a recommendation, and the true segments may be adjusted
  615. // based on readability.
  616. //
  617. // This is unavailable for category axis.
  618. splitNumber: PropTypes.number,
  619. // Maximum gap between split lines.
  620. //
  621. // For example, in time axis (type is 'time'), it can be set to be 3600 * 24
  622. // * 1000 to make sure that the gap between axis labels is less than or equal
  623. // to one day.
  624. //
  625. // {
  626. // maxInterval: 3600 * 1000 * 24
  627. // }
  628. //
  629. // It is available only for axis of type 'value' or 'time'.
  630. minInterval: PropTypes.number,
  631. // Compulsively set segmentation interval for axis.
  632. //
  633. // As splitNumber is a recommendation value, the calculated tick may not be
  634. // the same as expected. In this case, interval should be used along with min
  635. // and max to compulsively set tickings. But in most cases, we do not suggest
  636. // using this, out automatic calculation is enough for most situations.
  637. //
  638. // This is unavailable for category axis. Timestamp should be passed for
  639. // type: 'time' axis. Logged value should be passed for type: 'log' axis.
  640. interval: PropTypes.number,
  641. // Base of logarithm, which is valid only for numeric axes with type: 'log'.
  642. logBase: PropTypes.number,
  643. // True for axis that cannot be interacted with.
  644. silent: PropTypes.bool,
  645. // Whether the labels of axis triggers and reacts to mouse events.
  646. // Parameters of event includes:
  647. // {
  648. // Component type: xAxis, yAxis, radiusAxis, angleAxis
  649. // Each of which has an attribute for index, e.g., xAxisIndex for xAxis
  650. // componentType: string,
  651. // Value on axis before being formatted.
  652. // Click on value label to trigger event.
  653. // value: '',
  654. // Name of axis.
  655. // Click on laben name to trigger event.
  656. // name: ''
  657. // }
  658. triggerEvent: PropTypes.bool,
  659. // Settings related to axis line.
  660. axisLine: PropTypes.object,
  661. // Settings related to axis tick.
  662. axisTick: PropTypes.object,
  663. // Settings related to axis label.
  664. axisLabel: PropTypes.object,
  665. // SplitLine of axis in grid area.
  666. splitLine: PropTypes.object,
  667. // Split area of axis in grid area, not shown by default.
  668. splitArea: PropTypes.object,
  669. // Category data, available in type: 'category' axis.
  670. //
  671. // If type is not specified, but axis.data is specified, the type is auto set
  672. // as 'category'.
  673. //
  674. // If type is specified as 'category', but axis.data is not specified,
  675. // axis.data will be auto collected from series.data. It brings convenience,
  676. // but we should notice that axis.data provides then value range of the
  677. // 'category' axis. If it is auto collected from series.data, Only the values
  678. // appearing in series.data can be collected. For example, if series.data is
  679. // empty, nothing will be collected.
  680. //
  681. // Example:
  682. //
  683. // // Name list of all categories
  684. // data: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  685. // // Each item could also be a specific configuration item.
  686. // // In this case, `value` is used as the category name.
  687. // data: [
  688. // {
  689. // value: 'Monday',
  690. // // Highlight Monday
  691. // textStyle: {
  692. // fontSize: 20,
  693. // color: 'red'
  694. // }
  695. // },
  696. // 'Tuesday',
  697. // 'Wednesday',
  698. // 'Thursday',
  699. // 'Friday',
  700. // 'Saturday',
  701. // 'Sunday'
  702. // ]
  703. data: EChartsData,
  704. // axisPointer settings on the axis.
  705. axisPointer: PropTypes.object,
  706. // zlevel value of all graghical elements in x axis.
  707. //
  708. // zlevel is used to make layers with Canvas. Graphical elements with
  709. // different zlevel values will be placed in different Canvases, which is a
  710. // common optimization technique. We can put those frequently changed
  711. // elements (like those with animations) to a separate zlevel. Notice that
  712. // too many Canvases will increase memory cost, and should be used carefully
  713. // on mobile phones to avoid crash.
  714. //
  715. // Canvases with bigger zlevel will be placed on Canvases with smaller
  716. // zlevel.
  717. zlevel: PropTypes.number,
  718. z: PropTypes.number,
  719. });
  720. export const EChartsTooltip = PropTypes.shape({
  721. // custom filter function
  722. filter: PropTypes.func,
  723. // If this is true, then format date
  724. isGroupedByDate: PropTypes.bool,
  725. // Truncate labels to this length
  726. truncate: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
  727. /** echarts tooltip properties **/
  728. // Whether to show the tooltip component, including tooltip floating layer
  729. // and axisPointer.
  730. show: PropTypes.bool,
  731. // Type of triggering.
  732. // Options:
  733. //
  734. // 'item' Triggered by data item, which is mainly used for charts that don't
  735. // have a category axis like scatter charts or pie charts.
  736. // 'axis' Triggered by axes, which is mainly used for charts that have
  737. // category axes, like bar charts or line charts.
  738. //
  739. // ECharts 2.x only supports axis trigger for category axis. In ECharts 3, it
  740. // is supported for all types of axes in grid or polar. Also, you may assign
  741. // axis with axisPointer.axis.
  742. // 'none' Trigger nothing.
  743. trigger: PropTypes.oneOf(['item', 'axis', 'none']),
  744. // Configuration item for axis indicator.
  745. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#tooltip.axisPointer
  746. axisPointer: PropTypes.object,
  747. // Whether to show the tooltip floating layer, whose default value is true.
  748. // It should be configurated to be false, if you only need tooltip to trigger
  749. // the event or show the axisPointer without content.
  750. showContent: PropTypes.bool,
  751. // Whether to show tooltip content all the time. By default, it will be
  752. // hidden after some time. It can be set to be true to preserve displaying.
  753. //
  754. // This attribute is newly added to ECharts 3.0.
  755. alwaysShowContent: PropTypes.bool,
  756. // Conditions to trigger tooltip.
  757. // Options:
  758. //
  759. // 'mousemove' Trigger when mouse moves.
  760. // 'click' Trigger when mouse clicks.
  761. // 'mousemove|click' Trigger when mouse clicks and moves.
  762. //
  763. // 'none' Do not triggered by 'mousemove' and 'click'. Tooltip can be
  764. // triggered and hidden manually by calling action.tooltip.showTip and
  765. // action.tooltip.hideTip. It can also be triggered by
  766. // axisPointer.handle in this case.
  767. //
  768. // This attribute is new to ECharts 3.0.
  769. triggerOn: PropTypes.oneOf(['mousemove', 'click', 'mousemove|click', 'none']),
  770. // Delay time for showing tooltip, in ms. No delay by default, and it is not
  771. // recommended to set. Only valid when triggerOn is set to be 'mousemove'.
  772. showDelay: PropTypes.number,
  773. // Delay time for hiding tooltip, in ms. It will be invalid when
  774. // alwaysShowContent is true.
  775. hideDelay: PropTypes.number,
  776. // Whether mouse is allowed to enter the floating layer of tooltip, whose
  777. // default value is false. If you need to interact in the tooltip like with
  778. // links or buttons, it can be set as true.
  779. enterable: PropTypes.bool,
  780. // Whether confine tooltip content in the view rect of chart instance.
  781. //
  782. // Useful when tooltip is cut because of 'overflow: hidden' set on outer dom
  783. // of chart instance, or because of narrow screen on mobile.
  784. confine: PropTypes.bool,
  785. // The transition duration of tooltip's animation, in seconds. When it is set
  786. // to be 0, it would move closely with the mouse.
  787. transitionDuration: PropTypes.number,
  788. // The position of the tooltip's floating layer, which would follow the
  789. // position of mouse by default.
  790. //
  791. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#tooltip.position
  792. position: PropTypes.oneOfType([PropTypes.string, PropTypes.array, PropTypes.func]),
  793. // The content formatter of tooltip's floating layer which supports string
  794. // template and callback function.
  795. //
  796. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#tooltip.formatter
  797. formatter: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
  798. // The background color of tooltip's floating layer.
  799. backgroundColor: PropTypes.string,
  800. // The border color of tooltip's floating layer.
  801. borderColor: PropTypes.string,
  802. // The border width of tooltip's floating layer.
  803. borderWidth: PropTypes.number,
  804. // The floating layer of tooltip space around content. The unit is px.
  805. // Default values for each position are 5. And they can be set to different
  806. // values with left, right, top, and bottom.
  807. //
  808. // Examples:
  809. //
  810. // // Set padding to be 5
  811. // padding: 5
  812. // // Set the top and bottom paddings to be 5, and left and right paddings to be 10
  813. // padding: [5, 10]
  814. // // Set each of the four paddings separately
  815. // padding: [
  816. // 5, // up
  817. // 10, // right
  818. // 5, // down
  819. // 10, // left
  820. // ]
  821. padding: PropTypes.number,
  822. // The text syle of tooltip's floating layer.
  823. textStyle: PropTypes.object,
  824. extraCssText: PropTypes.string,
  825. });
  826. export const EChartsGrid = PropTypes.shape({
  827. // Component ID, not specified by default. If specified, it can be used to
  828. // refer the component in option or API.
  829. id: PropTypes.string,
  830. // Whether to show the grid in rectangular coordinate.
  831. show: PropTypes.bool,
  832. // zlevel value of all graghical elements in .
  833. //
  834. // zlevel is used to make layers with Canvas. Graphical elements with
  835. // different zlevel values will be placed in different Canvases, which is a
  836. // common optimization technique. We can put those frequently changed
  837. // elements (like those with animations) to a separate zlevel. Notice that
  838. // too many Canvases will increase memory cost, and should be used carefully
  839. // on mobile phones to avoid crash.
  840. //
  841. // Canvases with bigger zlevel will be placed on Canvases with smaller zlevel.
  842. zlevel: PropTypes.number,
  843. // z value of all graghical elements in , which controls order of drawing
  844. // graphical components. Components with smaller z values may be overwritten
  845. // by those with larger z values.
  846. //
  847. // z has a lower priority to zlevel, and will not create new Canvas.
  848. z: PropTypes.number,
  849. // Distance between grid component and the left side of the container.
  850. //
  851. // left value can be instant pixel value like 20; it can also be percentage
  852. // value relative to container width like '20%'; and it can also be 'left',
  853. // 'center', or 'right'.
  854. //
  855. // If the left value is set to be 'left', 'center', or 'right', then the
  856. // component will be aligned automatically based on position.
  857. left: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  858. // Distance between grid component and the top side of the container.
  859. //
  860. // top value can be instant pixel value like 20; it can also be percentage
  861. // value relative to container width like '20%'; and it can also be 'top',
  862. // 'middle', or 'bottom'.
  863. //
  864. // If the left value is set to be 'top', 'middle', or 'bottom', then the
  865. // component will be aligned automatically based on position.
  866. top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  867. // Distance between grid component and the right side of the container.
  868. //
  869. // right value can be instant pixel value like 20; it can also be percentage
  870. // value relative to container width like '20%'.
  871. right: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  872. // Distance between grid component and the bottom side of the container.
  873. //
  874. // bottom value can be instant pixel value like 20; it can also be percentage
  875. // value relative to container width like '20%'.
  876. bottom: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  877. // Width of grid component. Adaptive by default.
  878. width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  879. // Height of grid component. Adaptive by default.
  880. height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  881. // Whether the grid region contains axis tick label of axis.
  882. //
  883. // When containLabel is false:
  884. // grid.left grid.right grid.top grid.bottom grid.width grid.height decide
  885. // the location and size of the rectangle that is made of by xAxis and yAxis.
  886. //
  887. // Setting to false will helps when multiple gris need to be align at their
  888. // axes.
  889. //
  890. // When containLabel is true:
  891. //
  892. // grid.left grid.right grid.top grid.bottom grid.width grid.height decide
  893. // the location and size of the rectangle that is not only contains axes but
  894. // also contains labels of those axes.
  895. //
  896. // Setting to true will helps when the length of axis labels is dynamic and
  897. // is hard to approximate to avoid them overflowing the container or
  898. // overlapping other components.
  899. containLabel: PropTypes.bool,
  900. // Background color of grid, which is transparent by default.
  901. //
  902. // Color can be represented in RGB, for example 'rgb(128, 128, 128)'. RGBA
  903. // can be used when you need alpha channel, for example 'rgba(128, 128, 128,
  904. // 0.5)'. You may also use hexadecimal format, for example '#ccc'.
  905. //
  906. // Attention: Works only if show: true is set.
  907. backgroundColor: PropTypes.string,
  908. // Border color of grid. Support the same color format as backgroundColor.
  909. // Attention: Works only if show: true is set.
  910. borderColor: PropTypes.string,
  911. // Border width of grid.
  912. // Attention: Works only if show: true is set.
  913. borderWidth: PropTypes.number,
  914. // Size of shadow blur. This attribute should be used along with
  915. // shadowColor,shadowOffsetX, shadowOffsetY to set shadow to component.
  916. //
  917. // For example:
  918. //
  919. // {
  920. // shadowColor: 'rgba(0, 0, 0, 0.5)',
  921. // shadowBlur: 10
  922. // }
  923. //
  924. // Attention: This property works only if show: true is configured and backgroundColor is defined other than transparent.
  925. shadowBlur: PropTypes.number,
  926. // Shadow color. Support same format as color.
  927. // Attention: This property works only if show: true configured.
  928. shadowColor: PropTypes.string,
  929. // Offset distance on the horizontal direction of shadow.
  930. // Attention: This property works only if show: true configured.
  931. shadowOffsetX: PropTypes.number,
  932. // Offset distance on the vertical direction of shadow.
  933. // Attention: This property works only if show: true configured.
  934. shadowOffsetY: PropTypes.number,
  935. tooltip: EChartsTooltip,
  936. });
  937. export const EChartsAxisPointer = PropTypes.shape({
  938. // A list of link groups
  939. link: PropTypes.arrayOf(
  940. PropTypes.shape({
  941. // Link by x-axis index.
  942. xAxisIndex: PropTypes.arrayOf(PropTypes.number),
  943. // Link by y-axis index.
  944. yAxisIndex: PropTypes.arrayOf(PropTypes.number),
  945. // Link by x-axis id.
  946. xAxisId: PropTypes.arrayOf(PropTypes.string),
  947. // Link by y-axis id.
  948. yAxisId: PropTypes.arrayOf(PropTypes.string),
  949. // Link by x-axis name.
  950. xAxisName: PropTypes.arrayOf(PropTypes.string),
  951. // Link by y-axis name.
  952. yAxisName: PropTypes.arrayOf(PropTypes.string),
  953. })
  954. ),
  955. });
  956. export const EChartsLegend = PropTypes.shape({
  957. // Show legend on chart
  958. show: PropTypes.bool,
  959. truncate: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
  960. });
  961. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#dataZoom
  962. export const EChartsDataZoom = PropTypes.arrayOf(
  963. PropTypes.oneOfType([
  964. PropTypes.shape({
  965. type: PropTypes.oneOf(['inside']),
  966. }),
  967. PropTypes.shape({
  968. type: PropTypes.oneOf(['slider']),
  969. }),
  970. ])
  971. );
  972. // See https://ecomfe.github.io/echarts-doc/public/en/option.html#toolbox
  973. export const EChartsToolBox = PropTypes.shape({
  974. // Component ID, not specified by default. If specified, it can be used to
  975. // refer the component in option or API.
  976. id: PropTypes.string,
  977. // Whether to show toolbox component.
  978. show: PropTypes.bool,
  979. // The layout orientation of toolbox's icon.
  980. orient: PropTypes.oneOf(['horizontal', 'vertical']),
  981. // The size of toolbox's icon.
  982. itemSize: PropTypes.number,
  983. // The gap between each icon of toolbox. It is horizontal gap in horizontal
  984. // layout, while vertical gap in vertical layout.
  985. itemGap: PropTypes.number,
  986. // Whether to show the title of each tool icon when mouse hovers.
  987. showTitle: PropTypes.bool,
  988. // The configuration item for each tool.
  989. //
  990. // Besides the tools we provide, user-defined toolbox is also supported.
  991. //
  992. // Notes: User-defined tool name could only start with my, like myTool1 and
  993. // myTool2 in the below example:
  994. //
  995. // {
  996. // toolbox: {
  997. // feature: {
  998. // myTool1: {
  999. // show: true,
  1000. // title: 'custom extension method 1',
  1001. // icon: 'path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891',
  1002. // onclick: function (){
  1003. // alert('myToolHandler1')
  1004. // }
  1005. // },
  1006. // myTool2: {
  1007. // show: true,
  1008. // title: 'custom extension method',
  1009. // icon: 'image://http://echarts.baidu.com/images/favicon.png',
  1010. // onclick: function (){
  1011. // alert('myToolHandler2')
  1012. // }
  1013. // }
  1014. // }
  1015. // }
  1016. // }
  1017. feature: PropTypes.object,
  1018. // The style setting of Shared icon.
  1019. iconStyle: PropTypes.object,
  1020. // zlevel value of all graghical elements in .
  1021. //
  1022. // zlevel is used to make layers with Canvas. Graphical elements with
  1023. // different zlevel values will be placed in different Canvases, which is a
  1024. // common optimization technique. We can put those frequently changed
  1025. // elements (like those with animations) to a separate zlevel. Notice that
  1026. // too many Canvases will increase memory cost, and should be used carefully
  1027. // on mobile phones to avoid crash.
  1028. //
  1029. // Canvases with bigger zlevel will be placed on Canvases with smaller
  1030. // zlevel.
  1031. zlevel: PropTypes.number,
  1032. // z value of all graghical elements in , which controls order of drawing
  1033. // graphical components. Components with smaller z values may be overwritten
  1034. // by those with larger z values.
  1035. //
  1036. // z has a lower priority to zlevel, and will not create new Canvas.
  1037. z: PropTypes.number,
  1038. // Distance between toolbox component and the left side of the container.
  1039. //
  1040. // left value can be instant pixel value like 20; it can also be percentage
  1041. // value relative to container width like '20%'; and it can also be 'left',
  1042. // 'center', or 'right'.
  1043. //
  1044. // If the left value is set to be 'left', 'center', or 'right', then the
  1045. // component will be aligned automatically based on position.
  1046. left: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1047. // Distance between toolbox component and the top side of the container.
  1048. //
  1049. // top value can be instant pixel value like 20; it can also be percentage
  1050. // value relative to container width like '20%'; and it can also be 'top',
  1051. // 'middle', or 'bottom'.
  1052. //
  1053. // If the left value is set to be 'top', 'middle', or 'bottom', then the
  1054. // component will be aligned automatically based on position.
  1055. top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1056. // Distance between toolbox component and the right side of the container.
  1057. //
  1058. // right value can be instant pixel value like 20; it can also be percentage
  1059. // value relative to container width like '20%'.
  1060. //
  1061. // Adaptive by default.
  1062. right: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1063. // Distance between toolbox component and the bottom side of the container.
  1064. //
  1065. // bottom value can be instant pixel value like 20; it can also be percentage
  1066. // value relative to container width like '20%'.
  1067. //
  1068. // Adaptive by default.
  1069. bottom: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1070. // Width of toolbox component. Adaptive by default.
  1071. width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1072. // Height of toolbox component. Adaptive by default.
  1073. height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1074. });
  1075. export const EchartsGraphic = PropTypes.shape({
  1076. id: PropTypes.string,
  1077. // These are a bit complex to add typing for
  1078. elements: PropTypes.arrayOf(PropTypes.object),
  1079. });
  1080. export const SeriesUnit = PropTypes.shape({
  1081. seriesName: PropTypes.string,
  1082. data: PropTypes.arrayOf(
  1083. PropTypes.shape({
  1084. value: PropTypes.number,
  1085. // Number because datetime
  1086. name: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
  1087. })
  1088. ),
  1089. });
  1090. export const Series = PropTypes.arrayOf(SeriesUnit);
  1091. const SentryTypes = {
  1092. AnyModel: PropTypes.shape({
  1093. id: PropTypes.string.isRequired,
  1094. }),
  1095. Actor,
  1096. AuthConfig,
  1097. Activity,
  1098. AuthProvider,
  1099. Config,
  1100. DebugSourceConfig,
  1101. DebugSourceType,
  1102. Deploy,
  1103. DiscoverQuery,
  1104. DiscoverSavedQuery,
  1105. DiscoverResults,
  1106. Environment,
  1107. Event,
  1108. EventAttachment,
  1109. EventView,
  1110. Organization: PropTypes.shape({
  1111. id: PropTypes.string.isRequired,
  1112. }),
  1113. GlobalSelection,
  1114. Group,
  1115. Incident,
  1116. IncidentActivity,
  1117. IncidentSuspect,
  1118. IncidentSuspectData,
  1119. Tag,
  1120. Monitor,
  1121. PageLinks,
  1122. Project,
  1123. Series,
  1124. SeriesUnit,
  1125. TagKey: PropTypes.shape({
  1126. key: PropTypes.string.isRequired,
  1127. }),
  1128. Team,
  1129. NavigationObject,
  1130. Member,
  1131. Plugin,
  1132. PluginShape,
  1133. PluginsStore,
  1134. ProjectKey,
  1135. Release,
  1136. Repository,
  1137. User,
  1138. UserReport,
  1139. SavedSearch,
  1140. SentryApplication,
  1141. Widget,
  1142. // echarts prop types
  1143. EChartsSeries,
  1144. EChartsSeriesUnit,
  1145. EChartsXAxis: EChartsAxis,
  1146. EChartsYAxis: EChartsAxis,
  1147. EChartsTooltip,
  1148. EChartsGrid,
  1149. EChartsAxisPointer,
  1150. EChartsLegend,
  1151. EChartsDataZoom,
  1152. EChartsToolBox,
  1153. EchartsGraphic,
  1154. };
  1155. export default SentryTypes;