[BUGFIX] Allow any navigation component to load in BE 88/51888/7
authorBenni Mack <benni@typo3.org>
Tue, 28 Feb 2017 10:12:32 +0000 (11:12 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 15 Mar 2017 08:02:54 +0000 (09:02 +0100)
Since the ExtJS viewport refactoring in 8.5, it is not possible
anymore to load any other registered navigation component,
which makes EXT:commerce to not work anymore.

The patch changes the hard-coded pagetree app component
to fetch it from the pool of available navigation components.

Resolves: #80058
Releases: master
Change-Id: I1ce4cfa068f72f39cd5d993df6f9ebbdb7d07b2e
Reviewed-on: https://review.typo3.org/51888
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Thomas Maroschik <tmaroschik@dfau.de>
Tested-by: Thomas Maroschik <tmaroschik@dfau.de>
Reviewed-by: Sebastian Fischer <typo3@evoweb.de>
Tested-by: Sebastian Fischer <typo3@evoweb.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
components/testing_framework/Classes/Core/Acceptance/Support/Page/PageTree.php
typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js

index 159c508..c5fc49c 100644 (file)
@@ -71,6 +71,7 @@ class PageTree
     {
         $I = $this->tester;
         $I->switchToIFrame();
+        $I->waitforelementVisible(self::$pageTreeSelector);
         return $I->executeInSelenium(function (\Facebook\WebDriver\Remote\RemoteWebDriver $webdriver) {
             return $webdriver->findElement(\WebDriverBy::cssSelector(self::$pageTreeSelector));
         });
index 5da493b..e7481a6 100644 (file)
@@ -209,7 +209,7 @@ require(
                                        return;
                                }
                                if (this.loadedNavigationComponentId !== '') {
-                                       Ext.getCmp(this.loadedNavigationComponentId).hide();
+                                       $('#navigationComponent-' + this.loadedNavigationComponentId).hide();
                                }
                                if ($('.t3js-scaffold-content-navigation [data-component="' + navigationComponentId + '"]').length < 1) {
                                        $('.t3js-scaffold-content-navigation')
@@ -217,12 +217,29 @@ require(
                                }
                                var component = Ext.getCmp(navigationComponentId);
                                if (typeof component === 'undefined') {
-                                       /** @todo fix hard coded pagetree **/
-                                       component = new TYPO3.Components.PageTree.App();
-                                       component.render('navigationComponent-' + navigationComponentId);
+                                       var self = this,
+                                               deferredComponentExists = $.Deferred();
+
+                                       function checkIfComponentIdIsAvailable(componentId) {
+                                               if (typeof self.availableNavigationComponents[componentId] === 'undefined') {
+                                                       setTimeout(function (id) { checkIfComponentIdIsAvailable(id); }, 100, componentId);
+                                               } else {
+                                                       deferredComponentExists.resolve();
+                                               }
+                                       }
+                                       checkIfComponentIdIsAvailable(navigationComponentId);
+
+                                       deferredComponentExists.promise().done(function() {
+                                               component = self.availableNavigationComponents[navigationComponentId]();
+                                               component.render('navigationComponent-' + navigationComponentId);
+
+                                               TYPO3.Backend.NavigationContainer.show(navigationComponentId);
+                                               self.loadedNavigationComponentId = navigationComponentId;
+                                       });
+                               } else {
+                                       TYPO3.Backend.NavigationContainer.show(navigationComponentId);
+                                       this.loadedNavigationComponentId = navigationComponentId;
                                }
-                               TYPO3.Backend.NavigationContainer.show(navigationComponentId);
-                               this.loadedNavigationComponentId = navigationComponentId;
                        },
 
                        registerNavigationComponent: function (componentId, initCallback) {