From f8395496f1b0f3d344e0ce044be86739e8a227f7 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Sat, 12 Jul 2025 03:22:19 +0200 Subject: [PATCH 1/4] fix: handle invalid pointers in Views results --- src/dashboard/Data/Views/Views.react.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dashboard/Data/Views/Views.react.js b/src/dashboard/Data/Views/Views.react.js index 36b1c75eec..5dce4530a9 100644 --- a/src/dashboard/Data/Views/Views.react.js +++ b/src/dashboard/Data/Views/Views.react.js @@ -149,7 +149,11 @@ class Views extends TableView { if (val.__type === 'Date') { type = 'Date'; } else if (val.__type === 'Pointer') { - type = 'Pointer'; + if (val.className && val.objectId) { + type = 'Pointer'; + } else { + type = 'Object'; + } } else if (val.__type === 'File') { type = 'File'; } else if (val.__type === 'GeoPoint') { @@ -264,7 +268,11 @@ class Views extends TableView { if (value.__type === 'Date') { type = 'Date'; } else if (value.__type === 'Pointer') { - type = 'Pointer'; + if (value.className && value.objectId) { + type = 'Pointer'; + } else { + type = 'Object'; + } } else if (value.__type === 'File') { type = 'File'; } else if (value.__type === 'GeoPoint') { From 1859664d03002cb901202546ff440819e2fbcd40 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Sat, 12 Jul 2025 03:33:47 +0200 Subject: [PATCH 2/4] feat: add value viewer in views --- .../Data/Views/ViewValueDialog.react.js | 26 +++++++++++++++++++ src/dashboard/Data/Views/Views.react.js | 23 ++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/dashboard/Data/Views/ViewValueDialog.react.js diff --git a/src/dashboard/Data/Views/ViewValueDialog.react.js b/src/dashboard/Data/Views/ViewValueDialog.react.js new file mode 100644 index 0000000000..86ffa3ef61 --- /dev/null +++ b/src/dashboard/Data/Views/ViewValueDialog.react.js @@ -0,0 +1,26 @@ +import Field from 'components/Field/Field.react'; +import Label from 'components/Label/Label.react'; +import Modal from 'components/Modal/Modal.react'; +import React from 'react'; +import TextInput from 'components/TextInput/TextInput.react'; + +export default function ViewValueDialog({ value, onClose }) { + let stringValue; + if (typeof value === 'object' && value !== null) { + stringValue = JSON.stringify(value, null, 2); + } else { + stringValue = String(value); + } + return ( + + } input={} /> + + ); +} diff --git a/src/dashboard/Data/Views/Views.react.js b/src/dashboard/Data/Views/Views.react.js index 5dce4530a9..e267a2dbe5 100644 --- a/src/dashboard/Data/Views/Views.react.js +++ b/src/dashboard/Data/Views/Views.react.js @@ -12,6 +12,7 @@ import DragHandle from 'components/DragHandle/DragHandle.react'; import CreateViewDialog from './CreateViewDialog.react'; import EditViewDialog from './EditViewDialog.react'; import DeleteViewDialog from './DeleteViewDialog.react'; +import ViewValueDialog from './ViewValueDialog.react'; import BrowserMenu from 'components/BrowserMenu/BrowserMenu.react'; import MenuItem from 'components/BrowserMenu/MenuItem.react'; import Separator from 'components/BrowserMenu/Separator.react'; @@ -48,6 +49,7 @@ class Views extends TableView { lastError: null, lastNote: null, loading: false, + viewValue: null, }; this.headersRef = React.createRef(); this.noteTimeout = null; @@ -298,8 +300,14 @@ class Views extends TableView { } else { content = String(value); } + const isViewable = ['String', 'Number', 'Object'].includes(type); + const cellProps = {}; + if (isViewable) { + cellProps.onClick = () => this.handleValueClick(value); + cellProps.style = { cursor: 'pointer' }; + } return ( - + {content} ); @@ -443,7 +451,14 @@ class Views extends TableView { renderExtras() { let extras = null; - if (this.state.showCreate) { + if (this.state.viewValue !== null) { + extras = ( + this.setState({ viewValue: null })} + /> + ); + } else if (this.state.showCreate) { let classNames = []; if (this.props.schema?.data) { const classes = this.props.schema.data.get('classes'); @@ -542,6 +557,10 @@ class Views extends TableView { this.props.navigate(path); } + handleValueClick(value) { + this.setState({ viewValue: value }); + } + showNote(message, isError) { if (!message) { return; From b153daa1e2c151eb126680b1f5a27094cfc5749a Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Sat, 12 Jul 2025 03:49:26 +0200 Subject: [PATCH 3/4] fix: widen header resize handle --- src/dashboard/Data/Views/Views.react.js | 13 +++++++++---- src/dashboard/Data/Views/Views.scss | 12 +++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/dashboard/Data/Views/Views.react.js b/src/dashboard/Data/Views/Views.react.js index e267a2dbe5..0e371292d1 100644 --- a/src/dashboard/Data/Views/Views.react.js +++ b/src/dashboard/Data/Views/Views.react.js @@ -340,10 +340,15 @@ class Views extends TableView { renderHeaders() { return this.state.order.map(({ name, width }, i) => ( -
- {name} - this.handleResize(i, delta)} /> -
+ +
+ {name} +
+ this.handleResize(i, delta)} + /> +
)); } diff --git a/src/dashboard/Data/Views/Views.scss b/src/dashboard/Data/Views/Views.scss index 028832be21..a6495511e5 100644 --- a/src/dashboard/Data/Views/Views.scss +++ b/src/dashboard/Data/Views/Views.scss @@ -15,15 +15,21 @@ position: relative; white-space: nowrap; overflow: hidden; +} + +.headerLabel { + display: inline-block; + max-width: 100%; + overflow: hidden; text-overflow: ellipsis; } .handle { - position: absolute; - top: 0; - right: -4px; + position: relative; + display: inline-block; width: 8px; height: 30px; + margin: 0 -4px; cursor: ew-resize; } From 64c29ce47b6b7ffd2d43d095aa86401b10376455 Mon Sep 17 00:00:00 2001 From: Manuel Trezza <5673677+mtrezza@users.noreply.github.com> Date: Sat, 12 Jul 2025 03:50:06 +0200 Subject: [PATCH 4/4] Revert "fix: widen header resize handle" This reverts commit b153daa1e2c151eb126680b1f5a27094cfc5749a. --- src/dashboard/Data/Views/Views.react.js | 13 ++++--------- src/dashboard/Data/Views/Views.scss | 12 +++--------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/dashboard/Data/Views/Views.react.js b/src/dashboard/Data/Views/Views.react.js index 0e371292d1..e267a2dbe5 100644 --- a/src/dashboard/Data/Views/Views.react.js +++ b/src/dashboard/Data/Views/Views.react.js @@ -340,15 +340,10 @@ class Views extends TableView { renderHeaders() { return this.state.order.map(({ name, width }, i) => ( - -
- {name} -
- this.handleResize(i, delta)} - /> -
+
+ {name} + this.handleResize(i, delta)} /> +
)); } diff --git a/src/dashboard/Data/Views/Views.scss b/src/dashboard/Data/Views/Views.scss index a6495511e5..028832be21 100644 --- a/src/dashboard/Data/Views/Views.scss +++ b/src/dashboard/Data/Views/Views.scss @@ -15,21 +15,15 @@ position: relative; white-space: nowrap; overflow: hidden; -} - -.headerLabel { - display: inline-block; - max-width: 100%; - overflow: hidden; text-overflow: ellipsis; } .handle { - position: relative; - display: inline-block; + position: absolute; + top: 0; + right: -4px; width: 8px; height: 30px; - margin: 0 -4px; cursor: ew-resize; }