Skip to content

Commit

Permalink
fix doc viewer flyout styling in explorer (opensearch-project#378)
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 authored Apr 18, 2023
1 parent f06b18c commit ba93e95
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ export const DocFlyout = ({

const flyoutBody = (
<EuiFlyoutBody>
{populateDataGrid(
explorerFields,
getHeaders(explorerFields.queriedFields, DEFAULT_COLUMNS.slice(1), true),
<tr className="osdDocTable__row">{memorizedTds}</tr>,
getHeaders(explorerFields.selectedFields, DEFAULT_COLUMNS.slice(1), true),
<tr className="osdDocTable__row">{memorizedTds}</tr>
)}
<DocViewer http={http} hit={doc} openTraces={openTraces} />
<div className="obsExplorer">
{populateDataGrid(
explorerFields,
getHeaders(explorerFields.queriedFields, DEFAULT_COLUMNS.slice(1), true),
<tr className="osdDocTable__row">{memorizedTds}</tr>,
getHeaders(explorerFields.selectedFields, DEFAULT_COLUMNS.slice(1), true),
<tr className="osdDocTable__row">{memorizedTds}</tr>
)}
<DocViewer http={http} hit={doc} openTraces={openTraces} />
</div>
</EuiFlyoutBody>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ export const SurroundingFlyout = ({
};

const loadButton = (typeOfDocs: 'new' | 'old') => {
typeOfDocs === 'new'
? loadData(typeOfDocs, numNewEvents + 5)
: loadData(typeOfDocs, valueOldEvents + 5);
if (typeOfDocs === 'new') {
loadData(typeOfDocs, numNewEvents + 5);
} else {
loadData(typeOfDocs, valueOldEvents + 5);
}
};

const handleKeyDown = (
Expand All @@ -139,11 +141,11 @@ export const SurroundingFlyout = ({
};

const onChangeNewEvents = (e: React.ChangeEvent<HTMLInputElement>) => {
setNumNewEvents(parseInt(e.target.value));
setNumNewEvents(parseInt(e.target.value, 10));
};

const onChangeOldEvents = (e: React.ChangeEvent<HTMLInputElement>) => {
setNumOldEvents(parseInt(e.target.value));
setNumOldEvents(parseInt(e.target.value, 10));
};

const flyoutHeader = (
Expand Down Expand Up @@ -227,35 +229,37 @@ export const SurroundingFlyout = ({

const flyoutBody = (
<EuiFlyoutBody>
{getInputForm('arrowUp', onChangeNewEvents, numNewEvents, 'new')}
<EuiSpacer size="s" />
<div>
{newEventsError !== '' && (
<EuiCallOut iconType="bolt" title={newEventsError} color="warning" />
)}
</div>
{populateDataGrid(
explorerFields,
getHeaders(explorerFields.queriedFields, DEFAULT_COLUMNS.slice(1), true),
<>
{newEventsData}
<tr className="osdDocTable__row selected-event-row">{memorizedTds}</tr>
{oldEventsData}
</>,
getHeaders(explorerFields.selectedFields, DEFAULT_COLUMNS.slice(1), true),
<>
{newEventsData}
<tr className="osdDocTable__row selected-event-row">{memorizedTds}</tr>
{oldEventsData}
</>
)}
<div>
{oldEventsError !== '' && (
<EuiCallOut iconType="bolt" title={oldEventsError} color="warning" />
<div className="obsExplorer">
{getInputForm('arrowUp', onChangeNewEvents, numNewEvents, 'new')}
<EuiSpacer size="s" />
<div>
{newEventsError !== '' && (
<EuiCallOut iconType="bolt" title={newEventsError} color="warning" />
)}
</div>
{populateDataGrid(
explorerFields,
getHeaders(explorerFields.queriedFields, DEFAULT_COLUMNS.slice(1), true),
<>
{newEventsData}
<tr className="osdDocTable__row selected-event-row">{memorizedTds}</tr>
{oldEventsData}
</>,
getHeaders(explorerFields.selectedFields, DEFAULT_COLUMNS.slice(1), true),
<>
{newEventsData}
<tr className="osdDocTable__row selected-event-row">{memorizedTds}</tr>
{oldEventsData}
</>
)}
<div>
{oldEventsError !== '' && (
<EuiCallOut iconType="bolt" title={oldEventsError} color="warning" />
)}
</div>
<EuiSpacer size="s" />
{getInputForm('arrowDown', onChangeOldEvents, valueOldEvents, 'old')}
</div>
<EuiSpacer size="s" />
{getInputForm('arrowDown', onChangeOldEvents, valueOldEvents, 'old')}
</EuiFlyoutBody>
);

Expand Down

0 comments on commit ba93e95

Please sign in to comment.