aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-08-04 17:46:26 +0200
committersonartech <sonartech@sonarsource.com>2022-08-08 20:03:03 +0000
commit69afe4d2004b3b8b683560be9fa4d01f67082ef9 (patch)
tree3d0386e7d2da357122f348dd5320bec09aee04a0 /server/sonar-web/src/main/js/api
parentef13264ccbe3b9f03ceeaccab2b4366cb126bb24 (diff)
downloadsonarqube-69afe4d2004b3b8b683560be9fa4d01f67082ef9.tar.gz
sonarqube-69afe4d2004b3b8b683560be9fa4d01f67082ef9.zip
SONAR-17147 Refactoring comment popup and improving accessibilty
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r--server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts27
1 files changed, 25 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
index f40a56052a6..7236a4c7272 100644
--- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts
@@ -88,6 +88,7 @@ export default class IssuesServiceMock {
list: IssueData[];
constructor() {
+ // Comment should have their own store as we can test better CRUD operation
this.sourceViewerFiles = [
mockSourceViewerFile('file.foo', 'project'),
mockSourceViewerFile('file.bar', 'project')
@@ -383,9 +384,30 @@ export default class IssuesServiceMock {
const statusMap: { [key: string]: string } = {
confirm: 'CONFIRMED',
unconfirm: 'REOPENED',
- resolve: 'RESOLVED'
+ resolve: 'RESOLVED',
+ wontfix: 'RESOLVED',
+ falsepositive: 'RESOLVED'
};
- return this.getActionsResponse({ status: statusMap[data.transition] }, data.issue);
+ const transitionMap: Dict<string[]> = {
+ REOPENED: ['confirm', 'resolve', 'falsepositive', 'wontfix'],
+ OPEN: ['confirm', 'resolve', 'falsepositive', 'wontfix'],
+ CONFIRMED: ['resolve', 'unconfirm', 'falsepositive', 'wontfix'],
+ RESOLVED: ['reopen']
+ };
+
+ const resolutionMap: Dict<string> = {
+ wontfix: 'WONTFIX',
+ falsepositive: 'FALSE-POSITIVE'
+ };
+
+ return this.getActionsResponse(
+ {
+ status: statusMap[data.transition],
+ transitions: transitionMap[statusMap[data.transition]],
+ resolution: resolutionMap[data.transition]
+ },
+ data.issue
+ );
};
handleSetIssueTags = (data: { issue: string; tags: string }) => {
@@ -456,6 +478,7 @@ export default class IssuesServiceMock {
...issueDataSelected?.issue,
...overrides
};
+
return this.reply({
issue: issueDataSelected.issue
});