aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-02-05 16:37:02 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-02-05 16:37:02 +0100
commit5644a120eef5fc61ec3b0af277853f295edf6174 (patch)
tree6feb4653302e585cbf69f48aef2eb35a03debe9b
parent95de6de818b61776d420edf82ff4638001b69f0e (diff)
downloadsonarqube-5644a120eef5fc61ec3b0af277853f295edf6174.tar.gz
sonarqube-5644a120eef5fc61ec3b0af277853f295edf6174.zip
SONAR-5885 apply feeback
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee30
-rw-r--r--server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs7
-rw-r--r--server/sonar-web/src/main/js/graphics/barchart.js2
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties4
4 files changed, 36 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee
index 98249b2da88..7877cccc72b 100644
--- a/server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee
+++ b/server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee
@@ -18,6 +18,10 @@ define [
'click .js-select-period-start': 'selectPeriodStart'
'click .js-select-period-end': 'selectPeriodEnd'
+ 'click .js-last-week': 'onLastWeekClick'
+ 'click .js-last-month': 'onLastMonthClick'
+ 'click .js-last-year': 'onLastYearClick'
+
onRender: ->
@$el.toggleClass 'search-navigator-facet-box-collapsed', !@model.get('enabled')
@@ -33,11 +37,11 @@ define [
value = query[prop]
@$("input[name=#{prop}]").val value if value?
- @$('.js-barchart').barchart @model.getValues()
-
- @$('select').select2
- width: '100%'
- minimumResultsForSearch: 999
+ values = @model.getValues()
+ if _.isArray(values) && values.length > 0
+ @$('.js-barchart').barchart values
+ else
+ @$('.js-barchart').addClass 'hidden'
selectPeriodStart: ->
@@ -48,7 +52,6 @@ define [
@$('.js-period-end').datepicker 'show'
-
applyFacet: ->
obj = {}
@$('input').each ->
@@ -62,6 +65,21 @@ define [
@options.app.state.updateFilter createdAfter: null, createdBefore: null, createdAt: null
+ onLastWeekClick: ->
+ createdAfter = moment().subtract(1, 'weeks').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
+ onLastMonthClick: ->
+ createdAfter = moment().subtract(1, 'months').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
+ onLastYearClick: ->
+ createdAfter = moment().subtract(1, 'years').format 'YYYY-MM-DD'
+ @options.app.state.updateFilter createdAfter: createdAfter, createdBefore: null, createdAt: null
+
+
serializeData: ->
_.extend super,
periodStart: @options.app.state.get('query').createdAfter
diff --git a/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs b/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs
index 5aea5db9109..fb6925abc0a 100644
--- a/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs
+++ b/server/sonar-web/src/main/hbs/issues/facets/issues-creation-date-facet.hbs
@@ -20,5 +20,12 @@
<input class="js-period-end search-navigator-date-facet-selection-input-right"
type="text" value="{{#if periodEnd}}{{ds periodEnd}}{{/if}}" name="createdBefore">
</div>
+
+ <div class="spacer-top">
+ <span class="spacer-right">{{t 'issues.facet.createdAt.or'}}</span>
+ <a class="js-last-week spacer-right">{{t 'issues.facet.createdAt.last_week'}}</a>
+ <a class="js-last-month spacer-right">{{t 'issues.facet.createdAt.last_month'}}</a>
+ <a class="js-last-year">{{t 'issues.facet.createdAt.last_year'}}</a>
+ </div>
</div>
{{/if}}
diff --git a/server/sonar-web/src/main/js/graphics/barchart.js b/server/sonar-web/src/main/js/graphics/barchart.js
index 1331a725280..5b51819bad4 100644
--- a/server/sonar-web/src/main/js/graphics/barchart.js
+++ b/server/sonar-web/src/main/js/graphics/barchart.js
@@ -76,7 +76,7 @@
})
.attr('title', function (d, i) {
var beginning = moment(d.val),
- ending = i < data.length - 1 ? moment(data[i].val).subtract(1, 'days') : moment();
+ ending = i < data.length - 1 ? moment(data[i + 1].val).subtract(1, 'days') : moment();
return d.count + ' | ' + beginning.format('LL') + ' - ' + ending.format('LL');
})
.attr('data-placement', 'right')
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index a4bc5ab4abd..5bce0644a85 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -819,6 +819,10 @@ issues.facet.rules=Rule
issues.facet.resolutions=Resolution
issues.facet.languages=Language
issues.facet.createdAt=Creation Date
+issues.facet.createdAt.or=Or:
+issues.facet.createdAt.last_week=Last week
+issues.facet.createdAt.last_month=Last month
+issues.facet.createdAt.last_year=Last year
issues.facet.reporters=Reporter
issues.facet.authors=Author
issues.facet.issues=Issue Key