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

View File

@ -237,16 +237,6 @@ export class OperationComponent implements OnInit, OnDestroy {
daysAgo daysAgo
); );
}); });
this.exportJobs.forEach(data => {
const timeDiff: number = new Date().getTime() - +data.timeStamp;
data.timeDiff = this.calculateTime(
timeDiff,
secondsAgo,
minutesAgo,
hoursAgo,
daysAgo
);
});
} }
calculateTime( calculateTime(
@ -299,6 +289,7 @@ export class OperationComponent implements OnInit, OnDestroy {
flag = true; flag = true;
} }
}); });
this.refreshTimestampForExportJob();
if (flag) { if (flag) {
this.timeout = setTimeout(() => { this.timeout = setTimeout(() => {
this.refreshExportJobs(); 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
);
});
}
}
} }