teamSettingsFields.tsx 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {JsonFormObject} from 'sentry/components/forms/types';
  2. import {t} from 'sentry/locale';
  3. import {MemberRole} from 'sentry/types';
  4. import slugify from 'sentry/utils/slugify';
  5. // Export route to make these forms searchable by label/help
  6. export const route = '/settings/:orgId/teams/:teamId/settings/';
  7. const formGroups: JsonFormObject[] = [
  8. {
  9. // Form "section"/"panel"
  10. title: 'Team Settings',
  11. fields: [
  12. {
  13. name: 'slug',
  14. type: 'string',
  15. required: true,
  16. label: t('Team Slug'),
  17. placeholder: 'e.g. api-team',
  18. help: t('A unique ID used to identify the team'),
  19. transformInput: slugify,
  20. disabled: ({hasTeamWrite}) => !hasTeamWrite,
  21. saveOnBlur: false,
  22. saveMessageAlertType: 'info',
  23. saveMessage: t('You will be redirected to the new team slug after saving'),
  24. },
  25. ],
  26. },
  27. {
  28. title: 'Team Organization Role',
  29. fields: [
  30. {
  31. name: 'orgRole',
  32. type: 'select',
  33. choices: ({orgRoleList}) => {
  34. const choices = orgRoleList.map((r: MemberRole) => [r.id, r.name]) ?? [];
  35. choices.unshift(['', 'None']);
  36. return choices;
  37. },
  38. required: false,
  39. label: t('Organization Role'),
  40. help: t(
  41. 'Organization owners can bulk assign an org-role for all the members in this team'
  42. ),
  43. disabled: ({hasOrgAdmin, idpProvisioned}) => !hasOrgAdmin || idpProvisioned,
  44. visible: ({hasOrgRoleFlag}) => hasOrgRoleFlag,
  45. saveOnBlur: false,
  46. saveMessageAlertType: 'info',
  47. saveMessage: t(
  48. 'You are giving all team members the permissions of this organization role'
  49. ),
  50. },
  51. ],
  52. },
  53. ];
  54. export default formGroups;