Skip to content

Commit

Permalink
feat: pretty print sql in console logs
Browse files Browse the repository at this point in the history
Closes #31
  • Loading branch information
stdavis committed Jun 29, 2022
1 parent d955387 commit 1fd61a5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
26 changes: 22 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"react-error-boundary": "^3.1.4",
"reactstrap": "^9.1.1",
"sass": "^1.52.3",
"sql-formatter": "^7.0.2",
"typeface-montserrat": "^1.1.13",
"use-immer": "^0.7.0"
},
Expand Down
6 changes: 4 additions & 2 deletions src/components/Filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { Alert, Button, Card, CardBody, CardHeader, Nav, NavItem, NavLink, TabContent, TabPane } from 'reactstrap';
import { format } from 'sql-formatter';
import { useImmerReducer } from 'use-immer';
import config from '../services/config';
import AdvancedControls from './AdvancedControls';
Expand Down Expand Up @@ -195,10 +196,11 @@ export default function Filter({ mapView }) {
React.useEffect(() => {
if (layers) {
for (const layerKey of Object.keys(layers)) {
const where = state.layerDefinitions[layerKey];
layers[layerKey].filter = new FeatureFilter({
where: state.layerDefinitions[layerKey],
where,
});
console.log(`${layers[layerKey].layer.title} filter updated to: \n${state.layerDefinitions[layerKey]}`);
console.log(`${layers[layerKey].layer.title} filter updated to: \n${where ? format(where) : where}`);
}
}
}, [layers, state.layerDefinitions]);
Expand Down

0 comments on commit 1fd61a5

Please sign in to comment.