Browse Source

feat(ui): Warn users when removing last team from project

Jess MacQueen 7 years ago
parent
commit
2e8c428de9

+ 11 - 1
src/sentry/static/sentry/app/views/settings/project/projectTeams.jsx

@@ -28,6 +28,7 @@ const TeamRow = createReactClass({
     team: PropTypes.object.isRequired,
     access: PropTypes.object.isRequired,
     onRemove: PropTypes.func.isRequired,
+    teamCount: PropTypes.number.isRequired,
   },
 
   mixins: [ApiMixin],
@@ -79,7 +80,15 @@ const TeamRow = createReactClass({
         {this.props.access.has('project:write') && (
           <Box pl={2}>
             <Confirm
-              message={t('Are you sure you want to remove this team?')}
+              message={
+                this.props.teamCount === 1
+                  ? t(
+                      'This is the last team with access to this project. Removing it will mean ' +
+                        'only owners and managers will be able to access the project pages. Are ' +
+                        'you sure you want to remove this team?'
+                    )
+                  : t('Are you sure you want to remove this team?')
+              }
               onConfirm={this.handleRemove}
               disabled={this.state.loading}
             >
@@ -166,6 +175,7 @@ class ProjectTeams extends AsyncView {
               projectId={projectId}
               team={team}
               onRemove={this.handleRemovedTeam.bind(this, team)}
+              teamCount={this.state.projectTeams.length}
             />
           );
         })}

+ 1 - 0
tests/js/spec/views/__snapshots__/projectTeamSettings.spec.jsx.snap

@@ -72,6 +72,7 @@ exports[`ProjectTeamsSettings render() renders 1`] = `
               "slug": "team-slug",
             }
           }
+          teamCount={1}
         />
       </PanelBody>
     </Panel>