Skip to content

feat: Parse coder_metadata resource item as markdown #115

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

Closed
matifali opened this issue Mar 21, 2023 · 13 comments · Fixed by coder/coder#10521
Closed

feat: Parse coder_metadata resource item as markdown #115

matifali opened this issue Mar 21, 2023 · 13 comments · Fixed by coder/coder#10521
Assignees

Comments

@matifali
Copy link
Member

https://registry.terraform.io/providers/coder/coder/latest/docs/resources/metadata#nested-schema-for-item

resource "coder_metadata" "workspace_info" {
  count       = data.coder_workspace.me.start_count
  resource_id = docker_image.deeplearning.id
  icon        = data.coder_parameter.framework.option[index(data.coder_parameter.framework.option.*.value, data.coder_parameter.framework.value)].icon
  item {
    key   = "Framework"
    value = data.coder_parameter.framework.option[index(data.coder_parameter.framework.option.*.value, data.coder_parameter.framework.value)].name
  }
  item {
    key   = "NGC Version"
    value = local.ngc-version
	link = 'https://some-link.com'  
  }
  item {
    key   = "CPU Cores"
    value = data.coder_parameter.cpu.value
  }
  item {
    key   = "RAM (GB)"
    value = data.coder_parameter.ram.value
  }
}
@matifali
Copy link
Member Author

What do you think about this?@bpmct

@bpmct
Copy link
Member

bpmct commented Mar 22, 2023

What if we rendered markdown in the value instead, like we do for parameter descriptions?

@matifali
Copy link
Member Author

That would do the purpose; This is my idea if we can somehow make the values clickable and can open links. Nice idea

@matifali
Copy link
Member Author

As a workaround, an external coder_app resource can be used.

@hh
Copy link

hh commented Jun 17, 2023

Got my vote!

@matifali
Copy link
Member Author

@coder/ts how difficult is it to support markdown for rendering values field?

@BrunoQuaresma
Copy link
Collaborator

The difficult part is not the implementation but how to make it looks nice

@matifali
Copy link
Member Author

Can't we simply render the text as markdown? For example

[Google](https://google.com)

Should render as Google

@aslilac aslilac self-assigned this Oct 28, 2023
@aslilac
Copy link
Member

aslilac commented Nov 2, 2023

Image

rendering it as markdown is trivial. this took me like 15 minutes. but it's also pretty weird to just have this sort of stuff be possible. 😅

Image

there's also the fact that we currently support "click to copy", which makes a lot less sense when the description is more complex markdown, and interferes with clicking links.

@matifali
Copy link
Member Author

matifali commented Nov 2, 2023

I agree markdown could be pretty complex, the original request was to just be able to create hyperlinks. For example if we show the version of a software then clicking it could open a URL to the changelog.

@aslilac
Copy link
Member

aslilac commented Nov 2, 2023

I think we just need to come up with the right way to describe them. maybe we could restrict these to a subset of markdown somehow? and probably someway to detect whether it's markdown or not so we know whether to make it copyable or not. idk if we expose that in the terraform provider or if we just try to be smart about it.

@aslilac
Copy link
Member

aslilac commented Nov 2, 2023

maybe we could limit it to a super strict subset of markdown that basically only allows a single like and nothing else to keep it extra simple

@matifali
Copy link
Member Author

matifali commented Nov 2, 2023

SGTM, I do not have any other use case in mind. Maybe @bpmct can think of one.
I think a minimal markdown support with the ability to bold and hyperlink text would be enough.

@matifali matifali changed the title feat: Add a link to coder_metadata resource item so that it can be clicked and opened. feat: Parse coder_metadata resource item as markdown Nov 6, 2023
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 a pull request may close this issue.

5 participants