-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from webgriffe/issue-7
Add queue items grid to admin panel
- Loading branch information
Showing
18 changed files
with
400 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
@browsing_queue_items | ||
Feature: Browsing queue items | ||
In order to see the status of imported and not imported items from Akeneo | ||
As an Administrator | ||
I want to browse the Akeneo items queue | ||
|
||
Background: | ||
Given I am logged in as an administrator | ||
And there is a not imported item with identifier "braided-hat-m" for the "Product" importer in the Akeneo queue | ||
And there is a not imported item with identifier "braided-hat-l" for the "ProductAssociations" importer in the Akeneo queue | ||
And there is an already imported item with identifier "braided-hat-s" for the "Product" importer in the Akeneo queue | ||
|
||
@ui | ||
Scenario: Browsing all items | ||
When I browse Akeneo queue items | ||
Then I should see 3 queue items in the list | ||
|
||
@ui | ||
Scenario: Browsing not imported items | ||
When I browse Akeneo queue items | ||
And I choose "No" as an imported filter | ||
And I filter | ||
Then I should see 2, not imported, queue items in the list | ||
|
||
@ui | ||
Scenario: Browsing imported items | ||
When I browse Akeneo queue items | ||
And I choose "Yes" as an imported filter | ||
And I filter | ||
Then I should see 1, imported, queue item in the list | ||
|
||
@ui | ||
Scenario: Filtering items by importer | ||
When I browse Akeneo queue items | ||
And I specify "Associations" as an importer filter | ||
And I filter | ||
Then I should see 1 queue item in the list | ||
|
||
@ui | ||
Scenario: Filtering items by identifier | ||
When I browse Akeneo queue items | ||
And I specify "hat-l" as an identifier filter | ||
And I filter | ||
Then I should see 1 queue item in the list |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Webgriffe\SyliusAkeneoPlugin\Menu; | ||
|
||
use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent; | ||
|
||
final class AdminMenuListener | ||
{ | ||
public function addAdminMenuItems(MenuBuilderEvent $event): void | ||
{ | ||
$menu = $event->getMenu(); | ||
$catalogMenu = $menu->getChild('catalog'); | ||
if ($catalogMenu === null) { | ||
return; | ||
} | ||
|
||
$catalogMenu | ||
->addChild('webgriffe_sylius_akeneo.queue_item', ['route' => 'webgriffe_sylius_akeneo_admin_queue_item_index']) | ||
->setLabel('webgriffe_sylius_akeneo.ui.queue_items') | ||
->setLabelAttribute('icon', 'cloud download') | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
webgriffe_sylius_akeneo_admin_queue_item: | ||
resource: | | ||
alias: webgriffe_sylius_akeneo.queue_item | ||
section: admin | ||
path: akeneo_queue_items | ||
except: ['delete', 'update', 'create', 'show', 'bulkDelete'] | ||
templates: "@SyliusAdmin\\Crud" | ||
redirect: update | ||
grid: webgriffe_sylius_akeneo_admin_queue_item | ||
vars: | ||
all: | ||
subheader: webgriffe_sylius_akeneo.ui.manage_akeneo_queue_items | ||
index: | ||
icon: 'cloud download' | ||
type: sylius.resource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
sylius_resource: | ||
resources: | ||
webgriffe_sylius_akeneo.queue_item: | ||
classes: | ||
model: Webgriffe\SyliusAkeneoPlugin\Entity\QueueItem | ||
repository: Webgriffe\SyliusAkeneoPlugin\Doctrine\ORM\QueueItemRepository | ||
|
||
sylius_grid: | ||
grids: | ||
webgriffe_sylius_akeneo_admin_queue_item: | ||
driver: | ||
name: doctrine/orm | ||
options: | ||
class: Webgriffe\SyliusAkeneoPlugin\Entity\QueueItem | ||
sorting: | ||
createdAt: desc | ||
fields: | ||
akeneoEntity: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.importer | ||
sortable: ~ | ||
akeneoIdentifier: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.identifier | ||
sortable: ~ | ||
createdAt: | ||
type: datetime | ||
label: sylius.ui.created_at | ||
sortable: ~ | ||
importedAt: | ||
type: twig | ||
label: webgriffe_sylius_akeneo.ui.imported | ||
sortable: ~ | ||
options: | ||
template: '@WebgriffeSyliusAkeneoPlugin\QueueItem\Grid\importedAt.html.twig' | ||
errorMessage: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.error_message | ||
filters: | ||
akeneoEntity: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.importer | ||
akeneoIdentifier: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.identifier | ||
imported: | ||
type: exists | ||
label: webgriffe_sylius_akeneo.ui.imported | ||
options: | ||
field: importedAt | ||
errorMessage: | ||
type: string | ||
label: webgriffe_sylius_akeneo.ui.error_message | ||
actions: | ||
main: ~ | ||
item: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
webgriffe_sylius_akeneo: | ||
ui: | ||
queue_items: Akeneo PIM import | ||
manage_akeneo_queue_items: Manage Akeneo PIM import items | ||
importer: Importer type | ||
identifier: Identifier | ||
imported: Imported | ||
imported_yes: Yes, at %date% | ||
imported_no: No | ||
error_message: Error message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
webgriffe_sylius_akeneo: | ||
ui: | ||
queue_items: Importazione da Akeneo PIM | ||
manage_akeneo_queue_items: Gestisci gli elementi di importazione da Akeneo PIM | ||
importer: Tipo di import | ||
identifier: Identificatore | ||
imported: Importato | ||
imported_yes: Si, il %date% | ||
imported_no: No | ||
error_message: Messaggio d'errore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{% if data %} | ||
<span class="ui green label"> | ||
<i class="check icon"></i> | ||
{{ 'webgriffe_sylius_akeneo.ui.imported_yes'|trans({'%date%': data|date('Y-m-d H:i:s')}) }} | ||
</span> | ||
{% else %} | ||
<span class="ui red label"> | ||
<i class="remove icon"></i> | ||
{{ 'webgriffe_sylius_akeneo.ui.imported_no'|trans }} | ||
</span> | ||
{% endif %} |
3 changes: 3 additions & 0 deletions
3
tests/Application/config/packages/webgriffe_sylius_akeneo_plugin.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/Application/config/routes/webgriffe_sylius_akeneo_plugin.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
webgriffe_sylius_akeneo_plugin_admin: | ||
resource: "@WebgriffeSyliusAkeneoPlugin/Resources/config/admin_routing.yaml" | ||
prefix: /admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Context\Ui\Admin; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Page\Admin\QueueItem\IndexPageInterface; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class ManagingQueueItems implements Context | ||
{ | ||
/** @var IndexPageInterface */ | ||
private $indexPage; | ||
|
||
public function __construct(IndexPageInterface $indexPage) | ||
{ | ||
$this->indexPage = $indexPage; | ||
} | ||
|
||
/** | ||
* @When /^I browse Akeneo queue items$/ | ||
*/ | ||
public function iBrowseAkeneoQueueItems(): void | ||
{ | ||
$this->indexPage->open(); | ||
} | ||
|
||
/** | ||
* @Then /^I should see (\d+), not imported, queue items in the list$/ | ||
*/ | ||
public function iShouldSeeQueueItemsInTheList(int $numberOfItems): void | ||
{ | ||
Assert::same($this->indexPage->countItems(), $numberOfItems); | ||
foreach ($this->indexPage->getColumnFields('importedAt') as $columnField) { | ||
Assert::eq($columnField, 'No'); | ||
} | ||
} | ||
|
||
/** | ||
* @Given /^I choose "([^"]*)" as an imported filter$/ | ||
*/ | ||
public function iChooseAsAnImportedFilter(string $imported): void | ||
{ | ||
$this->indexPage->chooseImportedFilter($imported); | ||
} | ||
|
||
/** | ||
* @When /^I filter$/ | ||
*/ | ||
public function iFilter(): void | ||
{ | ||
$this->indexPage->filter(); | ||
} | ||
|
||
/** | ||
* @Then /^I should see (\d+), imported, queue items? in the list$/ | ||
*/ | ||
public function iShouldSeeImportedQueueItemInTheList(int $numberOfItems): void | ||
{ | ||
Assert::same($this->indexPage->countItems(), $numberOfItems); | ||
foreach ($this->indexPage->getColumnFields('importedAt') as $columnField) { | ||
Assert::contains($columnField, 'Yes'); | ||
} | ||
} | ||
|
||
/** | ||
* @When /^I specify "([^"]*)" as an importer filter$/ | ||
*/ | ||
public function iSpecifyAsAnImporterFilter(string $importer): void | ||
{ | ||
$this->indexPage->specifyImporterFilter($importer); | ||
} | ||
|
||
/** | ||
* @Then /^I should see (\d+) queue items? in the list$/ | ||
*/ | ||
public function iShouldSeeQueueItemInTheList(int $numberOfItems): void | ||
{ | ||
Assert::same($this->indexPage->countItems(), $numberOfItems); | ||
} | ||
|
||
/** | ||
* @Given /^I specify "([^"]*)" as an identifier filter$/ | ||
*/ | ||
public function iSpecifyAsAnIdentifierFilter(string $identifier): void | ||
{ | ||
$this->indexPage->specifyIdentifierFilter($identifier); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Page\Admin\QueueItem; | ||
|
||
use Sylius\Behat\Page\Admin\Crud\IndexPage as BaseIndexPage; | ||
|
||
class IndexPage extends BaseIndexPage implements IndexPageInterface | ||
{ | ||
public function chooseImportedFilter(string $imported): void | ||
{ | ||
$this->getElement('filter_imported')->selectOption($imported); | ||
} | ||
|
||
public function specifyImporterFilter(string $importer): void | ||
{ | ||
$this->getElement('filter_importer')->setValue($importer); | ||
} | ||
|
||
public function specifyIdentifierFilter(string $identifier): void | ||
{ | ||
$this->getElement('filter_identifier')->setValue($identifier); | ||
} | ||
|
||
protected function getDefinedElements(): array | ||
{ | ||
return array_merge( | ||
parent::getDefinedElements(), | ||
[ | ||
'filter_imported' => '#criteria_imported', | ||
'filter_importer' => '#criteria_akeneoEntity_value', | ||
'filter_identifier' => '#criteria_akeneoIdentifier_value', | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Webgriffe\SyliusAkeneoPlugin\Behat\Page\Admin\QueueItem; | ||
|
||
use Sylius\Behat\Page\Admin\Crud\IndexPageInterface as BaseIndexPageInterface; | ||
|
||
interface IndexPageInterface extends BaseIndexPageInterface | ||
{ | ||
public function chooseImportedFilter(string $imported): void; | ||
|
||
public function specifyImporterFilter(string $importer): void; | ||
|
||
public function specifyIdentifierFilter(string $identifier): void; | ||
} |
Oops, something went wrong.