]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19453 Component cleanup
authorPhilippe Perrin <philippe.perrin@sonarsource.com>
Mon, 12 Jun 2023 10:03:50 +0000 (12:03 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 14 Jun 2023 09:51:06 +0000 (09:51 +0000)
server/sonar-web/src/main/js/apps/create/project/CreateProjectPage.tsx
server/sonar-web/src/main/js/apps/create/project/components/InstanceNewCodeDefinitionComplianceWarning.tsx [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index d2f52c438a66a2c349033a2b97fc088709001a61..ab76cc0a0ef4a394ec6904b9fccc77ec6f23c9ec 100644 (file)
@@ -30,6 +30,7 @@ import DocLink from '../../../components/common/DocLink';
 import { ButtonLink, SubmitButton } from '../../../components/controls/buttons';
 import { Location, Router, withRouter } from '../../../components/hoc/withRouter';
 import NewCodeDefinitionSelector from '../../../components/new-code-definition/NewCodeDefinitionSelector';
+import DeferredSpinner from '../../../components/ui/DeferredSpinner';
 import { translate } from '../../../helpers/l10n';
 import { getProjectUrl } from '../../../helpers/urls';
 import { AlmKeys, AlmSettingsInstance } from '../../../types/alm-settings';
@@ -134,10 +135,6 @@ export class CreateProjectPage extends React.PureComponent<CreateProjectPageProp
     this.setState({ creatingAlmDefinition: alm });
   };
 
-  handleProjectCreate = (projectKey: string) => {
-    this.props.router.push(getProjectUrl(projectKey));
-  };
-
   handleProjectCreation = async () => {
     const { selectedNcd } = this.state;
     if (this.createProjectFnRef && selectedNcd) {
@@ -294,7 +291,7 @@ export class CreateProjectPage extends React.PureComponent<CreateProjectPageProp
 
   renderNcdSelection() {
     const { appState } = this.props;
-    const { selectedNcd } = this.state;
+    const { selectedNcd, submitting } = this.state;
 
     return (
       <div id="project-ncd-selection">
@@ -331,8 +328,12 @@ export class CreateProjectPage extends React.PureComponent<CreateProjectPageProp
 
         <div className="sw-flex sw-flex-row sw-gap-2 sw-mt-4">
           <ButtonLink onClick={this.handleGoBack}>{translate('back')}</ButtonLink>
-          <SubmitButton onClick={this.handleProjectCreation} disabled={!selectedNcd?.isCompliant}>
+          <SubmitButton
+            onClick={this.handleProjectCreation}
+            disabled={!selectedNcd?.isCompliant || submitting}
+          >
             {translate('onboarding.create_project.new_code_definition.create_project')}
+            <DeferredSpinner className="spacer-left" loading={submitting} />
           </SubmitButton>
         </div>
       </div>
diff --git a/server/sonar-web/src/main/js/apps/create/project/components/InstanceNewCodeDefinitionComplianceWarning.tsx b/server/sonar-web/src/main/js/apps/create/project/components/InstanceNewCodeDefinitionComplianceWarning.tsx
deleted file mode 100644 (file)
index 7e0f2cc..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import * as React from 'react';
-import { FormattedMessage } from 'react-intl';
-import { getNewCodePeriod } from '../../../../api/newCodePeriod';
-import { AppStateContextProviderProps } from '../../../../app/components/app-state/AppStateContextProvider';
-import withAppStateContext from '../../../../app/components/app-state/withAppStateContext';
-import DocLink from '../../../../components/common/DocLink';
-import Link from '../../../../components/common/Link';
-import { Alert } from '../../../../components/ui/Alert';
-import { translate } from '../../../../helpers/l10n';
-import { isNewCodeDefinitionCompliant } from '../../../../helpers/periods';
-
-export type InstanceNewCodeDefinitionComplianceWarningProps = AppStateContextProviderProps;
-
-export function InstanceNewCodeDefinitionComplianceWarning({
-  appState: { canAdmin },
-}: InstanceNewCodeDefinitionComplianceWarningProps) {
-  const [isCompliant, setIsCompliant] = React.useState(true);
-
-  React.useEffect(() => {
-    async function fetchInstanceNCDOptionCompliance() {
-      const newCodeDefinition = await getNewCodePeriod();
-      setIsCompliant(isNewCodeDefinitionCompliant(newCodeDefinition));
-    }
-
-    fetchInstanceNCDOptionCompliance();
-  }, []);
-
-  if (isCompliant) {
-    return null;
-  }
-
-  return (
-    <Alert className="huge-spacer-bottom sw-max-w-[700px]" variant="warning">
-      <p className="sw-mb-2 sw-font-bold">
-        {translate('onboarding.create_project.new_code_option.warning.title')}
-      </p>
-      <p className="sw-mb-2">
-        <FormattedMessage
-          id="onboarding.create_project.new_code_option.warning.explanation"
-          defaultMessage={translate(
-            'onboarding.create_project.new_code_option.warning.explanation'
-          )}
-          values={{
-            action: canAdmin ? (
-              <FormattedMessage
-                id="onboarding.create_project.new_code_option.warning.explanation.action.admin"
-                defaultMessage={translate(
-                  'onboarding.create_project.new_code_option.warning.explanation.action.admin'
-                )}
-                values={{
-                  link: (
-                    <Link to="/admin/settings?category=new_code_period">
-                      {translate(
-                        'onboarding.create_project.new_code_option.warning.explanation.action.admin.link'
-                      )}
-                    </Link>
-                  ),
-                }}
-              />
-            ) : (
-              translate('onboarding.create_project.new_code_option.warning.explanation.action')
-            ),
-          }}
-        />
-      </p>
-      <p>
-        {translate('learn_more')}:&nbsp;
-        <DocLink to="/project-administration/defining-new-code/">
-          {translate('onboarding.create_project.new_code_option.warning.learn_more.link')}
-        </DocLink>
-      </p>
-    </Alert>
-  );
-}
-
-export default withAppStateContext(InstanceNewCodeDefinitionComplianceWarning);
index 7bcc51b0e611e2e97085336030a822682dd950b6..80957df45f41f1e40d2f591412b2b87419bdd911 100644 (file)
@@ -3920,13 +3920,6 @@ onboarding.create_project.new_code_definition.description2=Learn more: {link}
 onboarding.create_project.new_code_definition.description2.link=Defining New Code
 onboarding.create_project.new_code_definition.create_project=Create project
 
-onboarding.create_project.new_code_option.warning.title=Your global new code definition is not compliant with the Clean as You Code methodology
-onboarding.create_project.new_code_option.warning.explanation=New projects use the global new code definition by default. {action} so that new projects benefit from the Clean as You Code methodology by default.
-onboarding.create_project.new_code_option.warning.explanation.action=We recommend that you ask an administrator of this SonarQube instance to update the global new code definition
-onboarding.create_project.new_code_option.warning.explanation.action.admin=We recommend that you update the global new code definition under {link}
-onboarding.create_project.new_code_option.warning.explanation.action.admin.link=General Settings - New Code
-onboarding.create_project.new_code_option.warning.learn_more.link=Defining New Code
-
 onboarding.token.header=Provide a token
 onboarding.token.text=The token is used to identify you when an analysis is performed. If it has been compromised, you can revoke it at any point in time in your {link}.
 onboarding.token.text.PROJECT_ANALYSIS_TOKEN=The project token is used to identify you when an analysis is performed. If it has been compromised, you can revoke it at any point in time in your {link}.