Skip to content

Commit

Permalink
[Page layouts] Some light fixes (#103197) (#103885)
Browse files Browse the repository at this point in the history
* [Solution Toolbar] Fixing button border on non-text color versions

* [Alerts] Removed extra wrappers and use EuiPageHeader

* [Logstash] Basic conversion to template

* [Reporting] Adding bottomBorder to page header

* [ML] Fix display of main navigation tabs

* [Stack Management] Fix side nav not updating when going back to landing page

* [Tags] Add spacing after page header

* [License Management] Full width on file uploader

* [Page Template] Fixed `emptyState` default template for pages with side nav

* [Infra] Removing some page header displays in empty states

* [Enterprise Search] Fix some error layouts

* [Index Patterns] Quick fix for empty state

* snaps

* [Page Template] Remove forced padding when `centeredBody`

* small hack for tab padding for ml

* scroll ML page to fix test

* fix test method type signature

Co-authored-by: Dave Snider <dave.snider@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michail Yasonik <michail.yasonik@elastic.co>

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michail Yasonik <michail.yasonik@elastic.co>
  • Loading branch information
4 people authored Jun 30, 2021
1 parent e467354 commit 5a4a08d
Show file tree
Hide file tree
Showing 29 changed files with 2,440 additions and 2,627 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
EuiCard,
EuiLink,
EuiText,
EuiFlexGroup,
} from '@elastic/eui';
import { useHistory } from 'react-router-dom';
import { reactRouterNavigate } from '../../../../../../plugins/kibana_react/public';
Expand Down Expand Up @@ -143,8 +144,8 @@ export const EmptyState = ({
</EuiFlexGrid>
<EuiSpacer size="xxl" />
<div className="inpEmptyState__footer">
<EuiFlexGrid columns={3}>
<EuiFlexItem className="inpEmptyState__footerFlexItem">
<EuiFlexGroup>
<EuiFlexItem grow={1} className="inpEmptyState__footerFlexItem">
<EuiDescriptionList
listItems={[
{
Expand All @@ -166,7 +167,7 @@ export const EmptyState = ({
]}
/>
</EuiFlexItem>
<EuiFlexItem className="inpEmptyState__footerFlexItem">
<EuiFlexItem grow={2} className="inpEmptyState__footerFlexItem">
<EuiDescriptionList
listItems={[
{
Expand All @@ -189,7 +190,7 @@ export const EmptyState = ({
]}
/>
</EuiFlexItem>
</EuiFlexGrid>
</EuiFlexGroup>
</div>
</EuiPageContentBody>
</EuiPageContent>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ export const KibanaPageTemplate: FunctionComponent<KibanaPageTemplateProps> = ({
pageSideBar = <KibanaPageTemplateSolutionNav {...solutionNav} />;
}

const emptyStateDefaultTemplate = pageSideBar ? 'centeredContent' : 'centeredBody';

/**
* An easy way to create the right content for empty pages
*/
if (isEmptyState && pageHeader && !children) {
template = template ?? 'centeredBody';
template = template ?? emptyStateDefaultTemplate;
const { iconType, pageTitle, description, rightSideItems } = pageHeader;
pageHeader = undefined;
children = (
Expand All @@ -81,14 +83,13 @@ export const KibanaPageTemplate: FunctionComponent<KibanaPageTemplateProps> = ({
} else if (isEmptyState && pageHeader && children) {
template = template ?? 'centeredContent';
} else if (isEmptyState && !pageHeader) {
template = template ?? 'centeredBody';
template = template ?? emptyStateDefaultTemplate;
}

return (
<EuiPageTemplate
template={template}
restrictWidth={restrictWidth}
paddingSize={template === 'centeredBody' ? 'none' : 'l'}
pageHeader={pageHeader}
pageSideBar={pageSideBar}
pageSideBarProps={{
Expand Down
13 changes: 11 additions & 2 deletions src/plugins/management/public/components/landing/landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,27 @@
* Side Public License, v 1.
*/

import React from 'react';
import React, { useEffect } from 'react';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiEmptyPrompt, EuiHorizontalRule, EuiPageContent } from '@elastic/eui';

interface ManagementLandingPageProps {
version: string;
onAppMounted: (id: string) => void;
setBreadcrumbs: () => void;
}

export const ManagementLandingPage = ({ version, setBreadcrumbs }: ManagementLandingPageProps) => {
export const ManagementLandingPage = ({
version,
setBreadcrumbs,
onAppMounted,
}: ManagementLandingPageProps) => {
setBreadcrumbs();

useEffect(() => {
onAppMounted('');
}, [onAppMounted]);

return (
<EuiPageContent verticalPosition="center" horizontalPosition="center" color="subdued">
<EuiEmptyPrompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const ManagementRouter = memo(
<ManagementLandingPage
version={dependencies.kibanaVersion}
setBreadcrumbs={setBreadcrumbs}
onAppMounted={onAppMounted}
/>
)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@

// Lighten the border color for all states
border-color: $euiBorderColor !important; // sass-lint:disable-line no-important

@include kbnThemeStyle('v8') {
&[class*='--text'] {
border-width: $euiBorderWidthThin;
border-style: solid;
}
}
}
7 changes: 5 additions & 2 deletions test/functional/services/common/test_subjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,12 @@ export class TestSubjects extends FtrService {
return testSubjSelector(selector);
}

public async scrollIntoView(selector: string) {
public async scrollIntoView(
selector: string,
offset?: number | { topOffset?: number; bottomOffset?: number }
) {
const element = await this.find(selector);
await element.scrollIntoViewIfNecessary();
await element.scrollIntoViewIfNecessary(offset);
}

// isChecked always returns false when run on an euiSwitch, because they use the aria-checked attribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React from 'react';

import { EuiPage, EuiPageContent } from '@elastic/eui';
import { KibanaPageTemplate } from '../../../../../../../../src/plugins/kibana_react/public';

import { ErrorStatePrompt } from '../../../shared/error_state';
import { SetAppSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome';
Expand All @@ -19,11 +19,9 @@ export const ErrorConnecting: React.FC = () => {
<SetPageChrome />
<SendTelemetry action="error" metric="cannot_connect" />

<EuiPage restrictWidth>
<EuiPageContent hasBorder>
<ErrorStatePrompt />
</EuiPageContent>
</EuiPage>
<KibanaPageTemplate isEmptyState>
<ErrorStatePrompt />
</KibanaPageTemplate>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@

import React from 'react';

import { EuiPage, EuiPageContent } from '@elastic/eui';
import { KibanaPageTemplate } from '../../../../../../../../src/plugins/kibana_react/public';

import { ErrorStatePrompt } from '../../../shared/error_state';
import { SendEnterpriseSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';

export const ErrorConnecting: React.FC = () => (
<EuiPage restrictWidth>
<KibanaPageTemplate isEmptyState>
<SendTelemetry action="error" metric="cannot_connect" />
<EuiPageContent>
<ErrorStatePrompt />
</EuiPageContent>
</EuiPage>

<ErrorStatePrompt />
</KibanaPageTemplate>
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import React from 'react';

import { EuiPage, EuiPageBody, EuiPageContent } from '@elastic/eui';
import { KibanaPageTemplate } from '../../../../../../../../src/plugins/kibana_react/public';

import { WORKPLACE_SEARCH_PLUGIN } from '../../../../../common/constants';
import { ErrorStatePrompt } from '../../../shared/error_state';
Expand All @@ -19,16 +19,14 @@ import { ViewContentHeader } from '../../components/shared/view_content_header';

export const ErrorState: React.FC = () => {
return (
<EuiPage restrictWidth>
<>
<SetPageChrome />
<SendTelemetry action="error" metric="cannot_connect" />

<EuiPageBody>
<KibanaPageTemplate isEmptyState>
<ViewContentHeader title={WORKPLACE_SEARCH_PLUGIN.NAME} />
<EuiPageContent>
<ErrorStatePrompt />
</EuiPageContent>
</EuiPageBody>
</EuiPage>
<ErrorStatePrompt />
</KibanaPageTemplate>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,13 @@ const CategoriesPageTemplate: React.FC<LazyObservabilityPageTemplateProps> = ({
return (
<LogsPageTemplate
data-test-subj="logsLogEntryCategoriesPage"
pageHeader={{
pageTitle: logCategoriesTitle,
}}
pageHeader={
rest.isEmptyState
? undefined
: {
pageTitle: logCategoriesTitle,
}
}
{...rest}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,13 @@ const AnomaliesPageTemplate: React.FC<LazyObservabilityPageTemplateProps> = ({
return (
<LogsPageTemplate
data-test-subj="logsLogEntryRatePage"
pageHeader={{
pageTitle: anomaliesTitle,
}}
pageHeader={
rest.isEmptyState
? undefined
: {
pageTitle: anomaliesTitle,
}
}
{...rest}
>
{children}
Expand Down
Loading

0 comments on commit 5a4a08d

Please sign in to comment.