mirror of
https://github.com/beekeeper-studio/beekeeper-studio.git
synced 2026-03-13 10:12:54 +08:00
fix some possible bugs
This commit is contained in:
@@ -1142,8 +1142,8 @@
|
||||
}
|
||||
this.editingResult = true;
|
||||
},
|
||||
saveChanges() {
|
||||
this.$refs.table.saveChanges();
|
||||
async saveChanges() {
|
||||
await this.$refs.table.saveChanges();
|
||||
this.editingResult = false;
|
||||
},
|
||||
copyToSql() {
|
||||
@@ -1333,7 +1333,6 @@
|
||||
this.error = null
|
||||
this.queryForExecution = rawQuery
|
||||
this.results = []
|
||||
this.resultsEditable = []
|
||||
this.resultsEditData = []
|
||||
this.selectedResult = 0
|
||||
let identification = []
|
||||
@@ -1404,7 +1403,6 @@
|
||||
}
|
||||
})
|
||||
this.results = Object.freeze(results);
|
||||
this.resultsEditable = this.results.map(() => false)
|
||||
this.resultsEditData = this.results.map(() => null)
|
||||
|
||||
// const defaultResult = Math.max(results.length - 1, 0)
|
||||
|
||||
@@ -140,9 +140,6 @@ import { format } from 'sql-formatter'
|
||||
queryDialect() {
|
||||
return this.dialectData?.queryDialectOverride ?? this.dialect;
|
||||
},
|
||||
allPks() {
|
||||
return this.editData.entries().filter(([_id, editData]) => editData?.isPk).map(([id]) => id);
|
||||
},
|
||||
keymap() {
|
||||
return this.$vHotkeyKeymap({
|
||||
'queryEditor.copyResultSelection': this.copySelection.bind(this),
|
||||
@@ -357,7 +354,7 @@ import { format } from 'sql-formatter'
|
||||
cellEdited(cell: CellComponent) {
|
||||
// Should this be id?
|
||||
const field: FieldDescriptor = this.result.fields.find((f) => f.id === cell.getField());
|
||||
const fieldEditData: FieldEditData = this.editData?.get(field.id);
|
||||
const fieldEditData: FieldEditData = this.editData?.get(cell.getField());
|
||||
if (!field) {
|
||||
log.warn('Could not find matching field for', cell.getField());
|
||||
return;
|
||||
@@ -480,8 +477,8 @@ import { format } from 'sql-formatter'
|
||||
},
|
||||
discardUpdate(pendingUpdate: TableUpdatePayload) {
|
||||
this.discardCellUpdate(pendingUpdate.cell, pendingUpdate.oldValue)
|
||||
const cells = this.propogatedChanges.get(pendingUpdate.key)
|
||||
cells?.forEach((cell) => {
|
||||
const cells = this.propogatedChanges?.get(pendingUpdate.key)
|
||||
cells?.forEach((cell: CellComponent) => {
|
||||
this.discardCellUpdate(cell, pendingUpdate.oldValue)
|
||||
});
|
||||
},
|
||||
@@ -562,8 +559,8 @@ import { format } from 'sql-formatter'
|
||||
this.pendingChanges.updates.forEach((edit: TableUpdatePayload) => {
|
||||
edit.cell.getElement().classList.add('edit-error')
|
||||
|
||||
const cells = this.propogatedChanges.get(edit.key)
|
||||
cells.forEach((cell: CellComponent) => {
|
||||
const cells = this.propogatedChanges?.get(edit.key)
|
||||
cells?.forEach((cell: CellComponent) => {
|
||||
cell.getElement().classList.add('edit-error')
|
||||
})
|
||||
});
|
||||
@@ -613,8 +610,8 @@ import { format } from 'sql-formatter'
|
||||
this.pendingChanges.updates.forEach((edit: TableUpdatePayload) => {
|
||||
edit.cell.getElement().classList.add('edit-error')
|
||||
|
||||
const cells = this.propogatedChanges.get(edit.key)
|
||||
cells.forEach((cell: CellComponent) => {
|
||||
const cells = this.propogatedChanges?.get(edit.key)
|
||||
cells?.forEach((cell: CellComponent) => {
|
||||
cell.getElement().classList.add('edit-error')
|
||||
})
|
||||
});
|
||||
|
||||
@@ -864,14 +864,16 @@ export abstract class BasicDatabaseClient<RawResultType extends BaseQueryResult,
|
||||
});
|
||||
} else {
|
||||
const table = tableData.find((t) => this.matchesTable(c, t));
|
||||
table.columns.forEach((col) => {
|
||||
columns.push({
|
||||
name: col.columnName,
|
||||
table: c.table,
|
||||
schema: c.schema,
|
||||
isWildcard: false
|
||||
if (table && table.columns) {
|
||||
table.columns.forEach((col) => {
|
||||
columns.push({
|
||||
name: col.columnName,
|
||||
table: c.table,
|
||||
schema: c.schema,
|
||||
isWildcard: false
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
columns.push(c);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DatabaseElement, IBasicDatabaseClient } from "../db/types";
|
||||
import Vue from 'vue';
|
||||
import { CancelableQuery, DatabaseFilterOptions, ExtendedTableColumn, FilterOptions, NgQueryResult, OrderBy, PrimaryKeyColumn, Routine, SchemaFilterOptions, SupportedFeatures, TableChanges, TableFilter, TableColumn, TableIndex, TableOrView, TablePartition, TableResult, TableProperties, StreamResults, TableInsert, TableTrigger, ImportFuncOptions, FieldDescriptor } from "../db/models";
|
||||
import { CancelableQuery, DatabaseFilterOptions, ExtendedTableColumn, FilterOptions, NgQueryResult, OrderBy, PrimaryKeyColumn, Routine, SchemaFilterOptions, SupportedFeatures, TableChanges, TableFilter, TableColumn, TableIndex, TableOrView, TablePartition, TableResult, TableProperties, StreamResults, TableInsert, TableTrigger, ImportFuncOptions, FieldDescriptor, FieldEditData } from "../db/models";
|
||||
import { AlterPartitionsSpec, AlterTableSpec, CreateTableSpec, IndexAlterations, RelationAlterations, TableKey } from "@shared/lib/dialects/models";
|
||||
import { IConnection } from "@/common/interfaces/IConnection";
|
||||
|
||||
@@ -98,7 +98,7 @@ export class ElectronUtilityConnectionClient implements IBasicDatabaseClient {
|
||||
}
|
||||
}
|
||||
|
||||
async getResultEditData(queryText: string, fields: FieldDescriptor[]): Promise<FieldDescriptor[]> {
|
||||
async getResultEditData(queryText: string, fields: FieldDescriptor[]): Promise<FieldEditData[]> {
|
||||
return await Vue.prototype.$util.send('conn/getResultEditData', { queryText, fields });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user