aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-10-30 11:22:02 +0100
committerStas Vilchik <vilchiks@gmail.com>2014-10-30 11:22:02 +0100
commite4ac260407e77f30829379b4c29083a693c201d2 (patch)
tree43c9ee3c92401e61d40fbadeecc5e1346f56af15
parent1b485b7d0f6b970e7c3d0051bff12fe2238ce141 (diff)
downloadsonarqube-e4ac260407e77f30829379b4c29083a693c201d2.tar.gz
sonarqube-e4ac260407e77f30829379b4c29083a693c201d2.zip
SONAR-5718 Add action plan and component facets
-rw-r--r--server/sonar-web/src/main/coffee/issues/controller.coffee11
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets-view.coffee7
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets/action-plan-facet.coffee25
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets/component-facet.coffee25
-rw-r--r--server/sonar-web/src/main/coffee/issues/facets/creation-date-facet.coffee4
-rw-r--r--server/sonar-web/src/main/coffee/issues/models/state.coffee4
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
7 files changed, 72 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/coffee/issues/controller.coffee b/server/sonar-web/src/main/coffee/issues/controller.coffee
index 6da72daaef6..a88af906420 100644
--- a/server/sonar-web/src/main/coffee/issues/controller.coffee
+++ b/server/sonar-web/src/main/coffee/issues/controller.coffee
@@ -14,6 +14,8 @@ define [
EXTRA_FIELDS = 'actions,transitions,assigneeName,reporterName,actionPlanName'
PAGE_SIZE = 50
FACET_DATA_FIELDS = ['components', 'projects', 'users', 'rules', 'actionPlans']
+ FACETS_FROM_SERVER = ['severities', 'statuses', 'resolutions', 'actionPlans', 'componentRootUuids', 'rules',
+ 'assignees', 'reporters', 'componentUuids', 'languages']
class extends Marionette.Controller
@@ -28,13 +30,18 @@ define [
s: 'FILE_LINE'
asc: true
extra_fields: EXTRA_FIELDS
- facets: @options.app.state.get('facets').join()
+ facets: @_facetsFromServer().join()
_allFacets: ->
@options.app.state.get('allFacets').map (facet) -> { property: facet }
+ _facetsFromServer: ->
+ facets = @options.app.state.get 'facets'
+ facets.filter (facet) -> FACETS_FROM_SERVER.indexOf(facet) != -1
+
+
fetchIssues: (firstPage = true) ->
if firstPage
@options.app.state.set { selectedIndex: 0, page: 1 }, { silent: true }
@@ -79,7 +86,7 @@ define [
enableFacet: (id) ->
facet = @options.app.facets.get id
- if facet.has 'values'
+ if facet.has('values') || FACETS_FROM_SERVER.indexOf(id) == -1
facet.set enabled: true
else
@requestFacet(id).done => facet.set enabled: true
diff --git a/server/sonar-web/src/main/coffee/issues/facets-view.coffee b/server/sonar-web/src/main/coffee/issues/facets-view.coffee
index d0f91d9a8cc..eeafbf9e384 100644
--- a/server/sonar-web/src/main/coffee/issues/facets-view.coffee
+++ b/server/sonar-web/src/main/coffee/issues/facets-view.coffee
@@ -9,6 +9,8 @@ define [
'issues/facets/rule-facet'
'issues/facets/resolution-facet'
'issues/facets/creation-date-facet'
+ 'issues/facets/action-plan-facet'
+ 'issues/facets/component-facet'
], (
Marionette
BaseFacet
@@ -19,6 +21,8 @@ define [
RuleFacet
ResolutionFacet
CreationDateFacet
+ ActionPlanFacet
+ ComponentFacet
) ->
class extends Marionette.CollectionView
@@ -34,7 +38,8 @@ define [
when 'created' then CreationDateFacet
when 'componentRootUuids' then ProjectFacet
when 'rules' then RuleFacet
- when 'creationDate' then CreationDateFacet
+ when 'actionPlans' then ActionPlanFacet
+ when 'componentUuids' then ComponentFacet
else BaseFacet
diff --git a/server/sonar-web/src/main/coffee/issues/facets/action-plan-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/action-plan-facet.coffee
new file mode 100644
index 00000000000..cb7571ec385
--- /dev/null
+++ b/server/sonar-web/src/main/coffee/issues/facets/action-plan-facet.coffee
@@ -0,0 +1,25 @@
+define [
+ 'issues/facets/base-facet'
+], (
+ BaseFacet
+) ->
+
+
+ class extends BaseFacet
+
+ getValuesWithLabels: ->
+ values = @model.getValues()
+ actionPlans = @options.app.facets.actionPlans
+ values.forEach (v) =>
+ key = v.val
+ label = null
+ if key
+ actionPlan = _.findWhere actionPlans, key: key
+ label = actionPlan.longName if actionPlan?
+ v.label = label
+ values
+
+
+ serializeData: ->
+ _.extend super,
+ values: @getValuesWithLabels()
diff --git a/server/sonar-web/src/main/coffee/issues/facets/component-facet.coffee b/server/sonar-web/src/main/coffee/issues/facets/component-facet.coffee
new file mode 100644
index 00000000000..752f4ee286a
--- /dev/null
+++ b/server/sonar-web/src/main/coffee/issues/facets/component-facet.coffee
@@ -0,0 +1,25 @@
+define [
+ 'issues/facets/base-facet'
+], (
+ BaseFacet
+) ->
+
+
+ class extends BaseFacet
+
+ getValuesWithLabels: ->
+ values = @model.getValues()
+ source = @options.app.facets.components
+ values.forEach (v) =>
+ key = v.val
+ label = null
+ if key
+ item = _.findWhere source, uuid: key
+ label = item.longName if item?
+ v.label = label
+ values
+
+
+ serializeData: ->
+ _.extend super,
+ values: @getValuesWithLabels()
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 5979ba1f977..41f7e9185f2 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
@@ -40,3 +40,7 @@ define [
value = $(@).val()
obj[property] = value
@options.app.state.updateFilter obj
+
+
+ disable: ->
+ @options.app.state.updateFilter createdAfter: null, createdBefore: null, createdAt: null
diff --git a/server/sonar-web/src/main/coffee/issues/models/state.coffee b/server/sonar-web/src/main/coffee/issues/models/state.coffee
index d838e468e71..1704bfe3cd5 100644
--- a/server/sonar-web/src/main/coffee/issues/models/state.coffee
+++ b/server/sonar-web/src/main/coffee/issues/models/state.coffee
@@ -12,9 +12,9 @@ define [
query: {}
- facets: ['severities', 'statuses', 'resolutions', 'componentRootUuids']
+ facets: ['severities', 'statuses', 'resolutions']
allFacets: ['severities', 'statuses', 'resolutions', 'componentRootUuids', 'assignees', 'reporters', 'rules',
- 'languages', 'actionPlans', 'creationDate']
+ 'languages', 'actionPlans', 'componentUuids', 'creationDate']
nextPage: ->
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 5b3cbfcc179..d47b8900472 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -765,7 +765,7 @@ issues.facet.componentRootUuids=Project
issues.facet.statuses=Status
issues.facet.actionPlans=Action Plan
issues.facet.assignees=Assignee
-issues.facet.components=Component
+issues.facet.componentUuids=Component
issues.facet.rules=Rule
issues.facet.resolutions=Resolution
issues.facet.languages=Language