From: Jeremy Davis Date: Mon, 30 Oct 2023 16:02:55 +0000 (+0100) Subject: SONAR-20915 Migrate project deletion to the new UI X-Git-Tag: 10.3.0.82913~66 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3052839387044d5acba1ef9259fee45f2d27330b;p=sonarqube.git SONAR-20915 Migrate project deletion to the new UI --- diff --git a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx index 3966b35b46a..dccd65c1304 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx @@ -60,6 +60,7 @@ const TEMP_PAGELIST_WITH_NEW_BACKGROUND_WHITE = [ '/project/baseline', '/project/branches', '/project/key', + '/project/deletion', ]; export default function GlobalContainer() { diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx index 24a6d8c50a6..e7cb678d01f 100644 --- a/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx +++ b/server/sonar-web/src/main/js/apps/projectDeletion/App.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { CenteredLayout, PageContentFontWrapper } from 'design-system/lib'; import * as React from 'react'; import { Helmet } from 'react-helmet-async'; import { ComponentContext } from '../../app/components/componentContext/ComponentContext'; @@ -32,10 +33,12 @@ export default function App() { } return ( -
+ -
-
-
+ +
+ + + ); } diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx index 5a8b33da38a..484b7fe5ea3 100644 --- a/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx +++ b/server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx @@ -17,11 +17,11 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { DangerButtonPrimary } from 'design-system/lib'; import * as React from 'react'; import { deleteApplication } from '../../api/application'; import { deletePortfolio, deleteProject } from '../../api/project-management'; import ConfirmButton from '../../components/controls/ConfirmButton'; -import { Button } from '../../components/controls/buttons'; import { Router, withRouter } from '../../components/hoc/withRouter'; import { addGlobalSuccessMessage } from '../../helpers/globalMessages'; import { translate, translateWithParameters } from '../../helpers/l10n'; @@ -67,9 +67,9 @@ export class Form extends React.PureComponent { onConfirm={this.handleDelete} > {({ onClick }) => ( - + )} ); diff --git a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx index a309495370b..6d38d4d7144 100644 --- a/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx +++ b/server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx @@ -17,29 +17,33 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { Title } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; +import { isApplication, isPortfolioLike } from '../../types/component'; import { Component } from '../../types/types'; interface Props { component: Pick; } -export default function Header(props: Props) { - const { qualifier } = props.component; - let description: string; - if (['VW', 'SVW'].includes(qualifier)) { - description = translate('portfolio_deletion.page.description'); - } else if (qualifier === 'APP') { - description = translate('application_deletion.page.description'); - } else { - description = translate('project_deletion.page.description'); +function getDescription(qualifier: string) { + if (isPortfolioLike(qualifier)) { + return translate('portfolio_deletion.page.description'); + } else if (isApplication(qualifier)) { + return translate('application_deletion.page.description'); } + return translate('project_deletion.page.description'); +} + +export default function Header(props: Readonly) { + const { qualifier } = props.component; + return ( -
-

{translate('deletion.page')}

-
{description}
+
+ {translate('deletion.page')} +

{getDescription(qualifier)}

); }