<tbody>
<tr>
<td>open</td>
- <td>/overview?id=project-for-overview</td>
+ <td>/dashboard?id=project-for-overview</td>
<td></td>
</tr>
<tr>
return `${window.baseUrl}/component_measures/metric/${metric}?id=${encodeURIComponent(componentKey)}`;
}
-/**
- * Generate URL for a component's dashboard
- * @param {string} componentKey
- * @param {string} dashboardKey
- * @param {string} [period]
- * @returns {string}
- */
-export function getComponentDashboardUrl (componentKey, dashboardKey, period) {
- let url = window.baseUrl + '/dashboard?id=' + encodeURIComponent(componentKey) +
- '&did=' + encodeURIComponent(dashboardKey);
- if (period) {
- url += '&period=' + period;
- }
- return url;
-}
-
-/**
- * Generate URL for a fixed component's dashboard (overview)
- * @param {string} componentKey
- * @param {string} dashboardKey
- * @returns {string}
- */
-export function getComponentFixedDashboardUrl (componentKey, dashboardKey) {
- return window.baseUrl + '/overview' + dashboardKey + '?id=' + encodeURIComponent(componentKey);
-}
-
/**
* Generate URL for a component's permissions page
* @param {string} componentKey
import React from 'react';
import LinksMixin from '../links-mixin';
import { translate } from '../../../helpers/l10n';
-import { getComponentFixedDashboardUrl } from '../../../helpers/urls';
+import { getComponentUrl } from '../../../helpers/urls';
const SETTINGS_URLS = [
'/project/settings',
isFixedDashboardActive() {
const path = window.location.pathname;
- return path.indexOf(window.baseUrl + '/overview') === 0 || path.indexOf(window.baseUrl + '/governance') === 0;
+ return path.indexOf(window.baseUrl + '/dashboard') === 0 || path.indexOf(window.baseUrl + '/governance') === 0;
},
- renderOverviewLink() {
- const url = getComponentFixedDashboardUrl(this.props.component.key, '');
+ renderDashboardLink() {
+ const url = getComponentUrl(this.props.component.key);
const name = <i className="icon-home"/>;
const className = classNames({ active: this.isFixedDashboardActive() });
return (
render() {
return (
<ul className="nav navbar-nav nav-tabs">
- {this.renderOverviewLink()}
+ {this.renderDashboardLink()}
{this.renderComponentIssuesLink()}
{this.renderComponentMeasuresLink()}
{this.renderCodeLink()}
if Project.root_qualifiers.include?('VW') && (@resource.qualifier == 'VW' || @resource.qualifier == 'SVW')
return redirect_to(url_for({:controller => 'governance'}) + '?id=' + url_encode(params[:id]))
else
- return redirect_to(url_for({:controller => 'overview'}) + '?id=' + url_encode(params[:id]))
+ @snapshot = @resource.last_snapshot
+ render :action => 'overview'
end
end
else
SECTION=Navigation::SECTION_RESOURCE
def index
- if Project.root_qualifiers.include?('VW') && (@resource.qualifier == 'VW' || @resource.qualifier == 'SVW')
- return redirect_to(url_for({:controller => 'governance'}) + '?id=' + url_encode(params[:id]))
- end
+ redirect_to "#{ApplicationController.root_context}/dashboard/?id=#{url_encode(params[:id])}"
end
end
--- /dev/null
+<%
+ links_size = @resource.project_links.size
+
+ profiles = []
+ if @snapshot
+ qprofiles_measure = @snapshot.measure(Metric::QUALITY_PROFILES)
+ if qprofiles_measure && !qprofiles_measure.data.blank?
+ profiles = JSON.parse qprofiles_measure.data
+ end
+ end
+ profiles_size = profiles.size
+
+ is_gate_default = false
+ gate = nil
+ root = @resource.root_project
+ gate_id = Property.value('sonar.qualitygate', root.id, nil)
+ unless gate_id
+ gate_id=Property.value('sonar.qualitygate', nil, nil)
+ is_gate_default = false || gate_id
+ end
+ if gate_id
+ gate = Internal.quality_gates.get(gate_id.to_i)
+ end
+%>
+
+<%
+ if @snapshot
+ m = @snapshot.measure(Metric::QUALITY_GATE_DETAILS)
+ alert_status = @snapshot.measure(Metric::ALERT_STATUS)
+ if m && !m.data.blank?
+ details = JSON.parse m.data
+ m.alert_status = details['level']
+ raw_conditions = details['conditions']
+ conditions = []
+ raw_conditions.each do |condition|
+ if !metric(condition['metric']).nil?
+ conditions << condition
+ end
+ end
+ end
+ end
+%>
+
+<% content_for :extra_script do %>
+ <script>
+ (function () {
+ var component = {
+ id: '<%= escape_javascript @resource.uuid %>',
+ key: '<%= escape_javascript @resource.key %>',
+ description: '<%= escape_javascript @resource.description %>',
+ links: [
+ <% @resource.project_links.sort.each_with_index do |link, index| %>
+ {
+ name: '<%= escape_javascript link.name -%>',
+ type: '<%= escape_javascript link.link_type -%>',
+ href: '<%= escape_javascript link.href -%>'
+ }<% if index < links_size - 1 %>, <% end -%>
+ <% end %>
+ ],
+ profiles: [
+ <% profiles.each_with_index do |profile, index| %>
+ {
+ name: '<%= escape_javascript profile['name'] -%>',
+ key: '<%= escape_javascript profile['key']-%>',
+ language: '<%= escape_javascript Api::Utils.language_name(profile['language']) -%>'
+ }<% if index < profiles_size - 1 %>, <% end -%>
+ <% end %>
+ ],
+ <% if gate %>
+ gate: {
+ name: '<%= escape_javascript gate.getName() -%>',
+ key: <%= escape_javascript gate_id -%>,
+ isDefault: <%= is_gate_default -%>
+ }
+ <% end %>
+ };
+
+ window.sonarqube.overview = {
+ component: component
+ };
+ })();
+ </script>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/overview.js?v=<%= sonar_version -%>"></script>
+<% end %>
+++ /dev/null
-<%
- links_size = @resource.project_links.size
-
- profiles = []
- if @snapshot
- qprofiles_measure = @snapshot.measure(Metric::QUALITY_PROFILES)
- if qprofiles_measure && !qprofiles_measure.data.blank?
- profiles = JSON.parse qprofiles_measure.data
- end
- end
- profiles_size = profiles.size
-
- is_gate_default = false
- gate = nil
- root = @resource.root_project
- gate_id = Property.value('sonar.qualitygate', root.id, nil)
- unless gate_id
- gate_id=Property.value('sonar.qualitygate', nil, nil)
- is_gate_default = false || gate_id
- end
- if gate_id
- gate = Internal.quality_gates.get(gate_id.to_i)
- end
-%>
-
-<%
- if @snapshot
- m = @snapshot.measure(Metric::QUALITY_GATE_DETAILS)
- alert_status = @snapshot.measure(Metric::ALERT_STATUS)
- if m && !m.data.blank?
- details = JSON.parse m.data
- m.alert_status = details['level']
- raw_conditions = details['conditions']
- conditions = []
- raw_conditions.each do |condition|
- if !metric(condition['metric']).nil?
- conditions << condition
- end
- end
- end
- end
-%>
-
-<% content_for :extra_script do %>
- <script>
- (function () {
- var component = {
- id: '<%= escape_javascript @resource.uuid %>',
- key: '<%= escape_javascript @resource.key %>',
- description: '<%= escape_javascript @resource.description %>',
- links: [
- <% @resource.project_links.sort.each_with_index do |link, index| %>
- {
- name: '<%= escape_javascript link.name -%>',
- type: '<%= escape_javascript link.link_type -%>',
- href: '<%= escape_javascript link.href -%>'
- }<% if index < links_size - 1 %>, <% end -%>
- <% end %>
- ],
- profiles: [
- <% profiles.each_with_index do |profile, index| %>
- {
- name: '<%= escape_javascript profile['name'] -%>',
- key: '<%= escape_javascript profile['key']-%>',
- language: '<%= escape_javascript Api::Utils.language_name(profile['language']) -%>'
- }<% if index < profiles_size - 1 %>, <% end -%>
- <% end %>
- ],
- <% if gate %>
- gate: {
- name: '<%= escape_javascript gate.getName() -%>',
- key: <%= escape_javascript gate_id -%>,
- isDefault: <%= is_gate_default -%>
- }
- <% end %>
- };
-
- window.sonarqube.overview = {
- component: component
- };
- })();
- </script>
- <script src="<%= ApplicationController.root_context -%>/js/bundles/overview.js?v=<%= sonar_version -%>"></script>
-<% end %>