mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-24 23:05:29 +08:00
CB-4067 removes refactor postfix for new state, service and types
This commit is contained in:
@@ -15,7 +15,7 @@ import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { ExecutorInterrupter, type IExecutorHandler } from '@cloudbeaver/core-executor';
|
||||
import type { AdminConnectionSearchInfo } from '@cloudbeaver/core-sdk';
|
||||
import { OptionsPanelService } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionFormServiceRefactored, ConnectionFormStateRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import { ConnectionFormService, ConnectionFormState } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
import { SearchDatabase } from './SearchDatabase.js';
|
||||
|
||||
@@ -28,14 +28,14 @@ export class ConnectionSearchService {
|
||||
|
||||
disabled = false;
|
||||
|
||||
formState: ConnectionFormStateRefactored | null = null;
|
||||
formState: ConnectionFormState | null = null;
|
||||
|
||||
constructor(
|
||||
private readonly notificationService: NotificationService,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
private readonly serviceProvider: IServiceProvider,
|
||||
private readonly optionsPanelService: OptionsPanelService,
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
private readonly commonDialogService: CommonDialogService,
|
||||
private readonly connectionsManagerService: ConnectionsManagerService,
|
||||
) {
|
||||
@@ -147,7 +147,7 @@ export class ConnectionSearchService {
|
||||
}
|
||||
|
||||
if (!this.formState) {
|
||||
this.formState = new ConnectionFormStateRefactored(this.serviceProvider, this.connectionFormServiceRefactored, {
|
||||
this.formState = new ConnectionFormState(this.serviceProvider, this.connectionFormService, {
|
||||
config: {
|
||||
...this.connectionInfoResource.getEmptyConfig(),
|
||||
host: database.host,
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import { useMemo } from 'react';
|
||||
|
||||
import { Loader, s, useS } from '@cloudbeaver/core-blocks';
|
||||
import { type IConnectionInfoParams } from '@cloudbeaver/core-connections';
|
||||
import { ConnectionFormLoader, useConnectionFormStateRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import { ConnectionFormLoader, useConnectionFormState } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
import styles from './ConnectionEdit.module.css';
|
||||
import { FormMode } from '@cloudbeaver/core-ui';
|
||||
@@ -20,7 +20,7 @@ interface Props {
|
||||
}
|
||||
|
||||
export const ConnectionEdit = observer<Props>(function ConnectionEditNew({ item }) {
|
||||
const data = useConnectionFormStateRefactored(item, state => {
|
||||
const data = useConnectionFormState(item, state => {
|
||||
state.setMode(FormMode.Edit);
|
||||
state.setState({
|
||||
...state.state,
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@ import { AdministrationScreenService } from '@cloudbeaver/core-administration';
|
||||
import { injectable, IServiceProvider } from '@cloudbeaver/core-di';
|
||||
import type { ConnectionConfig } from '@cloudbeaver/core-sdk';
|
||||
import { TabsContainer } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionFormServiceRefactored, ConnectionFormStateRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import { ConnectionFormService, ConnectionFormState } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
import { ConnectionsAdministrationNavService } from './ConnectionsAdministrationNavService.js';
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface ICreateMethodOptions {
|
||||
@injectable()
|
||||
export class CreateConnectionService {
|
||||
disabled = false;
|
||||
data: ConnectionFormStateRefactored | null;
|
||||
data: ConnectionFormState | null;
|
||||
|
||||
readonly tabsContainer: TabsContainer<void, ICreateMethodOptions>;
|
||||
|
||||
@@ -33,7 +33,7 @@ export class CreateConnectionService {
|
||||
private readonly connectionsAdministrationNavService: ConnectionsAdministrationNavService,
|
||||
private readonly administrationScreenService: AdministrationScreenService,
|
||||
private readonly serviceProvider: IServiceProvider,
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
) {
|
||||
this.data = null;
|
||||
this.tabsContainer = new TabsContainer('Connection Creation mode');
|
||||
@@ -105,7 +105,7 @@ export class CreateConnectionService {
|
||||
}
|
||||
|
||||
setConnectionTemplate(projectId: string, config: ConnectionConfig, availableDrivers: string[]): void {
|
||||
this.data = new ConnectionFormStateRefactored(this.serviceProvider, this.connectionFormServiceRefactored, {
|
||||
this.data = new ConnectionFormState(this.serviceProvider, this.connectionFormService, {
|
||||
projectId,
|
||||
availableDrivers,
|
||||
config,
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import { ConnectionInfoOriginResource, ConnectionInfoResource, createConnectionP
|
||||
import type { TLocalizationToken } from '@cloudbeaver/core-localization';
|
||||
import { CachedMapAllKey, CachedResourceOffsetPageListKey } from '@cloudbeaver/core-resource';
|
||||
import { type TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormPropsRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import type { IConnectionFormProps } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
import styles from './ConnectionAccess.module.css';
|
||||
import { ConnectionAccessGrantedList } from './ConnectionAccessGrantedList.js';
|
||||
@@ -35,7 +35,7 @@ import { ConnectionAccessList } from './ConnectionAccessList.js';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { getConnectionFormAccessPart } from './getConnectionFormAccessPart.js';
|
||||
|
||||
export const ConnectionAccess: TabContainerPanelComponent<IConnectionFormPropsRefactored> = observer(function ConnectionAccess({ tabId, formState }) {
|
||||
export const ConnectionAccess: TabContainerPanelComponent<IConnectionFormProps> = observer(function ConnectionAccess({ tabId, formState }) {
|
||||
const translate = useTranslate();
|
||||
const style = useS(styles);
|
||||
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ import { AdministrationScreenService } from '@cloudbeaver/core-administration';
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
import { isGlobalProject, ProjectInfoResource } from '@cloudbeaver/core-projects';
|
||||
import { EAdminPermission, PermissionsService } from '@cloudbeaver/core-root';
|
||||
import { ConnectionFormServiceRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import { ConnectionFormService } from '@cloudbeaver/plugin-connections';
|
||||
import { getConnectionFormAccessPart } from './getConnectionFormAccessPart.js';
|
||||
|
||||
const ConnectionAccess = React.lazy(async () => {
|
||||
@@ -24,7 +24,7 @@ export class ConnectionAccessTabService extends Bootstrap {
|
||||
private readonly key: string;
|
||||
|
||||
constructor(
|
||||
private readonly ConnectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly ConnectionFormService: ConnectionFormService,
|
||||
private readonly administrationScreenService: AdministrationScreenService,
|
||||
private readonly permissionsResource: PermissionsService,
|
||||
private readonly projectInfoResource: ProjectInfoResource,
|
||||
@@ -34,7 +34,7 @@ export class ConnectionAccessTabService extends Bootstrap {
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.ConnectionFormServiceRefactored.parts.add({
|
||||
this.ConnectionFormService.parts.add({
|
||||
key: this.key,
|
||||
name: 'connections_connection_edit_access',
|
||||
title: 'connections_connection_edit_access',
|
||||
|
||||
+5
-5
@@ -6,11 +6,11 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
import { FormPart, formStatusContext, type IFormState } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormStateRefactored } from '../../../../plugin-connections/src/ConnectionForm/IConnectionFormStateRefactored.js';
|
||||
import type { IExecutionContextProvider } from '@cloudbeaver/core-executor';
|
||||
import type { IConnectionFormAccessState } from './IConnectionFormAccessState.js';
|
||||
import { createConnectionParam, type ConnectionInfoResource } from '@cloudbeaver/core-connections';
|
||||
import { action, makeObservable } from 'mobx';
|
||||
import type { IConnectionFormState } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
const getDefaultState = () =>
|
||||
({
|
||||
@@ -18,9 +18,9 @@ const getDefaultState = () =>
|
||||
editing: false,
|
||||
}) as IConnectionFormAccessState;
|
||||
|
||||
export class ConnectionFormAccessPart extends FormPart<IConnectionFormAccessState, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormAccessPart extends FormPart<IConnectionFormAccessState, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
) {
|
||||
super(formState, getDefaultState());
|
||||
@@ -51,8 +51,8 @@ export class ConnectionFormAccessPart extends FormPart<IConnectionFormAccessStat
|
||||
}
|
||||
|
||||
protected override async saveChanges(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
const status = contexts.getContext(formStatusContext);
|
||||
const connectionId = this.formState.state.config.connectionId;
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-d
|
||||
import type { IFormState } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionInfoResource } from '@cloudbeaver/core-connections';
|
||||
import { ConnectionFormAccessPart } from './ConnectionFormAccessPart.js';
|
||||
import type { IConnectionFormStateRefactored } from '@cloudbeaver/plugin-connections';
|
||||
import type { IConnectionFormState } from '@cloudbeaver/plugin-connections';
|
||||
|
||||
const DATA_CONTEXT_CONNECTION_FORM_ACCESS_PART = createDataContext<ConnectionFormAccessPart>('Connection Form Access Part');
|
||||
|
||||
export function getConnectionFormAccessPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormAccessPart {
|
||||
export function getConnectionFormAccessPart(formState: IFormState<IConnectionFormState>): ConnectionFormAccessPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_ACCESS_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const connectionInfoResource = di.getService(ConnectionInfoResource);
|
||||
|
||||
@@ -15,14 +15,14 @@ import { formStatusContext, formValidationContext, TabList, TabPanelList, TabsSt
|
||||
|
||||
import { ConnectionFormActionsContext, type IConnectionFormActionsContext } from './ConnectFormActionsContext.js';
|
||||
import style from './ConnectionForm.module.css';
|
||||
import type { ConnectionFormStateRefactored } from './ConnectionFormStateRefactored.js';
|
||||
import type { ConnectionFormState } from './ConnectionFormState.js';
|
||||
import { getFirstException } from '@cloudbeaver/core-utils';
|
||||
import { ConnectionFormServiceRefactored } from './ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from './ConnectionFormService.js';
|
||||
import { ConnectionInfoResource, createConnectionParam } from '@cloudbeaver/core-connections';
|
||||
import { connectionTestContext } from './Contexts/connectionTestContext.js';
|
||||
|
||||
export interface ConnectionFormProps {
|
||||
formState: ConnectionFormStateRefactored;
|
||||
formState: ConnectionFormState;
|
||||
onCancel?: () => void;
|
||||
onSave?: (config: ConnectionConfig) => void;
|
||||
className?: string;
|
||||
@@ -30,7 +30,7 @@ export interface ConnectionFormProps {
|
||||
|
||||
export const ConnectionForm = observer<ConnectionFormProps>(function ConnectionForm({ formState, onCancel, onSave = () => {}, className }) {
|
||||
const props = useObjectRef({ onSave });
|
||||
const service = useService(ConnectionFormServiceRefactored);
|
||||
const service = useService(ConnectionFormService);
|
||||
const styles = useS(style);
|
||||
const notificationService = useService(NotificationService);
|
||||
const connectionInfoResource = useService(ConnectionInfoResource);
|
||||
|
||||
@@ -14,12 +14,10 @@ import { ConnectionInfoResource, createConnectionParam, DatabaseAuthModelsResour
|
||||
import { ServerConfigResource } from '@cloudbeaver/core-root';
|
||||
|
||||
import { ConnectionFormActionsContext } from './ConnectFormActionsContext.js';
|
||||
import type { IConnectionFormPropsRefactored } from './IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from './IConnectionFormState.js';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
|
||||
export const ConnectionFormBaseActions: PlaceholderComponent<IConnectionFormPropsRefactored> = observer(function ConnectionFormBaseActions({
|
||||
formState,
|
||||
}) {
|
||||
export const ConnectionFormBaseActions: PlaceholderComponent<IConnectionFormProps> = observer(function ConnectionFormBaseActions({ formState }) {
|
||||
const actions = useContext(ConnectionFormActionsContext);
|
||||
|
||||
if (!actions) {
|
||||
|
||||
+3
-5
@@ -8,14 +8,12 @@
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { FormBaseService, type IFormProps } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormStateRefactored } from './IConnectionFormStateRefactored.js';
|
||||
import { FormBaseService } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormProps, IConnectionFormState } from './IConnectionFormState.js';
|
||||
import { ConnectionFormBaseActionsLoader } from './ConnectionFormBaseActionsLoader.js';
|
||||
|
||||
export type ConnectionFormRefactoredProps = IFormProps<IConnectionFormStateRefactored>;
|
||||
|
||||
@injectable()
|
||||
export class ConnectionFormServiceRefactored extends FormBaseService<IConnectionFormStateRefactored, ConnectionFormRefactoredProps> {
|
||||
export class ConnectionFormService extends FormBaseService<IConnectionFormState, IConnectionFormProps> {
|
||||
constructor(localizationService: LocalizationService, notificationService: NotificationService) {
|
||||
super(localizationService, notificationService, 'Connection form');
|
||||
|
||||
+4
-4
@@ -8,11 +8,11 @@
|
||||
import type { IServiceProvider } from '@cloudbeaver/core-di';
|
||||
import { FormState } from '@cloudbeaver/core-ui';
|
||||
|
||||
import { ConnectionFormServiceRefactored } from './ConnectionFormServiceRefactored.js';
|
||||
import type { IConnectionFormStateRefactored } from './IConnectionFormStateRefactored.js';
|
||||
import { ConnectionFormService } from './ConnectionFormService.js';
|
||||
import type { IConnectionFormState } from './IConnectionFormState.js';
|
||||
|
||||
export class ConnectionFormStateRefactored extends FormState<IConnectionFormStateRefactored> {
|
||||
constructor(serviceProvider: IServiceProvider, service: ConnectionFormServiceRefactored, config: IConnectionFormStateRefactored) {
|
||||
export class ConnectionFormState extends FormState<IConnectionFormState> {
|
||||
constructor(serviceProvider: IServiceProvider, service: ConnectionFormService, config: IConnectionFormState) {
|
||||
super(serviceProvider, service, config);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -9,16 +9,16 @@
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
import { DriverPropertiesLoader } from './DriverPropertiesLoader.js';
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from '../ConnectionFormService.js';
|
||||
|
||||
@injectable()
|
||||
export class ConnectionDriverPropertiesTabService extends Bootstrap {
|
||||
constructor(private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored) {
|
||||
constructor(private readonly connectionFormService: ConnectionFormService) {
|
||||
super();
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.connectionFormServiceRefactored.parts.add({
|
||||
this.connectionFormService.parts.add({
|
||||
key: 'driver_properties',
|
||||
name: 'plugin_connections_connection_form_part_properties',
|
||||
title: 'plugin_connections_connection_form_part_properties',
|
||||
|
||||
+7
-7
@@ -8,12 +8,12 @@
|
||||
import { FormPart, type IFormState } from '@cloudbeaver/core-ui';
|
||||
import type { IExecutionContextProvider } from '@cloudbeaver/core-executor';
|
||||
import { ConnectionInfoResource, createConnectionParam, type DBDriverResource } from '@cloudbeaver/core-connections';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import type { IConnectionProperties } from '../Options/IConnectionConfig.js';
|
||||
|
||||
export class ConnectionFormDriverPropertiesPart extends FormPart<IConnectionProperties, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormDriverPropertiesPart extends FormPart<IConnectionProperties, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly dbDriverResource: DBDriverResource,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
) {
|
||||
@@ -34,8 +34,8 @@ export class ConnectionFormDriverPropertiesPart extends FormPart<IConnectionProp
|
||||
}
|
||||
|
||||
protected override async saveChanges(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
await this.connectionInfoResource.update(createConnectionParam(this.formState.state.projectId, this.formState.state.config.connectionId!), {
|
||||
connectionId: this.formState.state.config.connectionId,
|
||||
@@ -44,8 +44,8 @@ export class ConnectionFormDriverPropertiesPart extends FormPart<IConnectionProp
|
||||
}
|
||||
|
||||
protected override format(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): void | Promise<void> {
|
||||
const driverId = this.formState.state.config.driverId;
|
||||
|
||||
|
||||
+2
-2
@@ -15,10 +15,10 @@ import { type TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui';
|
||||
import { uuid } from '@cloudbeaver/core-utils';
|
||||
|
||||
import styles from './DriverProperties.module.css';
|
||||
import type { ConnectionFormRefactoredProps } from '../ConnectionFormServiceRefactored.js';
|
||||
import { getConnectionFormDriverPropertiesPart } from './getConnectionFormDriverPropertiesPart.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
export const DriverProperties: TabContainerPanelComponent<ConnectionFormRefactoredProps> = observer(function DriverProperties({ tabId, formState }) {
|
||||
export const DriverProperties: TabContainerPanelComponent<IConnectionFormProps> = observer(function DriverProperties({ tabId, formState }) {
|
||||
const { selected } = useTab(tabId);
|
||||
const style = useS(styles);
|
||||
const driverPropertiesPart = getConnectionFormDriverPropertiesPart(formState);
|
||||
|
||||
+2
-2
@@ -9,13 +9,13 @@ import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-d
|
||||
import type { IFormState } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionFormDriverPropertiesPart } from './ConnectionFormDriverPropertiesPart.js';
|
||||
import { ConnectionInfoResource, DBDriverResource } from '@cloudbeaver/core-connections';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
|
||||
const DATA_CONTEXT_CONNECTION_FORM_DRIVER_PROPERTIES_PART = createDataContext<ConnectionFormDriverPropertiesPart>(
|
||||
'Connection Form Driver Properties Part',
|
||||
);
|
||||
|
||||
export function getConnectionFormDriverPropertiesPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormDriverPropertiesPart {
|
||||
export function getConnectionFormDriverPropertiesPart(formState: IFormState<IConnectionFormState>): ConnectionFormDriverPropertiesPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_DRIVER_PROPERTIES_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const dbDriverResource = di.getService(DBDriverResource);
|
||||
|
||||
+2
-2
@@ -21,5 +21,5 @@ export const CONNECTION_FORM_STATE_SCHEMA = schema
|
||||
.required()
|
||||
.strict();
|
||||
|
||||
export type IConnectionFormStateRefactored = schema.infer<typeof CONNECTION_FORM_STATE_SCHEMA>;
|
||||
export type IConnectionFormPropsRefactored = IFormProps<IConnectionFormStateRefactored>;
|
||||
export type IConnectionFormState = schema.infer<typeof CONNECTION_FORM_STATE_SCHEMA>;
|
||||
export type IConnectionFormProps = IFormProps<IConnectionFormState>;
|
||||
+10
-10
@@ -27,7 +27,7 @@ import { getConnectionName } from './getConnectionName.js';
|
||||
import type { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import { connectionCredentialsStateContext } from '../Contexts/connectionCredentialsStateContext.js';
|
||||
import type { IConnectionFormOptionsState } from './IConnectionFormOptionsState.js';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import { connectionTestContext } from '../Contexts/connectionTestContext.js';
|
||||
|
||||
const MAIN_PROPERTY_DATABASE_KEY = 'database';
|
||||
@@ -66,9 +66,9 @@ const defaultStateGetter = () =>
|
||||
userPassword: '',
|
||||
}) as IConnectionFormOptionsState;
|
||||
|
||||
export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsState, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsState, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly dbDriverResource: DBDriverResource,
|
||||
private readonly projectInfoResource: ProjectInfoResource,
|
||||
private readonly databaseAuthModelsResource: DatabaseAuthModelsResource,
|
||||
@@ -81,7 +81,7 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
super(formState, defaultStateGetter());
|
||||
}
|
||||
|
||||
private async formAuthState(data: IConnectionFormStateRefactored, contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>) {
|
||||
private async formAuthState(data: IConnectionFormState, contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>) {
|
||||
const stateContext = contexts.getContext(formStateContext);
|
||||
|
||||
if (!this.formState.state.projectId || !this.formState.state.config.connectionId) {
|
||||
@@ -221,8 +221,8 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
}
|
||||
|
||||
protected override async format(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
const credentialsState = contexts.getContext(connectionCredentialsStateContext);
|
||||
|
||||
@@ -365,8 +365,8 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
}
|
||||
|
||||
protected override async validate(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
const validation = contexts.getContext(formValidationContext);
|
||||
|
||||
@@ -403,8 +403,8 @@ export class ConnectionFormOptionsPart extends FormPart<IConnectionFormOptionsSt
|
||||
}
|
||||
|
||||
protected override async saveChanges(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
const status = contexts.getContext(formStatusContext);
|
||||
const state = this.formState.state;
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import React from 'react';
|
||||
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from '../ConnectionFormService.js';
|
||||
|
||||
export const Options = React.lazy(async () => {
|
||||
const { Options } = await import('./Options.js');
|
||||
@@ -18,12 +18,12 @@ export const Options = React.lazy(async () => {
|
||||
|
||||
@injectable()
|
||||
export class ConnectionOptionsTabService extends Bootstrap {
|
||||
constructor(private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored) {
|
||||
constructor(private readonly connectionFormService: ConnectionFormService) {
|
||||
super();
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.connectionFormServiceRefactored.parts.add({
|
||||
this.connectionFormService.parts.add({
|
||||
key: 'options',
|
||||
name: 'plugin_connections_connection_form_part_main',
|
||||
order: 1,
|
||||
|
||||
@@ -61,8 +61,8 @@ import styles from './Options.module.css';
|
||||
import { ParametersForm } from './ParametersForm.js';
|
||||
import { ProviderPropertiesForm } from './ProviderPropertiesForm.js';
|
||||
import { useOptions } from './useOptions.js';
|
||||
import type { ConnectionFormRefactoredProps } from '../ConnectionFormServiceRefactored.js';
|
||||
import { getConnectionFormOptionsPart } from './getConnectionFormOptionsPart.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
const PROFILE_AUTH_MODEL_ID = 'profile';
|
||||
|
||||
@@ -86,7 +86,7 @@ const driverConfiguration: IDriverConfiguration[] = [
|
||||
isVisible: driver => driver.configurationTypes.includes(DriverConfigurationType.Url),
|
||||
},
|
||||
];
|
||||
export const Options: TabContainerPanelComponent<ConnectionFormRefactoredProps> = observer(function Options({ formState }) {
|
||||
export const Options: TabContainerPanelComponent<IConnectionFormProps> = observer(function Options({ formState }) {
|
||||
const isAdmin = usePermission(EAdminPermission.admin);
|
||||
const serverConfigResource = useResource(Options, ServerConfigResource, undefined);
|
||||
const projectInfoResource = useService(ProjectInfoResource);
|
||||
|
||||
+2
-2
@@ -12,11 +12,11 @@ import { ConnectionInfoOriginResource, ConnectionInfoResource, DatabaseAuthModel
|
||||
import { ProjectInfoResource } from '@cloudbeaver/core-projects';
|
||||
import { AuthProvidersResource, UserInfoResource } from '@cloudbeaver/core-authentication';
|
||||
import { LocalizationService } from '@cloudbeaver/core-localization';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
|
||||
const DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART = createDataContext<ConnectionFormOptionsPart>('Connection Form Options Part');
|
||||
|
||||
export function getConnectionFormOptionsPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormOptionsPart {
|
||||
export function getConnectionFormOptionsPart(formState: IFormState<IConnectionFormState>): ConnectionFormOptionsPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const dbDriverResource = di.getService(DBDriverResource);
|
||||
|
||||
@@ -14,9 +14,9 @@ import type { ConnectionConfig, DatabaseAuthModel } from '@cloudbeaver/core-sdk'
|
||||
import { getConnectionName } from './getConnectionName.js';
|
||||
import { getDefaultConfigurationType } from './getDefaultConfigurationType.js';
|
||||
import type { IFormState } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
|
||||
export function useOptions(formState: IFormState<IConnectionFormStateRefactored>, config: ConnectionConfig) {
|
||||
export function useOptions(formState: IFormState<IConnectionFormState>, config: ConnectionConfig) {
|
||||
const mode = formState.mode;
|
||||
const connectionInfoService = useService(ConnectionInfoResource);
|
||||
const info = connectionInfoService.get(createConnectionParam(formState.state.projectId, formState.state.config.connectionId!));
|
||||
|
||||
+19
-21
@@ -11,12 +11,10 @@ import { AUTH_PROVIDER_LOCAL_ID } from '@cloudbeaver/core-authentication';
|
||||
import { Button, getComputed, type PlaceholderComponent, useResource, useTranslate, useAuthenticationAction } from '@cloudbeaver/core-blocks';
|
||||
import { ConnectionInfoResource, createConnectionParam, DatabaseAuthModelsResource, DBDriverResource } from '@cloudbeaver/core-connections';
|
||||
|
||||
import type { IConnectionFormPropsRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
|
||||
export const AuthenticationButton: PlaceholderComponent<IConnectionFormPropsRefactored> = observer(function ConnectionFormAuthenticationAction({
|
||||
formState,
|
||||
}) {
|
||||
export const AuthenticationButton: PlaceholderComponent<IConnectionFormProps> = observer(function ConnectionFormAuthenticationAction({ formState }) {
|
||||
const translate = useTranslate();
|
||||
const driverMap = useResource(ConnectionFormAuthenticationAction, DBDriverResource, formState.state.config.driverId || null);
|
||||
const connectionInfoService = useService(ConnectionInfoResource);
|
||||
@@ -45,23 +43,23 @@ export const AuthenticationButton: PlaceholderComponent<IConnectionFormPropsRefa
|
||||
);
|
||||
});
|
||||
|
||||
export const ConnectionFormAuthenticationAction: PlaceholderComponent<IConnectionFormPropsRefactored> = observer(
|
||||
function ConnectionFormAuthenticationAction({ formState }) {
|
||||
const driverMap = useResource(ConnectionFormAuthenticationAction, DBDriverResource, formState.state.config.driverId || null);
|
||||
const connectionInfoService = useService(ConnectionInfoResource);
|
||||
const info = connectionInfoService.get(createConnectionParam(formState.state.projectId, formState.state.config.connectionId!));
|
||||
export const ConnectionFormAuthenticationAction: PlaceholderComponent<IConnectionFormProps> = observer(function ConnectionFormAuthenticationAction({
|
||||
formState,
|
||||
}) {
|
||||
const driverMap = useResource(ConnectionFormAuthenticationAction, DBDriverResource, formState.state.config.driverId || null);
|
||||
const connectionInfoService = useService(ConnectionInfoResource);
|
||||
const info = connectionInfoService.get(createConnectionParam(formState.state.projectId, formState.state.config.connectionId!));
|
||||
|
||||
const driver = driverMap.data;
|
||||
const { data: authModel } = useResource(
|
||||
ConnectionFormAuthenticationAction,
|
||||
DatabaseAuthModelsResource,
|
||||
getComputed(() => formState.state.config.authModelId || info?.authModel || driver?.defaultAuthModel || null),
|
||||
);
|
||||
const driver = driverMap.data;
|
||||
const { data: authModel } = useResource(
|
||||
ConnectionFormAuthenticationAction,
|
||||
DatabaseAuthModelsResource,
|
||||
getComputed(() => formState.state.config.authModelId || info?.authModel || driver?.defaultAuthModel || null),
|
||||
);
|
||||
|
||||
if (!authModel?.requiredAuth && !info?.requiredAuth) {
|
||||
return null;
|
||||
}
|
||||
if (!authModel?.requiredAuth && !info?.requiredAuth) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <AuthenticationButton formState={formState} />;
|
||||
},
|
||||
);
|
||||
return <AuthenticationButton formState={formState} />;
|
||||
});
|
||||
|
||||
+4
-4
@@ -8,7 +8,7 @@
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import { FormPart, type IFormState } from '@cloudbeaver/core-ui';
|
||||
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import type { IConnectionFormOriginInfoState } from './IConnectionFormOriginInfoState.js';
|
||||
import {
|
||||
ConnectionInfoResource,
|
||||
@@ -23,9 +23,9 @@ import { computed, makeObservable } from 'mobx';
|
||||
const defaultStateGetter = () => ({}) as IConnectionFormOriginInfoState;
|
||||
|
||||
@injectable()
|
||||
export class ConnectionFormOriginInfoFormPart extends FormPart<IConnectionFormOriginInfoState, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormOriginInfoFormPart extends FormPart<IConnectionFormOriginInfoState, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly connectionInfoOriginDetailsResource: ConnectionInfoOriginDetailsResource,
|
||||
private readonly userInfoResource: UserInfoResource,
|
||||
private readonly databaseAuthModelsResource: DatabaseAuthModelsResource,
|
||||
@@ -100,7 +100,7 @@ export class ConnectionFormOriginInfoFormPart extends FormPart<IConnectionFormOr
|
||||
this.setInitialState(state);
|
||||
}
|
||||
|
||||
protected override async saveChanges(data: IFormState<IConnectionFormStateRefactored>): Promise<void> {
|
||||
protected override async saveChanges(data: IFormState<IConnectionFormState>): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -9,7 +9,7 @@
|
||||
import { ConnectionInfoOriginResource, createConnectionParam, isLocalConnection } from '@cloudbeaver/core-connections';
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from '../ConnectionFormService.js';
|
||||
import { importLazyComponent } from '@cloudbeaver/core-blocks';
|
||||
|
||||
export const ConnectionFormAuthenticationAction = importLazyComponent(() =>
|
||||
@@ -22,14 +22,14 @@ export const OriginInfoTab = importLazyComponent(() => import('./OriginInfoTab.j
|
||||
@injectable()
|
||||
export class ConnectionOriginInfoTabService extends Bootstrap {
|
||||
constructor(
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
private readonly connectionInfoOriginResource: ConnectionInfoOriginResource,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.connectionFormServiceRefactored.parts.add({
|
||||
this.connectionFormService.parts.add({
|
||||
key: 'origin',
|
||||
order: 3,
|
||||
tab: () => OriginInfoTab,
|
||||
@@ -48,6 +48,6 @@ export class ConnectionOriginInfoTabService extends Bootstrap {
|
||||
},
|
||||
});
|
||||
|
||||
this.connectionFormServiceRefactored.actionsContainer.add(ConnectionFormAuthenticationAction, 0);
|
||||
this.connectionFormService.actionsContainer.add(ConnectionFormAuthenticationAction, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ import { ConnectionInfoOriginDetailsResource, ConnectionInfoResource, createConn
|
||||
import { type TabContainerPanelComponent, useTab } from '@cloudbeaver/core-ui';
|
||||
|
||||
import styles from './OriginInfo.module.css';
|
||||
import type { IConnectionFormPropsRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { getConnectionFormOriginInfoFormPart } from './getConnectionFormOriginInfoFormPart.js';
|
||||
|
||||
export const OriginInfo: TabContainerPanelComponent<IConnectionFormPropsRefactored> = observer(function OriginInfo({ tabId, formState }) {
|
||||
export const OriginInfo: TabContainerPanelComponent<IConnectionFormProps> = observer(function OriginInfo({ tabId, formState }) {
|
||||
const tab = useTab(tabId);
|
||||
const translate = useTranslate();
|
||||
const originInfoPart = getConnectionFormOriginInfoFormPart(formState);
|
||||
|
||||
@@ -10,11 +10,11 @@ import { observer } from 'mobx-react-lite';
|
||||
import { Translate } from '@cloudbeaver/core-blocks';
|
||||
import { Tab, type TabContainerTabComponent, TabTitle } from '@cloudbeaver/core-ui';
|
||||
|
||||
import type { IConnectionFormPropsRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
import { ConnectionInfoOriginResource, createConnectionParam } from '@cloudbeaver/core-connections';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
|
||||
export const OriginInfoTab: TabContainerTabComponent<IConnectionFormPropsRefactored> = observer(function OriginInfoTab({ formState, ...rest }) {
|
||||
export const OriginInfoTab: TabContainerTabComponent<IConnectionFormProps> = observer(function OriginInfoTab({ formState, ...rest }) {
|
||||
const connectionInfoOriginService = useService(ConnectionInfoOriginResource);
|
||||
const info = connectionInfoOriginService.get(createConnectionParam(formState.state.projectId, formState.state.config.connectionId!));
|
||||
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ import {
|
||||
DatabaseAuthModelsResource,
|
||||
DBDriverResource,
|
||||
} from '@cloudbeaver/core-connections';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import { ConnectionFormOriginInfoFormPart } from './ConnectionFormOriginInfoFormPart.js';
|
||||
import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-data-context';
|
||||
import { UserInfoResource } from '@cloudbeaver/core-authentication';
|
||||
@@ -22,7 +22,7 @@ const DATA_CONTEXT_CONNECTION_FORM_ORIGIN_INFO_FORM_PART = createDataContext<Con
|
||||
'Connection Form Origin Info Form Part',
|
||||
);
|
||||
|
||||
export function getConnectionFormOriginInfoFormPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormOriginInfoFormPart {
|
||||
export function getConnectionFormOriginInfoFormPart(formState: IFormState<IConnectionFormState>): ConnectionFormOriginInfoFormPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_ORIGIN_INFO_FORM_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const connectionInfoOriginDetailsResource = di.getService(ConnectionInfoOriginDetailsResource);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { DriverConfigurationType, NetworkHandlerAuthType, type NetworkHandlerCon
|
||||
import { ConnectionInfoResource, createConnectionParam, SSH_TUNNEL_ID } from '@cloudbeaver/core-connections';
|
||||
import { toJS } from 'mobx';
|
||||
import { connectionCredentialsStateContext } from '../Contexts/connectionCredentialsStateContext.js';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import type { INetworkHandlerConfig } from '../Options/IConnectionNetworkHanler.js';
|
||||
import { getConnectionFormOptionsPart } from '../Options/getConnectionFormOptionsPart.js';
|
||||
import { isNotNullDefined } from '@cloudbeaver/core-utils';
|
||||
@@ -33,9 +33,9 @@ const DEFAULT_SSH_NETWORK_HANDLER: INetworkHandlerConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
export class ConnectionFormSSHPart extends FormPart<INetworkHandlerConfig, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormSSHPart extends FormPart<INetworkHandlerConfig, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
) {
|
||||
super(formState, DEFAULT_SSH_NETWORK_HANDLER);
|
||||
@@ -55,13 +55,13 @@ export class ConnectionFormSSHPart extends FormPart<INetworkHandlerConfig, IConn
|
||||
}
|
||||
|
||||
protected override async saveChanges(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {}
|
||||
|
||||
protected override format(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): void | Promise<void> {
|
||||
const credentialsState = contexts.getContext(connectionCredentialsStateContext);
|
||||
const optionsPart = getConnectionFormOptionsPart(this.formState);
|
||||
@@ -108,8 +108,8 @@ export class ConnectionFormSSHPart extends FormPart<INetworkHandlerConfig, IConn
|
||||
}
|
||||
|
||||
protected override validate(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): void | Promise<void> {
|
||||
const validation = contexts.getContext(formValidationContext);
|
||||
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ import { DBDriverResource, SSH_TUNNEL_ID } from '@cloudbeaver/core-connections';
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
import { DriverConfigurationType } from '@cloudbeaver/core-sdk';
|
||||
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from '../ConnectionFormService.js';
|
||||
import { getConnectionFormOptionsPart } from '../Options/getConnectionFormOptionsPart.js';
|
||||
|
||||
export const SSHTab = React.lazy(async () => {
|
||||
@@ -27,13 +27,13 @@ export const SSHPanel = React.lazy(async () => {
|
||||
export class ConnectionSSHTabService extends Bootstrap {
|
||||
constructor(
|
||||
private readonly dbDriverResource: DBDriverResource,
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.connectionFormServiceRefactored.parts.add({
|
||||
this.connectionFormService.parts.add({
|
||||
key: 'ssh',
|
||||
name: 'plugin_connections_connection_form_part_main',
|
||||
order: 3,
|
||||
|
||||
@@ -38,12 +38,12 @@ import { isSafari } from '@cloudbeaver/core-utils';
|
||||
import { authTypes } from './authTypes.js';
|
||||
import styles from './SSH.module.css';
|
||||
import { SSHKeyUploader } from './SSHKeyUploader.js';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import { getConnectionFormSSHPart } from './getConnectionFormSSHPart.js';
|
||||
|
||||
interface Props {
|
||||
handlerState: NetworkHandlerConfigInput;
|
||||
formState: IFormState<IConnectionFormStateRefactored>;
|
||||
formState: IFormState<IConnectionFormState>;
|
||||
}
|
||||
|
||||
export const SSH: TabContainerPanelComponent<Props> = observer(function SSH({ formState, handlerState }) {
|
||||
|
||||
@@ -10,11 +10,11 @@ import { observer } from 'mobx-react-lite';
|
||||
import type { TabContainerPanelComponent } from '@cloudbeaver/core-ui';
|
||||
|
||||
import { SSH } from './SSH.js';
|
||||
import type { ConnectionFormRefactoredProps } from '../ConnectionFormServiceRefactored.js';
|
||||
import { useAutoLoad } from '@cloudbeaver/core-blocks';
|
||||
import { getConnectionFormSSHPart } from './getConnectionFormSSHPart.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
export const SSHPanel: TabContainerPanelComponent<ConnectionFormRefactoredProps> = observer(function SSHPanel(props) {
|
||||
export const SSHPanel: TabContainerPanelComponent<IConnectionFormProps> = observer(function SSHPanel(props) {
|
||||
const SSHPart = getConnectionFormSSHPart(props.formState);
|
||||
|
||||
useAutoLoad(SSHPanel, SSHPart);
|
||||
|
||||
@@ -10,10 +10,9 @@ import { observer } from 'mobx-react-lite';
|
||||
import { Translate, useResource } from '@cloudbeaver/core-blocks';
|
||||
import { NetworkHandlerResource, SSH_TUNNEL_ID } from '@cloudbeaver/core-connections';
|
||||
import { Tab, type TabContainerTabComponent, TabTitle } from '@cloudbeaver/core-ui';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
import type { ConnectionFormRefactoredProps } from '../ConnectionFormServiceRefactored.js';
|
||||
|
||||
export const SSHTab: TabContainerTabComponent<ConnectionFormRefactoredProps> = observer(function SSHTab(props) {
|
||||
export const SSHTab: TabContainerTabComponent<IConnectionFormProps> = observer(function SSHTab(props) {
|
||||
const handler = useResource(SSHTab, NetworkHandlerResource, SSH_TUNNEL_ID);
|
||||
|
||||
return (
|
||||
|
||||
+2
-2
@@ -9,11 +9,11 @@ import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-d
|
||||
import type { IFormState } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionFormSSHPart } from './ConnectionFormSSHPart.js';
|
||||
import { ConnectionInfoResource } from '@cloudbeaver/core-connections';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
|
||||
const DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART = createDataContext<ConnectionFormSSHPart>('Connection Form SSH Part');
|
||||
|
||||
export function getConnectionFormSSHPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormSSHPart {
|
||||
export function getConnectionFormSSHPart(formState: IFormState<IConnectionFormState>): ConnectionFormSSHPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const connectionInfoResource = di.getService(ConnectionInfoResource);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { FormPart, type IFormState } from '@cloudbeaver/core-ui';
|
||||
|
||||
import type { IExecutionContextProvider } from '@cloudbeaver/core-executor';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import { type NetworkHandlerConfigInput } from '@cloudbeaver/core-sdk';
|
||||
import { isNotNullDefined } from '@cloudbeaver/core-utils';
|
||||
import { getSSLDriverHandler } from './getSSLDriverHandler.js';
|
||||
@@ -34,9 +34,9 @@ const DEFAULT_SSL_NETWORK_HANDLER: INetworkHandlerConfig = {
|
||||
secureProperties: {},
|
||||
};
|
||||
|
||||
export class ConnectionFormSSLPart extends FormPart<INetworkHandlerConfig, IConnectionFormStateRefactored> {
|
||||
export class ConnectionFormSSLPart extends FormPart<INetworkHandlerConfig, IConnectionFormState> {
|
||||
constructor(
|
||||
formState: IFormState<IConnectionFormStateRefactored>,
|
||||
formState: IFormState<IConnectionFormState>,
|
||||
private readonly dbDriverResource: DBDriverResource,
|
||||
private readonly networkHandlerResource: NetworkHandlerResource,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
@@ -76,8 +76,8 @@ export class ConnectionFormSSLPart extends FormPart<INetworkHandlerConfig, IConn
|
||||
}
|
||||
|
||||
protected override async format(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {
|
||||
const credentialsState = contexts.getContext(connectionCredentialsStateContext);
|
||||
const optionsPart = getConnectionFormOptionsPart(this.formState);
|
||||
@@ -159,8 +159,8 @@ export class ConnectionFormSSLPart extends FormPart<INetworkHandlerConfig, IConn
|
||||
}
|
||||
|
||||
protected override async saveChanges(
|
||||
data: IFormState<IConnectionFormStateRefactored>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormStateRefactored>>,
|
||||
data: IFormState<IConnectionFormState>,
|
||||
contexts: IExecutionContextProvider<IFormState<IConnectionFormState>>,
|
||||
): Promise<void> {}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ import { DBDriverResource, NetworkHandlerResource } from '@cloudbeaver/core-conn
|
||||
import { Bootstrap, injectable } from '@cloudbeaver/core-di';
|
||||
|
||||
import { getSSLDriverHandler } from './getSSLDriverHandler.js';
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormService } from '../ConnectionFormService.js';
|
||||
|
||||
export const SSLTab = React.lazy(async () => {
|
||||
const { SSLTab } = await import('./SSLTab.js');
|
||||
@@ -27,13 +27,13 @@ export class ConnectionSSLTabService extends Bootstrap {
|
||||
constructor(
|
||||
private readonly dbDriverResource: DBDriverResource,
|
||||
private readonly networkHandlerResource: NetworkHandlerResource,
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
override register(): void {
|
||||
this.connectionFormServiceRefactored.parts.add({
|
||||
this.connectionFormService.parts.add({
|
||||
key: 'ssl',
|
||||
order: 4,
|
||||
tab: () => SSLTab,
|
||||
|
||||
@@ -33,11 +33,11 @@ import { isSafari } from '@cloudbeaver/core-utils';
|
||||
|
||||
import { SAVED_VALUE_INDICATOR } from './SAVED_VALUE_INDICATOR.js';
|
||||
import styles from './SSL.module.css';
|
||||
import type { IConnectionFormPropsRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
import { ConnectionInfoResource, createConnectionParam } from '@cloudbeaver/core-connections';
|
||||
import { getConnectionFormOptionsPart } from '../Options/getConnectionFormOptionsPart.js';
|
||||
|
||||
interface Props extends IConnectionFormPropsRefactored {
|
||||
interface Props extends IConnectionFormProps {
|
||||
handler: NetworkHandlerDescriptor;
|
||||
handlerState: NetworkHandlerConfigInput;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ import type { TabContainerTabComponent } from '@cloudbeaver/core-ui';
|
||||
import { getSSLDriverHandler } from './getSSLDriverHandler.js';
|
||||
import { SSL } from './SSL.js';
|
||||
import { getConnectionFormSSLPart } from './getConnectionFormSSLPart.js';
|
||||
import type { IConnectionFormPropsRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
export const SSLPanel: TabContainerTabComponent<IConnectionFormPropsRefactored> = observer(function SSLPanel(props) {
|
||||
export const SSLPanel: TabContainerTabComponent<IConnectionFormProps> = observer(function SSLPanel(props) {
|
||||
const networkHandlerResource = useResource(SSLPanel, NetworkHandlerResource, CachedMapAllKey);
|
||||
const dbDriverResource = useResource(SSLPanel, DBDriverResource, props.formState.state.config.driverId ?? null);
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ import { CachedMapAllKey } from '@cloudbeaver/core-resource';
|
||||
import { Tab, type TabContainerTabComponent, TabTitle } from '@cloudbeaver/core-ui';
|
||||
|
||||
import { getSSLDriverHandler } from './getSSLDriverHandler.js';
|
||||
import type { ConnectionFormRefactoredProps } from '../ConnectionFormServiceRefactored.js';
|
||||
import type { IConnectionFormProps } from '../IConnectionFormState.js';
|
||||
|
||||
export const SSLTab: TabContainerTabComponent<ConnectionFormRefactoredProps> = observer(function SSLTab(props) {
|
||||
export const SSLTab: TabContainerTabComponent<IConnectionFormProps> = observer(function SSLTab(props) {
|
||||
const networkHandlerResource = useResource(SSLTab, NetworkHandlerResource, CachedMapAllKey);
|
||||
const dbDriverResource = useResource(SSLTab, DBDriverResource, props.formState.state.config.driverId ?? null);
|
||||
|
||||
|
||||
+2
-2
@@ -8,12 +8,12 @@
|
||||
import { createDataContext, DATA_CONTEXT_DI_PROVIDER } from '@cloudbeaver/core-data-context';
|
||||
import type { IFormState } from '@cloudbeaver/core-ui';
|
||||
import { ConnectionFormSSLPart } from './ConnectionFormSSLPart.js';
|
||||
import type { IConnectionFormStateRefactored } from '../IConnectionFormStateRefactored.js';
|
||||
import type { IConnectionFormState } from '../IConnectionFormState.js';
|
||||
import { ConnectionInfoResource, DBDriverResource, NetworkHandlerResource } from '@cloudbeaver/core-connections';
|
||||
|
||||
const DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART = createDataContext<ConnectionFormSSLPart>('Connection Form SSL Part');
|
||||
|
||||
export function getConnectionFormSSLPart(formState: IFormState<IConnectionFormStateRefactored>): ConnectionFormSSLPart {
|
||||
export function getConnectionFormSSLPart(formState: IFormState<IConnectionFormState>): ConnectionFormSSLPart {
|
||||
return formState.getPart(DATA_CONTEXT_CONNECTION_FORM_OPTIONS_PART, context => {
|
||||
const di = context.get(DATA_CONTEXT_DI_PROVIDER)!;
|
||||
const dbDriverResource = di.getService(DBDriverResource);
|
||||
|
||||
+8
-11
@@ -7,12 +7,12 @@
|
||||
*/
|
||||
import { useRef } from 'react';
|
||||
import { IServiceProvider, useService } from '@cloudbeaver/core-di';
|
||||
import { ConnectionFormStateRefactored } from './ConnectionFormStateRefactored.js';
|
||||
import { ConnectionFormServiceRefactored } from './ConnectionFormServiceRefactored.js';
|
||||
import type { IConnectionFormStateRefactored } from './IConnectionFormStateRefactored.js';
|
||||
import { ConnectionFormState } from './ConnectionFormState.js';
|
||||
import { ConnectionFormService } from './ConnectionFormService.js';
|
||||
import type { IConnectionFormState } from './IConnectionFormState.js';
|
||||
import type { IConnectionInfoParams } from '@cloudbeaver/core-connections';
|
||||
|
||||
const EMPTY_CONNECTION_INFO_PARAMS: IConnectionFormStateRefactored = {
|
||||
const EMPTY_CONNECTION_INFO_PARAMS: IConnectionFormState = {
|
||||
projectId: '',
|
||||
config: {},
|
||||
submitType: 'submit',
|
||||
@@ -20,16 +20,13 @@ const EMPTY_CONNECTION_INFO_PARAMS: IConnectionFormStateRefactored = {
|
||||
type: 'admin',
|
||||
};
|
||||
|
||||
export function useConnectionFormStateRefactored(
|
||||
params: IConnectionInfoParams,
|
||||
configure?: (state: ConnectionFormStateRefactored) => any,
|
||||
): ConnectionFormStateRefactored {
|
||||
export function useConnectionFormState(params: IConnectionInfoParams, configure?: (state: ConnectionFormState) => any): ConnectionFormState {
|
||||
const serviceProvider = useService(IServiceProvider);
|
||||
const service = useService(ConnectionFormServiceRefactored);
|
||||
const ref = useRef<ConnectionFormStateRefactored>(null);
|
||||
const service = useService(ConnectionFormService);
|
||||
const ref = useRef<ConnectionFormState>(null);
|
||||
|
||||
if (ref.current?.state.config.connectionId !== params.connectionId || ref.current?.state.projectId !== params.projectId) {
|
||||
ref.current = new ConnectionFormStateRefactored(serviceProvider, service, {
|
||||
ref.current = new ConnectionFormState(serviceProvider, service, {
|
||||
...EMPTY_CONNECTION_INFO_PARAMS,
|
||||
projectId: params.projectId,
|
||||
config: {
|
||||
+5
-5
@@ -19,8 +19,8 @@ import type { ConnectionConfig } from '@cloudbeaver/core-sdk';
|
||||
import { FormMode, OptionsPanelService } from '@cloudbeaver/core-ui';
|
||||
import { AuthenticationService } from '@cloudbeaver/plugin-authentication';
|
||||
|
||||
import { ConnectionFormStateRefactored } from '../ConnectionForm/ConnectionFormStateRefactored.js';
|
||||
import { ConnectionFormServiceRefactored } from '../ConnectionForm/ConnectionFormServiceRefactored.js';
|
||||
import { ConnectionFormState } from '../ConnectionForm/ConnectionFormState.js';
|
||||
import { ConnectionFormService } from '../ConnectionForm/ConnectionFormService.js';
|
||||
|
||||
const PublicConnectionForm = importLazyComponent(() => import('./PublicConnectionForm.js').then(m => m.PublicConnectionForm));
|
||||
|
||||
@@ -28,14 +28,14 @@ const formGetter = () => PublicConnectionForm;
|
||||
|
||||
@injectable()
|
||||
export class PublicConnectionFormService {
|
||||
formState: ConnectionFormStateRefactored | null;
|
||||
formState: ConnectionFormState | null;
|
||||
|
||||
constructor(
|
||||
private readonly commonDialogService: CommonDialogService,
|
||||
private readonly notificationService: NotificationService,
|
||||
private readonly optionsPanelService: OptionsPanelService,
|
||||
private readonly serviceProvider: IServiceProvider,
|
||||
private readonly connectionFormServiceRefactored: ConnectionFormServiceRefactored,
|
||||
private readonly connectionFormService: ConnectionFormService,
|
||||
private readonly connectionInfoResource: ConnectionInfoResource,
|
||||
private readonly connectionsManagerService: ConnectionsManagerService,
|
||||
private readonly userInfoResource: UserInfoResource,
|
||||
@@ -76,7 +76,7 @@ export class PublicConnectionFormService {
|
||||
}
|
||||
|
||||
if (!this.formState) {
|
||||
this.formState = new ConnectionFormStateRefactored(this.serviceProvider, this.connectionFormServiceRefactored, {
|
||||
this.formState = new ConnectionFormState(this.serviceProvider, this.connectionFormService, {
|
||||
projectId,
|
||||
availableDrivers: availableDrivers ?? [],
|
||||
config,
|
||||
|
||||
@@ -16,10 +16,10 @@ export * from './ConnectionForm/OriginInfo/ConnectionOriginInfoTabService.js';
|
||||
export * from './ConnectionForm/Contexts/connectionCredentialsStateContext.js';
|
||||
export * from './ConnectionForm/ConnectionFormBaseActionsLoader.js';
|
||||
export * from './ConnectionForm/ConnectionFormLoader.js';
|
||||
export * from './ConnectionForm/IConnectionFormStateRefactored.js';
|
||||
export * from './ConnectionForm/ConnectionFormStateRefactored.js';
|
||||
export * from './ConnectionForm/useConnectionFormStateRefactored.js';
|
||||
export * from './ConnectionForm/ConnectionFormServiceRefactored.js';
|
||||
export * from './ConnectionForm/IConnectionFormState.js';
|
||||
export * from './ConnectionForm/ConnectionFormState.js';
|
||||
export * from './ConnectionForm/useConnectionFormState.js';
|
||||
export * from './ConnectionForm/ConnectionFormService.js';
|
||||
export * from './ConnectionForm/Options/getConnectionFormOptionsPart.js';
|
||||
export * from './ConnectionForm/SharedCredentials/CONNECTION_FORM_SHARED_CREDENTIALS_TAB_ID.js';
|
||||
export * from './ConnectionForm/ConnectionAuthModelCredentials/ConnectionAuthModelCredentialsForm.js';
|
||||
|
||||
@@ -25,6 +25,6 @@ export const connectionPlugin: PluginManifest = {
|
||||
() => import('./NavNodes/ConnectionFoldersBootstrap.js').then(m => m.ConnectionFoldersBootstrap),
|
||||
() => import('./ConnectionForm/SSL/ConnectionSSLTabService.js').then(m => m.ConnectionSSLTabService),
|
||||
() => import('./PluginConnectionsSettingsService.js').then(m => m.PluginConnectionsSettingsService),
|
||||
() => import('./ConnectionForm/ConnectionFormServiceRefactored.js').then(m => m.ConnectionFormServiceRefactored),
|
||||
() => import('./ConnectionForm/ConnectionFormService.js').then(m => m.ConnectionFormService),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user