'ncloc',
'sqale_index',
'violations',
- 'duplicated_lines_density'
+ 'duplicated_lines_density',
+ 'alert_status'
];
const METRICS_WITH_COVERAGE = [
return (
<div className="page">
<header className="page-header">
- <h1 className="page-title">{translate('code.page')}</h1>
+ <Search component={this.props.component}/>
<div
className="pull-left"
style={{ visibility: fetching ? 'visible' : 'hidden' }}>
<i className="spinner"/>
</div>
-
- <Search component={this.props.component}/>
</header>
{errorMessage && (
import ComponentName from './ComponentName';
import ComponentMeasure from './ComponentMeasure';
+import ComponentQualityGate from './ComponentQualityGate';
import ComponentDetach from './ComponentDetach';
import ComponentPin from './ComponentPin';
}
render () {
- const { component, selected, previous, coverageMetric, onBrowse } = this.props;
+ const { component, selected, previous, coverageMetric, onBrowse, isView } = this.props;
let componentAction = null;
</span>
</td>
<td className="code-name-cell">
+ {isView && (
+ <ComponentQualityGate
+ component={component}/>
+ )}
<ComponentName
component={component}
previous={previous}
function mapStateToProps (state, ownProps) {
return {
- selected: state.current.searchSelectedItem === ownProps.component
+ selected: state.current.searchSelectedItem === ownProps.component,
+ isView: state.current.isView
};
}
<span>{component.name.substr(prefix.length)}</span>
</span>
) : component.name;
+ const canBrowse = !!onBrowse && !component.copy;
return (
<Truncated title={getTooltip(component)}>
<QualifierIcon qualifier={component.qualifier}/>
{' '}
- {onBrowse ? (
+ {canBrowse ? (
<a
onClick={handleClick}
href="#">
--- /dev/null
+/*
+ * SonarQube :: Web
+ * 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 React from 'react';
+
+import { translate } from '../../../helpers/l10n';
+
+const METRIC = 'alert_status';
+
+const ComponentQualityGate = ({ component }) => {
+ const measure = _.findWhere(component.msr, { key: METRIC });
+ return measure ? (
+ <span
+ className="spacer-right"
+ title={translate('metric.level', measure.data)}
+ style={{ position: 'relative', top: '-1px' }}>
+ <i className={`icon-alert-${measure.data.toLowerCase()}`}/>
+ </span>
+ ) : <span/>;
+};
+
+
+export default ComponentQualityGate;
searchQuery: '',
searchSelectedItem: null,
coverageMetric: null,
+ isView: false,
baseBreadcrumbs: [],
errorMessage: null
};
case INIT:
const coverageMetric = selectCoverageMetric(action.component);
const baseBreadcrumbs = action.breadcrumbs.length > 1 ? _.initial(action.breadcrumbs) : [];
+ const isView = action.component.qualifier === 'VW' || action.component.qualifier === 'SVW';
- return { ...state, coverageMetric, baseBreadcrumbs };
+ return { ...state, coverageMetric, baseBreadcrumbs, isView };
case BROWSE:
const baseComponent = hasSourceCode(action.component) ? null : action.component;
const components = hasSourceCode(action.component) ? null : sortChildren(action.children);
}
.code-search-box {
- padding-left: 10px;
- overflow: hidden;
+ float: left;
+ padding-right: 10px;
}
return this.renderLink(url, translate('code.page'), '/code');
},
+ renderProjectsLink() {
+ if (!this.isView()) {
+ return null;
+ }
+
+ const url = `/view_projects/index?id=${encodeURIComponent(this.props.component.key)}`;
+ return this.renderLink(url, translate('view_projects.page'), '/view_projects');
+ },
+
renderComponentIssuesLink() {
const url = `/component_issues/index?id=${encodeURIComponent(this.props.component.key)}`;
return this.renderLink(url, translate('issues.page'), '/component_issues');
{!this.isDeveloper() && this.renderFixedDashboards()}
{this.renderCustomDashboards()}
{this.renderCodeLink()}
+ {this.renderProjectsLink()}
{this.renderComponentIssuesLink()}
{this.renderTools()}
{this.renderAdministration()}
--- /dev/null
+#
+# 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 ViewProjectsController < ApplicationController
+ before_filter :init_resource_for_user_role
+
+ SECTION=Navigation::SECTION_RESOURCE
+
+ def index
+
+ end
+
+end
--- /dev/null
+<% content_for :extra_script do %>
+ <script src="<%= ApplicationController.root_context -%>/js/bundles/code.js?v=<%= sonar_version -%>"></script>
+<% end %>
timemachine.page=Time Machine
comparison.page=Compare
comparison_global.page=Compare Projects
+view_projects.page=Projects