-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
always show query; allow reverting query; add loading states; add jso…
…npath table unused Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
4 changed files
with
148 additions
and
67 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiInMemoryTable, EuiCode, EuiText } from '@elastic/eui'; | ||
|
||
interface JsonPathExamplesTableProps {} | ||
|
||
type JSONPathExample = { | ||
expression: string; | ||
meaning: string; | ||
example: string; | ||
}; | ||
|
||
const examples = [ | ||
{ | ||
expression: '$.data', | ||
meaning: 'The entire input', | ||
example: '$.data', | ||
}, | ||
] as JSONPathExample[]; | ||
|
||
const columns = [ | ||
{ | ||
field: 'expression', | ||
name: 'Expression', | ||
width: '25%', | ||
sortable: false, | ||
render: (expression: string) => <EuiCode>{expression}</EuiCode>, | ||
}, | ||
{ | ||
field: 'meaning', | ||
name: 'Meaning', | ||
width: '50%', | ||
sortable: false, | ||
render: (meaning: string) => <EuiText size="s">{meaning}</EuiText>, | ||
}, | ||
{ | ||
field: 'example', | ||
name: 'Example', | ||
width: '25%', | ||
sortable: false, | ||
render: (example: string) => <EuiCode>{example}</EuiCode>, | ||
}, | ||
]; | ||
|
||
/** | ||
* A stateless component containing JSONPath examples in a table. | ||
*/ | ||
export function JsonPathExamplesTable(props: JsonPathExamplesTableProps) { | ||
return ( | ||
<EuiInMemoryTable<JSONPathExample> | ||
items={examples} | ||
columns={columns} | ||
pagination={false} | ||
sorting={false} | ||
hasActions={false} | ||
/> | ||
); | ||
} |
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