Skip to content

Commit

Permalink
fix pvc
Browse files Browse the repository at this point in the history
  • Loading branch information
maciaszczykm committed Mar 29, 2024
1 parent 54f5988 commit f715f2c
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
53 changes: 50 additions & 3 deletions assets/src/components/kubernetes/storage/PersistentVolume.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ReactElement, useMemo } from 'react'
import { useSetBreadcrumbs } from '@pluralsh/design-system'
import { Outlet, useOutletContext, useParams } from 'react-router-dom'
import {
ChipList,
SidecarItem,
useSetBreadcrumbs,
} from '@pluralsh/design-system'
import { Link, Outlet, useOutletContext, useParams } from 'react-router-dom'

import {
ConfigMapQueryVariables,
Expand All @@ -14,7 +18,10 @@ import { getResourceDetailsAbsPath } from '../../../routes/kubernetesRoutesConst

import ResourceDetails, { TabEntry } from '../ResourceDetails'

import { InlineLink } from '../../utils/typography/InlineLink'

import { getBreadcrumbs } from './PersistentVolumes'
import { PVStatusChip } from './utils'

const directory: Array<TabEntry> = [
{ path: '', label: 'Info' },
Expand Down Expand Up @@ -48,12 +55,52 @@ export default function PersistentVolume(): ReactElement {
)
)

const [claimNamespace, claimName] = (pv?.claim ?? '').split('/')

if (loading) return <LoadingIndicator />

return (
<ResourceDetails
tabs={directory}
sidecar={<MetadataSidecar objectMeta={pv?.objectMeta} />}
sidecar={
<MetadataSidecar objectMeta={pv?.objectMeta}>
<SidecarItem heading="Claim">
<Link
to={getResourceDetailsAbsPath(
cluster?.id,
'persistentvolumeclaim',
claimName ?? '',
claimNamespace
)}
>
<InlineLink>{pv?.claim}</InlineLink>
</Link>
</SidecarItem>
<SidecarItem heading="Storage class">
<Link
to={getResourceDetailsAbsPath(
cluster?.id,
'storageclass',
pv?.storageClass ?? ''
)}
>
<InlineLink>{pv?.storageClass}</InlineLink>
</Link>
</SidecarItem>
<SidecarItem heading="Status">
<PVStatusChip status={pv?.status} />
</SidecarItem>
<SidecarItem heading="Access modes">
<ChipList
size="small"
limit={1}
values={Object.entries(pv?.accessModes || {})}
transformValue={(accessModes) => accessModes.join(': ')}
emptyState={null}
/>
</SidecarItem>
</MetadataSidecar>
}
>
<Outlet context={pv} />
</ResourceDetails>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const colClaim = columnHelper.accessor((pv) => pv.claim, {
const { cluster } = table.options.meta as {
cluster?: ClusterTinyFragment
}
const [name, namespace] = (getValue() ?? '').split('/')
const [namespace, name] = (getValue() ?? '').split('/')

return (
<Link
Expand Down
2 changes: 1 addition & 1 deletion assets/src/generated/graphql-kubernetes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6492,7 +6492,7 @@ export type PersistentVolumeClaimsSuspenseQueryHookResult = ReturnType<typeof us
export type PersistentVolumeClaimsQueryResult = Apollo.QueryResult<PersistentVolumeClaimsQuery, PersistentVolumeClaimsQueryVariables>;
export const PersistentVolumeClaimDocument = gql`
query PersistentVolumeClaim($name: String!, $namespace: String!) {
handleGetPersistentVolumeClaimDetail(namespace: $namespace, name: $name) @rest(type: "persistentvolumeclaim_PersistentVolumeClaim", path: "persistentvolumeclaim/{args.namespace}/{args.name}") {
handleGetPersistentVolumeClaimDetail(namespace: $namespace, name: $name) @rest(type: "persistentvolumeclaim_PersistentVolumeClaimDetail", path: "persistentvolumeclaim/{args.namespace}/{args.name}") {
...PersistentVolumeClaimDetail
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ query PersistentVolumeClaims(
query PersistentVolumeClaim($name: String!, $namespace: String!) {
handleGetPersistentVolumeClaimDetail(namespace: $namespace, name: $name)
@rest(
type: "persistentvolumeclaim_PersistentVolumeClaim"
type: "persistentvolumeclaim_PersistentVolumeClaimDetail"
path: "persistentvolumeclaim/{args.namespace}/{args.name}"
) {
...PersistentVolumeClaimDetail
Expand Down

0 comments on commit f715f2c

Please sign in to comment.