Warning

Beta version This feature is currently in beta. It may change in a future version without prior notice. See the Beta Features page for the full list of beta features and their planned release. If you’re using this feature, we encourage you to share your feedback to help with the evaluation process.

Attachment

Attachment Capabilities

Capability

Support

Comment

Attach one or multiple files into an alarm

Supported feature

See Alarms

Attach one or multiple files into a collection

Supported feature

See Collections

Limit the size of files

Supported feature

See Limitations

Limit the authorized types of files

Supported feature

See Limitations

Retrieve attachments for PDF reports

Supported feature

See Including attachments from osp-storage

Examples

Concept

Attachments are files that can be uploaded and attached to either an alarm or a collection entry. They can then be visualize and retrieved from any front-end widget that can display alarms/collections.

These attachments are uploaded and downloaded through the osp-storage module.

Alarms

Currently, files can be attached to an alarm in two different ways:

  • Journal: a journal entry of an alarm can contain attachments. Therefore, you can attach file to an alarm through the alarm journal. The input/edit component of the journal allow to upload files if the journal is configured with a set uploadId. Look at journal columns options on view.web for more information on how to configure this.

  • Additional data: attachments are represented by a string identifier. You can use the additional data of an alarm to store those identifiers and then display them using an ATTACHMENT as the column render. This allow to display the list of attachments on a table. Look at Attachment render on view.web for more information on how to configure this. To upload files and set the additional data with them, you can use menus prompt as demonstrated on Use menus to upload file as attachments on alarms.

Both of these options allow to visualize the attachments through the Alarm Table widget.

Collections

As of the nature of collections, the data structure of a collection entry is freely defined by a schema. With attachments represented as string identifiers, you need to define a property on your schema that is either a string (one attachment) or a list of strings (many attachments).

Then, you can use the Attachment and the Attachments list / grid components on a form to upload/handle files and transform them into attachments that will be attached to your collection entry.

Similarly to alarms, you can display them as well as a table column. Look at Attachment render on schema.web for more information on how to configure this.

Limitations

Some limitations can be defined to either accept or refuse the upload of a file.

First, the upload is done through the osp-front-end. Requests are transmitted through a proxy that limit the maximum size of the payload content, which could result in an 413 HTTP error if the file you attempt to is too large. This can be configured through the osp-front-end environment variables.

In addition to this limit, size limits can also be fine-tuned for specific needs. Every upload / download of an attachment is done with an upload.ospp configuration who can define two options:

  • authorizedContentTypes: Allow to define which type of files can be uploaded through this configuration. Content type must be specified as a MIME type (e.g. image/png, application/pdf)

  • maxSize: Defines a maximum authorized size for files uploaded through this configuration. This is closely related to the osp-front-end proxy configuration. If the proxy doesn’t allow more than a certain size, setting here a higher number won’t bypass the restriction from the proxy.