-
Notifications
You must be signed in to change notification settings - Fork 991
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
Fixes #37664 - switch to using js-cookie #10250
base: develop
Are you sure you want to change the base?
Conversation
Should I try to create a packaging PR as well for this? @theforeman/packaging |
@@ -81,7 +82,7 @@ function onContentLoad() { | |||
|
|||
tfm.i18n.intl.ready.then(function() { | |||
var tz = jstz.determine(); | |||
$.cookie('timezone', tz.name(), { | |||
Cookies.set('timezone', tz.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.
In other places we use tfm
to pull in code from webpack. If we do that, I think we can avoid the Ruby dependency on js_cookie_rails
.
I actually wonder why we need the timezone cookie. Some of my digging.
It was added in ad998ce. There it has set_timezone
in app/controllers/concerns/application_shared.rb
but that was moved to app/controllers/concerns/foreman/controller/timezone.rb
in d1e1858. That makes me think it's still used. A quick look on the internet tells me this design is still a best practice.
Having said that: tfm.i18n.intl.ready
looks to be coming from webpack code so you can also consider moving the whole cookie setting code to webpack.
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.
its used in rubys set_timezone.
I moved it to webpack
cca3247
to
1477aa4
Compare
1477aa4
to
c90eb44
Compare
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.
If you want to take a stab at packaging then please
Added packaging pr theforeman/foreman-packaging#11048 |
c90eb44
to
7ba72c5
Compare
Added it to tfm as well as some plugins are using 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.
Did you have a look at the test failure? I think I've seen that one pop up in multiple tests but haven't looked into it yet.
Yeah I see test_0002_correctly override global params fail on some prs and cant reproduce it locally |
I bet it'll turn out to be some nasty race condition or theforeman/actions#53 |
7ba72c5
to
c842625
Compare
Rebased |
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.
Ran npm install and tested
_ForemanSelectedhosts
cookie value is updated as expected. LGTM 👍
/packit build |
The packit build failures will probably need more changes here
|
This change will require a specfile update (new dependency), and thus I don't think the packit build step will ever pass on the PR. |
@ehelms doesnt the packaging update (was merged already) take care of that? |
The packaging PR (https://github.com/theforeman/foreman-packaging/pull/11048/files) adds the package but does not update Foreman to require the package. Thus it does not get pulled in during build time and the above error occurs. This is a bit of a chicken and egg problem. We do not update the spec with new dependencies until the code has the dependency merged, but RPM builds will fail until we update the spec with the new build. We tend to just accept that packit will fail in this case and that's OK. |
theforeman/foreman-packaging#8414 intends to solve that by dynamically generating the build requires. We're working on dropping EL8, which was a blocker to using this. I also need to write the NodeJS side of it, but I don't expect to wrap that up in time for this PR. |
replaces jquery.cookie with js-cookie, as jquery.cookie has moved to js-cookie