mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1521] Form string type is not rendered (#2318)
* Fix missing string widget and task list loading * Update tasklist.component.ts call initStream
This commit is contained in:
committed by
Eugenio Romano
parent
7479bb1b6f
commit
7a26c1d53d
@@ -23,7 +23,7 @@ import { FormService } from './../services/form.service';
|
||||
import { NodeService } from './../services/node.service';
|
||||
import { ContentLinkModel } from './widgets/core/content-link.model';
|
||||
import { FormFieldModel, FormModel, FormOutcomeEvent, FormOutcomeModel, FormValues, FormFieldValidator } from './widgets/core/index';
|
||||
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
||||
|
||||
@Component({
|
||||
@@ -280,23 +280,14 @@ export class FormComponent implements OnInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
loadFormProcessVariables(taskId: string): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.formService.getTask(taskId).subscribe(
|
||||
task => {
|
||||
findProcessVariablesByTaskId(taskId: string): Observable<any> {
|
||||
return this.formService.getTask(taskId).
|
||||
switchMap((task: any) => {
|
||||
if (this.isAProcessTask(task)) {
|
||||
this.visibilityService.getTaskProcessVariable(taskId).subscribe(_ => {
|
||||
resolve(true);
|
||||
});
|
||||
return this.visibilityService.getTaskProcessVariable(taskId);
|
||||
} else {
|
||||
resolve(true);
|
||||
return Observable.of({});
|
||||
}
|
||||
},
|
||||
error => {
|
||||
this.handleError(error);
|
||||
resolve(false);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -306,7 +297,7 @@ export class FormComponent implements OnInit, OnChanges {
|
||||
|
||||
getFormByTaskId(taskId: string): Promise<FormModel> {
|
||||
return new Promise<FormModel>((resolve, reject) => {
|
||||
this.loadFormProcessVariables(this.taskId).then(_ => {
|
||||
this.findProcessVariablesByTaskId(this.taskId).subscribe( (processVariables) => {
|
||||
this.formService
|
||||
.getTaskForm(taskId)
|
||||
.subscribe(
|
||||
|
@@ -45,6 +45,7 @@ export class FormRenderingService {
|
||||
|
||||
private types: { [key: string]: ComponentTypeResolver } = {
|
||||
'text': DefaultTypeResolver.fromType(TextWidgetComponent),
|
||||
'string': DefaultTypeResolver.fromType(TextWidgetComponent),
|
||||
'integer': DefaultTypeResolver.fromType(NumberWidgetComponent),
|
||||
'multi-line-text': DefaultTypeResolver.fromType(MultilineTextWidgetComponentComponent),
|
||||
'boolean': DefaultTypeResolver.fromType(CheckboxWidgetComponent),
|
||||
|
@@ -90,6 +90,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
||||
* @memberOf TaskListComponent
|
||||
*/
|
||||
hasCustomDataSource: boolean = false;
|
||||
isStreamLoaded = false;
|
||||
|
||||
private defaultSchemaColumn: DataColumn[] = [
|
||||
{ type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true },
|
||||
@@ -99,10 +100,9 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
||||
constructor(private taskListService: TaskListService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data === undefined) {
|
||||
this.data = new ObjectDataTableAdapter();
|
||||
}
|
||||
initStream() {
|
||||
if (!this.isStreamLoaded) {
|
||||
this.isStreamLoaded = true;
|
||||
this.taskListService.tasksList$.subscribe(
|
||||
(tasks) => {
|
||||
let instancesRow = this.createDataRow(tasks.data);
|
||||
@@ -115,6 +115,15 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
if (this.data === undefined) {
|
||||
this.data = new ObjectDataTableAdapter();
|
||||
}
|
||||
this.initStream();
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.setupSchema();
|
||||
@@ -143,6 +152,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
this.initStream();
|
||||
if (this.isPropertyChanged(changes)) {
|
||||
this.reload();
|
||||
}
|
||||
|
Reference in New Issue
Block a user