Skip to content

Commit e1fe31d

Browse files
xingzhang-suselsongsuse
authored andcommitted
#1158 Display OS scan support status in the image scan result UI (Fix bug)
1 parent fa6b973 commit e1fe31d

5 files changed

Lines changed: 23 additions & 13 deletions

File tree

admin/webapp/websrc/app/common/constants/global.constant.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,4 +308,10 @@ export class GlobalConstant {
308308
MAX_LENGTH_TOTAL: 100000,
309309
MAX_LENGTH_PER_PAGE: 10000,
310310
};
311+
312+
public static OS_STATUS = {
313+
UNKNOWN: 'OSScanStatusUnknown',
314+
SUPPORTED: 'OSScanStatusSupported',
315+
UNSUPPORTED: 'OSScanStatusUnsupported',
316+
};
311317
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
<div>
22
{{ os }}
33
<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-
}}
4+
*ngIf="os_scan_status === OS_STATUS.UNSUPPORTED"
5+
class="type-label ms-2 customer-rule">
6+
{{ 'registry.OS_UNSUPPORTED' | translate }}
127
</span>
138
</div>

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
33
import { ICellRendererAngularComp } from 'ag-grid-angular';
44
import { ICellRendererParams } from 'ag-grid-community';
55
import { TranslateModule } from '@ngx-translate/core';
6+
import { GlobalConstant } from 'app/common/constants/global.constant';
67

78
@Component({
89
standalone: true,
@@ -15,13 +16,23 @@ import { TranslateModule } from '@ngx-translate/core';
1516
export class RegistryDetailsOsCell implements ICellRendererAngularComp {
1617
private params!: ICellRendererParams;
1718
os!: string;
18-
os_scan_status!: number;
19+
os_scan_status!: string;
20+
OS_STATUS = GlobalConstant.OS_STATUS;
1921

2022
agInit(params: ICellRendererParams): void {
2123
this.params = params;
22-
this.os = params && params.node.data ? params.node.data.base_os : '-';
24+
this.os =
25+
params && params.node.data
26+
? params.node.data.base_os
27+
? params.node.data.base_os
28+
: '-'
29+
: '';
2330
this.os_scan_status =
24-
params && params.node.data ? params.node.data.os_scan_status : 0;
31+
params && params.node.data
32+
? params.node.data.os_scan_status
33+
? params.node.data.os_scan_status
34+
: this.OS_STATUS.UNKNOWN
35+
: '';
2536
}
2637

2738
refresh(params: ICellRendererParams): boolean {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,6 @@
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",
13401339
"OS_UNSUPPORTED": "OS Unsupported",
13411340
"TIP": {
13421341
"EDIT": "Edit Registry",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,6 @@
13351335
"VIEW_ALL_IMAGES": "浏览全部扫描过的镜像",
13361336
"_REPO_SCAN": "浏览集群镜像库",
13371337
"FED._REPO_SCAN": "浏览集群镜像库",
1338-
"OS_UNKNOWN": "操作系统未知",
13391338
"OS_UNSUPPORTED": "操作系统不支持",
13401339
"TIP": {
13411340
"EDIT": "编辑镜像库",

0 commit comments

Comments
 (0)