Skip to content

Commit

Permalink
[ADF-2055] Ability to pre-populate form with a file and values (#2834)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
eromano committed Jan 17, 2018
1 parent 244234d commit b1fd6cb
Show file tree
Hide file tree
Showing 48 changed files with 789 additions and 344 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion demo-shell/package.json
Expand Up @@ -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",
Expand Down
9 changes: 7 additions & 2 deletions demo-shell/resources/i18n/en.json
Expand Up @@ -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",
Expand Down Expand Up @@ -50,7 +54,8 @@
"DOWNLOAD": "Download",
"COPY": "Copy",
"MOVE": "Move",
"DELETE": "Delete"
"DELETE": "Delete",
"PROCESS_ACTION": "Start Process"
}
}
},
Expand Down
16 changes: 16 additions & 0 deletions demo-shell/src/app/components/files/files.component.html
Expand Up @@ -191,6 +191,7 @@
format="timeAgo"
class="desktop-only">
</data-column>

</data-columns>

<content-actions>
Expand Down Expand Up @@ -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
Expand All @@ -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">
Expand Down Expand Up @@ -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>
Expand Down
29 changes: 25 additions & 4 deletions demo-shell/src/app/components/files/files.component.ts
Expand Up @@ -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';

Expand Down Expand Up @@ -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';

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
@@ -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>
47 changes: 24 additions & 23 deletions docs/README.md
Expand Up @@ -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

Expand Down Expand Up @@ -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) |
Expand Down
Binary file added docs/docassets/images/select-apps-dialog.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docassets/images/start_process.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/select-apps-dialog-component.md
@@ -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;
});
}

```

0 comments on commit b1fd6cb

Please sign in to comment.