aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorStas Vilchik <stas-vilchik@users.noreply.github.com>2017-05-01 17:48:42 +0200
committerGitHub <noreply@github.com>2017-05-01 17:48:42 +0200
commit4712ad2d974220f42893f6509ec5f0b7a7b446b0 (patch)
tree2ece706f5fed984c2fd996b5f87e5b0956eb1642 /server/sonar-web/src/main/js/apps
parent43f27896459dec1a76dc117db3a5b22afb99e0ff (diff)
downloadsonarqube-4712ad2d974220f42893f6509ec5f0b7a7b446b0.tar.gz
sonarqube-4712ad2d974220f42893f6509ec5f0b7a7b446b0.zip
sort issues by creation date when coming from about page (#1993)
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js10
-rw-r--r--server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js10
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/App.js7
-rw-r--r--server/sonar-web/src/main/js/apps/issues/utils.js6
4 files changed, 26 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js
index 010c2912f5c..349dbf85bba 100644
--- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js
+++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypes.js
@@ -43,7 +43,7 @@ export default class EntryIssueTypes extends React.PureComponent {
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'BUG' })}
+ to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })}
className="about-page-issue-type-link">
{formatMeasure(bugs, 'SHORT_INT')}
</Link>
@@ -56,7 +56,11 @@ export default class EntryIssueTypes extends React.PureComponent {
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'VULNERABILITY' })}
+ to={getIssuesUrl({
+ resolved: 'false',
+ types: 'VULNERABILITY',
+ s: 'CREATION_DATE'
+ })}
className="about-page-issue-type-link">
{formatMeasure(vulnerabilities, 'SHORT_INT')}
</Link>
@@ -69,7 +73,7 @@ export default class EntryIssueTypes extends React.PureComponent {
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL' })}
+ to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })}
className="about-page-issue-type-link">
{formatMeasure(codeSmells, 'SHORT_INT')}
</Link>
diff --git a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js
index e2a8e7ad16c..e7ef546f2ac 100644
--- a/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js
+++ b/server/sonar-web/src/main/js/apps/about/components/EntryIssueTypesForSonarQubeDotCom.js
@@ -43,7 +43,7 @@ export default class EntryIssueTypesForSonarQubeDotCom extends React.PureCompone
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'BUG' })}
+ to={getIssuesUrl({ resolved: 'false', types: 'BUG', s: 'CREATION_DATE' })}
className="about-page-issue-type-link">
{formatMeasure(bugs, 'SHORT_INT')}
</Link>
@@ -56,7 +56,11 @@ export default class EntryIssueTypesForSonarQubeDotCom extends React.PureCompone
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'VULNERABILITY' })}
+ to={getIssuesUrl({
+ resolved: 'false',
+ types: 'VULNERABILITY',
+ s: 'CREATION_DATE'
+ })}
className="about-page-issue-type-link">
{formatMeasure(vulnerabilities, 'SHORT_INT')}
</Link>
@@ -69,7 +73,7 @@ export default class EntryIssueTypesForSonarQubeDotCom extends React.PureCompone
<tr>
<td className="about-page-issue-type-number">
<Link
- to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL' })}
+ to={getIssuesUrl({ resolved: 'false', types: 'CODE_SMELL', s: 'CREATION_DATE' })}
className="about-page-issue-type-link">
{formatMeasure(codeSmells, 'SHORT_INT')}
</Link>
diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.js b/server/sonar-web/src/main/js/apps/issues/components/App.js
index 7dc673d80dd..6361d5cc85f 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/App.js
+++ b/server/sonar-web/src/main/js/apps/issues/components/App.js
@@ -346,13 +346,18 @@ export default class App extends React.PureComponent {
const parameters = {
componentKeys: component && component.key,
- ...serializeQuery(query),
s: 'FILE_LINE',
+ ...serializeQuery(query),
ps: 100,
facets,
...additional
};
+ // only sorting by CREATION_DATE is allowed, so let's sort DESC
+ if (query.sort) {
+ Object.assign(parameters, { asc: 'false' });
+ }
+
if (myIssues) {
Object.assign(parameters, { assignees: '__me__' });
}
diff --git a/server/sonar-web/src/main/js/apps/issues/utils.js b/server/sonar-web/src/main/js/apps/issues/utils.js
index 1ad58e08816..712b00024db 100644
--- a/server/sonar-web/src/main/js/apps/issues/utils.js
+++ b/server/sonar-web/src/main/js/apps/issues/utils.js
@@ -42,6 +42,7 @@ export type Query = {|
resolved: boolean,
resolutions: Array<string>,
rules: Array<string>,
+ sort: string,
severities: Array<string>,
sinceLeakPeriod: boolean,
statuses: Array<string>,
@@ -65,6 +66,9 @@ const parseAsStringArray = (value: ?string): Array<string> => (value ? value.spl
const parseAsFacetMode = (facetMode: string) =>
(facetMode === 'debt' || facetMode === 'effort' ? 'effort' : 'count');
+// allow sorting by CREATION_DATE only
+const parseAsSort = (sort: string): string => (sort === 'CREATION_DATE' ? 'CREATION_DATE' : '');
+
export const parseQuery = (query: RawQuery): Query => ({
assigned: parseAsBoolean(query.assigned),
assignees: parseAsStringArray(query.assignees),
@@ -83,6 +87,7 @@ export const parseQuery = (query: RawQuery): Query => ({
resolved: parseAsBoolean(query.resolved),
resolutions: parseAsStringArray(query.resolutions),
rules: parseAsStringArray(query.rules),
+ sort: parseAsSort(query.s),
severities: parseAsStringArray(query.severities),
sinceLeakPeriod: parseAsBoolean(query.sinceLeakPeriod, false),
statuses: parseAsStringArray(query.statuses),
@@ -116,6 +121,7 @@ export const serializeQuery = (query: Query): RawQuery => {
projectUuids: serializeValue(query.projects),
resolved: query.resolved ? undefined : 'false',
resolutions: serializeValue(query.resolutions),
+ s: serializeString(query.sort),
severities: serializeValue(query.severities),
sinceLeakPeriod: query.sinceLeakPeriod ? 'true' : undefined,
statuses: serializeValue(query.statuses),