From d1dc9be79f75e879b88c12b28113de5164b25e63 Mon Sep 17 00:00:00 2001 From: Andre Dietisheim Date: Fri, 26 Jan 2024 15:54:18 +0100 Subject: [PATCH] fix: offer 'Open Helm Charts' on project node (was: cluster)(#676) Signed-off-by: Andre Dietisheim --- .../openshift/actions/helm/OpenHelmChartsAction.java | 8 +++++--- src/main/resources/META-INF/plugin.xml | 7 ++++--- .../openshift/actions/helm/OpenHelmChartsActionTest.java | 6 ------ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsAction.java b/src/main/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsAction.java index 5e4f7adc5..e9ce28246 100644 --- a/src/main/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsAction.java +++ b/src/main/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsAction.java @@ -15,6 +15,8 @@ import org.jboss.tools.intellij.openshift.actions.HelmAction; import org.jboss.tools.intellij.openshift.telemetry.TelemetryService; import org.jboss.tools.intellij.openshift.tree.application.ApplicationsRootNode; +import org.jboss.tools.intellij.openshift.tree.application.NamespaceNode; +import org.jboss.tools.intellij.openshift.tree.application.ParentableNode; import org.jboss.tools.intellij.openshift.ui.helm.ChartsDialog; import org.jboss.tools.intellij.openshift.utils.helm.Helm; import org.jetbrains.annotations.NotNull; @@ -24,7 +26,8 @@ public class OpenHelmChartsAction extends HelmAction { @Override public void actionPerformedOnSelectedObject(AnActionEvent anActionEvent, Object selected, @NotNull Helm helm) { Project project = getEventProject(anActionEvent); - ChartsDialog dialog = new ChartsDialog((ApplicationsRootNode) selected, helm, project); + ApplicationsRootNode rootNode = ((ParentableNode) selected).getRoot(); + ChartsDialog dialog = new ChartsDialog(rootNode, helm, project); sendTelemetryResults(TelemetryService.TelemetryResult.SUCCESS); dialog.show(); } @@ -36,7 +39,6 @@ protected String getTelemetryActionName() { @Override public boolean isVisible(Object selected) { - return (selected instanceof ApplicationsRootNode) - && ((ApplicationsRootNode) selected).isLogged(); + return selected instanceof NamespaceNode; } } diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index c85fe1183..59c2dd819 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -282,9 +282,6 @@ - - - + + + + diff --git a/src/test/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsActionTest.java b/src/test/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsActionTest.java index 2b31ec8d6..9f925c63e 100644 --- a/src/test/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsActionTest.java +++ b/src/test/java/org/jboss/tools/intellij/openshift/actions/helm/OpenHelmChartsActionTest.java @@ -21,12 +21,6 @@ public AnAction getAction() { @Override protected void verifyProject(boolean visible) { - assertFalse(visible); - } - - @Override - protected void verifyLoggedInCluster(boolean visible) { assertTrue(visible); } - }