-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
4860-deprecate-and-remove-dashboards-code #5448
Conversation
Codecov Report
@@ 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
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this 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.
Thanks for using the deprecator. This still hasn't addressed my other concerns:
|
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated controller.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See latest commit.
There was a problem hiding this 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. 🙂
@kennyadsl @jarednorman Can this PR be closed? |
There was a problem hiding this 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.
@lauriejefferson would you mind to rebase and force push your branch with latest |
52029c2
to
314703e
Compare
@tvdeyen Rebase completed. |
@jarednorman @tvdeyen @kennyadsl Is there any feedback on this issue? |
Nope, I have approved and am just waiting for another person on core to approve. |
@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.' |
There was a problem hiding this comment.
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
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.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.' |
@tvdeyen I fixed the rspec tests. Please review. |
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. |
@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. |
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. |
@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. |
I think we're good. |
@jarednorman @kennyadsl Can this PR be closed? |
@lauriejefferson thanks for the contribution! |
Summary
Fixes #4860
This PR adds deprecation warnings to the following views and controllers: