import { Pencil, Plus } from 'lucide-react'; import { useCurrentStateAndParams } from '@uirouter/react'; import { Pod } from 'kubernetes-types/core/v1'; import { Authorized } from '@/react/hooks/useUser'; import { useStackFile } from '@/react/common/stacks/stack.service'; import { Widget, WidgetBody } from '@@/Widget'; import { Button } from '@@/buttons'; import { Link } from '@@/Link'; import { Icon } from '@@/Icon'; import { useApplication, useApplicationServices, } from '../../application.queries'; import { isSystemNamespace } from '../../../namespaces/utils'; import { applicationIsKind, isExternalApplication } from '../../utils'; import { appStackIdLabel } from '../../constants'; import { RestartApplicationButton } from './RestartApplicationButton'; import { RedeployApplicationButton } from './RedeployApplicationButton'; import { RollbackApplicationButton } from './RollbackApplicationButton'; import { ApplicationServicesTable } from './ApplicationServicesTable'; import { ApplicationIngressesTable } from './ApplicationIngressesTable'; import { ApplicationAutoScalingTable } from './ApplicationAutoScalingTable'; import { ApplicationEnvVarsTable } from './ApplicationEnvVarsTable'; import { ApplicationVolumeConfigsTable } from './ApplicationVolumeConfigsTable'; import { ApplicationPersistentDataTable } from './ApplicationPersistentDataTable'; export function ApplicationDetailsWidget() { const stateAndParams = useCurrentStateAndParams(); const { params: { namespace, name, 'resource-type': resourceType, endpointId: environmentId, }, } = stateAndParams; // get app info const appQuery = useApplication(environmentId, namespace, name, resourceType); const app = appQuery.data; const externalApp = app && isExternalApplication(app); const appStackId = Number(app?.metadata?.labels?.[appStackIdLabel]); const appStackFileQuery = useStackFile(appStackId); const { data: appServices } = useApplicationServices( environmentId, namespace, name, app ); return ( {!isSystemNamespace(namespace) && (
{!applicationIsKind('Pod', app) && ( <> )} {!externalApp && ( )} {appStackFileQuery.data && ( )}
)}
); }