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