[ADF-4979] Add onChanges detection for Task Header Cloud component (#5208)

* [ADF-4979] Add onChanges detection for Task Header Cloud component

* [ADF-4979] Revert licenses.txt changes

* [ADF-4979] Documentation added for the taskError Event
This commit is contained in:
arditdomi
2019-11-06 11:07:48 +00:00
committed by Maurizio Vitale
parent 7d36400dbd
commit 3c1097fb84
25 changed files with 380 additions and 238 deletions

View File

@@ -8,8 +8,6 @@
[taskId]="taskId"
(cancelClick)="goBack()"
(taskCompleted)="onTaskCompleted()"
(taskClaimed)="onTaskClaimed()"
(taskUnclaimed)="onTaskUnclaimed()"
(formContentClicked)="onFormContentClicked($event)"
(formSaved)="onFormSaved()">
</adf-cloud-task-form>

View File

@@ -60,14 +60,6 @@ export class TaskDetailsCloudDemoComponent {
this.goBack();
}
onTaskClaimed() {
this.taskHeader.ngOnInit();
}
onTaskUnclaimed() {
this.taskHeader.ngOnInit();
}
onFormContentClicked(resourceClicked: any) {
this.previewService.showResource(resourceClicked.nodeId);
}

View File

@@ -0,0 +1,31 @@
<h2>{{ 'APP_LAYOUT.TASK_HEADER_CLOUD.COMPONENT_NAME' | translate }}</h2>
<mat-form-field class="app-appName-input">
{{ 'APP_LAYOUT.TASK_HEADER_CLOUD.APP_NAME_INPUT' | translate }}
<input matInput
[type]="'text'"
[formControl]="appNameFormControl">
</mat-form-field>
<mat-form-field class="app-taskId-input">
{{ 'APP_LAYOUT.TASK_HEADER_CLOUD.TASK_ID_INPUT' | translate }}
<input matInput
[type]="'text'"
[formControl]="taskIdFormControl">
</mat-form-field>
<button mat-button *ngIf="appNameFormControl.value && taskIdFormControl.value"
class="app-find-task-button"
(click)="updateTaskHeader()">
{{ 'APP_LAYOUT.TASK_HEADER_CLOUD.FIND_TASK_BUTTON' | translate }}
</button>
<mat-error *ngIf="errorMessage">{{errorMessage}}</mat-error>
<div>
<adf-cloud-task-header #taskHeader
[appName]="appName"
[taskId]="taskId"
(taskError)="onError($event)">
</adf-cloud-task-header>
</div>

View File

@@ -0,0 +1,16 @@
.app {
&-appName-input {
width: 500px;
margin-right: 50px;
}
&-taskId-input {
width: 500px;
}
&-find-task-button {
background-color: #ff9800;
margin-left: 30px;
}
}

View File

@@ -0,0 +1,49 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component, ViewChild } from '@angular/core';
import { TaskHeaderCloudComponent } from '@alfresco/adf-process-services-cloud';
import { FormControl, Validators } from '@angular/forms';
@Component({
templateUrl: './task-header-cloud-demo.component.html',
styleUrls: ['./task-header-cloud-demo.component.scss']
})
export class TaskHeaderCloudDemoComponent {
@ViewChild('taskHeader')
taskHeader: TaskHeaderCloudComponent;
appName: string;
taskId: string;
errorMessage;
appNameFormControl = new FormControl('', Validators.required);
taskIdFormControl = new FormControl('', Validators.required);
constructor() {}
updateTaskHeader() {
this.errorMessage = undefined;
this.appName = this.appNameFormControl.value;
this.taskId = this.taskIdFormControl.value;
}
onError(error) {
this.errorMessage = error.message;
}
}