Merge pull request #4376 from pengpengshui/reptolib

Modify pagenation in Use, project name exist issue #4350 #4205 #4177
This commit is contained in:
pengpengshui 2018-03-08 17:34:10 +08:00 committed by GitHub
commit c24e0a5959
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 35 additions and 23 deletions

View File

@ -27,7 +27,6 @@ h4{
.filterSelect clr-icon{margin-left: 15px;}
.filterSelect label{width: 136px;}
.filterSelect label input{width: 100%;}
.cursor{cursor: pointer;}
.pull-left{float: left;}
.padLeft0{padding-left: 0;}
.floatSetPar{display: inline-block; width: 120px;margin-right: 10px;}
@ -56,6 +55,7 @@ h4{
.selectBox ul li{
list-style: none;
padding: 3px 20px
cursor: pointer;
}
.selectBox ul li:hover{
color: #262626;

View File

@ -69,7 +69,7 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
</div>
</div>
<label *ngIf="noEndpointInfo.length != 0" class="colorRed alertLabel">{{noEndpointInfo | translate}}</label>
<span class="goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'SIDE_NAV.SYSTEM_MGMT.REGISTRY' | translate}}</span>
<span class="alertLabel goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'SIDE_NAV.SYSTEM_MGMT.REGISTRY' | translate}}</span>
</div>
<!--Trigger-->

View File

@ -1,4 +1,4 @@
import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
import {Component, Input, Output, EventEmitter, ViewChild, OnChanges} from '@angular/core';
import { NgModel } from '@angular/forms';
import { DATETIME_PICKER_TEMPLATE } from './datetime-picker.component.html';
@ -7,7 +7,7 @@ import { DATETIME_PICKER_TEMPLATE } from './datetime-picker.component.html';
selector: 'hbr-datetime',
template: DATETIME_PICKER_TEMPLATE
})
export class DatePickerComponent {
export class DatePickerComponent implements OnChanges{
@Input() dateInput: string;
@Input() oneDayOffset: boolean;
@ -17,6 +17,10 @@ export class DatePickerComponent {
@Output() search = new EventEmitter<string>();
ngOnChanges(): void {
this.dateInput = this.dateInput.trim();
}
get dateInvalid(): boolean {
return (this.searchTime.errors && this.searchTime.errors.dateValidator && (this.searchTime.dirty || this.searchTime.touched)) || false;
}

View File

@ -1,11 +1,11 @@
export const LIST_REPLICATION_RULE_TEMPLATE: string = `
<div style="padding-bottom: 15px;">
<clr-datagrid [clrDgLoading]="loading" [(clrDgSingleSelected)]="selectedRow" [clDgRowSelection]="true">
<clr-dg-action-bar style="height:24px;" *ngIf="isSystemAdmin">
<button type="button" class="btn btn-sm btn-secondary" (click)="openModal()"><clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="editRule(selectedRow)"><clr-icon shape="pencil" size="16"></clr-icon>&nbsp;{{'REPLICATION.EDIT_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="deleteRule(selectedRow)"><clr-icon shape="times" size="16"></clr-icon>&nbsp;{{'REPLICATION.DELETE_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)"><clr-icon shape="export" size="16"></clr-icon>&nbsp;{{'REPLICATION.REPLICATE' | translate}}</button>
<clr-dg-action-bar style="height:24px;">
<button type="button" class="btn btn-sm btn-secondary" *ngIf="isSystemAdmin" (click)="openModal()"><clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" *ngIf="isSystemAdmin" [disabled]="!selectedRow" (click)="editRule(selectedRow)"><clr-icon shape="pencil" size="16"></clr-icon>&nbsp;{{'REPLICATION.EDIT_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" *ngIf="isSystemAdmin" [disabled]="!selectedRow" (click)="deleteRule(selectedRow)"><clr-icon shape="times" size="16"></clr-icon>&nbsp;{{'REPLICATION.DELETE_POLICY' | translate}}</button>
<button type="button" class="btn btn-sm btn-secondary" *ngIf="isSystemAdmin" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)"><clr-icon shape="export" size="16"></clr-icon>&nbsp;{{'REPLICATION.REPLICATE' | translate}}</button>
</clr-dg-action-bar>
<clr-dg-column [clrDgField]="'name'">{{'REPLICATION.NAME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'projects'" *ngIf="!projectScope">{{'REPLICATION.PROJECT' | translate}}</clr-dg-column>

View File

@ -388,6 +388,9 @@ export class ReplicationComponent implements OnInit, OnDestroy {
refreshJobs() {
this.currentJobStatus = this.jobStatus[0];
this.search.startTime = ' ';
this.search.endTime = ' ';
this.search.repoName = "";
this.search.startTimestamp = "";
this.search.endTimestamp = "";

View File

@ -31,7 +31,7 @@
"clarity-icons": "^0.10.17",
"clarity-ui": "^0.10.17",
"core-js": "^2.4.1",
"harbor-ui": "0.6.46",
"harbor-ui": "0.6.47",
"intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0",

View File

@ -13,6 +13,7 @@
pattern="^[a-z0-9]+(?:[._-][a-z0-9]+)*$"
minlength="2"
#projectName="ngModel"
autocomplete="off"
(keyup)='handleValidation()'>
<span class="tooltip-content">
{{ nameTooltipText | translate }}

View File

@ -74,7 +74,7 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
ngOnInit(): void {
this.proNameChecker
.debounceTime(500)
.distinctUntilChanged()
//.distinctUntilChanged()
.subscribe((name: string) => {
let cont = this.currentForm.controls["create_project_name"];
if (cont && this.hasChanged) {
@ -166,6 +166,8 @@ export class CreateProjectComponent implements AfterViewChecked, OnInit, OnDestr
newProject() {
this.project = new Project();
this.hasChanged = false;
this.isNameValid = true;
this.createProjectOpened = true;
}

View File

@ -49,10 +49,6 @@ import {BatchInfo, BathInfoChanges} from '../shared/confirmation-dialog/confirma
export class UserComponent implements OnInit, OnDestroy {
users: User[] = [];
originalUsers: Promise<User[]>;
private onGoing: boolean = true;
private adminMenuText: string = "";
private adminColumn: string = "";
private deletionSubscription: Subscription;
selectedRow: User[] = [];
ISADMNISTRATOR: string = "USER.ENABLE_ADMIN_ACTION";
batchDelectionInfos: BatchInfo[] = [];
@ -60,12 +56,15 @@ export class UserComponent implements OnInit, OnDestroy {
currentTerm: string;
totalCount: number = 0;
currentPage: number = 1;
timerHandler: any;
private onGoing: boolean = true;
private adminMenuText: string = "";
private adminColumn: string = "";
private deletionSubscription: Subscription;
@ViewChild(NewUserModalComponent)
newUserDialog: NewUserModalComponent;
timerHandler: any;
constructor(
private userService: UserService,
private translate: TranslateService,
@ -98,10 +97,6 @@ export class UserComponent implements OnInit, OnDestroy {
return this.selectedRow.length === 1 && this.isMySelf(this.selectedRow[0].user_id);
}
private isMatchFilterTerm(terms: string, testedItem: string): boolean {
return testedItem.toLowerCase().indexOf(terms.toLowerCase()) !== -1;
}
public get canCreateUser(): boolean {
let appConfig = this.appConfigService.getConfig();
if (appConfig) {
@ -173,9 +168,12 @@ export class UserComponent implements OnInit, OnDestroy {
if (terms.trim() === "") {
this.refreshUser((this.currentPage - 1) * 15, this.currentPage * 15);
} else {
this.users = users.filter(user => {
let selectUsers = users.filter(user => {
return this.isMatchFilterTerm(terms, user.username);
});
this.totalCount = selectUsers.length;
this.users = selectUsers.slice((this.currentPage - 1) * 15, this.currentPage * 15);//First page
this.forceRefreshView(5000);
}
});
@ -367,4 +365,8 @@ export class UserComponent implements OnInit, OnDestroy {
}, duration);
}
private isMatchFilterTerm(terms: string, testedItem: string): boolean {
return testedItem.toLowerCase().indexOf(terms.toLowerCase()) !== -1;
}
}