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
[#55016] Waiting modal doesn't time out
Pavel Balashou80dff648e587
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 08e17d21b1d..04f3567938a 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -1447,6 +1447,11 @@ en:focus_grab: "This is a focus anchor for modals. Press shift+tab to go back to the modal trigger element."Close: "Close"open_project_storage_modal:+ waiting_title:+ timeout: "Timeout"waiting_subtitle:network_off: "There is a network problem."network_on: "Network is back. We are trying."+ timeout: >+ OpenProject could not provide you access to the project folder within the expected period of time. Please, try once again.<br><br>+ If that problem persists please contact you OpenProject administrator to check the <a href="https://www.openproject.org/docs/system-admin-guide/file-storages/file-storage-troubleshooting/">health status of the file storage setup</a>.diff --git a/frontend/src/stimulus/controllers/dynamic/storages/open-project-storage-modal.controller.ts b/frontend/src/stimulus/controllers/dynamic/storages/open-project-storage-modal.controller.tsindex 64659fcc20f..4e65905b732 100644--- a/frontend/src/stimulus/controllers/dynamic/storages/open-project-storage-modal.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/storages/open-project-storage-modal.controller.ts@@ -30,6 +30,7 @@import { Controller } from '@hotwired/stimulus';import { renderStreamMessage } from '@hotwired/turbo';+import { xCircleIconData, toDOMString } from '@openproject/octicons-angular';export default class OpenProjectStorageModalController extends Controller<HTMLDialogElement> {static values = {@@ -37,26 +38,35 @@ export default class OpenProjectStorageModalController extends Controller<HTMLDiredirectUrl: String,};- interval:number;+ loadingInterval:number;+ timeoutInterval:number;networkErrorHappend:boolean;projectStorageOpenUrlValue:string;redirectUrlValue:string;connect() {this.element.showModal();- this.interval = 0;+ this.loadingInterval = 0;this.networkErrorHappend = false;this.load();+ this.timeoutInterval = setTimeout(+ () => {+ clearInterval(this.loadingInterval);+ this.setTimeoutMessage();+ },+ 120000,+ );this.element.addEventListener('close', () => { this.disconnect(); });this.element.addEventListener('cancel', () => { this.disconnect(); });}disconnect() {- clearInterval(this.interval);+ clearInterval(this.loadingInterval);+ clearInterval(this.timeoutInterval);}load() {- this.interval = setTimeout(+ this.loadingInterval = setTimeout(async () => {try {const response = await fetch(@@ -101,4 +111,30 @@ export default class OpenProjectStorageModalController extends Controller<HTMLDi}this.networkErrorHappend = value;}++ private setTimeoutMessage() {+ const waitingLogo = document.getElementById('waiting_logo');+ const waitingTitle = document.getElementById('waiting_title');+ const waitingSubtitle = document.getElementById('waiting_subtitle');+ if (waitingLogo) {+ waitingLogo.innerHTML = toDOMString(+ xCircleIconData,+ 'medium',+ {+ 'aria-hidden': 'true',+ class: 'octicon octicon-x-circle-icon color-fg-danger',+ },+ );+ }+ if (waitingTitle) {+ waitingTitle.innerText = I18n.t(+ 'js.open_project_storage_modal.waiting_title.timeout',+ );+ }+ if (waitingSubtitle) {+ waitingSubtitle.innerHTML = I18n.t(+ 'js.open_project_storage_modal.waiting_subtitle.timeout',+ );+ }+ }}diff --git a/modules/storages/app/components/storages/open_project_storage_modal_component.html.erb b/modules/storages/app/components/storages/open_project_storage_modal_component.html.erbindex 81e480bae87..56feb9d121a 100644--- a/modules/storages/app/components/storages/open_project_storage_modal_component.html.erb+++ b/modules/storages/app/components/storages/open_project_storage_modal_component.html.erb@@ -7,4 +7,7 @@<% dialog.with_body(id: self.class.dialog_body_id, p: 2) do %><%= render(self.class::Body.new(@state)) %><% end %>+ <% dialog.with_footer do %>+ <%= render(Primer::ButtonComponent.new(data: { "close-dialog-id": self.class.dialog_id })) { I18n.t("button_close") } %>+ <% end %><% end %>diff --git a/modules/storages/app/components/storages/open_project_storage_modal_component/body.html.erb b/modules/storages/app/components/storages/open_project_storage_modal_component/body.html.erbindex cc55e36f04d..22bd5b3729c 100644--- a/modules/storages/app/components/storages/open_project_storage_modal_component/body.html.erb+++ b/modules/storages/app/components/storages/open_project_storage_modal_component/body.html.erb@@ -1,13 +1,13 @@<%= render(Primer::OpenProject::FlexLayout.new(align_items: :center, p: 4)) do |flex| %><% case @state %><% when :waiting %>- <% flex.with_row do %>- <div class="op-loading-indicator">+ <% flex.with_row(id: 'waiting_logo') do %>+ <div class='op-loading-indicator'><div></div><div></div></div><% end %><% flex.with_row do %>- <%= render(Primer::Beta::Heading.new(tag: :h2, text_align: :center)) { waiting_title } %>+ <%= render(Primer::Beta::Heading.new(tag: :h2, text_align: :center, id: 'waiting_title')) { waiting_title } %><% end %><% flex.with_row do %><%= render(Primer::Beta::Text.new(text_align: :center, color: :muted, id: 'waiting_subtitle')) { waiting_subtitle } %>