mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
refactor(app): persisted folders form section [EE-6235] (#10693)
* refactor(app): persisted folder section [EE-6235]
This commit is contained in:
parent
7a2412b1be
commit
e07ee05ee7
39 changed files with 732 additions and 374 deletions
|
@ -25,7 +25,7 @@ import { IngressControllerClassMap } from '../../ingressClass/types';
|
|||
import { useIsRBACEnabledQuery } from '../../getIsRBACEnabled';
|
||||
import { getIngressClassesFormValues } from '../../ingressClass/IngressClassDatatable/utils';
|
||||
|
||||
import { useStorageClassesFormValues } from './useStorageClassesFormValues';
|
||||
import { useStorageClassesFormValues } from './useStorageClasses';
|
||||
import { ConfigureFormValues, StorageClassFormValues } from './types';
|
||||
import { configureValidationSchema } from './validation';
|
||||
import { RBACAlert } from './RBACAlert';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Switch } from '@@/form-components/SwitchField/Switch';
|
|||
|
||||
import { StorageAccessModeSelector } from './StorageAccessModeSelector';
|
||||
import { ConfigureFormValues, StorageClassFormValues } from './types';
|
||||
import { availableStorageClassPolicies } from './useStorageClassesFormValues';
|
||||
import { availableStorageClassPolicies } from './useStorageClasses';
|
||||
|
||||
type Props = {
|
||||
storageClassValues: StorageClassFormValues[];
|
||||
|
|
|
@ -26,9 +26,31 @@ export const availableStorageClassPolicies = [
|
|||
},
|
||||
];
|
||||
|
||||
export function useStorageClassesFormValues(
|
||||
environment: Environment | null | undefined
|
||||
) {
|
||||
export function useStorageClasses(environment?: Environment | null) {
|
||||
return useQuery(
|
||||
[
|
||||
'environments',
|
||||
environment?.Id,
|
||||
'kubernetes',
|
||||
'storageclasses',
|
||||
// include the storage classes in the cache key to force a refresh when the storage classes change in the environment object
|
||||
JSON.stringify(environment?.Kubernetes.Configuration.StorageClasses),
|
||||
],
|
||||
async () => {
|
||||
if (!environment) {
|
||||
return [];
|
||||
}
|
||||
const storageClasses = await getStorageClasses(environment.Id);
|
||||
return storageClasses;
|
||||
},
|
||||
{
|
||||
...withError('Failure', `Unable to get Storage Classes`),
|
||||
enabled: !!environment,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function useStorageClassesFormValues(environment?: Environment | null) {
|
||||
return useQuery(
|
||||
[
|
||||
'environments',
|
Loading…
Add table
Add a link
Reference in a new issue