Skip to content

Commit

Permalink
Fix hiding column prefix (#695)
Browse files Browse the repository at this point in the history
* fixing missing feature that was hiding columns starting with __

* removing test console log

* removing code smell

* removing code smell

* fixing test

* Bumped outdated version numbers

---------

Co-authored-by: Alfred Rubin <alfredo.rubin@neo4j.com>
Co-authored-by: Niels de Jong <niels-121@hotmail.com>
  • Loading branch information
3 people authored Nov 16, 2023
1 parent 85d9581 commit 826e0e0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/master-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_LABS_USERNAME }}/neodash:latest,${{ secrets.DOCKER_HUB_LABS_USERNAME }}/neodash:2.3.5
tags: ${{ secrets.DOCKER_HUB_LABS_USERNAME }}/neodash:latest,${{ secrets.DOCKER_HUB_LABS_USERNAME }}/neodash:2.4.0
build-docker-legacy:
needs: build-test
runs-on: neodash-runners
Expand All @@ -103,7 +103,7 @@ jobs:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/neodash:latest,${{ secrets.DOCKER_HUB_USERNAME }}/neodash:2.3.5
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/neodash:latest,${{ secrets.DOCKER_HUB_USERNAME }}/neodash:2.4.0
deploy-gallery:
runs-on: neodash-runners
strategy:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ USER nginx
EXPOSE $NGINX_PORT

HEALTHCHECK cmd curl --fail "http://localhost:$NGINX_PORT" || exit 1
LABEL version="2.3.5"
LABEL version="2.4.0"
2 changes: 1 addition & 1 deletion cypress/e2e/start_page.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('NeoDash E2E Tests', () => {
cy.get('main .react-grid-item:eq(2) .MuiDataGrid-columnHeaders', { timeout: WAITING_TIME })
.should('contain', 'title')
.and('contain', 'released')
.and('contain', '__id');
.and('not.contain', '__id');
cy.get('main .react-grid-item:eq(2) .MuiDataGrid-virtualScroller .MuiDataGrid-row').should('have.length', 5);
cy.get('main .react-grid-item:eq(2) .MuiDataGrid-footerContainer').should('contain', '1–5 of 8');
cy.get('main .react-grid-item:eq(2) .MuiDataGrid-footerContainer button[aria-label="Go to next page"]').click();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neodash",
"version": "2.3.5",
"version": "2.4.0",
"description": "NeoDash - Neo4j Dashboard Builder",
"neo4jDesktop": {
"apiVersion": "^1.2.0"
Expand Down
18 changes: 13 additions & 5 deletions src/chart/table/TableChart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { DataGrid, GridColumnVisibilityModel } from '@mui/x-data-grid';
import { ChartProps } from '../Chart';
import {
Expand Down Expand Up @@ -27,6 +27,7 @@ import { getCheckboxes, hasCheckboxes, updateCheckBoxes } from './TableActionsHe
const TABLE_HEADER_HEIGHT = 32;
const TABLE_FOOTER_HEIGHT = 62;
const TABLE_ROW_HEIGHT = 52;
const HIDDEN_COLUMN_PREFIX = '__';

const theme = createTheme({
typography: {
Expand Down Expand Up @@ -87,10 +88,6 @@ export const NeoTableChart = (props: ChartProps) => {

const useStyles = generateClassDefinitionsBasedOnRules(styleRules);
const classes = useStyles();
if (props.records == null || props.records.length == 0 || props.records[0].keys == null) {
return <>No data, re-run the report.</>;
}

const tableRowHeight = compact ? TABLE_ROW_HEIGHT / 2 : TABLE_ROW_HEIGHT;
const pageSizeReducer = compact ? 3 : 1;

Expand Down Expand Up @@ -162,6 +159,17 @@ export const NeoTableChart = (props: ChartProps) => {
);
});

useEffect(() => {
const hiddenColumns = Object.assign(
{},
...columns.filter((x) => x.field.startsWith(HIDDEN_COLUMN_PREFIX)).map((x) => ({ [x.field]: false }))
);
setColumnVisibilityModel(hiddenColumns);
}, [records]);

if (props.records == null || props.records.length == 0 || props.records[0].keys == null) {
return <>No data, re-run the report.</>;
}
const getTransposedRows = (records) => {
// Skip first key
const rowKeys = [...records[0].keys];
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/forms/chart/NeoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const NeoForm = (props: ChartProps) => {
const [status, setStatus] = React.useState(FormStatus.DATA_ENTRY);
const [formResults, setFormResults] = React.useState([]);
const debouncedRunCypherQuery = useCallback(debounce(props.queryCallback, RUN_QUERY_DELAY_MS), []);
console.log(settings.hasSubmitButton);
console.log(hasSubmitButton);

// Helper function to force a refresh on all reports that depend on the form.
// All reports that use one or more parameters used in the form will be refreshed.
Expand Down

0 comments on commit 826e0e0

Please sign in to comment.