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('Name'),
  17. placeholder: 'e.g. api-team',
  18. help: t('A unique ID used to identify the team'),
  19. disabled: ({access}) => !access.has('team:write'),
  20. transformInput: slugify,
  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('The organization role that team members will have access to'),
  41. disabled: ({access, idpProvisioned}) =>
  42. !access.has('org:admin') || idpProvisioned,
  43. visible: ({hasOrgRoleFlag}) => hasOrgRoleFlag,
  44. saveOnBlur: false,
  45. saveMessageAlertType: 'info',
  46. saveMessage: t(
  47. 'You are giving all team members the permissions of this organization role'
  48. ),
  49. },
  50. ],
  51. },
  52. ];
  53. export default formGroups;