|
| 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 | + * you may not use this file except in compliance with the Elastic License. |
| 5 | + */ |
| 6 | + |
| 7 | +import { |
| 8 | + EuiButton, |
| 9 | + EuiCard, |
| 10 | + EuiFlexGrid, |
| 11 | + EuiFlexGroup, |
| 12 | + EuiFlexItem, |
| 13 | + EuiHorizontalRule, |
| 14 | + EuiIcon, |
| 15 | + EuiImage, |
| 16 | + EuiSpacer, |
| 17 | + EuiText, |
| 18 | + EuiTitle, |
| 19 | +} from '@elastic/eui'; |
| 20 | +import { i18n } from '@kbn/i18n'; |
| 21 | +import React, { useEffect } from 'react'; |
| 22 | +import styled from 'styled-components'; |
| 23 | +import { usePluginContext } from '../../hooks/use_plugin_context'; |
| 24 | +import { appsSection, tryItOutItemsSection } from './section'; |
| 25 | + |
| 26 | +const Container = styled.div` |
| 27 | + min-height: calc(100vh - 48px); |
| 28 | + background: ${(props) => props.theme.eui.euiColorEmptyShade}; |
| 29 | +`; |
| 30 | + |
| 31 | +const Title = styled.div` |
| 32 | + background-color: ${(props) => props.theme.eui.euiPageBackgroundColor}; |
| 33 | + border-bottom: ${(props) => props.theme.eui.euiBorderThin}; |
| 34 | +`; |
| 35 | + |
| 36 | +const Page = styled.div` |
| 37 | + width: 100%; |
| 38 | + max-width: 1200px; |
| 39 | + margin: 0 auto; |
| 40 | + overflow: hidden; |
| 41 | +} |
| 42 | +`; |
| 43 | + |
| 44 | +const EuiCardWithoutPadding = styled(EuiCard)` |
| 45 | + padding: 0; |
| 46 | +`; |
| 47 | + |
| 48 | +export const Home = () => { |
| 49 | + const { core } = usePluginContext(); |
| 50 | + |
| 51 | + useEffect(() => { |
| 52 | + core.chrome.setBreadcrumbs([ |
| 53 | + { |
| 54 | + text: i18n.translate('xpack.observability.home.breadcrumb.observability', { |
| 55 | + defaultMessage: 'Observability', |
| 56 | + }), |
| 57 | + }, |
| 58 | + { |
| 59 | + text: i18n.translate('xpack.observability.home.breadcrumb.gettingStarted', { |
| 60 | + defaultMessage: 'Getting started', |
| 61 | + }), |
| 62 | + }, |
| 63 | + ]); |
| 64 | + }, [core]); |
| 65 | + |
| 66 | + return ( |
| 67 | + <Container> |
| 68 | + <Title> |
| 69 | + <Page> |
| 70 | + <EuiSpacer size="xxl" /> |
| 71 | + <EuiFlexGroup> |
| 72 | + <EuiFlexItem grow={false}> |
| 73 | + <EuiIcon type="logoObservability" size="xxl" /> |
| 74 | + </EuiFlexItem> |
| 75 | + <EuiFlexItem> |
| 76 | + <EuiTitle size="m"> |
| 77 | + <h1> |
| 78 | + {i18n.translate('xpack.observability.home.title', { |
| 79 | + defaultMessage: 'Observability', |
| 80 | + })} |
| 81 | + </h1> |
| 82 | + </EuiTitle> |
| 83 | + </EuiFlexItem> |
| 84 | + </EuiFlexGroup> |
| 85 | + <EuiSpacer size="xxl" /> |
| 86 | + </Page> |
| 87 | + </Title> |
| 88 | + <Page> |
| 89 | + <EuiSpacer size="xxl" /> |
| 90 | + <EuiFlexGroup direction="column"> |
| 91 | + {/* title and description */} |
| 92 | + <EuiFlexItem style={{ maxWidth: '50%' }}> |
| 93 | + <EuiTitle size="s"> |
| 94 | + <h2> |
| 95 | + {i18n.translate('xpack.observability.home.sectionTitle', { |
| 96 | + defaultMessage: 'Observability built on the Elastic Stack', |
| 97 | + })} |
| 98 | + </h2> |
| 99 | + </EuiTitle> |
| 100 | + <EuiSpacer size="m" /> |
| 101 | + <EuiText size="s" color="subdued"> |
| 102 | + {i18n.translate('xpack.observability.home.sectionsubtitle', { |
| 103 | + defaultMessage: |
| 104 | + 'Bring your logs, metrics, and APM traces together at scale in a single stack so you can monitor and react to events happening anywhere in your environment.', |
| 105 | + })} |
| 106 | + </EuiText> |
| 107 | + </EuiFlexItem> |
| 108 | + |
| 109 | + {/* Apps sections */} |
| 110 | + <EuiFlexItem> |
| 111 | + <EuiSpacer size="s" /> |
| 112 | + <EuiFlexGroup> |
| 113 | + <EuiFlexItem> |
| 114 | + <EuiFlexGrid columns={2}> |
| 115 | + {appsSection.map((app) => ( |
| 116 | + <EuiFlexItem> |
| 117 | + <EuiCardWithoutPadding |
| 118 | + display="plain" |
| 119 | + layout="horizontal" |
| 120 | + icon={<EuiIcon size="l" type={app.icon} />} |
| 121 | + title={ |
| 122 | + <EuiTitle size="xs" className="title"> |
| 123 | + <h3>{app.title}</h3> |
| 124 | + </EuiTitle> |
| 125 | + } |
| 126 | + description={app.description} |
| 127 | + /> |
| 128 | + </EuiFlexItem> |
| 129 | + ))} |
| 130 | + </EuiFlexGrid> |
| 131 | + </EuiFlexItem> |
| 132 | + <EuiFlexItem> |
| 133 | + <EuiImage |
| 134 | + size="xl" |
| 135 | + alt="observability overview image" |
| 136 | + url={core.http.basePath.prepend( |
| 137 | + '/plugins/observability/assets/observability_overview.png' |
| 138 | + )} |
| 139 | + /> |
| 140 | + </EuiFlexItem> |
| 141 | + </EuiFlexGroup> |
| 142 | + </EuiFlexItem> |
| 143 | + |
| 144 | + {/* Get started button */} |
| 145 | + <EuiFlexItem> |
| 146 | + <EuiFlexGroup justifyContent="center" gutterSize="none"> |
| 147 | + <EuiFlexItem grow={false}> |
| 148 | + <EuiButton |
| 149 | + fill |
| 150 | + iconType="sortRight" |
| 151 | + iconSide="right" |
| 152 | + href={core.http.basePath.prepend('/app/home#/tutorial_directory/logging')} |
| 153 | + > |
| 154 | + {i18n.translate('xpack.observability.home.getStatedButton', { |
| 155 | + defaultMessage: 'Get started', |
| 156 | + })} |
| 157 | + </EuiButton> |
| 158 | + </EuiFlexItem> |
| 159 | + </EuiFlexGroup> |
| 160 | + </EuiFlexItem> |
| 161 | + |
| 162 | + <EuiHorizontalRule margin="xl" /> |
| 163 | + |
| 164 | + {/* Try it out */} |
| 165 | + <EuiFlexItem> |
| 166 | + <EuiFlexGroup justifyContent="center"> |
| 167 | + <EuiFlexItem grow={false}> |
| 168 | + <EuiTitle size="s"> |
| 169 | + <h3> |
| 170 | + {i18n.translate('xpack.observability.home.tryItOut', { |
| 171 | + defaultMessage: 'Try it out', |
| 172 | + })} |
| 173 | + </h3> |
| 174 | + </EuiTitle> |
| 175 | + </EuiFlexItem> |
| 176 | + </EuiFlexGroup> |
| 177 | + </EuiFlexItem> |
| 178 | + |
| 179 | + {/* Try it out sections */} |
| 180 | + <EuiFlexItem> |
| 181 | + <EuiFlexGroup justifyContent="center"> |
| 182 | + {tryItOutItemsSection.map((item) => ( |
| 183 | + <EuiFlexItem grow={false} key={item.id} style={{ width: '260px' }}> |
| 184 | + <EuiCard |
| 185 | + layout="horizontal" |
| 186 | + icon={<EuiIcon size="l" type={item.icon} />} |
| 187 | + title={ |
| 188 | + <EuiTitle size="xs" className="title"> |
| 189 | + <h3>{item.title}</h3> |
| 190 | + </EuiTitle> |
| 191 | + } |
| 192 | + description={item.description} |
| 193 | + target={item.target} |
| 194 | + href={item.href} |
| 195 | + /> |
| 196 | + </EuiFlexItem> |
| 197 | + ))} |
| 198 | + </EuiFlexGroup> |
| 199 | + <EuiSpacer /> |
| 200 | + </EuiFlexItem> |
| 201 | + </EuiFlexGroup> |
| 202 | + </Page> |
| 203 | + </Container> |
| 204 | + ); |
| 205 | +}; |
0 commit comments