hunk.code_window: import { SidebarItem } from './SidebarItem';
   import { SidebarSection } from './SidebarSection';
   interface Props {
     isAdmin: boolean;
   }
  
hunk.labels: keep keep keep keep add keep keep
hunk.after_edit:   isTeamLeader?: boolean;
  
hunk.file_path: app/react/sidebar/SettingsSidebar.tsx
hunk.type: add
file: import { useQuery } from 'react-query';
  
  import { EnvironmentId } from '@/portainer/environments/types';
  import axios, { parseAxiosError } from '@/portainer/services/axios';
  
  export interface VersionResponse {
    ApiVersion: string;
  }
  
  export async function getVersion(environmentId: EnvironmentId) {
    try {
      const { data } = await axios.get<VersionResponse>(
        buildUrl(environmentId, 'version')
      );
      return data;
    } catch (err) {
      throw parseAxiosError(err as Error, 'Unable to retrieve version');
    }
  }
  
  export interface InfoResponse {
    Swarm?: {
      NodeID: string;
      ControlAvailable: boolean;
    };
  }
  
  export async function getInfo(environmentId: EnvironmentId) {
    try {
      const { data } = await axios.get<InfoResponse>(
        buildUrl(environmentId, 'info')
      );
      return data;
    } catch (err) {
      throw parseAxiosError(err as Error, 'Unable to retrieve version');
    }
  }
  
  function buildUrl(
    environmentId: EnvironmentId,
    action: string,
    subAction = ''
  ) {
    let url = `/endpoints/${environmentId}/docker/${action}`;
  
    if (subAction) {
      url += `/${subAction}`;
    }
  
    return url;
  }
  
  export function useInfo<TSelect = InfoResponse>(
    environmentId: EnvironmentId,
    select?: (info: InfoResponse) => TSelect
  ) {
    return useQuery(
      ['environment', environmentId, 'docker', 'info'],
      () => getInfo(environmentId),
      {
        select,
      }
    );
  }
  export function useVersion<TSelect = VersionResponse>(
    environmentId: EnvironmentId,
    select?: (info: VersionResponse) => TSelect
  ) {
    return useQuery(
      ['environment', environmentId, 'docker', 'version'],
      () => getVersion(environmentId),
      {
        select,
      }
    );
  }
  