imports/vx/client/code/vxapp.js
/**
     * Client-side support for uploading a file.
     *
     * @param {string} uploadType Upload type.
     * @param {object} currentUpload Current upload reactive variable.
     * @param {object} file HTML file instance.
     * @param {object} uploadParameters Optional upload parameters object.
     */
Client-side support for uploading a file.
@param {string} uploadType Upload type.
@param {object} currentUpload Current upload reactive variable.
@param {object} file HTML file instance.
@param {object} uploadParameters Optional upload parameters object.
Client - side support for uploading a file . @param { string } uploadType Upload type . @param { object } currentUpload Current upload reactive variable . @param { object } file HTML file instance . @param { object } uploadParameters Optional upload parameters object .
uploadFile(uploadType, currentUpload, file, uploadParameters) {
        try {
            OLog.debug("vxapp.js uploadFile *fire*")
            if (!file) {
                OLog.error("vxapp.js uploadFile *error* no file input was supplied")
                return
            }
            Meteor.call("initUploadStats", uploadType, file.name, file.size, (error, result) => {
                if (!result.success) {
                    UX.createNotificationForResult(result)
                    VXApp.setUploadStatus(uploadType, "CLEARED")
                    return
                }
                Meteor.call("createImportEvent", "LIST_IMPORT_START", uploadType, (error, result) => {
                    if (!result.success) {
                        UX.createNotificationForResult(result)
                        VXApp.setUploadStatus(uploadType, "CLEARED")
                        return
                    }
                    VXApp.uploadTransmit(uploadType, currentUpload, uploadParameters, file)
                })
            })
        }
        catch (error) {
            OLog.error(`vxapp.js uploadFile unexpected error=${error}`)
            UX.createNotificationForResult({ success: false, icon: "BUG", key: "common.alert_unexpected_error",
                variables: { error: error.toString() } })
            VXApp.setUploadStatus(uploadType, "CLEARED")
        }
    }
uploadFile ( uploadType , currentUpload , file , uploadParameters ) { try { OLog . debug ( "vxapp.js uploadFile *fire*" ) if ( ! file ) { OLog . error ( "vxapp.js uploadFile *error* no file input was supplied" ) return } Meteor . call ( "initUploadStats" , uploadType , file . name , file . size , ( error , result ) => { if ( ! result . success ) { UX . createNotificationForResult ( result ) VXApp . setUploadStatus ( uploadType , "CLEARED" ) return } Meteor . call ( "createImportEvent" , "LIST_IMPORT_START" , uploadType , ( error , result ) => { if ( ! result . success ) { UX . createNotificationForResult ( result ) VXApp . setUploadStatus ( uploadType , "CLEARED" ) return } VXApp . uploadTransmit ( uploadType , currentUpload , uploadParameters , file ) } ) } ) } catch ( error ) { OLog . error ( ` ${ error } ` ) UX . createNotificationForResult ( { success : false , icon : "BUG" , key : "common.alert_unexpected_error" , variables : { error : error . toString ( ) } } ) VXApp . setUploadStatus ( uploadType , "CLEARED" ) } }
Client-side support for uploading a file.
Client - side support for uploading a file .