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

Pad friendly URL #1

Open
pablojan opened this issue Jul 12, 2018 · 7 comments
Open

Pad friendly URL #1

pablojan opened this issue Jul 12, 2018 · 7 comments
Assignees

Comments

@pablojan
Copy link
Contributor

pablojan commented Jul 12, 2018

We want to have friendly URLs for the pads.
A pad URL must be aligned with the pad title.
If a pad title changes, a new URL for that title must be accepted as well as previous URLs
It is ok to store the current title as a pad's object property.

SwellRT provides utility methods for handling this, check out.
https://github.com/P2Pvalue/swellrt/blob/develop/wave/doc/swellrt/Reference.md#friendly-names-for-collaborative-objects

@pablojan pablojan assigned pablojan and Ana06 and unassigned pablojan Jul 12, 2018
@Ana06
Copy link
Contributor

Ana06 commented Jul 12, 2018

until #2 is implemented the pad title can not change, right? 🤔 although it is supported anyway....

@pablojan
Copy link
Contributor Author

pablojan commented Jul 12, 2018 via email

@Ana06
Copy link
Contributor

Ana06 commented Jul 13, 2018

@pablojan I have some questions:

  • The id would be the first name? or would we another kind of id? It is maybe a good idea to have something different as id, it would allow us to do things like having the same pad name for different users and with a url like <user-name>/<pad-title> but for that the id needs to be different from the title. 🤔

  • currently in SwellRT there is a getObjectNames method, which returns all the names given a name or the id. But what we actually want is the id given a name, because getting all the names don't really helps us. I think we are not going to show all the names of a Pad, but only looking for the document to render (identied by the id) from a given name. Wouldn't it be a good idea implement a getObjectIdfromName method in SwellRT or did you have another approach in mind? In case we want a getObjectIdfromName method , can I give it a try? 😄

@pablojan
Copy link
Contributor Author

Swell assigns an auto generated id to objects if no custom id is provided, for example local.net/s+34cs5z2 , and I think that it must be the canonical id for the object.

Secondly, to make things easier for the users, we can set a first object name, using the title.
Regarding your idea of different names by user <user-name>/<pad-title> I can't say now if it is a useful approach.

I am pretty sure that getObjectNames() returns the object id together with all names for that id. Maybe doc is not clear enough. 💃

@Ana06
Copy link
Contributor

Ana06 commented Jul 13, 2018

@pablojan

I am pretty sure that getObjectNames() returns the object id together with all names for that id. Maybe doc is not clear enough.

I see... the WaveNaming is converted to JSON so the id is there, just missed in the documentation... 🤔 I'll update the documentation 😉

@Ana06
Copy link
Contributor

Ana06 commented Jul 13, 2018

ok... it is there... but it is still not really nice... It returns something like:

{ "waveId": { "domain": "local.net", "id": "hola" }, "names": [ { "name": "hola", "created": 1531492853419 } ] }

what would mean that to get the id you would have to do something like in the frontend:

names_json['waveId']['domain'].concat('/').concat(names_json['waveId']['id'])

or is there a better way to do this? 🤔 because if not, it would be nicer to just return { id: "local.net/hola", names: ["hola"] }. So, parsing it manually instead of using toJson of a WaveNaming

Ana06 added a commit to Ana06/jetpad that referenced this issue Jul 13, 2018
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.
Ana06 added a commit to Ana06/jetpad that referenced this issue Jul 13, 2018
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.
Ana06 added a commit to Ana06/jetpad that referenced this issue Jul 13, 2018
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.
@Ana06 Ana06 mentioned this issue Jul 13, 2018
@pablojan
Copy link
Contributor Author

hehe sure, the response will be nicer returning the id in one single string.
I did open an issue in swellrt for it https://github.com/P2Pvalue/swellrt/issues/242

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

No branches or pull requests

2 participants