Skip to content

Commit f6adf8d

Browse files
xingzhang-suselsongsuse
authored andcommitted
#1158 Display OS scan support status in the image scan result UI
1 parent 169d65b commit f6adf8d

8 files changed

Lines changed: 80 additions & 3 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<div>
2+
{{ os }}
3+
<span
4+
*ngIf="os_scan_status !== 1"
5+
class="type-label ms-2"
6+
[class.customer-rule]="os_scan_status === 2"
7+
[class.ground-rule]="os_scan_status === 0">
8+
{{
9+
(os_scan_status === 2 ? 'registry.OS_UNSUPPORTED' : 'registry.OS_UNKNOWN')
10+
| translate
11+
}}
12+
</span>
13+
</div>

admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-os-cell/registry-details-os-cell.scss

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { RegistryDetailsOsCell } from './registry-details-os-cell';
4+
5+
describe('RegistryDetailsOsCell', () => {
6+
let component: RegistryDetailsOsCell;
7+
let fixture: ComponentFixture<RegistryDetailsOsCell>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [RegistryDetailsOsCell]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(RegistryDetailsOsCell);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { CommonModule } from '@angular/common';
2+
import { ChangeDetectionStrategy, Component } from '@angular/core';
3+
import { ICellRendererAngularComp } from 'ag-grid-angular';
4+
import { ICellRendererParams } from 'ag-grid-community';
5+
import { TranslateModule } from '@ngx-translate/core';
6+
7+
@Component({
8+
standalone: true,
9+
selector: 'app-registry-details-os-cell',
10+
templateUrl: './registry-details-os-cell.html',
11+
styleUrl: './registry-details-os-cell.scss',
12+
imports: [CommonModule, TranslateModule],
13+
changeDetection: ChangeDetectionStrategy.OnPush,
14+
})
15+
export class RegistryDetailsOsCell implements ICellRendererAngularComp {
16+
private params!: ICellRendererParams;
17+
os!: string;
18+
os_scan_status!: number;
19+
20+
agInit(params: ICellRendererParams): void {
21+
this.params = params;
22+
this.os = params && params.node.data ? params.node.data.base_os : '-';
23+
this.os_scan_status =
24+
params && params.node.data ? params.node.data.os_scan_status : 0;
25+
}
26+
27+
refresh(params: ICellRendererParams): boolean {
28+
this.params = params;
29+
return true;
30+
}
31+
}

admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-table-all-view.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
retry,
3333
} from 'rxjs/operators';
3434
import { MapConstant } from '@common/constants/map.constant';
35+
import { RegistryDetailsOsCell } from './registry-details-os-cell/registry-details-os-cell';
3536

3637
@Component({
3738
standalone: false,
@@ -94,7 +95,9 @@ export class RegistryDetailsTableAllViewComponent
9495
{
9596
field: 'base_os',
9697
colId: 'os',
98+
cellRenderer: 'osCellRenderer',
9799
headerValueGetter: () => this.translate.instant('scan.gridHeader.OS'),
100+
minWidth: 200,
98101
sortable: true,
99102
},
100103
{
@@ -166,6 +169,7 @@ export class RegistryDetailsTableAllViewComponent
166169
vulnerabilitiesCellRenderer:
167170
RegistryDetailsVulnerabilitiesCellComponent,
168171
statusCellRenderer: RegistryDetailsTableStatusCellComponent,
172+
osCellRenderer: RegistryDetailsOsCell,
169173
},
170174
overlayNoRowsTemplate: this.translate.instant('general.NO_ROWS'),
171175
};

admin/webapp/websrc/app/routes/registries/registry-details/registry-details-table/registry-details-table.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { DatePipe } from '@angular/common';
2222
import { RegistryDetailsTableStatusCellComponent } from './registry-details-table-status-cell/registry-details-table-status-cell.component';
2323
import { FormControl } from '@angular/forms';
2424
import { MapConstant } from '@common/constants/map.constant';
25+
import { RegistryDetailsOsCell } from './registry-details-os-cell/registry-details-os-cell';
2526

2627
@Component({
2728
standalone: false,
@@ -62,9 +63,9 @@ export class RegistryDetailsTableComponent implements OnInit, OnChanges {
6263
},
6364
{
6465
field: 'base_os',
65-
valueFormatter: params =>
66-
params.value || this.translate.instant('scan.message.OS_ERR'),
66+
cellRenderer: 'osCellRenderer',
6767
headerValueGetter: () => this.translate.instant('scan.gridHeader.OS'),
68+
minWidth: 200,
6869
},
6970
{
7071
field: 'size',
@@ -127,6 +128,7 @@ export class RegistryDetailsTableComponent implements OnInit, OnChanges {
127128
vulnerabilitiesCellRenderer:
128129
RegistryDetailsVulnerabilitiesCellComponent,
129130
statusCellRenderer: RegistryDetailsTableStatusCellComponent,
131+
osCellRenderer: RegistryDetailsOsCell,
130132
},
131133
overlayNoRowsTemplate: this.translate.instant('general.NO_ROWS'),
132134
};

admin/webapp/websrc/assets/i18n/en-common.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,8 @@
13361336
"VIEW_ALL_IMAGES": "View all scanned images",
13371337
"_REPO_SCAN": "View Federated Repositories",
13381338
"FED._REPO_SCAN": "View Federated Repositories",
1339+
"OS_UNKNOWN": "OS Unknown",
1340+
"OS_UNSUPPORTED": "OS Unsupported",
13391341
"TIP": {
13401342
"EDIT": "Edit Registry",
13411343
"DELETE": "Remove Registry",

admin/webapp/websrc/assets/i18n/zh_cn-common.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,10 +1335,12 @@
13351335
"VIEW_ALL_IMAGES": "浏览全部扫描过的镜像",
13361336
"_REPO_SCAN": "浏览集群镜像库",
13371337
"FED._REPO_SCAN": "浏览集群镜像库",
1338+
"OS_UNKNOWN": "操作系统未知",
1339+
"OS_UNSUPPORTED": "操作系统不支持",
13381340
"TIP": {
13391341
"EDIT": "编辑镜像库",
13401342
"DELETE": "删除镜像库",
1341-
"VIEW": "View Registry"
1343+
"VIEW": "浏览镜像库"
13421344
},
13431345
"IBM": {
13441346
"ACCOUNT": "IBM 云用户",

0 commit comments

Comments
 (0)