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:
@@ -14,7 +14,7 @@ import {
|
||||
ObjectPropertyInfo
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
|
||||
export type Connection = Pick<ConnectionInfo, 'id' | 'name' | 'connected' | 'driverId' | 'features' | 'authModel' | 'authNeeded'> & { authProperties?: ObjectPropertyInfo[] }
|
||||
export type Connection = Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'connected' | 'driverId' | 'features' | 'authModel' | 'authNeeded'> & { authProperties?: ObjectPropertyInfo[] }
|
||||
|
||||
@injectable()
|
||||
export class ConnectionInfoResource extends CachedMapResource<string, Connection> {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Subject } from 'rxjs';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { SessionResource } from '@cloudbeaver/core-root';
|
||||
import { DataSourceInfo, isResourceKeyList } from '@cloudbeaver/core-sdk';
|
||||
import { isResourceKeyList } from '@cloudbeaver/core-sdk';
|
||||
|
||||
import { ROOT_NODE_PATH } from '../NodesManager/NavNodeInfoResource';
|
||||
import { NavNodeManagerService } from '../NodesManager/NavNodeManagerService';
|
||||
@@ -20,8 +20,6 @@ import { ConnectionInfoResource, Connection } from './ConnectionInfoResource';
|
||||
import { ContainerResource, ObjectContainer } from './ContainerResource';
|
||||
import { EConnectionFeature } from './EConnectionFeature';
|
||||
|
||||
export type DBSource = Pick<DataSourceInfo, 'id' | 'name' | 'driverId' | 'description'>
|
||||
|
||||
@injectable()
|
||||
export class ConnectionsManagerService {
|
||||
onOpenConnection = new Subject<Connection>();
|
||||
|
||||
@@ -2,6 +2,7 @@ mutation closeConnection($id: ID!) {
|
||||
connection: closeConnection(id: $id) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
@@ -2,6 +2,7 @@ query connectionState($id: ID!) {
|
||||
connection: connectionState(id: $id) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
@@ -2,6 +2,7 @@ mutation createConnection($config: ConnectionConfig!) {
|
||||
createConnection(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
@@ -2,6 +2,7 @@ mutation initConnection($id: ID!, $credentials: Object) {
|
||||
connection: initConnection(id: $id, credentials: $credentials) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
@@ -2,6 +2,7 @@ mutation openConnection($config: ConnectionConfig!) {
|
||||
connection: openConnection(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
query templateDataSourceList {
|
||||
sources: templateDataSources {
|
||||
query getTemplateConnections {
|
||||
connections: templateConnections {
|
||||
id
|
||||
name
|
||||
driverId
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -1,8 +1,10 @@
|
||||
mutation asyncExportTaskStatus(
|
||||
mutation getAsyncTaskInfo(
|
||||
$taskId: String!
|
||||
$removeOnFinish: Boolean!
|
||||
) {
|
||||
taskInfo: asyncTaskStatus(
|
||||
taskInfo: asyncTaskInfo(
|
||||
id: $taskId
|
||||
removeOnFinish: $removeOnFinish
|
||||
) {
|
||||
id
|
||||
name
|
||||
@@ -11,37 +11,14 @@ mutation asyncSqlExecuteQuery(
|
||||
filter: $filter
|
||||
) {
|
||||
id
|
||||
name
|
||||
running
|
||||
result {
|
||||
duration
|
||||
statusMessage
|
||||
results {
|
||||
updateRowCount
|
||||
sourceQuery
|
||||
title
|
||||
resultSet {
|
||||
id
|
||||
columns {
|
||||
dataKind
|
||||
entityName
|
||||
fullTypeName
|
||||
icon
|
||||
label
|
||||
maxLength
|
||||
name
|
||||
position
|
||||
precision
|
||||
scale
|
||||
typeName
|
||||
}
|
||||
rows
|
||||
}
|
||||
}
|
||||
}
|
||||
status
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
taskResult
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
mutation asyncTaskStatus(
|
||||
$taskId: String!
|
||||
) {
|
||||
taskInfo: asyncTaskStatus(
|
||||
id: $taskId
|
||||
) {
|
||||
id
|
||||
running
|
||||
result {
|
||||
duration
|
||||
statusMessage
|
||||
results {
|
||||
updateRowCount
|
||||
sourceQuery
|
||||
title
|
||||
resultSet {
|
||||
id
|
||||
columns {
|
||||
dataKind
|
||||
entityName
|
||||
fullTypeName
|
||||
icon
|
||||
label
|
||||
maxLength
|
||||
name
|
||||
position
|
||||
precision
|
||||
scale
|
||||
typeName
|
||||
}
|
||||
rows
|
||||
}
|
||||
}
|
||||
}
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-10
@@ -1,14 +1,8 @@
|
||||
mutation executeSqlQuery(
|
||||
$connectionId: ID!
|
||||
$contextId: ID!
|
||||
$query: String!
|
||||
$filter: SQLDataFilter
|
||||
mutation getSqlExecuteTaskResults(
|
||||
$taskId: ID!
|
||||
) {
|
||||
result: sqlExecuteQuery(
|
||||
connectionId: $connectionId
|
||||
contextId: $contextId
|
||||
sql: $query
|
||||
filter: $filter
|
||||
result: asyncSqlExecuteResults(
|
||||
taskId: $taskId
|
||||
) {
|
||||
duration
|
||||
statusMessage
|
||||
+134
-178
@@ -16,6 +16,7 @@ export type Scalars = {
|
||||
};
|
||||
|
||||
export type Query = {
|
||||
allConnections: Array<ConnectionInfo>;
|
||||
authLogin: UserAuthInfo;
|
||||
authLogout?: Maybe<Scalars['Boolean']>;
|
||||
authModels: Array<DatabaseAuthModel>;
|
||||
@@ -23,14 +24,14 @@ export type Query = {
|
||||
connectionInfo: ConnectionInfo;
|
||||
/** @deprecated Field no longer supported */
|
||||
connectionState: ConnectionInfo;
|
||||
createConnectionConfiguration: ConnectionInfo;
|
||||
createRole: AdminRoleInfo;
|
||||
createUser: AdminUserInfo;
|
||||
/** @deprecated Field no longer supported */
|
||||
dataSourceList: Array<DataSourceInfo>;
|
||||
dataTransferAvailableStreamProcessors: Array<DataTransferProcessorInfo>;
|
||||
dataTransferExportDataFromContainer: AsyncTaskInfo;
|
||||
dataTransferExportDataFromResults: AsyncTaskInfo;
|
||||
dataTransferRemoveDataFile?: Maybe<Scalars['Boolean']>;
|
||||
deleteConnectionConfiguration?: Maybe<Scalars['Boolean']>;
|
||||
deleteRole?: Maybe<Scalars['Boolean']>;
|
||||
deleteUser?: Maybe<Scalars['Boolean']>;
|
||||
driverList: Array<DriverInfo>;
|
||||
@@ -49,12 +50,16 @@ export type Query = {
|
||||
sessionPermissions: Array<Maybe<Scalars['ID']>>;
|
||||
sessionState: SessionInfo;
|
||||
sessionUser?: Maybe<UserAuthInfo>;
|
||||
setRolePermissions?: Maybe<Scalars['Boolean']>;
|
||||
setConnectionAccess?: Maybe<Scalars['Boolean']>;
|
||||
setSubjectPermissions?: Maybe<Scalars['Boolean']>;
|
||||
setUserCredentials?: Maybe<Scalars['Boolean']>;
|
||||
sqlCompletionProposals?: Maybe<Array<Maybe<SqlCompletionProposal>>>;
|
||||
sqlDialectInfo?: Maybe<SqlDialectInfo>;
|
||||
sqlListContexts?: Maybe<Array<Maybe<SqlContextInfo>>>;
|
||||
templateConnections: Array<ConnectionInfo>;
|
||||
/** @deprecated Field no longer supported */
|
||||
templateDataSources: Array<DataSourceInfo>;
|
||||
updateConnectionConfiguration: ConnectionInfo;
|
||||
};
|
||||
|
||||
export type QueryAuthLoginArgs = {
|
||||
@@ -70,6 +75,10 @@ export type QueryConnectionStateArgs = {
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type QueryCreateConnectionConfigurationArgs = {
|
||||
config: ConnectionConfig;
|
||||
};
|
||||
|
||||
export type QueryCreateRoleArgs = {
|
||||
roleId: Scalars['ID'];
|
||||
};
|
||||
@@ -95,6 +104,10 @@ export type QueryDataTransferRemoveDataFileArgs = {
|
||||
dataFileId: Scalars['String'];
|
||||
};
|
||||
|
||||
export type QueryDeleteConnectionConfigurationArgs = {
|
||||
id: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type QueryDeleteRoleArgs = {
|
||||
roleId: Scalars['ID'];
|
||||
};
|
||||
@@ -155,9 +168,14 @@ export type QueryRevokeUserRoleArgs = {
|
||||
roleId: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type QuerySetRolePermissionsArgs = {
|
||||
export type QuerySetConnectionAccessArgs = {
|
||||
connectionId: Scalars['ID'];
|
||||
subjects: Array<Scalars['ID']>;
|
||||
};
|
||||
|
||||
export type QuerySetSubjectPermissionsArgs = {
|
||||
roleId: Scalars['ID'];
|
||||
permissions: Array<Maybe<Scalars['ID']>>;
|
||||
permissions: Array<Scalars['ID']>;
|
||||
};
|
||||
|
||||
export type QuerySetUserCredentialsArgs = {
|
||||
@@ -182,9 +200,17 @@ export type QuerySqlListContextsArgs = {
|
||||
connectionId: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type QueryUpdateConnectionConfigurationArgs = {
|
||||
id: Scalars['ID'];
|
||||
config: ConnectionConfig;
|
||||
};
|
||||
|
||||
export type Mutation = {
|
||||
asyncSqlExecuteQuery: AsyncTaskInfo;
|
||||
asyncSqlExecuteResults: SqlExecuteInfo;
|
||||
asyncTaskCancel?: Maybe<Scalars['Boolean']>;
|
||||
asyncTaskInfo: AsyncTaskInfo;
|
||||
/** @deprecated Field no longer supported */
|
||||
asyncTaskStatus: AsyncTaskInfo;
|
||||
changeSessionLanguage?: Maybe<Scalars['Boolean']>;
|
||||
closeConnection: ConnectionInfo;
|
||||
@@ -216,10 +242,19 @@ export type MutationAsyncSqlExecuteQueryArgs = {
|
||||
filter?: Maybe<SqlDataFilter>;
|
||||
};
|
||||
|
||||
export type MutationAsyncSqlExecuteResultsArgs = {
|
||||
taskId: Scalars['ID'];
|
||||
};
|
||||
|
||||
export type MutationAsyncTaskCancelArgs = {
|
||||
id: Scalars['String'];
|
||||
};
|
||||
|
||||
export type MutationAsyncTaskInfoArgs = {
|
||||
id: Scalars['String'];
|
||||
removeOnFinish: Scalars['Boolean'];
|
||||
};
|
||||
|
||||
export type MutationAsyncTaskStatusArgs = {
|
||||
id: Scalars['String'];
|
||||
};
|
||||
@@ -335,6 +370,7 @@ export type AsyncTaskInfo = {
|
||||
running: Scalars['Boolean'];
|
||||
status?: Maybe<Scalars['String']>;
|
||||
error?: Maybe<ServerError>;
|
||||
/** @deprecated Field no longer supported */
|
||||
result?: Maybe<SqlExecuteInfo>;
|
||||
taskResult?: Maybe<Scalars['Object']>;
|
||||
};
|
||||
@@ -427,6 +463,27 @@ export type DriverInfo = {
|
||||
applicableAuthModel: Array<Scalars['ID']>;
|
||||
};
|
||||
|
||||
export type ConnectionInfo = {
|
||||
id: Scalars['ID'];
|
||||
driverId: Scalars['ID'];
|
||||
name: Scalars['String'];
|
||||
description?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['String']>;
|
||||
template: Scalars['Boolean'];
|
||||
connected: Scalars['Boolean'];
|
||||
provided: Scalars['Boolean'];
|
||||
readOnly: Scalars['Boolean'];
|
||||
connectTime?: Maybe<Scalars['String']>;
|
||||
connectionError?: Maybe<ServerError>;
|
||||
serverVersion?: Maybe<Scalars['String']>;
|
||||
clientVersion?: Maybe<Scalars['String']>;
|
||||
authNeeded: Scalars['Boolean'];
|
||||
authModel?: Maybe<Scalars['ID']>;
|
||||
authProperties: Array<ObjectPropertyInfo>;
|
||||
features: Array<Scalars['String']>;
|
||||
navigatorSettings: NavigatorSettings;
|
||||
};
|
||||
|
||||
export type DataSourceInfo = {
|
||||
id: Scalars['ID'];
|
||||
driverId: Scalars['ID'];
|
||||
@@ -440,19 +497,22 @@ export type DataSourceInfo = {
|
||||
};
|
||||
|
||||
export type ConnectionConfig = {
|
||||
driverId?: Maybe<Scalars['ID']>;
|
||||
name?: Maybe<Scalars['String']>;
|
||||
description?: Maybe<Scalars['String']>;
|
||||
dataSourceId?: Maybe<Scalars['ID']>;
|
||||
templateId?: Maybe<Scalars['ID']>;
|
||||
driverId?: Maybe<Scalars['ID']>;
|
||||
host?: Maybe<Scalars['String']>;
|
||||
port?: Maybe<Scalars['String']>;
|
||||
databaseName?: Maybe<Scalars['String']>;
|
||||
url?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['Object']>;
|
||||
userName?: Maybe<Scalars['String']>;
|
||||
userPassword?: Maybe<Scalars['String']>;
|
||||
template?: Maybe<Scalars['Boolean']>;
|
||||
readOnly?: Maybe<Scalars['Boolean']>;
|
||||
authModelId?: Maybe<Scalars['ID']>;
|
||||
credentials?: Maybe<Scalars['Object']>;
|
||||
dataSourceId?: Maybe<Scalars['ID']>;
|
||||
userName?: Maybe<Scalars['String']>;
|
||||
userPassword?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type NavigatorSettings = {
|
||||
@@ -475,25 +535,6 @@ export type NavigatorSettingsInput = {
|
||||
hideVirtualModel: Scalars['Boolean'];
|
||||
};
|
||||
|
||||
export type ConnectionInfo = {
|
||||
id: Scalars['ID'];
|
||||
driverId: Scalars['ID'];
|
||||
name: Scalars['String'];
|
||||
description?: Maybe<Scalars['String']>;
|
||||
properties?: Maybe<Scalars['String']>;
|
||||
connected: Scalars['Boolean'];
|
||||
provided: Scalars['Boolean'];
|
||||
connectTime?: Maybe<Scalars['String']>;
|
||||
connectionError?: Maybe<ServerError>;
|
||||
serverVersion?: Maybe<Scalars['String']>;
|
||||
clientVersion?: Maybe<Scalars['String']>;
|
||||
authNeeded: Scalars['Boolean'];
|
||||
authModel?: Maybe<Scalars['ID']>;
|
||||
authProperties: Array<ObjectPropertyInfo>;
|
||||
features: Array<Scalars['String']>;
|
||||
navigatorSettings: NavigatorSettings;
|
||||
};
|
||||
|
||||
export type LogEntry = {
|
||||
time?: Maybe<Scalars['DateTime']>;
|
||||
type: Scalars['String'];
|
||||
@@ -793,7 +834,7 @@ export type CloseConnectionMutationVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export type CloseConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
export type CloseConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type ConnectionAuthPropertiesQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
@@ -805,13 +846,13 @@ export type ConnectionStateQueryVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export type ConnectionStateQuery = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
export type ConnectionStateQuery = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type CreateConnectionMutationVariables = Exact<{
|
||||
config: ConnectionConfig;
|
||||
}>;
|
||||
|
||||
export type CreateConnectionMutation = { createConnection: Pick<ConnectionInfo, 'id' | 'name' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
export type CreateConnectionMutation = { createConnection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type DeleteConnectionMutationVariables = Exact<{
|
||||
id: Scalars['ID'];
|
||||
@@ -850,17 +891,17 @@ export type InitConnectionMutationVariables = Exact<{
|
||||
credentials?: Maybe<Scalars['Object']>;
|
||||
}>;
|
||||
|
||||
export type InitConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
export type InitConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type OpenConnectionMutationVariables = Exact<{
|
||||
config: ConnectionConfig;
|
||||
}>;
|
||||
|
||||
export type OpenConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
export type OpenConnectionMutation = { connection: Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'> };
|
||||
|
||||
export type TemplateDataSourceListQueryVariables = Exact<{ [key: string]: never }>;
|
||||
export type GetTemplateConnectionsQueryVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type TemplateDataSourceListQuery = { sources: Array<Pick<DataSourceInfo, 'id' | 'name' | 'driverId' | 'description'>> };
|
||||
export type GetTemplateConnectionsQuery = { connections: Array<Pick<ConnectionInfo, 'id' | 'name' | 'description' | 'driverId' | 'connected' | 'features' | 'authNeeded' | 'authModel'>> };
|
||||
|
||||
export type TestConnectionMutationVariables = Exact<{
|
||||
config: ConnectionConfig;
|
||||
@@ -868,15 +909,6 @@ export type TestConnectionMutationVariables = Exact<{
|
||||
|
||||
export type TestConnectionMutation = { testConnection: Pick<ConnectionInfo, 'id'> };
|
||||
|
||||
export type AsyncExportTaskStatusMutationVariables = Exact<{
|
||||
taskId: Scalars['String'];
|
||||
}>;
|
||||
|
||||
export type AsyncExportTaskStatusMutation = { taskInfo: (
|
||||
Pick<AsyncTaskInfo, 'id' | 'name' | 'running' | 'status' | 'taskResult'>
|
||||
& { error?: Maybe<Pick<ServerError, 'message' | 'errorCode' | 'stackTrace'>> }
|
||||
); };
|
||||
|
||||
export type ExportDataFromContainerQueryVariables = Exact<{
|
||||
connectionId: Scalars['ID'];
|
||||
containerNodePath: Scalars['ID'];
|
||||
@@ -920,6 +952,16 @@ export type NavGetStructContainersQueryVariables = Exact<{
|
||||
|
||||
export type NavGetStructContainersQuery = { navGetStructContainers: { catalogList: Array<Pick<DatabaseObjectInfo, 'name' | 'description' | 'type' | 'features'>>; schemaList: Array<Pick<DatabaseObjectInfo, 'name' | 'description' | 'type' | 'features'>> } };
|
||||
|
||||
export type GetAsyncTaskInfoMutationVariables = Exact<{
|
||||
taskId: Scalars['String'];
|
||||
removeOnFinish: Scalars['Boolean'];
|
||||
}>;
|
||||
|
||||
export type GetAsyncTaskInfoMutation = { taskInfo: (
|
||||
Pick<AsyncTaskInfo, 'id' | 'name' | 'running' | 'status' | 'taskResult'>
|
||||
& { error?: Maybe<Pick<ServerError, 'message' | 'errorCode' | 'stackTrace'>> }
|
||||
); };
|
||||
|
||||
export type AsyncSqlExecuteQueryMutationVariables = Exact<{
|
||||
connectionId: Scalars['ID'];
|
||||
contextId: Scalars['ID'];
|
||||
@@ -928,45 +970,15 @@ export type AsyncSqlExecuteQueryMutationVariables = Exact<{
|
||||
}>;
|
||||
|
||||
export type AsyncSqlExecuteQueryMutation = { taskInfo: (
|
||||
Pick<AsyncTaskInfo, 'id' | 'running'>
|
||||
& { result?: Maybe<(
|
||||
Pick<SqlExecuteInfo, 'duration' | 'statusMessage'>
|
||||
& { results: Array<(
|
||||
Pick<SqlQueryResults, 'updateRowCount' | 'sourceQuery' | 'title'>
|
||||
& { resultSet?: Maybe<(
|
||||
Pick<SqlResultSet, 'id' | 'rows'>
|
||||
& { columns?: Maybe<Array<Maybe<Pick<SqlResultColumn, 'dataKind' | 'entityName' | 'fullTypeName' | 'icon' | 'label' | 'maxLength' | 'name' | 'position' | 'precision' | 'scale' | 'typeName'>>>> }
|
||||
)>; }
|
||||
)>; }
|
||||
)>; error?: Maybe<Pick<ServerError, 'message' | 'errorCode' | 'stackTrace'>>; }
|
||||
Pick<AsyncTaskInfo, 'id' | 'name' | 'running' | 'status' | 'taskResult'>
|
||||
& { error?: Maybe<Pick<ServerError, 'message' | 'errorCode' | 'stackTrace'>> }
|
||||
); };
|
||||
|
||||
export type AsyncTaskStatusMutationVariables = Exact<{
|
||||
taskId: Scalars['String'];
|
||||
export type GetSqlExecuteTaskResultsMutationVariables = Exact<{
|
||||
taskId: Scalars['ID'];
|
||||
}>;
|
||||
|
||||
export type AsyncTaskStatusMutation = { taskInfo: (
|
||||
Pick<AsyncTaskInfo, 'id' | 'running'>
|
||||
& { result?: Maybe<(
|
||||
Pick<SqlExecuteInfo, 'duration' | 'statusMessage'>
|
||||
& { results: Array<(
|
||||
Pick<SqlQueryResults, 'updateRowCount' | 'sourceQuery' | 'title'>
|
||||
& { resultSet?: Maybe<(
|
||||
Pick<SqlResultSet, 'id' | 'rows'>
|
||||
& { columns?: Maybe<Array<Maybe<Pick<SqlResultColumn, 'dataKind' | 'entityName' | 'fullTypeName' | 'icon' | 'label' | 'maxLength' | 'name' | 'position' | 'precision' | 'scale' | 'typeName'>>>> }
|
||||
)>; }
|
||||
)>; }
|
||||
)>; error?: Maybe<Pick<ServerError, 'message' | 'errorCode' | 'stackTrace'>>; }
|
||||
); };
|
||||
|
||||
export type ExecuteSqlQueryMutationVariables = Exact<{
|
||||
connectionId: Scalars['ID'];
|
||||
contextId: Scalars['ID'];
|
||||
query: Scalars['String'];
|
||||
filter?: Maybe<SqlDataFilter>;
|
||||
}>;
|
||||
|
||||
export type ExecuteSqlQueryMutation = { result?: Maybe<(
|
||||
export type GetSqlExecuteTaskResultsMutation = { result: (
|
||||
Pick<SqlExecuteInfo, 'duration' | 'statusMessage'>
|
||||
& { results: Array<(
|
||||
Pick<SqlQueryResults, 'updateRowCount' | 'sourceQuery' | 'title'>
|
||||
@@ -975,7 +987,7 @@ export type ExecuteSqlQueryMutation = { result?: Maybe<(
|
||||
& { columns?: Maybe<Array<Maybe<Pick<SqlResultColumn, 'dataKind' | 'entityName' | 'fullTypeName' | 'icon' | 'label' | 'maxLength' | 'name' | 'position' | 'precision' | 'scale' | 'typeName'>>>> }
|
||||
)>; }
|
||||
)>; }
|
||||
)>; };
|
||||
); };
|
||||
|
||||
export type ReadDataFromContainerMutationVariables = Exact<{
|
||||
connectionId: Scalars['ID'];
|
||||
@@ -1281,6 +1293,7 @@ export const CloseConnectionDocument = `
|
||||
connection: closeConnection(id: $id) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
@@ -1311,6 +1324,7 @@ export const ConnectionStateDocument = `
|
||||
connection: connectionState(id: $id) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
@@ -1324,6 +1338,7 @@ export const CreateConnectionDocument = `
|
||||
createConnection(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
@@ -1404,6 +1419,7 @@ export const InitConnectionDocument = `
|
||||
connection: initConnection(id: $id, credentials: $credentials) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
@@ -1417,6 +1433,7 @@ export const OpenConnectionDocument = `
|
||||
connection: openConnection(config: $config) {
|
||||
id
|
||||
name
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
@@ -1425,13 +1442,17 @@ export const OpenConnectionDocument = `
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const TemplateDataSourceListDocument = `
|
||||
query templateDataSourceList {
|
||||
sources: templateDataSources {
|
||||
export const GetTemplateConnectionsDocument = `
|
||||
query getTemplateConnections {
|
||||
connections: templateConnections {
|
||||
id
|
||||
name
|
||||
driverId
|
||||
description
|
||||
driverId
|
||||
connected
|
||||
features
|
||||
authNeeded
|
||||
authModel
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -1442,22 +1463,6 @@ export const TestConnectionDocument = `
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const AsyncExportTaskStatusDocument = `
|
||||
mutation asyncExportTaskStatus($taskId: String!) {
|
||||
taskInfo: asyncTaskStatus(id: $taskId) {
|
||||
id
|
||||
name
|
||||
running
|
||||
status
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
taskResult
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const ExportDataFromContainerDocument = `
|
||||
query exportDataFromContainer($connectionId: ID!, $containerNodePath: ID!, $parameters: DataTransferParameters!) {
|
||||
taskInfo: dataTransferExportDataFromContainer(connectionId: $connectionId, containerNodePath: $containerNodePath, parameters: $parameters) {
|
||||
@@ -1535,87 +1540,41 @@ export const NavGetStructContainersDocument = `
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const GetAsyncTaskInfoDocument = `
|
||||
mutation getAsyncTaskInfo($taskId: String!, $removeOnFinish: Boolean!) {
|
||||
taskInfo: asyncTaskInfo(id: $taskId, removeOnFinish: $removeOnFinish) {
|
||||
id
|
||||
name
|
||||
running
|
||||
status
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
taskResult
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const AsyncSqlExecuteQueryDocument = `
|
||||
mutation asyncSqlExecuteQuery($connectionId: ID!, $contextId: ID!, $query: String!, $filter: SQLDataFilter) {
|
||||
taskInfo: asyncSqlExecuteQuery(connectionId: $connectionId, contextId: $contextId, sql: $query, filter: $filter) {
|
||||
id
|
||||
name
|
||||
running
|
||||
result {
|
||||
duration
|
||||
statusMessage
|
||||
results {
|
||||
updateRowCount
|
||||
sourceQuery
|
||||
title
|
||||
resultSet {
|
||||
id
|
||||
columns {
|
||||
dataKind
|
||||
entityName
|
||||
fullTypeName
|
||||
icon
|
||||
label
|
||||
maxLength
|
||||
name
|
||||
position
|
||||
precision
|
||||
scale
|
||||
typeName
|
||||
}
|
||||
rows
|
||||
}
|
||||
}
|
||||
}
|
||||
status
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
taskResult
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const AsyncTaskStatusDocument = `
|
||||
mutation asyncTaskStatus($taskId: String!) {
|
||||
taskInfo: asyncTaskStatus(id: $taskId) {
|
||||
id
|
||||
running
|
||||
result {
|
||||
duration
|
||||
statusMessage
|
||||
results {
|
||||
updateRowCount
|
||||
sourceQuery
|
||||
title
|
||||
resultSet {
|
||||
id
|
||||
columns {
|
||||
dataKind
|
||||
entityName
|
||||
fullTypeName
|
||||
icon
|
||||
label
|
||||
maxLength
|
||||
name
|
||||
position
|
||||
precision
|
||||
scale
|
||||
typeName
|
||||
}
|
||||
rows
|
||||
}
|
||||
}
|
||||
}
|
||||
error {
|
||||
message
|
||||
errorCode
|
||||
stackTrace
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
export const ExecuteSqlQueryDocument = `
|
||||
mutation executeSqlQuery($connectionId: ID!, $contextId: ID!, $query: String!, $filter: SQLDataFilter) {
|
||||
result: sqlExecuteQuery(connectionId: $connectionId, contextId: $contextId, sql: $query, filter: $filter) {
|
||||
export const GetSqlExecuteTaskResultsDocument = `
|
||||
mutation getSqlExecuteTaskResults($taskId: ID!) {
|
||||
result: asyncSqlExecuteResults(taskId: $taskId) {
|
||||
duration
|
||||
statusMessage
|
||||
results {
|
||||
@@ -2022,15 +1981,12 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
|
||||
openConnection(variables: OpenConnectionMutationVariables): Promise<OpenConnectionMutation> {
|
||||
return withWrapper(() => client.request<OpenConnectionMutation>(OpenConnectionDocument, variables));
|
||||
},
|
||||
templateDataSourceList(variables?: TemplateDataSourceListQueryVariables): Promise<TemplateDataSourceListQuery> {
|
||||
return withWrapper(() => client.request<TemplateDataSourceListQuery>(TemplateDataSourceListDocument, variables));
|
||||
getTemplateConnections(variables?: GetTemplateConnectionsQueryVariables): Promise<GetTemplateConnectionsQuery> {
|
||||
return withWrapper(() => client.request<GetTemplateConnectionsQuery>(GetTemplateConnectionsDocument, variables));
|
||||
},
|
||||
testConnection(variables: TestConnectionMutationVariables): Promise<TestConnectionMutation> {
|
||||
return withWrapper(() => client.request<TestConnectionMutation>(TestConnectionDocument, variables));
|
||||
},
|
||||
asyncExportTaskStatus(variables: AsyncExportTaskStatusMutationVariables): Promise<AsyncExportTaskStatusMutation> {
|
||||
return withWrapper(() => client.request<AsyncExportTaskStatusMutation>(AsyncExportTaskStatusDocument, variables));
|
||||
},
|
||||
exportDataFromContainer(variables: ExportDataFromContainerQueryVariables): Promise<ExportDataFromContainerQuery> {
|
||||
return withWrapper(() => client.request<ExportDataFromContainerQuery>(ExportDataFromContainerDocument, variables));
|
||||
},
|
||||
@@ -2046,14 +2002,14 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
|
||||
navGetStructContainers(variables: NavGetStructContainersQueryVariables): Promise<NavGetStructContainersQuery> {
|
||||
return withWrapper(() => client.request<NavGetStructContainersQuery>(NavGetStructContainersDocument, variables));
|
||||
},
|
||||
getAsyncTaskInfo(variables: GetAsyncTaskInfoMutationVariables): Promise<GetAsyncTaskInfoMutation> {
|
||||
return withWrapper(() => client.request<GetAsyncTaskInfoMutation>(GetAsyncTaskInfoDocument, variables));
|
||||
},
|
||||
asyncSqlExecuteQuery(variables: AsyncSqlExecuteQueryMutationVariables): Promise<AsyncSqlExecuteQueryMutation> {
|
||||
return withWrapper(() => client.request<AsyncSqlExecuteQueryMutation>(AsyncSqlExecuteQueryDocument, variables));
|
||||
},
|
||||
asyncTaskStatus(variables: AsyncTaskStatusMutationVariables): Promise<AsyncTaskStatusMutation> {
|
||||
return withWrapper(() => client.request<AsyncTaskStatusMutation>(AsyncTaskStatusDocument, variables));
|
||||
},
|
||||
executeSqlQuery(variables: ExecuteSqlQueryMutationVariables): Promise<ExecuteSqlQueryMutation> {
|
||||
return withWrapper(() => client.request<ExecuteSqlQueryMutation>(ExecuteSqlQueryDocument, variables));
|
||||
getSqlExecuteTaskResults(variables: GetSqlExecuteTaskResultsMutationVariables): Promise<GetSqlExecuteTaskResultsMutation> {
|
||||
return withWrapper(() => client.request<GetSqlExecuteTaskResultsMutation>(GetSqlExecuteTaskResultsDocument, variables));
|
||||
},
|
||||
readDataFromContainer(variables: ReadDataFromContainerMutationVariables): Promise<ReadDataFromContainerMutation> {
|
||||
return withWrapper(() => client.request<ReadDataFromContainerMutation>(ReadDataFromContainerDocument, variables));
|
||||
|
||||
+9
-9
@@ -13,7 +13,7 @@ import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { PermissionsService, EPermission } from '@cloudbeaver/core-root';
|
||||
|
||||
import { ConnectionDialog } from './ConnectionDialog/ConnectionDialog';
|
||||
import { TemplateDataSourceListResource } from './DataSourcesResource';
|
||||
import { TemplateConnectionsResource } from './TemplateConnectionsResource';
|
||||
|
||||
@injectable()
|
||||
export class BasicConnectionPluginBootstrap {
|
||||
@@ -21,7 +21,7 @@ export class BasicConnectionPluginBootstrap {
|
||||
constructor(
|
||||
private connectionDialogsService: ConnectionDialogsService,
|
||||
private mainMenuService: MainMenuService,
|
||||
private templateDataSourceListResource: TemplateDataSourceListResource,
|
||||
private templateConnectionsResource: TemplateConnectionsResource,
|
||||
private commonDialogService: CommonDialogService,
|
||||
private notificationService: NotificationService,
|
||||
private permissionsService: PermissionsService
|
||||
@@ -29,7 +29,7 @@ export class BasicConnectionPluginBootstrap {
|
||||
}
|
||||
|
||||
bootstrap() {
|
||||
this.loadDbSources();
|
||||
this.loadTemplateConnections();
|
||||
this.mainMenuService.registerMenuItem(
|
||||
this.connectionDialogsService.newConnectionMenuToken,
|
||||
{
|
||||
@@ -44,20 +44,20 @@ export class BasicConnectionPluginBootstrap {
|
||||
}
|
||||
|
||||
private async openConnectionsDialog() {
|
||||
this.loadDbSources();
|
||||
this.loadTemplateConnections();
|
||||
await this.commonDialogService.open(ConnectionDialog, null);
|
||||
}
|
||||
|
||||
private isDisabled() {
|
||||
this.loadDbSources();
|
||||
return !this.templateDataSourceListResource.data.length;
|
||||
this.loadTemplateConnections();
|
||||
return !this.templateConnectionsResource.data.length;
|
||||
}
|
||||
|
||||
private async loadDbSources() {
|
||||
private async loadTemplateConnections() {
|
||||
try {
|
||||
await this.templateDataSourceListResource.loadAll();
|
||||
await this.templateConnectionsResource.loadAll();
|
||||
} catch (error) {
|
||||
this.notificationService.logException(error, 'Template Data Sources loading failed');
|
||||
this.notificationService.logException(error, 'Template Connections loading failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-20
@@ -9,7 +9,7 @@
|
||||
import { observable, action } from 'mobx';
|
||||
|
||||
import {
|
||||
DBDriverResource, DBSource, ErrorDetailsDialog, DatabaseAuthModelsResource
|
||||
DBDriverResource, Connection, ErrorDetailsDialog, DatabaseAuthModelsResource
|
||||
} from '@cloudbeaver/core-app';
|
||||
import { injectable, IInitializableController, IDestructibleController } from '@cloudbeaver/core-di';
|
||||
import { CommonDialogService } from '@cloudbeaver/core-dialogs';
|
||||
@@ -17,15 +17,15 @@ import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { ConnectionConfig, GQLError, DatabaseAuthModel } from '@cloudbeaver/core-sdk';
|
||||
|
||||
import { BasicConnectionService } from '../BasicConnectionService';
|
||||
import { TemplateDataSourceListResource } from '../DataSourcesResource';
|
||||
import { TemplateConnectionsResource } from '../TemplateConnectionsResource';
|
||||
|
||||
export enum ConnectionStep {
|
||||
DBSource,
|
||||
ConnectionTemplateSelect,
|
||||
Connection
|
||||
}
|
||||
|
||||
export interface IConnectionController {
|
||||
dbSource: DBSource | null;
|
||||
template: Connection | null;
|
||||
config: ConnectionConfig;
|
||||
isConnecting: boolean;
|
||||
onConnect(): void;
|
||||
@@ -34,10 +34,10 @@ export interface IConnectionController {
|
||||
@injectable()
|
||||
export class ConnectionController
|
||||
implements IInitializableController, IDestructibleController, IConnectionController {
|
||||
@observable step = ConnectionStep.DBSource
|
||||
@observable step = ConnectionStep.ConnectionTemplateSelect
|
||||
@observable isLoading = true;
|
||||
@observable isConnecting = false;
|
||||
@observable dbSource: DBSource | null = null
|
||||
@observable template: Connection | null = null
|
||||
@observable authModel?: DatabaseAuthModel;
|
||||
@observable config: ConnectionConfig = {
|
||||
credentials: {},
|
||||
@@ -49,8 +49,8 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
private onClose!: () => void
|
||||
private isDistructed = false;
|
||||
|
||||
get dbSources() {
|
||||
return this.templateDataSourceListResource.data;
|
||||
get templateConnections() {
|
||||
return this.templateConnectionsResource.data;
|
||||
}
|
||||
|
||||
get dbDrivers() {
|
||||
@@ -58,15 +58,15 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
}
|
||||
|
||||
get dbDriver() {
|
||||
if (!this.dbSource) {
|
||||
if (!this.template) {
|
||||
return undefined;
|
||||
}
|
||||
return this.dbDrivers.get(this.dbSource.driverId);
|
||||
return this.dbDrivers.get(this.template.driverId);
|
||||
}
|
||||
|
||||
constructor(
|
||||
private dbDriverResource: DBDriverResource,
|
||||
private templateDataSourceListResource: TemplateDataSourceListResource,
|
||||
private templateConnectionsResource: TemplateConnectionsResource,
|
||||
private basicConnectionService: BasicConnectionService,
|
||||
private notificationService: NotificationService,
|
||||
private commonDialogService: CommonDialogService,
|
||||
@@ -75,7 +75,7 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
|
||||
init(onClose: () => void) {
|
||||
this.onClose = onClose;
|
||||
this.loadDBSources();
|
||||
this.loadTemplateConnections();
|
||||
}
|
||||
|
||||
destruct(): void {
|
||||
@@ -85,6 +85,10 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
onStep = (step: ConnectionStep) => {
|
||||
this.step = step;
|
||||
this.clearError();
|
||||
|
||||
if (step === ConnectionStep.ConnectionTemplateSelect) {
|
||||
this.template = null;
|
||||
}
|
||||
}
|
||||
|
||||
onConnect = async () => {
|
||||
@@ -102,12 +106,12 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
}
|
||||
}
|
||||
|
||||
onDBSourceSelect = async (sourceId: string) => {
|
||||
this.dbSource = this.dbSources.find(dbSource => dbSource.id === sourceId)!;
|
||||
onTemplateSelect = async (templateId: string) => {
|
||||
this.template = this.templateConnections.find(template => template.id === templateId)!;
|
||||
|
||||
await this.loadAuthModel();
|
||||
this.clearError();
|
||||
this.setDBSourceDefaults();
|
||||
this.seTemplateDefaults();
|
||||
|
||||
this.step = ConnectionStep.Connection;
|
||||
if (!this.authModel) {
|
||||
@@ -123,7 +127,7 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
|
||||
private getConnectionConfig(): ConnectionConfig {
|
||||
const config: ConnectionConfig = {};
|
||||
config.dataSourceId = this.config.dataSourceId;
|
||||
config.templateId = this.config.templateId;
|
||||
config.authModelId = this.config.authModelId;
|
||||
config.credentials = this.config.credentials;
|
||||
|
||||
@@ -131,8 +135,8 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
}
|
||||
|
||||
@action
|
||||
private setDBSourceDefaults() {
|
||||
this.config.dataSourceId = this.dbSource?.id;
|
||||
private seTemplateDefaults() {
|
||||
this.config.templateId = this.template?.id;
|
||||
this.config.authModelId = this.dbDriver?.defaultAuthModel;
|
||||
this.config.credentials = {};
|
||||
}
|
||||
@@ -153,9 +157,9 @@ implements IInitializableController, IDestructibleController, IConnectionControl
|
||||
}
|
||||
}
|
||||
|
||||
private async loadDBSources() {
|
||||
private async loadTemplateConnections() {
|
||||
try {
|
||||
await this.templateDataSourceListResource.loadAll();
|
||||
await this.templateConnectionsResource.loadAll();
|
||||
await this.dbDriverResource.loadAll();
|
||||
} catch (exception) {
|
||||
this.notificationService.logException(exception, 'Can\'t load database sources');
|
||||
|
||||
+11
-11
@@ -20,7 +20,7 @@ import { useStyles } from '@cloudbeaver/core-theming';
|
||||
|
||||
import { ConnectionController, ConnectionStep } from './ConnectionController';
|
||||
import { ConnectionDialogFooter } from './ConnectionDialogFooter';
|
||||
import { DBSourceSelector } from './DBSourceSelector/DBSourceSelector';
|
||||
import { TemplateConnectionSelector } from './TemplateConnectionSelector/TemplateConnectionSelector';
|
||||
|
||||
const styles = css`
|
||||
CommonDialogWrapper {
|
||||
@@ -51,30 +51,30 @@ export const ConnectionDialog = observer(function ConnectionDialog({
|
||||
const translate = useTranslate();
|
||||
let title = translate('basicConnection_connectionDialog_newConnection');
|
||||
|
||||
if (controller.step === ConnectionStep.Connection && controller.dbSource?.name) {
|
||||
title = controller.dbSource.name;
|
||||
if (controller.step === ConnectionStep.Connection && controller.template?.name) {
|
||||
title = controller.template.name;
|
||||
}
|
||||
|
||||
return styled(useStyles(styles))(
|
||||
<CommonDialogWrapper
|
||||
title={title}
|
||||
icon={controller.dbDriver?.icon}
|
||||
noBodyPadding={controller.step === ConnectionStep.DBSource}
|
||||
noBodyPadding={controller.step === ConnectionStep.ConnectionTemplateSelect}
|
||||
footer={controller.step === ConnectionStep.Connection && (
|
||||
<ConnectionDialogFooter
|
||||
isConnecting={controller.isConnecting}
|
||||
onBack={() => controller.onStep(ConnectionStep.DBSource)}
|
||||
onBack={() => controller.onStep(ConnectionStep.ConnectionTemplateSelect)}
|
||||
onConnect={controller.onConnect}
|
||||
/>
|
||||
)}
|
||||
onReject={rejectDialog}
|
||||
>
|
||||
{controller.isLoading && <Loader />}
|
||||
{!controller.isLoading && controller.step === ConnectionStep.DBSource && (
|
||||
<DBSourceSelector
|
||||
dbSources={controller.dbSources}
|
||||
{!controller.isLoading && controller.step === ConnectionStep.ConnectionTemplateSelect && (
|
||||
<TemplateConnectionSelector
|
||||
templateConnections={controller.templateConnections}
|
||||
dbDrivers={controller.dbDrivers}
|
||||
onSelect={controller.onDBSourceSelect}
|
||||
onSelect={controller.onTemplateSelect}
|
||||
/>
|
||||
)}
|
||||
{controller.step === ConnectionStep.Connection && (!controller.authModel ? (
|
||||
@@ -84,8 +84,8 @@ export const ConnectionDialog = observer(function ConnectionDialog({
|
||||
) : (
|
||||
<SubmittingForm onSubmit={controller.onConnect} ref={focusedRef as React.RefObject<HTMLFormElement>}>
|
||||
<ObjectPropertyInfoForm
|
||||
prefix={`auth_${controller.dbSource?.id || ''}`}
|
||||
autofillToken={`section-${controller.dbSource?.id || ''} section-auth`}
|
||||
prefix={`auth_${controller.template?.id || ''}`}
|
||||
autofillToken={`section-${controller.template?.id || ''} section-auth`}
|
||||
properties={controller.authModel.properties}
|
||||
credentials={controller.config.credentials}
|
||||
processing={controller.isConnecting}
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { DBDriver, DBSource } from '@cloudbeaver/core-app';
|
||||
import { ListItem } from '@cloudbeaver/core-blocks';
|
||||
|
||||
type DBSourceItemProps = {
|
||||
dbSource: DBSource;
|
||||
dbDriver?: DBDriver;
|
||||
onSelect(driverId: string): void;
|
||||
}
|
||||
|
||||
export const DBSourceItem = observer(function DBSourceItem({ dbSource, dbDriver, onSelect }: DBSourceItemProps) {
|
||||
const select = useCallback(() => onSelect(dbSource.id), [dbSource]);
|
||||
|
||||
return <ListItem icon={dbDriver?.icon} name={dbSource.name} description={dbSource.description} onClick={select}/>;
|
||||
});
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { DBDriver, Connection } from '@cloudbeaver/core-app';
|
||||
import { ListItem } from '@cloudbeaver/core-blocks';
|
||||
|
||||
type Props = {
|
||||
template: Connection;
|
||||
dbDriver?: DBDriver;
|
||||
onSelect(connectionId: string): void;
|
||||
}
|
||||
|
||||
export const TemplateConnectionItem = observer(function TemplateConnectionItem({
|
||||
template,
|
||||
dbDriver,
|
||||
onSelect,
|
||||
}: Props) {
|
||||
const select = useCallback(() => onSelect(template.id), [template]);
|
||||
|
||||
return <ListItem icon={dbDriver?.icon} name={template.name} description={template.description} onClick={select}/>;
|
||||
});
|
||||
+15
-15
@@ -9,40 +9,40 @@
|
||||
import { observer } from 'mobx-react';
|
||||
import { useState, useMemo } from 'react';
|
||||
|
||||
import { DBDriver, DBSource } from '@cloudbeaver/core-app';
|
||||
import { DBDriver, Connection } from '@cloudbeaver/core-app';
|
||||
import { ItemList, ItemListSearch } from '@cloudbeaver/core-blocks';
|
||||
|
||||
import { DBSourceItem } from './DBSourceItem';
|
||||
import { TemplateConnectionItem } from './TemplateConnectionItem';
|
||||
|
||||
type DBSourceSelectorProps = {
|
||||
dbSources: DBSource[];
|
||||
type Props = {
|
||||
templateConnections: Connection[];
|
||||
dbDrivers: Map<string, DBDriver>;
|
||||
className?: string;
|
||||
onSelect(dbSourceId: string): void;
|
||||
}
|
||||
|
||||
export const DBSourceSelector = observer(function DBSourceSelector({
|
||||
dbSources,
|
||||
export const TemplateConnectionSelector = observer(function TemplateConnectionSelector({
|
||||
templateConnections,
|
||||
dbDrivers,
|
||||
className,
|
||||
onSelect,
|
||||
}: DBSourceSelectorProps) {
|
||||
}: Props) {
|
||||
const [search, setSearch] = useState('');
|
||||
const filteredDBSources = useMemo(() => {
|
||||
if (!search) {
|
||||
return dbSources;
|
||||
return templateConnections;
|
||||
}
|
||||
return dbSources.filter(source => source.name.toUpperCase().includes(search.toUpperCase()));
|
||||
}, [search, dbSources]);
|
||||
return templateConnections.filter(template => template.name.toUpperCase().includes(search.toUpperCase()));
|
||||
}, [search, templateConnections]);
|
||||
|
||||
return (
|
||||
<ItemList className={className}>
|
||||
<ItemListSearch onSearch={setSearch} />
|
||||
{filteredDBSources.map(dbSource => (
|
||||
<DBSourceItem
|
||||
key={dbSource.id}
|
||||
dbSource={dbSource}
|
||||
dbDriver={dbDrivers.get(dbSource.driverId)}
|
||||
{filteredDBSources.map(template => (
|
||||
<TemplateConnectionItem
|
||||
key={template.id}
|
||||
template={template}
|
||||
dbDriver={dbDrivers.get(template.driverId)}
|
||||
onSelect={onSelect}
|
||||
/>
|
||||
))}
|
||||
+5
-5
@@ -6,13 +6,13 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { DBSource } from '@cloudbeaver/core-app';
|
||||
import { Connection } from '@cloudbeaver/core-app';
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { EPermission, PermissionsService } from '@cloudbeaver/core-root';
|
||||
import { GraphQLService, CachedDataResource } from '@cloudbeaver/core-sdk';
|
||||
|
||||
@injectable()
|
||||
export class TemplateDataSourceListResource extends CachedDataResource<DBSource[], null> {
|
||||
export class TemplateConnectionsResource extends CachedDataResource<Connection[], null> {
|
||||
constructor(
|
||||
private graphQLService: GraphQLService,
|
||||
private permissionsService: PermissionsService
|
||||
@@ -35,13 +35,13 @@ export class TemplateDataSourceListResource extends CachedDataResource<DBSource[
|
||||
return this.data;
|
||||
}
|
||||
|
||||
protected async loader(key: null): Promise<DBSource[]> {
|
||||
protected async loader(key: null): Promise<Connection[]> {
|
||||
if (!await this.permissionsService.hasAsync(EPermission.public)) {
|
||||
this.markUpdated(key);
|
||||
return [];
|
||||
}
|
||||
const { sources } = await this.graphQLService.gql.templateDataSourceList();
|
||||
const { connections } = await this.graphQLService.gql.getTemplateConnections();
|
||||
this.markUpdated(key);
|
||||
return sources;
|
||||
return connections;
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,5 @@ export default [
|
||||
['basicConnection_connectionDialog_connecting', 'Connecting...'],
|
||||
['basicConnection_connectionDialog_connect', 'Connect'],
|
||||
['basicConnection_connectionDialog_connecting_message', 'Connecting to database...'],
|
||||
['basicConnection_main_menu_item', 'Preconfigured'],
|
||||
['basicConnection_main_menu_item', 'Template'],
|
||||
];
|
||||
|
||||
@@ -9,5 +9,5 @@ export default [
|
||||
['basicConnection_connectionDialog_connecting', 'Подключение...'],
|
||||
['basicConnection_connectionDialog_connect', 'Подключиться'],
|
||||
['basicConnection_connectionDialog_connecting_message', 'Подключение к базе...'],
|
||||
['basicConnection_main_menu_item', 'Подключиться'],
|
||||
['basicConnection_main_menu_item', 'Шаблон'],
|
||||
];
|
||||
|
||||
@@ -10,8 +10,8 @@ import { PluginManifest } from '@cloudbeaver/core-di';
|
||||
|
||||
import { BasicConnectionPluginBootstrap } from './BasicConnectionPluginBootstrap';
|
||||
import { BasicConnectionService } from './BasicConnectionService';
|
||||
import { TemplateDataSourceListResource } from './DataSourcesResource';
|
||||
import { LocaleService } from './LocaleService';
|
||||
import { TemplateConnectionsResource } from './TemplateConnectionsResource';
|
||||
|
||||
export const basicConnectionPluginManifest: PluginManifest = {
|
||||
info: {
|
||||
@@ -20,7 +20,7 @@ export const basicConnectionPluginManifest: PluginManifest = {
|
||||
|
||||
providers: [
|
||||
BasicConnectionService,
|
||||
TemplateDataSourceListResource,
|
||||
TemplateConnectionsResource,
|
||||
LocaleService,
|
||||
],
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ export class ExportFromContainerProcess extends Deferred<string> {
|
||||
containerNodePath,
|
||||
parameters,
|
||||
});
|
||||
this.applyResult(taskInfo);
|
||||
await this.applyResult(taskInfo);
|
||||
this.taskId = taskInfo.id;
|
||||
if (this.getState() === EDeferredState.CANCELLING) {
|
||||
await this.cancelAsync(this.taskId);
|
||||
@@ -80,8 +80,11 @@ export class ExportFromContainerProcess extends Deferred<string> {
|
||||
}
|
||||
// run the first check immediately because usually the query execution is fast
|
||||
try {
|
||||
const { taskInfo } = await this.graphQLService.gql.asyncExportTaskStatus({ taskId: this.taskId });
|
||||
this.applyResult(taskInfo);
|
||||
const { taskInfo } = await this.graphQLService.gql.getAsyncTaskInfo({
|
||||
taskId: this.taskId,
|
||||
removeOnFinish: false,
|
||||
});
|
||||
await this.applyResult(taskInfo);
|
||||
if (this.isFinished) {
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +114,7 @@ export class ExportFromContainerProcess extends Deferred<string> {
|
||||
}
|
||||
}
|
||||
|
||||
private applyResult(taskInfo: AsyncTaskInfo): void {
|
||||
private async applyResult(taskInfo: AsyncTaskInfo) {
|
||||
// task is running
|
||||
if (taskInfo.running) {
|
||||
return;
|
||||
@@ -128,6 +131,7 @@ export class ExportFromContainerProcess extends Deferred<string> {
|
||||
}
|
||||
// task execution successful
|
||||
this.toResolved(taskInfo.taskResult);
|
||||
await this.graphQLService.gql.getAsyncTaskInfo({ taskId: taskInfo.id, removeOnFinish: true });
|
||||
}
|
||||
|
||||
private onError(error: Error, status?: string) {
|
||||
|
||||
@@ -42,7 +42,7 @@ export class ExportFromResultsProcess extends Deferred<string> {
|
||||
resultsId,
|
||||
parameters,
|
||||
});
|
||||
this.applyResult(taskInfo);
|
||||
await this.applyResult(taskInfo);
|
||||
this.taskId = taskInfo.id;
|
||||
if (this.getState() === EDeferredState.CANCELLING) {
|
||||
await this.cancelAsync(this.taskId);
|
||||
@@ -82,8 +82,11 @@ export class ExportFromResultsProcess extends Deferred<string> {
|
||||
}
|
||||
// run the first check immediately because usually the query execution is fast
|
||||
try {
|
||||
const { taskInfo } = await this.graphQLService.gql.asyncExportTaskStatus({ taskId: this.taskId });
|
||||
this.applyResult(taskInfo);
|
||||
const { taskInfo } = await this.graphQLService.gql.getAsyncTaskInfo({
|
||||
taskId: this.taskId,
|
||||
removeOnFinish: false,
|
||||
});
|
||||
await this.applyResult(taskInfo);
|
||||
if (this.isFinished) {
|
||||
return;
|
||||
}
|
||||
@@ -113,7 +116,7 @@ export class ExportFromResultsProcess extends Deferred<string> {
|
||||
}
|
||||
}
|
||||
|
||||
private applyResult(taskInfo: AsyncTaskInfo): void {
|
||||
private async applyResult(taskInfo: AsyncTaskInfo) {
|
||||
// task is running
|
||||
if (taskInfo.running) {
|
||||
return;
|
||||
@@ -130,6 +133,7 @@ export class ExportFromResultsProcess extends Deferred<string> {
|
||||
}
|
||||
// task execution successful
|
||||
this.toResolved(taskInfo.taskResult);
|
||||
await this.graphQLService.gql.getAsyncTaskInfo({ taskId: taskInfo.id, removeOnFinish: true });
|
||||
}
|
||||
|
||||
private onError(error: Error, status?: string) {
|
||||
|
||||
@@ -38,7 +38,7 @@ export class SQLQueryExecutionProcess extends Deferred<SqlExecuteInfo> {
|
||||
// start async task
|
||||
try {
|
||||
const taskInfo = await this.executeQueryAsync(sqlQueryParams, filter);
|
||||
this.applyResult(taskInfo);
|
||||
await this.applyResult(taskInfo);
|
||||
this.taskId = taskInfo.id;
|
||||
if (this.getState() === EDeferredState.CANCELLING) {
|
||||
await this.cancelAsync(this.taskId);
|
||||
@@ -60,7 +60,7 @@ export class SQLQueryExecutionProcess extends Deferred<SqlExecuteInfo> {
|
||||
// run the first check immediately because usually the query execution is fast
|
||||
try {
|
||||
const taskInfo = await this.getQueryStatusAsync(this.taskId);
|
||||
this.applyResult(taskInfo);
|
||||
await this.applyResult(taskInfo);
|
||||
if (this.isFinished) {
|
||||
return;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export class SQLQueryExecutionProcess extends Deferred<SqlExecuteInfo> {
|
||||
}
|
||||
|
||||
private async getQueryStatusAsync(taskId: string): Promise<AsyncTaskInfo> {
|
||||
const { taskInfo } = await this.graphQLService.gql.asyncTaskStatus({ taskId });
|
||||
const { taskInfo } = await this.graphQLService.gql.getAsyncTaskInfo({ taskId, removeOnFinish: false });
|
||||
return taskInfo;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ export class SQLQueryExecutionProcess extends Deferred<SqlExecuteInfo> {
|
||||
await this.graphQLService.gql.asyncTaskCancel({ taskId });
|
||||
}
|
||||
|
||||
private applyResult(taskInfo: AsyncTaskInfo): void {
|
||||
private async applyResult(taskInfo: AsyncTaskInfo) {
|
||||
// task is running
|
||||
if (taskInfo.running) {
|
||||
return;
|
||||
@@ -138,12 +138,14 @@ export class SQLQueryExecutionProcess extends Deferred<SqlExecuteInfo> {
|
||||
this.onError(serverError, taskInfo.status);
|
||||
return;
|
||||
}
|
||||
if (!taskInfo.result) {
|
||||
this.onError(new Error('Tasks execution returns no result'), taskInfo.status);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// task execution successful
|
||||
this.toResolved(taskInfo.result);
|
||||
const { result } = await this.graphQLService.gql.getSqlExecuteTaskResults({ taskId: taskInfo.id });
|
||||
this.toResolved(result);
|
||||
await this.graphQLService.gql.getAsyncTaskInfo({ taskId: taskInfo.id, removeOnFinish: true });
|
||||
} catch (exception) {
|
||||
this.onError(new Error('Tasks execution returns no result'), exception);
|
||||
}
|
||||
}
|
||||
|
||||
private onError(error: Error, status?: string) {
|
||||
|
||||
Reference in New Issue
Block a user