-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHOAIENG-1109 Select Storage Classes in add cluster storage sections
- Loading branch information
Showing
11 changed files
with
137 additions
and
46 deletions.
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
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
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
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
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
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
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
29 changes: 29 additions & 0 deletions
29
frontend/src/pages/projects/screens/spawner/storage/useDefaultStorageClass.ts
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,29 @@ | ||
import * as React from 'react'; | ||
import useStorageClasses from '~/concepts/k8s/useStorageClasses'; | ||
import { StorageClassKind } from '~/k8sTypes'; | ||
import { | ||
getStorageClassConfig, | ||
isOpenshiftDefaultStorageClass, | ||
} from '~/pages/storageClasses/utils'; | ||
|
||
const useDefaultStorageClass = (): StorageClassKind | undefined => { | ||
const [storageClasses, storageClassesLoaded] = useStorageClasses(); | ||
const [defaultStorageClass, setDefaultStorageClass] = React.useState< | ||
StorageClassKind | undefined | ||
>(); | ||
|
||
React.useEffect(() => { | ||
if (!storageClassesLoaded) { | ||
return; | ||
} | ||
|
||
const defaultSc = storageClasses.find( | ||
(sc) => isOpenshiftDefaultStorageClass(sc) || getStorageClassConfig(sc)?.isDefault, | ||
); | ||
setDefaultStorageClass(defaultSc); | ||
}, [storageClasses, storageClassesLoaded]); | ||
|
||
return defaultStorageClass; | ||
}; | ||
|
||
export default useDefaultStorageClass; |
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
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
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