summaryrefslogtreecommitdiffstats
path: root/polygerrit-ui/app/elements/change/gr-change-requirements/gr-change-requirements.html
blob: e79bce16a05a0edd70a0589fcbbf38b4b911d570 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!--
@license
Copyright (C) 2018 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../behaviors/rest-client-behavior/rest-client-behavior.html">
<link rel="import" href="../../../styles/shared-styles.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">
<link rel="import" href="../../shared/gr-icons/gr-icons.html">
<link rel="import" href="../../shared/gr-label/gr-label.html">
<link rel="import" href="../../shared/gr-label-info/gr-label-info.html">
<link rel="import" href="../../shared/gr-limited-text/gr-limited-text.html">

<dom-module id="gr-change-requirements">
  <template strip-whitespace>
    <style include="shared-styles">
      :host {
        display: table;
        width: 100%;
      }
      .status {
        color: #FFA62F;
        display: inline-block;
        font-family: var(--monospace-font-family);
        text-align: center;
      }
      .approved.status {
        color: var(--vote-text-color-recommended);
      }
      .rejected.status {
        color: var(--vote-text-color-disliked);
      }
      iron-icon {
        color: inherit;
      }
      .name {
        font-weight: var(--font-weight-bold);
      }
      section {
        display: table-row;
      }
      .show-hide {
        float: right;
      }
      .title {
        min-width: 10em;
        padding: .75em .5em 0 var(--requirements-horizontal-padding);
        vertical-align: top;
      }
      .value {
        padding: .6em .5em 0 0;
        vertical-align: middle;
      }
      .title,
      .value {
        display: table-cell;
      }
      .hidden {
        display: none;
      }
      .showHide {
        cursor: pointer;
      }
      .showHide .title {
        border-top: 1px solid var(--border-color);
        padding-bottom: .5em;
        padding-top: .5em;
      }
      .showHide .value {
        border-top: 1px solid var(--border-color);
        padding-top: 0;
        vertical-align: middle;
      }
      .showHide iron-icon {
        color: var(--deemphasized-text-color);
        float: right;
      }
      .spacer {
        height: .5em;
      }
    </style>
    <template
        is="dom-repeat"
        items="[[_requirements]]">
      <section>
        <div class="title requirement">
          <span class$="status [[item.style]]">
            <iron-icon class="icon" icon="[[_computeRequirementIcon(item.satisfied)]]"></iron-icon>
          </span>
          <gr-limited-text class="name" limit="40" text="[[item.fallback_text]]"></gr-limited-text>
        </div>
      </section>
    </template>
    <template
        is="dom-repeat"
        items="[[_requiredLabels]]">
      <section>
        <div class="title">
          <span class$="status [[item.style]]">
            <iron-icon class="icon" icon="[[item.icon]]"></iron-icon>
          </span>
          <gr-limited-text class="name" limit="40" text="[[item.label]]"></gr-limited-text>
        </div>
        <div class="value">
          <gr-label-info
              change="{{change}}"
              account="[[account]]"
              mutable="[[mutable]]"
              label="[[item.label]]"
              label-info="[[item.labelInfo]]"></gr-label-info>
        </div>
      </section>
    </template>
    <section class="spacer"></section>
    <section class$="spacer [[_computeShowOptional(_optionalLabels.*)]]"></section>
    <section
        show-bottom-border$="[[_showOptionalLabels]]"
        on-tap="_handleShowHide"
        class$="showHide [[_computeShowOptional(_optionalLabels.*)]]">
      <div class="title">Other labels</div>
      <div class="value">
        <iron-icon
            id="showHide"
            icon="[[_computeShowHideIcon(_showOptionalLabels)]]">
        </iron-icon>
      </label>
      </div>
    </section>
    <template
        is="dom-repeat"
        items="[[_optionalLabels]]">
      <section class$="optional [[_computeSectionClass(_showOptionalLabels)]]">
        <div class="title">
          <span class$="status [[item.style]]">
            <template is="dom-if" if="[[item.icon]]">
              <iron-icon class="icon" icon="[[item.icon]]"></iron-icon>
            </template>
            <template is="dom-if" if="[[!item.icon]]">
              <span>[[_computeLabelValue(item.labelInfo.value)]]</span>
            </template>
          </span>
          <gr-limited-text class="name" limit="40" text="[[item.label]]"></gr-limited-text>
        </div>
        <div class="value">
          <gr-label-info
              change="{{change}}"
              account="[[account]]"
              mutable="[[mutable]]"
              label="[[item.label]]"
              label-info="[[item.labelInfo]]"></gr-label-info>
        </div>
      </section>
    </template>
    <section class$="spacer [[_computeShowOptional(_optionalLabels.*)]] [[_computeSectionClass(_showOptionalLabels)]]"></section>
  </template>
  <script src="gr-change-requirements.js"></script>
</dom-module>