Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add showing first 10 rows to merging of cubes #1563

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/browser/dataset-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,7 @@ export const DataSetPreview = ({
filters={[variables.cubeFilter]}
/>
</Flex>
<Typography
className={classes.numberOfRows}
variant="body2"
sx={{ fontWeight: "light" }}
>
<Trans id="datatable.showing.first.rows">
Showing first 10 rows
</Trans>
</Typography>
<FirstTenRowsCaption />
</Flex>
</Paper>
</Flex>
Expand All @@ -230,3 +222,11 @@ export const DataSetPreview = ({
};

export type DataSetPreviewProps = React.ComponentProps<typeof DataSetPreview>;

export const FirstTenRowsCaption = () => {
return (
<Typography variant="body2" sx={{ fontWeight: "light" }}>
<Trans id="datatable.showing.first.rows">Showing first 10 rows</Trans>
</Typography>
);
};
105 changes: 59 additions & 46 deletions app/configurator/components/add-dataset-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { FormEvent, useCallback, useEffect, useMemo, useState } from "react";
import { useClient } from "urql";

import { DatasetResults, PartialSearchCube } from "@/browser/dataset-browse";
import { FirstTenRowsCaption } from "@/browser/dataset-preview";
import { getPossibleChartTypes } from "@/charts";
import { Error as ErrorHint, Loading } from "@/components/hint";
import Tag from "@/components/tag";
Expand Down Expand Up @@ -666,60 +667,72 @@ export const PreviewDataTable = ({
{observations.data?.dataCubesObservations ? (
<Box
sx={{
width: "100%",
overflowX: "scroll",
display: "flex",
flexDirection: "column",
alignItems: "flex-end",
gap: 2,
}}
>
<Table>
<TableHead>
<TableRow>
{allColumns.map((column) =>
!!selectedColumnsByIri[columnId(column)] ? (
<TableCell
key={column.iri}
sx={{ minWidth: 200, maxWidth: 300 }}
>
{column.cubeIri === otherCube.iri && (
<NewAnnotation />
)}
{isJoinByComponent(column) ? (
<>
<Tooltip
arrow
title={
<>
{column.originalIris
.map((o) => o.description)
.join(", ")}
</>
}
placement="right"
>
<Tag type="dimension">Joined</Tag>
</Tooltip>
</>
) : null}
<br />
<Typography variant="h5">{column.label}</Typography>
</TableCell>
) : null
)}
</TableRow>
</TableHead>
<TableBody>
{previewObservations.map((observation, index) => (
<TableRow key={index}>
<Box
sx={{
width: "100%",
overflowX: "scroll",
}}
>
<Table>
<TableHead>
<TableRow>
{allColumns.map((column) =>
!!selectedColumnsByIri[columnId(column)] ? (
<TableCell key={column.iri}>
{observation[column.iri]}
<TableCell
key={column.iri}
sx={{ minWidth: 200, maxWidth: 300 }}
>
{column.cubeIri === otherCube.iri && (
<NewAnnotation />
)}
{isJoinByComponent(column) ? (
<>
<Tooltip
arrow
title={
<>
{column.originalIris
.map((o) => o.description)
.join(", ")}
</>
}
placement="right"
>
<Tag type="dimension">Joined</Tag>
</Tooltip>
</>
) : null}
<br />
<Typography variant="h5">
{column.label}
</Typography>
</TableCell>
) : null
)}
</TableRow>
))}
</TableBody>
</Table>
</TableHead>
<TableBody>
{previewObservations.map((observation, index) => (
<TableRow key={index}>
{allColumns.map((column) =>
!!selectedColumnsByIri[columnId(column)] ? (
<TableCell key={column.iri}>
{observation[column.iri]}
</TableCell>
) : null
)}
</TableRow>
))}
</TableBody>
</Table>
</Box>
<FirstTenRowsCaption />
</Box>
) : null}
</>
Expand Down
2 changes: 1 addition & 1 deletion app/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ msgstr "New"

#: app/configurator/components/add-dataset-dialog.tsx
msgid "dataset.search.preview.title"
msgstr "Preview data table"
msgstr "Review available dimensions"

#: app/configurator/components/add-dataset-dialog.tsx
msgid "dataset.search.search-options.more-2-options-selected"
Expand Down
Loading