Hi, I’m currently exploring the new Teamwork Graph Smart Links module and ran into some issues and have some feedback.
1.) Custom subdomains
The most important one for me is that even if I set subdomains: true, pasting links with an additional subdomain level does not work. For example, consider the following manifest definition:
modules:
graph:smartLink:
- key: sl-test-example-hello-world
icon: https://static.example-hello-world.com/favicon.ico
name: sl-test
function: getEntityByUrl
domains:
- example-hello-world.com
- www.example-hello-world.com
subdomains: true
patterns:
- https:\/\/([\w\.-]+\.)?example-hello-world\.com\/([0-9a-zA-Z]{4,128})(?:\/.*)?$
That is the example code from the documentation. This works as following when I edit an issue’s description and paste a link matching the pattern:
- pasting
https://example-hello-world.com/123456→ works
- pasting
https://www.example-hello-world.com/123456→ works
- pasting
https://us-east-1.www.example-hello-world.com/123456→ does not work
- This should work if I understand the definition of the
subdomainsfield correctly
- This should work if I understand the definition of the
- pasting
https://foobar.us-east-1.www.example-hello-world.com/123456→ does not work
- I guess this is intentional but it’s not explicitly mentioned in the docs that it won’t work
I verified that the pattern should work with the given urls by testing it with regex101.com. It seems that this problem is also covered in another topic here but hasn’t been answered by anyone. Is that a known problem?
2.) id not supported
Then, it seems someone has taken @tbinna ‘s type definitions and copy/pasted them into the Smart Links tutorial but hasn’t verified them - or the API contract has changed in the meantime. I’m suspecting that because the identifier object does not accept an id field (only url is allowed) and the http request resolving the pasted url even returns an error if you provide an id in the identifier object:
[
{
"error": {
"type": "ResolveFailedError",
"message": "Invalid response received from Xen: .data.invokeExtension.response.body.entities[0].identifier id should NOT have additional properties",
"status": 500,
"extensionKey": "external_sl_3p::sl-test-example-hello-world"
},
"status": 500
}
]
The response definition does not mention an id field either. So that should be fixed in the tutorial I guess.
3.) Using an SVG image as preview
At the top of the Smart Links documentation page, there’s a preview how a smart link will look like in the “extended” mode. On that documentation page, it’s not explicitly mentioned how we can provide/create such a preview image. But in the example code at the bottom, there’s an example hidden:
thumbnail: {
externalUrl: 'https://...',
},
Unfortunately, if I use an SVG image there, it doesn’t display it properly and cuts off the top and bottom instead. (I tested it with an SVG image that’s being used in a Forge app with <Image /> where it is being displayed as expected) So I’m wondering what your suggestion is how we could use it?