]> source.dussan.org Git - sonarqube.git/commitdiff
Move web services to get metadata on issue filters to
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 15 Jan 2014 22:32:56 +0000 (23:32 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 15 Jan 2014 22:32:56 +0000 (23:32 +0100)
* /api/issue_filters/show/<id>
* /api/issue_filters/favorites

sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issue_filters_controller.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb

diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issue_filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issue_filters_controller.rb
new file mode 100644 (file)
index 0000000..eadddbc
--- /dev/null
@@ -0,0 +1,71 @@
+#
+# SonarQube, open source software quality management tool.
+# Copyright (C) 2008-2013 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 3 of the License, or (at your option) any later version.
+#
+# SonarQube is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+
+# since 3.6
+class Api::IssueFiltersController < Api::ApiController
+
+  # Detail of an issue filter
+  # GET /api/issue_filters/show/<id>
+  def show
+    require_parameters :id
+    filter = Internal.issues.findIssueFilter(params[:id].to_i)
+
+    hash = {
+      :filter => {
+        :id => filter.id().to_i,
+        :name => filter.name(),
+        :user => filter.user(),
+        :shared => filter.shared(),
+        :description => filter.description(),
+        :query => filter.data()
+      }
+    }
+
+    respond_to do |format|
+      format.json { render :json => jsonp(hash), :status => 200 }
+    end
+  end
+
+  # GET /api/issue_filters/favorites/<id>
+  def favorites
+    if logged_in?
+      favorite_filters = Internal.issues.findFavouriteIssueFiltersForCurrentUser()
+    else
+      favorite_filters = []
+    end
+
+    hash = {
+      :favoriteFilters => favorite_filters.map do |filter|
+        {
+          :id => filter.id().to_i,
+          :name => filter.name(),
+          :user => filter.user(),
+          :shared => filter.shared(),
+          :description => filter.description()
+          # no need to export query field
+        }
+      end
+    }
+
+    respond_to do |format|
+      format.json { render :json => jsonp(hash), :status => 200 }
+    end
+  end
+end
index fb9c564f328e10d76d3d5e86c566fd5b75894505..3f5f412f6d4dc9ad1d0ba943db3fcf53857db8bf 100644 (file)
@@ -314,54 +314,6 @@ class Api::IssuesController < Api::ApiController
     end
   end
 
-  # Detail of an issue filter
-  # GET /api/filter/<id>
-  def filter
-    require_parameters :id
-    filter = Internal.issues.findIssueFilter(params[:id].to_i)
-
-    hash = {
-      :filter => {
-        :id => filter.id().to_i,
-        :name => filter.name(),
-        :user => filter.user(),
-        :shared => filter.shared(),
-        :description => filter.description(),
-        :query => filter.data()
-      }
-    }
-
-    respond_to do |format|
-      format.json { render :json => jsonp(hash), :status => 200 }
-    end
-  end
-
-  # GET /api/favorite_filters
-  def favorite_filters
-    if logged_in?
-      favorite_filters = Internal.issues.findFavouriteIssueFiltersForCurrentUser()
-    else
-      favorite_filters = []
-    end
-
-    hash = {
-      :favoriteFilters => favorite_filters.map do |filter|
-        {
-          :id => filter.id().to_i,
-          :name => filter.name(),
-          :user => filter.user(),
-          :shared => filter.shared(),
-          :description => filter.description()
-          # no need to export query field
-        }
-      end
-    }
-
-    respond_to do |format|
-      format.json { render :json => jsonp(hash), :status => 200 }
-    end
-  end
-
   protected
 
   def render_result_issue(result)