Closed (fixed)
Project:
Domain
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
4 Oct 2018 at 08:50 UTC
Updated:
10 Jul 2020 at 11:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gaydabura commentedInterface added and reworked using last changes.
Comment #3
agentrickardThanks. Does this patch make any changes to what's in https://github.com/agentrickard/domain/pull/434? If so, it isn't immediately clear.
And what is the interdiff running against?
Note: what we really need now are tests. That's what's holding up this feature.
Comment #4
gaydabura commented@agentrickard its rebase including latest changes from github, and some addition work (Interface isolated). Interdiff against previous patch.
Comment #5
agentrickardI can't integrate this without a patch against the GutHub branch or isolation of the new work.
Comment #6
agentrickardThis new interface has been added, thanks to @gaydabura.
Probably easiest to pull patches from https://patch-diff.githubusercontent.com/raw/agentrickard/domain/pull/43...
Comment #7
aspilicious commentedAgentrickard, your patch doesn't apply so I uploaded a new one.
Comment #8
agentrickardYes, I've been actively making changes over in GitHub.
The link in comment #6 should always have the latest changes.
https://patch-diff.githubusercontent.com/raw/agentrickard/domain/pull/43...
Comment #9
joekersI just started to play around with this and I'll report back any issues I have.
What is needed to get this merged into the dev branch?
Comment #10
agentrickardI've been on vacation. The missing piece is automated tests.
Comment #11
agentrickardComment #12
sorlov commentedNeed to reroll this patch according to latest dev version (mostly related to changes in .travis.yml)
Comment #13
agentrickardHere's the latest version.
What I really need help with is conversion of the DomainConfigUIOverviewTest to support the Ajax load of the form element. It looks like we have to use FunctionJavascript for that.
See https://www.drupal.org/docs/8/phpunit/running-phpunit-javascript-tests
Comment #14
andypostLatest patch looks great! just needs lots of clean-up
Most critical is
- request usage and passing from controllers to service methods
- session changes - stop using global and use from request
Remains are info file and DI clean-ups - not critical
it should be only one of them, better use
core_version_requirement: ^8.7.7 || ^9https://www.drupal.org/node/3070687
OTOH maybe it is not needed for submodules!
needs to explore if lazy builders can help here... also it could be packaged to controller
SwitchForm::classto keep usagecould use
$route_matchvariable to call less\Drupal::could use comment why 1
It looks constructor could be removed for setter only - then less dependency on parent class
t()calls also TODO to clean-upwhy request object serialized?
Looks
getSelectedConfigName()require $request argument to bypass from usage placesAlso sessions needs convert for 8.9 and 9.0 https://www.drupal.org/node/3109877
Maybe mark it internal for a while? to decide about session and request by-pass?
Related #2473875: Convert uses of $_SESSION to symfony session retrieved from the request
Could extend
ConfirmFormBaseorConfigFormBaseTBD convert sessions
missing logger and messenger services, or messenger added via setter?
missing
$this->t()$modulesproperty are protectedAlso it needs defaultTheme for 8.8 https://www.drupal.org/node/3083055
it will bring flux to tests, the same for wait ajax in js-tests
could use to return
$thisto use chaining insetUp()Comment #15
agentrickardI am totally NOT ready for that kind of critique.
My focus right now is test coverage.
Once tests are passing, we can worry about these issues.
Comment #16
andypostIt's not a critique, just review of current state from #d9readiness point of view
About tests - missing test coverage for manager and overrides - probably kernel test should be enough
The trick is to test variations of domain override and domain + language override
Comment #17
agentrickardD9 readiness is a separate issue that comes after getting the code working.
We have variations of domain/language testing in Domain Config now. What we need coverage for is this new form interaction.
The challenge right now is that I can't get the UI to properly save the form without using JS tests -- and using JS tests, things fail that work using Functional tests.
Here's the latest patch. See Drupal\Tests\domain_config_ui\FunctionalJavaScript\DomainConfigUIOverrideTest
Comment #18
agentrickardMaybe it will be enough to test whether the config changes get saved...
Comment #19
andypostGood point! But checking anyway require to wait for click and then do check.
Comment #20
agentrickardYup, I made it work. The test could use a review.
Comment #21
agentrickardComment #22
agentrickardRemoves empty tests.
Comment #23
agentrickardsigh.
Comment #25
agentrickardTests are passing locally (using Drupal 8.9-dev). Not sure what's going on with testbot.
Comment #26
agentrickardComment #28
agentrickardMoved the failing test to FunctionalJavaScript and it works locally and on Travis.
Comment #29
agentrickardNew version with good test coverage.
Now it is ready for code review.
Comment #31
agentrickardThis has been testing just fine for me locally but failing on Travis and d.o., and I don't know why.
Comment #32
vacho commented@agentrickard Thanks for this great contribution here. To enhance the code my first review is Coding Standards. To contribution I fixed all of this and this is a new patch with it.
Comment #33
vacho commentedinterdiff patch 30 - 32
Comment #35
agentrickardRight now, I am more concerned with figuring why the tests fail.
Comment #36
vacho commentedThe first error looks like a environment is not setting to let "one" subdomain. Maybe is needed more work here. BTW I note that the tests works well at 1 April 2020 and now not. So they are several changes at tests that now the module domain tests needs maitenance.
1) Drupal\Tests\domain\Functional\Views\ActiveDomainDefaultArgumentTest::testActiveDomainDefaultArgument
GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: one.php-apache-jenkins-drupal8-contrib-patches-31009
Comment #37
agentrickardYes, but there is no explanation for why this would start failing now. We haven't made any changes to the test setup.
What "changes at tests" are you referring to?
Comment #38
hbensalem commentedHello,
installation breaks, on this line :
DomainConfigUIManager.php
$this->request is empty on the batch execution maybe.
another error :
Error: Call to a member function get() on null in Drupal\domain_config_ui\DomainConfigUIManager->getSelectedLanguageId() (line 62 of modules/contrib/domain/domain_config_ui/src/DomainConfigUIManager.php).
Same reason i think.
thx
Comment #39
agentrickardHow are you installing? I would expect to see this error when running tests.
[UPDATE]
I cannot replicate that report on a clean installation of Drupal 8.9, using the UI or Drush for enabling modules.
Please open a new issue with more information.
Comment #40
vacho commentedRespect to comment #38
Installation works fine. with drupal 8.8.6-dev + domain 8.x-1.x
Respect to comment #37
Currently the test Drupal\Tests\domain\Functional\Views\ActiveDomainDefaultArgumentTest::testActiveDomainDefaultArgument fail for branch 8.x-1.x too, soo it is not a problem only for this patch.
I recently created this issue here: 3134564
I Think that first is needed to fix it because fails at main branch contribution and it propage to all another issues.
Comment #41
agentrickardThe testing issue is a problem with configuration of the host, see #3133850: Subdomain registration has started failing. These tests all pass locally for me.
Comment #42
agentrickardTrying the advice from #3133850: Subdomain registration has started failing
Comment #43
agentrickardComment #45
agentrickardNew patch.
Comment #47
agentrickardOne more time.
Comment #49
agentrickardComment #51
agentrickardTry setting HOSTNAME directly.
Comment #53
agentrickardComment #54
agentrickardComment #55
agentrickardComment #57
vacho commented@agentrickard what are you doing? can you up some explain what is the difference between patch to patch. BTW is a good practice to add a interdiff.
Comment #58
andypostAll changes are about related, to make tests to work in drupal-ci
Comment #59
agentrickardI don't interdiff my own projects.
These patches are entirely because the tests pass fine locally, but started failing due to a change to the d.o. testbot.
Comment #60
agentrickardAt this point, I'm very frustrated by the testing. This is all working fine on local. I can't make Travis handle FunctionalJavaScript, and a change to d.o. testing broke our test runner.
I am considering two paths:
1) Commit this as is, and fix code-style and D9 issues separately.
2) Abandon this and leave it a patch only unless someone wants to support it as a standalone module.
Comment #61
agentrickardAnd no one has an opinion? Has anyone tried running the tests locally?
Comment #62
aspilicious commentedI have a few clients using this patch, so we need it when porting to D9.
When the client agrees I can arrange some time to verify the tests locally.
At the moment I don't have an opinion.
Comment #63
agentrickardThank you!
Comment #64
rebecca.healan@turner.com commentedI checked out the code from Github and played around with it on my local. It works great for our purposes, and I would love if it were able to be committed. A couple notes:
- I ran the Functional and FunctionalJavascript tests on my local on 8.8.4 and they all passed. I had attempted to run them on 8.7.1 and the Stark theme was not available, which broke one of the tests.
- On /admin/appearance, settings in the 'Administrative Theme' section are saved per domain, but setting a theme as default for the general site was always saved for all domains. This was confusing to me, and I think additional info should be present in the UI on that page. This could definitely be a follow-up issue.
- When I created an authenticated user as a Domain Administrator to one of my three domains, and gave the user the permission 'Manage domain-specific configurations', they were able to manage both their assigned domain and All Domains. Managing All Domains is a lot more power than I would expect that permission to have. This could also be a follow-up issue.
Comment #65
agentrickardThanks for that review.
I think we should take a look at item 3. If that is too much power, it's an error in the logic. Since we already have tests for things, it should be fairly easy to check.
Comment #66
agentrickardSo there is this note in the code: SwitchForm::getDomainOptions()
Perhaps we should add an additional permission here.
The reason it's available here is that by default, you would have to have permission to set the setting without this module (e.g. Administer site settings).
Given that you may have multiple admins who should only set that value for a specific domain, adding a permission to 'set default site value' or similar seems wise.
Comment #67
agentrickardCorrected an error with config loading in Drupal 8.9 and added a new permission 'set default domain configuration'.
Comment #68
agentrickardImproved patch that sets the warning message string properly and updates the README.
Comment #69
pianomansam commented@agentrickard with patch #7 and even patch #68, I'm getting an error in Drush since upgrading to Drush 10:
Apparently, in Drush 10
$request_stack->getCurrentRequest()is null. To resolve this, I updated line 47 to:and line 59 to:
Comment #70
featherbellyI am so happy to see this! (had come across Domain Theme Switch and Domain Site Settings which OK for basic use cases but do not offer the same level of flexibility).
Really appreciate all this hard work and would be great to see this committed :-)
Have installed patch at #68 via composer and will report back any findings/feedback. I'll be extending site settings form across 20+ domains and using specific themes.
(I'm a comparative newbie contributing to issue threads or testing patches so feel free to offer any specific guidance on assisting constructively).
Comment #71
agentrickard@pianomansam
What drush command are you running that triggers that error?
Comment #72
pianomansam commented@agentrickard pretty much anything... even a
drush status.Comment #73
hbensalem commentedHello, i'm having the same errors as #69, the proposed changes removes the errors (i have Drush Commandline Tool 9.7.2 )
But i'm having another issue, testing with css_vars module and a custom config form module, changing the domain reloads the page with the same exact variables and it's always "All domain" (its like nothing is happening)
variable is correctly passed in the url but the default option doesn't change ( please see the screen capture)
Thank you :)
Comment #74
hbensalem commentedOk i have done some debugging, for me it seems to be a depedency injection problem, the request_stack doesn't contain the query params
Made some changes in getSelectedDomainId()
and getSelectedLanguageId :
and everything works fine for me, no errors on drush and the domain change affects correctly the variables.
thx
Comment #75
agentrickard@pianomansam and @hbensalem
What Drupal version are you running?
Comment #76
hbensalem commented@agentrickard drupal 8.9
Comment #77
agentrickardThanks. Are there other domains in that dropdown on the form?
Comment #78
hbensalem commentedyes 4 in total
Comment #79
pianomansam commentedI'm also using Drupal 8.9 with Drush 10.
Comment #80
agentrickardI cannot replicate that drush error. Perhaps it's an issue with drush launcher?
Comment #81
agentrickardThese sorts of dependency injection failures and request interruptions typically happen when you have a module like Shield installed. Modules that implement the Middleware layer interfere with DI in very unpredictable ways.
I don't like the idea of removing dependency injection here, though we have to do similar things in
Drupal\domain_config\DomainConfigOverrider::initiateContext()Comment #82
agentrickardHere's a new patch against the latest changes to 8.x-1.x.
Notes:
* To test, you must start from a clean install or rebuild the container (drush cr), since the service definition for `domain_config_ui.manager` has changed.
* It is possible that this will still throw the errors reported in #74, in which case we have to move the call out of the __construct() method and into getSelectedConfigName().
Comment #83
hbensalem commentedHi @agentrickard
thx for the patch but still doesn't work for me, i can't start from a fresh install for testing, but i did what you suggested.
1/ apply patch, drush cr
2/ comment getSelectedDomainId / getSelectedLanguageId() $this->request->get part
- drush cr
=> no errors
3/ put back code
- drush status
thx
Comment #84
hbensalem commentedSo these changes work for me ;
- put back the depedency injection. :
change the constructor :
Change the functions :
Comment #85
pianomansam commentedI don't have Shield installed nor do I have any modules that are modifying RequestStack AFAIK.
Comment #86
agentrickard@hbensalam
So that would suggest that the RequestStack isn't always populated with currentRequest -- which is not something I can reproduce.
@pianomansam
Then your issue is probably with Drush Launcher not providing a url param. You may have to pass one manually.
Comment #87
hbensalem commented@agentrickard only way that RequestStack can be populated is to put back the dependency .. i dont know how it works in you current setup
can you confirm that the proposed changes doesn't break the standard behavior ?
and like @pianomansam i dont have any module that are modifying the RequestStack.
thx.
Comment #88
agentrickardFixed up the Request / RequestStack load issue with some consistency. We do need to ensure that both lookups use the same request object,.
Comment #89
hbensalem commented@agentrickard patch #88 works fine for me, thx ! ( ^____^ )
this module will be used on a live production site very soon, will keep you update ;)
Comment #90
agentrickardGreat! I'm still confused about why that happened, but I think the code is fine.
Comment #91
agentrickardNew patch now that d.o. testing is working again!
Comment #92
agentrickard@pianomansam We will need to address that in a follow-up issue. I think this is ready for commit once we do a little code cleanup.
Comment #93
agentrickardAnd a final revision with code style issues corrected. This patch also includes D9 compatibility.
Comment #94
agentrickardOne more cleanup.
Comment #96
agentrickardOne more time.
Comment #97
agentrickardAfter a lot of work by a whole bunch of people, I have committed this patch.
Comment #99
pianomansam commentedI've upgraded to Beta 1 which includes this commit, and I am no longer seeing issues running commands in Drush 10.
Comment #100
featherbellyKudos, everybody.