viewer fixes for demo shell (#3686)

This commit is contained in:
Denys Vuika
2018-08-10 13:50:02 +01:00
committed by Eugenio Romano
parent 6cb1d2be5c
commit 7ceee231bd
4 changed files with 39 additions and 23 deletions

View File

@@ -190,7 +190,11 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
validateDynamicTableRowEvent.preventDefault();
}
}
)
),
formService.formContentClicked.subscribe(content => {
this.showContentPreview(content);
})
);
// Uncomment this block to see form event handling in action
@@ -396,6 +400,10 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
}
onContentClick(content: any): void {
this.showContentPreview(content);
}
private showContentPreview(content: any) {
if (content.contentBlob) {
this.preview.showBlob(content.name, content.contentBlob);
} else {

0
git
View File

View File

@@ -15,13 +15,13 @@
* limitations under the License.
*/
import { LogService } from '../../services/log.service';
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation, OnDestroy } from '@angular/core';
import { FormService } from './../services/form.service';
import { WidgetVisibilityService } from './../services/widget-visibility.service';
import { FormComponent } from './form.component';
import { ContentLinkModel } from './widgets/core/content-link.model';
import { FormOutcomeModel } from './widgets/core/index';
import { Subscription } from 'rxjs';
/**
* Displays the start form for a named process definition, which can be used to retrieve values to start a new process.
@@ -45,7 +45,9 @@ import { FormOutcomeModel } from './widgets/core/index';
styleUrls: ['./form.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class StartFormComponent extends FormComponent implements OnChanges, OnInit {
export class StartFormComponent extends FormComponent implements OnChanges, OnInit, OnDestroy {
private subscriptions: Subscription[] = [];
/** Definition ID of the process to start. */
@Input()
@@ -79,16 +81,22 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
outcomesContainer: ElementRef = null;
constructor(formService: FormService,
visibilityService: WidgetVisibilityService,
logService: LogService) {
visibilityService: WidgetVisibilityService) {
super(formService, visibilityService, null, null);
this.showTitle = false;
}
ngOnInit() {
this.formService.formContentClicked.subscribe((content: ContentLinkModel) => {
this.subscriptions.push(
this.formService.formContentClicked.subscribe(content => {
this.formContentClicked.emit(content);
});
})
);
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => subscription.unsubscribe());
this.subscriptions = [];
}
ngOnChanges(changes: SimpleChanges) {
@@ -109,14 +117,14 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
loadStartForm(processId: string) {
this.formService.getProcessIntance(processId)
.subscribe((intance: any) => {
.subscribe((instance: any) => {
this.formService
.getStartFormInstance(processId)
.subscribe(
form => {
this.formName = form.name;
if (intance.variables) {
form.processVariables = intance.variables;
if (instance.variables) {
form.processVariables = instance.variables;
}
this.form = this.parseForm(form);
this.visibilityService.refreshVisibility(this.form);

View File

@@ -144,7 +144,7 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
file.contentBlob = blob;
this.formService.formContentClicked.next(file);
},
(error) => {
() => {
this.logService.error('Unable to send event for file ' + file.name);
}
);