Skip to content
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-30072: As an editor I would like to see the content tree state restored after reloading a page #144

Merged
merged 4 commits into from
Feb 28, 2019

Conversation

tischsoic
Copy link
Contributor

@tischsoic tischsoic commented Feb 26, 2019

JIRA: https://jira.ez.no/browse/EZP-30072

Requires: ezsystems/ezplatform-admin-ui#857

Screenshots

Restoring tree state after page refresh:

8p4gvqavyn

Resizing Content Tree container according to windows size & scroll:

67p8i3a9ox

@tischsoic tischsoic self-assigned this Feb 26, 2019
@tischsoic tischsoic force-pushed the EZP-30072-restore-Contet-Tree-after-reload branch from fa02300 to ba4bd68 Compare February 27, 2019 12:31
@tischsoic tischsoic changed the base branch from use-live-data to master February 27, 2019 12:32
@tischsoic tischsoic force-pushed the EZP-30072-restore-Contet-Tree-after-reload branch from 7d6f0a4 to e78463b Compare February 28, 2019 08:13
@tischsoic tischsoic changed the title [WIP] EZP-30072: As an editor I would like to see the content tree state restored after reloading a page EZP-30072: As an editor I would like to see the content tree state restored after reloading a page Feb 28, 2019
@tischsoic
Copy link
Contributor Author

Ready for review - ping @dew326

const mapChildrenToSubitemsDeep = (tree) => {
const parsedSubtree = [];

for (const subtree of tree) {
Copy link
Member

Choose a reason for hiding this comment

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

With map this would be simpler.

const mapChildrenToSubitems = (location) => {
location.totalSubitemsCount = location.totalChildrenCount;
location.subitems = location.children;
location.totalSubitemsCount = location.totalChildrenCount;
Copy link
Member

Choose a reason for hiding this comment

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

Why one more time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upps, mistake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe after rebase.

nodes: subtree,
},
}),

Copy link
Member

Choose a reason for hiding this comment

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

not needed

return;
}

const index = parentSubtree.children.findIndex((element) => parseInt(element.locationId, 10) === parseInt(path[1], 10));
Copy link
Member

Choose a reason for hiding this comment

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

The other element.locationId doesn't have parseInt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it can be removed.

localStorage.setItem(KEY_CONTENT_TREE_SUBTREE, JSON.stringify(this.subtree));
}

findParentSubtree(subtree, item, path) {
Copy link
Member

Choose a reason for hiding this comment

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

item seems unused

@tischsoic tischsoic force-pushed the EZP-30072-restore-Contet-Tree-after-reload branch from 9f7cedd to 435e76b Compare February 28, 2019 13:16
@tischsoic
Copy link
Contributor Author

ping @dew326 - I applied fixes in last commit. :)


return mapChildrenToSubitems(location);
})
.then(callback)
.catch(showErrorNotification);
// .catch(showErrorNotification);
Copy link
Member

Choose a reason for hiding this comment

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

why?

@lserwatka lserwatka merged commit ff9a898 into master Feb 28, 2019
@lserwatka lserwatka deleted the EZP-30072-restore-Contet-Tree-after-reload branch February 28, 2019 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants