Merge "Revisit label rendering"
This commit is contained in:
commit
c1ebae4c14
@ -73,8 +73,9 @@ limitations under the License.
|
||||
<span class="u-red"><span>-</span>[[change.deletions]]</span>
|
||||
</span>
|
||||
<span title="Code-Review"
|
||||
class$="[[_computeCodeReviewClass(change.labels.Code_Review)]]">[[_computeCodeReviewLabel(change.labels.Code_Review)]]</span>
|
||||
<span class="cell verified u-green" title="Verified">[[_computeVerifiedLabel(change.labels.Verified)]]</span>
|
||||
class$="[[_computeLabelClass(change.labels.Code_Review)]]">[[_computeLabelValue(change.labels.Code_Review)]]</span>
|
||||
<span title="Verified"
|
||||
class$="[[_computeLabelClass(change.labels.Verified)]]">[[_computeLabelValue(change.labels.Verified)]]</span>
|
||||
</template>
|
||||
<script>
|
||||
(function() {
|
||||
@ -116,48 +117,47 @@ limitations under the License.
|
||||
return '';
|
||||
},
|
||||
|
||||
_computeCodeReviewClass: function(codeReview) {
|
||||
_computeLabelClass: function(label) {
|
||||
// Mimic a Set.
|
||||
var classes = {
|
||||
'cell': true,
|
||||
'codeReview': true,
|
||||
'label': true,
|
||||
};
|
||||
if (codeReview) {
|
||||
if (codeReview.approved) {
|
||||
if (label) {
|
||||
if (label.approved) {
|
||||
classes['u-green'] = true;
|
||||
}
|
||||
if (codeReview.value == 1) {
|
||||
if (label.value == 1) {
|
||||
classes['u-monospace'] = true;
|
||||
classes['u-green'] = true;
|
||||
} else if (codeReview.value == -1) {
|
||||
} else if (label.value == -1) {
|
||||
classes['u-monospace'] = true;
|
||||
classes['u-red'] = true;
|
||||
}
|
||||
if (label.rejected) {
|
||||
classes['u-red'] = true;
|
||||
}
|
||||
}
|
||||
return Object.keys(classes).sort().join(' ');
|
||||
},
|
||||
|
||||
_computeCodeReviewLabel: function(codeReview) {
|
||||
if (!codeReview) { return ''; }
|
||||
if (codeReview.approved) {
|
||||
_computeLabelValue: function(label) {
|
||||
if (!label) { return ''; }
|
||||
if (label.approved) {
|
||||
return '✓';
|
||||
}
|
||||
if (codeReview.value > 0) {
|
||||
return '+' + codeReview.value;
|
||||
if (label.rejected) {
|
||||
return '✕';
|
||||
}
|
||||
if (codeReview.value < 0) {
|
||||
return codeReview.value;
|
||||
if (label.value > 0) {
|
||||
return '+' + label.value;
|
||||
}
|
||||
if (label.value < 0) {
|
||||
return label.value;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
_computeVerifiedLabel: function(verified) {
|
||||
if (verified && verified.approved) {
|
||||
return '✓';
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
_computeProjectURL: function(project) {
|
||||
return '/projects/' + project + ',dashboards/default';
|
||||
},
|
||||
|
@ -49,8 +49,8 @@ limitations under the License.
|
||||
<span class="topHeader branch">Branch</span>
|
||||
<span class="topHeader updated">Updated</span>
|
||||
<span class="topHeader size">Size</span>
|
||||
<span class="topHeader codeReview" title="Code-Review">CR</span>
|
||||
<span class="topHeader verified" title="Verified">V</span>
|
||||
<span class="topHeader label" title="Code-Review">CR</span>
|
||||
<span class="topHeader label" title="Verified">V</span>
|
||||
</div>
|
||||
<template is="dom-repeat" items="{{groups}}" as="changeGroup" index-as="groupIndex">
|
||||
<template is="dom-if" if="[[_groupTitle(groupIndex)]]">
|
||||
|
@ -50,14 +50,10 @@ limitations under the License.
|
||||
width: 9em;
|
||||
text-align: right;
|
||||
}
|
||||
.codeReview {
|
||||
.label {
|
||||
width: 2.6em;
|
||||
text-align: center;
|
||||
}
|
||||
.verified {
|
||||
width: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
Loading…
Reference in New Issue
Block a user