mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 17:46:00 +00:00
precise work with mongoid
This commit is contained in:
@@ -124,6 +124,8 @@
|
||||
{:else}
|
||||
<span class="null">({value.data.length} bytes)</span>
|
||||
{/if}
|
||||
{:else if value.$oid}
|
||||
<span class="value">ObjectId("{value.$oid}")</span>
|
||||
{:else if _.isPlainObject(value)}
|
||||
<span class="null" title={JSON.stringify(value, undefined, 2)}>(JSON)</span>
|
||||
{:else if _.isArray(value)}
|
||||
|
||||
@@ -67,6 +67,7 @@ export function countColumnSizes(grider: Grider, columns, containerWidth, displa
|
||||
const value = row[uqName];
|
||||
let text = value;
|
||||
if (_.isArray(value)) text = `[${value.length} items]`;
|
||||
else if (value?.$oid) text = `ObjectId("${value.$oid}")`;
|
||||
const width = context.measureText(text).width + 8;
|
||||
// console.log('colName', colName, text, width);
|
||||
columnSizes.putSizeOverride(colIndex, width);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
showModal(EditJsonModal, {
|
||||
json: rowData,
|
||||
onSave: value => {
|
||||
if (value._id != rowData._id) {
|
||||
if (rowData._id && value._id != rowData._id) {
|
||||
showModal(ErrorMessageModal, { message: '_id attribute cannot be changed' });
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ export function extractRowCopiedValue(row, col) {
|
||||
if (value === undefined) value = _.get(row, col);
|
||||
if (value === null) return '(NULL)';
|
||||
if (value === undefined) return '(NoField)';
|
||||
if (value && value.$oid) return `ObjectId("${value.$oid}")`;
|
||||
if (value && value.type == 'Buffer' && _.isArray(value.data)) return arrayToHexString(value.data);
|
||||
if (_.isPlainObject(value) || _.isArray(value)) return JSON.stringify(value);
|
||||
return value;
|
||||
|
||||
Reference in New Issue
Block a user