mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 00:57:44 +01:00
Merge pull request #4880 from pengpengshui/fixIssues
Add multiple filter options for log #4360
This commit is contained in:
commit
df055e3241
@ -49,7 +49,7 @@ export const CREATE_EDIT_ENDPOINT_TEMPLATE: string = `
|
|||||||
</clr-tooltip-content>
|
</clr-tooltip-content>
|
||||||
</clr-tooltip>
|
</clr-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group" style="height:30px;">
|
||||||
<label for="spin" class="col-md-4"></label>
|
<label for="spin" class="col-md-4"></label>
|
||||||
<span class="col-md-8 spinner spinner-inline" [hidden]="!inProgress"></span>
|
<span class="col-md-8 spinner spinner-inline" [hidden]="!inProgress"></span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -77,7 +77,7 @@ describe('RecentLogComponent (inline template)', () => {
|
|||||||
|
|
||||||
spy = spyOn(logService, 'getRecentLogs')
|
spy = spyOn(logService, 'getRecentLogs')
|
||||||
.and.callFake(function (params: RequestQueryParams) {
|
.and.callFake(function (params: RequestQueryParams) {
|
||||||
if (params && params.get('repository')) {
|
if (params && params.get('username')) {
|
||||||
return Promise.resolve(mockData2);
|
return Promise.resolve(mockData2);
|
||||||
} else {
|
} else {
|
||||||
if (params.get('page') === '1') {
|
if (params.get('page') === '1') {
|
||||||
|
@ -43,6 +43,8 @@ export class RecentLogComponent implements OnInit {
|
|||||||
logsCache: AccessLog;
|
logsCache: AccessLog;
|
||||||
loading: boolean = true;
|
loading: boolean = true;
|
||||||
currentTerm: string;
|
currentTerm: string;
|
||||||
|
defaultFilter = "username";
|
||||||
|
isOpenFilterTag: boolean;
|
||||||
@Input() withTitle: boolean = false;
|
@Input() withTitle: boolean = false;
|
||||||
|
|
||||||
pageSize: number = DEFAULT_PAGE_SIZE;
|
pageSize: number = DEFAULT_PAGE_SIZE;
|
||||||
@ -94,6 +96,19 @@ export class RecentLogComponent implements OnInit {
|
|||||||
this.doFilter("");
|
this.doFilter("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openFilter(isOpen: boolean): void {
|
||||||
|
if (isOpen) {
|
||||||
|
this.isOpenFilterTag = true;
|
||||||
|
}else {
|
||||||
|
this.isOpenFilterTag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
selectFilterKey($event: any): void {
|
||||||
|
this.defaultFilter = $event['target'].value;
|
||||||
|
this.doFilter(this.currentTerm);
|
||||||
|
}
|
||||||
|
|
||||||
load(state: State) {
|
load(state: State) {
|
||||||
//Keep it for future filter
|
//Keep it for future filter
|
||||||
this.currentState = state;
|
this.currentState = state;
|
||||||
@ -105,7 +120,7 @@ export class RecentLogComponent implements OnInit {
|
|||||||
params.set("page", '' + pageNumber);
|
params.set("page", '' + pageNumber);
|
||||||
params.set("page_size", '' + this.pageSize);
|
params.set("page_size", '' + this.pageSize);
|
||||||
if (this.currentTerm && this.currentTerm !== "") {
|
if (this.currentTerm && this.currentTerm !== "") {
|
||||||
params.set('repository', this.currentTerm);
|
params.set(this.defaultFilter, this.currentTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
@ -8,7 +8,15 @@ export const LOG_TEMPLATE: string = `
|
|||||||
<div class="row flex-items-xs-between flex-items-xs-bottom">
|
<div class="row flex-items-xs-between flex-items-xs-bottom">
|
||||||
<div></div>
|
<div></div>
|
||||||
<div class="action-head-pos rightPos">
|
<div class="action-head-pos rightPos">
|
||||||
<hbr-filter [withDivider]="true" filterPlaceholder='{{"AUDIT_LOG.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)" [currentValue]="currentTerm"></hbr-filter>
|
<div class="select filterTag" [hidden]="!isOpenFilterTag">
|
||||||
|
<select id="selectKey" (change)="selectFilterKey($event)">
|
||||||
|
<option value="username">{{"AUDIT_LOG.USERNAME" | translate | lowercase}}</option>
|
||||||
|
<option value="repository">{{"CONFIG.REPOSITORY" | translate | lowercase}}</option>
|
||||||
|
<option value="tag">{{"REPOSITORY.TAG" | translate | lowercase}}</option>
|
||||||
|
<option value="operation">{{"AUDIT_LOG.OPERATION" | translate | lowercase}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<hbr-filter [withDivider]="true" filterPlaceholder='{{"AUDIT_LOG.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)" (openFlag)="openFilter($event)" [currentValue]="currentTerm"></hbr-filter>
|
||||||
<span (click)="refresh()" class="refresh-btn">
|
<span (click)="refresh()" class="refresh-btn">
|
||||||
<clr-icon shape="refresh" [hidden]="inProgress" ng-disabled="inProgress"></clr-icon>
|
<clr-icon shape="refresh" [hidden]="inProgress" ng-disabled="inProgress"></clr-icon>
|
||||||
<span class="spinner spinner-inline" [hidden]="!inProgress"></span>
|
<span class="spinner spinner-inline" [hidden]="!inProgress"></span>
|
||||||
@ -90,4 +98,5 @@ export const LOG_STYLES: string = `
|
|||||||
right: 35px;
|
right: 35px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
.filterTag{float:left;margin-top:8px;}
|
||||||
`;
|
`;
|
@ -30,7 +30,7 @@
|
|||||||
"clarity-icons": "^0.10.27",
|
"clarity-icons": "^0.10.27",
|
||||||
"clarity-ui": "^0.10.27",
|
"clarity-ui": "^0.10.27",
|
||||||
"core-js": "^2.4.1",
|
"core-js": "^2.4.1",
|
||||||
"harbor-ui": "0.7.17",
|
"harbor-ui": "0.7.18",
|
||||||
"intl": "^1.2.5",
|
"intl": "^1.2.5",
|
||||||
"mutationobserver-shim": "^0.3.2",
|
"mutationobserver-shim": "^0.3.2",
|
||||||
"ngx-cookie": "^1.0.0",
|
"ngx-cookie": "^1.0.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user