Maurizio Vitale 1fa81962a0
👽 Angular 14 rebase 👽 (#7769)
* fix after rebase

* new release strategy for ng next

Signed-off-by: eromano <eugenioromano16@gmail.com>

* peer dep

Signed-off-by: eromano <eugenioromano16@gmail.com>

* Angular 14

fix unit test and storybook

Signed-off-by: eromano <eugenioromano16@gmail.com>

fix after rebase

Signed-off-by: eromano <eugenioromano16@gmail.com>

update pkg.json

Signed-off-by: eromano <eugenioromano16@gmail.com>

missing dep

Signed-off-by: eromano <eugenioromano16@gmail.com>

Fix mistake and missing code

Dream....build only affected libs

Add utility run commands

* Use nx command to run affected tests

* Fix nx test core

fix content tests

Run unit with watch false

core test fixes

reduce test warnings

Fix process cloud unit

Fix adf unit test

Fix lint process cloud

Disable lint next line

Use right core path

Fix insights unit

fix linting insights

Fix process-services unit

fix the extensions test report

fix test warnings

Fix content unit

Fix bunch of content unit

* Produce an adf alpha of 14

* hopefully fixing the content

* Push back the npm publish

* Remove flaky unit

* Fix linting

* Make the branch as root

* Get rid of angualar13

* Remove the travis depth

* Fixing version for npm

* Enabling cache for unit and build

* Fix scss for core and paths

Copy i18 and asset by using ng-packager

Export the theming alias and fix path

Use ng-package to copy assets process-services-cloud

Use ng-package to copy assets process-services

Use ng-package to copy assets content-services

Use ng-package to copy assets insights

* feat: fix api secondary entry point

* fix storybook rebase

* Move dist under dist/libs from lib/dist

* Fix the webstyle

* Use only necessary nrwl deps and improve lint

* Fix unit for libs

* Convert lint.sh to targets - improve performance

* Use latest of angular

* Align alfresco-js-api

Signed-off-by: eromano <eugenioromano16@gmail.com>
Co-authored-by: eromano <eugenioromano16@gmail.com>
Co-authored-by: Mikolaj Serwicki <mikolaj.serwicki@hyland.com>
Co-authored-by: Tomasz <tomasz.gnyp@hyland.com>
2022-08-25 10:50:30 +01:00

6.9 KiB

Title, Added, Status, Last reviewed
Title Added Status Last reviewed
Upload Service v2.0.0 Active 2019-01-16

Upload Service

Provides access to various APIs related to file upload features.

Class members

Methods

  • addToQueue(files: FileModel[]): FileModel[]
    Adds files to the uploading queue to be uploaded

    • files: FileModel[] - 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[])
    Cancels uploading of files. If the file is smaller than 1 MB the file will be uploaded and then the node deleted to prevent having files that were aborted but still uploaded.

    • files: FileModel[] - One or more separate parameters or an array of files specifying uploads to cancel
  • clearCache()

  • clearQueue()
    Clears the upload queue

  • getQueue(): FileModel[]
    Gets the file Queue

    • Returns FileModel[] - Array of files that form the queue
  • getThreadsCount(): number
    Returns the number of concurrent threads for uploading.

    • Returns number - Number of concurrent threads (default 1)
  • getUploadPromise(file: FileModel): any
    Gets an upload promise for a file.

    • file: FileModel - The target file
    • Returns any - Promise that is resolved if the upload is successful or error otherwise
  • isUploading(): boolean
    Checks whether the service still has files uploading or awaiting upload.

    • Returns boolean - True if files in the queue are still uploading, false otherwise
  • uploadFilesInTheQueue(successEmitter?: EventEmitter<any>, errorEmitter?: EventEmitter<any>)
    Finds all the files in the queue that are not yet uploaded and uploads them into the directory folder.

    • successEmitter: EventEmitter<any> - (Optional) Emitter to invoke on file success status change
    • errorEmitter: EventEmitter<any> - (Optional) Emitter to invoke on file error status change

Events

Name Type Description
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

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 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. You can also specify some more options about how to perform the check via the match-options parameter.

In the example below, we have added the nocase option (ie, ignore case when performing the glob match), so *.TXT will also match .txt, etc. For more information about the options available please check the documentation for the minimatch node module.

app.config.json

{
    "ecmHost": "http://localhost:3000/ecm",
    "bpmHost": "http://localhost:3000/bpm",
    "application": {
        "name": "Alfresco"
    },
    "files": {
          "excluded": [".DS_Store", "desktop.ini", ".git", "*.txt"],
          "match-options": {
            "nocase": true
          }
    }
}

From version 3.8.0 it is also possible to filter out the folders:

app.config.json

{
    "ecmHost": "http://localhost:3000/ecm",
    "bpmHost": "http://localhost:3000/bpm",
    "application": {
        "name": "Alfresco"
    },
    "folders": {
          "excluded": [".git"],
          "match-options": {
            "nocase": true
          }
    }
}

In this way all the files present in the .git folder won't be uploaded.

Please note that the filtering options available for the folders is the same as the one for the files.

Toggling Versioning Support

It is also possible to provide the versioningEnabled value as part of the FileUploadOptions when using upload service from the code.

Note: When creating a new node using multipart/form-data by default versioning is enabled and set to MAJOR Version. Since Alfresco 6.2.3 versioningEnabled flag was introduced offering better control over the new node Versioning.

Concurrent Uploads

By default, the Upload Service processes one file at a time. You can increase the number of concurrent threads by changing the upload.threads configuration parameter:

app.config.json

{
    "upload": {
        "threads": 2
    }
}