Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observability overview page #69141

Merged
merged 115 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
fbbbde6
creating overview page and menu
cauemarcondes May 27, 2020
8a5ec48
styling the home page
cauemarcondes May 28, 2020
8078ff0
adjusting breadcrumb
cauemarcondes May 28, 2020
d5192d4
renaming isnt working
cauemarcondes May 28, 2020
1b3166b
renaming isnt working
cauemarcondes May 28, 2020
1a8d95c
renaming isnt working
cauemarcondes May 28, 2020
6504be0
fixing import
cauemarcondes May 29, 2020
0ee34a9
fixing scroll when resize window
cauemarcondes May 29, 2020
ac9e903
fixing eslint errors
cauemarcondes May 29, 2020
6b54ca7
prepending links
cauemarcondes May 29, 2020
ef30490
adding target option
cauemarcondes May 29, 2020
3f88d6d
refactoring
cauemarcondes Jun 1, 2020
79c7196
adding dark mode support
cauemarcondes Jun 2, 2020
ceefa0e
fixing prettier format
cauemarcondes Jun 2, 2020
9f8998a
fixing i18n
cauemarcondes Jun 2, 2020
435be86
reverting some unnecessary changes
cauemarcondes Jun 2, 2020
41ed178
addressing PR comments
cauemarcondes Jun 3, 2020
474415c
fixing functional tests
cauemarcondes Jun 3, 2020
e0c590e
ordering observability menu
cauemarcondes Jun 3, 2020
25cab4a
fixing tests
cauemarcondes Jun 3, 2020
98a0e36
addressing PR comments
cauemarcondes Jun 4, 2020
6c568b2
fixing scroll
cauemarcondes Jun 4, 2020
10889e5
addressing pr comments
cauemarcondes Jun 5, 2020
843a23c
addressing pr comments
cauemarcondes Jun 5, 2020
96cf83f
creating overview page
cauemarcondes Jun 6, 2020
3c566ea
mocking data
cauemarcondes Jun 8, 2020
13c89b9
mocking data
cauemarcondes Jun 9, 2020
ded7994
refactoring
cauemarcondes Jun 10, 2020
9870857
crearting apm chart
cauemarcondes Jun 12, 2020
d4683ec
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 15, 2020
711ca04
adding overview page
cauemarcondes Jun 15, 2020
13bca65
adding metric charts
cauemarcondes Jun 15, 2020
3272a69
adding charts
cauemarcondes Jun 15, 2020
00bcffb
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 16, 2020
3f4eab3
changing mock data location
cauemarcondes Jun 16, 2020
51c6230
adding mock registry
cauemarcondes Jun 17, 2020
fcd8e4c
adding date picker
cauemarcondes Jun 17, 2020
d34e1b3
adding route validation
cauemarcondes Jun 18, 2020
aea3534
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 18, 2020
68f4af3
adding io-ts
cauemarcondes Jun 18, 2020
e36eb19
adding io-ts
cauemarcondes Jun 18, 2020
58dd5f1
adding io-ts support
cauemarcondes Jun 23, 2020
61cae1f
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 23, 2020
bc224a4
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 23, 2020
28f26e2
fixing imports and mock data
cauemarcondes Jun 23, 2020
6e511e1
adding app folder
cauemarcondes Jun 23, 2020
215ca59
creating a section for each plugin
cauemarcondes Jun 23, 2020
513868d
adding stats
cauemarcondes Jun 24, 2020
c0bf62e
adding domain min max
cauemarcondes Jun 24, 2020
c18a62a
refactoring xcoordinaters
cauemarcondes Jun 24, 2020
f8f0786
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 24, 2020
e451893
fixing route
cauemarcondes Jun 24, 2020
a75c3b7
adding bucket size
cauemarcondes Jun 25, 2020
c42363e
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 25, 2020
b478a53
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 26, 2020
78463fa
adding group property on logs
cauemarcondes Jun 26, 2020
570ca43
adding home page
cauemarcondes Jun 26, 2020
3c79436
dont break page if location state is undefined
cauemarcondes Jun 26, 2020
3963bd2
each component fetches its own data
cauemarcondes Jun 29, 2020
04b3e72
Refactoring
cauemarcondes Jun 29, 2020
ce07d77
adding loading indicator to chart
cauemarcondes Jun 29, 2020
863823a
fixing uptime chart
cauemarcondes Jun 29, 2020
7f16ae2
adding brush functionality to charts
cauemarcondes Jun 29, 2020
69c8de6
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 29, 2020
d4771f6
fixing refresh button and auto refresh function
cauemarcondes Jun 30, 2020
88ee166
adding horizontal line to accordion section
cauemarcondes Jun 30, 2020
f686961
adding emptySection to dashboard page
cauemarcondes Jun 30, 2020
414f05c
adding add data button
cauemarcondes Jun 30, 2020
90572fa
adding resources section
cauemarcondes Jun 30, 2020
360f6fc
removing margins from horizontal rule
cauemarcondes Jun 30, 2020
3dc98db
changing min interval to 60s
cauemarcondes Jun 30, 2020
ac63290
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jun 30, 2020
1c6bc01
fixing empty section
cauemarcondes Jun 30, 2020
708851f
removing unnecessary code
cauemarcondes Jun 30, 2020
74abf3a
adding unit tests
cauemarcondes Jul 1, 2020
4ed3de0
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 1, 2020
d835beb
fixing imports
cauemarcondes Jul 1, 2020
d88e230
adding initial story book for observability
cauemarcondes Jul 1, 2020
988e5fa
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 1, 2020
46ec7ce
removeing uptime mock data
cauemarcondes Jul 1, 2020
a71003c
fixing xDomain to show correct data on x-axis
cauemarcondes Jul 1, 2020
62efb5f
fixing empty state alignment
cauemarcondes Jul 1, 2020
fe67af4
adding story book and other improvements
cauemarcondes Jul 1, 2020
ff47c40
adding news component
cauemarcondes Jul 2, 2020
a83514e
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 2, 2020
39dd39d
adding support to custom colors on EuiProgress and EuiStats
cauemarcondes Jul 2, 2020
837ede1
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 3, 2020
07109b8
removing infra mock data
cauemarcondes Jul 3, 2020
bfa6fbd
adding error message when api throwns an error
cauemarcondes Jul 3, 2020
d949b39
adding alert section
cauemarcondes Jul 3, 2020
dc86f69
Adding alerts
cauemarcondes Jul 3, 2020
1bc38bb
adding alert api call
cauemarcondes Jul 6, 2020
bb046a7
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 6, 2020
2e119cb
addressing PR comments
cauemarcondes Jul 6, 2020
1abf1b8
adding storybook
cauemarcondes Jul 7, 2020
1ccf833
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 7, 2020
90acb10
adding feedback button
cauemarcondes Jul 7, 2020
518f092
addressing PR comments
cauemarcondes Jul 7, 2020
0b9bcb2
chamging plugins return data
cauemarcondes Jul 7, 2020
2b2be64
fixing kibana app navigation
cauemarcondes Jul 7, 2020
ea5baad
fixing unit test
cauemarcondes Jul 7, 2020
4f4f751
fixing ts issues
cauemarcondes Jul 7, 2020
fc1f42c
addressing PR comments
cauemarcondes Jul 7, 2020
0507723
using lodash truncate
cauemarcondes Jul 7, 2020
51c889b
adding comment
cauemarcondes Jul 7, 2020
ec58b0d
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 7, 2020
63a29fb
updating public documentation
cauemarcondes Jul 7, 2020
712fd22
Merge branch 'master' of github.com:elastic/kibana into observability…
cauemarcondes Jul 7, 2020
6ca4171
fixing alerts request
cauemarcondes Jul 7, 2020
6dbd5ec
fixing unit test
cauemarcondes Jul 7, 2020
6439c32
fixing unit test
cauemarcondes Jul 8, 2020
68da249
aligin beta badge to the center
cauemarcondes Jul 8, 2020
ce8ec35
adding moment duration to get the units as seconds
cauemarcondes Jul 8, 2020
d85eb3e
addressing PR comments
cauemarcondes Jul 8, 2020
1cc7605
addressing PR comments
cauemarcondes Jul 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export const storybookAliases = {
infra: 'x-pack/legacy/plugins/infra/scripts/storybook.js',
security_solution: 'x-pack/plugins/security_solution/scripts/storybook.js',
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/scripts/storybook.js',
observability: 'x-pack/plugins/observability/scripts/storybook.js',
};
3 changes: 2 additions & 1 deletion src/plugins/data/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const UI_SETTINGS = {
FORMAT_NUMBER_DEFAULT_LOCALE: 'format:number:defaultLocale',
TIMEPICKER_REFRESH_INTERVAL_DEFAULTS: 'timepicker:refreshIntervalDefaults',
TIMEPICKER_QUICK_RANGES: 'timepicker:quickRanges',
TIMEPICKER_TIME_DEFAULTS: 'timepicker:timeDefaults',
INDEXPATTERN_PLACEHOLDER: 'indexPattern:placeholder',
FILTERS_PINNED_BY_DEFAULT: 'filters:pinnedByDefault',
FILTERS_EDITOR_SUGGEST_VALUES: 'filterEditor:suggestValues',
};
} as const;
54 changes: 46 additions & 8 deletions x-pack/plugins/observability/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,61 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { createHashHistory } from 'history';
import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import { EuiThemeProvider } from '../../../../legacy/common/eui_styled_components';
import { Route, Router, Switch } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
import { AppMountParameters, CoreStart } from '../../../../../src/core/public';
import { Home } from '../pages/home';
import { EuiThemeProvider } from '../../../../legacy/common/eui_styled_components';
import { PluginContext } from '../context/plugin_context';
import { useUrlParams } from '../hooks/use_url_params';
import { routes } from '../routes';
import { usePluginContext } from '../hooks/use_plugin_context';

const App = () => {
return (
<>
<Switch>
{Object.keys(routes).map((key) => {
const path = key as keyof typeof routes;
const route = routes[path];
const Wrapper = () => {
const { core } = usePluginContext();
useEffect(() => {
core.chrome.setBreadcrumbs([
{
text: i18n.translate('xpack.observability.observability.breadcrumb.', {
defaultMessage: 'Observability',
}),
},
...route.breadcrumb,
]);
}, [core]);

const { query, path: pathParams } = useUrlParams(route.params);
return route.handler({ query, path: pathParams });
};
return <Route key={path} path={path} exact={true} component={Wrapper} />;
})}
</Switch>
</>
);
};

export const renderApp = (core: CoreStart, { element }: AppMountParameters) => {
const i18nCore = core.i18n;
const isDarkMode = core.uiSettings.get('theme:darkMode');
const history = createHashHistory();
ReactDOM.render(
<PluginContext.Provider value={{ core }}>
<EuiThemeProvider darkMode={isDarkMode}>
<i18nCore.Context>
<Home />
</i18nCore.Context>
</EuiThemeProvider>
<Router history={history}>
<EuiThemeProvider darkMode={isDarkMode}>
<i18nCore.Context>
<App />
</i18nCore.Context>
</EuiThemeProvider>
</Router>
</PluginContext.Provider>,
element
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { queryAllByTestId, render } from '@testing-library/react';
import React from 'react';
import { ChartContainer } from './';

describe('chart container', () => {
it('shows loading indicator', () => {
const component = render(
<ChartContainer height={100} isLoading={true}>
<div>My amazing component</div>
</ChartContainer>
);
expect(component.getByTestId('loading')).toBeInTheDocument();
});
it("doesn't show loading indicator", () => {
const component = render(
<ChartContainer height={100} isLoading={false}>
<div>My amazing component</div>
</ChartContainer>
);
expect(queryAllByTestId(component.container, 'loading')).toEqual([]);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { EuiLoadingChart } from '@elastic/eui';
import { EuiFlexGroup } from '@elastic/eui';
import { EuiFlexItem } from '@elastic/eui';
import { EuiLoadingChartSize } from '@elastic/eui/src/components/loading/loading_chart';

interface Props {
isLoading: boolean;
height: number;
width?: number;
iconSize?: EuiLoadingChartSize;
children: React.ReactNode;
}

export const ChartContainer = ({ isLoading, height, children, iconSize = 'xl', width }: Props) => {
const style = { height, marginTop: `-${height}px`, marginBottom: 0, width };
return (
<>
{children}
{isLoading === true && (
<EuiFlexGroup
justifyContent="spaceAround"
alignItems="center"
style={style}
data-test-subj="loading"
>
<EuiFlexItem grow={false}>
<EuiLoadingChart size={iconSize} />
</EuiFlexItem>
</EuiFlexGroup>
)}
</>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { render } from '@testing-library/react';
import React from 'react';
import { EuiThemeProvider } from '../../../typings';
import { EmptySection } from './';
import { ISection } from '../../../typings/section';

describe('EmptySection', () => {
it('renders without action button', () => {
const section: ISection = {
id: 'apm',
title: 'APM',
icon: 'logoAPM',
description: 'foo bar',
};
const { getByText, queryAllByText } = render(
<EuiThemeProvider>
<EmptySection section={section} />
</EuiThemeProvider>
);

expect(getByText('APM')).toBeInTheDocument();
expect(getByText('foo bar')).toBeInTheDocument();
expect(queryAllByText('Install agent')).toEqual([]);
});
it('renders with action button', () => {
const section: ISection = {
id: 'apm',
title: 'APM',
icon: 'logoAPM',
description: 'foo bar',
linkTitle: 'install agent',
href: 'https://www.elastic.co',
};
const { getByText, getByTestId } = render(
<EuiThemeProvider>
<EmptySection section={section} />
</EuiThemeProvider>
);

expect(getByText('APM')).toBeInTheDocument();
expect(getByText('foo bar')).toBeInTheDocument();
const linkButton = getByTestId('empty-apm') as HTMLAnchorElement;
expect(linkButton.href).toEqual('https://www.elastic.co/');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { EuiButton, EuiEmptyPrompt, EuiText } from '@elastic/eui';
import React from 'react';
import { ISection } from '../../../typings/section';

interface Props {
section: ISection;
}

export const EmptySection = ({ section }: Props) => {
return (
<EuiEmptyPrompt
style={{ maxWidth: 'none' }}
iconType={section.icon}
iconColor="default"
title={<h2>{section.title}</h2>}
titleSize="xs"
body={<EuiText color="default">{section.description}</EuiText>}
actions={
<>
{section.linkTitle && (
<EuiButton
size="s"
color="primary"
fill
href={section.href}
target={section.target}
data-test-subj={`empty-${section.id}`}
>
{section.linkTitle}
</EuiButton>
)}
</>
}
/>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { Header } from './';
import { render } from '@testing-library/react';
import { EuiThemeProvider } from '../../../typings';

describe('Header', () => {
it('renders without add data button', () => {
const { getByText, queryAllByText, getByTestId } = render(
<EuiThemeProvider>
<Header color="#fff" />
</EuiThemeProvider>
);
expect(getByTestId('observability-logo')).toBeInTheDocument();
expect(getByText('Observability')).toBeInTheDocument();
expect(queryAllByText('Add data')).toEqual([]);
});
it('renders with add data button', () => {
const { getByText, getByTestId } = render(
<EuiThemeProvider>
<Header color="#fff" showAddData />
</EuiThemeProvider>
);
expect(getByTestId('observability-logo')).toBeInTheDocument();
expect(getByText('Observability')).toBeInTheDocument();
expect(getByText('Add data')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiTitle, EuiSpacer } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { EuiButtonEmpty } from '@elastic/eui';

const Container = styled.div<{ color: string }>`
background: ${(props) => props.color};
border-bottom: ${(props) => props.theme.eui.euiBorderThin};
`;

const Wrapper = styled.div<{ restrictWidth?: number }>`
width: 100%;
max-width: ${(props) => `${props.restrictWidth}px`};
margin: 0 auto;
overflow: hidden;
padding: ${(props) => (props.restrictWidth ? 0 : '0 24px')};
`;

interface Props {
color: string;
showAddData?: boolean;
restrictWidth?: number;
}

export const Header = ({ color, restrictWidth, showAddData = false }: Props) => {
return (
<Container color={color}>
<Wrapper restrictWidth={restrictWidth}>
<EuiSpacer size="l" />
<EuiFlexGroup>
<EuiFlexItem grow={false}>
<EuiIcon type="logoObservability" size="xxl" data-test-subj="observability-logo" />
</EuiFlexItem>
<EuiFlexItem>
<EuiTitle size="m">
<h1>
{i18n.translate('xpack.observability.home.title', {
defaultMessage: 'Observability',
})}
</h1>
</EuiTitle>
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
</EuiFlexItem>
{showAddData && (
<EuiFlexItem style={{ alignItems: 'flex-end' }}>
{/* TODO: caue: what is the URL here? */}
cauemarcondes marked this conversation as resolved.
Show resolved Hide resolved
<EuiButtonEmpty href="https://www.elastic.co" iconType="plusInCircle">
{i18n.translate('xpack.observability.home.addData', { defaultMessage: 'Add data' })}
</EuiButtonEmpty>
</EuiFlexItem>
)}
</EuiFlexGroup>
<EuiSpacer size="l" />
</Wrapper>
</Container>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiPage, EuiPageBody, EuiPageProps } from '@elastic/eui';
import React from 'react';
import styled from 'styled-components';
import { Header } from '../header/index';

const getPaddingSize = (props: EuiPageProps) => (props.restrictWidth ? 0 : '24px');

const Page = styled(EuiPage)<EuiPageProps>`
background: transparent;
padding-right: ${getPaddingSize};
padding-left: ${getPaddingSize};
`;

const Container = styled.div<{ color?: string }>`
overflow-y: hidden;
min-height: calc(100vh - ${(props) => props.theme.eui.euiHeaderChildSize});
background: ${(props) => props.color};
`;

interface Props {
headerColor: string;
bodyColor: string;
children?: React.ReactNode;
restrictWidth?: number;
showAddData?: boolean;
}

export const WithHeaderLayout = ({
headerColor,
bodyColor,
children,
restrictWidth,
showAddData,
}: Props) => (
<Container color={bodyColor}>
<Header color={headerColor} restrictWidth={restrictWidth} showAddData={showAddData} />
<Page restrictWidth={restrictWidth}>
<EuiPageBody>{children}</EuiPageBody>
</Page>
</Container>
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.newItem__image{
@include euiBottomShadowSmall;
}
Loading