#2 Amélioration générales des configurations

This commit is contained in:
FyloZ 2021-08-09 21:33:15 -04:00
parent 1a5c09cb41
commit 7bed986536
Signed by: william
GPG Key ID: 835378AE9AF4AE97
3 changed files with 6 additions and 2 deletions

View File

@ -4,7 +4,7 @@
<cre-primary-button routerLink="/color">Retour</cre-primary-button> <cre-primary-button routerLink="/color">Retour</cre-primary-button>
</cre-action-group> </cre-action-group>
<cre-action-group> <cre-action-group>
<cre-accent-button type="submit" (click)="onSubmit()">Enregistrer</cre-accent-button> <cre-accent-button [disabled]="!(form.dirty && form.valid)" (click)="onSubmit()">Enregistrer</cre-accent-button>
</cre-action-group> </cre-action-group>
</cre-action-bar> </cre-action-bar>

View File

@ -47,6 +47,10 @@ export class CreConfigEditor extends ErrorHandlingComponent {
this.fetchConfigurations(formBuilder) this.fetchConfigurations(formBuilder)
} }
ngOnInit() {
super.ngOnInit()
}
getConfigControl(key: string): ConfigControl { getConfigControl(key: string): ConfigControl {
return { return {
config: this.configs.get(key), config: this.configs.get(key),

View File

@ -46,7 +46,7 @@ export class ConfigControl {
} }
export function buildFormControl(config: Config): AbstractControl { export function buildFormControl(config: Config): AbstractControl {
return new FormControl({value: config.content, disabled: !config.editable}, Validators.required) return new FormControl({value: config.content, disabled: !config.editable}, !configKeyIsPassword(config.key) ? Validators.required : null)
} }
export function configKeyIsPassword(key: string): boolean { export function configKeyIsPassword(key: string): boolean {