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

Give components "friendly" slugs on creation #1384

Open
Tracked by #1509
bradenmacdonald opened this issue Oct 15, 2024 · 6 comments
Open
Tracked by #1509

Give components "friendly" slugs on creation #1384

bradenmacdonald opened this issue Oct 15, 2024 · 6 comments
Labels
enhancement Relates to new features or improvements to existing features

Comments

@bradenmacdonald
Copy link
Contributor

bradenmacdonald commented Oct 15, 2024

Context

Currently, library components get a UUID as the unique part of their usage key, and this makes for long/ugly URLs and is unhelpful when viewing a list of component IDs.

Screenshot

Requirements

  1. As an author, when I create a new component, it should be assigned a "friendly slug" based on whatever name I put in the editor before first saving changes.
  2. Later edits to the component may change the name, but should not affect the slug. (We don't want the ID changing after a component has been published/used.)

Example:

Putting this text in the editor modal

Screenshot

Should result in this slug:

Screenshot 2

Obviously, make sure the slug is unique.

Note that the Learning Core API does allow changing the slug after creation, so if necessary the workflow can be: generate UUID slug -> launch editor -> rename usage key based on display name at first save

(In future versions, we may want to just make the slug editable for any components that have never been published or even better, never been used in a course)

@bradenmacdonald
Copy link
Contributor Author

@jmakowski1123 New story, but based on things we've discussed - please review.

@rpenido
Copy link
Contributor

rpenido commented Oct 25, 2024

Note that the Learning Core API does allow changing the slug after creation, so if necessary the workflow can be: generate UUID slug -> launch editor -> rename usage key based on display name at first save

@bradenmacdonald
I'm a bit worried about changing the slug after creation. Here are some questions and concerns!

  1. How do we define this "first save"?
    • If the user creates the component and hits "Cancel" in the editor, should we keep the slug as the UUID?
    • Would it count as a "first save" if he edits this component some days later?
  2. We may have tags associated (async) with the component on creation. If we change the UUID we would also need to move these tags
  3. We might have some (possible, but unlikely) race conditions associated with this: simultaneous "first save"s or tagging while running the "first save"
  4. Do you think it's feasible to change the flow and ask the user for the name before creating a block to avoid changing the UUID?

@bradenmacdonald
Copy link
Contributor Author

bradenmacdonald commented Oct 25, 2024

@rpenido Since we didn't get this into Sumac, I don't think it's a huge priority anymore. It probably makes more sense to refactor the editors in the MFE so that they can be opened without having a block ID, and they only create the block once you save changes. Then we can set the slug on the initial save and it will avoid all the problems you've mentioned.

@bradenmacdonald
Copy link
Contributor Author

CC @ormsbee ^

@rpenido
Copy link
Contributor

rpenido commented Nov 29, 2024

@bradenmacdonald Should we close this issue and make it part of #1482's scope, or should we just have it as a dependency?

@bradenmacdonald
Copy link
Contributor Author

I think we should just have #1482 as a dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Relates to new features or improvements to existing features
Projects
Status: Early ideas
Development

No branches or pull requests

2 participants