mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/devel' into devel
This commit is contained in:
@@ -46,6 +46,7 @@ export class ConnectionDialogsService {
|
||||
order: 2,
|
||||
title: 'app_shared_connectionMenu_disconnect',
|
||||
onClick: () => this.connectionsManagerService.closeAllConnections(),
|
||||
isDisabled: () => !this.connectionsManagerService.hasAnyConnection(true),
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -83,7 +83,10 @@ export class ConnectionsManagerService {
|
||||
await this.afterConnectionClose(id);
|
||||
}
|
||||
|
||||
hasAnyConnection(): boolean {
|
||||
hasAnyConnection(connected?: boolean): boolean {
|
||||
if (connected) {
|
||||
return Array.from(this.connectionInfo.data.values()).some(connection => connection.connected);
|
||||
}
|
||||
return !!Array.from(this.connectionInfo.data.values()).length;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ export class AgGridTableController implements IInitializableController, IDestruc
|
||||
|
||||
this.subscriptions.push(gridModel.tableDataModel.onRowsUpdate.subscribe(this.updateRows.bind(this)));
|
||||
this.subscriptions.push(gridModel.tableEditor.onRowsUpdate.subscribe(this.updateRows.bind(this)));
|
||||
this.subscriptions.push(gridModel.tableEditor.onCancelChanges.subscribe(this.cancelEditing.bind(this)));
|
||||
this.subscriptions.push(gridModel.onChunkSizeChange.subscribe(this.changeChunkSize.bind(this)));
|
||||
this.subscriptions.push(gridModel.onReset.subscribe(this.resetData.bind(this)));
|
||||
}
|
||||
@@ -165,6 +166,12 @@ export class AgGridTableController implements IInitializableController, IDestruc
|
||||
return this.gridModel.isCellEdited(rowIndex, column);
|
||||
}
|
||||
|
||||
private cancelEditing() {
|
||||
if (this.api) {
|
||||
this.api.stopEditing(true);
|
||||
}
|
||||
}
|
||||
|
||||
private updateRows(rows: number[]) {
|
||||
if (this.api) {
|
||||
const updatedRows: RowNode[] = [];
|
||||
|
||||
@@ -18,13 +18,17 @@ import { TableRow, SomeTableRows } from './TableRow';
|
||||
*/
|
||||
export class TableEditor {
|
||||
readonly onRowsUpdate: Observable<number[]>
|
||||
readonly onCancelChanges: Observable<null>
|
||||
|
||||
@observable private editedRows = new Map<number, EditedRow>();
|
||||
private rowsUpdateSubject: Subject<number[]>
|
||||
private cancelChangesSubject: Subject<null>
|
||||
|
||||
constructor(private dataModel: TableDataModel) {
|
||||
this.rowsUpdateSubject = new Subject();
|
||||
this.cancelChangesSubject = new Subject();
|
||||
this.onRowsUpdate = this.rowsUpdateSubject.asObservable();
|
||||
this.onCancelChanges = this.cancelChangesSubject.asObservable();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,6 +124,7 @@ export class TableEditor {
|
||||
const rows = Array.from(this.editedRows.keys());
|
||||
this.editedRows.clear();
|
||||
if (!skipUpdate) {
|
||||
this.cancelChangesSubject.next(null);
|
||||
this.rowsUpdateSubject.next(rows);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user