aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorAmbroise C <ambroise.christea@sonarsource.com>2024-04-10 18:57:32 +0200
committersonartech <sonartech@sonarsource.com>2024-04-11 20:02:47 +0000
commitdf4b2cacab25e01c608dbf865f57f8ef8868f984 (patch)
tree1762432d82e54a565d7db265e27218f12c66d4e2 /server/sonar-web/src/main/js
parentba07204fd4e62749f7de8e6106036aee7acc113b (diff)
downloadsonarqube-df4b2cacab25e01c608dbf865f57f8ef8868f984.tar.gz
sonarqube-df4b2cacab25e01c608dbf865f57f8ef8868f984.zip
SONAR-21822 Fix GitHub scan onboarding tutorial for monorepo
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx4
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/components/DefaultProjectKey.tsx10
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx60
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/github-action/commands/MonorepoDocLinkFallback.tsx3
4 files changed, 33 insertions, 44 deletions
diff --git a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
index 285dc145251..d701224a491 100644
--- a/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/__tests__/TutorialSelection-it.tsx
@@ -70,7 +70,9 @@ beforeEach(() => {
const ui = {
loading: byText('loading'),
noScanRights: byText('onboarding.tutorial.no_scan_rights'),
- monoRepoSecretInfo: byText('onboarding.tutorial.with.github_action.create_secret.monorepo_info'),
+ monoRepoSecretInfo: byText(
+ 'onboarding.tutorial.with.github_action.create_secret.monorepo_project_level_token_info.link',
+ ),
monoRepoYamlDocLink: byRole('link', {
name: 'onboarding.tutorial.with.github_action.monorepo.see_yaml_instructions',
}),
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/DefaultProjectKey.tsx b/server/sonar-web/src/main/js/components/tutorials/components/DefaultProjectKey.tsx
index c059bc3de82..b8e4cb95a09 100644
--- a/server/sonar-web/src/main/js/components/tutorials/components/DefaultProjectKey.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/components/DefaultProjectKey.tsx
@@ -17,8 +17,9 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { CodeSnippet, NumberedListItem } from 'design-system';
+import { CodeSnippet, FlagMessage, NumberedListItem } from 'design-system';
import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
import { Component } from '../../../types/types';
import SentenceWithFilename from './SentenceWithFilename';
@@ -33,12 +34,17 @@ export default function DefaultProjectKey(props: DefaultProjectKeyProps) {
const { component, monorepo } = props;
return (
- <NumberedListItem>
+ <NumberedListItem className="sw-mb-6">
<SentenceWithFilename
filename="sonar-project.properties"
translationKey={`onboarding.tutorial.other.project_key${monorepo ? '.monorepo' : ''}`}
/>
<CodeSnippet snippet={sonarProjectSnippet(component.key)} isOneLine className="sw-p-6" />
+ <div>
+ <FlagMessage variant="info">
+ <FormattedMessage id="onboarding.tutorial.other.project_key.monorepo.info" />
+ </FlagMessage>
+ </div>
</NumberedListItem>
);
}
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
index 385105e5179..26fb3f005d9 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/SecretStep.tsx
@@ -28,10 +28,8 @@ import {
import * as React from 'react';
import { FormattedMessage } from 'react-intl';
import { translate } from '../../../helpers/l10n';
-import { hasGlobalPermission } from '../../../helpers/users';
import { useProjectBindingQuery } from '../../../queries/devops-integration';
import { AlmSettingsInstance } from '../../../types/alm-settings';
-import { Permissions } from '../../../types/permissions';
import { Component } from '../../../types/types';
import { LoggedInUser } from '../../../types/users';
import { InlineSnippet } from '../components/InlineSnippet';
@@ -86,38 +84,6 @@ export default function SecretStep(props: SecretStepProps) {
/>
<InlineSnippet snippet="SONAR_TOKEN" className="sw-ml-1" />
<ClipboardIconButton copyValue="SONAR_TOKEN" className="sw-ml-2 sw-align-sub" />
- {monorepo && (
- <FlagMessage variant="info" className="sw-block sw-w-fit sw-mt-4">
- <FormattedMessage
- defaultMessage={translate(
- 'onboarding.tutorial.with.github_action.create_secret.monorepo_sonar_token',
- )}
- id="onboarding.tutorial.with.github_action.create_secret.monorepo_sonar_token"
- values={{
- token_name: <InlineSnippet snippet="SONAR_TOKEN_1" className="sw-ml-1" />,
- global_secret: hasGlobalPermission(currentUser, Permissions.Scan) ? (
- <FormattedMessage
- defaultMessage={translate(
- 'onboarding.tutorial.with.github_action.create_secret.monorepo_create_global_token',
- )}
- id="onboarding.tutorial.with.github_action.create_secret.monorepo_create_global_token"
- values={{
- link: (
- <Link to="/account/security" target="_blank" className="sw-mx-1">
- {translate(
- 'onboarding.tutorial.with.github_action.create_secret.monorepo_create_global_token.link',
- )}
- </Link>
- ),
- }}
- />
- ) : (
- ''
- ),
- }}
- />
- </FlagMessage>
- )}
</NumberedListItem>
<NumberedListItem>
<TokenStepGenerator component={component} currentUser={currentUser} />
@@ -127,6 +93,27 @@ export default function SecretStep(props: SecretStepProps) {
translationKey="onboarding.tutorial.with.github_action.secret.add"
highlightKeys={['add_secret']}
/>
+ {monorepo && (
+ <FlagMessage variant="info" className="sw-block sw-w-fit sw-mt-4">
+ <div>
+ <div>
+ <FormattedMessage
+ id="onboarding.tutorial.with.github_action.create_secret.monorepo_project_level_token_info"
+ values={{
+ link: (
+ <Link to="/account/security">
+ <FormattedMessage id="onboarding.tutorial.with.github_action.create_secret.monorepo_project_level_token_info.link" />
+ </Link>
+ ),
+ }}
+ />
+ </div>
+ <div className="sw-mt-2">
+ <FormattedMessage id="onboarding.tutorial.with.github_action.create_secret.monorepo_global_token_info" />
+ </div>
+ </div>
+ </FlagMessage>
+ )}
</NumberedListItem>
</NumberedList>
<BasicSeparator className="sw-my-6" />
@@ -167,11 +154,6 @@ export default function SecretStep(props: SecretStepProps) {
/>
</NumberedListItem>
</NumberedList>
- {monorepo && (
- <FlagMessage variant="info" className="sw-block sw-w-fit sw-mt-4">
- {translate('onboarding.tutorial.with.github_action.create_secret.monorepo_info')}
- </FlagMessage>
- )}
</>
);
}
diff --git a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/MonorepoDocLinkFallback.tsx b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/MonorepoDocLinkFallback.tsx
index 6c0d3ebffb5..0ae8b529271 100644
--- a/server/sonar-web/src/main/js/components/tutorials/github-action/commands/MonorepoDocLinkFallback.tsx
+++ b/server/sonar-web/src/main/js/components/tutorials/github-action/commands/MonorepoDocLinkFallback.tsx
@@ -30,8 +30,7 @@ export default function MonorepoDocLinkFallback() {
<NumberedListItem>
<DocumentationLink className="sw-mt-4" to={MONOREPO_DOC}>
{translate('onboarding.tutorial.with.github_action.monorepo.see_yaml_instructions')}
- </DocumentationLink>{' '}
- {translate('onboarding.tutorial.with.github_action.monorepo.pre_see_yaml_instructions')}
+ </DocumentationLink>
</NumberedListItem>
);
}