Module: alfresco/upload/UploadMonitor

alfresco/upload/UploadMonitor

This module provides display handling for file uploads. It's normally only used by the UploadService.
Since:
  • 1.0.50
Author:
  • Martin Doyle
License:
Source:

Extends

  • alfresco/upload/_UploadsDisplayMixin

Mixes In

  • alfresco/core/FileSizeMixin

Members

_uploads :object

A map of all uploads.
Type:
  • object
Default Value:
  • null
Source:

<readonly> baseClass :string

The constant representing the base BEM CSS class for this widget.
Type:
  • string
Default Value:
  • "alfresco-upload-UploadMonitor"
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/UploadMonitor.css"}]
Source:

displayUploadPercentage :boolean

Whether to display the upload percentage against each item.
Type:
  • boolean
Default Value:
  • true
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/UploadMonitor.properties"}]
Source:

maxUploadNameLength :number

The maximum length of the upload name (in characters) after which it will be truncated.
Type:
  • number
Default Value:
  • 50
Source:

reverseChars :String[]

The characters which should swap when the text is reversed.
Type:
  • String[]
Since:
  • 1.0.79
Default Value:
  • ["[]", "{}", "<>", "()"]
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

useEllipsisForLongFilenames :boolean

If set to true, this will override the [maxUploadNameLength property]{@see module:alfresco/upload/UploadMonitor#maxUploadNameLength} and any long filenames will instead be truncated instead by the available space, with an ellipsis used at the end of the string to denote any missing characters.
Type:
  • boolean
Since:
  • 1.0.66
Default Value:
  • true
Source:

widgetsForErrorIcon :object[]

This defines the widget model for rendering an error icon. This is expected to be a single SVGImage but is made configurable in order to support customization of dimensions and the image rendered. If a radically different widget model is provided then it may be necessary to use an extension of this widget with an extension to the handleFailedUpload function.
Type:
  • object[]
Since:
  • 1.0.58
Source:

widgetsForInProgressActions :object[]

This collection of PublishAction widgets will be displayed against each inprogress item in the upload monitor. The upload item (containing relevant information) will be added as the current item, and the publishPayloadType will default to PayloadTypes.CURRENT_ITEM, if not specified. In effect, this means that you should normally only need to specify the publishTopic and iconClass in the PublishAction config.

The currentItem that's provided to the supplied action is an object with five properties. Specifically, three simple properties of fileId, fileSize (bytes) and fileName and two additional complex properties of fileObj (which is all the details of the upload object) and response (which is the server response - valid for finished uploads only).

Type:
  • object[]
Since:
  • 1.0.56
Source:

widgetsForSuccessfulActions :object[]

PublishActions for displaying against successful items. For more information on how to use this, see widgetsForInProgressActions.
Type:
  • object[]
Since:
  • 1.0.56
Default Value:
  • null
Source:

widgetsForUnsuccessfulActions :object[]

PublishActions for displaying against unsuccessful items. For more information on how to use this, see widgetsForInProgressActions.
Type:
  • object[]
Since:
  • 1.0.56
Default Value:
  • null
Source:

Methods

addActions(actionPayload, actionsNode)

Create the actions widgets, ensure that the default publishPayloadType is set to CURRENT_ITEM, and set the current item to be the supplied upload info.
Parameters:
Name Type Description
actionPayload object The upload information to be used in the action payload
actionsNode object The node in which to place the actions
Since:
  • 1.0.56
Source:

addFailedFile(fileName, error)

This function handles displaying a file that could not be uploaded (where the failure was identified before any attempt was made to start uploading the file).
Parameters:
Name Type Description
fileName string The name of the file that could not be uploaded
error object The details of why the file could not be uploaded.
Source:

addInProgressFile(fileId)

This function handles displaying a file that an attempt will be made to upload. The updateUploadProgress function will handle updating the upload progress.
Parameters:
Name Type Description
fileId string The unique id of the file
Source:

constructor()

Constructor
Source:

getDisplayText(file, doNotModify) → {string}

Create the display name of the upload, including the file size
Parameters:
Name Type Argument Default Description
file object The upload file
doNotModify boolean <optional>
false If true then will prevent any post-modification of the display text
Source:
Returns:
The name of the upload to be deisplayed
Type
string

handleCompletedUpload(fileId, completionEvt, request)

This function handles the successful completion of a file upload. By default it moves the displayed file from the "In progress" section to the "Completed" section.
Parameters:
Name Type Description
fileId string The unique id of the file
completionEvt object The upload completions event
request object The request object used to attempt to upload the file
Source:

handleFailedUpload(fileId, completionEvt, request)

This function handles the failure to upload a file. By default it moves the displayed file from the "In Progress" section to the "Failed" section.
Parameters:
Name Type Description
fileId string The unique id of the file
completionEvt object The upload completions event
request object The request object used to attempt to upload the file
Source:

handleModifyItem(payload)

Handle modification requests for a specific item
Parameters:
Name Type Description
payload Object The published payload
Since:
  • 1.0.65
Source:

postCreate()

Run after the widget has been created.
Since:
  • 1.0.65
Source:
Listens to Events:

reset()

Resets the display.
Source:

reverseDirectionalChars(nextChar) → {String}

Reverse any directional characters (e.g. brackets)
Parameters:
Name Type Description
nextChar String The next character to be checked
Since:
  • 1.0.79
Source:
Returns:
The replaced or original character
Type
String

setupReverseChars()

Setup the reverse-chars code lookup array (one-time run)
Since:
  • 1.0.79
Source:

updateAggregateProgress(aggregateProgress)

Displays the overall upload progress of all the files.
Parameters:
Name Type Description
aggregateProgress number The aggregate progress as a decimal of 1.
Source:

updateUploadProgress(fileId, percentageComplete)

Updates the displayed progress for an individual file upload.
Parameters:
Name Type Description
fileId string The unique id of the file
percentageComplete number The current upload progress as a percentage
Source: