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

messages.js « terminal « modules « stores « ide « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa1c7f23677225952bbe31daa796dccc00a34a67 (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
56
57
import { escape } from 'lodash';
import httpStatus, { HTTP_STATUS_UNPROCESSABLE_ENTITY } from '~/lib/utils/http_status';
import { __, sprintf } from '~/locale';

export const UNEXPECTED_ERROR_CONFIG = __(
  'An unexpected error occurred while checking the project environment.',
);
export const UNEXPECTED_ERROR_RUNNERS = __(
  'An unexpected error occurred while checking the project runners.',
);
export const UNEXPECTED_ERROR_STATUS = __(
  'An unexpected error occurred while communicating with the Web Terminal.',
);
export const UNEXPECTED_ERROR_STARTING = __(
  'An unexpected error occurred while starting the Web Terminal.',
);
export const UNEXPECTED_ERROR_STOPPING = __(
  'An unexpected error occurred while stopping the Web Terminal.',
);
export const EMPTY_RUNNERS = __(
  'Configure GitLab runners to start using the Web Terminal. %{helpStart}Learn more.%{helpEnd}',
);
export const ERROR_CONFIG = __(
  'Configure a %{codeStart}.gitlab-webide.yml%{codeEnd} file in the %{codeStart}.gitlab%{codeEnd} directory to start using the Web Terminal. %{helpStart}Learn more.%{helpEnd}',
);
export const ERROR_PERMISSION = __(
  'You do not have permission to run the Web Terminal. Please contact a project administrator.',
);

export const configCheckError = (status, helpUrl) => {
  if (status === HTTP_STATUS_UNPROCESSABLE_ENTITY) {
    return sprintf(
      ERROR_CONFIG,
      {
        helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
        helpEnd: '</a>',
        codeStart: '<code>',
        codeEnd: '</code>',
      },
      false,
    );
  } else if (status === httpStatus.FORBIDDEN) {
    return ERROR_PERMISSION;
  }

  return UNEXPECTED_ERROR_CONFIG;
};

export const runnersCheckEmpty = (helpUrl) =>
  sprintf(
    EMPTY_RUNNERS,
    {
      helpStart: `<a href="${escape(helpUrl)}" target="_blank">`,
      helpEnd: '</a>',
    },
    false,
  );