diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2018-12-19 15:28:21 +0100 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-01-18 20:21:02 +0100 |
commit | 5c110414621fcfb2db1083f76ff09c4b6364757f (patch) | |
tree | e4093ebbf1a8402f4e60c4c1eb8839b2a70a5f4a /server/sonar-web/src/main/js/apps/organizations | |
parent | 0d3ba8c8aa4c29e46e9a687f42590ffda3fb348f (diff) | |
download | sonarqube-5c110414621fcfb2db1083f76ff09c4b6364757f.tar.gz sonarqube-5c110414621fcfb2db1083f76ff09c4b6364757f.zip |
SONARCLOUD-329 Create downgrade reason page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/organizations')
-rw-r--r-- | server/sonar-web/src/main/js/apps/organizations/actions.ts | 1 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx | 23 |
2 files changed, 20 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/organizations/actions.ts b/server/sonar-web/src/main/js/apps/organizations/actions.ts index 0bd460161e2..cda9b50e9e4 100644 --- a/server/sonar-web/src/main/js/apps/organizations/actions.ts +++ b/server/sonar-web/src/main/js/apps/organizations/actions.ts @@ -47,6 +47,5 @@ export const updateOrganization = (key: string, changes: T.OrganizationBase) => export const deleteOrganization = (key: string) => (dispatch: Dispatch<any>) => { return api.deleteOrganization(key).then(() => { dispatch(actions.deleteOrganization(key)); - dispatch(addGlobalSuccessMessage(translate('organization.deleted'))); }); }; diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx index 2df8f24417b..6954e3bf7e7 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx @@ -29,6 +29,7 @@ import { getOrganizationBilling } from '../../../api/organizations'; import { isSonarCloud } from '../../../helpers/system'; import { Alert } from '../../../components/ui/Alert'; import { withRouter, Router } from '../../../components/hoc/withRouter'; +import addGlobalSuccessMessage from '../../../app/utils/addGlobalSuccessMessage'; interface DispatchToProps { deleteOrganization: (key: string) => Promise<void>; @@ -78,7 +79,7 @@ export class OrganizationDelete extends React.PureComponent<Props, State> { } }; - handleInput = (event: React.SyntheticEvent<HTMLInputElement>) => { + handleInput = (event: React.ChangeEvent<HTMLInputElement>) => { this.setState({ verify: event.currentTarget.value }); }; @@ -87,8 +88,24 @@ export class OrganizationDelete extends React.PureComponent<Props, State> { }; onDelete = () => { - return this.props.deleteOrganization(this.props.organization.key).then(() => { - this.props.router.replace('/'); + const { organization } = this.props; + return this.props.deleteOrganization(organization.key).then(() => { + if (this.state.hasPaidPlan) { + this.props.router.replace({ + pathname: '/feedback/downgrade', + state: { + confirmationMessage: translateWithParameters( + 'organization.deleted_x', + organization.name + ), + organization, + title: translate('billing.downgrade.reason.title_deleted') + } + }); + } else { + addGlobalSuccessMessage(translate('organization.deleted')); + this.props.router.replace('/'); + } }); }; |