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

Fix bug where whitespace was not preserved in result #1439

Merged
merged 1 commit into from
Jun 29, 2021
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
2 changes: 1 addition & 1 deletion src/browser/components/ClickableUrls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const URL_REGEX = /(?:https?|s?ftp|bolt):\/\/(?:(?:[^\s()<>]+|\((?:[^\s()<>]+|(?

interface ClickableUrlsProps {
text?: string | null
WrappingTag?: keyof JSX.IntrinsicElements
WrappingTag?: keyof JSX.IntrinsicElements | React.ElementType
}

export default function ClickableUrls({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ exports[`RelatableViews RelatableView does not display bodyMessage if rows, and
class="relatable__table-cell relatable__table-body-cell"
role="cell"
>
<span>
<span
class="sc-hEsumM cPMQJb"
>
"String with HTML &lt;strong&gt;in&lt;/strong&gt; it"
</span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ export const StyledJsonPre = styled.pre`
max-width: 500px;
white-space: pre-wrap;
`

export const StyledPreSpan = styled.span`
white-space: pre;
`
15 changes: 10 additions & 5 deletions src/browser/modules/Stream/CypherFrame/relatable-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ import { stringModifier } from 'services/bolt/cypherTypesFormatting'
import ClickableUrls from '../../../components/ClickableUrls'
import { StyledStatsBar, StyledTruncatedMessage } from '../styled'
import Ellipsis from '../../../components/Ellipsis'
import { RelatableStyleWrapper, StyledJsonPre } from './relatable-view.styled'
import {
RelatableStyleWrapper,
StyledJsonPre,
StyledPreSpan
} from './relatable-view.styled'
import { stringifyMod, unescapeDoubleQuotesForDisplay } from 'services/utils'
import { GlobalState } from 'shared/globalState'

Expand Down Expand Up @@ -93,12 +97,12 @@ function CypherCell({ cell }: any) {
const renderCell = (entry: any) => {
if (Array.isArray(entry)) {
const children = entry.map((item, index) => (
<span key={index}>
<StyledPreSpan key={index}>
{renderCell(item)}
{index === entry.length - 1 ? null : ', '}
</span>
</StyledPreSpan>
))
return <span>[{children}]</span>
return <StyledPreSpan>[{children}]</StyledPreSpan>
} else if (typeof entry === 'object') {
return renderObject(entry)
} else {
Expand All @@ -107,6 +111,7 @@ const renderCell = (entry: any) => {
text={unescapeDoubleQuotesForDisplay(
stringifyMod(entry, stringModifier, true)
)}
WrappingTag={StyledPreSpan}
/>
)
}
Expand All @@ -119,7 +124,7 @@ const renderObject = (entry: any) => {
text={unescapeDoubleQuotesForDisplay(
stringifyMod(entry, stringModifier, true)
)}
WrappingTag={StyledJsonPre as any}
WrappingTag={StyledJsonPre}
/>
)
}
Expand Down
72 changes: 36 additions & 36 deletions src/browser/modules/Stream/__snapshots__/SchemaFrame.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@ exports[`SchemaFrame renders empty 1`] = `
class="sc-eXEjpC gPTqCq"
>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameIndexesTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Indexes
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
None
</td>
</tr>
</tbody>
</table>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameConstraintsTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Constraints
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
None
</td>
Expand Down Expand Up @@ -92,97 +92,97 @@ exports[`SchemaFrame renders empty for Neo4j >= 4.0 1`] = `
class="sc-eXEjpC gPTqCq"
>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameIndexesTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Index Name
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Type
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Uniqueness
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
EntityType
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
LabelsOrTypes
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Properties
</th>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
State
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
None
</td>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
/>
</tr>
</tbody>
</table>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameConstraintsTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Constraints
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
None
</td>
Expand Down Expand Up @@ -222,49 +222,49 @@ exports[`SchemaFrame renders results for Neo4j < 4.0 1`] = `
class="sc-eXEjpC gPTqCq"
>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameIndexesTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Indexes
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
ON :Movie(released) ONLINE
</td>
</tr>
</tbody>
</table>
<table
class="sc-ecaExY pzTAf"
class="sc-gbzWSY eHhwcy"
data-testid="schemaFrameConstraintsTable"
>
<thead>
<tr>
<th
class="sc-jqIZGH dcsmCY table-header"
class="sc-jMMfwr cZHnqC table-header"
>
Constraints
</th>
</tr>
</thead>
<tbody>
<tr
class="sc-gbzWSY gkTicA table-row"
class="sc-jqIZGH cbOGkC table-row"
>
<td
class="sc-jMMfwr igisOH table-properties"
class="sc-jGxEUC hTSKjw table-properties"
>
ON ( book:Book ) ASSERT book.isbn IS UNIQUE
</td>
Expand Down