Skip to content

Commit

Permalink
changing report config default options (#724)
Browse files Browse the repository at this point in the history
* changing report config default options

* Minor style fixes

---------

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 Jan 8, 2024
1 parent 2d4e5f2 commit e6d535a
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 631 deletions.
10 changes: 2 additions & 8 deletions gallery/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -20,7 +16,5 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
],
"include": ["src"]
}
2 changes: 1 addition & 1 deletion public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
white-space: pre;
background-position: 0px -11px;
padding-right: 0px !important;
margin-top: 0px !important;
margin-top: 0px;
padding-left: 30px;
padding-top: 0px !important;
padding-bottom: 0px !important;
Expand Down
16 changes: 7 additions & 9 deletions src/application/ApplicationThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ export const createConnectionThunk =
'ERR - connect to DB',
database,
'',
`Error while trying to establish connection to Neo4j DB in ${
neodashMode
} mode at ${
Date(Date.now()).substring(0, 33)}`
`Error while trying to establish connection to Neo4j DB in ${neodashMode} mode at ${Date(
Date.now()
).substring(0, 33)}`
)
);
}
Expand All @@ -113,11 +112,10 @@ export const createConnectionThunk =
'INF - connect to DB',
database,
'',
`${username
} established connection to Neo4j DB in ${
neodashMode
} mode at ${
Date(Date.now()).substring(0, 33)}`
`${username} established connection to Neo4j DB in ${neodashMode} mode at ${Date(Date.now()).substring(
0,
33
)}`
)
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/application/logging/LoggingThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export const createLogThunk =
() => {},
(records) => {
if (records && records[0] && records[0]._fields && records[0]._fields[0] && records[0]._fields[0] == uuid) {
console.log(`log created: ${ uuid}`);
console.log(`log created: ${uuid}`);

Check warning on line 36 in src/application/logging/LoggingThunk.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
} else {
// we only show error notification one time
const state = getState();
const loggingSettings = applicationGetLoggingSettings(state);
let LogErrorNotificationNum = Number(loggingSettings.logErrorNotification);
console.log(`Error creating log for ${ (LogErrorNotificationNum - 4) * -1 } times`);
console.log(`Error creating log for ${(LogErrorNotificationNum - 4) * -1} times`);

Check warning on line 42 in src/application/logging/LoggingThunk.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
if (LogErrorNotificationNum > 0) {
dispatch(
createNotificationThunk(
Expand All @@ -60,7 +60,7 @@ export const createLogThunk =
const state = getState();
const loggingSettings = applicationGetLoggingSettings(state);
let LogErrorNotificationNum = Number(loggingSettings.logErrorNotification);
console.log(`Error creating log for ${ (LogErrorNotificationNum - 4) * -1 } times`);
console.log(`Error creating log for ${(LogErrorNotificationNum - 4) * -1} times`);

Check warning on line 63 in src/application/logging/LoggingThunk.ts

View workflow job for this annotation

GitHub Actions / build-test (18.x)

Unexpected console statement
if (LogErrorNotificationNum > 0) {
dispatch(
createNotificationThunk(
Expand Down
4 changes: 2 additions & 2 deletions src/card/settings/CardSettingsContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import NeoCodeEditorComponent, {
import { getReportTypes } from '../../extensions/ExtensionUtils';
import { Dropdown } from '@neo4j-ndl/react';
import { EXTENSIONS_CARD_SETTINGS_COMPONENT } from '../../extensions/ExtensionConfig';
import { update } from '../../utils/ObjectManipulation';
import { objMerge } from '../../utils/ObjectManipulation';

const NeoCardSettingsContent = ({
pagenumber,
Expand Down Expand Up @@ -156,7 +156,7 @@ const NeoCardSettingsContent = ({
{report && report.settingsComponent ? (
<SettingsComponent
onReportSettingUpdate={onReportSettingUpdate}
settings={update({ helperText: report.helperText, inputMode: report.inputMode }, reportSettings)}
settings={objMerge({ helperText: report.helperText, inputMode: report.inputMode }, reportSettings)}
database={database}
query={query}
onQueryUpdate={onQueryUpdate}
Expand Down
58 changes: 28 additions & 30 deletions src/chart/bar/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ const NeoBarChart = (props: ChartProps) => {
if (legendPosition === 'Horizontal') {
// Calculate margin based on whether the legend is shown
return showLegend ? legendWidth * 0.3 + marginBottom + 50 : legendWidth * 0.3 + marginBottom;
}
// Return the default marginBottom if legendPosition is not 'Horizontal'
return marginBottom;

}
// Return the default marginBottom if legendPosition is not 'Horizontal'
return marginBottom;
}

// Using the function in your code
Expand Down Expand Up @@ -316,33 +315,32 @@ const NeoBarChart = (props: ChartProps) => {
],
},
];
}
// Vertical legend
return [
{
dataFrom: 'keys',
anchor: 'bottom-right',
direction: 'column',
justify: false,
translateX: legendWidth + 10,
translateY: 0,
itemsSpacing: 1,
itemWidth: legendWidth,
itemHeight: 20,
itemDirection: 'left-to-right',
itemOpacity: 0.85,
symbolSize: 15,
effects: [
{
on: 'hover',
style: {
itemOpacity: 1,
},
}
// Vertical legend
return [
{
dataFrom: 'keys',
anchor: 'bottom-right',
direction: 'column',
justify: false,
translateX: legendWidth + 10,
translateY: 0,
itemsSpacing: 1,
itemWidth: legendWidth,
itemHeight: 20,
itemDirection: 'left-to-right',
itemOpacity: 0.85,
symbolSize: 15,
effects: [
{
on: 'hover',
style: {
itemOpacity: 1,
},
],
},
];

},
],
},
];
};

// Height of each legend item
Expand Down
14 changes: 7 additions & 7 deletions src/chart/bar/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function getOriginalRecordForNivoClickEvent(e, records, selection) {
// TODO - rewrite this to be more optimal (using list comprehensions, etc.)
const usesGroups = Object.keys(e.data).length > 2;
const group = e.id;
const {value} = e;
const { value } = e;
const category = e.indexValue;

// Go through all records and find the first record `r` where the event's values match exactly.
Expand All @@ -34,12 +34,12 @@ export function getOriginalRecordForNivoClickEvent(e, records, selection) {
return dict;
}
} else if (recordCategory == category && recordValue == value) {
const dict = {};
for (const i in Object.keys(r._fieldLookup)) {
const key = Object.keys(r._fieldLookup)[i];
dict[key] = r._fields[r._fieldLookup[key]];
}
return dict;
const dict = {};
for (const i in Object.keys(r._fieldLookup)) {
const key = Object.keys(r._fieldLookup)[i];
dict[key] = r._fields[r._fieldLookup[key]];
}
return dict;
}
}
}
1 change: 1 addition & 0 deletions src/component/editor/CodeViewerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const NeoCodeViewerComponent = ({ value = '', placeholder = '' }) => {
paddingLeft: '10px',
background: 'none',
overflow: 'scroll !important',
marginTop: '5px',
border: '1px solid lightgray',
}}
className={'textinput-linenumbers'}
Expand Down
Loading

0 comments on commit e6d535a

Please sign in to comment.