mirror of https://github.com/abpframework/abp.git
4 changed files with 108 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||||
|
import { EntityAction } from '@abp/ng.theme.shared/extensions'; |
||||
|
import { RolesComponent } from '../components/roles/roles.component'; |
||||
|
import { IdentityRoleDto } from '../proxy/identity/models'; |
||||
|
|
||||
|
export const DEFAULT_ROLES_ENTITY_ACTIONS = EntityAction.createMany<IdentityRoleDto>([ |
||||
|
{ |
||||
|
text: 'AbpIdentity::Edit', |
||||
|
action: data => { |
||||
|
const component = data.getInjected(RolesComponent); |
||||
|
component.edit(data.record.id); |
||||
|
}, |
||||
|
permission: 'AbpIdentity.Roles.Update', |
||||
|
}, |
||||
|
{ |
||||
|
text: 'AbpIdentity::Permissions', |
||||
|
action: data => { |
||||
|
const component = data.getInjected(RolesComponent); |
||||
|
component.openPermissionsModal(data.record.name); |
||||
|
}, |
||||
|
permission: 'AbpIdentity.Roles.ManagePermissions', |
||||
|
}, |
||||
|
{ |
||||
|
text: 'AbpIdentity::Delete', |
||||
|
action: data => { |
||||
|
const component = data.getInjected(RolesComponent); |
||||
|
component.delete(data.record.id, data.record.name); |
||||
|
}, |
||||
|
permission: 'AbpIdentity.Roles.Delete', |
||||
|
visible: data => !data.record.isStatic, |
||||
|
}, |
||||
|
]); |
||||
@ -0,0 +1,32 @@ |
|||||
|
import { LocalizationService } from '@abp/ng.core'; |
||||
|
import { EntityProp, ePropType } from '@abp/ng.theme.shared/extensions'; |
||||
|
import { of } from 'rxjs'; |
||||
|
import { IdentityRoleDto } from '../proxy/identity/models'; |
||||
|
|
||||
|
export const DEFAULT_ROLES_ENTITY_PROPS = EntityProp.createMany<IdentityRoleDto>([ |
||||
|
{ |
||||
|
type: ePropType.String, |
||||
|
name: 'name', |
||||
|
displayName: 'AbpIdentity::RoleName', |
||||
|
sortable: true, |
||||
|
valueResolver: data => { |
||||
|
const l10n = data.getInjected(LocalizationService); |
||||
|
const t = l10n.instant.bind(l10n); |
||||
|
const { isDefault, isPublic, name } = data.record; |
||||
|
|
||||
|
return of( |
||||
|
name + |
||||
|
(isDefault |
||||
|
? `<span class="badge badge-pill badge-success ml-1">${t( |
||||
|
'AbpIdentity::DisplayName:IsDefault', |
||||
|
)}</span>` |
||||
|
: '') + |
||||
|
(isPublic |
||||
|
? `<span class="badge badge-pill badge-info ml-1">${t( |
||||
|
'AbpIdentity::DisplayName:IsPublic', |
||||
|
)}</span>` |
||||
|
: ''), |
||||
|
); |
||||
|
}, |
||||
|
}, |
||||
|
]); |
||||
@ -0,0 +1,30 @@ |
|||||
|
import { ePropType, FormProp, PropData } from '@abp/ng.theme.shared/extensions'; |
||||
|
import { Validators } from '@angular/forms'; |
||||
|
import { IdentityRoleDto } from '../proxy/identity/models'; |
||||
|
|
||||
|
export const DEFAULT_ROLES_CREATE_FORM_PROPS = FormProp.createMany<IdentityRoleDto>([ |
||||
|
{ |
||||
|
type: ePropType.String, |
||||
|
name: 'name', |
||||
|
displayName: 'AbpIdentity::RoleName', |
||||
|
id: 'role-name', |
||||
|
disabled: (data: PropData<IdentityRoleDto>) => data.record && data.record.isStatic, |
||||
|
validators: () => [Validators.required], |
||||
|
}, |
||||
|
{ |
||||
|
type: ePropType.Boolean, |
||||
|
name: 'isDefault', |
||||
|
displayName: 'AbpIdentity::DisplayName:IsDefault', |
||||
|
id: 'role-is-default', |
||||
|
defaultValue: false, |
||||
|
}, |
||||
|
{ |
||||
|
type: ePropType.Boolean, |
||||
|
name: 'isPublic', |
||||
|
displayName: 'AbpIdentity::DisplayName:IsPublic', |
||||
|
id: 'role-is-public', |
||||
|
defaultValue: false, |
||||
|
}, |
||||
|
]); |
||||
|
|
||||
|
export const DEFAULT_ROLES_EDIT_FORM_PROPS = DEFAULT_ROLES_CREATE_FORM_PROPS; |
||||
@ -0,0 +1,15 @@ |
|||||
|
import { ToolbarAction } from '@abp/ng.theme.shared/extensions'; |
||||
|
import { RolesComponent } from '../components/roles/roles.component'; |
||||
|
import { IdentityRoleDto } from '../proxy/identity/models'; |
||||
|
|
||||
|
export const DEFAULT_ROLES_TOOLBAR_ACTIONS = ToolbarAction.createMany<IdentityRoleDto[]>([ |
||||
|
{ |
||||
|
text: 'AbpIdentity::NewRole', |
||||
|
action: data => { |
||||
|
const component = data.getInjected(RolesComponent); |
||||
|
component.add(); |
||||
|
}, |
||||
|
permission: 'AbpIdentity.Roles.Create', |
||||
|
icon: 'fa fa-plus', |
||||
|
}, |
||||
|
]); |
||||
Loading…
Reference in new issue