import { storiesOf } from '@storybook/react' ; import React from 'react' ; import { CoreStart } from 'kibana/public' ; import { AgentConfiguration } from '../../../../../../common/agent_configuration/configuration_types' ; import { FETCH_STATUS } from '../../../../../hooks/use_fetcher' ; import { createCallApmApi } from '../../../../../services/rest/createCallApmApi' ; import { AgentConfigurationCreateEdit } from './index' ; import { ApmPluginContext , ApmPluginContextValue , } from '../../../../../context/apm_plugin/apm_plugin_context' ; storiesOf ( 'app/Settings/AgentConfigurations/AgentConfigurationCreateEdit' , module ) . addDecorator ( ( storyFn ) => { const coreMock = { } as unknown as CoreStart ; createCallApmApi ( coreMock ) ; const contextMock = { core : { notifications : { toasts : { addWarning : ( ) => { } , addDanger : ( ) => { } } , } , } , } ; return ( < ApmPluginContext . Provider value = { contextMock as unknown as ApmPluginContextValue } > { storyFn ( ) } < /ApmPluginContext.Provider>); } ) . add ( 'with config' , ( ) => { return ( < AgentConfigurationCreateEdit pageStep = "choose-settings-step" existingConfigResult = { { status : FETCH_STATUS . SUCCESS , data : { service : { name : 'opbeans-node' , environment : 'production' } , settings : { } , } as AgentConfiguration , } } />); } , { info : { propTablesExclude : [ AgentConfigurationCreateEdit , ApmPluginContext . Provider , ] , source : false , } , } ) ;