aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-07-29 14:33:40 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-07-29 14:35:56 +0200
commit5f00487afc3999d0727f1ea7faf5e5ac7090ca5d (patch)
tree598af873f492812a5eb370d4079ec97689aa6a70 /server/sonar-web
parentb4d84b51ba7e3366651ad281ca729199c1870bf2 (diff)
downloadsonarqube-5f00487afc3999d0727f1ea7faf5e5ac7090ca5d.tar.gz
sonarqube-5f00487afc3999d0727f1ea7faf5e5ac7090ca5d.zip
SONAR-6631 drop old manual measures page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/nav/templates/nav-context-navbar.hbs5
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb106
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_create_form.html.erb69
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_edit_form.html.erb39
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/index.html.erb88
5 files changed, 1 insertions, 306 deletions
diff --git a/server/sonar-web/src/main/js/apps/nav/templates/nav-context-navbar.hbs b/server/sonar-web/src/main/js/apps/nav/templates/nav-context-navbar.hbs
index 189faf5bd7c..e6eeb5cf547 100644
--- a/server/sonar-web/src/main/js/apps/nav/templates/nav-context-navbar.hbs
+++ b/server/sonar-web/src/main/js/apps/nav/templates/nav-context-navbar.hbs
@@ -50,10 +50,7 @@
{{/if}}
{{#if component.configuration.showManualMeasures}}
<li>
- <a href="{{link '/manual_measures/index?id=' contextKeyEncoded}}">{{t 'manual_measures.page'}}</a>
- </li>
- <li>
- <a href="{{link '/custom_measures/index?id=' contextKeyEncoded}}">Custom Measures <span class="badge big-spacer-left">New</span></a>
+ <a href="{{link '/custom_measures/index?id=' contextKeyEncoded}}">{{t 'custom_measures.page'}}</a>
</li>
{{/if}}
{{#if component.configuration.showActionPlans}}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb
deleted file mode 100644
index 645e3a148f6..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb
+++ /dev/null
@@ -1,106 +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 ManualMeasuresController < ApplicationController
-
- SECTION=Navigation::SECTION_RESOURCE
- before_filter :init_resource_for_admin_role
- helper MetricsHelper
-
- def index
- load_measures()
- end
-
- def create_form
- load_measures()
- already_defined_metrics=@measures.map {|m| m.metric}
- @manual_metrics=Metric.all.select { |m| m.user_managed? && !already_defined_metrics.include?(m)}
- @metric=nil
- @measure=nil
-
- render :partial => 'manual_measures/create_form'
- end
-
- def edit_form
- @metric=Metric.by_key(params[:metric])
- @measure=ManualMeasure.find(:first, :conditions => ['component_uuid=? and metric_id=?', @resource.uuid, @metric.id]) || ManualMeasure.new
-
- render :partial => 'manual_measures/edit_form'
- end
-
- def create
- verify_post_request
- if params[:metric]==''
- load_measures()
- already_defined_metrics=@measures.map {|m| m.metric}
- @manual_metrics=Metric.all.select { |m| m.user_managed? && !already_defined_metrics.include?(m)}
- render :text => 'Metric must be selected.', :status => 400
-
- else
- @metric=Metric.by_key(params[:metric])
- @measure=ManualMeasure.new(:resource => @resource, :user_login => current_user.login, :metric_id => @metric.id)
-
- @measure.typed_value=params[:val]
- @measure.description=params[:desc]
- @measure.user_login=current_user.login
-
- if @measure.valid?
- @measure.save
- flash[:notice] = 'Measure successfully created.'
- render :text => 'ok', :status => 200
- else
- render :text => @measure.errors.full_messages.map{|msg| msg}.join('<br/>'),
- :status => 400
- end
- end
- end
-
- def edit
- verify_post_request
- @metric=Metric.by_key(params[:metric])
- @measure=ManualMeasure.find(:first, :conditions => ['component_uuid=? and metric_id=?', @resource.uuid, @metric.id])
-
- @measure.typed_value=params[:val]
- @measure.description=params[:desc]
- @measure.user_login=current_user.login
-
- if @measure.valid?
- @measure.save
- flash[:notice] = 'Measure successfully edited.'
- render :text => 'ok', :status => 200
- else
- render :text => @measure.errors.full_messages.map{|msg| msg}.join('<br/>'),
- :status => 400
- end
- end
-
- def delete
- verify_post_request
- metric=Metric.by_key(params[:metric])
- ManualMeasure.destroy_all(['component_uuid=? and metric_id=?', @resource.uuid, metric.id])
- flash[:notice] = 'Measure successfully deleted.'
- redirect_to :action => 'index', :id => params[:id]
- end
-
- private
-
- def load_measures
- @measures=ManualMeasure.find(:all, :conditions => ['component_uuid=?', @resource.uuid]).select { |m| m.metric.enabled }
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_create_form.html.erb
deleted file mode 100644
index 45e2fc5830a..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_create_form.html.erb
+++ /dev/null
@@ -1,69 +0,0 @@
-<div id="modal_window">
- <script >
- var idToShow;
- function showPercentage(){
- $j('#showPercent_' + idToShow).hide();
- idToShow = $j('#metricSelect').val();
- $j('#showPercent_' + idToShow).show();
- }
- </script>
- <form action="<%= url_for :action => 'create' -%>" method="POST" id="measure_create_form">
- <fieldset>
- <div class="modal-head">
- <h2><%= message('manual_measures.create_measure') -%></h2>
- </div>
- <% if @manual_metrics.empty? %>
- <div class="modal-body">
- <div class="info">
- <img style="vertical-align: text-bottom" src="<%= ApplicationController.root_context -%>/images/information.png">
- <%= message('manual_measures.no_more_available_metric') -%>
- <% if has_role?(:admin) %>
- <%= link_to message('manual_measures.to_define_new_manual_metric_il_require'), :controller => 'metrics', :action => 'index' -%>
- <% end %>
- </div>
- </div>
- <% else %>
- <div class="modal-body">
- <div class="modal-error"></div>
-
- <input type="hidden" name="id" value="<%= @resource.id -%>"/>
-
- <div class="modal-field">
- <label for="measures[]"><%= message('manual_measures.col.metric') -%> <em class="mandatory">*</em></label>
- <select name="metric" id="metricSelect" onChange="showPercentage()">
- <%= options_grouped_by_domain(@manual_metrics, nil, :include_empty => true) -%>
- </select>
- &nbsp;
- <%= link_to message('manual_measures.manage_metrics'), :controller => 'metrics', :action => 'index' if has_role?(:admin)-%>
- </div>
- <div class="modal-field">
- <label for="measures[]"><%= message('manual_measures.col.value') -%> <em class="mandatory">*</em></label>
- <input type="text" name="val" id="valueText" value=""/>
- <% @manual_metrics.each do |metric|
- if metric.value_type==Metric::VALUE_TYPE_PERCENT %>
- <span id="showPercent_<%= metric.key.parameterize -%>" style="display:none"> % </span>
- <% else %>
- <span id="showPercent_<%= metric.key.parameterize -%>" style="display:none"></span>
- <% end
- end %>
- </div>
- <div class="modal-field">
- <label for="measures[]"><%= message('manual_measures.col.description') -%> </label>
- <textarea rows="5" cols="50" name="desc" class="width100"></textarea>
- </div>
- </div>
- <% end %>
- <div class="modal-foot">
- <% if ! @manual_metrics.empty? %>
- <%= submit_tag message('create') %>
- <% end %>
- <%= link_to message('cancel'), :action => 'index', :id => @resource.id -%>
- </div>
- </fieldset>
- </form>
-
- <script>
- $j("#measure_create_form").modalForm();
- </script>
-
-</div>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_edit_form.html.erb
deleted file mode 100644
index bb37846b992..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/_edit_form.html.erb
+++ /dev/null
@@ -1,39 +0,0 @@
-<form action="<%= url_for :action => 'edit' -%>" method="POST" id="measure_edit_form">
- <fieldset>
- <div class="modal-head">
- <h2><%= message('manual_measures.edit_measure', :params => [h(@metric.short_name)]) -%></h2>
- </div>
-
- <div class="modal-body">
- <div class="modal-error"></div>
-
- <input type="hidden" name="id" value="<%= @resource.id -%>"/>
-
- <div class="modal-field">
- <input type="hidden" name="metric" id="metrictSelect" value="<%= @metric.key -%>" />
- </div>
-
- <div class="modal-field">
- <label for="measures[]"><%= message('manual_measures.col.value') -%> <em class="mandatory">*</em></label>
- <input type="text" name="val" id="valueText" value="<%= @measure ? @measure.editable_value : '' -%>"/>
- <% if @metric.value_type==Metric::VALUE_TYPE_PERCENT %>
- <span> % </span>
- <% end %>
- </div>
- <div class="modal-field">
- <label for="measures[]"><%= message('manual_measures.col.description') -%> </label>
- <textarea rows="5" cols="50" name="desc" class="width100"><%= @measure.description -%></textarea>
- </div>
- </div>
-
- <div class="modal-foot">
- <%= submit_tag message('save') %>
- <%= link_to message('cancel'), :action => 'index', :id => @resource.id -%>
- </div>
- </fieldset>
-</form>
-
-<script>
- $j("#measure_edit_form").modalForm();
-</script>
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/index.html.erb
deleted file mode 100644
index a38c2d2a833..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/manual_measures/index.html.erb
+++ /dev/null
@@ -1,88 +0,0 @@
-<style type="text/css">
- #manualMeasures td {
- vertical-align: top;
- }
-
- #manualMeasures td.pendingMeasure {
- background-color: orange;
- padding: 0 2px;
- width: 2px;
- }
-</style>
-
-<div class="page">
- <header class="page-header">
- <h1 class="page-title"><%= message('manual_measures.page') -%></h1>
- <div class="page-actions">
- <a id="addMeasureLink"
- href="<%=ApplicationController.root_context-%>/manual_measures/create_form/<%= @resource.id -%>"
- class="open-modal link-action"><%= message('manual_measures.add_measure') -%></a>
- </div>
- <p class="page-description"><%= message('manual_measures.page.description') -%></p>
- </header>
-
- <% has_pendings=false %>
- <table class="width100 data sortable" id="manualMeasures">
- <thead>
- <tr>
- <th style="padding: 0; margin: 0" class="nosort"></th>
- <th class="thin nowrap"><%= message('manual_measures.col.domain') -%></th>
- <th class="thin nowrap sortfirstasc"><%= message('manual_measures.col.metric') -%></th>
- <th class="thin nowrap nosort" style="text-align: right"><%= message('manual_measures.col.value') -%></th>
- <th><%= message('manual_measures.col.description') -%></th>
- <th class="righticon" style="text-align: right"><%= message('manual_measures.col.author') -%></th>
- <th class="righticon" style="text-align: right"><%= message('manual_measures.col.date') -%></th>
- <th class="thin nowrap nosort"><%= message('manual_measures.col.operations') -%></th>
- </tr>
- </thead>
- <tbody>
- <% if @measures.empty? %>
- <td colspan="8" class="even">No measures</td>
- <% end %>
- <%
- @measures.each do |measure|
- %>
- <a name="<%= measure.metric.key -%>"></a>
- <tr>
- <% if measure.pending?(@snapshot)
- has_pendings=true
- %>
- <td class="pendingMeasure"></td>
- <% else %>
- <td style="padding: 0"></td>
- <% end %>
- <td class="thin nowrap"><%= measure.metric.domain -%></td>
- <td class="thin nowrap"><%= measure.metric.short_name -%></td>
- <td class="thin nowrap" align="right"><%= measure.formatted_value -%></td>
- <td id="desc"><%= measure.description -%></td>
- <td align="right"><%= measure.username -%>
- </td>
- <td align="right">
- <%= l(measure.updated_at) -%>
- </td>
- <td class="thin nowrap">
- <a href="<%= url_for :controller => 'manual_measures', :action => 'edit_form', :metric => measure.metric.key, :id => @resource.id -%>" class="open-modal link-action"><%= message('edit') -%></a>&nbsp;
-
- <%= link_to_action message('delete'), "#{ApplicationController.root_context}/manual_measures/delete/#{ @resource.id}?metric=#{measure.metric.key}",
- :class => 'link-action link-red',
- :id => "delete_#{measure.metric.key}",
- :confirm_button => message('delete'),
- :confirm_title => message('manual_measures.delete_measure'),
- :confirm_msg => message('manual_measures.delete_measure.desc', :params => [measure.metric.short_name])
- -%>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <script>jQuery('#manualMeasures').sortable();</script>
-
- <% if has_pendings %>
- <div class="doc">
- <p>
- <span style="background-color: orange;width: 8px;height: 8px;display: inline-block;vertical-align: middle;margin-right: 5px"> </span>
- <%= message('manual_measures.pending_message') -%>
- </p>
- </div>
- <% end %>
-</div>