x-pack/platform/packages/shared/kbn-failure-store-modal/README.md
A reusable React component package that provides a modal interface for configuring failure store settings in Kibana. This package contains stateless components for managing failure store configurations including retention periods and custom settings.
The Failure Store Modal is a form-based modal component that allows users to:
This package is part of the Kibana monorepo and is available as a shared browser package.
import { FailureStoreModal } from '@kbn/failure-store-modal';
import React, { useState } from 'react';
import { FailureStoreModal } from '@kbn/failure-store-modal';
const MyComponent = () => {
const [isModalVisible, setIsModalVisible] = useState(false);
const handleSave = (data) => {
console.log('Failure store config:', data);
// Handle the saved configuration
setIsModalVisible(false);
};
const handleClose = () => {
setIsModalVisible(false);
};
return (
<>
<button onClick={() => setIsModalVisible(true)}>
Configure Failure Store
</button>
{isModalVisible && (
<FailureStoreModal
onCloseModal={handleClose}
onSaveModal={handleSave}
failureStoreProps={{
failureStoreEnabled: false,
defaultRetentionPeriod: '30d'
}}
/>
)}
</>
);
};
<FailureStoreModal
onCloseModal={handleClose}
onSaveModal={handleSave}
failureStoreProps={{
failureStoreEnabled: true,
defaultRetentionPeriod: '30d',
customRetentionPeriod: '7d'
}}
/>
<FailureStoreModal
onCloseModal={handleClose}
onSaveModal={handleSave}
failureStoreProps={{
failureStoreEnabled: true,
defaultRetentionPeriod: '30d',
retentionDisabled: true
}}
canShowDisableLifecycle={true}
/>
<FailureStoreModal
onCloseModal={handleClose}
onSaveModal={handleSave}
failureStoreProps={{
failureStoreEnabled: true,
defaultRetentionPeriod: '30d'
}}
canShowDisableLifecycle={true}
disableButtonLabel="Forever"
/>
<FailureStoreModal
onCloseModal={handleClose}
onSaveModal={handleSave}
failureStoreProps={{
failureStoreEnabled: true,
defaultRetentionPeriod: '30d',
customRetentionPeriod: '40d'
}}
inheritOptions={{
canShowInherit: true,
isWired: true,
isCurrentlyInherited: false
}}
/>
| Prop | Type | Required | Description |
|---|---|---|---|
onCloseModal | () => void | ✓ | Callback function called when the modal is closed |
onSaveModal | (data: FailureStoreFormData) => Promise<void> | void | ✓ | Callback function called when the form is submitted with valid data |
failureStoreProps | FailureStoreFormProps | ✓ | Configuration object for the failure store settings |
inheritOptions | InheritOptions | ✗ | Configuration for inheritance behavior from parent stream or index template |
showIlmDescription | boolean | ✗ | Whether to display tier-specific messaging (defaults to true) |
canShowDisableLifecycle | boolean | ✗ | Whether to show the option to disable lifecycle management (defaults to false) |
disableButtonLabel | string | ✗ | Custom label for the disabled lifecycle button. If not provided, defaults to "Disabled" |
| Property | Type | Required | Description |
|---|---|---|---|
failureStoreEnabled | boolean | ✓ | Whether failure store is currently enabled |
defaultRetentionPeriod | string | ✗ | Default retention period (e.g., "30d", "7h") |
customRetentionPeriod | string | ✗ | Custom retention period if different from default |
retentionDisabled | boolean | ✗ | Whether lifecycle management is disabled for retention |
| Property | Type | Required | Description |
|---|---|---|---|
canShowInherit | boolean | ✓ | Whether to display the inherit toggle |
isWired | boolean | ✓ | If true, shows "parent stream" labels; if false, shows "index template" labels |
isCurrentlyInherited | boolean | ✓ | Initial state of the inherit toggle |
| Property | Type | Description |
|---|---|---|
failureStoreEnabled | boolean | Whether failure store should be enabled |
customRetentionPeriod | string | undefined | Custom retention period if specified |
retentionDisabled | boolean | undefined | Whether lifecycle management is disabled |
inherit | boolean | undefined | Whether to inherit configuration from parent stream or index template |
The modal supports the following time units for retention periods:
d - Daysh - Hoursm - Minutess - Secondsms - Millisecondsmicros - Microsecondsnanos - NanosecondscanShowDisableLifecycle, users can choose to disable lifecycle managementThe package includes comprehensive test coverage:
# Run tests
yarn jest --config x-pack/platform/packages/shared/kbn-failure-store-modal/jest.config.js
View and develop the component in Storybook:
yarn storybook failure_store_modal