teamSettingsFields.tsx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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(
  41. 'Organization owners can bulk assign an org-role for all the members in this team'
  42. ),
  43. disabled: ({access, idpProvisioned}) =>
  44. !access.has('org:admin') || idpProvisioned,
  45. visible: ({hasOrgRoleFlag}) => hasOrgRoleFlag,
  46. saveOnBlur: false,
  47. saveMessageAlertType: 'info',
  48. saveMessage: t(
  49. 'You are giving all team members the permissions of this organization role'
  50. ),
  51. },
  52. ],
  53. },
  54. ];
  55. export default formGroups;