-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend PersistentVolumeClaim: Make its limits field optional
As it's not mandatory. Signed-off-by: Joaquim Rocha <[email protected]>
- Loading branch information
1 parent
3ae32c2
commit 77292a5
Showing
3 changed files
with
531 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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({}); |
Oops, something went wrong.