Open
Conversation
This will allow us to use the pad title in the url of the pad instead of the id, but still be able to identify it with the id.
Rename the paramether in the route fron `id` to `name` to have friendly urls. Use the name in the route to call `getObjectNames` which allow us to get the id. The result need an ugly parsing to get the id, due to the format of the response. See: SwellRT#1 (comment) Closes SwellRT#1.
pablojan
reviewed
Jul 16, 2018
| } | ||
| init(name) { | ||
| // get the id from the name | ||
| this.swellService.getObjectNames(name) |
Contributor
There was a problem hiding this comment.
Would be good to encapsulate the "get object id from name" logic in a method of swellService?
pablojan
reviewed
Jul 16, 2018
| @@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy { | |||
| this.swellService.getObject(name) | |||
pablojan
reviewed
Jul 16, 2018
| @@ -47,7 +47,7 @@ export class HomeComponent implements OnInit, OnDestroy { | |||
| this.swellService.getObject(name) | |||
| .then( object => { | |||
Contributor
There was a problem hiding this comment.
swellService.getObject(objectId) requires a id as parameter, not a name. This code creates an object with id == name
pablojan
requested changes
Jul 16, 2018
Contributor
pablojan
left a comment
There was a problem hiding this comment.
This changes break the current logic to open/create objects (sorry, surely it was not clear enough).
HomeComponent:
- Gets a pad (object) name from user input.
- Checks whether this name correspond with an existing pad (for example a method swellService.getObjectIdByName()).
If not, creates a new object (with autogenerated id) and assing it the name - Redirect to pad/:name
- To be considered: are we going to pass the object name as is as URL part?
PadComponent:
- gets the name from URL and invoque padService.init(name)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Align pad URL with pad title. For that it was needed to:
idtonamegetObjectNameswhich allow us to get the id