phabricator.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. function PhabricatorPlugin(params) {
  2. return {
  3. status: 'unknown',
  4. description:
  5. 'Integrate Phabricator issue tracking by linking a user account to a project.',
  6. isTestable: false,
  7. hasConfiguration: true,
  8. shortName: 'Phabricator',
  9. id: 'phabricator',
  10. assets: [],
  11. name: 'Phabricator',
  12. author: {
  13. url: 'https://github.com/getsentry/sentry-plugins',
  14. name: 'Sentry Team',
  15. },
  16. contexts: [],
  17. doc: '',
  18. resourceLinks: [
  19. {
  20. url: 'https://github.com/getsentry/sentry-plugins/issues',
  21. title: 'Bug Tracker',
  22. },
  23. {
  24. url: 'https://github.com/getsentry/sentry-plugins',
  25. title: 'Source',
  26. },
  27. ],
  28. allowed_actions: ['create', 'link', 'unlink'],
  29. enabled: true,
  30. slug: 'phabricator',
  31. version: '9.1.0.dev0',
  32. canDisable: true,
  33. type: 'issue-tracking',
  34. metadata: {},
  35. };
  36. }
  37. function PhabricatorCreate(params) {
  38. return [
  39. {
  40. default: 'ApiException: Authentication failed, token expired!',
  41. type: 'text',
  42. name: 'title',
  43. label: 'Title',
  44. },
  45. {
  46. default:
  47. 'http://dev.getsentry.net:8000/sentry/earth/issues/10/\n\n```\nApiException: Authentication failed, token expired!\n at io.sentry.example.ApiRequest.perform(ApiRequest.java:8)\n at io.sentry.example.Sidebar.fetch(Sidebar.java:5)\n at io.sentry.example.Application.home(Application.java:102)\n...\n(52 additional frame(s) were not displayed)\n\nThis is an example Java exception\n```',
  48. type: 'textarea',
  49. name: 'description',
  50. label: 'Description',
  51. },
  52. {
  53. multi: true,
  54. name: 'tags',
  55. type: 'select',
  56. required: false,
  57. label: 'Tags',
  58. has_autocomplete: true,
  59. placeholder: 'Start typing to search for a project',
  60. },
  61. {
  62. name: 'assignee',
  63. default: '',
  64. type: 'select',
  65. required: false,
  66. label: 'Assignee',
  67. has_autocomplete: true,
  68. placeholder: 'Start typing to search for an assignee',
  69. },
  70. ];
  71. }
  72. const DEFAULT_AUTOCOMPLETE_ASSIGNEE = {
  73. text: 'David Cramer (zeeg)',
  74. id: 'PHID-USER-53avnyn5r6z6daqjfwdo',
  75. };
  76. const DEFAULT_AUTOCOMPLETE_TAG1 = {text: 'Bar', id: 'PHID-PROJ-biz3qujawd2dfknvhpqv'};
  77. const DEFAULT_AUTOCOMPLETE_TAG2 = {text: 'Foo', id: 'PHID-PROJ-3dfrsmwmavdv4gbg4fxd'};
  78. function PhabricatorAutocomplete(type = 'project', values = null) {
  79. if (values) return {[type]: values};
  80. if (type === 'assignee') values = [DEFAULT_AUTOCOMPLETE_ASSIGNEE];
  81. if (type === 'tags') values = [DEFAULT_AUTOCOMPLETE_TAG1, DEFAULT_AUTOCOMPLETE_TAG2];
  82. return {[type]: values};
  83. }
  84. export {PhabricatorPlugin, PhabricatorCreate, PhabricatorAutocomplete};