Commit 24ee7796 authored by Donald Cook's avatar Donald Cook

Updated service desk settings copy

Added still supported email message
Updated UX

Removed merged duplicate component
parent c215b24d
<script> <script>
import { GlAlert } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { __ } from '~/locale'; import { __, sprintf } from '~/locale';
import ServiceDeskSetting from './service_desk_setting.vue'; import ServiceDeskSetting from './service_desk_setting.vue';
import ServiceDeskService from '../services/service_desk_service'; import ServiceDeskService from '../services/service_desk_service';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
...@@ -122,11 +122,13 @@ export default { ...@@ -122,11 +122,13 @@ export default {
this.incomingEmail = data?.service_desk_address; this.incomingEmail = data?.service_desk_address;
this.showAlert(__('Changes were successfully made.'), 'success'); this.showAlert(__('Changes were successfully made.'), 'success');
}) })
.catch(() => .catch(err => {
this.showAlert( this.showAlert(
__('An error occurred while saving the template. Please check if the template exists.'), sprintf(__('An error occured while making the changes: %{error}'), {
), error: err?.response?.data?.message,
) }),
);
})
.finally(() => { .finally(() => {
this.isTemplateSaving = false; this.isTemplateSaving = false;
}); });
......
<script> <script>
import { GlButton, GlFormSelect, GlToggle, GlLoadingIcon } from '@gitlab/ui'; import { GlButton, GlFormSelect, GlToggle, GlLoadingIcon, GlSprintf } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip'; import tooltip from '~/vue_shared/directives/tooltip';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
...@@ -17,6 +17,7 @@ export default { ...@@ -17,6 +17,7 @@ export default {
GlFormSelect, GlFormSelect,
GlToggle, GlToggle,
GlLoadingIcon, GlLoadingIcon,
GlSprintf,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
props: { props: {
...@@ -60,6 +61,7 @@ export default { ...@@ -60,6 +61,7 @@ export default {
selectedTemplate: this.initialSelectedTemplate, selectedTemplate: this.initialSelectedTemplate,
outgoingName: this.initialOutgoingName || __('GitLab Support Bot'), outgoingName: this.initialOutgoingName || __('GitLab Support Bot'),
projectKey: this.initialProjectKey, projectKey: this.initialProjectKey,
baseEmail: this.incomingEmail.replace(this.initialProjectKey, ''),
}; };
}, },
computed: { computed: {
...@@ -123,12 +125,33 @@ export default { ...@@ -123,12 +125,33 @@ export default {
/> />
</div> </div>
</div> </div>
<span v-if="projectKey" class="form-text text-muted">
<gl-sprintf :message="__('Emails sent to %{email} will still be supported')">
<template #email>
<code>{{ baseEmail }}</code>
</template>
</gl-sprintf>
</span>
</template> </template>
<template v-else> <template v-else>
<gl-loading-icon :inline="true" /> <gl-loading-icon :inline="true" />
<span class="sr-only">{{ __('Fetching incoming email') }}</span> <span class="sr-only">{{ __('Fetching incoming email') }}</span>
</template> </template>
<template v-if="hasProjectKeySupport">
<label for="service-desk-project-suffix" class="mt-3">
{{ __('Project name suffix') }}
</label>
<input id="service-desk-project-suffix" v-model.trim="projectKey" class="form-control" />
<span class="form-text text-muted">
{{
__(
'Project name suffix is a user-defined string which will be appended to the project path, and will form the Service Desk email address.',
)
}}
</span>
</template>
<label for="service-desk-template-select" class="mt-3"> <label for="service-desk-template-select" class="mt-3">
{{ __('Template to append to all Service Desk issues') }} {{ __('Template to append to all Service Desk issues') }}
</label> </label>
...@@ -144,19 +167,7 @@ export default { ...@@ -144,19 +167,7 @@ export default {
<span class="form-text text-muted"> <span class="form-text text-muted">
{{ __('Emails sent from Service Desk will have this name') }} {{ __('Emails sent from Service Desk will have this name') }}
</span> </span>
<template v-if="hasProjectKeySupport"> <div class="gl-display-flex gl-justify-content-end">
<label for="service-desk-project-suffix" class="mt-3">
{{ __('Project name suffix') }}
</label>
<input id="service-desk-project-suffix" v-model.trim="projectKey" class="form-control" />
<span class="form-text text-muted mb-3">
{{
__(
'Project name suffix is a user-defined string which will be appended to the project path, and will form the Service Desk email address.',
)
}}
</span>
</template>
<gl-button <gl-button
variant="success" variant="success"
class="gl-mt-5" class="gl-mt-5"
...@@ -168,4 +179,5 @@ export default { ...@@ -168,4 +179,5 @@ export default {
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
...@@ -218,9 +218,7 @@ describe('ServiceDeskRoot', () => { ...@@ -218,9 +218,7 @@ describe('ServiceDeskRoot', () => {
.$nextTick() .$nextTick()
.then(waitForPromises) .then(waitForPromises)
.then(() => { .then(() => {
expect(wrapper.html()).toContain( expect(wrapper.html()).toContain('An error occured while making the changes:');
'An error occurred while saving the template. Please check if the template exists.',
);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment