Merge branch 'master' into develop

This commit is contained in:
Jan Prochazka
2021-10-17 11:15:40 +02:00
8 changed files with 58 additions and 20 deletions

View File

@@ -1,3 +1,6 @@
import _ from 'lodash';
import { arrayToHexString } from 'dbgate-tools';
export function copyTextToClipboard(text) {
const oldFocus = document.activeElement;
@@ -58,3 +61,13 @@ export function copyTextToClipboard(text) {
if (oldFocus) oldFocus.focus();
}
export function extractRowCopiedValue(row, col) {
let value = row[col];
if (value === undefined) value = _.get(row, col);
if (value === null) return '(NULL)';
if (value === undefined) return '(NoField)';
if (value.type == 'Buffer' && _.isArray(value.data)) return arrayToHexString(value.data);
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value);
return value;
}