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 { NodeService } from './../services/node.service';
|
||||||
import { ContentLinkModel } from './widgets/core/content-link.model';
|
import { ContentLinkModel } from './widgets/core/content-link.model';
|
||||||
import { FormFieldModel, FormModel, FormOutcomeEvent, FormOutcomeModel, FormValues, FormFieldValidator } from './widgets/core/index';
|
import { FormFieldModel, FormModel, FormOutcomeEvent, FormOutcomeModel, FormValues, FormFieldValidator } from './widgets/core/index';
|
||||||
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -280,23 +280,14 @@ export class FormComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadFormProcessVariables(taskId: string): Promise<boolean> {
|
findProcessVariablesByTaskId(taskId: string): Observable<any> {
|
||||||
return new Promise((resolve, reject) => {
|
return this.formService.getTask(taskId).
|
||||||
this.formService.getTask(taskId).subscribe(
|
switchMap((task: any) => {
|
||||||
task => {
|
if (this.isAProcessTask(task)) {
|
||||||
if (this.isAProcessTask(task)) {
|
return this.visibilityService.getTaskProcessVariable(taskId);
|
||||||
this.visibilityService.getTaskProcessVariable(taskId).subscribe(_ => {
|
} else {
|
||||||
resolve(true);
|
return Observable.of({});
|
||||||
});
|
}
|
||||||
} else {
|
|
||||||
resolve(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error => {
|
|
||||||
this.handleError(error);
|
|
||||||
resolve(false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,7 +297,7 @@ export class FormComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
getFormByTaskId(taskId: string): Promise<FormModel> {
|
getFormByTaskId(taskId: string): Promise<FormModel> {
|
||||||
return new Promise<FormModel>((resolve, reject) => {
|
return new Promise<FormModel>((resolve, reject) => {
|
||||||
this.loadFormProcessVariables(this.taskId).then(_ => {
|
this.findProcessVariablesByTaskId(this.taskId).subscribe( (processVariables) => {
|
||||||
this.formService
|
this.formService
|
||||||
.getTaskForm(taskId)
|
.getTaskForm(taskId)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
@@ -45,6 +45,7 @@ export class FormRenderingService {
|
|||||||
|
|
||||||
private types: { [key: string]: ComponentTypeResolver } = {
|
private types: { [key: string]: ComponentTypeResolver } = {
|
||||||
'text': DefaultTypeResolver.fromType(TextWidgetComponent),
|
'text': DefaultTypeResolver.fromType(TextWidgetComponent),
|
||||||
|
'string': DefaultTypeResolver.fromType(TextWidgetComponent),
|
||||||
'integer': DefaultTypeResolver.fromType(NumberWidgetComponent),
|
'integer': DefaultTypeResolver.fromType(NumberWidgetComponent),
|
||||||
'multi-line-text': DefaultTypeResolver.fromType(MultilineTextWidgetComponentComponent),
|
'multi-line-text': DefaultTypeResolver.fromType(MultilineTextWidgetComponentComponent),
|
||||||
'boolean': DefaultTypeResolver.fromType(CheckboxWidgetComponent),
|
'boolean': DefaultTypeResolver.fromType(CheckboxWidgetComponent),
|
||||||
|
@@ -90,6 +90,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
|||||||
* @memberOf TaskListComponent
|
* @memberOf TaskListComponent
|
||||||
*/
|
*/
|
||||||
hasCustomDataSource: boolean = false;
|
hasCustomDataSource: boolean = false;
|
||||||
|
isStreamLoaded = false;
|
||||||
|
|
||||||
private defaultSchemaColumn: DataColumn[] = [
|
private defaultSchemaColumn: DataColumn[] = [
|
||||||
{ type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true },
|
{ type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true },
|
||||||
@@ -99,21 +100,29 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
|||||||
constructor(private taskListService: TaskListService) {
|
constructor(private taskListService: TaskListService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initStream() {
|
||||||
|
if (!this.isStreamLoaded) {
|
||||||
|
this.isStreamLoaded = true;
|
||||||
|
this.taskListService.tasksList$.subscribe(
|
||||||
|
(tasks) => {
|
||||||
|
let instancesRow = this.createDataRow(tasks.data);
|
||||||
|
this.renderInstances(instancesRow);
|
||||||
|
this.selectTask(this.landingTaskId);
|
||||||
|
this.onSuccess.emit(tasks);
|
||||||
|
this.isLoading = false;
|
||||||
|
}, (error) => {
|
||||||
|
this.onError.emit(error);
|
||||||
|
this.isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.data === undefined) {
|
if (this.data === undefined) {
|
||||||
this.data = new ObjectDataTableAdapter();
|
this.data = new ObjectDataTableAdapter();
|
||||||
}
|
}
|
||||||
this.taskListService.tasksList$.subscribe(
|
this.initStream();
|
||||||
(tasks) => {
|
|
||||||
let instancesRow = this.createDataRow(tasks.data);
|
|
||||||
this.renderInstances(instancesRow);
|
|
||||||
this.selectTask(this.landingTaskId);
|
|
||||||
this.onSuccess.emit(tasks);
|
|
||||||
this.isLoading = false;
|
|
||||||
}, (error) => {
|
|
||||||
this.onError.emit(error);
|
|
||||||
this.isLoading = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
ngAfterContentInit() {
|
||||||
@@ -143,6 +152,7 @@ export class TaskListComponent implements OnChanges, OnInit, AfterContentInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
this.initStream();
|
||||||
if (this.isPropertyChanged(changes)) {
|
if (this.isPropertyChanged(changes)) {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user