-
Notifications
You must be signed in to change notification settings - Fork 174
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
Bugfix/preserve view #102
Merged
Merged
Bugfix/preserve view #102
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
41bb5f8
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 4349a3e
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 7cafa4b
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus f8a6a28
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 0ab8b3a
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 9e4e1f0
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 0d886e5
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus c0edce7
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 21fa6a4
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 63c3a61
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus c0d06bc
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 282ddcc
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus 7623ae3
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus db5803f
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus ab060d9
Merge remote-tracking branch 'upstream/master'
maxmarkus a8be44f
Merge branch 'master' of github.com:kyma-project/luigi
maxmarkus f7b37bc
Merge remote-tracking branch 'upstream/master'
maxmarkus e70f781
refactored preserve view to be able to route to everywhere and back, …
maxmarkus 41e27d9
removed console.logs
maxmarkus a60a37f
Add example for preserve view feature for nested nodes
kwiatekus 59f159c
Remove example for preserve view feature for nested nodes
kwiatekus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,23 +47,7 @@ | |
Routing.handleRouteChange(trimLeadingSlash(window.location.pathname), component, node, config); | ||
}; | ||
|
||
const addPreserveView = (component, data, config, node) => { | ||
if (data.params.preserveView) { | ||
const pv = component.get().preservedViews; | ||
pv.push({ | ||
path: Routing.getNodePath(component.get().currentNode), | ||
nextPath: Routing.getNodePath(component.get().currentNode) + data.params.link, | ||
context: component.get().context | ||
}); | ||
component.set({preservedViews: pv}); | ||
|
||
// Resetting iframe config to null, since Routing.navigateTo will then create a new iframe | ||
// instead of using the existing instance for route. | ||
config.iframe = null; | ||
} | ||
}; | ||
|
||
const handleNavigation = async (component, data, config, node) => { | ||
const buildPath = (component, data) => { | ||
let path = data.params.link; | ||
if (data.params.fromClosestContext) { // from the closest navigation context | ||
const node = [...component.get().navigationPath].reverse().find((n) => n.navigationContext && n.navigationContext.length > 0); | ||
|
@@ -76,13 +60,36 @@ | |
path = Routing.concatenatePath(Routing.getNodePath(component.get().currentNode), data.params.link); | ||
} | ||
|
||
if (data.params.nodeParams) { | ||
if (data.params.nodeParams && Object.keys(data.params.nodeParams).length) { | ||
path += '?'; | ||
Object.entries(data.params.nodeParams).forEach(entry => { | ||
path += (encodeURIComponent(Routing.getContentViewParamPrefix() + entry[0]) + '=' + encodeURIComponent(entry[1]) + '&'); | ||
}); | ||
} | ||
return path; | ||
}; | ||
|
||
const addPreserveView = (component, data, config, node) => { | ||
if (data.params.preserveView) { | ||
console.log('TCL: addPreserveView -> data', data, node); | ||
const pv = component.get().preservedViews; | ||
const nextPath = buildPath(component, data); | ||
pv.push({ | ||
path: Routing.getNodePath(component.get().currentNode), | ||
nextPath: nextPath.startsWith('/') ? nextPath : '/' + nextPath, | ||
context: component.get().context | ||
}); | ||
console.log('pv', pv); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please get rid of console logs |
||
component.set({preservedViews: pv}); | ||
|
||
// Resetting iframe config to null, since Routing.navigateTo will then create a new iframe | ||
// instead of using the existing instance for route. | ||
config.iframe = null; | ||
} | ||
}; | ||
|
||
const handleNavigation = async (component, data, config, node) => { | ||
const path = buildPath(component, data); | ||
const matchedPath = await Routing.matchPath(path); | ||
if (matchedPath !== null) { | ||
addPreserveView(component, data, config, node); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please get rid of console logs