mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fix the attach content from alfresco and local (#5328)
This commit is contained in:
committed by
Eugenio Romano
parent
4699f407e9
commit
e1ff2909bd
@@ -5,5 +5,6 @@
|
||||
[variables]="variables"
|
||||
(error)="openSnackMessage($event)"
|
||||
(success)="onStartProcessSuccess()"
|
||||
(formContentClicked)="onFormContentClicked($event)"
|
||||
(cancel)="onCancelStartProcess()">
|
||||
</adf-cloud-start-process>
|
||||
|
@@ -19,6 +19,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { NotificationService, AppConfigService } from '@alfresco/adf-core';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
import { PreviewService } from 'app/services/preview.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: './start-process-cloud-demo.component.html',
|
||||
@@ -34,6 +35,7 @@ export class StartProcessCloudDemoComponent implements OnInit {
|
||||
constructor(private appConfig: AppConfigService,
|
||||
private cloudLayoutService: CloudLayoutService,
|
||||
private route: ActivatedRoute,
|
||||
private previewService: PreviewService,
|
||||
private notificationService: NotificationService,
|
||||
private router: Router) {
|
||||
}
|
||||
@@ -61,4 +63,8 @@ export class StartProcessCloudDemoComponent implements OnInit {
|
||||
openSnackMessage(event: any) {
|
||||
this.notificationService.openSnackMessage(event.response.body.entry.message);
|
||||
}
|
||||
|
||||
onFormContentClicked(resourceClicked: any) {
|
||||
this.previewService.showResource(resourceClicked.nodeId);
|
||||
}
|
||||
}
|
||||
|
@@ -210,6 +210,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
this.visibilityService.refreshVisibility(<any> parsedForm);
|
||||
parsedForm.validateForm();
|
||||
this.form = parsedForm;
|
||||
this.form.nodeId = '-my-';
|
||||
this.form.contentHost = this.appConfigService.get('ecmHost');
|
||||
this.onFormLoaded(this.form);
|
||||
resolve(this.form);
|
||||
@@ -238,6 +239,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
|
||||
this.visibilityService.refreshVisibility(<any> parsedForm);
|
||||
parsedForm.validateForm();
|
||||
this.form = parsedForm;
|
||||
this.form.nodeId = '-my-';
|
||||
this.form.contentHost = this.appConfigService.get('ecmHost');
|
||||
this.onFormLoaded(this.form);
|
||||
},
|
||||
|
@@ -53,7 +53,6 @@
|
||||
</button>
|
||||
<mat-menu #fileActionMenu="matMenu" xPosition="before">
|
||||
<button id="{{'file-'+file?.id+'-show-file'}}"
|
||||
[disabled]="file['isExternal']"
|
||||
mat-menu-item (click)="onAttachFileClicked(file)">
|
||||
<mat-icon>image</mat-icon>
|
||||
<span>{{ 'FORM.FIELD.SHOW_FILE' | translate }}</span>
|
||||
|
@@ -22,9 +22,9 @@ import {
|
||||
FormService,
|
||||
LogService,
|
||||
ThumbnailService,
|
||||
ContentLinkModel,
|
||||
NotificationService,
|
||||
baseHost
|
||||
baseHost,
|
||||
ContentLinkModel
|
||||
} from '@alfresco/adf-core';
|
||||
import { Node, RelatedContentRepresentation } from '@alfresco/js-api';
|
||||
import { ContentCloudNodeSelectorService } from '../../../services/content-cloud-node-selector.service';
|
||||
@@ -124,14 +124,8 @@ export class AttachFileCloudWidgetComponent extends UploadCloudWidgetComponent
|
||||
);
|
||||
}
|
||||
|
||||
onAttachFileClicked(file: ContentLinkModel) {
|
||||
this.processCloudContentService
|
||||
.getRawContentNode(file.nodeId, this.field.form.contentHost)
|
||||
.subscribe(
|
||||
blob => {
|
||||
file.contentBlob = blob;
|
||||
this.fileClicked(file);
|
||||
}
|
||||
);
|
||||
onAttachFileClicked(nodeSelector: any) {
|
||||
nodeSelector.nodeId = nodeSelector.id;
|
||||
this.fileClicked(new ContentLinkModel(nodeSelector));
|
||||
}
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@
|
||||
[showRefreshButton]="false"
|
||||
[showValidationIcon]="false"
|
||||
[showTitle]="false"
|
||||
(formContentClicked)="onFormContentClicked($event)"
|
||||
(formLoaded)="onFormLoaded($event)">
|
||||
<adf-cloud-form-custom-outcomes>
|
||||
<ng-template [ngTemplateOutlet]="taskFormCloudButtons">
|
||||
|
@@ -23,7 +23,7 @@ import {
|
||||
import { ProcessInstanceCloud } from '../models/process-instance-cloud.model';
|
||||
import { StartProcessCloudService } from '../services/start-process-cloud.service';
|
||||
import { FormControl, Validators, FormGroup, AbstractControl, FormBuilder, ValidatorFn } from '@angular/forms';
|
||||
import { FormModel } from '@alfresco/adf-core';
|
||||
import { FormModel, ContentLinkModel } from '@alfresco/adf-core';
|
||||
import { MatAutocompleteTrigger } from '@angular/material';
|
||||
import { ProcessPayloadCloud } from '../models/process-payload-cloud.model';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
@@ -84,6 +84,10 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
@Output()
|
||||
error = new EventEmitter<ProcessInstanceCloud>();
|
||||
|
||||
/** Emitted when form content is clicked. */
|
||||
@Output()
|
||||
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter();
|
||||
|
||||
processDefinitionList: ProcessDefinitionCloud[] = [];
|
||||
processDefinitionCurrent: ProcessDefinitionCloud;
|
||||
errorMessageId: string = '';
|
||||
@@ -301,6 +305,10 @@ export class StartProcessCloudComponent implements OnChanges, OnInit, OnDestroy
|
||||
return this.processForm.get('processDefinition');
|
||||
}
|
||||
|
||||
onFormContentClicked(content: ContentLinkModel) {
|
||||
this.formContentClicked.emit(content);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
|
Reference in New Issue
Block a user