Fix cve export UI issues (#17227)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2022-07-25 10:41:44 +08:00 committed by GitHub
parent a4c577f9ec
commit e9855a88dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 79 additions and 58 deletions

View File

@ -235,12 +235,11 @@
{{ 'OPERATION.FAILED' | translate }}
</button>
<clr-tab-content id="contentFailed" *clrIfActive>
<ng-container *ngFor="let item of exportJobs">
<div
class="eventInfo"
*ngFor="let item of exportJobs">
<div
class="iconsArea"
*ngIf="item.state === 'failure'">
*ngIf="item.state === 'failure'"
class="eventInfo">
<div class="iconsArea">
<i
class="spinner spinner-inline spinner-pos"
[hidden]="
@ -257,7 +256,9 @@
shape="error-standard"
class="color-red"></clr-icon>
<clr-icon
[hidden]="item.state !== 'interrupt'"
[hidden]="
item.state !== 'interrupt'
"
size="18"
shape="unlink"
class="color-orange"></clr-icon>
@ -265,7 +266,9 @@
<div class="infoArea">
<label
class="eventName"
(click)="toggleTitle(spanErrorInfo)">
(click)="
toggleTitle(spanErrorInfo)
">
<span class="flex">
<span class="job-name">{{
item.name | translate
@ -285,6 +288,7 @@
>
</div>
</div>
</ng-container>
<div
class="eventInfo"
*ngFor="let list of failLists">

View File

@ -237,16 +237,6 @@ export class OperationComponent implements OnInit, OnDestroy {
daysAgo
);
});
this.exportJobs.forEach(data => {
const timeDiff: number = new Date().getTime() - +data.timeStamp;
data.timeDiff = this.calculateTime(
timeDiff,
secondsAgo,
minutesAgo,
hoursAgo,
daysAgo
);
});
}
calculateTime(
@ -299,6 +289,7 @@ export class OperationComponent implements OnInit, OnDestroy {
flag = true;
}
});
this.refreshTimestampForExportJob();
if (flag) {
this.timeout = setTimeout(() => {
this.refreshExportJobs();
@ -353,4 +344,30 @@ export class OperationComponent implements OnInit, OnDestroy {
);
}
}
refreshTimestampForExportJob() {
let secondsAgo: string,
minutesAgo: string,
hoursAgo: string,
daysAgo: string;
forkJoin([
this.translate.get('OPERATION.SECOND_AGO'),
this.translate.get('OPERATION.MINUTE_AGO'),
this.translate.get('OPERATION.HOUR_AGO'),
this.translate.get('OPERATION.DAY_AGO'),
]).subscribe(res => {
[secondsAgo, minutesAgo, hoursAgo, daysAgo] = res;
});
if (this.exportJobs?.length) {
this.exportJobs.forEach(data => {
const timeDiff: number = new Date().getTime() - +data.timeStamp;
data.timeDiff = this.calculateTime(
timeDiff,
secondsAgo,
minutesAgo,
hoursAgo,
daysAgo
);
});
}
}
}