Optional Uploader Settings

There are a number of additional options that can be modified in the initial osmos.configure function call to customize the uploader further. Below is a configured sample Osmos Uploader with a single field:

  Osmos.configure({
    schema: {
      fields: [
        {
          name: "Sample Field",
          displayName: "Sample Field",
          description: "<a sample of a field>"
        },
      ],
    },
    token: "123abc",
    uploadDescription: "<Sample Uploader",
    // Set to false to show the schema for the destination connector in the uploader on the file upload screen.
    hideUploadSchema: true,
  
    // Set to false to show the uploader description on the file upload screen.
    hideUploadDescription: true,
  
    // Set to false to show the advanced version of the uploader, with formulas, SmartFill, and QuickFixes.
    disableAdvancedMode: true,
  
    // Maximum number of records displayed in the Uploader UI (User Interface).
    // This value is capped at 100,000 and higher values will default back to 100,000.
    // Can be lowered to increase UI performance when using expensive validators.
    // NOTE: Your file can have >100,000 rows and will be processed fully. There are no limits to how many records can be uploaded.
    // This setting only limits the number of rows displayed in the UI.
    maxRecords: 100000,
  
    // Set to true to hide the preview pane screen for CSV files in the uploader.
    hideCSVPreviewPane: false,
  
    // This function determines whether to show an "upload complete" Callback when the user upload has been completed.
    completionHandler: async () => {},
  
    // Set autoMapEnabled to false to disable automatic field mapping on new uploads.
    autoMapEnabled: true,
  
    // Set autoRecallEnabled to false to disable automatic field mapping and transformations based on previous uploads.
    autoRecallEnabled: true,
  
    // Set allowSubmissionWithErrors to true to allow uploads which contain errors.
    // Note that only rows which do not contain errors will be written to the destination.
    allowSubmissionWithErrors: false,
  
    // Set storeTransformsForRecall to false in order to prevent new mappings and transformations from being recalled in future uploads.
    storeTransformsForRecall: true,

  });

Adding Uploader Description text: uploadDescription: A standard output of the HTML snippet which must be configured. This function shows a description of the Uploader to a user.

The description will also appear on the column mapping.

Show/Hide Upload Description: hideUploadDescription: A standard output of the HTML snippet which defaults to true. This function determines whether to show the destination description when the user is uploading their file.

Show/Hide Upload Schema:hideUploadSchema: A standard output of the HTML snippet which defaults to true. This function will be called when the user closes the Uploader. It will be called with the following arguments:

  • originalFileUrl - string | undefined, the URL the submitted file was uploaded to or undefined if they closed the uploader before submitting

  • reachedTransformStep - boolean, whether the user reached the transform step

  • successfullySubmittedData - boolean, whether the user's data was successfully submitted or not

  • numRecordsSubmitted - number, the number of records submitted

  • skippedRowNumbers - number[], the indices of rows from the original file that were manually skipped by the user

Turn On/Off Advanced Mode Uploader: disableAdvancedMode: Disables Advanced Mode. true by default.

Changing how many rows of data to show in the Uploader: maxRecords: Not a standard output of the HTML snippet. This function defines the maximum amount of records or rows to display and validate. This defaults to 100_000. This also limits the amount of records that will be sent to validation webhooks. Setting a lower limit can be useful if your users are encountering performance issues when uploading large files or if your validation webhooks fail with large payloads.

Turn On/Off PreviewPane when Uploading CSV Files: hideCSVPreviewPane: A standard output of the HTML snippet which defaults to false. This function determines whether to show the preview pane when the user is uploading a CSV File.

Turn On/Off Callback: completionHandler: Not a standard output of the HTML snippet. This function determines whether to show an "upload complete" Callback when the user upload has been completed.

Enabling/Disabling Recall + Auto-Mapping: After loading, the uploader attempts to automatically map fields and apply some transforms based on heuristics and previously seen files. While this behavior is usually useful to speed up mapping and ease the upload process, there some scenarios where it is undesired.

  • Set autoMapEnabled to false to disable automatic field mapping based on heuristics

  • Set autoRecallEnabled to false to disable automatic population of transforms based on previous uploads

Enabling Submission with Errors: In some cases, it can be beneficial to allow submitting uploads even if there are errors. To enable this, set the allowSubmissionWithErrors option to true.

Disabling Transform Recall Storage: By default, Osmos stores all data transformations (mappings, formulas, QuickFixes, etc.) submitted to uploaders for recall. Recall is the process by which transforms are auto-populated when the uploader is first opened during subsequent uploads.

If you want to disable this functionality and prevent the transforms for uploads to be saved for recall, you can set the storeTransformsForRecall option to false.

For more information on Callback functionality, please see Notifications: Callback

Last updated