Skip to content

Commit a452418

Browse files
committed
Fix actions
1 parent a3c61df commit a452418

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

Ui/Component/Listing/Column/RowAction.php renamed to Ui/Component/Listing/Column/Actions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
namespace Opengento\WebapiLogger\Ui\Component\Listing\Column;
1010

11+
use Magento\Framework\Phrase;
1112
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1213
use Magento\Framework\View\Element\UiComponentFactory;
1314
use Magento\Ui\Component\Listing\Columns\Column;
1415
use Magento\Framework\UrlInterface;
1516

16-
class RowAction extends Column
17+
class Actions extends Column
1718
{
1819
public function __construct(
1920
ContextInterface $context,
@@ -27,14 +28,13 @@ public function __construct(
2728

2829
public function prepareDataSource(array $dataSource): array
2930
{
30-
foreach ($dataSource['data']['items'] ?? [] as &$item) {
31-
$item[$this->getData('name')] = [
32-
'edit' => [
33-
'href' =>
34-
$this->urlBuilder->getUrl('webapi_logs/reports/detail', ['log_id' => $item['log_id']]),
35-
'label' => __('View More')
36-
]
37-
];
31+
if (isset($dataSource['data']['items'])) {
32+
foreach ($dataSource['data']['items'] as &$item) {
33+
$item[$this->getData('name')]['edit'] = [
34+
'href' => $this->urlBuilder->getUrl('webapi_logs/reports/detail', ['log_id' => $item['log_id']]),
35+
'label' => new Phrase('View')
36+
];
37+
}
3838
}
3939

4040
return $dataSource;

Ui/Component/Listing/Column/ResponseBody.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

view/adminhtml/ui_component/webapi_logs_reports_index_listing.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<label translate="true">Created At</label>
126126
</settings>
127127
</column>
128-
<actionsColumn name="actions" class="Opengento\WebapiLogger\Ui\Component\Listing\Column\RowAction">
128+
<actionsColumn name="actions" class="Opengento\WebapiLogger\Ui\Component\Listing\Column\Actions">
129129
<settings>
130130
<indexField>log_id</indexField>
131131
<sortable>false</sortable>

0 commit comments

Comments
 (0)