Skip to content

Commit

Permalink
Merge pull request #65 from mercedes-benz/VULCAN-381/ExecuteButtonBug
Browse files Browse the repository at this point in the history
Vulcan 381/Execute button bug
  • Loading branch information
devarajanmurugesan authored Oct 20, 2023
2 parents 9fd233b + 1f3baa1 commit 90c29a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const NeoCard = ({
extensions, // A set of enabled extensions.
globalParameters, // Query parameters that are globally set for the entire dashboard.
dashboardSettings, // Dictionary of settings for the entire dashboard.
enableExecuteButtonForIds, // Reports will have save buttons to execute cypher queries
onRemovePressed, // action to take when the card is removed. (passed from parent)
onClonePressed, // action to take when user presses the clone button
onReportHelpButtonPressed, // action to take when someone clicks the 'help' button in the report settings.
Expand Down Expand Up @@ -108,7 +107,7 @@ const NeoCard = ({
const onHandleMinimize = () => {
onPutItem(report);
};

useEffect(() => {
if (!report.settingsOpen) {
setActive(report.settings && report.settings.autorun !== undefined ? report.settings.autorun : true);
Expand Down Expand Up @@ -146,7 +145,6 @@ const NeoCard = ({
settingsOpen={settingsOpen}
editable={editable}
dashboardSettings={dashboardSettings}
enableExecuteButtonForIds={enableExecuteButtonForIds}
extensions={extensions}
settings={report.settings ? report.settings : {}}
updateReportSetting={(name, value) => onReportSettingUpdate(id, name, value)}
Expand Down
13 changes: 7 additions & 6 deletions src/card/view/CardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const NeoCardView = ({
type,
selection,
dashboardSettings,
enableExecuteButtonForIds = [],
settings,
updateReportSetting,
createNotification,
Expand Down Expand Up @@ -79,6 +78,13 @@ const NeoCardView = ({
);
};

// Reset the report if hideQueryEditorInAutoRunOnMode is enabled
useEffect(() => {
if (!settings?.autorun && settings?.hideQueryEditorInAutoRunOnMode) {
setActive(false);
}
}, [JSON.stringify(globalParameters)]);

// @ts-ignore
const reportHeader = (
<NeoCardViewHeader
Expand Down Expand Up @@ -130,11 +136,6 @@ const NeoCardView = ({
if (!settingsOpen) {
setLastRunTimestamp(Date.now());
}

// Resets the report with save button
if (enableExecuteButtonForIds.map((report) => report.id).includes(id)) {
setActive(false);
}
}, [JSON.stringify(localParameters)]);

useEffect(() => {
Expand Down
3 changes: 0 additions & 3 deletions src/page/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ export const NeoPage = ({
const notGroupReports = reports.filter((report: any) => !report.groupId);
const filteredReports = reports.filter((report: any) => report.groupId); // Filter only reports with groupId

const enableExecuteButtonForIds = reports.filter((report: any) => report.settings?.hideQueryEditorInAutoRunOnMode);

const availableHandles = () => {
if (dashboardSettings.resizing && dashboardSettings.resizing == 'all') {
return ['s', 'w', 'e', 'sw', 'se'];
Expand Down Expand Up @@ -288,7 +286,6 @@ export const NeoPage = ({
<NeoCard
id={id}
key={getReportKey(pagenumber, id)}
enableExecuteButtonForIds={enableExecuteButtonForIds}
dashboardSettings={dashboardSettings}
onRemovePressed={onRemovePressed}
onPutItem={onPutItem}
Expand Down

0 comments on commit 90c29a4

Please sign in to comment.