view data improvements

This commit is contained in:
Jan Prochazka
2021-12-09 10:10:58 +01:00
parent 4958c49147
commit 014274f4c6
5 changed files with 31 additions and 21 deletions

View File

@@ -52,7 +52,7 @@ export default class ChangeSetGrider extends Grider {
) {
super();
this.changeSet = changeSetState && changeSetState.value;
this.insertedRows = getChangeSetInsertedRows(this.changeSet, display?.baseTableOrCollection);
this.insertedRows = getChangeSetInsertedRows(this.changeSet, display?.baseTableOrSimilar);
this.setChangeSet = value => dispatchChangeSet({ type: 'set', value });
this.rowCacheIndexes = new Set();
this.rowDataCache = {};
@@ -169,7 +169,7 @@ export default class ChangeSetGrider extends Grider {
get rowCountInUpdate() {
if (this.batchChangeSet) {
const newRows = getChangeSetInsertedRows(this.batchChangeSet, this.display.baseTable);
const newRows = getChangeSetInsertedRows(this.batchChangeSet, this.display.baseTableOrSimilar);
return this.sourceRows.length + newRows.length;
} else {
return this.rowCount;
@@ -178,13 +178,13 @@ export default class ChangeSetGrider extends Grider {
insertRow(): number {
const res = this.rowCountInUpdate;
this.applyModification(chs => changeSetInsertNewRow(chs, this.display.baseTableOrCollection));
this.applyModification(chs => changeSetInsertNewRow(chs, this.display.baseTableOrSimilar));
return res;
}
insertDocuments(documents: any[]): number {
const res = this.rowCountInUpdate;
this.applyModification(chs => changeSetInsertDocuments(chs, documents, this.display.baseTableOrCollection));
this.applyModification(chs => changeSetInsertDocuments(chs, documents, this.display.baseTableOrSimilar));
return res;
}

View File

@@ -758,15 +758,18 @@
// $: console.log('DISPLAY.config', display.config);
$: {
if (display?.groupColumns && display?.baseTable) {
if (display?.groupColumns && display?.baseTableOrSimilar && onReferenceClick) {
onReferenceClick({
referenceId: stableStringify(display && display.groupColumns),
schemaName: display.baseTable.schemaName,
pureName: display.baseTable.pureName,
schemaName: display.baseTableOrSimilar?.schemaName,
pureName: display.baseTableOrSimilar?.pureName,
columns: display.groupColumns.map(col => ({
baseName: col,
refName: col,
dataType: _.get(display.baseTable && display.baseTable.columns.find(x => x.columnName == col), 'dataType'),
dataType: _.get(
display.baseTableOrView?.columns?.find(x => x.columnName == col),
'dataType'
),
})),
});
}

View File

@@ -68,7 +68,6 @@
return parseInt(response.data.rows[0].count);
}
</script>
<script lang="ts">
@@ -128,7 +127,7 @@
initialValues.sourceConnectionId = conid;
initialValues.sourceDatabaseName = database;
initialValues.sourceSql = display.getExportQuery();
initialValues.sourceList = display.baseTable ? [display.baseTable.pureName] : [];
initialValues.sourceList = display.baseTableOrSimilar ? [display.baseTableOrSimilar.pureName] : [];
showModal(ImportExportModal, { initialValues });
}
@@ -139,8 +138,8 @@
icon: 'img sql-file',
tabComponent: 'QueryTab',
props: {
schemaName: display.baseTable.schemaName,
pureName: display.baseTable.pureName,
schemaName: display.baseTableOrSimilar?.schemaName,
pureName: display.baseTableOrSimilar?.pureName,
conid,
database,
},
@@ -198,7 +197,6 @@
},
{ command: 'sqlDataGrid.export', tag: 'export' }
);
</script>
<LoadingDataGridCore