Skip to content

Conversation

pacco-a
Copy link
Contributor

@pacco-a pacco-a commented Oct 18, 2022

Prevent the "Browse to find or drag image here" button to disappear when an image is added in a multiple files image form element.

Description (*)

The only modification in the code is the addition of the already existing (and utilized) property "isMultipleFiles" into the condition that determine whether the "Browse to find or drag image here" button should be display or not.

In doing so, when the user add an image to the multiple files image form element, the "Browse to find or drag image here" is still there.

This is useful to inform the user that the form element can take multiple images and that these images can be drag and drop, especially when the form element is initially populated with existing images.

Manual testing scenarios (*)

  1. Create an adminhtml UI form with an imageUploader element.
  2. Define the "isMultipleFiles" boolean property to true in this element.
  3. Check the form, the "Browse to find or drag image here" button disappear after the first image is uploaded.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] add isMultipleFiles property to image form element template #39219: add isMultipleFiles property to image form element template
@m2-assistant
Copy link

m2-assistant bot commented Oct 18, 2022

Hi @webPacco. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@MeCapron
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@sidolov sidolov added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Oct 20, 2022
@ishakhsuvarov
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

@magento run Integration Tests, Functional Tests EE, Functional Tests CE, Functional Tests B2B

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Echo
Copy link
Contributor

engcom-Echo commented Nov 29, 2022

Hi @pacco-a

The issue is not reproducible on 2.4-develop branch.
Below are the steps we have followed to reproduce the issue.

  1. Create an adminhtml UI form with an imageUploader element.
 <field name="image"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">string</item> <item name="source" xsi:type="string">image</item> <item name="label" xsi:type="string" translate="true">Image</item> <item name="visible" xsi:type="boolean">true</item> <item name="isMultipleFiles" xsi:type="boolean">true</item> <item name="formElement" xsi:type="string">imageUploader</item> <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item> <item name="previewTmpl" xsi:type="string">IMG_SampleImageUploader/image-preview</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> <item name="uploaderConfig" xsi:type="array"> <item name="url" xsi:type="url" path="sampleimageuploader/image/upload/field/image"/> </item> </item> </argument> </field> 
  1. Define the "isMultipleFiles" boolean property to true in this element.
    image

  2. Check the form, the "Browse to find or drag image here" button disappear after the first image is uploaded.
    image

Please let us know if we are missing something here.

@engcom-Lima engcom-Lima added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Dec 5, 2022
@engcom-Lima
Copy link
Contributor

Hi @pacco-a ,

Thanks for your contribution and collaboration.

Kindly provide us details on above comment as soon as possible . So, that we proceed further with this PR.

Thanks

@engcom-Echo
Copy link
Contributor

engcom-Echo commented Dec 13, 2022

Hi @pacco-a

We have noticed that this PR has not been updated for a period of 14 Days.
Hence we assume that this issue is fixed now, so we are closing it.Please raise a fresh PR or reopen this PR if you need more assistance on this.

Thanks

@pacco-a
Copy link
Contributor Author

pacco-a commented Jan 11, 2023

Hi @engcom-Echo,

Sorry for the time. I personally keep reproducing this behavior when using 2.4-develop branch.

Maybe there is something wrong in my process :

1 - Configuring a blank new 2.4-develop project.

2 - Creating a new module for testing purposes (here : "FormTestModule")

3 - Adding a Controller (1) , layout (2) , Ui Component form (3) , dummy DataProvider (4), dummy Uploader route (5)

(1)
<?php declare(strict_types=1); namespace Pacco\FormTestModule\Controller\Adminhtml\FormTestController; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\Controller\ResultInterface; use Magento\Framework\View\Result\PageFactory; class FormTestAction extends Action implements HttpGetActionInterface { private PageFactory $resultPageFactory; public function __construct( Context $context, PageFactory $resultPageFactory ) { parent::__construct($context); $this->resultPageFactory = $resultPageFactory; } public function execute(): ResultInterface { $page = $this->resultPageFactory->create(); $page->getConfig()->getTitle()->set('Test form title'); return $page; } }
(2)
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="content"> <uiComponent name="formtest_formtest_formtest_form"/> </referenceContainer> </body> </page>
(3)
<?xml version="1.0"?> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="provider" xsi:type="string"> formtest_formtest_formtest_form.formtest_formtest_formtest_form_data_source </item> <item name="deps" xsi:type="string"> formtest_formtest_formtest_form.formtest_formtest_formtest_form_data_source </item> </item> <item name="config" xsi:type="array"> <item name="dataScope" xsi:type="string">data</item> </item> <item name="template" xsi:type="string">templates/form/collapsible</item> <item name="label" xsi:type="string" translate="true">FormTest Form</item> <item name="buttons" xsi:type="array"> </item> </argument> <dataSource name="formtest_formtest_formtest_form_data_source"> <argument name="dataProvider" xsi:type="configurableObject"> <argument name="class" xsi:type="string"> Pacco\FormTestModule\Ui\Component\Form\FormTestDataProvider </argument> <argument name="name" xsi:type="string">formtest_formtest_formtest_form_data_source</argument> <argument name="primaryFieldName" xsi:type="string">id</argument> <argument name="requestFieldName" xsi:type="string">id</argument> </argument> <argument name="data" xsi:type="array"> <item name="js_config" xsi:type="array"> <item name="component" xsi:type="string">Magento_Ui/js/form/provider</item> </item> </argument> </dataSource> <fieldset name="config"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Configuration</item> <item name="collapsible" xsi:type="boolean">false</item> <item name="visible" xsi:type="boolean">false</item> </item> </argument> <field name="edit_type"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> <item name="default" xsi:type="string">default</item> </item> </argument> </field> </fieldset> <fieldset name="formtest"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">FormTest</item> <item name="collapsible" xsi:type="boolean">false</item> <item name="dataScope" xsi:type="string">formtest</item> </item> </argument> <field name="name"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Workshop name</item> <item name="dataType" xsi:type="string">text</item> <item name="formElement" xsi:type="string">input</item> </item> </argument> </field> </fieldset> <fieldset name="image"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Media</item> </item> </argument> <field name="image"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="dataType" xsi:type="string">string</item> <item name="source" xsi:type="string">image</item> <item name="label" xsi:type="string" translate="true">Image</item> <item name="visible" xsi:type="boolean">true</item> <item name="allowedExtensions" xsi:type="string">jpg jpeg gif png webp</item> <item name="isMultipleFiles" xsi:type="boolean">true</item> <item name="formElement" xsi:type="string">imageUploader</item> <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item> <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item> <item name="validation" xsi:type="array"> <item name="required-entry" xsi:type="boolean">true</item> </item> <item name="uploaderConfig" xsi:type="array"> <item name="url" xsi:type="url" path="formtest/upload/uploader"/> </item> </item> </argument> </field> </fieldset> </form>
(4)
<?php namespace Pacco\FormTestModule\Ui\Component\Form; use Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider; class FormTestDataProvider extends DataProvider { public function getData(): array { return []; } }
(5)
<?php declare(strict_types=1); namespace Pacco\FormTestModule\Controller\Adminhtml\Upload; use Magento\Backend\App\Action; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\ResultInterface; class Uploader extends Action implements HttpPostActionInterface { public function __construct( Action\Context $context ) { parent::__construct($context); } public function execute(): ResultInterface { /** @var Json $jsonResult */ $jsonResult = $this->resultFactory->create(ResultFactory::TYPE_JSON); return $jsonResult->setData([ 'name' => 'filename', 'size' => 1234, 'type' => 'image', 'path' => 'mypathpath', 'url' => 'pathpathpathurl' ]); } }

Thanks

@MeCapron
Copy link
Contributor

MeCapron commented Jul 3, 2023

Hi @engcom-Lima, can you please reopen this issue?

Thanks you

@MeCapron
Copy link
Contributor

MeCapron commented Jul 4, 2023

Poke @engcom-Echo, can you help me please?

@engcom-Echo engcom-Echo reopened this Jul 7, 2023
@m2-assistant
Copy link

m2-assistant bot commented Jul 7, 2023

Hi @pacco-a. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.

Add the comment under your pull request to deploy test or vanilla Magento instance:
  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@engcom-November engcom-November self-assigned this Sep 24, 2024
@engcom-November
Copy link
Contributor

@magento create issue

@engcom-November
Copy link
Contributor

engcom-November commented Sep 26, 2024

Hello @pacco-a,

Thanks for the collaboration & contribution!

✔️ QA Passed

Steps to reproduce:
Install the give module, inspect the Browse to find or drag image disappears or not.
P36325V.zip

Pardon the broken image here, file upload is not handled as the main issue is reproduced.

Before: ✖️ 

div block Browse to find or drag image disappears after uploading a file.
image

After: ✔️

div block Browse to find or drag image does not disappear after uploading a file.
image

Thank you.

@engcom-November
Copy link
Contributor

@magento run all tests

@engcom-November
Copy link
Contributor

@magento run Integration Tests

@engcom-November
Copy link
Contributor

@magento run Unit Tests, WebAPI Tests

@engcom-November
Copy link
Contributor

All the builds are green, moving this to Merge in progress.

@magento-devops-reposync-svc magento-devops-reposync-svc merged commit f645b64 into magento:2.4-develop Feb 24, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: accept Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
9 participants