mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
fix(volumes): update external labels CE [r8s-108] (#7)
This commit is contained in:
parent
57e10dc911
commit
fd0bc652a9
8 changed files with 10 additions and 8 deletions
|
@ -8,7 +8,7 @@ import { ExternalBadge } from '@@/Badge/ExternalBadge';
|
|||
import { UnusedBadge } from '@@/Badge/UnusedBadge';
|
||||
|
||||
import { useNamespacesQuery } from '../../namespaces/queries/useNamespacesQuery';
|
||||
import { isVolumeExternal, isVolumeUsed } from '../utils';
|
||||
import { isVolumeUsed } from '../utils';
|
||||
|
||||
import { VolumeViewModel } from './types';
|
||||
import { helper } from './columns.helper';
|
||||
|
@ -44,7 +44,7 @@ export function NameCell({
|
|||
<SystemBadge />
|
||||
) : (
|
||||
<>
|
||||
{isVolumeExternal(item) && <ExternalBadge />}
|
||||
{item.PersistentVolumeClaim.IsExternal && <ExternalBadge />}
|
||||
{!isVolumeUsed(item) && <UnusedBadge />}
|
||||
</>
|
||||
)}
|
||||
|
|
|
@ -13,6 +13,7 @@ export interface VolumeViewModel {
|
|||
Storage?: unknown;
|
||||
CreationDate?: string;
|
||||
ApplicationOwner?: string;
|
||||
IsExternal?: boolean;
|
||||
};
|
||||
ResourcePool: {
|
||||
Namespace: {
|
||||
|
|
|
@ -9,6 +9,7 @@ import { Volume } from '@/kubernetes/models/volume/Volume';
|
|||
import { parseKubernetesAxiosError } from '../../axiosError';
|
||||
import { K8sVolumeInfo } from '../types';
|
||||
import { VolumeViewModel, StorageClassViewModel } from '../ListView/types';
|
||||
import { appOwnerLabel } from '../../applications/constants';
|
||||
|
||||
import { queryKeys } from './query-keys';
|
||||
|
||||
|
@ -86,6 +87,7 @@ function convertToVolumeViewModels(
|
|||
CreationDate: volume.persistentVolumeClaim.creationDate,
|
||||
ApplicationOwner:
|
||||
volume.persistentVolumeClaim.owningApplications?.[0]?.Name,
|
||||
IsExternal: !volume.persistentVolumeClaim.labels?.[appOwnerLabel],
|
||||
},
|
||||
ResourcePool: {
|
||||
Namespace: {
|
||||
|
|
|
@ -37,6 +37,7 @@ interface K8sPersistentVolumeClaim {
|
|||
volumeMode?: PersistentVolumeClaimSpec['volumeMode'];
|
||||
owningApplications?: K8sVolOwningApplication[];
|
||||
phase: PersistentVolumeClaimStatus['phase'];
|
||||
labels?: { [key: string]: string };
|
||||
}
|
||||
|
||||
interface K8sStorageClass {
|
||||
|
|
|
@ -6,10 +6,6 @@ export function isVolumeUsed(volume: VolumeViewModel) {
|
|||
return volume.Applications.length !== 0;
|
||||
}
|
||||
|
||||
export function isVolumeExternal(volume: VolumeViewModel) {
|
||||
return !volume.PersistentVolumeClaim.ApplicationOwner;
|
||||
}
|
||||
|
||||
export function generatedApplicationConfigVolumeName(applicationName: string) {
|
||||
return `config-${applicationName}-${uuidv4()}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue