che icon indicating copy to clipboard operation
che copied to clipboard

Dashboard IDE selection and devworkspace creation should not use the same displayName variable

Open nickboldt opened this issue 3 years ago • 2 comments
trafficstars

Is your enhancement related to a problem? Please describe

As discovered in CRW-3098 and CRW-3327, the Dashboard (as of 7.52.x = 3.2) presents a list of availale IDEs for a given sample project using the displayName fields in the che-editors.yaml file, then converts the found string to Title Case.

Here's how the IDE selection looks upstream in Che:

image

Note that the names shown are inconsistent (IDEA has a full name, where the other two do not), and "che-code" is not an official trademark-compliant name. Also "Theia-Ide" is less descriptive than "Eclipse Theia" and weirdly cased as "Ide" does not look like an acronym -- it should be "IDE".

I attempted to clean up the displayed names to comply with trademark/legal requirements:

image

But this broke the Dashboard and Factory's ability to launch workspaces w/ theia and vscode as the same displayName is used to create the devworkspace*.yaml files in the offline devfile registry.

So, this is problematic for a number of reasons:

  • spaces and uppercase letters in the IDE's displayName result in non-compliant subdomain values for the workspaces (workspaces won't open)
  • NOT having spaces and uppercase letters in the IDE selection UI means we have Vscode instead of VS Code which is embarrassing and doesn't comply with trademark rules

image

Describe the solution you'd like

  1. We could add a new field to the che-editors.yaml that can be used to generate the workspace subdomain prefix, eg., workspacePrefix = {idea, theia, vscode}
  2. We could add a new field for the Dashboard to use when displaying the IDE list, eg., selectionName = {"IntelliJ IDEA Community", "Eclipse Theia", "VS Code - Open Source"}

Describe alternatives you've considered

No response

Additional context

No response

nickboldt avatar Sep 15 '22 11:09 nickboldt

Probably as an another solution we can improve libraries that generate DevWorkspace templates to check that DevWorkspaceTemplate metadata.name contains only lower case alphanumeric characters, '-' or '.' and I think another check should be done on dashboard side.

In that case we won't need to add new fields

svor avatar Sep 15 '22 12:09 svor

Adding a compliance check would be cool, but I still won't be able to pass pretty strings to the Dashboard UI.

And even if you clean up the passed in string by removing spaces and lowercasing things ... if the string I pass in is "VS Code - Open Source" and you turn that into "vscode-opensource" we might still end up with errors if the workspace subdomain ends up too long. "IntelliJ IDEA Community" ==> "intellijideacommunity" which is also a long string for a prefix.

Could we improve the library so that we:

  • split the string into space-separated chunks, pick the second chunk, and lowercase that?

That would give us 4 or 5 chars as the workspace name prefix:

  • theia
  • idea
  • code

Upstream we have right now:

image

So we could use the same strings/logic above + add pycharm:

  • "Eclipse Theia" ==> "theia"
  • "IntelliJ IDEA Community" ==> "idea"
  • "JetBrains PyCharm Community" ==> "pycharm"
  • "VS Code - Open Source" ==> "code"

nickboldt avatar Sep 20 '22 14:09 nickboldt

The dashboard displays the values coming from https://github.com/eclipse-che/che-plugin-registry/blob/main/che-editors.yaml as-is. If anything need to be changed there please provide a fix and let us know. On the dashboard end we are not going to add any extra logic related to editor names - all the metadata should come from the registry

ibuziuk avatar Oct 19 '22 13:10 ibuziuk

First two PRs:

  • https://github.com/eclipse-che/che-plugin-registry/pull/1441
  • https://github.com/redhat-developer/devspaces/pull/829

Once merged, will need a PR for Dashboard too, as we'll hit this error:

displayName must conform to lowercase RFC 1123 subdomain rules

-- https://github.com/redhat-developer/devspaces/commit/0c64a21414555c35ef93391a093ac70f13b190f8

I'm not sure what needs to change but I'm guessing it's something to do with editorId or how we load targetEditors from the plugin registry...

nickboldt avatar Oct 19 '22 23:10 nickboldt

I think we can resolve this as we have updated the display names in the dashboard and can still open workspaces. See https://issues.redhat.com/browse/CRW-3098

nickboldt avatar Nov 01 '22 20:11 nickboldt