debian-mirror-gitlab/app/assets/javascripts/clusters_list/constants.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

279 lines
11 KiB
JavaScript
Raw Normal View History

2021-11-18 22:05:49 +05:30
import { __, s__, sprintf } from '~/locale';
2021-12-11 22:18:48 +05:30
import { helpPagePath } from '~/helpers/help_page_helper';
2021-11-18 22:05:49 +05:30
export const MAX_LIST_COUNT = 25;
export const INSTALL_AGENT_MODAL_ID = 'install-agent';
export const ACTIVE_CONNECTION_TIME = 480000;
2023-03-04 22:38:38 +05:30
export const NAME_MAX_LENGTH = 50;
2021-01-03 14:25:43 +05:30
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')],
},
};
2020-04-08 14:13:33 +05:30
export const CLUSTER_TYPES = {
project_type: __('Project'),
group_type: __('Group'),
instance_type: __('Instance'),
};
2020-06-23 00:09:42 +05:30
export const MAX_REQUESTS = 3;
2020-04-08 14:13:33 +05:30
export const STATUSES = {
2020-05-24 23:13:21 +05:30
default: { className: 'bg-white', title: __('Unknown') },
2020-04-08 14:13:33 +05:30
disabled: { className: 'disabled', title: __('Disabled') },
2020-05-24 23:13:21 +05:30
created: { className: 'bg-success', title: __('Connected') },
2020-04-08 14:13:33 +05:30
unreachable: { className: 'bg-danger', title: __('Unreachable') },
authentication_failure: { className: 'bg-warning', title: __('Authentication Failure') },
deleting: { title: __('Deleting') },
2020-06-23 00:09:42 +05:30
creating: { title: __('Creating') },
2020-04-08 14:13:33 +05:30
};
2021-11-18 22:05:49 +05:30
2022-04-04 11:22:00 +05:30
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__(
2022-05-07 20:08:51 +05:30
"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.",
2022-04-04 11:22:00 +05:30
),
versionOutdatedTitle: s__('ClusterAgents|Agent version update required'),
versionOutdatedText: s__(
2022-05-07 20:08:51 +05:30
'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.',
2022-04-04 11:22:00 +05:30
),
versionMismatchOutdatedTitle: s__('ClusterAgents|Agent version mismatch and update'),
2022-05-07 20:08:51 +05:30
viewDocsText: s__('ClusterAgents|How to update an agent?'),
defaultConfigText: s__('ClusterAgents|Default configuration'),
defaultConfigTooltip: s__('ClusterAgents|What is default configuration?'),
2022-04-04 11:22:00 +05:30
};
2022-05-07 20:08:51 +05:30
export const I18N_AGENT_TOKEN = {
copyToken: s__('ClusterAgents|Copy token'),
copyCommand: s__('ClusterAgents|Copy command'),
2022-06-21 17:19:12 +05:30
tokenLabel: s__('ClusterAgents|Agent access token:'),
2022-05-07 20:08:51 +05:30
tokenSingleUseWarningTitle: s__(
'ClusterAgents|You cannot see this token again after you close this window.',
),
2022-06-21 17:19:12 +05:30
tokenSubtitle: s__('ClusterAgents|The agent uses the token to connect with GitLab.'),
2021-11-18 22:05:49 +05:30
2022-06-21 17:19:12 +05:30
basicInstallTitle: s__('ClusterAgents|Install using Helm (recommended)'),
basicInstallBody: s__(
'ClusterAgents|From a terminal, connect to your cluster and run this command. The token is included in the command.',
2022-05-07 20:08:51 +05:30
),
2023-03-04 22:38:38 +05:30
helmVersionText: s__(
'ClusterAgents|Use a Helm version compatible with your Kubernetes version (see %{linkStart}Helm version support policy%{linkEnd}).',
),
2021-11-18 22:05:49 +05:30
2022-05-07 20:08:51 +05:30
advancedInstallTitle: s__('ClusterAgents|Advanced installation methods'),
advancedInstallBody: s__(
2022-06-21 17:19:12 +05:30
'ClusterAgents|%{linkStart}View the documentation%{linkEnd} for advanced installation. Ensure you have your access token available.',
2022-05-07 20:08:51 +05:30
),
};
2021-11-18 22:05:49 +05:30
2023-03-04 22:38:38 +05:30
export const HELM_VERSION_POLICY_URL = 'https://helm.sh/docs/topics/version_skew/';
2022-05-07 20:08:51 +05:30
export const I18N_AGENT_MODAL = {
registerAgentButton: s__('ClusterAgents|Register'),
close: __('Close'),
cancel: __('Cancel'),
2021-11-18 22:05:49 +05:30
2022-06-21 17:19:12 +05:30
modalTitle: s__('ClusterAgents|Connect a Kubernetes cluster'),
2022-05-07 20:08:51 +05:30
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.",
),
2022-06-21 17:19:12 +05:30
altText: s__('ClusterAgents|GitLab agent for Kubernetes'),
2022-05-07 20:08:51 +05:30
learnMoreLink: s__('ClusterAgents|How do I register an agent?'),
registrationErrorTitle: s__('ClusterAgents|Failed to register an agent'),
unknownError: s__('ClusterAgents|An unknown error occurred. Please try again.'),
2021-11-18 22:05:49 +05:30
};
2022-01-26 12:08:38 +05:30
export const KAS_DISABLED_ERROR = 'Gitlab::Kas::Client::ConfigurationError';
2021-11-18 22:05:49 +05:30
export const I18N_AVAILABLE_AGENTS_DROPDOWN = {
2022-05-07 20:08:51 +05:30
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}'),
2021-11-18 22:05:49 +05:30
};
export const AGENT_STATUSES = {
active: {
name: s__('ClusterAgents|Connected'),
icon: 'status-success',
2023-04-23 21:23:45 +05:30
class: 'gl-text-green-500',
2021-11-18 22:05:49 +05:30
tooltip: {
title: sprintf(s__('ClusterAgents|Last connected %{timeAgo}.')),
},
},
inactive: {
name: s__('ClusterAgents|Not connected'),
2022-08-13 15:12:31 +05:30
icon: 'status-alert',
2023-04-23 21:23:45 +05:30
class: 'gl-text-red-500',
2021-11-18 22:05:49 +05:30
tooltip: {
title: s__('ClusterAgents|Agent might not be connected to GitLab'),
body: sprintf(
s__(
2022-01-26 12:08:38 +05:30
'ClusterAgents|The agent has not been connected in a long time. There might be a connectivity issue. Last contact was %{timeAgo}.',
2021-11-18 22:05:49 +05:30
),
),
},
},
unused: {
name: s__('ClusterAgents|Never connected'),
icon: 'status-neutral',
2023-04-23 21:23:45 +05:30
class: 'gl-text-gray-500',
2021-11-18 22:05:49 +05:30
tooltip: {
title: s__('ClusterAgents|Agent never connected to GitLab'),
body: s__('ClusterAgents|Make sure you are using a valid token.'),
},
},
};
2021-12-11 22:18:48 +05:30
export const I18N_AGENTS_EMPTY_STATE = {
introText: s__(
2022-06-21 17:19:12 +05:30
'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.',
2021-12-11 22:18:48 +05:30
),
};
export const I18N_CLUSTERS_EMPTY_STATE = {
2022-01-26 12:08:38 +05:30
introText: s__(
'ClusterIntegration|Connect your cluster to GitLab through %{linkStart}cluster certificates%{linkEnd}.',
2021-12-11 22:18:48 +05:30
),
2022-01-26 12:08:38 +05:30
alertText: s__(
'ClusterIntegration|The certificate-based method to connect clusters to GitLab was %{linkStart}deprecated%{linkEnd} in GitLab 14.5.',
),
2021-12-11 22:18:48 +05:30
};
export const AGENT_CARD_INFO = {
tabName: 'agent',
2022-05-07 20:08:51 +05:30
title: sprintf(s__('ClusterAgents|%{number} of %{total} agents')),
emptyTitle: s__('ClusterAgents|No agents'),
2021-12-11 22:18:48 +05:30
tooltip: {
label: s__('ClusterAgents|Recommended'),
2022-06-21 17:19:12 +05:30
title: s__('ClusterAgents|GitLab agent'),
2021-12-11 22:18:48 +05:30
text: sprintf(
s__(
2022-06-21 17:19:12 +05:30
'ClusterAgents|The GitLab agent provides an increased level of security when connecting Kubernetes clusters to GitLab. %{linkStart}Learn more about the GitLab agent.%{linkEnd}',
2021-12-11 22:18:48 +05:30
),
),
link: helpPagePath('user/clusters/agent/index'),
},
2022-01-26 12:08:38 +05:30
footerText: sprintf(s__('ClusterAgents|View all %{number} agents')),
2021-12-11 22:18:48 +05:30
};
export const CERTIFICATE_BASED_CARD_INFO = {
tabName: 'certificate_based',
2022-01-26 12:08:38 +05:30
title: sprintf(
s__('ClusterAgents|%{number} of %{total} clusters connected through cluster certificates'),
),
emptyTitle: s__('ClusterAgents|No clusters connected through cluster certificates'),
footerText: sprintf(s__('ClusterAgents|View all %{number} clusters')),
badgeText: s__('ClusterAgents|Deprecated'),
2021-12-11 22:18:48 +05:30
};
export const MAX_CLUSTERS_LIST = 6;
2022-05-07 20:08:51 +05:30
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];
2021-12-11 22:18:48 +05:30
export const CLUSTERS_ACTIONS = {
2022-06-21 17:19:12 +05:30
connectCluster: s__('ClusterAgents|Connect a cluster'),
connectWithAgent: s__('ClusterAgents|Connect a cluster (agent)'),
connectClusterDeprecated: s__('ClusterAgents|Connect a cluster (deprecated)'),
createCluster: s__('ClusterAgents|Create a cluster'),
connectClusterCertificate: s__('ClusterAgents|Connect a cluster (certificate - deprecated)'),
2022-07-16 23:28:13 +05:30
actionsDisabledHint: s__(
2022-04-04 11:22:00 +05:30
'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.'),
2021-12-11 22:18:48 +05:30
};
export const AGENT = 'agent';
export const CERTIFICATE_BASED = 'certificate_based';
2022-01-26 12:08:38 +05:30
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';
2022-03-02 08:16:31 +05:30
export const DELETE_AGENT_MODAL_ID = 'delete-agent-modal-%{agentName}';
2022-04-04 11:22:00 +05:30
export const AGENT_FEEDBACK_ISSUE = 'https://gitlab.com/gitlab-org/gitlab/-/issues/342696';
export const AGENT_FEEDBACK_KEY = 'agent_feedback_banner';