mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
apply filters to csv export
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"grapesjs-react": "^2.0.2",
|
||||
"hotkeys-js": "^3.7.2",
|
||||
"lodash": "^4.17.15",
|
||||
"query-string": "^6.8.3",
|
||||
"ramda": "^0.26.1",
|
||||
"react": "^16.9.0",
|
||||
"react-color": "^2.17.3",
|
||||
|
||||
@@ -26,6 +26,8 @@ import { exportTable } from "../firebase/callables";
|
||||
import { saveAs } from "file-saver";
|
||||
import useTableConfig from "../hooks/useFiretable/useTableConfig";
|
||||
import { SnackContext } from "../contexts/snackContext";
|
||||
import { FireTableFilter } from "../hooks/useFiretable";
|
||||
|
||||
const ITEM_HEIGHT = 48;
|
||||
const ITEM_PADDING_TOP = 8;
|
||||
const MenuProps = {
|
||||
@@ -72,10 +74,11 @@ const useStyles = makeStyles(theme =>
|
||||
interface Props {
|
||||
columns: any;
|
||||
collection: string;
|
||||
filters: FireTableFilter[];
|
||||
}
|
||||
|
||||
export default function ExportCSV(props: Props) {
|
||||
const { columns, collection } = props;
|
||||
const { columns, collection, filters } = props;
|
||||
const classes = useStyles();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [csvColumns, setCSVColumns] = useState<any[]>([]);
|
||||
@@ -99,7 +102,7 @@ export default function ExportCSV(props: Props) {
|
||||
});
|
||||
const data = await exportTable({
|
||||
collectionPath: collection,
|
||||
filters: [],
|
||||
filters,
|
||||
columns,
|
||||
});
|
||||
var blob = new Blob([data.data], {
|
||||
|
||||
@@ -9,6 +9,7 @@ import ExportCSV from "components/ExportCSV";
|
||||
import Button from "@material-ui/core/Button";
|
||||
import { createStyles, makeStyles } from "@material-ui/core/styles";
|
||||
import AddIcon from "@material-ui/icons/AddCircle";
|
||||
import { FireTableFilter } from "../../hooks/useFiretable";
|
||||
|
||||
const useStyles = makeStyles(Theme => {
|
||||
return createStyles({
|
||||
@@ -43,9 +44,17 @@ interface Props {
|
||||
updateConfig: Function;
|
||||
addRow: Function;
|
||||
columns: any;
|
||||
filters: FireTableFilter[];
|
||||
}
|
||||
const TableHeader = (props: Props) => {
|
||||
const { collection, rowHeight, updateConfig, columns, addRow } = props;
|
||||
const {
|
||||
collection,
|
||||
rowHeight,
|
||||
updateConfig,
|
||||
columns,
|
||||
addRow,
|
||||
filters,
|
||||
} = props;
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.tableHeader}>
|
||||
@@ -86,6 +95,7 @@ const TableHeader = (props: Props) => {
|
||||
return { key, name, config, type };
|
||||
})}
|
||||
collection={collection}
|
||||
filters={filters}
|
||||
/>
|
||||
|
||||
<ImportCSV columns={columns} addRow={addRow} />
|
||||
|
||||
@@ -25,6 +25,7 @@ import DuplicateIcon from "@material-ui/icons/FileCopy";
|
||||
import useStyles from "./useStyle";
|
||||
import Grid from "./Grid";
|
||||
import Tooltip from "@material-ui/core/Tooltip";
|
||||
|
||||
const Hotkeys = lazy(() => import("./HotKeys"));
|
||||
const TableHeader = lazy(() => import("./TableHeader"));
|
||||
const SearchBox = lazy(() => import("../SearchBox"));
|
||||
@@ -249,6 +250,7 @@ function Table(props: Props) {
|
||||
rowHeight={rowHeight}
|
||||
updateConfig={tableActions.table.updateConfig}
|
||||
columns={columns}
|
||||
filters={filters}
|
||||
addRow={tableActions.row.add}
|
||||
/>
|
||||
</Suspense>{" "}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { functions } from "./index";
|
||||
import { FireTableFilter } from "../hooks/useFiretable";
|
||||
|
||||
export enum CLOUD_FUNCTIONS {
|
||||
updateAlgoliaRecord = "updateAlgoliaRecord",
|
||||
@@ -39,10 +40,6 @@ export const algoliaDeleteDoc = functions.httpsCallable(
|
||||
|
||||
export const exportTable = (data: {
|
||||
collectionPath: string;
|
||||
filters: {
|
||||
key: string;
|
||||
operator: "==" | "<" | ">" | ">=" | "<=";
|
||||
value: string;
|
||||
}[];
|
||||
filters: FireTableFilter[];
|
||||
columns: any[];
|
||||
}) => functions.httpsCallable(CLOUD_FUNCTIONS.exportTable)(data);
|
||||
|
||||
@@ -9977,6 +9977,15 @@ query-string@^4.1.0:
|
||||
object-assign "^4.1.0"
|
||||
strict-uri-encode "^1.0.0"
|
||||
|
||||
query-string@^6.8.3:
|
||||
version "6.8.3"
|
||||
resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.8.3.tgz#fd9fb7ffb068b79062b43383685611ee47777d4b"
|
||||
integrity sha512-llcxWccnyaWlODe7A9hRjkvdCKamEKTh+wH8ITdTc3OhchaqUZteiSCX/2ablWHVrkVIe04dntnaZJ7BdyW0lQ==
|
||||
dependencies:
|
||||
decode-uri-component "^0.2.0"
|
||||
split-on-first "^1.0.0"
|
||||
strict-uri-encode "^2.0.0"
|
||||
|
||||
querystring-es3@^0.2.0, querystring-es3@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
|
||||
@@ -11422,6 +11431,11 @@ spectrum-colorpicker@^1.8.0:
|
||||
resolved "https://registry.yarnpkg.com/spectrum-colorpicker/-/spectrum-colorpicker-1.8.0.tgz#b926cf5002c0a77860b5f8351e1c093c65200107"
|
||||
integrity sha1-uSbPUALAp3hgtfg1HhwJPGUgAQc=
|
||||
|
||||
split-on-first@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
|
||||
integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
|
||||
|
||||
split-string@^3.0.1, split-string@^3.0.2:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
|
||||
@@ -11544,6 +11558,11 @@ strict-uri-encode@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
|
||||
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
|
||||
|
||||
strict-uri-encode@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
|
||||
integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY=
|
||||
|
||||
string-length@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed"
|
||||
|
||||
Reference in New Issue
Block a user