mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 08:19:40 +02:00
feat(helm): update helm view [r8s-256] (#582)
Co-authored-by: Cara Ryan <cara.ryan@portainer.io> Co-authored-by: James Player <james.player@portainer.io> Co-authored-by: stevensbkang <skan070@gmail.com>
This commit is contained in:
parent
46eddbe7b9
commit
0ca9321db1
57 changed files with 2635 additions and 222 deletions
111
app/react/kubernetes/helm/HelmApplicationView/HelmSummary.tsx
Normal file
111
app/react/kubernetes/helm/HelmApplicationView/HelmSummary.tsx
Normal file
|
@ -0,0 +1,111 @@
|
|||
import { Badge } from '@/react/components/Badge';
|
||||
|
||||
import { Alert } from '@@/Alert';
|
||||
|
||||
import { HelmRelease } from '../types';
|
||||
|
||||
interface Props {
|
||||
release: HelmRelease;
|
||||
}
|
||||
|
||||
export enum DeploymentStatus {
|
||||
DEPLOYED = 'deployed',
|
||||
FAILED = 'failed',
|
||||
PENDING = 'pending-install',
|
||||
PENDINGUPGRADE = 'pending-upgrade',
|
||||
PENDINGROLLBACK = 'pending-rollback',
|
||||
SUPERSEDED = 'superseded',
|
||||
UNINSTALLED = 'uninstalled',
|
||||
UNINSTALLING = 'uninstalling',
|
||||
}
|
||||
|
||||
export function HelmSummary({ release }: Props) {
|
||||
const isSuccess =
|
||||
release.info?.status === DeploymentStatus.DEPLOYED ||
|
||||
release.info?.status === DeploymentStatus.SUPERSEDED;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="flex flex-col gap-y-4">
|
||||
<div>
|
||||
<Badge type={getStatusColor(release.info?.status)}>
|
||||
{getText(release.info?.status)}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{!!release.namespace && <Badge>Namespace: {release.namespace}</Badge>}
|
||||
{!!release.version && <Badge>Revision: #{release.version}</Badge>}
|
||||
{!!release.chart?.metadata?.name && (
|
||||
<Badge>Chart: {release.chart.metadata.name}</Badge>
|
||||
)}
|
||||
{!!release.chart?.metadata?.appVersion && (
|
||||
<Badge>App version: {release.chart.metadata.appVersion}</Badge>
|
||||
)}
|
||||
{!!release.chart?.metadata?.version && (
|
||||
<Badge>
|
||||
Chart version: {release.chart.metadata.name}-
|
||||
{release.chart.metadata.version}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
{!!release.info?.description && !isSuccess && (
|
||||
<Alert color={getAlertColor(release.info?.status)}>
|
||||
{release.info?.description}
|
||||
</Alert>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function getAlertColor(status?: string) {
|
||||
switch (status?.toLowerCase()) {
|
||||
case DeploymentStatus.DEPLOYED:
|
||||
return 'success';
|
||||
case DeploymentStatus.FAILED:
|
||||
return 'error';
|
||||
case DeploymentStatus.PENDING:
|
||||
case DeploymentStatus.PENDINGUPGRADE:
|
||||
case DeploymentStatus.PENDINGROLLBACK:
|
||||
case DeploymentStatus.UNINSTALLING:
|
||||
return 'warn';
|
||||
case DeploymentStatus.SUPERSEDED:
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusColor(status?: string) {
|
||||
switch (status?.toLowerCase()) {
|
||||
case DeploymentStatus.DEPLOYED:
|
||||
return 'success';
|
||||
case DeploymentStatus.FAILED:
|
||||
return 'danger';
|
||||
case DeploymentStatus.PENDING:
|
||||
case DeploymentStatus.PENDINGUPGRADE:
|
||||
case DeploymentStatus.PENDINGROLLBACK:
|
||||
case DeploymentStatus.UNINSTALLING:
|
||||
return 'warn';
|
||||
case DeploymentStatus.SUPERSEDED:
|
||||
default:
|
||||
return 'info';
|
||||
}
|
||||
}
|
||||
|
||||
function getText(status?: string) {
|
||||
switch (status?.toLowerCase()) {
|
||||
case DeploymentStatus.DEPLOYED:
|
||||
return 'Deployed';
|
||||
case DeploymentStatus.FAILED:
|
||||
return 'Failed';
|
||||
case DeploymentStatus.PENDING:
|
||||
case DeploymentStatus.PENDINGUPGRADE:
|
||||
case DeploymentStatus.PENDINGROLLBACK:
|
||||
case DeploymentStatus.UNINSTALLING:
|
||||
return 'Pending';
|
||||
case DeploymentStatus.SUPERSEDED:
|
||||
return 'Superseded';
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue