fix(app): path override validation [EE-5078] (#9077)
Co-authored-by: testa113 <testa113>pull/9086/head
parent
0074bcc2ee
commit
a2388226ad
|
@ -447,7 +447,7 @@
|
|||
class="form-control"
|
||||
ng-model="overridenKey.Path"
|
||||
placeholder="/etc/myapp/conf.d"
|
||||
name="overriden_key_path_{{ index }}_{{ keyIndex }}"
|
||||
name="overriden_key_configmap_path_{{ index }}_{{ keyIndex }}"
|
||||
ng-disabled="ctrl.formValues.Containers.length > 1"
|
||||
required
|
||||
ng-change="ctrl.onChangeConfigMapPath()"
|
||||
|
@ -457,21 +457,21 @@
|
|||
<div
|
||||
class="small"
|
||||
ng-show="
|
||||
kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
kubernetesApplicationCreationForm['overriden_key_configmap_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configMapPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
"
|
||||
>
|
||||
<div class="text-warning" ng-if="overridenKey.Type === ctrl.ApplicationConfigurationFormValueOverridenKeyTypes.FILESYSTEM">
|
||||
<div
|
||||
ng-show="
|
||||
kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
kubernetesApplicationCreationForm['overriden_key_configmap_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configMapPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
"
|
||||
>
|
||||
<ng-messages for="kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$error">
|
||||
<ng-messages for="kubernetesApplicationCreationForm['overriden_key_configmap_path_' + index + '_' + keyIndex].$error">
|
||||
<p class="vertical-center" ng-message="required"><pr-icon icon="'alert-triangle'" mode="'warning'"></pr-icon> Path is required.</p>
|
||||
</ng-messages>
|
||||
<p class="vertical-center" ng-if="ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined">
|
||||
<p class="vertical-center" ng-if="ctrl.state.duplicates.configMapPaths.refs[index + '_' + keyIndex] !== undefined">
|
||||
<pr-icon icon="'alert-triangle'" mode="'warning'"></pr-icon> This path is already used.
|
||||
</p>
|
||||
</div>
|
||||
|
@ -597,7 +597,7 @@
|
|||
class="form-control"
|
||||
ng-model="overridenKey.Path"
|
||||
placeholder="/etc/myapp/conf.d"
|
||||
name="overriden_key_path_{{ index }}_{{ keyIndex }}"
|
||||
name="overriden_key_secret_path_{{ index }}_{{ keyIndex }}"
|
||||
ng-disabled="ctrl.formValues.Containers.length > 1"
|
||||
required
|
||||
ng-change="ctrl.onChangeSecretPath()"
|
||||
|
@ -607,21 +607,21 @@
|
|||
<div
|
||||
class="small"
|
||||
ng-show="
|
||||
kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
kubernetesApplicationCreationForm['overriden_key_secret_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.secretPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
"
|
||||
>
|
||||
<div class="text-warning" ng-if="overridenKey.Type === ctrl.ApplicationConfigurationFormValueOverridenKeyTypes.FILESYSTEM">
|
||||
<div
|
||||
ng-show="
|
||||
kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
kubernetesApplicationCreationForm['overriden_key_secret_path_' + index + '_' + keyIndex].$invalid ||
|
||||
ctrl.state.duplicates.secretPaths.refs[index + '_' + keyIndex] !== undefined
|
||||
"
|
||||
>
|
||||
<ng-messages for="kubernetesApplicationCreationForm['overriden_key_path_' + index + '_' + keyIndex].$error">
|
||||
<ng-messages for="kubernetesApplicationCreationForm['overriden_key_secret_path_' + index + '_' + keyIndex].$error">
|
||||
<p class="vertical-center" ng-message="required"><pr-icon icon="'alert-triangle'" mode="'warning'"></pr-icon> Path is required.</p>
|
||||
</ng-messages>
|
||||
<p class="vertical-center" ng-if="ctrl.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] !== undefined"
|
||||
<p class="vertical-center" ng-if="ctrl.state.duplicates.secretPaths.refs[index + '_' + keyIndex] !== undefined"
|
||||
><pr-icon icon="'alert-triangle'" mode="'warning'"></pr-icon> This path is already used.</p
|
||||
>
|
||||
</div>
|
||||
|
|
|
@ -122,7 +122,8 @@ class KubernetesCreateApplicationController {
|
|||
duplicates: {
|
||||
environmentVariables: new KubernetesFormValidationReferences(),
|
||||
persistedFolders: new KubernetesFormValidationReferences(),
|
||||
configurationPaths: new KubernetesFormValidationReferences(),
|
||||
configMapPaths: new KubernetesFormValidationReferences(),
|
||||
secretPaths: new KubernetesFormValidationReferences(),
|
||||
existingVolumes: new KubernetesFormValidationReferences(),
|
||||
publishedPorts: {
|
||||
containerPorts: new KubernetesFormValidationReferences(),
|
||||
|
@ -275,7 +276,7 @@ class KubernetesCreateApplicationController {
|
|||
}
|
||||
|
||||
onChangeConfigMapPath() {
|
||||
this.state.duplicates.configurationPaths.refs = [];
|
||||
this.state.duplicates.configMapPaths.refs = [];
|
||||
|
||||
const paths = _.reduce(
|
||||
this.formValues.ConfigMaps,
|
||||
|
@ -292,12 +293,12 @@ class KubernetesCreateApplicationController {
|
|||
_.forEach(config.OverridenKeys, (overridenKey, keyIndex) => {
|
||||
const findPath = _.find(duplicatePaths, (path) => path === overridenKey.Path);
|
||||
if (findPath) {
|
||||
this.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] = findPath;
|
||||
this.state.duplicates.configMapPaths.refs[index + '_' + keyIndex] = findPath;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.state.duplicates.configurationPaths.hasRefs = Object.keys(this.state.duplicates.configurationPaths.refs).length > 0;
|
||||
this.state.duplicates.configMapPaths.hasRefs = Object.keys(this.state.duplicates.configMapPaths.refs).length > 0;
|
||||
}
|
||||
/* #endregion */
|
||||
|
||||
|
@ -335,7 +336,7 @@ class KubernetesCreateApplicationController {
|
|||
}
|
||||
|
||||
onChangeSecretPath() {
|
||||
this.state.duplicates.configurationPaths.refs = [];
|
||||
this.state.duplicates.secretPaths.refs = [];
|
||||
|
||||
const paths = _.reduce(
|
||||
this.formValues.Secrets,
|
||||
|
@ -352,12 +353,12 @@ class KubernetesCreateApplicationController {
|
|||
_.forEach(secret.OverridenKeys, (overridenKey, keyIndex) => {
|
||||
const findPath = _.find(duplicatePaths, (path) => path === overridenKey.Path);
|
||||
if (findPath) {
|
||||
this.state.duplicates.configurationPaths.refs[index + '_' + keyIndex] = findPath;
|
||||
this.state.duplicates.secretPaths.refs[index + '_' + keyIndex] = findPath;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.state.duplicates.configurationPaths.hasRefs = Object.keys(this.state.duplicates.configurationPaths.refs).length > 0;
|
||||
this.state.duplicates.secretPaths.hasRefs = Object.keys(this.state.duplicates.secretPaths.refs).length > 0;
|
||||
}
|
||||
/* #endregion */
|
||||
|
||||
|
@ -672,7 +673,8 @@ class KubernetesCreateApplicationController {
|
|||
!this.state.alreadyExists &&
|
||||
!this.state.duplicates.environmentVariables.hasRefs &&
|
||||
!this.state.duplicates.persistedFolders.hasRefs &&
|
||||
!this.state.duplicates.configurationPaths.hasRefs &&
|
||||
!this.state.duplicates.configMapPaths.hasRefs &&
|
||||
!this.state.duplicates.secretPaths.hasRefs &&
|
||||
!this.state.duplicates.existingVolumes.hasRefs &&
|
||||
!this.state.duplicates.publishedPorts.containerPorts.hasRefs &&
|
||||
!this.state.duplicates.publishedPorts.nodePorts.hasRefs &&
|
||||
|
|
Loading…
Reference in New Issue