-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix 2.21.1: fix update worker settings propagation (#3203)
* fix update worker settings Signed-off-by: artembuslaev <artem.buslaev@envisionblockchain.com> * fix Signed-off-by: artembuslaev <artem.buslaev@envisionblockchain.com> * update version Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> * [skip ci] Add swagger.yaml * update settings Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> * fix fint Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> --------- Signed-off-by: artembuslaev <artem.buslaev@envisionblockchain.com> Signed-off-by: simvalery <valeriy.simonov@envisionblockchain.com> Co-authored-by: artembuslaev <artem.buslaev@envisionblockchain.com> Co-authored-by: envision-ci-agent <envision-ci-agent@users.noreply.github.com>
- Loading branch information
1 parent
e62fbf1
commit 1539a3d
Showing
27 changed files
with
141 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
126 changes: 78 additions & 48 deletions
126
frontend/src/app/views/admin/settings-view/settings-view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,85 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { FormBuilder, Validators } from '@angular/forms'; | ||
import { Component, OnDestroy, OnInit } from '@angular/core'; | ||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; | ||
import { CommonSettings } from '@guardian/interfaces'; | ||
import { SettingsService } from 'src/app/services/settings.service'; | ||
import { Subscription } from 'rxjs' | ||
|
||
@Component({ | ||
selector: 'app-settings-view', | ||
templateUrl: './settings-view.component.html', | ||
selector: 'app-settings-view', | ||
templateUrl: './settings-view.component.html', | ||
styleUrls: ['./settings-view.component.scss'] | ||
}) | ||
export class SettingsViewComponent implements OnInit { | ||
dataForm = this.fb.group({ | ||
operatorId: ['', Validators.compose([ | ||
Validators.required, | ||
Validators.pattern(/^\d+\.\d+\.\d+$/) | ||
])], | ||
operatorKey: ['', Validators.compose([ | ||
Validators.required, | ||
Validators.minLength(5) | ||
])], | ||
ipfsStorageApiKey: ['', Validators.compose([ | ||
Validators.required, | ||
Validators.minLength(5) | ||
])] | ||
}); | ||
isLoading: boolean = true; | ||
|
||
constructor( | ||
private fb: FormBuilder, | ||
private settingsService: SettingsService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.settingsService.getSettings() | ||
.subscribe((result: CommonSettings) => { | ||
this.dataForm.patchValue(result); | ||
this.isLoading = false | ||
}, (error) => { | ||
this.isLoading = true | ||
}); | ||
} | ||
|
||
onSubmit() { | ||
if (this.dataForm.valid) { | ||
this.isLoading = true; | ||
this.settingsService.updateSettings(this.dataForm.value) | ||
.subscribe(() => { | ||
this.isLoading = false; | ||
}, () => { | ||
this.isLoading = false; | ||
this.ngOnInit(); | ||
}); | ||
} | ||
} | ||
export class SettingsViewComponent implements OnInit, OnDestroy{ | ||
dataForm = this.fb.group({ | ||
operatorId: [ | ||
'', Validators.compose([ | ||
Validators.required, | ||
Validators.pattern(/^\d+\.\d+\.\d+$/) | ||
])], | ||
operatorKey: [ | ||
'', Validators.compose([ | ||
Validators.required, | ||
Validators.minLength(5) | ||
])], | ||
ipfsStorageApiKey: [ | ||
'', Validators.compose([ | ||
Validators.required, | ||
Validators.minLength(5) | ||
])] | ||
}); | ||
isLoading: boolean = true; | ||
|
||
keyAndProof = this.fb.group({ | ||
key: ['', Validators.required], | ||
proof: ['', Validators.required] | ||
}) | ||
|
||
private subscription: Subscription; | ||
|
||
constructor( | ||
private fb: FormBuilder, | ||
private settingsService: SettingsService) { | ||
this.subscription = new Subscription(); | ||
} | ||
|
||
ngOnInit() { | ||
this.subscription.add( | ||
this.settingsService.getSettings() | ||
.subscribe((result: CommonSettings) => { | ||
this.dataForm.patchValue(result); | ||
this.isLoading = false | ||
}, (error) => { | ||
this.isLoading = true | ||
}) | ||
); | ||
|
||
this.subscription.add( | ||
this.keyAndProof.valueChanges.subscribe(values => { | ||
this.dataForm.patchValue({ | ||
ipfsStorageApiKey: `${values.key};${values.proof}` | ||
}) | ||
}) | ||
); | ||
} | ||
|
||
getFormControl(formGroup: FormGroup, name: string): FormControl { | ||
return formGroup.get(name) as FormControl; | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subscription.unsubscribe() | ||
} | ||
|
||
onSubmit() { | ||
if (this.dataForm.valid) { | ||
this.isLoading = true; | ||
this.settingsService.updateSettings(this.dataForm.value) | ||
.subscribe(() => { | ||
this.isLoading = false; | ||
}, () => { | ||
this.isLoading = false; | ||
this.ngOnInit(); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.