[BREAKINGCHANGE] fetch plugin based on version#128
Conversation
4d0516d to
d604ac7
Compare
|
Thank you @shahrokni for updating the frontend regarding the plugin multi version management ! Indeed the backend will need to be updated at some point, but hopefully that should be as easy as to update the regexp capturingPluginName = regexp.MustCompile(`/plugins/([a-zA-Z0-9_-]+)/?.*`)to catch the registry and the version. |
192e537 to
e9f8773
Compare
582eb82 to
48908cf
Compare
48908cf to
a179a07
Compare
58660be to
4dedf66
Compare
4dedf66 to
52b534a
Compare
fb57b58 to
0d2ec31
Compare
Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com> Signed-off-by: Seyed Mahmoud SHAHROKNI <seyedmahmoud.shahrokni@amadeus.com>
fbee7e9 to
c291fbc
Compare
| * Note: It is likely that the key is not found. However, the search should NOT give up easily! | ||
| * Instead it should continue with the fallback mechanism | ||
| */ | ||
| compoundKey = `${kind}:${name}:${registry}:${version}`; |
There was a problem hiding this comment.
we should reuse the getPluginModuleCompoundKey otherwise some strings with undefined will be generated.
| pluginIndexesCache.current = request; | ||
|
|
||
| // Remove failed requests from the cache so they can potentially be retried | ||
| request.catch(() => pluginIndexesCache.current === undefined); |
There was a problem hiding this comment.
Previous issue, but should this be?
| request.catch(() => pluginIndexesCache.current = undefined); |
| }, | ||
| importPlugin, | ||
| } = p; | ||
| importMap.set(`${kind}:${name}:${registry ?? ''}:${version ?? ''}`, { resource, importPlugin }); |
There was a problem hiding this comment.
same here: getPluginModuleCompoundKey
| kind, | ||
| metadata: { name, version, registry }, | ||
| } = resource; | ||
| const { importPlugin } = importMap.get(`${kind}:${name}:${registry ?? ''}:${version ?? ''}`) || {}; |
There was a problem hiding this comment.
getPluginModuleCompoundKey
| resource = pluginIndexes.pluginResourcesByNameKindRegistryVersion.get(compoundKey); | ||
| if (resource) { | ||
| pluginModule = (await loadPluginModule(resource)) as Record<string, Plugin<UnknownSpec>>; | ||
| const plugin = pluginModule?.[`${name}:${registry ?? ''}:${version ?? ''}`]; |
There was a problem hiding this comment.
maybe we should also have a function for this name, it might seem trivial but is repeated a couple of times.
There was a problem hiding this comment.
Its the compound key. We can use the same function no?
perses/perses#1186
Different Plugins Versions and Registries
So far a plugin could be imported by its name only.
The backend has recently introduced a feature by which multiple versions of the same plugin could be available.
This means if the consumer of the Plugin Registry provided the version and registry, the exact desired plugin could be loaded in the front!
To achieve the mentioned goal the new URL will carry the version and registry as well. If not provided by the consumer, the front uses the default values introduced by the backend which are latest and perses.dev
Backend should be adjusted to manage the new URL. I checked the backend and understood that at the moment the intercepted GET request is translated to the address of the files on the disk. Please take a look at (ui\endpoint.go)
I believe the following shared code should be adjusted for the new URL that I just explained.
There is also a TODO comment in backend that I believe could to be addressed now
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: