File tree Expand file tree Collapse file tree
extensions/ql-vscode/src/view Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as React from "react" ;
2+ import { styled } from "styled-components" ;
3+ import { formatDecimal } from "../../common/number" ;
4+
5+ const RightAlignedSpan = styled . span `
6+ display: inline-block;
7+ text-align: right;
8+ width: 100%;
9+ ` ;
10+
11+ type Props = {
12+ value : number ;
13+ } ;
14+
15+ export const RawNumberValue = ( { value } : Props ) => {
16+ return < RightAlignedSpan > { formatDecimal ( value ) } </ RightAlignedSpan > ;
17+ } ;
Original file line number Diff line number Diff line change @@ -2,29 +2,34 @@ import * as React from "react";
22
33import { Location } from "./locations/Location" ;
44import { CellValue } from "../../common/bqrs-cli-types" ;
5+ import { RawNumberValue } from "../common/RawNumberValue" ;
56
67interface Props {
78 value : CellValue ;
89 databaseUri : string ;
910 onSelected ?: ( ) => void ;
1011}
1112
12- export default function RawTableValue ( props : Props ) : JSX . Element {
13- const rawValue = props . value ;
14- if (
15- typeof rawValue === "string" ||
16- typeof rawValue === "number" ||
17- typeof rawValue === "boolean"
18- ) {
19- return < Location label = { rawValue . toString ( ) } /> ;
13+ export default function RawTableValue ( {
14+ value,
15+ databaseUri,
16+ onSelected,
17+ } : Props ) : JSX . Element {
18+ switch ( typeof value ) {
19+ case "boolean" :
20+ return < span > { value . toString ( ) } </ span > ;
21+ case "number" :
22+ return < RawNumberValue value = { value } /> ;
23+ case "string" :
24+ return < Location label = { value . toString ( ) } /> ;
25+ default :
26+ return (
27+ < Location
28+ loc = { value . url }
29+ label = { value . label }
30+ databaseUri = { databaseUri }
31+ onClick = { onSelected }
32+ />
33+ ) ;
2034 }
21-
22- return (
23- < Location
24- loc = { rawValue . url }
25- label = { rawValue . label }
26- databaseUri = { props . databaseUri }
27- onClick = { props . onSelected }
28- />
29- ) ;
3035}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { tryGetRemoteLocation } from "../../common/bqrs-utils";
1111import TextButton from "../common/TextButton" ;
1212import { convertNonPrintableChars } from "../../common/text-utils" ;
1313import { sendTelemetry , useTelemetryOnChange } from "../common/telemetry" ;
14+ import { RawNumberValue } from "../common/RawNumberValue" ;
1415
1516const numOfResultsInContractedMode = 5 ;
1617
@@ -50,9 +51,11 @@ const sendRawResultsLinkTelemetry = () => sendTelemetry("raw-results-link");
5051
5152const Cell = ( { value, fileLinkPrefix, sourceLocationPrefix } : CellProps ) => {
5253 switch ( typeof value ) {
53- case "string" :
54- case "number" :
5554 case "boolean" :
55+ return < span > { value . toString ( ) } </ span > ;
56+ case "number" :
57+ return < RawNumberValue value = { value } /> ;
58+ case "string" :
5659 return < span > { convertNonPrintableChars ( value . toString ( ) ) } </ span > ;
5760 case "object" : {
5861 const url = tryGetRemoteLocation (
You can’t perform that action at this time.
0 commit comments