diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-22 13:32:00 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-25 13:47:25 +0200 |
commit | 2e0c8fc8d35b3baf8b116baf51d08ddee3b72fd8 (patch) | |
tree | 79d4ddc9f012a3ba6c0bcd0d67db89c970472f32 /server | |
parent | 7543c6b2d9e44f7055a2d378f9bbfc2a0fe5114c (diff) | |
download | sonarqube-2e0c8fc8d35b3baf8b116baf51d08ddee3b72fd8.tar.gz sonarqube-2e0c8fc8d35b3baf8b116baf51d08ddee3b72fd8.zip |
SONAR-7914 Drop project level "Manage Dashboards" page and actions
Diffstat (limited to 'server')
10 files changed, 29 insertions, 93 deletions
diff --git a/server/sonar-web/src/main/js/helpers/urls.js b/server/sonar-web/src/main/js/helpers/urls.js index ef25fe9a952..19bd44e6add 100644 --- a/server/sonar-web/src/main/js/helpers/urls.js +++ b/server/sonar-web/src/main/js/helpers/urls.js @@ -76,15 +76,6 @@ export function getComponentFixedDashboardUrl (componentKey, dashboardKey) { } /** - * Generate URL for a component's dashboards management page - * @param {string} componentKey - * @returns {string} - */ -export function getComponentDashboardManagementUrl (componentKey) { - return window.baseUrl + '/dashboards?resource=' + encodeURIComponent(componentKey); -} - -/** * Generate URL for a component's permissions page * @param {string} componentKey * @returns {string} diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js index 6ce4822c186..3028759fe08 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js @@ -21,13 +21,11 @@ import qs from 'querystring'; import _ from 'underscore'; import classNames from 'classnames'; import React from 'react'; - import LinksMixin from '../links-mixin'; import { translate, getLocalizedDashboardName } from '../../../helpers/l10n'; import { getComponentDashboardUrl, - getComponentFixedDashboardUrl, - getComponentDashboardManagementUrl + getComponentFixedDashboardUrl } from '../../../helpers/urls'; const SETTINGS_URLS = [ @@ -80,7 +78,6 @@ export default React.createClass({ isCustomDashboardsActive () { const dashboards = this.props.component.dashboards; return _.any(dashboards, this.isCustomDashboardActive) || - this.isDashboardManagementActive() || this.isDefaultDeveloperDashboardActive(); }, @@ -89,11 +86,6 @@ export default React.createClass({ return this.isDeveloper() && path.indexOf(window.baseUrl + '/dashboard') === 0; }, - isDashboardManagementActive () { - const path = window.location.pathname; - return path.indexOf(window.baseUrl + '/dashboards') === 0; - }, - renderOverviewLink() { const url = getComponentFixedDashboardUrl(this.props.component.key, ''); const name = <i className="icon-home"/>; @@ -118,7 +110,6 @@ export default React.createClass({ renderCustomDashboards() { const dashboards = this.props.component.dashboards.map(this.renderCustomDashboard); const className = classNames('dropdown', { active: this.isCustomDashboardsActive() }); - const managementLink = this.renderDashboardsManagementLink(); return <li className={className}> <a className="dropdown-toggle" data-toggle="dropdown" href="#"> {translate('layout.dashboards')} @@ -126,25 +117,10 @@ export default React.createClass({ </a> <ul className="dropdown-menu"> {dashboards} - {managementLink && <li className="divider"/>} - {managementLink} </ul> </li>; }, - renderDashboardsManagementLink() { - if (!window.SS.user) { - return null; - } - const key = 'dashboard-management'; - const url = getComponentDashboardManagementUrl(this.props.component.key); - const name = translate('dashboard.manage_dashboards'); - const className = classNames('pill-right', { active: this.isDashboardManagementActive() }); - return <li key={key} className={className}> - <a className="note" href={url}>{name}</a> - </li>; - }, - renderCodeLink() { if (this.isDeveloper()) { return null; diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb index 06b4e593a4f..3ca18a8aa5c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb @@ -24,36 +24,24 @@ class DashboardsController < ApplicationController before_filter :login_required def index - @global = !params[:resource] + @global = true @actives=ActiveDashboard.user_dashboards(current_user, @global) @shared_dashboards=Dashboard.all(:conditions => ['(shared=? or user_id=?) and is_global=?', true, current_user.id, @global]) active_ids=@actives.map(&:dashboard_id) @shared_dashboards.reject! { |d| active_ids.include?(d.id) } @shared_dashboards=Api::Utils.insensitive_sort(@shared_dashboards, &:name) - - if params[:resource] - @resource=Project.by_key(params[:resource]) - if @resource.nil? - # TODO display error page - redirect_to home_path - return false - end - access_denied unless has_role?(:user, @resource) - @snapshot = @resource.last_snapshot - @project=@resource # variable name used in old widgets - end end def create_form - @global = !params[:resource] + @global = true @dashboard = Dashboard.new - render :partial => 'create_form', :resource => params[:resource] + render :partial => 'create_form' end def create verify_post_request - @global = !params[:resource] + @global = true @dashboard = Dashboard.new() @dashboard.user_id = current_user.id load_dashboard_from_params(@dashboard) @@ -61,21 +49,21 @@ class DashboardsController < ApplicationController active_dashboard = current_user.active_dashboards.to_a.find { |ad| ad.name==@dashboard.name } if active_dashboard @dashboard.errors.add_to_base(Api::Utils.message('dashboard.error_create_existing_name')) - render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource] + render :partial => 'dashboards/create_form', :status => 400 elsif @dashboard.save add_default_dashboards_if_first_user_dashboard(@dashboard.global?) last_index=current_user.active_dashboards.max_by(&:order_index).order_index current_user.active_dashboards.create(:dashboard => @dashboard, :user => current_user, :order_index => (last_index+1)) render :text => CGI.escapeHTML(params[:resource]), :highlight => @dashboard.id, :status => 200 else - render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource] + render :partial => 'dashboards/create_form', :status => 400 end end def edit_form @dashboard = Dashboard.find(params[:id]) if @dashboard.editable_by?(current_user) - render :partial => 'edit_form', :resource => params[:resource] + render :partial => 'edit_form' else access_denied end @@ -98,7 +86,7 @@ class DashboardsController < ApplicationController render :text => CGI.escapeHTML(params[:resource]), :status => 200 else @dashboard.user = dashboard_owner - render :partial => 'dashboards/edit_form', :status => 400, :resource => params[:resource] + render :partial => 'dashboards/edit_form', :status => 400 end else access_denied @@ -108,7 +96,7 @@ class DashboardsController < ApplicationController def delete_form @dashboard = Dashboard.find(params[:id]) if @dashboard.editable_by?(current_user) - render :partial => 'delete_form', :resource => params[:resource] + render :partial => 'delete_form' else access_denied end @@ -125,7 +113,7 @@ class DashboardsController < ApplicationController render :text => CGI.escapeHTML(params[:resource]), :status => 200 else @dashboard.errors.add(message('dashboard.error_delete_default'), ' ') - render :partial => 'dashboards/delete_form', :status => 400, :resource => params[:resource] + render :partial => 'dashboards/delete_form', :status => 400 end end @@ -152,7 +140,7 @@ class DashboardsController < ApplicationController current_user.active_dashboards.create(:dashboard => dashboard, :user => current_user, :order_index => (last_active_dashboard ? last_active_dashboard.order_index+1 : 1)) end - redirect_to :action => 'index', :resource => params[:resource] + redirect_to :action => 'index' end def unfollow @@ -166,7 +154,7 @@ class DashboardsController < ApplicationController flash[:notice]=Api::Utils.message('dashboard.default_restored') end - redirect_to :action => 'index', :resource => params[:resource] + redirect_to :action => 'index' end @@ -188,7 +176,7 @@ class DashboardsController < ApplicationController end end - redirect_to :action => 'index', :resource => params[:resource] + redirect_to :action => 'index' end def load_dashboard_from_params(dashboard) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_available_dashboards.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_available_dashboards.html.erb index 35cd88de775..2f80d7fefdf 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_available_dashboards.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_available_dashboards.html.erb @@ -15,10 +15,9 @@ </tr> <% else @shared_dashboards.each do |dashboard| %> - <% resource_id = @resource.id if @resource %> <tr id="dashboard-<%= dashboard.id -%>" class="<%= cycle('even', 'odd', :name => 'shared') -%>"> <td> - <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id, :id => (resource_id unless dashboard.global?)}, + <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id}, :id => "view-#{u dashboard.name}" %> <div class="description"><%= h dashboard.description -%></div> </td> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb index 6ea50822919..c79ab4b210f 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb @@ -1,9 +1,5 @@ <form id="create-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/create"> - <% if @global %> - <input type="hidden" name="global" value="true" /> - <% else %> - <input type="hidden" name="resource" value="<%= h params[:resource] %>"/> - <% end %> + <input type="hidden" name="global" value="true" /> <fieldset> <div class="modal-head"> <h2><%= message('dashboard.new_dashboard') -%></h2> @@ -38,8 +34,6 @@ <script> $j("#create-dashboard-form").modalForm({success: function (data) { - var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = window.baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards'; }}); </script> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard_operations.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard_operations.html.erb index 472d7778eef..ae66c82c2d7 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard_operations.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard_operations.html.erb @@ -1,18 +1,17 @@ <td class="thin nowrap text-right"> - <% resource_id = @resource.id if @resource %> <% if dashboard.editable_by?(current_user) %> - <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => :configure, :did => dashboard.id, :id => (resource_id unless dashboard.global?)}, + <%= link_to message('dashboard.configure_widgets'), {:controller => :dashboard, :action => :configure, :did => dashboard.id}, :id => "configure-#{u dashboard.name}", :class => 'link-action' %> - <%= link_to message('edit'), {:action => :edit_form, :id => dashboard.id, :resource => resource_id}, + <%= link_to message('edit'), {:action => :edit_form, :id => dashboard.id}, :id => "edit-#{u dashboard.name}", :class => 'open-modal' %> <% if can_be_disabled %> - <%= link_to message('delete'), {:action => :delete_form, :id => dashboard.id, :resource => resource_id}, + <%= link_to message('delete'), {:action => :delete_form, :id => dashboard.id}, :id => "delete-#{u dashboard.name}", :class => 'open-modal text-danger' %> <% end %> <% end %> <% if can_be_disabled %> - <%= link_to message(subscription_action), {:action => subscription_action.to_sym, :id => dashboard.id, :resource => resource_id}, :method => :post, + <%= link_to message(subscription_action), {:action => subscription_action.to_sym, :id => dashboard.id}, :method => :post, :id => "#{subscription_action}-#{u dashboard.name}" %> <% end %> </td> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb index 2bbdcfa5270..b5494ee17bd 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb @@ -1,10 +1,6 @@ <form id="delete-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/delete"> <input type="hidden" name="id" value="<%= @dashboard.id -%>"> - <% if @dashboard.global %> - <input type="hidden" name="global" value="true" /> - <% else %> - <input type="hidden" name="resource" value="<%= h(params[:resource]) %>"/> - <% end %> + <input type="hidden" name="global" value="true" /> <fieldset> <div class="modal-head"> <h2><%= message 'dashboard.delete_confirm_title' -%></h2> @@ -26,7 +22,6 @@ <script> $j("#delete-dashboard-form").modalForm({success: function (data) { - var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = window.baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards'; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb index afd283ef4ac..09c82c5d924 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb @@ -1,10 +1,6 @@ <form id="edit-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/update"> <input type="hidden" name="id" value="<%= @dashboard.id -%>"> - <% if @dashboard.global %> - <input type="hidden" name="global" value="true" /> - <% else %> - <input type="hidden" name="resource" value="<%= h(params[:resource]) %>"/> - <% end %> + <input type="hidden" name="global" value="true" /> <fieldset> <div class="modal-head"> <h2><%= message('dashboard.edit_dashboard') -%></h2> @@ -45,7 +41,6 @@ <script> $j("#edit-dashboard-form").modalForm({success: function (data) { - var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : ''; - window.location = window.baseUrl + '/dashboards' + contextParams; + window.location = window.baseUrl + '/dashboards'; }}); </script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_my_dashboards.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_my_dashboards.html.erb index 3c2425053b5..5b3b526756d 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_my_dashboards.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_my_dashboards.html.erb @@ -15,10 +15,9 @@ </tr> <% else %> <% @actives.map(&:dashboard).each_with_index do |dashboard, index| %> - <% resource_id = @resource.id if @resource %> <tr id="dashboard-<%= dashboard.id -%>" class="<%= cycle('even', 'odd', :name => 'dashboard') -%>"> <td> - <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id, :id => (resource_id unless dashboard.global?)}, + <%= link_to h(dashboard.name(true)), {:controller => :dashboard, :action => :index, :did => dashboard.id}, :id => "view-#{u dashboard.name}" %> <div class="description"><%= h dashboard.description -%></div> </td> @@ -30,12 +29,12 @@ </td> <td class="order"> <% if index > 0 %> - <%= link_to '', {:action => :up, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "up-#{u dashboard.name}", :class => "icon-move-up" %> + <%= link_to '', {:action => :up, :id => dashboard.id}, :method => :post, :id => "up-#{u dashboard.name}", :class => "icon-move-up" %> <% else %> <%= image_tag('transparent_16.gif') %> <% end %> <% if index < @actives.size-1 %> - <%= link_to '', {:action => :down, :id => dashboard.id, :resource => resource_id}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %> + <%= link_to '', {:action => :down, :id => dashboard.id}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %> <% else %> <%= image_tag('transparent_16.gif') %> <% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb index eca8850357d..edbc0bf98e9 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/index.html.erb @@ -6,7 +6,7 @@ </li> </ul> - <h1><%= message(@global ? 'dashboard.my_global_dashboards' : 'dashboard.my_project_dashboards') -%></h1> + <h1><%= message('dashboard.my_global_dashboards') -%></h1> <%= render_partial :partial => 'my_dashboards', :locals => { :is_admin => is_admin? } %> <h1><%= message('dashboard.available_dashboards') -%></h1> |