[ADF-4793] The filters don't work on community-edition [ Use local storage for community version ] (#4973)

* * Use local storage for community version.

* * Created a communityModule.

* * Updated unit tests the recent changes

* * Updated documents.

* * Modified process/task filters doc.
This commit is contained in:
siva kumar
2019-08-07 04:07:32 +05:30
committed by Eugenio Romano
parent 964e89f6ef
commit 0bca6607a9
33 changed files with 759 additions and 114 deletions

View File

@@ -0,0 +1,51 @@
---
Title: Local Preference Cloud Service
Added: v3.4.0
Status: Experimental
Last reviewed: 2019-08-06
---
# [Local Preference Cloud Service](../../../lib/process-services-cloud/src/lib/services/local-preference-cloud.service.ts "Defined in local-preference-cloud.service.ts")
Manages Local Storage preferences.
## Class members
### Methods
- **createPreference**(appName: `string`, key: `string`, newPreference: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Creates local preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- _newPreference:_ `any` -
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of created local preferences
- **deletePreference**(key: `string`, preferences: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Deletes local preference by given preference key.
- _key:_ `string` - Key of the target preference
- _preferences:_ `any` - Details of updated preferences
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of preferences without deleted preference
- **getPreferenceByKey**(appName: `string`, key: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Gets local preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of local preference
- **getPreferences**(appName: `string`, key: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Gets local preferences
- _appName:_ `string` - Name of the target app
- _key:_ `string` - (Optional) (Optional) (Optional) (Optional)
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of local preferences
- **prepareLocalPreferenceResponse**(key: `string`): `any`<br/>
- _key:_ `string` -
- **Returns** `any` -
- **updatePreference**(appName: `string`, key: `string`, updatedPreference: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Updates local preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- _updatedPreference:_ `any` - Details of updated preference
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of updated local preferences
## See also
- [User preference Cloud Service](user-preference-cloud.service.md)

View File

@@ -35,13 +35,47 @@ Manage Process Filters, which are pre-configured Process Instance queries.
- _updatedFilter:_ [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts) -
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`[]>` - Observable of process instance filters with updated filter
## Details
## Inject Preference service
The methods of this service generally return an instance of
[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts) or an array of instances.
Token: [`PROCESS_FILTERS_SERVICE_TOKEN`](../../../lib/process-services-cloud/src/lib/services/cloud-token.service.ts)
A DI token that maps to the dependency to be injected.
You can use the returned filters to get matching process instances for the process app,
such as 'Running', 'Completed', 'All', etc.
[Process Filter Cloud Service](../../../lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.ts "Defined in process-filter-cloud.service.ts")
is by default injected with the [Local Preference Cloud Service](../../process-services-cloud/services/local-preference-cloud.service.md)
```ts
import { NgModule } from '@angular/core';
import { LocalPreferenceCloudService, PROCESS_FILTERS_SERVICE_TOKEN } from '@alfresco/adf-process-services-cloud';
@NgModule({
imports: [
...Import Required Modules
],
providers: [
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
]
})
export class ExampleModule {}
```
If you would like to inject the [User Preference Cloud Service](../../process-services-cloud/services/user-preference-cloud.service.md), you can inject the service like below shown
```ts
import { NgModule } from '@angular/core';
import { UserPreferenceCloudService, PROCESS_FILTERS_SERVICE_TOKEN } from '@alfresco/adf-process-services-cloud';
@NgModule({
imports: [
...Import Required Modules
],
providers: [
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
]
})
export class ExampleModule {}
```
## See also

View File

@@ -7,7 +7,7 @@ Last reviewed: 2019-01-09
# [Task Filter Cloud Service](../../../lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts "Defined in task-filter-cloud.service.ts")
Manages task filters.
Manages task filters.
## Class members
@@ -53,6 +53,48 @@ this.taskFilterService.getTaskListFilters(appName).subscribe( (filters: TaskFilt
These filters can now be used to get matching task instances for the process app.
## Inject Preference service
Token: [`TASK_FILTERS_SERVICE_TOKEN`](../../../lib/process-services-cloud/src/lib/services/cloud-token.service.ts)
A DI token that maps to the dependency to be injected.
[Task Filter Cloud Service](../../../lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.ts "Defined in task-filter-cloud.service.ts")
is by default injected with the [Local Preference Cloud Service](../../process-services-cloud/services/local-preference-cloud.service.md)
```ts
import { NgModule } from '@angular/core';
import { LocalPreferenceCloudService, TASK_FILTERS_SERVICE_TOKEN } from '@alfresco/adf-process-services-cloud';
@NgModule({
imports: [
...Import Required Modules
],
providers: [
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
]
})
export class ExampleModule {}
```
If you would like to inject the [UserPreferenceCloudService](../../process-services-cloud/services/user-preference-cloud.service.md), you can inject the service like below shown
```ts
import { NgModule } from '@angular/core';
import { UserPreferenceCloudService, TASK_FILTERS_SERVICE_TOKEN } from '@alfresco/adf-process-services-cloud';
@NgModule({
imports: [
...Import Required Modules
],
providers: [
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
]
})
export class ExampleModule {}
```
## See also
- [Task filter service](../../process-services/services/task-filter.service.md)

View File

@@ -0,0 +1,50 @@
---
Title: User Preference Cloud Service
Added: v3.4.0
Status: Experimental
Last reviewed: 2019-08-06
---
# [User Preference Cloud Service](../../../lib/process-services-cloud/src/lib/services/user-preference-cloud.service.ts "Defined in user-preference-cloud.service.ts")
Manages user preferences.
## Class members
### Methods
- **createPreference**(appName: `string`, key: `string`, newPreference: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Creates user preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- _newPreference:_ `any` -
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of created user preferences
- **deletePreference**(appName: `string`, key: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Deletes user preference by given preference key.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of delete operation status
- **getBasePath**(appName: `string`): `string`<br/>
- _appName:_ `string` -
- **Returns** `string` -
- **getPreferenceByKey**(appName: `string`, key: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Gets user preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of user preference
- **getPreferences**(appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Gets user preferences
- _appName:_ `string` - Name of the target app
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - List of user preferences
- **updatePreference**(appName: `string`, key: `string`, updatedPreference: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
Updates user preference.
- _appName:_ `string` - Name of the target app
- _key:_ `string` - Key of the target preference
- _updatedPreference:_ `any` - Details of updated preference
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Observable of updated user preferences
## See also
- [Local preference Cloud Service](local-preference-cloud.service.md)