hunk.code_window:       apiService = this.KubernetesDeploymentService;
       } else if (app.ApplicationType === KubernetesApplicationTypes.DaemonSet) {
         apiService = this.KubernetesDaemonSetService;
       } else if (app.ApplicationType === KubernetesApplicationTypes.StatefulSet) {
         apiService = this.KubernetesStatefulSetService;
       } else if (app.ApplicationType === KubernetesApplicationTypes.Pod) {
         apiService = this.KubernetesPodService;
       } else {
         throw new PortainerError('Unable to determine which association to use to retrieve API Service');
       }
  
hunk.labels: keep keep keep keep keep replace keep keep keep keep
hunk.after_edit:     } else if (app instanceof KubernetesPod || (app instanceof KubernetesApplication && app.ApplicationType === KubernetesApplicationTypes.Pod)) {
  
hunk.file_path: app/kubernetes/services/applicationService.js
hunk.type: replace
file: import { useState } from 'react';
  import { createPortal } from 'react-dom';
  import { Terminal } from 'lucide-react';
  import clsx from 'clsx';
  
  import { EnvironmentId } from '@/react/portainer/environments/types';
  import { useAnalytics } from '@/react/hooks/useAnalytics';
  
  import { Button } from '@@/buttons';
  
  import { useSidebarState } from '../../useSidebarState';
  import { SidebarTooltip } from '../../SidebarItem/SidebarTooltip';
  
  import { KubeCtlShell } from './KubectlShell';
  
  interface Props {
    environmentId: EnvironmentId;
  }
  export function KubectlShellButton({ environmentId }: Props) {
    const { isOpen: isSidebarOpen } = useSidebarState();
  
    const [open, setOpen] = useState(false);
    const { trackEvent } = useAnalytics();
  
    const button = (
      <Button
        color="primary"
        size="small"
        disabled={open}
        data-cy="k8sSidebar-shellButton"
        onClick={() => handleOpen()}
        className={clsx('sidebar', !isSidebarOpen && '!p-1')}
        icon={Terminal}
      >
        {isSidebarOpen ? 'kubectl shell' : ''}
      </Button>
    );
  
    return (
      <>
        {!isSidebarOpen && (
          <SidebarTooltip
            content={
              <span className="text-sm whitespace-nowrap">Kubectl Shell</span>
            }
          >
            <span className="flex w-full justify-center">{button}</span>
          </SidebarTooltip>
        )}
        {isSidebarOpen && button}
        {open &&
          createPortal(
            <KubeCtlShell
              environmentId={environmentId}
              onClose={() => setOpen(false)}
            />,
            document.body
          )}
      </>
    );
  
    function handleOpen() {
      setOpen(true);
  
      trackEvent('kubernetes-kubectl-shell', { category: 'kubernetes' });
    }
  }
  