Skip to content

Commit

Permalink
[ACA-3416] Add Claim/Release actions on adf task form (#5753)
Browse files Browse the repository at this point in the history
* [ACA-3255] FE - Claim a task

* * Added unit tests

* * Added unit tests
* Changed cloud directive names

* * Added/Updated documents

* * Added showReleaseClaim button flag
* Add unit test too

* * Used claim/release directive in task-header component.

* * Fixed unit test

* * Fixed one comment

* * After rebase

* * Fixed comments
  • Loading branch information
sivakumar414ram committed Jun 10, 2020
1 parent 77bbece commit ea62b1e
Show file tree
Hide file tree
Showing 32 changed files with 946 additions and 104 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
Title: Claim Task Directive
Added: v3.1.0
Title: Claim Task Cloud Directive
Added: v3.9.0
Status: Experimental
Last reviewed: 2019-03-25
Last reviewed: 2020-06-09
---

# [Claim task directive](../../../lib/process-services-cloud/src/lib/task/directives/claim-task.directive.ts "Defined in claim-task.directive.ts")
# [Claim task Cloud directive](../../../lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts "Defined in claim-task-cloud.directive.ts")

Claims a task

## Basic Usage

```html
<button adf-claim-task [appName]="appName" [taskId]="taskId" (success)="onTaskClaimed()">Complete</button>
<button adf-cloud-claim-task [appName]="appName" [taskId]="taskId" (success)="onTaskClaimed()">Claim</button>
```

## Class members
Expand All @@ -22,7 +22,7 @@ Claims a task
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| appName | `string` | "" | (Required) The name of the application. |
| taskId | `string` | | (Required) The id of the task. |
| taskId | `string` | "" | (Required) The id of the task. |

### Events

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
Title: Unclaim Task Cloud Directive
Added: v3.9.0
Status: Experimental
Last reviewed: 2020-06-09
---

# [Unclaim Task Cloud directive](../../../lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts "Defined in unclaim-task-cloud.directive.ts")

Unclaims a task

## Basic Usage

```html
<button adf-cloud-unclaim-task [appName]="appName" [taskId]="taskId" (success)="onTaskUnclaimed()">Unclaim</button>
```

## Class members

### Properties

| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| appName | `string` | "" | (Required) The name of the application. |
| taskId | `string` | "" | (Required) The id of the task. |

### Events

| Name | Type | Description |
| ---- | ---- | ----------- |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task cannot be completed. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task is completed. |
34 changes: 34 additions & 0 deletions docs/process-services/components/form-custom-outcome.component.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
Title: Form custom outcomes component
Added: v3.9.0
Status: Active
Last reviewed: 2020-06-09
---

# [Form custom outcomes component](../../../lib/process-services/src/lib/form/form-custom-outcomes.component.ts "Defined in form-custom-outcomes.component.ts")

Supplies custom outcome buttons to be included in [Form component](form.component.md).

![](../../docassets/images/form-custom-outcomes.component.png)

## Basic Usage

```html
<adf-form>
<adf-form-custom-outcomes>
<button mat-button (click)="onCustomOutcome1()">
Custom-outcome-1
</button>
<button mat-button (click)="onCustomOutcome2()">
Custom-outcome-2
</button>
<button mat-button (click)="onCustomOutcome3()">
Custom-outcome-3
</button>
</adf-form-custom-outcomes>
</adf-form>
```

## See Also

- [Form component](form.component.md)
2 changes: 2 additions & 0 deletions docs/process-services/components/task-form.component.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Shows a [`form`](../../../lib/process-services/src/lib/task-list/models/form.mod
| formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. |
| formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../../lib/core/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
| showAttachForm | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<void>` | Emitted when the form associated with the form task is attached. |
| taskClaimed | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the task is claimed. |
| taskUnclaimed | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when the task is unclaimed (ie, requeued). |

## See also

Expand Down
1 change: 1 addition & 0 deletions docs/process-services/components/task-header.component.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Shows all the information related to a task.
| ---- | ---- | ------------- | ----------- |
| formName | `string` | null | The name of the form. |
| taskDetails | [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) | | (required) Details related to the task. |
| showClaimRelease | `boolean` | true | Toggles display of the claim/release button. |

### Events

Expand Down
31 changes: 31 additions & 0 deletions docs/process-services/directives/claim-task.directive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
Title: Claim Task Directive
Added: v3.9.0
Status: Experimental
Last reviewed: 2020-06-09
---

# [Claim task directive](../../../lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.ts "Defined in claim-task.directive.ts")

Claims a task

## Basic Usage

```html
<button adf-claim-task [taskId]="taskId" (success)="onTaskClaimed()">Claim</button>
```

## Class members

### Properties

| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| taskId | `string` | "" | (Required) The id of the task. |

### Events

| Name | Type | Description |
| ---- | ---- | ----------- |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task cannot be completed. |
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task is completed. |
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
Title: Unclaim Task Directive
Added: v3.1.0
Added: v3.9.0
Status: Experimental
Last reviewed: 2019-03-25
Last reviewed: 2020-06-09
---

# [Unclaim task directive](../../../lib/process-services-cloud/src/lib/task/directives/unclaim-task.directive.ts "Defined in unclaim-task.directive.ts")
# [Unclaim Task directive](../../../lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.ts "Defined in unclaim-task.directive.ts")

Unclaims a task

## Basic Usage

```html
<button adf-unclaim-task [appName]="appName" [taskId]="taskId" (success)="onTaskUnclaimed()">Complete</button>
<button adf-unclaim-task [appName]="appName" [taskId]="taskId" (success)="onTaskUnclaimed()">Unclaim</button>
```

## Class members
Expand All @@ -21,8 +21,7 @@ Unclaims a task

| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| appName | `string` | "" | (Required) The name of the application. |
| taskId | `string` | | (Required) The id of the task. |
| taskId | `string` | "" | (Required) The id of the task. |

### Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { setupTestBed } from '@alfresco/adf-core';
import { TaskCloudService } from '../services/task-cloud.service';
import { of } from 'rxjs';
import { ClaimTaskDirective } from './claim-task.directive';
import { ClaimTaskCloudDirective } from './claim-task-cloud.directive';
import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock';
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
import { TranslateModule } from '@ngx-translate/core';

describe('ClaimTaskDirective', () => {
describe('ClaimTaskCloudDirective', () => {

@Component({
selector: 'adf-cloud-claim-test-component',
Expand All @@ -35,8 +35,8 @@ describe('ClaimTaskDirective', () => {
taskMock = 'test1234';
appNameMock = 'simple-app';

@ViewChild(ClaimTaskDirective)
claimTaskDirective: ClaimTaskDirective;
@ViewChild(ClaimTaskCloudDirective)
claimTaskDirective: ClaimTaskCloudDirective;
}

let fixture: ComponentFixture<TestComponent>;
Expand Down Expand Up @@ -78,8 +78,8 @@ describe('Claim Task Directive validation errors', () => {
appNameUndefined = undefined;
appNameNull = null;

@ContentChildren(ClaimTaskDirective)
claimTaskValidationDirective: ClaimTaskDirective;
@ContentChildren(ClaimTaskCloudDirective)
claimTaskValidationDirective: ClaimTaskCloudDirective;
}

@Component({
Expand All @@ -90,8 +90,8 @@ describe('Claim Task Directive validation errors', () => {

appName = 'simple-app';

@ContentChildren(ClaimTaskDirective)
claimTaskValidationDirective: ClaimTaskDirective;
@ContentChildren(ClaimTaskCloudDirective)
claimTaskValidationDirective: ClaimTaskCloudDirective;
}

@Component({
Expand All @@ -103,8 +103,8 @@ describe('Claim Task Directive validation errors', () => {
appNameUndefined = undefined;
taskMock = 'test1234';

@ContentChildren(ClaimTaskDirective)
claimTaskValidationDirective: ClaimTaskDirective;
@ContentChildren(ClaimTaskCloudDirective)
claimTaskValidationDirective: ClaimTaskCloudDirective;
}

@Component({
Expand All @@ -116,8 +116,8 @@ describe('Claim Task Directive validation errors', () => {
appNameNull = null;
taskMock = 'test1234';

@ViewChild(ClaimTaskDirective)
claimTaskValidationDirective: ClaimTaskDirective;
@ViewChild(ClaimTaskCloudDirective)
claimTaskValidationDirective: ClaimTaskCloudDirective;
}

let fixture: ComponentFixture<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { TaskCloudService } from '../services/task-cloud.service';
// tslint:disable-next-line: directive-selector
selector: '[adf-cloud-claim-task]'
})
export class ClaimTaskDirective implements OnInit {
export class ClaimTaskCloudDirective implements OnInit {

/** (Required) The id of the task. */
@Input()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

export * from './claim-task.directive';
export * from './unclaim-task.directive';
export * from './claim-task-cloud.directive';
export * from './unclaim-task-cloud.directive';
export * from './complete-task.directive';

export * from './task-directive.module';
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@

import { NgModule } from '@angular/core';
import { CompleteTaskDirective } from './complete-task.directive';
import { ClaimTaskDirective } from './claim-task.directive';
import { UnClaimTaskDirective } from './unclaim-task.directive';
import { ClaimTaskCloudDirective } from './claim-task-cloud.directive';
import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive';

@NgModule({
declarations: [
CompleteTaskDirective,
ClaimTaskDirective,
UnClaimTaskDirective
ClaimTaskCloudDirective,
UnClaimTaskCloudDirective
],
exports: [
CompleteTaskDirective,
ClaimTaskDirective,
UnClaimTaskDirective
ClaimTaskCloudDirective,
UnClaimTaskCloudDirective
]
})
export class TaskDirectiveModule { }
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { setupTestBed } from '@alfresco/adf-core';
import { TaskCloudService } from '../services/task-cloud.service';
import { of } from 'rxjs';
import { UnClaimTaskDirective } from './unclaim-task.directive';
import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive';
import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock';
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
import { TranslateModule } from '@ngx-translate/core';

describe('UnClaimTaskDirective', () => {
describe('UnClaimTaskCloudDirective', () => {

@Component({
selector: 'adf-cloud-test-component',
Expand All @@ -35,8 +35,8 @@ describe('UnClaimTaskDirective', () => {
appName = 'simple-app';
taskIdMock = '1234';

@ContentChildren(UnClaimTaskDirective)
unclaimTaskDirective: UnClaimTaskDirective;
@ContentChildren(UnClaimTaskCloudDirective)
unclaimTaskDirective: UnClaimTaskCloudDirective;
}

let fixture: ComponentFixture<TestComponent>;
Expand Down Expand Up @@ -78,8 +78,8 @@ describe('UnClaim Task Directive validation errors', () => {
appNameUndefined = undefined;
appNameNull = null;

@ContentChildren(UnClaimTaskDirective)
claimTaskValidationDirective: UnClaimTaskDirective;
@ContentChildren(UnClaimTaskCloudDirective)
claimTaskValidationDirective: UnClaimTaskCloudDirective;
}

@Component({
Expand All @@ -90,8 +90,8 @@ describe('UnClaim Task Directive validation errors', () => {

appName = 'simple-app';

@ContentChildren(UnClaimTaskDirective)
claimTaskValidationDirective: UnClaimTaskDirective;
@ContentChildren(UnClaimTaskCloudDirective)
claimTaskValidationDirective: UnClaimTaskCloudDirective;
}

@Component({
Expand All @@ -103,8 +103,8 @@ describe('UnClaim Task Directive validation errors', () => {
appNameUndefined = undefined;
taskMock = 'test1234';

@ContentChildren(UnClaimTaskDirective)
claimTaskValidationDirective: UnClaimTaskDirective;
@ContentChildren(UnClaimTaskCloudDirective)
claimTaskValidationDirective: UnClaimTaskCloudDirective;
}

@Component({
Expand All @@ -116,8 +116,8 @@ describe('UnClaim Task Directive validation errors', () => {
appNameNull = null;
taskMock = 'test1234';

@ViewChild(UnClaimTaskDirective)
claimTaskValidationDirective: UnClaimTaskDirective;
@ViewChild(UnClaimTaskCloudDirective)
claimTaskValidationDirective: UnClaimTaskCloudDirective;
}

let fixture: ComponentFixture<any>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TaskCloudService } from '../services/task-cloud.service';
// tslint:disable-next-line: directive-selector
selector: '[adf-cloud-unclaim-task]'
})
export class UnClaimTaskDirective implements OnInit {
export class UnClaimTaskCloudDirective implements OnInit {

/** (Required) The id of the task. */
@Input()
Expand Down

0 comments on commit ea62b1e

Please sign in to comment.