mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix: some flaws
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ import { createExtension, isExtension, IExtension } from '../../../../extensions
|
||||
const connectionProviderSymbol = Symbol('@extension/ConnectionProvider');
|
||||
|
||||
export interface IConnectionProvider<T = never> {
|
||||
(context: T): string;
|
||||
(context: T): string | undefined;
|
||||
}
|
||||
|
||||
export function connectionProvider<T>(provider: IConnectionProvider<T>) {
|
||||
|
||||
@@ -113,7 +113,7 @@ export class NodesManagerService {
|
||||
|
||||
const { objectInfo } = await this.graphQLService.gql.queryDatabaseObjectInfo({
|
||||
nodeId,
|
||||
filter: { features: ['viewable', 'editPossible'] },
|
||||
// filter: { features: ['viewable', 'editPossible'] },
|
||||
});
|
||||
|
||||
const info = { ...objectInfo.object, id: objectInfo.id };
|
||||
@@ -142,7 +142,7 @@ export class NodesManagerService {
|
||||
childrenDatabaseObjectInfo,
|
||||
} = await this.graphQLService.gql.queryChildrenDatabaseObjectInfo({
|
||||
nodePath: nodeId,
|
||||
filter: { features: ['viewable', 'editPossible'] }, // filter properties for view
|
||||
// filter: { features: ['viewable', 'editPossible'] }, // filter properties for view
|
||||
});
|
||||
|
||||
const children = childrenDatabaseObjectInfo.map(children => ({
|
||||
|
||||
@@ -81,7 +81,12 @@ export class DataViewerTabService {
|
||||
}
|
||||
}
|
||||
|
||||
private handleTabSelect(tab: ITab<IObjectViewerTabState>) {
|
||||
private async handleTabSelect(tab: ITab<IObjectViewerTabState>) {
|
||||
const objectInfo = await this.nodesManagerService.loadDatabaseObjectInfo(tab.handlerState.objectId);
|
||||
|
||||
if (!this.nodesManagerService.isNodeHasData(objectInfo)) {
|
||||
return;
|
||||
}
|
||||
this.dataViewerTableService.createTableModelIfNotExists(tab.handlerState.objectId);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { ConnectionsManagerService, IConnectionCatalogSchema } from '@dbeaver/core/app';
|
||||
import { ConnectionsManagerService } from '@dbeaver/core/app';
|
||||
import { injectable } from '@dbeaver/core/di';
|
||||
import { CommonDialogService } from '@dbeaver/core/dialogs';
|
||||
import { GraphQLService } from '@dbeaver/core/sdk';
|
||||
@@ -15,8 +15,12 @@ import { RowDiff } from './TableViewer/TableDataModel/EditedRow';
|
||||
import { IRequestDataResult, ITableViewerModelInit, TableViewerModel } from './TableViewer/TableViewerModel';
|
||||
import { TableViewerStorageService } from './TableViewer/TableViewerStorageService';
|
||||
|
||||
interface ISqlContextParams extends IConnectionCatalogSchema {
|
||||
interface ISqlContextParams {
|
||||
contextId: string;
|
||||
connectionId: string;
|
||||
objectCatalogId?: string;
|
||||
objectSchemaId?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface IDataViewerTableModel {
|
||||
@@ -64,14 +68,22 @@ export class DataViewerTableService {
|
||||
return new TableViewerModel(callbacks, this.commonDialogService);
|
||||
}
|
||||
|
||||
private async createSqlContext(connectionCatalogSchema: IConnectionCatalogSchema): Promise<ISqlContextParams> {
|
||||
private async createSqlContext(
|
||||
connectionId: string,
|
||||
defaultCatalog?: string,
|
||||
defaultSchema?: string
|
||||
): Promise<ISqlContextParams> {
|
||||
|
||||
const response = await this.graphQLService.gql.sqlContextCreate(connectionCatalogSchema);
|
||||
const response = await this.graphQLService.gql.sqlContextCreate({
|
||||
connectionId,
|
||||
defaultCatalog,
|
||||
defaultSchema,
|
||||
});
|
||||
return {
|
||||
contextId: response.context.id,
|
||||
connectionId: connectionCatalogSchema.connectionId,
|
||||
catalogId: response.context.defaultCatalog || null,
|
||||
schemaId: response.context.defaultSchema || null,
|
||||
connectionId,
|
||||
objectCatalogId: response.context.defaultCatalog,
|
||||
objectSchemaId: response.context.defaultSchema,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -112,11 +124,7 @@ export class DataViewerTableService {
|
||||
if (!data.sqlContextParams) {
|
||||
|
||||
// it is first data request
|
||||
const sqlContextParams: ISqlContextParams = await this.createSqlContext({
|
||||
connectionId: data.connectionId,
|
||||
catalogId: null,
|
||||
schemaId: null,
|
||||
});
|
||||
const sqlContextParams: ISqlContextParams = await this.createSqlContext(data.connectionId);
|
||||
data.sqlContextParams = sqlContextParams;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ export class ObjectViewerTabService {
|
||||
const nodeInfo = this.nodesManagerService
|
||||
.getNodeContainerInfo(context.handlerState.objectId);
|
||||
|
||||
if (nodeInfo.connectionId) {
|
||||
// connection node id differs from connection id
|
||||
return NodeManagerUtils.connectionNodeIdToConnectionId(nodeInfo.connectionId);
|
||||
if (!nodeInfo.connectionId) {
|
||||
return;
|
||||
}
|
||||
return '';
|
||||
// connection node id differs from connection id
|
||||
return NodeManagerUtils.connectionNodeIdToConnectionId(nodeInfo.connectionId);
|
||||
}
|
||||
|
||||
getDBObjectCatalog(context: ITab<IObjectViewerTabState>) {
|
||||
@@ -78,19 +78,19 @@ export class ObjectViewerTabService {
|
||||
.getNodeContainerInfo(context.handlerState.objectId);
|
||||
|
||||
if (nodeInfo.catalogId) {
|
||||
return nodeInfo.catalogId;
|
||||
return;
|
||||
}
|
||||
return '';
|
||||
return nodeInfo.catalogId;
|
||||
}
|
||||
|
||||
getDBObjectSchema(context: ITab<IObjectViewerTabState>) {
|
||||
const nodeInfo = this.nodesManagerService
|
||||
.getNodeContainerInfo(context.handlerState.objectId);
|
||||
|
||||
if (nodeInfo.schemaId) {
|
||||
return nodeInfo.schemaId;
|
||||
if (!nodeInfo.schemaId) {
|
||||
return;
|
||||
}
|
||||
return '';
|
||||
return nodeInfo.schemaId;
|
||||
}
|
||||
|
||||
registerTabHandler() {
|
||||
|
||||
Reference in New Issue
Block a user