Skip to content

Commit 6e7c175

Browse files
authored
Merge pull request #1811 from sivaschenko/locate-fix
Locate functionality fix and ACL renaming
2 parents cce088f + 8b07276 commit 6e7c175

File tree

2 files changed

+18
-14
lines changed
  • AdobeStockAsset/etc
  • AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/preview

2 files changed

+18
-14
lines changed

AdobeStockAsset/etc/acl.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<resources>
1111
<resource id="Magento_Backend::admin">
1212
<resource id="Magento_Backend::system">
13-
<resource id="Magento_AdobeStockAsset::adobe_stock_asset" title="Adobe Stock" translate="title" sortOrder="5">
14-
<resource id="Magento_AdobeStockAsset::actions" title="Actions" translate="title">
13+
<resource id="Magento_AdobeStockAsset::adobe_stock_asset" title="Adobe Stock WebAPI" translate="title" sortOrder="5">
14+
<resource id="Magento_AdobeStockAsset::actions" title="WebAPI Actions" translate="title">
1515
<resource id="Magento_AdobeStockAsset::actions_delete" title="Delete" translate="title"/>
1616
<resource id="Magento_AdobeStockAsset::actions_save" title="Save" translate="title"/>
1717
<resource id="Magento_AdobeStockAsset::actions_view" title="View" translate="title"/>

AdobeStockImageAdminUi/view/adminhtml/web/js/components/grid/column/preview/actions.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ define([
180180
if (path !== '') {
181181
this.imageDirectory().locateNode(path);
182182
}
183-
this.selectRecord(this.getRecordFromMediaGalleryProvider(assetDetails.path));
183+
this.selectRecordFromMediaGalleryProvider(assetDetails.path);
184184
}.bind(this));
185185

186186
},
@@ -203,23 +203,27 @@ define([
203203
},
204204

205205
/**
206-
* Get image data by image file name
206+
* Select record by image file name
207207
*
208208
* @param {String} path
209-
* @returns {null|Object}
210209
*/
211-
getRecordFromMediaGalleryProvider: function (path) {
212-
var report = null;
210+
selectRecordFromMediaGalleryProvider: function (path) {
211+
var subscription;
213212

214-
this.imageItems.each(function (item) {
215-
if (item.path === path) {
216-
report = item;
213+
subscription = this.imageItems.subscribe(function (items) {
214+
subscription.dispose();
215+
items.each(function (item) {
216+
if (item.path === path) {
217+
this.selectRecord(item);
217218

218-
return false;
219-
}
220-
});
219+
return false;
220+
}
221+
}.bind(this));
222+
}.bind(this));
221223

222-
return report;
224+
setTimeout(function () {
225+
subscription.dispose();
226+
}, 1500);
223227
},
224228

225229
/**

0 commit comments

Comments
 (0)