Skip to Content
OWL data_display

File Upload Progress Bar

Odoo 19 OWL component — File Upload Progress Bar (core)

Live preview Interactive
Source excerpt web/static/src/core/file_upload/file_upload_progress_bar.js
import { _t } from "@web/core/l10n/translation";
import { useService } from "../utils/hooks";
import { ConfirmationDialog } from "../confirmation_dialog/confirmation_dialog";

import { Component } from "@odoo/owl";

export class FileUploadProgressBar extends Component {
    static template = "web.FileUploadProgressBar";
    static props = {
        fileUpload: { type: Object },
    };

    setup() {
        this.dialogService = useService("dialog");
    }

    onCancel() {
        if (!this.props.fileUpload.xhr) {
            return;
        }
        this.dialogService.add(ConfirmationDialog, {
            body: _t("Do you really want to cancel the upload of %s?", this.props.fileUpload.title),
            confirm: () => {
                this.props.fileUpload.xhr.abort();
            },
        });
    }
}
Registry / API
Registry name
FileUploadProgressBar
Category
Module
web
Slug
file-upload-progress-bar
Nav group
data_display