Merge "Fix 'Completed without results.' font-weight"

This commit is contained in:
Ben Rohlfs
2021-02-17 11:47:52 +00:00
committed by Gerrit Code Review

View File

@@ -86,9 +86,9 @@ class GrResultRow extends GrLitElement {
flex-shrink: 1; flex-shrink: 1;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
margin-right: var(--spacing-s);
} }
td .summary-cell .message { td .summary-cell .message {
margin-left: var(--spacing-s);
flex-grow: 1; flex-grow: 1;
/* Looks a bit stupid, but the idea is that .message shrinks first, /* Looks a bit stupid, but the idea is that .message shrinks first,
and only when that has shrunken to 0, then .summary should also and only when that has shrunken to 0, then .summary should also
@@ -119,7 +119,7 @@ class GrResultRow extends GrLitElement {
update(changedProperties: PropertyValues) { update(changedProperties: PropertyValues) {
if (changedProperties.has('result')) { if (changedProperties.has('result')) {
this.isExpandable = !!this.result?.message; this.isExpandable = !!this.result?.summary && !!this.result?.message;
} }
super.update(changedProperties); super.update(changedProperties);
} }
@@ -137,9 +137,7 @@ class GrResultRow extends GrLitElement {
<td class="summaryCol"> <td class="summaryCol">
<div class="summary-cell"> <div class="summary-cell">
${(this.result.links ?? []).map(this.renderLink)} ${(this.result.links ?? []).map(this.renderLink)}
<!-- The &nbsp; is for being able to shrink a tiny amount without ${this.renderSummary(this.result.summary)}
the text itself getting shrunk with an ellipsis. -->
<div class="summary">${this.result.summary}&nbsp;</div>
<div class="message"> <div class="message">
${this.isExpanded ? '' : this.result.message} ${this.isExpanded ? '' : this.result.message}
</div> </div>
@@ -181,6 +179,15 @@ class GrResultRow extends GrLitElement {
this.isExpanded = !this.isExpanded; this.isExpanded = !this.isExpanded;
} }
renderSummary(text?: string) {
if (!text) return;
return html`
<!-- The &nbsp; is for being able to shrink a tiny amount without
the text itself getting shrunk with an ellipsis. -->
<div class="summary">${text}&nbsp;</div>
`;
}
renderLink(link: Link) { renderLink(link: Link) {
return html` return html`
<a href="${link.url}" target="_blank"> <a href="${link.url}" target="_blank">
@@ -359,7 +366,8 @@ export class GrChecksResults extends GrLitElement {
renderSuccessfulRun(run: CheckRun) { renderSuccessfulRun(run: CheckRun) {
const adaptedRun: RunResult = { const adaptedRun: RunResult = {
category: Category.INFO, // will not be used, but is required category: Category.INFO, // will not be used, but is required
summary: run.statusDescription ?? 'Completed without results.', summary: run.statusDescription ?? '',
message: 'Completed without results.',
...run, ...run,
}; };
return html`<gr-result-row .result="${adaptedRun}"></gr-result-row>`; return html`<gr-result-row .result="${adaptedRun}"></gr-result-row>`;