U4-11177 - Update tree nodes with the new node names based on variant/language

Created by Warren Buckley 04 Apr 2018, 08:47:46 Updated by Robert Copilau 19 Apr 2018, 06:39:44

Subtask of: U4-11114

If the default language is missing for content, and content is also missing in the selected language - the content will simply not be available in the tree.

This requires a new API Endpoint to take in a language ID and return tree nodes as the chosen language

  • If we don't have a variant for that node - we fallback & return the default language
  • Return a flag/bool that this node was not translated or is the default base language

2 Attachments

Download Recording #3.mp4

Comments

Shannon Deminick 17 Apr 2018, 07:20:51

To get 'real' data in the tree, we need to wait for this task http://issues.umbraco.org/issue/U4-11128

In the meantime, I've wired up the back end to change the tree node names to suffix the selected language.

PR https://github.com/umbraco/Umbraco-CMS/pull/2590

This PR is a monster, i don't expect you to go through all of the code but please have a look at it since there might be some interesting things in there. Part of this PR is cleaning up the tree which was a huge mess: really strange jquery object and event binding is no longer there, everything is done with promises. The tree API is exposed properly on the tree directive and controllers can bind to the directive API by binding to the "api" attribute. Have fixed up tons of the promise chaining, i'm not even sure how this was working in v7! There's some old legacy code cleaned up / removed too.

So to test:

  • Create a tree structure with a few root nodes and a few levels under each
  • Create a few languages
  • Select a content node in the main tree, switch languages and you'll see the node names all update, you can verify that tree requests are sent to the server with a languageId parameter by looking at the chrome dev tools network tab. Also when you switch languages the already selected node will remain selected.
  • Make sure you have a content picker property type on one of your content items, go launch this content picker. You can expand several different branches in the picker, then switch languages (you'll see a strange glitch where all the nodes will flash red) but all expanded branches will be re-synced with what you had expanded already but in the new language. TODO: I will fix up the glitch thing later.
  • Make sure that you can logout, login and have everything working as expected. Make sure you can select a content item in a deeper tree level, then refresh the browser and make sure that the tree is synced as expected.


Robert Copilau 18 Apr 2018, 11:19:15

Test results: Hey @Shandem, everything works fine except for the last point whereupon browser refresh the tree should have the previously selected language which it does not. I have attached a video showing that it does not work and an image showing the error thrown upon browser refresh.


Shannon Deminick 19 Apr 2018, 06:28:22

@robertcopilau I think you misinterpreted what I wrote :)

then refresh the browser and make sure that the tree is synced as expected.

All i meant was that when you refresh the browser it re-syncs the current tree node and in your video that is what it does :) refreshing and re-syncing to the currently selected language will be a different task since we'll need to track the language switch in a query string, similar to what we are doing with the navigation selector/deep link thing you did before.

I'll keep an eye out for that JS error you got, a lot has changed with the tree so will debug that when i see it.


Robert Copilau 19 Apr 2018, 06:35:12

Sorry, I expected the tree to sync with the current selected language upon refresh :). Merged.


Priority: Normal

Type: Task

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 8.0.0

Due in version: 8.0.0

Sprint: Sprint 83

Story Points: 3

Cycle: 9