Skip to content

Commit

Permalink
Merge branch 'main' into serverless/add-global-search-ux
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan authored Jun 15, 2023
2 parents 8418f07 + f9d16e1 commit 9509cad
Show file tree
Hide file tree
Showing 65 changed files with 2,612 additions and 91 deletions.
39 changes: 24 additions & 15 deletions x-pack/packages/kbn-slo-schema/src/rest_specs/slo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@
*/

import * as t from 'io-ts';

import {
budgetingMethodSchema,
dateType,
historicalSummarySchema,
indicatorSchema,
indicatorTypesArraySchema,
kqlCustomIndicatorSchema,
metricCustomIndicatorSchema,
objectiveSchema,
optionalSettingsSchema,
previewDataSchema,
settingsSchema,
sloIdSchema,
summarySchema,
tagsSchema,
timeWindowSchema,
metricCustomIndicatorSchema,
kqlCustomIndicatorSchema,
apmTransactionErrorRateIndicatorSchema,
apmTransactionDurationIndicatorSchema,
} from '../schema';

const createSLOParamsSchema = t.type({
Expand All @@ -44,6 +42,14 @@ const createSLOResponseSchema = t.type({
id: sloIdSchema,
});

const getPreviewDataParamsSchema = t.type({
body: t.type({
indicator: indicatorSchema,
}),
});

const getPreviewDataResponseSchema = t.array(previewDataSchema);

const deleteSLOParamsSchema = t.type({
path: t.type({
id: sloIdSchema,
Expand Down Expand Up @@ -156,20 +162,22 @@ type FetchHistoricalSummaryParams = t.TypeOf<typeof fetchHistoricalSummaryParams
type FetchHistoricalSummaryResponse = t.OutputOf<typeof fetchHistoricalSummaryResponseSchema>;
type HistoricalSummaryResponse = t.OutputOf<typeof historicalSummarySchema>;

type GetPreviewDataParams = t.TypeOf<typeof getPreviewDataParamsSchema.props.body>;
type GetPreviewDataResponse = t.TypeOf<typeof getPreviewDataResponseSchema>;

type BudgetingMethod = t.TypeOf<typeof budgetingMethodSchema>;

type MetricCustomIndicatorSchema = t.TypeOf<typeof metricCustomIndicatorSchema>;
type KQLCustomIndicatorSchema = t.TypeOf<typeof kqlCustomIndicatorSchema>;
type APMTransactionErrorRateIndicatorSchema = t.TypeOf<
typeof apmTransactionErrorRateIndicatorSchema
>;
type APMTransactionDurationIndicatorSchema = t.TypeOf<typeof apmTransactionDurationIndicatorSchema>;
type Indicator = t.OutputOf<typeof indicatorSchema>;
type MetricCustomIndicator = t.OutputOf<typeof metricCustomIndicatorSchema>;
type KQLCustomIndicator = t.OutputOf<typeof kqlCustomIndicatorSchema>;

export {
createSLOParamsSchema,
deleteSLOParamsSchema,
findSLOParamsSchema,
findSLOResponseSchema,
getPreviewDataParamsSchema,
getPreviewDataResponseSchema,
getSLODiagnosisParamsSchema,
getSLOParamsSchema,
getSLOResponseSchema,
Expand All @@ -188,6 +196,8 @@ export type {
CreateSLOResponse,
FindSLOParams,
FindSLOResponse,
GetPreviewDataParams,
GetPreviewDataResponse,
GetSLOResponse,
FetchHistoricalSummaryParams,
FetchHistoricalSummaryResponse,
Expand All @@ -198,8 +208,7 @@ export type {
UpdateSLOInput,
UpdateSLOParams,
UpdateSLOResponse,
MetricCustomIndicatorSchema,
KQLCustomIndicatorSchema,
APMTransactionDurationIndicatorSchema,
APMTransactionErrorRateIndicatorSchema,
Indicator,
MetricCustomIndicator,
KQLCustomIndicator,
};
6 changes: 6 additions & 0 deletions x-pack/packages/kbn-slo-schema/src/schema/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const historicalSummarySchema = t.intersection([
summarySchema,
]);

const previewDataSchema = t.type({
date: dateType,
sliValue: t.number,
});

const dateRangeSchema = t.type({ from: dateType, to: dateType });

export type { SummarySchema };
Expand All @@ -63,6 +68,7 @@ export {
dateType,
errorBudgetSchema,
historicalSummarySchema,
previewDataSchema,
statusSchema,
summarySchema,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* 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.
*/

import React from 'react';

import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText, EuiTitle } from '@elastic/eui';

import { FormattedMessage } from '@kbn/i18n-react';

export const EsreDocsSection: React.FC = () => (
<EuiFlexGroup alignItems="center">
<EuiFlexItem grow={4}>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.title"
defaultMessage="Dive deeper with the ESRE docs"
/>
</h2>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.description"
defaultMessage="To learn more about how to get started with ESRE, and test these tools with concrete examples, visit the ESRE documentation."
/>
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={6}>
<EuiFlexGroup direction="column">
<EuiFlexItem grow={false}>
<EuiPanel hasBorder>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.learn.title"
defaultMessage="Learn"
/>
</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.learn.description"
defaultMessage="These are complex topics, so we've curated some learning topics to help you get started."
/>
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPanel hasBorder>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.faq.title"
defaultMessage="FAQ"
/>
</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.faq.description"
defaultMessage="Learn what ESRE is (and isn't) from these frequently asked questions."
/>
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiPanel hasBorder>
<EuiFlexGroup direction="column" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.help.title"
defaultMessage="Help"
/>
</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.esre.esreDocsSection.help.description"
defaultMessage="Need help? Check out the ESRE discuss forum!"
/>
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,88 @@

import React from 'react';

import {
EuiImage,
EuiPanel,
EuiFlexGroup,
EuiFlexItem,
EuiText,
EuiHorizontalRule,
EuiFlexGrid,
useIsWithinBreakpoints,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import analyticsIllustration from '../../../../assets/images/analytics.svg';
import scalableIllustration from '../../../../assets/images/scalable.svg';
import simplifyIllustration from '../../../../assets/images/simplify.svg';
import { SetEsreChrome as SetPageChrome } from '../../../shared/kibana_chrome';
import { EnterpriseSearchEsrePageTemplate } from '../layout/page_template';

import { EsreDocsSection } from './esre_docs_section';
import { MeasurePerformanceSection } from './measure_performance_section';
import { RankAggregationSection } from './rank_aggregation_section';
import { SemanticSearchSection } from './semantic_search_section';

export const EsreGuide: React.FC = () => {
const isMobile = useIsWithinBreakpoints(['xs']);

return (
<EnterpriseSearchEsrePageTemplate
restrictWidth
bottomBorder={false}
pageHeader={{
pageTitle: i18n.translate('xpack.enterpriseSearch.esre.guide.pageTitle', {
defaultMessage: 'Enhance your search with ESRE',
}),
}}
>
<SetPageChrome />
<p>ESRE placeholder</p>
<EuiPanel color="transparent" paddingSize="none">
<EuiFlexGroup justifyContent="spaceBetween" direction="column" responsive>
<EuiFlexItem grow>
<EuiPanel color="subdued" hasShadow={false}>
<EuiFlexGrid alignItems="center" responsive={false} columns={isMobile ? 1 : 3}>
<EuiFlexItem grow={false}>
<EuiImage size="m" src={simplifyIllustration} alt="" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiImage size="m" src={analyticsIllustration} alt="" />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiImage size="m" src={scalableIllustration} alt="" />
</EuiFlexItem>
</EuiFlexGrid>
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem grow>
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.esre.guide.description"
defaultMessage="The Elasticsearch Relevance Engine™ (ESRE) enables developers to build AI search-powered applications using the Elastic platform. ESRE is a set of tools and features that include our proprietary trained ML model ELSER, our vector search and embeddings capabilities, and RRF ranking for combining vector and text search."
/>
</p>
</EuiText>
</EuiFlexItem>
<EuiFlexItem grow>
<SemanticSearchSection />
</EuiFlexItem>
<EuiHorizontalRule />
<EuiFlexItem grow>
<RankAggregationSection />
</EuiFlexItem>
<EuiHorizontalRule />
<EuiFlexItem grow>
<MeasurePerformanceSection />
</EuiFlexItem>
<EuiHorizontalRule />
<EuiFlexItem grow>
<EsreDocsSection />
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EnterpriseSearchEsrePageTemplate>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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.
*/

import React from 'react';

import {
EuiAccordion,
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiTitle,
EuiText,
IconType,
EuiPanel,
} from '@elastic/eui';

export interface EsreGuideAccordionProps {
id: string;
icon: IconType;
title: string;
description: string;
initialIsOpen?: boolean;
}

export const EsreGuideAccordion: React.FC<EsreGuideAccordionProps> = ({
id,
icon,
title,
description,
initialIsOpen = false,
children,
}) => {
return (
<EuiPanel hasBorder paddingSize="l">
<EuiAccordion
id={id}
initialIsOpen={initialIsOpen}
buttonContent={
<EuiFlexGroup responsive={false} gutterSize="s" alignItems="center">
<EuiFlexItem grow={false}>
<EuiIcon type={icon} size="xxl" />
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup direction="column" responsive={false} gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3>{title}</h3>
</EuiTitle>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>{description}</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
}
>
{children}
</EuiAccordion>
</EuiPanel>
);
};
Loading

0 comments on commit 9509cad

Please sign in to comment.