I suggest adding an option to set the progress indicator on ajax links/buttons, targeted with classes .use-ajax and .use-ajax-submit like it is possible to set dialog-type and dialog-options:

element_settings.dialogType = $(this).data('dialog-type');
element_settings.dialog = $(this).data('dialog-options');

My suggestions is to keep the throbber default (seems obvious) and then add an option to override it with a data attribute named data-progress-type:

// Provide clicked links with a throbber as the default indicator,
// instead of the progress bar, since it looks better.
var progress_type = $(this).data('progress-type');
element_settings.progress = {type: progress_type ? progress_type : 'throbber'};

We're basically just providing the options to set the indicator to ex: fullscreen like we do in the Form API.
So I guess all the cases that made it relevant for #ajax in Form API also applies here. But let me know if you want some actual cases.

Issue fork drupal-2818463

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kallehauge created an issue. See original summary.

droplet’s picture

My first thoughts, I like it but we need to document what we're supporting there. We won't want to see any new issue about `progress bar` doesn't work in above code. :)

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

waspper’s picture

StatusFileSize
new764 bytes

+1. It would be great to allow setting it as an option. I've provided a smaller patch, which will look for the "data-progress-type" attribute. It will fallback to the "throbber" type if not provided.

This will change only 2 lines into the function "Drupal.ajax.bindAjaxLinks".

waspper’s picture

Version: 8.7.x-dev » 8.6.x-dev
Status: Active » Needs review
waspper’s picture

StatusFileSize
new764 bytes

Typo in filename. Attached good one.

waspper’s picture

StatusFileSize
new594 bytes

Even smaller version

seanb’s picture

Patch in #10 looks nice and elegant. Work like a charm. +1

ckidow’s picture

Patch #10 is nice. Thx for that.

Regarding the 'fullscreen' progress indicator, there is a "message" option. Would be nice to implement a "data-progress-message" attribute to fully support all progress types. Is this possible inside this issue?

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

seanb’s picture

Issue tags: -JavaScript +JavaScript
StatusFileSize
new1.11 KB

Reroll for 9.1.x

nathandentzau’s picture

+1 Reroll for 9.1 works.

nathandentzau’s picture

Version: 8.9.x-dev » 9.2.x-dev
Assigned: Unassigned » nathandentzau
Status: Needs review » Reviewed & tested by the community
catch’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -throbber, -fullscreen, -Progress Bar, -progress, -indicators

The patch doesn't apply, and this still needs some automated test coverage added.

kapilv’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB
ilya.no’s picture

StatusFileSize
new1.15 KB

Attaching patch for latest 8.9 version in case anyone else needs it.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bhumikavarshney’s picture

Status: Needs review » Needs work
StatusFileSize
new29.52 KB

Hi @ilya.no,
The #20 patch while applying throws error.
Please let me know if am doing anything wrong.
Thanks

neslee canil pinto’s picture

Status: Needs work » Needs review
StatusFileSize
new1.43 KB
new1.03 KB

Updated patch #20 to the latest version (9.3.x)

mitthukumawat’s picture

StatusFileSize
new143.44 KB
new121.93 KB

@Neslee Canil Pinto
Thanks for the updated patch. I have applied it cleanly for drupal 9.3.x-dev version.
I reviewed the changed files and found the data-progress-type attribute added properly.
Adding screenshots of resulting changes.

Madhu kumar’s picture

StatusFileSize
new415.3 KB

Patch #23 applied cleanly and option to set the progress indicator on ajax links/buttons, Sharing screenshot for the reference.

gauravvvv’s picture

StatusFileSize
new9.04 KB
new8.54 KB

Re-rolled patch, attached interdiff for same.

gauravvvv’s picture

vikashsoni’s picture

@Neslee Canil Pinto Thanks for the patch applied successfully in drupal-9.3.x-dev
After patch data-progress-type attribute added properly
Thanks for the patch

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

matteo.borgognoni made their first commit to this issue’s fork.

seanb’s picture

StatusFileSize
new9.13 KB

Reroll for 9.3.x

Zsuffa Dávid’s picture

#32 Works for me with core 9.3.7.
thx

ranjith_kumar_k_u’s picture

StatusFileSize
new1.08 KB
new8.08 KB

Fixed CS errors.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new144 bytes

The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

idebr’s picture

Assigned: nathandentzau » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.09 KB

Reroll for 9.5.x

idebr’s picture

Status: Needs review » Needs work

The last submitted patch, 38: 2818463-38.patch, failed testing. View results

eugene.brit’s picture

StatusFileSize
new561 bytes

Re-roll for 10.0.x

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.