Skip to content

Commit eee1b35

Browse files
authored
Merge pull request #552 from neo4j-labs/task/new-design-dashboard
New design dashboard
2 parents 6608417 + 12d6dde commit eee1b35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1367
-1430
lines changed

cypress.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ export default defineConfig({
55
projectId: 'a8nh14',
66
video: false,
77
e2e: {
8+
experimentalMemoryManagement: true,
9+
numTestsKeptInMemory: 0,
810
baseUrl: 'http://localhost:3000',
911
setupNodeEvents(on, config) {
1012
return require('./cypress/plugins/index.js')(on, config);
1113
},
14+
retries: {
15+
runMode: 2,
16+
openMode: 0,
17+
},
1218
},
1319
env: {
1420
codeCoverage: {

cypress/e2e/start_page.cy.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('NeoDash E2E Tests', () => {
2727
},
2828
});
2929

30-
cy.get('#form-dialog-title', { timeout: 2000 }).should('be.visible');
30+
cy.get('#form-dialog-title', { timeout: 20000 }).should('contain', 'NeoDash - Neo4j Dashboard Builder').click();
3131

3232
cy.get('#form-dialog-title').then(($div) => {
3333
const text = $div.text();
@@ -43,7 +43,7 @@ describe('NeoDash E2E Tests', () => {
4343
// cy.contains('Yes').click()
4444
// }
4545

46-
cy.get('#form-dialog-title').should('contain', 'Connect to Neo4j');
46+
cy.get('#form-dialog-title', { timeout: 20000 }).should('contain', 'Connect to Neo4j');
4747

4848
// Connect to Neo4j database
4949
// cy.get('#protocol').click()
@@ -279,6 +279,7 @@ describe('NeoDash E2E Tests', () => {
279279
});
280280

281281
function enableAdvancedVisualizations() {
282+
cy.get('main button[aria-label="Dashboard actions').should('be.visible').click();
282283
cy.get('#extensions-sidebar-button').should('be.visible').click();
283284
cy.get('#checkbox-advanced-charts').should('be.visible').click();
284285
cy.get('.ndl-dialog-close').scrollIntoView().should('be.visible').click();
@@ -321,6 +322,9 @@ function checkInitialState() {
321322

322323
function createCard() {
323324
// Check the starter cards
324-
cy.get('main .react-grid-item:eq(2) button[aria-label="add report"]').click();
325+
cy.get('main .react-grid-item button[aria-label="add report"]', { timeout: WAITING_TIME })
326+
.should('be.visible')
327+
.click();
328+
cy.wait(1000);
325329
cy.get('main .react-grid-item:eq(2)').should('contain', 'No query specified.');
326330
}

cypress/plugins/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@ module.exports = (on, config) => {
22
require('@cypress/code-coverage/task')(on, config);
33
//Used to instrument code ran like unit tests
44
on('file:preprocessor', require('@cypress/code-coverage/use-babelrc'));
5+
on('before:browser:launch', (browser, launchOptions) => {
6+
if (browser.family === 'chromium') {
7+
console.log('Adding Chrome flag: --disable-dev-shm-usage');
8+
launchOptions.args.push('--disable-dev-shm-usage');
9+
}
10+
return launchOptions;
11+
});
512
return config;
613
};

docs/modules/ROOT/pages/developer-guide/style-configuration.adoc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ An example configuration for NeoDash
1414
....
1515
{
1616
"DASHBOARD_HEADER_BRAND_LOGO": "logo_lightsand.png",
17-
"APPLY_CUSTOM_BRAND_LOGO": true,
1817
"DASHBOARD_HEADER_COLOR" : "#F3F3F0",
1918
"DASHBOARD_HEADER_BUTTON_COLOR" : "#009999",
2019
"DASHBOARD_HEADER_TITLE_COLOR" : "#00C1B6",
@@ -31,9 +30,7 @@ An example configuration for NeoDash
3130
[width="100%",cols="19%,17%,26%,38%",options="header",]
3231
|===
3332
|Name |Type |Default Value |Description
34-
|APPLY_CUSTOM_BRAND_LOGO |boolean |false |If enabled, a custom logo will be used on the header based on the DASHBOARD_HEADER_BRAND_LOGO variable.
35-
36-
|DASHBOARD_HEADER_BRAND_LOGO |string |undefined |If APPLY_CUSTOM_BRAND_LOGO is true, this variable defines the name of the logo file located on the public folder of the Neodash deployment.
33+
|DASHBOARD_HEADER_BRAND_LOGO |string |undefined |This variable defines the name of the logo file located on the public folder of the Neodash deployment, if you want your own logo instead of the Neo4j one.
3734

3835
|DASHBOARD_HEADER_COLOR |string |#0B297D |Determines the color of the header.
3936

package.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,27 @@
3636
"dependencies": {
3737
"@azure/openai": "^1.0.0-beta.2",
3838
"@codemirror/lang-markdown": "^6.1.1",
39-
"@codemirror/language-data": "^6.3.1",
39+
"@dnd-kit/core": "^6.0.8",
40+
"@dnd-kit/sortable": "^7.0.2",
4041
"@mui/icons-material": "^5.11.16",
4142
"@mui/material": "^5.12.3",
4243
"@mui/styles": "^5.12.3",
4344
"@mui/x-data-grid": "5.17.26",
4445
"@mui/x-date-pickers": "^5.0.17",
45-
"@neo4j-cypher/react-codemirror": "^1.0.2",
46-
"@neo4j-ndl/base": "1.7.0",
47-
"@neo4j-ndl/react": "1.7.0",
48-
"@nivo/bar": "^0.82.1",
49-
"@nivo/circle-packing": "^0.82.1",
50-
"@nivo/core": "^0.82.1",
51-
"@nivo/geo": "^0.82.1",
52-
"@nivo/line": "^0.82.1",
53-
"@nivo/pie": "^0.82.1",
54-
"@nivo/radar": "^0.82.1",
55-
"@nivo/sankey": "^0.82.1",
46+
"@neo4j-cypher/react-codemirror": "^1.0.3",
47+
"@neo4j-ndl/base": "1.10.1",
48+
"@neo4j-ndl/react": "1.10.2",
49+
"@nivo/bar": "^0.83.0",
50+
"@nivo/circle-packing": "^0.83.0",
51+
"@nivo/core": "^0.83.0",
52+
"@nivo/geo": "^0.83.0",
53+
"@nivo/line": "^0.83.0",
54+
"@nivo/pie": "^0.83.0",
55+
"@nivo/radar": "^0.83.0",
56+
"@nivo/sankey": "^0.83.0",
5657
"@nivo/scatterplot": "^0.83.0",
57-
"@nivo/sunburst": "^0.82.1",
58-
"@nivo/treemap": "^0.82.1",
58+
"@nivo/sunburst": "^0.83.0",
59+
"@nivo/treemap": "^0.83.0",
5960
"@sentry/react": "^7.57.0",
6061
"@sentry/webpack-plugin": "^2.5.0",
6162
"babel-runtime": "^6.26.0",
@@ -88,6 +89,7 @@
8889
"react-markdown": "^8.0.0",
8990
"react-redux": "^7.2.6",
9091
"react-show-more-text": "^1.6.2",
92+
"react-toggle-dark-mode": "^1.1.1",
9193
"react-use-error-boundary": "^3.0.0",
9294
"redux-persist": "^6.0.0",
9395
"redux-thunk": "^2.4.1",

public/neo4j-icon-color-full.png

7.17 KB
Loading

src/application/Application.tsx

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ import { NeoLoadSharedDashboardModal } from '../modal/LoadSharedDashboardModal';
4747
import { downloadComponentAsImage } from '../chart/ChartUtils';
4848
import NeoReportHelpModal from '../modal/ReportHelpModal';
4949
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
50-
import { ThemeProvider } from '@mui/material/styles';
51-
import lightTheme from '../component/theme/Themes';
5250
import { resetSessionStorage } from '../sessionStorage/SessionStorageActions';
51+
import { getDashboardTheme } from '../dashboard/DashboardSelectors';
5352

5453
/**
5554
* This is the main application component for NeoDash.
@@ -83,13 +82,15 @@ const Application = ({
8382
resetDashboard,
8483
onAboutModalOpen,
8584
onAboutModalClose,
85+
resetApplication,
8686
getDebugState,
8787
onReportHelpModalClose,
8888
welcomeScreenOpen,
8989
setWelcomeScreenOpen,
9090
onConnectionModalOpen,
9191
onConnectionModalClose,
9292
onSSOAttempt,
93+
themeMode,
9394
}) => {
9495
const [initialized, setInitialized] = React.useState(false);
9596

@@ -106,52 +107,67 @@ const Application = ({
106107

107108
const ref = React.useRef();
108109

110+
useEffect(() => {
111+
if (themeMode === 'dark') {
112+
document.body.classList.add('ndl-theme-dark');
113+
} else {
114+
document.body.classList.remove('ndl-theme-dark');
115+
}
116+
}, [themeMode]);
117+
109118
// Only render the dashboard component if we have an active Neo4j connection.
110119
return (
111-
<ThemeProvider theme={lightTheme}>
112-
<div ref={ref} className='n-flex'>
113-
{/* TODO - clean this up. Only draw the placeholder if the connection is not established. */}
114-
<NeoDashboardPlaceholder connected={connected}></NeoDashboardPlaceholder>
115-
{connected ? <Dashboard onDownloadDashboardAsImage={(_) => downloadComponentAsImage(ref)}></Dashboard> : <></>}
116-
{/* TODO - move all models into a pop-ups (or modals) component. */}
117-
<NeoAboutModal open={aboutModalOpen} handleClose={onAboutModalClose} getDebugState={getDebugState} />
118-
<NeoConnectionModal
119-
open={connectionModalOpen}
120-
dismissable={connected}
121-
connection={connection}
122-
ssoSettings={ssoSettings}
123-
standalone={standaloneSettings.standalone}
124-
standaloneSettings={standaloneSettings}
125-
createConnection={createConnection}
126-
onSSOAttempt={onSSOAttempt}
127-
setConnectionProperties={setConnectionDetails}
128-
onConnectionModalClose={onConnectionModalClose}
129-
></NeoConnectionModal>
130-
<NeoWelcomeScreenModal
131-
welcomeScreenOpen={welcomeScreenOpen}
132-
setWelcomeScreenOpen={setWelcomeScreenOpen}
133-
hasCachedDashboard={hasCachedDashboard}
134-
hasNeo4jDesktopConnection={hasNeo4jDesktopConnection}
135-
onConnectionModalOpen={onConnectionModalOpen}
136-
createConnectionFromDesktopIntegration={createConnectionFromDesktopIntegration}
120+
<div
121+
ref={ref}
122+
className={`n-bg-palette-neutral-bg-default n-h-screen n-w-screen n-flex n-flex-col n-overflow-hidden`}
123+
>
124+
{connected ? (
125+
<Dashboard
126+
onDownloadDashboardAsImage={(_) => downloadComponentAsImage(ref)}
137127
onAboutModalOpen={onAboutModalOpen}
138-
resetDashboard={resetDashboard}
139-
></NeoWelcomeScreenModal>
140-
<NeoUpgradeOldDashboardModal
141-
open={oldDashboard}
142-
text={oldDashboard}
143-
loadDashboard={loadDashboard}
144-
clearOldDashboard={clearOldDashboard}
145-
/>
146-
<NeoLoadSharedDashboardModal
147-
shareDetails={shareDetails}
148-
onResetShareDetails={onResetShareDetails}
149-
onConfirmLoadSharedDashboard={onConfirmLoadSharedDashboard}
150-
/>
151-
<NeoReportHelpModal open={reportHelpModalOpen} handleClose={onReportHelpModalClose} />
152-
<NeoNotificationModal></NeoNotificationModal>
153-
</div>
154-
</ThemeProvider>
128+
resetApplication={resetApplication}
129+
></Dashboard>
130+
) : (
131+
<NeoDashboardPlaceholder></NeoDashboardPlaceholder>
132+
)}
133+
{/* TODO - move all models into a pop-ups (or modals) component. */}
134+
<NeoAboutModal open={aboutModalOpen} handleClose={onAboutModalClose} getDebugState={getDebugState} />
135+
<NeoConnectionModal
136+
open={connectionModalOpen}
137+
dismissable={connected}
138+
connection={connection}
139+
ssoSettings={ssoSettings}
140+
standalone={standaloneSettings.standalone}
141+
standaloneSettings={standaloneSettings}
142+
createConnection={createConnection}
143+
onSSOAttempt={onSSOAttempt}
144+
setConnectionProperties={setConnectionDetails}
145+
onConnectionModalClose={onConnectionModalClose}
146+
></NeoConnectionModal>
147+
<NeoWelcomeScreenModal
148+
welcomeScreenOpen={welcomeScreenOpen}
149+
setWelcomeScreenOpen={setWelcomeScreenOpen}
150+
hasCachedDashboard={hasCachedDashboard}
151+
hasNeo4jDesktopConnection={hasNeo4jDesktopConnection}
152+
onConnectionModalOpen={onConnectionModalOpen}
153+
createConnectionFromDesktopIntegration={createConnectionFromDesktopIntegration}
154+
onAboutModalOpen={onAboutModalOpen}
155+
resetDashboard={resetDashboard}
156+
></NeoWelcomeScreenModal>
157+
<NeoUpgradeOldDashboardModal
158+
open={oldDashboard}
159+
text={oldDashboard}
160+
loadDashboard={loadDashboard}
161+
clearOldDashboard={clearOldDashboard}
162+
/>
163+
<NeoLoadSharedDashboardModal
164+
shareDetails={shareDetails}
165+
onResetShareDetails={onResetShareDetails}
166+
onConfirmLoadSharedDashboard={onConfirmLoadSharedDashboard}
167+
/>
168+
<NeoReportHelpModal open={reportHelpModalOpen} handleClose={onReportHelpModalClose} />
169+
<NeoNotificationModal></NeoNotificationModal>
170+
</div>
155171
);
156172
};
157173

@@ -171,6 +187,7 @@ const mapStateToProps = (state) => ({
171187
return applicationGetDebugState(state);
172188
}, // TODO - change this to be variable instead of a function?
173189
hasNeo4jDesktopConnection: applicationHasNeo4jDesktopConnection(state),
190+
themeMode: getDashboardTheme(state),
174191
});
175192

176193
const mapDispatchToProps = (dispatch) => ({
@@ -212,6 +229,10 @@ const mapDispatchToProps = (dispatch) => ({
212229
onAboutModalOpen: (_) => dispatch(setAboutModalOpen(true)),
213230
setWelcomeScreenOpen: (open) => dispatch(setWelcomeScreenOpen(open)),
214231
onAboutModalClose: (_) => dispatch(setAboutModalOpen(false)),
232+
resetApplication: () => {
233+
dispatch(setWelcomeScreenOpen(true));
234+
dispatch(setConnected(false));
235+
},
215236
});
216237

217238
Application.displayName = 'Application';

src/application/ApplicationReducer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ export const applicationReducer = (state = initialState, action: { type: any; pa
8181
}
8282
case SET_ABOUT_MODAL_OPEN: {
8383
const { open } = payload;
84+
if (!open) {
85+
console.log('');
86+
}
8487
state = update(state, { aboutModalOpen: open });
8588
return state;
8689
}

src/card/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const NeoCard = ({
121121
const component = (
122122
<div
123123
ref={observe}
124-
className='bg-light-neutral-bg-weak overflow-hidden n-shadow-l4 border-2 border-light-neutral-border-strong min-w-max rounded-lg px-4 py-5 sm:p-6 n-h-full'
124+
className='n-bg-neutral-bg-weak overflow-hidden n-shadow-l4 border-2 border-neutral-border-strong min-w-max rounded-lg px-4 py-5 sm:p-6 n-h-full'
125125
>
126126
{/* The front of the card, referred to as the 'view' */}
127127
<Collapse disablestrictmodecompat='true' in={!settingsOpen} timeout={collapseTimeout} className='n-h-full'>

src/card/settings/CardSettings.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ const NeoCardSettings = ({
9191
);
9292

9393
return (
94-
<div className={`card-view ${expanded ? 'expanded' : ''} n-overflow-y-auto n-h-full`}>
94+
<div
95+
className={`card-view n-bg-palette-neutral-bg-strong ${expanded ? 'expanded' : ''} n-overflow-y-auto n-h-full`}
96+
>
9597
{cardSettingsHeader}
9698
<ReportItemContainer style={{ height: reportHeight }} className='-n-mt-2'>
9799
{cardSettingsContent}

0 commit comments

Comments
 (0)