mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-06 18:50:09 +01:00
Update for restriction check.
This commit is contained in:
parent
900854128a
commit
3b0bd2e700
@ -87,7 +87,7 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
||||
private errorHandler: ErrorHandler,
|
||||
private translateService: TranslateService) {}
|
||||
|
||||
openCreateEditTarget(editable: boolean, targetId?: number) {
|
||||
openCreateEditTarget(editable: boolean, targetId?: number | string) {
|
||||
|
||||
this.target = this.initEndpoint;
|
||||
this.editable = editable;
|
||||
@ -211,6 +211,8 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
||||
payload.password = this.target.password;
|
||||
delete payload.name;
|
||||
}
|
||||
|
||||
if(!this.target.id) { return; }
|
||||
toPromise<number>(this.endpointService
|
||||
.updateEndpoint(this.target.id, payload))
|
||||
.then(
|
||||
@ -267,7 +269,9 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
||||
username: this.initVal.username,
|
||||
password: this.initVal.password
|
||||
};
|
||||
this.targetForm.valueChanges.subscribe(data=>{
|
||||
let self: CreateEditEndpointComponent | any = this;
|
||||
if(self) {
|
||||
self.targetForm.valueChanges.subscribe((data: any)=>{
|
||||
for(let key in data) {
|
||||
let current = data[key];
|
||||
let origin: string = comparison[key];
|
||||
@ -283,5 +287,6 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -145,14 +145,18 @@ export class EndpointComponent implements OnInit {
|
||||
editTarget(target: Endpoint) {
|
||||
if(target) {
|
||||
let editable = true;
|
||||
if (!target.id) {
|
||||
return;
|
||||
}
|
||||
let id: number | string = target.id;
|
||||
toPromise<ReplicationRule[]>(this.endpointService
|
||||
.getEndpointWithReplicationRules(target.id))
|
||||
.getEndpointWithReplicationRules(id))
|
||||
.then(
|
||||
rules=>{
|
||||
if(rules && rules.length > 0) {
|
||||
rules.forEach((rule)=>editable = (rule && rule.enabled !== 1));
|
||||
}
|
||||
this.createEditEndpointComponent.openCreateEditTarget(editable, +target.id);
|
||||
this.createEditEndpointComponent.openCreateEditTarget(editable, id);
|
||||
let hnd = setInterval(()=>this.ref.markForCheck(), 100);
|
||||
setTimeout(()=>clearInterval(hnd), 1000);
|
||||
})
|
||||
|
@ -120,7 +120,7 @@ export class EndpointDefaultService extends EndpointService {
|
||||
queryParams = new RequestQueryParams();
|
||||
}
|
||||
if(endpointName) {
|
||||
queryParams.set('endpointName', endpointName);
|
||||
queryParams.set('name', endpointName);
|
||||
}
|
||||
let requestUrl: string = `${this._endpointUrl}`;
|
||||
return this.http
|
||||
|
Loading…
Reference in New Issue
Block a user