From ac3940634732a1b7a24cc3929e960b493732c381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Tue, 13 Aug 2024 19:19:09 +0200 Subject: [PATCH 01/12] Replace dynamic bootstrapped components with angular elements --- app/helpers/application_helper.rb | 32 +-- app/helpers/custom_fields_helper.rb | 4 +- app/views/admin/backups/show.html.erb | 2 +- .../settings/projects_settings/show.html.erb | 15 +- .../_enterprise_feature_hint.html.erb | 2 +- .../show.html.erb | 2 +- app/views/attribute_help_texts/_tab.html.erb | 2 +- .../augmented/_collapsible_section.html.erb | 6 +- .../colors/_color_autocomplete_field.html.erb | 2 +- app/views/common/_tabs.html.erb | 2 +- app/views/common/upsale.html.erb | 2 +- app/views/custom_actions/_form.html.erb | 9 +- app/views/custom_styles/show.html.erb | 6 +- app/views/enterprises/_current.html.erb | 4 +- app/views/enterprises/_info.html.erb | 2 +- app/views/filters/_boolean.html.erb | 2 +- .../filters/date/_between_dates.html.erb | 4 +- app/views/filters/date/_on_date.html.erb | 2 +- .../homescreen/blocks/_new_features.html.erb | 2 +- app/views/layouts/base.html.erb | 10 +- app/views/members/_member_form.html.erb | 2 +- .../repositories/_repository_header.html.erb | 8 +- app/views/search/index.html.erb | 6 +- app/views/statuses/_form.html.erb | 2 +- .../types/form/_form_configuration.html.erb | 6 +- app/views/versions/show.html.erb | 4 +- app/views/wiki/_page_form.html.erb | 2 +- app/views/work_packages/bulk/edit.html.erb | 4 +- app/views/work_packages/moves/new.html.erb | 4 +- .../application-architecture/README.md | 2 +- frontend/.eslintrc.js | 2 + frontend/src/app/app.module.ts | 138 +++++++++-- ...al-search-work-packages-entry.component.ts | 46 ---- .../global-search-work-packages.component.ts | 28 ++- .../openproject-global-search.module.ts | 4 - .../tabs/global-search-tabs.component.ts | 12 +- .../title/global-search-title.component.ts | 13 +- .../main-menu/main-menu-toggle.component.ts | 7 +- .../setup/global-dynamic-components.const.ts | 215 ------------------ .../components/admin/backup.component.ts | 12 +- .../setup/globals/dynamic-bootstrapper.ts | 129 ----------- frontend/src/app/core/setup/init-globals.ts | 1 - .../editable-query-props.component.ts | 11 +- .../type-form-configuration.component.ts | 4 +- .../ee-active-saved-trial.component.ts | 3 +- .../enterprise/enterprise-base.component.ts | 3 +- .../free-trial-button.component.ts | 11 +- .../blocks/new-features.component.ts | 4 +- .../in-app-notification-bell.component.ts | 3 +- .../app/features/plugins/plugin-context.ts | 26 +-- .../user/user-activity.component.ts | 13 +- .../zen-mode-toggle-button.component.ts | 3 +- .../custom-date-action-admin.component.ts | 7 +- .../components/wp-new/wp-new-full-view.html | 2 +- .../routing/wp-full-view/wp-full-view.html | 4 +- .../static-attribute-help-text.component.ts | 3 +- .../collapsible-section.component.ts | 7 +- .../colors/colors-autocompleter.component.ts | 7 +- .../copy-to-clipboard.component.ts | 10 +- .../basic-single-date-picker.component.ts | 13 +- .../modal-single-date-picker.component.html | 2 +- .../modal-single-date-picker.component.ts | 19 +- .../dynamic-bootstrap.component.html | 4 - .../dynamic-bootstrap.component.spec.ts | 57 ----- .../dynamic-bootstrap.component.ts | 41 ---- .../dynamic-bootstrap.module.ts | 8 - .../ckeditor-augmented-textarea.component.ts | 2 - .../ckeditor/ckeditor-preview.service.ts | 26 +-- .../enterprise-banner.component.ts | 12 +- .../enterprise-page.component.html | 2 +- .../enterprise-page.component.ts | 12 +- .../formattable-display-field.module.ts | 4 - .../grids/grid/page/grid-page.component.html | 2 +- .../custom-text/custom-text.component.ts | 10 +- .../wp-overview/wp-overview.component.html | 4 +- .../header-project-select.component.ts | 3 +- .../add-section-dropdown.component.ts | 7 +- .../hide-section-link.component.ts | 3 +- .../show-section-dropdown.component.ts | 63 ----- .../modal/modal-overlay.component.ts | 8 +- .../no-results/no-results.component.ts | 11 +- .../op-non-working-days-list.component.html | 5 +- .../op-non-working-days-list.component.ts | 3 +- .../persistent-toggle.component.ts | 3 +- .../resizer/main-menu-resizer.component.ts | 11 +- .../storage-information.html | 4 +- .../storage-login-button.component.ts | 11 +- .../content-tabs/content-tabs.component.ts | 11 +- .../edit/trigger-actions-entry.component.ts | 20 +- .../toaster/toasts-container.component.ts | 7 +- .../overview/wp-overview-graph.component.ts | 7 +- frontend/src/app/shared/shared.module.ts | 47 ++-- .../drop-modal/drop-modal-portal.component.ts | 12 +- .../components/switch/switch.component.ts | 9 +- .../text_formatting/filters/macro_filter.rb | 3 +- .../filters/macros/github_pull_request.rb | 48 ++++ .../menu_manager/top_menu/projects_menu.rb | 2 +- lib/redmine/menu_manager/top_menu_helper.rb | 2 +- lib/tabular_form_builder.rb | 2 +- .../default.html.erb | 12 +- .../avatars/users/_local_avatars.html.erb | 2 +- .../avatar-upload-form.component.ts | 11 +- modules/avatars/frontend/module/main.ts | 5 - .../app/views/rb_sprints/_sprint.html.erb | 4 +- .../augment/cost-subform.augment.service.ts | 8 - .../costs/app/views/cost_types/index.html.erb | 2 +- modules/costs/app/views/costlog/edit.html.erb | 4 +- .../costs/app/views/my/timer/_menu.html.erb | 2 +- .../frontend/module/main.ts | 20 +- .../pull-request-macro.component.ts | 3 - modules/reporting/lib/widget/filters/date.rb | 4 +- .../reporting/lib/widget/reporting_widget.rb | 1 + .../reporting/lib/widget/table/entry_table.rb | 8 +- .../_project_folder_form.html.erb | 4 +- spec/lib/custom_field_form_builder_spec.rb | 6 +- spec/lib/tabular_form_builder_spec.rb | 4 +- spec/support/capybara_browser_logs.rb | 2 +- spec/support/pages/custom_fields.rb | 2 +- spec/support/pages/notifications/center.rb | 2 +- 119 files changed, 453 insertions(+), 1053 deletions(-) delete mode 100644 frontend/src/app/core/global_search/global-search-work-packages-entry.component.ts delete mode 100644 frontend/src/app/core/setup/global-dynamic-components.const.ts delete mode 100644 frontend/src/app/core/setup/globals/dynamic-bootstrapper.ts delete mode 100644 frontend/src/app/shared/components/dynamic-bootstrap/component/dynamic-bootstrap/dynamic-bootstrap.component.html delete mode 100644 frontend/src/app/shared/components/dynamic-bootstrap/component/dynamic-bootstrap/dynamic-bootstrap.component.spec.ts delete mode 100644 frontend/src/app/shared/components/dynamic-bootstrap/component/dynamic-bootstrap/dynamic-bootstrap.component.ts delete mode 100644 frontend/src/app/shared/components/dynamic-bootstrap/dynamic-bootstrap.module.ts delete mode 100644 frontend/src/app/shared/components/hide-section/show-section-dropdown.component.ts create mode 100644 lib/open_project/text_formatting/filters/macros/github_pull_request.rb diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e42b67248862..341888e7390d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -174,7 +174,7 @@ def labeled_check_box_tags(name, collection, options = {}) def html_hours(text) text.gsub(%r{(\d+)\.(\d+)}, '\1.\2') - .html_safe + .html_safe end def authoring(created, author, options = {}) @@ -202,7 +202,7 @@ def time_tag(time) else datetime = time.acts_like?(:time) ? time.xmlschema : time.iso8601 content_tag(:time, text, datetime:, - title: format_time(time), class: "timestamp") + title: format_time(time), class: "timestamp") end end @@ -253,18 +253,18 @@ def accesskey(s) # Same as Rails' simple_format helper without using paragraphs def simple_format_without_paragraph(text) text.to_s - .gsub(/\r\n?/, "\n") # \r\n and \r -> \n - .gsub(/\n\n+/, "

") # 2+ newline -> 2 br - .gsub(/([^\n]\n)(?=[^\n])/, '\1
') # 1 newline -> br - .html_safe + .gsub(/\r\n?/, "\n") # \r\n and \r -> \n + .gsub(/\n\n+/, "

") # 2+ newline -> 2 br + .gsub(/([^\n]\n)(?=[^\n])/, '\1
') # 1 newline -> br + .html_safe end def lang_options_for_select(blank = true) auto = if blank && (valid_languages - all_languages) == (all_languages - valid_languages) - [["(auto)", ""]] - else - [] - end + [["(auto)", ""]] + else + [] + end mapped_languages = valid_languages.map { |lang| translate_language(lang) } @@ -347,7 +347,7 @@ def current_layout def progress_bar(pcts, options = {}) pcts = Array(pcts).map(&:round) closed = pcts[0] - done = pcts[1] || 0 + done = pcts[1] || 0 width = options[:width] || "100px;" legend = options[:legend] || "" total_progress = options[:hide_total_progress] ? "" : t(:total_progress) @@ -356,7 +356,7 @@ def progress_bar(pcts, options = {}) content_tag :span do progress = content_tag :span, class: "progress-bar", style: "width: #{width}" do concat content_tag(:span, "", class: "inner-progress closed", style: "width: #{closed}%") - concat content_tag(:span, "", class: "inner-progress done", style: "width: #{done}%") + concat content_tag(:span, "", class: "inner-progress done", style: "width: #{done}%") end progress + content_tag(:span, "#{legend}#{percent_sign} #{total_progress}", class: "progress-bar-legend") end @@ -369,8 +369,10 @@ def checked_image(checked = true) end def calendar_for(*_args) - ActiveSupport::Deprecation.warn "calendar_for has been removed. Please use the op-basic-single-date-picker angular component instead", - caller + ActiveSupport::Deprecation.warn( + "calendar_for has been removed. Please use the opce-basic-single-date-picker angular component instead", + caller + ) end def locale_first_day_of_week @@ -435,7 +437,7 @@ def permitted_params def translate_language(lang_code) # rename in-context translation language name for the language select box if lang_code.to_sym == Redmine::I18n::IN_CONTEXT_TRANSLATION_CODE && - ::I18n.locale != Redmine::I18n::IN_CONTEXT_TRANSLATION_CODE + ::I18n.locale != Redmine::I18n::IN_CONTEXT_TRANSLATION_CODE [Redmine::I18n::IN_CONTEXT_TRANSLATION_NAME, lang_code.to_s] else [I18n.t("cldr.language_name", locale: lang_code), lang_code.to_s] diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index fa2e4b641e9d..6d16917b3631 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -72,7 +72,7 @@ def custom_field_tag(name, custom_value) tag = case field_format.try(:edit_as) when "date" - angular_component_tag "op-basic-single-date-picker", + angular_component_tag "opce-basic-single-date-picker", inputs: { required: custom_field.is_required, value: custom_value.value, @@ -150,7 +150,7 @@ def custom_field_tag_for_bulk_edit(name, custom_field, project = nil) case field_format.try(:edit_as) when "date" - angular_component_tag "op-modal-single-date-picker", + angular_component_tag "opce-modal-single-date-picker", inputs: { id: field_id, name: field_name diff --git a/app/views/admin/backups/show.html.erb b/app/views/admin/backups/show.html.erb index 4c9d15683957..1b6f6fa64d16 100644 --- a/app/views/admin/backups/show.html.erb +++ b/app/views/admin/backups/show.html.erb @@ -90,7 +90,7 @@ See COPYRIGHT and LICENSE files for more details. <% end %> <% if @backup_token.present? %> -<%= tag :backup, data: { +<%= angular_component_tag "opce-backup", data: { 'job-status-id': @job_status_id, 'last-backup-date': @last_backup_date, 'last-backup-attachment-id': @last_backup_attachment_id, diff --git a/app/views/admin/settings/projects_settings/show.html.erb b/app/views/admin/settings/projects_settings/show.html.erb index aabbee95cf61..f8ee4cf5648e 100644 --- a/app/views/admin/settings/projects_settings/show.html.erb +++ b/app/views/admin/settings/projects_settings/show.html.erb @@ -61,14 +61,13 @@ See COPYRIGHT and LICENSE files for more details. - <%= content_tag 'editable-query-props', - '', - data: { - name: 'settings[project_gantt_query]', - id: 'settings_project_gantt_query', - query: ::Projects::GanttQueryGeneratorService.current_query, - 'url-params': 'true' - } + <%= angular_component_tag 'opce-editable-query-props', + data: { + name: 'settings[project_gantt_query]', + id: 'settings_project_gantt_query', + query: ::Projects::GanttQueryGeneratorService.current_query, + 'url-params': 'true' + } %> diff --git a/app/views/admin/settings/work_packages_settings/_enterprise_feature_hint.html.erb b/app/views/admin/settings/work_packages_settings/_enterprise_feature_hint.html.erb index 88daaf178482..d82dc602b7c1 100644 --- a/app/views/admin/settings/work_packages_settings/_enterprise_feature_hint.html.erb +++ b/app/views/admin/settings/work_packages_settings/_enterprise_feature_hint.html.erb @@ -1,7 +1,7 @@ <% unless EnterpriseToken.allows_to?(ee_feature) %> <%= - angular_component_tag 'op-enterprise-banner', + angular_component_tag 'opce-enterprise-banner', inputs: { collapsible: true, textMessage: explanation, diff --git a/app/views/admin/settings/working_days_and_hours_settings/show.html.erb b/app/views/admin/settings/working_days_and_hours_settings/show.html.erb index 6dd8ceaac2ba..80f82d5479fc 100644 --- a/app/views/admin/settings/working_days_and_hours_settings/show.html.erb +++ b/app/views/admin/settings/working_days_and_hours_settings/show.html.erb @@ -90,7 +90,7 @@ See COPYRIGHT and LICENSE files for more details.

<%= t("working_days.instance_wide_info") %>

- <%= angular_component_tag "op-non-working-days-list", + <%= angular_component_tag "opce-non-working-days-list", data: { modified_non_working_days: @modified_non_working_days } %> diff --git a/app/views/attribute_help_texts/_tab.html.erb b/app/views/attribute_help_texts/_tab.html.erb index edc64251d148..1da41bb295ac 100644 --- a/app/views/attribute_help_texts/_tab.html.erb +++ b/app/views/attribute_help_texts/_tab.html.erb @@ -42,7 +42,7 @@ edit_attribute_help_text_path(attribute_help_text) %> - <%= angular_component_tag 'attribute-help-text', + <%= angular_component_tag 'opce-attribute-help-text', inputs: { helpTextId: attribute_help_text.id, attribute: attribute_help_text.attribute_name, diff --git a/app/views/augmented/_collapsible_section.html.erb b/app/views/augmented/_collapsible_section.html.erb index b223a5c174aa..4b9986a9ffd9 100644 --- a/app/views/augmented/_collapsible_section.html.erb +++ b/app/views/augmented/_collapsible_section.html.erb @@ -1,6 +1,6 @@ - - - <% end %> @@ -116,8 +117,8 @@ - - + + diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erb index 1368cf54c11d..9ffedb2176f1 100644 --- a/app/views/custom_styles/show.html.erb +++ b/app/views/custom_styles/show.html.erb @@ -156,10 +156,10 @@ See COPYRIGHT and LICENSE files for more details. <% end %> <% custom_export_expanded = @custom_style.id && (@custom_style.export_logo.present? || @custom_style.export_cover.present? || @custom_style.export_cover_text_color.present?) %> - - -