Merge branch 'master' into develop

This commit is contained in:
Jan Prochazka
2022-10-13 11:02:40 +02:00
15 changed files with 134 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { getAsImageSrc, safeJsonParse } from 'dbgate-tools';
import { isArray } from 'lodash';
import _ from 'lodash';
import CellValue from '../datagrid/CellValue.svelte';
import JSONTree from '../jsontree/JSONTree.svelte';
@@ -12,7 +12,7 @@
export let displayType;
</script>
<td rowspan={rowSpan} data-column={columnIndex} class:isEmpty={value===undefined}>
<td rowspan={rowSpan} data-column={columnIndex} class:isEmpty={value === undefined}>
{#if value !== undefined}
{#if displayType == 'json'}
<JSONTree value={safeJsonParse(value, value?.toString())} slicedKeyCount={1} disableContextMenu />
@@ -23,6 +23,8 @@
{:else}
<span class="null"> (no image)</span>
{/if}
{:else if _.isArray(value) || _.isPlainObject(value)}
<JSONTree {value} slicedKeyCount={1} disableContextMenu />
{:else}
<CellValue {rowData} {value} />
{/if}

View File

@@ -57,6 +57,7 @@
let errorMessage;
let rowCount;
let isLoading = false;
let isLoadQueued = false;
const lastVisibleRowIndexRef = createRef(0);
const disableLoadNextRef = createRef(false);
@@ -121,6 +122,12 @@
}
async function loadData(node: PerspectiveTreeNode, counts) {
if (isLoading) {
isLoadQueued = true;
return;
} else {
isLoadQueued = false;
}
// console.log('LOADING', node);
if (!node) return;
const rows = [];
@@ -147,6 +154,10 @@
// loadProps.push(child.getNodeLoadProps());
// }
// }
if (isLoadQueued) {
loadData(root, $loadedCounts);
}
}
export function openJson() {