aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2021-01-28 14:14:17 +0100
committersonartech <sonartech@sonarsource.com>2021-02-02 20:07:49 +0000
commit36139d190e06cc9b6632362000b8738f212c0e90 (patch)
tree346aba2be34803f501691a44e6cd5f4238aa75d4
parentcb43c076ae6fff6bef9d57d2b05fd5c4a9e70c84 (diff)
downloadsonarqube-36139d190e06cc9b6632362000b8738f212c0e90.tar.gz
sonarqube-36139d190e06cc9b6632362000b8738f212c0e90.zip
SONAR-14404 Add monorepo checkbox for Github bindings
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap42
-rw-r--r--server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap1
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts1
-rw-r--r--server/sonar-web/src/main/js/types/alm-settings.ts2
7 files changed, 63 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
index 67de027591a..6aac5329007 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx
@@ -238,6 +238,12 @@ export default function AlmSpecificForm(props: AlmSpecificFormProps) {
propKey: 'summaryCommentEnabled',
value: summaryCommentEnabled === undefined ? true : summaryCommentEnabled
})}
+ {renderMonoRepoField({
+ monorepoEnabled,
+ value: monorepo,
+ docLink: '/documentation/analysis/github-integration/',
+ onFieldChange: props.onFieldChange
+ })}
</>
);
case AlmKeys.GitLab:
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
index f351c4d487a..3d2368ed24b 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBinding.tsx
@@ -202,6 +202,7 @@ export class PRDecorationBinding extends React.PureComponent<Props & StateProps,
almSpecificFields?.summaryCommentEnabled === undefined
? true
: almSpecificFields?.summaryCommentEnabled;
+ const monorepo = almSpecificFields?.monorepo ?? false;
if (!repository) {
return Promise.reject();
}
@@ -209,7 +210,8 @@ export class PRDecorationBinding extends React.PureComponent<Props & StateProps,
almSetting,
project,
repository,
- summaryCommentEnabled
+ summaryCommentEnabled,
+ monorepo
});
}
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
index 1e52df759ce..53e7289bf8c 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/PRDecorationBinding-test.tsx
@@ -100,8 +100,9 @@ describe('handleSubmit', () => {
const githubKey = 'github';
const repository = 'repo/path';
const summaryCommentEnabled = true;
+ const monorepo = true;
wrapper.setState({
- formData: { key: githubKey, repository, summaryCommentEnabled },
+ formData: { key: githubKey, repository, summaryCommentEnabled, monorepo },
instances
});
wrapper.instance().handleSubmit();
@@ -111,7 +112,8 @@ describe('handleSubmit', () => {
almSetting: githubKey,
project: PROJECT_KEY,
repository,
- summaryCommentEnabled
+ summaryCommentEnabled,
+ monorepo
});
expect(wrapper.state().success).toBe(true);
});
@@ -310,7 +312,8 @@ it('should accept submit github settings', async () => {
almSetting: 'github-binding',
project: PROJECT_KEY,
repository: 'foo',
- summaryCommentEnabled: true
+ summaryCommentEnabled: true,
+ monorepo: false
});
await wrapper.instance().submitProjectAlmBinding(AlmKeys.GitHub, 'github-binding', {
@@ -321,7 +324,8 @@ it('should accept submit github settings', async () => {
almSetting: 'github-binding',
project: PROJECT_KEY,
repository: 'foo',
- summaryCommentEnabled: true
+ summaryCommentEnabled: true,
+ monorepo: false
});
});
diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap
index 3a91ce2c977..cc9dadc14c0 100644
--- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/__tests__/__snapshots__/AlmSpecificForm-test.tsx.snap
@@ -571,6 +571,48 @@ exports[`it should render correctly for github and monorepo=true 1`] = `
/>
</div>
</div>
+ <div
+ className="form-field"
+ >
+ <label
+ className="display-flex-center"
+ htmlFor="monorepo"
+ >
+ settings.pr_decoration.binding.form.monorepo
+ <HelpTooltip
+ className="spacer-left"
+ overlay={
+ <FormattedMessage
+ defaultMessage="settings.pr_decoration.binding.form.monorepo.help"
+ id="settings.pr_decoration.binding.form.monorepo.help"
+ values={
+ Object {
+ "doc_link": <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ target="_blank"
+ to="/documentation/analysis/github-integration/"
+ >
+ learn_more
+ </Link>,
+ }
+ }
+ />
+ }
+ placement="right"
+ />
+ </label>
+ <div
+ className="display-flex-center"
+ >
+ <InputForBoolean
+ isDefault={true}
+ name="monorepo"
+ onChange={[Function]}
+ value={false}
+ />
+ </div>
+ </div>
</Fragment>
`;
diff --git a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap
index 23f83edc47b..d5aa70897c0 100644
--- a/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/tutorials/jenkins/__tests__/__snapshots__/WebhookStep-test.tsx.snap
@@ -144,6 +144,7 @@ exports[`it should render correctly for github: content 1`] = `
Object {
"alm": "github",
"key": "foo",
+ "monorepo": true,
"repository": "PROJECT_KEY",
}
}
diff --git a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
index 34018f3fd9a..a1f23453a56 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/alm-settings.ts
@@ -118,6 +118,7 @@ export function mockProjectGithubBindingResponse(
alm: AlmKeys.GitHub,
key: 'foo',
repository: 'PROJECT_KEY',
+ monorepo: true,
...overrides
};
}
diff --git a/server/sonar-web/src/main/js/types/alm-settings.ts b/server/sonar-web/src/main/js/types/alm-settings.ts
index 148d3b08950..08d14166359 100644
--- a/server/sonar-web/src/main/js/types/alm-settings.ts
+++ b/server/sonar-web/src/main/js/types/alm-settings.ts
@@ -79,6 +79,7 @@ export interface ProjectBitbucketBindingResponse extends ProjectAlmBindingRespon
export interface ProjectGitHubBindingResponse extends ProjectAlmBindingResponse {
alm: AlmKeys.GitHub;
repository: string;
+ monorepo: boolean;
}
export interface ProjectGitLabBindingResponse extends ProjectAlmBindingResponse {
@@ -107,6 +108,7 @@ export interface BitbucketProjectAlmBindingParams extends ProjectAlmBindingParam
export interface GithubProjectAlmBindingParams extends ProjectAlmBindingParams {
repository: string;
summaryCommentEnabled: boolean;
+ monorepo: boolean;
}
export interface GitlabProjectAlmBindingParams extends ProjectAlmBindingParams {