[ADF-2557] Updated docs with new props script (#3149)

* [ADF-2557] Updated docs for services with new props script

* [ADF-2557] Updated service docs with new props script
This commit is contained in:
Andy Stark
2018-04-08 16:23:04 +01:00
committed by Eugenio Romano
parent 8769c257f8
commit 1d517d3a8a
27 changed files with 612 additions and 299 deletions

View File

@@ -1,57 +1,66 @@
---
Added: v2.0.0
Status: Active
Last reviewed: 2018-04-05
---
# Upload Service
Provides access to various APIs related to file upload features.
## Methods
## Class members
- `isUploading(): boolean`
Checks whether the service is uploading a file.
### Methods
- `getQueue(): FileModel[]`
Returns the file Queue
- `addToQueue(files: FileModel[]): FileModel[]`
Adds files to the uploading queue to be uploaded
- `files` - One or more separate parameters or an array of files to queue
- `uploadFilesInTheQueue(emitter: EventEmitter<any>)`
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
- `emitter` - (Deprecated) Emitter to invoke on file status change
- `cancelUpload(files: FileModel[])`
Cancels uploading of files.
- `files` - One or more separate parameters or an array of files
- `clearQueue()`
Clears the upload queue
- `getUploadPromise(file: FileModel): any`
Gets an upload promise for a file.
- `file` - The target file
- `addToQueue(files: FileModel[] = null): FileModel[]`<br/>
Adds files to the uploading queue to be uploaded
- `files: FileModel[] = null` - One or more separate parameters or an array of files to queue
- **Returns** `FileModel[]` - Array of files that were not blocked from upload by the ignore list
- `cancelUpload(files: FileModel[] = null)`<br/>
Cancels uploading of files.
- `files: FileModel[] = null` - One or more separate parameters or an array of files specifying uploads to cancel
- `clearQueue()`<br/>
Clears the upload queue
- `getQueue(): FileModel[]`<br/>
Gets the file Queue
- **Returns** `FileModel[]` - Array of files that form the queue
- `getUploadPromise(file: FileModel = null): any`<br/>
Gets an upload promise for a file.
- `file: FileModel = null` - The target file
- **Returns** `any` - Promise that is resolved if the upload is successful or error otherwise
- `isUploading(): boolean`<br/>
Checks whether the service is uploading a file.
- **Returns** `boolean` - True if a file is uploading, false otherwise
- `uploadFilesInTheQueue(emitter: EventEmitter<any> = null)`<br/>
Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.
- `emitter: EventEmitter<any> = null` - (Deprecated) Emitter to invoke on file status change
## Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| queueChanged | FileModel\[] | Raised every time the file queue changes. |
| fileUpload | FileUploadEvent | Raised every time a File model changes its state. |
| fileUploadStarting | FileUploadEvent | Raised when upload starts. |
| fileUploadCancelled | FileUploadEvent | Raised when upload gets cancelled by user. |
| fileUploadProgress | FileUploadEvent | Raised during file upload process and contains the current progress for the particular File model. |
| fileUploadAborted | FileUploadEvent | Raised when file upload gets aborted by the server. |
| fileUploadError | FileUploadEvent | Raised when an error occurs to file upload. |
| fileUploadComplete | FileUploadCompleteEvent | Raised when file upload is complete. |
| fileUploadDelete | FileUploadDeleteEvent | Raised when uploaded file is removed from server. |
| queueChanged | FileModel\[] | Emitted when the file queue changes. |
| fileUpload | FileUploadEvent | Emitted when a File model changes its state. |
| fileUploadStarting | FileUploadEvent | Emitted when an upload starts. |
| fileUploadCancelled | FileUploadEvent | Emitted when an upload gets cancelled by the user. |
| fileUploadProgress | FileUploadEvent | Emitted during the file upload process and contains the current progress for a particular File model. |
| fileUploadAborted | FileUploadEvent | Emitted when a file upload gets aborted by the server. |
| fileUploadError | FileUploadEvent | Emitted when an error occurs during a file upload. |
| fileUploadComplete | FileUploadCompleteEvent | Emitted when a file upload is complete. |
| fileUploadDelete | FileUploadDeleteEvent | Emitted when an uploaded file is removed from server. |
| fileDeleted | string | This can be invoked when a file is deleted from an external source to upload the file dialog status. |
## Details
### Ignore list configuration
Is possible add an ignore list for files that you don't want to allow upload on your CS.
The configuration of this service is saved in the **_app.config.json file_**.If you want more details about the configuration service follow this [link](https://github.com/Alfresco/alfresco-ng2-components/tree/master/ng2-components/ng2-alfresco-core#appconfigservice).
In the example below you can see how filtered out the : '.git', '.DS_Store' and 'desktop.ini'. **Every element is a glob pattern string.** So, if you want to exclude all the txt files, you can add the "\*.txt". (notice the asterisk at the beginning of the pattern!)
You can add an ignore list for files that you don't want to be uploaded on your CS.
The configuration of this service is saved in the `app.config.json` file
(see the [App Config service](app-config.service.md) for more information).
The example below shows how to filter out the : '.git', '.DS_Store' and 'desktop.ini' files.
Each element of the ignore list is a glob pattern string, so you could exclude all the `.txt`
files, for example, by adding a `*.txt` pattern to the list.
**app.config.json**
@@ -68,7 +77,5 @@ In the example below you can see how filtered out the : '.git', '.DS_Store' and
}
```
Note:
- Standard glob patterns work.
- You can end patterns with a forward slash / to specify a directory.
Note that all standard glob patterns work and you can end patterns with a forward
slash `/` character to specify a directory.