Skip to content

[DREAM-900] Migrate administration work package settings towards Primer - #26044

Merged
HDinger merged 15 commits into
opf:devfrom
klappradla:feature/dream-900-migrate-administration-work-package-settings-towards-primer
Oct 19, 2026
Merged

HDinger merged 15 commits into
opf:devfrom
klappradla:feature/dream-900-migrate-administration-work-package-settings-towards-primer

Conversation

@klappradla

@klappradla klappradla commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Ticket

DREAM-900

What are you trying to accomplish?

This migrates the project and work package settings pages for admins to Primer.

Screenshots

before after
image image
image image

What approach did you choose and why?

I extracted form objects for both forms and a shared component that wraps the AngularJS component for editing columns.

AI involvement

None/Assisted – No AI assistance used OR only autocomplete/pasted snippets. I effectively wrote and understand all the code.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@klappradla klappradla changed the title Setup lib + build pipeline + demo app [DREAM-900] Migrate administration work package settings towards Primer Oct 15, 2026
@github-actions github-actions Bot added the ai: None/Assisted 👤 No AI assistance used OR only snippets. A human effectively wrote and understands all the code. label Oct 15, 2026
@HDinger HDinger added this to the 18.0.x milestone Oct 15, 2026

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks already quite solid 👍 As mention in async, please also draft the doc changes by updating the images in here (the numbers in the image you can ignore), and here

module ProjectSettings
# NOTE: Wrapping this in a component to get around the issue that the helpers
# aren't re-evaluated with every request when called from a form.
class DefaultColumnsComponent < ApplicationComponent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed reads strange, but I asume that this is the workaround you mentioned, you want to get rid of?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I updated the helper delegation in e81a0bd and then removed those components in 788f008.

},
input_width: :medium
)
sf.group(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primer offers so called nested_forms which I think make sense here, as the checkboxes are dependend and should be intended as such. You can have a look here how this is used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunately only available on checkboxes or radio buttons (see search in repo for instance), not for a select like we have here.

Primer already implicitly wraps the check_box_group into a group behind the scenes. By doing it explicitly in the markup myself, I get control over which attributes are set on the group wrapper. I need that in order to set the hidden attribute for determining the initial state of the component when rendering the HTML on the server.

If I set the hidden attribute on the check_box_group, the same markup is rendered, with the difference, that the hidden attribute is nested too deep: Primer will initially set a d-none class on the outer wrapping container and won't remove it again when the hidden attribute is toggled 🙈

def initialize(pane:)
module Admin
module Settings
class ColumnSelectionComponent < ApplicationComponent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍
It would be good to add a small preview in lookbook for this component.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in a39a4fb ✅

within "opce-draggable-autocompleter" do
items = page.all(".op-draggable-autocomplete--item")
expect(items.map(&:text)).to eq ["Name", "Status", "Identifier"]
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it makes sense to navigate to the project list and check wether the correct columns are shown


require "spec_helper"

RSpec.describe "Work packages general admin settings", :js do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in the other test: The check whether the setting actually worked is missing (next to checking whether the page itself shows the correct values). So either you navigate to the WP table and check wehter the settings is applied correctly, or you check the stored setting value

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I went with a combination: for the columns, I'm looking at the actual page, for the other settings only in the database to not extend the test too long.

@klappradla
klappradla requested a review from HDinger October 16, 2026 10:31
Unfortunately due to the way helper delegation is set up for `ApplicationForm`, I also had to extract separate
components for the usage within the project and work package forms…
Instead of delegating the helpers call to ApplicationController, we want to take the view context. Otherwise, any helper
call that gets memorized will return the same result for all requests and only change when a new version of the app is
deployed. That has effects on e.g. translations.
It's not necessary to have separate components for them any more.
Update specs to also check the effect of the settings changes. For some, the check is done in the database, for some
others in the UI.
@klappradla
klappradla force-pushed the feature/dream-900-migrate-administration-work-package-settings-towards-primer branch from b347df1 to 6564e90 Compare October 16, 2026 10:31

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice 👏 👍
I have two minor remarks and would like to have @MayaBerd opinion on the doc changes

1. **Allow cross-project work package relations**, i.e. that work packages created in one project can have relations to work packages in another project, for example parent-children work packages.

2. **Display subprojects work packages in main projects** by default. This way the work packages of subprojects will always be visible in the main project if a user has the corresponding role in the subproject to see work packages.
2. **Display subprojects work packages on main projects** by default. This way the work packages of subprojects will always be visible in the main project if a user has the corresponding role in the subproject to see work packages.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not 100% sure whether this is correct. I think in might actually be better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think so too. I'll update the translation 🚜

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, "in" is better

module OpenProject
module Admin
module Settings
class ColumnSelectionComponentPreview < ViewComponent::Preview

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment like this:

# @logical_path OpenProject/Admin/Settings

Otherwise, the module gets automatically transformed with a space between "Open" and "Project":

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch, thanks 🙇

I just always looked at it through the filtered view 🙈

@HDinger
HDinger requested a review from MayaBerd October 16, 2026 12:03
@HDinger

HDinger commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@klappradla there is also a test that seems to fail only here, so it is probably caused by some of the changes although it looks not related to the settings. Maybe it's the helper change

The mocked call failed because the helper calls now go through the actual view context. So updating the stub to allow
calling anything and just add a specific mock for the part the test cares about.

@HDinger HDinger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good 👍 Thanks for the effort on this 🙇
Good to merge once the tests are green

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure about the size of the image here, but let's merge it. I want to see it on the actual page. If an update is needed, I can take care of it.

@HDinger
HDinger merged commit 1dedcf1 into opf:dev Oct 19, 2026
20 of 21 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

ai: None/Assisted 👤 No AI assistance used OR only snippets. A human effectively wrote and understands all the code. feature Passion time

Development

Successfully merging this pull request may close these issues.

3 participants