NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
41 stars 26 forks source link

Randomly generate portal label for free trial portals #1466

Closed laurenwalker closed 4 years ago

laurenwalker commented 4 years ago
mbjones commented 4 years ago

it would be great if these were easy to type and remember. Which means not using a random number or uuid or that type of thing. One common things I've seen other projects do is to choose two or three random words from set lists, which provides quite a few permutations. For example, docker uses names like 'furious_einstein' and 'awesome_newton', which generates about 25K random strings using the code here: https://github.com/moby/moby/blob/master/pkg/namesgenerator/names-generator.go

Depending on how many of these we need, we could tweak the algorithm by adding another word, or increasing the wordlist lengths. A more generalized version of this approach was done in python: https://github.com/jjmontesl/codenamize -- it gives more options for number of adjectives to control the size of the codespace.

laurenwalker commented 4 years ago

@rushirajnenuji - The code I pushed for #1465 paves the way for this issue. The PortalEditorView will fetch the subscription (for now, it just creates a Subscription model since Bookkeeper is not fully integrated in yet). When it has completed fetching, the view will insert free trial info. You can use this to hook in the changes to the PortEditorSettingsView.

https://github.com/NCEAS/metacatui/blob/3ba47b98fdab14a40315de244e55e5709075ce70/src/js/views/portals/editor/PortalEditorView.js#L738-L779

It would be great to have this done soon so we can test it before releasing to production on Aug 11. Let me know if you run into any issues.

rushirajnenuji commented 4 years ago

Hi Lauren - as discussed, I've added this support to generate random portal labels for portals in the preview mode. This is ready for review.

Screen Shot 2020-08-03 at 9.55.58 AM.png

laurenwalker commented 4 years ago

Opening this back up because new portals are not able to be saved with random labels. I get a validation error when I click Save.

laurenwalker commented 4 years ago

Also, when you try to edit a free trial portal that already exists, I'm able to edit the label in the text input.

We need to make sure when changes are made that they are tested at least at a minimum, to make sure things don't break. This caused a few breaking changes and isn't totally functional @rushirajnenuji . I am going to fix it up since I'm already in the code.

rushirajnenuji commented 4 years ago

Hey @laurenwalker - sorry I missed that. I'll keep in mind to perform thorough testing for new functionalities added.