Skip to content

Commit

Permalink
Added API for track columns and pass default columns
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeYvas committed Feb 28, 2024
1 parent 0603af0 commit 0d89ac6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const QueryBuilderModal = ({
onQueryRunFail,
onQueryExecutionSuccess,
onQueryExecutionFail,
onSetDefaultVisibleColumns,
recordColumns,
getParamsSource,
recordsLimit,
additionalControls,
Expand Down Expand Up @@ -212,6 +214,8 @@ export const QueryBuilderModal = ({
testQuery={testQuery}
isTestQueryLoading={isTestQueryLoading}
fqlQuery={fqlQuery}
recordColumns={recordColumns}
onSetDefaultVisibleColumns={onSetDefaultVisibleColumns}
testQueryDataSource={testQueryDataSource}
entityTypeDataSource={entityTypeDataSource}
queryDetailsDataSource={queryDetailsDataSource}
Expand Down
10 changes: 8 additions & 2 deletions src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const TestQuery = ({
onQueryExecutionSuccess,
onQueryExecutionFail,
onQueryRetrieved,
recordColumns = [],

Check failure on line 23 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'recordColumns' is missing in props validation

Check failure on line 23 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'recordColumns' is missing in props validation
onSetDefaultVisibleColumns,

Check failure on line 24 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'onSetDefaultVisibleColumns' is missing in props validation

Check failure on line 24 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

'onSetDefaultVisibleColumns' is missing in props validation
fqlQuery,
entityTypeId,
isPreviewLoading,
Expand All @@ -31,7 +33,7 @@ export const TestQuery = ({
const queryClient = useQueryClient();

const [columns, setColumns] = useState([]);
const [visibleColumns, setVisibleColumns] = useState([]);
const [visibleColumns, setVisibleColumns] = useState(recordColumns);
const [includeContent, setIncludeContent] = useState(true);
const [recordsLimitExceeded, setRecordsLimitExceeded] = useState(false);

Expand Down Expand Up @@ -106,11 +108,15 @@ export const TestQuery = ({
setIsPreviewLoading(false);
};

const handleColumnChange = ({ values }) => setVisibleColumns(values);
const handleColumnChange = ({ values }) => {
onSetDefaultVisibleColumns(values)

Check failure on line 112 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon

Check failure on line 112 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon
return setVisibleColumns(values)

Check failure on line 113 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Expected blank line before this statement

Check failure on line 113 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon

Check failure on line 113 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Expected blank line before this statement

Check failure on line 113 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon
};

const handleDefaultVisibleColumnsChange = (values) => {
if (!visibleColumns.length) {
setVisibleColumns(values);
onSetDefaultVisibleColumns(values)

Check failure on line 119 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon

Check failure on line 119 in src/QueryBuilder/QueryBuilder/TestQuery/TestQuery.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Missing semicolon
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/QueryBuilder/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ export const queryBuilderModalPropTypes = {
testQueryDataSource: PropTypes.func,
cancelQueryDataSource: PropTypes.func,
queryDetailsDataSource: PropTypes.func,
recordColumns: PropTypes.arrayOf(PropTypes.string),
initialValues: PropTypes.object,
saveBtnLabel: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
onSetDefaultVisibleColumns: PropTypes.func,
entityTypeDataSource: PropTypes.func,
getParamsSource: PropTypes.func,
onQueryRunSuccess: PropTypes.func,
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { QueryBuilderPlugin as default } from './QueryBuilder';
export { QueryBuilderPlugin } from './QueryBuilder';

0 comments on commit 0d89ac6

Please sign in to comment.