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();
|
validateDynamicTableRowEvent.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
),
|
||||||
|
|
||||||
|
formService.formContentClicked.subscribe(content => {
|
||||||
|
this.showContentPreview(content);
|
||||||
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// Uncomment this block to see form event handling in action
|
// 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 {
|
onContentClick(content: any): void {
|
||||||
|
this.showContentPreview(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
private showContentPreview(content: any) {
|
||||||
if (content.contentBlob) {
|
if (content.contentBlob) {
|
||||||
this.preview.showBlob(content.name, content.contentBlob);
|
this.preview.showBlob(content.name, content.contentBlob);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -15,13 +15,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { LogService } from '../../services/log.service';
|
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation, OnDestroy } from '@angular/core';
|
||||||
import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
|
|
||||||
import { FormService } from './../services/form.service';
|
import { FormService } from './../services/form.service';
|
||||||
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
import { WidgetVisibilityService } from './../services/widget-visibility.service';
|
||||||
import { FormComponent } from './form.component';
|
import { FormComponent } from './form.component';
|
||||||
import { ContentLinkModel } from './widgets/core/content-link.model';
|
import { ContentLinkModel } from './widgets/core/content-link.model';
|
||||||
import { FormOutcomeModel } from './widgets/core/index';
|
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.
|
* 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'],
|
styleUrls: ['./form.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None
|
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. */
|
/** Definition ID of the process to start. */
|
||||||
@Input()
|
@Input()
|
||||||
@@ -79,16 +81,22 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
|
|||||||
outcomesContainer: ElementRef = null;
|
outcomesContainer: ElementRef = null;
|
||||||
|
|
||||||
constructor(formService: FormService,
|
constructor(formService: FormService,
|
||||||
visibilityService: WidgetVisibilityService,
|
visibilityService: WidgetVisibilityService) {
|
||||||
logService: LogService) {
|
|
||||||
super(formService, visibilityService, null, null);
|
super(formService, visibilityService, null, null);
|
||||||
this.showTitle = false;
|
this.showTitle = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.formService.formContentClicked.subscribe((content: ContentLinkModel) => {
|
this.subscriptions.push(
|
||||||
|
this.formService.formContentClicked.subscribe(content => {
|
||||||
this.formContentClicked.emit(content);
|
this.formContentClicked.emit(content);
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.subscriptions.forEach(subscription => subscription.unsubscribe());
|
||||||
|
this.subscriptions = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
@@ -109,14 +117,14 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
|
|||||||
|
|
||||||
loadStartForm(processId: string) {
|
loadStartForm(processId: string) {
|
||||||
this.formService.getProcessIntance(processId)
|
this.formService.getProcessIntance(processId)
|
||||||
.subscribe((intance: any) => {
|
.subscribe((instance: any) => {
|
||||||
this.formService
|
this.formService
|
||||||
.getStartFormInstance(processId)
|
.getStartFormInstance(processId)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
form => {
|
form => {
|
||||||
this.formName = form.name;
|
this.formName = form.name;
|
||||||
if (intance.variables) {
|
if (instance.variables) {
|
||||||
form.processVariables = intance.variables;
|
form.processVariables = instance.variables;
|
||||||
}
|
}
|
||||||
this.form = this.parseForm(form);
|
this.form = this.parseForm(form);
|
||||||
this.visibilityService.refreshVisibility(this.form);
|
this.visibilityService.refreshVisibility(this.form);
|
||||||
|
@@ -144,7 +144,7 @@ export class UploadWidgetComponent extends WidgetComponent implements OnInit {
|
|||||||
file.contentBlob = blob;
|
file.contentBlob = blob;
|
||||||
this.formService.formContentClicked.next(file);
|
this.formService.formContentClicked.next(file);
|
||||||
},
|
},
|
||||||
(error) => {
|
() => {
|
||||||
this.logService.error('Unable to send event for file ' + file.name);
|
this.logService.error('Unable to send event for file ' + file.name);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user