mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2451] Reviewed component docs (#3108)
* [ADF-2451] Reviewed component docs * [ADF-2451] Reviewed component docs * [ADF-2451] Renamed node share directive doc fileand rebuilt index
This commit is contained in:
committed by
Eugenio Romano
parent
e8e2af7d6b
commit
36625c1af6
@@ -1,62 +1,44 @@
|
||||
---
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2018-03-21
|
||||
---
|
||||
|
||||
# Process Filter Service
|
||||
|
||||
Manage Process Filters, which are pre-configured Process Instance queries.
|
||||
|
||||
## Importing
|
||||
|
||||
```ts
|
||||
import { ProcessFilterService, FilterProcessRepresentationModel } from '@alfresco/adf-process-services';
|
||||
|
||||
export class SomePageComponent implements OnInit {
|
||||
|
||||
constructor(private processFilterService: ProcessFilterService) {
|
||||
}
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
#### createDefaultFilters(appId: number): Observable`<any[]>`
|
||||
- `getProcessFilters(appId: number): Observable<FilterProcessRepresentationModel[]>`
|
||||
Gets all filters defined for a Process App.
|
||||
- `appId` - ID of the target app
|
||||
- `getProcessFilterById(filterId: number, appId?: number): Observable<FilterProcessRepresentationModel>`
|
||||
Retrieves the process filter by ID.
|
||||
- `filterId` - ID of the filter
|
||||
- `appId` - (Optional) ID of the target app
|
||||
- `getProcessFilterByName(filterName: string, appId?: number): Observable<FilterProcessRepresentationModel>`
|
||||
Retrieves the process filter by name.
|
||||
- `filterName` - Name of the filter
|
||||
- `appId` - (Optional) ID of the target app
|
||||
- `createDefaultFilters(appId: number): Observable<FilterProcessRepresentationModel[]>`
|
||||
Creates and returns the default filters for an app.
|
||||
- `appId` - ID of the target app
|
||||
- `getRunningFilterInstance(appId: number): FilterProcessRepresentationModel`
|
||||
Creates and returns a filter that matches "running" process instances.
|
||||
- `appId` - ID of the target app
|
||||
- `addProcessFilter(filter: FilterProcessRepresentationModel): Observable<FilterProcessRepresentationModel>`
|
||||
Adds a filter.
|
||||
- `filter` - The filter to add
|
||||
- `callApiProcessFilters(appId?: number): any`
|
||||
Calls `getUserProcessInstanceFilters` from the Alfresco JS API.
|
||||
- `appId` - (Optional) ID of the target app
|
||||
|
||||
Create and return the default filters for a Process App:
|
||||
## Details
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
this.processFilterService.createDefaultFilters(processAppId)
|
||||
.subscribe( filters => {
|
||||
console.log('filters: ', filters);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is an array of `FilterProcessRepresentationModel` objects:
|
||||
|
||||
filters:
|
||||
0: {
|
||||
appId: 2
|
||||
filter:
|
||||
name: ""
|
||||
sort: "created-desc"
|
||||
state: "running"
|
||||
icon: "glyphicon-random"
|
||||
id: null
|
||||
index: undefined
|
||||
name: "Running"
|
||||
recent: true
|
||||
}
|
||||
1: {id: null, appId: 2, name: "Completed", recent: false, icon: "glyphicon-ok-sign", …}
|
||||
2: {id: null, appId: 2, name: "All", recent: true, icon: "glyphicon-th", …}
|
||||
|
||||
These filters can now be used to get matching process instances for Process App with ID 2,
|
||||
such as 'Running', 'Completed', and 'All' .
|
||||
|
||||
#### getProcessFilters(appId: number): Observable`<FilterProcessRepresentationModel[]>`
|
||||
|
||||
Get all filters defined for a Process App:
|
||||
The methods of this service generally return an instance of
|
||||
`FilterProcessRepresentationModel` or an array of instances. For example, you
|
||||
could use `getProcessFilters` as follows:
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
@@ -70,133 +52,19 @@ this.processFilterService.getProcessFilters(processAppId)
|
||||
|
||||
The response is an array of `FilterProcessRepresentationModel` objects:
|
||||
|
||||
filters:
|
||||
0: {id: 15, appId: 2, name: "Running", recent: true, icon: "glyphicon-random", …}
|
||||
1: {id: 14, appId: 2, name: "Completed", recent: false, icon: "glyphicon-ok-sign", …}
|
||||
2: {id: 13, appId: 2, name: "All", recent: false, icon: "glyphicon-th", …}
|
||||
3: {id: 3003, appId: 2, name: "Running", recent: false, icon: "glyphicon-random", …}
|
||||
4: {id: 3004, appId: 2, name: "Completed", recent: false, icon: "glyphicon-ok-sign", …}
|
||||
5: {id: 3005, appId: 2, name: "All", recent: false, icon: "glyphicon-th", …}
|
||||
|
||||
filters:
|
||||
0: {id: 15, appId: 2, name: "Running", recent: true, icon: "glyphicon-random", …}
|
||||
1: {id: 14, appId: 2, name: "Completed", recent: false, icon: "glyphicon-ok-sign", …}
|
||||
2: {id: 13, appId: 2, name: "All", recent: false, icon: "glyphicon-th", …}
|
||||
3: {id: 3003, appId: 2, name: "Running", recent: false, icon: "glyphicon-random", …}
|
||||
4: {id: 3004, appId: 2, name: "Completed", recent: false, icon: "glyphicon-ok-sign", …}
|
||||
5: {id: 3005, appId: 2, name: "All", recent: false, icon: "glyphicon-th", …}
|
||||
|
||||
In this example I had run the `createDefaultFilters` method ones and that created the duplicate of
|
||||
the default filters.
|
||||
You can use the returned filters to get matching process instances for the process app with ID 2,
|
||||
such as 'Running', 'Completed', 'All', etc.
|
||||
|
||||
These filters can now be used to get matching process instances for Process App with ID 2,
|
||||
such as 'Running', 'Completed', and 'All' .
|
||||
|
||||
#### getProcessFilterById(filterId: number, appId?: number): Observable`<FilterProcessRepresentationModel>`
|
||||
## See also
|
||||
|
||||
Get a specific Process Filter based on its ID, optionally pass in Process App ID to improve performance
|
||||
when searching for filter:
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
const filterId = 3003;
|
||||
this.processFilterService.getProcessFilterById(filterId, processAppId)
|
||||
.subscribe( (filter: FilterProcessRepresentationModel) => {
|
||||
console.log('filter: ', filter);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is a `FilterProcessRepresentationModel` object:
|
||||
|
||||
appId: 2
|
||||
filter: {sort: "created-desc", name: "", state: "running"}
|
||||
icon: "glyphicon-random"
|
||||
id: 3003
|
||||
name: "Running"
|
||||
recent: false
|
||||
|
||||
The filter can now be used to get 'Running' process instances for Process App with ID 2.
|
||||
|
||||
#### getProcessFilterByName(filterName: string, appId?: number): Observable`<FilterProcessRepresentationModel>`
|
||||
|
||||
Get a specific Process Filter based on its name, optionally pass in Process App ID to improve performance
|
||||
when searching for filter:
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
const filterName = 'Running';
|
||||
this.processFilterService.getProcessFilterByName(filterName, processAppId)
|
||||
.subscribe( (filter: FilterProcessRepresentationModel) => {
|
||||
console.log('filter: ', filter);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is a `FilterProcessRepresentationModel` object:
|
||||
|
||||
appId: 2
|
||||
filter: {sort: "created-desc", name: "", state: "running"}
|
||||
icon: "glyphicon-random"
|
||||
id: 15
|
||||
name: "Running"
|
||||
recent: true
|
||||
|
||||
If there are several filters with the same name for the Process App, then you get back the
|
||||
first one found matching the name.
|
||||
|
||||
The filter can now be used to get 'Running' process instances for Process App with ID 2.
|
||||
|
||||
#### addProcessFilter(filter: FilterProcessRepresentationModel): Observable`<FilterProcessRepresentationModel>`
|
||||
|
||||
Add a new Process Instance filter:
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
const filterName = 'RunningAsc';
|
||||
const filterRunningAsc = new FilterProcessRepresentationModel({
|
||||
'name': filterName,
|
||||
'appId': processAppId,
|
||||
'recent': true,
|
||||
'icon': 'glyphicon-random',
|
||||
'filter': { 'sort': 'created-asc', 'name': 'runningasc', 'state': 'running' }
|
||||
});
|
||||
this.processFilterService.addProcessFilter(filterRunningAsc)
|
||||
.subscribe( (filterResponse: FilterProcessRepresentationModel) => {
|
||||
console.log('filterResponse: ', filterResponse);
|
||||
}, error => {
|
||||
console.log('Error: ', error);
|
||||
});
|
||||
```
|
||||
|
||||
The response is a `FilterProcessRepresentationModel` object:
|
||||
|
||||
appId: 2
|
||||
icon: "glyphicon-random"
|
||||
id: 3008
|
||||
name: "RunningAsc"
|
||||
recent: false
|
||||
|
||||
The filter can now be used to get 'Running' process instances for
|
||||
Process App with ID 2 in created date ascending order.
|
||||
|
||||
See also the `getRunningFilterInstance` method.
|
||||
|
||||
#### getRunningFilterInstance(appId: number): FilterProcessRepresentationModel
|
||||
|
||||
Convenience method to create and return a filter that matches `running` process instances
|
||||
for passed in Process App ID:
|
||||
|
||||
```ts
|
||||
const processAppId = 2;
|
||||
const runningFilter: FilterProcessRepresentationModel = this.processFilterService.getRunningFilterInstance(processAppId);
|
||||
console.log('Running filter', runningFilter);
|
||||
```
|
||||
|
||||
The response is a `FilterProcessRepresentationModel` object:
|
||||
|
||||
appId: 2
|
||||
filter: {sort: "created-desc", name: "", state: "running"}
|
||||
icon: "glyphicon-random"
|
||||
id: null
|
||||
index: undefined
|
||||
name: "Running"
|
||||
recent: true
|
||||
|
||||
The filter can now be used to get 'Running' process instances for
|
||||
Process App with ID 2 in created date ascending order.
|
||||
- [Process Filters component](process-filters.component.md)
|
||||
- [Task Filter service](task-filter.service.md)
|
||||
|
Reference in New Issue
Block a user