]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20915 Migrate project deletion to the new UI
authorJeremy Davis <jeremy.davis@sonarsource.com>
Mon, 30 Oct 2023 16:02:55 +0000 (17:02 +0100)
committersonartech <sonartech@sonarsource.com>
Tue, 31 Oct 2023 20:02:42 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/components/GlobalContainer.tsx
server/sonar-web/src/main/js/apps/projectDeletion/App.tsx
server/sonar-web/src/main/js/apps/projectDeletion/Form.tsx
server/sonar-web/src/main/js/apps/projectDeletion/Header.tsx

index 3966b35b46a1816826b24e1b61b974da57746565..dccd65c13045c88b8fec02c22f48bb669b99f3e2 100644 (file)
@@ -60,6 +60,7 @@ const TEMP_PAGELIST_WITH_NEW_BACKGROUND_WHITE = [
   '/project/baseline',
   '/project/branches',
   '/project/key',
+  '/project/deletion',
 ];
 
 export default function GlobalContainer() {
index 24a6d8c50a641f28691740125b44b8dce1d02cd9..e7cb678d01f8afc3981184f9cc6d8b2a454bc519 100644 (file)
@@ -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 (
-    <div className="page page-limited">
+    <CenteredLayout>
       <Helmet defer={false} title={translate('deletion.page')} />
-      <Header component={component} />
-      <Form component={component} />
-    </div>
+      <PageContentFontWrapper className="sw-my-8 sw-body-sm">
+        <Header component={component} />
+        <Form component={component} />
+      </PageContentFontWrapper>
+    </CenteredLayout>
   );
 }
index 5a8b33da38a32f1ee6bd163e9c592713ef869279..484b7fe5ea3a28930fe0fc12a3861377e3206451 100644 (file)
  * 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<Props> {
         onConfirm={this.handleDelete}
       >
         {({ onClick }) => (
-          <Button className="button-red" id="delete-project" onClick={onClick}>
+          <DangerButtonPrimary id="delete-project" onClick={onClick}>
             {translate('delete')}
-          </Button>
+          </DangerButtonPrimary>
         )}
       </ConfirmButton>
     );
index a309495370b2d80699728c199a0a7c249faefe17..6d38d4d71442c23412069e06aea08313830b405b 100644 (file)
  * 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<Component, 'qualifier'>;
 }
 
-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<Props>) {
+  const { qualifier } = props.component;
+
   return (
-    <header className="page-header">
-      <h1 className="page-title">{translate('deletion.page')}</h1>
-      <div className="page-description">{description}</div>
+    <header className="sw-mt-8 sw-mb-4">
+      <Title className="sw-mb-4">{translate('deletion.page')}</Title>
+      <p className="sw-mb-2">{getDescription(qualifier)}</p>
     </header>
   );
 }