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