Skip to content

Switching between Media Gallery bookmarks does not change the selected folder #29411

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
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8020a01
Merge branch '2.4-develop' of github.com:magento/magento2 into ASI-15…
Aug 5, 2020
8e1e390
magento/adobe-stock-integration#1523: Switching between Views does no…
Aug 5, 2020
ee2ab23
magento/adobe-stock-integration#1523: Switching between Views does no…
Aug 5, 2020
e94ffe6
Merge branch '2.4-develop' of github.com:magento/magento2 into ASI-15…
Aug 6, 2020
3396cfd
Merge branch '2.4-develop' of github.com:magento/magento2 into ASI-15…
Aug 6, 2020
20dc815
magento/adobe-stock-integration#1523: Switching between Views does no…
Aug 6, 2020
58efb76
magento/adobe-stock-integration#1523: Switching between Views does no…
Aug 7, 2020
60da76c
magento/magento2#29411: Directory Tree refactoring
sivaschenko Aug 13, 2020
a516ee5
magento/magento2#29411: Naming update
sivaschenko Aug 18, 2020
0d0aa22
Merge branch '2.4-develop' of github.com:magento/magento2 into ASI-15…
sivaschenko Aug 18, 2020
eb1f0bb
magento/magento2#29411: Updated requested directory selection behaviour
sivaschenko Aug 18, 2020
36074a9
magento/magento2#29411: Formatting fixes
sivaschenko Aug 18, 2020
9a69a6a
magento/magento2#29411: Fixed static tests
sivaschenko Aug 18, 2020
79c8386
magento/magento2#29411: Fixed MFTF test
sivaschenko Aug 24, 2020
4a354da
Merge branch '2.4-develop' into ASI-1523-switching-between-views-does…
sivaschenko Aug 24, 2020
ae61599
Fixed static tests
sivaschenko Aug 24, 2020
a68bbbd
Fixed static tests
sivaschenko Aug 25, 2020
e533396
Fixed static tests
sivaschenko Aug 25, 2020
218c017
Merge branch '2.4-develop' into ASI-1523-switching-between-views-does…
sivaschenko Aug 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ define([
filterChips: '${ $.filterChipsProvider }'
},
listens: {
'${ $.provider }:params.filters.path': 'clearFiltersHandle'
'${ $.provider }:params.filters.path': 'updateSelectedDirectory'
},
viewConfig: [{
component: 'Magento_MediaGalleryUi/js/directory/directories',
Expand Down Expand Up @@ -220,7 +220,7 @@ define([
this.firejsTreeEvents();
}.bind(this));
} else {
this.checkChipFiltersState();
this.updateSelectedDirectory();
}
}.bind(this));
}.bind(this));
Expand All @@ -239,26 +239,30 @@ define([
}.bind(this));

$(this.directoryTreeSelector).on('loaded.jstree', function () {
this.checkChipFiltersState();
this.updateSelectedDirectory();
}.bind(this));

},

/**
* Verify directory filter on init event, select folder per directory filter state
*/
checkChipFiltersState: function () {
updateSelectedDirectory: function () {
var currentFilterPath = this.filterChips().filters.path,
isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
currentTreePath;

currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
Base64.idDecode(window.MediabrowserUtility.pathId);

if (this.folderExistsInTree(currentTreePath)) {
this.locateNode(currentTreePath);
if (_.isUndefined(currentFilterPath)) {
this.clearFiltersHandle();
} else {
this.selectStorageRoot();
currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
Base64.idDecode(window.MediabrowserUtility.pathId);

if (this.folderExistsInTree(currentTreePath)) {
this.locateNode(currentTreePath);
} else {
this.selectStorageRoot();
}
}
},

Expand All @@ -281,8 +285,8 @@ define([
* @param {String} currentFilterPath
*/
isFiltersApplied: function (currentFilterPath) {
return !_.isUndefined(currentFilterPath) && currentFilterPath !== '' &&
currentFilterPath !== 'wysiwyg' && currentFilterPath !== 'catalog/category';
return !_.isUndefined(currentFilterPath) && currentFilterPath !== ''
Copy link
Member

Choose a reason for hiding this comment

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

I think catalog/category comparison should also be removed (cc @Nazar65 )

Copy link
Member

@Nazar65 Nazar65 Aug 14, 2020

Choose a reason for hiding this comment

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

this comparisons needed to cover behavior with pres elected folders, for example when bookmark applied and we open media gallery from category, category folder should be presented only if the bookmarks not available

&& currentFilterPath !== 'catalog/category';
},

/**
Expand All @@ -302,15 +306,10 @@ define([

},

/**
* Listener to clear filters event
*/
clearFiltersHandle: function () {
if (_.isUndefined(this.filterChips().filters.path)) {
$(this.directoryTreeSelector).jstree('deselect_all');
this.activeNode(null);
this.directories().setInActive();
}
$(this.directoryTreeSelector).jstree('deselect_all');
this.activeNode(null);
this.directories().setInActive();
},

/**
Expand Down