aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/hbs/component-viewer/cw-source.hbs
blob: e8f68051bf9ab38a210008b9924c502714bbebc5 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{{#if state.sourceSecurity}}

  <p>{{t 'code_viewer.no_source_code_displayed_due_to_security'}}</p>

{{else}}

  {{#if state.duplicationsInDeletedFiles}}
    <p class="marginbottom10 js-duplications-in-deleted-files">{{t 'duplications.dups_found_on_deleted_resource'}}</p>
  {{/if}}

  {{#if issuesLimitReached}}
    <p class="message-alert marginbottom10">{{tp 'component_viewer.issues_limit_reached' issuesLimit}}</p>
  {{/if}}

  <table class="code">
    {{#if showZeroLine}}
      <tr class="row row-hidden" data-line-number="0" id="{{uid}}-0">
        {{#if settings.coverage}}
          <td class="stat coverage-tests"></td>
          <td class="stat coverage-conditions"></td>
        {{/if}}
        {{#if settings.duplications}}
          <td class="stat"></td>
        {{/if}}
        {{#if settings.scm}}
          <td class="stat"></td>
        {{/if}}
        <td class="stat lid"></td>
        <td class="line"></td>
      </tr>
    {{/if}}

    {{#each source}}
      {{#if show}}
        <tr class="row" data-line-number="{{lineNumber}}" id="{{../../uid}}-{{lineNumber}}">

          {{#if ../../settings.scm}}
            <td class="stat {{#if scm}}scm{{/if}}">
              {{#if scm}}
                {{#ifSCMChanged ../../../../source ../../../lineNumber}}
                  <span class="scm-date">{{scm.date}}</span>
                  <span class="scm-author" title="{{scm.author}}">{{scm.author}}</span>
                {{/ifSCMChanged}}
              {{/if}}
            </td>
          {{/if}}

          {{#if ../../settings.duplications}}
            <td class="stat duplications">
              {{#each duplications}}
                <span class="duplication {{#if this}}duplication-exists{{/if}}" data-index="{{this}}"></span>
              {{/each}}
            </td>
          {{/if}}

          {{#if ../../settings.coverage}}
            <td class="stat {{#if coverage}}coverage-{{#if coverage.covered}}green{{else}}red{{/if}}{{/if}}">
              {{#if coverage}}
                <span class="coverage-tests" title="{{tp 'coverage_viewer.line_covered_by_x_tests' coverage.testCases}}">
                  {{coverage.testCases}}
                </span>
              {{/if}}
            </td>

            <td class="stat {{#if coverage}}{{#if coverage.branchCoverageStatus}}coverage-{{coverage.branchCoverageStatus}}{{/if}}{{/if}}">
              {{#if coverage}}
                {{#if coverage.branches}}
                  <span class="coverage-branches" title="{{tp 'coverage_viewer.x_covered_branches' coverage.coveredBranches}}">
                    {{coverage.coveredBranches}}/{{coverage.branches}}
                  </span>
                {{/if}}
              {{/if}}
            </td>
          {{/if}}

          <td class="stat lid js-line-actions" title="{{t 'component_viewer.line_actions'}}">{{lineNumber}}</td>

          <td class="line"><pre>{{{code}}}</pre></td>
        </tr>
      {{/if}}
    {{/each}}
  </table>

{{/if}}