mirror of https://github.com/portainer/portainer
fix(app): remove canUndo function from environment variables [EE-6232] (#10961)
Co-authored-by: testa113 <testa113>pull/10968/head
parent
a8e53a4510
commit
787c7ec4cc
|
@ -26,7 +26,6 @@ import { YAMLInspector } from '@/react/kubernetes/components/YAMLInspector';
|
||||||
import { ApplicationsStacksDatatable } from '@/react/kubernetes/applications/ListView/ApplicationsStacksDatatable';
|
import { ApplicationsStacksDatatable } from '@/react/kubernetes/applications/ListView/ApplicationsStacksDatatable';
|
||||||
import { NodesDatatable } from '@/react/kubernetes/cluster/HomeView/NodesDatatable';
|
import { NodesDatatable } from '@/react/kubernetes/cluster/HomeView/NodesDatatable';
|
||||||
import { StackName } from '@/react/kubernetes/DeployView/StackName/StackName';
|
import { StackName } from '@/react/kubernetes/DeployView/StackName/StackName';
|
||||||
import { kubeEnvVarValidationSchema } from '@/react/kubernetes/applications/ApplicationForm/kubeEnvVarValidationSchema';
|
|
||||||
import { SecretsFormSection } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/SecretsFormSection';
|
import { SecretsFormSection } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/SecretsFormSection';
|
||||||
import { configurationsValidationSchema } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/configurationValidationSchema';
|
import { configurationsValidationSchema } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/configurationValidationSchema';
|
||||||
import { ConfigMapsFormSection } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigMapsFormSection';
|
import { ConfigMapsFormSection } from '@/react/kubernetes/applications/components/ConfigurationsFormSection/ConfigMapsFormSection';
|
||||||
|
@ -57,8 +56,8 @@ import {
|
||||||
} from '@/react/kubernetes/applications/components/NameFormSection';
|
} from '@/react/kubernetes/applications/components/NameFormSection';
|
||||||
import { deploymentTypeValidation } from '@/react/kubernetes/applications/components/AppDeploymentTypeFormSection/deploymentTypeValidation';
|
import { deploymentTypeValidation } from '@/react/kubernetes/applications/components/AppDeploymentTypeFormSection/deploymentTypeValidation';
|
||||||
import { AppDeploymentTypeFormSection } from '@/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection';
|
import { AppDeploymentTypeFormSection } from '@/react/kubernetes/applications/components/AppDeploymentTypeFormSection/AppDeploymentTypeFormSection';
|
||||||
|
import { EnvironmentVariablesFormSection } from '@/react/kubernetes/applications/components/EnvironmentVariablesFormSection/EnvironmentVariablesFormSection';
|
||||||
import { EnvironmentVariablesFieldset } from '@@/form-components/EnvironmentVariablesFieldset';
|
import { kubeEnvVarValidationSchema } from '@/react/kubernetes/applications/components/EnvironmentVariablesFormSection/kubeEnvVarValidationSchema';
|
||||||
|
|
||||||
import { applicationsModule } from './applications';
|
import { applicationsModule } from './applications';
|
||||||
|
|
||||||
|
@ -219,17 +218,6 @@ withFormValidation(
|
||||||
kubeServicesValidation
|
kubeServicesValidation
|
||||||
);
|
);
|
||||||
|
|
||||||
withFormValidation(
|
|
||||||
ngModule,
|
|
||||||
withControlledInput(withControlledInput(EnvironmentVariablesFieldset), {
|
|
||||||
values: 'onChange',
|
|
||||||
}),
|
|
||||||
'kubeEnvironmentVariablesFieldset',
|
|
||||||
['canUndoDelete'],
|
|
||||||
// use kubeEnvVarValidationSchema instead of envVarValidation to add a regex matches rule
|
|
||||||
kubeEnvVarValidationSchema
|
|
||||||
);
|
|
||||||
|
|
||||||
withFormValidation(
|
withFormValidation(
|
||||||
ngModule,
|
ngModule,
|
||||||
withControlledInput(
|
withControlledInput(
|
||||||
|
@ -350,3 +338,16 @@ withFormValidation(
|
||||||
deploymentTypeValidation,
|
deploymentTypeValidation,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
withFormValidation(
|
||||||
|
ngModule,
|
||||||
|
withControlledInput(
|
||||||
|
withUIRouter(
|
||||||
|
withCurrentUser(withReactQuery(EnvironmentVariablesFormSection))
|
||||||
|
),
|
||||||
|
{ values: 'onChange' }
|
||||||
|
),
|
||||||
|
'environmentVariablesFormSection',
|
||||||
|
[],
|
||||||
|
kubeEnvVarValidationSchema
|
||||||
|
);
|
||||||
|
|
|
@ -235,18 +235,10 @@
|
||||||
<!-- #endregion -->
|
<!-- #endregion -->
|
||||||
|
|
||||||
<!-- #region ENVIRONMENT VARIABLES -->
|
<!-- #region ENVIRONMENT VARIABLES -->
|
||||||
<div class="form-group">
|
<environment-variables-form-section
|
||||||
<div class="col-sm-12 vertical-center">
|
|
||||||
<label class="control-label !pt-0 text-left !text-sm">Environment variables</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-11 col-lg-10 mt-2">
|
|
||||||
<kube-environment-variables-fieldset
|
|
||||||
values="ctrl.formValues.EnvironmentVariables"
|
values="ctrl.formValues.EnvironmentVariables"
|
||||||
on-change="(ctrl.onEnvironmentVariableChange)"
|
on-change="(ctrl.onEnvironmentVariableChange)"
|
||||||
can-undo-delete="true"
|
></environment-variables-form-section>
|
||||||
></kube-environment-variables-fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- #endregion -->
|
<!-- #endregion -->
|
||||||
|
|
||||||
<!-- #region CONFIGMAPS -->
|
<!-- #region CONFIGMAPS -->
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { FormSection } from '@@/form-components/FormSection';
|
||||||
|
import {
|
||||||
|
EnvVarValues,
|
||||||
|
EnvironmentVariablesFieldset,
|
||||||
|
} from '@@/form-components/EnvironmentVariablesFieldset';
|
||||||
|
import { ArrayError } from '@@/form-components/InputList/InputList';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
values: EnvVarValues;
|
||||||
|
onChange(value: EnvVarValues): void;
|
||||||
|
errors?: ArrayError<EnvVarValues>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function EnvironmentVariablesFormSection({
|
||||||
|
values,
|
||||||
|
onChange,
|
||||||
|
errors,
|
||||||
|
}: Props) {
|
||||||
|
return (
|
||||||
|
<FormSection title="Environment variables" titleSize="sm">
|
||||||
|
<div className="mb-4">
|
||||||
|
<EnvironmentVariablesFieldset
|
||||||
|
values={values}
|
||||||
|
onChange={onChange}
|
||||||
|
errors={errors}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</FormSection>
|
||||||
|
);
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ export function kubeEnvVarValidationSchema(): SchemaOf<EnvVar[]> {
|
||||||
),
|
),
|
||||||
value: string().default(''),
|
value: string().default(''),
|
||||||
needsDeletion: bool().default(false),
|
needsDeletion: bool().default(false),
|
||||||
|
isNew: bool().default(false),
|
||||||
})
|
})
|
||||||
).test(
|
).test(
|
||||||
'unique',
|
'unique',
|
Loading…
Reference in New Issue