mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ADF-4947] Array type supported in data table columns (#5165)
* [WIP] [ADF-4947] Array type supported in data table columns * * removed resolver for aria label * * process services feature added * * fixed docs
This commit is contained in:
parent
12bbb993bd
commit
baa0d6da30
@ -18,6 +18,7 @@
|
||||
[selectionMode]="selectionMode"
|
||||
[multiselect]="multiselect"
|
||||
[actions]="true"
|
||||
[resolverFn]="resolver"
|
||||
rowStyleClass="custom-row-style"
|
||||
(showRowActionsMenu)="onShowRowActionsMenu($event)"
|
||||
(executeRowAction)="onExecuteRowAction($event)">
|
||||
@ -28,7 +29,11 @@
|
||||
<data-column key="id" title="Id"></data-column>
|
||||
<data-column key="createdOn" title="Created"></data-column>
|
||||
<data-column key="name" title="Name" class="adf-full-width name-column"></data-column>
|
||||
<data-column key="createdBy.name" title="Created By"></data-column>
|
||||
<data-column type="text" key="createdBy.name" title="Created By"></data-column>
|
||||
<data-column type="text" key="users" title="Users"></data-column>
|
||||
<data-column key="status" title="Status">
|
||||
<ng-template let-value="value">{{value | json }}</ng-template>
|
||||
</data-column>
|
||||
</data-columns>
|
||||
-->
|
||||
</adf-datatable>
|
||||
|
@ -16,8 +16,16 @@
|
||||
*/
|
||||
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { DataColumn, DataRow } from '@alfresco/adf-core';
|
||||
import { DataCellEvent, DataRowActionEvent, DataSorting, ObjectDataColumn, ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
|
||||
import {
|
||||
DataCellEvent,
|
||||
DataColumn,
|
||||
DataRow,
|
||||
DataRowActionEvent,
|
||||
DataSorting,
|
||||
ObjectDataColumn,
|
||||
ObjectDataRow,
|
||||
ObjectDataTableAdapter
|
||||
} from '@alfresco/adf-core';
|
||||
|
||||
export class FilteredDataAdapter extends ObjectDataTableAdapter {
|
||||
|
||||
@ -75,6 +83,20 @@ export class DataTableComponent {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
resolver(row: DataRow, col: DataColumn): any {
|
||||
const value = row.getValue(col.key);
|
||||
if (col.key === 'users') {
|
||||
return (value || []).map(user => `${user.firstName} ${user.lastName}`).toString();
|
||||
}
|
||||
|
||||
if (col.key === 'status') {
|
||||
const users = row.getValue('users');
|
||||
return (value || []).map((status, index) => ({ 'name': `${users[index].firstName} ${users[index].lastName}`, status }));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/* spellchecker: disable */
|
||||
reset() {
|
||||
this.data = new FilteredDataAdapter(
|
||||
@ -90,7 +112,21 @@ export class DataTableComponent {
|
||||
createdOn: new Date(2016, 6, 2, 15, 8, 1),
|
||||
createdBy: this._createdBy,
|
||||
icon: 'material-icons://folder_open',
|
||||
json: null
|
||||
json: null,
|
||||
users: [
|
||||
{
|
||||
firstName: 'Super',
|
||||
lastName: 'Man'
|
||||
},
|
||||
{
|
||||
firstName: 'Iron',
|
||||
lastName: 'Man'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
@ -98,7 +134,21 @@ export class DataTableComponent {
|
||||
createdOn: new Date(2016, 6, 2, 15, 8, 2),
|
||||
createdBy: this._createdBy,
|
||||
icon: 'material-icons://accessibility',
|
||||
json: null
|
||||
json: null,
|
||||
users: [
|
||||
{
|
||||
firstName: 'Mister',
|
||||
lastName: 'Bean'
|
||||
},
|
||||
{
|
||||
firstName: 'Doctor',
|
||||
lastName: 'Strange'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
@ -106,7 +156,21 @@ export class DataTableComponent {
|
||||
createdOn: new Date(2016, 6, 2, 15, 8, 3),
|
||||
createdBy: this._createdBy,
|
||||
icon: 'material-icons://alarm',
|
||||
json: null
|
||||
json: null,
|
||||
users: [
|
||||
{
|
||||
firstName: 'Thunder',
|
||||
lastName: 'Thor'
|
||||
},
|
||||
{
|
||||
firstName: 'Marvel',
|
||||
lastName: 'Avenger'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
@ -120,10 +184,45 @@ export class DataTableComponent {
|
||||
createdOn: new Date(2016, 6, 2, 15, 8, 4),
|
||||
createdBy: {
|
||||
name: 'Felipe',
|
||||
lastname: 'Melo'
|
||||
lastName: 'Melo'
|
||||
},
|
||||
icon: 'material-icons://alarm'
|
||||
},
|
||||
users: [
|
||||
{
|
||||
firstName: 'Spider',
|
||||
lastName: 'Man'
|
||||
},
|
||||
{
|
||||
firstName: '17',
|
||||
lastName: 'Again'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: 'I am using custom resolver',
|
||||
createdOn: new Date(2016, 6, 2, 15, 8, 4),
|
||||
createdBy: this._createdBy,
|
||||
icon: 'material-icons://person_outline',
|
||||
users: [
|
||||
{
|
||||
firstName: 'Captain',
|
||||
lastName: 'America'
|
||||
},
|
||||
{
|
||||
firstName: 'John',
|
||||
lastName: 'Wick'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
@ -132,7 +231,9 @@ export class DataTableComponent {
|
||||
{ type: 'date', key: 'createdOn', title: 'Created On', sortable: true, cssClass: 'adf-ellipsis-cell adf-expand-cell-2' },
|
||||
{ type: 'text', key: 'name', title: 'Name', cssClass: 'adf-ellipsis-cell', sortable: true },
|
||||
{ type: 'text', key: 'createdBy.name', title: 'Created By', sortable: true, cssClass: ''},
|
||||
{ type: 'json', key: 'json', title: 'Json', cssClass: 'adf-expand-cell-2'}
|
||||
{ type: 'json', key: 'json', title: 'Json', cssClass: 'adf-expand-cell-2'},
|
||||
{ type: 'text', key: 'users', title: 'Users', cssClass: 'adf-expand-cell-2'},
|
||||
{ type: 'json', key: 'status', title: 'Status', cssClass: 'adf-expand-cell-2'}
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -209,6 +209,7 @@ for more information about installing and using the source code.
|
||||
| [Form service](core/services/form.service.md) | Implements Process Services form methods | [Source](../lib/core/form/services/form.service.ts) |
|
||||
| [Highlight Transform service](core/services/highlight-transform.service.md) | Adds HTML to a string to highlight chosen sections. | [Source](../lib/core/services/highlight-transform.service.ts) |
|
||||
| [Identity Group service](core/services/identity-group.service.md) | Performs CRUD operations on identity groups. | [Source](../lib/core/userinfo/services/identity-group.service.ts) |
|
||||
| [Identity role service](core/services/identity-role.service.md) | Provides APIs for working with the Roles in Identity Services. | [Source](../lib/core/userinfo/services/identity-role.service.ts) |
|
||||
| [Identity user service](core/services/identity-user.service.md) | Gets OAuth2 personal details and roles for users and performs CRUD operations on identity users. | [Source](../lib/core/userinfo/services/identity-user.service.ts) |
|
||||
| [JWT helper service](core/services/jwt-helper.service.md) | Decodes a JSON Web Token (JWT) to a JavaScript object. | [Source](../lib/core/services/jwt-helper.service.ts) |
|
||||
| [Log Service](core/services/log.service.md) | Provides log functionality. | [Source](../lib/core/services/log.service.ts) |
|
||||
|
@ -354,6 +354,7 @@ Learm more about styling your datatable: [Customizing the component's styles](#c
|
||||
| loading | `boolean` | false | Flag that indicates if the datatable is in loading state and needs to show the loading template (see the docs to learn how to configure a loading template). |
|
||||
| multiselect | `boolean` | false | Toggles multiple row selection, which renders checkboxes at the beginning of each row. |
|
||||
| noPermission | `boolean` | false | Flag that indicates if the datatable should show the "no permission" template. |
|
||||
| resolverFn | `Function` | | Custom resolver function which is used to parse dynamic column objects. see [Resolver Function](#resolver-function)|
|
||||
| rowMenuCacheEnabled | `boolean` | true | Should the items for the row actions menu be cached for reuse after they are loaded the first time? |
|
||||
| rowStyle | `string` | | The inline style to apply to every row. See [NgStyle](https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html) docs for more details and usage examples. |
|
||||
| rowStyleClass | `string` | "" | The CSS class to apply to every row. |
|
||||
@ -754,6 +755,73 @@ Once set up, the sticky header behaves as shown in the image below:
|
||||
|
||||

|
||||
|
||||
## Resolver Function
|
||||
|
||||
If you have a table with complex object, you might want to parse it before to display. you can do this using following steps.
|
||||
|
||||
# what is resolver
|
||||
Resolver is a pure function which gets executed on each row and columns.
|
||||
|
||||
# purpose
|
||||
It helps to parse the complex object in the data table.
|
||||
|
||||
# example
|
||||
Assume we want to merge two properties and show them in a text format
|
||||
|
||||
```json
|
||||
{
|
||||
name: 'I am using custom resolver',
|
||||
users: [
|
||||
{
|
||||
firstName: 'Captain',
|
||||
lastName: 'America'
|
||||
},
|
||||
{
|
||||
firstName: 'John',
|
||||
lastName: 'Wick'
|
||||
}
|
||||
],
|
||||
status: [
|
||||
'I am here to save the world.. By world means AMERICA',
|
||||
'That nobody is John Wick…'
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
here is the sample resolver which merge the users property and status and it will show in one column
|
||||
|
||||
```javascript
|
||||
resolver(row: DataRow, col: DataColumn): any {
|
||||
const value = row.getValue(col.key);
|
||||
|
||||
// Desired parsing logic
|
||||
if (col.key === 'status') {
|
||||
const users = row.getValue('users');
|
||||
return (value || []).map((status, index) => `name - ${users[index].firstName} ${users[index].lastName} status: ${status}` ).toString();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<adf-datatable
|
||||
[data]="data"
|
||||
[resolverFn]="resolver">
|
||||
<data-columns>
|
||||
<data-column type="text" key="name" title="Name"></data-column>
|
||||
<data-column type="text" key="users" title="Users"></data-column>
|
||||
<data-column type="text" key="status" title="Status"></data-column>
|
||||
</data-columns>
|
||||
</adf-datatable>
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
## See also
|
||||
|
||||
- [Data column component](data-column.component.md)
|
||||
|
@ -5,7 +5,7 @@ Status: Experimental
|
||||
Last reviewed: 2019-06-05
|
||||
---
|
||||
|
||||
# [Notification History component](../../../lib/core/notification-history/notification-history.component.ts "Defined in notification-history.component.ts")
|
||||
# [Notification History component](../../../lib/core/notifications/components/notification-history.component.ts "Defined in notification-history.component.ts")
|
||||
|
||||
This component is in the current status just an experimental component.
|
||||
The main purpose of the [Notification history component](../../core/components/notification-history.component.md) is list all the notification received in the current session. They will disappear from the list after the refresh.
|
||||
|
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Bpm User model](../../../lib/core/userinfo/models/bpm-user.model.ts "Defined in bpm-user.model.ts")
|
||||
# [Bpm User model](../../../lib/core/models/bpm-user.model.ts "Defined in bpm-user.model.ts")
|
||||
|
||||
Contains information about a Process Services user.
|
||||
|
||||
|
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Ecm User model](../../../lib/core/userinfo/models/ecm-user.model.ts "Defined in ecm-user.model.ts")
|
||||
# [Ecm User model](../../../lib/core/models/ecm-user.model.ts "Defined in ecm-user.model.ts")
|
||||
|
||||
Contains information about a Content Services user.
|
||||
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Bpm User service](../../../lib/core/userinfo/services/bpm-user.service.ts "Defined in bpm-user.service.ts")
|
||||
# [Bpm User service](../../../lib/core/services/bpm-user.service.ts "Defined in bpm-user.service.ts")
|
||||
|
||||
Gets information about the current Process Services user.
|
||||
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2018-11-19
|
||||
---
|
||||
|
||||
# [Ecm User service](../../../lib/core/userinfo/services/ecm-user.service.ts "Defined in ecm-user.service.ts")
|
||||
# [Ecm User service](../../../lib/core/services/ecm-user.service.ts "Defined in ecm-user.service.ts")
|
||||
|
||||
Gets information about a Content Services user.
|
||||
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2019-07-13
|
||||
---
|
||||
|
||||
# [Identity Group service](../../../lib/core/userinfo/services/identity-group.service.ts "Defined in identity-group.service.ts")
|
||||
# [Identity Group service](../../../lib/core/services/identity-group.service.ts "Defined in identity-group.service.ts")
|
||||
|
||||
Performs CRUD operations on identity groups.
|
||||
|
||||
@ -29,45 +29,45 @@ Performs CRUD operations on identity groups.
|
||||
- _groupId:_ `string` - Id of the target group
|
||||
- _roleNames:_ `string[]` - Array of role names
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>` - True if the group has one or more of the roles, false otherwise
|
||||
- **createGroup**(newGroup: [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **createGroup**(newGroup: [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Creates new group.
|
||||
- _newGroup:_ [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts) - Object of containing the new group details.
|
||||
- _newGroup:_ [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts) - Object of containing the new group details.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the group created.
|
||||
- **deleteGroup**(groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Deletes Group.
|
||||
- _groupId:_ `string` - Id of the group.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the group deleted.
|
||||
- **findGroupsByName**(searchParams: [`IdentityGroupSearchParam`](../../../lib/core/userinfo/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **findGroupsByName**(searchParams: [`IdentityGroupSearchParam`](../../../lib/core/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Finds groups filtered by name.
|
||||
- _searchParams:_ [`IdentityGroupSearchParam`](../../../lib/core/userinfo/models/identity-group.model.ts) - Object containing the name filter string
|
||||
- _searchParams:_ [`IdentityGroupSearchParam`](../../../lib/core/models/identity-group.model.ts) - Object containing the name filter string
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of group information
|
||||
- **getClientIdByApplicationName**(applicationName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string>`<br/>
|
||||
Gets the client Id using the app name.
|
||||
- _applicationName:_ `string` - Name of the app
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<string>` - client Id string
|
||||
- **getClientRoles**(groupId: `string`, clientId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **getClientRoles**(groupId: `string`, clientId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets client roles.
|
||||
- _groupId:_ `string` - Id of the target group
|
||||
- _clientId:_ `string` - Id of the client
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - List of roles
|
||||
- **getGroupRoles**(groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - List of roles
|
||||
- **getGroupRoles**(groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets details for a specified group.
|
||||
- _groupId:_ `string` - Id of the target group
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Group details
|
||||
- **getGroups**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - Group details
|
||||
- **getGroups**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`[]>`<br/>
|
||||
Gets all groups.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`[]>` - Array of group information objects
|
||||
- **getTotalGroupsCount**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupCountModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`[]>` - Array of group information objects
|
||||
- **getTotalGroupsCount**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupCountModel`](../../../lib/core/models/identity-group.model.ts)`>`<br/>
|
||||
Gets groups total count.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupCountModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`>` - Number of groups count.
|
||||
- **queryGroups**(requestQuery: [`IdentityGroupQueryCloudRequestModel`](../../../lib/core/userinfo/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupQueryResponse`](../../../lib/core/userinfo/models/identity-group.model.ts)`>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupCountModel`](../../../lib/core/models/identity-group.model.ts)`>` - Number of groups count.
|
||||
- **queryGroups**(requestQuery: [`IdentityGroupQueryCloudRequestModel`](../../../lib/core/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupQueryResponse`](../../../lib/core/models/identity-group.model.ts)`>`<br/>
|
||||
Queries groups.
|
||||
- _requestQuery:_ [`IdentityGroupQueryCloudRequestModel`](../../../lib/core/userinfo/models/identity-group.model.ts) -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupQueryResponse`](../../../lib/core/userinfo/models/identity-group.model.ts)`>` - Array of user information objects
|
||||
- **updateGroup**(groupId: `string`, updatedGroup: [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- _requestQuery:_ [`IdentityGroupQueryCloudRequestModel`](../../../lib/core/models/identity-group.model.ts) -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupQueryResponse`](../../../lib/core/models/identity-group.model.ts)`>` - Array of user information objects
|
||||
- **updateGroup**(groupId: `string`, updatedGroup: [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Updates group details.
|
||||
- _groupId:_ `string` - Id of the targeted group.
|
||||
- _updatedGroup:_ [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts) - Object of containing the group details
|
||||
- _updatedGroup:_ [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts) - Object of containing the group details
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the group updated.
|
||||
|
||||
## See also
|
||||
|
@ -5,6 +5,6 @@ Status: Active
|
||||
Last reviewed: 2019-09-24
|
||||
---
|
||||
|
||||
# [Identity role service](../../../lib/core/userinfo/services/identity-role.service.ts "Defined in identity-role.service.ts")
|
||||
# [Identity role service](../../../lib/core/services/identity-role.service.ts "Defined in identity-role.service.ts")
|
||||
|
||||
Provides APIs for working with the Roles in Identity Services.
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2019-07-12
|
||||
---
|
||||
|
||||
# [Identity user service](../../../lib/core/userinfo/services/identity-user.service.ts "Defined in identity-user.service.ts")
|
||||
# [Identity user service](../../../lib/core/services/identity-user.service.ts "Defined in identity-user.service.ts")
|
||||
|
||||
Gets OAuth2 personal details and roles for users and performs CRUD operations on identity users.
|
||||
|
||||
@ -13,15 +13,15 @@ Gets OAuth2 personal details and roles for users and performs CRUD operations on
|
||||
|
||||
### Methods
|
||||
|
||||
- **assignRoles**(userId: `string`, roles: [`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **assignRoles**(userId: `string`, roles: [`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Assigns roles to the user.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- _roles:_ [`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]` - Array of roles.
|
||||
- _roles:_ [`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]` - Array of roles.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the role assigned.
|
||||
- **changePassword**(userId: `string`, newPassword: [`IdentityUserPasswordModel`](../../../lib/core/userinfo/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **changePassword**(userId: `string`, newPassword: [`IdentityUserPasswordModel`](../../../lib/core/services/identity-user.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Changes user password.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- _newPassword:_ [`IdentityUserPasswordModel`](../../../lib/core/userinfo/models/identity-user.model.ts) -
|
||||
- _newPassword:_ [`IdentityUserPasswordModel`](../../../lib/core/services/identity-user.service.ts) -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the password changed.
|
||||
- **checkUserHasAnyApplicationRole**(userId: `string`, applicationName: `string`, roleNames: `string[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>`<br/>
|
||||
Checks if a user has any application role.
|
||||
@ -50,9 +50,9 @@ Gets OAuth2 personal details and roles for users and performs CRUD operations on
|
||||
- _userId:_ `string` - ID of the target user
|
||||
- _roleNames:_ `string[]` - Array of roles to check for
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<boolean>` - True if the user has one of the roles, false otherwise
|
||||
- **createUser**(newUser: [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **createUser**(newUser: [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Creates new user.
|
||||
- _newUser:_ [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts) - Object containing the new user details.
|
||||
- _newUser:_ [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts) - Object containing the new user details.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the user created.
|
||||
- **deleteUser**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Deletes User.
|
||||
@ -74,14 +74,14 @@ Gets OAuth2 personal details and roles for users and performs CRUD operations on
|
||||
Find users based on search input.
|
||||
- _search:_ `string` - Search query string
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of users
|
||||
- **getAssignedRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **getAssignedRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets assigned roles.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of assigned roles information objects
|
||||
- **getAvailableRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - Array of assigned roles information objects
|
||||
- **getAvailableRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets available roles
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of available roles information objects
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - Array of available roles information objects
|
||||
- **getClientIdByApplicationName**(applicationName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string>`<br/>
|
||||
Gets the client ID for an application.
|
||||
- _applicationName:_ `string` - Name of the application
|
||||
@ -91,57 +91,57 @@ Gets OAuth2 personal details and roles for users and performs CRUD operations on
|
||||
- _userId:_ `string` - ID of the target user
|
||||
- _clientId:_ `string` - ID of the client app
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any[]>` - List of client roles
|
||||
- **getCurrentUserInfo**(): [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)<br/>
|
||||
- **getCurrentUserInfo**(): [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)<br/>
|
||||
Gets the name and other basic details of the current user.
|
||||
- **Returns** [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts) - The user's details
|
||||
- **getEffectiveRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **Returns** [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts) - The user's details
|
||||
- **getEffectiveRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets effective roles.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of composite roles information objects
|
||||
- **getInvolvedGroups**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - Array of composite roles information objects
|
||||
- **getInvolvedGroups**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`[]>`<br/>
|
||||
Gets involved groups.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`[]>` - Array of involved groups information objects.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`[]>` - Array of involved groups information objects.
|
||||
- **getTotalUsersCount**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<number>`<br/>
|
||||
Gets users total count.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<number>` - Number of users count.
|
||||
- **getUserRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>`<br/>
|
||||
- **getUserRoles**(userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>`<br/>
|
||||
Gets a list of roles for a user.
|
||||
- _userId:_ `string` - ID of the user
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]>` - Array of role info objects
|
||||
- **getUsers**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]>` - Array of role info objects
|
||||
- **getUsers**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>`<br/>
|
||||
Gets details for all users.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **getUsersByRolesWithCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **getUsersByRolesWithCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>`<br/>
|
||||
Gets an array of users (including the current user) who have any of the roles in the supplied list.
|
||||
- _roleNames:_ `string[]` - List of role names to look for
|
||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **getUsersByRolesWithoutCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>`<br/>
|
||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **getUsersByRolesWithoutCurrentUser**(roleNames: `string[]`): [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>`<br/>
|
||||
Gets an array of users (not including the current user) who have any of the roles in the supplied list.
|
||||
- _roleNames:_ `string[]` - List of role names to look for
|
||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **joinGroup**(joinGroupRequest: [`IdentityJoinGroupRequestModel`](../../../lib/core/userinfo/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **Returns** [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]>` - Array of user info objects
|
||||
- **joinGroup**(joinGroupRequest: [`IdentityJoinGroupRequestModel`](../../../lib/core/services/identity-user.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Joins group.
|
||||
- _joinGroupRequest:_ [`IdentityJoinGroupRequestModel`](../../../lib/core/userinfo/models/identity-user.model.ts) - Details of join group request (IdentityJoinGroupRequestModel).
|
||||
- _joinGroupRequest:_ [`IdentityJoinGroupRequestModel`](../../../lib/core/services/identity-user.service.ts) - Details of join group request (IdentityJoinGroupRequestModel).
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the user joined the group.
|
||||
- **leaveGroup**(userId: `any`, groupId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Leaves group.
|
||||
- _userId:_ `any` - Id of the user.
|
||||
- _groupId:_ `string` - Id of the group.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the user left the group.
|
||||
- **queryUsers**(requestQuery: [`IdentityUserQueryCloudRequestModel`](../../../lib/core/userinfo/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserQueryResponse`](../../../lib/core/userinfo/models/identity-user.model.ts)`>`<br/>
|
||||
- **queryUsers**(requestQuery: [`IdentityUserQueryCloudRequestModel`](../../../lib/core/services/identity-user.service.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserQueryResponse`](../../../lib/core/services/identity-user.service.ts)`>`<br/>
|
||||
Gets details for all users.
|
||||
- _requestQuery:_ [`IdentityUserQueryCloudRequestModel`](../../../lib/core/userinfo/models/identity-user.model.ts) -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserQueryResponse`](../../../lib/core/userinfo/models/identity-user.model.ts)`>` - Array of user information objects.
|
||||
- **removeRoles**(userId: `string`, removedRoles: [`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- _requestQuery:_ [`IdentityUserQueryCloudRequestModel`](../../../lib/core/services/identity-user.service.ts) -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserQueryResponse`](../../../lib/core/services/identity-user.service.ts)`>` - Array of user information objects.
|
||||
- **removeRoles**(userId: `string`, removedRoles: [`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Removes assigned roles.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- _removedRoles:_ [`IdentityRoleModel`](../../../lib/core/userinfo/models/identity-role.model.ts)`[]` -
|
||||
- _removedRoles:_ [`IdentityRoleModel`](../../../lib/core/models/identity-role.model.ts)`[]` -
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the role removed.
|
||||
- **updateUser**(userId: `string`, updatedUser: [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
- **updateUser**(userId: `string`, updatedUser: [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||
Updates user details.
|
||||
- _userId:_ `string` - Id of the user.
|
||||
- _updatedUser:_ [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts) - Object containing the user details.
|
||||
- _updatedUser:_ [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts) - Object containing the user details.
|
||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Empty response when the user updated.
|
||||
|
||||
## See also
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2018-06-08
|
||||
---
|
||||
|
||||
# [Notification Service](../../../lib/core/services/notification.service.ts "Defined in notification.service.ts")
|
||||
# [Notification Service](../../../lib/core/notifications/services/notification.service.ts "Defined in notification.service.ts")
|
||||
|
||||
Shows a notification message with optional feedback.
|
||||
|
||||
@ -17,33 +17,36 @@ Shows a notification message with optional feedback.
|
||||
|
||||
- **dismissSnackMessageAction**()<br/>
|
||||
dismiss the notification snackbar
|
||||
- **openSnackMessage**(message: `string`, config?: `number|MatSnackBarConfig`, translationArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
- **openSnackMessage**(message: `string`, config?: `number|MatSnackBarConfig`, interpolateArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Opens a SnackBar notification to show a message.
|
||||
- _message:_ `string` - The message (or resource key) to show.
|
||||
- _config:_ `number|MatSnackBarConfig` - (Optional) Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
- _translationArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- _interpolateArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
- **openSnackMessageAction**(message: `string`, action: `string`, config?: `number|MatSnackBarConfig`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
- **openSnackMessageAction**(message: `string`, action: `string`, config?: `number|MatSnackBarConfig`, interpolateArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Opens a SnackBar notification with a message and a response button.
|
||||
- _message:_ `string` - The message (or resource key) to show.
|
||||
- _action:_ `string` - Caption for the response button
|
||||
- _config:_ `number|MatSnackBarConfig` - (Optional) Time before notification disappears after being shown or MatSnackBarConfig object
|
||||
- _interpolateArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` - Information/control object for the SnackBar
|
||||
- **showError**(message: `string`, action?: `string`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
- **showError**(message: `string`, action?: `string`, interpolateArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Rase error message
|
||||
- _message:_ `string` - Text message or translation key for the message.
|
||||
- _action:_ `string` - (Optional) Action name
|
||||
- _interpolateArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` -
|
||||
- **showInfo**(message: `string`, action?: `string`, interpolateArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Rase info message
|
||||
- _message:_ `string` - Text message or translation key for the message.
|
||||
- _action:_ `string` - (Optional) Action name
|
||||
- _interpolateArgs:_ `any` - (Optional)
|
||||
- _interpolateArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` -
|
||||
- **showWarning**(message: `string`, action?: `string`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
- **showWarning**(message: `string`, action?: `string`, interpolateArgs?: `any`): [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>`<br/>
|
||||
Rase warning message
|
||||
- _message:_ `string` - Text message or translation key for the message.
|
||||
- _action:_ `string` - (Optional) Action name
|
||||
- _interpolateArgs:_ `any` - (Optional) The interpolation parameters to add for the translation
|
||||
- **Returns** [`MatSnackBarRef`](https://material.angular.io/components/snack-bar/overview)`<any>` -
|
||||
|
||||
## Details
|
||||
|
BIN
docs/docassets/images/custom-data-table-resolver.png
Normal file
BIN
docs/docassets/images/custom-data-table-resolver.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Analytics Generator Component](../../../lib/insights/analytics-process/components/analytics-generator.component.ts "Defined in analytics-generator.component.ts")
|
||||
# [Analytics Generator Component](../../../lib/insights/src/lib/analytics-process/components/analytics-generator.component.ts "Defined in analytics-generator.component.ts")
|
||||
|
||||
Generates and shows charts
|
||||
|
||||
@ -24,7 +24,7 @@ Generates and shows charts
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| reportId | `number` | | |
|
||||
| reportParamQuery | [`ReportQuery`](../../../lib/insights/diagram/models/report/reportQuery.model.ts) | undefined | |
|
||||
| reportParamQuery | [`ReportQuery`](../../../lib/insights/src/lib/diagram/models/report/reportQuery.model.ts) | undefined | |
|
||||
|
||||
### Events
|
||||
|
||||
|
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [APS Analytics List Component](../../../lib/insights/analytics-process/components/analytics-report-list.component.ts "Defined in analytics-report-list.component.ts")
|
||||
# [APS Analytics List Component](../../../lib/insights/src/lib/analytics-process/components/analytics-report-list.component.ts "Defined in analytics-report-list.component.ts")
|
||||
|
||||
Shows a list of all available reports
|
||||
|
||||
@ -31,5 +31,5 @@ Shows a list of all available reports
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | |
|
||||
| reportClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ReportParametersModel`](../../../lib/insights/diagram/models/report/reportParameters.model.ts)`>` | |
|
||||
| reportClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ReportParametersModel`](../../../lib/insights/src/lib/diagram/models/report/reportParameters.model.ts)`>` | |
|
||||
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<>` | |
|
||||
|
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [APS Analytics Component](../../../lib/insights/analytics-process/components/analytics.component.ts "Defined in analytics.component.ts")
|
||||
# [APS Analytics Component](../../../lib/insights/src/lib/analytics-process/components/analytics.component.ts "Defined in analytics.component.ts")
|
||||
|
||||
Shows the charts related to the reportId passed as input
|
||||
|
||||
|
@ -4,7 +4,7 @@ Added: v2.0.0
|
||||
Status: Active
|
||||
---
|
||||
|
||||
# [Diagram Component](../../../lib/insights/diagram/components/diagram.component.ts "Defined in diagram.component.ts")
|
||||
# [Diagram Component](../../../lib/insights/src/lib/diagram/components/diagram.component.ts "Defined in diagram.component.ts")
|
||||
|
||||
Displays process diagrams.
|
||||
|
||||
|
@ -5,7 +5,7 @@ Status: Active
|
||||
Last reviewed: 2018-03-29
|
||||
---
|
||||
|
||||
# [Widget component](../../../lib/insights/analytics-process/components/widgets/widget.component.ts "Defined in widget.component.ts")
|
||||
# [Widget component](../../../lib/insights/src/lib/analytics-process/components/widgets/widget.component.ts "Defined in widget.component.ts")
|
||||
|
||||
Base class for standard and custom widget classes.
|
||||
|
||||
|
@ -28,7 +28,7 @@ Searches Groups.
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| appName | `string` | | Name of the application. If specified this shows the users who have access to the app. |
|
||||
| mode | `string` | | User selection mode (single/multiple). |
|
||||
| preSelectGroups | [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`[]` | \[] | Array of users to be pre-selected. This pre-selects all users in multi selection mode and only the first user of the array in single selection mode. |
|
||||
| preSelectGroups | [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`[]` | \[] | Array of users to be pre-selected. This pre-selects all users in multi selection mode and only the first user of the array in single selection mode. |
|
||||
| roles | `string[]` | \[] | Role names of the groups to be listed. |
|
||||
| searchGroupsControl | `FormControl` | new FormControl() | FormControl to search the group |
|
||||
| title | `string` | | Title of the field |
|
||||
@ -37,8 +37,8 @@ Searches Groups.
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| removeGroup | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`>` | Emitted when a group is removed. |
|
||||
| selectGroup | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)`>` | Emitted when a group is selected. |
|
||||
| removeGroup | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`>` | Emitted when a group is removed. |
|
||||
| selectGroup | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)`>` | Emitted when a group is selected. |
|
||||
|
||||
## Details
|
||||
|
||||
|
@ -26,7 +26,7 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| appName | `string` | | Name of the application. If specified, this shows the users who have access to the app. |
|
||||
| mode | `string` | | User selection mode (single/multiple). |
|
||||
| preSelectUsers | [`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. Mandatory properties are: id, email, username |
|
||||
| preSelectUsers | [`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`[]` | | Array of users to be pre-selected. All users in the array are pre-selected in multi selection mode, but only the first user is pre-selected in single selection mode. Mandatory properties are: id, email, username |
|
||||
| roles | `string[]` | | Role names of the users to be listed. |
|
||||
| searchUserCtrl | `FormControl` | new FormControl() | FormControl to search the user |
|
||||
| title | `string` | | Placeholder translation key |
|
||||
@ -36,6 +36,6 @@ Allows one or more users to be selected (with auto-suggestion) based on the inpu
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| removeUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`>` | Emitted when a selected user is removed in multi selection mode. |
|
||||
| selectUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../../lib/core/userinfo/models/identity-user.model.ts)`>` | Emitted when a user is selected. |
|
||||
| removeUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`>` | Emitted when a selected user is removed in multi selection mode. |
|
||||
| selectUser | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`IdentityUserModel`](../../../lib/core/models/identity-user.model.ts)`>` | Emitted when a user is selected. |
|
||||
| warning | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an warning occurs. |
|
||||
|
@ -23,7 +23,7 @@ Extracts the initial character from a group name.
|
||||
|
||||
## Details
|
||||
|
||||
This pipe takes a [`IdentityGroupModel`](../../../lib/core/userinfo/models/identity-group.model.ts)
|
||||
This pipe takes a [`IdentityGroupModel`](../../../lib/core/models/identity-group.model.ts)
|
||||
object as its parameter and extracts the initial character from the `name`
|
||||
property. The initial is a handy way to identify the group in lists and
|
||||
other situations where there is limited screen space available.
|
||||
|
@ -58,6 +58,7 @@ when the process list is empty:
|
||||
| presetColumn | `string` | | Custom preset column schema in JSON format. |
|
||||
| processDefinitionId | `string` | | The Definition Id of the process. |
|
||||
| processInstanceId | `number \| string` | | The id of the process instance. |
|
||||
| resolverFn | `Function` | | Resolver function is used to show dynamic complex column objects see the [docs](../../core/interfaces/datatable-adapter.interface.md) to learn how to configure a resolverFn. |
|
||||
| selectFirstRow | `boolean` | true | Toggles default selection of the first row |
|
||||
| selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. |
|
||||
| size | `number` | | The number of processes to fetch in each page. |
|
||||
|
@ -77,6 +77,10 @@ export class DataTableCellComponent implements OnInit, OnDestroy {
|
||||
@Input()
|
||||
tooltip: string;
|
||||
|
||||
/** Custom resolver function which is used to parse dynamic column objects */
|
||||
@Input()
|
||||
resolverFn: (row: DataRow, col: DataColumn) => any = null;
|
||||
|
||||
protected onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(protected alfrescoApiService: AlfrescoApiService) {}
|
||||
@ -98,7 +102,7 @@ export class DataTableCellComponent implements OnInit, OnDestroy {
|
||||
|
||||
protected updateValue() {
|
||||
if (this.column && this.column.key && this.row && this.data) {
|
||||
const value = this.data.getValue(this.row, this.column);
|
||||
const value = this.data.getValue(this.row, this.column, this.resolverFn);
|
||||
|
||||
this.value$.next(value);
|
||||
|
||||
|
@ -141,6 +141,7 @@
|
||||
[data]="data"
|
||||
[column]="col"
|
||||
[row]="row"
|
||||
[resolverFn]="resolverFn"
|
||||
[tooltip]="getCellTooltip(row, col)">
|
||||
</adf-date-cell>
|
||||
</div>
|
||||
@ -150,6 +151,7 @@
|
||||
[data]="data"
|
||||
[column]="col"
|
||||
[row]="row"
|
||||
[resolverFn]="resolverFn"
|
||||
[tooltip]="getCellTooltip(row, col)">
|
||||
</adf-location-cell>
|
||||
</div>
|
||||
@ -159,6 +161,7 @@
|
||||
[data]="data"
|
||||
[column]="col"
|
||||
[row]="row"
|
||||
[resolverFn]="resolverFn"
|
||||
[tooltip]="getCellTooltip(row, col)">
|
||||
</adf-filesize-cell>
|
||||
</div>
|
||||
@ -169,6 +172,7 @@
|
||||
[data]="data"
|
||||
[column]="col"
|
||||
[row]="row"
|
||||
[resolverFn]="resolverFn"
|
||||
[tooltip]="getCellTooltip(row, col)">
|
||||
</adf-datatable-cell>
|
||||
</div>
|
||||
@ -177,6 +181,7 @@
|
||||
[editable]="col.editable"
|
||||
[data]="data"
|
||||
[column]="col"
|
||||
[resolverFn]="resolverFn"
|
||||
[row]="row">
|
||||
</adf-json-cell>
|
||||
</div>
|
||||
@ -189,7 +194,7 @@
|
||||
<div class="adf-cell-value" tabindex="0">
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="col.template"
|
||||
[ngTemplateOutletContext]="{ $implicit: { data: data, row: row, col: col }, value: data.getValue(row, col) }">
|
||||
[ngTemplateOutletContext]="{ $implicit: { data: data, row: row, col: col }, value: data.getValue(row, col, resolverFn) }">
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -161,6 +161,13 @@ export class DataTableComponent implements AfterContentInit, OnChanges, DoCheck,
|
||||
@Input()
|
||||
rowMenuCacheEnabled = true;
|
||||
|
||||
/**
|
||||
* Custom resolver function which is used to parse dynamic column objects
|
||||
* see the docs to learn how to configure a resolverFn.
|
||||
*/
|
||||
@Input()
|
||||
resolverFn: (row: DataRow, col: DataColumn) => any = null;
|
||||
|
||||
noContentTemplate: TemplateRef<any>;
|
||||
noPermissionTemplate: TemplateRef<any>;
|
||||
loadingTemplate: TemplateRef<any>;
|
||||
|
@ -52,12 +52,12 @@ export class JsonCellComponent extends DataTableCellComponent implements OnInit
|
||||
|
||||
ngOnInit() {
|
||||
if (this.column && this.column.key && this.row && this.data) {
|
||||
this.value$.next(this.data.getValue(this.row, this.column));
|
||||
this.value$.next(this.data.getValue(this.row, this.column, this.resolverFn));
|
||||
}
|
||||
}
|
||||
|
||||
view() {
|
||||
const rawValue: string | object = this.data.getValue(this.row, this.column);
|
||||
const rawValue: string | object = this.data.getValue(this.row, this.column, this.resolverFn);
|
||||
const value = typeof rawValue === 'object'
|
||||
? JSON.stringify(rawValue || {}, null, 2)
|
||||
: rawValue;
|
||||
|
@ -52,7 +52,8 @@ export class LocationCellComponent extends DataTableCellComponent implements OnI
|
||||
if (this.column && this.column.key && this.row && this.data) {
|
||||
const path: PathInfoEntity = this.data.getValue(
|
||||
this.row,
|
||||
this.column
|
||||
this.column,
|
||||
this.resolverFn
|
||||
);
|
||||
|
||||
if (path && path.name && path.elements) {
|
||||
|
@ -28,7 +28,7 @@ export interface DataTableAdapter {
|
||||
setRows(rows: Array<DataRow>): void;
|
||||
getColumns(): Array<DataColumn>;
|
||||
setColumns(columns: Array<DataColumn>): void;
|
||||
getValue(row: DataRow, col: DataColumn): any;
|
||||
getValue(row: DataRow, col: DataColumn, resolverFn?: (row: DataRow, col: DataColumn) => any): any;
|
||||
getSorting(): DataSorting;
|
||||
setSorting(sorting: DataSorting): void;
|
||||
sort(key?: string, direction?: string): void;
|
||||
|
@ -99,7 +99,7 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||
this._columns = columns || [];
|
||||
}
|
||||
|
||||
getValue(row: DataRow, col: DataColumn): any {
|
||||
getValue(row: DataRow, col: DataColumn, resolver?: (row: DataRow, col: DataColumn) => any ): any {
|
||||
if (!row) {
|
||||
throw new Error('Row not found');
|
||||
}
|
||||
@ -107,6 +107,10 @@ export class ObjectDataTableAdapter implements DataTableAdapter {
|
||||
throw new Error('Column not found');
|
||||
}
|
||||
|
||||
if (resolver) {
|
||||
return resolver(row, col);
|
||||
}
|
||||
|
||||
const value = row.getValue(col.key);
|
||||
|
||||
if (col.type === 'icon') {
|
||||
|
@ -45,7 +45,12 @@ export let fakeProcessInstance = {
|
||||
graphicalNotationDefined: true,
|
||||
startFormDefined: false,
|
||||
suspended: false,
|
||||
variables: []
|
||||
variables: [
|
||||
{
|
||||
name: 'initiator',
|
||||
value: 'fake-user-1'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
@ -70,7 +75,12 @@ export let fakeProcessInstance = {
|
||||
graphicalNotationDefined: true,
|
||||
startFormDefined: false,
|
||||
suspended: false,
|
||||
variables: []
|
||||
variables: [
|
||||
{
|
||||
name: 'initiator',
|
||||
value: 'fake-user-2'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
@ -6,6 +6,7 @@
|
||||
[loading]="isLoading"
|
||||
[selectionMode]="selectionMode"
|
||||
[multiselect]="multiselect"
|
||||
[resolverFn]="resolverFn"
|
||||
(rowClick)="onRowClick($event)"
|
||||
(row-keyup)="onRowKeyUp($event)">
|
||||
<adf-loading-content-template>
|
||||
|
@ -22,7 +22,7 @@ import { By } from '@angular/platform-browser';
|
||||
|
||||
import { ProcessInstanceListComponent } from './process-list.component';
|
||||
|
||||
import { AppConfigService, setupTestBed, CoreModule, DataTableModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService, setupTestBed, CoreModule, DataTableModule, DataRow, DataColumn } from '@alfresco/adf-core';
|
||||
import { DataRowEvent, ObjectDataRow, ObjectDataTableAdapter } from '@alfresco/adf-core';
|
||||
|
||||
import { fakeProcessInstance, fakeProcessInstancesWithNoName, fakeProcessInstancesEmpty } from '../../mock';
|
||||
@ -38,6 +38,13 @@ describe('ProcessInstanceListComponent', () => {
|
||||
let service: ProcessService;
|
||||
let getProcessInstancesSpy: jasmine.Spy;
|
||||
let appConfig: AppConfigService;
|
||||
const resolverfn = (row: DataRow, col: DataColumn) => {
|
||||
const value = row.getValue(col.key);
|
||||
if (col.key === 'variables') {
|
||||
return (value || []).map((processVar) => `${processVar.name} - ${processVar.value}`).toString();
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
@ -271,6 +278,30 @@ describe('ProcessInstanceListComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should show custom resolved value in the column', async(() => {
|
||||
appConfig.config['adf-process-list'] = {
|
||||
'presets': {
|
||||
'fakeProcessCustomSchema': [
|
||||
{
|
||||
'key': 'variables',
|
||||
'type': 'text',
|
||||
'title': 'Variables'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
component.presetColumn = 'fakeProcessCustomSchema';
|
||||
component.resolverFn = resolverfn;
|
||||
component.reload();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
const customColumn = fixture.debugElement.queryAll(By.css('[title="Variables"] adf-datatable-cell'));
|
||||
expect(customColumn[0].nativeElement.innerText).toEqual('initiator - fake-user-1');
|
||||
expect(customColumn[1].nativeElement.innerText).toEqual('initiator - fake-user-2');
|
||||
});
|
||||
}));
|
||||
|
||||
describe('component changes', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -20,7 +20,9 @@ import {
|
||||
DataRowEvent,
|
||||
DataTableAdapter,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
CustomLoadingContentTemplateDirective
|
||||
CustomLoadingContentTemplateDirective,
|
||||
DataRow,
|
||||
DataColumn
|
||||
} from '@alfresco/adf-core';
|
||||
import {
|
||||
AppConfigService,
|
||||
@ -112,6 +114,13 @@ export class ProcessInstanceListComponent extends DataTableSchema implements On
|
||||
@Input()
|
||||
selectFirstRow: boolean = true;
|
||||
|
||||
/**
|
||||
* Resolver function is used to show dynamic complex column objects
|
||||
* see the docs to learn how to configure a resolverFn.
|
||||
*/
|
||||
@Input()
|
||||
resolverFn: (row: DataRow, col: DataColumn) => any = null;
|
||||
|
||||
/** Emitted when a row in the process list is clicked. */
|
||||
@Output()
|
||||
rowClick: EventEmitter<string> = new EventEmitter<string>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user