Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore(coder plugin): make template names optional #103

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

Merged
merged 42 commits into from
Apr 4, 2024

Conversation

Parkreiner
Copy link
Member

@Parkreiner Parkreiner commented Apr 1, 2024

Closes #59

Changes made

  • Updated CoderWorkspacesConfig by adding an isReadingEntityData value
  • Added two new general-purpose components
    • InlineCodeSnippet
    • Disclosure
  • Turned EntityDataReminder into ReminderAccordion (uses Disclosure as its main building block)
    • This will let us keep adding more reminder information over time as different accordion entries
    • Thought there were too many edge cases around trying to reflect the lack of a template name in the main workspaces list itself, so I pulled it out, and combined it with our existing reminder for entities
    • Similarly, I felt like adding support for 100% bespoke messages for reminders like this was too much complexity for a niche feature that might not get used. Admins can choose which reminders they want to always be turned off
    • This is also now part of the exported components for the plugin
  • The main piece: made template names optional, and accounted for everything that entails
    • CoderAppConfig now exposes defaultTemplateName and defaultMode (both optional)
    • CoderWorkspacesConfig's creationUrl property is now potentially undefined
    • Updated the workspace creation links to be disabled when there is no URL
    • Updated UI to hide the call-to-action button for making workspaces when there is no usable URL
    • Added a new accordion entry that displays when there is no usable workspace creation URL
  • Added/updated test cases where relevant

Edit: Squeezed in one other change at the last minute, because it seemed like a good idea. Updated CoderWorkspacesCard and CoderWorkspacesCard.Root so that they don't blow up when the value of readEntityData changes between re-renders. We're still dealing with the same technical issues as before, but instead of throwing an error, they will unmount and remount with the new prop

Notes

  • Just because this PR is so chunky, I'm going to split the doc updates off into a separate PR

@Parkreiner Parkreiner marked this pull request as ready for review April 2, 2024 19:47
@Parkreiner Parkreiner requested a review from code-asher April 2, 2024 19:47
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

The new help accordions are a great idea!

Comment on lines +67 to +68
// Was originally defined in terms of fancy mapped types based on YamlConfig;
// ended up being a bad idea, because it increased coupling in a bad way
Copy link
Member

Choose a reason for hiding this comment

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

👍 this does seem nice

<Tooltip
ref={tooltipRef}
title={
canCreateWorkspace ? tooltipText : 'Please add a template name value'
Copy link
Member

Choose a reason for hiding this comment

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

I at first did not notice the extra help below, should we maybe say "check below for more information"? Alternatively, if we moved the accordion closer to the button that could help. I might just be particularly blind though.

Copy link
Member Author

@Parkreiner Parkreiner Apr 4, 2024

Choose a reason for hiding this comment

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

Yeah, good call. I was a little worried about putting too much text in the tooltip (since by default, it's only a single line), but after looking at MUI's docs again, it looks like you can use fully-customizable HTML instead of plain text

Will update things to make the relationship more obvious. Might also see if I can throw in some splashes of color for the accordion to draw the eye better

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the UI. Tried to add some subtle color to the make the accordion stand out more, but it either looked super ugly, or started to break from the default Backstage styling

I'm going with a longer tooltip message for now; will reconsider adding color if we get more feedback

Copy link
Member

Choose a reason for hiding this comment

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

Sweet!

@Parkreiner Parkreiner merged commit ece362a into main Apr 4, 2024
2 checks passed
@Parkreiner Parkreiner deleted the mes/template-name-take-2 branch April 4, 2024 17:13
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.

Coder plugin: make the appConfig template key optional and allow custom messaging
2 participants