From 4bcb14e8bdbaaefa59d61c6ffb4d9035961f6d13 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Thu, 23 Apr 2020 16:32:14 +0300 Subject: [PATCH 1/8] magento2-login-as-customer/issues/90: Static tests fix. --- .../LoginAsCustomer/Block/Adminhtml/Login.php | 2 ++ .../Plugin/Button/ToolbarPlugin.php | 23 +++++++++++-------- .../Magento/LoginAsCustomer/composer.json | 14 +++++++++-- .../LoginAsCustomer/etc/frontend/di.xml | 2 +- .../layout/loginascustomer_login_grid.xml | 2 +- .../loginascustomer_login_grid_block.xml | 12 +++++----- .../frontend/web/js/view/loginAsCustomer.js | 2 +- 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php b/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php index b7aa3487672b2..fd454f96abf95 100755 --- a/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php +++ b/app/code/Magento/LoginAsCustomer/Block/Adminhtml/Login.php @@ -9,6 +9,8 @@ /** * Login as customer log + * + * @api */ class Login extends \Magento\Backend\Block\Widget\Grid\Container { diff --git a/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php b/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php index 20b0332ae76d2..64a0ad8a872a0 100644 --- a/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php +++ b/app/code/Magento/LoginAsCustomer/Plugin/Button/ToolbarPlugin.php @@ -7,14 +7,12 @@ namespace Magento\LoginAsCustomer\Plugin\Button; -use \Magento\LoginAsCustomerAdvanced\Controller\Adminhtml\Order\Login as LoginController; -use \Magento\Backend\Block\Widget\Button\Toolbar\Interceptor; -use \Magento\Framework\View\Element\AbstractBlock; -use \Magento\Backend\Block\Widget\Button\ButtonList; +use Magento\Backend\Block\Widget\Button\ButtonList; +use Magento\Backend\Block\Widget\Button\Toolbar; +use Magento\Framework\View\Element\AbstractBlock; /** - * Class ToolbarPlugin - * @package Magento\LoginAsCustomerAdvanced\Plugin\Button + * Plugin for \Magento\Backend\Block\Widget\Button\Toolbar. */ class ToolbarPlugin { @@ -42,12 +40,15 @@ public function __construct( } /** - * @param \Magento\Backend\Block\Widget\Button\Toolbar\Interceptor $subject + * Add Login As Customer button. + * + * @param \Magento\Backend\Block\Widget\Button\Toolbar $subject * @param \Magento\Framework\View\Element\AbstractBlock $context * @param \Magento\Backend\Block\Widget\Button\ButtonList $buttonList + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforePushButtons( - Interceptor $subject, + Toolbar $subject, AbstractBlock $context, ButtonList $buttonList ):void { @@ -71,7 +72,11 @@ public function beforePushButtons( ]); $buttonList->add( 'guest_to_customer', - ['label' => __('Login As Customer'), 'onclick' => 'window.open(\'' . $buttonUrl . '\')', 'class' => 'reset'], + [ + 'label' => __('Login As Customer'), + 'onclick' => 'window.open(\'' . $buttonUrl . '\')', + 'class' => 'reset' + ], -1 ); } diff --git a/app/code/Magento/LoginAsCustomer/composer.json b/app/code/Magento/LoginAsCustomer/composer.json index 5b0ade832bbcd..c5aa42e1a1f4b 100755 --- a/app/code/Magento/LoginAsCustomer/composer.json +++ b/app/code/Magento/LoginAsCustomer/composer.json @@ -4,11 +4,21 @@ "require": { "magento/framework": "*", "magento/module-backend": "*", - "magento/module-sales": "*", + "magento/module-checkout": "*", "magento/module-customer": "*", - "magento/module-checkout": "*" + "magento/module-sales": "*", + "magento/module-store": "*", + "magento/module-ui": "*", + "magento/module-user": "*" + }, + "suggest": { + "magento/module-page-cache": "*" }, "type": "magento2-module", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], "version": "2.2.1", "autoload": { "files": [ "registration.php" ], diff --git a/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml b/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml index 5f0f784e051e3..1cf46eadddc2c 100755 --- a/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml +++ b/app/code/Magento/LoginAsCustomer/etc/frontend/di.xml @@ -13,7 +13,7 @@ - Magento\LoginAsCustomer\CustomerData\LoginAsCustomer + Magento\LoginAsCustomer\CustomerData\LoginAsCustomer diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml index 6f400c0e5c601..e298729b5422b 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid.xml @@ -5,7 +5,7 @@ * See COPYING.txt for license details. */ --> - + diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml index 8f38fab2e2e7a..b75a5b0a68621 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/layout/loginascustomer_login_grid_block.xml @@ -18,7 +18,7 @@ - + ID login_id @@ -26,7 +26,7 @@ col-id - + Customer ID customer_id @@ -34,7 +34,7 @@ col-title - + Customer Email email @@ -42,7 +42,7 @@ col-title - + Admin ID admin_id @@ -50,7 +50,7 @@ col-title - + Admin Name username @@ -58,7 +58,7 @@ col-title - + Logged In created_at diff --git a/app/code/Magento/LoginAsCustomer/view/frontend/web/js/view/loginAsCustomer.js b/app/code/Magento/LoginAsCustomer/view/frontend/web/js/view/loginAsCustomer.js index 215148a7e7dec..11ff23350483f 100644 --- a/app/code/Magento/LoginAsCustomer/view/frontend/web/js/view/loginAsCustomer.js +++ b/app/code/Magento/LoginAsCustomer/view/frontend/web/js/view/loginAsCustomer.js @@ -22,7 +22,7 @@ define([ this._super(); this.customer = customerData.get('customer'); - this.loginAsCustomer = customerData.get('logged_as_customer'); + this.loginAsCustomer = customerData.get('loggedAsCustomer'); this.isVisible(this.loginAsCustomer().admin_user_id); this.notificationText = $.mage.__('You are connected as %1 on %2') From 2004134135e609e28df120dfd27630c8f076a406 Mon Sep 17 00:00:00 2001 From: Pavel Bystritsky Date: Thu, 23 Apr 2020 16:40:54 +0300 Subject: [PATCH 2/8] magento2-login-as-customer/issues/90: Integration tests fix. --- .../adminhtml/ui_component/customer_form.xml | 13 ++--- .../ui_component/manual_store_form.xml | 49 ++++++++++--------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml b/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml index 82988c801ef7d..43c746f186da0 100755 --- a/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml +++ b/app/code/Magento/LoginAsCustomer/view/adminhtml/ui_component/customer_form.xml @@ -5,10 +5,11 @@ * See COPYING.txt for license details. */ --> -
- - - Magento\LoginAsCustomer\Block\Adminhtml\Customer\Edit\Login - - + + + +