aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-10-31 09:48:46 +0100
committerStas Vilchik <vilchiks@gmail.com>2014-10-31 10:06:42 +0100
commit17b95be24249d20954068cbbcd2ae9fcfa5da6aa (patch)
treedb3103899d958bc5d054da2f8e9f036fa3f34781 /server
parent76b88cf1f5f42d331ad02df55a083325226c6224 (diff)
downloadsonarqube-17b95be24249d20954068cbbcd2ae9fcfa5da6aa.tar.gz
sonarqube-17b95be24249d20954068cbbcd2ae9fcfa5da6aa.zip
SONAR-5718 Add permalinks for saved filters
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/coffee/issues/app.coffee11
-rw-r--r--server/sonar-web/src/main/coffee/issues/controller.coffee18
-rw-r--r--server/sonar-web/src/main/coffee/issues/models/state.coffee2
-rw-r--r--server/sonar-web/src/main/coffee/issues/router.coffee18
4 files changed, 35 insertions, 14 deletions
diff --git a/server/sonar-web/src/main/coffee/issues/app.coffee b/server/sonar-web/src/main/coffee/issues/app.coffee
index 29bcf6fee9a..775b26a4d9a 100644
--- a/server/sonar-web/src/main/coffee/issues/app.coffee
+++ b/server/sonar-web/src/main/coffee/issues/app.coffee
@@ -75,10 +75,6 @@ requirejs [
App.addInitializer ->
- @controller.fetchFilters()
-
-
- App.addInitializer ->
@issuesView = new WorkspaceListView
app: @
collection: @issues
@@ -108,9 +104,10 @@ requirejs [
App.addInitializer ->
- key.setScope 'list'
- @router = new Router app: @
- Backbone.history.start()
+ @controller.fetchFilters().done =>
+ key.setScope 'list'
+ @router = new Router app: @
+ Backbone.history.start()
l10nXHR = window.requestMessages()
diff --git a/server/sonar-web/src/main/coffee/issues/controller.coffee b/server/sonar-web/src/main/coffee/issues/controller.coffee
index a5424edb81b..56ddd0b4309 100644
--- a/server/sonar-web/src/main/coffee/issues/controller.coffee
+++ b/server/sonar-web/src/main/coffee/issues/controller.coffee
@@ -137,9 +137,10 @@ define [
@options.app.state.setQuery resolved: 'false'
- applyFilter: (filter) ->
- query = @parseQuery filter.get 'query'
- @options.app.state.setQuery query
+ applyFilter: (filter, ignoreQuery = false) ->
+ unless ignoreQuery
+ filterQuery = @parseQuery filter.get 'query'
+ @options.app.state.setQuery filterQuery
@options.app.state.set filter: filter, changed: false
@@ -160,6 +161,17 @@ define [
route.join separator
+ getRoute: (separator = '|') ->
+ filter = @options.app.state.get 'filter'
+ query = @getQuery separator
+ if filter?
+ if @options.app.state.get('changed') && query.length > 0
+ query = "id=#{filter.id}|#{query}"
+ else
+ query = "id=#{filter.id}"
+ query
+
+
_prepareComponent: (issue) ->
key: issue.get 'component'
name: issue.get 'componentLongName'
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 264e81ad2e1..49040ea3c79 100644
--- a/server/sonar-web/src/main/coffee/issues/models/state.coffee
+++ b/server/sonar-web/src/main/coffee/issues/models/state.coffee
@@ -43,6 +43,6 @@ define [
setQuery: (query) ->
@set { query: query }, { silent: true }
- @trigger 'change:query'
@set changed: true
+ @trigger 'change:query'
diff --git a/server/sonar-web/src/main/coffee/issues/router.coffee b/server/sonar-web/src/main/coffee/issues/router.coffee
index b89b9e5ace3..b85773f6c43 100644
--- a/server/sonar-web/src/main/coffee/issues/router.coffee
+++ b/server/sonar-web/src/main/coffee/issues/router.coffee
@@ -15,6 +15,7 @@ define [
initialize: (options) ->
@options = options
@listenTo @options.app.state, 'change:query', @updateRoute
+ @listenTo @options.app.state, 'change:filter', @updateRoute
emptyQuery: ->
@@ -22,11 +23,22 @@ define [
index: (query) ->
- filter = @options.app.controller.parseQuery query
- @options.app.state.setQuery filter
+ query = @options.app.controller.parseQuery query
+ if query.id?
+ filter = @options.app.filters.get query.id
+ delete query.id
+ filter.fetch().done =>
+ if Object.keys(query).length > 0
+ @options.app.controller.applyFilter filter, true
+ @options.app.state.setQuery query
+ @options.app.state.set changed: true
+ else
+ @options.app.controller.applyFilter filter
+ else
+ @options.app.state.setQuery query
updateRoute: ->
- route = @options.app.controller.getQuery()
+ route = @options.app.controller.getRoute()
@navigate route