show json icon in perspectives

This commit is contained in:
Jan Prochazka
2022-10-13 14:09:08 +02:00
parent 0028240552
commit 225518df3e
6 changed files with 24 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ import _isBoolean from 'lodash/isBoolean';
import _isArray from 'lodash/isArray';
import { safeJsonParse } from 'dbgate-tools';
export type PerspectiveDataPatternColumnType = 'null' | 'string' | 'number' | 'boolean' | 'json';
export type PerspectiveDataPatternColumnType = 'null' | 'oid' | 'string' | 'number' | 'boolean' | 'json';
export interface PerspectiveDataPatternColumn {
name: string;
@@ -29,6 +29,7 @@ function detectValueType(value): PerspectiveDataPatternColumnType {
if (_isString(value)) return 'string';
if (_isNumber(value)) return 'number';
if (_isBoolean(value)) return 'boolean';
if (value?.$oid) return 'oid';
if (_isPlainObject(value) || _isArray(value)) return 'json';
if (value == null) return 'null';
}