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
EZP-31571: Content tree view in UDW #1361
EZP-31571: Content tree view in UDW #1361
Conversation
@@ -156,6 +166,12 @@ export default class ContentTreeModule extends Component { | |||
} | |||
|
|||
readSubtree() { | |||
const { readSubtree } = this.props; | |||
|
|||
if (readSubtree) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would check if it is a function
@@ -28,8 +28,13 @@ export const loadLocationItems = ({ siteaccess }, parentLocationId, callback, li | |||
.catch(showErrorNotification); | |||
}; | |||
|
|||
export const loadSubtree = ({ token, siteaccess }, subtree, callback) => { | |||
const request = new Request(`${ENDPOINT_LOAD_SUBTREE}`, { | |||
export const loadSubtree = ({ restInfo: { token, siteaccess }, subtree, sortClause, sortOrder }, callback) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const loadSubtree = ({ restInfo: { token, siteaccess }, subtree, sortClause, sortOrder }, callback) => { | |
export const loadSubtree = ({ token, siteaccess, subtree, sortClause, sortOrder }, callback) => { |
Do not pass restInfo
object just pass the token
and siteaccess
this is more consistent with other places.
src/bundle/ui-dev/src/modules/content-tree/services/content.tree.service.js
Show resolved
Hide resolved
dispatchLoadedLocationsAction({ type: 'SET_LOCATIONS', data: locationsMap }); | ||
|
||
if (!multiple && !isNotSelectable) { | ||
dispatchSelectedLocationsAction({ type: 'CLEAR_SELECTED_LOCATIONS' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use REPLACE_SELECTED_LOCATIONS
loadedLocationsMap.forEach((location) => { | ||
leafs.push({ | ||
children: [], | ||
limit: 30, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why limit is hardcoded to 30?
const tree = []; | ||
let leafs = tree; | ||
|
||
loadedLocationsMap.forEach((location) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole method deserves to be refactored.
<div className="c-tree"> | ||
{contentTreeVisible && ( | ||
<ContentTreeModule | ||
userId={14} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why user id is hardcoded to admin?
(containersOnly && !isContainer) || (allowedContentTypes && !allowedContentTypes.includes(contentTypeInfo.identifier)); | ||
|
||
setMarkedLocationId(locationId); | ||
dispatchLoadedLocationsAction({ type: 'CUT_LOCATIONS', locationId: markedLocationId }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you CUT
and in next line you do SET
which replace the whole loadedLocations
?
src/bundle/ui-dev/src/modules/universal-discovery/bookmarks.tab.module.js
Outdated
Show resolved
Hide resolved
…b.module.js Co-authored-by: Dariusz Szut <dew326@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC: changed parameters for loadSubtree function to object: 810d10b#diff-d555737827e39c2e1490479db6f96e76R31
Checklist:
$ composer fix-cs
)