|
| 1 | +/* |
| 2 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 3 | + * or more contributor license agreements. Licensed under the Elastic License |
| 4 | + * 2.0 and the Server Side Public License, v 1; you may not use this file except |
| 5 | + * in compliance with, at your election, the Elastic License 2.0 or the Server |
| 6 | + * Side Public License, v 1. |
| 7 | + */ |
| 8 | + |
| 9 | +import { i18n } from '@kbn/i18n'; |
| 10 | +import { CoreSetup } from '@kbn/core/server'; |
| 11 | +import { CustomIntegrationRegistry } from '../custom_integration_registry'; |
| 12 | +import { CustomIntegrationIcon, IntegrationCategory, PLUGIN_ID } from '../../common'; |
| 13 | + |
| 14 | +interface PlaceholderIntegration { |
| 15 | + id: string; |
| 16 | + title: string; |
| 17 | + icon?: string; |
| 18 | + euiIconName?: string; |
| 19 | + description: string; |
| 20 | + docUrlTemplate: string; |
| 21 | + categories: IntegrationCategory[]; |
| 22 | +} |
| 23 | + |
| 24 | +export const integrations: PlaceholderIntegration[] = [ |
| 25 | + { |
| 26 | + id: 'esf', |
| 27 | + title: i18n.translate('customIntegrations.placeholders.EsfTitle', { |
| 28 | + defaultMessage: 'AWS Serverless Application Repository', |
| 29 | + }), |
| 30 | + icon: 'logo_esf.svg', |
| 31 | + description: i18n.translate('customIntegrations.placeholders.EsfDescription', { |
| 32 | + defaultMessage: |
| 33 | + 'Collect logs using AWS Lambda application available in AWS Serverless Application Repository.', |
| 34 | + }), |
| 35 | + docUrlTemplate: `https://github.com/elastic/elastic-serverless-forwarder/blob/main/docs/README-AWS.md`, |
| 36 | + categories: ['aws', 'custom'], |
| 37 | + }, |
| 38 | +]; |
| 39 | + |
| 40 | +export function registerPlaceholders( |
| 41 | + core: CoreSetup, |
| 42 | + registry: CustomIntegrationRegistry, |
| 43 | + branch: string |
| 44 | +) { |
| 45 | + integrations.forEach((integration: PlaceholderIntegration) => { |
| 46 | + const icons: CustomIntegrationIcon[] = []; |
| 47 | + if (integration.euiIconName) { |
| 48 | + icons.push({ |
| 49 | + type: 'eui', |
| 50 | + src: integration.euiIconName, |
| 51 | + }); |
| 52 | + } else if (integration.icon) { |
| 53 | + icons.push({ |
| 54 | + type: 'svg', |
| 55 | + src: core.http.basePath.prepend( |
| 56 | + `/plugins/${PLUGIN_ID}/assets/placeholders/${integration.icon}` |
| 57 | + ), |
| 58 | + }); |
| 59 | + } |
| 60 | + |
| 61 | + registry.registerCustomIntegration({ |
| 62 | + id: `placeholder.${integration.id}`, |
| 63 | + title: integration.title, |
| 64 | + description: integration.description, |
| 65 | + type: 'ui_link', |
| 66 | + shipper: 'placeholders', |
| 67 | + // Documentation for `main` branches is still published at a `master` URL. |
| 68 | + uiInternalPath: integration.docUrlTemplate.replace( |
| 69 | + '{branch}', |
| 70 | + branch === 'main' ? 'master' : branch |
| 71 | + ), |
| 72 | + isBeta: false, |
| 73 | + icons, |
| 74 | + categories: integration.categories, |
| 75 | + }); |
| 76 | + }); |
| 77 | +} |
0 commit comments