mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-13 07:47:05 +08:00
fix(core-connections): CB-481 remove extra styles, add separate URL check for new connection
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ import { observer } from 'mobx-react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import {
|
||||
TabsState, TabList, Loader,
|
||||
TabsState, TabList,
|
||||
Button, BORDER_TAB_STYLES, TabPanelList
|
||||
} from '@cloudbeaver/core-blocks';
|
||||
import { useController, useService } from '@cloudbeaver/core-di';
|
||||
|
||||
+6
-8
@@ -17,7 +17,6 @@ import { ConnectionConfig } from '@cloudbeaver/core-sdk';
|
||||
|
||||
import { DBDriver, DBDriverResource } from '../../../DBDriverResource';
|
||||
import { ConnectionsResource, isLocalConnection } from '../../ConnectionsResource';
|
||||
import { EConnectionType } from './EConnectionType';
|
||||
import { IConnectionFormModel } from './IConnectionFormModel';
|
||||
|
||||
@injectable()
|
||||
@@ -28,8 +27,11 @@ implements IInitializableController {
|
||||
|
||||
readonly afterSave: IExecutor<string>;
|
||||
|
||||
get connectionType(): EConnectionType {
|
||||
return this.model.connection.useUrl ? EConnectionType.URL : EConnectionType.Parameters;
|
||||
get isUrlConnection(): boolean {
|
||||
if (this.model.editing) {
|
||||
return this.model.connection.useUrl;
|
||||
}
|
||||
return !this.driver?.sampleURL;
|
||||
}
|
||||
|
||||
get isDisabled(): boolean {
|
||||
@@ -66,10 +68,6 @@ implements IInitializableController {
|
||||
this.close = close;
|
||||
}
|
||||
|
||||
setType = (type: EConnectionType): void => {
|
||||
this.model.connection.useUrl = type === EConnectionType.URL;
|
||||
};
|
||||
|
||||
save = async (): Promise<void> => {
|
||||
this.isSaving = true;
|
||||
try {
|
||||
@@ -115,7 +113,7 @@ implements IInitializableController {
|
||||
config.template = this.model.connection.template;
|
||||
config.driverId = this.model.connection.driverId;
|
||||
|
||||
if (this.connectionType === EConnectionType.Parameters) {
|
||||
if (!this.isUrlConnection) {
|
||||
if (!this.driver?.embedded) {
|
||||
config.host = this.model.connection.host;
|
||||
config.port = this.model.connection.port;
|
||||
|
||||
+2
-9
@@ -10,12 +10,10 @@ import { observer } from 'mobx-react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import {
|
||||
Radio,
|
||||
InputField,
|
||||
ObjectPropertyInfoForm,
|
||||
Textarea,
|
||||
InputGroup,
|
||||
RadioGroup,
|
||||
TabsState,
|
||||
TabPanel,
|
||||
Combobox,
|
||||
@@ -48,12 +46,6 @@ const styles = css`
|
||||
flex-direction: column;
|
||||
max-width: 630px;
|
||||
}
|
||||
connection-type {
|
||||
margin-left: 180px;
|
||||
}
|
||||
Radio {
|
||||
composes: theme-typography--body2 from global;
|
||||
}
|
||||
`;
|
||||
|
||||
export const Options = observer(function Options({
|
||||
@@ -64,6 +56,7 @@ export const Options = observer(function Options({
|
||||
const translate = useTranslate();
|
||||
const disabled = formController.isDisabled;
|
||||
const isOriginLocal = formController.local;
|
||||
const connectionType = formController.isUrlConnection ? EConnectionType.URL : EConnectionType.Parameters;
|
||||
|
||||
return styled(useStyles(styles))(
|
||||
<SubmittingForm onChange={controller.onFormChange} onSubmit={formController.save}>
|
||||
@@ -120,7 +113,7 @@ export const Options = observer(function Options({
|
||||
</FormGroup>
|
||||
</FormBoxElement>
|
||||
<FormBoxElement>
|
||||
<TabsState currentTabId={formController.connectionType}>
|
||||
<TabsState currentTabId={connectionType}>
|
||||
<TabPanel tabId={EConnectionType.Parameters}>
|
||||
<ParametersForm
|
||||
connection={model.connection}
|
||||
|
||||
Reference in New Issue
Block a user