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
feat: add when property to extensions menus #3959
feat: add when property to extensions menus #3959
Conversation
hi @axel7083 thanks for this other PR I was wondering if we should probably use prefix/suffix on the properties to avoid collisions/separate stuff for example We should describe what is available for given contexts For example, in container list, probably it should be And in image list, `imageSomething, etc. |
Other field are very generic in the For examle, in we can have
Then the when condition would be |
I would say I'm fine with the prefix but I'm unsure if we should use the I'm just thinking out loud. So I'm not sure as well about the properties as well. in the list, we display items so I'm not sure about so at the end, is it like |
or other ideas |
I implemented first the But if you rather have simple prefix, as you want. |
the so ok why not to say that containerList is a scope, I don't know what others think. it would mean then cc @lstocchi that added the context for the onboarding. Thoughts ? |
+1 to using e.g. in this case I'm assuming we'd want to allow adding an action to type container and state running, but it would also appear in the container details page at some point. |
@benoitf For the naming, we have to choose for the ComposeInfoUI, ContainerInfoUI, ImageInfoUI and PodInfoUI prefix to use. Any suggestation ? |
ComposeInfoUI -> is it what you're expecting ? based on the fact that it's displayed in a list in details page it would be
|
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
…onents Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
4ff5470
to
2c51d96
Compare
I really appreciate this contribution and haven't had a chance to test it yet, but so far it looks like prefixes like imageListItem are furthering one of our current problems that actions are only available in a specific place, e.g. you can push an image from the Images List, but not if you're actually looking at that image in Details. It requires every person contributing an action to know all the places where an object might appear and add to each of them. How many people will forget that pods appear in the containers list? I know there will be cases where something should only appear in one place too, but that seems lower frequency so I'm hesitant to release this without the other way of contributing. Maybe we can do both, or do something to make it more generic or more obvious to know where to contribute? Also, shouldn't docs/extensions/write/when-clause-context be updated? I'm ok with separate issue or PR, just don't want to lose this. |
I think action would appear correctly in both image list and image details (or container list and container details)
I think person won't need to know all the places. If you need an action about pods, you will register a menu for @axel7083 last change, could you tweak the prefix as as you're sharing the same *Actions component from the ContainerList and ContainerDetails we can't have 'List' in the name of the property Also, shouldn't docs/extensions/write/when-clause-context be updated? I'm ok with separate issue or PR, just don't want to lose this. @axel7083 could you open a PR against this file as well (out of this PR) |
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Looking as like final review: so it looks next steps (follow-up PR, etc) would be to include in containersDetails and imageDetails the inclusion of
and
but it seems there is something odd here, as it looks for compose or pods we're providing the wrong contributedMenus in ContainerList from my understanding we should have contributedContainerMenus = await window.getContributedMenus(MenuContext.DASHBOARD_CONTAINER);
contributedPodMenus = await window.getContributedMenus(MenuContext.DASHBOARD_POD);
contributedComposeMenus = await window.getContributedMenus(MenuContext.DASHBOARD_COMPOSE); and then for PodActions <PodActions..
contributions="{contributedPodMenus}" and then for ContainerActions <ContainerActions..
contributions="{contributedContainerMenus}" and then for ComposeActions <ComposeActions..
contributions="{contributedComposeMenus}" |
I see, but in the curent implementation, we do not distinguish with MenuContext.DASHBOARD_CONTAINER, MenuContext.DASHBOARD_COMPOSE etc.. This is evaluated at runtime using the when condition. We register all the menus to the ContainerList and then they are using the when condition to choose where they should be displayed. |
yes but this is not the expected behavior b/c you register a command to be displayed for a condition for different purpose, like for an image, for a pod or for a compose object. then, in your when clause, you'll use when a fine grained object, but default is that it's added. so if you say, I want to bind an action for a CONTAINER, you don't expect to see the action for a POD or for a Compose object |
The following change is more relevant to the previous PR about adding the DASHBOARD_CONTAINER than the when condition, should I include the change in this PR ? The change would include
|
I'm fine with your proposal |
and if it helps, you can merge some commits together and separate changes with different commits having a meaningful set of changes |
Perfect then
I will do everything here |
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not related to this PR but I think we should have contributedMenus being in a store as new items/deletion of items should refresh the UI on the fly
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
@axel7083 we still have unit tests failing I'll probably merge on monday as never merge big chunks on friday :-) |
Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
What does this PR do?
The
when
property is available on a large range of options, and this PR aims to add support for conditional menus provided by extensions.Screenshot/screencast of this PR
when
:type === compose
when
:state === RUNNING
What issues does this PR fix or reference?
The accessibles
when
propertiesDepending on which type of
ContainerGroup
it is, different properties are accessible.For a standalone container the following properties are accessible in addition of the global context.
standalone
compose
pod
TODO
Implementation details
The main logic of evaluating the context is delegated to the
ContributionActions.svelte
component. It was too laborious to manage everything in theContainerList.svelte
.The
ComposeInfoUI
andPodInfoUI
interface have a new propertytype
which allows to identify the type of ContainerGroup, this has been added since there was no other simple way to be able to distinguish them easily.An utility context function has been created
transformObjectToContext
taking any object and transforming it aContextUI
object. This function is generic since, the ContributionActions component does not have any type information about the arguments it receive.How to test this PR?