-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add new ml response tab * Add bulk API content --------- (cherry picked from commit ee7ec89) Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5d13c93
commit 37788e7
Showing
7 changed files
with
178 additions
and
10 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,60 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { isEmpty } from 'lodash'; | ||
import { | ||
EuiCode, | ||
EuiCodeEditor, | ||
EuiEmptyPrompt, | ||
EuiLink, | ||
EuiSpacer, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
import { | ||
customStringify, | ||
ML_RESPONSE_PROCESSOR_EXAMPLE_DOCS_LINK, | ||
} from '../../../common'; | ||
|
||
interface MLResponseProps { | ||
mlResponse: {}; | ||
} | ||
|
||
/** | ||
* Small component to render the ML response within a raw search response. | ||
*/ | ||
export function MLResponse(props: MLResponseProps) { | ||
return ( | ||
<> | ||
<EuiSpacer size="s" /> | ||
<EuiText size="s"> | ||
Showing results stored in <EuiCode>ext.ml_inference</EuiCode> from the | ||
search response.{' '} | ||
<EuiLink href={ML_RESPONSE_PROCESSOR_EXAMPLE_DOCS_LINK} target="_blank"> | ||
See an example | ||
</EuiLink> | ||
</EuiText> | ||
<EuiSpacer size="m" /> | ||
{isEmpty(props.mlResponse) ? ( | ||
<EuiEmptyPrompt title={<h2>No response found</h2>} titleSize="s" /> | ||
) : ( | ||
<EuiCodeEditor | ||
mode="json" | ||
theme="textmate" | ||
width="100%" | ||
height="100%" | ||
value={customStringify(props.mlResponse)} | ||
readOnly={true} | ||
setOptions={{ | ||
fontSize: '12px', | ||
autoScrollEditorIntoView: true, | ||
wrap: true, | ||
}} | ||
tabSize={2} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
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
49 changes: 49 additions & 0 deletions
49
public/pages/workflow_detail/workflow_inputs/ingest_inputs/bulk_popover_content.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,49 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { | ||
EuiText, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
EuiLink, | ||
EuiCodeBlock, | ||
EuiPopoverTitle, | ||
} from '@elastic/eui'; | ||
import { BULK_API_DOCS_LINK } from '../../../../../common'; | ||
|
||
interface BulkPopoverContentProps { | ||
indexName: string; | ||
} | ||
|
||
/** | ||
* A basic component containing details about the bulk API and link to documentation. | ||
* Provides a partially-complete example, dynamically populated based on an index name. | ||
*/ | ||
export function BulkPopoverContent(props: BulkPopoverContentProps) { | ||
return ( | ||
<EuiFlexItem style={{ width: '40vw' }}> | ||
<EuiPopoverTitle>Ingest additional data</EuiPopoverTitle> | ||
<EuiFlexGroup direction="column"> | ||
<EuiFlexItem grow={false}> | ||
<EuiText> | ||
You can ingest additional bulk data into the same index using the | ||
Bulk API.{' '} | ||
<EuiLink href={BULK_API_DOCS_LINK} target="_blank"> | ||
Learn more | ||
</EuiLink> | ||
</EuiText> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiCodeBlock fontSize="m" isCopyable={true}> | ||
{`POST ${props.indexName}/_bulk | ||
{ "index": { "_index": "${props.indexName}", "_id": //YOUR DOC ID// } } | ||
{ //INSERT YOUR DOCUMENTS// }`} | ||
</EuiCodeBlock> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiFlexItem> | ||
); | ||
} |
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