From 47864a100799d121bd4f9a41f9a660efc119b76b Mon Sep 17 00:00:00 2001 From: Phil Eaton Date: Thu, 9 Sep 2021 11:44:00 -0400 Subject: [PATCH] Fix for new project deserialization and panel editing (#42) * More fixes * Fixes to update panel * Force running to be false on load * Update readme * Update install instructions --- README.md | 9 +++------ shared/state.ts | 9 ++++++--- ui/Panels.tsx | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 434b9edf4..db3954450 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,10 @@ scripting, and visualization in a single platform. ![A screenshot of app.datastation.multiprocess.io](./screenshot.png) -## Major Features +## Features * Cross-platform: Windows, macOS, and Linux -* Query SQLite, PostgreSQL- and MySQL-compatible databases +* Query SQLite, SQL Server PostgreSQL- and MySQL-compatible databases * With builtin support for proxying over SSH * Query HTTP servers * With builtin support for proxying over SSH @@ -21,10 +21,7 @@ scripting, and visualization in a single platform. ## Install -Zip files for the latest release provided on the -[releases](https://github.com/multiprocessio/datastation/releases) -page. x86-64 builds for Mac and Windows are available. In the future -this will expand to ARM and Linux. +Install instructions are available [on the website here](https://datastation.multiprocess.io/docs/installation.html). ## Documentation diff --git a/shared/state.ts b/shared/state.ts index c480540af..d822c2611 100644 --- a/shared/state.ts +++ b/shared/state.ts @@ -33,10 +33,9 @@ export class PanelResultMeta extends PanelResult { } static fromJSON(raw: any): PanelResultMeta { + raw = raw || {}; + raw.loading = false; const prm = mergeDeep(new PanelResultMeta(), raw); - if (!raw) { - return prm; - } prm.lastRun = typeof raw.lastRun === 'string' ? new Date(raw.lastRun) @@ -105,6 +104,7 @@ export class ConnectorInfo { } static fromJSON(raw: any): ConnectorInfo { + raw = raw || {}; const ci = mergeDeep(new ConnectorInfo(), raw); switch (raw.type) { @@ -224,6 +224,7 @@ export class PanelInfo { } static fromJSON(raw: any): PanelInfo { + raw = raw || {}; let pit: PanelInfo = mergeDeep(new PanelInfo(raw.type || 'literal'), raw); switch (pit.type) { @@ -401,6 +402,7 @@ export class ProjectPage { } static fromJSON(raw: any): ProjectPage { + raw = raw || {}; const pp = new ProjectPage(); pp.panels = (raw.panels || []).map(PanelInfo.fromJSON); pp.name = raw.name; @@ -436,6 +438,7 @@ export class ProjectState { } static fromJSON(raw: any): ProjectState { + raw = raw || {}; const ps = new ProjectState(); ps.projectName = raw.projectName || ''; ps.pages = (raw.pages || []).map(ProjectPage.fromJSON); diff --git a/ui/Panels.tsx b/ui/Panels.tsx index 588bbef89..196343807 100644 --- a/ui/Panels.tsx +++ b/ui/Panels.tsx @@ -33,8 +33,9 @@ export function Panels({ updatePage(page); } - function updatePanel(page: ProjectPage, panelId: string, panelIndex: number) { + function updatePanel(page: ProjectPage, panelId: string) { return (panel: PanelInfo) => { + const panelIndex = page.panels.findIndex((p) => p.id === panelId); page.panels[panelIndex] = panel; updatePage(page); reevalPanel(panelId, true); @@ -66,9 +67,8 @@ export function Panels({ {page.panels.map((panel, panelIndex) => (