-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
Setup UI - Validate that at least one "Component" is enabled #17778
Conversation
(Standard links)
|
@totten is this 'ok-without-test'? |
@eileenmcnaughton Yeah, I think it's OK without a test. Note that this PR is an offshoot of #17749 which @herbdool has IMHO, the main test suite doesn't have a good harness for installer tests. However, we do have QA coverage of it by way of: (1) implicit testing in CI (i.e. some CI builds rely on the same "setup" API) |
@totten I think this needs a rebase to eliminate most of the commits? |
Use-case: You run the installer with an empty list of `components` Before: The installer begins running - but then crashes half way through After: The installer doesn't even begin - because the requirement-check fails. Comment: There are guards in both `checkRequirements` and `installDatabase`. They're slightly redundant, but not strictly redundant (e.g. in cases of installer bugs or wonky plugins).
87691c0
to
fe4a84d
Compare
@eileenmcnaughton Quite right. It's rebased now, so the commits are tidier. |
setup/res/installer.js
Outdated
this.on('change', cb); | ||
return this; | ||
}; | ||
})($); |
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 this right?
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.
@seamuslee001 You're asking if the closure is properly formed? Well, $
seemed to bind correctly.
Note that the setup page doesn't have all the normal services of a Civi page, so we work from first principles. JS on the setup page loads like this:
<script type="text/javascript" src="http://dmaster.bknix:8001/sites/all/modules/civicrm/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="http://dmaster.bknix:8001/sites/all/modules/civicrm/setup/res/installer.js"></script>
<script type="text/javascript">
window.csj$ = jQuery.noConflict();
</script>
Which means the JS file should be written in the style of a vanilla jQuery plugin.
Double-checking some other examples (jquery.jeditable.js
, jquery.notify.js
, jquery.tokeninput.js
, etc), it seems more typical for vanilla-style jQuery plugins to take the input as jQuery
. So on style grounds this snippet is a little off.
I'm pushing an update to make it clearer that this file works like a vanilla jQuery plugin.
1. Conventional for jQuery plugins to be named `jquery.foo.js` 2. Conventional to bind to `window.jQuery` at load-time
test this please @herbdool did you test this one too? |
test this please |
I haven't tested this but I could try next week. |
thanks @herbdool |
@eileenmcnaughton @totten PR works for me. JS validation: all good. I get the error and cannot continue unless I select at least one component. PHP validation: all good. I removed the JS and tested the process. It also gives me an error message. |
thanks @herbdool |
Overview
Suppose an admin uses the "Setup UI" to perform installation - and disables all components. The behavior should be less crashy.
Before
The user is allowed to start the installation. It aborts mid-way through, leaving the system in an inconsistent state.
After
There are now two more guards:
components
, it will complain during thecheckRequirements
phase -- before installation begins.Comments
This PR builds on #17749. It is not logically dependent, but it is technically dependent - because they both touch the list of
<script>
tags used on the "Setup" screen. Consequently, the list of commits is a bit long right now - this PR is really just the last three commits.