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';
this.setState({ creatingAlmDefinition: alm });
};
- handleProjectCreate = (projectKey: string) => {
- this.props.router.push(getProjectUrl(projectKey));
- };
-
handleProjectCreation = async () => {
const { selectedNcd } = this.state;
if (this.createProjectFnRef && selectedNcd) {
renderNcdSelection() {
const { appState } = this.props;
- const { selectedNcd } = this.state;
+ const { selectedNcd, submitting } = this.state;
return (
<div id="project-ncd-selection">
<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>
+++ /dev/null
-/*
- * 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')}:
- <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);
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}.