"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.createRailsAgentInstructions = void 0; var _i18n = require("@kbn/i18n"); var _eui = require("@elastic/eui"); var _react = _interopRequireDefault(require("react")); var _agent_config_instructions = require("../agent_config_instructions"); var _instruction_variants = require("../instruction_variants"); var _api_key_callout = require("./api_key_callout"); var _agent_status_instructions = require("../agent_status_instructions"); /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ const createRailsAgentInstructions = commonOptions => { const { baseUrl, apmServerUrl, apiKeyDetails, checkAgentStatus, agentStatus, agentStatusLoading } = commonOptions; return [{ title: _i18n.i18n.translate('xpack.apm.onboarding.rails.install.title', { defaultMessage: 'Install the APM agent' }), children: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_eui.EuiMarkdownFormat, null, _i18n.i18n.translate('xpack.apm.onboarding.rails.install.textPre', { defaultMessage: 'Add the agent to your Gemfile.' })), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, null), /*#__PURE__*/_react.default.createElement(_eui.EuiCodeBlock, { language: "bash", isCopyable: true }, "gem 'elastic-apm'")) }, { title: _i18n.i18n.translate('xpack.apm.onboarding.rails.configure.title', { defaultMessage: 'Configure the agent' }), children: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_eui.EuiMarkdownFormat, null, _i18n.i18n.translate('xpack.apm.onboarding.rails.configure.textPre', { defaultMessage: 'APM is automatically started when your app boots. Configure the agent, by creating the config file {configFile}', values: { configFile: '`config/elastic_apm.yml`' } })), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, null), ((apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.displayApiKeySuccessCallout) || (apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.displayApiKeyErrorCallout)) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_api_key_callout.ApiKeyCallout, { isError: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.displayApiKeyErrorCallout, isSuccess: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.displayApiKeySuccessCallout, errorMessage: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.errorMessage }), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, null)), /*#__PURE__*/_react.default.createElement(_agent_config_instructions.AgentConfigInstructions, { variantId: _instruction_variants.INSTRUCTION_VARIANT.RAILS, apmServerUrl: apmServerUrl, apiKey: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.apiKey, createApiKey: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.createAgentKey, createApiKeyLoading: apiKeyDetails === null || apiKeyDetails === void 0 ? void 0 : apiKeyDetails.createApiKeyLoading }), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, null), /*#__PURE__*/_react.default.createElement(_eui.EuiMarkdownFormat, null, _i18n.i18n.translate('xpack.apm.onboarding.rails.configure.textPost', { defaultMessage: 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', values: { documentationLink: `${baseUrl}guide/en/apm/agent/ruby/current/index.html` } }))) }, (0, _agent_status_instructions.agentStatusCheckInstruction)({ checkAgentStatus, agentStatus, agentStatusLoading })]; }; exports.createRailsAgentInstructions = createRailsAgentInstructions;