forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from stephmilovic/lens_cases
Lens Cases UI
- Loading branch information
Showing
6 changed files
with
100 additions
and
20 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
43 changes: 43 additions & 0 deletions
43
x-pack/plugins/cases/public/components/lens_context/index.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,43 @@ | ||
/* | ||
* 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, { useState } from 'react'; | ||
import { EuiMarkdownEditorUiPlugin, EuiMarkdownAstNodePosition } from '@elastic/eui'; | ||
import { Plugin } from 'unified'; | ||
|
||
interface LensProcessingPluginRendererProps { | ||
id: string | null; | ||
title: string; | ||
graphEventId?: string; | ||
type: 'lens'; | ||
[key: string]: string | null | undefined; | ||
} | ||
|
||
export interface CasesLensIntegration { | ||
editor_plugins: { | ||
parsingPlugin: Plugin; | ||
processingPluginRenderer: React.FC< | ||
LensProcessingPluginRendererProps & { position: EuiMarkdownAstNodePosition } | ||
>; | ||
uiPlugin: EuiMarkdownEditorUiPlugin; | ||
}; | ||
} | ||
|
||
// This context is available to all children of the stateful_event component where the provider is currently set | ||
export const CasesLensIntegrationContext = React.createContext<CasesLensIntegration | null>(null); | ||
|
||
export const CasesLensIntegrationProvider: React.FC<{ | ||
lensIntegration?: CasesLensIntegration; | ||
}> = ({ children, lensIntegration }) => { | ||
const [activeLensIntegration] = useState(lensIntegration ?? null); | ||
|
||
return ( | ||
<CasesLensIntegrationContext.Provider value={activeLensIntegration}> | ||
{children} | ||
</CasesLensIntegrationContext.Provider> | ||
); | ||
}; |
13 changes: 13 additions & 0 deletions
13
x-pack/plugins/cases/public/components/lens_context/use_lens_context.ts
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,13 @@ | ||
/* | ||
* 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 { useContext } from 'react'; | ||
import { CasesLensIntegrationContext } from '.'; | ||
|
||
export const useLensContext = () => { | ||
return useContext(CasesLensIntegrationContext); | ||
}; |
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
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