diff --git a/docs/antora.yml b/docs/antora.yml index 57a496f89..d06c4b663 100644 --- a/docs/antora.yml +++ b/docs/antora.yml @@ -1,6 +1,6 @@ name: neodash version: 2.2 -title: NeoDash Documentation +title: NeoDash start_page: ROOT:index.adoc nav: - modules/ROOT/nav.adoc diff --git a/docs/preview.yml b/docs/preview.yml index 58b34b401..ed1a8f02e 100644 --- a/docs/preview.yml +++ b/docs/preview.yml @@ -1,5 +1,5 @@ site: - title: NeoDash Documentation + title: NeoDash content: sources: diff --git a/src/card/Card.tsx b/src/card/Card.tsx index 1552bec3a..aad4a02a3 100644 --- a/src/card/Card.tsx +++ b/src/card/Card.tsx @@ -9,7 +9,6 @@ import { updateSelectionThunk, updateReportQueryThunk, toggleCardSettingsThunk, - updateReportRefreshRateThunk, updateReportSettingThunk, updateReportTitleThunk, updateReportTypeThunk, @@ -47,7 +46,6 @@ const NeoCard = ({ onTypeUpdate, // action to take when the card report type is updated. onFieldsUpdate, // action to take when the set of returned query fields is updated. onQueryUpdate, // action to take when the card query is updated. - onRefreshRateUpdate, // action to take when the card refresh rate is updated. onReportSettingUpdate, // action to take when an advanced report setting is updated. onSelectionUpdate, // action to take when the selected visualization fields are updated. onGlobalParameterUpdate, // action to take when a report updates a dashboard parameter. @@ -138,7 +136,6 @@ const NeoCard = ({ query={report.query} globalParameters={globalParameters} fields={report.fields ? report.fields : []} - refreshRate={report.refreshRate} selection={report.selection} widthPx={width} heightPx={height} @@ -170,7 +167,6 @@ const NeoCard = ({ heightPx={height} fields={report.fields} type={report.type} - refreshRate={report.refreshRate} expanded={expanded} extensions={extensions} dashboardSettings={dashboardSettings} @@ -179,7 +175,6 @@ const NeoCard = ({ reportSettings={report.settings} reportSettingsOpen={report.advancedSettingsOpen} onQueryUpdate={(query) => onQueryUpdate(index, query)} - onRefreshRateUpdate={(rate) => onRefreshRateUpdate(index, rate)} onDatabaseChanged={(database) => onDatabaseChanged(index, database)} onReportSettingUpdate={(setting, value) => onReportSettingUpdate(index, setting, value)} onTypeUpdate={(type) => onTypeUpdate(index, type)} @@ -237,9 +232,6 @@ const mapDispatchToProps = (dispatch) => ({ onQueryUpdate: (index: any, query: any) => { dispatch(updateReportQueryThunk(index, query)); }, - onRefreshRateUpdate: (index: any, rate: any) => { - dispatch(updateReportRefreshRateThunk(index, rate)); - }, onTypeUpdate: (index: any, type: any) => { dispatch(updateReportTypeThunk(index, type)); }, diff --git a/src/card/CardActions.ts b/src/card/CardActions.ts index 28e2c20f4..3b3828878 100644 --- a/src/card/CardActions.ts +++ b/src/card/CardActions.ts @@ -32,12 +32,6 @@ export const updateReportQuery = (pagenumber: number, index: number, query: any) payload: { pagenumber, index, query }, }); -export const UPDATE_REPORT_REFRESH_RATE = 'PAGE/CARD/UPDATE_REPORT_REFRESH_RATE'; -export const updateReportRefreshRate = (pagenumber: number, index: number, rate: any) => ({ - type: UPDATE_REPORT_REFRESH_RATE, - payload: { pagenumber, index, rate }, -}); - export const UPDATE_CYPHER_PARAMETERS = 'PAGE/CARD/UPDATE_CYPHER_PARAMETERS'; export const updateCypherParameters = (pagenumber: number, index: number, parameters: any) => ({ type: UPDATE_CYPHER_PARAMETERS, diff --git a/src/card/CardReducer.ts b/src/card/CardReducer.ts index 8623503cd..acbe99818 100644 --- a/src/card/CardReducer.ts +++ b/src/card/CardReducer.ts @@ -6,7 +6,6 @@ import { UPDATE_CYPHER_PARAMETERS, UPDATE_FIELDS, UPDATE_REPORT_QUERY, - UPDATE_REPORT_REFRESH_RATE, UPDATE_REPORT_SETTING, UPDATE_REPORT_SIZE, UPDATE_REPORT_TITLE, @@ -61,12 +60,6 @@ export const cardReducer = (state = CARD_INITIAL_STATE, action: { type: any; pay state = update(state, { query: query }); return state; } - case UPDATE_REPORT_REFRESH_RATE: { - const { rate } = payload; - - state = update(state, { refreshRate: rate }); - return state; - } case UPDATE_CYPHER_PARAMETERS: { const { parameters } = payload; state = update(state, { parameters: parameters }); diff --git a/src/card/CardThunks.ts b/src/card/CardThunks.ts index 68d9f827e..342e6a2f6 100644 --- a/src/card/CardThunks.ts +++ b/src/card/CardThunks.ts @@ -2,8 +2,6 @@ import { updateReportTitle, updateReportQuery, updateSelection, - updateReportSize, - updateReportRefreshRate, updateCypherParameters, updateFields, updateReportType, @@ -52,17 +50,6 @@ export const updateReportQueryThunk = (index, query) => (dispatch: any, getState } }; -// TODO: make refresh rate an advanced setting -export const updateReportRefreshRateThunk = (index, rate) => (dispatch: any, getState: any) => { - try { - const state = getState(); - const { pagenumber } = state.dashboard.settings; - dispatch(updateReportRefreshRate(pagenumber, index, rate)); - } catch (e) { - dispatch(createNotificationThunk('Cannot update refresh rate', e)); - } -}; - export const updateCypherParametersThunk = (index, parameters) => (dispatch: any, getState: any) => { try { const state = getState(); diff --git a/src/card/settings/CardSettings.tsx b/src/card/settings/CardSettings.tsx index d00f83a07..92100b579 100644 --- a/src/card/settings/CardSettings.tsx +++ b/src/card/settings/CardSettings.tsx @@ -11,7 +11,6 @@ const NeoCardSettings = ({ query, database, // Current database related to the report databaseList, // List of databases the user can choose from ('system' is filtered out) - refreshRate, width, height, type, @@ -21,7 +20,6 @@ const NeoCardSettings = ({ heightPx, extensions, // A set of enabled extensions. onQueryUpdate, - onRefreshRateUpdate, onDatabaseChanged, // When the database related to a report is changed it must be stored in the report state onRemovePressed, onClonePressed, @@ -57,7 +55,6 @@ const NeoCardSettings = ({ ) : ( diff --git a/src/card/settings/CardSettingsContent.tsx b/src/card/settings/CardSettingsContent.tsx index ee098bf1b..129ca0e81 100644 --- a/src/card/settings/CardSettingsContent.tsx +++ b/src/card/settings/CardSettingsContent.tsx @@ -12,11 +12,9 @@ const NeoCardSettingsContent = ({ database, // Current report database databaseList, // List of databases the user can choose from ('system' is filtered out) reportSettings, - refreshRate, type, extensions, onQueryUpdate, - onRefreshRateUpdate, onReportSettingUpdate, onTypeUpdate, onDatabaseChanged, // When the database related to a report is changed it must be stored in the report state @@ -25,9 +23,6 @@ const NeoCardSettingsContent = ({ const [queryText, setQueryText] = React.useState(query); const debouncedQueryUpdate = useCallback(debounce(onQueryUpdate, 250), []); - const [refreshRateText, setRefreshRateText] = React.useState(refreshRate); - const debouncedRefreshRateUpdate = useCallback(debounce(onRefreshRateUpdate, 250), []); - // State to manage the current database entry inside the form const [databaseText, setDatabaseText] = React.useState(database); const debouncedDatabaseUpdate = useCallback(debounce(onDatabaseChanged, 250), []); @@ -39,13 +34,6 @@ const NeoCardSettingsContent = ({ } }, [query]); - useEffect(() => { - // Reset text to the dashboard state when the page gets reorganized. - if (refreshRate !== refreshRateText) { - setRefreshRateText(refreshRate !== undefined ? refreshRate : ''); - } - }, [refreshRate]); - const reportTypes = getReportTypes(extensions); const SettingsComponent = reportTypes[type] && reportTypes[type].settingsComponent; @@ -64,13 +52,13 @@ const NeoCardSettingsContent = ({ ))} /> - {reportTypes[type] && reportTypes[type].disableRefreshRate == undefined ? ( + {reportTypes[type] && reportTypes[type].disableDatabaseSelector == undefined ? ( ( {database} @@ -85,22 +73,6 @@ const NeoCardSettingsContent = ({ <> )} - {reportTypes[type] && reportTypes[type].disableRefreshRate == undefined ? ( - { - setRefreshRateText(value); - debouncedRefreshRateUpdate(value); - }} - /> - ) : ( - <> - )} -

{/* Allow for overriding the code box with a custom component */} diff --git a/src/card/view/CardView.tsx b/src/card/view/CardView.tsx index f1c53ad04..872c9a6ea 100644 --- a/src/card/view/CardView.tsx +++ b/src/card/view/CardView.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { ReportItemContainer } from '../CardStyle'; import NeoCardViewHeader from './CardViewHeader'; import NeoCardViewFooter from './CardViewFooter'; @@ -8,7 +8,6 @@ import NeoCodeEditorComponent from '../../component/editor/CodeEditorComponent'; import PlayCircleFilledIcon from '@material-ui/icons/PlayCircleFilled'; import { CARD_FOOTER_HEIGHT, CARD_HEADER_HEIGHT } from '../../config/CardConfig'; -import { downloadComponentAsImage } from '../../chart/ChartUtils'; import { getReportTypes } from '../../extensions/ExtensionUtils'; import NeoCodeViewerComponent from '../../component/editor/CodeViewerComponent'; @@ -29,7 +28,6 @@ const NeoCardView = ({ dashboardSettings, settings, settingsOpen, - refreshRate, editable, onGlobalParameterUpdate, onSelectionUpdate, @@ -42,11 +40,12 @@ const NeoCardView = ({ const reportHeight = heightPx - CARD_FOOTER_HEIGHT - CARD_HEADER_HEIGHT + 13; const cardHeight = heightPx - CARD_FOOTER_HEIGHT; const ref = React.useRef(); + const [lastRunTimestamp, setLastRunTimestamp] = useState(Date.now()); const getLocalParameters = (parse_string): any => { let re = /(?:^|\W)\$(\w+)(?!\w)/g; - let match; - let localQueryVariables: string[] = []; + let match; + let localQueryVariables: string[] = []; while ((match = re.exec(parse_string))) { localQueryVariables.push(match[1]); } @@ -65,10 +64,12 @@ const NeoCardView = ({ title={title} editable={editable} description={settings.description} - fullscreenEnabled={dashboardSettings.fullscreenEnabled} - downloadImageEnabled={dashboardSettings.downloadImageEnabled} + fullscreenEnabled={settings.fullscreenEnabled} + downloadImageEnabled={settings.downloadImageEnabled} + refreshButtonEnabled={settings.refreshButtonEnabled} onTitleUpdate={onTitleUpdate} onToggleCardSettings={onToggleCardSettings} + onManualRefreshCard={() => setLastRunTimestamp(Date.now())} settings={settings} onDownloadImage={onDownloadImage} onToggleCardExpand={onToggleCardExpand} @@ -115,6 +116,13 @@ const NeoCardView = ({ ) ); + const localParameters = getLocalParameters(query); + useEffect(() => { + if (!settingsOpen) { + setLastRunTimestamp(Date.now()); + } + }, [settingsOpen, query, JSON.stringify(localParameters)]); + // TODO - understand why CardContent is throwing a warning based on this style config. const cardContentStyle = { paddingBottom: '0px', @@ -139,7 +147,8 @@ const NeoCardView = ({ ); + const refreshButton = ( + + + + + + ); + const maximizeButton = ( @@ -174,6 +185,7 @@ const NeoCardViewHeader = ({ {downloadImageEnabled ? downloadImageButton : <>} {fullscreenEnabled ? expanded ? unMaximizeButton : maximizeButton : <>} {descriptionEnabled ? descriptionButton : <>} + {refreshButtonEnabled ? refreshButton : <>} {editable ? settingsButton : <>} } diff --git a/src/chart/line/LineChart.tsx b/src/chart/line/LineChart.tsx index 6f069ab6a..ab7def714 100644 --- a/src/chart/line/LineChart.tsx +++ b/src/chart/line/LineChart.tsx @@ -4,10 +4,6 @@ import { NoDrawableDataErrorMessage } from '../../component/editor/CodeViewerCom import { evaluateRulesOnDict } from '../../extensions/styling/StyleRuleEvaluator'; import { ChartProps } from '../Chart'; import { convertRecordObjectToString, recordToNative } from '../ChartUtils'; -import { ResponsiveSunburst } from '@nivo/sunburst'; -import { useState } from 'react'; -import { Tooltip } from '@material-ui/core'; -import RefreshIcon from '@material-ui/icons/Refresh'; interface LineChartData { id: string; diff --git a/src/config/DashboardConfig.ts b/src/config/DashboardConfig.ts index a18e24292..7aee60f6e 100644 --- a/src/config/DashboardConfig.ts +++ b/src/config/DashboardConfig.ts @@ -9,26 +9,18 @@ export const DASHBOARD_SETTINGS = { helperText: 'This controls whether users can edit your dashboard. Disable this to turn the dashboard into presentation mode.', }, - fullscreenEnabled: { - label: 'Enable Fullscreen Report Views', - type: SELECTION_TYPES.LIST, - values: [true, false], - default: true, - helperText: "Show a 'fullscreen view' button for each report, letting users expand a visualization.", + queryTimeLimit: { + label: 'Maximum Query Time (seconds)', + type: SELECTION_TYPES.NUMBER, + default: 20, + helperText: 'The maximum time a report is allowed to run before automatically aborted.', }, downloadImageEnabled: { label: 'Enable Image Download', type: SELECTION_TYPES.LIST, values: [true, false], default: false, - helperText: - "Enables a 'download image' button for each report, letting users download a visualization as an image.", - }, - queryTimeLimit: { - label: 'Maximum Query Time (seconds)', - type: SELECTION_TYPES.NUMBER, - default: 20, - helperText: 'The maximum time a report is allowed to run before automatically aborted.', + helperText: 'Shows a button in the dashboard header that lets users capture their dashboard as an image.', }, disableRowLimiting: { label: 'Disable Row Limiting ⚠️', diff --git a/src/config/ReportConfig.tsx b/src/config/ReportConfig.tsx index 1d5927a3a..381c42f7a 100644 --- a/src/config/ReportConfig.tsx +++ b/src/config/ReportConfig.tsx @@ -52,12 +52,35 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -206,6 +229,24 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, @@ -213,9 +254,14 @@ export const REPORT_TYPES = { default: true, }, iconStyle: { - label: 'Icon Style on format { label : url}', + label: 'Node Label images', type: SELECTION_TYPES.TEXT, - default: '', + default: '{label : url}', + }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', }, description: { label: 'Report Description', @@ -360,12 +406,35 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -501,12 +570,35 @@ export const REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 40, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -665,12 +757,35 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -773,12 +888,35 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -819,12 +957,35 @@ export const REPORT_TYPES = { values: ['bottom', 'middle', 'top'], default: 'top', }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -844,12 +1005,35 @@ export const REPORT_TYPES = { type: SELECTION_TYPES.COLOR, default: '#fafafa', }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -863,7 +1047,6 @@ export const REPORT_TYPES = { 'This report will let users interactively select Cypher parameters that are available globally, in all reports. A parameter can either be a node property, relationship property, or a free text field.', component: NeoParameterSelectionChart, settingsComponent: NeoCardSettingsContentPropertySelect, - disableRefreshRate: true, disableCypherParameters: true, textOnly: true, maxRecords: 100, @@ -928,6 +1111,12 @@ export const REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 1000, }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -940,6 +1129,7 @@ export const REPORT_TYPES = { helperText: 'iFrame reports let you embed external webpages into your dashboard. Enter an URL in the query box above to embed it as an iFrame.', textOnly: true, // this makes sure that no query is executed, input of the report gets passed directly to the renderer. + disableDatabaseSelector: true, component: NeoIFrameChart, inputMode: 'url', maxRecords: 1, @@ -962,6 +1152,12 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -975,6 +1171,7 @@ export const REPORT_TYPES = { component: NeoMarkdownChart, inputMode: 'markdown', textOnly: true, // this makes sure that no query is executed, input of the report gets passed directly to the renderer. + disableDatabaseSelector: true, maxRecords: 1, allowScrolling: true, settings: { @@ -989,6 +1186,18 @@ export const REPORT_TYPES = { values: [true, false], default: false, }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, diff --git a/src/extensions/advancedcharts/AdvancedChartsReportConfig.tsx b/src/extensions/advancedcharts/AdvancedChartsReportConfig.tsx index d4121dfc6..a0d9dccda 100644 --- a/src/extensions/advancedcharts/AdvancedChartsReportConfig.tsx +++ b/src/extensions/advancedcharts/AdvancedChartsReportConfig.tsx @@ -87,6 +87,40 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 40, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + autorun: { + label: 'Auto-run query', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: true, + }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, + description: { + label: 'Report Description', + type: SELECTION_TYPES.MULTILINE_TEXT, + default: 'Enter markdown here...', + }, }, }, sunburst: { @@ -180,12 +214,35 @@ export const ADVANCED_REPORT_TYPES = { values: [true, false], default: true, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -268,12 +325,35 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 40, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -350,12 +430,35 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 40, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -463,12 +566,35 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 18, }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -552,12 +678,6 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.NUMBER, default: 40, }, - autorun: { - label: 'Auto-run Query', - type: SELECTION_TYPES.LIST, - values: [true, false], - default: true, - }, projectionScale: { label: 'Projection Scale', type: SELECTION_TYPES.NUMBER, @@ -578,6 +698,35 @@ export const ADVANCED_REPORT_TYPES = { type: SELECTION_TYPES.TEXT, default: 'properties.name', }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + autorun: { + label: 'Auto-run query', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: true, + }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, description: { label: 'Report Description', type: SELECTION_TYPES.MULTILINE_TEXT, @@ -714,12 +863,40 @@ export const ADVANCED_REPORT_TYPES = { values: ['basicClosed', 'cardinalClosed', 'catmullRomClosed', 'linearClosed'], default: 'linearClosed', }, + refreshButtonEnabled: { + label: 'Refreshable', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + fullscreenEnabled: { + label: 'Fullscreen enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, + downloadImageEnabled: { + label: 'Download Image enabled', + type: SELECTION_TYPES.LIST, + values: [true, false], + default: false, + }, autorun: { label: 'Auto-run query', type: SELECTION_TYPES.LIST, values: [true, false], default: true, }, + refreshRate: { + label: 'Refresh rate (seconds)', + type: SELECTION_TYPES.NUMBER, + default: '0 (No refresh)', + }, + description: { + label: 'Report Description', + type: SELECTION_TYPES.MULTILINE_TEXT, + default: 'Enter markdown here...', + }, }, }, }; diff --git a/src/report/Report.tsx b/src/report/Report.tsx index e820e1647..07bac0e4e 100644 --- a/src/report/Report.tsx +++ b/src/report/Report.tsx @@ -18,6 +18,7 @@ import { SELECTION_TYPES } from '../config/CardConfig'; export const NeoReport = ({ database = 'neo4j', // The Neo4j database to run queries onto. query = '', // The Cypher query used to populate the report. + lastRunTimestamp = 0, // Timestamp of the last query run for this report. parameters = {}, // A dictionary of parameters to pass into the query. disabled = false, // Whether to disable query execution. selection = {}, // A selection of return fields to send to the report. @@ -27,10 +28,9 @@ export const NeoReport = ({ fields = f; }, // The callback to update the set of query fields after query execution. setGlobalParameter = () => {}, // callback to update global (dashboard) parameters. - getGlobalParameter = () => { + getGlobalParameter = (_: string) => { return ''; }, // function to get global (cypher) parameters. - refreshRate = 0, // Optionally refresh the report every X seconds. dimensions = { width: 300, height: 300 }, // Size of the report in pixels. rowLimit = DEFAULT_ROW_LIMIT, // The maximum number of records to render. queryTimeLimit = 20, // Time limit for queries before automatically aborted. @@ -134,16 +134,16 @@ export const NeoReport = ({ } populateReport(); // If a refresh rate was specified, set up an interval for re-running the report. (max 24 hrs) - if (refreshRate && refreshRate > 0) { + if (settings.refreshRate && settings.refreshRate > 0) { // @ts-ignore setTimer( setInterval(() => { populateReport(false); - }, Math.min(refreshRate, 86400) * 1000.0) + }, Math.min(settings.refreshRate, 86400) * 1000.0) ); } } - }, [disabled, query, JSON.stringify(parameters)]); + }, [lastRunTimestamp]); // Define query callback to allow reports to get extra data on interactions. const queryCallback = useCallback((query, parameters, setRecords) => { diff --git a/webpack.config.js b/webpack.config.js index 7ead570c2..1c542a5d1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -43,6 +43,6 @@ module.exports = (env) => { port: 3000, hot: true, }, - plugins: production ? [] : [new webpack.HotModuleReplacementPlugin()] + plugins: production ? [] : [new webpack.HotModuleReplacementPlugin()], }; };