ASP.NET: Please wait ...

Waiting for a not too long process to finish

I am told to add an option to a drop down list that will iterate through a dynamic list of stored procedures and execute those stored procedures from the internal ASP.NET website.

I have been assured this process will take less than 15 seconds. The end user sponsor of this change request agrees that not being able to do anything on the site during this time is acceptable.

In a previous job, before the creation of Hangfire, I created a Windows Service that fired off jobs using Quarts.net and would read entries in a table to do various tasks initiated by end users on an internal Windows Form application.

I found Waiting Spinner. The link to the source they used has changed. It can be found here.

The existing website already overrode the OnClick event in ASPX page and dealt with ASP.NET renaming the controls. See here for background.

The only issue I had to change in the code from spin.js.org was in the spin.js. The way they defined a class was not working for me.

I had to change it to below.

It looks good and we will see if it passes User Acceptance Testing.

class Spinner {
    constructor (opts) {
        if (opts === void 0) { opts = {}; }
        this.opts = __assign(__assign({}, defaults), opts);
    }
    /**
     * Adds the spinner to the given target element. If this instance is already
     * spinning, it is automatically removed from its previous target by calling
     * stop() internally.
     */
    spin(target) {
        this.stop();
        this.el = document.createElement('div');
        this.el.className = this.opts.className;
        this.el.setAttribute('role', 'progressbar');
        css(this.el, {
            position: this.opts.position,
            width: 0,
            zIndex: this.opts.zIndex,
            left: this.opts.left,
            top: this.opts.top,
            transform: "scale(" + this.opts.scale + ")",
        });
        if (target) {
            target.insertBefore(this.el, target.firstChild || null);
        }
        drawLines(this.el, this.opts);
        return this;
    };
    /**
     * Stops and removes the Spinner.
     * Stopped spinners may be reused by calling spin() again.
     */
    stop() {
        if (this.el) {
            if (typeof requestAnimationFrame !== 'undefined') {
                cancelAnimationFrame(this.animateId);
            }
            else {
                clearTimeout(this.animateId);
            }
            if (this.el.parentNode) {
                this.el.parentNode.removeChild(this.el);
            }
            this.el = undefined;
        }
        return this;
    };
}