Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Allow plugins to add multiple tabs #2165

Merged
merged 1 commit into from
Mar 18, 2021

Conversation

GuessWhoSamFoo
Copy link
Contributor

What this PR does / why we need it:
This is a non-breaking API change that allows plugin authors to add multiple tabs from a single plugin. Plugins will still be displayed in lexical order as they are sorted with tabs potentially from other plugins.

options := []service.PluginOption{
	service.WithTabPrinter(handleTab, handleTab2, handleTab3),
}

Which issue(s) this PR fixes

Signed-off-by: Sam Foo [email protected]

Tab: cTab,
return []TabResponse{
{
Tab: cTab,
Copy link
Contributor

Choose a reason for hiding this comment

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

So for now JS plugins can still generate a single tab? I'm guessing there will be updates here after corresponding changes are made pushed https://github.com/vmware-tanzu/plugin-library-for-octant?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@wwitzel3 wwitzel3 left a comment

Choose a reason for hiding this comment

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

This looks good to me, please create an issue in the plugin library repo to ensure we update the libraries there for this new behavior as part of 0.18.

As mentioned in a comment, we'll want to update https://github.com/vmware-tanzu/plugin-library-for-octant/blob/main/plugin/helpers.ts#L83 and https://github.com/vmware-tanzu/plugin-library-for-octant/blob/main/plugin/octant.d.ts#L62 after this lands.

@GuessWhoSamFoo
Copy link
Contributor Author

Merging so npm libraries can cut an update if desired.

@GuessWhoSamFoo GuessWhoSamFoo merged commit 8055778 into vmware-archive:master Mar 18, 2021
@wwitzel3
Copy link
Contributor

Bad review from me previously, I completely missed that the TabResponse object in the jsPlugin.PrintTabs method was hard coded to a single tab. So even with the typescript updates, the JS plugins won't be able to generate multiple tabs.

Sorry about that, I'll open for that and see about getting that implemented along side the TS libraries.

https://github.com/vmware-tanzu/octant/blob/master/pkg/plugin/javascript.go#L399

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow plugins to contribute multiple tab responses
3 participants