OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
loading indicator as stimulus target; resolves review: https://github.com/opf/openproject/pull/16364#discussion_r1731023060
as-op5d1637f5f4ca
diff --git a/frontend/src/stimulus/controllers/dynamic/job-status-polling.controller.ts b/frontend/src/stimulus/controllers/dynamic/job-status-polling.controller.tsindex c039b839e80..e0e37ef3077 100644--- a/frontend/src/stimulus/controllers/dynamic/job-status-polling.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/job-status-polling.controller.ts@@ -1,16 +1,18 @@import { Controller } from '@hotwired/stimulus';import { FrameElement } from '@hotwired/turbo';-export default class JobStatusPollingController extends Controller<FrameElement> {- static targets = ['finished', 'download', 'redirect'];+export default class JobStatusPollingController extends Controller<HTMLElement> {+ static targets = ['finished', 'download', 'redirect', 'indicator', "frame"];static values = { backOnClose: { type: Boolean, default: false } };declare readonly backOnCloseValue:boolean;+ declare readonly indicatorTarget:HTMLElement;+ declare readonly frameTarget:FrameElement;interval:ReturnType<typeof setInterval>;connect() {- this.interval = setInterval(() => this.element.reload(), 2000);+ this.interval = setInterval(() => this.frameTarget.reload(), 2000);}disconnect() {@@ -30,10 +32,7 @@ export default class JobStatusPollingController extends Controller<FrameElement>}hideProgressIndicator() {- const node = document.querySelector('#job-status-modal-dialog .op-loading-indicator');- if (node) {- node.remove();- }+ this.indicatorTarget.remove();}downloadTargetConnected(element:HTMLLinkElement) {diff --git a/modules/job_status/app/components/job_status/dialog/dialog_component.html.erb b/modules/job_status/app/components/job_status/dialog/dialog_component.html.erbindex 3a878693945..422784a64b1 100644--- a/modules/job_status/app/components/job_status/dialog/dialog_component.html.erb+++ b/modules/job_status/app/components/job_status/dialog/dialog_component.html.erb@@ -2,18 +2,22 @@title: I18n.t('job_status_dialog.title'),visually_hide_title: true,size: :large,- id: MODAL_ID+ id: MODAL_ID,+ data: {+ "application-target": "dynamic",+ controller: 'job-status-polling',+ "job-status-polling-back-on-close-value": back_on_close+ })) do |dialog| %><% dialog.with_body do %>- <div class="op-loading-indicator"><div></div><div></div></div>+ <div class="op-loading-indicator" data-job-status-polling-target="indicator">+ <div></div>+ <div></div>+ </div><%= turbo_frame_tag("job_status_modal",src: job_status_dialog_body_path(job_uuid: job_uuid),data: {- "application-target": "dynamic",- controller: 'job-status-polling',- "job-status-polling-back-on-close-value": back_on_close,- }- ) do %>- <% end %>+ "job-status-polling-target": "frame"+ }) %><% end %><% end %>