Git Product home page Git Product logo

redmine_custom_fields_groups's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redmine_custom_fields_groups's Issues

5.x not working

In the plugin Gemfile I had to update gem deface to
gem 'deface', '= 1.9.0'
(but this probably has to do with other plugin dependencies I have.

However, then I get

Zeitwerk::NameError: expected file /home/rm-base/redmine-5.0.5/plugins/redmine_customize_core_fields/app/overrides/issues/new.rb to define constant Issues::New, but didn't

      raise Zeitwerk::NameError.new(msg, cref.last)
      ^^^^^
<internal:dir>:220:in `glob'
/home/rm-base/redmine-5.0.5/config/environment.rb:16:in `<top (required)>'
/home/rm-base/.rbenv/versions/3.1.2/bin/bundle:25:in `load'
/home/rm-base/.rbenv/versions/3.1.2/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

help?

Update README.md

Problem
Currently, README.md doesn't describe what can be done by this plugin.

Improvement
Write understandable document with screenshots, before major version up which supports Redmine 5.0.

Configurable fieldset+legend expended/collapse state for each users

Problem
In case of setting fieldset+legend as group tag, there may be possibility that each users want to their own default state.

  • All expended
  • All collapsed
  • Keep each expended/collapsed state (with local storage or cookie)

Improvement
Allow configuration of above states as user preference at /my/account view.

Reordering custom_field_groups item causes 404 routing error

Problem
Reordering custom_fields_groups item by drag&drop causes 404 routing error , and doesn't although reordering itself is done successfully after browser reload.

Started PUT "/custom_fields_groups/1" for 127.0.0.1 at 2024-04-19 10:16:07 +0900
Processing by CustomFieldsGroupsController#update as JS
  Parameters: {"custom_fields_group"=>{"position"=>"2"}, "id"=>"1"}
   (0.7ms)  SELECT MAX("tokens"."updated_on") FROM "tokens" WHERE "tokens"."user_id" = $1 AND "tokens"."value" = $2 AND "tokens"."action" = $3  [["user_id", 1], ["value", "d7bc71d40ffa1a84d2a7be55db18f76ecb5d30d9"], ["action", "session"]]
  ↳ app/models/user.rb:478:in `verify_session_token'
   (1.8ms)  SELECT MAX("settings"."updated_on") FROM "settings"
  ↳ app/models/setting.rb:280:in `check_cache'
  User Load (0.8ms)  SELECT "users".* FROM "users" WHERE "users"."type" IN ($1, $2) AND "users"."status" = $3 AND "users"."id" = $4 LIMIT $5  [["type", "User"], ["type", "AnonymousUser"], ["status", 1], ["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:117:in `find_current_user'
  Current user: admin (id=1)
  CustomFieldsGroup Load (0.5ms)  SELECT "custom_fields_groups".* FROM "custom_fields_groups" WHERE "custom_fields_groups"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  ↳ plugins/redmine_custom_fields_groups/app/controllers/custom_fields_groups_controller.rb:35:in `update'
  TRANSACTION (0.4ms)  BEGIN
  ↳ plugins/redmine_custom_fields_groups/app/controllers/custom_fields_groups_controller.rb:37:in `block in update'
  CustomFieldsGroup Exists? (0.9ms)  SELECT 1 AS one FROM "custom_fields_groups" WHERE "custom_fields_groups"."name" = $1 AND "custom_fields_groups"."id" != $2 LIMIT $3  [["name", "Test1"], ["id", 1], ["LIMIT", 1]]
  ↳ plugins/redmine_custom_fields_groups/app/controllers/custom_fields_groups_controller.rb:37:in `block in update'
  CustomFieldsGroup Update (3.2ms)  UPDATE "custom_fields_groups" SET "position" = $1, "updated_at" = $2 WHERE "custom_fields_groups"."id" = $3  [["position", 2], ["updated_at", "2024-04-19 10:16:07.248882"], ["id", 1]]
  ↳ plugins/redmine_custom_fields_groups/app/controllers/custom_fields_groups_controller.rb:37:in `block in update'
  CustomFieldsGroup Update All (0.7ms)  UPDATE "custom_fields_groups" SET position = position + -1 WHERE (id <> 1 AND position BETWEEN 1 AND 2)
  ↳ lib/redmine/acts/positioned.rb:109:in `shift_positions'
  TRANSACTION (0.6ms)  COMMIT
  ↳ plugins/redmine_custom_fields_groups/app/controllers/custom_fields_groups_controller.rb:36:in `update'
Redirected to http://localhost:3000/custom_fields_groups
Completed 302 Found in 50ms (ActiveRecord: 9.6ms | Allocations: 6635)


Started PUT "/custom_fields_groups" for 127.0.0.1 at 2024-04-19 10:16:07 +0900
  
ActionController::RoutingError (No route matches [PUT] "/custom_fields_groups"):

To Reproduce

  1. Create 2 custom fields groups from /custom_fields_groups view.
  2. Change 2nd item position to 1st by drag&drop green up/down arrow.

Expectation
Routing error should not be happen and order is changed.

Test and CI are missing

Problem
Currently, there are no test and CI, so maintaining code is a bit hard.

Expectation
Test and CI should be supported.

Allow each users to select group tag from user preference

Problem
Currently, group tag settings (h3, h4 or fieldset+legend) is global level setting at plugin settings view, so it's not possible to meet the needs of multiple users.

Improvement
If each login users can select their own preference at /my/account view, above problem will be solved.

Automatic code reloading doesn't work on development environment

Same as gtt-project/redmine_attachment_categories#14

Problem
Automatic code reloading doesn't work on development environment.

  Rendered issues/show.html.erb within layouts/base (186.1ms)
Completed 500 Internal Server Error in 734ms (ActiveRecord: 68.6ms)


  
ActionView::Template::Error (undefined method `render_custom_fields_rows_by_groups' for #<#<Class:0x00007fe34d3e40a8>:0x00007fe3567aed38>
Did you mean?  render_custom_fields_tabs):
    75:     rows.right l(:label_spent_time), issue_spent_hours_details(@issue), :class => 'spent-time'
    76:   end
    77: end %>
    78: <%= render_custom_fields_rows_by_groups(@issue) %>
    79: <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
    80: </div>
    81: 
  
app/views/issues/show.html.erb:78:in `_app_views_issues_show_html_erb___4227993626553242008_150560'
app/controllers/issues_controller.rb:112:in `block (2 levels) in show'
app/controllers/issues_controller.rb:104:in `show'
lib/redmine/sudo_mode.rb:61:in `sudo_mode'

To Reproduce

  1. Launch server by bundle exec rails s -b 0
  2. Open localhost:3000 by browser, then access to some view
  3. Edit arbitral source file (like config/locale/ja.yml)
  4. Reload browser

Expectation
Automatic code reloading works without 500 error

Deleting a custom field which is used in custom fields group is failed

Problem
Deleting a custom field which is used in custom fields group is failed.

Rails log details
Started DELETE "/custom_fields/2" for 127.0.0.1 at 2024-04-09 16:19:53 +0900
Processing by CustomFieldsController#destroy as HTML
  Parameters: {"authenticity_token"=>"YwLENT7yyZk673OPHLhtELBgmxdsBzeGzPhwR3qibh0cu8f5i1HIaZQKUK1TWMMJmAKQmygQHCT4csP+AtxHog==", "id"=>"2"}
   (2.1ms)  SELECT MAX("tokens"."updated_on") FROM "tokens" WHERE "tokens"."user_id" = $1 AND "tokens"."value" = $2 AND "tokens"."action" = $3  [["user_id", 1], ["value", "92cf39907dffaa6604326d3ecef27279bad6343c"], ["action", "session"]]
  ↳ app/models/user.rb:478:in `verify_session_token'
   (1.5ms)  SELECT MAX("settings"."updated_on") FROM "settings"
  ↳ app/models/setting.rb:280:in `check_cache'
  User Load (1.4ms)  SELECT "users".* FROM "users" WHERE "users"."type" IN ($1, $2) AND "users"."status" = $3 AND "users"."id" = $4 LIMIT $5  [["type", "User"], ["type", "AnonymousUser"], ["status", 1], ["id", 1], ["LIMIT", 1]]
  ↳ app/controllers/application_controller.rb:117:in `find_current_user'
  Current user: admin (id=1)
  CustomField Load (0.6ms)  SELECT "custom_fields".* FROM "custom_fields" WHERE "custom_fields"."id" = $1 LIMIT $2  [["id", 2], ["LIMIT", 1]]
  ↳ app/controllers/custom_fields_controller.rb:109:in `find_custom_field'
  TRANSACTION (1.9ms)  BEGIN
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  CustomFieldEnumeration Destroy (1.5ms)  DELETE FROM "custom_field_enumerations" WHERE "custom_field_enumerations"."id" IN (SELECT "custom_field_enumerations"."id" FROM "custom_field_enumerations" WHERE "custom_field_enumerations"."custom_field_id" = $1 ORDER BY "custom_field_enumerations"."position" ASC)  [["custom_field_id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  CustomValue Destroy (1.3ms)  DELETE FROM "custom_values" WHERE "custom_values"."custom_field_id" = $1  [["custom_field_id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  IssueCustomField::HABTM_Trackers Destroy (1.8ms)  DELETE FROM "custom_fields_trackers" WHERE "custom_fields_trackers"."custom_field_id" = $1  [["custom_field_id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  IssueCustomField::HABTM_Projects Destroy (0.3ms)  DELETE FROM "custom_fields_projects" WHERE "custom_fields_projects"."custom_field_id" = $1  [["custom_field_id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  CustomField::HABTM_Roles Destroy (1.1ms)  DELETE FROM "custom_fields_roles" WHERE "custom_fields_roles"."custom_field_id" = $1  [["custom_field_id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  IssueCustomField Destroy (8.9ms)  DELETE FROM "custom_fields" WHERE "custom_fields"."id" = $1  [["id", 2]]
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
  TRANSACTION (0.3ms)  ROLLBACK
  ↳ app/controllers/custom_fields_controller.rb:85:in `destroy'
Redirected to http://localhost:3000/custom_fields?tab=IssueCustomField
Completed 302 Found in 85ms (ActiveRecord: 41.0ms | Allocations: 11177)
PostgreSQL message
DELETE FROM "custom_fields" WHERE "custom_fields"."id" = 2;
ERROR:  update or delete on table "custom_fields" violates foreign key constraint "fk_rails_dc9da07f56" on table "custom_fields_group_fields"
DETAIL:  Key (id)=(2) is still referenced from table "custom_fields_group_fields".
SQL state: 23503

To Reproduce

  1. Add a custom field to a custom fields group.
  2. Delete the custom field.

Expectation
Deleting a custom field should be possible.

Update Japanese locale

Problem
Currently, Japanese locale is missing.

Improvement
Add Japanese locale.

Currently, this plugin doesn't use project module and permission, so just existence words translation should be enough.

Automatic Weblate translation PR CI unit test is failing

Problem
Currently, automatic Weblate translation PR CI is failing.
Jobs: https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703

https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718463297#step:7:1

Error:
CustomFieldsGroupTest#test_should_require_name:
NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x000055a13a4071e0>
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:22:in `block in <class:CustomFieldsGroupTest>'

bin/rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:20
:
Error:
CustomFieldsGroupTest#test_should_validate_name_uniqueness:
NoMethodError: undefined method `deep_symbolize_keys' for #<String:0x000055a13c831f70>
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:37:in `block (2 levels) in <class:CustomFieldsGroupTest>'
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:[34](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718463297#step:7:35):in `block in <class:CustomFieldsGroupTest>'

bin/rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:26

https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:1

Error:
CustomFieldsGroupTest#test_should_require_name:
TypeError: no implicit conversion of String into Hash
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:2[3](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:3):in `block in <class:CustomFieldsGroupTest>'

rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:20
:
Error:
CustomFieldsGroupTest#test_should_validate_name_uniqueness:
TypeError: no implicit conversion of String into Hash
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:38:in `block (2 levels) in <class:CustomFieldsGroupTest>'
    plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:3[4](https://github.com/gtt-project/redmine_custom_fields_groups/actions/runs/9345503703/job/25718467637#step:7:4):in `block in <class:CustomFieldsGroupTest>'

rails test plugins/redmine_custom_fields_groups/test/unit/custom_fields_group_test.rb:26

To Reproduce
I am not sure why this unit test error is happen, but the errors happen same place,
and I guess that custom_fields_group.errors[:name] causes the errors.
https://github.com/gtt-project/redmine_custom_fields_groups/blob/next/test/unit/custom_fields_group_test.rb#L20-L40

  test 'should require name' do
    custom_fields_group = CustomFieldsGroup.new
    assert_not custom_fields_group.save
    assert custom_fields_group.errors[:name]
  end

  test 'should validate name uniqueness' do
    assert_difference 'CustomFieldsGroup.count' do
      custom_fields_group = CustomFieldsGroup.new
      custom_fields_group.name = 'test'
      assert custom_fields_group.save
      assert_equal 'test', custom_fields_group.name
    end

    assert_no_difference 'CustomFieldsGroup.count' do
      custom_fields_group = CustomFieldsGroup.new
      custom_fields_group.name = 'test'
      assert_not custom_fields_group.save
      assert custom_fields_group.errors[:name]
    end
  end

Expectation
The errors should not happen from any repository PR.

Deploying on Redmine 5.x did not work. May be a DB issue

Upon trying to deploy this addon I get:


== 20211011081244 CreateCustomFieldsGroupFields: migrating ====================
-- create_table(:custom_fields_group_fields, {:id=>false})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Column `custom_fields_group_id` on table `custom_fields_group_fields` does not match column `id` on `custom_fields_groups`, which has type `bigint(20)`. To resolve this issue, change the type of the `custom_fields_group_id` column on `custom_fields_group_fields` to be :bigint. (For example `t.bigint :custom_fields_group_id`).
Original message: Mysql2::Error: Can't create table `db_redmine`.`custom_fields_group_fields` (errno: 150 "Foreign key constraint is incorrectly formed")
/home/finddx-rm/redmine-5.0.2/plugins/redmine_custom_fields_groups/db/migrate/20211011081244_create_custom_fields_group_fields.rb:3:in `change'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:468:in `up'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:500:in `migrate_plugin'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:441:in `migrate'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:455:in `block in migrate'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:454:in `each'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:454:in `migrate'
/home/finddx-rm/redmine-5.0.2/lib/tasks/redmine.rake:151:in `block (3 levels) in <top (required)>'
/home/finddx-rm/.rbenv/versions/2.7.2/bin/bundle:23:in `load'
/home/finddx-rm/.rbenv/versions/2.7.2/bin/bundle:23:in `<main>'

Caused by:
ActiveRecord::MismatchedForeignKey: Column `custom_fields_group_id` on table `custom_fields_group_fields` does not match column `id` on `custom_fields_groups`, which has type `bigint(20)`. To resolve this issue, change the type of the `custom_fields_group_id` column on `custom_fields_group_fields` to be :bigint. (For example `t.bigint :custom_fields_group_id`).
Original message: Mysql2::Error: Can't create table `db_redmine`.`custom_fields_group_fields` (errno: 150 "Foreign key constraint is incorrectly formed")
/home/finddx-rm/redmine-5.0.2/plugins/redmine_custom_fields_groups/db/migrate/20211011081244_create_custom_fields_group_fields.rb:3:in `change'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:468:in `up'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:500:in `migrate_plugin'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:441:in `migrate'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:455:in `block in migrate'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:454:in `each'
/home/finddx-rm/redmine-5.0.2/lib/redmine/plugin.rb:454:in `migrate'
/home/finddx-rm/redmine-5.0.2/lib/tasks/redmine.rake:151:in `block (3 levels) in <top (required)>'
/home/finddx-rm/.rbenv/versions/2.7.2/bin/bundle:23:in `load'
/home/finddx-rm/.rbenv/versions/2.7.2/bin/bundle:23:in `<main>'

Zeitwerk support

Problem
When using Redmine master (trunk) branch, this plugin installation (bundle exec rake redmine:plugins:migrate) fails with the following error.

$ bundle exec rake redmine:plugins:migrate
rake aborted!
LoadError: cannot load such file -- redmine_custom_fields_groups
/Users/sanak/Build/rb/redmine/vendor/bundle/ruby/2.7.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/Users/sanak/Build/rb/redmine/vendor/bundle/ruby/2.7.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/Users/sanak/Build/rb/redmine/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
/Users/sanak/Build/rb/redmine/plugins/redmine_custom_fields_groups/init.rb:1:in `<top (required)>'
/Users/sanak/Build/rb/redmine/lib/redmine/plugin_loader.rb:31:in `load'
/Users/sanak/Build/rb/redmine/lib/redmine/plugin_loader.rb:31:in `run_initializer'
/Users/sanak/Build/rb/redmine/lib/redmine/plugin_loader.rb:111:in `each'
/Users/sanak/Build/rb/redmine/lib/redmine/plugin_loader.rb:111:in `block in load'
:

Supporting Zeitwerk is necessary, because upcoming Redmine version (5.0) uses it.
Here is the some links:

Plugin setting typo in "fieldset_default_state" key's "all_expended" value

Problem
This is similar with Redmine core side typo.

Expectation
all_expended should be replaced to all_expanded.

Note
Consider to add migration process in settings and user_preferences tables.
Here is the code snippet of settings table value.

setting = Setting.plugin_redmine_custom_fields_groups
if (
  setting.present? &&
  setting.has_key?('fieldset_default_state') &&
  setting['fieldset_default_state'] == 'all_expended'
)
  setting['fieldset_default_state'] = 'all_expanded'
  Setting.plugin_redmine_custom_fields_groups = setting
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.