-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Bug/STC-742: Fix column overflow in semantic ID autofix preview table #23514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
akabiru
merged 3 commits into
release/17.5
from
bug/stc-742-admin-page-for-semantic-ids-long-ids-cause-overflow
Jun 3, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
app/components/work_packages/admin/settings/identifier_autofix_row_component.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| #-- copyright | ||
| # OpenProject is an open source project management software. | ||
| # Copyright (C) the OpenProject GmbH | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License version 3. | ||
| # | ||
| # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| # Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| # Copyright (C) 2010-2013 the ChiliProject Team | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| # | ||
| # See COPYRIGHT and LICENSE files for more details. | ||
| #++ | ||
|
|
||
| module WorkPackages | ||
| module Admin | ||
| module Settings | ||
| class IdentifierAutofixRowComponent < OpPrimer::BorderBoxRowComponent | ||
| def project | ||
| render(Primer::Beta::Link.new(href: project_path(model[:project]))) { model[:project].name } | ||
| end | ||
|
|
||
| def previous_identifier | ||
| flex_layout(direction: :column) do |col| | ||
| col.with_row { render(Primer::Beta::Text.new) { model[:current_identifier] } } | ||
| if (label = error_label).present? | ||
| col.with_row do | ||
| render(Primer::Beta::Text.new(color: :danger, font_size: :small)) { label } | ||
| end | ||
| end | ||
| end | ||
| end | ||
|
|
||
| def autofixed_suggestion | ||
| model[:suggested_identifier] | ||
| end | ||
|
|
||
| # The sequence number is derived deterministically from the identifier so it looks | ||
| # varied across projects but is stable across renders. Range: 1–500. | ||
| def example_work_package_id | ||
| identifier = model[:suggested_identifier] | ||
| "#{identifier}-#{(identifier.bytes.sum % 500) + 1}" | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def error_label | ||
| I18n.t("admin.settings.work_packages_identifier.autofix_preview.error_#{model[:error_reason]}", | ||
| default: "") | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
app/components/work_packages/admin/settings/identifier_autofix_table_component.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| #-- copyright | ||
| # OpenProject is an open source project management software. | ||
| # Copyright (C) the OpenProject GmbH | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License version 3. | ||
| # | ||
| # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: | ||
| # Copyright (C) 2006-2013 Jean-Philippe Lang | ||
| # Copyright (C) 2010-2013 the ChiliProject Team | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| # | ||
| # See COPYRIGHT and LICENSE files for more details. | ||
| #++ | ||
|
|
||
| module WorkPackages | ||
| module Admin | ||
| module Settings | ||
| class IdentifierAutofixTableComponent < OpPrimer::BorderBoxTableComponent | ||
| columns :project, :previous_identifier, :autofixed_suggestion, :example_work_package_id | ||
| # Project and previous identifier hold the long content; spanning two grid columns lets | ||
| # them wrap instead of truncating, while the short handle columns stay compact. | ||
| main_column :project, :previous_identifier | ||
| mobile_labels :previous_identifier, :autofixed_suggestion, :example_work_package_id | ||
|
|
||
| def initialize(rows:, remaining_count: 0, **) | ||
| super(rows:, **) | ||
| @remaining_count = remaining_count | ||
| end | ||
|
|
||
| def row_class | ||
| IdentifierAutofixRowComponent | ||
| end | ||
|
|
||
| def mobile_title | ||
| header(:table_title) | ||
| end | ||
|
|
||
| def headers | ||
| [ | ||
| [:project, { caption: header(:label_project) }], | ||
| [:previous_identifier, { caption: header(:label_previous_identifier) }], | ||
| [:autofixed_suggestion, { caption: header(:label_autofixed_suggestion) }], | ||
| [:example_work_package_id, { caption: header(:label_example_work_package_id) }] | ||
| ] | ||
| end | ||
|
|
||
| def has_footer? | ||
| @remaining_count.positive? | ||
| end | ||
|
|
||
| def footer | ||
| I18n.t("admin.settings.work_packages_identifier.autofix_preview.remaining_projects", | ||
| count: @remaining_count) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def header(key) | ||
| I18n.t("admin.settings.work_packages_identifier.box_header.#{key}") | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.