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

4860-deprecate-and-remove-dashboards-code #5448

Conversation

lauriejefferson
Copy link
Contributor

Summary

Fixes #4860
This PR adds deprecation warnings to the following views and controllers:

@lauriejefferson lauriejefferson requested a review from a team as a code owner October 23, 2023 16:14
@github-actions github-actions bot added changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem labels Oct 23, 2023
@codecov
Copy link

codecov bot commented Oct 23, 2023

Codecov Report

Merging #5448 (18d6c65) into main (c64e9fd) will decrease coverage by 0.04%.
Report is 112 commits behind head on main.
The diff coverage is 14.28%.

❗ Current head 18d6c65 differs from pull request most recent head 5e67650. Consider uploading reports for the commit 5e67650 to get more accurate results

@@            Coverage Diff             @@
##             main    #5448      +/-   ##
==========================================
- Coverage   88.86%   88.82%   -0.04%     
==========================================
  Files         607      607              
  Lines       14750    14757       +7     
==========================================
+ Hits        13107    13108       +1     
- Misses       1643     1649       +6     
Files Coverage Δ
...ore/lib/spree/permission_sets/dashboard_display.rb 100.00% <100.00%> (ø)
...p/controllers/spree/admin/dashboards_controller.rb 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

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

Thanks for taking a stab at this!

We have some infrastructure for handling deprecations and don't call ActiveSupportDeprecation.warn directly like you have. Instead we use Spree.deprecator. You'll need to switch your code to use that.

Additionally, the DashboardsController is deprecated in a way that simply loading it will trigger the deprecation which is undesirable and the specs themselves don't need to be deprecated. I recommend looking through some past PRs that deprecated things to find some examples of how we've handled similar deprecations in the past to get a feel for how this should be handled.

@jarednorman
Copy link
Member

Thanks for using the deprecator. This still hasn't addressed my other concerns:

Additionally, the DashboardsController is deprecated in a way that simply loading it will trigger the deprecation which is undesirable and the specs themselves don't need to be deprecated. I recommend looking through some past PRs that deprecated things to find some examples of how we've handled similar deprecations in the past to get a feel for how this should be handled.

@lauriejefferson
Copy link
Contributor Author

I need a little help with the DashboardController deprecation. I searched through past PRs and I see #4102 that may relate. From the PR, It does use a deprecator in the OrdersController, but I'm not sure if that code has also been deprecated in favor of Spree.deprecator.

@@ -3,6 +3,9 @@
module Spree
module Admin
class DashboardsController < BaseController
class << self
Spree.deprecator.warn "The Dashboards controller is deprecated. Please use the new admin dashboard."
end
Copy link
Member

Choose a reason for hiding this comment

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

I think if we put this in a before_action the code would only run if the controller is used during runtime and not during app boot. Could you try?

before_action do
  Spree.deprecator.warn "The Dashboards controller is deprecated. Please use the new admin dashboard."
end

Copy link
Member

Choose a reason for hiding this comment

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

Also I find the message a bit confusing. To me it is not clear which one is deprecated and which I should use.

The deprecated controller can simply be logged by using

"The #{self.class.name} controller" ...

in the message. Could you please give a more precise hint which the new controller is? Maybe by using a path or a more precise name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there any response to the changes I made on this pull request?

Copy link
Member

Choose a reason for hiding this comment

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

There isn't a new admin dashboard. This dashboards feature was something that was added to the project, but never actually used in core (and I've never seen it used in store either.) We're not removing this in place of something else, we're just removing it.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, for now there's no replacement. We can say something like:

"The Dashboards controller is deprecated. If you still use dashboards, please copy all controllers and views from solidus_backend to your application."

Copy link
Member

Choose a reason for hiding this comment

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

Also, there's a test failure that I think is related!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kennyadsl Is the above language the same for the DashboardDisplay module, the Home controller and view?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can use a single message that is more generic and we can apply to all. Up to you to choose it, but let me know if I can help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See latest commit.

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @lauriejefferson! I left a couple of comments, but I think we are close. 🙂

@lauriejefferson
Copy link
Contributor Author

@kennyadsl @jarednorman Can this PR be closed?

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

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

Yeah, I think this looks good now.

@tvdeyen
Copy link
Member

tvdeyen commented Apr 5, 2024

@lauriejefferson would you mind to rebase and force push your branch with latest main to retrigger the pipepline? Thanks 🙏🏻

@lauriejefferson lauriejefferson force-pushed the 4860-deprecate-and-remove-dashboards-code branch from 52029c2 to 314703e Compare April 5, 2024 14:39
@lauriejefferson
Copy link
Contributor Author

@tvdeyen Rebase completed.

@lauriejefferson
Copy link
Contributor Author

@jarednorman @tvdeyen @kennyadsl Is there any feedback on this issue?

@jarednorman
Copy link
Member

Nope, I have approved and am just waiting for another person on core to approve.

@tvdeyen
Copy link
Member

tvdeyen commented Apr 11, 2024

@lauriejefferson the spec failures are related. Mind taking another look?

@@ -10,6 +10,7 @@

context "when activated" do
before do
Spree.Deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'
Copy link
Member

Choose a reason for hiding this comment

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

Ah, a typo causes the spec error

Suggested change
Spree.Deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'
Spree.deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'

@@ -18,6 +19,7 @@
end

context "when not activated" do
Spree.Deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Spree.Deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'
Spree.deprecator.warn 'The dashboard_display_spec.rb test is being deprecated. Please update your source code.'

@lauriejefferson
Copy link
Contributor Author

@tvdeyen I fixed the rspec tests. Please review.

@nvandoorn
Copy link
Contributor

Hey @lauriejefferson, I have a revised version of this branch available here: https://github.com/nvandoorn/solidus/tree/4860-deprecate-and-remove-dashboards-code

The specs should pass and everything is up to date. You're welcome to pull these changes if you wish, or I can open another pull request.

@lauriejefferson
Copy link
Contributor Author

@nvandoorn Has your branch been approved? I'm not sure if I need to pull your changes. I may have added what was necessary to complete this issue. @jarednorman @tvdeyen Please advise.

@nvandoorn
Copy link
Contributor

Hey @lauriejefferson, I haven't opened a pull request yet so the changes have not been approved yet.

I believe the current revision of this pull request needs a revision for the specs to pass as indicated by @tvdeyen's last comment.

@lauriejefferson
Copy link
Contributor Author

@jarednorman @tvdeyen @nvandoorn I pulled @nvandoorn changes into my local branch and everything's up to date. Can you verify that the correct specs have been added? Please advise.

@jarednorman
Copy link
Member

I think we're good.

@lauriejefferson
Copy link
Contributor Author

@jarednorman @kennyadsl Can this PR be closed?

@kennyadsl
Copy link
Member

@lauriejefferson thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem changelog:solidus_core Changes to the solidus_core gem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate and remove "dashboards" code
5 participants