2025-03-03 11:29:58 +13:00
|
|
|
import { useCurrentStateAndParams } from '@uirouter/react';
|
|
|
|
|
2025-04-10 16:08:24 +12:00
|
|
|
import helm from '@/assets/ico/vendor/helm.svg?c';
|
2025-03-03 11:29:58 +13:00
|
|
|
import { PageHeader } from '@/react/components/PageHeader';
|
2025-04-10 16:08:24 +12:00
|
|
|
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
|
|
|
import { EnvironmentId } from '@/react/portainer/environments/types';
|
2025-03-03 11:29:58 +13:00
|
|
|
|
2025-04-10 16:08:24 +12:00
|
|
|
import { WidgetTitle, WidgetBody, Widget, Loading } from '@@/Widget';
|
|
|
|
import { Card } from '@@/Card';
|
|
|
|
import { Alert } from '@@/Alert';
|
|
|
|
|
|
|
|
import { HelmSummary } from './HelmSummary';
|
|
|
|
import { ReleaseTabs } from './ReleaseDetails/ReleaseTabs';
|
|
|
|
import { useHelmRelease } from './queries/useHelmRelease';
|
2025-04-22 09:52:52 +12:00
|
|
|
import { ChartActions } from './ChartActions/ChartActions';
|
2025-03-03 11:29:58 +13:00
|
|
|
|
|
|
|
export function HelmApplicationView() {
|
2025-04-10 16:08:24 +12:00
|
|
|
const environmentId = useEnvironmentId();
|
2025-03-03 11:29:58 +13:00
|
|
|
const { params } = useCurrentStateAndParams();
|
2025-03-13 12:20:16 +13:00
|
|
|
const { name, namespace } = params;
|
2025-03-03 11:29:58 +13:00
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<PageHeader
|
|
|
|
title="Helm details"
|
|
|
|
breadcrumbs={[
|
|
|
|
{ label: 'Applications', link: 'kubernetes.applications' },
|
|
|
|
name,
|
|
|
|
]}
|
|
|
|
reload
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div className="row">
|
|
|
|
<div className="col-sm-12">
|
2025-04-10 16:08:24 +12:00
|
|
|
<Widget>
|
2025-04-22 09:52:52 +12:00
|
|
|
{name && (
|
|
|
|
<WidgetTitle icon={helm} title={name}>
|
|
|
|
<ChartActions
|
|
|
|
environmentId={environmentId}
|
|
|
|
releaseName={name}
|
|
|
|
namespace={namespace}
|
|
|
|
/>
|
|
|
|
</WidgetTitle>
|
|
|
|
)}
|
|
|
|
<WidgetBody>
|
2025-04-10 16:08:24 +12:00
|
|
|
<HelmDetails
|
|
|
|
name={name}
|
|
|
|
namespace={namespace}
|
|
|
|
environmentId={environmentId}
|
|
|
|
/>
|
|
|
|
</WidgetBody>
|
|
|
|
</Widget>
|
2025-03-03 11:29:58 +13:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
2025-04-10 16:08:24 +12:00
|
|
|
|
|
|
|
type HelmDetailsProps = {
|
|
|
|
name: string;
|
|
|
|
namespace: string;
|
|
|
|
environmentId: EnvironmentId;
|
|
|
|
};
|
|
|
|
|
|
|
|
function HelmDetails({ name, namespace, environmentId }: HelmDetailsProps) {
|
|
|
|
const {
|
|
|
|
data: release,
|
|
|
|
isInitialLoading,
|
|
|
|
isError,
|
|
|
|
} = useHelmRelease(environmentId, name, namespace, {
|
|
|
|
showResources: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isInitialLoading) {
|
|
|
|
return <Loading />;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isError) {
|
|
|
|
return (
|
|
|
|
<Alert color="error" title="Failed to load Helm application details" />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!release) {
|
|
|
|
return <Alert color="error" title="No Helm application details found" />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<HelmSummary release={release} />
|
|
|
|
<div className="my-6 h-[1px] w-full bg-gray-5 th-dark:bg-gray-7 th-highcontrast:bg-white" />
|
|
|
|
<Card className="bg-inherit">
|
|
|
|
<ReleaseTabs release={release} />
|
|
|
|
</Card>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|