Skip to content

Conversation

@Ana06
Copy link
Contributor

@Ana06 Ana06 commented Jul 13, 2018

Align pad URL with pad title. For that it was needed to:

  • Save the pad title when creating it
  • Rename the paramether in the route fron id to name
  • Use the name in the route to call getObjectNames which allow us to get the id
  • Some ugly parsing to get the id, due to the format of the response. See: Pad friendly URL #1 (comment) 🙈

Ana06 added 2 commits July 13, 2018 18:02
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.
}
init(name) {
// get the id from the name
this.swellService.getObjectNames(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to encapsulate the "get object id from name" logic in a method of swellService?


launchPad() {
let name = this.padid.value;
this.swellService.getObject(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

missing trailing ;

launchPad() {
let name = this.padid.value;
this.swellService.getObject(name)
.then( object => {
Copy link
Contributor

Choose a reason for hiding this comment

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

swellService.getObject(objectId) requires a id as parameter, not a name. This code creates an object with id == name

Copy link
Contributor

@pablojan pablojan left a comment

Choose a reason for hiding this comment

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

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants