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

service_desk_helper.js « issuables_list « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4b4a38c2205e42532d89c8c552769de417faa6d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { __ } from '~/locale';

/**
 * Returns the attributes used for gl-empty-state in the Service Desk issues list.
 */
// eslint-disable-next-line import/prefer-default-export
export function emptyStateHelper(emptyStateMeta) {
  const { isServiceDeskSupported, svgPath, serviceDeskHelpPage } = emptyStateMeta;

  if (isServiceDeskSupported) {
    const title = __(
      'Use Service Desk to connect with your users (e.g. to offer customer support) through email right inside GitLab',
    );
    const commonMessage = __(
      'Those emails automatically become issues (with the comments becoming the email conversation) listed here.',
    );
    const commonDescription = `
      <span>${commonMessage}</span>
      <a href="${serviceDeskHelpPage}">${__('Read more')}</a>`;

    if (emptyStateMeta.canEditProjectSettings && emptyStateMeta.isServiceDeskEnabled) {
      return {
        title,
        svgPath,
        description: `<p>${__('Have your users email')} <code>${
          emptyStateMeta.serviceDeskAddress
        }</code></p> ${commonDescription}`,
      };
    }

    if (emptyStateMeta.canEditProjectSettings && !emptyStateMeta.isServiceDeskEnabled) {
      return {
        title,
        svgPath,
        description: commonDescription,
        primaryLink: emptyStateMeta.editProjectPage,
        primaryText: __('Turn on Service Desk'),
      };
    }

    return {
      title,
      svgPath,
      description: commonDescription,
    };
  }

  return {
    title: __('Service Desk is enabled but not yet active'),
    svgPath,
    description: __('You must set up incoming email before it becomes active.'),
    primaryLink: emptyStateMeta.incomingEmailHelpPage,
    primaryText: __('More information'),
  };
}