Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix getting background color based on status for table row
Browse files Browse the repository at this point in the history
MatthijsSmets committed Jan 8, 2024
1 parent 61ddcb4 commit 9db5a84
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/app/debug/table/table.component.html
Original file line number Diff line number Diff line change
@@ -110,11 +110,11 @@
</tr>
</thead>
<tbody>
<tr class="table-row"
<tr (click)="highLightRow(i);"
*ngFor="let row of tableSettings.reportMetadata.slice(0, tableSettings.displayAmount); let i = index"
(click)="highLightRow(i);"
[ngClass]="{'highlight': selectedRow === i}"
style="background-color:{{getStatusColor(row)}}"
class="table-row"
style="{{getStatusColor(row)}}"
>
<td>
<input type="checkbox" [checked]="row.checked" (click)="toggleCheck(row)">
11 changes: 7 additions & 4 deletions src/app/debug/table/table.component.ts
Original file line number Diff line number Diff line change
@@ -200,17 +200,20 @@ export class TableComponent implements OnInit {
}

getStatusColor(metadata: any): string {
let style = 'background-color: ';
let statusName = this.viewSettings.currentView.metadataNames.find(
(name: string) => {
return name.toLowerCase() === 'status';
}
);
if (statusName && metadata[statusName]) {
return metadata[statusName].toLowerCase() === 'success'
? '#c3e6cb'
: '#f79c9c';
style +=
metadata[statusName].toLowerCase() === 'success'
? '#c3e6cb'
: '#f79c9c';
return style;
}
return 'none';
return '';
}

showCompareButton(): boolean {

0 comments on commit 9db5a84

Please sign in to comment.