diff --git a/app/kubernetes/views/applications/create/createApplicationController.js b/app/kubernetes/views/applications/create/createApplicationController.js index 8ce33d213..9d620b228 100644 --- a/app/kubernetes/views/applications/create/createApplicationController.js +++ b/app/kubernetes/views/applications/create/createApplicationController.js @@ -372,6 +372,10 @@ class KubernetesCreateApplicationController { onChangePersistedFolder(values) { this.$scope.$evalAsync(() => { + this.state.persistedFoldersUseExistingVolumes = values.some((pf) => pf.existingVolume); + if (!this.state.isEdit && this.state.persistedFoldersUseExistingVolumes) { + this.formValues.DataAccessPolicy = this.ApplicationDataAccessPolicies.Shared; + } this.formValues.PersistedFolders = values; if (values && values.length && !this.supportGlobalDeployment()) { this.onChangeDeploymentType(this.ApplicationDeploymentTypes.Replicated); diff --git a/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx b/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx index 892ab0521..b9a896448 100644 --- a/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx +++ b/app/react/kubernetes/applications/CreateView/DataAccessPolicyFormSection.tsx @@ -1,6 +1,8 @@ import { Box, Boxes } from 'lucide-react'; import { BoxSelector, BoxSelectorOption } from '@@/BoxSelector'; +import { FormSection } from '@@/form-components/FormSection'; +import { TextTip } from '@@/Tip/TextTip'; import { AppDataAccessPolicy } from '../types'; @@ -20,13 +22,18 @@ export function DataAccessPolicyFormSection({ const options = getOptions(value, isEdit, persistedFoldersUseExistingVolumes); return ( - + + + Specify how the data will be used across instances. + + + ); } @@ -65,7 +72,7 @@ function getOptions( } return ''; }, - disabled: () => persistedFoldersUseExistingVolumes, + disabled: () => isEdit && value !== 'Shared', }, ] as const; } diff --git a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/PersistedFolderItem.tsx b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/PersistedFolderItem.tsx index 53f62d4b7..9ed9c90d0 100644 --- a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/PersistedFolderItem.tsx +++ b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/PersistedFolderItem.tsx @@ -204,7 +204,7 @@ export function PersistedFolderItem({ isDisabled={ (isEdit && isExistingPersistedFolder()) || applicationValues.Containers.length > 1 || - availableVolumes.length <= 1 + availableVolumes.length < 1 } data-cy={`k8sAppCreate-pvcSelect_${index}`} /> diff --git a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/persistedFoldersValidation.ts b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/persistedFoldersValidation.ts index 1dd19d808..e5d452812 100644 --- a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/persistedFoldersValidation.ts +++ b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/persistedFoldersValidation.ts @@ -103,8 +103,8 @@ function existingVolumeValidation(): SchemaOf { Storage: string().required(), storageClass: storageClassValidation(), CreationDate: string().required(), - ApplicationOwner: string().required(), - ApplicationName: string().required(), + ApplicationOwner: string(), + ApplicationName: string(), PreviousName: string(), MountPath: string(), Yaml: string(), diff --git a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/types.ts b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/types.ts index b0d4a0912..ba728f46e 100644 --- a/app/react/kubernetes/applications/components/PersistedFoldersFormSection/types.ts +++ b/app/react/kubernetes/applications/components/PersistedFoldersFormSection/types.ts @@ -19,8 +19,8 @@ export type ExistingVolume = { Storage: string; storageClass: StorageClass; CreationDate: string; - ApplicationOwner: string; - ApplicationName: string; + ApplicationOwner?: string; + ApplicationName?: string; PreviousName?: string; MountPath?: string; Yaml?: string;