Skip to content
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

3157 use enum labels in current filters search status #1

Open
wants to merge 70 commits into
base: master
Choose a base branch
from

Conversation

harunkumars
Copy link
Owner

Fixes Issue activeadmin#3157 - Display Enum labels for Active Filters in Current Search Status

ActiveAdmin::Filters::ActiveFilter#values controls the displayed value for active filters.
This currently does not have any special handling for Enums.

For e.g. with an enum definition like enum status: [:inactive, :active] , when filtering for :inactive status, the Current Search Status widget shows "Status is 0"

This PR, uses ActiveRecord::Enum.defined_enums to translate the display value for the filter to the associated label for enums. The Current Search Status widget will now show "Status is Inactive"

If a custom collection is provided when registering the ActiveAdmin resource e.g. filter :status, as: :select, collection: [[:not_active, 0], [:active, 1]] which specifies dropdown labels that are different from the enum labels, then the dropdown label from the custom collection is used. The Current Search Status widget will now show "Status is Not Active"

javierjulio and others added 30 commits March 10, 2023 23:12
* Update CI

This also disables the bug report template lint and webpacker build temporarily since its been failing for awhile and I haven't been able to resolve. Also updates bundler in bundled with in lock file.

* bundle update nokogiri

* Remove pry and pry-byebug

This isn't needed at the moment. Removing will resolve a Ruby 3.2 error.

```
undefined method `=~' for class `Pry::Code' (NameError)
```
This runs eslint using reviewdog so any warnings appear as inline annotations in the "Files changed" tab.
* Replace mdl with markdown lint workflow

This will use annotations and show up inline in a PR.

* Remove mdl gem

The rails_61 gemfile has groups that don't apply to it as we use this just for running tests, not lint/docs etc.

* Update markdown file

Minor editor to remove unnecessary mention of bundler version since its very outdated but also because bundler comes with Ruby anyway, so just a recent Ruby version needs to be installed.
* Add rubocop workflow

* Remove rubocop rake task
Bumps [github-pages](https://github.com/github/pages-gem) from 227 to 228.
- [Release notes](https://github.com/github/pages-gem/releases)
- [Commits](github/pages-gem@v227...v228)

---
updated-dependencies:
- dependency-name: github-pages
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ctiveadmin#7751)

Bumps [loofah](https://github.com/flavorjones/loofah) from 2.19.0 to 2.19.1.
- [Release notes](https://github.com/flavorjones/loofah/releases)
- [Changelog](https://github.com/flavorjones/loofah/blob/main/CHANGELOG.md)
- [Commits](flavorjones/loofah@v2.19.0...v2.19.1)

---
updated-dependencies:
- dependency-name: loofah
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…veadmin#7810)

Bumps [rack](https://github.com/rack/rack) from 2.2.4 to 2.2.6.3.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](rack/rack@2.2.4...v2.2.6.3)

---
updated-dependencies:
- dependency-name: rack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…tiveadmin#7824)

Bumps [globalid](https://github.com/rails/globalid) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/rails/globalid/releases)
- [Commits](rails/globalid@v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: globalid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…n#7822)

Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.3 to 1.5.0.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md)
- [Commits](rails/rails-html-sanitizer@v1.4.3...v1.5.0)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…in#7823)

Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.4.3 to 1.5.0.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/master/CHANGELOG.md)
- [Commits](rails/rails-html-sanitizer@v1.4.3...v1.5.0)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.20.5 to 7.21.0.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.21.0/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…veadmin#7760)

Bumps [pundit](https://github.com/varvet/pundit) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/varvet/pundit/releases)
- [Changelog](https://github.com/varvet/pundit/blob/main/CHANGELOG.md)
- [Commits](https://github.com/varvet/pundit/commits)

---
updated-dependencies:
- dependency-name: pundit
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [eslint](https://github.com/eslint/eslint) from 8.28.0 to 8.36.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.28.0...v8.36.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Isolate general lint to new workflow

This only needs to run on pull request, not both pull request and push like tests.

Remove coverage from rspec lint step for now. Ideally this would just run with tests but if we have Dependabot merge without rebasing first, this can start failing.

* Fix sqlite3 install due to no rebase enforcement

Since we don't enforce PRs to be up to date with master, if Dependabot merges multiple PRs rapidly, we can start running into errors.
Bumps [rollup](https://github.com/rollup/rollup) from 2.79.1 to 3.19.1.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](rollup/rollup@v2.79.1...v3.19.1)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [jquery](https://github.com/jquery/jquery) from 3.6.1 to 3.6.4.
- [Release notes](https://github.com/jquery/jquery/releases)
- [Commits](jquery/jquery@3.6.1...3.6.4)

---
updated-dependencies:
- dependency-name: jquery
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/DatabaseCleaner/database_cleaner/releases)
- [Changelog](https://github.com/DatabaseCleaner/database_cleaner/blob/main/History.rdoc)
- [Commits](DatabaseCleaner/database_cleaner@v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: database_cleaner
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ctiveadmin#7842)

Bumps [jasmine](https://github.com/jasmine/jasmine-gem) from 2.99.0 to 3.99.0.
- [Release notes](https://github.com/jasmine/jasmine-gem/releases)
- [Changelog](https://github.com/jasmine/jasmine-gem/blob/main/RELEASE.markdown)
- [Commits](jasmine/jasmine-gem@v2.99.0...v3.99.0)

---
updated-dependencies:
- dependency-name: jasmine
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…iveadmin#7836)

Bumps [devise](https://github.com/heartcombo/devise) from 4.8.1 to 4.9.0.
- [Release notes](https://github.com/heartcombo/devise/releases)
- [Changelog](https://github.com/heartcombo/devise/blob/main/CHANGELOG.md)
- [Commits](heartcombo/devise@v4.8.1...v4.9.0)

---
updated-dependencies:
- dependency-name: devise
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…iveadmin#7839)

Bumps [launchy](https://github.com/copiousfreetime/launchy) from 2.5.0 to 2.5.2.
- [Release notes](https://github.com/copiousfreetime/launchy/releases)
- [Changelog](https://github.com/copiousfreetime/launchy/blob/main/README.md)
- [Commits](copiousfreetime/launchy@v2.5.0...v2.5.2)

---
updated-dependencies:
- dependency-name: launchy
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

Bumps [database_cleaner](https://github.com/DatabaseCleaner/database_cleaner) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/DatabaseCleaner/database_cleaner/releases)
- [Changelog](https://github.com/DatabaseCleaner/database_cleaner/blob/main/History.rdoc)
- [Commits](DatabaseCleaner/database_cleaner@v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: database_cleaner
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…nks (activeadmin#7838)

Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 2.99.2 to 3.99.0.
- [Release notes](https://github.com/jasmine/jasmine/releases)
- [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md)
- [Commits](jasmine/jasmine@v2.99.2...v3.99.0)

---
updated-dependencies:
- dependency-name: jasmine-core
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
I wonder if this is causing some caching errors with Dependabot PRs. Also ruby/setup-ruby doesn't demo this, just the use of BUNDLE_GEMFILE.
mail gem has been fixed and this is not needed anymore
@javierjulio javierjulio force-pushed the 3157-use-enum-labels-in-current-filters-search-status branch from 17eada7 to 18135b2 Compare March 13, 2023 01:26
javierjulio and others added 3 commits March 12, 2023 21:56
* Update Codecov ignore paths

Use the correct format as documented by Codecov. Ignore the spec directory.

* Bump threshold temporarily due to incorrect ignore
Reset Codecov project threshold

Now that we've fixed the ignore setting we can reset this to start.
- `Etendu du filtre` in french is a nonsense. `Périmètre` is more appropriated

- `Aucun filtres` -> `Aucun filtre` (must be singular)

- `Aucun %{model} trouvé` -> `Aucun(e) %{model} trouvé(e)` : The "model" can be feminine in French 😝
@javierjulio javierjulio force-pushed the 3157-use-enum-labels-in-current-filters-search-status branch from 18135b2 to 5eb6ba1 Compare March 13, 2023 22:23
tagliala and others added 11 commits March 13, 2023 18:53
Make the gem more secure by requiring that all privileged operations by
any of the owners require OTP.

Ref: https://guides.rubygems.org/mfa-requirement-opt-in/
…ctiveadmin#7892)

Bumps [rails](https://github.com/rails/rails) from 6.1.7.2 to 6.1.7.3.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](rails/rails@v6.1.7.2...v6.1.7.3)

---
updated-dependencies:
- dependency-name: rails
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…min#7894)

Bumps [railties](https://github.com/rails/rails) from 6.1.7.2 to 6.1.7.3.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v7.0.4.3/railties/CHANGELOG.md)
- [Commits](rails/rails@v6.1.7.2...v6.1.7.3)

---
updated-dependencies:
- dependency-name: railties
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Updated manually after the fact because Dependabot for some reason was downgrading certain gems like nokogiri and others.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ctiveadmin#7891)

Bumps [rails](https://github.com/rails/rails) from 6.1.7.2 to 6.1.7.3.
- [Release notes](https://github.com/rails/rails/releases)
- [Commits](rails/rails@v6.1.7.2...v6.1.7.3)

---
updated-dependencies:
- dependency-name: rails
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Reran bundle update locally to fix Dependabot downgrades. I'm not sure why its doing that but it shouldn't be. Perhaps an update to the Gemfile will help.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.21.0 to 7.21.3.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.21.3/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Update daily workflow to use root gemfile only

This was failing since we don't have a rails_70 gemfile directory. That's assumed as the default in the root gemfile. We'll just use that for now.

Update workflow id to jruby_tests.

Only run workflow on the activeadmin repo, do no run on forks.

* Migrate jruby lint job to daily workflow

All this did was run the bug report template but since we run the full tests on jruby in the daily workflow just makes sense to run it there and not part of regular CI.

* Migrate gherkin-lint to optimized workflow

No need to run gherkin-lint from Ruby. We can run it in an optimized workflow that will only run when applicable.

* Update simplecov to filter spec directory

* Bundle update all outdated dependencies

For some reason Dependabot is downgrading some dependencies in the rails_61_* gemfiles but I don't know why.

* Only set COVERAGE on test run steps

Since we build the test app, the COVERAGE variable exists then and is triggering simplecov when we don't want it too.

* Add github-actions to Dependabot config

* Adjust codecov project threshold

* Remove git setup step in lint workflow

In the CI workflow, indicate that get setup is needed for the test app setup step.
* Run daily workflow at noon

* Migrate bug report template to optimized workflow

This extracts the bug report template check from the lint workflow to its own workflow so it only runs when being updated and now runs on a daily schedule to ensure it completes successfully since we may not be changing it much at all.

* For gemfiles/* use monthly interval

These shouldn't change as much (mostly with rails) but we aren't as interested in updating so frequently. Also issues with Dependabot downgrading dependencies that it shouldn't be so we want to review without auto merging for now. Just too hard to manage for ActiveAdmin due to the number of dependencies we declare.

* For npm use monthly interval

Despite this being the root package and we want to keep up to date, these packages tend to be noisy since they have such frequent releases. Let's try updating on a monthly basis.

* Delete mergify.yml

Dependabot is downgrading dependencies it shouldn't be but its hard to manage with several gemfiles and all being auto merged. If it weren't for the wrong downgrading issue, I don't mind auto merging but its hard to manage so let's try it without for now. We'll leave it on for Arbre/Inherited Resources since they have far fewer dependencies compared to ActiveAdmin.

* Don't use bundler to run bug report template

* Add concurrency to tests CI
* Simplify ci concurrency

We can just use the actual event name to clarify intent.

* Add concurrency and cancel on pull request only

* Disable daily workflow due to failures

I believe this jruby test started failing after upgrading nokogiri/racc due to the error. It's very time consuming to keep this up to date and passing with minor updates. For now we'll disable and see if others can resolve, if not we'll just remove this workflow.

* Update comment for schedule cron value

To clarify that these times are in UTC per docs.

* Reset codecov project default threshold

We should have resolved most Codecov issues regarding files that should be ignored so this should be ok to maintain going forward.
@javierjulio javierjulio force-pushed the 3157-use-enum-labels-in-current-filters-search-status branch from 5eb6ba1 to ff3c597 Compare March 19, 2023 01:30
@javierjulio javierjulio force-pushed the 3157-use-enum-labels-in-current-filters-search-status branch from ff3c597 to 0221992 Compare March 19, 2023 01:39
@npgretz
Copy link

npgretz commented Mar 6, 2024

Just wanted to add this is very much still a desired feature for me! I explained another work around with Enumerize in my comment on this closed thread: activeadmin#3157 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants