1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/renderer/components/+storage-volumes/volumes.store.ts
Violetta 0d3505cfac
Add persistent volumes info to storage class submenu (#2160)
Signed-off-by: vshakirova <vshakirova@mirantis.com>
2021-02-24 11:02:39 +03:00

20 lines
726 B
TypeScript

import { KubeObjectStore } from "../../kube-object.store";
import { autobind } from "../../utils";
import { PersistentVolume, persistentVolumeApi } from "../../api/endpoints/persistent-volume.api";
import { apiManager } from "../../api/api-manager";
import { StorageClass } from "../../api/endpoints/storage-class.api";
@autobind()
export class PersistentVolumesStore extends KubeObjectStore<PersistentVolume> {
api = persistentVolumeApi;
getByStorageClass(storageClass: StorageClass): PersistentVolume[] {
return this.items.filter(volume =>
volume.getStorageClassName() === storageClass.getName()
);
}
}
export const volumesStore = new PersistentVolumesStore();
apiManager.registerStore(volumesStore);