diff --git a/packages/datalib/src/GridDisplay.ts b/packages/datalib/src/GridDisplay.ts
index 27bb2e007..b56ae30a4 100644
--- a/packages/datalib/src/GridDisplay.ts
+++ b/packages/datalib/src/GridDisplay.ts
@@ -294,6 +294,20 @@ export abstract class GridDisplay {
this.reload();
}
+ showFilter(uniqueName) {
+ this.setConfig(cfg => {
+ if (!cfg.filters.uniqueName)
+ return {
+ ...cfg,
+ filters: {
+ ..._.omitBy(cfg.filters, v => !v),
+ [uniqueName]: '',
+ },
+ };
+ return cfg;
+ });
+ }
+
removeFilter(uniqueName) {
this.setConfig(cfg => ({
...cfg,
@@ -547,4 +561,11 @@ export abstract class GridDisplay {
formViewKeyRequested: null,
}));
}
+
+ switchToJsonView() {
+ this.setConfig(cfg => ({
+ ...cfg,
+ isJsonView: true,
+ }));
+ }
}
diff --git a/packages/web/src/datagrid/CollectionDataGridCore.svelte b/packages/web/src/datagrid/CollectionDataGridCore.svelte
index 90c26e366..e2ef2d4da 100644
--- a/packages/web/src/datagrid/CollectionDataGridCore.svelte
+++ b/packages/web/src/datagrid/CollectionDataGridCore.svelte
@@ -1,5 +1,5 @@
@@ -23,6 +24,6 @@
{#each display
?.getColumns(filter)
?.filter(column => filterName(filter, column.columnName)) || [] as column (column.uniqueName)}
-
+
{/each}
diff --git a/packages/web/src/datagrid/ColumnManagerRow.svelte b/packages/web/src/datagrid/ColumnManagerRow.svelte
index 86ceb0fe9..caf4e4391 100644
--- a/packages/web/src/datagrid/ColumnManagerRow.svelte
+++ b/packages/web/src/datagrid/ColumnManagerRow.svelte
@@ -6,6 +6,7 @@
export let column;
export let display;
+ export let isJsonView = false;
{
// @ts-ignore
if (e.target.closest('.expandColumnIcon')) return;
- display.focusColumn(column.uniqueName);
+ if (isJsonView) display.showFilter(column.uniqueName);
+ else display.focusColumn(column.uniqueName);
}}
>
-
+
display.toggleExpandedColumn(column.uniqueName)}
/>
- display.setColumnVisibility(column.uniquePath, !column.isChecked)}
- />
+ {#if isJsonView}
+
+ {:else}
+ display.setColumnVisibility(column.uniquePath, !column.isChecked)}
+ />
+ {/if}
diff --git a/packages/web/src/datagrid/DataGrid.svelte b/packages/web/src/datagrid/DataGrid.svelte
index 234a70cec..bf1f0d785 100644
--- a/packages/web/src/datagrid/DataGrid.svelte
+++ b/packages/web/src/datagrid/DataGrid.svelte
@@ -29,7 +29,8 @@
export let config;
export let gridCoreComponent;
- export let formViewComponent;
+ export let formViewComponent = null;
+ export let jsonViewComponent = null;
export let formDisplay;
export let display;
export let changeSetState;
@@ -55,6 +56,7 @@
let managerSize;
$: isFormView = !!(formDisplay && formDisplay.config && formDisplay.config.isFormView);
+ $: isJsonView = !!config.isJsonView;
const handleExecuteMacro = () => {
onRunMacro($selectedMacro, extractMacroValuesForMacro($macroValues, $selectedMacro), selectedCellsPublished());
@@ -83,7 +85,7 @@
height={showReferences ? '40%' : '60%'}
skip={freeTableColumn || isFormView}
>
-
+
@@ -118,11 +120,14 @@
{#if isFormView}
+ {:else if isJsonView}
+
{:else}
getCurrentDataGrid().switchToForm(),
});
+ registerCommand({
+ id: 'dataGrid.switchToJson',
+ category: 'Data grid',
+ name: 'Switch to JSON',
+ keyText: 'F4',
+ testEnabled: () => getCurrentDataGrid()?.jsonViewEnabled(),
+ onClick: () => getCurrentDataGrid().switchToJson(),
+ });
+
registerCommand({
id: 'dataGrid.filterSelected',
category: 'Data grid',
@@ -265,6 +274,7 @@
export let onOpenQuery = null;
export let onOpenActiveChart = null;
export let formViewAvailable = false;
+ export let jsonViewAvailable=false;
export let errorMessage = undefined;
export let isLoadedAll;
@@ -409,12 +419,20 @@
return formViewAvailable && display.baseTable && display.baseTable.primaryKey;
}
+ export function jsonViewEnabled() {
+ return jsonViewAvailable;
+ }
+
export function switchToForm() {
const cell = currentCell;
const rowData = isRegularCell(cell) ? grider.getRowData(cell[0]) : null;
display.switchToFormView(rowData);
}
+ export function switchToJson() {
+ display.switchToJsonView();
+ }
+
export function filterSelectedValue() {
const flts = {};
for (const cell of selectedCells) {
@@ -1009,6 +1027,7 @@
{ command: 'dataGrid.copyToClipboard' },
{ command: 'dataGrid.export' },
{ command: 'dataGrid.switchToForm' },
+ { command: 'dataGrid.switchToJson' },
{ divider: true },
{ command: 'dataGrid.save' },
{ command: 'dataGrid.revertRowChanges' },
diff --git a/packages/web/src/elements/Pager.svelte b/packages/web/src/elements/Pager.svelte
new file mode 100644
index 000000000..4b8fae4fd
--- /dev/null
+++ b/packages/web/src/elements/Pager.svelte
@@ -0,0 +1,58 @@
+
+
+
+ {
+ skip -= limit;
+ if (skip < 0) skip = 0;
+ dispatch('load');
+ }}
+ >
+
+
+ Start:
+ dispatch('load')} on:keydown={handleKeyDown} />
+ Rows:
+ dispatch('load')} on:keydown={handleKeyDown} />
+ {
+ skip += limit;
+ dispatch('load');
+ }}
+ >
+
+
+
+
+
diff --git a/packages/web/src/jsontree/JSONTree.svelte b/packages/web/src/jsontree/JSONTree.svelte
index 2c56e06cb..d90515938 100644
--- a/packages/web/src/jsontree/JSONTree.svelte
+++ b/packages/web/src/jsontree/JSONTree.svelte
@@ -5,8 +5,8 @@
setContext(contextKey, {});
- export let key = '',
- value;
+ export let key = '';
+ export let value;
diff --git a/packages/web/src/jsonview/CollectionJsonView.svelte b/packages/web/src/jsonview/CollectionJsonView.svelte
new file mode 100644
index 000000000..eabc115d5
--- /dev/null
+++ b/packages/web/src/jsonview/CollectionJsonView.svelte
@@ -0,0 +1,66 @@
+
+
+
+
+{#if isLoading}
+
+{/if}
+
+
diff --git a/packages/web/src/tabs/CollectionDataTab.svelte b/packages/web/src/tabs/CollectionDataTab.svelte
index 9dedcfbbc..5149eee5c 100644
--- a/packages/web/src/tabs/CollectionDataTab.svelte
+++ b/packages/web/src/tabs/CollectionDataTab.svelte
@@ -21,6 +21,7 @@
import CollectionDataGridCore from '../datagrid/CollectionDataGridCore.svelte';
import { useCollectionInfo, useConnectionInfo } from '../utility/metadataLoaders';
import { extensions } from '../stores';
+ import CollectionJsonView from '../jsonview/CollectionJsonView.svelte';
export let tabid;
export let conid;
@@ -72,5 +73,6 @@
{changeSetStore}
{dispatchChangeSet}
gridCoreComponent={CollectionDataGridCore}
+ jsonViewComponent={CollectionJsonView}
isDynamicStructure
/>