Skip to content

[Widgets] Mass-action delete for Widgets #20765

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

Merged

Conversation

vasilii-b
Copy link

@vasilii-b vasilii-b commented Jan 29, 2019

Description (*)

This PR adds massaction delete to Widget Instances
2019-01-29 12 19 57

Fixed Issues (if relevant)

  1. [Widgets] Bulk delete is not available #20764: [Widgets] Bulk delete is not available

Manual testing scenarios (*)

Provided in issue description

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)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @vasilii-b. Thank you for your contribution
Here is 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team magento-engcom-team added Area: Frontend Component: Widget Release Line: 2.3 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jan 29, 2019
if (count($notDeletedInstances)) {
$this->messageManager->addErrorMessage(__(
'Widget(s) with ID(s) %1 were not found',
implode(',', $notDeletedInstances)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an additional space after the comma in the implode functions. So we have in result 1, 2, 30 instead of 1,2,30

public function execute(int $id)
{
$model = $this->getById($id);
var_dump($model->getData(), $id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should not be here :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 😆

* @return WidgetInstance
* @throws NoSuchEntityException
*/
private function getById(int $id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename it to getWidgetById, please?

* Command to delete a widget instance by specified widget instance ID
* @api
*/
interface DeleteWidgetInstanceByIdInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have doubts regarding a necessity to use an API interface in this particular case. It might be useful if we create an additional web API endpoint or we need to define a strategy in an interface for multiple implementations. But it's not the case.
The main downside of using an interface here - it does not make much sense. In the future, the interface restricts us in possible architectural changes (if the implementation needs to be changed). So if we declare an interface we are responsible for its support. On the other hand, if we don't have an interface we can change the implementation in more flexible ways.
So the main idea is to use API interfaces only in cases when they are useful but not harmful.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! I'll adjust it. Thank you!

@vasilii-b
Copy link
Author

Hi @rogyar, can you please have a look on added changes? Thank you!

/**
* Class DeleteWidgetInstanceById
*/
class DeleteWidgetInstanceById
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rename it to DeleteWidgetById

@@ -0,0 +1,73 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use strict_types declaration in new implementations

@@ -34,4 +34,6 @@
<plugin name="widget-layout-update-plugin"
type="Magento\Widget\Model\ResourceModel\Layout\Plugin" sortOrder="10"/>
</type>
<preference for="Magento\Widget\Api\DeleteWidgetInstanceByIdInterface"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't need this config anymore

@sidolov
Copy link
Contributor

sidolov commented Feb 19, 2019

@vasilii-b , I am closing this PR now due to inactivity.
Please reopen and update if you wish to continue.
Thank you for the collaboration!

@sidolov sidolov closed this Feb 19, 2019
@ghost
Copy link

ghost commented Feb 19, 2019

Hi @vasilii-b, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Vasilii Burlacu added 2 commits July 10, 2019 15:35
…lk-delete

* origin/2.3-develop: (4954 commits)
  magento#23427 Fix static
  magento#23532 Fix-static-tests
  magento/magento#23500 fix funk tests
  fix validation class for max-words
  MC-17922: Date in filter area doesn't match with Active filters bar
  Fixed coding standards violations
  Updated unit test
  MC-17922: Date in filter area doesn't match with Active filters bar
  Update Framework/Mail::Message to send all emails as MIME, not just HTML emails.
  MC-17922: Date in filter area doesn't match with Active filters bar
  Removed editors from all dependable customer billing address fields
  Correct array type hints
  Fix mass detection issue
  Testing configurable option update based on product and attribute_id
  move breakpoint by -1px to make nav work correctly at viweport width of 768px
  MC-17275: Admin Down after changing store domain/cookie
  Setting right shipper street1 in addressline1
  MC-17275: Admin Down after changing store domain/cookie
  Replaced urldecode with rawurldecode that not converting + into space
  Fixed issue magento#23383
  ...
# Fixed codestyle and added improvements requested by maintainer
@vasilii-b vasilii-b reopened this Jul 10, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jul 10, 2019

Hi @vasilii-b. Thank you for your contribution
Here is 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.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ghost ghost unassigned rogyar Jul 10, 2019
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5614 has been created to process this Pull Request
✳️ @sidolov, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Delta
Copy link
Contributor

✔️ QA passed

@m2-assistant
Copy link

m2-assistant bot commented Aug 30, 2019

Hi @vasilii-b, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.4 milestone Aug 30, 2019
@sidolov sidolov added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests Component: Widget Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants