aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/overview/meta.jsx
blob: 7971125ca6beb3455b1b820bf8a8865150bee273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React from 'react';
import ProfileLink from './helpers/profile-link';
import GateLink from './helpers/gate-link';

export default React.createClass({
  render: function () {
    const
        profiles = (this.props.component.profiles || []).map(function (profile) {
          return (
              <li key={profile.key}>
                <span className="note little-spacer-right">({profile.language})</span>
                <ProfileLink profile={profile.key}>{profile.name}</ProfileLink>
              </li>
          );
        }),
        links = (this.props.component.links || []).map(function (link) {
          const iconClassName = `little-spacer-right icon-color-link icon-${link.type}`;
          return (
              <li key={link.type}>
                <i className={iconClassName}></i>
                <a href={link.href} target="_blank">{link.name}</a>
              </li>
          );
        });

    const descriptionCard = this.props.component.description ? (
            <div className="overview-card">
              <div className="overview-meta-description">{this.props.component.description}</div>
            </div>
        ) : null,

        linksCard = _.size(this.props.component.links) > 0 ? (
            <div className="overview-card">
              <ul className="overview-meta-list">{links}</ul>
            </div>
        ) : null,

        profilesCard = _.size(this.props.component.profiles) > 0 ? (
            <div className="overview-card">
              <h4 className="overview-meta-header">{window.t('overview.quality_profiles')}</h4>
              <ul className="overview-meta-list">{profiles}</ul>
            </div>
        ) : null,

        gateCard = this.props.component.gate ? (
            <div className="overview-card">
              <h4 className="overview-meta-header">{window.t('overview.quality_gate')}</h4>
              <ul className="overview-meta-list">
                <li>
                  {this.props.component.gate.isDefault ?
                      <span className="note little-spacer-right">(Default)</span> : null}
                  <GateLink gate={this.props.component.gate.key}>{this.props.component.gate.name}</GateLink>
                </li>
              </ul>
            </div>
        ) : null;

    return (
        <div className="overview-meta">
          {descriptionCard}
          {linksCard}
          {profilesCard}
          {gateCard}
        </div>
    );
  }
});