[ADF-2055] Ability to pre-populate form with a file and values (#2834)

* fix translations form

* fix style webpack script

* fix tslint error problem in viewer

* fix naming problems in attach file widget

* add start process form values data initialization option

* fix translation problems

* missing return type

* start process name configuration

* add CS cross PS configuration

* start process from file example

* fix minor issues

* add documentation and move the dialog in a separate component

* easy test select app

* alfrescoRepositoryName right property

* file conversion test

* fix issue after CR

* Remove forgotten semicolon.
This commit is contained in:
Eugenio Romano 2018-01-17 17:06:00 +00:00 committed by GitHub
parent 244234db4f
commit b1fd6cb60c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 789 additions and 344 deletions

View File

@ -6,7 +6,7 @@
"scripts": {
"ng": "ng",
"start": "npm run server-versions && rimraf dist && ng serve --host 0.0.0.0 --app dist --open --aot=false",
"start:dev": "npm run lint && npm run server-versions && rimraf dist && npm run clean-lib-angular && concurrently \"ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open\" \"npm run style:dev - --watch\" ",
"start:dev": "npm run lint && npm run server-versions && rimraf dist && npm run clean-lib-angular && concurrently \"ng serve --host 0.0.0.0 --disable-host-check --app dev pp-dev --proxy-config proxy.conf.js --open\" \"npm run style:dev -- --watch\" ",
"start:dist": "npm run server-versions && rimraf dist && node --max_old_space_size=30000 node_modules/.bin/ng serve --prod --build-optimizer=false --aot=false --host 0.0.0.0 --disable-host-check --app dist",
"build": "npm run server-versions && rimraf dist && ng build --app dist",
"build:dev": "npm run lint && npm run style:dev && npm run server-versions && rimraf dist && ng build --app dev",

View File

@ -3,7 +3,11 @@
"VERSION": {
"NO_PERMISSION": "You don't have permission to manage versions of this content",
"NO_PERMISSION_EVENT": "You don't have ${event.permission} permission to ${event.action} the ${event.type}",
"CHOOSE_FILE": "Select a file to see its versions"
"CHOOSE_FILE": "Select a file to see its versions",
"DIALOG": {
"CLOSE": "Close",
"TITLE": "Manage versions"
}
},
"APP_LAYOUT": {
"APP_NAME": "ADF Demo Application",
@ -50,7 +54,8 @@
"DOWNLOAD": "Download",
"COPY": "Copy",
"MOVE": "Move",
"DELETE": "Delete"
"DELETE": "Delete",
"PROCESS_ACTION": "Start Process"
}
}
},

View File

@ -191,6 +191,7 @@
format="timeAgo"
class="desktop-only">
</data-column>
</data-columns>
<content-actions>
@ -268,6 +269,13 @@
(success)="onDeleteActionSuccess($event)"
handler="delete">
</content-action>
<content-action
*ngIf="authenticationService.isBpmLoggedIn()"
icon="play_arrow"
target="document"
title="{{'DOCUMENT_LIST.ACTIONS.DOCUMENT.PROCESS_ACTION' | translate}}"
(execute)="startProcesAction($event)">
</content-action>
</content-actions>
</adf-document-list>
<adf-pagination
@ -290,6 +298,7 @@
{{ 'ADF-DOCUMENT-LIST.LAYOUT.LOAD_MORE' | translate }}
</adf-infinite-pagination>
</adf-upload-drag-area>
<adf-info-drawer-layout *ngIf="showVersions" class="adf-manage-versions-sidebar" fxFlex="0 0 auto">
<div info-drawer-content>
<ng-container *ngIf="hasOneFileSelected();else choose_document_template">
@ -318,6 +327,13 @@
<context-menu-holder></context-menu-holder>
<div *ngIf="processId" >
<adf-start-process
[values]="formValues"
[appId]="processId">
</adf-start-process>
</div>
<div class="adf-content-service-settings">
<p>Current folder ID: {{ documentList.currentFolderId }}</p>

View File

@ -23,14 +23,16 @@ import { MatDialog } from '@angular/material';
import { ActivatedRoute, Params, Router } from '@angular/router';
import { MinimalNodeEntity, NodePaging, Pagination, MinimalNodeEntryEntity, SiteEntry } from 'alfresco-js-api';
import {
AlfrescoApiService, ContentService, TranslationService,
AlfrescoApiService, AuthenticationService, ContentService, TranslationService,
FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
UploadService, DataColumn, DataRow, UserPreferencesService,
PaginationComponent
PaginationComponent, FormValues
} from '@alfresco/adf-core';
import { DocumentListComponent, PermissionStyleModel, DownloadZipDialogComponent } from '@alfresco/adf-content-services';
import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
import { Subscription } from 'rxjs/Rx';
@ -60,6 +62,10 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
// The identifier of a node. You can also use one of these well-known aliases: -my- | -shared- | -root-
currentFolderId: string = DEFAULT_FOLDER_TO_SHOW;
formValues: FormValues = {};
processId;
@Input()
selectionMode = 'multiple';
@ -143,7 +149,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
private router: Router,
private logService: LogService,
private preference: UserPreferencesService,
@Optional() private route: ActivatedRoute) {
@Optional() private route: ActivatedRoute,
public authenticationService: AuthenticationService) {
}
showFile(event) {
@ -208,7 +215,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}
giveDefaultPaginationWhenNotDefined() {
this.pagination = <Pagination> {
this.pagination = <Pagination> {
maxItems: this.preference.paginationSize,
skipCount: 0,
totalItems: 0,
@ -446,6 +453,20 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
return false;
}
startProcesAction($event) {
this.formValues['file'] = $event.value.entry;
const dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px',
panelClass: 'adf-version-manager-dialog'
});
dialogRef.afterClosed().subscribe(selectedProcess => {
this.processId = selectedProcess.id;
});
}
onChangePageSize(event: Pagination): void {
this.preference.paginationSize = event.maxItems;
this.changedPageSize.emit(event);

View File

@ -1,7 +1,7 @@
<header mat-dialog-title>Manage versions</header>
<header mat-dialog-title>{{'VERSION.DIALOG.TITLE' | translate}}</header>
<section mat-dialog-content>
<adf-version-manager [node]="contentEntry"></adf-version-manager>
</section>
<footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
<button mat-button (click)="close()">Close</button>
<button mat-button (click)="close()">{{'VERSION.DIALOG.CLOSE' | translate}}</button>
</footer>

View File

@ -168,30 +168,30 @@ for more information about installing and using the source code.
## Components
| Name | Description | Source link |
| ---- | ----------- | ----------- |
| [Breadcrumb component](breadcrumb.component.md) | Indicates the current position within a navigation hierarchy. | [Source](../lib/content-services/breadcrumb/breadcrumb.component.ts) |
| [Dropdown breadcrumb component](dropdown-breadcrumb.component.md) | Indicates the current position within a navigation hierarchy using a dropdown menu. | [Source](../lib/content-services/breadcrumb/dropdown-breadcrumb.component.ts) |
| Name | Description | Source link |
| --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [Breadcrumb component](breadcrumb.component.md) | Indicates the current position within a navigation hierarchy. | [Source](../lib/content-services/breadcrumb/breadcrumb.component.ts) |
| [Dropdown breadcrumb component](dropdown-breadcrumb.component.md) | Indicates the current position within a navigation hierarchy using a dropdown menu. | [Source](../lib/content-services/breadcrumb/dropdown-breadcrumb.component.ts) |
| [Content metadata component](content-metadata.component.md) | Allows a user to display and edit metadata related to a node. | [Source](../lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts) |
| [Content node selector component](content-node-selector.component.md) | Allows a user to select items from a Content Services repository. | [Source](../lib/content-services/content-node-selector/content-node-selector.component.ts) |
| [Content action component](content-action.component.md) | Adds options to a Document List actions menu for a particular content type. | [Source](../lib/content-services/document-list/components/content-action/content-action.component.ts) |
| [Document list component](document-list.component.md) | Displays the documents from a repository. | [Source](../lib/content-services/document-list/components/document-list.component.ts) |
| [Search control component](search-control.component.md) | Displays a input text which shows find-as-you-type suggestions. | [Source](../lib/content-services/search/components/search-control.component.ts) |
| [Search component](search.component.md) | Searches items for supplied search terms. | [Source](../lib/content-services/search/components/search.component.ts) |
| [Sites dropdown component](sites-dropdown.component.md) | Displays a dropdown menu to show and interact with the sites of the current user. | [Source](../lib/content-services/site-dropdown/sites-dropdown.component.ts) |
| [Like component](like.component.md) | Allows a user to add "likes" to an item. | [Source](../lib/content-services/social/like.component.ts) |
| [Rating component](rating.component.md) | Allows a user to add ratings to an item. | [Source](../lib/content-services/social/rating.component.ts) |
| [Tag actions component](tag-actions.component.md) | Shows available actions for tags. | [Source](../lib/content-services/tag/tag-actions.component.ts) |
| [Tag list component](tag-list.component.md) | Shows tags for an item. | [Source](../lib/content-services/tag/tag-list.component.ts) |
| [Tag node list component](tag-node-list.component.md) | Shows tags for a node. | [Source](../lib/content-services/tag/tag-node-list.component.ts) |
| [File uploading dialog component](file-uploading-dialog.component.md) | Shows a dialog listing all the files uploaded with the Upload Button or Drag Area components. | [Source](../lib/content-services/upload/components/file-uploading-dialog.component.ts) |
| [Upload button component](upload-button.component.md) | Activates a file upload. | [Source](../lib/content-services/upload/components/upload-button.component.ts) |
| [Upload drag area component](upload-drag-area.component.md) | Adds a drag and drop area to upload files to Alfresco. | [Source](../lib/content-services/upload/components/upload-drag-area.component.ts) |
| [Version list component](version-list.component.md) | Displays the version history of a node in a [Version Manager component](version-manager.component.md) | [Source](../lib/content-services/version-manager/version-list.component.ts) |
| [Version manager component](version-manager.component.md) | Displays the version history of a node with the ability to upload a new version. | [Source](../lib/content-services/version-manager/version-manager.component.ts) |
| [Webscript component](webscript.component.md) | Provides access to Webscript features. | [Source](../lib/content-services/webscript/webscript.component.ts) |
| _Content metadata card component_ | _Not currently documented_ | [Source](../lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.ts) |
| _Content node selector panel component_ | _Not currently documented_ | [Source](../lib/content-services/content-node-selector/content-node-selector-panel.component.ts) |
| [Content node selector component](content-node-selector.component.md) | Allows a user to select items from a Content Services repository. | [Source](../lib/content-services/content-node-selector/content-node-selector.component.ts) |
| [Content action component](content-action.component.md) | Adds options to a Document List actions menu for a particular content type. | [Source](../lib/content-services/document-list/components/content-action/content-action.component.ts) |
| [Document list component](document-list.component.md) | Displays the documents from a repository. | [Source](../lib/content-services/document-list/components/document-list.component.ts) |
| [Search control component](search-control.component.md) | Displays a input text which shows find-as-you-type suggestions. | [Source](../lib/content-services/search/components/search-control.component.ts) |
| [Search component](search.component.md) | Searches items for supplied search terms. | [Source](../lib/content-services/search/components/search.component.ts) |
| [Sites dropdown component](sites-dropdown.component.md) | Displays a dropdown menu to show and interact with the sites of the current user. | [Source](../lib/content-services/site-dropdown/sites-dropdown.component.ts) |
| [Like component](like.component.md) | Allows a user to add "likes" to an item. | [Source](../lib/content-services/social/like.component.ts) |
| [Rating component](rating.component.md) | Allows a user to add ratings to an item. | [Source](../lib/content-services/social/rating.component.ts) |
| [Tag actions component](tag-actions.component.md) | Shows available actions for tags. | [Source](../lib/content-services/tag/tag-actions.component.ts) |
| [Tag list component](tag-list.component.md) | Shows tags for an item. | [Source](../lib/content-services/tag/tag-list.component.ts) |
| [Tag node list component](tag-node-list.component.md) | Shows tags for a node. | [Source](../lib/content-services/tag/tag-node-list.component.ts) |
| [File uploading dialog component](file-uploading-dialog.component.md) | Shows a dialog listing all the files uploaded with the Upload Button or Drag Area components. | [Source](../lib/content-services/upload/components/file-uploading-dialog.component.ts) |
| [Upload button component](upload-button.component.md) | Activates a file upload. | [Source](../lib/content-services/upload/components/upload-button.component.ts) |
| [Upload drag area component](upload-drag-area.component.md) | Adds a drag and drop area to upload files to Alfresco. | [Source](../lib/content-services/upload/components/upload-drag-area.component.ts) |
| [Version list component](version-list.component.md) | Displays the version history of a node in a [Version Manager component](version-manager.component.md) | [Source](../lib/content-services/version-manager/version-list.component.ts) |
| [Version manager component](version-manager.component.md) | Displays the version history of a node with the ability to upload a new version. | [Source](../lib/content-services/version-manager/version-manager.component.ts) |
| [Webscript component](webscript.component.md) | Provides access to Webscript features. | [Source](../lib/content-services/webscript/webscript.component.ts) |
| _Content metadata component_ | _Not currently documented_ | [Source](../lib/content-services/content-metadata/content-metadata.component.ts) |
| _Content node selector panel component_ | _Not currently documented_ | [Source](../lib/content-services/content-node-selector/content-node-selector-panel.component.ts) |
## Directives
@ -242,6 +242,7 @@ for more information about installing and using the source code.
| Name | Description | Source link |
| ---- | ----------- | ----------- |
| [Apps list component](apps-list.component.md) | Shows all available apps. | [Source](../lib/process-services/app-list/apps-list.component.ts) |
| [Select app dialog component](select-apps-dialog-component.md) | Shows a dialog listing all the PS apps with a slect box to slect it | [Source](../lib/process-services/app-list/select-apps-dialog-component.ts) |
| [Create process attachment component](create-process-attachment.component.md) | Displays Upload Component (Drag and Click) to upload the attachment to a specified process instance | [Source](../lib/process-services/attachment/create-process-attachment.component.ts) |
| [Create task attachment component](create-task-attachment.component.md) | Displays Upload Component (Drag and Click) to upload the attachment to a specified task | [Source](../lib/process-services/attachment/create-task-attachment.component.ts) |
| [Process attachment list component](process-attachment-list.component.md) | Displays attached documents on a specified process instance | [Source](../lib/process-services/attachment/process-attachment-list.component.ts) |

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -0,0 +1,26 @@
# Select app Component
Shows all available apps and give you back the selected app.
![select-apps-dialog](docassets/images/select-apps-dialog.png)
## Basic Usage
```ts
import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
constructor(private dialog: MatDialog) {
}
startSelectDialog(){
const dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px',
panelClass: 'adf-version-manager-dialog'
});
dialogRef.afterClosed().subscribe(selectedProcess => {
this.processId = selectedProcess.id;
});
}
```

View File

@ -17,7 +17,9 @@ Starts a process.
| Name | Description |
| --- | --- |
| appId | (required): Limit the list of processes which can be started to those contained in the specified app |
| name | (optional) name to assign to the current process |
| variables | Variables in input to the process [RestVariable](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api/docs/RestVariable.md)|
| values | Parameter to pass form field values in the start form if is associated |
### Events
@ -27,6 +29,74 @@ Starts a process.
| cancel | Raised when the process canceled |
| error | Raised when the start process fail |
### Custom data example
Here is an example of how to pass in form field values, these correspond to the start form that has been defined for the process:
```ts
const formValues:FormValues = {
'test_1': 'value_1',
'test_2': 'value_2',
'test_3': 'value_1',
'test_4': 'dropdown_id',
'test_5': 'dropdown_label',
'dropdown': {'id': 'dropdown_id', 'name': 'dropdown_label'}
};
```
```html
<adf-start-process
[values]="formValues"
appId="YOUR_APP_ID" >
</adf-start-process>
```
### Attach a File to the start-form of the process
After the repository is created in APS, you can see your new repository in the Alfresco Repositories list.
If the ID is set to 1, then all default values are fine.
However, if it is set to something else, for example, ***1002*** and the name is ***alfresco***, you must set in your 'app.config.json' the property ***alfrescoRepositoryName*** alfresco-1002:
```ts
{
name: 'Alfresco ADF Application'
},
ecmHost: 'http://{hostname}{:port}/ecm',
bpmHost: 'http://{hostname}{:port}/bpm',
logLevel: 'silent',
alfrescoRepositoryName : 'alfresco-1002'
```
After you need to pass the node in the input values object with the other properties:
```ts
let node: MinimalNodeEntryEntity = this.odesApiService.getNode(NODE_ID);
const formValues: FormValues = {
'file' : node
'field_one': 'example text'
};
```
Note In the object above the key 'file' is the name of the attach file field in the start form of the process.
The value of the file property has to be a ***MinimalNodeEntryEntity**:
```html
<adf-start-process
[values]="formValues"
appId="YOUR_APP_ID" >
</adf-start-process>
```
The result will be the start form prefilled with the file:
![Start process load file](docassets/images/start_process.png)
## Details
Displays Start Process, allowing the user to specify some details like process name and process definition, which are the most basic requirement to start a new process instance. The user have to select the process definition from a dropdown if there are more than one process definition available. If there is just one process definition available for the app, then it is auto-selected. There is a error message shown if no process definition is available.

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Startformular"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Vorschau nicht verfügbar"
},
"FIELD": {
"UPLOAD": "Hochladen",
"REQUIRED": "*Erforderlich",
"VALIDATOR": {
"INVALID_NUMBER": "Verwenden Sie ein anderes Zahlenformat",
"INVALID_DATE": "Verwenden Sie ein anderes Datumsformat",
"INVALID_VALUE": "Geben Sie einen anderen Wert ein",
"NOT_GREATER_THAN": "Darf nicht größer als {{ maxValue }} sein",
"NOT_LESS_THAN": "Darf nicht kleiner als {{ minValue }} sein",
"AT_LEAST_LONG": "Geben Sie mindestens {{ minLength }} Zeichen ein",
"NO_LONGER_THAN": "Geben Sie höchstens {{ maxLength }} Zeichen ein"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Dieser Ordner ist leer"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "Sie verfügen nicht über die nötige Berechtigung ('{{permission}}'), um {{type}} zu {{action}}"
}
}
}

View File

@ -1,26 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Start Form"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Preview not available"
},
"FIELD": {
"SOURCE": "Select source from ",
"UPLOAD": "UPLOAD",
"REQUIRED": "*Required",
"VALIDATOR": {
"INVALID_NUMBER": "Use a different number format",
"INVALID_DATE": "Use a different date format",
"INVALID_VALUE": "Enter a different value",
"NOT_GREATER_THAN": "Can't be greater than {{ maxValue }}",
"NOT_LESS_THAN": "Can't be less than {{ minValue }}",
"AT_LEAST_LONG": "Enter at least {{ minLength }} characters",
"NO_LONGER_THAN": "Enter no more than {{ maxLength }} characters"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "This folder is empty"

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Iniciar formulario"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Vista previa no disponible"
},
"FIELD": {
"UPLOAD": "Cargar",
"REQUIRED": "*Requerido",
"VALIDATOR": {
"INVALID_NUMBER": "Utilizar un formato de número diferente",
"INVALID_DATE": "Utilizar un formato de fecha diferente",
"INVALID_VALUE": "Introducir un valor diferente",
"NOT_GREATER_THAN": "No puede ser mayor que {{ maxValue }}",
"NOT_LESS_THAN": "No puede ser menor que {{ minValue }}",
"AT_LEAST_LONG": "Introducir al menos {{ minLength }} caracteres",
"NO_LONGER_THAN": "No introducir más de {{ maxLength }} caracteres"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Esta carpeta está vacía"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "No tiene permiso {{permission}} para {{action}} el {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Démarrer le formulaire"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Aperçu non disponible"
},
"FIELD": {
"UPLOAD": "Importer",
"REQUIRED": "*Obligatoire",
"VALIDATOR": {
"INVALID_NUMBER": "Utiliser un format de numéro différent",
"INVALID_DATE": "Utiliser un format de date différent",
"INVALID_VALUE": "Entrer une valeur différente",
"NOT_GREATER_THAN": "Ne peut pas être supérieur à {{ maxValue }}",
"NOT_LESS_THAN": "Ne peut pas être inférieur à {{ minValue }}",
"AT_LEAST_LONG": "Entrez {{ minLength }} caractères minimum",
"NO_LONGER_THAN": "Entrez {{ maxLength }} caractères maximum"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Ce dossier est vide"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "Vous n'avez pas les droits d'accès {{permission}} pour {{action}} le {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Modulo di inizio"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Anteprima non disponibile"
},
"FIELD": {
"UPLOAD": "Carica",
"REQUIRED": "*Obbligatorio",
"VALIDATOR": {
"INVALID_NUMBER": "Usa un formato numerico diverso",
"INVALID_DATE": "Usa un formato di data diverso",
"INVALID_VALUE": "Immetti un valore diverso",
"NOT_GREATER_THAN": "Non può essere maggiore di {{ maxValue }}",
"NOT_LESS_THAN": "Non può essere inferiore di {{ minValue }}",
"AT_LEAST_LONG": "Immetti almeno {{ minLength }} caratteri",
"NO_LONGER_THAN": "Immetti non più di {{ maxLength }} caratteri"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Questa cartella è vuota"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "Non hai l'autorizzazione {{permission}} per {{action}} {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "開始フォーム"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "プレビューは使用できません"
},
"FIELD": {
"UPLOAD": "アップロード",
"REQUIRED": "*必須",
"VALIDATOR": {
"INVALID_NUMBER": "別の番号形式を使用してください",
"INVALID_DATE": "別の日付形式を使用してください",
"INVALID_VALUE": "別の値を入力してください",
"NOT_GREATER_THAN": "{{ maxValue }} より大きい値にすることはできません",
"NOT_LESS_THAN": "{{ minValue }} より小さい値にすることはできません",
"AT_LEAST_LONG": "{{ minLength }} 文字以上で入力してください",
"NO_LONGER_THAN": "{{ maxLength }} 文字以内で入力してください"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "このフォルダは空です"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "{{type}} を {{action}} するための {{permission}} 権限がありません"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Start skjema"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Forhåndsvisning ikke tilgjengelig"
},
"FIELD": {
"UPLOAD": "Laster opp",
"REQUIRED": "*Påkrevd",
"VALIDATOR": {
"INVALID_NUMBER": "Bruk et annet nummerformat",
"INVALID_DATE": "Bruk et annet datoformat",
"INVALID_VALUE": "Angi en annen verdi",
"NOT_GREATER_THAN": "Kan ikke være større enn {{ maxValue }}",
"NOT_LESS_THAN": "Kan ikke være mindre enn {{ minValue }}",
"AT_LEAST_LONG": "Angi minst {{ minLength }} tegn",
"NO_LONGER_THAN": "Ikke angi flere enn {{ maxLength }} tegn"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Denne mappen er tom"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "Du har ikke {{permission}} tillatelsen til å {{action}} {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Beginformulier"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Preview niet beschikbaar"
},
"FIELD": {
"UPLOAD": "Uploaden",
"REQUIRED": "*Verplicht",
"VALIDATOR": {
"INVALID_NUMBER": "Gebruik een andere getalnotatie",
"INVALID_DATE": "Gebruik een andere datumnotatie",
"INVALID_VALUE": "Voer een andere waarde in",
"NOT_GREATER_THAN": "Mag niet groter zijn dan {{ maxValue }}",
"NOT_LESS_THAN": "Mag niet kleiner zijn dan {{ minValue }}",
"AT_LEAST_LONG": "Voer minimaal {{ minLength }} tekens in",
"NO_LONGER_THAN": "Voer maximaal {{ maxLength }} tekens in"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Deze map is leeg"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "U hebt geen {{permission}} rechten voor het {{action}} van {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Iniciar formulário"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Pré-visualização não disponível"
},
"FIELD": {
"UPLOAD": "Carregar",
"REQUIRED": "*Obrigatório",
"VALIDATOR": {
"INVALID_NUMBER": "Use um formato de número diferente",
"INVALID_DATE": "Use um formato de data diferente",
"INVALID_VALUE": "Insira um valor diferente",
"NOT_GREATER_THAN": "Não pode ser maior do que {{ maxValue }}",
"NOT_LESS_THAN": "Não pode ser menor do que {{ minValue }}",
"AT_LEAST_LONG": "Insira no mínimo {{ minLength }} caracteres",
"NO_LONGER_THAN": "Insira no máximo {{ maxLength }} caracteres"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Esta pasta está vazia"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "Você não tem a permissão {{permission}} para {{action}} o {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Запустить форму"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Предварительный просмотр недоступен"
},
"FIELD": {
"UPLOAD": "Загрузить",
"REQUIRED": "*Обязательно для заполнения",
"VALIDATOR": {
"INVALID_NUMBER": "Используйте другой формат числа",
"INVALID_DATE": "Используйте другой формат даты",
"INVALID_VALUE": "Введите другое значение",
"NOT_GREATER_THAN": "Не может быть более {{ maxValue }}",
"NOT_LESS_THAN": "Не может быть менее {{ minValue }}",
"AT_LEAST_LONG": "Введите не менее {{ minLength }} символ",
"NO_LONGER_THAN": "Введите не более {{ maxLength }} символ"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "Эта папка пуста"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "У вас нет разрешения {{permission}}, чтобы {{action}} {{type}}"
}
}
}

View File

@ -1,25 +1,4 @@
{
"FORM": {
"START_FORM": {
"TITLE": "启动表单"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "预览不可用"
},
"FIELD": {
"UPLOAD": "上传",
"REQUIRED": "*必填项",
"VALIDATOR": {
"INVALID_NUMBER": "使用其他数字格式",
"INVALID_DATE": "使用其他日期格式",
"INVALID_VALUE": "输入其他值",
"NOT_GREATER_THAN": "不得大于 {{ maxValue }}",
"NOT_LESS_THAN": "不得小于 {{ minValue }}",
"AT_LEAST_LONG": "输入至少 {{ minLength }} 个字符",
"NO_LONGER_THAN": "不得输入超过 {{ maxLength }} 个字符"
}
}
},
"ADF-DOCUMENT-LIST": {
"EMPTY": {
"HEADER": "此文件夹为空"
@ -185,4 +164,4 @@
"PERMISSON": {
"LACKOF": "您没有 {{action}} {{type}} 的 {{permission}} 权限"
}
}
}

View File

@ -30,7 +30,8 @@ export class AppConfigService {
},
ecmHost: 'http://{hostname}{:port}/ecm',
bpmHost: 'http://{hostname}{:port}/bpm',
logLevel: 'silent'
logLevel: 'silent',
alfrescoRepositoryName : 'alfresco-1'
};
constructor(private http: HttpClient) {

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Startformular"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Vorschau nicht verfügbar"
},
"FIELD": {
"UPLOAD": "Hochladen",
"REQUIRED": "*Erforderlich",
"VALIDATOR": {
"INVALID_NUMBER": "Verwenden Sie ein anderes Zahlenformat",
"INVALID_DATE": "Verwenden Sie ein anderes Datumsformat",
"INVALID_VALUE": "Geben Sie einen anderen Wert ein",
"NOT_GREATER_THAN": "Darf nicht größer als {{ maxValue }} sein",
"NOT_LESS_THAN": "Darf nicht kleiner als {{ minValue }} sein",
"AT_LEAST_LONG": "Geben Sie mindestens {{ minLength }} Zeichen ein",
"NO_LONGER_THAN": "Geben Sie höchstens {{ maxLength }} Zeichen ein"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Angezeigt werden {{ range }} von {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Laden",
"UNKNOWN_FORMAT": "Vorschau konnte nicht geladen werden"
}
}
}

View File

@ -1,4 +1,27 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Start Form"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Preview not available"
},
"FIELD": {
"LOCALSTORAGE" : "Local storage",
"SOURCE": "Select source from ",
"UPLOAD": "UPLOAD",
"REQUIRED": "*Required",
"VALIDATOR": {
"INVALID_NUMBER": "Use a different number format",
"INVALID_DATE": "Use a different date format",
"INVALID_VALUE": "Enter a different value",
"NOT_GREATER_THAN": "Can't be greater than {{ maxValue }}",
"NOT_LESS_THAN": "Can't be less than {{ minValue }}",
"AT_LEAST_LONG": "Enter at least {{ minLength }} characters",
"NO_LONGER_THAN": "Enter no more than {{ maxLength }} characters"
}
}
},
"CORE": {
"FILE_SIZE": {
"BYTES": "Bytes",

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Iniciar formulario"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Vista previa no disponible"
},
"FIELD": {
"UPLOAD": "Cargar",
"REQUIRED": "*Requerido",
"VALIDATOR": {
"INVALID_NUMBER": "Utilizar un formato de número diferente",
"INVALID_DATE": "Utilizar un formato de fecha diferente",
"INVALID_VALUE": "Introducir un valor diferente",
"NOT_GREATER_THAN": "No puede ser mayor que {{ maxValue }}",
"NOT_LESS_THAN": "No puede ser menor que {{ minValue }}",
"AT_LEAST_LONG": "Introducir al menos {{ minLength }} caracteres",
"NO_LONGER_THAN": "No introducir más de {{ maxLength }} caracteres"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Mostrando {{ range }} de {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Cargando",
"UNKNOWN_FORMAT": "No se ha podido cargar la vista previa"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Démarrer le formulaire"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Aperçu non disponible"
},
"FIELD": {
"UPLOAD": "Importer",
"REQUIRED": "*Obligatoire",
"VALIDATOR": {
"INVALID_NUMBER": "Utiliser un format de numéro différent",
"INVALID_DATE": "Utiliser un format de date différent",
"INVALID_VALUE": "Entrer une valeur différente",
"NOT_GREATER_THAN": "Ne peut pas être supérieur à {{ maxValue }}",
"NOT_LESS_THAN": "Ne peut pas être inférieur à {{ minValue }}",
"AT_LEAST_LONG": "Entrez {{ minLength }} caractères minimum",
"NO_LONGER_THAN": "Entrez {{ maxLength }} caractères maximum"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Affichage de {{ range }} sur {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Chargement en cours",
"UNKNOWN_FORMAT": "Impossible de charger l'aperçu"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Modulo di inizio"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Anteprima non disponibile"
},
"FIELD": {
"UPLOAD": "Carica",
"REQUIRED": "*Obbligatorio",
"VALIDATOR": {
"INVALID_NUMBER": "Usa un formato numerico diverso",
"INVALID_DATE": "Usa un formato di data diverso",
"INVALID_VALUE": "Immetti un valore diverso",
"NOT_GREATER_THAN": "Non può essere maggiore di {{ maxValue }}",
"NOT_LESS_THAN": "Non può essere inferiore di {{ minValue }}",
"AT_LEAST_LONG": "Immetti almeno {{ minLength }} caratteri",
"NO_LONGER_THAN": "Immetti non più di {{ maxLength }} caratteri"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Visualizzazione di {{ range }} su {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Caricamento in corso",
"UNKNOWN_FORMAT": "Impossibile caricare l'anteprima"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "開始フォーム"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "プレビューは使用できません"
},
"FIELD": {
"UPLOAD": "アップロード",
"REQUIRED": "*必須",
"VALIDATOR": {
"INVALID_NUMBER": "別の番号形式を使用してください",
"INVALID_DATE": "別の日付形式を使用してください",
"INVALID_VALUE": "別の値を入力してください",
"NOT_GREATER_THAN": "{{ maxValue }} より大きい値にすることはできません",
"NOT_LESS_THAN": "{{ minValue }} より小さい値にすることはできません",
"AT_LEAST_LONG": "{{ minLength }} 文字以上で入力してください",
"NO_LONGER_THAN": "{{ maxLength }} 文字以内で入力してください"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "表示中: {{ range }} / {{ total }} 件",
@ -148,4 +169,4 @@
"LOADING": "読み込み中",
"UNKNOWN_FORMAT": "プレビューを読み込めませんでした"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Start skjema"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Forhåndsvisning ikke tilgjengelig"
},
"FIELD": {
"UPLOAD": "Laster opp",
"REQUIRED": "*Påkrevd",
"VALIDATOR": {
"INVALID_NUMBER": "Bruk et annet nummerformat",
"INVALID_DATE": "Bruk et annet datoformat",
"INVALID_VALUE": "Angi en annen verdi",
"NOT_GREATER_THAN": "Kan ikke være større enn {{ maxValue }}",
"NOT_LESS_THAN": "Kan ikke være mindre enn {{ minValue }}",
"AT_LEAST_LONG": "Angi minst {{ minLength }} tegn",
"NO_LONGER_THAN": "Ikke angi flere enn {{ maxLength }} tegn"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Vis {{ range }} av {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Laster",
"UNKNOWN_FORMAT": "Kan ikke laste forhåndsvisning"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Beginformulier"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Preview niet beschikbaar"
},
"FIELD": {
"UPLOAD": "Uploaden",
"REQUIRED": "*Verplicht",
"VALIDATOR": {
"INVALID_NUMBER": "Gebruik een andere getalnotatie",
"INVALID_DATE": "Gebruik een andere datumnotatie",
"INVALID_VALUE": "Voer een andere waarde in",
"NOT_GREATER_THAN": "Mag niet groter zijn dan {{ maxValue }}",
"NOT_LESS_THAN": "Mag niet kleiner zijn dan {{ minValue }}",
"AT_LEAST_LONG": "Voer minimaal {{ minLength }} tekens in",
"NO_LONGER_THAN": "Voer maximaal {{ maxLength }} tekens in"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "{{ range }} van {{ total }} wordt weergegeven",
@ -148,4 +169,4 @@
"LOADING": "Wordt geladen",
"UNKNOWN_FORMAT": "Kan voorbeeld niet laden"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Iniciar formulário"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Pré-visualização não disponível"
},
"FIELD": {
"UPLOAD": "Carregar",
"REQUIRED": "*Obrigatório",
"VALIDATOR": {
"INVALID_NUMBER": "Use um formato de número diferente",
"INVALID_DATE": "Use um formato de data diferente",
"INVALID_VALUE": "Insira um valor diferente",
"NOT_GREATER_THAN": "Não pode ser maior do que {{ maxValue }}",
"NOT_LESS_THAN": "Não pode ser menor do que {{ minValue }}",
"AT_LEAST_LONG": "Insira no mínimo {{ minLength }} caracteres",
"NO_LONGER_THAN": "Insira no máximo {{ maxLength }} caracteres"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "Mostrando {{ range }} de {{ total }}",
@ -148,4 +169,4 @@
"LOADING": "Carregando",
"UNKNOWN_FORMAT": "Não foi possível carregar pré-visualização"
}
}
}

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "Запустить форму"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "Предварительный просмотр недоступен"
},
"FIELD": {
"UPLOAD": "Загрузить",
"REQUIRED": "*Обязательно для заполнения",
"VALIDATOR": {
"INVALID_NUMBER": "Используйте другой формат числа",
"INVALID_DATE": "Используйте другой формат даты",
"INVALID_VALUE": "Введите другое значение",
"NOT_GREATER_THAN": "Не может быть более {{ maxValue }}",
"NOT_LESS_THAN": "Не может быть менее {{ minValue }}",
"AT_LEAST_LONG": "Введите не менее {{ minLength }} символ",
"NO_LONGER_THAN": "Введите не более {{ maxLength }} символ"
}
}
},
"CORE": {
"FILE_SIZE": {
"BYTES": "Б",

View File

@ -1,4 +1,25 @@
{
"FORM": {
"START_FORM": {
"TITLE": "启动表单"
},
"PREVIEW": {
"IMAGE_NOT_AVAILABLE": "预览不可用"
},
"FIELD": {
"UPLOAD": "上传",
"REQUIRED": "*必填项",
"VALIDATOR": {
"INVALID_NUMBER": "使用其他数字格式",
"INVALID_DATE": "使用其他日期格式",
"INVALID_VALUE": "输入其他值",
"NOT_GREATER_THAN": "不得大于 {{ maxValue }}",
"NOT_LESS_THAN": "不得小于 {{ minValue }}",
"AT_LEAST_LONG": "输入至少 {{ minLength }} 个字符",
"NO_LONGER_THAN": "不得输入超过 {{ maxLength }} 个字符"
}
}
},
"CORE": {
"PAGINATION": {
"ITEMS_RANGE": "显示 {{range}}/{{total}}",
@ -148,4 +169,4 @@
"LOADING": "正在加载",
"UNKNOWN_FORMAT": "无法加载预览"
}
}
}

View File

@ -458,17 +458,21 @@ export class ViewerComponent implements OnChanges {
await this.renditionService.convert(nodeId, 'pdf').toPromise();
this.viewerType = 'pdf';
this.urlFileContent = this.apiService.contentApi.getRenditionUrl(nodeId, 'pdf');
} catch {
} catch (error) {
this.logService.error(error);
}
}
} catch {
} catch (error) {
this.logService.error(error);
try {
const imagePreview = await this.apiService.renditionsApi.getRendition(nodeId, 'imgpreview');
if (imagePreview.entry.status.toString() === 'CREATED') {
this.viewerType = 'image';
this.urlFileContent = this.apiService.contentApi.getRenditionUrl(nodeId, 'imgpreview');
}
} catch {
} catch (error) {
this.logService.error(error);
}
}
@ -484,14 +488,16 @@ export class ViewerComponent implements OnChanges {
this.viewerType = 'pdf';
this.urlFileContent = this.apiService.contentApi.getSharedLinkRenditionUrl(sharedId, 'pdf');
}
} catch {
} catch (error) {
this.logService.error(error);
try {
const rendition = await this.apiService.renditionsApi.getSharedLinkRendition(sharedId, 'imgpreview');
if (rendition.entry.status.toString() === 'CREATED') {
this.viewerType = 'image';
this.urlFileContent = this.apiService.contentApi.getSharedLinkRenditionUrl(sharedId, 'imgpreview');
}
} catch {
} catch (error) {
this.logService.error(error);
}
}

View File

@ -55,7 +55,7 @@ describe('AppsListComponent', () => {
component = fixture.componentInstance;
debugElement = fixture.debugElement;
service = fixture.debugElement.injector.get(AppsProcessService);
service = TestBed.get(AppsProcessService);
getAppsSpy = spyOn(service, 'getDeployedApplications').and.returnValue(Observable.of(deployedApps));
});

View File

@ -22,6 +22,7 @@ import { MaterialModule } from '../material.module';
import { TranslateModule } from '@ngx-translate/core';
import { AppsListComponent } from './apps-list.component';
import { SelectAppsDialogComponent } from './select-apps-dialog-component';
@NgModule({
imports: [
@ -31,11 +32,16 @@ import { AppsListComponent } from './apps-list.component';
TranslateModule
],
declarations: [
AppsListComponent
AppsListComponent,
SelectAppsDialogComponent
],
providers: [],
exports: [
AppsListComponent
AppsListComponent,
SelectAppsDialogComponent
],
entryComponents: [
SelectAppsDialogComponent
]
})
export class AppsListModule {

View File

@ -16,3 +16,4 @@
*/
export * from './apps-list.component';
export * from './select-apps-dialog-component';

View File

@ -0,0 +1,13 @@
<header mat-dialog-title id="adf-selet-app-dialog-title">{{'APP.DIALOG.TITLE' | translate}}</header>
<section mat-dialog-content>
<mat-select id="adf-selet-app-dialog-dropdown" placeholder="{{'APP.DIALOG.LIST' | translate}}" [(value)]="selectedProcess" >
<mat-option *ngFor="let currentProcessApp of processApps" [value]="currentProcessApp">
{{ currentProcessApp.name }}
</mat-option>
</mat-select>
</section>
<footer mat-dialog-actions fxLayout="row" fxLayoutAlign="end center">
<button mat-button (click)="onStart()">{{'APP.DIALOG.START' | translate}}</button>
</footer>

View File

@ -0,0 +1,131 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Component } from '@angular/core';
import { async, TestBed } from '@angular/core/testing';
import { ComponentFixture } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
import { MaterialModule } from '../material.module';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
import { MatDialog } from '@angular/material';
import { OverlayContainer } from '@angular/cdk/overlay';
import { AppsProcessService } from '@alfresco/adf-core';
import { deployedApps } from '../mock/apps-list.mock';
import { Observable } from 'rxjs/Observable';
import { SelectAppsDialogComponent } from './select-apps-dialog-component';
@Component({
selector: 'adf-dialog-test',
template: ''
})
export class DialogSelectAppTestComponent {
processId: any;
dialogRef: any;
constructor(private dialog: MatDialog) {
}
startProcesAction() {
this.dialogRef = this.dialog.open(SelectAppsDialogComponent, {
width: '630px'
});
this.dialogRef.afterClosed().subscribe(selectedProcess => {
this.processId = selectedProcess.id;
});
}
}
describe('Select app dialog', () => {
let fixture: ComponentFixture<DialogSelectAppTestComponent>;
let component: DialogSelectAppTestComponent;
let dialogRef;
let overlayContainerElement: HTMLElement;
let service: AppsProcessService;
beforeEach(async(() => {
dialogRef = {
close: jasmine.createSpy('close')
};
TestBed.configureTestingModule({
imports: [
MaterialModule,
FormsModule,
ReactiveFormsModule,
BrowserDynamicTestingModule
],
declarations: [
SelectAppsDialogComponent,
DialogSelectAppTestComponent
],
providers: [
AppsProcessService,
{
provide: OverlayContainer,
useFactory: () => {
overlayContainerElement = document.createElement('div');
return { getContainerElement: () => overlayContainerElement };
}
}
{
provide: MatDialogRef, useValue: dialogRef
},
{
provide: MAT_DIALOG_DATA,
useValue: {}
}
]
});
TestBed.overrideModule(BrowserDynamicTestingModule, {
set: { entryComponents: [SelectAppsDialogComponent] }
});
TestBed.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DialogSelectAppTestComponent);
component = fixture.componentInstance;
service = TestBed.get(AppsProcessService);
spyOn(service, 'getDeployedApplications').and.returnValue(Observable.of(deployedApps));
});
describe('Dialog', () => {
beforeEach(() => {
fixture.detectChanges();
};
it('should init title and dropdown', () => {
component.startProcesAction();
expect(overlayContainerElement.querySelector('.adf-selet-app-dialog-title')).toBeDefined();
expect(overlayContainerElement.querySelector('.adf-selet-app-dialog-dropdown')).toBeDefined();
});
});
});

View File

@ -0,0 +1,56 @@
/*!
* @license
* Copyright 2016 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppsProcessService, NotificationService, TranslationService } from '@alfresco/adf-core';
import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material';
@Component({
selector: 'adf-select-apps-dialog',
templateUrl: 'select-apps-dialog-component.html'
})
export class SelectAppsDialogComponent {
processApps: any;
selectedProcess: any;
constructor(private appsProcessService: AppsProcessService,
private translateService: TranslationService,
private notificationService: NotificationService,
public dialogRef: MatDialogRef<SelectAppsDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
this.appsProcessService.getDeployedApplications().subscribe(
(apps: any[]) => {
this.processApps = apps.filter((currentApp) => {
return currentApp.id;
});
},
(err) => {
this.translateService.get('TAG.MESSAGES.EXIST').subscribe((error) => {
this.notificationService.openSnackMessage(error, 4000);
});
}
);
}
onStart(): void {
this.dialogRef.close(this.selectedProcess);
}
}

View File

@ -25,7 +25,7 @@
<button mat-menu-item (click)="uploadFile.click()"
id="attach-local-file"
*ngIf="isAllFileSourceSelected()">
From HD
{{ 'FORM.FIELD.LOCALSTORAGE' | translate }}
<mat-icon>file_upload</mat-icon>
<input #uploadFile
class="adf-attach-widget__input-type"
@ -38,18 +38,18 @@
*ngIf="isDefinedSourceFolder()"
id="attach-{{field.params?.fileSource?.name}}"
(click)="openSelectDialogFromFileSource()">
From {{field.params?.fileSource?.name}}
{{field.params?.fileSource?.name}}
<mat-icon>
<img class="adf-attach-widget__image-logo" [src]="alfrescoLogoUrl">
<img class="adf-attach-widget__image-logo" src="../assets/images/alfresco-flower.svg">
</mat-icon>
</button>
<div *ngIf="!isDefinedSourceFolder()">
<button mat-menu-item *ngFor="let repo of repositoryList"
id="attach-{{repo?.name}}"
(click)="openSelectDialog(repo.id, repo.name)">
From {{repo.name}}
{{repo.name}}
<mat-icon>
<img class="adf-attach-widget__image-logo" [src]="alfrescoLogoUrl">
<img class="adf-attach-widget__image-logo" src="../assets/images/alfresco-flower.svg">
</mat-icon>
</button>
</div>

View File

@ -40,11 +40,9 @@ import { Observable } from 'rxjs/Observable';
})
export class AttachFileWidgetComponent extends UploadWidgetComponent implements OnInit {
alfrescoLogoUrl: string = '../assets/images/alfresco-flower.svg';
repositoryList = [];
constructor(
public formService: FormService,
constructor(public formService: FormService,
private logger: LogService,
public thumbnails: ThumbnailService,
public processContentService: ProcessContentService,
@ -69,36 +67,36 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
return !!this.field.params && !!this.field.params.fileSource;
}
isMultipleSourceUpload() {
isMultipleSourceUpload(): boolean {
return !this.field.readOnly && this.isFileSourceConfigured() && !this.isOnlyLocalSourceSelected();
}
isAllFileSourceSelected() {
isAllFileSourceSelected(): boolean {
return this.field.params &&
this.field.params.fileSource &&
this.field.params.fileSource.serviceId === 'all-file-sources';
}
isOnlyLocalSourceSelected() {
isOnlyLocalSourceSelected(): boolean {
return this.field.params &&
this.field.params.fileSource &&
this.field.params.fileSource.serviceId === 'local-file';
}
isSimpleUploadButton() {
isSimpleUploadButton(): boolean {
return this.isUploadButtonVisible() &&
!this.isFileSourceConfigured() ||
this.isOnlyLocalSourceSelected();
!this.isFileSourceConfigured() ||
this.isOnlyLocalSourceSelected();
}
isUploadButtonVisible() {
isUploadButtonVisible(): boolean {
return (!this.hasFile || this.multipleOption) && !this.field.readOnly;
}
isDefinedSourceFolder() {
isDefinedSourceFolder(): boolean {
return !!this.field.params &&
!!this.field.params.fileSource &&
!!this.field.params.fileSource.selectedFolder;
!!this.field.params.fileSource &&
!!this.field.params.fileSource.selectedFolder;
}
openSelectDialogFromFileSource() {
@ -106,7 +104,7 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
if (this.isDefinedSourceFolder()) {
this.contentDialog.openFileBrowseDialogByFolderId(params.fileSource.selectedFolder.pathId).subscribe(
(selections: MinimalNodeEntryEntity[]) => {
this.uploadFileFromShare(selections,
this.uploadFileFromCS(selections,
this.field.params.fileSource.selectedFolder.accountId,
this.field.params.fileSource.selectedFolder.siteId);
});
@ -117,11 +115,11 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
const accountIdentifier = 'alfresco-' + repoId + repoName;
this.contentDialog.openFileBrowseDialogBySite().subscribe(
(selections: MinimalNodeEntryEntity[]) => {
this.uploadFileFromShare(selections, accountIdentifier);
this.uploadFileFromCS(selections, accountIdentifier);
});
}
private uploadFileFromShare(fileNodeList: MinimalNodeEntryEntity[], accountId: string, siteId?: string) {
private uploadFileFromCS(fileNodeList: MinimalNodeEntryEntity[], accountId: string, siteId?: string) {
let filesSaved = [];
Observable.from(fileNodeList)
.mergeMap(node =>
@ -131,7 +129,9 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements
).subscribe((res) => {
filesSaved.push(res);
},
(error) => { this.logger.error(error); },
(error) => {
this.logger.error(error);
},
() => {
this.field.value = filesSaved;
this.field.json.value = filesSaved;

View File

@ -302,5 +302,13 @@
"NEW_TASK": "New Task",
"NEW_PROCESS": "New Process"
}
},
"APP":{
"DIALOG" :{
"START" : "Start",
"TITLE" : "Select a process",
"LIST": "Proces list",
"ERROR" : "Possible connection with process service not present"
}
}
}

View File

@ -17,6 +17,7 @@
</mat-select>
</mat-form-field>
<adf-start-form *ngIf="hasStartForm()"
[data]="values"
[disableStartProcessButton]="!hasProcessName()"
[processDefinitionId]="currentProcessDef.id"
(outcomeClick)="onOutcomeClick($event)"

View File

@ -23,7 +23,7 @@ import {
MatInputModule,
MatSelectModule
} from '@angular/material';
import { FormModule, FormService } from '@alfresco/adf-core';
import { ActivitiContentService, AppConfigService, FormModule, FormService } from '@alfresco/adf-core';
import { Observable } from 'rxjs/Observable';
import { ProcessInstanceVariable } from '../models/process-instance-variable.model';
@ -33,6 +33,8 @@ import { StartProcessInstanceComponent } from './start-process.component';
describe('StartProcessInstanceComponent', () => {
let appConfig: AppConfigService;
let activitiContentService: ActivitiContentService;
let component: StartProcessInstanceComponent;
let fixture: ComponentFixture<StartProcessInstanceComponent>;
let processService: ProcessService;
@ -54,6 +56,7 @@ describe('StartProcessInstanceComponent', () => {
StartProcessInstanceComponent
],
providers: [
ActivitiContentService,
ProcessService,
FormService
]
@ -61,7 +64,8 @@ describe('StartProcessInstanceComponent', () => {
}));
beforeEach(() => {
appConfig = TestBed.get(AppConfigService);
activitiContentService = TestBed.get(ActivitiContentService);
fixture = TestBed.createComponent(StartProcessInstanceComponent);
component = fixture.componentInstance;
processService = fixture.debugElement.injector.get(ProcessService);
@ -70,7 +74,7 @@ describe('StartProcessInstanceComponent', () => {
getDefinitionsSpy = spyOn(processService, 'getProcessDefinitions').and.returnValue(Observable.of(testProcessDefs));
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(Observable.of(newProcess));
getStartFormDefinitionSpy = spyOn(formService, 'getStartFormDefinition').and.returnValue(Observable.of(taskFormMock));
spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(Observable.of({ id: 1234 }));
});
it('should create instance of StartProcessInstanceComponent', () => {
@ -81,7 +85,7 @@ describe('StartProcessInstanceComponent', () => {
it('should call service to fetch process definitions with appId', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalledWith('123');
@ -89,7 +93,7 @@ describe('StartProcessInstanceComponent', () => {
it('should call service to fetch process definitions without appId', () => {
let change = new SimpleChange(null, null, true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalledWith(null);
@ -97,7 +101,7 @@ describe('StartProcessInstanceComponent', () => {
it('should call service to fetch process definitions with appId when provided', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalledWith('123');
@ -105,7 +109,7 @@ describe('StartProcessInstanceComponent', () => {
it('should display the correct number of processes in the select list', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
let selectElement = fixture.nativeElement.querySelector('mat-select');
@ -114,7 +118,7 @@ describe('StartProcessInstanceComponent', () => {
it('should display the option def details', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
component.processDefinitions = testProcessDefs;
fixture.detectChanges();
fixture.whenStable().then(() => {
@ -131,7 +135,7 @@ describe('StartProcessInstanceComponent', () => {
it('should indicate an error to the user if process defs cannot be loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.throw({}));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
@ -144,7 +148,7 @@ describe('StartProcessInstanceComponent', () => {
it('should show no process available message when no process definition is loaded', async(() => {
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of([]));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
fixture.whenStable().then(() => {
@ -156,7 +160,7 @@ describe('StartProcessInstanceComponent', () => {
it('should auto-select process def from dropdown if there is just one process def', () => {
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
component.processDefinitions[0] = testProcessDefRepr;
fixture.detectChanges();
fixture.whenStable().then(() => {
@ -183,17 +187,17 @@ describe('StartProcessInstanceComponent', () => {
}));
it('should reload processes when appId input changed', () => {
component.ngOnChanges({appId: change});
component.ngOnChanges({ appId: change });
expect(getDefinitionsSpy).toHaveBeenCalledWith(456);
});
it('should reload processes when appId input changed to null', () => {
component.ngOnChanges({appId: nullChange});
component.ngOnChanges({ appId: nullChange });
expect(getDefinitionsSpy).toHaveBeenCalledWith(null);
});
it('should get current processDeff', () => {
component.ngOnChanges({appId: change});
component.ngOnChanges({ appId: change });
component.onProcessDefChange('my:Process');
fixture.detectChanges();
expect(getDefinitionsSpy).toHaveBeenCalled();
@ -206,7 +210,7 @@ describe('StartProcessInstanceComponent', () => {
beforeEach(() => {
component.name = 'My new process';
let change = new SimpleChange(null, 123, true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
});
it('should call service to start process if required fields provided', async(() => {
@ -261,7 +265,7 @@ describe('StartProcessInstanceComponent', () => {
it('should throw error event when process cannot be started', async(() => {
let errorSpy = spyOn(component.error, 'error');
let error = {message: 'My error'};
let error = { message: 'My error' };
startProcessSpy = startProcessSpy.and.returnValue(Observable.throw(error));
component.onProcessDefChange('my:process1');
component.startProcess();
@ -331,7 +335,7 @@ describe('StartProcessInstanceComponent', () => {
beforeEach(async(() => {
component.name = 'My new process';
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
fixture.detectChanges();
}));
@ -374,7 +378,7 @@ describe('StartProcessInstanceComponent', () => {
beforeEach(() => {
getDefinitionsSpy.and.returnValue(Observable.of(testProcessDefWithForm));
let change = new SimpleChange(null, '123', true);
component.ngOnChanges({'appId': change});
component.ngOnChanges({ 'appId': change });
component.onProcessDefChange('my:process1');
fixture.detectChanges();
fixture.whenStable();
@ -397,7 +401,7 @@ describe('StartProcessInstanceComponent', () => {
}));
it('should emit cancel event on cancel Button', () => {
let cancelButton = fixture.nativeElement.querySelector('#cancle_process');
let cancelButton = fixture.nativeElement.querySelector('#cancle_process');
let cancelSpy: jasmine.Spy = spyOn(component.cancel, 'emit');
cancelButton.click();
fixture.detectChanges();
@ -405,6 +409,35 @@ describe('StartProcessInstanceComponent', () => {
});
});
describe('CS content connection', () => {
fit('alfrescoRepositoryName default configuration property', () => {
expect(component.getAlfrescoRepositoryName()).toBe('alfresco-1Alfresco');
});
fit('alfrescoRepositoryName configuration property should be fetched', () => {
appConfig.config = Object.assign(appConfig.config, {
'alfrescoRepositoryName': 'alfresco-123'
};
expect(component.getAlfrescoRepositoryName()).toBe('alfresco-123Alfresco');
});
fit('if values in input is a node should be linked in the process service', () => {
component.values = {};
component.values['file'] = {
isFile: true,
name= 'example-file'
};
component.moveNodeFromCStoPS();
fixture.whenStable().then(() => {
expect(component.values.file[0].id).toBe(1234);
});
});
});
});
});

View File

@ -15,8 +15,23 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild, ViewEncapsulation } from '@angular/core';
import { StartFormComponent, FormRenderingService } from '@alfresco/adf-core';
import {
Component,
EventEmitter,
Input,
OnChanges,
Output,
SimpleChanges,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import {
ActivitiContentService,
AppConfigService,
StartFormComponent,
FormRenderingService,
FormValues
} from '@alfresco/adf-core';
import { ProcessInstanceVariable } from '../models/process-instance-variable.model';
import { ProcessDefinitionRepresentation } from './../models/process-definition.model';
import { ProcessInstance } from './../models/process-instance.model';
@ -37,6 +52,12 @@ export class StartProcessInstanceComponent implements OnChanges {
@Input()
variables: ProcessInstanceVariable[];
@Input()
values: FormValues;
@Input()
name: string;
@Output()
start: EventEmitter<ProcessInstance> = new EventEmitter<ProcessInstance>();
@ -51,19 +72,23 @@ export class StartProcessInstanceComponent implements OnChanges {
processDefinitions: ProcessDefinitionRepresentation[] = [];
name: string;
currentProcessDef: ProcessDefinitionRepresentation = new ProcessDefinitionRepresentation();
errorMessageId: string = '';
constructor(private activitiProcess: ProcessService,
private formRenderingService: FormRenderingService) {
private formRenderingService: FormRenderingService,
private activitiContentService: ActivitiContentService,
private appConfig: AppConfigService) {
this.formRenderingService.setComponentTypeResolver('upload', () => AttachFileWidgetComponent, true);
this.formRenderingService.setComponentTypeResolver('select-folder', () => AttachFolderWidgetComponent, true);
}
ngOnChanges(changes: SimpleChanges) {
if (changes['values'] && changes['values'].currentValue) {
this.moveNodeFromCStoPS();
}
let appIdChange = changes['appId'];
let appId = appIdChange ? appIdChange.currentValue : null;
this.load(appId);
@ -82,6 +107,30 @@ export class StartProcessInstanceComponent implements OnChanges {
);
}
getAlfrescoRepositoryName(): string {
let alfrescoRepositoryName = this.appConfig.get<string>('alfrescoRepositoryName');
if (!alfrescoRepositoryName) {
alfrescoRepositoryName = 'alfresco-1';
}
return alfrescoRepositoryName + 'Alfresco';
}
moveNodeFromCStoPS() {
let accountIdentifier = this.getAlfrescoRepositoryName();
for (let key in this.values) {
if (this.values.hasOwnProperty(key)) {
let currentValue = this.values[key];
if (currentValue.isFile) {
this.activitiContentService.applyAlfrescoNode(currentValue, null, accountIdentifier).subscribe((res) => {
this.values[key] = [res];
});
}
}
}
}
public startProcess(outcome?: string) {
if (this.currentProcessDef.id && this.name) {
this.resetErrorMessage();
@ -121,7 +170,7 @@ export class StartProcessInstanceComponent implements OnChanges {
this.cancel.emit();
}
hasStartForm() {
hasStartForm(): boolean {
return this.currentProcessDef && this.currentProcessDef.hasStartForm;
}
@ -129,7 +178,7 @@ export class StartProcessInstanceComponent implements OnChanges {
return this.processDefinitions ? (this.processDefinitions.length > 0 || this.errorMessageId) : this.errorMessageId;
}
isStartFormMissingOrValid() {
isStartFormMissingOrValid(): boolean {
if (this.startForm) {
return this.startForm.form && this.startForm.form.isValid;
} else {
@ -137,7 +186,7 @@ export class StartProcessInstanceComponent implements OnChanges {
}
}
validateForm() {
validateForm(): boolean {
return this.currentProcessDef.id && this.name && this.isStartFormMissingOrValid();
}
@ -149,7 +198,7 @@ export class StartProcessInstanceComponent implements OnChanges {
this.errorMessageId = '';
}
hasErrorMessage() {
hasErrorMessage(): boolean {
return this.processDefinitions.length === 0 && !this.errorMessageId;
}

View File

@ -15,7 +15,7 @@
* limitations under the License.
*/
import { AlfrescoApiService } from '@alfresco/adf-core';
import { AlfrescoApiService, FormValues } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { TaskDetailsModel } from '../../task-list';
@ -98,7 +98,7 @@ export class ProcessService {
.catch(err => this.handleProcessError(err));
}
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: any, variables?: ProcessInstanceVariable[]): Observable<ProcessInstance> {
startProcess(processDefinitionId: string, name: string, outcome?: string, startFormValues?: FormValues, variables?: ProcessInstanceVariable[]): Observable<ProcessInstance> {
let startRequest: any = {
name: name,
processDefinitionId: processDefinitionId