Fix bug in harbor UI

fix #9271
fix #9207
fix #9178

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-10-18 14:18:52 +08:00
parent 5c5e475da4
commit 081e701793
7 changed files with 20 additions and 13 deletions

View File

@ -118,7 +118,7 @@
<clr-tooltip-content clrPosition="top-left" clrSize="md" *clrIfOpen>
<span class="tooltip-content" *ngIf="supportedFilters[i]?.type==='name'">{{'TOOLTIP.NAME_FILTER' | translate}}</span>
<span class="tooltip-content" *ngIf="supportedFilters[i]?.type==='tag'">{{'TOOLTIP.TAG_FILTER' | translate}}</span>
<span class="tooltip-content" *ngIf="supportedFilters[i]?.type==='label'">{{'TOOLTIP.LABEL_FILTER' | translate}}</span>
<span class="tooltip-content" >{{'TOOLTIP.LABEL_FILTER' | translate}}</span>
<span class="tooltip-content" *ngIf="supportedFilters[i]?.type==='resource'">{{'TOOLTIP.RESOURCE_FILTER' | translate}}</span>
</clr-tooltip-content>
</clr-tooltip>
@ -209,10 +209,6 @@
</clr-tooltip>
</label>
</div>
<div class="clr-checkbox-wrapper clr-form-control">
<input type="checkbox" [checked]="true" id="enablePolicy" formControlName="enabled" class="clr-checkbox">
<label for="enablePolicy" class="clr-control-label">{{'REPLICATION.ENABLED_RULE' | translate}}</label>
</div>
</div>
</div>
<div class="loading-center">

View File

@ -204,7 +204,6 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
}),
filters: this.fb.array([]),
deletion: false,
enabled: true,
override: true
});
}
@ -229,7 +228,6 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
}
},
deletion: false,
enabled: true,
override: true
});
this.isPushMode = true;
@ -253,7 +251,6 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
dest_registry: rule.dest_registry,
trigger: rule.trigger,
deletion: rule.deletion,
enabled: rule.enabled,
override: rule.override
});
let filtersArray = this.getFilterArray(rule);

View File

@ -256,7 +256,7 @@ export class MemberComponent implements OnInit, OnDestroy {
// Function to delete specific member
let deleteMember = (projectId: number, member: Member) => {
let operMessage = new OperateInfo();
operMessage.name = 'OPERATION.DELETE_MEMBER';
operMessage.name = member.entity_type === 'u' ? 'OPERATION.DELETE_MEMBER' : 'OPERATION.DELETE_GROUP';
operMessage.data.id = member.id;
operMessage.state = OperationState.progressing;
operMessage.data.name = member.entity_name;

View File

@ -79,7 +79,7 @@
[(ngModel)]="imagePermissionPull" clrCheckbox>
</td>
</tr>
<tr>
<tr *ngIf="withHelmChart">
<td class="left">{{'ROBOT_ACCOUNT.PERMISSIONS_HELMCHART' | translate}}</td>
<td>
<input type="checkbox"

View File

@ -8,6 +8,7 @@ import { of } from "rxjs";
import { ErrorHandler } from "@harbor/ui";
import { MessageHandlerService } from "../../../shared/message-handler/message-handler.service";
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { AppConfigService } from "../../../app-config.service";
describe('AddRobotComponent', () => {
let component: AddRobotComponent;
@ -24,6 +25,13 @@ describe('AddRobotComponent', () => {
let fakeMessageHandlerService = {
showSuccess: function() {}
};
let fakeAppConfigService = {
getConfig: function() {
return {
with_chartmuseum: true
};
}
};
beforeEach(async(() => {
TestBed.configureTestingModule({
@ -40,6 +48,7 @@ describe('AddRobotComponent', () => {
TranslateService,
ErrorHandler,
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService },
{ provide: AppConfigService, useValue: fakeAppConfigService },
{ provide: RobotService, useValue: fakeRobotService }
]
}).compileComponents();

View File

@ -18,6 +18,7 @@ import { ErrorHandler } from "@harbor/ui";
import { MessageHandlerService } from "../../../shared/message-handler/message-handler.service";
import { InlineAlertComponent } from "../../../shared/inline-alert/inline-alert.component";
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { AppConfigService } from "../../../app-config.service";
@Component({
selector: "add-robot",
@ -43,6 +44,7 @@ export class AddRobotComponent implements OnInit, OnDestroy {
robotForm: NgForm;
imagePermissionPush: boolean = true;
imagePermissionPull: boolean = true;
withHelmChart: boolean;
@Input() projectId: number;
@Input() projectName: string;
@Output() create = new EventEmitter<boolean>();
@ -54,10 +56,13 @@ export class AddRobotComponent implements OnInit, OnDestroy {
private errorHandler: ErrorHandler,
private cdr: ChangeDetectorRef,
private messageHandlerService: MessageHandlerService,
private sanitizer: DomSanitizer
) {}
private sanitizer: DomSanitizer,
private appConfigService: AppConfigService
) {}
ngOnInit(): void {
this.withHelmChart = this.appConfigService.getConfig().with_chartmuseum;
this.robotNameChecker.pipe(debounceTime(800)).subscribe((name: string) => {
let cont = this.currentForm.controls["robot_name"];
if (cont) {

View File

@ -103,7 +103,7 @@ export const maintainUrlQueryParmas = function (uri: string, key: string, value:
str += contentArray[1][getRandomInt(contentArray[1].length)];
}
if (!str.match(/[A-Z]+/g)) {
str += contentArray[1][getRandomInt(contentArray[1].length)];
str += contentArray[2][getRandomInt(contentArray[2].length)];
}
return str;
}