Browse Source

fix(identity): disable input when editing a static role

pull/1607/head
TheDiaval 7 years ago
parent
commit
c1ab80a3ef
  1. 2
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html
  2. 9
      npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

2
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html

@ -77,7 +77,7 @@
<div class="form-group"> <div class="form-group">
<label for="role-name">{{ 'AbpIdentity::RoleName' | abpLocalization }}</label <label for="role-name">{{ 'AbpIdentity::RoleName' | abpLocalization }}</label
><span> * </span> ><span> * </span>
<input type="text" id="role-name" class="form-control" formControlName="name" autofocus /> <input autofocus type="text" id="role-name" class="form-control" formControlName="name" />
</div> </div>
<div class="custom-checkbox custom-control mb-2"> <div class="custom-checkbox custom-control mb-2">

9
npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts

@ -1,10 +1,10 @@
import { ABP } from '@abp/ng.core'; import { ABP } from '@abp/ng.core';
import { ConfirmationService, Toaster } from '@abp/ng.theme.shared'; import { ConfirmationService, Toaster } from '@abp/ng.theme.shared';
import { Component, TemplateRef, ViewChild } from '@angular/core'; import { Component, TemplateRef, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { Select, Store } from '@ngxs/store'; import { Select, Store } from '@ngxs/store';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { debounceTime, finalize, pluck } from 'rxjs/operators'; import { finalize, pluck } from 'rxjs/operators';
import { import {
IdentityAddRole, IdentityAddRole,
IdentityDeleteRole, IdentityDeleteRole,
@ -54,7 +54,10 @@ export class RolesComponent {
createForm() { createForm() {
this.form = this.fb.group({ this.form = this.fb.group({
name: [this.selected.name || '', [Validators.required, Validators.maxLength(256)]], name: new FormControl({ value: this.selected.name || '', disabled: this.selected.isStatic }, [
Validators.required,
Validators.maxLength(256),
]),
isDefault: [this.selected.isDefault || false], isDefault: [this.selected.isDefault || false],
isPublic: [this.selected.isPublic || false], isPublic: [this.selected.isPublic || false],
}); });

Loading…
Cancel
Save