mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 10:45:45 +01:00
Merge pull request #2299 from wknet123/master-endpoint
Update for restriction check.
This commit is contained in:
commit
de8e0091f9
@ -87,7 +87,7 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
|||||||
private errorHandler: ErrorHandler,
|
private errorHandler: ErrorHandler,
|
||||||
private translateService: TranslateService) {}
|
private translateService: TranslateService) {}
|
||||||
|
|
||||||
openCreateEditTarget(editable: boolean, targetId?: number) {
|
openCreateEditTarget(editable: boolean, targetId?: number | string) {
|
||||||
|
|
||||||
this.target = this.initEndpoint;
|
this.target = this.initEndpoint;
|
||||||
this.editable = editable;
|
this.editable = editable;
|
||||||
@ -211,6 +211,8 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
|||||||
payload.password = this.target.password;
|
payload.password = this.target.password;
|
||||||
delete payload.name;
|
delete payload.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!this.target.id) { return; }
|
||||||
toPromise<number>(this.endpointService
|
toPromise<number>(this.endpointService
|
||||||
.updateEndpoint(this.target.id, payload))
|
.updateEndpoint(this.target.id, payload))
|
||||||
.then(
|
.then(
|
||||||
@ -267,20 +269,23 @@ export class CreateEditEndpointComponent implements AfterViewChecked {
|
|||||||
username: this.initVal.username,
|
username: this.initVal.username,
|
||||||
password: this.initVal.password
|
password: this.initVal.password
|
||||||
};
|
};
|
||||||
this.targetForm.valueChanges.subscribe(data=>{
|
let self: CreateEditEndpointComponent | any = this;
|
||||||
for(let key in data) {
|
if(self) {
|
||||||
let current = data[key];
|
self.targetForm.valueChanges.subscribe((data: any)=>{
|
||||||
let origin: string = comparison[key];
|
for(let key in data) {
|
||||||
if(((this.actionType === ActionType.EDIT && this.editable && !current) || current) &&
|
let current = data[key];
|
||||||
current !== origin) {
|
let origin: string = comparison[key];
|
||||||
this.hasChanged = true;
|
if(((this.actionType === ActionType.EDIT && this.editable && !current) || current) &&
|
||||||
break;
|
current !== origin) {
|
||||||
} else {
|
this.hasChanged = true;
|
||||||
this.hasChanged = false;
|
break;
|
||||||
this.inlineAlert.close();
|
} else {
|
||||||
|
this.hasChanged = false;
|
||||||
|
this.inlineAlert.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,16 +143,20 @@ export class EndpointComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
editTarget(target: Endpoint) {
|
editTarget(target: Endpoint) {
|
||||||
if (target) {
|
if(target) {
|
||||||
let editable = true;
|
let editable = true;
|
||||||
|
if (!target.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let id: number | string = target.id;
|
||||||
toPromise<ReplicationRule[]>(this.endpointService
|
toPromise<ReplicationRule[]>(this.endpointService
|
||||||
.getEndpointWithReplicationRules(target.id))
|
.getEndpointWithReplicationRules(id))
|
||||||
.then(
|
.then(
|
||||||
rules=>{
|
rules=>{
|
||||||
if(rules && rules.length > 0) {
|
if(rules && rules.length > 0) {
|
||||||
rules.forEach((rule)=>editable = (rule && rule.enabled !== 1));
|
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);
|
let hnd = setInterval(()=>this.ref.markForCheck(), 100);
|
||||||
setTimeout(()=>clearInterval(hnd), 1000);
|
setTimeout(()=>clearInterval(hnd), 1000);
|
||||||
})
|
})
|
||||||
|
@ -120,7 +120,7 @@ export class EndpointDefaultService extends EndpointService {
|
|||||||
queryParams = new RequestQueryParams();
|
queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
if(endpointName) {
|
if(endpointName) {
|
||||||
queryParams.set('endpointName', endpointName);
|
queryParams.set('name', endpointName);
|
||||||
}
|
}
|
||||||
let requestUrl: string = `${this._endpointUrl}`;
|
let requestUrl: string = `${this._endpointUrl}`;
|
||||||
return this.http
|
return this.http
|
||||||
|
Loading…
Reference in New Issue
Block a user