From a004472c05c49bc64be6c0cec80a7a0a1782b92b Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 3 Oct 2024 10:39:15 +0300 Subject: [PATCH] UI: Fixed edit and disabled oauth client settings scope --- .../oauth2/clients/client.component.html | 28 ++------ .../admin/oauth2/clients/client.component.ts | 70 ++----------------- 2 files changed, 10 insertions(+), 88 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.html b/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.html index df43a595fe..060c4177e8 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.html @@ -162,28 +162,12 @@ -
- - admin.oauth2.scope - - - {{scope}} - cancel - - - - - {{ 'admin.oauth2.scope-required' | translate }} - - -
- - + +
diff --git a/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.ts b/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.ts index a66d1592d9..44a5993485 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/oauth2/clients/client.component.ts @@ -33,18 +33,10 @@ import { AppState } from '@core/core.state'; import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; import { TranslateService } from '@ngx-translate/core'; import { Store } from '@ngrx/store'; -import { - AbstractControl, - UntypedFormArray, - UntypedFormBuilder, - UntypedFormGroup, - ValidationErrors, - Validators -} from '@angular/forms'; +import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { isDefinedAndNotNull } from '@core/utils'; import { OAuth2Service } from '@core/http/oauth2.service'; import { Subscription } from 'rxjs'; -import { MatChipInputEvent } from '@angular/material/chips'; import { COMMA, ENTER } from '@angular/cdk/keycodes'; import { PageLink } from '@shared/models/page/page-link'; import { coerceBoolean } from '@app/shared/decorators/coercion'; @@ -84,16 +76,6 @@ export class ClientComponent extends EntityComponent = []; - public static validateScope(control: AbstractControl): ValidationErrors | null { - const scope: string[] = control.value; - if (!scope || !scope.length) { - return { - required: true - }; - } - return null; - } - readonly separatorKeysCodes: number[] = [ENTER, COMMA]; clientAuthenticationMethods = Object.keys(ClientAuthenticationMethod); @@ -146,7 +128,7 @@ export class ClientComponent extends EntityComponent = []; - if (entity.scope) { - for (const scope of entity.scope) { - newScopeControls.push(this.fb.control(scope, [Validators.required])); - } - } - this.entityForm.setControl('scope', this.fb.array(newScopeControls)); - } } getProviderName(): string { @@ -204,35 +174,6 @@ export class ClientComponent extends EntityComponent { delete provider.additionalInfo; @@ -264,7 +205,7 @@ export class ClientComponent extends EntityComponent { - (this.entityForm.get('scope') as UntypedFormArray).clear(); + this.entityForm.get('scope').setValue([]); this.setProviderDefaultValue(provider, this.entityForm); })); } @@ -355,9 +296,6 @@ export class ClientComponent extends EntityComponent { - (clientRegistration.get('scope') as UntypedFormArray).push(this.fb.control('')); - }); clientRegistration.patchValue(template); } }