Modify test case and merge master

This commit is contained in:
pfh 2018-01-05 14:32:16 +08:00
parent 13308ce9d8
commit 162878a95c
11 changed files with 41 additions and 11403 deletions

View File

@ -23,7 +23,6 @@ export const CONFIRMATION_DIALOG_TEMPLATE: string = `
<ng-template [ngSwitchCase]="0"> <ng-template [ngSwitchCase]="0">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button> <button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" (click)="confirm()">{{'BUTTON.CONFIRM' | translate}}</button> <button type="button" class="btn btn-primary" (click)="confirm()">{{'BUTTON.CONFIRM' | translate}}</button>
<button type="button" class="btn btn-primary" (click)="cancel()">{{'BUTTON.CLOSE' | translate}}</button>
</ng-template> </ng-template>
<ng-template [ngSwitchCase]="1"> <ng-template [ngSwitchCase]="1">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.NO' | translate}}</button> <button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.NO' | translate}}</button>
@ -31,7 +30,7 @@ export const CONFIRMATION_DIALOG_TEMPLATE: string = `
</ng-template> </ng-template>
<ng-template [ngSwitchCase]="2"> <ng-template [ngSwitchCase]="2">
<button type="button" class="btn btn-outline" (click)="cancel()" [hidden]="isDelete">{{'BUTTON.CANCEL' | translate}}</button> <button type="button" class="btn btn-outline" (click)="cancel()" [hidden]="isDelete">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-danger" (click)="confirm()" [hidden]="isDelete">{{'BUTTON.DELETE' | translate}}</button> <button type="button" class="btn btn-danger" (click)="delete()" [hidden]="isDelete">{{'BUTTON.DELETE' | translate}}</button>
<button type="button" class="btn btn-primary" (click)="cancel()" [disabled]="!batchOverStatus" [hidden]="!isDelete">{{'BUTTON.CLOSE' | translate}}</button> <button type="button" class="btn btn-primary" (click)="cancel()" [disabled]="!batchOverStatus" [hidden]="!isDelete">{{'BUTTON.CLOSE' | translate}}</button>
</ng-template> </ng-template>
<ng-template [ngSwitchCase]="3"> <ng-template [ngSwitchCase]="3">

View File

@ -98,8 +98,8 @@ export class ConfirmationDialogComponent {
this.close(); this.close();
} }
confirm(): void { delete(): void {
if(!this.message){//Inproper condition if (!this.message){//Inproper condition
this.close(); this.close();
return; return;
} }
@ -118,4 +118,21 @@ export class ConfirmationDialogComponent {
); );
this.confirmAction.emit(message); this.confirmAction.emit(message);
} }
confirm(): void {
if (!this.message){//Inproper condition
this.close();
return;
}
let data: any = this.message.data ? this.message.data : {};
let target = this.message.targetId ? this.message.targetId : ConfirmationTargets.EMPTY;
let message = new ConfirmationAcknowledgement(
ConfirmationState.CONFIRMED,
data,
target
);
this.confirmAction.emit(message);
this.close();
}
} }

View File

@ -2,11 +2,11 @@ export const LIST_REPLICATION_RULE_TEMPLATE: string = `
<div> <div>
<clr-datagrid [clrDgLoading]="loading" [(clrDgSingleSelected)]="selectedRow" (clrDgSingleSelectedChange)="selectedChange()"> <clr-datagrid [clrDgLoading]="loading" [(clrDgSingleSelected)]="selectedRow" (clrDgSingleSelectedChange)="selectedChange()">
<clr-dg-action-bar> <clr-dg-action-bar>
<div class="btn-group"> <div class="btn-group" *ngIf="opereateAvailable">
<button type="button" *ngIf="creationAvailable" class="btn btn-sm btn-secondary" (click)="openModal()">{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" (click)="openModal()">{{'REPLICATION.NEW_REPLICATION_RULE' | translate}}</button>
<button type="button" *ngIf="creationAvailable" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="editRule(selectedRow)">{{'REPLICATION.EDIT_POLICY' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="editRule(selectedRow)">{{'REPLICATION.EDIT_POLICY' | translate}}</button>
<button type="button" *ngIf="creationAvailable" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="deleteRule(selectedRow)">{{'REPLICATION.DELETE_POLICY' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="deleteRule(selectedRow)">{{'REPLICATION.DELETE_POLICY' | translate}}</button>
<button type="button" *ngIf="creationAvailable" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)">{{'REPLICATION.REPLICATE' | translate}}</button> <button type="button" class="btn btn-sm btn-secondary" [disabled]="!selectedRow" (click)="replicateRule(selectedRow)">{{'REPLICATION.REPLICATE' | translate}}</button>
</div> </div>
</clr-dg-action-bar> </clr-dg-action-bar>
<clr-dg-column [clrDgField]="'name'">{{'REPLICATION.NAME' | translate}}</clr-dg-column> <clr-dg-column [clrDgField]="'name'">{{'REPLICATION.NAME' | translate}}</clr-dg-column>

View File

@ -96,7 +96,7 @@ export class ListReplicationRuleComponent implements OnInit, OnChanges {
setInterval(() => ref.markForCheck(), 500); setInterval(() => ref.markForCheck(), 500);
} }
public get creationAvailable(): boolean { public get opereateAvailable(): boolean {
return !this.readonly && !this.projectId ? true : false; return !this.readonly && !this.projectId ? true : false;
} }

View File

@ -1,5 +1,5 @@
export const REPLICATION_TEMPLATE: string = ` export const REPLICATION_TEMPLATE: string = `
<div class="row"> <div class="row" style="position:relative">
<div> <div>
<div class="row flex-items-xs-between rightPos"> <div class="row flex-items-xs-between rightPos">
<div class="flex-xs-middle option-right"> <div class="flex-xs-middle option-right">
@ -13,6 +13,7 @@ export const REPLICATION_TEMPLATE: string = `
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<hbr-list-replication-rule #listReplicationRule [readonly]="readonly" [projectId]="projectId" (replicateManual)=replicateManualRule($event) (selectOne)="selectOneRule($event)" (openNewRule)="openModal()" (editOne)="openEditRule($event)" (reload)="reloadRules($event)" [loading]="loading" [withReplicationJob]="withReplicationJob" (redirect)="customRedirect($event)"></hbr-list-replication-rule> <hbr-list-replication-rule #listReplicationRule [readonly]="readonly" [projectId]="projectId" (replicateManual)=replicateManualRule($event) (selectOne)="selectOneRule($event)" (openNewRule)="openModal()" (editOne)="openEditRule($event)" (reload)="reloadRules($event)" [loading]="loading" [withReplicationJob]="withReplicationJob" (redirect)="customRedirect($event)"></hbr-list-replication-rule>
</div> </div>
<br> <br>
<div *ngIf="withReplicationJob" class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div *ngIf="withReplicationJob" class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="row flex-items-xs-between" style="height:60px;"> <div class="row flex-items-xs-between" style="height:60px;">
<h5 class="flex-items-xs-bottom option-left-down" style="margin-left: 14px;">{{'REPLICATION.REPLICATION_JOBS' | translate}}</h5> <h5 class="flex-items-xs-bottom option-left-down" style="margin-left: 14px;">{{'REPLICATION.REPLICATION_JOBS' | translate}}</h5>

View File

@ -136,9 +136,6 @@ export class ReplicationComponent implements OnInit, OnDestroy {
private translateService: TranslateService) { private translateService: TranslateService) {
} }
/*public get creationAvailable(): boolean {
return !this.readonly && this.projectId ? true : false;
}*/
public get showPaginationIndex(): boolean { public get showPaginationIndex(): boolean {
return this.totalCount > 0; return this.totalCount > 0;
@ -158,7 +155,6 @@ export class ReplicationComponent implements OnInit, OnDestroy {
openModal(): void { openModal(): void {
this.openCreateRule.emit(); this.openCreateRule.emit();
// this.createEditPolicyComponent.openCreateEditRule(true);
} }
openEditRule(rule: ReplicationRule) { openEditRule(rule: ReplicationRule) {
@ -168,7 +164,6 @@ export class ReplicationComponent implements OnInit, OnDestroy {
editable = false; editable = false;
} }
this.openEdit.emit(rule.id); this.openEdit.emit(rule.id);
// this.createEditPolicyComponent.openCreateEditRule(editable, rule.id);
} }
} }

11373
src/ui_ng/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
"clarity-icons": "^0.10.17", "clarity-icons": "^0.10.17",
"clarity-ui": "^0.10.17", "clarity-ui": "^0.10.17",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"harbor-ui": "0.6.6", "harbor-ui": "0.6.9",
"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",

View File

@ -89,6 +89,7 @@ const harborRoutes: Routes = [
path: 'replications', path: 'replications',
component: TotalReplicationPageComponent, component: TotalReplicationPageComponent,
canActivate: [SystemAdminGuard], canActivate: [SystemAdminGuard],
canActivateChild: [SystemAdminGuard],
}, },
{ {
path: 'replications/:id/rule', path: 'replications/:id/rule',
@ -143,7 +144,6 @@ const harborRoutes: Routes = [
{ {
path: 'replications', path: 'replications',
component: ReplicationPageComponent, component: ReplicationPageComponent,
canActivate: [SystemAdminGuard]
}, },
{ {
path: 'members', path: 'members',

View File

@ -33,13 +33,12 @@ export class SystemAdminGuard implements CanActivate, CanActivateChild {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> | boolean {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let user = this.authService.getCurrentUser(); let user = this.authService.getCurrentUser();
let projectMem = this.authService.projectMembers;
if (!user) { if (!user) {
this.authService.retrieveUser() this.authService.retrieveUser()
.then(() => { .then(() => {
//updated user //updated user
user = this.authService.getCurrentUser(); user = this.authService.getCurrentUser();
if (user.has_admin_role > 0 || projectMem[0].role_name === 'projectAdmin') { if (user.has_admin_role > 0) {
return resolve(true); return resolve(true);
} else { } else {
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);
@ -61,7 +60,7 @@ export class SystemAdminGuard implements CanActivate, CanActivateChild {
} }
}); });
} else { } else {
if (user.has_admin_role > 0 || projectMem[0].role_name === 'projectAdmin') { if (user.has_admin_role > 0) {
return resolve(true); return resolve(true);
} else { } else {
this.router.navigate([CommonRoutes.HARBOR_DEFAULT]); this.router.navigate([CommonRoutes.HARBOR_DEFAULT]);

View File

@ -237,15 +237,15 @@ Test Case - Edit Token Expire
Modify Token Expiration 30 Modify Token Expiration 30
Close Browser Close Browser
Test Case - Create An Replication Rule New Endpoint # Test Case - Create An Replication Rule New Endpoint
Init Chrome Driver # Init Chrome Driver
${d}= Get current date result_format=%m%s # ${d}= Get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} # Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
Create An New Project project${d} # Create An New Project project${d}
Go Into Project project${d} # Go Into Project project${d}
Switch To Replication # Switch To Replication
Create An New Rule With New Endpoint policy_name=test_policy_${d} policy_description=test_description destination_name=test_destination_name_${d} destination_url=test_destination_url_${d} destination_username=test_destination_username destination_password=test_destination_password # Create An New Rule With New Endpoint policy_name=test_policy_${d} policy_description=test_description destination_name=test_destination_name_${d} destination_url=test_destination_url_${d} destination_username=test_destination_username destination_password=test_destination_password
Close Browser # Close Browser
Test Case - Scan A Tag In The Repo Test Case - Scan A Tag In The Repo
Init Chrome Driver Init Chrome Driver