diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-11-03 17:34:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 17:34:38 +0100 |
commit | 4c5465f67fdb404bbe983a53c753d1253785661a (patch) | |
tree | 836a5922a17efb401b9a6437b8e9b7dae5cdc93c /server/sonar-web/src/main | |
parent | f0774ea5179b30cb9cae1a3ce9e9c72eb7154156 (diff) | |
download | sonarqube-4c5465f67fdb404bbe983a53c753d1253785661a.tar.gz sonarqube-4c5465f67fdb404bbe983a53c753d1253785661a.zip |
drop global dashboards and measures from ui (#1353)
Diffstat (limited to 'server/sonar-web/src/main')
41 files changed, 2 insertions, 2594 deletions
diff --git a/server/sonar-web/src/main/js/apps/measures/app.js b/server/sonar-web/src/main/js/apps/measures/app.js deleted file mode 100644 index f3ce71cbaaf..00000000000 --- a/server/sonar-web/src/main/js/apps/measures/app.js +++ /dev/null @@ -1,202 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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. - */ -import _ from 'underscore'; -import Marionette from 'backbone.marionette'; -import FilterBar from './measures-filter-bar'; -import BaseFilters from '../../components/navigator/filters/base-filters'; -import CheckboxFilterView from '../../components/navigator/filters/checkbox-filters'; -import ChoiceFilters from '../../components/navigator/filters/choice-filters'; -import AjaxSelectFilters from '../../components/navigator/filters/ajax-select-filters'; -import FavoriteFilters from '../../components/navigator/filters/favorite-filters'; -import RangeFilters from '../../components/navigator/filters/range-filters'; -import StringFilterView from '../../components/navigator/filters/string-filters'; -import MetricFilterView from '../../components/navigator/filters/metric-filters'; -import { translate } from '../../helpers/l10n'; - -const NavigatorApp = new Marionette.Application(); - -const newLastAnalysisFilter = function () { - return new BaseFilters.Filter({ - name: translate('measure_filter.criteria.last_analysis'), - propertyFrom: 'ageMinDays', - propertyTo: 'ageMaxDays', - type: RangeFilters.RangeFilterView, - placeholder: translate('measure_filter.criteria.age.days'), - enabled: false, - optional: true - }); -}; - -const newMetricFilter = function (property) { - return new BaseFilters.Filter({ - property, - name: translate('measure_filter.criteria.metric'), - type: MetricFilterView, - metrics: window.SS.metrics, - periods: window.SS.metricPeriods, - operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' }, - enabled: false, - optional: true - }); -}; - -const newNameFilter = function () { - return new BaseFilters.Filter({ - name: translate('measure_filter.name_contains'), - property: 'nameSearch', - type: StringFilterView, - enabled: false, - optional: true - }); -}; - -const newAlertFilter = function () { - return new BaseFilters.Filter({ - name: translate('measure_filter.criteria.alert'), - property: 'alertLevels[]', - type: ChoiceFilters.ChoiceFilterView, - enabled: false, - optional: true, - choices: { - 'error': translate('measure_filter.criteria.alert.error'), - 'warn': translate('measure_filter.criteria.alert.warn'), - 'ok': translate('measure_filter.criteria.alert.ok') - } - }); -}; - -const showAlert = text => { - const alert = document.createElement('div'); - alert.classList.add('alert', 'alert-warning'); - alert.textContent = text; - - const container = document.querySelector('.navigator-details'); - container.insertBefore(alert, container.firstChild); -}; - -const init = function () { - NavigatorApp.addRegions({ filtersRegion: '.navigator-filters' }); - - this.filters = new BaseFilters.Filters(); - - if (_.isObject(window.SS.favorites)) { - this.filters.add([ - new BaseFilters.Filter({ - type: FavoriteFilters.FavoriteFilterView, - enabled: true, - optional: false, - choices: window.SS.favorites, - favoriteUrl: '/measures/filter', - manageUrl: '/measures/manage' - }) - ]); - } - - this.filters.add([ - new BaseFilters.Filter({ - name: translate('measure_filter.criteria.components'), - property: 'qualifiers[]', - type: ChoiceFilters.ChoiceFilterView, - enabled: true, - optional: false, - choices: window.SS.qualifiers, - defaultValue: translate('any') - }), - - new BaseFilters.Filter({ - name: translate('measure_filter.criteria.components_of'), - property: 'base', - type: AjaxSelectFilters.ComponentFilterView, - multiple: false, - enabled: false, - optional: true - }), - - new BaseFilters.Filter({ - name: translate('measure_filter.criteria.only_favorites'), - property: 'onFavourites', - type: CheckboxFilterView, - enabled: false, - optional: true - }), - - new BaseFilters.Filter({ - name: translate('measure_filter.criteria.date'), - propertyFrom: 'fromDate', - propertyTo: 'toDate', - type: RangeFilters.DateRangeFilterView, - enabled: false, - optional: true - }), - - new BaseFilters.Filter({ - name: translate('measure_filter.criteria.key_contains'), - property: 'keySearch', - type: StringFilterView, - enabled: false, - optional: true - }) - ]); - - this.filters.add([ - newLastAnalysisFilter(), - newMetricFilter('c3'), - newMetricFilter('c2'), - newMetricFilter('c1'), - newNameFilter(), - newAlertFilter() - ]); - - this.filterBarView = new FilterBar({ - collection: this.filters, - extra: { - sort: '', - asc: false - } - }); - - this.filtersRegion.show(this.filterBarView); - - if (window.queryParams) { - NavigatorApp.filterBarView.restoreFromQuery(window.queryParams); - } - key.setScope('list'); - - if (window.queryParams) { - const qualifiersFilter = window.queryParams.find(p => p.key === 'qualifiers[]'); - const noQualifiers = !qualifiersFilter || !qualifiersFilter.value || !qualifiersFilter.value.length; - - const baseFilter = window.queryParams.find(p => p.key === 'base'); - const noBase = !baseFilter || !baseFilter.value || !baseFilter.value.length; - - const favoritesFilter = window.queryParams.find(p => p.key === 'onFavourites'); - const noFavorites = !favoritesFilter || !favoritesFilter.value; - - if (noQualifiers && noBase && noFavorites) { - showAlert(translate('measures.select_components')); - } - } -}; - -NavigatorApp.on('start', function () { - init.call(NavigatorApp); -}); - -window.sonarqube.appStarted.then(options => NavigatorApp.start(options)); diff --git a/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js b/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js deleted file mode 100644 index 33dfbedae4d..00000000000 --- a/server/sonar-web/src/main/js/apps/measures/measures-filter-bar.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program 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. - * - * This program 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. - */ -import $ from 'jquery'; -import FilterBarView from '../../components/navigator/filters/filter-bar'; - -export default FilterBarView.extend({ - template () { - return $('#filter-bar-template').html(); - } -}); - diff --git a/server/sonar-web/src/main/js/apps/projects/components/App.js b/server/sonar-web/src/main/js/apps/projects/components/App.js index f58788129d8..a6513662112 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/App.js +++ b/server/sonar-web/src/main/js/apps/projects/components/App.js @@ -31,7 +31,7 @@ import '../styles.css'; export default class App extends React.Component { static propTypes = { - user: React.PropTypes.object, + user: React.PropTypes.oneOfType([React.PropTypes.object, React.PropTypes.bool]), fetchProjects: React.PropTypes.func.isRequired }; diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js index 3f76148af2e..1b00795944e 100644 --- a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js @@ -29,48 +29,6 @@ export default React.createClass({ return { globalDashboards: [], globalPages: [] }; }, - renderDashboardLink (dashboard) { - const url = `${window.baseUrl}/dashboard/index?did=${encodeURIComponent(dashboard.key)}`; - const name = this.getLocalizedDashboardName(dashboard.name); - return ( - <li key={dashboard.name}> - <a href={url}>{name}</a> - </li> - ); - }, - - renderDashboardsManagementLink () { - const url = window.baseUrl + '/dashboards'; - return ( - <li> - <a href={url}>{translate('dashboard.manage_dashboards')}</a> - </li> - ); - }, - - renderDashboards () { - if (window.SS.user) { - // do not render dashboards menu for authenticated users - return null; - } - - const dashboards = this.props.globalDashboards.map(this.renderDashboardLink); - const canManageDashboards = !!window.SS.user; - return ( - <li className="dropdown"> - <a className="dropdown-toggle" data-toggle="dropdown" href="#"> - {translate('layout.dashboards')} - <span className="icon-dropdown"/> - </a> - <ul className="dropdown-menu"> - {dashboards} - {canManageDashboards ? <li className="divider"/> : null} - {canManageDashboards ? this.renderDashboardsManagementLink() : null} - </ul> - </li> - ); - }, - renderProjects () { const url = window.baseUrl + '/projects'; return ( @@ -89,15 +47,6 @@ export default React.createClass({ ); }, - renderMeasuresLink () { - const url = window.baseUrl + '/measures/search?qualifiers[]=TRK'; - return ( - <li className={this.activeLink('/measures')}> - <a href={url}>{translate('layout.measures')}</a> - </li> - ); - }, - renderRulesLink () { const url = window.baseUrl + '/coding_rules'; return ( @@ -167,10 +116,8 @@ export default React.createClass({ render () { return ( <ul className="nav navbar-nav"> - {this.renderDashboards()} {this.renderProjects()} {this.renderIssuesLink()} - {this.renderMeasuresLink()} {this.renderRulesLink()} {this.renderProfilesLink()} {this.renderQualityGatesLink()} diff --git a/server/sonar-web/src/main/js/main/nav/settings/settings-nav.js b/server/sonar-web/src/main/js/main/nav/settings/settings-nav.js index 35313c30300..27e029f37df 100644 --- a/server/sonar-web/src/main/js/main/nav/settings/settings-nav.js +++ b/server/sonar-web/src/main/js/main/nav/settings/settings-nav.js @@ -81,7 +81,6 @@ export default React.createClass({ {this.renderLink('/settings/encryption', translate('property.category.security.encryption'))} {this.renderLink('/settings/server_id', translate('property.category.server_id'))} {this.renderLink('/metrics', 'Custom Metrics')} - {this.renderLink('/admin_dashboards', translate('default_dashboards.page'))} {this.props.extensions.map(e => this.renderLink(e.url, e.name))} </ul> </li> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb deleted file mode 100644 index 7336c98a363..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/admin_dashboards_controller.rb +++ /dev/null @@ -1,96 +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 AdminDashboardsController < ApplicationController - - SECTION=Navigation::SECTION_CONFIGURATION - - before_filter :admin_required - before_filter :load_default_dashboards - - def index - ids=@actives.map(&:dashboard_id) - @shared_dashboards=Dashboard.find(:all, :conditions => {:shared => true}).sort { |a, b| a.name.downcase<=>b.name.downcase } - @shared_dashboards.reject! { |s| ids.include?(s.id) } - end - - def down - verify_post_request - position(+1) - redirect_to :action => 'index' - end - - def up - verify_post_request - position(-1) - redirect_to :action => 'index' - end - - def add - verify_post_request - dashboard=Dashboard.find(params[:id]) - if dashboard and dashboard.shared? - last_index = @actives.max_by(&:order_index).order_index - - ActiveDashboard.create(:dashboard => dashboard, :order_index => last_index+1) - flash[:notice]='Default dashboard added.' - end - - redirect_to :action => 'index' - end - - def remove - verify_post_request - - to_be_removed = ActiveDashboard.find(params[:id]) - not_found unless to_be_removed - - remaining_defaults = @actives.select { |a| (a.global? == to_be_removed.global? && a.id != to_be_removed.id) } - if remaining_defaults.size == 0 - flash[:error]='At least one dashboard must be defined as default.' - else - to_be_removed.destroy - flash[:notice]='Dashboard removed from default dashboards.' - end - - redirect_to :action => 'index' - end - - private - - def load_default_dashboards - @actives=ActiveDashboard.default_dashboards - end - - def position(offset) - to_move = @actives.find { |a| a.id == params[:id].to_i } - if to_move - dashboards_same_type=@actives.select { |a| (a.global? == to_move.global?) }.sort_by(&:order_index) - - index = dashboards_same_type.index(to_move) - dashboards_same_type[index], dashboards_same_type[index + offset] = dashboards_same_type[index + offset], dashboards_same_type[index] - - dashboards_same_type.each_with_index do |a, i| - a.order_index=i+1 - a.save - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index fc2247ec8de..4fb0a3fc1e6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -22,8 +22,6 @@ class DashboardController < ApplicationController SECTION=Navigation::SECTION_RESOURCE - before_filter :login_required, :except => [:index] - def index if params[:id] @resource = Project.by_key(params[:id]) @@ -58,148 +56,13 @@ class DashboardController < ApplicationController if logged_in? return redirect_to :controller => 'account' else - load_dashboard() - load_authorized_widget_definitions() - end - end - end - - def configure - 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() || (!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])) + return redirect_to :controller => 'projects' end end end - def widget_definitions - @category=params[:category] - 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]) - else - active=ActiveDashboard.user_dashboards(current_user).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]) - else - active=ActiveDashboard.user_dashboards(nil).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 project_not_found flash[:error] = message('dashboard.project_not_found') redirect_to :action => :index @@ -208,24 +71,4 @@ class DashboardController < ApplicationController 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/dashboards_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb deleted file mode 100644 index 7baf8e59600..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb +++ /dev/null @@ -1,196 +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 DashboardsController < ApplicationController - - SECTION=Navigation::SECTION_RESOURCE - - before_filter :login_required - - def index - @actives=ActiveDashboard.user_dashboards(current_user) - @shared_dashboards=Dashboard.all(:conditions => ['(shared=? or user_id=?)', true, current_user.id]) - active_ids=@actives.map(&:dashboard_id) - @shared_dashboards.reject! { |d| active_ids.include?(d.id) } - @shared_dashboards=Api::Utils.insensitive_sort(@shared_dashboards, &:name) - end - - def create_form - @global = true - @dashboard = Dashboard.new - render :partial => 'create_form' - end - - def create - verify_post_request - @global = true - @dashboard = Dashboard.new() - @dashboard.user_id = current_user.id - load_dashboard_from_params(@dashboard) - - 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 - 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 - end - end - - def edit_form - @dashboard = Dashboard.find(params[:id]) - if @dashboard.editable_by?(current_user) - render :partial => 'edit_form' - else - access_denied - end - end - - def update - verify_post_request - @dashboard = Dashboard.find(params[:id]) - dashboard_owner = @dashboard.user - if @dashboard.editable_by?(current_user) - load_dashboard_from_params(@dashboard) - if @dashboard.save - - # SONAR-4979 If the dashboard is no more shared, current user has to unfollow it if he was following it - unless @dashboard.shared - active = current_user.active_dashboards.to_a.find { |a| (a.user_id == dashboard_owner.id) && (a.dashboard_id == @dashboard.id)} - active.destroy if active - end - - render :text => CGI.escapeHTML(params[:resource]), :status => 200 - else - @dashboard.user = dashboard_owner - render :partial => 'dashboards/edit_form', :status => 400 - end - else - access_denied - end - end - - def delete_form - @dashboard = Dashboard.find(params[:id]) - if @dashboard.editable_by?(current_user) - render :partial => 'delete_form' - else - access_denied - end - end - - def delete - verify_post_request - @dashboard=Dashboard.find(params[:id]) - - access_denied unless @dashboard.editable_by?(current_user) - - if @dashboard.destroy - flash[:warning]=Api::Utils.message('dashboard.default_restored') if ActiveDashboard.count(:conditions => {:user_id => current_user.id})==0 - render :text => CGI.escapeHTML(params[:resource]), :status => 200 - else - @dashboard.errors.add(message('dashboard.error_delete_default'), ' ') - render :partial => 'dashboards/delete_form', :status => 400 - end - end - - def down - verify_post_request - position(+1) - end - - def up - verify_post_request - position(-1) - end - - def follow - verify_post_request - dashboard=Dashboard.find(params[:id]) - - add_default_dashboards_if_first_user_dashboard(dashboard.global?) - active_dashboard = current_user.active_dashboards.to_a.find { |ad| ad.name==dashboard.name } - if active_dashboard - flash[:error]=Api::Utils.message('dashboard.error_follow_existing_name') - else - last_active_dashboard=current_user.active_dashboards.max_by(&:order_index) - 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' - end - - def unfollow - verify_post_request - dashboard=Dashboard.find(params[:id]) - - add_default_dashboards_if_first_user_dashboard(dashboard.global?) - ActiveDashboard.destroy_all(:user_id => current_user.id, :dashboard_id => params[:id].to_i) - - if ActiveDashboard.count(:conditions => {:user_id => current_user.id})==0 - flash[:notice]=Api::Utils.message('dashboard.default_restored') - end - - redirect_to :action => 'index' - end - - - private - - def position(offset) - dashboard=Dashboard.find(params[:id]) - - add_default_dashboards_if_first_user_dashboard(dashboard.global?) - actives=current_user.active_dashboards.select { |a| a.global? == dashboard.global? }.sort_by(&:order_index) - - index = actives.index { |a| a.dashboard_id == dashboard.id } - if index - actives[index], actives[index + offset] = actives[index + offset], actives[index] - - actives.each_with_index do |a, i| - a.order_index=i+1 - a.save - end - end - - redirect_to :action => 'index' - end - - def load_dashboard_from_params(dashboard) - dashboard.name = params[:name] - dashboard.description = params[:description] - dashboard.shared = params[:shared].present? - dashboard.column_layout = Dashboard::DEFAULT_LAYOUT if !dashboard.column_layout - dashboard.user = User.find_active_by_login(params[:owner]) unless params[:owner].nil? - end - - def add_default_dashboards_if_first_user_dashboard(global) - unless current_user.active_dashboards.any? { |a| a.global? == global } - ActiveDashboard.default_dashboards.select { |a| a.global? == global }.each do |default_active| - current_user.active_dashboards.create(:dashboard => default_active.dashboard, :user => current_user, :order_index => default_active.order_index) - end - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb deleted file mode 100644 index 4d4ea18e494..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ /dev/null @@ -1,350 +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 MeasuresController < ApplicationController - - SECTION=Navigation::SECTION_MEASURES - - # GET /measures/index - def index - @filter = MeasureFilter.new - render :action => 'search' - end - - def search - if params[:id] - @filter = find_filter(params[:id]) - else - @filter = MeasureFilter.new - end - @filter.criteria=criteria_params - - # SONAR-4997 - # Only list display is now managed - @filter.set_criteria_value(:display, 'list') - @filter.execute(self, :user => current_user) - - if request.xhr? - render :partial => 'measures/display', :locals => {:filter => @filter, :edit_mode => false, :widget_id => params[:widget_id]} - end - end - - # Load existing filter - # GET /measures/filter/<filter id> - def filter - require_parameters :id - - @filter = find_filter(params[:id]) - @filter.load_criteria_from_data - # criteria can be overridden - @filter.override_criteria(criteria_params) - - # SONAR-4997 - # Only list display is now managed - @filter.set_criteria_value(:display, 'list') - - @filter.execute(self, :user => current_user) - @unchanged = true - - render :action => 'search' - end - - # GET /measures/save_as_form?[id=<id>][&criteria] - def save_as_form - if params[:id].present? - @filter = find_filter(params[:id]) - else - @filter = MeasureFilter.new - end - @filter.criteria=criteria_params_without_page_id - @filter.convert_criteria_to_data - render :partial => 'measures/save_as_form' - end - - # POST /measures/save_as?[id=<id>]&name=<name>[¶meters] - def save_as - verify_post_request - access_denied unless logged_in? - - add_to_favourites=false - if params[:id].present? - @filter = find_filter(params[:id]) - else - @filter = MeasureFilter.new - @filter.user_id=current_user.id - add_to_favourites=true - end - @filter.name=params[:name] - @filter.description=params[:description] - @filter.shared=(params[:shared]=='true') - @filter.data=URI.unescape(params[:data]) - if @filter.save - current_user.favourited_measure_filters<<@filter if add_to_favourites - render :text => @filter.id.to_s, :status => 200 - else - render_measures_error(@filter) - end - end - - # POST /measures/save?id=<id>&[criteria] - def save - verify_post_request - require_parameters :id - access_denied unless logged_in? - - @filter = find_filter(params[:id]) - @filter.criteria=criteria_params_without_page_id - @filter.convert_criteria_to_data - unless @filter.save - flash[:error]='Error' - end - redirect_to :action => 'filter', :id => @filter.id - end - - # GET /measures/manage - def manage - access_denied unless logged_in? - @filter = MeasureFilter.new - @shared_filters = MeasureFilter.all(:include => :user, - :conditions => ['shared=? and (user_id is null or user_id<>?)', true, current_user.id]) - Api::Utils.insensitive_sort!(@shared_filters) { |elt| elt.name } - @fav_filter_ids = current_user.measure_filter_favourites.map { |fav| fav.measure_filter_id } - end - - # GET /measures/edit_form/<filter id> - def edit_form - require_parameters :id - @filter = find_filter(params[:id]) - render :partial => 'measures/edit_form' - end - - # POST /measures/edit/<filter id>?name=<name>&description=<description>&shared=<true|false> - def edit - verify_post_request - access_denied unless logged_in? - require_parameters :id - - @filter = MeasureFilter.find(params[:id]) - access_denied unless @filter.owner?(current_user) || has_role?(:admin) - - @filter.name=params[:name] - @filter.description=params[:description] - @filter.shared=(params[:shared]=='true') - if has_role?(:admin) && params[:owner] - @filter.user = User.find_by_login(params[:owner]) - end - - if @filter.save - # SONAR-4469 - # If filter become unshared then remove all favorite filters linked to it, expect favorite of filter's owner - MeasureFilterFavourite.delete_all(['user_id<>? and measure_filter_id=?', @filter.user.id, params[:id]]) if params[:shared]!='true' - - render :text => @filter.id.to_s, :status => 200 - else - render_measures_error(@filter) - end - end - - # GET /measures/copy_form/<filter id> - def copy_form - require_parameters :id - @filter = find_filter(params[:id]) - @filter.shared = false - @filter.user_id = nil - render :partial => 'measures/copy_form' - end - - # POST /measures/copy/<filter id>?name=<copy name>&description=<copy description> - def copy - verify_post_request - access_denied unless logged_in? - require_parameters :id - - source = find_filter(params[:id]) - target = MeasureFilter.new - target.name=params[:name] - target.description=params[:description] - target.user_id=current_user.id - target.shared=(params[:shared]=='true') - target.data=source.data - if target.save - current_user.favourited_measure_filters << target - render :text => target.id.to_s, :status => 200 - else - render_measures_error(target) - end - end - - # POST /measures/delete/<filter id> - def delete - verify_post_request - access_denied unless logged_in? - require_parameters :id - - @filter = find_filter(params[:id]) - @filter.destroy - redirect_to :action => 'manage' - end - - def favourites - verify_ajax_request - render :partial => 'measures/favourites' - end - - # POST /measures/toggle_fav/<filter id> - def toggle_fav - access_denied unless logged_in? - require_parameters :id - - favourites = MeasureFilterFavourite.all(:conditions => ['user_id=? and measure_filter_id=?', current_user.id, params[:id]]) - if favourites.empty? - filter = find_filter(params[:id]) - current_user.favourited_measure_filters<<filter if filter.shared || filter.owner?(current_user) - is_favourite = true - else - favourites.each { |fav| fav.delete } - is_favourite = false - end - - render :text => is_favourite.to_s, :status => 200 - end - - # - # GET /measures/search_filter?<parameters> - # - # -- Example - # curl -v -u admin:admin 'http://localhost:9000/measures/search_filter?filter=123&metrics=ncloc,complexity - # &fields=name,longName,date,links,favorite,measureTrend,measureStatus,measureVariation&pageSize=100&page=1&sort=metric:ncloc&asc=true' - # - def search_filter - require_parameters :filter - - fields = (params[:fields].split(',') if params[:fields]) || [] - display_links = fields.include?('links') - display_variation = fields.include?('measureVariation') - metrics = params[:metrics].split(',') if params[:metrics] - - filter = find_filter(params[:filter]) - filter.load_criteria_from_data - filter.override_criteria(criteria_params) - filter.metrics= params[:metrics].split(',') if metrics - filter.require_links= display_links - # Force the display to none in case this value was saved to 'list' in the db - filter.set_criteria_value('display', 'none') - filter.execute(self, :user => current_user) - - hash = {} - components_json = [] - filter.rows.each do |row| - component = row.resource - component_hash = {} - component_hash[:key] = component.key - component_hash[:name] = component.name if fields.include?('name') && component.name - component_hash[:longName] = component.long_name if fields.include?('longName') && component.long_name - component_hash[:qualifier] = component.qualifier if component.qualifier - component_hash[:favorite] = logged_in? && current_user.favourite?(component.id) if fields.include?('favourite') - component_hash[:date] = Api::Utils.format_datetime(row.analysis.created_at) if fields.include?('date') && row.analysis.created_at - component_hash[:fdate] = human_short_date(row.analysis.created_at) if fields.include?('date') && row.analysis.created_at - - if display_links && row.links - links_hash = {} - row.links.each do |link| - links_hash[:name] = link.name if link.name - links_hash[:type] = link.link_type if link.link_type - links_hash[:url] = link.href if link.href - end - component_hash[:links] = links_hash - end - - if metrics - component_hash[:measures] = {} - row.measures.each do |measure| - component_hash[:measures][measure.metric.key] = {} - component_hash[:measures][measure.metric.key][:val] = measure.value if measure.value - component_hash[:measures][measure.metric.key][:fval] = measure.formatted_value if measure.value - component_hash[:measures][measure.metric.key][:text] = measure.data if measure.data - component_hash[:measures][measure.metric.key][:status] = measure.alert_status if fields.include?('measureStatus') && measure.alert_status - component_hash[:measures][measure.metric.key][:p1] = measure.variation_value_1 if display_variation && measure.variation_value_1 - component_hash[:measures][measure.metric.key][:p2] = measure.variation_value_2 if display_variation && measure.variation_value_2 - component_hash[:measures][measure.metric.key][:p3] = measure.variation_value_3 if display_variation && measure.variation_value_3 - component_hash[:measures][measure.metric.key][:p4] = measure.variation_value_4 if display_variation && measure.variation_value_4 - component_hash[:measures][measure.metric.key][:p5] = measure.variation_value_5 if display_variation && measure.variation_value_5 - end - end - components_json << component_hash - end - - hash[:metrics] = {} - filter.metrics.each do |metric| - hash[:metrics][metric.key] = { - :name => metric.short_name, - :type => metric.val_type, - :direction => metric.direction - } - hash[:metrics][metric.key][:worstValue] = metric.worst_value if metric.worst_value - hash[:metrics][metric.key][:bestValue] = metric.best_value if metric.best_value - end - - hash[:components] = components_json - hash[:maxResultsReached] = filter.security_exclusions - hash[:paging] = {} - hash[:paging][:page] = filter.pagination.page - hash[:paging][:pages] = filter.pagination.pages - hash[:paging][:pageSize] = filter.pagination.limit - hash[:paging][:total] = filter.pagination.count - - respond_to do |format| - format.json { render :json => hash } - end - end - - - private - - def find_filter(id) - filter = MeasureFilter.find(id) - access_denied unless filter.shared || filter.owner?(current_user) - filter - end - - def criteria_params_without_page_id - params.merge({:controller => nil, :action => nil, :search => nil, :widget_id => nil, :edit => nil}) - params.delete(:page) - params - end - - def criteria_params - params.merge({:controller => nil, :action => nil, :search => nil, :widget_id => nil, :edit => nil}) - end - - def render_measures_error(filter) - errors = [] - filter.errors.full_messages.each { |msg| errors<<CGI.escapeHTML(msg) + '<br/>' } - render :text => errors, :status => 400 - end - - def human_short_date(date) - if Date.today - date.to_date == 0 - date.strftime('%H:%M') - else - l(date.to_date) - end - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/widget_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/widget_controller.rb deleted file mode 100644 index c40d8764c50..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/widget_controller.rb +++ /dev/null @@ -1,86 +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 WidgetController < ApplicationController - helper :dashboard - - SECTION=Navigation::SECTION_RESOURCE - - def index - load_resource - load_widget - params[:layout]='false' - render :action => 'index' - end - - def show - load_resource - load_widget - begin - render :inline => @widget_definition.getTarget().getTemplate(), :locals => { - :widget_properties => @widget.properties_as_hash, :widget => @widget, :dashboard_configuration => @dashboard_configuration - } - rescue => error - logger.error(message('dashboard.cannot_render_widget_x', :params => [@widget_definition.getId(), error]), error) - render :status => 500 - end - - end - - private - - def load_resource - if params[:resource] - @resource=Project.by_key(params[:resource]) - not_found("Resource not found") unless @resource - access_denied unless has_role?(:user, @resource) - - @project=@resource - @snapshot = @resource.last_snapshot - end - end - - def load_widget - widget_key=params[:id] - @widget_definition = java_facade.getWidget(widget_key) - not_found('Unknown widget') unless @widget_definition - - authorized=(@widget_definition.getUserRoles().size==0) - unless authorized - @widget_definition.getUserRoles().each do |role| - authorized=(role=='user') || (role=='viewer') || has_role?(role, @resource) - break if authorized - end - end - access_denied unless authorized - - @widget=Widget.new(:widget_key => widget_key) - @widget.id=1 - @widget_definition.getWidgetProperties().each do |property_definition| - value = params[property_definition.key()] - @widget.properties<<WidgetProperty.new( - :widget => @widget, - :kee => property_definition.key(), - :text_value => (value.blank? ? property_definition.defaultValue : value) - ) - end - @dashboard_configuration=Api::DashboardConfiguration.new(nil, :period_index => params[:period], :snapshot => @snapshot) - @widget_width = params[:widget_width] || '350px' - end -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb deleted file mode 100644 index ae9e6bea1dd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/_list.html.erb +++ /dev/null @@ -1,46 +0,0 @@ -<table class="data" id="<%= group -%>"> - <thead> - <tr> - <th class="name"><%= message('name') -%></th> - <th class="owner"><%= message('shared_by') -%></th> - <th class="order"><%= message('order') -%></th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if active_dashboards.empty? %> - <tr class="even"> - <td colspan="4" class="empty"><%= message('dashboard.no_dashboard') -%></td> - </tr> - <% else %> - <% active_dashboards.each_with_index do |active, index| %> - <tr id="active-<%= u active.name -%>" class="<%= cycle('even', 'odd', :name => group) -%>"> - <td> - <div><%= h(active.name(true)) -%></div> - <div class="description"><%= active.dashboard.description -%></div> - </td> - <td class="owner"> - <%= h(active.dashboard.user_name || message('dashboard.username.default')) -%> - </td> - <td class="order"> - <% if index > 0 %> - <%= link_to '', {:action => :up, :id => active.id}, :method => :post, :id => "up-#{u active.name}", :class => 'icon-move-up' %> - <% else %> - <%= image_tag('transparent_16.gif') %> - <% end %> - <% if index < active_dashboards.size-1 %> - <%= link_to '', {:action => :down, :id => active.id}, :method => :post, :id => "down-#{u active.name}", :class => 'icon-move-down' %> - <% else %> - <%= image_tag('transparent_16.gif') %> - <% end %> - </td> - <td class="thin nowrap text-right"> - <% if active_dashboards.size() > 1 %> - <%= link_to 'Remove from defaults', {:action => :remove, :id => active.id}, {:confirm => 'Are you sure to remove it from default dashboards?', :method => :post, :id => "remove-#{u active.name}", :class => 'link-action'} %> - <% end %> - </td> - </tr> - <% end %> - <% end %> - </tbody> -</table> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb deleted file mode 100644 index e57ce66c4c3..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/admin_dashboards/index.html.erb +++ /dev/null @@ -1,49 +0,0 @@ -<div class="page"> - <header class="page-header"> - <h1 class="page-title"><%= message('dashboard.global_dashboards') -%></h1> - <p class="page-description"><%= message('dashboard.global_dashboards.description') -%></p> - </header> - - <%= render :partial => 'list', :locals => {:active_dashboards => @actives.select(&:global?), :group => 'activeGlobal'} %> - - <header class="page-header huge-spacer-top"> - <h1 class="page-title"><%= message('dashboard.shared_dashboards') -%></h1> - <p class="page-description"><%= message('dashboard.shared_dashboards.description') -%></p> - </header> - - <table class="data" id="shared"> - <thead> - <tr> - <th class="name"><%= message('name') -%></th> - <th class="owner"><%= message('shared_by') -%></th> - <th class="global"><%= message('global') -%></th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if @shared_dashboards.empty? %> - <tr class="even"> - <td colspan="4"><%= message('dashboard.no_dashboard') -%></td> - </tr> - <% else %> - <% @shared_dashboards.each do |dashboard| %> - <tr class="<%= cycle('even', 'odd') -%>"> - <td> - <div><%= h(dashboard.name(true)) -%></div> - <div class="description"><%= dashboard.description -%></div> - </td> - <td class="owner"> - <%= h(dashboard.user_name || message('dashboard.username.default')) -%> - </td> - <td class="global"> - <%= boolean_icon(dashboard.global) -%> - </td> - <td class="thin nowrap text-right"> - <%= link_to 'Add to defaults', {:action => 'add', :id => dashboard.id}, {:method => :post, :id => "add-#{u dashboard.name}", :class => 'link-action'} %> - </td> - </tr> - <% end %> - <% end %> - </tbody> - </table> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_configure_widget.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_configure_widget.html.erb deleted file mode 100644 index b3f6a8dcbaa..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_configure_widget.html.erb +++ /dev/null @@ -1,55 +0,0 @@ -<% - switch_to_widget_resource(widget) - widget_body=widget_body(widget) - default_layout=(widget.layout=='DEFAULT') -%> - -<div class="widget-header"> - <div class="widget-actions"> - <% if widget.java_definition.isEditable() || (!widget.java_definition.global) %> - <a class="link-action" onclick="portal.editWidget(<%= widget.id -%>);return false;"><%= message('edit') -%></a> - <% end %> - <a class="link-action" onclick="portal.deleteWidget(this);return false;"><%= message('delete') -%></a> - </div> - <div class="widget-handle"> - <%= h message('widget.' + widget.java_definition.getId() + '.name', :default => widget.java_definition.getTitle()) -%> - </div> -</div> - -<div class="widget_props" id="widget_props_<%= widget.id -%>" style="<%= 'display:none' if widget.configured -%>"> - <%= render :partial => 'widget_properties', :locals => {:widget => widget} -%> -</div> - -<%= render :partial => 'widget_title', :locals => {:widget => widget} -%> -<div id="widget_<%= widget.id -%>" class="configure_widget <%= h widget.java_definition.getId() -%>" style="height:100%;<%= 'display:none;' if !widget.configured -%>"> - <div class="transparent"></div> - <% if !widget_body %> - <div class="block"> - <% if default_layout %> - <div class="widget"> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [widget.key]) -%></span> - <div class="clear"></div> - </div> - <% else %> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [widget.key]) -%></span> - <% end %> - </div> - <% elsif widget_body.include? '<' %> - <% - - if default_layout - %> - <div class="widget"> - <% end %> - <%= widget_body -%> - <% if default_layout %> - <div class="clear"></div> - </div> - <% end %> - <% else %> - <div class="widget"><p><%= message('no_data') -%></p></div> - <% end %> - <div style="clear: both;"></div> -</div> - -<% restore_global_resource %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb deleted file mode 100644 index 0b13c900ff9..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<header class="page-header"> - <h1 class="page-title"><%= h @dashboard.name(true) -%></h1> - - - <div class="page-actions noprint"> - <% if @snapshot %> - <% if @snapshot.periods? %> - <% period_options = period_select_option_tags(@snapshot, 'small') %> - <% if period_options %> - <form method="GET" action="<%= url_for :controller => :dashboard, :action => :index, :id => @resource.id -%>" style="display: inline" class="spacer-left"> - <input type="hidden" name="did" value="<%= @dashboard.id -%>"/> - <%= dropdown_tag 'period', period_options, {:width => '250px'}, {:id => 'select-comparison', :onchange => 'submit()'} -%> - </form> - <% end %> - <% end %> - <% end %> - - <% if logged_in? %> - <div class="button-group"> - <% if back %> - <%= link_to message('dashboard.back_to_dashboard'), dashboard_action(:index), :class => 'button' -%> - <% else %> - <% if @dashboard.editable_by?(current_user) %> - <%= link_to message('dashboard.configure_widgets'), dashboard_action(:configure), :class => 'button' -%> - <% end %> - <% end %> - </div> - <% end %> - </div> -</header> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget.html.erb deleted file mode 100644 index b706fd19076..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -<% - switch_to_widget_resource(widget) - widget_body=widget_body(widget) - default_layout=(widget.java_definition.getWidgetLayout().name()=='DEFAULT') -%> - -<% if !widget.configured %> -<div class="block"> - <div class="widget"> - <span class="empty_widget"> - <a class="note" href="<%= url_for(dashboard_action(:configure)) -%>"><%= message('dashboard.please_configure_the_widget_x', :params => widget.java_definition.getTitle()) -%></a> - </span> - <div class="clear"></div> - </div> -</div> - -<% elsif !widget_body %> - <div class="block"> - <% if default_layout %> - <div class="widget"> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [widget.key]) -%></span> - <div class="clear"></div> - </div> - <% else %> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [widget.key]) -%></span> - <% end %> - </div> - -<% elsif widget_body.include?('<') %> - <div class="block" id="block_<%= widget.id -%>"> - <%= render :partial => 'widget_title', :locals => {:widget => widget} -%> - - <div class="<%= h widget.key -%>" style="height:100%;"> - <% if default_layout %> - <div class="widget"> - <%= widget_body -%> - <div class="clear"></div> - </div> - <% else %> - <%= widget_body -%> - <% end %> - - <div style="clear: both;"></div> - </div> - </div> -<% end %> - -<% restore_global_resource %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definition.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definition.html.erb deleted file mode 100644 index c0ab98601ff..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definition.html.erb +++ /dev/null @@ -1,10 +0,0 @@ - <div class="widget_def" id="def_<%= definition.id.tr('_', '') -%>"> - <p><b><%= h message("widget.#{definition.id}.name", :default => definition.title) -%></b></p> - - <p><%= h message("widget.#{definition.id}.description", :default => definition.description) -%></p> - - <% form_tag dashboard_action(:add_widget, :widget => definition.id) do -%> - <input type="hidden" name="category" value="<%= category -%>"> - <input type="submit" value="<%= message('dashboard.add_widget') -%>" id="add-widget-<%= u(definition.id) -%>"> - <% end -%> - </div>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definitions.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definitions.html.erb deleted file mode 100644 index 64ed279cc23..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_definitions.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<table class="width100"> - <tr style="line-height: 20px;text-align: right"> - <td valign="top"> - <ul class="horizontal widget_categs" id="widget-filters"> - <li>Category:</li> - <li class="<%= 'selected' if category.blank? -%>"> - <a href="#" onClick="return filterWidgetsByCategory('')" id="widget-filter-none"><%= message('any') -%></a> - </li> - <% @widget_categories.each do |c| %> - <li class="<%= 'selected' if category==c -%>"> - <a href="#" onClick="return filterWidgetsByCategory('<%= escape_javascript(c) -%>')" id="widget-filter-<%= u(c) -%>"><%= h(c) -%></a> - </li> - <% end %> - </ul> - <%= image_tag 'loading.gif', :style => 'vertical-align: top; display: none', :id => 'filter-widgets-loading' -%> - </td> - <td nowrap valign="top"> - Search: - <input id="filter-widget-box" name="filter-widget-box" size="10" onKeyUp="filtersWidgetsByContent(this.value);" type="text"/> - </td> - </tr> -</table> - -<% @widget_definitions.each do |definition| %> - <%= render :partial => 'widget_definition', :locals => {:definition => definition, :dashboard => @dashboard, :resource => @resource, :category => category} %> -<% end %> - diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb deleted file mode 100644 index c333abd9e9e..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb +++ /dev/null @@ -1,79 +0,0 @@ -<form id="configure-widget-<%= widget.id -%>" method="post" action="<%= ApplicationController.root_context -%>/dashboard/save_widget?wid=<%= widget.id -%>"> - <div id="error<%= widget.id -%>" class="error" style="display: none"></div> - <table class="table width100"> - <tbody> - - <% if !widget.java_definition.global %> - <tr> - <td class="form-key-cell"><%= message('widget.resource_id') %> <em class="mandatory">*</em></td> - <td class="form-val-cell" id="row_resource"> - <%= resource_select_tag 'resource_id', { - :resource_type_property => 'supportsGlobalDashboards', - :selected_resource => widget.resource, - :width => '250px', - :html_id => "widget-#{widget.id}-select-prj-#{widget.key.parameterize}", - :html_class => "widget-select-prj-#{widget.key.parameterize}" - } -%> - </td> - </tr> - <% end %> - - <% widget.java_definition.getWidgetProperties().each do |property_def| %> - <tr> - <td class="form-key-cell"><%= message("widget." + widget.key + ".property." + property_def.key() + ".name", :default => property_def.key()) -%><%= " *" unless property_def.optional() -%></td> - <td class="form-val-cell" id="row_<%= property_def.key() -%>"> - <%= property_value_field(property_def, widget.property_text_value(property_def.key()), widget) -%> - <div class="form-val-note"> - <% - # Old key used for retro-compatibility - property_description = message("widget." + widget.key + ".param." + property_def.key(), :default => '') - property_description = message("widget." + widget.key + ".property." + property_def.key() + ".desc", :default => property_def.description()) unless property_description != '' - -%> - - <% unless property_description.blank? -%> - <div><%= property_description -%></div> - <% end %> - <% if !property_def.defaultValue.blank? || property_def.type.name == PropertyType::TYPE_BOOLEAN -%> - <div><%= message('default') %>: <%= h(default_value property_def) -%></div> - <% end -%> - </div> - </td> - </tr> - <% end %> - - <tr> - <td colspan="2"> - <%= submit_tag message('save'), :id => "widget-#{widget.id}-save-#{widget.key.parameterize}", :class => "widget-save-#{widget.key.parameterize}" -%> - <% if widget.configured %> - <a href="#" onClick="portal.cancelEditWidget(<%= widget.id -%>);return false;"><%= message('cancel') -%></a> - <% end %> - </td> - </tr> - </tbody> - </table> - <%= hidden_field_tag "widgetid", "", :class => "widgetid" %> -</form> - -<script> - (function ($) { - $('#configure-widget-<%= widget.id -%>').on('submit', function (e) { - e.preventDefault(); - var form = $(e.currentTarget); - var resourceInput = form.find('input[name="resource_id"]'); - if (resourceInput.length && !resourceInput.val()) { - $('#error<%= widget.id -%>').text('<%= escape_javascript message('widget.select_project') -%>'); - $('#error<%= widget.id -%>').show(); - } else { - $.ajax({ - url: window.baseUrl + '/dashboard/save_widget?wid=<%= widget.id -%>&id=<%= params[:id] -%>', - type: 'POST', - data: form.serialize(), - error: function (request) { - $('#error<%= widget.id -%>').text(request.responseText); - $('#error<%= widget.id -%>').show(); - } - }); - } - }); - })(window.jQuery); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb deleted file mode 100644 index 0c9fb7ae468..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/_widget_title.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<% unless widget_title(widget).blank? %> - <div class="widget-title" id="widget_title_<%= widget.id -%>"><%= widget_title(widget) -%></div> -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb deleted file mode 100644 index 48b2288e5fa..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/configure.html.erb +++ /dev/null @@ -1,110 +0,0 @@ -<% content_for :script do %> - <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> -<% end %> - -<div class="page" id="dashboard"> - <%= render :partial => 'header', :locals => {:back => true} %> - - <div id="configure"> - <div id="widget_defs"> - <%= render :partial => 'widget_definitions', :locals => {:category => @category} -%> - </div> - - <div id="edit-layout"> - <% {'100%', 'layout100.png', - '50%-50%', 'layout5050.png', - '30%-70%', 'layout3070.png', - '70%-30%', 'layout7030.png', - '33%-33%-33%', 'layout333333.png' - }.each_pair do |layout, picto| %> - <div class="select-layout <%= 'selected' if @dashboard.layout==layout -%>"> - <%= link_to image_tag(picto), dashboard_action(:set_layout, :layout => layout), :method => :post, :title => layout %> - </div> - <% end %> - </div> - </div> - - <% - columns=@dashboard.column_layout.split('-') - for index in 1..columns.size() - %> - <div class="dashboard-column-wrapper" style="width: <%= columns[index-1] -%>;margin: 0 -1px 0 0;"> - <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0 <%= index<columns.size() ? "5px" : "0px" -%> 0 <%= index>1 ? "5px" : "0px" -%>;"> - <% - @dashboard.widgets.select { |widget| widget.column_index==index && widget.java_definition }.sort_by { |widget| widget.row_index }.each do |widget| - %> - <div class="block" id="block_<%= widget.id -%>"> - <%= render :partial => 'configure_widget', :locals => {:widget => widget} %> - </div> - <% - end - %> - <div class="column-handle" style="display: none"></div> - </div> - </div> - <% end %> -</div> - -<script type="text/javascript"> - <!-- - var options = { - editorEnabled: true, - column: 'dashboard-column', - columnHandle: 'column-handle', - block: 'block', - hoverClass: 'block-hover', - dashboardState: 'dashboardstate', - highlightDuration: 2000, - highlightStartColor: '#cae3f2', - highlightEndColor: '#ffffff', - saveUrl: '<%= url_for dashboard_action(:set_dashboard) -%>' - }; - var portal; - function init_dashboard() { - portal = new Portal(options); - <% if params[:highlight] %> - portal.highlightWidget('<%= escape_javascript(params[:highlight]) -%>'); - <% end %> - } - $j(document).ready(function(){init_dashboard();}); - - function filterWidgetsByCategory(category) { - $j('#filter-widgets-loading').show(); - $j.ajax ({ url: '<%= add_category_to_url(url_for dashboard_action(:widget_definitions)) -%>' + encodeURIComponent(category), - success: function(responseHTML){$j('#widget_defs').html(responseHTML);}, - error:function(error){alert('error');} - }); - return false; - } - - var widgetContents = [ - <% - number_of_widgets = @widget_definitions.size() - @widget_definitions.each_with_index do |definition, index| - widget_id = "def_#{definition.id.tr('_', '')}" - widget_title = message("widget.#{definition.id}.name", :default => definition.title).downcase - widget_description = message("widget.#{definition.id}.description", :default => definition.description).downcase - %> - { id:"<%= widget_id -%>", c:"<%= escape_javascript widget_title.gsub(/\r\n?/, " ") -%> <%= escape_javascript widget_description.gsub(/\r\n?/, " ") -%>" } <%= "," unless index==number_of_widgets-1 -%> - <% end %> - ]; - - function filtersWidgetsByContent(text) { - var userInput = text.toLowerCase(); - widgetContents.forEach(function (widget) { - var element = $j('#'+widget.id); - if (element != null) { - if (widget.c.indexOf(userInput) != -1) { - element.show(); - } else { - element.hide(); - } - } - }); - return false; - } - //--> - - $j('#filter-widget-box').focus(); -</script> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb deleted file mode 100644 index 132fe9ded98..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/index.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -<% content_for :script do %> - <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> -<% end %> - - -<div class="page" id="dashboard"> - <% if @resource -%> - <span class="hidden" id="is-project-dashboard"> </span> - <% end -%> - <%= render :partial => 'header', :locals => {:back => false} %> - <div style="width: 100%;display: block; float: none"> - <% - columns=@dashboard.column_layout.split('-') - for index in 1..columns.size() - %> - <!-- the right margin with 1px is a trick for IE. See SONAR-2637 --> - <div class="dashboard-column-wrapper" style="width: <%= columns[index-1] -%>;margin: 0 -1px 0 0;"> - <div class="dashboard-column" id="dashboard-column-<%= index -%>" style="margin: 0 <%= index<columns.size() ? "5px" : "0px" -%> 0 <%= index>1 ? "5px" : "0px" -%>;"> - <% - @dashboard.widgets.select { |widget| widget.column_index==index }.sort_by { |widget| widget.row_index }.each do |widget| - widget_definition=@authorized_widget_definitions.find { |wd| wd.getId()==widget.widget_key } - if widget_definition - %> - <%= render :partial => 'widget', :locals => {:widget => widget} %> - <% - reset_cycle - end - end - %> - </div> - </div> - <% end %> - </div> - <div style="clear: both;"></div> -</div> - -<script> - jQuery('html').addClass('dashboard-page'); - jQuery('[data-toggle="tooltip"]').tooltip({ container: '#body' }); -</script> 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 deleted file mode 100644 index 2f80d7fefdf..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_available_dashboards.html.erb +++ /dev/null @@ -1,37 +0,0 @@ -<table class="data" id="shared-dashboards"> - <thead> - <tr> - <th class="name"><%= message('name') -%></th> - <th class="shared"><%= message('shared') -%></th> - <th class="owner"><%= message('owner') -%></th> - <th class="order"> </th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if @shared_dashboards.nil? || @shared_dashboards.empty? %> - <tr class="even"> - <td colspan="5" class="empty"><%= message('dashboard.no_dashboard') -%></td> - </tr> - <% else - @shared_dashboards.each do |dashboard| %> - <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 => "view-#{u dashboard.name}" %> - <div class="description"><%= h dashboard.description -%></div> - </td> - <td class="shared"> - <% if (dashboard.shared) %><i class="icon-check"></i><% end %> - </td> - <td class="owner"> - <%= h(dashboard.user_name || message('dashboard.username.default')) -%> - </td> - <td class="order"> </td> - <%= render :partial => 'dashboard_operations', :locals => {:dashboard => dashboard, :can_be_disabled => true, :subscription_action => 'follow'} %> - </tr> - <% end - end - %> - </tbody> -</table> 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 deleted file mode 100644 index c139061537b..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<form id="create-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/create"> - <input type="hidden" name="global" value="true" /> - <fieldset> - <div class="modal-head"> - <h2><%= message('dashboard.new_dashboard') -%></h2> - </div> - <div class="modal-body"> - <% if @dashboard %> - <% @dashboard.errors.full_messages.each do |msg| %> - <p class="error"><%= h msg -%></p> - <% end %> - <% end %> - <div class="modal-field"> - <label for="name"><%= h message('name') -%> <em class="mandatory">*</em></label> - <input id="name" name="name" type="text" size="50" maxlength="256" value="<%= h @dashboard.name -%>" autofocus="autofocus"/> - </div> - <div class="modal-field"> - <label for="description"><%= h message('description') -%></label> - <input id="description" name="description" type="text" size="50" maxlength="4000" value="<%= h @dashboard.description -%>"/> - </div> - <% if logged_in? %> - <div class="modal-field"> - <label for="shared"><%= h message('shared') -%></label> - <input id="shared" name="shared" type="checkbox" value="true" <%= 'checked' if @dashboard.shared -%>/> - </div> - <% end %> - </div> - <div class="modal-foot"> - <input type="submit" value="<%= h message('dashboard.create_dashboard') -%>" id="save-submit"/> - <a href="#" onclick="return closeModalWindow()" id="save-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#create-dashboard-form").modalForm({success: function (data) { - 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 deleted file mode 100644 index ae66c82c2d7..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_dashboard_operations.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<td class="thin nowrap text-right"> - <% if dashboard.editable_by?(current_user) %> - <%= 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}, - :id => "edit-#{u dashboard.name}", :class => 'open-modal' %> - - <% if can_be_disabled %> - <%= 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}, :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 deleted file mode 100644 index b5494ee17bd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_delete_form.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<form id="delete-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/delete"> - <input type="hidden" name="id" value="<%= @dashboard.id -%>"> - <input type="hidden" name="global" value="true" /> - <fieldset> - <div class="modal-head"> - <h2><%= message 'dashboard.delete_confirm_title' -%></h2> - </div> - <div class="modal-body"> - <% @dashboard.errors.full_messages.each do |msg| %> - <p class="alert alert-danger"><%= h msg -%></p> - <% end %> - <p> - <%= message 'dashboard.do_you_want_to_delete_dashboard' -%> - </p> - </div> - <div class="modal-foot"> - <button class="button-red" id="confirm-submit"><%= message 'dashboard.delete_dashboard' -%></button> - <a href="#" onclick="return closeModalWindow()" id="confirm-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#delete-dashboard-form").modalForm({success: function (data) { - 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 deleted file mode 100644 index 09c82c5d924..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb +++ /dev/null @@ -1,46 +0,0 @@ -<form id="edit-dashboard-form" method="post" action="<%= ApplicationController.root_context -%>/dashboards/update"> - <input type="hidden" name="id" value="<%= @dashboard.id -%>"> - <input type="hidden" name="global" value="true" /> - <fieldset> - <div class="modal-head"> - <h2><%= message('dashboard.edit_dashboard') -%></h2> - </div> - <div class="modal-body"> - <% @dashboard.errors.full_messages.each do |msg| %> - <p class="error"><%= h msg -%></p> - <% end %> - <div class="modal-field"> - <label for="name"><%= h message('name') -%> <em class="mandatory">*</em></label> - <input id="name" name="name" type="text" size="50" maxlength="256" value="<%= h @dashboard.name -%>" autofocus="autofocus"/> - </div> - <div class="modal-field"> - <label for="description"><%= h message('description') -%></label> - <input id="description" name="description" type="text" size="50" maxlength="4000" value="<%= h @dashboard.description -%>"/> - </div> - <% if @dashboard.can_be_reassigned_by(current_user) %> - <div class="modal-field"> - <label for="owner"><%= h message('owner') -%></label> - <%= user_select_tag('owner', :html_id => 'select-dashboard-owner', :selected_user => @dashboard.user) -%> - </div> - <% end %> - <% if @dashboard.can_be_shared_by(current_user) %> - <div class="modal-field"> - <label for="shared"><%= h message('shared') -%></label> - <input id="shared" name="shared" type="checkbox" value="true" <%= 'checked' if @dashboard.shared -%>/> - </div> - <% else %> - <input id="shared" name="shared" type="hidden" value="<%= @dashboard.shared %>"/> - <% end %> - </div> - <div class="modal-foot"> - <input type="submit" value="<%= h message('dashboard.update_dashboard') -%>" id="save-submit"/> - <a href="#" onclick="return closeModalWindow()" id="save-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> - -<script> - $j("#edit-dashboard-form").modalForm({success: function (data) { - 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 deleted file mode 100644 index 5b3b526756d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboards/_my_dashboards.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -<table class="data" id="dashboards"> - <thead> - <tr> - <th class="name"><%= message('name') -%></th> - <th class="shared"><%= message('shared') -%></th> - <th class="owner"><%= message('owner') -%></th> - <th class="order"><%= message('order') -%></th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if @actives.nil? || @actives.empty? %> - <tr class="even"> - <td colspan="5" class="empty"><%= message('dashboard.no_dashboard') -%></td> - </tr> - <% else %> - <% @actives.map(&:dashboard).each_with_index do |dashboard, index| %> - <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 => "view-#{u dashboard.name}" %> - <div class="description"><%= h dashboard.description -%></div> - </td> - <td class="shared"> - <% if (dashboard.shared) %><i class="icon-check" id='<%= "dashboard-#{index}-shared" -%>'></i><% end %> - </td> - <td class="owner"> - <%= h(dashboard.user_name || message('dashboard.username.default')) -%> - </td> - <td class="order"> - <% if index > 0 %> - <%= 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}, :method => :post, :id => "down-#{u dashboard.name}", :class => "icon-move-down" %> - <% else %> - <%= image_tag('transparent_16.gif') %> - <% end %> - </td> - <%= render :partial => 'dashboard_operations', :locals => {:dashboard => dashboard, :can_be_disabled => @actives.length > 1, :subscription_action => 'unfollow'} %> - </tr> - <% end - end - %> - </tbody> -</table> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb deleted file mode 100644 index c18d3b3b4fd..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_copy_form.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<form id="copy-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/copy"> - <input type="hidden" name="id" value="<%= @filter.id -%>"> - <fieldset> - <div class="modal-head"> - <h2>Copy Filter</h2> - </div> - - <%= render :partial => 'shared_form' %> - - <div class="modal-foot"> - <input type="submit" value="<%= h message('copy') -%>" id="copy-submit"/> - <a href="#" onclick="return closeModalWindow()" id="copy-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> -<script> - $j("#copy-filter-form").modalForm({success: function (data) { - window.location = window.baseUrl + '/measures/filter/' + data; - }}); -</script>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display.html.erb deleted file mode 100644 index 22f30d97b77..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% if !filter.errors.empty? %> - <% filter.errors.full_messages.each do |message| %> - <div class="alert alert-danger"><%= h message %></div> - <% end %> -<% elsif filter.rows && filter.display %> - <%= render :partial => 'measures/display_list', :locals => {:filter => filter, :edit_mode => edit_mode, :widget_id => widget_id} -%> -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb deleted file mode 100644 index c3e904234bf..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb +++ /dev/null @@ -1,231 +0,0 @@ -<div id="measure_filter_list<%= widget_id -%>"> -<script> - var filterCriteria<%= widget_id -%> = <%= json_escape(filter.criteria.to_json) -%>; - - function refreshList<%= widget_id -%>(sort, asc, page) { - $j('#measure_filter_foot<%= widget_id -%>_pages').hide(); - $j('#measure_filter_foot<%= widget_id -%>_loading').show(); - - filterCriteria<%= widget_id -%>['sort']=sort; - filterCriteria<%= widget_id -%>['asc']=asc; - filterCriteria<%= widget_id -%>['page']=page; - var url = window.baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>); - - <% if widget_id %> - $j('#measure_filter_list<%= widget_id -%>').load(url); - <% else %> - window.location = url; - <% end %> - return false; - } -</script> -<% - display_favourites = logged_in? - colspan = filter.display.columns.size - colspan += 1 if display_favourites - if edit_mode - content_for :script do -%> - <script> - var colOffset = <%= display_favourites ? 1 : 0 -%>; - function leftCol(id) { - var cell = $j('#measures-table tr td[index=' + id + ']'); - var columnIndex = cell.parent().children().index(cell); - if (columnIndex-colOffset > 0) { - moveCol(columnIndex - 1, columnIndex); - } - } - function rightCol(id) { - var cols = filterCriteria<%= widget_id -%>['cols']||[]; - var cell = $j('#measures-table tr td[index=' + id + ']'); - var columnIndex = cell.parent().children().index(cell); - - if (columnIndex-colOffset < cols.length - 1) { - moveCol(columnIndex, columnIndex + 1); - } - } - function moveCol(from, to) { - var cols = filterCriteria<%= widget_id -%>['cols']||[]; - var temp = cols[from-colOffset]; - cols[from-colOffset] = cols[to-colOffset]; - cols[to-colOffset] = temp; - $j('#measures-table thead tr').each(function () { - var tr = $j(this); - var td1 = tr.find('th:eq(' + from + ')'); - var td2 = tr.find('th:eq(' + to + ')'); - td1.remove().insertAfter(td2); - }); - $j('#measures-table tbody tr').each(function () { - var tr = $j(this); - var td1 = tr.find('td:eq(' + from + ')'); - var td2 = tr.find('td:eq(' + to + ')'); - td1.remove().insertAfter(td2); - }); - } - function deleteCol(id) { - var cols = filterCriteria<%= widget_id -%>['cols']||[]; - var cell = $j('#measures-table tr td[index=' + id + ']'); - var columnIndex = cell.parent().children().index(cell); - cols.splice(columnIndex-colOffset, 1); - $j('#measures-table thead tr').each(function () { - var tr = $j(this); - var td1 = tr.find('th:eq(' + columnIndex + ')'); - td1.remove(); - }); - $j('#measures-table tbody tr').each(function () { - var tr = $j(this); - var td1 = tr.find('td:eq(' + columnIndex + ')'); - td1.remove(); - }); - } - $j(document).ready(function () { - $j("#select-metric").on("change", function (e) { - var selectedKey = $j("#select-metric option:selected").val(); - if (selectedKey != null && selectedKey != '') { - if (selectedKey.indexOf('metric:') == 0) { - if (selectedKey.indexOf('metric:new_') == 0) { - $j('#select-period option :eq(0)').attr('disabled', 'disabled'); - $j('#select-period ').val('1'); - } else { - $j('#select-period option :eq(0)').removeAttr('disabled'); - $j('#select-period').val(''); - } - $j('#select-period').show(); - } else { - $j('#select-period').hide(); - } - $j("#add-metric").removeAttr('disabled'); - } else { - $j("#add-metric").attr("disabled", "disabled"); - } - }); - - $j("#add-metric").on("click", function (e) { - var cols = filterCriteria<%= widget_id -%>['cols']||[]; - var columnKey = $j("#select-metric option:selected").val(); - var period = $j("#select-period option:selected").val(); - if (period.length > 0) { - columnKey += ':' + period; - } - cols.push(columnKey); - filterCriteria['edit']='true'; - window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); - }); - $j("#add-metric").attr("disabled", "disabled"); - - $j("#exit-edit").on("click", function (e) { - delete filterCriteria['edit']; - window.location = window.baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>); - }); - }); - </script> - <% - end - %> - <table class="spaced width100 box"> - <tr> - <td> - <%= metric_select_tag 'metric', Metric.all.reject { |m| m.hidden || m.data? }, - :html_id => 'select-metric', - :allow_empty => true, - :key_prefix => 'metric:', - :extra_values => [ - [message('measure_filter.col.key'), 'key'], - [message('measure_filter.col.name'), 'name'], - [message('measure_filter.col.short_name'), 'short_name'], - [message('measure_filter.col.description'), 'description'], - [message('measure_filter.col.version'), 'version'], - [message('measure_filter.col.date'), 'date'], - [message('measure_filter.col.project_creation_date'), 'project_creation_date'], - [message('measure_filter.col.links'), 'links'] - ] - -%> - <select id="select-period" style="display: none;"> - <option value="">Value</option> - <% period_labels.each_with_index do |period_label, index| %> - <option value="<%= index + 1 -%>"><%= period_label -%></option> - <% end %> - </select> - - <button id="add-metric"><%= message 'measure_filter.add_column_button' %></button> - </td> - <td class="text-right"> - <a href="#" class="button" id="exit-edit"><%= message 'close' -%></a> - </td> - </tr> - </table> -<% - end -%> - -<table class="data condensed" id="measures-table"> - <thead> - <tr valign="top"> - <% if display_favourites %> - <th class="thin"></th> - <% end %> - <% filter.display.columns.each do |column| %> - <%= list_column_html(filter, column, widget_id) -%> - <% end %> - </tr> - </thead> - <tbody> - - <% if edit_mode %> - <tr class="bordered-bottom"> - <% if display_favourites %> - <td></td> - <% end %> - <% filter.display.columns.each_with_index do |column, index| %> - <td class="nowrap <%= column.align -%>" index="<%= index -%>"> - <a href="javascript:leftCol(<%= index -%>)" id="left-<%= column.key.parameterize -%>"><%= image_tag("controls/resultset_previous.png", :alt => message('move_left')) -%></a> - <a href="javascript:deleteCol(<%= index -%>)" id="delete-<%= column.key.parameterize -%>"><%= image_tag("cross-gray.png", :alt => message('measure_filter.delete_column')) -%></a> - <a href="javascript:rightCol(<%= index -%>)" id="right-<%= column.key.parameterize -%>"><%= image_tag("controls/resultset_next.png", :alt => message('move_right')) -%></a> - </td> - <% end %> - <% end %> - - <% if filter.base_row %> - <tr class="highlight"> - <% if display_favourites %> - <td class="thin"><%= link_to_favourite(filter.base_row.resource) -%></td> - <% end %> - <% filter.display.columns.each do |column| %> - <td class="<%= column.align -%> <%= column.row_css -%>"> - <%= list_cell_html(column, filter.base_row) -%> - </td> - <% end %> - </tr> - <% end %> - - <% filter.rows.each do |row| %> - <tr class="<%= cycle 'even', 'odd' -%>"> - <% if display_favourites %> - <td class="thin"><%= link_to_favourite(row.resource) -%></td> - <% end %> - <% filter.display.columns.each do |column| %> - <td class="<%= column.align -%> <%= column.row_css -%>"> - <%= list_cell_html(column, row) -%> - </td> - <% end %> - </tr> - <% end %> - - <% if filter.rows.empty? %> - <tr class="even"> - <td colspan="<%= colspan -%>"><%= message 'no_data' -%></td> - </tr> - <% end %> - - </tbody> - <% if widget_id %> - <%= table_pagination(filter.pagination, :colspan => colspan, :id => "measure_filter_foot#{widget_id}", :include_loading_icon => true) { |label, page_id| - link_to_function label, "refreshList#{widget_id}('#{filter.criteria[:sort]}', #{filter.criteria[:asc]}, '#{page_id}')" - } -%> - <% else %> - <%= table_pagination(filter.pagination, :colspan => colspan, :id => "measure_filter_foot#{widget_id}", :include_loading_icon => true) { |label, page_id| - link_to(label, filter.criteria.merge({:page => page_id})) - } -%> - <% end %> -</table> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb deleted file mode 100644 index bbbd2da0a31..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_edit_form.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<form id="edit-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/edit"> - <input type="hidden" name="id" value="<%= @filter.id -%>"> - <fieldset> - <div class="modal-head"> - <h2>Edit Filter</h2> - </div> - - <%= render :partial => 'shared_form', :locals => {:display_owner => true} %> - - <div class="modal-foot"> - <input type="submit" value="<%= h message('save') -%>" id="save-submit"/> - <a href="#" onclick="return closeModalWindow()" id="save-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> -<script> - $j("#edit-filter-form").modalForm({success: function (data) { - window.location = window.baseUrl + '/measures/filter/' + data; - }}); -</script>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb deleted file mode 100644 index 77124eb9e98..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<div id="sidebar-favourites"> -<% if logged_in? %> - <li class="sidebar-title"><%= message('measure_filter.favourite_filters') -%></li> - <% current_user.favourited_measure_filters.each do |filter| %> - <li <%= "class='active'" if @filter && filter.id==@filter.id -%>> - <a href="<%= ApplicationController.root_context -%>/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a> - </li> - <% end %> - <li><a href="<%= ApplicationController.root_context -%>/measures/manage" class="link-action"><%= message('manage') %></a></li> - <li class="spacer"></li> -<% end %> -</div>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites2.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites2.html.erb deleted file mode 100644 index 27387dfe7b3..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_favourites2.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -<% if logged_in? %> - { - <% current_user.favourited_measure_filters.each do |filter| %> - "<%= h filter.id -%>": "<%= escape_javascript filter.name -%>", - <% end %> - } -<% else %> - null -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_qualifiers.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_qualifiers.html.erb deleted file mode 100644 index 349bad62bc1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_qualifiers.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -{ -<% - qualifiers = Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| - [message("qualifiers.#{resource_type.getQualifier()}"), resource_type.getQualifier()] - end - - qualifiers.each do |q| -%> - '<%= h q[1] -%>': '<%= h q[0] -%>', -<% end %> -} diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb deleted file mode 100644 index 00ecb3aa7a1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_save_as_form.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<form id="save-as-filter-form" method="post" action="<%= ApplicationController.root_context -%>/measures/save_as"> - <input type="hidden" name="id" value="<%= @filter.id -%>"> - <input type="hidden" name="data" value="<%= u(@filter.data) -%>"> - <fieldset> - <div class="modal-head"> - <h2>Save Filter</h2> - </div> - - <%= render :partial => 'shared_form' %> - - <div class="modal-foot"> - <input type="submit" value="<%= h message('save') -%>" id="save-as-submit"/> - <a href="#" onclick="return closeModalWindow()" id="save-as-cancel"><%= h message('cancel') -%></a> - </div> - </fieldset> -</form> -<script> - $j("#save-as-filter-form").modalForm({success:function (data) { - window.location = window.baseUrl + '/measures/filter/' + data; - }}); -</script>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_body.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_body.html.erb deleted file mode 100644 index ac365ce8836..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_body.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% - if @filter && @filter.display - edit_mode = (params[:edit]=='true') -%> - <% if @filter.security_exclusions %> - <p class="notes"><%= message('results_not_display_due_to_security') -%></p> - <% end %> - - <%= render :partial => 'measures/display', :locals => {:filter => @filter, :edit_mode => edit_mode, :widget_id => nil} -%> -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb deleted file mode 100644 index fa098e97750..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_search_header.html.erb +++ /dev/null @@ -1,65 +0,0 @@ -<% - if @filter && @filter.display - edit_mode = (params[:edit]=='true') -%> - - <h1 id="filter-title" class="page-title"> - <% if @filter.id && @filter.name.present? %> - <%= h @filter.name -%> - <span class="navigator-header-title-note"> - <% if !@filter.shared %> - [<%= message 'measure_filter.private' -%>] - <% elsif logged_in? && @filter.user_id==current_user.id %> - [<%= message 'measure_filter.shared_with_all_users' -%>] - <% elsif @filter.user_id && @filter.user %> - [<%= message 'shared_by' -%> <%= @filter.user.name -%>] - <% else %> - [<%= message 'shared_by' -%> Sonar] - <% end %> - </span> - <% else %> - <%= message('layout.measures') -%> - <% end %> - </h1> - - <div class="page-actions"> - <div class="button-group"> - <button onclick="window.location='<%= ApplicationController.root_context -%>/measures/search?qualifiers[]=TRK';"><%= message 'measure_filter.new_search' -%></button> - - <% unless edit_mode %> - <% if logged_in? %> - <% if @filter.id %> - <button id="copy" onclick="openModalWindow('<%= url_for :action => 'copy_form', :id => @filter.id -%>');"><%= message('copy') -%></button> - <% end %> - - <% if !defined?(@unchanged) && @filter.id && @filter.owner?(current_user) %> - <button id="save" onclick="var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = '<%= url_for params.merge({:action => 'save', :id => @filter.id}) -%>';f.submit();return false;"><%= message('save') -%></button> - <% end %> - - <% unless @filter.id %> - <button id="save-as" onclick="openModalWindow('<%= url_for params.merge({:action => 'save_as_form', :id => @filter.id}) -%>');"><%= message('save_as') -%></button> - <% end %> - - <% if @filter.id && @filter.owner?(current_user) %> - <button id="edit-filter" onclick="openModalWindow('<%= url_for :action => 'edit_form', :id => @filter.id -%>');"><%= message('edit') -%></button> - <% end %> - <% end %> - <% end %> - </div> - - <% unless edit_mode %> - <% if @filter.display %> - <div class="button-group"> - <button id="change-display" onclick="window.location='<%= url_for @filter.criteria.merge({:action => 'search', :edit => true, :id => @filter.id}) -%>';"><%= message("measure_filter.#{@filter.display.key}.change") -%></button> - </div> - <% end %> - <% end %> - </div> - - <% if @filter.description.present? %> - <div id="filter-description" class="page-description"><%= h @filter.description -%></div> - <% end %> - -<% else %> - <h1 class="page-title"><%= message('layout.measures') -%></h1> -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb deleted file mode 100644 index c53de5eab58..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_shared_form.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% if !local_assigns.has_key? :display_owner - display_owner = false - end %> -<div class="modal-body"> - <div class="modal-error"/> - <div class="modal-field"> - <label for="name"><%= h message('name') -%> <em class="mandatory">*</em></label> - <input id="name" name="name" type="text" size="50" maxlength="100" value="<%= h @filter.name -%>" autofocus="autofocus"/> - </div> - <div class="modal-field"> - <label for="description"><%= h message('description') -%></label> - <input id="description" name="description" type="text" size="50" maxlength="4000" value="<%= h @filter.description -%>"/> - </div> - <% if display_owner && @filter.can_be_reassigned_by(current_user) %> - <div class="modal-field"> - <label for="owner"><%= h message('owner') -%></label> - <%= user_select_tag('owner', :html_id => 'select-filter-owner', :selected_user => @filter.user) -%> - </div> - <% end %> - <% if logged_in? %> - <% if @filter.user_id.nil? || @filter.user_id == current_user.id %> - <div class="modal-field"> - <label for="shared"><%= h message('measure_filter.shared_with_all_users') -%></label> - <input id="shared" name="shared" type="checkbox" value="true" <%= 'checked' if @filter.shared -%>/> - </div> - <% else %> - <input id="shared" name="shared" type="hidden" value="<%= @filter.shared -%>"/> - <% end %> - <% end %> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb deleted file mode 100644 index 3017c74dcff..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb +++ /dev/null @@ -1,134 +0,0 @@ -<% content_for :script do %> - <script> - $j(document).ready(function () { - $j(".measure-filter-star").click(function () { - var filterId = $j(this).attr('filter-id'); - var star = $j(this); - $j.ajax({ - type: 'POST', - url: window.baseUrl + "/measures/toggle_fav", - data: {id: filterId}, - success: function (data) { - if (data == 'true') { - star.removeClass('icon-not-favorite').addClass('icon-favorite'); - star.attr('title', '<%= escape_javascript message('click_to_remove_from_favorites') -%>'); - } else { - star.removeClass('icon-favorite').addClass('icon-not-favorite'); - star.attr('title', '<%= escape_javascript message('click_to_add_to_favorites') -%>'); - } - $j('#sidebar-favourites').load(baseUrl + '/measures/favourites'); - } - }); - }); - }); - </script> -<% end %> -<div> - <div class="page"> - <h1><%= message 'measure_filter.manage.my_filters' -%></h1> - <table class="data marginbottom10" id="my-filters"> - <thead> - <tr> - <th class="thin"></th> - <th><%= message('name') -%></th> - <th><%= message('measure_filter.sharing') -%></th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if current_user.measure_filters.empty? %> - <tr class="even"> - <td colspan="4"><%= message('measure_filter.no_filters') -%></td> - </tr> - <% else %> - <% current_user.measure_filters.each do |filter| %> - <tr id="my-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'my-filters') -%>"> - <td> - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - </td> - <td> - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> - <div class="note"><%= h filter.description -%></div> - <% end %> - </td> - <td> - <% if filter.shared %> - <%= message 'measure_filter.shared_with_all_users' -%> - <% else %> - <%= message 'measure_filter.private' -%> - <% end %> - </td> - <td class="text-thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - - <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", - :class => 'link-action link-red', - :id => "delete_#{filter.name.parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'measure_filter.delete_confirm_title', - :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', - :confirm_msg_params => [filter.name] -%> - </td> - </tr> - <% end %> - <% end %> - </tbody> - </table> - - <br/> - - <h1><%= message 'measure_filter.manage.shared_filters' -%></h1> - <table class="data" id="shared-filters"> - <thead> - <tr> - <th class="thin"></th> - <th><%= message('name') -%></th> - <th><%= message('shared_by') -%></th> - <th class="text-right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if @shared_filters.empty? %> - <tr class="even"> - <td colspan="4"><%= message('measure_filter.no_filters') -%></td> - </tr> - <% else %> - <% @shared_filters.each do |filter| %> - <tr id="shared-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'shared-filters') -%>"> - <td> - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - </td> - <td> - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> - <div class="note"><%= h filter.description -%></div> - <% end %> - </td> - <td> - <%= filter.user ? h(filter.user.name) : '[SonarQube]' -%> - </td> - <td class="thin nowrap text-right"> - <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - <% if has_role?(:admin) %> - - <a id="edit_system_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", - :class => 'link-action link-red', - :id => "delete_system_#{filter.name.parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'measure_filter.delete_confirm_title', - :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', - :confirm_msg_params => [filter.name] -%> - <% end %> - </td> - </tr> - <% end %> - <% end %> - </tbody> - </table> - </div> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb deleted file mode 100644 index fff811989ea..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/search.html.erb +++ /dev/null @@ -1,97 +0,0 @@ -<div class="page"> - <header class="page-header"> - <%= render :partial => 'search_header' -%> - </header> - - <div class="navigator-filters"></div> - - <div class="navigator-content"> - <div class="navigator-main"> - <div class="navigator-details"> - <%= render :partial => 'search_body' -%> - </div> - </div> - </div> -</div> - - -<script id="filter-bar-template" type="text/x-handlebars-template"> - <form method="get" action="<%= ApplicationController.root_context -%>/measures/search"> - <% if @filter.id %> - <input type="hidden" name="id" value="<%= h @filter.id -%>"> - <% end %> - <% if @filter.display %> - <input type="hidden" name="display" value="<%= h @filter.display.key -%>"/> - <% - @filter.display.url_params.each do |k_v_array| - if k_v_array[1].is_a?(String) - %> - <%= hidden_field_tag k_v_array[0], k_v_array[1] -%> - <% else - k_v_array[1].each do |string_val| - %> - <%= hidden_field_tag "#{k_v_array[0]}[]", string_val -%> - <% end - end - end - end - %> - - <div class="navigator-filters-list"></div> - <button class="navigator-filter-submit"><%= message('search_verb') -%></button> - </form> -</script> - - -<% content_for :extra_script do %> - <script> - jQuery('html').addClass('navigator-page measures-page'); - - window.SS = typeof window.SS === 'object' ? window.SS : {}; - - _.extend(window.SS, { - qualifiers: <%= render :partial => 'measures/qualifiers' -%>, - <% condition_metrics = Metric.all.select { |m| m.numeric? && !m.hidden } %> - metrics: <%= condition_metrics.to_json -%>, - metricPeriods: { - '1': '<%= Api::Utils.period_label(1) -%>', - '2': '<%= Api::Utils.period_label(2) -%>', - '3': '<%= Api::Utils.period_label(3) -%>' - }, - favorites: <%= render :partial => 'measures/favourites2' -%>, - workDuration: { - days: '<%= message('work_duration.x_days') -%>', - hours: '<%= message('work_duration.x_hours') -%>', - minutes: '<%= message('work_duration.x_minutes') -%>' - } - }); - - - - var queryParams = [ - { key: 'qualifiers[]', value: <%= json_escape(@filter.criteria['qualifiers'].to_json) -%> }, - { key: 'alertLevels[]', value: <%= json_escape(@filter.criteria['alertLevels'].to_json) -%> }, - { key: 'fromDate', value: '<%= escape_javascript @filter.criteria['fromDate'] -%>' }, - { key: 'toDate', value: '<%= escape_javascript @filter.criteria['toDate'] -%>' }, - { key: 'ageMinDays', value: '<%= escape_javascript @filter.criteria('ageMinDays') -%>' }, - { key: 'ageMaxDays', value: '<%= escape_javascript @filter.criteria['ageMaxDays'] -%>' }, - <% if @filter.base_resource %> - { key: 'base', value: ['<%= escape_javascript @filter.base_resource.key -%>'], text: ['<%= escape_javascript @filter.base_resource.name(true) -%>'] }, - <% end %> - { key: 'onFavourites', value: <%= @filter.criteria['onFavourites']=='true' -%> }, - { key: 'keySearch', value: '<%= escape_javascript @filter.criteria['keySearch'] -%>' }, - - <% for i in 1..3 %> - <% unless @filter.criteria("c#{i}_metric").blank? %> - { key: '<%= "c#{i}_metric" -%>', value: '<%= escape_javascript @filter.criteria("c#{i}_metric") -%>' }, - { key: '<%= "c#{i}_period" -%>', value: '<%= escape_javascript @filter.criteria("c#{i}_period") -%>' }, - { key: '<%= "c#{i}_op" -%>', value: '<%= escape_javascript @filter.criteria("c#{i}_op") -%>' }, - { key: '<%= "c#{i}_val" -%>', value: '<%= escape_javascript @filter.criteria("c#{i}_val") -%>' }, - <% end %> - <% end %> - { key: 'nameSearch', value: '<%= escape_javascript @filter.criteria['nameSearch'] -%>' } - ]; - </script> - - <script src="<%= ApplicationController.root_context -%>/js/bundles/measures.js?v=<%= sonar_version -%>"></script> -<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb deleted file mode 100644 index 3d718d0a954..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/widget/index.html.erb +++ /dev/null @@ -1,44 +0,0 @@ -<% content_for :script do %> - <script src="<%= ApplicationController.root_context -%>/js/bundles/dashboard.js?v=<%= sonar_version -%>"></script> - <script src="<%= ApplicationController.root_context -%>/js/bundles/widgets.js?v=<%= sonar_version -%>"></script> -<% end %> - -<div id="block_1" class="block" style="width: <%= @widget_width -%>"> - <div class="<%= @widget_definition.getId() %>" style="height:100%;"> - <% - widget_body=nil - begin - widget_body=render :inline => @widget_definition.getTarget().getTemplate(), :locals => {:widget_properties => @widget.properties_as_hash, :widget => @widget, :dashboard_configuration => @dashboard_configuration} - rescue => error - logger.error(message('dashboard.cannot_render_widget_x', :params => [@widget_definition.getId(), error]), error) - end - default_layout=(@widget_definition.getWidgetLayout().name()=='DEFAULT') - %> - -<% if !widget_body %> - - <% if default_layout %> - <div class="widget"> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [@widget.key]) -%></span> - <div class="clear"></div> - </div> - <% else %> - <span class="empty_widget"><%= message('widget.error_occurred_please_read_logs', :params => [@widget.key]) -%></span> - <% end %> - -<% - elsif widget_body.include?('<') -%> - <% if default_layout %> - <div class="widget"> - <%= widget_body -%> - <div class="clear"></div> - </div> - <% else %> - <%= widget_body -%> - <% end %> -<% end %> - - <div style="clear: both;"></div> - </div> -</div>
\ No newline at end of file |