Modify label filter issue and add stick label to image case

This commit is contained in:
pfh 2018-04-02 14:45:52 +08:00
parent a43451c7ea
commit e5a757d78d
13 changed files with 133 additions and 50 deletions

View File

@ -68,7 +68,8 @@ export class CreateEditLabelComponent implements OnInit, OnDestroy {
ngOnInit(): void {
this.nameChecker.debounceTime(500).subscribe((name: string) => {
this.checkOnGoing = true;
toPromise<Label[]>(this.labelService.getLabels(this.scope, this.projectId, name))
let labelName = this.currentForm.controls['name'].value;
toPromise<Label[]>(this.labelService.getLabels(this.scope, this.projectId, labelName))
.then(targets => {
if (targets && targets.length) {
this.isLabelNameExist = true;

View File

@ -157,7 +157,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
// if input value exit in project list
let pro = res.find((data: any) => data.name === name);
if (!pro) {
this.noProjectInfo = 'REPLICATION.PROJECT_NOT_EXIST_INFO';
this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO';
this.noSelectedProject = true;
} else {
this.noProjectInfo = '';
@ -165,12 +165,12 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
this.setProject([pro])
}
} else {
this.noProjectInfo = 'REPLICATION.PROJECT_NOT_EXIST_INFO';
this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO';
this.noSelectedProject = true;
}
}).catch((error: any) => {
this.errorHandler.error(error);
this.noProjectInfo = 'REPLICATION.PROJECT_NOT_EXIST_INFO';
this.noProjectInfo = 'REPLICATION.NO_PROJECT_INFO';
this.noSelectedProject = true;
});
});

View File

@ -30,6 +30,7 @@ import {Label} from "../service/interface";
export class LabelPieceComponent implements OnInit {
@Input() label: Label;
@Input() labelWidth: number;
ngOnInit(): void {
}

View File

@ -3,7 +3,7 @@
*/
export const LABEL_PIEICE_TEMPLATE: string = `
<label class="label" [ngStyle]="{'background-color': label.color}">
<label class="label" [ngStyle]="{'background-color': label.color}" [style.max-width.px]="labelWidth">
<clr-icon *ngIf="label.scope=='p'" shape="organization"></clr-icon>
<clr-icon *ngIf="label.scope=='g'" shape="administrator"></clr-icon>
{{label.name}}
@ -11,7 +11,12 @@ export const LABEL_PIEICE_TEMPLATE: string = `
`;
export const LABEL_PIEICE_STYLES: string = `
.label{border: none; color:#222;padding-top:2px; max-width:140px;}
.label clr-icon{ margin-right: 3px; display:block;}
.label{border: none; color:#222;
display: inline-block;
justify-content: flex-start;
overflow: hidden;
text-overflow: ellipsis;
line-height: .875rem;}
.label clr-icon{ margin-right: 3px;}
.btn-group .dropdown-menu clr-icon{display:block;}
`;

View File

@ -15,7 +15,7 @@ export const TAG_TEMPLATE = `
<div class="row" style="position:relative;">
<div>
<div class="row flex-items-xs-right rightPos">
<div class='filterLabelPiece' [style.left.px]='filterLabelPieceWidth' ><hbr-label-piece [hidden]='!filterOneLabel' [label]="filterOneLabel"></hbr-label-piece></div>
<div class='filterLabelPiece' [style.left.px]='filterLabelPieceWidth' ><hbr-label-piece [hidden]='!filterOneLabel' [label]="filterOneLabel" [labelWidth]="130"></hbr-label-piece></div>
<div class="flex-xs-middle">
<hbr-filter *ngIf="withAdmiral" [withDivider]="true" filterPlaceholder="{{'TAG.FILTER_FOR_TAGS' | translate}}" (filter)="doSearchTagNames($event)" [currentValue]="lastFilteredTagName"></hbr-filter>
<clr-dropdown *ngIf="!withAdmiral">
@ -23,12 +23,12 @@ export const TAG_TEMPLATE = `
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
<div style='display:grid'>
<label class="dropdown-header">{{'REPOSITORY.FILTER_BY_LABEL' | translate}}</label>
<div class="form-group"><input type="text" placeholder="Filter labels" #labelNamePiece (keyup)="handleInputFilter(labelNamePiece.value)"></div>
<div [hidden]='imageFilterLabels.length'>{{'LABEL.NO_LABELS' | translate }}</div>
<div class="form-group"><input type="text" placeholder="Filter labels" [(ngModel)]= "filterName" (keyup)="handleInputFilter()"></div>
<div [hidden]='imageFilterLabels.length' style="padding-left:10px;">{{'LABEL.NO_LABELS' | translate }}</div>
<div [hidden]='!imageFilterLabels.length' style='max-height:300px;overflow-y: auto;'>
<button type="button" class="dropdown-item" *ngFor='let label of imageFilterLabels' (click)="label.iconsShow = true; filterLabel(label)">
<clr-icon shape="check" class='pull-left' [hidden]='!label.iconsShow'></clr-icon>
<div class='labelDiv'><hbr-label-piece [label]="label.label"></hbr-label-piece></div>
<div class='labelDiv'><hbr-label-piece [label]="label.label" [labelWidth]="130"></hbr-label-piece></div>
<clr-icon shape="times-circle" class='pull-right' [hidden]='!label.iconsShow' (click)="$event.stopPropagation(); label.iconsShow = false; unFilterLabel(label)"></clr-icon>
</button>
</div>
@ -49,12 +49,12 @@ export const TAG_TEMPLATE = `
<clr-dropdown-menu clrPosition="bottom-left" *clrIfOpen>
<div style='display:grid'>
<label class="dropdown-header">{{'REPOSITORY.ADD_TO_IMAGE' | translate}}</label>
<div class="form-group"><input type="text" placeholder="Filter labels" #stickLabelNamePiece (keyup)="handleStickInputFilter(stickLabelNamePiece.value)"></div>
<div [hidden]='imageStickLabels.length'>{{'LABEL.NO_LABELS' | translate }}</div>
<div class="form-group"><input type="text" placeholder="Filter labels" [(ngModel)]="stickName" (keyup)="handleStickInputFilter()"></div>
<div [hidden]='imageStickLabels.length' style="padding-left:10px;">{{'LABEL.NO_LABELS' | translate }}</div>
<div [hidden]='!imageStickLabels.length' style='max-height:300px;overflow-y: auto;'>
<button type="button" class="dropdown-item" *ngFor='let label of imageStickLabels' (click)="selectLabel(label); label.iconsShow = true">
<clr-icon shape="check" class='pull-left' [hidden]='!label.iconsShow'></clr-icon>
<div class='labelDiv'><hbr-label-piece [label]="label.label"></hbr-label-piece></div>
<div class='labelDiv'><hbr-label-piece [label]="label.label" [labelWidth]="130"></hbr-label-piece></div>
<clr-icon shape="times-circle" class='pull-right' [hidden]='!label.iconsShow' (click)="$event.stopPropagation(); unSelectLabel(label); label.iconsShow = false"></clr-icon>
</button>
</div>
@ -96,7 +96,7 @@ export const TAG_TEMPLATE = `
<clr-dg-cell style="width: 160px;">{{t.created | date: 'short'}}</clr-dg-cell>
<clr-dg-cell style="width: 80px;" *ngIf="!withClair">{{t.docker_version}}</clr-dg-cell>
<clr-dg-cell *ngIf="!withAdmiral" style="width: 140px;">
<hbr-label-piece *ngIf="t.labels?.length" [label]="t.labels[0]"></hbr-label-piece>
<hbr-label-piece *ngIf="t.labels?.length" [label]="t.labels[0]" [labelWidth]="90"> </hbr-label-piece>
<div class="signpost-item" [hidden]="t.labels?.length<=1">
<div class="trigger-item">
<clr-signpost>

View File

@ -111,7 +111,8 @@ export class TagComponent implements OnInit, AfterViewInit {
labelNameFilter: Subject<string> = new Subject<string> ();
stickLabelNameFilter: Subject<string> = new Subject<string> ();
filterOnGoing: boolean;
stickName = ''
filterName = '';
initFilter = {
name: '',
description: '',
@ -159,12 +160,12 @@ export class TagComponent implements OnInit, AfterViewInit {
.debounceTime(500)
.distinctUntilChanged()
.subscribe((name: string) => {
if (name && name.length) {
if (this.filterName.length) {
this.filterOnGoing = true;
this.imageFilterLabels = [];
this.imageLabels.forEach(data => {
if (data.label.name.indexOf(name) !== -1) {
if (data.label.name.indexOf(this.filterName) !== -1) {
this.imageFilterLabels.push(data);
}
})
@ -178,12 +179,12 @@ export class TagComponent implements OnInit, AfterViewInit {
.debounceTime(500)
.distinctUntilChanged()
.subscribe((name: string) => {
if (name && name.length) {
if (this.stickName.length) {
this.filterOnGoing = true;
this.imageStickLabels = [];
this.imageLabels.forEach(data => {
if (data.label.name.indexOf(name) !== -1) {
if (data.label.name.indexOf(this.stickName) !== -1) {
this.imageStickLabels.push(data);
}
})
@ -385,17 +386,17 @@ export class TagComponent implements OnInit, AfterViewInit {
}
}
handleInputFilter($event: string) {
if ($event && $event.length) {
this.labelNameFilter.next($event);
handleInputFilter() {
if (this.filterName.length) {
this.labelNameFilter.next(this.filterName);
}else {
this.imageFilterLabels = clone(this.imageLabels);
}
}
handleStickInputFilter($event: string) {
if ($event && $event.length) {
this.stickLabelNameFilter.next($event);
handleStickInputFilter() {
if (this.stickName.length) {
this.stickLabelNameFilter.next(this.stickName);
}else {
this.imageStickLabels = clone(this.imageLabels);
}

View File

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

View File

@ -417,7 +417,7 @@
"IMAGE": "Images",
"LABELS": "Labels",
"ADD_TO_IMAGE": "Add labels to this image",
"FILTER_BY_LABEL": "Filter projects by label",
"FILTER_BY_LABEL": "Filter images by label",
"ADD_LABELS": "Add labels",
"ACTION": "ACTION",
"DEPLOY": "DEPLOY",

View File

@ -417,8 +417,8 @@
"IMAGE": "Imágenes",
"LABELS": "Labels",
"ADD_TO_IMAGE": "Add labels to this image",
"FILTER_BY_LABEL": "Filter images by label",
"ADD_LABELS": "Add labels",
"FILTER_BY_LABEL": "Filter projects by label",
"ACTION": "ACTION",
"DEPLOY": "DEPLOY",
"ADDITIONAL_INFO": "Add Additional Info"

View File

@ -368,6 +368,10 @@
"NOTARY_IS_UNDETERMINED": "Ne peut pas déterminer la signature de ce tag.",
"PLACEHOLDER": "Nous ne trouvons aucun dépôt !",
"IMAGE": "Images",
"LABELS": "Labels",
"ADD_TO_IMAGE": "Add labels to this image",
"FILTER_BY_LABEL": "Filter images by label",
"ADD_LABELS": "Add labels",
"ACTION": "ACTION",
"DEPLOY": "DEPLOY",
"ADDITIONAL_INFO": "Add Additional Info"

View File

@ -48,3 +48,20 @@
transform: rotate(-90deg);
}
.datagrid-spinner{margin-top: 24px;}
/* set overflow bar style */
::-webkit-scrollbar {
width: 8px;background:transparent;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background: #ccc;
-webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.5);
}
::-webkit-scrollbar-thumb:window-inactive {
background: rgba(255,0,0,0.4);
}

View File

@ -215,4 +215,12 @@ Edit Repo Info
Page Should Contain test_description_info
Capture Page Screenshot RepoInfo.png
Add Labels To Tag
[Arguments] ${tagName} ${labelName}
Click Element xpath=//clr-dg-row[contains(.,"${tagName}")]//label
Sleep 1
Click Element xpath=//clr-dg-action-bar//clr-dropdown//button
Sleep 1
Click Element xpath=//clr-dropdown//div//label[contains(.,"${labelName}")]
Sleep 3
Page Should Contain Element xpath=//clr-dg-row//label[contains(.,"${labelName}")]

View File

@ -48,7 +48,7 @@ Test Case - Read Only Mode
Close Browser
Test Case - Create An New User
Init Chrome Driver
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
Close Browser
@ -73,7 +73,7 @@ Test Case - Update Password
Logout Harbor
Sign In Harbor ${HARBOR_URL} tester${d} Test12#4
Close Browser
Test Case - Create An New Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
@ -93,8 +93,8 @@ Test Case - User View Projects
Wait Until Page Contains test${d}1
Wait Until Page Contains test${d}2
Wait Until Page Contains test${d}3
Close Browser
Close Browser
Test Case - Push Image
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
@ -108,21 +108,21 @@ Test Case - Push Image
Test Case - User View Logs
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=true
Push image ${ip} tester${d} Test1@34 project${d} busybox:latest
Pull image ${ip} tester${d} Test1@34 project${d} busybox:latest
Go Into Project project${d}
Delete Repo project${d}
Go To Project Log
Advanced Search Should Display
Do Log Advanced Search
Close Browser
Test Case - Manage project publicity
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
@ -172,12 +172,12 @@ Test Case - Project Level Policy Public
Click Project Public
Save Project Config
# Verify
Public Should Be Selected
Public Should Be Selected
Back To Projects
# Project${d} default should be private
# Here logout and login to try avoid a bug only in autotest
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Filter Object project${d}
Project Should Be Public project${d}
Close Browser
@ -266,6 +266,52 @@ Test Case - Edit Token Expire
Modify Token Expiration 30
Close Browser
Test Case - Create A New Labels
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Close Browser
Test Case - Update Label
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Sleep 3
${d1}= Get Current Date
Update A Label label_${d}
Close Browser
Test Case - Delete Label
Init Chrome Driver
${d}= Get Current Date
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To System Labels
Create New Labels label_${d}
Sleep 3
Delete A Label
Close Browser
TestCase - Add Labels To A Repo
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} vmware/photon:1.0
Sleep 2
#Add labels
Switch To System Labels
Create New Labels label_${d}
Sleep 2
Go Into Project project${d}
Go Into Repo project${d}/vmware/photon
Add Labels To Tag 1.0 label_${d}
Close Browser
Test Case - Scan A Tag In The Repo
Init Chrome Driver
${d}= get current date result_format=%m%s
@ -327,7 +373,7 @@ Test Case - Manual Scan All
Summary Chart Should Display latest
Close Browser
#
Test Case - Project Level Image Serverity Policy
Test Case - Project Level Image Serverity Policy
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library haproxy
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
@ -346,7 +392,7 @@ Test Case - Scan Image On Push
Go Into Project library
Goto Project Config
Enable Scan On Push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
Back To Projects
Go Into Project library
Go Into Repo memcached
@ -382,7 +428,7 @@ Test Case - Delete A Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New Project With New User ${HARBOR_URL} tester${d} tester${d}@vmware.com tester${d} Test1@34 harobr project${d} false
Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Push Image ${ip} tester${d} Test1@34 project${d} hello-world
Project Should Not Be Deleted project${d}
Go Into Project project${d}
Delete Repo project${d}
@ -392,7 +438,7 @@ Test Case - Delete A Project
Test Case - Delete Multi Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project projecta${d}
Create An New Project projectb${d}
@ -418,8 +464,8 @@ Test Case - Delete Multi User
Switch To User Tag
Filter Object delete
Multi-delete Object deletea deleteb deletec
# Assert delete
Delete Success
# Assert delete
Delete Success
Sleep 1
# Filter object delete
Page Should Not Contain deletea
@ -430,7 +476,7 @@ Test Case - Delete Multi Repo
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox
Sleep 2
Go Into Project project${d}
@ -471,7 +517,7 @@ Test Case - Delete Multi Member
Delete Success
Page Should Not Contain testa${d}
Close Browser
Test Case - Assign Sys Admin
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
@ -490,7 +536,7 @@ Test Case - Admin Push Signed Image
${rc} ${output}= Run And Return Rc And Output docker pull hello-world:latest
Log ${output}
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world:latest
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group9-Content-trust/notary-push-image.sh ${ip}
Log ${output}