Skip to content

Commit

Permalink
frontend PersistentVolumeClaim: Make its limits field optional
Browse files Browse the repository at this point in the history
As it's not mandatory.

Signed-off-by: Joaquim Rocha <[email protected]>
  • Loading branch information
joaquimrocha committed Oct 5, 2023
1 parent 3ae32c2 commit 77292a5
Show file tree
Hide file tree
Showing 3 changed files with 531 additions and 1 deletion.
70 changes: 70 additions & 0 deletions frontend/src/components/storage/ClaimList.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Meta, Story } from '@storybook/react/types-6-0';
import _ from 'lodash';
import PersistentVolumeClaim, {
KubePersistentVolumeClaim,
} from '../../lib/k8s/persistentVolumeClaim';
import { TestContext } from '../../test';
import PVClaimList from './ClaimList';

const basePVC = {
apiVersion: 'v1',
kind: 'PersistentVolumeClaim',
metadata: {
creationTimestamp: '2023-04-27T20:31:27Z',
finalizers: ['kubernetes.io/pvc-protection'],
name: 'my-pvc',
namespace: 'default',
resourceVersion: '1234',
uid: 'abc-1234',
},
spec: {
accessModes: ['ReadWriteOnce'],
resources: {
requests: {
storage: '8Gi',
},
},
storageClassName: 'default',
volumeMode: 'Filesystem',
volumeName: 'pvc-abc-1234',
},
status: {
accessModes: ['ReadWriteOnce'],
capacity: {
storage: '8Gi',
},
phase: 'Bound',
},
};

PersistentVolumeClaim.useList = () => {
const noStorageClassNamePVC = _.cloneDeep(basePVC);
noStorageClassNamePVC.metadata.name = 'no-storage-class-name-pvc';
noStorageClassNamePVC.spec.storageClassName = '';

const objList = [basePVC, noStorageClassNamePVC].map(
pvc => new PersistentVolumeClaim(pvc as KubePersistentVolumeClaim)
);
return [objList, null, () => {}, () => {}] as any;
};

export default {
title: 'Storage/PersistentVolumeClaim',
component: PVClaimList,
argTypes: {},
decorators: [
Story => {
return (
<TestContext>
<Story />
</TestContext>
);
},
],
} as Meta;

const Template: Story = () => {
return <PVClaimList />;
};

export const ListView = Template.bind({});
Loading

0 comments on commit 77292a5

Please sign in to comment.