mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-06 18:50:09 +01:00
Fix UI compile issues.
This commit is contained in:
parent
e8113fa3fa
commit
1d98212d60
@ -42,4 +42,6 @@ export class AuditLog {
|
||||
keywords: string;
|
||||
page: number;
|
||||
page_size: number;
|
||||
fromTime: string;
|
||||
toTime: string;
|
||||
}
|
@ -41,14 +41,14 @@
|
||||
<div class="flex-items-xs-middle">
|
||||
<clr-icon shape="date"></clr-icon>
|
||||
<label for="fromDateInput" aria-haspopup="true" role="tooltip" [class.invalid]="fromTime.errors && fromTime.errors.dateValidator && (fromTime.dirty || fromTime.touched)" [class.valid]="fromTime.valid" class="tooltip tooltip-validation invalid tooltip-sm">
|
||||
<input id="fromDateInput" type="date" #fromTime="ngModel" name="from" [(ngModel)]="currentJobSearchOption.fromTime" dateValidator placeholder="dd/mm/yyyy" (change)="doJobSearchByStartTime(!(fromTime.errors && fromTime.errors.dateValidator), fromTime.value)">
|
||||
<input id="fromDateInput" type="date" #fromTime="ngModel" name="from" [(ngModel)]="search.startTime" dateValidator placeholder="dd/mm/yyyy" (change)="doJobSearchByStartTime(!(fromTime.errors && fromTime.errors.dateValidator), fromTime.value)">
|
||||
<span *ngIf="fromTime.errors && fromTime.errors.dateValidator && (fromTime.dirty || fromTime.touched)" class="tooltip-content">
|
||||
{{'AUDIT_LOG.INVALID_DATE' | translate }}
|
||||
</span>
|
||||
</label>
|
||||
<clr-icon shape="date"></clr-icon>
|
||||
<label for="toDateInput" aria-haspopup="true" role="tooltip" [class.invalid]="toTime.errors && toTime.errors.dateValidator && (toTime.dirty || toTime.touched)" [class.valid]="toTime.valid" class="tooltip tooltip-validation invalid tooltip-sm">
|
||||
<input id="toDateInput" type="date" #toTime="ngModel" name="to" [(ngModel)]="currentJobSearchOption.toTime" dateValidator placeholder="dd/mm/yyyy" (change)="doJobSearchByEndTime(!(toTime.errors && toTime.errors.dateValidator),toTime.value)">
|
||||
<input id="toDateInput" type="date" #toTime="ngModel" name="to" [(ngModel)]="search.endTime" dateValidator placeholder="dd/mm/yyyy" (change)="doJobSearchByEndTime(!(toTime.errors && toTime.errors.dateValidator),toTime.value)">
|
||||
<span *ngIf="toTime.errors && toTime.errors.dateValidator && (toTime.dirty || toTime.touched)" class="tooltip-content">
|
||||
{{'AUDIT_LOG.INVALID_DATE' | translate }}
|
||||
</span>
|
||||
|
@ -52,7 +52,9 @@ class SearchOption {
|
||||
repoName: string = '';
|
||||
status: string = '';
|
||||
startTime: string = '';
|
||||
startTimestamp: string = '';
|
||||
endTime: string = '';
|
||||
endTimestamp: string = '';
|
||||
page: number = 1;
|
||||
pageSize: number = 5;
|
||||
}
|
||||
@ -66,7 +68,7 @@ export class ReplicationComponent implements OnInit {
|
||||
|
||||
projectId: number;
|
||||
|
||||
search: SearchOption;
|
||||
search: SearchOption = new SearchOption();
|
||||
|
||||
ruleStatus = ruleStatus;
|
||||
currentRuleStatus: {key: string, description: string};
|
||||
@ -98,7 +100,6 @@ export class ReplicationComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.projectId = +this.route.snapshot.parent.params['id'];
|
||||
this.search = new SearchOption();
|
||||
this.currentRuleStatus = this.ruleStatus[0];
|
||||
this.currentJobStatus = this.jobStatus[0];
|
||||
this.currentJobSearchOption = 0;
|
||||
@ -149,7 +150,7 @@ export class ReplicationComponent implements OnInit {
|
||||
}
|
||||
this.replicationService
|
||||
.listJobs(this.search.policyId, this.search.status, this.search.repoName,
|
||||
this.search.startTime, this.search.endTime, this.search.page, this.search.pageSize)
|
||||
this.search.startTimestamp, this.search.endTimestamp, this.search.page, this.search.pageSize)
|
||||
.subscribe(
|
||||
response=>{
|
||||
this.jobsTotalRecordCount = response.headers.get('x-total-count');
|
||||
@ -241,21 +242,20 @@ export class ReplicationComponent implements OnInit {
|
||||
}
|
||||
|
||||
doJobSearchByStartTime(valid: boolean, strDate: string) {
|
||||
this.search.startTime = '';
|
||||
this.search.startTimestamp = '';
|
||||
if(valid && strDate) {
|
||||
strDate = this.convertDate(strDate);
|
||||
console.log(strDate);
|
||||
this.search.startTime = (new Date(strDate).getTime() / 1000) + '';
|
||||
this.search.startTimestamp = new Date(strDate).getTime() / 1000 + '';
|
||||
}
|
||||
this.fetchPolicyJobs();
|
||||
}
|
||||
|
||||
doJobSearchByEndTime(valid: boolean, strDate: string) {
|
||||
this.search.endTime = '';
|
||||
this.search.endTimestamp = '';
|
||||
if(valid && strDate) {
|
||||
strDate = this.convertDate(strDate);
|
||||
let oneDayOffset = 3600 * 24;
|
||||
this.search.endTime = (new Date(strDate).getTime() / 1000 + oneDayOffset) + '';
|
||||
this.search.endTimestamp = (new Date(strDate).getTime() / 1000 + oneDayOffset) + '';
|
||||
}
|
||||
this.fetchPolicyJobs();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user