Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-14 21:11:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-14 21:11:06 +0300
commit3244feeb4f1980251fd9ff6cc263e34072fbf7c7 (patch)
tree3b534fea55ea5ccfe61f1e9d65b4460db165b111 /app/assets/javascripts/webhooks
parent2d80ade70258fa78e9ada2e8b3055129a69654f3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/webhooks')
-rw-r--r--app/assets/javascripts/webhooks/components/form_url_app.vue21
1 files changed, 14 insertions, 7 deletions
diff --git a/app/assets/javascripts/webhooks/components/form_url_app.vue b/app/assets/javascripts/webhooks/components/form_url_app.vue
index a156b638e21..4fafeff8804 100644
--- a/app/assets/javascripts/webhooks/components/form_url_app.vue
+++ b/app/assets/javascripts/webhooks/components/form_url_app.vue
@@ -70,12 +70,13 @@ export default {
getInitialItems() {
return isEmpty(this.initialUrlVariables) ? [{}] : cloneDeep(this.initialUrlVariables);
},
- isEditingItem(key) {
+ isEditingItem(index, key) {
if (isEmpty(this.initialUrlVariables)) {
return false;
}
- return this.initialUrlVariables.some((item) => item.key === key);
+ const item = this.initialUrlVariables[index];
+ return item && item.key === key;
},
keyInvalidFeedback(key) {
if (this.isValidated && isEmpty(key)) {
@@ -84,8 +85,8 @@ export default {
return null;
},
- valueInvalidFeedback(key, value) {
- if (this.isEditingItem(key)) {
+ valueInvalidFeedback(index, key, value) {
+ if (this.isEditingItem(index, key)) {
return null;
}
@@ -93,6 +94,10 @@ export default {
return this.$options.i18n.inputRequired;
}
+ if (!isEmpty(value) && !this.url?.includes(value)) {
+ return this.$options.i18n.valuePartOfUrl;
+ }
+
return null;
},
isValid() {
@@ -105,7 +110,8 @@ export default {
if (
this.maskEnabled &&
this.items.some(
- ({ key, value }) => this.keyInvalidFeedback(key) || this.valueInvalidFeedback(key, value),
+ ({ key, value }, index) =>
+ this.keyInvalidFeedback(key) || this.valueInvalidFeedback(index, key, value),
)
) {
return false;
@@ -145,6 +151,7 @@ export default {
urlLabel: __('URL'),
urlPlaceholder: 'http://example.com/trigger-ci.json',
urlPreview: s__('Webhooks|URL preview'),
+ valuePartOfUrl: s__('Webhooks|Must match part of URL'),
},
};
</script>
@@ -186,9 +193,9 @@ export default {
:index="index"
:item-key="key"
:item-value="value"
- :is-editing="isEditingItem(key)"
+ :is-editing="isEditingItem(index, key)"
:key-invalid-feedback="keyInvalidFeedback(key)"
- :value-invalid-feedback="valueInvalidFeedback(key, value)"
+ :value-invalid-feedback="valueInvalidFeedback(index, key, value)"
@input="onItemInput"
@remove="removeItem"
/>