mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
viewer fixes for demo shell (#3686)
This commit is contained in:
committed by
Eugenio Romano
parent
6cb1d2be5c
commit
7ceee231bd
@@ -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 {
|
||||
|
@@ -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.formContentClicked.emit(content);
|
||||
});
|
||||
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,22 +117,22 @@ 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;
|
||||
}
|
||||
this.form = this.parseForm(form);
|
||||
this.visibilityService.refreshVisibility(this.form);
|
||||
this.form.validateForm();
|
||||
this.form.readOnly = this.readOnlyForm;
|
||||
this.onFormLoaded(this.form);
|
||||
},
|
||||
error => this.handleError(error)
|
||||
form => {
|
||||
this.formName = form.name;
|
||||
if (instance.variables) {
|
||||
form.processVariables = instance.variables;
|
||||
}
|
||||
this.form = this.parseForm(form);
|
||||
this.visibilityService.refreshVisibility(this.form);
|
||||
this.form.validateForm();
|
||||
this.form.readOnly = this.readOnlyForm;
|
||||
this.onFormLoaded(this.form);
|
||||
},
|
||||
error => this.handleError(error)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user