-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fleet] Introduce Storybook to Fleet (#112611)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
322c5e2
commit b1d6779
Showing
13 changed files
with
463 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...t/public/applications/integrations/sections/epm/components/assets_facet_group.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* 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 { AssetsFacetGroup as Component } from './assets_facet_group'; | ||
|
||
export default { | ||
component: Component, | ||
title: 'Sections/EPM/Assets Facet Group', | ||
}; | ||
|
||
interface Args { | ||
width: number; | ||
} | ||
|
||
const args: Args = { | ||
width: 250, | ||
}; | ||
|
||
export const AssetsFacetGroup = ({ width }: Args) => { | ||
return ( | ||
<div style={{ width }}> | ||
<Component | ||
assets={{ | ||
kibana: { | ||
dashboard: [], | ||
visualization: [], | ||
index_pattern: [], | ||
search: [], | ||
map: [], | ||
lens: [], | ||
security_rule: [], | ||
ml_module: [], | ||
}, | ||
elasticsearch: { | ||
component_template: [], | ||
data_stream_ilm_policy: [], | ||
data_stream: [], | ||
ilm_policy: [], | ||
index_template: [], | ||
ingest_pipeline: [], | ||
transform: [], | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
AssetsFacetGroup.args = args; |
79 changes: 79 additions & 0 deletions
79
...s/fleet/public/applications/integrations/sections/epm/components/package_card.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* 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 type { SavedObject } from 'src/core/public'; | ||
|
||
import type { Installation } from '../../../../../../common'; | ||
|
||
import type { PackageCardProps } from './package_card'; | ||
import { PackageCard } from './package_card'; | ||
|
||
export default { | ||
title: 'Sections/EPM/Package Card', | ||
description: 'A card representing a package available in Fleet', | ||
}; | ||
|
||
type Args = Omit<PackageCardProps, 'status'> & { width: number }; | ||
|
||
const args: Args = { | ||
width: 250, | ||
title: 'Title', | ||
description: 'Description', | ||
name: 'beats', | ||
release: 'ga', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
}; | ||
|
||
const argTypes = { | ||
release: { | ||
control: { | ||
type: 'radio', | ||
options: ['ga', 'beta', 'experimental'], | ||
}, | ||
}, | ||
}; | ||
|
||
export const NotInstalled = ({ width, ...props }: Args) => ( | ||
<div style={{ width }}> | ||
<PackageCard {...props} status="not_installed" /> | ||
</div> | ||
); | ||
|
||
export const Installed = ({ width, ...props }: Args) => { | ||
const savedObject: SavedObject<Installation> = { | ||
id: props.id, | ||
type: props.type || '', | ||
attributes: { | ||
name: props.name, | ||
version: props.version, | ||
install_version: props.version, | ||
es_index_patterns: {}, | ||
installed_kibana: [], | ||
installed_es: [], | ||
install_status: 'installed', | ||
install_source: 'registry', | ||
install_started_at: '2020-01-01T00:00:00.000Z', | ||
}, | ||
references: [], | ||
}; | ||
|
||
return ( | ||
<div style={{ width }}> | ||
<PackageCard {...props} status="installed" savedObject={savedObject} /> | ||
</div> | ||
); | ||
}; | ||
|
||
NotInstalled.args = args; | ||
NotInstalled.argTypes = argTypes; | ||
Installed.args = args; | ||
Installed.argTypes = argTypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
...et/public/applications/integrations/sections/epm/components/package_list_grid.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/* | ||
* 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 { action } from '@storybook/addon-actions'; | ||
|
||
import type { SavedObject } from 'src/core/public'; | ||
|
||
import type { Installation } from '../../../../../../common'; | ||
|
||
import type { ListProps } from './package_list_grid'; | ||
import { PackageListGrid } from './package_list_grid'; | ||
|
||
export default { | ||
component: PackageListGrid, | ||
title: 'Sections/EPM/Package List Grid', | ||
}; | ||
|
||
type Args = Pick<ListProps, 'title' | 'isLoading' | 'showMissingIntegrationMessage'>; | ||
|
||
const args: Args = { | ||
title: 'Installed integrations', | ||
isLoading: false, | ||
showMissingIntegrationMessage: false, | ||
}; | ||
|
||
const savedObject: SavedObject<Installation> = { | ||
id: 'id', | ||
type: 'integration', | ||
attributes: { | ||
name: 'savedObject', | ||
version: '1.2.3', | ||
install_version: '1.2.3', | ||
es_index_patterns: {}, | ||
installed_kibana: [], | ||
installed_es: [], | ||
install_status: 'installed', | ||
install_source: 'registry', | ||
install_started_at: '2020-01-01T00:00:00.000Z', | ||
}, | ||
references: [], | ||
}; | ||
|
||
export const EmptyList = (props: Args) => ( | ||
<PackageListGrid | ||
list={[]} | ||
onSearchChange={action('onSearchChange')} | ||
setSelectedCategory={action('setSelectedCategory')} | ||
{...props} | ||
/> | ||
); | ||
|
||
export const List = (props: Args) => ( | ||
<PackageListGrid | ||
list={[ | ||
{ | ||
title: 'Package One', | ||
description: 'Not Installed Description', | ||
name: 'beats', | ||
release: 'ga', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'not_installed', | ||
}, | ||
{ | ||
title: 'Package Two', | ||
description: 'Not Installed Description', | ||
name: 'aws', | ||
release: 'beta', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'not_installed', | ||
}, | ||
{ | ||
title: 'Package Three', | ||
description: 'Not Installed Description', | ||
name: 'azure', | ||
release: 'experimental', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'not_installed', | ||
}, | ||
{ | ||
title: 'Package Four', | ||
description: 'Installed Description', | ||
name: 'elastic', | ||
release: 'ga', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'installed', | ||
savedObject, | ||
}, | ||
{ | ||
title: 'Package Five', | ||
description: 'Installed Description', | ||
name: 'unknown', | ||
release: 'beta', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'installed', | ||
savedObject, | ||
}, | ||
{ | ||
title: 'Package Six', | ||
description: 'Installed Description', | ||
name: 'kibana', | ||
release: 'experimental', | ||
id: 'id', | ||
version: '1.0.0', | ||
download: '/', | ||
path: 'path', | ||
status: 'installed', | ||
savedObject, | ||
}, | ||
]} | ||
onSearchChange={action('onSearchChange')} | ||
setSelectedCategory={action('setSelectedCategory')} | ||
{...props} | ||
/> | ||
); | ||
|
||
EmptyList.args = args; | ||
List.args = args; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...s/fleet/public/applications/integrations/sections/epm/components/requirements.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { Requirements as Component } from './requirements'; | ||
|
||
export default { | ||
component: Component, | ||
title: 'Sections/EPM/Requirements', | ||
}; | ||
|
||
interface Args { | ||
width: number; | ||
} | ||
|
||
const args: Args = { | ||
width: 250, | ||
}; | ||
|
||
export const Requirements = ({ width }: Args) => { | ||
return ( | ||
<div style={{ width }}> | ||
<Component | ||
requirements={{ | ||
kibana: { | ||
version: '1.2.3', | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
Requirements.args = args; |
Oops, something went wrong.