diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-11 15:10:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-11 15:10:41 +0300 |
commit | 1c7411c597334e20d2e92cc948f0699d339d2710 (patch) | |
tree | e88e76f1f563b71a4b9113373f24849bc5d1d79e /app/assets/javascripts/projects | |
parent | 3e9023894d319cf56b7b844910953df19ca010b1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/projects')
-rw-r--r-- | app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue index d964a701b08..b8053bf9ab5 100644 --- a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue +++ b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue @@ -75,6 +75,7 @@ export default { outgoingName: this.initialOutgoingName || __('GitLab Support Bot'), projectKey: this.initialProjectKey, searchTerm: '', + projectKeyError: null, }; }, computed: { @@ -104,6 +105,14 @@ export default { this.selectedFileTemplateProjectId = selectedFileTemplateProjectId; this.selectedTemplate = selectedTemplate; }, + validateProjectKey() { + if (this.projectKey && !new RegExp(/^[a-z0-9_]+$/).test(this.projectKey)) { + this.projectKeyError = __('Only use lowercase letters, numbers, and underscores.'); + return; + } + + this.projectKeyError = null; + }, }, }; </script> @@ -169,8 +178,17 @@ export default { v-model.trim="projectKey" data-testid="project-suffix" class="form-control" + :state="!projectKeyError" + @blur="validateProjectKey" /> - <span v-if="hasProjectKeySupport" class="form-text text-muted"> + <span v-if="hasProjectKeySupport && projectKeyError" class="form-text text-danger"> + {{ projectKeyError }} + </span> + <span + v-if="hasProjectKeySupport" + class="form-text text-muted" + :class="{ 'gl-mt-2!': hasProjectKeySupport && projectKeyError }" + > {{ __('A string appended to the project path to form the Service Desk email address.') }} </span> <span v-else class="form-text text-muted"> |