Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-5292 add separate group for advanced properties #2725

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* CloudBeaver - Cloud Database Manager
* Copyright (C) 2020-2024 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-lite';

import { Expandable, Group, InputField, useTranslate } from '@cloudbeaver/core-blocks';
import type { ConnectionConfig } from '@cloudbeaver/core-sdk';

const MAX_KEEP_ALIVE_INTERVAL = 32767;
const DEFAULT_CONFIG: ConnectionConfig = {
keepAliveInterval: 0,
};

interface Props {
config: ConnectionConfig;
disabled?: boolean;
readonly?: boolean;
}

export const AdvancedPropertiesForm = observer<Props>(function AdvancedPropertiesForm({ config, disabled, readonly }) {
const translate = useTranslate();

return (
<Group form gap>
<Expandable label={translate('ui_advanced_settings')}>
<InputField
type="number"
minLength={1}
min={0}
max={MAX_KEEP_ALIVE_INTERVAL}
name="keepAliveInterval"
disabled={disabled}
readOnly={readonly}
title={translate('connections_connection_keep_alive_tooltip')}
state={config}
defaultState={DEFAULT_CONFIG}
>
{translate('connections_connection_keep_alive')}
</InputField>
</Expandable>
</Group>
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { ConnectionAuthModelSelector } from '../ConnectionAuthModelCredentials/C
import { ConnectionFormService } from '../ConnectionFormService';
import type { IConnectionFormProps } from '../IConnectionFormProps';
import { CONNECTION_FORM_SHARED_CREDENTIALS_TAB_ID } from '../SharedCredentials/CONNECTION_FORM_SHARED_CREDENTIALS_TAB_ID';
import { AdvancedPropertiesForm } from './AdvancedPropertiesForm';
import { ConnectionOptionsTabService } from './ConnectionOptionsTabService';
import styles from './Options.module.css';
import { ParametersForm } from './ParametersForm';
Expand Down Expand Up @@ -338,6 +339,8 @@ export const Options: TabContainerPanelComponent<IConnectionFormProps> = observe
{driver?.providerProperties && (
<ProviderPropertiesForm config={config} properties={driver.providerProperties} disabled={disabled} readonly={readonly} />
)}

<AdvancedPropertiesForm config={config} disabled={disabled} readonly={readonly} />
</Container>
</ColoredContainer>
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
Expandable,
Group,
GroupTitle,
InputField,
ObjectPropertyInfoForm,
useObjectPropertyCategories,
useTranslate,
Expand All @@ -28,11 +27,6 @@ interface Props {
readonly?: boolean;
}

const MAX_KEEP_ALIVE_INTERVAL_IN_SECONDS = 32767;
const DEFAULT_CONFIG: ConnectionConfig = {
keepAliveInterval: 0,
};

export const ProviderPropertiesForm = observer<Props>(function ProviderPropertiesForm({ config, properties, disabled, readonly }) {
const translate = useTranslate();
const supportedProperties = properties.filter(property => property.supportedConfigurationTypes?.some(type => type === config.configurationType));
Expand Down Expand Up @@ -78,21 +72,6 @@ export const ProviderPropertiesForm = observer<Props>(function ProviderPropertie
</>
)}

<InputField
type="number"
minLength={1}
min={0}
max={MAX_KEEP_ALIVE_INTERVAL_IN_SECONDS}
name="keepAliveInterval"
disabled={disabled}
readOnly={readonly}
title={translate('connections_connection_keep_alive_tooltip')}
state={config}
defaultState={DEFAULT_CONFIG}
>
{translate('connections_connection_keep_alive')}
</InputField>

{categories.map((category, index) => (
<Container key={`${category}_${config.driverId}`} gap>
<Expandable label={category} defaultExpanded={index === 0}>
Expand Down
Loading