aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-05-26 15:30:57 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-05-26 15:30:57 +0200
commitb6066864751a4ab5b39932f685999df656af75ce (patch)
tree90af848a930f5f716b19b279bfe458f48dbbfc7b
parentff31991df9551ffeaff35d5808406acf01f5d93e (diff)
downloadsonarqube-b6066864751a4ab5b39932f685999df656af75ce.tar.gz
sonarqube-b6066864751a4ab5b39932f685999df656af75ce.zip
drop ruby code
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/analysis_reports_controller.rb31
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/component_viewer_controller.rb28
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard2_controller.rb227
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb177
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb38
5 files changed, 0 insertions, 501 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/analysis_reports_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/analysis_reports_controller.rb
deleted file mode 100644
index 153fb237dc7..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/analysis_reports_controller.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 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.
-#
-
-class AnalysisReportsController < ApplicationController
-
- before_filter :admin_required
-
- SECTION=Navigation::SECTION_CONFIGURATION
-
- def index
-
- end
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/component_viewer_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/component_viewer_controller.rb
deleted file mode 100644
index a43d77c5169..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/component_viewer_controller.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 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.
-#
-
-class ComponentViewerController < ApplicationController
-
- # GET /component_viewer/index
- def index
-
- end
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard2_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard2_controller.rb
deleted file mode 100644
index 73a3a5e1999..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard2_controller.rb
+++ /dev/null
@@ -1,227 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 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.
-#
-class Dashboard2Controller < ApplicationController
-
- SECTION=Navigation::SECTION_RESOURCE
-
- before_filter :login_required, :except => [:index]
-
- def index
- load_resource()
-
- if !@resource || @resource.display_dashboard?
- load_dashboard()
- load_authorized_widget_definitions()
- else
- # display the layout of the parent without the sidebar, usually the directory, but display the file viewers
- @hide_sidebar = true
- @file = @resource
- @project = @snapshot.parent.project
- @metric=params[:metric]
- render :action => 'no_dashboard'
- end
- end
-
- def configure
- load_resource()
- load_dashboard()
-
- @category=params[:category]
- load_widget_definitions(@category)
- end
-
- def set_layout
- verify_post_request
- dashboard=Dashboard.find(params[:did])
- if dashboard.editable_by?(current_user)
- dashboard.column_layout=params[:layout]
- dashboard.save!
- columns=dashboard.column_layout.split('-')
- dashboard.widgets.find(:all, :conditions => ["column_index > ?", columns.size()]).each do |widget|
- widget.column_index=columns.size()
- widget.save
- end
- end
- redirect_to :action => 'configure', :did => dashboard.id, :id => params[:id]
- end
-
- def set_dashboard
- verify_post_request
- load_dashboard()
-
- dashboardstate=params[:dashboardstate]
-
- columns=dashboardstate.split(";")
- all_ids=[]
- columns.each_with_index do |col, index|
- ids=col.split(",")
- ids.each_with_index do |id, order|
- widget=@dashboard.widgets.to_a.find { |i| i.id==id.to_i() }
- if widget
- widget.column_index=index+1
- widget.row_index=order+1
- widget.save!
- all_ids<<widget.id
- end
- end
- end
- @dashboard.widgets.reject { |w| all_ids.include?(w.id) }.each do |w|
- w.destroy
- end
- render :json => {:status => 'ok'}
- end
-
- def add_widget
- verify_post_request
- dashboard=Dashboard.find(params[:did])
- widget_id=nil
- if dashboard.editable_by?(current_user)
- definition=java_facade.getWidget(params[:widget])
- if definition
- first_column_widgets=dashboard.widgets.select { |w| w.column_index==1 }.sort_by { |w| w.row_index }
- new_widget=dashboard.widgets.create(:widget_key => definition.getId(),
- :name => definition.getTitle(),
- :column_index => 1,
- :row_index => 1,
- :configured => !(definition.hasRequiredProperties() || (dashboard.global && !definition.isGlobal)))
- widget_id=new_widget.id
- first_column_widgets.each_with_index do |w, index|
- w.row_index=index+2
- w.save
- end
- end
- end
- redirect_to :action => 'configure', :did => dashboard.id, :id => params[:id], :highlight => widget_id, :category => params[:category]
- end
-
- def save_widget
- verify_post_request
- widget=Widget.find(params[:wid])
- #TODO check owner of dashboard
- Widget.transaction do
- widget.properties.clear
- widget.java_definition.getWidgetProperties().each do |java_property|
- value=params[java_property.key()] || java_property.defaultValue()
- if value && !value.empty?
- prop = widget.properties.build(:kee => java_property.key, :text_value => value)
- prop.save!
- end
- end
- widget.resource_id=Project.by_key(params[:resource_id]).id if params[:resource_id].present?
- widget.configured=true
- widget.save!
- render :update do |page|
- page.redirect_to(url_for(:action => 'configure', :did => widget.dashboard_id, :id => params[:id]))
- end
- end
- end
-
- def widget_definitions
- @category=params[:category]
- load_resource()
- load_dashboard()
- load_widget_definitions(@category)
- render :partial => 'widget_definitions', :locals => {:category => @category}
- end
-
- private
-
- def load_dashboard
- active=nil
- @dashboard=nil
-
- if logged_in?
- if params[:did]
- @dashboard=Dashboard.first(:conditions => ['id=? AND user_id=?', params[:did].to_i, current_user.id])
- elsif params[:name]
- @dashboard=Dashboard.first(:conditions => ['name=? AND user_id=?', params[:name], current_user.id])
- elsif params[:id]
- active=ActiveDashboard.user_dashboards(current_user, false).first
- else
- active=ActiveDashboard.user_dashboards(current_user, true).first
- end
- end
-
- unless active or @dashboard
- # anonymous or not found in user dashboards
- if params[:did]
- @dashboard=Dashboard.first(:conditions => ['id=? AND shared=?', params[:did].to_i, true])
- elsif params[:name]
- @dashboard=Dashboard.first(:conditions => ['name=? AND shared=?', params[:name], true])
- elsif params[:id]
- active=ActiveDashboard.user_dashboards(nil, false).first
- else
- active=ActiveDashboard.user_dashboards(nil, true).first
- end
- end
-
- unless @dashboard
- @dashboard=(active && active.dashboard)
- end
-
- not_found('dashboard') unless @dashboard
-
- @dashboard_configuration=Api::DashboardConfiguration.new(@dashboard, :period_index => params[:period], :snapshot => @snapshot) if @dashboard && @snapshot
- end
-
- def load_resource
- if params[:id]
- @resource=Project.by_key(params[:id])
- return project_not_found unless @resource
- @resource=@resource.permanent_resource
-
- @snapshot=@resource.last_snapshot
- return project_not_analyzed unless @snapshot
-
- access_denied unless has_role?(:user, @resource)
-
- @project=@resource # for backward compatibility with old widgets
- end
- end
-
- def project_not_found
- flash[:error] = message('dashboard.project_not_found')
- redirect_to :action => :index
- end
-
- def project_not_analyzed
- render :action => 'empty'
- end
-
- def load_authorized_widget_definitions
- @authorized_widget_definitions=java_facade.getWidgets().select do |widget|
- roles = widget.getUserRoles()
- roles.empty? || roles.any? { |role| (role=='user') || (role=='viewer') || has_role?(role, @resource) }
- end
- end
-
- def load_widget_definitions(filter_on_category)
- @widget_definitions=java_facade.getWidgets().to_a.sort {|w1,w2| widgetL10nName(w1) <=> widgetL10nName(w2)}
-
- @widget_categories=@widget_definitions.map(&:getWidgetCategories).to_a.flatten.uniq.sort
- unless filter_on_category.blank?
- @widget_definitions=@widget_definitions.select { |definition| definition.getWidgetCategories().to_a.include?(filter_on_category) }
- end
- end
-
- def widgetL10nName(widget)
- Api::Utils.message('widget.' + widget.id + '.name')
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
deleted file mode 100644
index da7bb1f10ba..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/issue_controller.rb
+++ /dev/null
@@ -1,177 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 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.
-#
-
-require 'set'
-
-class IssueController < ApplicationController
-
- def do_action
- verify_ajax_request
- verify_post_request
- require_parameters :id, :issue
-
- action_type = params[:id]
- issue_key = params[:issue]
-
- if action_type=='comment'
- issue_result = Internal.issues.addComment(issue_key, params[:text])
- elsif action_type=='assign'
- assignee = (params[:me]=='true' ? current_user.login : params[:assignee])
- issue_result = Internal.issues.assign(issue_key, assignee)
- elsif action_type=='transition'
- issue_result = Internal.issues.doTransition(issue_key, params[:transition])
- elsif action_type=='severity'
- issue_result = Internal.issues.setSeverity(issue_key, params[:severity])
- elsif action_type=='plan'
- issue_result = Internal.issues.plan(issue_key, params[:plan])
- elsif action_type=='unplan'
- issue_result = Internal.issues.plan(issue_key, nil)
- else
- # Execute action defined by plugin
- issue_result = Internal.issues.executeAction(issue_key, action_type)
- end
-
- if issue_result.ok
- init_issue(issue_key)
- render :partial => 'issue/issue', :locals => {:issue => @issue}
- else
- @errors = issue_result.errors
- render :partial => 'issue/error', :status => issue_result.httpStatus
- end
-
- end
-
- # Edit and save an existing comment
- def edit_comment
- verify_ajax_request
- verify_post_request
- require_parameters :key
-
- text = Api::Utils.read_post_request_param(params[:text])
- edit_result = Internal.issues.editComment(params[:key], text)
-
- if edit_result.ok
- init_issue(edit_result.get.issueKey)
- render :partial => 'issue/issue', :locals => {:issue => @issue}
- else
- @errors = edit_result.errors
- render :partial => 'issue/error', :status => edit_result.httpStatus
- end
- end
-
- # Delete an existing comment
- def delete_comment
- verify_post_request
- verify_ajax_request
- require_parameters :id
-
- comment = Internal.issues.deleteComment(params[:id])
-
- init_issue(comment.issueKey)
- render :partial => 'issue/issue', :locals => {:issue => @issue}
- end
-
- # Create a manual issue
- def create
- verify_post_request
- verify_ajax_request
-
- component_key = params[:component]
- if Api::Utils.is_integer?(component_key)
- component = Project.find(component_key)
- component_key = (component && component.key)
- end
-
- issue_result = Internal.issues.create(params.merge({:component => component_key}))
- if issue_result.ok
- render :partial => 'issue/manual_issue_created', :locals => {:issue => Internal.issues.getIssueByKey(issue_result.get.key)}
- else
- render :partial => 'shared/result_messages', :status => 500, :locals => {:result => issue_result}
- end
- end
-
- def show
- # the redirect is needed for the backward compatibility with eclipse plugin
- redirect_to :controller => 'issues', :action => 'search', :anchor => 'issues=' + params[:id]
- end
-
-
- #
- #
- # ACTIONS FROM THE ISSUES WIDGETS
- #
- #
-
- def widget_issues_list
- @snapshot = Snapshot.find(params[:snapshot_id]) if params[:snapshot_id]
- @dashboard_configuration = Api::DashboardConfiguration.new(nil, :period_index => params[:period], :snapshot => @snapshot)
- render :partial => 'project/widgets/issues/issues_list'
- end
-
- # Display the rule description in the issue panel
- def rule
- verify_ajax_request
- require_parameters :id
-
- @rule = Internal.rules.findByKey(params[:id])
- if @rule.debtCharacteristicKey()
- @characteristic = Internal.debt.characteristicByKey(@rule.debtCharacteristicKey())
- @sub_characteristic = Internal.debt.characteristicByKey(@rule.debtSubCharacteristicKey())
- end
- render :partial => 'issue/rule'
- end
-
- # Display the changelog in the issue panel
- def changelog
- verify_ajax_request
- require_parameters :id
- @issue = Internal.issues.getIssueByKey(params[:id])
- @changelog = Internal.issues.changelog(@issue)
- render :partial => 'issue/changelog'
- end
-
-
- private
-
- def init_issue(issue_key)
- @issue = Internal.issues.getIssueByKey(issue_key)
- @project = Internal.component_api.findByUuid(@issue.projectUuid())
- @component = Internal.component_api.findByUuid(@issue.componentUuid())
- @rule = Internal.rules.findByKey(@issue.ruleKey().to_s)
- @action_plan = Internal.issues.findActionPlan(@issue.actionPlanKey()) if @issue.actionPlanKey()
- @comments = Internal.issues.findComments(issue_key)
-
- user_logins = Set.new
- user_logins << @issue.assignee() if @issue.assignee()
- user_logins << @issue.reporter() if @issue.reporter()
- @comments .each do |comment|
- user_logins << comment.userLogin() if comment.userLogin()
- end
- users = Internal.users_api.find({'logins', user_logins})
- @users = {}
- users.each do |u|
- @users[u.login()] = u
- end
-
- resource = Project.by_key(@component.key())
- @snapshot = resource.last_snapshot if resource.last_snapshot
- end
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb
deleted file mode 100644
index 416ed4d5434..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/mock/example_controller.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2014 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.
-#
-class Mock::ExampleController < Api::ApiController
-
- # GET /mock/example/index
- def index
- # declare JSON response with ruby hash or array
- render :json => JSON({'foo' => 'bar', 'an_integer' => 4})
- end
-
- # GET /mock/example/search
- def search
- # declare JSON response with string
- render :json => <<RESPONSE
- {
- "foo": "bar"
- }
-RESPONSE
- end
-
-end