revert row changes, delete - for all selected rows

This commit is contained in:
Jan Prochazka
2020-03-29 13:16:58 +02:00
parent 50bf392e4a
commit 54d3f8383a
4 changed files with 33 additions and 13 deletions

View File

@@ -194,7 +194,9 @@ export function changeSetToSql(changeSet: ChangeSet): Command[] {
}
export function revertChangeSetRowChanges(changeSet: ChangeSet, definition: ChangeSetRowDefinition): ChangeSet {
console.log('definition', definition)
const [field, item] = findExistingChangeSetItem(changeSet, definition);
console.log('field, item', field, item)
if (item)
return {
...changeSet,

View File

@@ -371,21 +371,19 @@ export abstract class GridDisplay {
if (!this.baseTable) return null;
if (this.baseTable.pureName != col.pureName || this.baseTable.schemaName != col.schemaName) return null;
return {
pureName: col.pureName,
schemaName: col.schemaName,
...this.getChangeSetRow(row, insertedRowIndex),
uniqueName: uniqueName,
columnName: col.columnName,
insertedRowIndex,
condition: insertedRowIndex == null ? this.getChangeSetCondition(row) : null,
};
}
getChangeSetRow(row): ChangeSetRowDefinition {
getChangeSetRow(row, insertedRowIndex): ChangeSetRowDefinition {
if (!this.baseTable) return null;
return {
pureName: this.baseTable.pureName,
schemaName: this.baseTable.schemaName,
condition: this.getChangeSetCondition(row),
insertedRowIndex,
condition: insertedRowIndex == null ? this.getChangeSetCondition(row) : null,
};
}
}