summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/clusters_list/constants.js
blob: c914ee518b2a664ffe3367790fe3f87a8a2f7682 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
import { __, s__, sprintf } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';

export const MAX_LIST_COUNT = 25;
export const INSTALL_AGENT_MODAL_ID = 'install-agent';
export const ACTIVE_CONNECTION_TIME = 480000;

export const CLUSTER_ERRORS = {
  default: {
    tableText: s__('ClusterIntegration|Unknown Error'),
    title: s__('ClusterIntegration|Unknown Error'),
    description: s__(
      'ClusterIntegration|An unknown error occurred while attempting to connect to Kubernetes.',
    ),
    troubleshootingTips: [
      s__('ClusterIntegration|Check your cluster status'),
      s__('ClusterIntegration|Make sure your API endpoint is correct'),
      s__(
        'ClusterIntegration|Node calculations use the Kubernetes Metrics API. Make sure your cluster has metrics installed',
      ),
    ],
  },
  authentication_error: {
    tableText: s__('ClusterIntegration|Unable to Authenticate'),
    title: s__('ClusterIntegration|Authentication Error'),
    description: s__('ClusterIntegration|GitLab failed to authenticate.'),
    troubleshootingTips: [
      s__('ClusterIntegration|Check your token'),
      s__('ClusterIntegration|Check your CA certificate'),
    ],
  },
  connection_error: {
    tableText: s__('ClusterIntegration|Unable to Connect'),
    title: s__('ClusterIntegration|Connection Error'),
    description: s__('ClusterIntegration|GitLab failed to connect to the cluster.'),
    troubleshootingTips: [
      s__('ClusterIntegration|Check your cluster status'),
      s__('ClusterIntegration|Make sure your API endpoint is correct'),
    ],
  },
  http_error: {
    tableText: s__('ClusterIntegration|Unable to Connect'),
    title: s__('ClusterIntegration|HTTP Error'),
    description: s__('ClusterIntegration|There was an HTTP error when connecting to your cluster.'),
    troubleshootingTips: [s__('ClusterIntegration|Check your cluster status')],
  },
};

export const CLUSTER_TYPES = {
  project_type: __('Project'),
  group_type: __('Group'),
  instance_type: __('Instance'),
};

export const MAX_REQUESTS = 3;

export const STATUSES = {
  default: { className: 'bg-white', title: __('Unknown') },
  disabled: { className: 'disabled', title: __('Disabled') },
  created: { className: 'bg-success', title: __('Connected') },
  unreachable: { className: 'bg-danger', title: __('Unreachable') },
  authentication_failure: { className: 'bg-warning', title: __('Authentication Failure') },
  deleting: { title: __('Deleting') },
  creating: { title: __('Creating') },
};

export const I18N_AGENT_TABLE = {
  nameLabel: s__('ClusterAgents|Name'),
  statusLabel: s__('ClusterAgents|Connection status'),
  lastContactLabel: s__('ClusterAgents|Last contact'),
  versionLabel: __('Version'),
  configurationLabel: s__('ClusterAgents|Configuration'),
  optionsLabel: __('Options'),
  troubleshootingText: s__('ClusterAgents|Learn how to troubleshoot'),
  neverConnectedText: s__('ClusterAgents|Never'),
  versionMismatchTitle: s__('ClusterAgents|Agent version mismatch'),
  versionMismatchText: s__(
    "ClusterAgents|The agent version do not match each other across your cluster's pods. This can happen when a new agent version was just deployed and Kubernetes is shutting down the old pods.",
  ),
  versionOutdatedTitle: s__('ClusterAgents|Agent version update required'),
  versionOutdatedText: s__(
    'ClusterAgents|Your agent version is out of sync with your GitLab version (v%{version}), which might cause compatibility problems. Update the agent installed on your cluster to the most recent version.',
  ),
  versionMismatchOutdatedTitle: s__('ClusterAgents|Agent version mismatch and update'),
  viewDocsText: s__('ClusterAgents|How to update an agent?'),
  defaultConfigText: s__('ClusterAgents|Default configuration'),
  defaultConfigTooltip: s__('ClusterAgents|What is default configuration?'),
};

export const I18N_AGENT_TOKEN = {
  copyToken: s__('ClusterAgents|Copy token'),
  copyCommand: s__('ClusterAgents|Copy command'),
  tokenTitle: s__('ClusterAgents|Registration token'),

  tokenBody: s__(
    `ClusterAgents|The registration token will be used to connect the agent on your cluster to GitLab. %{linkStart}What are registration tokens?%{linkEnd}`,
  ),
  tokenSingleUseWarningTitle: s__(
    'ClusterAgents|You cannot see this token again after you close this window.',
  ),
  tokenSingleUseWarningBody: s__(
    `ClusterAgents|The recommended installation method includes the token. If you want to follow the advanced installation method provided in the docs, make sure you save the token value before you close this window.`,
  ),

  basicInstallTitle: s__('ClusterAgents|Recommended installation method'),
  basicInstallBody: __(
    `Open a CLI and connect to the cluster you want to install the agent in. Use this installation method to minimize any manual steps. The token is already included in the command.`,
  ),

  advancedInstallTitle: s__('ClusterAgents|Advanced installation methods'),
  advancedInstallBody: s__(
    'ClusterAgents|For the advanced installation method %{linkStart}see the documentation%{linkEnd}.',
  ),
};

export const I18N_AGENT_MODAL = {
  registerAgentButton: s__('ClusterAgents|Register'),
  close: __('Close'),
  cancel: __('Cancel'),

  modalTitle: s__('ClusterAgents|Connect a cluster through an agent'),
  modalBody: s__(
    'ClusterAgents|Add an agent configuration file to %{linkStart}this repository%{linkEnd} and select it, or create a new one to register with GitLab:',
  ),
  enableKasText: s__(
    "ClusterAgents|Your instance doesn't have the %{linkStart}GitLab Agent Server (KAS)%{linkEnd} set up. Ask a GitLab Administrator to install it.",
  ),
  altText: s__('ClusterAgents|GitLab Agent for Kubernetes'),
  learnMoreLink: s__('ClusterAgents|How do I register an agent?'),
  copyToken: s__('ClusterAgents|Copy token'),
  tokenTitle: s__('ClusterAgents|Registration token'),
  tokenBody: s__(
    `ClusterAgents|The registration token will be used to connect the agent on your cluster to GitLab. %{linkStart}What are registration tokens?%{linkEnd}`,
  ),
  registrationErrorTitle: s__('ClusterAgents|Failed to register an agent'),
  unknownError: s__('ClusterAgents|An unknown error occurred. Please try again.'),
};

export const KAS_DISABLED_ERROR = 'Gitlab::Kas::Client::ConfigurationError';

export const I18N_AVAILABLE_AGENTS_DROPDOWN = {
  selectAgent: s__('ClusterAgents|Select an agent or enter a name to create new'),
  registeringAgent: s__('ClusterAgents|Registering agent'),
  noResults: __('No matching results'),
  createButton: s__('ClusterAgents|Create agent: %{searchTerm}'),
};

export const AGENT_STATUSES = {
  active: {
    name: s__('ClusterAgents|Connected'),
    icon: 'status-success',
    class: 'text-success-500',
    tooltip: {
      title: sprintf(s__('ClusterAgents|Last connected %{timeAgo}.')),
    },
  },
  inactive: {
    name: s__('ClusterAgents|Not connected'),
    icon: 'severity-critical',
    class: 'text-danger-800',
    tooltip: {
      title: s__('ClusterAgents|Agent might not be connected to GitLab'),
      body: sprintf(
        s__(
          'ClusterAgents|The agent has not been connected in a long time. There might be a connectivity issue. Last contact was %{timeAgo}.',
        ),
      ),
    },
  },
  unused: {
    name: s__('ClusterAgents|Never connected'),
    icon: 'status-neutral',
    class: 'text-secondary-400',
    tooltip: {
      title: s__('ClusterAgents|Agent never connected to GitLab'),
      body: s__('ClusterAgents|Make sure you are using a valid token.'),
    },
  },
};

export const I18N_AGENTS_EMPTY_STATE = {
  introText: s__(
    'ClusterIntegration|Use the %{linkStart}GitLab Agent%{linkEnd} to safely connect your Kubernetes clusters to GitLab. You can deploy your applications, run your pipelines, use Review Apps, and much more.',
  ),
  buttonText: s__('ClusterAgents|Connect with the GitLab Agent'),
};

export const I18N_CLUSTERS_EMPTY_STATE = {
  introText: s__(
    'ClusterIntegration|Connect your cluster to GitLab through %{linkStart}cluster certificates%{linkEnd}.',
  ),
  buttonText: s__('ClusterIntegration|Connect with a certificate'),
  alertText: s__(
    'ClusterIntegration|The certificate-based method to connect clusters to GitLab was %{linkStart}deprecated%{linkEnd} in GitLab 14.5.',
  ),
};

export const AGENT_CARD_INFO = {
  tabName: 'agent',
  title: sprintf(s__('ClusterAgents|%{number} of %{total} agents')),
  emptyTitle: s__('ClusterAgents|No agents'),
  tooltip: {
    label: s__('ClusterAgents|Recommended'),
    title: s__('ClusterAgents|GitLab Agent'),
    text: sprintf(
      s__(
        'ClusterAgents|The GitLab Agent provides an increased level of security when connecting Kubernetes clusters to GitLab. %{linkStart}Learn more about the GitLab Agent.%{linkEnd}',
      ),
    ),
    link: helpPagePath('user/clusters/agent/index'),
  },
  actionText: s__('ClusterAgents|Install a new agent'),
  footerText: sprintf(s__('ClusterAgents|View all %{number} agents')),
  installAgentDisabledHint: s__(
    'ClusterAgents|Requires a Maintainer or greater role to install new agents',
  ),
};

export const CERTIFICATE_BASED_CARD_INFO = {
  tabName: 'certificate_based',
  title: sprintf(
    s__('ClusterAgents|%{number} of %{total} clusters connected through cluster certificates'),
  ),
  emptyTitle: s__('ClusterAgents|No clusters connected through cluster certificates'),
  actionText: s__('ClusterAgents|Connect existing cluster'),
  footerText: sprintf(s__('ClusterAgents|View all %{number} clusters')),
  badgeText: s__('ClusterAgents|Deprecated'),
  connectExistingClusterDisabledHint: s__(
    'ClusterAgents|Requires a maintainer or greater role to connect existing clusters',
  ),
};

export const MAX_CLUSTERS_LIST = 6;

export const ALL_TAB = {
  title: s__('ClusterAgents|All'),
  component: 'ClustersViewAll',
  queryParamValue: 'all',
};

export const AGENT_TAB = {
  title: s__('ClusterAgents|Agent'),
  component: 'agents',
  queryParamValue: 'agent',
};
export const CERTIFICATE_TAB = {
  title: s__('ClusterAgents|Certificate'),
  component: 'clusters',
  queryParamValue: 'certificate_based',
};

export const CLUSTERS_TABS = [ALL_TAB, AGENT_TAB, CERTIFICATE_TAB];

export const CLUSTERS_ACTIONS = {
  actionsButton: s__('ClusterAgents|Actions'),
  createNewCluster: s__('ClusterAgents|Create a new cluster'),
  connectWithAgent: s__('ClusterAgents|Connect with an agent'),
  connectExistingCluster: s__('ClusterAgents|Connect with a certificate'),
  agent: s__('ClusterAgents|Agent'),
  certificate: s__('ClusterAgents|Certificate'),
  dropdownDisabledHint: s__(
    'ClusterAgents|Requires a Maintainer or greater role to perform these actions',
  ),
};

export const DELETE_AGENT_BUTTON = {
  deleteButton: s__('ClusterAgents|Delete agent'),
  disabledHint: s__('ClusterAgents|Requires a Maintainer or greater role to delete agents'),
  modalTitle: __('Are you sure?'),
  modalBody: s__('ClusterAgents|Are you sure you want to delete this agent? You cannot undo this.'),
  modalInputLabel: s__('ClusterAgents|To delete the agent, type %{name} to confirm:'),
  modalAction: s__('ClusterAgents|Delete'),
  modalCancel: __('Cancel'),
  successMessage: s__('ClusterAgents|%{name} successfully deleted'),
  defaultError: __('An error occurred. Please try again.'),
};

export const AGENT = 'agent';
export const CERTIFICATE_BASED = 'certificate_based';

export const EVENT_LABEL_MODAL = 'agent_registration_modal';
export const EVENT_LABEL_TABS = 'kubernetes_section_tabs';
export const EVENT_ACTIONS_OPEN = 'open_modal';
export const EVENT_ACTIONS_SELECT = 'select_agent';
export const EVENT_ACTIONS_CLICK = 'click_button';
export const EVENT_ACTIONS_CHANGE = 'change_tab';

export const MODAL_TYPE_EMPTY = 'empty_state';
export const MODAL_TYPE_REGISTER = 'agent_registration';

export const DELETE_AGENT_MODAL_ID = 'delete-agent-modal-%{agentName}';

export const AGENT_FEEDBACK_ISSUE = 'https://gitlab.com/gitlab-org/gitlab/-/issues/342696';
export const AGENT_FEEDBACK_KEY = 'agent_feedback_banner';