Skip to content

Commit

Permalink
Merge branch 'main' into renderImportedDashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
bhavyarm authored Mar 31, 2022
2 parents 1422dad + 79069d8 commit 5017001
Show file tree
Hide file tree
Showing 36 changed files with 343 additions and 189 deletions.
6 changes: 5 additions & 1 deletion docs/developer/advanced/sharing-saved-objects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,17 @@ const shareToSpaceFlyoutProps: ShareToSpaceFlyoutProps = {
onClose: () => setShowFlyout(false),
};

const canAssignSpaces = !capabilities || !!capabilities.savedObjectsManagement.shareIntoSpace;
const clickProperties = canAssignSpaces
? { cursorStyle: 'pointer', listOnClick: () => setShowFlyout(true) }
: { cursorStyle: 'not-allowed' };
return (
<>
<LazySpaceList
namespaces={spaceIds}
displayLimit={8}
behaviorContext="outside-space" <4>
listOnClick={() => setShowFlyout(true)}
{...clickProperties}
/>
{showFlyout && <LazyShareToSpaceFlyout {...shareToSpaceFlyoutProps} />}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

export { NoDataCard, ElasticAgentCard } from './no_data_page';
export { NoDataPage } from './no_data_page';

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 @@ -7,3 +7,5 @@
*/

export { NoDataCard, ElasticAgentCard } from './no_data_card';
export { NoDataPage } from './no_data_page';
export type { NoDataPageProps } from './types';

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

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

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 @@ -40,19 +40,6 @@ describe('ElasticAgentCardComponent', () => {
});

describe('props', () => {
test('recommended', () => {
const component = shallow(
<ElasticAgentCardComponent
recommended
canAccessFleet={true}
navigateToUrl={navigateToUrl}
currentAppId$={currentAppId$}
/>
);
expect(component.find(NoDataCard).props().recommended).toBe(true);
expect(component).toMatchSnapshot();
});

test('button', () => {
const component = shallow(
<ElasticAgentCardComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from './elastic_agent_card.component';

export default {
title: 'Elastic Agent Data Card',
title: 'Page Template/No Data Page/Elastic Agent Data Card',
description: 'A solution-specific wrapper around NoDataCard, to be used on NoData page',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/
export { NoDataCard } from './no_data_card';
export { ElasticAgentCard } from './elastic_agent_card';
export type { NoDataCardProps, ElasticAgentCardProps } from './types';
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,17 @@ import { NoDataCard } from './no_data_card';
import type { NoDataCardProps } from './types';

export default {
title: 'No Data Card',
title: 'Page Template/No Data Page/No Data Card',
description: 'A wrapper around EuiCard, to be used on NoData page',
};

type Params = Pick<NoDataCardProps, 'recommended' | 'button' | 'description'>;
type Params = Pick<NoDataCardProps, 'button' | 'description'>;

export const PureComponent = (params: Params) => {
return <NoDataCard title={'Add data'} {...params} />;
};

PureComponent.argTypes = {
recommended: {
control: 'boolean',
defaultValue: false,
},
button: {
control: {
type: 'text',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ export const NO_DATA_CARD_MAX_WIDTH = 400;
export const NoDataCardStyles = () => {
return {
maxWidth: NO_DATA_CARD_MAX_WIDTH,
marginInline: 'auto',
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ describe('NoDataCard', () => {
});

describe('props', () => {
test('recommended', () => {
const component = render(
<NoDataCard recommended title="Card title" description="Description" />
);
expect(component).toMatchSnapshot();
});

test('button', () => {
const component = render(
<NoDataCard button="Button" title="Card title" description="Description" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ import { EuiButton, EuiCard } from '@elastic/eui';
import type { NoDataCardProps } from './types';
import { NoDataCardStyles } from './no_data_card.styles';

const recommendedLabel = i18n.translate(
'sharedUXComponents.pageTemplate.noDataPage.recommendedLabel',
{
defaultMessage: 'Recommended',
}
);

const defaultDescription = i18n.translate(
'sharedUXComponents.pageTemplate.noDataCard.description',
{
Expand All @@ -28,7 +21,6 @@ const defaultDescription = i18n.translate(
);

export const NoDataCard: FunctionComponent<NoDataCardProps> = ({
recommended,
title,
button,
description,
Expand All @@ -49,7 +41,6 @@ export const NoDataCard: FunctionComponent<NoDataCardProps> = ({
// Default footer action is a button with the provided or default string
return <EuiButton fill>{button || title}</EuiButton>;
};
const label = recommended ? recommendedLabel : undefined;
const cardDescription = description || defaultDescription;

return (
Expand All @@ -58,7 +49,6 @@ export const NoDataCard: FunctionComponent<NoDataCardProps> = ({
paddingSize="l"
title={title!}
description={cardDescription}
betaBadgeProps={{ label }}
footer={footer()}
isDisabled={isDisabled}
{...cardRest}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import { EuiCardProps } from '@elastic/eui';
import { MouseEventHandler, ReactNode } from 'react';

export type NoDataCardProps = Partial<Omit<EuiCardProps, 'layout'>> & {
/**
* Applies the `Recommended` beta badge and makes the button `fill`
*/
recommended?: boolean;
/**
* Provide just a string for the button's label, or a whole component;
* The button will be hidden completely if `isDisabled=true`
Expand Down
Loading

0 comments on commit 5017001

Please sign in to comment.