mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-29 12:07:56 +01:00
Merge pull request #13376 from AllForNothing/p2p-css
Fix a bug for editing p2p instance
This commit is contained in:
commit
a255f3e74d
@ -208,10 +208,15 @@ export class DistributionSetupModalComponent implements OnInit, OnDestroy {
|
|||||||
instance.vendor = this.model.vendor;
|
instance.vendor = this.model.vendor;
|
||||||
instance.name = this.model.name;
|
instance.name = this.model.name;
|
||||||
instance.endpoint = this.model.endpoint;
|
instance.endpoint = this.model.endpoint;
|
||||||
|
instance.insecure = this.model.insecure;
|
||||||
instance.enabled = this.model.enabled;
|
instance.enabled = this.model.enabled;
|
||||||
instance.description = this.model.description;
|
|
||||||
instance.auth_mode = this.model.auth_mode;
|
instance.auth_mode = this.model.auth_mode;
|
||||||
instance.auth_info = this.model.auth_info;
|
instance.description = this.model.description;
|
||||||
|
if (instance.auth_mode !== AuthMode.NONE) {
|
||||||
|
instance.auth_info = this.authData;
|
||||||
|
} else {
|
||||||
|
delete instance.auth_info;
|
||||||
|
}
|
||||||
this.distributionService.UpdateInstance({preheatInstanceName: this.model.name, instance: this.handleInstance(instance)
|
this.distributionService.UpdateInstance({preheatInstanceName: this.model.name, instance: this.handleInstance(instance)
|
||||||
}).subscribe(
|
}).subscribe(
|
||||||
response => {
|
response => {
|
||||||
@ -247,6 +252,8 @@ export class DistributionSetupModalComponent implements OnInit, OnDestroy {
|
|||||||
} else {
|
} else {
|
||||||
delete this.model.auth_info;
|
delete this.model.auth_info;
|
||||||
}
|
}
|
||||||
|
// set insure property to true or false
|
||||||
|
this.model.insecure = !!this.model.insecure;
|
||||||
this.distributionService.CreateInstance({instance: this.model}).subscribe(
|
this.distributionService.CreateInstance({instance: this.model}).subscribe(
|
||||||
response => {
|
response => {
|
||||||
this.translate.get('DISTRIBUTION.CREATE_SUCCESS').subscribe(msg => {
|
this.translate.get('DISTRIBUTION.CREATE_SUCCESS').subscribe(msg => {
|
||||||
@ -278,6 +285,9 @@ export class DistributionSetupModalComponent implements OnInit, OnDestroy {
|
|||||||
if (editingMode) {
|
if (editingMode) {
|
||||||
this.model = clone(data);
|
this.model = clone(data);
|
||||||
this.originModelForEdit = clone(data);
|
this.originModelForEdit = clone(data);
|
||||||
|
// set insure property to true or false
|
||||||
|
this.originModelForEdit.insecure = !!data.insecure;
|
||||||
|
this.model.insecure = !!data.insecure;
|
||||||
this.authData = this.model.auth_info || {};
|
this.authData = this.model.auth_info || {};
|
||||||
} else {
|
} else {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user