Skip to content

Commit

Permalink
CB-3955 hide presentation bar in statistics mode (#2289)
Browse files Browse the repository at this point in the history
Co-authored-by: Daria Marutkina <[email protected]>
  • Loading branch information
devnaumov and dariamarutkina authored Jan 11, 2024
1 parent 4453119 commit bb743ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface Props {
presentation: IDataPresentationOptions;
resultIndex: number;
simple: boolean;
isStatistics: boolean;
}

const styles = css`
Expand All @@ -32,7 +33,7 @@ const styles = css`
}
`;

export const TableGrid = observer<Props>(function TableGrid({ model, actions, dataFormat, presentation, resultIndex, simple }) {
export const TableGrid = observer<Props>(function TableGrid({ model, actions, dataFormat, presentation, resultIndex, simple, isStatistics }) {
if ((presentation.dataFormat !== undefined && dataFormat !== presentation.dataFormat) || !model.source.hasResult(resultIndex)) {
if (model.isLoading()) {
return null;
Expand All @@ -42,11 +43,9 @@ export const TableGrid = observer<Props>(function TableGrid({ model, actions, da
return <TextPlaceholder>Current data can't be displayed by selected presentation</TextPlaceholder>;
}

const result = model.getResult(resultIndex);

const Presentation = presentation.getPresentationComponent();

if (result?.loadedFully && !result.data) {
if (isStatistics) {
return <TableStatistics model={model} resultIndex={resultIndex} />;
}

Expand Down
26 changes: 15 additions & 11 deletions webapp/packages/plugin-data-viewer/src/TableViewer/TableViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const TableViewer = observer<TableViewerProps, HTMLDivElement>(
? dataPresentationService.getSupported(DataPresentationType.toolsPanel, dataFormat, valuePresentationId, dataModel, resultIndex)
: null;

const isStatistics = result?.loadedFully && !result.data;
const resultExist = dataModel.source.hasResult(resultIndex);
const overlay = dataModel.source.results.length > 0 && presentation.dataFormat === dataFormat;
const valuePanelDisplayed =
Expand All @@ -203,16 +204,18 @@ export const TableViewer = observer<TableViewerProps, HTMLDivElement>(
return (
<div ref={ref} className={s(styles, { tableViewer: true }, className)}>
<div className={s(styles, { tableContent: true })}>
<TablePresentationBar
className={s(styles, { tablePresentationBar: true })}
type={DataPresentationType.main}
presentationId={presentation.id}
dataFormat={dataFormat}
supportedDataFormat={dataModel.supportedDataFormats}
model={dataModel}
resultIndex={resultIndex}
onPresentationChange={dataTableActions.setPresentation}
/>
{!isStatistics && (
<TablePresentationBar
className={s(styles, { tablePresentationBar: true })}
type={DataPresentationType.main}
presentationId={presentation.id}
dataFormat={dataFormat}
supportedDataFormat={dataModel.supportedDataFormats}
model={dataModel}
resultIndex={resultIndex}
onPresentationChange={dataTableActions.setPresentation}
/>
)}
<div className={s(styles, { tableData: true })}>
<TableHeader model={dataModel} resultIndex={resultIndex} simple={simple} />
<Split
Expand All @@ -233,6 +236,7 @@ export const TableViewer = observer<TableViewerProps, HTMLDivElement>(
presentation={presentation}
resultIndex={resultIndex}
simple={simple}
isStatistics={isStatistics}
/>
</Loader>
<TableError model={dataModel} loading={loading} />
Expand Down Expand Up @@ -263,7 +267,7 @@ export const TableViewer = observer<TableViewerProps, HTMLDivElement>(
</Pane>
</Split>
</div>
{!simple && (
{!simple && !isStatistics && (
<TablePresentationBar
type={DataPresentationType.toolsPanel}
className={s(styles, { tablePresentationBar: true })}
Expand Down

0 comments on commit bb743ac

Please sign in to comment.