openproject icon indicating copy to clipboard operation
openproject copied to clipboard

[Op#54456] Display the mapped projects list in the project attributes detail view

Open akabiru opened this issue 9 months ago • 0 comments

https://community.openproject.org/work_packages/54456

Implementation

  • [x] Add primer tabs
  • [x] Use the new available_project_attributes projects query filter to retrieve projects that have a given custom field activated #15400
  • [x] Extend Projects::{TableComponent,RowComponent} specialise to current requirements; the project list doesn't need to be full fledged.
    • [x] Maintain tab state on refresh by using tab-navs so that each tab navigation changes the URL
    • [x] ~On delete last item, show no results~ Separate WP(https://community.openproject.org/wp/55123)
      • [x] ~On delete within nested pagination, retain current pagination state~
    • [x] Add tests
    • [x] ~Lazy load the project lists tab, only load list on click. Turbo should help out here https://turbo.hotwired.dev/reference/frames#lazy-loaded-frame~ @dominic-braeunlein to confirm on whether to use url or query strings to enable url sharing
    • [x] Remove line under PageHeader? (https://community.openproject.org/wp/55079)
    • [x] Unlink strategy confirmation https://community.openproject.org/wp/55090
  • [x] ~Cover on delete failure edge case, render Primer::Flash with error detail?~ (https://community.openproject.org/projects/openproject/work_packages/55133/activity)
  • [x] ~Fix Hierarchy~ Separate WP (https://community.openproject.org/projects/openproject/work_packages/55124)
Dev Notes

🚧 ~An empty list is returned at present even though resolving the query locally returns results.~ ~I haven't dug into why this is happening yet~

[2] pry(#<Settings::ProjectCustomFields::ProjectCustomFieldMapping::TableComponent>)> query
=> #<Queries::Projects::ProjectQuery:0x0000fffeeb34f608
 id: nil,
 name: "project-custom-field-mapping-14",
 user_id: nil,
 filters:
  [#<Queries::Projects::Filters::AvailableProjectAttributesFilter:0x0000fffef079ca30
    @context=#<Queries::Projects::ProjectQuery:0x0000fffeeb34f608 ...>,
    @name=:available_project_attributes,
    @operator="~",
    @values=["14"]>],
 selects: [],
 orders: [],
 created_at: nil,
 updated_at: nil>
[3] pry(#<Settings::ProjectCustomFields::ProjectCustomFieldMapping::TableComponent>)> query.results
  ProjectCustomFieldProjectMapping Pluck (0.8ms)  SELECT "project_custom_field_project_mappings"."custom_field_id" FROM "project_custom_field_project_mappings"
  ↳ app/models/queries/projects/filters/available_project_attributes_filter.rb:42:in `allowed_values'
=>   Project Load (0.3ms)  SELECT "projects".* FROM "projects" INNER JOIN "project_custom_field_project_mappings" ON "project_custom_field_project_mappings"."project_id" = "projects"."id" WHERE "project_custom_field_project_mappings"."custom_field_id" = $1 /* loading for pp */ ORDER BY "projects"."id" DESC LIMIT $2  [["custom_field_id", 14], ["LIMIT", 11]]
  ↳ app/components/projects/table_component.rb:43:in `before_render'
[#<Project:0x0000fffeeba92ca8
  id: 1,
  name: "Demo project",
  description: "This is a short summary of the goals of this demo project.",
  public: true,
  parent_id: nil,
  created_at: Thu, 25 Apr 2024 09:36:43.282536000 UTC +00:00,
  updated_at: Fri, 26 Apr 2024 09:08:58.217300000 UTC +00:00,
  identifier: "demo-project",
  lft: 11,
  rgt: 12,
  active: true,
  templated: false,
  status_code: "on_track",
  status_explanation: "All tasks are on schedule. The people involved know their tasks. The system is completely set up.">]

attributes-cmpt

https://github.com/opf/openproject/assets/17295175/b5765563-b3e1-450c-9f24-88431a1adc82

akabiru avatar May 06 '24 06:05 akabiru