Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint Release 025 #111

Merged
merged 6 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@
border: none !important;
}

.MuiBox-root {
line-height: normal;
}

.MuiDataGrid-footerContainer > div {
margin-top: -40px;
}
Expand Down Expand Up @@ -129,8 +133,8 @@
}

.MuiCard-root {
box-shadow: 0 0 #0000,0 0 #0000,var(--tw-shadow) !important;
box-shadow: var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow) !important;
box-shadow: 0 0 #0000, 0 0 #0000, var(--tw-shadow) !important;
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important;
}

.white-text {
Expand Down Expand Up @@ -183,7 +187,6 @@
text-align: center;
}


.card-view.expanded {
position: absolute;
top: 0;
Expand Down Expand Up @@ -213,24 +216,23 @@

.card-view .MuiTablePagination-root {
margin-top: -40px;

}

@keyframes pulse {
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
}
0% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
}

70% {
transform: scale(1);
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
}
70% {
transform: scale(1);
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
}

100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}
100% {
transform: scale(0.95);
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
}
}

/* Workaround for Needle not handling menu placement of dropdowns on modals */
Expand All @@ -242,10 +244,10 @@
/* End workaround */

/* Workaround for cleaning the Gantt chart UI */
.gantt-wrapper > div > div:first-child > div:first-child > div:first-child > div> div:not(:first-child) {
.gantt-wrapper > div > div:first-child > div:first-child > div:first-child > div > div:not(:first-child) {
display: none;
}
.gantt-wrapper > div > div > div > div> div> div> div:not(:first-child) {
.gantt-wrapper > div > div > div > div > div > div > div:not(:first-child) {
display: none;
}
/* End Gantt chart workaround */
16 changes: 6 additions & 10 deletions src/card/view/CardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import React, { useEffect, useState } from 'react';
import { ReportItemContainer } from '../CardStyle';
import NeoCardViewHeader from './CardViewHeader';
import NeoCardViewFooter from './CardViewFooter';
import { CardContent, Fab } from '@mui/material';
import { CardContent } from '@mui/material';
import NeoCodeEditorComponent from '../../component/editor/CodeEditorComponent';
import { CARD_FOOTER_HEIGHT, CARD_HEADER_HEIGHT } from '../../config/CardConfig';
import { getReportTypes } from '../../extensions/ExtensionUtils';
import NeoCodeViewerComponent from '../../component/editor/CodeViewerComponent';
import { NeoReportWrapper } from '../../report/ReportWrapper';
import { identifyStyleRuleParameters } from '../../extensions/styling/StyleRuleEvaluator';
import { IconButton } from '@neo4j-ndl/react';
import { PlayCircleIconSolid } from '@neo4j-ndl/react/icons';
import { Button, IconButton } from '@neo4j-ndl/react';
import { PlayCircleIconSolid, PlayIconSolid } from '@neo4j-ndl/react/icons';
import { extensionEnabled } from '../../utils/ReportUtils';
import { PlayArrowOutlined } from '@mui/icons-material';
import { checkParametersNameInGlobalParameter, extractAllParameterNames } from '../../utils/parameterUtils';
import { objMerge } from '../../utils/ObjectManipulation';
import { REPORT_TYPES } from '../../config/ReportConfig';
Expand Down Expand Up @@ -203,18 +202,15 @@ const NeoCardView = ({

const executeButton = (
<div style={{ display: 'flex', justifyContent: 'center' }}>
<Fab
variant='extended'
<Button
disabled={isParametersDefined(query)}
onClick={() => {
setActive(true);
}}
color='success'
size='small'
>
<PlayArrowOutlined aria-label={'play'} />
{settings.executeButtonName ?? 'Execute'}
</Fab>
<PlayIconSolid className='btn-icon-base-r' />
</Button>
</div>
);

Expand Down
4 changes: 2 additions & 2 deletions src/component/groupreport/GroupReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export default function GroupReport({
onClonePressed,
}) {
return groupedReports[groupId].length > 0 ? (
<Box display='grid' gridTemplateColumns='repeat(12, 1fr)' columnGap={1} sx={getBorderSpecsForGroupId(groupId)}>
<Box display='grid' gridTemplateColumns='repeat(24, 1fr)' columnGap={1} sx={getBorderSpecsForGroupId(groupId)}>
{groupedReports[groupId]
.sort((a: any, b: any) => a.groupOrder - b.groupOrder)
.map((report: { id: any; width: any; height: any }) => {
const { id, width: w, height: h } = report;
return (
<Box id={id} gridColumn={`span ${w}`} gridRow={`span ${h}`} sx={{ height: h * 210, paddingBottom: '15px' }}>
<Box id={id} gridColumn={`span ${w}`} gridRow={`span ${h}`} sx={{ height: h * 100, paddingBottom: '15px' }}>
<NeoCard
id={id}
key={getReportKey(pagenumber, id)}
Expand Down
10 changes: 10 additions & 0 deletions src/config/ReportConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ const _REPORT_TYPES = {
type: SELECTION_TYPES.TEXT,
default: 'View Response',
},
disableParameterCheck: {
type: SELECTION_TYPES.LIST,
values: [true, false],
default: true,
},
},
},
graph: {
Expand Down Expand Up @@ -390,6 +395,11 @@ const _REPORT_TYPES = {
type: SELECTION_TYPES.TEXT,
default: 'Query returned no data.',
},
disableParameterCheck: {
type: SELECTION_TYPES.LIST,
values: [true, false],
default: false,
},
},
},
bar: {
Expand Down
11 changes: 10 additions & 1 deletion src/extensions/forms/chart/NeoForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { REPORT_LOADING_ICON } from '../../../report/Report';
import debounce from 'lodash/debounce';
import { RUN_QUERY_DELAY_MS } from '../../../config/ReportConfig';
import NeoParameterSelectionChart from '../../../chart/parameter/ParameterSelectionChart';
import { checkParametersNameInGlobalParameter, extractAllParameterNames } from '../../../utils/parameterUtils';

enum FormStatus {
DATA_ENTRY, // The user is filling in the form.
Expand Down Expand Up @@ -42,6 +43,14 @@ const NeoForm = (props: ChartProps) => {
});
}

const isParametersDefined = (cypherQuery: string | undefined) => {
const parameterNames = extractAllParameterNames(cypherQuery);
if (props.parameters) {
return checkParametersNameInGlobalParameter(parameterNames, props.parameters);
}
return false;
};

useEffect(() => {
// If the parameters change after the form is completed, reset it, as there might be another submission.
if (status == FormStatus.SUBMITTED) {
Expand Down Expand Up @@ -77,7 +86,7 @@ const NeoForm = (props: ChartProps) => {
<Button
style={{ marginLeft: 15 }}
id='form-submit'
disabled={!submitButtonActive}
disabled={!submitButtonActive || isParametersDefined(props.query)}
onClick={() => {
if (!props.query || !props.query.trim()) {
props.createNotification(
Expand Down
8 changes: 5 additions & 3 deletions src/report/Report.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ export const NeoReport = ({
const debouncedRunCypherQuery = useCallback(debounce(runCypherQuery, RUN_QUERY_DELAY_MS), []);

const isQueryParametersDefined = (cypherQuery: string) => {
const parameterNames = extractAllParameterNames(cypherQuery);
if (parameters) {
return checkParametersNameInGlobalParameter(parameterNames, parameters);
if (!settings?.disableParameterCheck) {
const parameterNames = extractAllParameterNames(cypherQuery);
if (parameters) {
return checkParametersNameInGlobalParameter(parameterNames, parameters);
}
}
return false;
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/parameterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const extractAllParameterNames = (cypherQuery) => {

export const checkParametersNameInGlobalParameter = (parameterNames: string[], globalParameterNames: any): boolean => {
for (const key of parameterNames) {
if (typeof globalParameterNames[key] === 'undefined' || globalParameterNames[key] === null || globalParameterNames[key] === '') {
if (!globalParameterNames[key] || (Array.isArray(globalParameterNames[key]) && globalParameterNames[key].length === 0) || globalParameterNames[key] === '') {
return true;
}
}
Expand Down
Loading